@pega/cosmos-react-build 4.0.0-dev.8.1 → 4.0.0-dev.8.3

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.
@@ -1 +1 @@
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;AAkBjC,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
+ {"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;AAkBjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKtD,QAAA,MAAM,QAAQ,EAAE,iBAAiB,CAAC,aAAa,GAAG,YAAY,CA6G7D,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -40,7 +40,7 @@ const AppShell = forwardRef(({ main, appHeader, nav, ...restProps }, ref) => {
40
40
  navOpen: navState === 'open' || navState === 'opening',
41
41
  navState,
42
42
  openNav
43
- }), [navState]), children: [_jsx(SkipLinks, { items: skipLinks }), _jsx(AppHeader, { ...appHeader }), _jsxs(Flex, { ...restProps, container: {
43
+ }), [navState]), children: [_jsx(SkipLinks, { items: skipLinks }), _jsx(AppHeader, { ...appHeader }), nav && (_jsxs(Flex, { ...restProps, container: {
44
44
  direction: 'column',
45
45
  justify: 'between'
46
46
  }, ref: navRef, as: StyledNav, children: [_jsx(StyledScrollWrap, { onClick: () => {
@@ -52,7 +52,7 @@ const AppShell = forwardRef(({ main, appHeader, nav, ...restProps }, ref) => {
52
52
  }
53
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
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 })] }));
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), hideNav: !nav, children: main })] }));
56
56
  });
57
57
  export default AppShell;
58
58
  //# sourceMappingURL=AppShell.js.map
@@ -1 +1 @@
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;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A0B,IACzB,IAAI,QACJ,GAAG,EAAE,mBAAmB,EACxB,OAAO,QACP,OAAO,EAAC,QAAQ,EAChB,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';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\nimport * as plusIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/plus.icon';\nimport * as caseSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/case-solid.icon';\nimport * as barsIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/bars.icon';\nimport * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '@pega/cosmos-react-core/lib/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
+ {"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;AACvF,OAAO,KAAK,SAAS,MAAM,8DAA8D,CAAC;AAC1F,OAAO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,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,CACR,EAED,KAAC,UAAU,IAAC,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,YACvE,IAAI,GACM,IACY,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';\nimport * as timesIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/times.icon';\nimport * as plusIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/plus.icon';\nimport * as caseSolidIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/case-solid.icon';\nimport * as barsIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/bars.icon';\nimport * as caretLeftIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '@pega/cosmos-react-core/lib/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 {nav && (\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\n <StyledMain navOpen={['open', 'opening'].includes(navState)} hideNav={!nav}>\n {main}\n </StyledMain>\n </AppShellContext.Provider>\n );\n }\n);\n\nexport default AppShell;\n"]}
@@ -6,6 +6,7 @@ export declare const StyledAppShellToggleButton: import("styled-components").Sty
6
6
  export declare const StyledScrollWrap: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
7
7
  export declare const StyledMain: import("styled-components").StyledComponent<"main", import("styled-components").DefaultTheme, {
8
8
  navOpen: boolean;
9
+ hideNav: boolean;
9
10
  }, never>;
10
11
  export declare const StyledNav: import("styled-components").StyledComponent<"nav", import("styled-components").DefaultTheme, {}, never>;
11
12
  export declare const StyledAppShellCaretIcon: import("styled-components").StyledComponent<"svg", import("styled-components").DefaultTheme, {
@@ -1 +1 @@
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"}
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;aACP,OAAO;SAoCjB,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"}
@@ -45,7 +45,7 @@ export const StyledScrollWrap = styled.div(() => {
45
45
  `;
46
46
  });
47
47
  StyledScrollWrap.defaultProps = defaultThemeProp;
48
- export const StyledMain = styled.main(({ navOpen, theme: { base: { animation, breakpoints, palette } } }) => {
48
+ export const StyledMain = styled.main(({ navOpen, hideNav, theme: { base: { animation, breakpoints, palette } } }) => {
49
49
  return css `
50
50
  position: relative;
51
51
  min-height: calc(100vh - 6rem);
@@ -65,6 +65,12 @@ export const StyledMain = styled.main(({ navOpen, theme: { base: { animation, br
65
65
  css `
66
66
  margin-inline-start: ${navOpenWidth};
67
67
  `}
68
+
69
+ ${hideNav &&
70
+ css `
71
+ transition-duration: 0s;
72
+ margin-inline-start: 0;
73
+ `}
68
74
  `;
69
75
  });
70
76
  StyledMain.defaultProps = defaultThemeProp;
@@ -1 +1 @@
1
- {"version":3,"file":"AppShell.styles.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,MAAM,EACN,UAAU,EACV,YAAY,EACZ,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,iEAAiE,CAAC;AAEzE,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,MAAM,QAAQ,GAAG,MAAM,CAAC;AACxB,MAAM,YAAY,GAAG,OAAO,CAAC;AAE7B,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAClD,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,EAAE,CAChC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,CACpE,CAAC;IAEF,OAAO,GAAG,CAAA;qBACS,KAAK,CAAC,IAAI,CAAC,OAAO;0CACG,WAAW;GAClD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,WAAW,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAE5C,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,CAAC,CAAoB,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE;IAC9F,OAAO,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AAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,EAAE,CAAA,EAAE,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { lighten, rgba } from 'polished';\nimport { useContext } from 'react';\n\nimport {\n tryCatch,\n defaultThemeProp,\n Button,\n StyledIcon,\n useDirection,\n calculateFontSize\n} from '@pega/cosmos-react-core';\nimport {\n StyledToggleIcon,\n StyledNodeText,\n StyledNodeInteraction,\n StyledStandardTree\n} from '@pega/cosmos-react-core/lib/components/Tree/StandardTree.styles';\n\nimport AppShellContext from './AppShellContext';\n\nconst navWidth = '3rem';\nconst navOpenWidth = '14rem';\n\nexport const StyledUtils = styled.div(({ theme }) => {\n const borderColor = tryCatch(() =>\n lighten(0.1, theme.components['app-shell'].nav['background-color'])\n );\n\n return css`\n padding-block: ${theme.base.spacing};\n border-block-start: 0.0625rem solid ${borderColor};\n `;\n});\n\nStyledUtils.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellToggleButton = styled(Button)<{ open: boolean }>(({ theme, open }) => {\n return css`\n background-color: ${theme.base.palette.dark};\n color: ${theme.base.palette.light};\n border: none;\n\n ${open &&\n css`\n padding-inline: 1rem;\n `}\n\n ${StyledIcon} {\n width: 1.25rem;\n height: 1.25rem;\n font-weight: bold;\n }\n\n &:enabled:focus,\n :not([disabled]):focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n `;\n});\n\nStyledAppShellToggleButton.defaultProps = defaultThemeProp;\n\nexport const StyledScrollWrap = styled.div(() => {\n return css`\n height: 100%;\n overflow-y: auto;\n `;\n});\n\nStyledScrollWrap.defaultProps = defaultThemeProp;\n\nexport const StyledMain = styled.main<{\n navOpen: boolean;\n}>(\n ({\n navOpen,\n theme: {\n base: { animation, breakpoints, palette }\n }\n }) => {\n return css`\n position: relative;\n min-height: calc(100vh - 6rem);\n background-color: ${palette['app-background']};\n margin-inline-start: ${navWidth};\n transition: margin-inline-start ${`${animation.speed} ${animation.timing.ease}`};\n\n @media (pointer: coarse) {\n min-height: calc(100vh - 8rem);\n }\n\n @media (min-width: ${breakpoints.md}) {\n height: calc(100vh - 3rem);\n }\n\n ${navOpen &&\n css`\n margin-inline-start: ${navOpenWidth};\n `}\n `;\n }\n);\n\nStyledMain.defaultProps = defaultThemeProp;\n\nexport const StyledNav = styled.nav(\n ({\n theme: {\n base: {\n breakpoints,\n colors,\n palette,\n animation,\n spacing,\n shadow,\n 'custom-scrollbar': customScrollbar,\n 'border-radius': borderRadius,\n 'font-size': fontSize,\n 'font-scale': fontScale\n },\n components: { 'app-shell': appShell }\n }\n }) => {\n const { navState } = useContext(AppShellContext);\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n position: fixed;\n z-index: 1;\n height: calc(100vh - 6rem);\n background: ${appShell.nav['background-color']};\n width: ${navState === 'opening' || navState === 'open' ? navOpenWidth : navWidth};\n transition: width ${animation.speed} ${animation.timing.ease};\n display: flex;\n\n ${StyledStandardTree} {\n background-color: ${palette.dark};\n\n ${StyledNodeText}, ${StyledToggleIcon} {\n color: rgba(255, 255, 255, 0.7);\n font-size: ${fontSizes.xxs};\n }\n\n ${StyledNodeInteraction} {\n padding-block-start: calc(0.5 * ${spacing});\n padding-block-end: calc(0.5 * ${spacing});\n\n &:hover {\n background: rgba(255, 255, 255, 0.1);\n\n ${StyledNodeText} {\n color: ${palette.light};\n }\n }\n\n &:focus {\n box-shadow: ${shadow['focus-inset']};\n }\n\n &[aria-current='page'],\n &[aria-current='true'] {\n background: rgba(255, 255, 255, 0.05);\n\n ${StyledNodeText} {\n color: ${colors.blue.light};\n }\n }\n }\n\n &:has(:focus-visible) {\n box-shadow: inset 0 0 0 0.125rem #71c1ff99;\n }\n }\n\n ${customScrollbar &&\n css`\n * {\n scrollbar-color: rgba(255, 255, 255, 0.6) rgba(0, 0, 0, 0.2);\n scrollbar-width: thin;\n }\n\n @supports not ((scrollbar-width: thin) or (scrollbar-color: black white)) {\n /* stylelint-disable unit-allowed-list */\n\n *::-webkit-scrollbar {\n width: 12px;\n height: 12px;\n }\n\n *::-webkit-scrollbar-track {\n background-color: rgba(0, 0, 0, 0.2);\n }\n\n *::-webkit-scrollbar-corner {\n background-color: rgba(0, 0, 0, 0.2);\n border-bottom-right-radius: inherit;\n }\n\n *::-webkit-scrollbar-thumb {\n background-color: transparent;\n border: 3px solid transparent;\n border-radius: calc(1.125 * ${borderRadius});\n box-shadow: inset 0 0 2px 4px rgba(255, 255, 255, 0.6);\n }\n\n *::-webkit-scrollbar-thumb:hover {\n box-shadow: inset 0 0 2px 4px rgba(255, 255, 255, 0.7);\n }\n\n *::-webkit-scrollbar-track:horizontal {\n border-bottom-left-radius: inherit;\n }\n\n *::-webkit-scrollbar-track:vertical {\n border-top-right-radius: inherit;\n }\n\n /* stylelint-disable-next-line selector-pseudo-class-no-unknown */\n *::-webkit-scrollbar-track:not(:corner-present) {\n border-bottom-right-radius: inherit;\n }\n\n /* stylelint-enable unit-allowed-list */\n }\n `}\n\n @media (pointer: coarse) {\n height: calc(100vh - 8rem);\n }\n\n @media (min-width: ${breakpoints.md}) {\n height: calc(100vh - 3rem);\n }\n `;\n }\n);\n\nStyledNav.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellCaretIcon = styled.svg<{ nestedListCollapsed?: boolean }>(\n ({ nestedListCollapsed, theme }) => {\n const { rtl } = useDirection();\n\n return css`\n transition-property: transform;\n transition-duration: ${theme.base.animation.speed};\n transition-timing-function: ${theme.base.animation.timing.ease};\n\n ${nestedListCollapsed === false &&\n css`\n transform: rotateZ(${rtl ? '-90deg' : '90deg'});\n `}\n `;\n }\n);\n\nStyledAppShellCaretIcon.defaultProps = defaultThemeProp;\n\nexport const StyledNavListItem = styled.li(({ theme }) => {\n const { navOpen } = useContext(AppShellContext);\n const activeBackground = tryCatch(() =>\n rgba('#000000', theme.base.transparency['transparent-4'])\n );\n\n return css`\n display: block;\n position: relative;\n ${StyledIcon} {\n font-size: 1.25rem;\n }\n\n > :first-child {\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n padding: calc(1.25 * ${theme.base.spacing}) 0;\n white-space: nowrap;\n color: rgba(255, 255, 255, 0.7);\n cursor: pointer;\n font-weight: ${theme.base['font-weight']['semi-bold']};\n text-decoration: none;\n\n span {\n overflow: hidden;\n color: inherit;\n }\n\n &:hover,\n &:focus {\n color: ${theme.base.palette.light};\n background: rgba(255, 255, 255, 0.05);\n }\n\n &:focus {\n outline: none;\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n\n ${StyledAppShellCaretIcon}:last-child {\n position: absolute;\n left: ${navOpen ? 'auto' : '100%'};\n ${navOpen &&\n css`\n inset-inline-end: 1rem;\n `}\n margin: 0;\n opacity: ${navOpen ? '1' : '0'};\n transition-property: opacity;\n }\n\n ${StyledIcon}:first-child {\n flex-shrink: 0;\n margin: 0 calc((${navWidth} - 1.125rem) / 2);\n }\n }\n\n &[aria-current='page'] > :first-child,\n &[aria-current='true'] > :first-child,\n &:has([aria-current='page']) > :first-child,\n &:has([aria-current='true']) > :first-child {\n color: ${theme.base.colors.blue.light};\n background-color: ${activeBackground};\n }\n `;\n});\n\nStyledNavListItem.defaultProps = defaultThemeProp;\n\nexport const StyledNavList = styled.ul``;\n"]}
1
+ {"version":3,"file":"AppShell.styles.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,MAAM,EACN,UAAU,EACV,YAAY,EACZ,iBAAiB,EAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,iEAAiE,CAAC;AAEzE,OAAO,eAAe,MAAM,mBAAmB,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C1D,CAAC;IAEF,OAAO,GAAG,CAAA;;;MAGN,UAAU;;;;;;;;;6BASa,KAAK,CAAC,IAAI,CAAC,OAAO;;;;qBAI1B,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;iBAU1C,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK;;;;;;sBAMnB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC;;;QAG9C,uBAAuB;;gBAEf,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;UAC/B,OAAO;QACT,GAAG,CAAA;;SAEF;;mBAEU,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;;;;QAI9B,UAAU;;0BAEQ,QAAQ;;;;;;;;eAQnB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK;0BACjB,gBAAgB;;GAEvC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,iBAAiB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,EAAE,CAAA,EAAE,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { lighten, rgba } from 'polished';\nimport { useContext } from 'react';\n\nimport {\n tryCatch,\n defaultThemeProp,\n Button,\n StyledIcon,\n useDirection,\n calculateFontSize\n} from '@pega/cosmos-react-core';\nimport {\n StyledToggleIcon,\n StyledNodeText,\n StyledNodeInteraction,\n StyledStandardTree\n} from '@pega/cosmos-react-core/lib/components/Tree/StandardTree.styles';\n\nimport AppShellContext from './AppShellContext';\n\nconst navWidth = '3rem';\nconst navOpenWidth = '14rem';\n\nexport const StyledUtils = styled.div(({ theme }) => {\n const borderColor = tryCatch(() =>\n lighten(0.1, theme.components['app-shell'].nav['background-color'])\n );\n\n return css`\n padding-block: ${theme.base.spacing};\n border-block-start: 0.0625rem solid ${borderColor};\n `;\n});\n\nStyledUtils.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellToggleButton = styled(Button)<{ open: boolean }>(({ theme, open }) => {\n return css`\n background-color: ${theme.base.palette.dark};\n color: ${theme.base.palette.light};\n border: none;\n\n ${open &&\n css`\n padding-inline: 1rem;\n `}\n\n ${StyledIcon} {\n width: 1.25rem;\n height: 1.25rem;\n font-weight: bold;\n }\n\n &:enabled:focus,\n :not([disabled]):focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n `;\n});\n\nStyledAppShellToggleButton.defaultProps = defaultThemeProp;\n\nexport const StyledScrollWrap = styled.div(() => {\n return css`\n height: 100%;\n overflow-y: auto;\n `;\n});\n\nStyledScrollWrap.defaultProps = defaultThemeProp;\n\nexport const StyledMain = styled.main<{\n navOpen: boolean;\n hideNav: boolean;\n}>(\n ({\n navOpen,\n hideNav,\n theme: {\n base: { animation, breakpoints, palette }\n }\n }) => {\n return css`\n position: relative;\n min-height: calc(100vh - 6rem);\n background-color: ${palette['app-background']};\n margin-inline-start: ${navWidth};\n transition: margin-inline-start ${`${animation.speed} ${animation.timing.ease}`};\n\n @media (pointer: coarse) {\n min-height: calc(100vh - 8rem);\n }\n\n @media (min-width: ${breakpoints.md}) {\n height: calc(100vh - 3rem);\n }\n\n ${navOpen &&\n css`\n margin-inline-start: ${navOpenWidth};\n `}\n\n ${hideNav &&\n css`\n transition-duration: 0s;\n margin-inline-start: 0;\n `}\n `;\n }\n);\n\nStyledMain.defaultProps = defaultThemeProp;\n\nexport const StyledNav = styled.nav(\n ({\n theme: {\n base: {\n breakpoints,\n colors,\n palette,\n animation,\n spacing,\n shadow,\n 'custom-scrollbar': customScrollbar,\n 'border-radius': borderRadius,\n 'font-size': fontSize,\n 'font-scale': fontScale\n },\n components: { 'app-shell': appShell }\n }\n }) => {\n const { navState } = useContext(AppShellContext);\n const fontSizes = calculateFontSize(fontSize, fontScale);\n\n return css`\n position: fixed;\n z-index: 1;\n height: calc(100vh - 6rem);\n background: ${appShell.nav['background-color']};\n width: ${navState === 'opening' || navState === 'open' ? navOpenWidth : navWidth};\n transition: width ${animation.speed} ${animation.timing.ease};\n display: flex;\n\n ${StyledStandardTree} {\n background-color: ${palette.dark};\n\n ${StyledNodeText}, ${StyledToggleIcon} {\n color: rgba(255, 255, 255, 0.7);\n font-size: ${fontSizes.xxs};\n }\n\n ${StyledNodeInteraction} {\n padding-block-start: calc(0.5 * ${spacing});\n padding-block-end: calc(0.5 * ${spacing});\n\n &:hover {\n background: rgba(255, 255, 255, 0.1);\n\n ${StyledNodeText} {\n color: ${palette.light};\n }\n }\n\n &:focus {\n box-shadow: ${shadow['focus-inset']};\n }\n\n &[aria-current='page'],\n &[aria-current='true'] {\n background: rgba(255, 255, 255, 0.05);\n\n ${StyledNodeText} {\n color: ${colors.blue.light};\n }\n }\n }\n\n &:has(:focus-visible) {\n box-shadow: inset 0 0 0 0.125rem #71c1ff99;\n }\n }\n\n ${customScrollbar &&\n css`\n * {\n scrollbar-color: rgba(255, 255, 255, 0.6) rgba(0, 0, 0, 0.2);\n scrollbar-width: thin;\n }\n\n @supports not ((scrollbar-width: thin) or (scrollbar-color: black white)) {\n /* stylelint-disable unit-allowed-list */\n\n *::-webkit-scrollbar {\n width: 12px;\n height: 12px;\n }\n\n *::-webkit-scrollbar-track {\n background-color: rgba(0, 0, 0, 0.2);\n }\n\n *::-webkit-scrollbar-corner {\n background-color: rgba(0, 0, 0, 0.2);\n border-bottom-right-radius: inherit;\n }\n\n *::-webkit-scrollbar-thumb {\n background-color: transparent;\n border: 3px solid transparent;\n border-radius: calc(1.125 * ${borderRadius});\n box-shadow: inset 0 0 2px 4px rgba(255, 255, 255, 0.6);\n }\n\n *::-webkit-scrollbar-thumb:hover {\n box-shadow: inset 0 0 2px 4px rgba(255, 255, 255, 0.7);\n }\n\n *::-webkit-scrollbar-track:horizontal {\n border-bottom-left-radius: inherit;\n }\n\n *::-webkit-scrollbar-track:vertical {\n border-top-right-radius: inherit;\n }\n\n /* stylelint-disable-next-line selector-pseudo-class-no-unknown */\n *::-webkit-scrollbar-track:not(:corner-present) {\n border-bottom-right-radius: inherit;\n }\n\n /* stylelint-enable unit-allowed-list */\n }\n `}\n\n @media (pointer: coarse) {\n height: calc(100vh - 8rem);\n }\n\n @media (min-width: ${breakpoints.md}) {\n height: calc(100vh - 3rem);\n }\n `;\n }\n);\n\nStyledNav.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellCaretIcon = styled.svg<{ nestedListCollapsed?: boolean }>(\n ({ nestedListCollapsed, theme }) => {\n const { rtl } = useDirection();\n\n return css`\n transition-property: transform;\n transition-duration: ${theme.base.animation.speed};\n transition-timing-function: ${theme.base.animation.timing.ease};\n\n ${nestedListCollapsed === false &&\n css`\n transform: rotateZ(${rtl ? '-90deg' : '90deg'});\n `}\n `;\n }\n);\n\nStyledAppShellCaretIcon.defaultProps = defaultThemeProp;\n\nexport const StyledNavListItem = styled.li(({ theme }) => {\n const { navOpen } = useContext(AppShellContext);\n const activeBackground = tryCatch(() =>\n rgba('#000000', theme.base.transparency['transparent-4'])\n );\n\n return css`\n display: block;\n position: relative;\n ${StyledIcon} {\n font-size: 1.25rem;\n }\n\n > :first-child {\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n padding: calc(1.25 * ${theme.base.spacing}) 0;\n white-space: nowrap;\n color: rgba(255, 255, 255, 0.7);\n cursor: pointer;\n font-weight: ${theme.base['font-weight']['semi-bold']};\n text-decoration: none;\n\n span {\n overflow: hidden;\n color: inherit;\n }\n\n &:hover,\n &:focus {\n color: ${theme.base.palette.light};\n background: rgba(255, 255, 255, 0.05);\n }\n\n &:focus {\n outline: none;\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n\n ${StyledAppShellCaretIcon}:last-child {\n position: absolute;\n left: ${navOpen ? 'auto' : '100%'};\n ${navOpen &&\n css`\n inset-inline-end: 1rem;\n `}\n margin: 0;\n opacity: ${navOpen ? '1' : '0'};\n transition-property: opacity;\n }\n\n ${StyledIcon}:first-child {\n flex-shrink: 0;\n margin: 0 calc((${navWidth} - 1.125rem) / 2);\n }\n }\n\n &[aria-current='page'] > :first-child,\n &[aria-current='true'] > :first-child,\n &:has([aria-current='page']) > :first-child,\n &:has([aria-current='true']) > :first-child {\n color: ${theme.base.colors.blue.light};\n background-color: ${activeBackground};\n }\n `;\n});\n\nStyledNavListItem.defaultProps = defaultThemeProp;\n\nexport const StyledNavList = styled.ul``;\n"]}
@@ -47,7 +47,7 @@ export interface AppShellProps extends NoChildrenProp {
47
47
  /** Props related to the App Shell header. */
48
48
  appHeader: AppHeaderProps;
49
49
  /** Props related to the App Shell side navigation. */
50
- nav: NavProps;
50
+ nav?: NavProps;
51
51
  }
52
52
  export interface AppShellContextValue {
53
53
  navOpen: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"AppShell.types.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,sDAAsD,CAAC;AAEvF,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE1D,MAAM,WAAW,kBAAkB;IACjC,kCAAkC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,OAAO,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,CAAC,WAAW,CAAC,GAAG,aAAa,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;IACxF,iCAAiC;IACjC,KAAK,CAAC,EAAE,kBAAkB,EAAE,CAAC;CAC9B;AAED,UAAU,kBAAkB;IAC1B,iCAAiC;IACj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AAC,CAAC;IACpC,aAAa,CAAC,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;CACpC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AppShell.types.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.types.ts"],"names":[],"mappings":"","sourcesContent":["import { KeyboardEvent, MouseEvent, ReactNode } from 'react';\n\nimport { AsProp, BaseProps, NoChildrenProp } from '@pega/cosmos-react-core';\nimport { openCloseStates } from '@pega/cosmos-react-core/lib/hooks/useTransitionState';\n\nimport { AppHeaderProps } from './Header/AppHeader.types';\n\nexport interface NestedNavItemProps {\n /** Unique id for the nav item. */\n id: string;\n /** The display text of the nav item. */\n label: string;\n /** URL or DOM id to navigate to. This will render the nav item as a link. */\n href?: string;\n /** Click handler for the nav item. */\n onClick?: (id: string, e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;\n /** A set of nested nav items. */\n items?: NestedNavItemProps[];\n}\n\ninterface ParentNavItemProps {\n /** A set of nested nav items. */\n items?: NestedNavItemProps[];\n href?: never;\n onClick?: never;\n}\n\ninterface NavLinkProps {\n /** URL or DOM id to navigate to. This will render the nav item as a link. */\n href?: string;\n /** Click handler for the link. If no href if passed, this will render the nav item as a button. */\n onClick?: (id: string, e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;\n items?: never;\n}\n\nexport type NavItemProps = {\n /** Unique id for the nav item. */\n id: string;\n /** The display text of the nav item. */\n label: string;\n /** The name of the Cosmos Icon to render as a visual. Only applies to top-level nav items. */\n icon: string;\n} & (ParentNavItemProps | NavLinkProps);\n\nexport interface NavProps {\n /** A set of nav items that will render as a list in the App Shell. */\n items: NavItemProps[];\n /** The id of the active nav item. */\n currentItemId?: NavItemProps['id'];\n}\n\nexport interface AppShellProps extends NoChildrenProp {\n /** The content of the application. */\n main: ReactNode;\n /** Props related to the App Shell header. */\n appHeader: AppHeaderProps;\n /** Props related to the App Shell side navigation. */\n nav: NavProps;\n}\n\nexport interface AppShellContextValue {\n navOpen: boolean;\n navState: typeof openCloseStates[keyof typeof openCloseStates];\n openNav: () => void;\n}\n\nexport interface NavItemRenderProps extends AsProp, BaseProps, NoChildrenProp {\n id: NavItemProps['id'];\n label: NavItemProps['label'];\n visual: ReactNode;\n href?: NavLinkProps['href'];\n onClick?: NavLinkProps['onClick'];\n items?: NestedNavItemProps['items'];\n currentItemId?: NavItemProps['id'];\n}\n"]}
1
+ {"version":3,"file":"AppShell.types.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.types.ts"],"names":[],"mappings":"","sourcesContent":["import { KeyboardEvent, MouseEvent, ReactNode } from 'react';\n\nimport { AsProp, BaseProps, NoChildrenProp } from '@pega/cosmos-react-core';\nimport { openCloseStates } from '@pega/cosmos-react-core/lib/hooks/useTransitionState';\n\nimport { AppHeaderProps } from './Header/AppHeader.types';\n\nexport interface NestedNavItemProps {\n /** Unique id for the nav item. */\n id: string;\n /** The display text of the nav item. */\n label: string;\n /** URL or DOM id to navigate to. This will render the nav item as a link. */\n href?: string;\n /** Click handler for the nav item. */\n onClick?: (id: string, e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;\n /** A set of nested nav items. */\n items?: NestedNavItemProps[];\n}\n\ninterface ParentNavItemProps {\n /** A set of nested nav items. */\n items?: NestedNavItemProps[];\n href?: never;\n onClick?: never;\n}\n\ninterface NavLinkProps {\n /** URL or DOM id to navigate to. This will render the nav item as a link. */\n href?: string;\n /** Click handler for the link. If no href if passed, this will render the nav item as a button. */\n onClick?: (id: string, e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => void;\n items?: never;\n}\n\nexport type NavItemProps = {\n /** Unique id for the nav item. */\n id: string;\n /** The display text of the nav item. */\n label: string;\n /** The name of the Cosmos Icon to render as a visual. Only applies to top-level nav items. */\n icon: string;\n} & (ParentNavItemProps | NavLinkProps);\n\nexport interface NavProps {\n /** A set of nav items that will render as a list in the App Shell. */\n items: NavItemProps[];\n /** The id of the active nav item. */\n currentItemId?: NavItemProps['id'];\n}\n\nexport interface AppShellProps extends NoChildrenProp {\n /** The content of the application. */\n main: ReactNode;\n /** Props related to the App Shell header. */\n appHeader: AppHeaderProps;\n /** Props related to the App Shell side navigation. */\n nav?: NavProps;\n}\n\nexport interface AppShellContextValue {\n navOpen: boolean;\n navState: typeof openCloseStates[keyof typeof openCloseStates];\n openNav: () => void;\n}\n\nexport interface NavItemRenderProps extends AsProp, BaseProps, NoChildrenProp {\n id: NavItemProps['id'];\n label: NavItemProps['label'];\n visual: ReactNode;\n href?: NavLinkProps['href'];\n onClick?: NavLinkProps['onClick'];\n items?: NestedNavItemProps['items'];\n currentItemId?: NavItemProps['id'];\n}\n"]}
@@ -45,7 +45,7 @@ const NavParentItem = ({ id, label, visual, items, currentItemId }) => {
45
45
  setManagedItems(nodes => treeHelpers.expandTo(nodes, currentItemId));
46
46
  setCollapsed(false);
47
47
  }
48
- }, []);
48
+ }, [currentItemId]);
49
49
  useAfterInitialEffect(() => {
50
50
  setManagedItems(cur => {
51
51
  const expandedIds = new Set();
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationList.js","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAKL,UAAU,EACV,SAAS,EACT,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,cAAc,EACd,UAAU,EACV,YAAY,EAGZ,WAAW,EACX,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAGlF,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC9F,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,MAAM,cAAc,GAAG,CACrB,KAAkC,EAClC,WAAwC,EACZ,EAAE;IAC9B,IAAI,CAAC,KAAK;QAA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B,IAPG,IAAI,CAAC,EAAE,CAQM,CACrB,CAAC;QACJ,CAAC,CAAC,GACY,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import {\n ElementType,\n FunctionComponent,\n KeyboardEvent,\n MouseEvent,\n useContext,\n useEffect,\n useRef,\n useState\n} from 'react';\n\nimport {\n useTheme,\n useEscape,\n useDirection,\n Icon,\n Tooltip,\n ExpandCollapse,\n useElement,\n StandardTree,\n StandardTreeNode,\n StandardTreeProps,\n treeHelpers,\n useAfterInitialEffect\n} from '@pega/cosmos-react-core';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\n\nimport { NavProps, NavItemRenderProps } from './AppShell.types';\nimport { StyledNavList, StyledAppShellCaretIcon, StyledNavListItem } from './AppShell.styles';\nimport AppShellContext from './AppShellContext';\n\nconst transformItems = (\n items: NavItemRenderProps['items'],\n expandedIds: Set<StandardTreeNode['id']>\n): StandardTreeProps['nodes'] => {\n if (!items) return [];\n\n return items.map(item => ({\n id: item.id,\n label: item.label,\n onClick: (id: string, e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => {\n e.stopPropagation();\n item.onClick?.(id, e);\n },\n expanded: item.items ? expandedIds.has(item.id) : undefined,\n href: item.href,\n nodes: item.items ? transformItems(item.items, expandedIds) : undefined\n }));\n};\n\nconst NavParentItem: FunctionComponent<NavItemRenderProps> = ({\n id,\n label,\n visual,\n items,\n currentItemId\n}) => {\n const { navOpen, navState, openNav } = useContext(AppShellContext);\n const { end } = useDirection();\n const {\n base: { animation }\n } = useTheme();\n const [collapsed, setCollapsed] = useState(true);\n const [managedItems, setManagedItems] = useState<StandardTreeProps['nodes']>(() =>\n transformItems(items, new Set())\n );\n\n const buttonRef = useRef<HTMLButtonElement>(null);\n const treeRef = useRef<HTMLUListElement>(null);\n\n const toggleCollapsed = (e: MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n if (!navOpen) {\n setCollapsed(false);\n openNav();\n } else setCollapsed(state => !state);\n };\n\n useEscape(() => {\n setCollapsed(true);\n buttonRef.current?.focus();\n }, treeRef);\n\n useEffect(() => {\n if (currentItemId && treeHelpers.getNode(managedItems, currentItemId)) {\n setManagedItems(nodes => treeHelpers.expandTo(nodes, currentItemId));\n setCollapsed(false);\n }\n }, []);\n\n useAfterInitialEffect(() => {\n setManagedItems(cur => {\n const expandedIds = new Set<StandardTreeNode['id']>();\n\n treeHelpers.forEachNode(cur, node => {\n if (node.expanded) expandedIds.add(node.id);\n });\n\n return transformItems(items, expandedIds);\n });\n }, [items]);\n\n return (\n <>\n <BareButton\n id={id}\n ref={buttonRef}\n aria-expanded={!collapsed}\n aria-controls={`${id}-tree`}\n aria-label={label}\n onClick={toggleCollapsed}\n >\n {visual}\n <span>{label}</span>\n {navState === 'open' && (\n <Icon\n name={`caret-${end}`}\n as={StyledAppShellCaretIcon}\n nestedListCollapsed={collapsed}\n />\n )}\n </BareButton>\n <ExpandCollapse\n id={`${id}-tree`}\n collapsed={collapsed || !navOpen}\n transitionSpeed={\n managedItems.length >= 10 ? `calc(2 * ${animation.speed})` : animation.speed\n }\n >\n <StandardTree\n ref={treeRef}\n nodes={managedItems as StandardTreeNode[]}\n currentNodeId={currentItemId}\n selectableParents={false}\n onNodeToggle={nodeId => {\n setManagedItems(nodes =>\n treeHelpers.mapNode(nodes, nodeId, node => {\n return {\n ...node,\n expanded: !node.expanded\n };\n })\n );\n }}\n />\n </ExpandCollapse>\n </>\n );\n};\n\nexport const NavLinkItem: FunctionComponent<NavItemRenderProps> = ({\n id,\n label,\n visual,\n href,\n onClick\n}) => {\n const { navOpen } = useContext(AppShellContext);\n const { end } = useDirection();\n const [listItemEl, setListItemEl] = useElement<HTMLAnchorElement | HTMLButtonElement>();\n\n return (\n <>\n <BareButton\n ref={setListItemEl}\n href={href}\n onClick={(e: MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => {\n e.stopPropagation();\n onClick?.(id, e);\n }}\n aria-label={label}\n >\n {visual}\n <span>{label}</span>\n </BareButton>\n {!navOpen && (\n <Tooltip target={listItemEl} placement={end} showDelay='none' hideDelay='none'>\n {label}\n </Tooltip>\n )}\n </>\n );\n};\n\nconst NavigationList: FunctionComponent<NavProps> = ({ items, currentItemId }) => {\n let ItemComponent: ElementType;\n\n return (\n <StyledNavList>\n {items.map(item => {\n if (item.items) {\n ItemComponent = NavParentItem;\n } else {\n ItemComponent = NavLinkItem;\n }\n\n const ariaCurrent = item.href ? 'page' : 'true';\n return (\n <StyledNavListItem\n aria-current={currentItemId === item.id ? ariaCurrent : undefined}\n key={item.id}\n id={item.id}\n >\n <ItemComponent\n {...item}\n visual={<Icon name={item.icon} />}\n currentItemId={currentItemId}\n />\n </StyledNavListItem>\n );\n })}\n </StyledNavList>\n );\n};\n\nexport default NavigationList;\n"]}
1
+ {"version":3,"file":"NavigationList.js","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationList.tsx"],"names":[],"mappings":";AAAA,OAAO,EAKL,UAAU,EACV,SAAS,EACT,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,cAAc,EACd,UAAU,EACV,YAAY,EAGZ,WAAW,EACX,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,UAAU,MAAM,0DAA0D,CAAC;AAGlF,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC9F,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,MAAM,cAAc,GAAG,CACrB,KAAkC,EAClC,WAAwC,EACZ,EAAE;IAC9B,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAC;IAEtB,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACxB,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,KAAK,EAAE,IAAI,CAA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ElementType,\n FunctionComponent,\n KeyboardEvent,\n MouseEvent,\n useContext,\n useEffect,\n useRef,\n useState\n} from 'react';\n\nimport {\n useTheme,\n useEscape,\n useDirection,\n Icon,\n Tooltip,\n ExpandCollapse,\n useElement,\n StandardTree,\n StandardTreeNode,\n StandardTreeProps,\n treeHelpers,\n useAfterInitialEffect\n} from '@pega/cosmos-react-core';\nimport BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';\n\nimport { NavProps, NavItemRenderProps } from './AppShell.types';\nimport { StyledNavList, StyledAppShellCaretIcon, StyledNavListItem } from './AppShell.styles';\nimport AppShellContext from './AppShellContext';\n\nconst transformItems = (\n items: NavItemRenderProps['items'],\n expandedIds: Set<StandardTreeNode['id']>\n): StandardTreeProps['nodes'] => {\n if (!items) return [];\n\n return items.map(item => ({\n id: item.id,\n label: item.label,\n onClick: (id: string, e: MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>) => {\n e.stopPropagation();\n item.onClick?.(id, e);\n },\n expanded: item.items ? expandedIds.has(item.id) : undefined,\n href: item.href,\n nodes: item.items ? transformItems(item.items, expandedIds) : undefined\n }));\n};\n\nconst NavParentItem: FunctionComponent<NavItemRenderProps> = ({\n id,\n label,\n visual,\n items,\n currentItemId\n}) => {\n const { navOpen, navState, openNav } = useContext(AppShellContext);\n const { end } = useDirection();\n const {\n base: { animation }\n } = useTheme();\n const [collapsed, setCollapsed] = useState(true);\n const [managedItems, setManagedItems] = useState<StandardTreeProps['nodes']>(() =>\n transformItems(items, new Set())\n );\n\n const buttonRef = useRef<HTMLButtonElement>(null);\n const treeRef = useRef<HTMLUListElement>(null);\n\n const toggleCollapsed = (e: MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n if (!navOpen) {\n setCollapsed(false);\n openNav();\n } else setCollapsed(state => !state);\n };\n\n useEscape(() => {\n setCollapsed(true);\n buttonRef.current?.focus();\n }, treeRef);\n\n useEffect(() => {\n if (currentItemId && treeHelpers.getNode(managedItems, currentItemId)) {\n setManagedItems(nodes => treeHelpers.expandTo(nodes, currentItemId));\n setCollapsed(false);\n }\n }, [currentItemId]);\n\n useAfterInitialEffect(() => {\n setManagedItems(cur => {\n const expandedIds = new Set<StandardTreeNode['id']>();\n\n treeHelpers.forEachNode(cur, node => {\n if (node.expanded) expandedIds.add(node.id);\n });\n\n return transformItems(items, expandedIds);\n });\n }, [items]);\n\n return (\n <>\n <BareButton\n id={id}\n ref={buttonRef}\n aria-expanded={!collapsed}\n aria-controls={`${id}-tree`}\n aria-label={label}\n onClick={toggleCollapsed}\n >\n {visual}\n <span>{label}</span>\n {navState === 'open' && (\n <Icon\n name={`caret-${end}`}\n as={StyledAppShellCaretIcon}\n nestedListCollapsed={collapsed}\n />\n )}\n </BareButton>\n <ExpandCollapse\n id={`${id}-tree`}\n collapsed={collapsed || !navOpen}\n transitionSpeed={\n managedItems.length >= 10 ? `calc(2 * ${animation.speed})` : animation.speed\n }\n >\n <StandardTree\n ref={treeRef}\n nodes={managedItems as StandardTreeNode[]}\n currentNodeId={currentItemId}\n selectableParents={false}\n onNodeToggle={nodeId => {\n setManagedItems(nodes =>\n treeHelpers.mapNode(nodes, nodeId, node => {\n return {\n ...node,\n expanded: !node.expanded\n };\n })\n );\n }}\n />\n </ExpandCollapse>\n </>\n );\n};\n\nexport const NavLinkItem: FunctionComponent<NavItemRenderProps> = ({\n id,\n label,\n visual,\n href,\n onClick\n}) => {\n const { navOpen } = useContext(AppShellContext);\n const { end } = useDirection();\n const [listItemEl, setListItemEl] = useElement<HTMLAnchorElement | HTMLButtonElement>();\n\n return (\n <>\n <BareButton\n ref={setListItemEl}\n href={href}\n onClick={(e: MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => {\n e.stopPropagation();\n onClick?.(id, e);\n }}\n aria-label={label}\n >\n {visual}\n <span>{label}</span>\n </BareButton>\n {!navOpen && (\n <Tooltip target={listItemEl} placement={end} showDelay='none' hideDelay='none'>\n {label}\n </Tooltip>\n )}\n </>\n );\n};\n\nconst NavigationList: FunctionComponent<NavProps> = ({ items, currentItemId }) => {\n let ItemComponent: ElementType;\n\n return (\n <StyledNavList>\n {items.map(item => {\n if (item.items) {\n ItemComponent = NavParentItem;\n } else {\n ItemComponent = NavLinkItem;\n }\n\n const ariaCurrent = item.href ? 'page' : 'true';\n return (\n <StyledNavListItem\n aria-current={currentItemId === item.id ? ariaCurrent : undefined}\n key={item.id}\n id={item.id}\n >\n <ItemComponent\n {...item}\n visual={<Icon name={item.icon} />}\n currentItemId={currentItemId}\n />\n </StyledNavListItem>\n );\n })}\n </StyledNavList>\n );\n};\n\nexport default NavigationList;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pega/cosmos-react-build",
3
- "version": "4.0.0-dev.8.1",
3
+ "version": "4.0.0-dev.8.3",
4
4
  "author": "Pegasystems",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {
@@ -20,8 +20,8 @@
20
20
  "build": "tsc -b"
21
21
  },
22
22
  "dependencies": {
23
- "@pega/cosmos-react-core": "4.0.0-dev.8.1",
24
- "@pega/cosmos-react-dnd": "4.0.0-dev.8.1",
23
+ "@pega/cosmos-react-core": "4.0.0-dev.8.3",
24
+ "@pega/cosmos-react-dnd": "4.0.0-dev.8.3",
25
25
  "@types/codemirror": "^5.60.5",
26
26
  "@types/dagre": "^0.7.46",
27
27
  "@types/react": "^16.14.24 || ^17.0.38",