@pega/cosmos-react-wss 5.0.0-dev.4.9 → 5.0.0-dev.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/AppShell/AppShell.d.ts +6 -0
- package/lib/components/AppShell/AppShell.d.ts.map +1 -0
- package/lib/components/AppShell/AppShell.js +127 -0
- package/lib/components/AppShell/AppShell.js.map +1 -0
- package/lib/components/AppShell/AppShell.styles.d.ts +39 -0
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -0
- package/lib/components/AppShell/AppShell.styles.js +302 -0
- package/lib/components/AppShell/AppShell.styles.js.map +1 -0
- package/lib/components/AppShell/AppShell.types.d.ts +96 -0
- package/lib/components/AppShell/AppShell.types.d.ts.map +1 -0
- package/lib/components/AppShell/AppShell.types.js +2 -0
- package/lib/components/AppShell/AppShell.types.js.map +1 -0
- package/lib/components/AppShell/MobileHeaderContent.d.ts +11 -0
- package/lib/components/AppShell/MobileHeaderContent.d.ts.map +1 -0
- package/lib/components/AppShell/MobileHeaderContent.js +9 -0
- package/lib/components/AppShell/MobileHeaderContent.js.map +1 -0
- package/lib/components/AppShell/NavLinks.d.ts +11 -0
- package/lib/components/AppShell/NavLinks.d.ts.map +1 -0
- package/lib/components/AppShell/NavLinks.js +15 -0
- package/lib/components/AppShell/NavLinks.js.map +1 -0
- package/lib/components/AppShell/Notifications.d.ts +9 -0
- package/lib/components/AppShell/Notifications.d.ts.map +1 -0
- package/lib/components/AppShell/Notifications.js +18 -0
- package/lib/components/AppShell/Notifications.js.map +1 -0
- package/lib/components/AppShell/index.d.ts +3 -0
- package/lib/components/AppShell/index.d.ts.map +1 -0
- package/lib/components/AppShell/index.js +2 -0
- package/lib/components/AppShell/index.js.map +1 -0
- package/lib/components/CaseView/CaseView.d.ts +6 -0
- package/lib/components/CaseView/CaseView.d.ts.map +1 -0
- package/lib/components/CaseView/CaseView.js +35 -0
- package/lib/components/CaseView/CaseView.js.map +1 -0
- package/lib/components/CaseView/CaseView.styles.d.ts +5 -0
- package/lib/components/CaseView/CaseView.styles.d.ts.map +1 -0
- package/lib/components/CaseView/CaseView.styles.js +49 -0
- package/lib/components/CaseView/CaseView.styles.js.map +1 -0
- package/lib/components/CaseView/CaseView.types.d.ts +25 -0
- package/lib/components/CaseView/CaseView.types.d.ts.map +1 -0
- package/lib/components/CaseView/CaseView.types.js +2 -0
- package/lib/components/CaseView/CaseView.types.js.map +1 -0
- package/lib/components/CaseView/index.d.ts +3 -0
- package/lib/components/CaseView/index.d.ts.map +1 -0
- package/lib/components/CaseView/index.js +2 -0
- package/lib/components/CaseView/index.js.map +1 -0
- package/lib/components/PageTemplates/BannerPage.d.ts +36 -0
- package/lib/components/PageTemplates/BannerPage.d.ts.map +1 -0
- package/lib/components/PageTemplates/BannerPage.js +70 -0
- package/lib/components/PageTemplates/BannerPage.js.map +1 -0
- package/lib/components/PageTemplates/index.d.ts +3 -0
- package/lib/components/PageTemplates/index.d.ts.map +1 -0
- package/lib/components/PageTemplates/index.js +2 -0
- package/lib/components/PageTemplates/index.js.map +1 -0
- package/lib/components/QuickCreate/QuickCreate.d.ts +17 -0
- package/lib/components/QuickCreate/QuickCreate.d.ts.map +1 -0
- package/lib/components/QuickCreate/QuickCreate.js +43 -0
- package/lib/components/QuickCreate/QuickCreate.js.map +1 -0
- package/lib/components/QuickCreate/index.d.ts +3 -0
- package/lib/components/QuickCreate/index.d.ts.map +1 -0
- package/lib/components/QuickCreate/index.js +2 -0
- package/lib/components/QuickCreate/index.js.map +1 -0
- package/lib/index.d.ts +8 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +9 -0
- package/lib/index.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FunctionComponent } from 'react';
|
|
2
|
+
import type { ForwardProps } from '@pega/cosmos-react-core';
|
|
3
|
+
import type { AppShellProps } from './AppShell.types';
|
|
4
|
+
declare const AppShell: FunctionComponent<AppShellProps & ForwardProps>;
|
|
5
|
+
export default AppShell;
|
|
6
|
+
//# sourceMappingURL=AppShell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAe,iBAAiB,EAAmB,MAAM,OAAO,CAAC;AAsB7E,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,yBAAyB,CAAC;AAK5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AActD,QAAA,MAAM,QAAQ,EAAE,iBAAiB,CAAC,aAAa,GAAG,YAAY,CAuR5D,CAAC;AAEH,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { Avatar, Backdrop, Button, ContextSwitcher, debounce, Drawer, Flex, Icon, Image, Popover, SkipLinks, Text, useBreakpoint, useConsolidatedRef, useDirection, useElement, useI18n, useOuterEvent } from '@pega/cosmos-react-core';
|
|
4
|
+
import Operator from '@pega/cosmos-react-core/lib/components/AppShell/Operator';
|
|
5
|
+
import { StyledAppHeaderOperator } from '@pega/cosmos-react-core/lib/components/AppShell/AppHeader.styles';
|
|
6
|
+
import BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';
|
|
7
|
+
import { StyledAppHeader, StyledCountIcon, StyledHamburgerMenu, StyledMain, StyledNotificationCount, StyledPrimaryName, StyledEndNavBlock } from './AppShell.styles';
|
|
8
|
+
import Notifications from './Notifications';
|
|
9
|
+
import MobileHeaderContent from './MobileHeaderContent';
|
|
10
|
+
import NavLinks from './NavLinks';
|
|
11
|
+
const AppShell = forwardRef(function AppShell(props, ref) {
|
|
12
|
+
const { main, appInfo, navLinks, operator, notifications, contextSwitcher = {}, navAlignment = 'end', navPosition = 'inline' } = props;
|
|
13
|
+
const t = useI18n();
|
|
14
|
+
const { contexts, onContextClick, label: contextSwitcherLabel = t('switch_to') } = contextSwitcher;
|
|
15
|
+
const [backdropOpen, setBackdropOpen] = useState(false);
|
|
16
|
+
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
17
|
+
const [drawerContent, setDrawerContent] = useState('');
|
|
18
|
+
const [notificationsPopover, setNotificationsPopover] = useState(false);
|
|
19
|
+
const [linksCollapsed, setLinksCollapsed] = useState(false);
|
|
20
|
+
const [hasMobileNav, setHasMobileNav] = useState(true);
|
|
21
|
+
const [headerEl, setHeaderEl] = useElement();
|
|
22
|
+
const [navSectionEl, setNavSectionEl] = useElement();
|
|
23
|
+
const [popoverEl, setPopoverEl] = useElement();
|
|
24
|
+
const [notificationsButtonEl, setNotificationsButtonEl] = useElement();
|
|
25
|
+
const minInlineWidth = useRef(0);
|
|
26
|
+
const headerRef = useConsolidatedRef(setHeaderEl, ref);
|
|
27
|
+
const isSmallOrAbove = useBreakpoint('sm');
|
|
28
|
+
const { end } = useDirection();
|
|
29
|
+
let appInfoAs = 'div';
|
|
30
|
+
if (appInfo.href)
|
|
31
|
+
appInfoAs = 'a';
|
|
32
|
+
else if (appInfo.onClick)
|
|
33
|
+
appInfoAs = BareButton;
|
|
34
|
+
const skipLinks = useMemo(() => [
|
|
35
|
+
{
|
|
36
|
+
label: t('go_to_main_content'),
|
|
37
|
+
target: { ariaLabel: t('main_content'), selector: 'main' }
|
|
38
|
+
}
|
|
39
|
+
], [t]);
|
|
40
|
+
const closeDrawer = () => {
|
|
41
|
+
setDrawerContent('');
|
|
42
|
+
setBackdropOpen(false);
|
|
43
|
+
};
|
|
44
|
+
const openDrawer = (content) => {
|
|
45
|
+
setDrawerContent(content);
|
|
46
|
+
setBackdropOpen(true);
|
|
47
|
+
};
|
|
48
|
+
useOuterEvent('mousedown', [popoverEl, notificationsButtonEl], () => {
|
|
49
|
+
setNotificationsPopover(false);
|
|
50
|
+
notifications?.onNotificationsClose?.();
|
|
51
|
+
});
|
|
52
|
+
const debouncedResize = debounce((entries) => {
|
|
53
|
+
if (entries[0].contentRect.width > minInlineWidth.current) {
|
|
54
|
+
setLinksCollapsed(false);
|
|
55
|
+
}
|
|
56
|
+
}, 100);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
const resizeObserver = new ResizeObserver(debouncedResize);
|
|
59
|
+
const intersectionObserver = new IntersectionObserver(entries => {
|
|
60
|
+
if (entries[0].intersectionRatio > 0 &&
|
|
61
|
+
entries[0].intersectionRatio < 1 &&
|
|
62
|
+
!linksCollapsed) {
|
|
63
|
+
if (headerEl)
|
|
64
|
+
minInlineWidth.current = headerEl.clientWidth + 1;
|
|
65
|
+
setLinksCollapsed(true);
|
|
66
|
+
}
|
|
67
|
+
else if (navSectionEl)
|
|
68
|
+
navSectionEl.style.visibility = 'visible';
|
|
69
|
+
}, { root: navPosition === 'below' ? null : navSectionEl, threshold: 1 });
|
|
70
|
+
if (headerEl && navSectionEl && navSectionEl.firstChild && navSectionEl.lastChild) {
|
|
71
|
+
intersectionObserver.observe(navAlignment === 'start'
|
|
72
|
+
? navSectionEl.lastChild
|
|
73
|
+
: navSectionEl.firstChild);
|
|
74
|
+
resizeObserver.observe(headerEl);
|
|
75
|
+
}
|
|
76
|
+
return () => {
|
|
77
|
+
if (!headerEl) {
|
|
78
|
+
intersectionObserver.disconnect();
|
|
79
|
+
resizeObserver.disconnect();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}, [headerEl, navSectionEl, navLinks]);
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
setHasMobileNav(!isSmallOrAbove || linksCollapsed);
|
|
85
|
+
}, [isSmallOrAbove, linksCollapsed]);
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (!hasMobileNav && drawerOpen) {
|
|
88
|
+
if (drawerContent === 'notifications' && notifications) {
|
|
89
|
+
setNotificationsPopover(true);
|
|
90
|
+
}
|
|
91
|
+
setDrawerOpen(false);
|
|
92
|
+
}
|
|
93
|
+
else if (hasMobileNav && notificationsPopover) {
|
|
94
|
+
setNotificationsPopover(false);
|
|
95
|
+
openDrawer('notifications');
|
|
96
|
+
}
|
|
97
|
+
}, [hasMobileNav, drawerOpen]);
|
|
98
|
+
return (_jsxs(_Fragment, { children: [_jsx(SkipLinks, { items: skipLinks }), _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: () => {
|
|
99
|
+
if (!hasMobileNav) {
|
|
100
|
+
if (notificationsPopover) {
|
|
101
|
+
setNotificationsPopover(false);
|
|
102
|
+
notifications.onNotificationsClose?.();
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
setNotificationsPopover(true);
|
|
106
|
+
notifications.onNotificationsOpen?.();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
openDrawer('notifications');
|
|
111
|
+
}
|
|
112
|
+
}, 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 }))] }), _jsx(StyledMain, { navPosition: navPosition, children: main }), _jsx(Backdrop, { open: backdropOpen, transitionSpeed: 'none', onAfterTransitionIn: () => setDrawerOpen(true), onBeforeTransitionOut: () => setDrawerOpen(false), onClick: e => {
|
|
113
|
+
if (e.currentTarget === e.target)
|
|
114
|
+
setDrawerOpen(false);
|
|
115
|
+
}, children: _jsxs(Drawer, { open: drawerOpen, onAfterClose: () => {
|
|
116
|
+
closeDrawer();
|
|
117
|
+
if (drawerContent === 'notifications') {
|
|
118
|
+
notifications?.onNotificationsClose?.();
|
|
119
|
+
}
|
|
120
|
+
}, onAfterOpen: () => {
|
|
121
|
+
if (drawerContent === 'notifications') {
|
|
122
|
+
notifications?.onNotificationsOpen?.();
|
|
123
|
+
}
|
|
124
|
+
}, position: 'fixed', placement: end, size: 'min(26rem, calc(100vw - 5rem))', nullWhenClosed: true, children: [drawerContent === 'notifications' && notifications && (_jsx(Notifications, { ...notifications, onClose: () => setDrawerOpen(false) })), drawerContent === 'navigationOperator' && (_jsx(MobileHeaderContent, { appInfo: appInfo, navLinks: navLinks, operator: operator, onClose: () => setDrawerOpen(false) }))] }) })] }));
|
|
125
|
+
});
|
|
126
|
+
export default AppShell;
|
|
127
|
+
//# sourceMappingURL=AppShell.js.map
|
|
@@ -0,0 +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,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,EACd,MAAM,yBAAyB,CAAC;AAEjC,OAAO,QAAQ,MAAM,0DAA0D,CAAC;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,kEAAkE,CAAC;AAC3G,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAGlF,OAAO,EACL,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,MAAM,QAAQ,GAAoD,UAAU,CAAC,SAAS,QAAQ,CAC5F,KAAqC,EACrC,GAAyB;IAEzB,MAAM,EACJ,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,eAAe,GAAG,EAAE,EACpB,YAAY,GAAG,KAAK,EACpB,WAAW,GAAG,QAAQ,EACvB,GAAG,KAAK,CAAC;IACV,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,MAAM,EACJ,QAAQ,EACR,cAAc,EACd,KAAK,EAAE,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AI,aAAa,KAAK,eAAe,EAAE;4BACrC,aAAa,EAAE,mBAAmB,EAAE,EAAE,CAAC;yBACxC;oBACH,CAAC,EACD,QAAQ,EAAC,OAAO,EAChB,SAAS,EAAE,GAAG,EACd,IAAI,EAAC,gCAAgC,EACrC,cAAc,mBAEb,aAAa,KAAK,eAAe,IAAI,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, FunctionComponent, PropsWithoutRef } from 'react';\n\nimport {\n Avatar,\n Backdrop,\n Button,\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} 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';\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\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 && 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 <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\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"]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { AppShellProps } from './AppShell.types';
|
|
3
|
+
export declare const StyledNav: import("styled-components").StyledComponent<"nav", import("styled-components").DefaultTheme, {}, never>;
|
|
4
|
+
export declare const StyledAppHeader: import("styled-components").StyledComponent<"header", import("styled-components").DefaultTheme, {
|
|
5
|
+
navPosition: AppShellProps['navPosition'];
|
|
6
|
+
}, never>;
|
|
7
|
+
export declare const StyledPrimaryName: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
|
|
8
|
+
export declare const StyledEndNavBlock: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
9
|
+
mobile: boolean;
|
|
10
|
+
}, never>;
|
|
11
|
+
export declare const StyledLink: import("styled-components").StyledComponent<"a", import("styled-components").DefaultTheme, {}, never>;
|
|
12
|
+
export declare const StyledMain: import("styled-components").StyledComponent<"main", import("styled-components").DefaultTheme, {
|
|
13
|
+
navPosition: AppShellProps['navPosition'];
|
|
14
|
+
}, never>;
|
|
15
|
+
export declare const StyledHamburgerMenu: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
|
|
16
|
+
export declare const StyledMobileNav: import("styled-components").StyledComponent<"nav", import("styled-components").DefaultTheme, {}, never>;
|
|
17
|
+
export declare const StyledMobileLink: import("styled-components").StyledComponent<"a", import("styled-components").DefaultTheme, {}, never>;
|
|
18
|
+
export declare const StyledLinkSection: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
19
|
+
export declare const StyledOperatorSection: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
20
|
+
export declare const HorizontalBreak: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
21
|
+
export declare const StyledNotificationCount: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
|
|
22
|
+
export declare const StyledCountIcon: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Omit<import("@pega/cosmos-react-core").CountProps, "ref"> & import("react").RefAttributes<HTMLSpanElement>> & {
|
|
23
|
+
getTestIds: (testIdProp?: string | undefined) => import("@pega/cosmos-react-core").TestIdsRecord<readonly []>;
|
|
24
|
+
}, import("styled-components").DefaultTheme, {}, never>;
|
|
25
|
+
export declare const StyledNotifications: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
26
|
+
popover?: boolean | undefined;
|
|
27
|
+
}, never>;
|
|
28
|
+
export declare const StyledNotificationList: import("styled-components").StyledComponent<"ul", import("styled-components").DefaultTheme, {}, never>;
|
|
29
|
+
export declare const StyledNotification: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core/lib/components/Button/BareButton").BareButtonProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
30
|
+
export declare const StyledNotificationVisual: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
|
|
31
|
+
unread?: boolean | undefined;
|
|
32
|
+
}, never>;
|
|
33
|
+
export declare const StyledNotificationPrimary: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
|
|
34
|
+
unread?: boolean | undefined;
|
|
35
|
+
}, never>;
|
|
36
|
+
export declare const StyledNotificationSecondary: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
|
|
37
|
+
unread?: boolean | undefined;
|
|
38
|
+
}, never>;
|
|
39
|
+
//# sourceMappingURL=AppShell.styles.d.ts.map
|
|
@@ -0,0 +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;SAyCvF,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;;uDAkB3B,CAAC;AAEF,eAAO,MAAM,mBAAmB;;SAW9B,CAAC;AAIH,eAAO,MAAM,sBAAsB,wGAQjC,CAAC;AAIH,eAAO,MAAM,kBAAkB,0QA0B7B,CAAC;AAIH,eAAO,MAAM,wBAAwB;;SAiBnC,CAAC;AAIH,eAAO,MAAM,yBAAyB;;SAMpC,CAAC;AAIH,eAAO,MAAM,2BAA2B;;SAUvC,CAAC"}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { lighten, mix } from 'polished';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { calculateFontSize, Count, defaultThemeProp, StyledFlex, StyledImage, StyledText, StyledVisual, tryCatch } from '@pega/cosmos-react-core';
|
|
4
|
+
import { StyledAppHeaderOperator } from '@pega/cosmos-react-core/lib/components/AppShell/AppHeader.styles';
|
|
5
|
+
import { StyledAlert } from '@pega/cosmos-react-core/lib/components/Badges/Alert';
|
|
6
|
+
import BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';
|
|
7
|
+
const headerHeight = '3rem';
|
|
8
|
+
const tallHeaderHeight = '6rem';
|
|
9
|
+
export const StyledNav = styled.nav `
|
|
10
|
+
white-space: nowrap;
|
|
11
|
+
overflow: visible;
|
|
12
|
+
visibility: hidden;
|
|
13
|
+
height: 100%;
|
|
14
|
+
|
|
15
|
+
a:hover,
|
|
16
|
+
button:hover {
|
|
17
|
+
text-decoration: none;
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
export const StyledAppHeader = styled.header(({ navPosition, theme }) => {
|
|
21
|
+
return css `
|
|
22
|
+
position: sticky;
|
|
23
|
+
inset-block-start: 0;
|
|
24
|
+
height: ${navPosition === 'below' ? tallHeaderHeight : headerHeight};
|
|
25
|
+
width: 100%;
|
|
26
|
+
background-color: ${theme.base.palette['primary-background']};
|
|
27
|
+
z-index: calc(${theme.base['z-index'].popover} + 1);
|
|
28
|
+
border-bottom: 0.0625rem solid ${theme.base.palette['border-line']};
|
|
29
|
+
|
|
30
|
+
${StyledImage} {
|
|
31
|
+
height: 1.625rem;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
& > ${StyledFlex} {
|
|
35
|
+
height: ${headerHeight};
|
|
36
|
+
|
|
37
|
+
${StyledAppHeaderOperator} {
|
|
38
|
+
margin: ${theme.base.spacing};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
& > a,
|
|
42
|
+
& > button {
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
text-decoration: none;
|
|
45
|
+
user-select: none;
|
|
46
|
+
-webkit-user-select: none;
|
|
47
|
+
min-height: ${headerHeight};
|
|
48
|
+
|
|
49
|
+
&:focus {
|
|
50
|
+
box-shadow: ${theme.base.shadow.focus};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
& > ${StyledNav} {
|
|
56
|
+
height: calc(${tallHeaderHeight} - ${headerHeight});
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
});
|
|
60
|
+
StyledAppHeader.defaultProps = defaultThemeProp;
|
|
61
|
+
export const StyledPrimaryName = styled.span(({ theme }) => {
|
|
62
|
+
const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);
|
|
63
|
+
return css `
|
|
64
|
+
color: ${theme.base.palette['foreground-color']};
|
|
65
|
+
font-size: ${fontSize.xxl};
|
|
66
|
+
white-space: nowrap;
|
|
67
|
+
overflow: hidden;
|
|
68
|
+
text-overflow: ellipsis;
|
|
69
|
+
display: block;
|
|
70
|
+
max-width: 50ch;
|
|
71
|
+
`;
|
|
72
|
+
});
|
|
73
|
+
StyledPrimaryName.defaultProps = defaultThemeProp;
|
|
74
|
+
export const StyledEndNavBlock = styled.div(({ mobile }) => {
|
|
75
|
+
return (mobile &&
|
|
76
|
+
css `
|
|
77
|
+
margin-inline-start: auto;
|
|
78
|
+
`);
|
|
79
|
+
});
|
|
80
|
+
export const StyledLink = styled.a(({ theme }) => {
|
|
81
|
+
const hoverColor = lighten(0.2, theme.base.palette.interactive);
|
|
82
|
+
const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);
|
|
83
|
+
return css `
|
|
84
|
+
margin: 0 calc(0.5 * ${theme.base.spacing});
|
|
85
|
+
padding: 0 calc(0.5 * ${theme.base.spacing});
|
|
86
|
+
font-size: ${fontSize.m};
|
|
87
|
+
position: relative;
|
|
88
|
+
height: 100%;
|
|
89
|
+
display: flex;
|
|
90
|
+
align-items: center;
|
|
91
|
+
|
|
92
|
+
&:last-of-type {
|
|
93
|
+
margin-inline-end: ${theme.base.spacing};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&[aria-current='page'] {
|
|
97
|
+
::after {
|
|
98
|
+
content: '';
|
|
99
|
+
position: absolute;
|
|
100
|
+
inset-inline-start: 0;
|
|
101
|
+
inset-block-end: 0;
|
|
102
|
+
background-color: ${theme.base.palette.interactive};
|
|
103
|
+
height: 0.125rem;
|
|
104
|
+
width: 100%;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&:hover {
|
|
109
|
+
::after {
|
|
110
|
+
content: '';
|
|
111
|
+
position: absolute;
|
|
112
|
+
inset-inline-start: 0;
|
|
113
|
+
inset-block-end: 0;
|
|
114
|
+
background-color: ${hoverColor};
|
|
115
|
+
height: 0.125rem;
|
|
116
|
+
width: 100%;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
`;
|
|
120
|
+
});
|
|
121
|
+
StyledLink.defaultProps = defaultThemeProp;
|
|
122
|
+
export const StyledMain = styled.main(({ navPosition, theme }) => {
|
|
123
|
+
const calculatedHeaderHeight = navPosition === 'below' ? tallHeaderHeight : headerHeight;
|
|
124
|
+
return css `
|
|
125
|
+
--appshell-offset: ${calculatedHeaderHeight};
|
|
126
|
+
--appshell-horizontal-offset: 0;
|
|
127
|
+
position: relative;
|
|
128
|
+
min-height: calc(100vh - ${calculatedHeaderHeight});
|
|
129
|
+
background-color: ${theme.base.palette['primary-background']};
|
|
130
|
+
|
|
131
|
+
:focus {
|
|
132
|
+
outline: none;
|
|
133
|
+
}
|
|
134
|
+
`;
|
|
135
|
+
});
|
|
136
|
+
StyledMain.defaultProps = defaultThemeProp;
|
|
137
|
+
export const StyledHamburgerMenu = styled.button(({ theme }) => {
|
|
138
|
+
return css `
|
|
139
|
+
margin: ${theme.base.spacing};
|
|
140
|
+
`;
|
|
141
|
+
});
|
|
142
|
+
StyledHamburgerMenu.defaultProps = defaultThemeProp;
|
|
143
|
+
export const StyledMobileNav = styled.nav(({ theme }) => {
|
|
144
|
+
return css `
|
|
145
|
+
height: 100vh;
|
|
146
|
+
background-color: ${theme.base.palette['primary-background']};
|
|
147
|
+
`;
|
|
148
|
+
});
|
|
149
|
+
StyledMobileNav.defaultProps = defaultThemeProp;
|
|
150
|
+
export const StyledMobileLink = styled.a(({ theme }) => {
|
|
151
|
+
const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);
|
|
152
|
+
const activeColor = tryCatch(() => mix(0.85, theme.base.palette['primary-background'], theme.base.palette.interactive));
|
|
153
|
+
const hoverColor = tryCatch(() => mix(0.95, theme.base.palette['primary-background'], theme.base.palette.interactive));
|
|
154
|
+
return css `
|
|
155
|
+
font-size: ${fontSize.m};
|
|
156
|
+
padding: ${theme.base.spacing} calc(3 * ${theme.base.spacing});
|
|
157
|
+
background-color: ${theme.base.palette['primary-background']};
|
|
158
|
+
|
|
159
|
+
& + & {
|
|
160
|
+
margin-inline-start: 0;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
&:hover,
|
|
164
|
+
&:focus {
|
|
165
|
+
background-color: ${hoverColor};
|
|
166
|
+
text-decoration: none;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
&[aria-current='page'] {
|
|
170
|
+
font-weight: ${theme.base['font-weight']['semi-bold']};
|
|
171
|
+
background-color: ${activeColor};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@media (pointer: coarse) {
|
|
175
|
+
height: ${theme.base['hit-area'].finger};
|
|
176
|
+
}
|
|
177
|
+
`;
|
|
178
|
+
});
|
|
179
|
+
StyledMobileLink.defaultProps = defaultThemeProp;
|
|
180
|
+
export const StyledLinkSection = styled.div `
|
|
181
|
+
overflow: auto;
|
|
182
|
+
`;
|
|
183
|
+
export const StyledOperatorSection = styled.div `
|
|
184
|
+
position: sticky;
|
|
185
|
+
bottom: 0;
|
|
186
|
+
`;
|
|
187
|
+
export const HorizontalBreak = styled.div(({ theme }) => {
|
|
188
|
+
return css `
|
|
189
|
+
background-color: ${theme.base.palette['border-line']};
|
|
190
|
+
height: 0.0625rem;
|
|
191
|
+
margin: ${theme.base.spacing} calc(6 * ${theme.base.spacing}) 0 calc(3 * ${theme.base.spacing});
|
|
192
|
+
|
|
193
|
+
& + ${StyledFlex} {
|
|
194
|
+
margin-inline-start: calc(3 * ${theme.base.spacing});
|
|
195
|
+
}
|
|
196
|
+
`;
|
|
197
|
+
});
|
|
198
|
+
HorizontalBreak.defaultProps = defaultThemeProp;
|
|
199
|
+
export const StyledNotificationCount = styled.span `
|
|
200
|
+
flex-shrink: 0;
|
|
201
|
+
`;
|
|
202
|
+
export const StyledCountIcon = styled(Count)(({ theme: { base: { spacing } } }) => {
|
|
203
|
+
return css `
|
|
204
|
+
position: absolute;
|
|
205
|
+
inset-inline-start: calc(2 * ${spacing});
|
|
206
|
+
inset-block-start: calc(-0.25 * ${spacing});
|
|
207
|
+
padding: 0 calc(0.5 * ${spacing});
|
|
208
|
+
|
|
209
|
+
@media (pointer: coarse) {
|
|
210
|
+
inset-inline-start: calc(2.5 * ${spacing});
|
|
211
|
+
inset-block-start: calc(0.5 * ${spacing});
|
|
212
|
+
}
|
|
213
|
+
`;
|
|
214
|
+
});
|
|
215
|
+
export const StyledNotifications = styled.div(({ popover, theme }) => {
|
|
216
|
+
return css `
|
|
217
|
+
min-height: ${popover ? '10rem' : '100vh'};
|
|
218
|
+
max-height: ${popover ? '50vh' : '100vh'};
|
|
219
|
+
background-color: ${theme.base.palette['primary-background']};
|
|
220
|
+
|
|
221
|
+
${popover &&
|
|
222
|
+
css `
|
|
223
|
+
max-width: 80ch;
|
|
224
|
+
`}
|
|
225
|
+
`;
|
|
226
|
+
});
|
|
227
|
+
StyledNotifications.defaultProps = defaultThemeProp;
|
|
228
|
+
export const StyledNotificationList = styled.ul(({ theme }) => {
|
|
229
|
+
return css `
|
|
230
|
+
overflow: auto;
|
|
231
|
+
|
|
232
|
+
& > li:not(:last-of-type) {
|
|
233
|
+
border-bottom: solid 0.0625rem ${theme.base.palette['border-line']};
|
|
234
|
+
}
|
|
235
|
+
`;
|
|
236
|
+
});
|
|
237
|
+
StyledNotificationList.defaultProps = defaultThemeProp;
|
|
238
|
+
export const StyledNotification = styled(BareButton)(({ theme }) => {
|
|
239
|
+
const hoverColor = lighten(0.55, theme.base.palette.interactive);
|
|
240
|
+
return css `
|
|
241
|
+
width: 100%;
|
|
242
|
+
padding: calc(2 * ${theme.base.spacing}) calc(3 * ${theme.base.spacing});
|
|
243
|
+
background-color: ${theme.base.palette['primary-background']};
|
|
244
|
+
text-decoration: none;
|
|
245
|
+
cursor: pointer;
|
|
246
|
+
text-align: start;
|
|
247
|
+
white-space: normal;
|
|
248
|
+
|
|
249
|
+
&:hover,
|
|
250
|
+
&:focus {
|
|
251
|
+
background-color: ${hoverColor};
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
&:focus {
|
|
255
|
+
outline: none;
|
|
256
|
+
box-shadow: ${theme.base.shadow['focus-inset']};
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
${StyledVisual} {
|
|
260
|
+
align-self: flex-start;
|
|
261
|
+
}
|
|
262
|
+
`;
|
|
263
|
+
});
|
|
264
|
+
StyledNotification.defaultProps = defaultThemeProp;
|
|
265
|
+
export const StyledNotificationVisual = styled.span(({ theme, unread }) => {
|
|
266
|
+
return css `
|
|
267
|
+
position: relative;
|
|
268
|
+
${StyledAlert} {
|
|
269
|
+
position: absolute;
|
|
270
|
+
inset-inline-start: 0.375rem;
|
|
271
|
+
inset-block-start: 1.625rem;
|
|
272
|
+
background-color: ${theme.base.palette.interactive};
|
|
273
|
+
height: 0.75rem;
|
|
274
|
+
width: 0.75rem;
|
|
275
|
+
|
|
276
|
+
${!unread &&
|
|
277
|
+
css `
|
|
278
|
+
display: none;
|
|
279
|
+
`}
|
|
280
|
+
}
|
|
281
|
+
`;
|
|
282
|
+
});
|
|
283
|
+
StyledNotificationVisual.defaultProps = defaultThemeProp;
|
|
284
|
+
export const StyledNotificationPrimary = styled.span(({ theme, unread }) => {
|
|
285
|
+
return css `
|
|
286
|
+
font-weight: ${unread
|
|
287
|
+
? theme.base['font-weight'].bold
|
|
288
|
+
: theme.base['font-weight']['semi-bold']};
|
|
289
|
+
`;
|
|
290
|
+
});
|
|
291
|
+
StyledNotificationPrimary.defaultProps = defaultThemeProp;
|
|
292
|
+
export const StyledNotificationSecondary = styled.span(({ theme, unread }) => {
|
|
293
|
+
return css `
|
|
294
|
+
${StyledText} {
|
|
295
|
+
opacity: ${unread
|
|
296
|
+
? theme.base.transparency['transparent-1']
|
|
297
|
+
: theme.base.transparency['transparent-3']};
|
|
298
|
+
}
|
|
299
|
+
`;
|
|
300
|
+
});
|
|
301
|
+
StyledNotificationSecondary.defaultProps = defaultThemeProp;
|
|
302
|
+
//# sourceMappingURL=AppShell.styles.js.map
|
|
@@ -0,0 +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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import 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\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 ({\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);\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"]}
|