@pega/cosmos-react-build 4.0.0-dev.6.1 → 4.0.0-dev.8.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 (58) hide show
  1. package/lib/components/AppShell/AppShell.d.ts +3 -2
  2. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  3. package/lib/components/AppShell/AppShell.js +41 -79
  4. package/lib/components/AppShell/AppShell.js.map +1 -1
  5. package/lib/components/AppShell/AppShell.styles.d.ts +10 -15
  6. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  7. package/lib/components/AppShell/AppShell.styles.js +153 -248
  8. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  9. package/lib/components/AppShell/AppShell.types.d.ts +57 -30
  10. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  11. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  12. package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
  13. package/lib/components/AppShell/AppShellContext.js +3 -5
  14. package/lib/components/AppShell/AppShellContext.js.map +1 -1
  15. package/lib/components/AppShell/NavigationList.d.ts +6 -0
  16. package/lib/components/AppShell/NavigationList.d.ts.map +1 -0
  17. package/lib/components/AppShell/NavigationList.js +91 -0
  18. package/lib/components/AppShell/NavigationList.js.map +1 -0
  19. package/lib/components/AppShell/index.d.ts +1 -1
  20. package/lib/components/AppShell/index.d.ts.map +1 -1
  21. package/lib/components/AppShell/index.js.map +1 -1
  22. package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts +5 -1
  23. package/lib/components/FlowModeller/Node/NodeTemplate.styles.d.ts.map +1 -1
  24. package/lib/components/FlowModeller/Node/NodeTemplate.styles.js +10 -3
  25. package/lib/components/FlowModeller/Node/NodeTemplate.styles.js.map +1 -1
  26. package/lib/components/FlowModeller/Node/NodeTemplates.d.ts.map +1 -1
  27. package/lib/components/FlowModeller/Node/NodeTemplates.js +10 -28
  28. package/lib/components/FlowModeller/Node/NodeTemplates.js.map +1 -1
  29. package/lib/components/LifeCycle/Stage.d.ts.map +1 -1
  30. package/lib/components/LifeCycle/Stage.js +3 -9
  31. package/lib/components/LifeCycle/Stage.js.map +1 -1
  32. package/lib/components/LifeCycle/Step.d.ts +3 -2
  33. package/lib/components/LifeCycle/Step.d.ts.map +1 -1
  34. package/lib/components/LifeCycle/Step.js +27 -22
  35. package/lib/components/LifeCycle/Step.js.map +1 -1
  36. package/lib/components/LifeCycle/Task.d.ts.map +1 -1
  37. package/lib/components/LifeCycle/Task.js +5 -11
  38. package/lib/components/LifeCycle/Task.js.map +1 -1
  39. package/lib/components/MobileBuildSummary/MobileBuildSummary.d.ts +0 -1
  40. package/lib/components/MobileBuildSummary/MobileBuildSummary.d.ts.map +1 -1
  41. package/lib/components/MobileBuildSummary/MobileBuildSummary.js +5 -16
  42. package/lib/components/MobileBuildSummary/MobileBuildSummary.js.map +1 -1
  43. package/lib/components/MobileBuildSummary/MobileBuildSummary.types.d.ts +2 -0
  44. package/lib/components/MobileBuildSummary/MobileBuildSummary.types.d.ts.map +1 -1
  45. package/lib/components/MobileBuildSummary/MobileBuildSummary.types.js.map +1 -1
  46. package/lib/components/ObjectSelect/ObjectSummary.d.ts +1 -1
  47. package/lib/components/ObjectSelect/ObjectSummary.d.ts.map +1 -1
  48. package/lib/components/ObjectSelect/ObjectSummary.js +6 -6
  49. package/lib/components/ObjectSelect/ObjectSummary.js.map +1 -1
  50. package/lib/components/ObjectSelect/useCreateModal.d.ts +5 -0
  51. package/lib/components/ObjectSelect/useCreateModal.d.ts.map +1 -1
  52. package/lib/components/ObjectSelect/useCreateModal.js +4 -2
  53. package/lib/components/ObjectSelect/useCreateModal.js.map +1 -1
  54. package/lib/index.d.ts +1 -0
  55. package/lib/index.d.ts.map +1 -1
  56. package/lib/index.js +1 -0
  57. package/lib/index.js.map +1 -1
  58. package/package.json +3 -3
@@ -1,5 +1,6 @@
1
- /// <reference types="react" />
1
+ import { FunctionComponent } from 'react';
2
+ import { ForwardProps } from '@pega/cosmos-react-core';
2
3
  import type { AppShellProps } from './AppShell.types';
3
- declare const AppShell: import("react").ForwardRefExoticComponent<Pick<AppShellProps, "main" | "children" | "navigation" | "appInfo" | "appHeader" | "utils" | "hideNav"> & import("react").RefAttributes<HTMLElement>>;
4
+ declare const AppShell: FunctionComponent<AppShellProps & ForwardProps>;
4
5
  export default AppShell;
5
6
  //# sourceMappingURL=AppShell.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.tsx"],"names":[],"mappings":";AA+CA,OAAO,KAAK,EAAE,aAAa,EAA4B,MAAM,kBAAkB,CAAC;AAmGhF,QAAA,MAAM,QAAQ,iMA+Ib,CAAC;AAEF,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAA6C,MAAM,OAAO,CAAC;AAErF,OAAO,EAIL,YAAY,EASb,MAAM,yBAAyB,CAAC;AAmBjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKtD,QAAA,MAAM,QAAQ,EAAE,iBAAiB,CAAC,aAAa,GAAG,YAAY,CAyG7D,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -1,96 +1,58 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { forwardRef, useMemo, useState, useContext, useRef, useEffect } from 'react';
3
- import { Flex, Icon, Switch, SkipLinks, Drawer, useDirection, useI18n, useAfterInitialEffect, StandardTree, useConsolidatedRef, useTransitionState, MetaList, Avatar } from '@pega/cosmos-react-core';
4
- import { expandCollapseStates } from '@pega/cosmos-react-core/lib/hooks/useTransitionState';
5
- import BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useMemo } from 'react';
3
+ import { registerIcon, useI18n, Icon, useDirection, useConsolidatedRef, useElement, useTransitionState, Flex, Tooltip, SkipLinks } from '@pega/cosmos-react-core';
4
+ import { openCloseStates } from '@pega/cosmos-react-core/lib/hooks/useTransitionState';
5
+ import * as timesIcon from '../../../../cosmos-core/src/components/Icon/icons/times.icon';
6
+ import * as plusIcon from '../../../../cosmos-core/src/components/Icon/icons/plus.icon';
7
+ import * as caseSolidIcon from '../../../../cosmos-core/src/components/Icon/icons/case-solid.icon';
8
+ import * as barsIcon from '../../../../cosmos-core/src/components/Icon/icons/bars.icon';
9
+ import * as caretLeftIcon from '../../../../cosmos-core/src/components/Icon/icons/caret-left.icon';
10
+ import * as caretRightIcon from '../../../../cosmos-core/src/components/Icon/icons/caret-right.icon';
6
11
  import AppHeader from './Header/AppHeader';
7
- import { StyledHeader, StyledUtils, StyledUtilItem, StyledScrollWrap, StyledNavContent, StyledMain, StyledDrawerWrapper, StyledDrawerHeader, StyledNavTitle, StyledNav, StyledInnerNav, StyledNavToggle, StyledDrawerCloseButton } from './AppShell.styles';
12
+ import { StyledScrollWrap, StyledMain, StyledUtils, StyledNav, StyledAppShellToggleButton } from './AppShell.styles';
8
13
  import AppShellContext from './AppShellContext';
9
- const NavigationHeader = ({ text, visual, meta }) => {
10
- return (_jsxs(Flex, { container: { alignItems: 'center', pad: 2, gap: 1 }, as: StyledHeader, children: [visual && _jsx(Avatar, { ...visual, name: text, shape: 'squircle' }), _jsxs(Flex, { container: { direction: 'column', alignItems: 'start' }, children: [_jsx(StyledNavTitle, { variant: 'h4', children: text }), meta && _jsx(MetaList, { wrapItems: true, items: meta })] })] }));
11
- };
12
- const DrawerHeader = forwardRef(({ text }, ref) => {
14
+ import NavigationList from './NavigationList';
15
+ registerIcon(timesIcon, plusIcon, caseSolidIcon, barsIcon, caretRightIcon, caretLeftIcon);
16
+ const AppShell = forwardRef(({ main, appHeader, nav, ...restProps }, ref) => {
13
17
  const t = useI18n();
14
- const { setDrawerData, setDrawerOpen } = useContext(AppShellContext);
15
- const { start } = useDirection();
16
- const onDrawerClose = () => {
17
- setDrawerOpen(false);
18
- setDrawerData(undefined);
19
- };
20
- return (_jsxs(Flex, { container: { alignItems: 'center' }, as: StyledDrawerHeader, children: [_jsx(StyledDrawerCloseButton, { variant: 'simple', onClick: onDrawerClose, "aria-label": t('close_noun', [text]), icon: true, ref: ref, children: _jsx(Icon, { name: `caret-${start}` }) }), _jsx(StyledNavTitle, { variant: 'h4', children: text })] }));
21
- });
22
- const Utils = ({ items, onItemClick, onClose, currentItemId, devMode }) => {
23
- const { drawerData, setDrawerData, setDrawerOpen } = useContext(AppShellContext);
24
- const [showDevMode, setShowDevMode] = useState(devMode ?? false);
25
- const t = useI18n();
26
- useEffect(() => {
27
- setShowDevMode(devMode ?? false);
28
- }, [devMode]);
29
- useAfterInitialEffect(() => {
30
- if (!showDevMode) {
31
- setDrawerData(undefined);
32
- onClose();
33
- }
34
- }, [showDevMode]);
35
- return (_jsxs(StyledUtils, { showDevMode: showDevMode, children: [_jsx(Switch, { label: t('dev_mode').toUpperCase(), onChange: () => setShowDevMode(cur => !cur), on: showDevMode }), showDevMode && (_jsx("ul", { role: 'menu', children: items.map(({ label, id }) => {
36
- return (_jsx(StyledUtilItem, { role: 'menuitem', "aria-current": drawerData?.id !== id && currentItemId === id ? 'true' : undefined, children: _jsx(BareButton, { onClick: () => {
37
- setDrawerData({ label, id });
38
- setDrawerOpen(true);
39
- onItemClick(id);
40
- }, children: label }) }, id));
41
- }) }))] }));
42
- };
43
- const AppShell = forwardRef(({ main, appHeader, appInfo, utils, navigation, hideNav = false }, ref) => {
18
+ const { start, end } = useDirection();
44
19
  const navRef = useConsolidatedRef(ref);
45
- const [drawerOpen, setDrawerOpen] = useState(!!utils?.currentItemId);
46
- const [drawerData, setDrawerData] = useState(utils?.items.find(i => i.id === utils?.currentItemId));
47
- const backButtonRef = useRef(null);
48
- const { rtl } = useDirection();
49
- const t = useI18n();
50
- const { state: navState, toggle: toggleNavState } = useTransitionState({
20
+ const [expandCollapseEl, setExpandCollapseEl] = useElement();
21
+ const { state: navState, set: setNavState } = useTransitionState({
51
22
  ref: navRef,
52
23
  property: 'width',
53
- states: expandCollapseStates,
54
- defaultState: 'expanded'
24
+ states: openCloseStates,
25
+ defaultState: 'closed'
55
26
  });
56
- useAfterInitialEffect(() => {
57
- const drawerItem = utils?.items.find(i => i.id === utils?.currentItemId);
58
- if (drawerItem) {
59
- setDrawerData(drawerItem);
60
- setDrawerOpen(true);
61
- }
62
- else {
63
- setDrawerData(undefined);
64
- setDrawerOpen(false);
65
- }
66
- }, [utils?.currentItemId]);
67
27
  const skipLinks = useMemo(() => [
68
28
  {
69
29
  label: t('go_to_main_content'),
70
30
  target: { ariaLabel: t('main_content'), selector: 'main' }
71
31
  }
72
32
  ], [t]);
73
- const navExpanded = navState === 'expanded' || navState === 'expanding';
74
- const navContent = useMemo(() => {
75
- return (_jsx(Flex, { item: { grow: 1 }, as: StyledScrollWrap, children: _jsx(StandardTree, { ...navigation }) }));
76
- }, [navigation]);
77
- const toggleButtonLabel = t(navExpanded ? 'collapse' : 'expand');
78
- const toggleButtonA11y = t(navExpanded ? 'collapse_navigation' : 'expand_navigation');
33
+ const openNav = () => {
34
+ setNavState('open');
35
+ };
36
+ const closeNav = () => {
37
+ setNavState('closed');
38
+ };
79
39
  return (_jsxs(AppShellContext.Provider, { value: useMemo(() => ({
80
- drawerOpen,
81
- setDrawerOpen,
82
- drawerData,
83
- setDrawerData,
84
- navState
85
- }), [navExpanded, drawerOpen, drawerData, navState]), children: [_jsx(SkipLinks, { items: skipLinks }), _jsx(AppHeader, { ...appHeader }), _jsxs(Flex, { container: true, children: [!hideNav && (_jsxs(StyledNav, { ref: navRef, children: [_jsx(StyledInnerNav, { children: _jsxs(Flex, { container: { direction: 'column', justify: 'between' }, as: StyledNavContent, "aria-hidden": !navExpanded, children: [_jsx(StyledDrawerWrapper, { children: _jsxs(Drawer, { open: drawerOpen && !!drawerData, nullWhenClosed: true, position: 'absolute', placement: rtl ? 'right' : 'left', onBeforeOpen: utils?.drawer?.onBeforeOpen, onAfterOpen: () => {
86
- if (backButtonRef.current &&
87
- document.activeElement !== backButtonRef.current) {
88
- backButtonRef.current.focus();
89
- }
90
- utils?.drawer?.onAfterOpen?.();
91
- }, onBeforeClose: utils?.drawer?.onBeforeClose, onAfterClose: utils?.drawer?.onAfterClose, children: [_jsx(DrawerHeader, { ref: backButtonRef, text: drawerData?.label || '' }), navContent] }) }), !drawerOpen && (_jsxs(_Fragment, { children: [_jsx(NavigationHeader, { ...appInfo }), navContent] })), utils && _jsx(Utils, { ...utils, onClose: () => setDrawerOpen(false) })] }) }), _jsx(StyledNavToggle, { icon: true, "aria-expanded": navExpanded, label: navState === 'expanded' || navState === 'collapsed'
92
- ? toggleButtonLabel
93
- : undefined, "aria-label": toggleButtonA11y, onClick: toggleNavState, children: _jsx(Icon, { name: 'arrow-micro-right' }) })] })), _jsx(Flex, { item: { grow: 1 }, as: StyledMain, children: main })] })] }));
40
+ navOpen: navState === 'open' || navState === 'opening',
41
+ navState,
42
+ openNav
43
+ }), [navState]), children: [_jsx(SkipLinks, { items: skipLinks }), _jsx(AppHeader, { ...appHeader }), _jsxs(Flex, { ...restProps, container: {
44
+ direction: 'column',
45
+ justify: 'between'
46
+ }, ref: navRef, as: StyledNav, children: [_jsx(StyledScrollWrap, { onClick: () => {
47
+ if (['closing', 'closed'].includes(navState)) {
48
+ openNav();
49
+ }
50
+ else {
51
+ closeNav();
52
+ }
53
+ }, children: _jsx(NavigationList, { ...nav }) }), _jsxs(Flex, { as: StyledUtils, container: { justify: 'center' }, children: [_jsx(StyledAppShellToggleButton, { icon: true, ref: setExpandCollapseEl, compact: true, variant: 'simple', onClick: () => {
54
+ setNavState(navState === 'closed' ? 'open' : 'closed');
55
+ }, open: ['open', 'opening'].includes(navState), "aria-label": navState === 'closed' ? t('expand') : t('collapse'), children: _jsx(Icon, { name: `arrow-micro-${['closed', 'closing'].includes(navState) ? end : start}` }) }), ['open', 'closed'].includes(navState) && (_jsx(Tooltip, { target: expandCollapseEl, placement: 'right', showDelay: 'none', hideDelay: 'none', children: navState === 'closed' ? t('expand') : t('collapse') }))] })] }), _jsx(StyledMain, { navOpen: ['open', 'opening'].includes(navState), children: main })] }));
94
56
  });
95
57
  export default AppShell;
96
58
  //# sourceMappingURL=AppShell.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppShell.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAGV,OAAO,EACP,QAAQ,EACR,UAAU,EACV,MAAM,EACN,SAAS,EACV,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,SAAS,EAET,MAAM,EACN,YAAY,EACZ,OAAO,EACP,qBAAqB,EACrB,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,QAAQ,EACR,MAAM,EACP,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAC5F,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAElF,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EACL,YAAY,EACZ,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,SAAS,EACT,cAAc,EACd,eAAe,EACf,uBAAuB,EACxB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAGhD,MAAM,gBAAgB,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAgB,EAAE,EAAE;IAChE,OAAO,CACL,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,E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O,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,GAAI,IAC9D,GACQ,EACjB,KAAC,eAAe,IACd,IAAI,yBACW,WAAW,EAC1B,KAAK,EACH,QAAQ,KAAK,UAAU,IAAI,QAAQ,KAAK,WAAW;oCACjD,CAAC,CAAC,iBAAiB;oCACnB,CAAC,CAAC,SAAS,gBAEH,gBAAgB,EAC5B,OAAO,EAAE,cAAc,YAEvB,KAAC,IAAI,IAAC,IAAI,EAAC,mBAAmB,GAAG,GACjB,IACR,CACb,EACD,KAAC,IAAI,IAAC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,UAAU,YACpC,IAAI,GACA,IACF,IACkB,CAC5B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import {\n forwardRef,\n PropsWithoutRef,\n Ref,\n useMemo,\n useState,\n useContext,\n useRef,\n useEffect\n} from 'react';\n\nimport {\n Flex,\n Icon,\n Switch,\n SkipLinks,\n SkipLinksProps,\n Drawer,\n useDirection,\n useI18n,\n useAfterInitialEffect,\n StandardTree,\n useConsolidatedRef,\n useTransitionState,\n MetaList,\n Avatar\n} from '@pega/cosmos-react-core';\nimport { expandCollapseStates } from '@pega/cosmos-react-core/lib/hooks/useTransitionState';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\n\nimport AppHeader from './Header/AppHeader';\nimport {\n StyledHeader,\n StyledUtils,\n StyledUtilItem,\n StyledScrollWrap,\n StyledNavContent,\n StyledMain,\n StyledDrawerWrapper,\n StyledDrawerHeader,\n StyledNavTitle,\n StyledNav,\n StyledInnerNav,\n StyledNavToggle,\n StyledDrawerCloseButton\n} from './AppShell.styles';\nimport AppShellContext from './AppShellContext';\nimport type { AppShellProps, AppInfoProps, UtilsProps } from './AppShell.types';\n\nconst NavigationHeader = ({ text, visual, meta }: AppInfoProps) => {\n return (\n <Flex container={{ alignItems: 'center', pad: 2, gap: 1 }} as={StyledHeader}>\n {visual && <Avatar {...visual} name={text} shape='squircle' />}\n <Flex container={{ direction: 'column', alignItems: 'start' }}>\n <StyledNavTitle variant='h4'>{text}</StyledNavTitle>\n {meta && <MetaList wrapItems items={meta} />}\n </Flex>\n </Flex>\n );\n};\n\nconst DrawerHeader = forwardRef(\n ({ text }: PropsWithoutRef<AppInfoProps>, ref: Ref<HTMLButtonElement>) => {\n const t = useI18n();\n const { setDrawerData, setDrawerOpen } = useContext(AppShellContext);\n const { start } = useDirection();\n\n const onDrawerClose = () => {\n setDrawerOpen(false);\n setDrawerData(undefined);\n };\n\n return (\n <Flex container={{ alignItems: 'center' }} as={StyledDrawerHeader}>\n <StyledDrawerCloseButton\n variant='simple'\n onClick={onDrawerClose}\n aria-label={t('close_noun', [text])}\n icon\n ref={ref}\n >\n <Icon name={`caret-${start}`} />\n </StyledDrawerCloseButton>\n\n <StyledNavTitle variant='h4'>{text}</StyledNavTitle>\n </Flex>\n );\n }\n);\n\nconst Utils = ({\n items,\n onItemClick,\n onClose,\n currentItemId,\n devMode\n}: UtilsProps & { onClose: () => void }) => {\n const { drawerData, setDrawerData, setDrawerOpen } = useContext(AppShellContext);\n const [showDevMode, setShowDevMode] = useState(devMode ?? false);\n const t = useI18n();\n\n useEffect(() => {\n setShowDevMode(devMode ?? false);\n }, [devMode]);\n\n useAfterInitialEffect(() => {\n if (!showDevMode) {\n setDrawerData(undefined);\n onClose();\n }\n }, [showDevMode]);\n\n return (\n <StyledUtils showDevMode={showDevMode}>\n <Switch\n label={t('dev_mode').toUpperCase()}\n onChange={() => setShowDevMode(cur => !cur)}\n on={showDevMode}\n />\n {showDevMode && (\n <ul role='menu'>\n {items.map(({ label, id }) => {\n return (\n <StyledUtilItem\n key={id}\n role='menuitem'\n aria-current={drawerData?.id !== id && currentItemId === id ? 'true' : undefined}\n >\n <BareButton\n onClick={() => {\n setDrawerData({ label, id });\n setDrawerOpen(true);\n onItemClick(id);\n }}\n >\n {label}\n </BareButton>\n </StyledUtilItem>\n );\n })}\n </ul>\n )}\n </StyledUtils>\n );\n};\n\nconst AppShell = forwardRef(\n (\n {\n main,\n appHeader,\n appInfo,\n utils,\n navigation,\n hideNav = false\n }: PropsWithoutRef<AppShellProps>,\n ref: AppShellProps['ref']\n ) => {\n const navRef = useConsolidatedRef(ref);\n const [drawerOpen, setDrawerOpen] = useState(!!utils?.currentItemId);\n const [drawerData, setDrawerData] = useState(\n utils?.items.find(i => i.id === utils?.currentItemId)\n );\n const backButtonRef = useRef<HTMLButtonElement>(null);\n const { rtl } = useDirection();\n const t = useI18n();\n\n const { state: navState, toggle: toggleNavState } = useTransitionState({\n ref: navRef,\n property: 'width',\n states: expandCollapseStates,\n defaultState: 'expanded'\n });\n\n useAfterInitialEffect(() => {\n const drawerItem = utils?.items.find(i => i.id === utils?.currentItemId);\n\n if (drawerItem) {\n setDrawerData(drawerItem);\n setDrawerOpen(true);\n } else {\n setDrawerData(undefined);\n setDrawerOpen(false);\n }\n }, [utils?.currentItemId]);\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 navExpanded = navState === 'expanded' || navState === 'expanding';\n\n const navContent = useMemo(() => {\n return (\n <Flex item={{ grow: 1 }} as={StyledScrollWrap}>\n <StandardTree {...navigation} />\n </Flex>\n );\n }, [navigation]);\n\n const toggleButtonLabel = t(navExpanded ? 'collapse' : 'expand');\n const toggleButtonA11y = t(navExpanded ? 'collapse_navigation' : 'expand_navigation');\n\n return (\n <AppShellContext.Provider\n value={useMemo(\n () => ({\n drawerOpen,\n setDrawerOpen,\n drawerData,\n setDrawerData,\n navState\n }),\n [navExpanded, drawerOpen, drawerData, navState]\n )}\n >\n <SkipLinks items={skipLinks} />\n <AppHeader {...appHeader} />\n <Flex container>\n {!hideNav && (\n <StyledNav ref={navRef}>\n <StyledInnerNav>\n <Flex\n container={{ direction: 'column', justify: 'between' }}\n as={StyledNavContent}\n aria-hidden={!navExpanded}\n >\n <StyledDrawerWrapper>\n <Drawer\n open={drawerOpen && !!drawerData}\n nullWhenClosed\n position='absolute'\n placement={rtl ? 'right' : 'left'}\n onBeforeOpen={utils?.drawer?.onBeforeOpen}\n onAfterOpen={() => {\n if (\n backButtonRef.current &&\n document.activeElement !== backButtonRef.current\n ) {\n backButtonRef.current.focus();\n }\n utils?.drawer?.onAfterOpen?.();\n }}\n onBeforeClose={utils?.drawer?.onBeforeClose}\n onAfterClose={utils?.drawer?.onAfterClose}\n >\n <DrawerHeader ref={backButtonRef} text={drawerData?.label || ''} />\n {navContent}\n </Drawer>\n </StyledDrawerWrapper>\n\n {!drawerOpen && (\n <>\n <NavigationHeader {...appInfo} />\n {navContent}\n </>\n )}\n\n {utils && <Utils {...utils} onClose={() => setDrawerOpen(false)} />}\n </Flex>\n </StyledInnerNav>\n <StyledNavToggle\n icon\n aria-expanded={navExpanded}\n label={\n navState === 'expanded' || navState === 'collapsed'\n ? toggleButtonLabel\n : undefined\n }\n aria-label={toggleButtonA11y}\n onClick={toggleNavState}\n >\n <Icon name='arrow-micro-right' />\n </StyledNavToggle>\n </StyledNav>\n )}\n <Flex item={{ grow: 1 }} as={StyledMain}>\n {main}\n </Flex>\n </Flex>\n </AppShellContext.Provider>\n );\n }\n);\n\nexport default AppShell;\n"]}
1
+ {"version":3,"file":"AppShell.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqB,UAAU,EAAwB,OAAO,EAAE,MAAM,OAAO,CAAC;AAErF,OAAO,EACL,YAAY,EACZ,OAAO,EACP,IAAI,EAEJ,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,kBAAkB,EAElB,IAAI,EACJ,OAAO,EACP,SAAS,EACV,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,sDAAsD,CAAC;AAEvF,OAAO,KAAK,SAAS,MAAM,8DA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,OAAO,EAAE,GAAG,EAAE;oCACZ,WAAW,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;gCACzD,CAAC,EACD,IAAI,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,gBAChC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,YAE/D,KAAC,IAAI,IACH,IAAI,EAAE,eAAe,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,GAC7E,GACyB,EAC5B,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CACxC,KAAC,OAAO,IACN,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAC,OAAO,EACjB,SAAS,EAAC,MAAM,EAChB,SAAS,EAAC,MAAM,YAEf,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAC5C,CACX,IACI,IACF,EAEP,KAAC,UAAU,IAAC,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAG,IAAI,GAAc,IACvD,CAC5B,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,QAAQ,CAAC","sourcesContent":["import { FunctionComponent, forwardRef, PropsWithoutRef, Ref, useMemo } from 'react';\n\nimport {\n registerIcon,\n useI18n,\n Icon,\n ForwardProps,\n useDirection,\n useConsolidatedRef,\n useElement,\n useTransitionState,\n SkipLinksProps,\n Flex,\n Tooltip,\n SkipLinks\n} from '@pega/cosmos-react-core';\nimport { openCloseStates } from '@pega/cosmos-react-core/lib/hooks/useTransitionState';\n\nimport * as timesIcon from '../../../../cosmos-core/src/components/Icon/icons/times.icon';\nimport * as plusIcon from '../../../../cosmos-core/src/components/Icon/icons/plus.icon';\nimport * as caseSolidIcon from '../../../../cosmos-core/src/components/Icon/icons/case-solid.icon';\nimport * as barsIcon from '../../../../cosmos-core/src/components/Icon/icons/bars.icon';\nimport * as caretLeftIcon from '../../../../cosmos-core/src/components/Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '../../../../cosmos-core/src/components/Icon/icons/caret-right.icon';\n\nimport AppHeader from './Header/AppHeader';\nimport {\n StyledScrollWrap,\n StyledMain,\n StyledUtils,\n StyledNav,\n StyledAppShellToggleButton\n} from './AppShell.styles';\nimport AppShellContext from './AppShellContext';\nimport type { AppShellProps } from './AppShell.types';\nimport NavigationList from './NavigationList';\n\nregisterIcon(timesIcon, plusIcon, caseSolidIcon, barsIcon, caretRightIcon, caretLeftIcon);\n\nconst AppShell: FunctionComponent<AppShellProps & ForwardProps> = forwardRef(\n (\n { main, appHeader, nav, ...restProps }: PropsWithoutRef<AppShellProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n const t = useI18n();\n\n const { start, end } = useDirection();\n const navRef = useConsolidatedRef(ref);\n\n const [expandCollapseEl, setExpandCollapseEl] = useElement<HTMLButtonElement>();\n\n const { state: navState, set: setNavState } = useTransitionState({\n ref: navRef,\n property: 'width',\n states: openCloseStates,\n defaultState: 'closed'\n });\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 openNav = () => {\n setNavState('open');\n };\n\n const closeNav = () => {\n setNavState('closed');\n };\n\n return (\n <AppShellContext.Provider\n value={useMemo(\n () => ({\n navOpen: navState === 'open' || navState === 'opening',\n navState,\n openNav\n }),\n [navState]\n )}\n >\n <SkipLinks items={skipLinks} />\n <AppHeader {...appHeader} />\n\n <Flex\n {...restProps}\n container={{\n direction: 'column',\n justify: 'between'\n }}\n ref={navRef}\n as={StyledNav}\n >\n <StyledScrollWrap\n onClick={() => {\n if (['closing', 'closed'].includes(navState)) {\n openNav();\n } else {\n closeNav();\n }\n }}\n >\n <NavigationList {...nav} />\n </StyledScrollWrap>\n\n <Flex as={StyledUtils} container={{ justify: 'center' }}>\n <StyledAppShellToggleButton\n icon\n ref={setExpandCollapseEl}\n compact\n variant='simple'\n onClick={() => {\n setNavState(navState === 'closed' ? 'open' : 'closed');\n }}\n open={['open', 'opening'].includes(navState)}\n aria-label={navState === 'closed' ? t('expand') : t('collapse')}\n >\n <Icon\n name={`arrow-micro-${['closed', 'closing'].includes(navState) ? end : start}`}\n />\n </StyledAppShellToggleButton>\n {['open', 'closed'].includes(navState) && (\n <Tooltip\n target={expandCollapseEl}\n placement='right'\n showDelay='none'\n hideDelay='none'\n >\n {navState === 'closed' ? t('expand') : t('collapse')}\n </Tooltip>\n )}\n </Flex>\n </Flex>\n\n <StyledMain navOpen={['open', 'opening'].includes(navState)}>{main}</StyledMain>\n </AppShellContext.Provider>\n );\n }\n);\n\nexport default AppShell;\n"]}
@@ -1,21 +1,16 @@
1
1
  /// <reference types="react" />
2
- export declare const StyledNavToggle: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").ButtonProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
3
- export declare const StyledHeader: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
4
- export declare const StyledDrawerHeader: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
5
- export declare const StyledNavHeaderIcon: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").IconProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
6
- export declare const StyledNavTitle: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").TextProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
7
- export declare const StyledUtils: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
8
- showDevMode: boolean;
2
+ export declare const StyledUtils: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
3
+ export declare const StyledAppShellToggleButton: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").ButtonProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {
4
+ open: boolean;
9
5
  }, never>;
10
- export declare const StyledUtilItem: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, {}, never>;
11
6
  export declare const StyledScrollWrap: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
12
- export declare const StyledNavContent: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
13
- export declare const StyledMain: import("styled-components").StyledComponent<"main", import("styled-components").DefaultTheme, {}, never>;
14
- export declare const StyledDrawerWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
15
- export declare const StyledNavHeaderVisual: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
16
- bgColor: string;
7
+ export declare const StyledMain: import("styled-components").StyledComponent<"main", import("styled-components").DefaultTheme, {
8
+ navOpen: boolean;
17
9
  }, never>;
18
- export declare const StyledDrawerCloseButton: import("styled-components").StyledComponent<import("react").FunctionComponent<import("@pega/cosmos-react-core").ButtonProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
19
- export declare const StyledInnerNav: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
20
10
  export declare const StyledNav: import("styled-components").StyledComponent<"nav", import("styled-components").DefaultTheme, {}, never>;
11
+ export declare const StyledAppShellCaretIcon: import("styled-components").StyledComponent<"svg", import("styled-components").DefaultTheme, {
12
+ nestedListCollapsed?: boolean | undefined;
13
+ }, never>;
14
+ export declare const StyledNavListItem: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, {}, never>;
15
+ export declare const StyledNavList: import("styled-components").StyledComponent<"ul", import("styled-components").DefaultTheme, {}, never>;
21
16
  //# sourceMappingURL=AppShell.styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppShell.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.styles.ts"],"names":[],"mappings":";AA2BA,eAAO,MAAM,eAAe,qOA4B1B,CAAC;AAIH,eAAO,MAAM,YAAY,yGAwBvB,CAAC;AAIH,eAAO,MAAM,kBAAkB,yGAK7B,CAAC;AAIH,eAAO,MAAM,mBAAmB,mOAI9B,CAAC;AAIH,eAAO,MAAM,cAAc,mOAKzB,CAAC;AAIH,eAAO,MAAM,WAAW;iBAA6B,OAAO;SA8B1D,CAAC;AAIH,eAAO,MAAM,cAAc,wGA2BzB,CAAC;AAIH,eAAO,MAAM,gBAAgB,yGAO3B,CAAC;AAIH,eAAO,MAAM,gBAAgB,yGAmB3B,CAAC;AAIH,eAAO,MAAM,UAAU,0GAqBtB,CAAC;AAIF,eAAO,MAAM,mBAAmB,yGAQ9B,CAAC;AAIH,eAAO,MAAM,qBAAqB;aAAyB,MAAM;SAY/D,CAAC;AAIH,eAAO,MAAM,uBAAuB,qOAYlC,CAAC;AAIH,eAAO,MAAM,cAAc,yGAUzB,CAAC;AAIH,eAAO,MAAM,SAAS,yGA6IrB,CAAC"}
1
+ {"version":3,"file":"AppShell.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.styles.ts"],"names":[],"mappings":";AAwBA,eAAO,MAAM,WAAW,yGAStB,CAAC;AAIH,eAAO,MAAM,0BAA0B;UAA0B,OAAO;SAsBtE,CAAC;AAIH,eAAO,MAAM,gBAAgB,yGAK3B,CAAC;AAIH,eAAO,MAAM,UAAU;aACZ,OAAO;SA6BjB,CAAC;AAIF,eAAO,MAAM,SAAS,yGAkIrB,CAAC;AAIF,eAAO,MAAM,uBAAuB;;SAenC,CAAC;AAIF,eAAO,MAAM,iBAAiB,wGAmE5B,CAAC;AAIH,eAAO,MAAM,aAAa,wGAAc,CAAC"}