@pega/cosmos-react-wss 3.0.0-dev.11.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.
Files changed (34) hide show
  1. package/LICENSE +185 -0
  2. package/lib/components/AppShell/AppShell.d.ts +6 -0
  3. package/lib/components/AppShell/AppShell.d.ts.map +1 -0
  4. package/lib/components/AppShell/AppShell.js +120 -0
  5. package/lib/components/AppShell/AppShell.js.map +1 -0
  6. package/lib/components/AppShell/AppShell.styles.d.ts +33 -0
  7. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -0
  8. package/lib/components/AppShell/AppShell.styles.js +293 -0
  9. package/lib/components/AppShell/AppShell.styles.js.map +1 -0
  10. package/lib/components/AppShell/AppShell.types.d.ts +93 -0
  11. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -0
  12. package/lib/components/AppShell/AppShell.types.js +2 -0
  13. package/lib/components/AppShell/AppShell.types.js.map +1 -0
  14. package/lib/components/AppShell/MobileHeaderContent.d.ts +11 -0
  15. package/lib/components/AppShell/MobileHeaderContent.d.ts.map +1 -0
  16. package/lib/components/AppShell/MobileHeaderContent.js +9 -0
  17. package/lib/components/AppShell/MobileHeaderContent.js.map +1 -0
  18. package/lib/components/AppShell/NavLinks.d.ts +11 -0
  19. package/lib/components/AppShell/NavLinks.d.ts.map +1 -0
  20. package/lib/components/AppShell/NavLinks.js +15 -0
  21. package/lib/components/AppShell/NavLinks.js.map +1 -0
  22. package/lib/components/AppShell/Notifications.d.ts +9 -0
  23. package/lib/components/AppShell/Notifications.d.ts.map +1 -0
  24. package/lib/components/AppShell/Notifications.js +18 -0
  25. package/lib/components/AppShell/Notifications.js.map +1 -0
  26. package/lib/components/AppShell/index.d.ts +3 -0
  27. package/lib/components/AppShell/index.d.ts.map +1 -0
  28. package/lib/components/AppShell/index.js +2 -0
  29. package/lib/components/AppShell/index.js.map +1 -0
  30. package/lib/index.d.ts +3 -0
  31. package/lib/index.d.ts.map +1 -0
  32. package/lib/index.js +4 -0
  33. package/lib/index.js.map +1 -0
  34. package/package.json +40 -0
package/LICENSE ADDED
@@ -0,0 +1,185 @@
1
+ Cosmos License
2
+ Version 1.0, September 2020
3
+ This is a proprietary license that is based on the Apache 2.0 license and
4
+ is intended to provide a similar set of rights with the exception that any and
5
+ all Cosmos components shall be used only with Pegasystems Software.
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work.
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ "Pegasystems" (or "Pega") shall mean Pegasystems Inc., a Massachusetts
68
+ Corporation, having an office at One Rogers Street, Cambridge, MA 02142.
69
+
70
+ "Pegasystems Software" shall mean duly licensed Pegasystems software
71
+ and/or subscription services including but not limited to the Pega
72
+ Platform.
73
+
74
+ 2. Grant of Copyright License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ copyright license to reproduce, prepare Derivative Works of,
78
+ publicly display, publicly perform, sublicense, and distribute the
79
+ Work and such Derivative Works in Source or Object form solely for
80
+ use with Pegasystems Software.
81
+
82
+ 3. Grant of Patent License. Subject to the terms and conditions of
83
+ this License, each Contributor hereby grants to You a perpetual,
84
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
85
+ (except as stated in this section) patent license to make, have made,
86
+ use, offer to sell, sell, import, and otherwise transfer the Work,
87
+ where such license applies only to those patent claims licensable
88
+ by such Contributor that are necessarily infringed by their
89
+ Contribution(s) alone or by combination of their Contribution(s)
90
+ with the Work to which such Contribution(s) was submitted. If You
91
+ institute patent litigation against any entity (including a
92
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
93
+ or a Contribution incorporated within the Work constitutes direct
94
+ or contributory patent infringement, then any patent licenses
95
+ granted to You under this License for that Work shall terminate
96
+ as of the date such litigation is filed.
97
+
98
+ 4. Redistribution. You may reproduce and distribute copies of the
99
+ Work or Derivative Works thereof in any medium, with or without
100
+ modifications, and in Source or Object form, provided that You
101
+ meet the following conditions:
102
+
103
+ (a) You must give any other recipients of the Work or
104
+ Derivative Works a copy of this License; and
105
+
106
+ (b) You must cause any modified files to carry prominent notices
107
+ stating that You changed the files; and
108
+
109
+ (c) You must retain, in the Source form of any Derivative Works
110
+ that You distribute, all copyright, patent, trademark, and
111
+ attribution notices from the Source form of the Work,
112
+ excluding those notices that do not pertain to any part of
113
+ the Derivative Works; and
114
+
115
+ (d) If the Work includes a "NOTICE" text file as part of its
116
+ distribution, then any Derivative Works that You distribute must
117
+ include a readable copy of the attribution notices contained
118
+ within such NOTICE file, excluding those notices that do not
119
+ pertain to any part of the Derivative Works, in at least one
120
+ of the following places: within a NOTICE text file distributed
121
+ as part of the Derivative Works; within the Source form or
122
+ documentation, if provided along with the Derivative Works; or,
123
+ within a display generated by the Derivative Works, if and
124
+ wherever such third-party notices normally appear. The contents
125
+ of the NOTICE file are for informational purposes only and
126
+ do not modify the License. You may add Your own attribution
127
+ notices within Derivative Works that You distribute, alongside
128
+ or as an addendum to the NOTICE text from the Work, provided
129
+ that such additional attribution notices cannot be construed
130
+ as modifying the License.
131
+
132
+ You may add Your own copyright statement to Your modifications and
133
+ may provide additional or different license terms and conditions
134
+ for use, reproduction, or distribution of Your modifications, or
135
+ for any such Derivative Works as a whole, provided Your use,
136
+ reproduction, and distribution of the Work otherwise complies with
137
+ the conditions stated in this License including the limitation that
138
+ the Work be used only with Pegasystems Software.
139
+
140
+ 5. Submission of Contributions. Any Contribution intentionally submitted
141
+ for inclusion in the Work by You to the Licensor shall be under the
142
+ terms and conditions of this License, without any additional terms or
143
+ conditions. Notwithstanding the above, nothing herein shall supersede
144
+ or modify the terms of any separate license agreement you may have
145
+ executed with Licensor regarding such Contributions.
146
+
147
+ 6. Trademarks. This License does not grant permission to use the trade
148
+ names, trademarks, service marks, or product names of the Licensor,
149
+ except as required for reasonable and customary use in describing the
150
+ origin of the Work and reproducing the content of the NOTICE file.
151
+
152
+ 7. Disclaimer of Warranty. Unless required by applicable law or
153
+ agreed to in writing, Licensor provides the Work (and each
154
+ Contributor provides its Contributions) on an "AS IS" BASIS,
155
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
156
+ implied, including, without limitation, any warranties or conditions
157
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
158
+ PARTICULAR PURPOSE. You are solely responsible for determining the
159
+ appropriateness of using or redistributing the Work and assume any
160
+ risks associated with Your exercise of permissions under this License.
161
+
162
+ 8. Limitation of Liability. In no event and under no legal theory,
163
+ whether in tort (including negligence), contract, or otherwise,
164
+ unless required by applicable law (such as deliberate and grossly
165
+ negligent acts) or agreed to in writing, shall any Contributor be
166
+ liable to You for damages, including any direct, indirect, special,
167
+ incidental, or consequential damages of any character arising as a
168
+ result of this License or out of the use or inability to use the
169
+ Work (including but not limited to damages for loss of goodwill,
170
+ work stoppage, computer failure or malfunction, or any and all
171
+ other commercial damages or losses), even if such Contributor
172
+ has been advised of the possibility of such damages.
173
+
174
+ 9. Accepting Warranty or Additional Liability. While redistributing
175
+ the Work or Derivative Works thereof, You may choose to offer,
176
+ and charge a fee for, acceptance of support, warranty, indemnity,
177
+ or other liability obligations and/or rights consistent with this
178
+ License. However, in accepting such obligations, You may act only
179
+ on Your own behalf and on Your sole responsibility, not on behalf
180
+ of any other Contributor, and only if You agree to indemnify,
181
+ defend, and hold each Contributor harmless for any liability
182
+ incurred by, or claims asserted against, such Contributor by reason
183
+ of your accepting any such warranty or additional liability.
184
+
185
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,6 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { ForwardProps } from '@pega/cosmos-react-core';
3
+ import { 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":"AAAA,OAAO,EAGL,iBAAiB,EAKlB,MAAM,OAAO,CAAC;AAEf,OAAO,EAQL,YAAY,EAYb,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAajD,QAAA,MAAM,QAAQ,EAAE,iBAAiB,CAAC,aAAa,GAAG,YAAY,CA6P7D,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,120 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { forwardRef, useEffect, useRef, useState } from 'react';
3
+ import { Avatar, Backdrop, Button, Count, debounce, Drawer, Flex, Icon, Image, Popover, SkipNavigation, 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/AppShell.styles';
6
+ import BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';
7
+ import { StyledAppHeader, StyledCountIcon, StyledHamburgerMenu, StyledMain, StyledNotificationCount, StyledPrimaryName } from './AppShell.styles';
8
+ import Notifications from './Notifications';
9
+ import MobileHeaderContent from './MobileHeaderContent';
10
+ import NavLinks from './NavLinks';
11
+ const AppShell = forwardRef((props, ref) => {
12
+ const { main, appInfo, navLinks, operator, notifications, navAlignment = 'end', navPosition = 'inline' } = props;
13
+ const [backdropOpen, setBackdropOpen] = useState(false);
14
+ const [drawerOpen, setDrawerOpen] = useState(false);
15
+ const [drawerContent, setDrawerContent] = useState('');
16
+ const [notificationsPopover, setNotificationsPopover] = useState(false);
17
+ const [linksCollapsed, setLinksCollapsed] = useState(false);
18
+ const [hasMobileNav, setHasMobileNav] = useState(true);
19
+ const [headerEl, setHeaderEl] = useElement();
20
+ const [navSectionEl, setNavSectionEl] = useElement();
21
+ const [popoverEl, setPopoverEl] = useElement();
22
+ const [notificationsButtonEl, setNotificationsButtonEl] = useElement();
23
+ const minInlineWidth = useRef(0);
24
+ const headerRef = useConsolidatedRef(setHeaderEl, ref);
25
+ const isSmallOrAbove = useBreakpoint('sm');
26
+ const { end } = useDirection();
27
+ const t = useI18n();
28
+ let appInfoAs = 'div';
29
+ if (appInfo.href)
30
+ appInfoAs = 'a';
31
+ else if (appInfo.onClick)
32
+ appInfoAs = BareButton;
33
+ const closeDrawer = () => {
34
+ setDrawerContent('');
35
+ setBackdropOpen(false);
36
+ };
37
+ const openDrawer = (content) => {
38
+ setDrawerContent(content);
39
+ setBackdropOpen(true);
40
+ };
41
+ useOuterEvent('mousedown', [popoverEl, notificationsButtonEl], () => {
42
+ setNotificationsPopover(false);
43
+ notifications?.onNotificationsClose?.();
44
+ });
45
+ const debouncedResize = debounce((entries) => {
46
+ if (entries[0].contentRect.width > minInlineWidth.current) {
47
+ setLinksCollapsed(false);
48
+ }
49
+ }, 100);
50
+ useEffect(() => {
51
+ const resizeObserver = new ResizeObserver(debouncedResize);
52
+ const intersectionObserver = new IntersectionObserver(entries => {
53
+ if (entries[0].intersectionRatio > 0 &&
54
+ entries[0].intersectionRatio < 1 &&
55
+ !linksCollapsed) {
56
+ if (headerEl)
57
+ minInlineWidth.current = headerEl.clientWidth + 1;
58
+ setLinksCollapsed(true);
59
+ }
60
+ else if (navSectionEl)
61
+ navSectionEl.style.visibility = 'visible';
62
+ }, { root: navPosition === 'below' ? null : navSectionEl, threshold: 1 });
63
+ if (headerEl && navSectionEl && navSectionEl.firstChild && navSectionEl.lastChild) {
64
+ intersectionObserver.observe(navAlignment === 'start'
65
+ ? navSectionEl.lastChild
66
+ : navSectionEl.firstChild);
67
+ resizeObserver.observe(headerEl);
68
+ }
69
+ return () => {
70
+ if (!headerEl) {
71
+ intersectionObserver.disconnect();
72
+ resizeObserver.disconnect();
73
+ }
74
+ };
75
+ }, [headerEl, navSectionEl, navLinks]);
76
+ useEffect(() => {
77
+ setHasMobileNav(!isSmallOrAbove || linksCollapsed);
78
+ }, [isSmallOrAbove, linksCollapsed]);
79
+ useEffect(() => {
80
+ if (!hasMobileNav && drawerOpen) {
81
+ if (drawerContent === 'notifications' && notifications) {
82
+ setNotificationsPopover(true);
83
+ }
84
+ setDrawerOpen(false);
85
+ }
86
+ else if (hasMobileNav && notificationsPopover) {
87
+ setNotificationsPopover(false);
88
+ openDrawer('notifications');
89
+ }
90
+ }, [hasMobileNav, drawerOpen]);
91
+ return (_jsxs(_Fragment, { children: [_jsx(SkipNavigation, {}), _jsxs(StyledAppHeader, { ref: headerRef, navPosition: navPosition, children: [_jsxs(Flex, { container: { alignItems: 'center', justify: 'between' }, children: [_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, { container: { alignItems: 'center' }, children: [notifications && (_jsxs(_Fragment, { children: [_jsx(Button, { ref: setNotificationsButtonEl, variant: 'simple', label: t('open_app_header_notifications'), icon: true, onClick: () => {
92
+ if (!hasMobileNav) {
93
+ if (notificationsPopover) {
94
+ setNotificationsPopover(false);
95
+ notifications.onNotificationsClose?.();
96
+ }
97
+ else {
98
+ setNotificationsPopover(true);
99
+ notifications.onNotificationsOpen?.();
100
+ }
101
+ }
102
+ else {
103
+ openDrawer('notifications');
104
+ }
105
+ }, children: _jsxs(StyledNotificationCount, { children: [_jsx(Icon, { name: 'bell' }), !!notifications.count && (_jsx(Count, { as: 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 => {
106
+ if (e.currentTarget === e.target)
107
+ setDrawerOpen(false);
108
+ }, children: _jsxs(Drawer, { open: drawerOpen, onAfterClose: () => {
109
+ closeDrawer();
110
+ if (drawerContent === 'notifications') {
111
+ notifications?.onNotificationsClose?.();
112
+ }
113
+ }, onAfterOpen: () => {
114
+ if (drawerContent === 'notifications') {
115
+ notifications?.onNotificationsOpen?.();
116
+ }
117
+ }, 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) }))] }) })] }));
118
+ });
119
+ export default AppShell;
120
+ //# sourceMappingURL=AppShell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppShell.js","source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AAE;oBACX,IAAI,CAAC,CAAC,aAAa,KAAK,CAAC,CAAC,MAAM;wBAAE,aAAa,CAAC,KAAK,CAAC,CAAC;gBACzD,CAAC,YAED,MAAC,MAAM,IACL,IAAI,EAAE,UAAU,EAChB,YAAY,EAAE,GAAG,EAAE;wBACjB,WAAW,EAAE,CAAC;wBACd,IAAI,aAAa,KAAK,eAAe,EAAE;4BACrC,aAAa,EAAE,oBAAoB,EAAE,EAAE,CAAC;yBACzC;oBACH,CAAC,EACD,WAAW,EAAE,GAAG,EAAE;wBAChB,IAAI,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,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import {\n ElementType,\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n useEffect,\n useRef,\n useState\n} from 'react';\n\nimport {\n Avatar,\n Backdrop,\n Button,\n Count,\n debounce,\n Drawer,\n Flex,\n ForwardProps,\n Icon,\n Image,\n Popover,\n SkipNavigation,\n Text,\n useBreakpoint,\n useConsolidatedRef,\n useDirection,\n useElement,\n useI18n,\n useOuterEvent\n} 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/AppShell.styles';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\n\nimport { AppShellProps } from './AppShell.types';\nimport {\n StyledAppHeader,\n StyledCountIcon,\n StyledHamburgerMenu,\n StyledMain,\n StyledNotificationCount,\n StyledPrimaryName\n} from './AppShell.styles';\nimport Notifications from './Notifications';\nimport MobileHeaderContent from './MobileHeaderContent';\nimport NavLinks from './NavLinks';\n\nconst AppShell: FunctionComponent<AppShellProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<AppShellProps>, ref: AppShellProps['ref']) => {\n const {\n main,\n appInfo,\n navLinks,\n operator,\n notifications,\n navAlignment = 'end',\n navPosition = 'inline'\n } = props;\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 const t = useI18n();\n\n let appInfoAs: ElementType = 'div';\n if (appInfo.href) appInfoAs = 'a';\n else if (appInfo.onClick) appInfoAs = BareButton;\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 <SkipNavigation />\n <StyledAppHeader ref={headerRef} navPosition={navPosition}>\n <Flex container={{ alignItems: 'center', justify: 'between' }}>\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 container={{ alignItems: 'center' }}>\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 <Count as={StyledCountIcon} variant='urgent'>\n {notifications.count}\n </Count>\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 {!hasMobileNav && (\n <Operator\n as={StyledAppHeaderOperator}\n actions={operator.actions}\n popover={{ placement: 'bottom-start' }}\n >\n <Avatar {...operator.avatar} />\n </Operator>\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);\n\nexport default AppShell;\n"]}
@@ -0,0 +1,33 @@
1
+ import { AppShellProps } from './AppShell.types';
2
+ export declare const StyledNav: import("styled-components").StyledComponent<"nav", import("styled-components").DefaultTheme, {}, never>;
3
+ export declare const StyledAppHeader: import("styled-components").StyledComponent<"header", import("styled-components").DefaultTheme, {
4
+ navPosition: AppShellProps['navPosition'];
5
+ }, never>;
6
+ export declare const StyledPrimaryName: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
7
+ export declare const StyledLink: import("styled-components").StyledComponent<"a", import("styled-components").DefaultTheme, {}, never>;
8
+ export declare const StyledMain: import("styled-components").StyledComponent<"main", import("styled-components").DefaultTheme, {
9
+ navPosition: AppShellProps['navPosition'];
10
+ }, never>;
11
+ export declare const StyledHamburgerMenu: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
12
+ export declare const StyledMobileNav: import("styled-components").StyledComponent<"nav", import("styled-components").DefaultTheme, {}, never>;
13
+ export declare const StyledMobileLink: import("styled-components").StyledComponent<"a", import("styled-components").DefaultTheme, {}, never>;
14
+ export declare const StyledLinkSection: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
15
+ export declare const StyledOperatorSection: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
16
+ export declare const HorizontalBreak: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
17
+ export declare const StyledNotificationCount: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
18
+ export declare const StyledCountIcon: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
19
+ export declare const StyledNotifications: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
20
+ popover?: boolean | undefined;
21
+ }, never>;
22
+ export declare const StyledNotificationList: import("styled-components").StyledComponent<"ul", import("styled-components").DefaultTheme, {}, never>;
23
+ 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>;
24
+ export declare const StyledNotificationVisual: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
25
+ unread?: boolean | undefined;
26
+ }, never>;
27
+ export declare const StyledNotificationPrimary: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
28
+ unread?: boolean | undefined;
29
+ }, never>;
30
+ export declare const StyledNotificationSecondary: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {
31
+ unread?: boolean | undefined;
32
+ }, never>;
33
+ //# 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,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKjD,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,UAAU,uGAyCrB,CAAC;AAIH,eAAO,MAAM,UAAU;iBAA8B,aAAa,CAAC,aAAa,CAAC;SAYhF,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,0GAkB3B,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,293 @@
1
+ import { lighten, mix } from 'polished';
2
+ import styled, { css } from 'styled-components';
3
+ import { calculateFontSize, defaultThemeProp, StyledFlex, StyledImage, StyledText, StyledVisual, tryCatch, useDirection } from '@pega/cosmos-react-core';
4
+ import { StyledAppHeaderOperator } from '@pega/cosmos-react-core/lib/components/AppShell/AppShell.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 StyledLink = styled.a(({ theme }) => {
75
+ const { start } = useDirection();
76
+ const hoverColor = lighten(0.2, theme.base.palette.interactive);
77
+ const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);
78
+ return css `
79
+ margin: 0 calc(0.5 * ${theme.base.spacing});
80
+ padding: 0 calc(0.5 * ${theme.base.spacing});
81
+ font-size: ${fontSize.m};
82
+ position: relative;
83
+ height: 100%;
84
+ display: flex;
85
+
86
+ &:last-of-type {
87
+ margin-inline-end: ${theme.base.spacing};
88
+ }
89
+
90
+ &[aria-current='page'] {
91
+ ::after {
92
+ content: '';
93
+ position: absolute;
94
+ ${start}: 0;
95
+ inset-block-end: 0;
96
+ background-color: ${theme.base.palette.interactive};
97
+ height: 0.125rem;
98
+ width: 100%;
99
+ }
100
+ }
101
+
102
+ &:hover {
103
+ ::after {
104
+ content: '';
105
+ position: absolute;
106
+ ${start}: 0;
107
+ inset-block-end: 0;
108
+ background-color: ${hoverColor};
109
+ height: 0.125rem;
110
+ width: 100%;
111
+ }
112
+ }
113
+ `;
114
+ });
115
+ StyledLink.defaultProps = defaultThemeProp;
116
+ export const StyledMain = styled.main(({ navPosition, theme }) => {
117
+ return css `
118
+ position: relative;
119
+ min-height: calc(100vh - ${navPosition === 'below' ? tallHeaderHeight : headerHeight});
120
+ background-color: ${theme.base.palette['app-background']};
121
+
122
+ :focus {
123
+ outline: none;
124
+ }
125
+ `;
126
+ });
127
+ StyledMain.defaultProps = defaultThemeProp;
128
+ export const StyledHamburgerMenu = styled.button(({ theme }) => {
129
+ return css `
130
+ margin: ${theme.base.spacing};
131
+ `;
132
+ });
133
+ StyledHamburgerMenu.defaultProps = defaultThemeProp;
134
+ export const StyledMobileNav = styled.nav(({ theme }) => {
135
+ return css `
136
+ height: 100vh;
137
+ background-color: ${theme.base.palette['primary-background']};
138
+ `;
139
+ });
140
+ StyledMobileNav.defaultProps = defaultThemeProp;
141
+ export const StyledMobileLink = styled.a(({ theme }) => {
142
+ const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);
143
+ const activeColor = tryCatch(() => mix(0.85, theme.base.palette['primary-background'], theme.base.palette.interactive));
144
+ const hoverColor = tryCatch(() => mix(0.95, theme.base.palette['primary-background'], theme.base.palette.interactive));
145
+ return css `
146
+ font-size: ${fontSize.m};
147
+ padding: ${theme.base.spacing} calc(3 * ${theme.base.spacing});
148
+ background-color: ${theme.base.palette['primary-background']};
149
+
150
+ & + & {
151
+ margin-inline-start: 0;
152
+ }
153
+
154
+ &:hover,
155
+ &:focus {
156
+ background-color: ${hoverColor};
157
+ text-decoration: none;
158
+ }
159
+
160
+ &[aria-current='page'] {
161
+ font-weight: ${theme.base['font-weight']['semi-bold']};
162
+ background-color: ${activeColor};
163
+ }
164
+
165
+ @media (pointer: coarse) {
166
+ height: ${theme.base['hit-area'].finger};
167
+ }
168
+ `;
169
+ });
170
+ StyledMobileLink.defaultProps = defaultThemeProp;
171
+ export const StyledLinkSection = styled.div `
172
+ overflow: auto;
173
+ `;
174
+ export const StyledOperatorSection = styled.div `
175
+ position: sticky;
176
+ bottom: 0;
177
+ `;
178
+ export const HorizontalBreak = styled.div(({ theme }) => {
179
+ return css `
180
+ background-color: ${theme.base.palette['border-line']};
181
+ height: 0.0625rem;
182
+ margin: ${theme.base.spacing} calc(6 * ${theme.base.spacing}) 0 calc(3 * ${theme.base.spacing});
183
+
184
+ & + ${StyledFlex} {
185
+ margin-inline-start: calc(3 * ${theme.base.spacing});
186
+ }
187
+ `;
188
+ });
189
+ HorizontalBreak.defaultProps = defaultThemeProp;
190
+ export const StyledNotificationCount = styled.span `
191
+ flex-shrink: 0;
192
+ `;
193
+ export const StyledCountIcon = styled.span(({ theme: { base: { spacing } } }) => {
194
+ return css `
195
+ position: absolute;
196
+ inset-inline-start: calc(2 * ${spacing});
197
+ inset-block-start: calc(-0.25 * ${spacing});
198
+ padding: 0 calc(0.5 * ${spacing});
199
+
200
+ @media (pointer: coarse) {
201
+ inset-inline-start: calc(2.5 * ${spacing});
202
+ inset-block-start: calc(0.5 * ${spacing});
203
+ }
204
+ `;
205
+ });
206
+ export const StyledNotifications = styled.div(({ popover, theme }) => {
207
+ return css `
208
+ min-height: ${popover ? '10rem' : '100vh'};
209
+ max-height: ${popover ? '50vh' : '100vh'};
210
+ background-color: ${theme.base.palette['primary-background']};
211
+
212
+ ${popover &&
213
+ css `
214
+ max-width: 80ch;
215
+ `}
216
+ `;
217
+ });
218
+ StyledNotifications.defaultProps = defaultThemeProp;
219
+ export const StyledNotificationList = styled.ul(({ theme }) => {
220
+ return css `
221
+ overflow: auto;
222
+
223
+ & > li:not(:last-of-type) {
224
+ border-bottom: solid 0.0625rem ${theme.base.palette['border-line']};
225
+ }
226
+ `;
227
+ });
228
+ StyledNotificationList.defaultProps = defaultThemeProp;
229
+ export const StyledNotification = styled(BareButton)(({ theme }) => {
230
+ const hoverColor = lighten(0.55, theme.base.palette.interactive);
231
+ return css `
232
+ width: 100%;
233
+ padding: calc(2 * ${theme.base.spacing}) calc(3 * ${theme.base.spacing});
234
+ background-color: ${theme.base.palette['primary-background']};
235
+ text-decoration: none;
236
+ cursor: pointer;
237
+ text-align: start;
238
+ white-space: normal;
239
+
240
+ &:hover,
241
+ &:focus {
242
+ background-color: ${hoverColor};
243
+ }
244
+
245
+ &:focus {
246
+ outline: none;
247
+ box-shadow: inset ${theme.base.shadow.focus};
248
+ }
249
+
250
+ ${StyledVisual} {
251
+ align-self: flex-start;
252
+ }
253
+ `;
254
+ });
255
+ StyledNotification.defaultProps = defaultThemeProp;
256
+ export const StyledNotificationVisual = styled.span(({ theme, unread }) => {
257
+ return css `
258
+ position: relative;
259
+ ${StyledAlert} {
260
+ position: absolute;
261
+ inset-inline-start: 0.375rem;
262
+ inset-block-start: 1.625rem;
263
+ background-color: ${theme.base.palette.interactive};
264
+ height: 0.75rem;
265
+ width: 0.75rem;
266
+
267
+ ${!unread &&
268
+ css `
269
+ display: none;
270
+ `}
271
+ } ;
272
+ `;
273
+ });
274
+ StyledNotificationVisual.defaultProps = defaultThemeProp;
275
+ export const StyledNotificationPrimary = styled.span(({ theme, unread }) => {
276
+ return css `
277
+ font-weight: ${unread
278
+ ? theme.base['font-weight'].bold
279
+ : theme.base['font-weight']['semi-bold']};
280
+ `;
281
+ });
282
+ StyledNotificationPrimary.defaultProps = defaultThemeProp;
283
+ export const StyledNotificationSecondary = styled.span(({ theme, unread }) => {
284
+ return css `
285
+ ${StyledText} {
286
+ opacity: ${unread
287
+ ? theme.base.transparency['transparent-1']
288
+ : theme.base.transparency['transparent-3']};
289
+ }
290
+ `;
291
+ });
292
+ StyledNotificationSecondary.defaultProps = defaultThemeProp;
293
+ //# 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,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,YAAY,EACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,iEAAiE,CAAC;AAC1G,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,EAAE,KAAK,EAAE,EAAE,EAAE;IACzB,OAAO,GAAG,CAAA;;;gBAGE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,YAAY;;0BAE/C,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;sBAC5C,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO;uCACZ,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC;;QAEhE,WAAW;;;;YAIP,UAAU;kBACJ,YAAY;;UAEpB,uBAAuB;oBACb,KAAK,CAAC,IAAI,CAAC,OAAO;;;;;;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AgB,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 defaultThemeProp,\n StyledFlex,\n StyledImage,\n StyledText,\n StyledVisual,\n tryCatch,\n useDirection\n} from '@pega/cosmos-react-core';\nimport { StyledAppHeaderOperator } from '@pega/cosmos-react-core/lib/components/AppShell/AppShell.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 { 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 StyledLink = styled.a(({ theme }) => {\n const { start } = useDirection();\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\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 ${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 ${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 return css`\n position: relative;\n min-height: calc(100vh - ${navPosition === 'below' ? tallHeaderHeight : headerHeight});\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.span(\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: inset ${theme.base.shadow.focus};\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"]}
@@ -0,0 +1,93 @@
1
+ import { MouseEventHandler, ReactNode, Ref } from 'react';
2
+ import { Action, AvatarProps, BaseProps, ImageProps, NoChildrenProp } from '@pega/cosmos-react-core';
3
+ export declare type InteractionEvent = MouseEvent | KeyboardEvent;
4
+ interface AppInfoProps {
5
+ /** Name of the application. */
6
+ appName: string;
7
+ /** URL source of the logo image. */
8
+ imageSrc: ImageProps['src'];
9
+ /** URL or DOM id to navigate to from the logo and appName. */
10
+ href?: string;
11
+ /** Click handler for the logo and appName. */
12
+ onClick?: MouseEventHandler<HTMLAnchorElement>;
13
+ /** Specifies where to open the link href. */
14
+ target?: string;
15
+ }
16
+ interface NavLinkProps {
17
+ /** Unique id for the link */
18
+ id: string;
19
+ /** Text that is displayed for the link. */
20
+ text: string;
21
+ /** URL or DOM id to navigate to. */
22
+ href: string;
23
+ /** Click handler for the link. */
24
+ onClick?: (e: InteractionEvent) => void;
25
+ /** Indicates if the link represents the current view within the app. */
26
+ current?: boolean;
27
+ }
28
+ interface OperatorProps {
29
+ /** Props for constructing the operator avatar. */
30
+ avatar: AvatarProps;
31
+ /** The title of the operator menu. */
32
+ title: string;
33
+ /** A list of actions that will populate a menu attached to the operator. */
34
+ actions: Action[];
35
+ }
36
+ export interface NotificationItem {
37
+ /** An id representing the item. */
38
+ id: string;
39
+ /** The primary text for the item. */
40
+ primary: string;
41
+ /** Secondary text that will be rendered as a Meta List. */
42
+ secondary?: string[];
43
+ /** A visual associated with the item. */
44
+ visual?: ReactNode;
45
+ /** A flag indicating if the item has been read. */
46
+ unread?: boolean;
47
+ /** URL or DOM id to navigate to. */
48
+ href?: string;
49
+ /** The onClick handler for the item. */
50
+ onClick?: (event: InteractionEvent) => void;
51
+ }
52
+ export interface NotificationProps {
53
+ /** The title of the notifications view. */
54
+ title: string;
55
+ /** The number of new notifications. */
56
+ count: number;
57
+ /** A list of notification items. */
58
+ items: NotificationItem[];
59
+ /** If true, a loading indicator will render in place of the list. */
60
+ loading?: boolean;
61
+ /** Click event for items within the list. */
62
+ onItemClick?: (id: string, event: InteractionEvent) => void;
63
+ /** Callback that fires when the notification view opens. */
64
+ onNotificationsOpen?: () => void;
65
+ /** Callback that fires when the notification view closes. */
66
+ onNotificationsClose?: () => void;
67
+ }
68
+ export interface AppShellProps extends BaseProps, NoChildrenProp {
69
+ /** The content of the application. */
70
+ main: ReactNode;
71
+ /** Props related to the app name and logo. */
72
+ appInfo: AppInfoProps;
73
+ /** A set of navigation links for the application. */
74
+ navLinks: NavLinkProps[];
75
+ /** Props for the operator menu. */
76
+ operator: OperatorProps;
77
+ /** Props related to notifications for the application. */
78
+ notifications?: NotificationProps;
79
+ /**
80
+ * The alignment of navigation links within the header.
81
+ * @default 'end'
82
+ * */
83
+ navAlignment?: 'start' | 'center' | 'end';
84
+ /**
85
+ * The positioning of the navigation links relative to the other app header elements.
86
+ * @default 'inline'
87
+ * */
88
+ navPosition?: 'inline' | 'below';
89
+ /** Ref for the wrapping div element. */
90
+ ref?: Ref<HTMLDivElement>;
91
+ }
92
+ export {};
93
+ //# sourceMappingURL=AppShell.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppShell.types.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE1D,OAAO,EACL,MAAM,E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O,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAC7C;AAED,MAAM,WAAW,iBAAiB;IAChC,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,qEAAqE;IACrE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC5D,4DAA4D;IAC5D,mBAAmB,CAAC,EAAE,MAAM,IAAI,CAAC;IACjC,6DAA6D;IAC7D,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,aAAc,SAAQ,SAAS,EAAE,cAAc;IAC9D,sCAAsC;IACtC,IAAI,EAAE,SAAS,CAAC;IAChB,8CAA8C;IAC9C,OAAO,EAAE,YAAY,CAAC;IACtB,qDAAqD;IACrD,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,mCAAmC;IACnC,QAAQ,EAAE,aAAa,CAAC;IACxB,0DAA0D;IAC1D,aAAa,CAAC,EAAE,iBAAiB,CAAC;IAClC;;;SAGK;IACL,YAAY,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAC1C;;;SAGK;IACL,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IACjC,wCAAwC;IACxC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AppShell.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppShell.types.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.types.ts"],"names":[],"mappings":"","sourcesContent":["import { MouseEventHandler, ReactNode, Ref } from 'react';\n\nimport {\n Action,\n AvatarProps,\n BaseProps,\n ImageProps,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\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\ninterface 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 current?: 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: Action[];\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 /** Props related to the app name and logo. */\n appInfo: AppInfoProps;\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"]}
@@ -0,0 +1,11 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { AppShellProps } from './AppShell.types';
3
+ interface MobileHeaderContentProps {
4
+ appInfo: AppShellProps['appInfo'];
5
+ navLinks: AppShellProps['navLinks'];
6
+ operator: AppShellProps['operator'];
7
+ onClose: () => void;
8
+ }
9
+ declare const MobileHeaderContent: FunctionComponent<MobileHeaderContentProps>;
10
+ export default MobileHeaderContent;
11
+ //# sourceMappingURL=MobileHeaderContent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MobileHeaderContent.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/MobileHeaderContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAY1C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,UAAU,wBAAwB;IAChC,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IAClC,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACpC,QAAQ,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IACpC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,QAAA,MAAM,mBAAmB,EAAE,iBAAiB,CAAC,wBAAwB,CA0EpE,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Flex, Button, Avatar, Icon, Text, useI18n } from '@pega/cosmos-react-core';
3
+ import { HorizontalBreak, StyledLinkSection, StyledMobileLink, StyledMobileNav, StyledOperatorSection, StyledPrimaryName } from './AppShell.styles';
4
+ const MobileHeaderContent = ({ appInfo, navLinks, operator, onClose }) => {
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.current ? '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.text }, action.id))) })] })] }));
7
+ };
8
+ export default MobileHeaderContent;
9
+ //# sourceMappingURL=MobileHeaderContent.js.map
@@ -0,0 +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,E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mos-react-core';\n\nimport {\n HorizontalBreak,\n StyledLinkSection,\n StyledMobileLink,\n StyledMobileNav,\n StyledOperatorSection,\n StyledPrimaryName\n} from './AppShell.styles';\nimport { 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.current ? '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.text}\n </Button>\n ))}\n </Flex>\n </Flex>\n </Flex>\n );\n};\n\nexport default MobileHeaderContent;\n"]}
@@ -0,0 +1,11 @@
1
+ import { FunctionComponent, Ref } from 'react';
2
+ import { AppShellProps } from './AppShell.types';
3
+ interface NavLinksProps {
4
+ navLinks: AppShellProps['navLinks'];
5
+ navAlignment: AppShellProps['navAlignment'];
6
+ navPosition: AppShellProps['navPosition'];
7
+ ref?: Ref<HTMLDivElement>;
8
+ }
9
+ declare const NavLinks: FunctionComponent<NavLinksProps>;
10
+ export default NavLinks;
11
+ //# sourceMappingURL=NavLinks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavLinks.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/NavLinks.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA+B,GAAG,EAAE,MAAM,OAAO,CAAC;AAK5E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,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,EAAE,iBAAiB,CAAC,aAAa,CAkC9C,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import { Flex, Button } from '@pega/cosmos-react-core';
4
+ import { StyledNav, StyledLink } from './AppShell.styles';
5
+ const NavLinks = forwardRef(({ navLinks, navAlignment, navPosition }, ref) => {
6
+ return (_jsx(Flex, { as: StyledNav, ref: ref, container: {
7
+ alignItems: 'center',
8
+ gap: 1,
9
+ justify: navAlignment
10
+ }, item: { grow: 1 }, navPosition: navPosition, children: navLinks.map(navLink => {
11
+ return (_jsx(StyledLink, { as: Button, "aria-current": navLink.current ? 'page' : undefined, variant: 'text', href: navLink.href, onClick: navLink.onClick, children: navLink.text }, navLink.id));
12
+ }) }));
13
+ });
14
+ export default NavLinks;
15
+ //# sourceMappingURL=NavLinks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavLinks.js","sourceRoot":"","sources":["../../../src/components/AppShell/NavLinks.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAwB,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAU1D,MAAM,QAAQ,GAAqC,UAAU,CAC3D,CACE,EAAE,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAkC,EACvE,GAAyB,EACzB,EAAE;IACF,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,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAClD,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,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, PropsWithoutRef, Ref } from 'react';\n\nimport { Flex, Button } from '@pega/cosmos-react-core';\n\nimport { StyledNav, StyledLink } from './AppShell.styles';\nimport { 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: FunctionComponent<NavLinksProps> = forwardRef(\n (\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.current ? '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);\n\nexport default NavLinks;\n"]}
@@ -0,0 +1,9 @@
1
+ import { FunctionComponent } from 'react';
2
+ import { NotificationProps } from './AppShell.types';
3
+ interface NotificationsViewProps extends NotificationProps {
4
+ popover?: boolean;
5
+ onClose?: () => void;
6
+ }
7
+ declare const Notifications: FunctionComponent<NotificationsViewProps>;
8
+ export default Notifications;
9
+ //# sourceMappingURL=Notifications.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Notifications.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/Notifications.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAe1C,OAAO,EAAsC,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAWzF,UAAU,sBAAuB,SAAQ,iBAAiB;IACxD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,sBAAsB,CA4E5D,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Flex, Button, Icon, Text, Progress, MetaList, SummaryItem, Alert, EmptyState, useI18n } from '@pega/cosmos-react-core';
3
+ import { StyledNotifications, StyledNotificationList, StyledNotification, StyledNotificationPrimary, StyledNotificationSecondary, StyledNotificationVisual, StyledPrimaryName } from './AppShell.styles';
4
+ const Notifications = ({ title, items, loading, onItemClick, popover, onClose }) => {
5
+ const t = useI18n();
6
+ const renderContent = items.length ? (_jsx(Flex, { as: StyledNotificationList, item: { grow: 1 }, children: items.map(({ id, primary, secondary, visual, unread, href, onClick }) => {
7
+ const onSummaryItemClick = (e) => {
8
+ if (e.type === 'click' || (e.type === 'keyup' && e.key === 'Enter')) {
9
+ onClick?.(e);
10
+ onItemClick?.(id, e);
11
+ }
12
+ };
13
+ return (_jsxs("li", { children: [unread && (_jsx(StyledNotificationVisual, { unread: unread, children: _jsx(Alert, { variant: 'urgent' }) })), _jsx(SummaryItem, { as: StyledNotification, primary: _jsx(StyledNotificationPrimary, { unread: unread, children: primary }), secondary: secondary?.length ? (_jsx(StyledNotificationSecondary, { unread: unread, children: _jsx(MetaList, { items: secondary }) })) : undefined, visual: visual, href: href, onClick: onSummaryItemClick })] }, id));
14
+ }) })) : (_jsx(Flex, { container: { justify: 'center', alignItems: 'center' }, item: { grow: 1 }, children: _jsx(EmptyState, { message: t('app_header_notifications_empty') }) }));
15
+ return (_jsxs(Flex, { as: StyledNotifications, container: { direction: 'column', gap: 1 }, popover: popover, children: [onClose && (_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(Flex, { container: { pad: popover ? [2, 3, 0, 3] : [0, 3] }, children: _jsx(Text, { as: StyledPrimaryName, variant: 'h1', children: title }) }), loading ? (_jsx(Flex, { container: { justify: 'center', alignItems: 'center' }, item: { grow: 1 }, children: _jsx(Progress, { placement: 'local', message: t('app_header_notifications_loading') }) })) : (renderContent)] }));
16
+ };
17
+ export default Notifications;
18
+ //# sourceMappingURL=Notifications.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Notifications.js","sourceRoot":"","sources":["../../../src/components/AppShell/Notifications.tsx"],"names":[],"mappings":";AAEA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,KAAK,EACL,UAAU,EACV,OAAO,EACR,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,kBAAkB,EAClB,yBAAyB,EACzB,2BAA2B,EAC3B,wBAAwB,EACxB,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAO3B,MAAM,aAAa,GAA8C,CAAC,EAChE,KAAK,EACL,KAAK,EACL,OAAO,EACP,WAAW,EACX,OAAO,EACP,OAAO,EACgB,EAAE,EAAE;IAC3B,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CACnC,KAAC,IAAI,IAAC,EAAE,EAAE,sBAAsB,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,YAChD,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAoB,EAAE,EAAE;YACzF,MAAM,kBAAkB,GAAG,CAAC,CAAmB,EAAE,EAAE;gBACjD,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,IAAK,CAAmB,CAAC,GAAG,KAAK,OAAO,CAAC,EAAE;oBACtF,OAAO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IAAC,OAAO,EAAC,QAAQ,EAAC,IAAI,QAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,YAC/D,KAAC,IAAI,IAAC,IAAI,EAAC,OAAO,GAAG,GACd,GACJ,CACR,EACD,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,YACvD,KAAC,IAAI,IAAC,EAAE,EAAE,iBAAiB,EAAE,OAAO,EAAC,IAAI,YACtC,KAAK,GACD,GACF,EACN,OAAO,CAAC,CAAC,CAAC,CACT,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,YAC7E,KAAC,QAAQ,IAAC,SAAS,EAAC,OAAO,EAAC,OAAO,EAAE,CAAC,CAAC,kCAAkC,CAAC,GAAI,GACzE,CACR,CAAC,CAAC,CAAC,CACF,aAAa,CACd,IACI,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import { FunctionComponent } from 'react';\n\nimport {\n Flex,\n Button,\n Icon,\n Text,\n Progress,\n MetaList,\n SummaryItem,\n Alert,\n EmptyState,\n useI18n\n} from '@pega/cosmos-react-core';\n\nimport { InteractionEvent, NotificationItem, NotificationProps } from './AppShell.types';\nimport {\n StyledNotifications,\n StyledNotificationList,\n StyledNotification,\n StyledNotificationPrimary,\n StyledNotificationSecondary,\n StyledNotificationVisual,\n StyledPrimaryName\n} from './AppShell.styles';\n\ninterface NotificationsViewProps extends NotificationProps {\n popover?: boolean;\n onClose?: () => void;\n}\n\nconst Notifications: FunctionComponent<NotificationsViewProps> = ({\n title,\n items,\n loading,\n onItemClick,\n popover,\n onClose\n}: NotificationsViewProps) => {\n const t = useI18n();\n\n const renderContent = items.length ? (\n <Flex as={StyledNotificationList} item={{ grow: 1 }}>\n {items.map(({ id, primary, secondary, visual, unread, href, onClick }: NotificationItem) => {\n const onSummaryItemClick = (e: InteractionEvent) => {\n if (e.type === 'click' || (e.type === 'keyup' && (e as KeyboardEvent).key === 'Enter')) {\n onClick?.(e);\n onItemClick?.(id, e);\n }\n };\n\n return (\n <li key={id}>\n {unread && (\n <StyledNotificationVisual unread={unread}>\n <Alert variant='urgent' />\n </StyledNotificationVisual>\n )}\n <SummaryItem\n as={StyledNotification}\n primary={\n <StyledNotificationPrimary unread={unread}>{primary}</StyledNotificationPrimary>\n }\n secondary={\n secondary?.length ? (\n <StyledNotificationSecondary unread={unread}>\n <MetaList items={secondary} />\n </StyledNotificationSecondary>\n ) : undefined\n }\n visual={visual}\n href={href}\n onClick={onSummaryItemClick}\n />\n </li>\n );\n })}\n </Flex>\n ) : (\n <Flex container={{ justify: 'center', alignItems: 'center' }} item={{ grow: 1 }}>\n <EmptyState message={t('app_header_notifications_empty')} />\n </Flex>\n );\n\n return (\n <Flex as={StyledNotifications} container={{ direction: 'column', gap: 1 }} popover={popover}>\n {onClose && (\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 <Flex container={{ pad: popover ? [2, 3, 0, 3] : [0, 3] }}>\n <Text as={StyledPrimaryName} variant='h1'>\n {title}\n </Text>\n </Flex>\n {loading ? (\n <Flex container={{ justify: 'center', alignItems: 'center' }} item={{ grow: 1 }}>\n <Progress placement='local' message={t('app_header_notifications_loading')} />\n </Flex>\n ) : (\n renderContent\n )}\n </Flex>\n );\n};\n\nexport default Notifications;\n"]}
@@ -0,0 +1,3 @@
1
+ export { default } from './AppShell';
2
+ export { AppShellProps, NotificationItem } from './AppShell.types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default } from './AppShell';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/AppShell/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC","sourcesContent":["export { default } from './AppShell';\nexport { AppShellProps, NotificationItem } from './AppShell.types';\n"]}
package/lib/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { default as AppShell } from './components/AppShell';
2
+ export * from './components/AppShell';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,cAAc,uBAAuB,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,4 @@
1
+ // This file is autogenerated. Any changes will be overwritten.
2
+ export { default as AppShell } from './components/AppShell';
3
+ export * from './components/AppShell';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAC5D,cAAc,uBAAuB,CAAC","sourcesContent":["// This file is autogenerated. Any changes will be overwritten.\nexport { default as AppShell } from './components/AppShell';\nexport * from './components/AppShell';\n"]}
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@pega/cosmos-react-wss",
3
+ "version": "3.0.0-dev.11.0",
4
+ "author": "Pegasystems",
5
+ "license": "SEE LICENSE IN LICENSE",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/pegasystems/cosmos-react.git",
9
+ "directory": "packages/cosmos-wss"
10
+ },
11
+ "main": "lib/index.js",
12
+ "types": "lib/index.d.ts",
13
+ "files": [
14
+ "LICENSE",
15
+ "README.md",
16
+ "lib"
17
+ ],
18
+ "sideEffects": false,
19
+ "scripts": {
20
+ "build": "tsc -b"
21
+ },
22
+ "dependencies": {
23
+ "@pega/cosmos-react-core": "3.0.0-dev.11.0",
24
+ "polished": "^4.1.0",
25
+ "react": "^16.14.0 || ^17.0.0",
26
+ "react-dom": "^16.14.0 || ^17.0.0",
27
+ "styled-components": "^5.2.0"
28
+ },
29
+ "devDependencies": {
30
+ "@storybook/addon-a11y": "^6.4.19",
31
+ "@storybook/addon-actions": "^6.4.19",
32
+ "@storybook/addon-storysource": "^6.4.19",
33
+ "@storybook/addon-toolbars": "^6.4.19",
34
+ "@storybook/addons": "^6.4.19",
35
+ "@storybook/react": "^6.4.19",
36
+ "@storybook/theming": "^6.4.19",
37
+ "enzyme": "^3.11.0",
38
+ "typescript": "~4.6.2"
39
+ }
40
+ }