@pega/cosmos-react-wss 8.0.0-build.9.1 → 8.0.1
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/lib/components/AppShell/AppShell.d.ts +2 -3
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +5 -5
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts +2 -1
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +7 -1
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +5 -1
- package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.types.js.map +1 -1
- package/lib/components/AppShell/MobileHeaderContent.js +1 -1
- package/lib/components/AppShell/MobileHeaderContent.js.map +1 -1
- package/lib/components/AppShell/NavLinks.d.ts +2 -2
- package/lib/components/AppShell/NavLinks.d.ts.map +1 -1
- package/lib/components/AppShell/NavLinks.js +1 -1
- package/lib/components/AppShell/NavLinks.js.map +1 -1
- package/lib/components/CaseView/CaseView.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.js +78 -16
- package/lib/components/CaseView/CaseView.js.map +1 -1
- package/lib/components/CaseView/CaseView.styles.d.ts +5 -2
- package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.styles.js +47 -27
- package/lib/components/CaseView/CaseView.styles.js.map +1 -1
- package/lib/components/CaseView/CaseView.types.d.ts +4 -0
- package/lib/components/CaseView/CaseView.types.d.ts.map +1 -1
- package/lib/components/CaseView/CaseView.types.js.map +1 -1
- package/lib/components/PageTemplates/BannerPage.d.ts +4 -4
- package/lib/components/PageTemplates/BannerPage.d.ts.map +1 -1
- package/lib/components/PageTemplates/BannerPage.js +16 -9
- package/lib/components/PageTemplates/BannerPage.js.map +1 -1
- package/lib/components/QuickCreate/QuickCreate.d.ts +5 -5
- package/lib/components/QuickCreate/QuickCreate.d.ts.map +1 -1
- package/lib/components/QuickCreate/QuickCreate.js +7 -4
- package/lib/components/QuickCreate/QuickCreate.js.map +1 -1
- package/package.json +10 -10
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ForwardProps } from '@pega/cosmos-react-core';
|
|
1
|
+
import type { ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';
|
|
3
2
|
import type { AppShellProps } from './AppShell.types';
|
|
4
|
-
declare const AppShell:
|
|
3
|
+
declare const AppShell: ForwardRefForwardPropsComponent<AppShellProps>;
|
|
5
4
|
export default AppShell;
|
|
6
5
|
//# sourceMappingURL=AppShell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.tsx"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,+BAA+B,EAAkB,MAAM,yBAAyB,CAAC;AAM/F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAetD,QAAA,MAAM,QAAQ,EAAE,+BAA+B,CAAC,aAAa,CAmS3D,CAAC;AAEH,eAAe,QAAQ,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { Avatar, Backdrop, Button, ThemeOverride, ContextSwitcher, debounce, Drawer, Flex, Icon, Image, Popover, SkipLinks, Text, useBreakpoint, useConsolidatedRef, useDirection, useElement, useI18n, useOuterEvent, useTheme } from '@pega/cosmos-react-core';
|
|
3
|
+
import { Avatar, Backdrop, Button, ThemeOverride, ContextSwitcher, debounce, Drawer, Flex, Icon, Image, Popover, SkipLinks, Text, useBreakpoint, useConsolidatedRef, useDirection, useElement, useI18n, useOuterEvent, useTheme, VisuallyHiddenText } from '@pega/cosmos-react-core';
|
|
4
4
|
import Operator from '@pega/cosmos-react-core/lib/components/AppShell/Operator';
|
|
5
5
|
import { StyledAppHeaderOperator } from '@pega/cosmos-react-core/lib/components/AppShell/AppHeader.styles';
|
|
6
6
|
import BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';
|
|
7
7
|
import { getHeaderTheme } from '@pega/cosmos-react-core/lib/components/AppShell/style-utils';
|
|
8
|
-
import { StyledAppHeader, StyledCountIcon, StyledHamburgerMenu, StyledMain, StyledNotificationCount, StyledPrimaryName, StyledEndNavBlock } from './AppShell.styles';
|
|
8
|
+
import { StyledAppHeader, StyledCountIcon, StyledHamburgerMenu, StyledMain, StyledNotificationCount, StyledPrimaryName, StyledEndNavBlock, StyledBannerRegion } from './AppShell.styles';
|
|
9
9
|
import Notifications from './Notifications';
|
|
10
10
|
import MobileHeaderContent from './MobileHeaderContent';
|
|
11
11
|
import NavLinks from './NavLinks';
|
|
12
12
|
const AppShell = forwardRef(function AppShell(props, ref) {
|
|
13
|
-
const { main, appInfo, navLinks, operator, notifications, contextSwitcher = {}, navAlignment = 'end', navPosition = 'inline' } = props;
|
|
13
|
+
const { main, banners, appInfo, navLinks, operator, notifications, contextSwitcher = {}, navAlignment = 'end', navPosition = 'inline' } = props;
|
|
14
14
|
const t = useI18n();
|
|
15
15
|
const { contexts, onContextClick, label: contextSwitcherLabel = t('switch_to') } = contextSwitcher;
|
|
16
16
|
const [backdropOpen, setBackdropOpen] = useState(false);
|
|
@@ -98,7 +98,7 @@ const AppShell = forwardRef(function AppShell(props, ref) {
|
|
|
98
98
|
openDrawer('notifications');
|
|
99
99
|
}
|
|
100
100
|
}, [hasMobileNav, drawerOpen]);
|
|
101
|
-
return (_jsxs(_Fragment, { children: [_jsx(SkipLinks, { items: skipLinks }), _jsx(ThemeOverride, { theme: headerTheme, children: _jsxs(StyledAppHeader, { ref: headerRef, navPosition: navPosition, children: [_jsxs(Flex, { container: { alignItems: 'center', justify: 'between' }, children: [contexts && onContextClick && contexts.length > 1 && (_jsx(ContextSwitcher, { contexts: contexts, onContextClick: onContextClick, label: contextSwitcherLabel, container: { justify: 'center', pad: [0, 0, 0, 1] } })), _jsxs(Flex, { as: appInfoAs, container: { alignItems: 'center', pad: [1, 4, 1, 1], gap: 1 }, href: appInfo.href, onClick: appInfo.onClick, target: appInfo.target, children: [_jsx(Image, { src: appInfo.imageSrc, alt: appInfo.appName }), !hasMobileNav && (_jsx(Text, { as: StyledPrimaryName, variant: 'h1', children: appInfo.appName }))] }), !hasMobileNav && navPosition === 'inline' && (_jsx(NavLinks, { ref: setNavSectionEl, navLinks: navLinks, navAlignment: navAlignment, navPosition: navPosition })), _jsxs(Flex, { as: StyledEndNavBlock, container: { alignItems: 'center' }, mobile: hasMobileNav, children: [notifications && (_jsxs(_Fragment, { children: [_jsx(Button, { ref: setNotificationsButtonEl, variant: 'simple', label: t('open_app_header_notifications'), icon: true, onClick: () => {
|
|
101
|
+
return (_jsxs(_Fragment, { children: [_jsx(SkipLinks, { items: skipLinks }), _jsx(ThemeOverride, { theme: headerTheme, children: _jsxs(StyledAppHeader, { ref: headerRef, navPosition: navPosition, children: [_jsxs(Flex, { container: { alignItems: 'center', justify: 'between' }, children: [contexts && onContextClick && contexts.length > 1 && (_jsx(ContextSwitcher, { contexts: contexts, onContextClick: onContextClick, label: contextSwitcherLabel, container: { justify: 'center', pad: [0, 0, 0, 1] } })), _jsxs(Flex, { as: appInfoAs, container: { alignItems: 'center', pad: [1, 4, 1, 1], gap: 1 }, href: appInfo.href, onClick: appInfo.onClick, target: appInfo.target, children: [_jsx(Image, { src: appInfo.imageSrc, alt: appInfo.appName }), !hasMobileNav && (_jsx(Text, { as: appInfo.appNameHidden ? VisuallyHiddenText : StyledPrimaryName, variant: 'h1', children: appInfo.appName }))] }), !hasMobileNav && navPosition === 'inline' && (_jsx(NavLinks, { ref: setNavSectionEl, navLinks: navLinks, navAlignment: navAlignment, navPosition: navPosition })), _jsxs(Flex, { as: StyledEndNavBlock, container: { alignItems: 'center' }, mobile: hasMobileNav, children: [notifications && (_jsxs(_Fragment, { children: [_jsx(Button, { ref: setNotificationsButtonEl, variant: 'simple', label: t('open_app_header_notifications'), icon: true, onClick: () => {
|
|
102
102
|
if (!hasMobileNav) {
|
|
103
103
|
if (notificationsPopover) {
|
|
104
104
|
setNotificationsPopover(false);
|
|
@@ -112,7 +112,7 @@ const AppShell = forwardRef(function AppShell(props, ref) {
|
|
|
112
112
|
else {
|
|
113
113
|
openDrawer('notifications');
|
|
114
114
|
}
|
|
115
|
-
}, children: _jsxs(StyledNotificationCount, { children: [_jsx(Icon, { name: 'bell' }), !!notifications.count && (_jsx(StyledCountIcon, { variant: 'urgent', children: notifications.count }))] }) }), _jsx(Popover, { ref: setPopoverEl, show: notificationsPopover, target: notificationsButtonEl, placement: 'bottom-end', children: _jsx(Notifications, { ...notifications, popover: true }) })] })), !hasMobileNav && (_jsx(Operator, { as: StyledAppHeaderOperator, actions: operator.actions, popover: { placement: 'bottom-start' }, children: _jsx(Avatar, { ...operator.avatar }) })), hasMobileNav && (_jsx(Button, { as: StyledHamburgerMenu, label: t('open_app_header_drawer'), variant: 'simple', icon: true, onClick: () => openDrawer('navigationOperator'), children: _jsx(Icon, { name: 'bars' }) }))] })] }), !hasMobileNav && navPosition === 'below' && (_jsx(NavLinks, { ref: setNavSectionEl, navLinks: navLinks, navAlignment: navAlignment, navPosition: navPosition }))] }) }),
|
|
115
|
+
}, children: _jsxs(StyledNotificationCount, { children: [_jsx(Icon, { name: 'bell' }), !!notifications.count && (_jsx(StyledCountIcon, { variant: 'urgent', children: notifications.count }))] }) }), _jsx(Popover, { ref: setPopoverEl, show: notificationsPopover, target: notificationsButtonEl, placement: 'bottom-end', children: _jsx(Notifications, { ...notifications, popover: true }) })] })), !hasMobileNav && (_jsx(Operator, { as: StyledAppHeaderOperator, actions: operator.actions, popover: { placement: 'bottom-start' }, name: operator.avatar.name, children: _jsx(Avatar, { ...operator.avatar }) })), hasMobileNav && (_jsx(Button, { as: StyledHamburgerMenu, label: t('open_app_header_drawer'), variant: 'simple', icon: true, onClick: () => openDrawer('navigationOperator'), children: _jsx(Icon, { name: 'bars' }) }))] })] }), !hasMobileNav && navPosition === 'below' && (_jsx(NavLinks, { ref: setNavSectionEl, navLinks: navLinks, navAlignment: navAlignment, navPosition: navPosition }))] }) }), _jsxs(StyledMain, { navPosition: navPosition, children: [banners && _jsx(StyledBannerRegion, { children: banners }), main] }), _jsx(Backdrop, { open: backdropOpen, transitionSpeed: 'none', onAfterTransitionIn: () => setDrawerOpen(true), onBeforeTransitionOut: () => setDrawerOpen(false), onClick: e => {
|
|
116
116
|
if (e.currentTarget === e.target)
|
|
117
117
|
setDrawerOpen(false);
|
|
118
118
|
}, children: _jsxs(Drawer, { open: drawerOpen, onAfterClose: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGzE,OAAO,EACL,MAAM,EACN,QAAQ,EACR,MAAM,EACN,aAAa,EACb,eAAe,EACf,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,OAAO,EACP,SAAS,EACT,IAAI,EACJ,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,OAAO,EACP,aAAa,EACb,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAEjC,OAAO,QAAQ,MAAM,0DAA0D,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,kEAAkE,CAAC;AAC3G,OAAO,UAAU,MAAM,0DAA0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aAAa,OAAK,aAAa,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GAAI,CAC1E,EACA,aAAa,KAAK,oBAAoB,IAAI,CACzC,KAAC,mBAAmB,IAClB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GACnC,CACH,IACM,GACA,IACV,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { forwardRef, useEffect, useMemo, useRef, useState } from 'react';\nimport type { ElementType, FunctionComponent, PropsWithoutRef } from 'react';\n\nimport {\n Avatar,\n Backdrop,\n Button,\n ThemeOverride,\n ContextSwitcher,\n debounce,\n Drawer,\n Flex,\n Icon,\n Image,\n Popover,\n SkipLinks,\n Text,\n useBreakpoint,\n useConsolidatedRef,\n useDirection,\n useElement,\n useI18n,\n useOuterEvent,\n useTheme\n} from '@pega/cosmos-react-core';\nimport type { ForwardProps, SkipLinksProps } from '@pega/cosmos-react-core';\nimport Operator from '@pega/cosmos-react-core/lib/components/AppShell/Operator';\nimport { StyledAppHeaderOperator } from '@pega/cosmos-react-core/lib/components/AppShell/AppHeader.styles';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\nimport { getHeaderTheme } from '@pega/cosmos-react-core/lib/components/AppShell/style-utils';\n\nimport type { AppShellProps } from './AppShell.types';\nimport {\n StyledAppHeader,\n StyledCountIcon,\n StyledHamburgerMenu,\n StyledMain,\n StyledNotificationCount,\n StyledPrimaryName,\n StyledEndNavBlock\n} from './AppShell.styles';\nimport Notifications from './Notifications';\nimport MobileHeaderContent from './MobileHeaderContent';\nimport NavLinks from './NavLinks';\n\nconst AppShell: FunctionComponent<AppShellProps & ForwardProps> = forwardRef(function AppShell(\n props: PropsWithoutRef<AppShellProps>,\n ref: AppShellProps['ref']\n) {\n const {\n main,\n appInfo,\n navLinks,\n operator,\n notifications,\n contextSwitcher = {},\n navAlignment = 'end',\n navPosition = 'inline'\n } = props;\n const t = useI18n();\n const {\n contexts,\n onContextClick,\n label: contextSwitcherLabel = t('switch_to')\n } = contextSwitcher;\n const [backdropOpen, setBackdropOpen] = useState(false);\n const [drawerOpen, setDrawerOpen] = useState(false);\n const [drawerContent, setDrawerContent] = useState('');\n const [notificationsPopover, setNotificationsPopover] = useState(false);\n const [linksCollapsed, setLinksCollapsed] = useState(false);\n const [hasMobileNav, setHasMobileNav] = useState(true);\n\n const [headerEl, setHeaderEl] = useElement<HTMLElement>();\n const [navSectionEl, setNavSectionEl] = useElement<HTMLDivElement>();\n const [popoverEl, setPopoverEl] = useElement<HTMLDivElement>();\n const [notificationsButtonEl, setNotificationsButtonEl] = useElement<HTMLButtonElement>();\n const minInlineWidth = useRef(0);\n const theme = useTheme();\n const headerTheme = useMemo(() => getHeaderTheme(theme), [theme]);\n\n const headerRef = useConsolidatedRef(setHeaderEl, ref);\n\n const isSmallOrAbove = useBreakpoint('sm');\n const { end } = useDirection();\n\n let appInfoAs: ElementType = 'div';\n if (appInfo.href) appInfoAs = 'a';\n else if (appInfo.onClick) appInfoAs = BareButton;\n\n const skipLinks: SkipLinksProps['items'] = useMemo(\n () => [\n {\n label: t('go_to_main_content'),\n target: { ariaLabel: t('main_content'), selector: 'main' }\n }\n ],\n [t]\n );\n\n const closeDrawer = () => {\n setDrawerContent('');\n setBackdropOpen(false);\n };\n\n const openDrawer = (content: 'notifications' | 'navigationOperator') => {\n setDrawerContent(content);\n setBackdropOpen(true);\n };\n\n useOuterEvent('mousedown', [popoverEl, notificationsButtonEl], () => {\n setNotificationsPopover(false);\n notifications?.onNotificationsClose?.();\n });\n\n const debouncedResize = debounce((entries: ResizeObserverEntry[]) => {\n if (entries[0].contentRect.width > minInlineWidth.current) {\n setLinksCollapsed(false);\n }\n }, 100);\n\n useEffect(() => {\n const resizeObserver = new ResizeObserver(debouncedResize);\n\n const intersectionObserver = new IntersectionObserver(\n entries => {\n if (\n entries[0].intersectionRatio > 0 &&\n entries[0].intersectionRatio < 1 &&\n !linksCollapsed\n ) {\n if (headerEl) minInlineWidth.current = headerEl.clientWidth + 1;\n setLinksCollapsed(true);\n } else if (navSectionEl) navSectionEl.style.visibility = 'visible';\n },\n { root: navPosition === 'below' ? null : navSectionEl, threshold: 1 }\n );\n\n if (headerEl && navSectionEl?.firstChild && navSectionEl?.lastChild) {\n intersectionObserver.observe(\n navAlignment === 'start'\n ? (navSectionEl.lastChild as Element)\n : (navSectionEl.firstChild as Element)\n );\n resizeObserver.observe(headerEl);\n }\n\n return () => {\n if (!headerEl) {\n intersectionObserver.disconnect();\n resizeObserver.disconnect();\n }\n };\n }, [headerEl, navSectionEl, navLinks]);\n\n useEffect(() => {\n setHasMobileNav(!isSmallOrAbove || linksCollapsed);\n }, [isSmallOrAbove, linksCollapsed]);\n\n useEffect(() => {\n if (!hasMobileNav && drawerOpen) {\n if (drawerContent === 'notifications' && notifications) {\n setNotificationsPopover(true);\n }\n setDrawerOpen(false);\n } else if (hasMobileNav && notificationsPopover) {\n setNotificationsPopover(false);\n openDrawer('notifications');\n }\n }, [hasMobileNav, drawerOpen]);\n\n return (\n <>\n <SkipLinks items={skipLinks} />\n <ThemeOverride theme={headerTheme}>\n <StyledAppHeader ref={headerRef} navPosition={navPosition}>\n <Flex container={{ alignItems: 'center', justify: 'between' }}>\n {contexts && onContextClick && contexts.length > 1 && (\n <ContextSwitcher\n contexts={contexts}\n onContextClick={onContextClick}\n label={contextSwitcherLabel}\n container={{ justify: 'center', pad: [0, 0, 0, 1] }}\n />\n )}\n\n <Flex\n as={appInfoAs}\n container={{ alignItems: 'center', pad: [1, 4, 1, 1], gap: 1 }}\n href={appInfo.href}\n onClick={appInfo.onClick}\n target={appInfo.target}\n >\n <Image src={appInfo.imageSrc} alt={appInfo.appName} />\n {!hasMobileNav && (\n <Text as={StyledPrimaryName} variant='h1'>\n {appInfo.appName}\n </Text>\n )}\n </Flex>\n\n {!hasMobileNav && navPosition === 'inline' && (\n <NavLinks\n ref={setNavSectionEl}\n navLinks={navLinks}\n navAlignment={navAlignment}\n navPosition={navPosition}\n />\n )}\n\n <Flex as={StyledEndNavBlock} container={{ alignItems: 'center' }} mobile={hasMobileNav}>\n {notifications && (\n <>\n <Button\n ref={setNotificationsButtonEl}\n variant='simple'\n label={t('open_app_header_notifications')}\n icon\n onClick={() => {\n if (!hasMobileNav) {\n if (notificationsPopover) {\n setNotificationsPopover(false);\n notifications.onNotificationsClose?.();\n } else {\n setNotificationsPopover(true);\n notifications.onNotificationsOpen?.();\n }\n } else {\n openDrawer('notifications');\n }\n }}\n >\n <StyledNotificationCount>\n <Icon name='bell' />\n {!!notifications.count && (\n <StyledCountIcon variant='urgent'>{notifications.count}</StyledCountIcon>\n )}\n </StyledNotificationCount>\n </Button>\n <Popover\n ref={setPopoverEl}\n show={notificationsPopover}\n target={notificationsButtonEl}\n placement='bottom-end'\n >\n <Notifications {...notifications} popover />\n </Popover>\n </>\n )}\n\n {!hasMobileNav && (\n <Operator\n as={StyledAppHeaderOperator}\n actions={operator.actions}\n popover={{ placement: 'bottom-start' }}\n >\n <Avatar {...operator.avatar} />\n </Operator>\n )}\n\n {hasMobileNav && (\n <Button\n as={StyledHamburgerMenu}\n label={t('open_app_header_drawer')}\n variant='simple'\n icon\n onClick={() => openDrawer('navigationOperator')}\n >\n <Icon name='bars' />\n </Button>\n )}\n </Flex>\n </Flex>\n\n {!hasMobileNav && navPosition === 'below' && (\n <NavLinks\n ref={setNavSectionEl}\n navLinks={navLinks}\n navAlignment={navAlignment}\n navPosition={navPosition}\n />\n )}\n </StyledAppHeader>\n </ThemeOverride>\n <StyledMain navPosition={navPosition}>{main}</StyledMain>\n\n <Backdrop\n open={backdropOpen}\n transitionSpeed='none'\n onAfterTransitionIn={() => setDrawerOpen(true)}\n onBeforeTransitionOut={() => setDrawerOpen(false)}\n onClick={e => {\n if (e.currentTarget === e.target) setDrawerOpen(false);\n }}\n >\n <Drawer\n open={drawerOpen}\n onAfterClose={() => {\n closeDrawer();\n if (drawerContent === 'notifications') {\n notifications?.onNotificationsClose?.();\n }\n }}\n onAfterOpen={() => {\n if (drawerContent === 'notifications') {\n notifications?.onNotificationsOpen?.();\n }\n }}\n position='fixed'\n placement={end}\n size='min(26rem, calc(100vw - 5rem))'\n nullWhenClosed\n >\n {drawerContent === 'notifications' && notifications && (\n <Notifications {...notifications} onClose={() => setDrawerOpen(false)} />\n )}\n {drawerContent === 'navigationOperator' && (\n <MobileHeaderContent\n appInfo={appInfo}\n navLinks={navLinks}\n operator={operator}\n onClose={() => setDrawerOpen(false)}\n />\n )}\n </Drawer>\n </Backdrop>\n </>\n );\n});\n\nexport default AppShell;\n"]}
|
|
1
|
+
{"version":3,"file":"AppShell.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGzE,OAAO,EACL,MAAM,EACN,QAAQ,EACR,MAAM,EACN,aAAa,EACb,eAAe,EACf,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,OAAO,EACP,SAAS,EACT,IAAI,EACJ,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,OAAO,EACP,aAAa,EACb,QAAQ,EACR,kBAAkB,EACnB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,QAAQ,MAAM,0DAA0D,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,kEAAkE,CAAC;AAC3G,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,6DAA6D,CAAC;AAG7F,OAAO,EACL,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,uBAAuB,EACvB,iBAAiB,EACjB,iBAAi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AAI,aAAa,IAAI,CACrD,KAAC,aAAa,OAAK,aAAa,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GAAI,CAC1E,EACA,aAAa,KAAK,oBAAoB,IAAI,CACzC,KAAC,mBAAmB,IAClB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GACnC,CACH,IACM,GACA,IACV,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { forwardRef, useEffect, useMemo, useRef, useState } from 'react';\nimport type { ElementType, PropsWithoutRef } from 'react';\n\nimport {\n Avatar,\n Backdrop,\n Button,\n ThemeOverride,\n ContextSwitcher,\n debounce,\n Drawer,\n Flex,\n Icon,\n Image,\n Popover,\n SkipLinks,\n Text,\n useBreakpoint,\n useConsolidatedRef,\n useDirection,\n useElement,\n useI18n,\n useOuterEvent,\n useTheme,\n VisuallyHiddenText\n} from '@pega/cosmos-react-core';\nimport type { ForwardRefForwardPropsComponent, SkipLinksProps } from '@pega/cosmos-react-core';\nimport Operator from '@pega/cosmos-react-core/lib/components/AppShell/Operator';\nimport { StyledAppHeaderOperator } from '@pega/cosmos-react-core/lib/components/AppShell/AppHeader.styles';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\nimport { getHeaderTheme } from '@pega/cosmos-react-core/lib/components/AppShell/style-utils';\n\nimport type { AppShellProps } from './AppShell.types';\nimport {\n StyledAppHeader,\n StyledCountIcon,\n StyledHamburgerMenu,\n StyledMain,\n StyledNotificationCount,\n StyledPrimaryName,\n StyledEndNavBlock,\n StyledBannerRegion\n} from './AppShell.styles';\nimport Notifications from './Notifications';\nimport MobileHeaderContent from './MobileHeaderContent';\nimport NavLinks from './NavLinks';\n\nconst AppShell: ForwardRefForwardPropsComponent<AppShellProps> = forwardRef(function AppShell(\n props: PropsWithoutRef<AppShellProps>,\n ref: AppShellProps['ref']\n) {\n const {\n main,\n banners,\n appInfo,\n navLinks,\n operator,\n notifications,\n contextSwitcher = {},\n navAlignment = 'end',\n navPosition = 'inline'\n } = props;\n const t = useI18n();\n const {\n contexts,\n onContextClick,\n label: contextSwitcherLabel = t('switch_to')\n } = contextSwitcher;\n const [backdropOpen, setBackdropOpen] = useState(false);\n const [drawerOpen, setDrawerOpen] = useState(false);\n const [drawerContent, setDrawerContent] = useState('');\n const [notificationsPopover, setNotificationsPopover] = useState(false);\n const [linksCollapsed, setLinksCollapsed] = useState(false);\n const [hasMobileNav, setHasMobileNav] = useState(true);\n\n const [headerEl, setHeaderEl] = useElement<HTMLElement>();\n const [navSectionEl, setNavSectionEl] = useElement<HTMLDivElement>();\n const [popoverEl, setPopoverEl] = useElement<HTMLDivElement>();\n const [notificationsButtonEl, setNotificationsButtonEl] = useElement<HTMLButtonElement>();\n const minInlineWidth = useRef(0);\n const theme = useTheme();\n const headerTheme = useMemo(() => getHeaderTheme(theme), [theme]);\n\n const headerRef = useConsolidatedRef(setHeaderEl, ref);\n\n const isSmallOrAbove = useBreakpoint('sm');\n const { end } = useDirection();\n\n let appInfoAs: ElementType = 'div';\n if (appInfo.href) appInfoAs = 'a';\n else if (appInfo.onClick) appInfoAs = BareButton;\n\n const skipLinks: SkipLinksProps['items'] = useMemo(\n () => [\n {\n label: t('go_to_main_content'),\n target: { ariaLabel: t('main_content'), selector: 'main' }\n }\n ],\n [t]\n );\n\n const closeDrawer = () => {\n setDrawerContent('');\n setBackdropOpen(false);\n };\n\n const openDrawer = (content: 'notifications' | 'navigationOperator') => {\n setDrawerContent(content);\n setBackdropOpen(true);\n };\n\n useOuterEvent('mousedown', [popoverEl, notificationsButtonEl], () => {\n setNotificationsPopover(false);\n notifications?.onNotificationsClose?.();\n });\n\n const debouncedResize = debounce((entries: ResizeObserverEntry[]) => {\n if (entries[0].contentRect.width > minInlineWidth.current) {\n setLinksCollapsed(false);\n }\n }, 100);\n\n useEffect(() => {\n const resizeObserver = new ResizeObserver(debouncedResize);\n\n const intersectionObserver = new IntersectionObserver(\n entries => {\n if (\n entries[0].intersectionRatio > 0 &&\n entries[0].intersectionRatio < 1 &&\n !linksCollapsed\n ) {\n if (headerEl) minInlineWidth.current = headerEl.clientWidth + 1;\n setLinksCollapsed(true);\n } else if (navSectionEl) navSectionEl.style.visibility = 'visible';\n },\n { root: navPosition === 'below' ? null : navSectionEl, threshold: 1 }\n );\n\n if (headerEl && navSectionEl?.firstChild && navSectionEl?.lastChild) {\n intersectionObserver.observe(\n navAlignment === 'start'\n ? (navSectionEl.lastChild as Element)\n : (navSectionEl.firstChild as Element)\n );\n resizeObserver.observe(headerEl);\n }\n\n return () => {\n if (!headerEl) {\n intersectionObserver.disconnect();\n resizeObserver.disconnect();\n }\n };\n }, [headerEl, navSectionEl, navLinks]);\n\n useEffect(() => {\n setHasMobileNav(!isSmallOrAbove || linksCollapsed);\n }, [isSmallOrAbove, linksCollapsed]);\n\n useEffect(() => {\n if (!hasMobileNav && drawerOpen) {\n if (drawerContent === 'notifications' && notifications) {\n setNotificationsPopover(true);\n }\n setDrawerOpen(false);\n } else if (hasMobileNav && notificationsPopover) {\n setNotificationsPopover(false);\n openDrawer('notifications');\n }\n }, [hasMobileNav, drawerOpen]);\n\n return (\n <>\n <SkipLinks items={skipLinks} />\n <ThemeOverride theme={headerTheme}>\n <StyledAppHeader ref={headerRef} navPosition={navPosition}>\n <Flex container={{ alignItems: 'center', justify: 'between' }}>\n {contexts && onContextClick && contexts.length > 1 && (\n <ContextSwitcher\n contexts={contexts}\n onContextClick={onContextClick}\n label={contextSwitcherLabel}\n container={{ justify: 'center', pad: [0, 0, 0, 1] }}\n />\n )}\n\n <Flex\n as={appInfoAs}\n container={{ alignItems: 'center', pad: [1, 4, 1, 1], gap: 1 }}\n href={appInfo.href}\n onClick={appInfo.onClick}\n target={appInfo.target}\n >\n <Image src={appInfo.imageSrc} alt={appInfo.appName} />\n {!hasMobileNav && (\n <Text\n as={appInfo.appNameHidden ? VisuallyHiddenText : StyledPrimaryName}\n variant='h1'\n >\n {appInfo.appName}\n </Text>\n )}\n </Flex>\n\n {!hasMobileNav && navPosition === 'inline' && (\n <NavLinks\n ref={setNavSectionEl}\n navLinks={navLinks}\n navAlignment={navAlignment}\n navPosition={navPosition}\n />\n )}\n\n <Flex as={StyledEndNavBlock} container={{ alignItems: 'center' }} mobile={hasMobileNav}>\n {notifications && (\n <>\n <Button\n ref={setNotificationsButtonEl}\n variant='simple'\n label={t('open_app_header_notifications')}\n icon\n onClick={() => {\n if (!hasMobileNav) {\n if (notificationsPopover) {\n setNotificationsPopover(false);\n notifications.onNotificationsClose?.();\n } else {\n setNotificationsPopover(true);\n notifications.onNotificationsOpen?.();\n }\n } else {\n openDrawer('notifications');\n }\n }}\n >\n <StyledNotificationCount>\n <Icon name='bell' />\n {!!notifications.count && (\n <StyledCountIcon variant='urgent'>{notifications.count}</StyledCountIcon>\n )}\n </StyledNotificationCount>\n </Button>\n <Popover\n ref={setPopoverEl}\n show={notificationsPopover}\n target={notificationsButtonEl}\n placement='bottom-end'\n >\n <Notifications {...notifications} popover />\n </Popover>\n </>\n )}\n\n {!hasMobileNav && (\n <Operator\n as={StyledAppHeaderOperator}\n actions={operator.actions}\n popover={{ placement: 'bottom-start' }}\n name={operator.avatar.name}\n >\n <Avatar {...operator.avatar} />\n </Operator>\n )}\n\n {hasMobileNav && (\n <Button\n as={StyledHamburgerMenu}\n label={t('open_app_header_drawer')}\n variant='simple'\n icon\n onClick={() => openDrawer('navigationOperator')}\n >\n <Icon name='bars' />\n </Button>\n )}\n </Flex>\n </Flex>\n\n {!hasMobileNav && navPosition === 'below' && (\n <NavLinks\n ref={setNavSectionEl}\n navLinks={navLinks}\n navAlignment={navAlignment}\n navPosition={navPosition}\n />\n )}\n </StyledAppHeader>\n </ThemeOverride>\n\n <StyledMain navPosition={navPosition}>\n {banners && <StyledBannerRegion>{banners}</StyledBannerRegion>}\n {main}\n </StyledMain>\n\n <Backdrop\n open={backdropOpen}\n transitionSpeed='none'\n onAfterTransitionIn={() => setDrawerOpen(true)}\n onBeforeTransitionOut={() => setDrawerOpen(false)}\n onClick={e => {\n if (e.currentTarget === e.target) setDrawerOpen(false);\n }}\n >\n <Drawer\n open={drawerOpen}\n onAfterClose={() => {\n closeDrawer();\n if (drawerContent === 'notifications') {\n notifications?.onNotificationsClose?.();\n }\n }}\n onAfterOpen={() => {\n if (drawerContent === 'notifications') {\n notifications?.onNotificationsOpen?.();\n }\n }}\n position='fixed'\n placement={end}\n size='min(26rem, calc(100vw - 5rem))'\n nullWhenClosed\n >\n {drawerContent === 'notifications' && notifications && (\n <Notifications {...notifications} onClose={() => setDrawerOpen(false)} />\n )}\n {drawerContent === 'navigationOperator' && (\n <MobileHeaderContent\n appInfo={appInfo}\n navLinks={navLinks}\n operator={operator}\n onClose={() => setDrawerOpen(false)}\n />\n )}\n </Drawer>\n </Backdrop>\n </>\n );\n});\n\nexport default AppShell;\n"]}
|
|
@@ -25,7 +25,7 @@ export declare const StyledNotifications: import("styled-components").StyledComp
|
|
|
25
25
|
popover?: boolean;
|
|
26
26
|
}, never>;
|
|
27
27
|
export declare const StyledNotificationList: import("styled-components").StyledComponent<"ul", import("styled-components").DefaultTheme, {}, never>;
|
|
28
|
-
export declare const StyledNotification: import("styled-components").StyledComponent<import("react").
|
|
28
|
+
export declare const StyledNotification: import("styled-components").StyledComponent<import("@pega/cosmos-react-core").ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core/lib/components/Button/BareButton").BareButtonProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
29
29
|
export declare const StyledNotificationVisual: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
|
|
30
30
|
unread?: boolean;
|
|
31
31
|
}, never>;
|
|
@@ -35,4 +35,5 @@ export declare const StyledNotificationPrimary: import("styled-components").Styl
|
|
|
35
35
|
export declare const StyledNotificationSecondary: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
|
|
36
36
|
unread?: boolean;
|
|
37
37
|
}, never>;
|
|
38
|
+
export declare const StyledBannerRegion: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
38
39
|
//# sourceMappingURL=AppShell.styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.styles.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKtD,eAAO,MAAM,SAAS,yGAUrB,CAAC;AAEF,eAAO,MAAM,eAAe;iBAAgC,aAAa,CAAC,aAAa,CAAC;SA0CvF,CAAC;AAIF,eAAO,MAAM,iBAAiB,0GAY5B,CAAC;AAIH,eAAO,MAAM,iBAAiB;YAAwB,OAAO;SAO3D,CAAC;AAEH,eAAO,MAAM,UAAU,uGAyCrB,CAAC;AAIH,eAAO,MAAM,UAAU;iBAA8B,aAAa,CAAC,aAAa,CAAC;SAehF,CAAC;AAIF,eAAO,MAAM,mBAAmB,4GAI9B,CAAC;AAIH,eAAO,MAAM,eAAe,yGAK1B,CAAC;AAIH,eAAO,MAAM,gBAAgB,uGAmC3B,CAAC;AAIH,eAAO,MAAM,iBAAiB,yGAE7B,CAAC;AAEF,eAAO,MAAM,qBAAqB,yGAGjC,CAAC;AAEF,eAAO,MAAM,eAAe,yGAU1B,CAAC;AAIH,eAAO,MAAM,uBAAuB,0GAEnC,CAAC;AAEF,eAAO,MAAM,eAAe;2BA1NjB,CAAC,oEAAmC,yBAAY;uDA0OzD,CAAC;AAEH,eAAO,MAAM,mBAAmB;cAA0B,OAAO;SAW/D,CAAC;AAIH,eAAO,MAAM,sBAAsB,wGAQjC,CAAC;AAIH,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"AppShell.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.styles.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKtD,eAAO,MAAM,SAAS,yGAUrB,CAAC;AAEF,eAAO,MAAM,eAAe;iBAAgC,aAAa,CAAC,aAAa,CAAC;SA0CvF,CAAC;AAIF,eAAO,MAAM,iBAAiB,0GAY5B,CAAC;AAIH,eAAO,MAAM,iBAAiB;YAAwB,OAAO;SAO3D,CAAC;AAEH,eAAO,MAAM,UAAU,uGAyCrB,CAAC;AAIH,eAAO,MAAM,UAAU;iBAA8B,aAAa,CAAC,aAAa,CAAC;SAehF,CAAC;AAIF,eAAO,MAAM,mBAAmB,4GAI9B,CAAC;AAIH,eAAO,MAAM,eAAe,yGAK1B,CAAC;AAIH,eAAO,MAAM,gBAAgB,uGAmC3B,CAAC;AAIH,eAAO,MAAM,iBAAiB,yGAE7B,CAAC;AAEF,eAAO,MAAM,qBAAqB,yGAGjC,CAAC;AAEF,eAAO,MAAM,eAAe,yGAU1B,CAAC;AAIH,eAAO,MAAM,uBAAuB,0GAEnC,CAAC;AAEF,eAAO,MAAM,eAAe;2BA1NjB,CAAC,oEAAmC,yBAAY;uDA0OzD,CAAC;AAEH,eAAO,MAAM,mBAAmB;cAA0B,OAAO;SAW/D,CAAC;AAIH,eAAO,MAAM,sBAAsB,wGAQjC,CAAC;AAIH,eAAO,MAAM,kBAAkB,yPA0B7B,CAAC;AAIH,eAAO,MAAM,wBAAwB;aAA0B,OAAO;SAiBpE,CAAC;AAIH,eAAO,MAAM,yBAAyB;aAA0B,OAAO;SAMrE,CAAC;AAIH,eAAO,MAAM,2BAA2B;aAA0B,OAAO;SAUxE,CAAC;AAIF,eAAO,MAAM,kBAAkB,yGAI7B,CAAC"}
|
|
@@ -127,7 +127,7 @@ export const StyledMain = styled.main(({ navPosition, theme }) => {
|
|
|
127
127
|
--appshell-horizontal-offset: 0;
|
|
128
128
|
position: relative;
|
|
129
129
|
min-height: calc(100vh - ${calculatedHeaderHeight});
|
|
130
|
-
background-color: ${theme.base.palette['
|
|
130
|
+
background-color: ${theme.base.palette['app-background']};
|
|
131
131
|
|
|
132
132
|
:focus {
|
|
133
133
|
outline: none;
|
|
@@ -300,4 +300,10 @@ export const StyledNotificationSecondary = styled.span(({ theme, unread }) => {
|
|
|
300
300
|
`;
|
|
301
301
|
});
|
|
302
302
|
StyledNotificationSecondary.defaultProps = defaultThemeProp;
|
|
303
|
+
export const StyledBannerRegion = styled.div(({ theme }) => {
|
|
304
|
+
return css `
|
|
305
|
+
padding: calc(2 * ${theme.base.spacing});
|
|
306
|
+
`;
|
|
307
|
+
});
|
|
308
|
+
StyledBannerRegion.defaultProps = defaultThemeProp;
|
|
303
309
|
//# sourceMappingURL=AppShell.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.styles.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,iBAAiB,EACjB,KAAK,EACL,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,QAAQ,EACT,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,kEAAkE,CAAC;AAC3G,OAAO,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAC;AAClF,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAIlF,MAAM,YAAY,GAAG,MAAM,CAAC;AAC5B,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEhC,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;CAUlC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAC1C,CAAC,EAAE,WAAW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AAI,CAAuB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE;IAC9F,OAAO,GAAG,CAAA;;MAEN,WAAW;;;;0BAIS,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW;;;;QAIhD,CAAC,MAAM;QACT,GAAG,CAAA;;OAEF;;GAEJ,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,wBAAwB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEzD,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC,IAAI,CAAuB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE;IAC/F,OAAO,GAAG,CAAA;mBACO,MAAM;QACnB,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,IAAI;QAChC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC;GAC3C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,yBAAyB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE1D,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC,IAAI,CACpD,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE;IACpB,OAAO,GAAG,CAAA;QACN,UAAU;mBACC,MAAM;QACf,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC;QAC1C,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC;;KAE/C,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,2BAA2B,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import { lighten, mix } from 'polished';\nimport styled, { css } from 'styled-components';\n\nimport {\n calculateFontSize,\n Count,\n defaultThemeProp,\n StyledFlex,\n StyledImage,\n StyledText,\n StyledVisual,\n tryCatch\n} from '@pega/cosmos-react-core';\nimport { StyledAppHeaderOperator } from '@pega/cosmos-react-core/lib/components/AppShell/AppHeader.styles';\nimport { StyledAlert } from '@pega/cosmos-react-core/lib/components/Badges/Alert';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\n\nimport type { AppShellProps } from './AppShell.types';\n\nconst headerHeight = '3rem';\nconst tallHeaderHeight = '6rem';\n\nexport const StyledNav = styled.nav`\n white-space: nowrap;\n overflow: visible;\n visibility: hidden;\n height: 100%;\n\n a:hover,\n button:hover {\n text-decoration: none;\n }\n`;\n\nexport const StyledAppHeader = styled.header<{ navPosition: AppShellProps['navPosition'] }>(\n ({ navPosition, theme }) => {\n return css`\n position: sticky;\n inset-block-start: 0;\n height: ${navPosition === 'below' ? tallHeaderHeight : headerHeight};\n width: 100%;\n background-color: ${theme.base.palette['primary-background']};\n z-index: calc(${theme.base['z-index'].popover} + 1);\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n color: ${theme.base.palette['foreground-color']};\n\n ${StyledImage} {\n height: 1.625rem;\n }\n\n & > ${StyledFlex} {\n height: ${headerHeight};\n\n ${StyledAppHeaderOperator} {\n margin: ${theme.base.spacing};\n }\n\n & > a,\n & > button {\n cursor: pointer;\n text-decoration: none;\n user-select: none;\n -webkit-user-select: none;\n min-height: ${headerHeight};\n\n &:focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n }\n }\n\n & > ${StyledNav} {\n height: calc(${tallHeaderHeight} - ${headerHeight});\n }\n `;\n }\n);\n\nStyledAppHeader.defaultProps = defaultThemeProp;\n\nexport const StyledPrimaryName = styled.span(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n color: ${theme.base.palette['foreground-color']};\n font-size: ${fontSize.xxl};\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: block;\n max-width: 50ch;\n `;\n});\n\nStyledPrimaryName.defaultProps = defaultThemeProp;\n\nexport const StyledEndNavBlock = styled.div<{ mobile: boolean }>(({ mobile }) => {\n return (\n mobile &&\n css`\n margin-inline-start: auto;\n `\n );\n});\n\nexport const StyledLink = styled.a(({ theme }) => {\n const hoverColor = lighten(0.2, theme.base.palette.interactive);\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n margin: 0 calc(0.5 * ${theme.base.spacing});\n padding: 0 calc(0.5 * ${theme.base.spacing});\n font-size: ${fontSize.m};\n position: relative;\n height: 100%;\n display: flex;\n align-items: center;\n\n &:last-of-type {\n margin-inline-end: ${theme.base.spacing};\n }\n\n &[aria-current='page'] {\n ::after {\n content: '';\n position: absolute;\n inset-inline-start: 0;\n inset-block-end: 0;\n background-color: ${theme.base.palette.interactive};\n height: 0.125rem;\n width: 100%;\n }\n }\n\n &:hover {\n ::after {\n content: '';\n position: absolute;\n inset-inline-start: 0;\n inset-block-end: 0;\n background-color: ${hoverColor};\n height: 0.125rem;\n width: 100%;\n }\n }\n `;\n});\n\nStyledLink.defaultProps = defaultThemeProp;\n\nexport const StyledMain = styled.main<{ navPosition: AppShellProps['navPosition'] }>(\n ({ navPosition, theme }) => {\n const calculatedHeaderHeight = navPosition === 'below' ? tallHeaderHeight : headerHeight;\n return css`\n --appshell-offset: ${calculatedHeaderHeight};\n --appshell-horizontal-offset: 0;\n position: relative;\n min-height: calc(100vh - ${calculatedHeaderHeight});\n background-color: ${theme.base.palette['primary-background']};\n\n :focus {\n outline: none;\n }\n `;\n }\n);\n\nStyledMain.defaultProps = defaultThemeProp;\n\nexport const StyledHamburgerMenu = styled.button(({ theme }) => {\n return css`\n margin: ${theme.base.spacing};\n `;\n});\n\nStyledHamburgerMenu.defaultProps = defaultThemeProp;\n\nexport const StyledMobileNav = styled.nav(({ theme }) => {\n return css`\n height: 100vh;\n background-color: ${theme.base.palette['primary-background']};\n `;\n});\n\nStyledMobileNav.defaultProps = defaultThemeProp;\n\nexport const StyledMobileLink = styled.a(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n const activeColor = tryCatch(() =>\n mix(0.85, theme.base.palette['primary-background'], theme.base.palette.interactive)\n );\n\n const hoverColor = tryCatch(() =>\n mix(0.95, theme.base.palette['primary-background'], theme.base.palette.interactive)\n );\n\n return css`\n font-size: ${fontSize.m};\n padding: ${theme.base.spacing} calc(3 * ${theme.base.spacing});\n background-color: ${theme.base.palette['primary-background']};\n\n & + & {\n margin-inline-start: 0;\n }\n\n &:hover,\n &:focus {\n background-color: ${hoverColor};\n text-decoration: none;\n }\n\n &[aria-current='page'] {\n font-weight: ${theme.base['font-weight']['semi-bold']};\n background-color: ${activeColor};\n }\n\n @media (pointer: coarse) {\n height: ${theme.base['hit-area'].finger};\n }\n `;\n});\n\nStyledMobileLink.defaultProps = defaultThemeProp;\n\nexport const StyledLinkSection = styled.div`\n overflow: auto;\n`;\n\nexport const StyledOperatorSection = styled.div`\n position: sticky;\n bottom: 0;\n`;\n\nexport const HorizontalBreak = styled.div(({ theme }) => {\n return css`\n background-color: ${theme.base.palette['border-line']};\n height: 0.0625rem;\n margin: ${theme.base.spacing} calc(6 * ${theme.base.spacing}) 0 calc(3 * ${theme.base.spacing});\n\n & + ${StyledFlex} {\n margin-inline-start: calc(3 * ${theme.base.spacing});\n }\n `;\n});\n\nHorizontalBreak.defaultProps = defaultThemeProp;\n\nexport const StyledNotificationCount = styled.span`\n flex-shrink: 0;\n`;\n\nexport const StyledCountIcon = styled(Count)(({\n theme: {\n base: { spacing }\n }\n}) => {\n return css`\n position: absolute;\n inset-inline-start: calc(2 * ${spacing});\n inset-block-start: calc(-0.25 * ${spacing});\n padding: 0 calc(0.5 * ${spacing});\n\n @media (pointer: coarse) {\n inset-inline-start: calc(2.5 * ${spacing});\n inset-block-start: calc(0.5 * ${spacing});\n }\n `;\n});\n\nexport const StyledNotifications = styled.div<{ popover?: boolean }>(({ popover, theme }) => {\n return css`\n min-height: ${popover ? '10rem' : '100vh'};\n max-height: ${popover ? '50vh' : '100vh'};\n background-color: ${theme.base.palette['primary-background']};\n\n ${popover &&\n css`\n max-width: 80ch;\n `}\n `;\n});\n\nStyledNotifications.defaultProps = defaultThemeProp;\n\nexport const StyledNotificationList = styled.ul(({ theme }) => {\n return css`\n overflow: auto;\n\n & > li:not(:last-of-type) {\n border-bottom: solid 0.0625rem ${theme.base.palette['border-line']};\n }\n `;\n});\n\nStyledNotificationList.defaultProps = defaultThemeProp;\n\nexport const StyledNotification = styled(BareButton)(({ theme }) => {\n const hoverColor = lighten(0.55, theme.base.palette.interactive);\n\n return css`\n width: 100%;\n padding: calc(2 * ${theme.base.spacing}) calc(3 * ${theme.base.spacing});\n background-color: ${theme.base.palette['primary-background']};\n text-decoration: none;\n cursor: pointer;\n text-align: start;\n white-space: normal;\n\n &:hover,\n &:focus {\n background-color: ${hoverColor};\n }\n\n &:focus {\n outline: none;\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n\n ${StyledVisual} {\n align-self: flex-start;\n }\n `;\n});\n\nStyledNotification.defaultProps = defaultThemeProp;\n\nexport const StyledNotificationVisual = styled.span<{ unread?: boolean }>(({ theme, unread }) => {\n return css`\n position: relative;\n ${StyledAlert} {\n position: absolute;\n inset-inline-start: 0.375rem;\n inset-block-start: 1.625rem;\n background-color: ${theme.base.palette.interactive};\n height: 0.75rem;\n width: 0.75rem;\n\n ${!unread &&\n css`\n display: none;\n `}\n }\n `;\n});\n\nStyledNotificationVisual.defaultProps = defaultThemeProp;\n\nexport const StyledNotificationPrimary = styled.span<{ unread?: boolean }>(({ theme, unread }) => {\n return css`\n font-weight: ${unread\n ? theme.base['font-weight'].bold\n : theme.base['font-weight']['semi-bold']};\n `;\n});\n\nStyledNotificationPrimary.defaultProps = defaultThemeProp;\n\nexport const StyledNotificationSecondary = styled.span<{ unread?: boolean }>(\n ({ theme, unread }) => {\n return css`\n ${StyledText} {\n opacity: ${unread\n ? theme.base.transparency['transparent-1']\n : theme.base.transparency['transparent-3']};\n }\n `;\n }\n);\n\nStyledNotificationSecondary.defaultProps = defaultThemeProp;\n"]}
|
|
1
|
+
{"version":3,"file":"AppShell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AAC,IAAI,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC;GAC3C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,yBAAyB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE1D,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC,IAAI,CACpD,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE;IACpB,OAAO,GAAG,CAAA;QACN,UAAU;mBACC,MAAM;QACf,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC;QAC1C,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC;;KAE/C,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,2BAA2B,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE5D,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACzD,OAAO,GAAG,CAAA;wBACY,KAAK,CAAC,IAAI,CAAC,OAAO;GACvC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,kBAAkB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import { lighten, mix } from 'polished';\nimport styled, { css } from 'styled-components';\n\nimport {\n calculateFontSize,\n Count,\n defaultThemeProp,\n StyledFlex,\n StyledImage,\n StyledText,\n StyledVisual,\n tryCatch\n} from '@pega/cosmos-react-core';\nimport { StyledAppHeaderOperator } from '@pega/cosmos-react-core/lib/components/AppShell/AppHeader.styles';\nimport { StyledAlert } from '@pega/cosmos-react-core/lib/components/Badges/Alert';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\n\nimport type { AppShellProps } from './AppShell.types';\n\nconst headerHeight = '3rem';\nconst tallHeaderHeight = '6rem';\n\nexport const StyledNav = styled.nav`\n white-space: nowrap;\n overflow: visible;\n visibility: hidden;\n height: 100%;\n\n a:hover,\n button:hover {\n text-decoration: none;\n }\n`;\n\nexport const StyledAppHeader = styled.header<{ navPosition: AppShellProps['navPosition'] }>(\n ({ navPosition, theme }) => {\n return css`\n position: sticky;\n inset-block-start: 0;\n height: ${navPosition === 'below' ? tallHeaderHeight : headerHeight};\n width: 100%;\n background-color: ${theme.base.palette['primary-background']};\n z-index: calc(${theme.base['z-index'].popover} + 1);\n border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};\n color: ${theme.base.palette['foreground-color']};\n\n ${StyledImage} {\n height: 1.625rem;\n }\n\n & > ${StyledFlex} {\n height: ${headerHeight};\n\n ${StyledAppHeaderOperator} {\n margin: ${theme.base.spacing};\n }\n\n & > a,\n & > button {\n cursor: pointer;\n text-decoration: none;\n user-select: none;\n -webkit-user-select: none;\n min-height: ${headerHeight};\n\n &:focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n }\n }\n\n & > ${StyledNav} {\n height: calc(${tallHeaderHeight} - ${headerHeight});\n }\n `;\n }\n);\n\nStyledAppHeader.defaultProps = defaultThemeProp;\n\nexport const StyledPrimaryName = styled.span(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n color: ${theme.base.palette['foreground-color']};\n font-size: ${fontSize.xxl};\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: block;\n max-width: 50ch;\n `;\n});\n\nStyledPrimaryName.defaultProps = defaultThemeProp;\n\nexport const StyledEndNavBlock = styled.div<{ mobile: boolean }>(({ mobile }) => {\n return (\n mobile &&\n css`\n margin-inline-start: auto;\n `\n );\n});\n\nexport const StyledLink = styled.a(({ theme }) => {\n const hoverColor = lighten(0.2, theme.base.palette.interactive);\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n margin: 0 calc(0.5 * ${theme.base.spacing});\n padding: 0 calc(0.5 * ${theme.base.spacing});\n font-size: ${fontSize.m};\n position: relative;\n height: 100%;\n display: flex;\n align-items: center;\n\n &:last-of-type {\n margin-inline-end: ${theme.base.spacing};\n }\n\n &[aria-current='page'] {\n ::after {\n content: '';\n position: absolute;\n inset-inline-start: 0;\n inset-block-end: 0;\n background-color: ${theme.base.palette.interactive};\n height: 0.125rem;\n width: 100%;\n }\n }\n\n &:hover {\n ::after {\n content: '';\n position: absolute;\n inset-inline-start: 0;\n inset-block-end: 0;\n background-color: ${hoverColor};\n height: 0.125rem;\n width: 100%;\n }\n }\n `;\n});\n\nStyledLink.defaultProps = defaultThemeProp;\n\nexport const StyledMain = styled.main<{ navPosition: AppShellProps['navPosition'] }>(\n ({ navPosition, theme }) => {\n const calculatedHeaderHeight = navPosition === 'below' ? tallHeaderHeight : headerHeight;\n return css`\n --appshell-offset: ${calculatedHeaderHeight};\n --appshell-horizontal-offset: 0;\n position: relative;\n min-height: calc(100vh - ${calculatedHeaderHeight});\n background-color: ${theme.base.palette['app-background']};\n\n :focus {\n outline: none;\n }\n `;\n }\n);\n\nStyledMain.defaultProps = defaultThemeProp;\n\nexport const StyledHamburgerMenu = styled.button(({ theme }) => {\n return css`\n margin: ${theme.base.spacing};\n `;\n});\n\nStyledHamburgerMenu.defaultProps = defaultThemeProp;\n\nexport const StyledMobileNav = styled.nav(({ theme }) => {\n return css`\n height: 100vh;\n background-color: ${theme.base.palette['primary-background']};\n `;\n});\n\nStyledMobileNav.defaultProps = defaultThemeProp;\n\nexport const StyledMobileLink = styled.a(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n const activeColor = tryCatch(() =>\n mix(0.85, theme.base.palette['primary-background'], theme.base.palette.interactive)\n );\n\n const hoverColor = tryCatch(() =>\n mix(0.95, theme.base.palette['primary-background'], theme.base.palette.interactive)\n );\n\n return css`\n font-size: ${fontSize.m};\n padding: ${theme.base.spacing} calc(3 * ${theme.base.spacing});\n background-color: ${theme.base.palette['primary-background']};\n\n & + & {\n margin-inline-start: 0;\n }\n\n &:hover,\n &:focus {\n background-color: ${hoverColor};\n text-decoration: none;\n }\n\n &[aria-current='page'] {\n font-weight: ${theme.base['font-weight']['semi-bold']};\n background-color: ${activeColor};\n }\n\n @media (pointer: coarse) {\n height: ${theme.base['hit-area'].finger};\n }\n `;\n});\n\nStyledMobileLink.defaultProps = defaultThemeProp;\n\nexport const StyledLinkSection = styled.div`\n overflow: auto;\n`;\n\nexport const StyledOperatorSection = styled.div`\n position: sticky;\n bottom: 0;\n`;\n\nexport const HorizontalBreak = styled.div(({ theme }) => {\n return css`\n background-color: ${theme.base.palette['border-line']};\n height: 0.0625rem;\n margin: ${theme.base.spacing} calc(6 * ${theme.base.spacing}) 0 calc(3 * ${theme.base.spacing});\n\n & + ${StyledFlex} {\n margin-inline-start: calc(3 * ${theme.base.spacing});\n }\n `;\n});\n\nHorizontalBreak.defaultProps = defaultThemeProp;\n\nexport const StyledNotificationCount = styled.span`\n flex-shrink: 0;\n`;\n\nexport const StyledCountIcon = styled(Count)(({\n theme: {\n base: { spacing }\n }\n}) => {\n return css`\n position: absolute;\n inset-inline-start: calc(2 * ${spacing});\n inset-block-start: calc(-0.25 * ${spacing});\n padding: 0 calc(0.5 * ${spacing});\n\n @media (pointer: coarse) {\n inset-inline-start: calc(2.5 * ${spacing});\n inset-block-start: calc(0.5 * ${spacing});\n }\n `;\n});\n\nexport const StyledNotifications = styled.div<{ popover?: boolean }>(({ popover, theme }) => {\n return css`\n min-height: ${popover ? '10rem' : '100vh'};\n max-height: ${popover ? '50vh' : '100vh'};\n background-color: ${theme.base.palette['primary-background']};\n\n ${popover &&\n css`\n max-width: 80ch;\n `}\n `;\n});\n\nStyledNotifications.defaultProps = defaultThemeProp;\n\nexport const StyledNotificationList = styled.ul(({ theme }) => {\n return css`\n overflow: auto;\n\n & > li:not(:last-of-type) {\n border-bottom: solid 0.0625rem ${theme.base.palette['border-line']};\n }\n `;\n});\n\nStyledNotificationList.defaultProps = defaultThemeProp;\n\nexport const StyledNotification = styled(BareButton)(({ theme }) => {\n const hoverColor = lighten(0.55, theme.base.palette.interactive);\n\n return css`\n width: 100%;\n padding: calc(2 * ${theme.base.spacing}) calc(3 * ${theme.base.spacing});\n background-color: ${theme.base.palette['primary-background']};\n text-decoration: none;\n cursor: pointer;\n text-align: start;\n white-space: normal;\n\n &:hover,\n &:focus {\n background-color: ${hoverColor};\n }\n\n &:focus {\n outline: none;\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n\n ${StyledVisual} {\n align-self: flex-start;\n }\n `;\n});\n\nStyledNotification.defaultProps = defaultThemeProp;\n\nexport const StyledNotificationVisual = styled.span<{ unread?: boolean }>(({ theme, unread }) => {\n return css`\n position: relative;\n ${StyledAlert} {\n position: absolute;\n inset-inline-start: 0.375rem;\n inset-block-start: 1.625rem;\n background-color: ${theme.base.palette.interactive};\n height: 0.75rem;\n width: 0.75rem;\n\n ${!unread &&\n css`\n display: none;\n `}\n }\n `;\n});\n\nStyledNotificationVisual.defaultProps = defaultThemeProp;\n\nexport const StyledNotificationPrimary = styled.span<{ unread?: boolean }>(({ theme, unread }) => {\n return css`\n font-weight: ${unread\n ? theme.base['font-weight'].bold\n : theme.base['font-weight']['semi-bold']};\n `;\n});\n\nStyledNotificationPrimary.defaultProps = defaultThemeProp;\n\nexport const StyledNotificationSecondary = styled.span<{ unread?: boolean }>(\n ({ theme, unread }) => {\n return css`\n ${StyledText} {\n opacity: ${unread\n ? theme.base.transparency['transparent-1']\n : theme.base.transparency['transparent-3']};\n }\n `;\n }\n);\n\nStyledNotificationSecondary.defaultProps = defaultThemeProp;\n\nexport const StyledBannerRegion = styled.div(({ theme }) => {\n return css`\n padding: calc(2 * ${theme.base.spacing});\n `;\n});\n\nStyledBannerRegion.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -13,6 +13,8 @@ interface AppInfoProps {
|
|
|
13
13
|
onClick?: MouseEventHandler<HTMLAnchorElement>;
|
|
14
14
|
/** Specifies where to open the link href. */
|
|
15
15
|
target?: string;
|
|
16
|
+
/** If true, the appName will not be visibly displayed on screen. */
|
|
17
|
+
appNameHidden?: boolean;
|
|
16
18
|
}
|
|
17
19
|
export interface NavLinkProps {
|
|
18
20
|
/** Unique id for the link */
|
|
@@ -24,7 +26,7 @@ export interface NavLinkProps {
|
|
|
24
26
|
/** Click handler for the link. */
|
|
25
27
|
onClick?: (e: InteractionEvent) => void;
|
|
26
28
|
/** Indicates if the link represents the current view within the app. */
|
|
27
|
-
|
|
29
|
+
active?: boolean;
|
|
28
30
|
}
|
|
29
31
|
interface OperatorProps {
|
|
30
32
|
/** Props for constructing the operator avatar. */
|
|
@@ -69,6 +71,8 @@ export interface NotificationProps {
|
|
|
69
71
|
export interface AppShellProps extends BaseProps, NoChildrenProp {
|
|
70
72
|
/** The content of the application. */
|
|
71
73
|
main: ReactNode;
|
|
74
|
+
/** Banners will render above the main content if they are provided. */
|
|
75
|
+
banners?: ReactNode;
|
|
72
76
|
/** Props related to the app name and logo. */
|
|
73
77
|
appInfo: AppInfoProps;
|
|
74
78
|
/** Context manager configuration. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.types.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE/D,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAClG,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EACjB,MAAM,gEAAgE,CAAC;AAExE,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,aAAa,CAAC;AAE1D,UAAU,YAAY;IACpB,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,QAAQ,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IAC5B,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,OAAO,CAAC,EAAE,iBAA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eAAe,CAAC,EAAE,oBAAoB,CAAC;IACvC,qDAAqD;IACrD,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,mCAAmC;IACnC,QAAQ,EAAE,aAAa,CAAC;IACxB,0DAA0D;IAC1D,aAAa,CAAC,EAAE,iBAAiB,CAAC;IAClC;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAC1C;;;OAGG;IACH,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IACjC,wCAAwC;IACxC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.types.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { MouseEventHandler, ReactNode, Ref } from 'react';\n\nimport type { AvatarProps, BaseProps, ImageProps, NoChildrenProp } from '@pega/cosmos-react-core';\nimport type {\n ContextSwitcherProps,\n NavListItemProps\n} from '@pega/cosmos-react-core/lib/components/AppShell/AppShell.types';\n\nexport type InteractionEvent = MouseEvent | KeyboardEvent;\n\ninterface AppInfoProps {\n /** Name of the application. */\n appName: string;\n /** URL source of the logo image. */\n imageSrc: ImageProps['src'];\n /** URL or DOM id to navigate to from the logo and appName. */\n href?: string;\n /** Click handler for the logo and appName. */\n onClick?: MouseEventHandler<HTMLAnchorElement>;\n /** Specifies where to open the link href. */\n target?: string;\n}\n\nexport interface NavLinkProps {\n /** Unique id for the link */\n id: string;\n /** Text that is displayed for the link. */\n text: string;\n /** URL or DOM id to navigate to. */\n href: string;\n /** Click handler for the link. */\n onClick?: (e: InteractionEvent) => void;\n /** Indicates if the link represents the current view within the app. */\n
|
|
1
|
+
{"version":3,"file":"AppShell.types.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { MouseEventHandler, ReactNode, Ref } from 'react';\n\nimport type { AvatarProps, BaseProps, ImageProps, NoChildrenProp } from '@pega/cosmos-react-core';\nimport type {\n ContextSwitcherProps,\n NavListItemProps\n} from '@pega/cosmos-react-core/lib/components/AppShell/AppShell.types';\n\nexport type InteractionEvent = MouseEvent | KeyboardEvent;\n\ninterface AppInfoProps {\n /** Name of the application. */\n appName: string;\n /** URL source of the logo image. */\n imageSrc: ImageProps['src'];\n /** URL or DOM id to navigate to from the logo and appName. */\n href?: string;\n /** Click handler for the logo and appName. */\n onClick?: MouseEventHandler<HTMLAnchorElement>;\n /** Specifies where to open the link href. */\n target?: string;\n /** If true, the appName will not be visibly displayed on screen. */\n appNameHidden?: boolean;\n}\n\nexport interface NavLinkProps {\n /** Unique id for the link */\n id: string;\n /** Text that is displayed for the link. */\n text: string;\n /** URL or DOM id to navigate to. */\n href: string;\n /** Click handler for the link. */\n onClick?: (e: InteractionEvent) => void;\n /** Indicates if the link represents the current view within the app. */\n active?: boolean;\n}\n\ninterface OperatorProps {\n /** Props for constructing the operator avatar. */\n avatar: AvatarProps;\n /** The title of the operator menu. */\n title: string;\n /** A list of actions that will populate a menu attached to the operator. */\n actions: Pick<NavListItemProps, 'id' | 'primary' | 'href' | 'onClick' | 'visual'>[];\n}\n\nexport interface NotificationItem {\n /** An id representing the item. */\n id: string;\n /** The primary text for the item. */\n primary: string;\n /** Secondary text that will be rendered as a Meta List. */\n secondary?: string[];\n /** A visual associated with the item. */\n visual?: ReactNode;\n /** A flag indicating if the item has been read. */\n unread?: boolean;\n /** URL or DOM id to navigate to. */\n href?: string;\n /** The onClick handler for the item. */\n onClick?: (event: InteractionEvent) => void;\n}\n\nexport interface NotificationProps {\n /** The title of the notifications view. */\n title: string;\n /** The number of new notifications. */\n count: number;\n /** A list of notification items. */\n items: NotificationItem[];\n /** If true, a loading indicator will render in place of the list. */\n loading?: boolean;\n /** Click event for items within the list. */\n onItemClick?: (id: string, event: InteractionEvent) => void;\n /** Callback that fires when the notification view opens. */\n onNotificationsOpen?: () => void;\n /** Callback that fires when the notification view closes. */\n onNotificationsClose?: () => void;\n}\n\nexport interface AppShellProps extends BaseProps, NoChildrenProp {\n /** The content of the application. */\n main: ReactNode;\n /** Banners will render above the main content if they are provided. */\n banners?: ReactNode;\n /** Props related to the app name and logo. */\n appInfo: AppInfoProps;\n /** Context manager configuration. */\n contextSwitcher?: ContextSwitcherProps;\n /** A set of navigation links for the application. */\n navLinks: NavLinkProps[];\n /** Props for the operator menu. */\n operator: OperatorProps;\n /** Props related to notifications for the application. */\n notifications?: NotificationProps;\n /**\n * The alignment of navigation links within the header.\n * @default 'end'\n */\n navAlignment?: 'start' | 'center' | 'end';\n /**\n * The positioning of the navigation links relative to the other app header elements.\n * @default 'inline'\n */\n navPosition?: 'inline' | 'below';\n /** Ref for the wrapping div element. */\n ref?: Ref<HTMLDivElement>;\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import { Flex, Button, Avatar, Icon, Text, useI18n } from '@pega/cosmos-react-co
|
|
|
3
3
|
import { HorizontalBreak, StyledLinkSection, StyledMobileLink, StyledMobileNav, StyledOperatorSection, StyledPrimaryName } from './AppShell.styles';
|
|
4
4
|
const MobileHeaderContent = ({ appInfo, navLinks, operator, onClose }) => {
|
|
5
5
|
const t = useI18n();
|
|
6
|
-
return (_jsxs(Flex, { as: StyledMobileNav, container: { direction: 'column' }, children: [_jsx(Flex, { container: { pad: 1 }, item: { alignSelf: 'end' }, children: _jsx(Button, { variant: 'simple', icon: true, onClick: onClose, label: t('close'), children: _jsx(Icon, { name: 'times' }) }) }), _jsx(Button, { as: StyledMobileLink, variant: 'text', href: appInfo.href, onClick: appInfo.onClick, target: appInfo.target, children: _jsx(Text, { as: StyledPrimaryName, variant: 'h1', children: appInfo.appName }) }), _jsx(Flex, { as: StyledLinkSection, container: { direction: 'column', gap: 1, pad: [1, 0] }, item: { grow: 1 }, children: navLinks.map(navLink => (_jsx(Button, { as: StyledMobileLink, variant: 'text', "aria-current": navLink.
|
|
6
|
+
return (_jsxs(Flex, { as: StyledMobileNav, container: { direction: 'column' }, children: [_jsx(Flex, { container: { pad: 1 }, item: { alignSelf: 'end' }, children: _jsx(Button, { variant: 'simple', icon: true, onClick: onClose, label: t('close'), children: _jsx(Icon, { name: 'times' }) }) }), _jsx(Button, { as: StyledMobileLink, variant: 'text', href: appInfo.href, onClick: appInfo.onClick, target: appInfo.target, children: _jsx(Text, { as: StyledPrimaryName, variant: 'h1', children: appInfo.appName }) }), _jsx(Flex, { as: StyledLinkSection, container: { direction: 'column', gap: 1, pad: [1, 0] }, item: { grow: 1 }, children: navLinks.map(navLink => (_jsx(Button, { as: StyledMobileLink, variant: 'text', "aria-current": navLink.active ? 'page' : undefined, href: navLink.href, onClick: navLink.onClick, children: navLink.text }, navLink.id))) }), _jsxs(Flex, { as: StyledOperatorSection, container: { direction: 'column', gap: 2, pad: [0, 0, 2, 0] }, children: [_jsx(HorizontalBreak, {}), _jsxs(Flex, { container: { gap: 1, alignItems: 'center' }, children: [_jsx(Avatar, { ...operator.avatar }), _jsx(Text, { as: StyledPrimaryName, variant: 'h2', children: "Account" })] }), _jsx(Flex, { container: { direction: 'column', gap: 1 }, children: operator.actions.map(action => (_jsx(Button, { as: StyledMobileLink, variant: 'text', href: action.href, onClick: action.onClick, children: action.primary }, action.id))) })] })] }));
|
|
7
7
|
};
|
|
8
8
|
export default MobileHeaderContent;
|
|
9
9
|
//# sourceMappingURL=MobileHeaderContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileHeaderContent.js","sourceRoot":"","sources":["../../../src/components/AppShell/MobileHeaderContent.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAEpF,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,mBAAmB,C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,IACF,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["import type { FunctionComponent } from 'react';\n\nimport { Flex, Button, Avatar, Icon, Text, useI18n } from '@pega/cosmos-react-core';\n\nimport {\n HorizontalBreak,\n StyledLinkSection,\n StyledMobileLink,\n StyledMobileNav,\n StyledOperatorSection,\n StyledPrimaryName\n} from './AppShell.styles';\nimport type { AppShellProps } from './AppShell.types';\n\ninterface MobileHeaderContentProps {\n appInfo: AppShellProps['appInfo'];\n navLinks: AppShellProps['navLinks'];\n operator: AppShellProps['operator'];\n onClose: () => void;\n}\n\nconst MobileHeaderContent: FunctionComponent<MobileHeaderContentProps> = ({\n appInfo,\n navLinks,\n operator,\n onClose\n}: MobileHeaderContentProps) => {\n const t = useI18n();\n\n return (\n <Flex as={StyledMobileNav} container={{ direction: 'column' }}>\n <Flex container={{ pad: 1 }} item={{ alignSelf: 'end' }}>\n <Button variant='simple' icon onClick={onClose} label={t('close')}>\n <Icon name='times' />\n </Button>\n </Flex>\n\n <Button\n as={StyledMobileLink}\n variant='text'\n href={appInfo.href}\n onClick={appInfo.onClick}\n target={appInfo.target}\n >\n <Text as={StyledPrimaryName} variant='h1'>\n {appInfo.appName}\n </Text>\n </Button>\n\n <Flex\n as={StyledLinkSection}\n container={{ direction: 'column', gap: 1, pad: [1, 0] }}\n item={{ grow: 1 }}\n >\n {navLinks.map(navLink => (\n <Button\n as={StyledMobileLink}\n variant='text'\n key={navLink.id}\n aria-current={navLink.active ? 'page' : undefined}\n href={navLink.href}\n onClick={navLink.onClick}\n >\n {navLink.text}\n </Button>\n ))}\n </Flex>\n\n <Flex\n as={StyledOperatorSection}\n container={{ direction: 'column', gap: 2, pad: [0, 0, 2, 0] }}\n >\n <HorizontalBreak />\n <Flex container={{ gap: 1, alignItems: 'center' }}>\n <Avatar {...operator.avatar} />\n <Text as={StyledPrimaryName} variant='h2'>\n Account\n </Text>\n </Flex>\n <Flex container={{ direction: 'column', gap: 1 }}>\n {operator.actions.map(action => (\n <Button\n as={StyledMobileLink}\n variant='text'\n key={action.id}\n href={action.href}\n onClick={action.onClick}\n >\n {action.primary}\n </Button>\n ))}\n </Flex>\n </Flex>\n </Flex>\n );\n};\n\nexport default MobileHeaderContent;\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Ref } from 'react';
|
|
2
2
|
import type { AppShellProps } from './AppShell.types';
|
|
3
3
|
interface NavLinksProps {
|
|
4
4
|
navLinks: AppShellProps['navLinks'];
|
|
@@ -6,6 +6,6 @@ interface NavLinksProps {
|
|
|
6
6
|
navPosition: AppShellProps['navPosition'];
|
|
7
7
|
ref?: Ref<HTMLDivElement>;
|
|
8
8
|
}
|
|
9
|
-
declare const NavLinks:
|
|
9
|
+
declare const NavLinks: import("react").ForwardRefExoticComponent<Omit<NavLinksProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
10
10
|
export default NavLinks;
|
|
11
11
|
//# sourceMappingURL=NavLinks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavLinks.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/NavLinks.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"NavLinks.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/NavLinks.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,GAAG,EAAE,MAAM,OAAO,CAAC;AAKlD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,UAAU,aAAa;IACrB,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACpC,YAAY,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;IAC5C,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;IAC1C,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,QAAA,MAAM,QAAQ,uHAgCZ,CAAC;AAEH,eAAe,QAAQ,CAAC"}
|
|
@@ -8,7 +8,7 @@ const NavLinks = forwardRef(function NavLinks({ navLinks, navAlignment, navPosit
|
|
|
8
8
|
gap: 1,
|
|
9
9
|
justify: navAlignment
|
|
10
10
|
}, item: { grow: 1 }, navPosition: navPosition, children: navLinks.map(navLink => {
|
|
11
|
-
return (_jsx(StyledLink, { as: Button, "aria-current": navLink.
|
|
11
|
+
return (_jsx(StyledLink, { as: Button, "aria-current": navLink.active ? 'page' : undefined, variant: 'text', href: navLink.href, onClick: navLink.onClick, children: navLink.text }, navLink.id));
|
|
12
12
|
}) }));
|
|
13
13
|
});
|
|
14
14
|
export default NavLinks;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavLinks.js","sourceRoot":"","sources":["../../../src/components/AppShell/NavLinks.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGnC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAU1D,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"NavLinks.js","sourceRoot":"","sources":["../../../src/components/AppShell/NavLinks.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAGnC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAU1D,MAAM,QAAQ,GAAG,UAAU,CAAC,SAAS,QAAQ,CAC3C,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAkC,EACvE,GAAyB;IAEzB,OAAO,CACL,KAAC,IAAI,IACH,EAAE,EAAE,SAAS,EACb,GAAG,EAAE,GAAG,EACR,SAAS,EAAE;YACT,UAAU,EAAE,QAAQ;YACpB,GAAG,EAAE,CAAC;YACN,OAAO,EAAE,YAAY;SACtB,EACD,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EACjB,WAAW,EAAE,WAAW,YAEvB,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;YACtB,OAAO,CACL,KAAC,UAAU,IACT,EAAE,EAAE,MAAM,kBACI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EACjD,OAAO,EAAC,MAAM,EAEd,IAAI,EAAE,OAAO,CAAC,IAAI,EAClB,OAAO,EAAE,OAAO,CAAC,OAAO,YAEvB,OAAO,CAAC,IAAI,IAJR,OAAO,CAAC,EAAE,CAKJ,CACd,CAAC;QACJ,CAAC,CAAC,GACG,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,QAAQ,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { PropsWithoutRef, Ref } from 'react';\n\nimport { Flex, Button } from '@pega/cosmos-react-core';\n\nimport { StyledNav, StyledLink } from './AppShell.styles';\nimport type { AppShellProps } from './AppShell.types';\n\ninterface NavLinksProps {\n navLinks: AppShellProps['navLinks'];\n navAlignment: AppShellProps['navAlignment'];\n navPosition: AppShellProps['navPosition'];\n ref?: Ref<HTMLDivElement>;\n}\n\nconst NavLinks = forwardRef(function NavLinks(\n { navLinks, navAlignment, navPosition }: PropsWithoutRef<NavLinksProps>,\n ref: NavLinksProps['ref']\n) {\n return (\n <Flex\n as={StyledNav}\n ref={ref}\n container={{\n alignItems: 'center',\n gap: 1,\n justify: navAlignment\n }}\n item={{ grow: 1 }}\n navPosition={navPosition}\n >\n {navLinks.map(navLink => {\n return (\n <StyledLink\n as={Button}\n aria-current={navLink.active ? 'page' : undefined}\n variant='text'\n key={navLink.id}\n href={navLink.href}\n onClick={navLink.onClick}\n >\n {navLink.text}\n </StyledLink>\n );\n })}\n </Flex>\n );\n});\n\nexport default NavLinks;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseView.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"CaseView.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAA+B,MAAM,OAAO,CAAC;AAgB7D,OAAO,KAAK,EAAE,YAAY,EAAO,MAAM,yBAAyB,CAAC;AAUjE,OAAO,KAAK,EAAE,aAAa,EAAU,MAAM,kBAAkB,CAAC;AAE9D,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,GAAG,YAAY,CAoO9C,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,36 +1,98 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo, useRef, useState } from 'react';
|
|
3
|
-
import { useBreakpoint, Flex, Tabs, TabPanel, Text, MenuButton, useI18n, Icon, useAfterInitialEffect } from '@pega/cosmos-react-core';
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { useBreakpoint, Flex, Tabs, TabPanel, Text, MenuButton, useI18n, Icon, useAfterInitialEffect, getEdge, useDirection, throttle } from '@pega/cosmos-react-core';
|
|
4
|
+
import { StyledCaseHeaderPromotedAction } from '@pega/cosmos-react-work/lib/components/CaseView/CaseView.styles';
|
|
5
|
+
import { StyledAside, StyledCaseHeader, StyledCaseView, StyledContentContainer, StyledContent } from './CaseView.styles';
|
|
6
|
+
const CaseView = ({ caseId, heading, actions, stages, tasks, summary, feed, utility, promotedActions = [], ...restProps }) => {
|
|
6
7
|
const isMediumOrAbove = useBreakpoint('md');
|
|
7
8
|
const t = useI18n();
|
|
8
9
|
const tabsRef = useRef(null);
|
|
9
10
|
const tabs = useMemo(() => {
|
|
10
11
|
if (isMediumOrAbove)
|
|
11
|
-
return
|
|
12
|
+
return [];
|
|
12
13
|
const tabsArr = [];
|
|
13
14
|
if (summary)
|
|
14
|
-
tabsArr.push({
|
|
15
|
+
tabsArr.push({
|
|
16
|
+
name: 'Summary',
|
|
17
|
+
content: summary.content
|
|
18
|
+
});
|
|
15
19
|
if (feed)
|
|
16
20
|
tabsArr.push({ name: 'Feed', content: feed.content });
|
|
17
21
|
if (utility)
|
|
18
|
-
tabsArr.push({
|
|
22
|
+
tabsArr.push({
|
|
23
|
+
name: 'Utility',
|
|
24
|
+
content: utility.content
|
|
25
|
+
});
|
|
19
26
|
return tabsArr.map(tab => ({ ...tab, id: tab.name }));
|
|
20
27
|
}, [isMediumOrAbove, summary, feed, utility]);
|
|
21
28
|
const [currentTabId, setCurrentTabId] = useState(tabs && tabs.length > 0 ? tabs[0].id : null);
|
|
29
|
+
const [wrapPromotedActions, setWrapPromotedActions] = useState(false);
|
|
30
|
+
const actionsContainerEl = useRef(null);
|
|
31
|
+
const contentEl = useRef(null);
|
|
32
|
+
const headerEl = useRef(null);
|
|
33
|
+
const wrapActionsBreakpoint = useRef(null);
|
|
34
|
+
const { ltr } = useDirection();
|
|
22
35
|
useAfterInitialEffect(() => {
|
|
23
|
-
if (tabs
|
|
36
|
+
if (tabs.length > 0)
|
|
24
37
|
setCurrentTabId(cur => cur ?? tabs[0].id);
|
|
25
38
|
}, [tabs]);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
39
|
+
useLayoutEffect(() => {
|
|
40
|
+
if (!wrapPromotedActions &&
|
|
41
|
+
contentEl.current &&
|
|
42
|
+
actionsContainerEl.current &&
|
|
43
|
+
headerEl.current) {
|
|
44
|
+
const contentStart = getEdge({
|
|
45
|
+
el: contentEl.current,
|
|
46
|
+
side: 'leading',
|
|
47
|
+
ltr
|
|
48
|
+
});
|
|
49
|
+
const headerGroupEnd = getEdge({
|
|
50
|
+
el: headerEl.current,
|
|
51
|
+
side: 'trailing',
|
|
52
|
+
ltr
|
|
53
|
+
});
|
|
54
|
+
const actionsContainerWidth = actionsContainerEl.current.getBoundingClientRect().width;
|
|
55
|
+
wrapActionsBreakpoint.current =
|
|
56
|
+
Math.abs(Math.ceil(contentStart) - Math.ceil(headerGroupEnd)) +
|
|
57
|
+
Math.ceil(actionsContainerWidth);
|
|
58
|
+
}
|
|
59
|
+
const promotedActionsWrapHandler = () => {
|
|
60
|
+
if (wrapActionsBreakpoint.current && contentEl.current) {
|
|
61
|
+
const availableWidth = Math.ceil(contentEl.current.offsetWidth) - 20;
|
|
62
|
+
setWrapPromotedActions(availableWidth < wrapActionsBreakpoint.current);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const resizeObserver = new ResizeObserver(throttle(promotedActionsWrapHandler, 30));
|
|
66
|
+
promotedActionsWrapHandler();
|
|
67
|
+
if (contentEl.current) {
|
|
68
|
+
resizeObserver.observe(contentEl.current, { box: 'border-box' });
|
|
69
|
+
}
|
|
70
|
+
return () => {
|
|
71
|
+
resizeObserver.disconnect();
|
|
72
|
+
};
|
|
73
|
+
}, [contentEl, actionsContainerEl, headerEl, promotedActions, heading, wrapPromotedActions]);
|
|
74
|
+
return (_jsxs(StyledCaseView, { ...restProps, children: [_jsx(StyledCaseHeader, { computeButtonFgColor: !isMediumOrAbove || promotedActions.length > 0, children: _jsxs(Flex, { container: {
|
|
75
|
+
direction: 'column',
|
|
76
|
+
justify: 'between',
|
|
77
|
+
pad: 2,
|
|
78
|
+
alignItems: 'center',
|
|
79
|
+
gap: 2
|
|
80
|
+
}, ref: contentEl, as: StyledContentContainer, children: [_jsxs(Flex, { container: { justify: 'between', alignItems: 'center', gap: 2 }, item: { grow: 1 }, children: [_jsx(Text, { variant: 'h1', ref: headerEl, children: heading }), (promotedActions.length > 0 || actions) && (_jsxs(Flex, { container: {
|
|
81
|
+
gap: 1
|
|
82
|
+
}, ref: actionsContainerEl, children: [!wrapPromotedActions &&
|
|
83
|
+
promotedActions.map(action => (_jsx(StyledCaseHeaderPromotedAction, { variant: 'secondary', onClick: (e) => action.onClick?.(action.id, e), children: action.text }, action.id))), actions && (_jsx(MenuButton, { icon: promotedActions.length > 0 || !isMediumOrAbove ? 'more' : undefined, iconOnly: promotedActions.length > 0 || !isMediumOrAbove, variant: 'simple', text: t('actions'), "aria-label": t('actions_for', [caseId]), menu: {
|
|
84
|
+
items: actions.map(action => ({
|
|
85
|
+
...action,
|
|
86
|
+
primary: action.text,
|
|
87
|
+
visual: action.icon ? _jsx(Icon, { name: action.icon }) : undefined
|
|
88
|
+
})),
|
|
89
|
+
scrollAt: 20
|
|
90
|
+
} }))] }))] }), wrapPromotedActions && promotedActions.length > 0 && (_jsx(Flex, { item: { grow: 1 }, container: {
|
|
91
|
+
justify: 'start',
|
|
92
|
+
gap: 1,
|
|
93
|
+
alignItems: 'center',
|
|
94
|
+
wrap: 'wrap'
|
|
95
|
+
}, children: promotedActions.map(action => (_jsx(StyledCaseHeaderPromotedAction, { variant: 'secondary', onClick: (e) => action.onClick?.(action.id, e), children: action.text }, action.id))) }))] }) }), _jsxs(Flex, { container: { direction: 'column', gap: 2, pad: 2 }, as: StyledContentContainer, children: [stages?.content, tabs.length > 0 && currentTabId && (_jsxs(_Fragment, { children: [tasks?.content, _jsxs("div", { children: [_jsx(Tabs, { tabs: tabs, onTabClick: setCurrentTabId, currentTabId: currentTabId, ref: tabsRef }), tabs.map(tab => (_jsx(TabPanel, { tabId: tab.id, currentTabId: currentTabId, tablistRef: tabsRef, children: _jsx(StyledContent, { children: tab.content }) }, tab.id)))] })] })), tabs.length === 0 && (_jsxs(Flex, { container: { gap: 2 }, children: [(utility || summary) && (_jsxs(Flex, { as: StyledAside, container: { direction: 'column', gap: 2 }, children: [summary?.content && (_jsx("div", { role: 'region', "aria-label": summary?.label, children: summary?.content })), utility?.content && (_jsx("div", { role: 'region', "aria-label": utility?.label, children: utility?.content }))] })), _jsxs(Flex, { container: { direction: 'column', gap: 2 }, item: { grow: 1 }, children: [_jsx("div", { role: 'region', "aria-label": tasks?.label, children: tasks?.content }), _jsx("div", { role: 'region', "aria-label": feed?.label, children: feed?.content })] })] }))] })] }));
|
|
34
96
|
};
|
|
35
97
|
export default CaseView;
|
|
36
98
|
//# sourceMappingURL=CaseView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseView.js","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGlD,OAAO,EACL,aAAa,EACb,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,OAAO,EACP,IAAI,EACJ,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAG3B,MAAM,QAAQ,GAAqC,CAAC,EAClD,OAAO,EACP,OAAO,EACP,MAAM,EACN,KAAK,EACL,OAAO,EACP,IAAI,EACJ,OAAO,EACP,GAAG,SAAS,EACmB,EAAE,EAAE;IACnC,MAAM,eAAe,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM,OAAO,GAAG,MAAM,CAAc,IAAI,CAAC,CAAC;IAE1C,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE;QACxB,IAAI,eAAe;YAAE,OAAO,IAAI,CAAC;QACjC,MAAM,OAAO,GAAwD,EAAE,CAAC;QAExE,IAAI,OAAO;YAAE,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE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AO,CAAC,IAAI,CACvB,MAAC,IAAI,IAAC,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aAC9D,OAAO,EAAE,OAAO,IAAI,CACnB,cAAK,IAAI,EAAC,QAAQ,gBAAa,OAAO,EAAE,KAAK,YAC1C,OAAO,EAAE,OAAO,GACb,CACP,EACA,OAAO,EAAE,OAAO,IAAI,CACnB,cAAK,IAAI,EAAC,QAAQ,gBAAa,OAAO,EAAE,KAAK,YAC1C,OAAO,EAAE,OAAO,GACb,CACP,IACI,CACR,EACD,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,aACjE,cAAK,IAAI,EAAC,QAAQ,gBAAa,KAAK,EAAE,KAAK,YACxC,KAAK,EAAE,OAAO,GACX,EACN,cAAK,IAAI,EAAC,QAAQ,gBAAa,IAAI,EAAE,KAAK,YACvC,IAAI,EAAE,OAAO,GACV,IACD,IACF,CACR,IACI,IACQ,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import { useMemo, useRef, useState } from 'react';\nimport type { FC, PropsWithoutRef } from 'react';\n\nimport {\n useBreakpoint,\n Flex,\n Tabs,\n TabPanel,\n Text,\n MenuButton,\n useI18n,\n Icon,\n useAfterInitialEffect\n} from '@pega/cosmos-react-core';\nimport type { ForwardProps, Tab } from '@pega/cosmos-react-core';\n\nimport {\n StyledAside,\n StyledCaseHeader,\n StyledCaseView,\n StyledContentContainer\n} from './CaseView.styles';\nimport type { CaseViewProps, Region } from './CaseView.types';\n\nconst CaseView: FC<CaseViewProps & ForwardProps> = ({\n heading,\n actions,\n stages,\n tasks,\n summary,\n feed,\n utility,\n ...restProps\n}: PropsWithoutRef<CaseViewProps>) => {\n const isMediumOrAbove = useBreakpoint('md');\n const t = useI18n();\n const tabsRef = useRef<HTMLElement>(null);\n\n const tabs = useMemo(() => {\n if (isMediumOrAbove) return null;\n const tabsArr: { name: Tab['name']; content: Region['content'] }[] = [];\n\n if (summary) tabsArr.push({ name: 'Summary', content: summary.content });\n if (feed) tabsArr.push({ name: 'Feed', content: feed.content });\n if (utility) tabsArr.push({ name: 'Utility', content: utility.content });\n\n return tabsArr.map(tab => ({ ...tab, id: tab.name }));\n }, [isMediumOrAbove, summary, feed, utility]);\n\n const [currentTabId, setCurrentTabId] = useState(tabs && tabs.length > 0 ? tabs[0].id : null);\n useAfterInitialEffect(() => {\n if (tabs && tabs.length > 0) setCurrentTabId(cur => cur ?? tabs[0].id);\n }, [tabs]);\n\n return (\n <StyledCaseView {...restProps}>\n <StyledCaseHeader>\n <Flex\n container={{ justify: 'between', pad: 2, alignItems: 'center' }}\n as={StyledContentContainer}\n >\n <Text variant='h1'>{heading}</Text>\n {actions && (\n <div>\n <MenuButton\n icon={!isMediumOrAbove ? 'more' : undefined}\n iconOnly={!isMediumOrAbove}\n variant='simple'\n text={t('actions')}\n menu={{\n items: actions.map(action => ({\n ...action,\n primary: action.text,\n visual: action.icon ? <Icon name={action.icon} /> : undefined\n })),\n scrollAt: 20\n }}\n />\n </div>\n )}\n </Flex>\n </StyledCaseHeader>\n\n <Flex container={{ direction: 'column', gap: 2, pad: 2 }} as={StyledContentContainer}>\n {stages?.content}\n\n {tabs && currentTabId && (\n <>\n {tasks?.content}\n <Tabs\n tabs={tabs}\n onTabClick={setCurrentTabId}\n currentTabId={currentTabId}\n ref={tabsRef}\n />\n\n {tabs.map(tab => (\n <TabPanel\n tabId={tab.id}\n currentTabId={currentTabId}\n key={tab.id}\n tablistRef={tabsRef}\n >\n {tab.content}\n </TabPanel>\n ))}\n </>\n )}\n\n {!tabs && (\n <Flex container={{ gap: 2 }}>\n {(utility || summary) && (\n <Flex as={StyledAside} container={{ direction: 'column', gap: 2 }}>\n {summary?.content && (\n <div role='region' aria-label={summary?.label}>\n {summary?.content}\n </div>\n )}\n {utility?.content && (\n <div role='region' aria-label={utility?.label}>\n {utility?.content}\n </div>\n )}\n </Flex>\n )}\n <Flex container={{ direction: 'column', gap: 2 }} item={{ grow: 1 }}>\n <div role='region' aria-label={tasks?.label}>\n {tasks?.content}\n </div>\n <div role='region' aria-label={feed?.label}>\n {feed?.content}\n </div>\n </Flex>\n </Flex>\n )}\n </Flex>\n </StyledCaseView>\n );\n};\n\nexport default CaseView;\n"]}
|
|
1
|
+
{"version":3,"file":"CaseView.js","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGnE,OAAO,EACL,aAAa,EACb,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,IAAI,EACJ,UAAU,EACV,OAAO,EACP,IAAI,EACJ,qBAAqB,EACrB,OAAO,EACP,YAAY,EACZ,QAAQ,EACT,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,8BAA8B,EAAE,MAAM,iEAAiE,CAAC;AAEjH,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,aAAa,EACd,MAAM,mBAAmB,CAAC;AAG3B,MAAM,QAAQ,GAAqC,CAAC,EAClD,MAAM,EACN,OAAO,EACP,OAAO,EACP,MAAM,EACN,KAAK,EACL,OAAO,EACP,IAAI,EACJ,OAAO,EACP,eAAe,GAAG,EAAE,EACpB,GAAG,SAAS,EACmB,EAAE,EAAE;IACnC,MAAM,eAAe,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM,OAAO,GAAG,MAAM,CAAc,IAAI,CAAC,CAAC;IAE1C,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE;QACxB,IAAI,eAAe;YAAE,OAAO,EAAE,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,IAAI,EAAC,QAAQ,gBAAa,OAAO,EAAE,KAAK,YAC1C,OAAO,EAAE,OAAO,GACb,CACP,EACA,OAAO,EAAE,OAAO,IAAI,CACnB,cAAK,IAAI,EAAC,QAAQ,gBAAa,OAAO,EAAE,KAAK,YAC1C,OAAO,EAAE,OAAO,GACb,CACP,IACI,CACR,EACD,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,aACjE,cAAK,IAAI,EAAC,QAAQ,gBAAa,KAAK,EAAE,KAAK,YACxC,KAAK,EAAE,OAAO,GACX,EACN,cAAK,IAAI,EAAC,QAAQ,gBAAa,IAAI,EAAE,KAAK,YACvC,IAAI,EAAE,OAAO,GACV,IACD,IACF,CACR,IACI,IACQ,CAClB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import { useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport type { FC, MouseEvent, PropsWithoutRef } from 'react';\n\nimport {\n useBreakpoint,\n Flex,\n Tabs,\n TabPanel,\n Text,\n MenuButton,\n useI18n,\n Icon,\n useAfterInitialEffect,\n getEdge,\n useDirection,\n throttle\n} from '@pega/cosmos-react-core';\nimport type { ForwardProps, Tab } from '@pega/cosmos-react-core';\nimport { StyledCaseHeaderPromotedAction } from '@pega/cosmos-react-work/lib/components/CaseView/CaseView.styles';\n\nimport {\n StyledAside,\n StyledCaseHeader,\n StyledCaseView,\n StyledContentContainer,\n StyledContent\n} from './CaseView.styles';\nimport type { CaseViewProps, Region } from './CaseView.types';\n\nconst CaseView: FC<CaseViewProps & ForwardProps> = ({\n caseId,\n heading,\n actions,\n stages,\n tasks,\n summary,\n feed,\n utility,\n promotedActions = [],\n ...restProps\n}: PropsWithoutRef<CaseViewProps>) => {\n const isMediumOrAbove = useBreakpoint('md');\n const t = useI18n();\n const tabsRef = useRef<HTMLElement>(null);\n\n const tabs = useMemo(() => {\n if (isMediumOrAbove) return [];\n const tabsArr: { name: Tab['name']; content: Region['content'] }[] = [];\n\n if (summary)\n tabsArr.push({\n name: 'Summary',\n content: summary.content\n });\n if (feed) tabsArr.push({ name: 'Feed', content: feed.content });\n if (utility)\n tabsArr.push({\n name: 'Utility',\n content: utility.content\n });\n\n return tabsArr.map(tab => ({ ...tab, id: tab.name }));\n }, [isMediumOrAbove, summary, feed, utility]);\n\n const [currentTabId, setCurrentTabId] = useState(tabs && tabs.length > 0 ? tabs[0].id : null);\n const [wrapPromotedActions, setWrapPromotedActions] = useState(false);\n const actionsContainerEl = useRef<HTMLDivElement>(null);\n const contentEl = useRef<HTMLDivElement>(null);\n const headerEl = useRef<HTMLDivElement>(null);\n const wrapActionsBreakpoint = useRef<number | null>(null);\n const { ltr } = useDirection();\n\n useAfterInitialEffect(() => {\n if (tabs.length > 0) setCurrentTabId(cur => cur ?? tabs[0].id);\n }, [tabs]);\n\n useLayoutEffect(() => {\n if (\n !wrapPromotedActions &&\n contentEl.current &&\n actionsContainerEl.current &&\n headerEl.current\n ) {\n const contentStart = getEdge({\n el: contentEl.current,\n side: 'leading',\n ltr\n });\n\n const headerGroupEnd = getEdge({\n el: headerEl.current,\n side: 'trailing',\n ltr\n });\n const actionsContainerWidth = actionsContainerEl.current.getBoundingClientRect().width;\n\n wrapActionsBreakpoint.current =\n Math.abs(Math.ceil(contentStart) - Math.ceil(headerGroupEnd)) +\n Math.ceil(actionsContainerWidth);\n }\n\n const promotedActionsWrapHandler = () => {\n if (wrapActionsBreakpoint.current && contentEl.current) {\n const availableWidth = Math.ceil(contentEl.current.offsetWidth) - 20;\n setWrapPromotedActions(availableWidth < wrapActionsBreakpoint.current);\n }\n };\n\n const resizeObserver = new ResizeObserver(throttle(promotedActionsWrapHandler, 30));\n promotedActionsWrapHandler();\n\n if (contentEl.current) {\n resizeObserver.observe(contentEl.current, { box: 'border-box' });\n }\n\n return () => {\n resizeObserver.disconnect();\n };\n }, [contentEl, actionsContainerEl, headerEl, promotedActions, heading, wrapPromotedActions]);\n\n return (\n <StyledCaseView {...restProps}>\n <StyledCaseHeader computeButtonFgColor={!isMediumOrAbove || promotedActions.length > 0}>\n <Flex\n container={{\n direction: 'column',\n justify: 'between',\n pad: 2,\n alignItems: 'center',\n gap: 2\n }}\n ref={contentEl}\n as={StyledContentContainer}\n >\n <Flex container={{ justify: 'between', alignItems: 'center', gap: 2 }} item={{ grow: 1 }}>\n <Text variant='h1' ref={headerEl}>\n {heading}\n </Text>\n\n {(promotedActions.length > 0 || actions) && (\n <Flex\n container={{\n gap: 1\n }}\n ref={actionsContainerEl}\n >\n {!wrapPromotedActions &&\n promotedActions.map(action => (\n <StyledCaseHeaderPromotedAction\n variant='secondary'\n onClick={(e: MouseEvent<HTMLButtonElement>) => action.onClick?.(action.id, e)}\n key={action.id}\n >\n {action.text}\n </StyledCaseHeaderPromotedAction>\n ))}\n {actions && (\n <MenuButton\n icon={promotedActions.length > 0 || !isMediumOrAbove ? 'more' : undefined}\n iconOnly={promotedActions.length > 0 || !isMediumOrAbove}\n variant='simple'\n text={t('actions')}\n aria-label={t('actions_for', [caseId])}\n menu={{\n items: actions.map(action => ({\n ...action,\n primary: action.text,\n visual: action.icon ? <Icon name={action.icon} /> : undefined\n })),\n scrollAt: 20\n }}\n />\n )}\n </Flex>\n )}\n </Flex>\n\n {wrapPromotedActions && promotedActions.length > 0 && (\n <Flex\n item={{ grow: 1 }}\n container={{\n justify: 'start',\n gap: 1,\n alignItems: 'center',\n wrap: 'wrap'\n }}\n >\n {promotedActions.map(action => (\n <StyledCaseHeaderPromotedAction\n variant='secondary'\n onClick={(e: MouseEvent<HTMLButtonElement>) => action.onClick?.(action.id, e)}\n key={action.id}\n >\n {action.text}\n </StyledCaseHeaderPromotedAction>\n ))}\n </Flex>\n )}\n </Flex>\n </StyledCaseHeader>\n\n <Flex container={{ direction: 'column', gap: 2, pad: 2 }} as={StyledContentContainer}>\n {stages?.content}\n {tabs.length > 0 && currentTabId && (\n <>\n {tasks?.content}\n <div>\n <Tabs\n tabs={tabs}\n onTabClick={setCurrentTabId}\n currentTabId={currentTabId}\n ref={tabsRef}\n />\n\n {tabs.map(tab => (\n <TabPanel\n tabId={tab.id}\n currentTabId={currentTabId}\n key={tab.id}\n tablistRef={tabsRef}\n >\n <StyledContent>{tab.content}</StyledContent>\n </TabPanel>\n ))}\n </div>\n </>\n )}\n\n {tabs.length === 0 && (\n <Flex container={{ gap: 2 }}>\n {(utility || summary) && (\n <Flex as={StyledAside} container={{ direction: 'column', gap: 2 }}>\n {summary?.content && (\n <div role='region' aria-label={summary?.label}>\n {summary?.content}\n </div>\n )}\n {utility?.content && (\n <div role='region' aria-label={utility?.label}>\n {utility?.content}\n </div>\n )}\n </Flex>\n )}\n <Flex container={{ direction: 'column', gap: 2 }} item={{ grow: 1 }}>\n <div role='region' aria-label={tasks?.label}>\n {tasks?.content}\n </div>\n <div role='region' aria-label={feed?.label}>\n {feed?.content}\n </div>\n </Flex>\n </Flex>\n )}\n </Flex>\n </StyledCaseView>\n );\n};\n\nexport default CaseView;\n"]}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
export declare const StyledCaseView: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
2
|
+
export declare const StyledCaseHeader: import("styled-components").StyledComponent<"header", import("styled-components").DefaultTheme, {
|
|
3
|
+
computeButtonFgColor: boolean;
|
|
4
|
+
}, never>;
|
|
1
5
|
export declare const StyledAside: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
2
6
|
export declare const StyledContentContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const StyledCaseView: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
7
|
+
export declare const StyledContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
5
8
|
//# sourceMappingURL=CaseView.styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseView.styles.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.styles.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CaseView.styles.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.styles.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,cAAc,yGAAe,CAAC;AAE3C,eAAO,MAAM,gBAAgB;0BAAyC,OAAO;SA2B5E,CAAC;AAIF,eAAO,MAAM,WAAW,yGAKtB,CAAC;AAIH,eAAO,MAAM,sBAAsB,yGAkBjC,CAAC;AAIH,eAAO,MAAM,aAAa,yGAaxB,CAAC"}
|
|
@@ -1,48 +1,68 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
|
-
import { defaultThemeProp,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
export const
|
|
2
|
+
import { defaultThemeProp, StyledButton, calculateForegroundColor, StyledCard } from '@pega/cosmos-react-core';
|
|
3
|
+
import { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';
|
|
4
|
+
import { StyledSummaryPrimaryList } from '@pega/cosmos-react-work/lib/components/CaseView/CaseView.styles';
|
|
5
|
+
export const StyledCaseView = styled.div ``;
|
|
6
|
+
export const StyledCaseHeader = styled.header(({ theme, computeButtonFgColor }) => {
|
|
7
|
+
const { components: { 'case-view': { header: { background, 'foreground-color': foregroundColor } } } } = theme;
|
|
8
|
+
const color = calculateForegroundColor(background, foregroundColor);
|
|
7
9
|
return css `
|
|
10
|
+
position: relative;
|
|
11
|
+
background: ${background};
|
|
12
|
+
|
|
13
|
+
h1 {
|
|
14
|
+
color: ${color};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
${computeButtonFgColor &&
|
|
18
|
+
css `
|
|
19
|
+
button {
|
|
20
|
+
color: ${color};
|
|
21
|
+
}
|
|
22
|
+
`}
|
|
23
|
+
`;
|
|
24
|
+
});
|
|
25
|
+
StyledCaseHeader.defaultProps = defaultThemeProp;
|
|
26
|
+
export const StyledAside = styled.div(({ theme }) => {
|
|
27
|
+
return css `
|
|
28
|
+
min-width: ${theme.base['content-width'].sm};
|
|
8
29
|
max-width: 40%;
|
|
9
30
|
`;
|
|
10
31
|
});
|
|
11
32
|
StyledAside.defaultProps = defaultThemeProp;
|
|
12
|
-
export const StyledContentContainer = styled.div(() => {
|
|
33
|
+
export const StyledContentContainer = styled.div(({ theme }) => {
|
|
13
34
|
return css `
|
|
14
35
|
width: 100%;
|
|
15
36
|
max-width: 75rem;
|
|
16
37
|
margin-inline: auto;
|
|
17
|
-
`;
|
|
18
|
-
});
|
|
19
|
-
export const StyledCaseHeader = styled.header(({ theme }) => {
|
|
20
|
-
const color = tryCatch(() => readableColor(theme.base.palette['brand-primary']));
|
|
21
|
-
const isMediumOrAbove = useBreakpoint('md');
|
|
22
|
-
return css `
|
|
23
|
-
position: relative;
|
|
24
|
-
background-color: ${theme.base.palette['brand-primary']};
|
|
25
38
|
|
|
26
39
|
h1 {
|
|
27
|
-
|
|
40
|
+
min-width: ${theme.base['content-width'].xs};
|
|
28
41
|
}
|
|
29
42
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
43
|
+
& > div {
|
|
44
|
+
width: 100%;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
${StyledButton} {
|
|
48
|
+
margin-inline-start: 0;
|
|
49
|
+
}
|
|
36
50
|
`;
|
|
37
51
|
});
|
|
38
|
-
|
|
39
|
-
export const
|
|
52
|
+
StyledContentContainer.defaultProps = defaultThemeProp;
|
|
53
|
+
export const StyledContent = styled.div(({ theme }) => {
|
|
40
54
|
return css `
|
|
41
|
-
${
|
|
42
|
-
|
|
43
|
-
|
|
55
|
+
${StyledSummaryPrimaryList} {
|
|
56
|
+
grid-template-columns: auto 1fr;
|
|
57
|
+
column-gap: calc(2 * ${theme.base.spacing});
|
|
44
58
|
}
|
|
59
|
+
${theme.components.tabs.detached &&
|
|
60
|
+
css `
|
|
61
|
+
&& ${StyledCard} > ${StyledCardHeader} {
|
|
62
|
+
padding-inline: 0;
|
|
63
|
+
}
|
|
64
|
+
`}
|
|
45
65
|
`;
|
|
46
66
|
});
|
|
47
|
-
|
|
67
|
+
StyledContent.defaultProps = defaultThemeProp;
|
|
48
68
|
//# sourceMappingURL=CaseView.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseView.styles.js","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,gBAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"CaseView.styles.js","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,EACxB,UAAU,EACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wDAAwD,CAAC;AAC1F,OAAO,EAAE,wBAAwB,EAAE,MAAM,iEAAiE,CAAC;AAE3G,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA,EAAE,CAAC;AAE3C,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAC3C,CAAC,EAAE,KAAK,EAAE,oBAAoB,EAAE,EAAE,EAAE;IAClC,MAAM,EACJ,UAAU,EAAE,EACV,WAAW,EAAE,EACX,MAAM,EAAE,EAAE,UAAU,EAAE,kBAAkB,EAAE,eAAe,EAAE,EAC5D,EACF,EACF,GAAG,KAAK,CAAC;IACV,MAAM,K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StyledCard\n} from '@pega/cosmos-react-core';\nimport { StyledCardHeader } from '@pega/cosmos-react-core/lib/components/Card/CardHeader';\nimport { StyledSummaryPrimaryList } from '@pega/cosmos-react-work/lib/components/CaseView/CaseView.styles';\n\nexport const StyledCaseView = styled.div``;\n\nexport const StyledCaseHeader = styled.header<{ computeButtonFgColor: boolean }>(\n ({ theme, computeButtonFgColor }) => {\n const {\n components: {\n 'case-view': {\n header: { background, 'foreground-color': foregroundColor }\n }\n }\n } = theme;\n const color = calculateForegroundColor(background, foregroundColor);\n\n return css`\n position: relative;\n background: ${background};\n\n h1 {\n color: ${color};\n }\n\n ${computeButtonFgColor &&\n css`\n button {\n color: ${color};\n }\n `}\n `;\n }\n);\n\nStyledCaseHeader.defaultProps = defaultThemeProp;\n\nexport const StyledAside = styled.div(({ theme }) => {\n return css`\n min-width: ${theme.base['content-width'].sm};\n max-width: 40%;\n `;\n});\n\nStyledAside.defaultProps = defaultThemeProp;\n\nexport const StyledContentContainer = styled.div(({ theme }) => {\n return css`\n width: 100%;\n max-width: 75rem;\n margin-inline: auto;\n\n h1 {\n min-width: ${theme.base['content-width'].xs};\n }\n\n & > div {\n width: 100%;\n }\n\n ${StyledButton} {\n margin-inline-start: 0;\n }\n `;\n});\n\nStyledContentContainer.defaultProps = defaultThemeProp;\n\nexport const StyledContent = styled.div(({ theme }) => {\n return css`\n ${StyledSummaryPrimaryList} {\n grid-template-columns: auto 1fr;\n column-gap: calc(2 * ${theme.base.spacing});\n }\n ${theme.components.tabs.detached &&\n css`\n && ${StyledCard} > ${StyledCardHeader} {\n padding-inline: 0;\n }\n `}\n `;\n});\n\nStyledContent.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -5,10 +5,14 @@ export interface Region {
|
|
|
5
5
|
content: ReactNode;
|
|
6
6
|
}
|
|
7
7
|
export interface CaseViewProps extends NoChildrenProp, BaseProps {
|
|
8
|
+
/** A unique identifier for the case instance. */
|
|
9
|
+
caseId: string;
|
|
8
10
|
/** A text region for the title of the CaseView. */
|
|
9
11
|
heading: string;
|
|
10
12
|
/** An icon to serve as a visual for the CaseView. */
|
|
11
13
|
icon?: IconName;
|
|
14
|
+
/** Case level promoted actions available in the CaseView header. */
|
|
15
|
+
promotedActions?: Action[];
|
|
12
16
|
/** Case level actions available in an action menu. */
|
|
13
17
|
actions?: Action[];
|
|
14
18
|
/** A region to display any summary information about the CaseView. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseView.types.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAE3F,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,CAAC;CACpB;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc,EAAE,SAAS;IAC9D,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
1
|
+
{"version":3,"file":"CaseView.types.d.ts","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAE3F,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,SAAS,CAAC;CACpB;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc,EAAE,SAAS;IAC9D,iDAAiD;IACjD,MAAM,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,oEAAoE;IACpE,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CaseView.types.js","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from 'react';\n\nimport type { NoChildrenProp, Action, BaseProps, IconName } from '@pega/cosmos-react-core';\n\nexport interface Region {\n label: string;\n content: ReactNode;\n}\n\nexport interface CaseViewProps extends NoChildrenProp, BaseProps {\n /** A text region for the title of the CaseView. */\n heading: string;\n /** An icon to serve as a visual for the CaseView. */\n icon?: IconName;\n /** Case level actions available in an action menu. */\n actions?: Action[];\n /** A region to display any summary information about the CaseView. */\n summary?: Region;\n /** A region to hold a Stages component. */\n stages?: Region;\n /** A region to hold a Tasks component. */\n tasks?: Region;\n /** A region to hold a Feed component. */\n feed?: Region;\n /** A region to hold a Utilities component. */\n utility?: Region;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CaseView.types.js","sourceRoot":"","sources":["../../../src/components/CaseView/CaseView.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ReactNode } from 'react';\n\nimport type { NoChildrenProp, Action, BaseProps, IconName } from '@pega/cosmos-react-core';\n\nexport interface Region {\n label: string;\n content: ReactNode;\n}\n\nexport interface CaseViewProps extends NoChildrenProp, BaseProps {\n /** A unique identifier for the case instance. */\n caseId: string;\n /** A text region for the title of the CaseView. */\n heading: string;\n /** An icon to serve as a visual for the CaseView. */\n icon?: IconName;\n /** Case level promoted actions available in the CaseView header. */\n promotedActions?: Action[];\n /** Case level actions available in an action menu. */\n actions?: Action[];\n /** A region to display any summary information about the CaseView. */\n summary?: Region;\n /** A region to hold a Stages component. */\n stages?: Region;\n /** A region to hold a Tasks component. */\n tasks?: Region;\n /** A region to hold a Feed component. */\n feed?: Region;\n /** A region to hold a Utilities component. */\n utility?: Region;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { ReactNode, Ref } from 'react';
|
|
2
|
+
import type { BaseProps, ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';
|
|
3
3
|
export interface BannerOptions {
|
|
4
4
|
/** An image url for the banner */
|
|
5
5
|
backgroundImage?: string;
|
|
@@ -19,7 +19,7 @@ export interface BannerOptions {
|
|
|
19
19
|
*/
|
|
20
20
|
tintImage?: boolean;
|
|
21
21
|
}
|
|
22
|
-
export interface BannerPageProps {
|
|
22
|
+
export interface BannerPageProps extends BaseProps {
|
|
23
23
|
banner: BannerOptions;
|
|
24
24
|
/** Content for the first column */
|
|
25
25
|
a: ReactNode[];
|
|
@@ -35,5 +35,5 @@ export declare const StyledBannerPage: import("styled-components").StyledCompone
|
|
|
35
35
|
export declare const StyledBannerContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, Pick<BannerOptions, "backgroundColor" | "backgroundImage">, never>;
|
|
36
36
|
export declare const StyledBanner: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, Pick<BannerOptions, "backgroundColor" | "backgroundImage" | "variant" | "tintImage">, never>;
|
|
37
37
|
export declare const StyledContentContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
38
|
-
export declare const BannerPage:
|
|
38
|
+
export declare const BannerPage: ForwardRefForwardPropsComponent<BannerPageProps>;
|
|
39
39
|
//# sourceMappingURL=BannerPage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerPage.d.ts","sourceRoot":"","sources":["../../../src/components/PageTemplates/BannerPage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"BannerPage.d.ts","sourceRoot":"","sources":["../../../src/components/PageTemplates/BannerPage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAmB,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAgB7D,OAAO,KAAK,EAAE,SAAS,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAE1F,MAAM,WAAW,aAAa;IAC5B,kCAAkC;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,6BAA6B;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,MAAM,EAAE,aAAa,CAAC;IACtB,mCAAmC;IACnC,CAAC,EAAE,SAAS,EAAE,CAAC;IACf,oFAAoF;IACpF,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B,sGAAsG;IACtG,OAAO,CAAC,EAAE,YAAY,GAAG,aAAa,GAAG,aAAa,CAAC;IACvD,mCAAmC;IACnC,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED,eAAO,MAAM,gBAAgB,yGAK3B,CAAC;AAIH,eAAO,MAAM,qBAAqB,iKAoBhC,CAAC;AAIH,eAAO,MAAM,YAAY,2LA+BxB,CAAC;AAIF,eAAO,MAAM,sBAAsB,yGAyBlC,CAAC;AAsBF,eAAO,MAAM,UAAU,EAAE,+BAA+B,CAAC,eAAe,CA4HvE,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { transparentize } from 'polished';
|
|
3
3
|
import { forwardRef, useState, useRef } from 'react';
|
|
4
4
|
import styled, { css } from 'styled-components';
|
|
5
|
-
import { defaultThemeProp, Flex, Grid, Text, tryCatch, readableColor, useBreakpoint, useI18n, Tabs, TabPanel } from '@pega/cosmos-react-core';
|
|
5
|
+
import { defaultThemeProp, Flex, Grid, Text, tryCatch, readableColor, useBreakpoint, useI18n, Tabs, TabPanel, createClassName } from '@pega/cosmos-react-core';
|
|
6
6
|
export const StyledBannerPage = styled.div(({ theme }) => {
|
|
7
7
|
return css `
|
|
8
8
|
min-height: calc(100vh - var(--appshell-offset));
|
|
@@ -56,6 +56,11 @@ export const StyledContentContainer = styled.div(({ theme: { base: { breakpoints
|
|
|
56
56
|
width: 100%;
|
|
57
57
|
margin: 0 auto;
|
|
58
58
|
|
|
59
|
+
h1 {
|
|
60
|
+
font-size: 3rem;
|
|
61
|
+
word-break: break-word;
|
|
62
|
+
}
|
|
63
|
+
|
|
59
64
|
@media screen and (min-width: ${breakpoints.md}) {
|
|
60
65
|
width: 100%;
|
|
61
66
|
padding: calc(${spacing} * 2.5);
|
|
@@ -74,16 +79,18 @@ const variantMap = {
|
|
|
74
79
|
const StylePageTabContent = styled.div(({ theme }) => {
|
|
75
80
|
return css `
|
|
76
81
|
padding-block: calc(2 * ${theme.base.spacing});
|
|
82
|
+
|
|
77
83
|
${StyledContentContainer} {
|
|
78
84
|
padding: 0;
|
|
79
85
|
}
|
|
80
86
|
`;
|
|
81
87
|
});
|
|
82
88
|
StylePageTabContent.defaultProps = defaultThemeProp;
|
|
83
|
-
export const BannerPage = forwardRef(function BannerPage({ banner, a, b, variant = 'two-column', utilities, ...restProps }, ref) {
|
|
89
|
+
export const BannerPage = forwardRef(function BannerPage({ banner, a, b, variant = 'two-column', utilities, className: classNameProp, ...restProps }, ref) {
|
|
90
|
+
const className = createClassName('banner-page', classNameProp, { variant });
|
|
84
91
|
const gridCols = variantMap[variant];
|
|
85
|
-
const pageContent = (_jsxs(Grid, { container: { gap: 2 }, md: { container: { cols: '1fr' } }, lg: { container: { cols: b ? `${gridCols}` : '1fr' } }, as: StyledContentContainer, children: [!!a.length && _jsx(Flex, { container: { direction: 'column', gap: 2 }, children: a.map(el => el) }), b && !!b.length && (_jsx(Flex, { container: { direction: 'column', gap: 2 }, children: b.map(el => el) }))] }));
|
|
86
|
-
const pageBanner = banner && (_jsx(StyledBannerContainer, { backgroundImage: banner.backgroundImage, backgroundColor: banner.backgroundColor, children: _jsx(Flex, { variant: banner.variant, backgroundImage: banner.backgroundImage, backgroundColor: banner.backgroundColor, as: StyledBanner, container: { justify: 'center', alignItems: 'center', direction: 'column', gap: 1 }, tintImage: banner.tintImage, children: _jsxs(StyledContentContainer, { children: [_jsx(Text, { variant: 'h1', children: banner.title }), banner.message && (_jsx(Text, { variant: 'primary', as: 'p', children: banner.message }))] }) }) }));
|
|
92
|
+
const pageContent = (_jsxs(Grid, { container: { gap: 2 }, md: { container: { cols: '1fr' } }, lg: { container: { cols: b ? `${gridCols}` : '1fr' } }, as: StyledContentContainer, className: createClassName('banner-page-content'), children: [!!a.length && _jsx(Flex, { container: { direction: 'column', gap: 2 }, children: a.map(el => el) }), b && !!b.length && (_jsx(Flex, { container: { direction: 'column', gap: 2 }, children: b.map(el => el) }))] }));
|
|
93
|
+
const pageBanner = banner && (_jsx(StyledBannerContainer, { backgroundImage: banner.backgroundImage, backgroundColor: banner.backgroundColor, className: createClassName('banner-page-banner'), children: _jsx(Flex, { variant: banner.variant, backgroundImage: banner.backgroundImage, backgroundColor: banner.backgroundColor, as: StyledBanner, container: { justify: 'center', alignItems: 'center', direction: 'column', gap: 1 }, tintImage: banner.tintImage, children: _jsxs(StyledContentContainer, { children: [_jsx(Text, { variant: 'h1', children: banner.title }), banner.message && (_jsx(Text, { variant: 'primary', as: 'p', children: banner.message }))] }) }) }));
|
|
87
94
|
const isMediumOrAbove = useBreakpoint('md');
|
|
88
95
|
const [panel, setPanel] = useState('content');
|
|
89
96
|
const pageTabsRef = useRef(null);
|
|
@@ -91,8 +98,8 @@ export const BannerPage = forwardRef(function BannerPage({ banner, a, b, variant
|
|
|
91
98
|
const pageTabs = [
|
|
92
99
|
{ name: t('content'), id: 'content', content: pageContent },
|
|
93
100
|
{
|
|
94
|
-
name: t('
|
|
95
|
-
id: '
|
|
101
|
+
name: t('agent'),
|
|
102
|
+
id: 'agent',
|
|
96
103
|
content: utilities
|
|
97
104
|
}
|
|
98
105
|
];
|
|
@@ -101,10 +108,10 @@ export const BannerPage = forwardRef(function BannerPage({ banner, a, b, variant
|
|
|
101
108
|
};
|
|
102
109
|
if (utilities) {
|
|
103
110
|
if (isMediumOrAbove) {
|
|
104
|
-
return (_jsxs(Flex, { as: StyledBannerPage, container: { gap: 2 }, ref: ref, ...restProps, children: [_jsxs(Flex, { container: { direction: 'column' }, item: { grow: 1 }, children: [pageBanner, pageContent] }), _jsx("div", { children: utilities })] }));
|
|
111
|
+
return (_jsxs(Flex, { as: StyledBannerPage, container: { gap: 2 }, ref: ref, ...restProps, className: className, children: [_jsxs(Flex, { container: { direction: 'column' }, item: { grow: 1 }, children: [pageBanner, pageContent] }), _jsx("div", { children: utilities })] }));
|
|
105
112
|
}
|
|
106
|
-
return (_jsxs(Flex, { container: { direction: 'column', gap: 2 }, as: StyledBannerPage, children: [pageBanner, _jsxs(Flex, { container: { direction: 'column', pad: [undefined, 2, undefined] }, children: [_jsx(Tabs, { tabs: pageTabs, onTabClick: handleTabChange, currentTabId: panel, ref: pageTabsRef }), pageTabs.map(tab => (_jsx(TabPanel, { tabId: tab.id, currentTabId: panel, tablistRef: pageTabsRef, children: _jsx(StylePageTabContent, { children: tab.content }) }, tab.id)))] })] }));
|
|
113
|
+
return (_jsxs(Flex, { container: { direction: 'column', gap: 2 }, as: StyledBannerPage, className: className, children: [pageBanner, _jsxs(Flex, { container: { direction: 'column', pad: [undefined, 2, undefined] }, children: [_jsx(Tabs, { tabs: pageTabs, onTabClick: handleTabChange, currentTabId: panel, ref: pageTabsRef }), pageTabs.map(tab => (_jsx(TabPanel, { tabId: tab.id, currentTabId: panel, tablistRef: pageTabsRef, children: _jsx(StylePageTabContent, { children: tab.content }) }, tab.id)))] })] }));
|
|
107
114
|
}
|
|
108
|
-
return (_jsxs(StyledBannerPage, { ref: ref, ...restProps, children: [pageBanner, pageContent] }));
|
|
115
|
+
return (_jsxs(StyledBannerPage, { ref: ref, ...restProps, className: className, children: [pageBanner, pageContent] }));
|
|
109
116
|
});
|
|
110
117
|
//# sourceMappingURL=BannerPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerPage.js","sourceRoot":"","sources":["../../../src/components/PageTemplates/BannerPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,gBAAgB,EAChB,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,aAAa,EACb,aAAa,EACb,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,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,aACxD,UAAU,EACV,WAAW,IACP,EACP,wBAAM,SAAS,GAAO,IACjB,CACR,CAAC;QACJ,CAAC;QAED,OAAO,CACL,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,gBAAgB,aACnE,UAAU,EACX,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,EAAE,SAAS,CAAC,EAAE,aACtE,KAAC,IAAI,IACH,IAAI,EAAE,QAAQ,EACd,UAAU,EAAE,eAAe,EAC3B,YAAY,EAAE,KAAK,EACnB,GAAG,EAAE,WAAW,GAChB,EACD,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CACnB,KAAC,QAAQ,IAAC,KAAK,EAAE,GAAG,CAAC,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,YACnE,KAAC,mBAAmB,cAAE,GAAG,CAAC,OAAO,GAAuB,IADkB,GAAG,CAAC,EAAE,CAEvE,CACZ,CAAC,IACG,IACF,CACR,CAAC;IACJ,CAAC;IAED,OAAO,CACL,MAAC,gBAAgB,IAAC,GAAG,EAAE,GAAG,KAAM,SAAS,aACtC,UAAU,EACV,WAAW,IACK,CACpB,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { transparentize } from 'polished';\nimport { forwardRef, useState, useRef } from 'react';\nimport type { FC, PropsWithoutRef, ReactNode, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n defaultThemeProp,\n Flex,\n Grid,\n Text,\n tryCatch,\n readableColor,\n useBreakpoint,\n useI18n,\n Tabs,\n TabPanel\n} from '@pega/cosmos-react-core';\nimport type { ForwardProps } from '@pega/cosmos-react-core';\n\nexport interface BannerOptions {\n /** An image url for the banner */\n backgroundImage?: string;\n /** A title for the banner */\n title: string;\n /** A fallback background color if the background image is not provided */\n backgroundColor?: string;\n /** Text that will appear below the title */\n message?: string;\n /** The light variant will provide a white translucent filter over the background image\n * with dark text. The dark variant will provide the opposite.\n * @default 'light'\n */\n variant?: 'light' | 'dark';\n /** Toggles the translucent filter provided by the variant\n * @default true\n */\n tintImage?: boolean;\n}\n\nexport interface BannerPageProps {\n banner: BannerOptions;\n /** Content for the first column */\n a: ReactNode[];\n /** Content for the second column. If not provided the first column will stretch. */\n b?: ReactNode[];\n ref?: Ref<HTMLDivElement>;\n /** Variants for the sizing of the content columns. Two column will make the columns equal in size. */\n variant?: 'two-column' | 'narrow-wide' | 'wide-narrow';\n /** Utilities as the last column */\n utilities?: ReactNode;\n}\n\nexport const StyledBannerPage = styled.div(({ theme }) => {\n return css`\n min-height: calc(100vh - var(--appshell-offset));\n background-color: ${theme.base.palette['app-background']};\n `;\n});\n\nStyledBannerPage.defaultProps = defaultThemeProp;\n\nexport const StyledBannerContainer = styled.div<\n Pick<BannerOptions, 'backgroundImage' | 'backgroundColor'>\n>(({ backgroundImage, backgroundColor, theme }) => {\n return css`\n width: 100%;\n height: calc(${theme.base.spacing} * 38);\n\n ${backgroundImage &&\n css`\n background-image: url('${backgroundImage}');\n background-size: cover;\n background-position: center;\n background-repeat: no-repeat;\n `}\n\n ${backgroundColor &&\n css`\n background-color: ${backgroundColor};\n `}\n `;\n});\n\nStyledBannerContainer.defaultProps = defaultThemeProp;\n\nexport const StyledBanner = styled.div<\n Pick<BannerOptions, 'variant' | 'backgroundColor' | 'backgroundImage' | 'tintImage'>\n>(\n ({\n variant = 'light',\n backgroundColor,\n backgroundImage,\n tintImage = true,\n theme: {\n base: {\n palette: { light, dark }\n }\n }\n }) => {\n let textColor = variant === 'light' ? dark : light;\n let overlayColor = variant === 'light' ? transparentize(0.3, light) : transparentize(0.3, dark);\n if (backgroundColor && !backgroundImage) {\n textColor = tryCatch(() => readableColor(backgroundColor)) ?? dark;\n overlayColor = 'transparent';\n } else if (!backgroundColor && !backgroundImage) {\n overlayColor = 'transparent';\n textColor = dark;\n }\n return css`\n background-color: ${tintImage ? overlayColor : 'transparent'};\n color: ${textColor};\n width: 100%;\n height: 100%;\n text-align: center;\n `;\n }\n);\n\nStyledBanner.defaultProps = defaultThemeProp;\n\nexport const StyledContentContainer = styled.div(\n ({\n theme: {\n base: { breakpoints, spacing }\n }\n }) => {\n return css`\n padding: calc(${spacing} * 2);\n width: 100%;\n margin: 0 auto;\n\n @media screen and (min-width: ${breakpoints.md}) {\n width: 100%;\n padding: calc(${spacing} * 2.5);\n }\n @media screen and (min-width: ${breakpoints.lg}) {\n max-width: 93.75rem;\n }\n `;\n }\n);\n\nStyledContentContainer.defaultProps = defaultThemeProp;\n\nconst variantMap = {\n 'two-column': '1fr 1fr',\n 'narrow-wide': '3fr 7fr',\n 'wide-narrow': '7fr 3fr'\n};\n\nconst StylePageTabContent = styled.div(({ theme }) => {\n return css`\n padding-block: calc(2 * ${theme.base.spacing});\n ${StyledContentContainer} {\n padding: 0;\n }\n `;\n});\n\nStylePageTabContent.defaultProps = defaultThemeProp;\n\nexport const BannerPage: FC<BannerPageProps & ForwardProps> = forwardRef(function BannerPage(\n {\n banner,\n a,\n b,\n variant = 'two-column',\n utilities,\n ...restProps\n }: PropsWithoutRef<BannerPageProps>,\n ref: BannerPageProps['ref']\n) {\n const gridCols = variantMap[variant];\n const pageContent = (\n <Grid\n container={{ gap: 2 }}\n md={{ container: { cols: '1fr' } }}\n lg={{ container: { cols: b ? `${gridCols}` : '1fr' } }}\n as={StyledContentContainer}\n >\n {!!a.length && <Flex container={{ direction: 'column', gap: 2 }}>{a.map(el => el)}</Flex>}\n {b && !!b.length && (\n <Flex container={{ direction: 'column', gap: 2 }}>{b.map(el => el)}</Flex>\n )}\n </Grid>\n );\n\n const pageBanner = banner && (\n <StyledBannerContainer\n backgroundImage={banner.backgroundImage}\n backgroundColor={banner.backgroundColor}\n >\n <Flex\n variant={banner.variant}\n backgroundImage={banner.backgroundImage}\n backgroundColor={banner.backgroundColor}\n as={StyledBanner}\n container={{ justify: 'center', alignItems: 'center', direction: 'column', gap: 1 }}\n tintImage={banner.tintImage}\n >\n <StyledContentContainer>\n <Text variant='h1'>{banner.title}</Text>\n {banner.message && (\n <Text variant='primary' as='p'>\n {banner.message}\n </Text>\n )}\n </StyledContentContainer>\n </Flex>\n </StyledBannerContainer>\n );\n\n const isMediumOrAbove = useBreakpoint('md');\n const [panel, setPanel] = useState('content');\n const pageTabsRef = useRef<HTMLElement>(null);\n const t = useI18n();\n\n const pageTabs = [\n { name: t('content'), id: 'content', content: pageContent },\n {\n name: t('coach', ['Pega GenAI™']),\n id: 'coach',\n content: utilities\n }\n ];\n\n const handleTabChange = (id: string) => {\n setPanel(id);\n };\n\n if (utilities) {\n if (isMediumOrAbove) {\n return (\n <Flex as={StyledBannerPage} container={{ gap: 2 }} ref={ref} {...restProps}>\n <Flex container={{ direction: 'column' }} item={{ grow: 1 }}>\n {pageBanner}\n {pageContent}\n </Flex>\n <div>{utilities}</div>\n </Flex>\n );\n }\n\n return (\n <Flex container={{ direction: 'column', gap: 2 }} as={StyledBannerPage}>\n {pageBanner}\n <Flex container={{ direction: 'column', pad: [undefined, 2, undefined] }}>\n <Tabs\n tabs={pageTabs}\n onTabClick={handleTabChange}\n currentTabId={panel}\n ref={pageTabsRef}\n />\n {pageTabs.map(tab => (\n <TabPanel tabId={tab.id} currentTabId={panel} tablistRef={pageTabsRef} key={tab.id}>\n <StylePageTabContent>{tab.content}</StylePageTabContent>\n </TabPanel>\n ))}\n </Flex>\n </Flex>\n );\n }\n\n return (\n <StyledBannerPage ref={ref} {...restProps}>\n {pageBanner}\n {pageContent}\n </StyledBannerPage>\n );\n});\n"]}
|
|
1
|
+
{"version":3,"file":"BannerPage.js","sourceRoot":"","sources":["../../../src/components/PageTemplates/BannerPage.tsx"],"names":[],"mappings":";AAAA,OAAO,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,KAAC,mBAAmB,cAAE,GAAG,CAAC,OAAO,GAAuB,IADkB,GAAG,CAAC,EAAE,CAEvE,CACZ,CAAC,IACG,IACF,CACR,CAAC;IACJ,CAAC;IAED,OAAO,CACL,MAAC,gBAAgB,IAAC,GAAG,EAAE,GAAG,KAAM,SAAS,EAAE,SAAS,EAAE,SAAS,aAC5D,UAAU,EACV,WAAW,IACK,CACpB,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import { transparentize } from 'polished';\nimport { forwardRef, useState, useRef } from 'react';\nimport type { PropsWithoutRef, ReactNode, Ref } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n defaultThemeProp,\n Flex,\n Grid,\n Text,\n tryCatch,\n readableColor,\n useBreakpoint,\n useI18n,\n Tabs,\n TabPanel,\n createClassName\n} from '@pega/cosmos-react-core';\nimport type { BaseProps, ForwardRefForwardPropsComponent } from '@pega/cosmos-react-core';\n\nexport interface BannerOptions {\n /** An image url for the banner */\n backgroundImage?: string;\n /** A title for the banner */\n title: string;\n /** A fallback background color if the background image is not provided */\n backgroundColor?: string;\n /** Text that will appear below the title */\n message?: string;\n /** The light variant will provide a white translucent filter over the background image\n * with dark text. The dark variant will provide the opposite.\n * @default 'light'\n */\n variant?: 'light' | 'dark';\n /** Toggles the translucent filter provided by the variant\n * @default true\n */\n tintImage?: boolean;\n}\n\nexport interface BannerPageProps extends BaseProps {\n banner: BannerOptions;\n /** Content for the first column */\n a: ReactNode[];\n /** Content for the second column. If not provided the first column will stretch. */\n b?: ReactNode[];\n ref?: Ref<HTMLDivElement>;\n /** Variants for the sizing of the content columns. Two column will make the columns equal in size. */\n variant?: 'two-column' | 'narrow-wide' | 'wide-narrow';\n /** Utilities as the last column */\n utilities?: ReactNode;\n}\n\nexport const StyledBannerPage = styled.div(({ theme }) => {\n return css`\n min-height: calc(100vh - var(--appshell-offset));\n background-color: ${theme.base.palette['app-background']};\n `;\n});\n\nStyledBannerPage.defaultProps = defaultThemeProp;\n\nexport const StyledBannerContainer = styled.div<\n Pick<BannerOptions, 'backgroundImage' | 'backgroundColor'>\n>(({ backgroundImage, backgroundColor, theme }) => {\n return css`\n width: 100%;\n height: calc(${theme.base.spacing} * 38);\n\n ${backgroundImage &&\n css`\n background-image: url('${backgroundImage}');\n background-size: cover;\n background-position: center;\n background-repeat: no-repeat;\n `}\n\n ${backgroundColor &&\n css`\n background-color: ${backgroundColor};\n `}\n `;\n});\n\nStyledBannerContainer.defaultProps = defaultThemeProp;\n\nexport const StyledBanner = styled.div<\n Pick<BannerOptions, 'variant' | 'backgroundColor' | 'backgroundImage' | 'tintImage'>\n>(\n ({\n variant = 'light',\n backgroundColor,\n backgroundImage,\n tintImage = true,\n theme: {\n base: {\n palette: { light, dark }\n }\n }\n }) => {\n let textColor = variant === 'light' ? dark : light;\n let overlayColor = variant === 'light' ? transparentize(0.3, light) : transparentize(0.3, dark);\n if (backgroundColor && !backgroundImage) {\n textColor = tryCatch(() => readableColor(backgroundColor)) ?? dark;\n overlayColor = 'transparent';\n } else if (!backgroundColor && !backgroundImage) {\n overlayColor = 'transparent';\n textColor = dark;\n }\n return css`\n background-color: ${tintImage ? overlayColor : 'transparent'};\n color: ${textColor};\n width: 100%;\n height: 100%;\n text-align: center;\n `;\n }\n);\n\nStyledBanner.defaultProps = defaultThemeProp;\n\nexport const StyledContentContainer = styled.div(\n ({\n theme: {\n base: { breakpoints, spacing }\n }\n }) => {\n return css`\n padding: calc(${spacing} * 2);\n width: 100%;\n margin: 0 auto;\n\n h1 {\n font-size: 3rem;\n word-break: break-word;\n }\n\n @media screen and (min-width: ${breakpoints.md}) {\n width: 100%;\n padding: calc(${spacing} * 2.5);\n }\n @media screen and (min-width: ${breakpoints.lg}) {\n max-width: 93.75rem;\n }\n `;\n }\n);\n\nStyledContentContainer.defaultProps = defaultThemeProp;\n\nconst variantMap = {\n 'two-column': '1fr 1fr',\n 'narrow-wide': '3fr 7fr',\n 'wide-narrow': '7fr 3fr'\n};\n\nconst StylePageTabContent = styled.div(({ theme }) => {\n return css`\n padding-block: calc(2 * ${theme.base.spacing});\n\n ${StyledContentContainer} {\n padding: 0;\n }\n `;\n});\n\nStylePageTabContent.defaultProps = defaultThemeProp;\n\nexport const BannerPage: ForwardRefForwardPropsComponent<BannerPageProps> = forwardRef(\n function BannerPage(\n {\n banner,\n a,\n b,\n variant = 'two-column',\n utilities,\n className: classNameProp,\n ...restProps\n }: PropsWithoutRef<BannerPageProps>,\n ref: BannerPageProps['ref']\n ) {\n const className = createClassName('banner-page', classNameProp, { variant });\n const gridCols = variantMap[variant];\n const pageContent = (\n <Grid\n container={{ gap: 2 }}\n md={{ container: { cols: '1fr' } }}\n lg={{ container: { cols: b ? `${gridCols}` : '1fr' } }}\n as={StyledContentContainer}\n className={createClassName('banner-page-content')}\n >\n {!!a.length && <Flex container={{ direction: 'column', gap: 2 }}>{a.map(el => el)}</Flex>}\n {b && !!b.length && (\n <Flex container={{ direction: 'column', gap: 2 }}>{b.map(el => el)}</Flex>\n )}\n </Grid>\n );\n\n const pageBanner = banner && (\n <StyledBannerContainer\n backgroundImage={banner.backgroundImage}\n backgroundColor={banner.backgroundColor}\n className={createClassName('banner-page-banner')}\n >\n <Flex\n variant={banner.variant}\n backgroundImage={banner.backgroundImage}\n backgroundColor={banner.backgroundColor}\n as={StyledBanner}\n container={{ justify: 'center', alignItems: 'center', direction: 'column', gap: 1 }}\n tintImage={banner.tintImage}\n >\n <StyledContentContainer>\n <Text variant='h1'>{banner.title}</Text>\n {banner.message && (\n <Text variant='primary' as='p'>\n {banner.message}\n </Text>\n )}\n </StyledContentContainer>\n </Flex>\n </StyledBannerContainer>\n );\n\n const isMediumOrAbove = useBreakpoint('md');\n const [panel, setPanel] = useState('content');\n const pageTabsRef = useRef<HTMLElement>(null);\n const t = useI18n();\n\n const pageTabs = [\n { name: t('content'), id: 'content', content: pageContent },\n {\n name: t('agent'),\n id: 'agent',\n content: utilities\n }\n ];\n\n const handleTabChange = (id: string) => {\n setPanel(id);\n };\n\n if (utilities) {\n if (isMediumOrAbove) {\n return (\n <Flex\n as={StyledBannerPage}\n container={{ gap: 2 }}\n ref={ref}\n {...restProps}\n className={className}\n >\n <Flex container={{ direction: 'column' }} item={{ grow: 1 }}>\n {pageBanner}\n {pageContent}\n </Flex>\n <div>{utilities}</div>\n </Flex>\n );\n }\n\n return (\n <Flex\n container={{ direction: 'column', gap: 2 }}\n as={StyledBannerPage}\n className={className}\n >\n {pageBanner}\n <Flex container={{ direction: 'column', pad: [undefined, 2, undefined] }}>\n <Tabs\n tabs={pageTabs}\n onTabClick={handleTabChange}\n currentTabId={panel}\n ref={pageTabsRef}\n />\n {pageTabs.map(tab => (\n <TabPanel tabId={tab.id} currentTabId={panel} tablistRef={pageTabsRef} key={tab.id}>\n <StylePageTabContent>{tab.content}</StylePageTabContent>\n </TabPanel>\n ))}\n </Flex>\n </Flex>\n );\n }\n\n return (\n <StyledBannerPage ref={ref} {...restProps} className={className}>\n {pageBanner}\n {pageContent}\n </StyledBannerPage>\n );\n }\n);\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Ref,
|
|
2
|
-
import type { BaseProps,
|
|
1
|
+
import type { Ref, MouseEventHandler } from 'react';
|
|
2
|
+
import type { BaseProps, ForwardRefForwardPropsComponent, NoChildrenProp } from '@pega/cosmos-react-core';
|
|
3
3
|
export interface QuickCreateAction {
|
|
4
4
|
label: string;
|
|
5
5
|
icon?: string;
|
|
@@ -10,8 +10,8 @@ export interface QuickCreateProps extends BaseProps, NoChildrenProp {
|
|
|
10
10
|
actions: QuickCreateAction[];
|
|
11
11
|
ref?: Ref<HTMLDivElement>;
|
|
12
12
|
}
|
|
13
|
-
export declare const StyledQuickCreate: import("styled-components").StyledComponent<FunctionComponent<import("@pega/cosmos-react-core").CardContentProps & ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
14
|
-
export declare const StyledQuickCreateButton: import("styled-components").StyledComponent<
|
|
15
|
-
declare const QuickCreate:
|
|
13
|
+
export declare const StyledQuickCreate: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").CardContentProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
14
|
+
export declare const StyledQuickCreateButton: import("styled-components").StyledComponent<ForwardRefForwardPropsComponent<import("@pega/cosmos-react-core").ButtonProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
15
|
+
declare const QuickCreate: ForwardRefForwardPropsComponent<QuickCreateProps>;
|
|
16
16
|
export default QuickCreate;
|
|
17
17
|
//# sourceMappingURL=QuickCreate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuickCreate.d.ts","sourceRoot":"","sources":["../../../src/components/QuickCreate/QuickCreate.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,iBAAiB,EAAE,
|
|
1
|
+
{"version":3,"file":"QuickCreate.d.ts","sourceRoot":"","sources":["../../../src/components/QuickCreate/QuickCreate.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAmBpD,OAAO,KAAK,EACV,SAAS,EACT,+BAA+B,EAC/B,cAAc,EACf,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,iBAAiB,CAAC;CAC5B;AAED,MAAM,WAAW,gBAAiB,SAAQ,SAAS,EAAE,cAAc;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,iBAAiB,0OAI7B,CAAC;AAEF,eAAO,MAAM,uBAAuB,kLAgBlC,CAAC;AAWH,QAAA,MAAM,WAAW,EAAE,+BAA+B,CAAC,gBAAgB,CA+ClE,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { Button, Card, CardContent, CardHeader, defaultThemeProp, Flex, Grid, Icon, StyledIcon, Text, useTheme } from '@pega/cosmos-react-core';
|
|
4
|
+
import { Button, Card, CardContent, CardHeader, createClassName, defaultThemeProp, Flex, Grid, Icon, StyledIcon, Text, Tooltip, useElement, useTheme } from '@pega/cosmos-react-core';
|
|
5
5
|
export const StyledQuickCreate = styled(CardContent) `
|
|
6
6
|
ul {
|
|
7
7
|
list-style: none;
|
|
@@ -15,6 +15,8 @@ export const StyledQuickCreateButton = styled(Button)(({ icon, theme }) => {
|
|
|
15
15
|
border-radius: ${theme.base['border-radius']};
|
|
16
16
|
justify-content: ${icon ? 'start' : 'center'};
|
|
17
17
|
text-align: start;
|
|
18
|
+
white-space: break-spaces;
|
|
19
|
+
word-break: break-word;
|
|
18
20
|
|
|
19
21
|
& ${StyledIcon} {
|
|
20
22
|
width: 1em;
|
|
@@ -29,13 +31,14 @@ const StyledButtonText = styled.span `
|
|
|
29
31
|
-webkit-line-clamp: 2;
|
|
30
32
|
overflow: hidden;
|
|
31
33
|
`;
|
|
32
|
-
const QuickCreate = forwardRef(function QuickCreate({ heading, actions, ...restProps }, ref) {
|
|
34
|
+
const QuickCreate = forwardRef(function QuickCreate({ heading, actions, className, ...restProps }, ref) {
|
|
35
|
+
const [buttonEl, setButtonEl] = useElement();
|
|
33
36
|
const theme = useTheme();
|
|
34
|
-
return (_jsxs(Card, { ...restProps, ref: ref, children: [_jsx(CardHeader, { children: _jsx(Text, { variant: 'h2', children: heading }) }), _jsx(StyledQuickCreate, { children: _jsx(Grid, { as: 'ul', container: {
|
|
37
|
+
return (_jsxs(Card, { ...restProps, ref: ref, className: createClassName('quick-create', className), children: [_jsx(CardHeader, { children: _jsx(Text, { variant: 'h2', children: heading }) }), _jsx(StyledQuickCreate, { children: _jsx(Grid, { as: 'ul', container: {
|
|
35
38
|
gap: 1,
|
|
36
39
|
cols: `repeat(auto-fill, minmax(min(${theme.base['content-width'].sm}, 100%), 1fr))`
|
|
37
40
|
}, children: actions.map(({ label, icon, onClick }) => {
|
|
38
|
-
return (
|
|
41
|
+
return (_jsxs("li", { children: [_jsx(StyledQuickCreateButton, { ref: setButtonEl, onClick: onClick, variant: 'secondary', icon: !!icon, children: _jsxs(Flex, { container: { gap: 2, alignItems: 'center' }, as: 'span', children: [icon && _jsx(Icon, { name: icon }), _jsx(StyledButtonText, { children: label })] }) }), buttonEl && (_jsx(Tooltip, { target: buttonEl, smart: true, showDelay: 'none', hideDelay: 'none', children: label }))] }, label));
|
|
39
42
|
}) }) })] }));
|
|
40
43
|
});
|
|
41
44
|
export default QuickCreate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuickCreate.js","sourceRoot":"","sources":["../../../src/components/QuickCreate/QuickCreate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,QAAQ,EACT,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"QuickCreate.js","sourceRoot":"","sources":["../../../src/components/QuickCreate/QuickCreate.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,IAAI,EACJ,WAAW,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,GAAG,EAAE,CAAC;wBACN,IAAI,EAAE,gCAAgC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EAAE,gBAAgB;qBACrF,YAEA,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;wBACxC,OAAO,CACL,yBACE,KAAC,uBAAuB,IACtB,GAAG,EAAE,WAAW,EAChB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAC,WAAW,EACnB,IAAI,EAAE,CAAC,CAAC,IAAI,YAEZ,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAC,MAAM,aACzD,IAAI,IAAI,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,GAAI,EAC7B,KAAC,gBAAgB,cAAE,KAAK,GAAoB,IACvC,GACiB,EACzB,QAAQ,IAAI,CACX,KAAC,OAAO,IAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,QAAC,SAAS,EAAC,MAAM,EAAC,SAAS,EAAC,MAAM,YAC/D,KAAK,GACE,CACX,KAhBM,KAAK,CAiBT,CACN,CAAC;oBACJ,CAAC,CAAC,GACG,GACW,IACf,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { Ref, MouseEventHandler } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n Card,\n CardContent,\n CardHeader,\n createClassName,\n defaultThemeProp,\n Flex,\n Grid,\n Icon,\n StyledIcon,\n Text,\n Tooltip,\n useElement,\n useTheme\n} from '@pega/cosmos-react-core';\nimport type {\n BaseProps,\n ForwardRefForwardPropsComponent,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\n\nexport interface QuickCreateAction {\n label: string;\n icon?: string;\n onClick: MouseEventHandler;\n}\n\nexport interface QuickCreateProps extends BaseProps, NoChildrenProp {\n heading: string;\n actions: QuickCreateAction[];\n ref?: Ref<HTMLDivElement>;\n}\n\nexport const StyledQuickCreate = styled(CardContent)`\n ul {\n list-style: none;\n }\n`;\n\nexport const StyledQuickCreateButton = styled(Button)(({ icon, theme }) => {\n return css`\n width: 100%;\n height: 4rem;\n padding: calc(${theme.base.spacing} * 2);\n border-radius: ${theme.base['border-radius']};\n justify-content: ${icon ? 'start' : 'center'};\n text-align: start;\n white-space: break-spaces;\n word-break: break-word;\n\n & ${StyledIcon} {\n width: 1em;\n height: 1em;\n }\n `;\n});\n\nStyledQuickCreateButton.defaultProps = defaultThemeProp;\n\nconst StyledButtonText = styled.span`\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 2;\n overflow: hidden;\n`;\n\nconst QuickCreate: ForwardRefForwardPropsComponent<QuickCreateProps> = forwardRef(\n function QuickCreate(\n { heading, actions, className, ...restProps }: QuickCreateProps,\n ref: QuickCreateProps['ref']\n ) {\n const [buttonEl, setButtonEl] = useElement();\n const theme = useTheme();\n return (\n <Card {...restProps} ref={ref} className={createClassName('quick-create', className)}>\n <CardHeader>\n <Text variant='h2'>{heading}</Text>\n </CardHeader>\n <StyledQuickCreate>\n <Grid\n as='ul'\n container={{\n gap: 1,\n cols: `repeat(auto-fill, minmax(min(${theme.base['content-width'].sm}, 100%), 1fr))`\n }}\n >\n {actions.map(({ label, icon, onClick }) => {\n return (\n <li key={label}>\n <StyledQuickCreateButton\n ref={setButtonEl}\n onClick={onClick}\n variant='secondary'\n icon={!!icon}\n >\n <Flex container={{ gap: 2, alignItems: 'center' }} as='span'>\n {icon && <Icon name={icon} />}\n <StyledButtonText>{label}</StyledButtonText>\n </Flex>\n </StyledQuickCreateButton>\n {buttonEl && (\n <Tooltip target={buttonEl} smart showDelay='none' hideDelay='none'>\n {label}\n </Tooltip>\n )}\n </li>\n );\n })}\n </Grid>\n </StyledQuickCreate>\n </Card>\n );\n }\n);\n\nexport default QuickCreate;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-wss",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/pegasystems/cosmos-react.git",
|
|
@@ -19,21 +19,21 @@
|
|
|
19
19
|
"build": "tsc -b tsconfig.build.json"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@pega/cosmos-react-core": "8.0.
|
|
23
|
-
"@pega/cosmos-react-social": "8.0.
|
|
24
|
-
"@pega/cosmos-react-work": "8.0.
|
|
25
|
-
"@types/react": "^17.0.62",
|
|
26
|
-
"@types/react-dom": "^17.0.20",
|
|
22
|
+
"@pega/cosmos-react-core": "8.0.1",
|
|
23
|
+
"@pega/cosmos-react-social": "8.0.1",
|
|
24
|
+
"@pega/cosmos-react-work": "8.0.1",
|
|
25
|
+
"@types/react": "^17.0.62 || ^18.3.3",
|
|
26
|
+
"@types/react-dom": "^17.0.20 || ^18.3.0",
|
|
27
27
|
"@types/styled-components": "^5.1.26",
|
|
28
28
|
"polished": "^4.1.0",
|
|
29
|
-
"react": "^17.0.0",
|
|
30
|
-
"react-dom": "^17.0.0",
|
|
29
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
30
|
+
"react-dom": "^17.0.0 || ^18.0.0",
|
|
31
31
|
"styled-components": "^5.2.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@storybook/react": "~8.2.9",
|
|
35
|
-
"@testing-library/react": "^
|
|
36
|
-
"@testing-library/user-event": "^14.
|
|
35
|
+
"@testing-library/react": "^16.0.0",
|
|
36
|
+
"@testing-library/user-event": "^14.6.1",
|
|
37
37
|
"typescript": "~5.5.4"
|
|
38
38
|
}
|
|
39
39
|
}
|