@pega/cosmos-react-build 4.0.0-dev.3.1 → 4.0.0-dev.5.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 (47) hide show
  1. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  2. package/lib/components/AppShell/AppShell.js +2 -2
  3. package/lib/components/AppShell/AppShell.js.map +1 -1
  4. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  5. package/lib/components/AppShell/AppShell.styles.js +109 -93
  6. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  7. package/lib/components/AppShell/AppShell.types.d.ts +1 -1
  8. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  9. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  10. package/lib/components/{AppHeader → AppShell/Header}/AppHeader.d.ts +0 -0
  11. package/lib/components/AppShell/Header/AppHeader.d.ts.map +1 -0
  12. package/lib/components/AppShell/Header/AppHeader.js +77 -0
  13. package/lib/components/AppShell/Header/AppHeader.js.map +1 -0
  14. package/lib/components/{AppHeader → AppShell/Header}/AppHeader.styles.d.ts +7 -6
  15. package/lib/components/AppShell/Header/AppHeader.styles.d.ts.map +1 -0
  16. package/lib/components/AppShell/Header/AppHeader.styles.js +173 -0
  17. package/lib/components/AppShell/Header/AppHeader.styles.js.map +1 -0
  18. package/lib/components/{AppHeader → AppShell/Header}/AppHeader.types.d.ts +0 -0
  19. package/lib/components/AppShell/Header/AppHeader.types.d.ts.map +1 -0
  20. package/lib/components/{AppHeader → AppShell/Header}/AppHeader.types.js +0 -0
  21. package/lib/components/AppShell/Header/AppHeader.types.js.map +1 -0
  22. package/lib/components/{AppHeader → AppShell/Header}/BranchButton.d.ts +0 -0
  23. package/lib/components/AppShell/Header/BranchButton.d.ts.map +1 -0
  24. package/lib/components/{AppHeader → AppShell/Header}/BranchButton.js +4 -4
  25. package/lib/components/AppShell/Header/BranchButton.js.map +1 -0
  26. package/lib/components/AppShell/index.d.ts +2 -0
  27. package/lib/components/AppShell/index.d.ts.map +1 -1
  28. package/lib/components/AppShell/index.js.map +1 -1
  29. package/lib/index.d.ts +0 -2
  30. package/lib/index.d.ts.map +1 -1
  31. package/lib/index.js +0 -2
  32. package/lib/index.js.map +1 -1
  33. package/package.json +3 -3
  34. package/lib/components/AppHeader/AppHeader.d.ts.map +0 -1
  35. package/lib/components/AppHeader/AppHeader.js +0 -40
  36. package/lib/components/AppHeader/AppHeader.js.map +0 -1
  37. package/lib/components/AppHeader/AppHeader.styles.d.ts.map +0 -1
  38. package/lib/components/AppHeader/AppHeader.styles.js +0 -118
  39. package/lib/components/AppHeader/AppHeader.styles.js.map +0 -1
  40. package/lib/components/AppHeader/AppHeader.types.d.ts.map +0 -1
  41. package/lib/components/AppHeader/AppHeader.types.js.map +0 -1
  42. package/lib/components/AppHeader/BranchButton.d.ts.map +0 -1
  43. package/lib/components/AppHeader/BranchButton.js.map +0 -1
  44. package/lib/components/AppHeader/index.d.ts +0 -4
  45. package/lib/components/AppHeader/index.d.ts.map +0 -1
  46. package/lib/components/AppHeader/index.js +0 -3
  47. package/lib/components/AppHeader/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.tsx"],"names":[],"mappings":";AAgDA,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":";AA+CA,OAAO,KAAK,EAAE,aAAa,EAA4B,MAAM,kBAAkB,CAAC;AAmGhF,QAAA,MAAM,QAAQ,iMA+Ib,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -3,7 +3,7 @@ import { forwardRef, useMemo, useState, useContext, useRef, useEffect } from 're
3
3
  import { Flex, Icon, Switch, SkipLinks, Drawer, useDirection, useI18n, useAfterInitialEffect, StandardTree, useConsolidatedRef, useTransitionState, MetaList, Avatar } from '@pega/cosmos-react-core';
4
4
  import { expandCollapseStates } from '@pega/cosmos-react-core/lib/hooks/useTransitionState';
5
5
  import BareButton from '@pega/cosmos-react-core/lib/components/Button/BareButton';
6
- import AppHeader from '../AppHeader';
6
+ import AppHeader from './Header/AppHeader';
7
7
  import { StyledHeader, StyledUtils, StyledUtilItem, StyledScrollWrap, StyledNavContent, StyledMain, StyledDrawerWrapper, StyledDrawerHeader, StyledNavTitle, StyledNav, StyledInnerNav, StyledNavToggle, StyledDrawerCloseButton } from './AppShell.styles';
8
8
  import AppShellContext from './AppShellContext';
9
9
  const NavigationHeader = ({ text, visual, meta }) => {
@@ -41,11 +41,11 @@ const Utils = ({ items, onItemClick, onClose, currentItemId, devMode }) => {
41
41
  }) }))] }));
42
42
  };
43
43
  const AppShell = forwardRef(({ main, appHeader, appInfo, utils, navigation, hideNav = false }, ref) => {
44
+ const navRef = useConsolidatedRef(ref);
44
45
  const [drawerOpen, setDrawerOpen] = useState(!!utils?.currentItemId);
45
46
  const [drawerData, setDrawerData] = useState(utils?.items.find(i => i.id === utils?.currentItemId));
46
47
  const backButtonRef = useRef(null);
47
48
  const { rtl } = useDirection();
48
- const navRef = useConsolidatedRef(ref);
49
49
  const t = useI18n();
50
50
  const { state: navState, toggle: toggleNavState } = useTransitionState({
51
51
  ref: navRef,
@@ -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,kBAAk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ffect\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 '../AppHeader';\n\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 [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 navRef = useConsolidatedRef(ref);\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,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,EAAE,EAAE,EAAE,EA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,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 +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,0GAOrB,CAAC;AAIH,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,yGAsHpB,CAAC"}
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"}
@@ -165,13 +165,21 @@ export const StyledNavContent = styled.div(({ theme }) => {
165
165
  `;
166
166
  });
167
167
  StyledNavContent.defaultProps = defaultThemeProp;
168
- export const StyledMain = styled.main(({ theme }) => {
168
+ export const StyledMain = styled.main(({ theme: { base: { animation, breakpoints, palette } } }) => {
169
169
  return css `
170
- position: relative;
171
- min-height: calc(100vh - 3rem);
172
- background-color: ${theme.base.palette['app-background']};
173
- transition: margin ${theme.base.animation.speed} ${theme.base.animation.timing.ease};
174
- `;
170
+ position: relative;
171
+ min-height: calc(100vh - 6rem);
172
+ background-color: ${palette['app-background']};
173
+ transition: margin ${animation.speed} ${animation.timing.ease};
174
+
175
+ @media (pointer: coarse) {
176
+ min-height: calc(100vh - 8rem);
177
+ }
178
+
179
+ @media (min-width: ${breakpoints.md}) {
180
+ min-height: calc(100vh - 3rem);
181
+ }
182
+ `;
175
183
  });
176
184
  StyledMain.defaultProps = defaultThemeProp;
177
185
  export const StyledDrawerWrapper = styled.div(() => {
@@ -222,123 +230,131 @@ export const StyledInnerNav = styled.div(() => {
222
230
  `;
223
231
  });
224
232
  StyledInnerNav.defaultProps = defaultThemeProp;
225
- export const StyledNav = styled.nav(({ theme }) => {
233
+ export const StyledNav = styled.nav(({ theme: { base: { breakpoints, colors, animation, spacing, 'custom-scrollbar': customScrollbar, 'border-radius': borderRadius, 'font-weight': fontWeight }, components: { 'app-shell': appShell } } }) => {
226
234
  const { navState } = useContext(AppShellContext);
227
235
  return css `
228
- position: fixed;
229
- z-index: 1;
230
- height: calc(100vh - 3rem);
231
- background: ${theme.components['app-shell'].nav['background-color']};
232
-
233
- &,
234
- ${StyledInnerNav} {
235
- width: ${navState === 'expanding' || navState === 'expanded' ? '14' : '1.5'}rem;
236
- transition: width ${theme.base.animation.speed} ${theme.base.animation.timing.ease};
237
- }
236
+ position: fixed;
237
+ z-index: 1;
238
+ height: calc(100vh - 6rem);
239
+ background: ${appShell.nav['background-color']};
240
+
241
+ &,
242
+ ${StyledInnerNav} {
243
+ width: ${navState === 'expanding' || navState === 'expanded' ? '14' : '1.5'}rem;
244
+ transition: width ${animation.speed} ${animation.timing.ease};
245
+ }
238
246
 
239
- ${theme.base['custom-scrollbar'] &&
247
+ ${customScrollbar &&
240
248
  css `
241
- * {
242
- scrollbar-color: rgba(255, 255, 255, 0.6) rgba(0, 0, 0, 0.2);
243
- scrollbar-width: thin;
244
- }
249
+ * {
250
+ scrollbar-color: rgba(255, 255, 255, 0.6) rgba(0, 0, 0, 0.2);
251
+ scrollbar-width: thin;
252
+ }
245
253
 
246
- @supports not ((scrollbar-width: thin) or (scrollbar-color: black white)) {
247
- /* stylelint-disable unit-allowed-list */
254
+ @supports not ((scrollbar-width: thin) or (scrollbar-color: black white)) {
255
+ /* stylelint-disable unit-allowed-list */
248
256
 
249
- *::-webkit-scrollbar {
250
- width: 12px;
251
- height: 12px;
252
- }
257
+ *::-webkit-scrollbar {
258
+ width: 12px;
259
+ height: 12px;
260
+ }
253
261
 
254
- *::-webkit-scrollbar-track {
255
- background-color: rgba(0, 0, 0, 0.2);
256
- }
262
+ *::-webkit-scrollbar-track {
263
+ background-color: rgba(0, 0, 0, 0.2);
264
+ }
257
265
 
258
- *::-webkit-scrollbar-corner {
259
- background-color: rgba(0, 0, 0, 0.2);
260
- border-bottom-right-radius: inherit;
261
- }
266
+ *::-webkit-scrollbar-corner {
267
+ background-color: rgba(0, 0, 0, 0.2);
268
+ border-bottom-right-radius: inherit;
269
+ }
262
270
 
263
- *::-webkit-scrollbar-thumb {
264
- background-color: transparent;
265
- border: 3px solid transparent;
266
- border-radius: calc(1.125 * ${theme.base['border-radius']});
267
- box-shadow: inset 0 0 2px 4px rgba(255, 255, 255, 0.6);
268
- }
271
+ *::-webkit-scrollbar-thumb {
272
+ background-color: transparent;
273
+ border: 3px solid transparent;
274
+ border-radius: calc(1.125 * ${borderRadius});
275
+ box-shadow: inset 0 0 2px 4px rgba(255, 255, 255, 0.6);
276
+ }
269
277
 
270
- *::-webkit-scrollbar-thumb:hover {
271
- box-shadow: inset 0 0 2px 4px rgba(255, 255, 255, 0.7);
272
- }
278
+ *::-webkit-scrollbar-thumb:hover {
279
+ box-shadow: inset 0 0 2px 4px rgba(255, 255, 255, 0.7);
280
+ }
273
281
 
274
- *::-webkit-scrollbar-track:horizontal {
275
- border-bottom-left-radius: inherit;
276
- }
282
+ *::-webkit-scrollbar-track:horizontal {
283
+ border-bottom-left-radius: inherit;
284
+ }
277
285
 
278
- *::-webkit-scrollbar-track:vertical {
279
- border-top-right-radius: inherit;
280
- }
286
+ *::-webkit-scrollbar-track:vertical {
287
+ border-top-right-radius: inherit;
288
+ }
281
289
 
282
- /* stylelint-disable-next-line selector-pseudo-class-no-unknown */
283
- *::-webkit-scrollbar-track:not(:corner-present) {
284
- border-bottom-right-radius: inherit;
285
- }
290
+ /* stylelint-disable-next-line selector-pseudo-class-no-unknown */
291
+ *::-webkit-scrollbar-track:not(:corner-present) {
292
+ border-bottom-right-radius: inherit;
293
+ }
286
294
 
287
- /* stylelint-enable unit-allowed-list */
288
- }
289
- `}
295
+ /* stylelint-enable unit-allowed-list */
296
+ }
297
+ `}
290
298
 
291
- &:not(:hover) {
292
- ${StyledNavToggle}[aria-expanded='true']:not(:focus) {
293
- ${hideVisually}
299
+ &:not(:hover) {
300
+ ${StyledNavToggle}[aria-expanded='true']:not(:focus) {
301
+ ${hideVisually}
302
+ }
294
303
  }
295
- }
296
304
 
297
- /*
305
+ /*
298
306
  * A hoverable area just outside the nav for easier mouse interaction with the collapse button.
299
307
  * As the collpase button straddles the nav boundary, so maybe too should the hoverable area.
300
308
  */
301
- &::after {
302
- content: '';
303
- display: block;
304
- position: absolute;
305
- inset-block-start: 0;
306
- inset-inline-start: 100%;
307
- width: calc(2 * ${theme.base.spacing});
308
- height: 100%;
309
- }
310
-
311
- ${StyledStandardTree} {
312
- color: ${theme.base.colors.white};
313
-
314
- ${StyledNodeText} {
315
- font-weight: ${theme.base['font-weight']['semi-bold']};
309
+ &::after {
310
+ content: '';
311
+ display: block;
312
+ position: absolute;
313
+ inset-block-start: 0;
314
+ inset-inline-start: 100%;
315
+ width: calc(2 * ${spacing});
316
+ height: 100%;
316
317
  }
317
318
 
318
- ${StyledNodeInteraction} {
319
- padding-block-start: calc(0.5 * ${theme.base.spacing});
320
- padding-block-end: calc(0.5 * ${theme.base.spacing});
321
- &:hover,
322
- &[aria-current='true'] {
323
- background-color: ${hoverBg};
319
+ ${StyledStandardTree} {
320
+ color: ${colors.white};
321
+
322
+ ${StyledNodeText} {
323
+ font-weight: ${fontWeight['semi-bold']};
324
324
  }
325
325
 
326
- &[aria-current='true'] {
327
- ${StyledNodeIcon},
328
- ${StyledNodeText} {
329
- color: ${theme.base.colors.blue.light};
326
+ ${StyledNodeInteraction} {
327
+ padding-block-start: calc(0.5 * ${spacing});
328
+ padding-block-end: calc(0.5 * ${spacing});
329
+ &:hover,
330
+ &[aria-current='true'] {
331
+ background-color: ${hoverBg};
332
+ }
333
+
334
+ &[aria-current='true'] {
335
+ ${StyledNodeIcon},
336
+ ${StyledNodeText} {
337
+ color: ${colors.blue.light};
338
+ }
330
339
  }
331
340
  }
332
341
  }
333
- }
334
342
 
335
- /* Style for main is here since nav(the "&") may be conditionally rendered. */
336
- & + ${StyledMain} {
337
- margin-inline-start: ${navState === 'expanding' || navState === 'expanded'
343
+ /* Style for main is here since nav(the "&") may be conditionally rendered. */
344
+ & + ${StyledMain} {
345
+ margin-inline-start: ${navState === 'expanding' || navState === 'expanded'
338
346
  ? '14rem'
339
347
  : '1.5rem'};
340
- }
341
- `;
348
+ }
349
+
350
+ @media (pointer: coarse) {
351
+ height: calc(100vh - 8rem);
352
+ }
353
+
354
+ @media (min-width: ${breakpoints.md}) {
355
+ height: calc(100vh - 3rem);
356
+ }
357
+ `;
342
358
  });
343
359
  StyledNav.defaultProps = defaultThemeProp;
344
360
  //# sourceMappingURL=AppShell.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppShell.styles.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,U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,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK;;;;;;;UAOvC,UAAU;6BACS,QAAQ,KAAK,WAAW,IAAI,QAAQ,KAAK,UAAU;QACxE,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,QAAQ;;GAEf,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,SAAS,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { lighten, hideVisually } from 'polished';\nimport { useContext } from 'react';\n\nimport {\n Icon,\n Text,\n tryCatch,\n defaultThemeProp,\n Button,\n useDirection,\n StyledIcon,\n StyledAvatar\n} from '@pega/cosmos-react-core';\nimport { StyledSwitch, SwitchLabel } from '@pega/cosmos-react-core/lib/components/Switch/Switch';\nimport { StyledBareButton } from '@pega/cosmos-react-core/lib/components/Button/BareButton';\nimport {\n StyledNodeIcon,\n StyledNodeText,\n StyledNodeInteraction,\n StyledStandardTree\n} from '@pega/cosmos-react-core/lib/components/Tree/StandardTree.styles';\n\nimport AppShellContext from './AppShellContext';\n\nconst hoverBg = 'rgba(0, 0, 0, 0.4)';\n\nexport const StyledNavToggle = styled(Button)(({ theme }) => {\n const { ltr } = useDirection();\n\n return css`\n position: absolute;\n z-index: 1;\n inset-block-start: calc(2 * ${theme.base.spacing});\n inset-inline-end: 0;\n min-width: 1.5rem;\n min-height: 1.5rem;\n border: none;\n color: ${theme.base.palette['foreground-color']};\n box-shadow: ${theme.base.shadow.low};\n border-radius: 50%;\n transition-property: background-color;\n transform: translateX(${ltr ? '50%' : '-50%'});\n\n ${StyledIcon} {\n width: 1.5rem;\n height: 1.5rem;\n }\n\n &[aria-expanded='${ltr ? 'true' : 'false'}'] {\n ${StyledIcon} {\n transform: rotateY(180deg);\n }\n }\n `;\n});\n\nStyledNavToggle.defaultProps = defaultThemeProp;\n\nexport const StyledHeader = styled.div(({ theme }) => {\n const borderColor = tryCatch(() =>\n lighten(0.1, theme.components['app-shell'].nav['background-color'])\n );\n\n return css`\n width: 100%;\n height: auto;\n border-bottom: 0.0625rem solid ${borderColor};\n transition: height ${theme.base.animation.speed} ${theme.base.animation.timing['ease-out']};\n padding: calc(1.2 * ${theme.base.spacing}) calc(2 * ${theme.base.spacing});\n\n div {\n min-width: 0;\n }\n\n li {\n color: ${theme.base.palette.info};\n }\n\n ${StyledAvatar} {\n flex-shrink: 0;\n }\n `;\n});\n\nStyledHeader.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerHeader = styled(StyledHeader)(({ theme }) => {\n return css`\n padding: calc(2 * ${theme.base.spacing});\n padding-inline-start: ${theme.base.spacing};\n `;\n});\n\nStyledDrawerHeader.defaultProps = defaultThemeProp;\n\nexport const StyledNavHeaderIcon = styled(Icon)(({ theme }) => {\n return css`\n color: ${theme.base.colors.white};\n `;\n});\n\nStyledNavHeaderIcon.defaultProps = defaultThemeProp;\n\nexport const StyledNavTitle = styled(Text)(({ theme }) => {\n return css`\n color: ${theme.base.colors.white};\n word-break: break-word;\n `;\n});\n\nStyledNavTitle.defaultProps = defaultThemeProp;\n\nexport const StyledUtils = styled.div<{ showDevMode: boolean }>(({ theme, showDevMode }) => {\n const borderColor = tryCatch(() =>\n lighten(0.1, theme.components['app-shell'].nav['background-color'])\n );\n\n return css`\n padding-bottom: calc(${showDevMode ? 2 : 0} * ${theme.base.spacing});\n border-top: 0.0625rem solid ${borderColor};\n ${StyledSwitch} {\n &:hover {\n background-color: ${hoverBg};\n }\n\n ${SwitchLabel} {\n height: calc(2rem + 4 * ${theme.base.spacing});\n padding: calc(2 * ${theme.base.spacing});\n text-transform: capitalize;\n color: ${theme.base.colors.gray.light};\n font-weight: ${theme.base['font-weight'].bold};\n\n &::before,\n &::after {\n margin-inline-end: calc(2 * ${theme.base.spacing});\n }\n }\n }\n & > ul {\n list-style: none;\n }\n `;\n});\n\nStyledUtils.defaultProps = defaultThemeProp;\n\nexport const StyledUtilItem = styled.li(({ theme }) => {\n return css`\n &[aria-current='true'] {\n background-color: rgba(0, 0, 0, 0.4);\n\n & > ${StyledBareButton} {\n color: ${theme.base.colors.blue.light};\n }\n }\n\n ${StyledBareButton} {\n font-weight: ${theme.base['font-weight']['semi-bold']};\n color: ${theme.base.colors.white};\n width: 100%;\n height: 100%;\n text-align: start;\n padding: ${theme.base.spacing} calc(2 * ${theme.base.spacing});\n\n &:hover {\n background-color: rgba(0, 0, 0, 0.4);\n }\n\n &:focus {\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n }\n `;\n});\n\nStyledUtilItem.defaultProps = defaultThemeProp;\n\nexport const StyledScrollWrap = styled.div(() => {\n const { drawerOpen } = useContext(AppShellContext);\n\n return css`\n height: ${drawerOpen ? 'calc(100% - 4rem)' : '100%'};\n overflow-y: auto;\n `;\n});\n\nStyledScrollWrap.defaultProps = defaultThemeProp;\n\nexport const StyledNavContent = styled.div(({ theme }) => {\n const { navState } = useContext(AppShellContext);\n\n return css`\n width: 14rem;\n height: 100%;\n opacity: 0;\n transition: opacity ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n\n ${navState === 'collapsed' &&\n css`\n display: none;\n `}\n\n ${(navState === 'expanding' || navState === 'expanded') &&\n css`\n opacity: 1;\n `}\n `;\n});\n\nStyledNavContent.defaultProps = defaultThemeProp;\n\nexport const StyledMain = styled.main(({ theme }) => {\n return css`\n position: relative;\n min-height: calc(100vh - 3rem);\n background-color: ${theme.base.palette['app-background']};\n transition: margin ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n `;\n});\n\nStyledMain.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerWrapper = styled.div(() => {\n const { drawerOpen } = useContext(AppShellContext);\n\n return css`\n position: relative;\n z-index: 1;\n height: ${drawerOpen ? '100%' : 'auto'};\n `;\n});\n\nStyledDrawerWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledNavHeaderVisual = styled.div<{ bgColor: string }>(({ theme, bgColor }) => {\n return css`\n min-width: 2rem;\n min-height: 2rem;\n border-radius: 0.4rem;\n background-color: ${bgColor};\n margin-inline-end: ${theme.base.spacing};\n color: ${theme.base.colors.white};\n & svg {\n color: ${theme.base.colors.white};\n }\n `;\n});\n\nStyledNavHeaderVisual.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerCloseButton = styled(Button)(({ theme }) => {\n return css`\n margin-inline-end: ${theme.base.spacing};\n min-width: 1.5rem;\n min-height: 1.5rem;\n color: ${theme.base.colors.white};\n\n ${StyledIcon} {\n width: 1em;\n height: 1em;\n }\n `;\n});\n\nStyledDrawerCloseButton.defaultProps = defaultThemeProp;\n\nexport const StyledInnerNav = styled.div(() => {\n const { navState } = useContext(AppShellContext);\n\n return css`\n height: 100%;\n ${(navState === 'collapsing' || navState === 'expanding') &&\n css`\n overflow: hidden;\n `}\n `;\n});\n\nStyledInnerNav.defaultProps = defaultThemeProp;\n\nexport const StyledNav = styled.nav(({ theme }) => {\n const { navState } = useContext(AppShellContext);\n\n return css`\n position: fixed;\n z-index: 1;\n height: calc(100vh - 3rem);\n background: ${theme.components['app-shell'].nav['background-color']};\n\n &,\n ${StyledInnerNav} {\n width: ${navState === 'expanding' || navState === 'expanded' ? '14' : '1.5'}rem;\n transition: width ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n }\n\n ${theme.base['custom-scrollbar'] &&\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 * ${theme.base['border-radius']});\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 &:not(:hover) {\n ${StyledNavToggle}[aria-expanded='true']:not(:focus) {\n ${hideVisually}\n }\n }\n\n /*\n * A hoverable area just outside the nav for easier mouse interaction with the collapse button.\n * As the collpase button straddles the nav boundary, so maybe too should the hoverable area.\n */\n &::after {\n content: '';\n display: block;\n position: absolute;\n inset-block-start: 0;\n inset-inline-start: 100%;\n width: calc(2 * ${theme.base.spacing});\n height: 100%;\n }\n\n ${StyledStandardTree} {\n color: ${theme.base.colors.white};\n\n ${StyledNodeText} {\n font-weight: ${theme.base['font-weight']['semi-bold']};\n }\n\n ${StyledNodeInteraction} {\n padding-block-start: calc(0.5 * ${theme.base.spacing});\n padding-block-end: calc(0.5 * ${theme.base.spacing});\n &:hover,\n &[aria-current='true'] {\n background-color: ${hoverBg};\n }\n\n &[aria-current='true'] {\n ${StyledNodeIcon},\n ${StyledNodeText} {\n color: ${theme.base.colors.blue.light};\n }\n }\n }\n }\n\n /* Style for main is here since nav(the \"&\") may be conditionally rendered. */\n & + ${StyledMain} {\n margin-inline-start: ${navState === 'expanding' || navState === 'expanded'\n ? '14rem'\n : '1.5rem'};\n }\n `;\n});\n\nStyledNav.defaultProps = defaultThemeProp;\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,OA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zB,cAAc;cACd,cAAc;uBACL,MAAM,CAAC,IAAI,CAAC,KAAK;;;;;;;YAO5B,UAAU;+BACS,QAAQ,KAAK,WAAW,IAAI,QAAQ,KAAK,UAAU;QACxE,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,QAAQ;;;;;;;2BAOO,WAAW,CAAC,EAAE;;;KAGpC,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,SAAS,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { lighten, hideVisually } from 'polished';\nimport { useContext } from 'react';\n\nimport {\n Icon,\n Text,\n tryCatch,\n defaultThemeProp,\n Button,\n useDirection,\n StyledIcon,\n StyledAvatar\n} from '@pega/cosmos-react-core';\nimport { StyledSwitch, SwitchLabel } from '@pega/cosmos-react-core/lib/components/Switch/Switch';\nimport { StyledBareButton } from '@pega/cosmos-react-core/lib/components/Button/BareButton';\nimport {\n StyledNodeIcon,\n StyledNodeText,\n StyledNodeInteraction,\n StyledStandardTree\n} from '@pega/cosmos-react-core/lib/components/Tree/StandardTree.styles';\n\nimport AppShellContext from './AppShellContext';\n\nconst hoverBg = 'rgba(0, 0, 0, 0.4)';\n\nexport const StyledNavToggle = styled(Button)(({ theme }) => {\n const { ltr } = useDirection();\n\n return css`\n position: absolute;\n z-index: 1;\n inset-block-start: calc(2 * ${theme.base.spacing});\n inset-inline-end: 0;\n min-width: 1.5rem;\n min-height: 1.5rem;\n border: none;\n color: ${theme.base.palette['foreground-color']};\n box-shadow: ${theme.base.shadow.low};\n border-radius: 50%;\n transition-property: background-color;\n transform: translateX(${ltr ? '50%' : '-50%'});\n\n ${StyledIcon} {\n width: 1.5rem;\n height: 1.5rem;\n }\n\n &[aria-expanded='${ltr ? 'true' : 'false'}'] {\n ${StyledIcon} {\n transform: rotateY(180deg);\n }\n }\n `;\n});\n\nStyledNavToggle.defaultProps = defaultThemeProp;\n\nexport const StyledHeader = styled.div(({ theme }) => {\n const borderColor = tryCatch(() =>\n lighten(0.1, theme.components['app-shell'].nav['background-color'])\n );\n\n return css`\n width: 100%;\n height: auto;\n border-bottom: 0.0625rem solid ${borderColor};\n transition: height ${theme.base.animation.speed} ${theme.base.animation.timing['ease-out']};\n padding: calc(1.2 * ${theme.base.spacing}) calc(2 * ${theme.base.spacing});\n\n div {\n min-width: 0;\n }\n\n li {\n color: ${theme.base.palette.info};\n }\n\n ${StyledAvatar} {\n flex-shrink: 0;\n }\n `;\n});\n\nStyledHeader.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerHeader = styled(StyledHeader)(({ theme }) => {\n return css`\n padding: calc(2 * ${theme.base.spacing});\n padding-inline-start: ${theme.base.spacing};\n `;\n});\n\nStyledDrawerHeader.defaultProps = defaultThemeProp;\n\nexport const StyledNavHeaderIcon = styled(Icon)(({ theme }) => {\n return css`\n color: ${theme.base.colors.white};\n `;\n});\n\nStyledNavHeaderIcon.defaultProps = defaultThemeProp;\n\nexport const StyledNavTitle = styled(Text)(({ theme }) => {\n return css`\n color: ${theme.base.colors.white};\n word-break: break-word;\n `;\n});\n\nStyledNavTitle.defaultProps = defaultThemeProp;\n\nexport const StyledUtils = styled.div<{ showDevMode: boolean }>(({ theme, showDevMode }) => {\n const borderColor = tryCatch(() =>\n lighten(0.1, theme.components['app-shell'].nav['background-color'])\n );\n\n return css`\n padding-bottom: calc(${showDevMode ? 2 : 0} * ${theme.base.spacing});\n border-top: 0.0625rem solid ${borderColor};\n ${StyledSwitch} {\n &:hover {\n background-color: ${hoverBg};\n }\n\n ${SwitchLabel} {\n height: calc(2rem + 4 * ${theme.base.spacing});\n padding: calc(2 * ${theme.base.spacing});\n text-transform: capitalize;\n color: ${theme.base.colors.gray.light};\n font-weight: ${theme.base['font-weight'].bold};\n\n &::before,\n &::after {\n margin-inline-end: calc(2 * ${theme.base.spacing});\n }\n }\n }\n & > ul {\n list-style: none;\n }\n `;\n});\n\nStyledUtils.defaultProps = defaultThemeProp;\n\nexport const StyledUtilItem = styled.li(({ theme }) => {\n return css`\n &[aria-current='true'] {\n background-color: rgba(0, 0, 0, 0.4);\n\n & > ${StyledBareButton} {\n color: ${theme.base.colors.blue.light};\n }\n }\n\n ${StyledBareButton} {\n font-weight: ${theme.base['font-weight']['semi-bold']};\n color: ${theme.base.colors.white};\n width: 100%;\n height: 100%;\n text-align: start;\n padding: ${theme.base.spacing} calc(2 * ${theme.base.spacing});\n\n &:hover {\n background-color: rgba(0, 0, 0, 0.4);\n }\n\n &:focus {\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n }\n `;\n});\n\nStyledUtilItem.defaultProps = defaultThemeProp;\n\nexport const StyledScrollWrap = styled.div(() => {\n const { drawerOpen } = useContext(AppShellContext);\n\n return css`\n height: ${drawerOpen ? 'calc(100% - 4rem)' : '100%'};\n overflow-y: auto;\n `;\n});\n\nStyledScrollWrap.defaultProps = defaultThemeProp;\n\nexport const StyledNavContent = styled.div(({ theme }) => {\n const { navState } = useContext(AppShellContext);\n\n return css`\n width: 14rem;\n height: 100%;\n opacity: 0;\n transition: opacity ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n\n ${navState === 'collapsed' &&\n css`\n display: none;\n `}\n\n ${(navState === 'expanding' || navState === 'expanded') &&\n css`\n opacity: 1;\n `}\n `;\n});\n\nStyledNavContent.defaultProps = defaultThemeProp;\n\nexport const StyledMain = styled.main(\n ({\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 transition: margin ${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 min-height: calc(100vh - 3rem);\n }\n `;\n }\n);\n\nStyledMain.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerWrapper = styled.div(() => {\n const { drawerOpen } = useContext(AppShellContext);\n\n return css`\n position: relative;\n z-index: 1;\n height: ${drawerOpen ? '100%' : 'auto'};\n `;\n});\n\nStyledDrawerWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledNavHeaderVisual = styled.div<{ bgColor: string }>(({ theme, bgColor }) => {\n return css`\n min-width: 2rem;\n min-height: 2rem;\n border-radius: 0.4rem;\n background-color: ${bgColor};\n margin-inline-end: ${theme.base.spacing};\n color: ${theme.base.colors.white};\n & svg {\n color: ${theme.base.colors.white};\n }\n `;\n});\n\nStyledNavHeaderVisual.defaultProps = defaultThemeProp;\n\nexport const StyledDrawerCloseButton = styled(Button)(({ theme }) => {\n return css`\n margin-inline-end: ${theme.base.spacing};\n min-width: 1.5rem;\n min-height: 1.5rem;\n color: ${theme.base.colors.white};\n\n ${StyledIcon} {\n width: 1em;\n height: 1em;\n }\n `;\n});\n\nStyledDrawerCloseButton.defaultProps = defaultThemeProp;\n\nexport const StyledInnerNav = styled.div(() => {\n const { navState } = useContext(AppShellContext);\n\n return css`\n height: 100%;\n ${(navState === 'collapsing' || navState === 'expanding') &&\n css`\n overflow: hidden;\n `}\n `;\n});\n\nStyledInnerNav.defaultProps = defaultThemeProp;\n\nexport const StyledNav = styled.nav(\n ({\n theme: {\n base: {\n breakpoints,\n colors,\n animation,\n spacing,\n 'custom-scrollbar': customScrollbar,\n 'border-radius': borderRadius,\n 'font-weight': fontWeight\n },\n components: { 'app-shell': appShell }\n }\n }) => {\n const { navState } = useContext(AppShellContext);\n\n return css`\n position: fixed;\n z-index: 1;\n height: calc(100vh - 6rem);\n background: ${appShell.nav['background-color']};\n\n &,\n ${StyledInnerNav} {\n width: ${navState === 'expanding' || navState === 'expanded' ? '14' : '1.5'}rem;\n transition: width ${animation.speed} ${animation.timing.ease};\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 &:not(:hover) {\n ${StyledNavToggle}[aria-expanded='true']:not(:focus) {\n ${hideVisually}\n }\n }\n\n /*\n * A hoverable area just outside the nav for easier mouse interaction with the collapse button.\n * As the collpase button straddles the nav boundary, so maybe too should the hoverable area.\n */\n &::after {\n content: '';\n display: block;\n position: absolute;\n inset-block-start: 0;\n inset-inline-start: 100%;\n width: calc(2 * ${spacing});\n height: 100%;\n }\n\n ${StyledStandardTree} {\n color: ${colors.white};\n\n ${StyledNodeText} {\n font-weight: ${fontWeight['semi-bold']};\n }\n\n ${StyledNodeInteraction} {\n padding-block-start: calc(0.5 * ${spacing});\n padding-block-end: calc(0.5 * ${spacing});\n &:hover,\n &[aria-current='true'] {\n background-color: ${hoverBg};\n }\n\n &[aria-current='true'] {\n ${StyledNodeIcon},\n ${StyledNodeText} {\n color: ${colors.blue.light};\n }\n }\n }\n }\n\n /* Style for main is here since nav(the \"&\") may be conditionally rendered. */\n & + ${StyledMain} {\n margin-inline-start: ${navState === 'expanding' || navState === 'expanded'\n ? '14rem'\n : '1.5rem'};\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"]}
@@ -1,7 +1,7 @@
1
1
  import { Dispatch, ReactNode, Ref, SetStateAction } from 'react';
2
2
  import { StandardTreeProps, DrawerProps, NoChildrenProp, AvatarProps, OmitStrict } from '@pega/cosmos-react-core';
3
3
  import { expandCollapseStates } from '@pega/cosmos-react-core/lib/hooks/useTransitionState';
4
- import { AppHeaderProps } from '../AppHeader';
4
+ import { AppHeaderProps } from './Header/AppHeader.types';
5
5
  export interface AppShellProps extends NoChildrenProp {
6
6
  main: ReactNode;
7
7
  appInfo: AppInfoProps;
@@ -1 +1 @@
1
- {"version":3,"file":"AppShell.types.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,WAAW,EACX,UAAU,EACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAE5F,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,YAAY,CAAC;IACtB,SAAS,EAAE,cAAc,CAAC;IAC1B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,GAAG,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,aAAa,CAAC,EAAE,QAAQ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KAAK,EAAE,MAAM,CAAC;QACd,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;IACF,QAAQ,EAAE,OAAO,oBAAoB,CAAC,MAAM,OAAO,oBAAoB,CAAC,CAAC;CAC1E"}
@@ -1 +1 @@
1
- {"version":3,"file":"AppShell.types.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.types.ts"],"names":[],"mappings":"","sourcesContent":["import { Dispatch, ReactNode, Ref, SetStateAction } from 'react';\n\nimport {\n StandardTreeProps,\n DrawerProps,\n NoChildrenProp,\n AvatarProps,\n OmitStrict\n} from '@pega/cosmos-react-core';\nimport { expandCollapseStates } from '@pega/cosmos-react-core/lib/hooks/useTransitionState';\n\nimport { AppHeaderProps } from '../AppHeader';\n\nexport interface AppShellProps extends NoChildrenProp {\n main: ReactNode;\n appInfo: AppInfoProps;\n appHeader: AppHeaderProps;\n navigation: StandardTreeProps;\n hideNav?: boolean;\n utils?: UtilsProps;\n ref?: Ref<HTMLElement>;\n}\n\nexport interface UtilsProps {\n items: UtilItem[];\n currentItemId?: UtilItem['id'];\n onItemClick: (id: UtilItem['id']) => void;\n drawer?: Pick<DrawerProps, 'onBeforeOpen' | 'onAfterOpen' | 'onBeforeClose' | 'onAfterClose'>;\n devMode?: boolean;\n}\n\nexport interface UtilItem {\n id: string;\n label: string;\n}\n\nexport interface AppInfoProps {\n text: string;\n visual?: OmitStrict<AvatarProps, 'name' | 'shape' | 'size' | 'status'>;\n meta?: string[];\n}\n\nexport interface AppShellContextValue {\n drawerOpen: boolean;\n setDrawerOpen: Dispatch<SetStateAction<boolean>>;\n setDrawerData: Dispatch<SetStateAction<UtilItem | undefined>>;\n drawerData?: {\n label: string;\n id: string;\n };\n navState: typeof expandCollapseStates[keyof typeof expandCollapseStates];\n}\n"]}
1
+ {"version":3,"file":"AppShell.types.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.types.ts"],"names":[],"mappings":"","sourcesContent":["import { Dispatch, ReactNode, Ref, SetStateAction } from 'react';\n\nimport {\n StandardTreeProps,\n DrawerProps,\n NoChildrenProp,\n AvatarProps,\n OmitStrict\n} from '@pega/cosmos-react-core';\nimport { expandCollapseStates } from '@pega/cosmos-react-core/lib/hooks/useTransitionState';\n\nimport { AppHeaderProps } from './Header/AppHeader.types';\n\nexport interface AppShellProps extends NoChildrenProp {\n main: ReactNode;\n appInfo: AppInfoProps;\n appHeader: AppHeaderProps;\n navigation: StandardTreeProps;\n hideNav?: boolean;\n utils?: UtilsProps;\n ref?: Ref<HTMLElement>;\n}\n\nexport interface UtilsProps {\n items: UtilItem[];\n currentItemId?: UtilItem['id'];\n onItemClick: (id: UtilItem['id']) => void;\n drawer?: Pick<DrawerProps, 'onBeforeOpen' | 'onAfterOpen' | 'onBeforeClose' | 'onAfterClose'>;\n devMode?: boolean;\n}\n\nexport interface UtilItem {\n id: string;\n label: string;\n}\n\nexport interface AppInfoProps {\n text: string;\n visual?: OmitStrict<AvatarProps, 'name' | 'shape' | 'size' | 'status'>;\n meta?: string[];\n}\n\nexport interface AppShellContextValue {\n drawerOpen: boolean;\n setDrawerOpen: Dispatch<SetStateAction<boolean>>;\n setDrawerData: Dispatch<SetStateAction<UtilItem | undefined>>;\n drawerData?: {\n label: string;\n id: string;\n };\n navState: typeof expandCollapseStates[keyof typeof expandCollapseStates];\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppHeader.d.ts","sourceRoot":"","sources":["../../../../src/components/AppShell/Header/AppHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAUlB,MAAM,OAAO,CAAC;AAEf,OAAO,EAGL,YAAY,EASb,MAAM,yBAAyB,CAAC;AAgBjC,OAAO,EAAE,cAAc,EAAyB,MAAM,mBAAmB,CAAC;AA0I1E,QAAA,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,GAAG,YAAY,CAgG/D,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,77 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { forwardRef, useCallback, useEffect, useState, useRef } from 'react';
3
+ import { Flex, SearchInput, useBreakpoint, Button, Icon, useI18n, MenuButton, Tooltip, useElement } from '@pega/cosmos-react-core';
4
+ import { StyledAppHeaderSearchForm } from '@pega/cosmos-react-core/lib/components/AppShell/AppHeader.styles';
5
+ import { StyledAppHeader, StyledTabs, StyledAppAvatar, StyledUtilsContainer, StyledBrandContainer, StyledAppHeaderSearch, StyledAppName, StyledAppVersion, StyledBrandButton, StyledBrandImage, StyledContext } from './AppHeader.styles';
6
+ import BranchButton from './BranchButton';
7
+ const Links = ({ links }) => {
8
+ const [currentTabId, setCurrentTabId] = useState(links[0].id);
9
+ useEffect(() => {
10
+ setCurrentTabId(links[0].id);
11
+ }, [links]);
12
+ const handleTabClick = useCallback((id, e) => {
13
+ const newActiveTab = links.find(item => item.id === id);
14
+ if (newActiveTab) {
15
+ newActiveTab.onClick?.(id, e);
16
+ setCurrentTabId(newActiveTab.id);
17
+ }
18
+ }, [links]);
19
+ return _jsx(StyledTabs, { tabs: links, currentTabId: currentTabId, onTabClick: handleTabClick });
20
+ };
21
+ const AppHeaderSearch = ({ showSearchButton, setShowSearchButton, ...restProps }) => {
22
+ const isMediumOrAbove = useBreakpoint('md');
23
+ const t = useI18n();
24
+ const searchInputRef = useCallback(node => {
25
+ if (!showSearchButton && node) {
26
+ node.focus();
27
+ }
28
+ }, [showSearchButton]);
29
+ const focusSearchBtn = useRef(false);
30
+ const searchButtonRef = useCallback(node => {
31
+ if (node && focusSearchBtn.current) {
32
+ node.focus();
33
+ }
34
+ }, []);
35
+ return isMediumOrAbove || !showSearchButton ? (_jsxs(Flex, { as: StyledAppHeaderSearch, item: { shrink: 0, grow: 1 }, md: { item: { grow: 0, shrink: 1 } }, container: { justify: 'between', alignItems: 'center', gap: 1 }, children: [_jsx(StyledAppHeaderSearchForm, { role: 'search', "aria-label": t('sitewide'), onSubmit: e => e.preventDefault(), isMediumOrAbove: isMediumOrAbove, children: _jsx(SearchInput, { ...restProps, ref: searchInputRef }) }), _jsx(Button, { variant: 'simple', icon: true, onClick: () => {
36
+ setShowSearchButton(true);
37
+ focusSearchBtn.current = true;
38
+ }, label: t('collapse_search'), children: _jsx(Icon, { name: 'times' }) })] })) : (_jsx(Button, { variant: 'simple', icon: true, onClick: () => setShowSearchButton(false), ref: searchButtonRef, label: t('expand_search'), children: _jsx(Icon, { name: 'search' }) }));
39
+ };
40
+ const Utils = ({ avatar, branch, action, appInfo }) => {
41
+ const isMediumOrAbove = useBreakpoint('md');
42
+ const isSmallOrAbove = useBreakpoint('sm');
43
+ const [appInfoEl, setAppInfoEl] = useElement(null);
44
+ return (_jsxs(Flex, { container: { justify: 'between', alignItems: 'center' }, md: { container: { justify: 'end' } }, item: { shrink: 1 }, as: StyledUtilsContainer, children: [appInfo && (_jsxs(Flex, { container: { justify: 'between', alignItems: 'center', gap: 0.5 }, item: { shrink: 1 }, ref: setAppInfoEl, children: [_jsx(Flex, { as: StyledAppName, item: { shrink: 1 }, children: appInfo.name }), _jsx(StyledAppVersion, { children: appInfo.version }), _jsx(Tooltip, { target: appInfoEl, hideDelay: 'none', children: `${appInfo.name} ${appInfo.version}` })] })), _jsxs(Flex, { container: { alignItems: 'center' }, children: [branch && _jsx(BranchButton, { ...branch, compact: isSmallOrAbove ? branch.compact : true }), action && (_jsxs(Flex, { container: { justify: 'between', alignItems: 'center', gap: 0.5 }, item: { shrink: 0 }, as: Button, variant: 'secondary', icon: !isMediumOrAbove, label: isMediumOrAbove ? undefined : action.text, onClick: (e) => action.onClick?.(action.id, e), disabled: action.disabled, children: [action.icon && _jsx(Icon, { name: action.icon }), isMediumOrAbove && action.text] }))] }), _jsx(StyledAppAvatar, { ...avatar })] }));
45
+ };
46
+ const AppHeader = forwardRef(({ contexts, onContextClick, brand, utils, links }, ref) => {
47
+ const t = useI18n();
48
+ const selectedContext = contexts.length > 1 ? contexts.find(ctx => ctx.selected) : contexts[0];
49
+ const isMediumOrAbove = useBreakpoint('md');
50
+ const [showSearchButton, setShowSearchButton] = useState(true);
51
+ useEffect(() => {
52
+ if (isMediumOrAbove && !showSearchButton) {
53
+ setShowSearchButton(true);
54
+ }
55
+ }, [isMediumOrAbove]);
56
+ return (_jsxs(Flex, { as: StyledAppHeader, container: {
57
+ justify: 'between',
58
+ alignItems: 'center',
59
+ colGap: 2,
60
+ wrap: 'wrap',
61
+ pad: [0, 1]
62
+ }, md: { container: { wrap: 'nowrap' } }, ref: ref, children: [showSearchButton && (_jsxs(Flex, { as: StyledBrandContainer, container: {
63
+ justify: 'between',
64
+ alignItems: 'center',
65
+ gap: 1
66
+ }, item: { shrink: 0, alignSelf: 'stretch' }, children: [contexts.length > 1 && (_jsx(MenuButton, { text: t('switch_to'), variant: 'simple', icon: 'dot-9-solid', iconOnly: true, menu: {
67
+ mode: 'single-select',
68
+ items: contexts,
69
+ onItemClick: onContextClick
70
+ } })), _jsxs(Flex, { as: brand.onClick || brand.href ? StyledBrandButton : 'div', variant: 'simple', container: { alignItems: 'center', justify: 'between', gap: 2, pad: 1 }, "aria-label": `${brand.label} - ${selectedContext.primary}`, onClick: brand.onClick, href: brand.href, children: [_jsx(Flex, { item: { shrink: 0 }, as: StyledBrandImage, src: brand.logo, alt: brand.label }), _jsxs(Flex, { container: { justify: 'between', alignItems: 'center', gap: 1 }, children: [selectedContext.visual, _jsx(StyledContext, { children: selectedContext.primary })] })] })] })), links && links.length > 0 && _jsx(Links, { links: links }), _jsxs(Flex, { container: {
71
+ gap: 1,
72
+ justify: 'center',
73
+ alignItems: 'center'
74
+ }, item: { grow: showSearchButton ? 0 : 1 }, md: { item: { grow: showSearchButton ? 1 : 0 } }, children: [utils?.search && (_jsx(AppHeaderSearch, { ...utils.search, showSearchButton: showSearchButton, setShowSearchButton: setShowSearchButton })), showSearchButton && !isMediumOrAbove && utils?.avatar && (_jsx(StyledAppAvatar, { ...utils.avatar }))] }), utils && _jsx(Utils, { ...utils })] }));
75
+ });
76
+ export default AppHeader;
77
+ //# sourceMappingURL=AppHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppHeader.js","sourceRoot":"","sources":["../../../../src/components/AppShell/Header/AppHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EAKV,WAAW,EACX,SAAS,EACT,QAAQ,EACR,MAAM,EAGP,MAAM,OAAO,CAAC;AAEf,OAAO,EACL,IAAI,EACJ,WAAW,EAGX,aAAa,EACb,MAAM,EACN,IAAI,EACJ,OAAO,EACP,UAAU,EACV,OAAO,EACP,UAAU,EACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,yBAAyB,EAAE,MAAM,kEAAkE,CAAC;AAE7G,OAAO,EACL,eAAe,EACf,UAAU,EACV,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACd,MAAM,oBAAoB,CAAC;AAE5B,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C,MAAM,KAAK,GAA+B,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACtD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAE9D,SAAS,CAAC,GAAG,EAAE;QACb,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC/B,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,MAAM,cAAc,GAAG,WAAW,CAChC,CAAC,EAAU,EAAE,CAAqD,EAAE,EAAE;QACpE,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACxD,IAAI,YAAY,EAAE;YAChB,YAAY,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC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AE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,aAClE,eAAe,CAAC,MAAM,EACvB,KAAC,aAAa,cAAE,eAAe,CAAC,OAAO,GAAiB,IACnD,IACF,IACF,CACR,EACA,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAC,KAAK,IAAC,KAAK,EAAE,KAAK,GAAI,EAErD,MAAC,IAAI,IACH,SAAS,EAAE;oBACT,GAAG,EAAE,CAAC;oBACN,OAAO,EAAE,QAAQ;oBACjB,UAAU,EAAE,QAAQ;iBACrB,EACD,IAAI,EAAE,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EACxC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,aAE/C,KAAK,EAAE,MAAM,IAAI,CAChB,KAAC,eAAe,OACV,KAAK,CAAC,MAAM,EAChB,gBAAgB,EAAE,gBAAgB,EAClC,mBAAmB,EAAE,mBAAmB,GACxC,CACH,EACA,gBAAgB,IAAI,CAAC,eAAe,IAAI,KAAK,EAAE,MAAM,IAAI,CACxD,KAAC,eAAe,OAAK,KAAK,CAAC,MAAM,GAAI,CACtC,IACI,EACN,KAAK,IAAI,KAAC,KAAK,OAAK,KAAK,GAAI,IACzB,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n MouseEvent,\n FC,\n PropsWithoutRef,\n useCallback,\n useEffect,\n useState,\n useRef,\n Dispatch,\n SetStateAction\n} from 'react';\n\nimport {\n Flex,\n SearchInput,\n ForwardProps,\n SearchInputProps,\n useBreakpoint,\n Button,\n Icon,\n useI18n,\n MenuButton,\n Tooltip,\n useElement\n} from '@pega/cosmos-react-core';\nimport { StyledAppHeaderSearchForm } from '@pega/cosmos-react-core/lib/components/AppShell/AppHeader.styles';\n\nimport {\n StyledAppHeader,\n StyledTabs,\n StyledAppAvatar,\n StyledUtilsContainer,\n StyledBrandContainer,\n StyledAppHeaderSearch,\n StyledAppName,\n StyledAppVersion,\n StyledBrandButton,\n StyledBrandImage,\n StyledContext\n} from './AppHeader.styles';\nimport { AppHeaderProps, LinkProps, UtilsProps } from './AppHeader.types';\nimport BranchButton from './BranchButton';\n\nconst Links: FC<{ links: LinkProps[] }> = ({ links }) => {\n const [currentTabId, setCurrentTabId] = useState(links[0].id);\n\n useEffect(() => {\n setCurrentTabId(links[0].id);\n }, [links]);\n\n const handleTabClick = useCallback(\n (id: string, e?: MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {\n const newActiveTab = links.find(item => item.id === id);\n if (newActiveTab) {\n newActiveTab.onClick?.(id, e);\n setCurrentTabId(newActiveTab.id);\n }\n },\n [links]\n );\n\n return <StyledTabs tabs={links} currentTabId={currentTabId} onTabClick={handleTabClick} />;\n};\n\nconst AppHeaderSearch: FC<\n SearchInputProps & {\n showSearchButton: boolean;\n setShowSearchButton: Dispatch<SetStateAction<boolean>>;\n }\n> = ({ showSearchButton, setShowSearchButton, ...restProps }) => {\n const isMediumOrAbove = useBreakpoint('md');\n const t = useI18n();\n\n const searchInputRef = useCallback(\n node => {\n if (!showSearchButton && node) {\n node.focus();\n }\n },\n [showSearchButton]\n );\n const focusSearchBtn = useRef(false);\n const searchButtonRef = useCallback(node => {\n if (node && focusSearchBtn.current) {\n node.focus();\n }\n }, []);\n\n return isMediumOrAbove || !showSearchButton ? (\n <Flex\n as={StyledAppHeaderSearch}\n item={{ shrink: 0, grow: 1 }}\n md={{ item: { grow: 0, shrink: 1 } }}\n container={{ justify: 'between', alignItems: 'center', gap: 1 }}\n >\n <StyledAppHeaderSearchForm\n role='search'\n aria-label={t('sitewide')}\n onSubmit={e => e.preventDefault()}\n isMediumOrAbove={isMediumOrAbove}\n >\n <SearchInput {...restProps} ref={searchInputRef} />\n </StyledAppHeaderSearchForm>\n <Button\n variant='simple'\n icon\n onClick={() => {\n setShowSearchButton(true);\n focusSearchBtn.current = true;\n }}\n label={t('collapse_search')}\n >\n <Icon name='times' />\n </Button>\n </Flex>\n ) : (\n <Button\n variant='simple'\n icon\n onClick={() => setShowSearchButton(false)}\n ref={searchButtonRef}\n label={t('expand_search')}\n >\n <Icon name='search' />\n </Button>\n );\n};\n\nconst Utils: FC<UtilsProps> = ({ avatar, branch, action, appInfo }) => {\n const isMediumOrAbove = useBreakpoint('md');\n const isSmallOrAbove = useBreakpoint('sm');\n const [appInfoEl, setAppInfoEl] = useElement(null);\n\n return (\n <Flex\n container={{ justify: 'between', alignItems: 'center' }}\n md={{ container: { justify: 'end' } }}\n item={{ shrink: 1 }}\n as={StyledUtilsContainer}\n >\n {appInfo && (\n <Flex\n container={{ justify: 'between', alignItems: 'center', gap: 0.5 }}\n item={{ shrink: 1 }}\n ref={setAppInfoEl}\n >\n <Flex as={StyledAppName} item={{ shrink: 1 }}>\n {appInfo.name}\n </Flex>\n <StyledAppVersion>{appInfo.version}</StyledAppVersion>\n <Tooltip target={appInfoEl} hideDelay='none'>\n {`${appInfo.name} ${appInfo.version}`}\n </Tooltip>\n </Flex>\n )}\n <Flex container={{ alignItems: 'center' }}>\n {branch && <BranchButton {...branch} compact={isSmallOrAbove ? branch.compact : true} />}\n {action && (\n <Flex\n container={{ justify: 'between', alignItems: 'center', gap: 0.5 }}\n item={{ shrink: 0 }}\n as={Button}\n variant='secondary'\n icon={!isMediumOrAbove}\n label={isMediumOrAbove ? undefined : action.text}\n onClick={(e: MouseEvent<HTMLButtonElement>) => action.onClick?.(action.id, e)}\n disabled={action.disabled}\n >\n {action.icon && <Icon name={action.icon} />}\n {isMediumOrAbove && action.text}\n </Flex>\n )}\n </Flex>\n <StyledAppAvatar {...avatar} />\n </Flex>\n );\n};\n\nconst AppHeader: FunctionComponent<AppHeaderProps & ForwardProps> = forwardRef(\n (\n { contexts, onContextClick, brand, utils, links }: PropsWithoutRef<AppHeaderProps>,\n ref: AppHeaderProps['ref']\n ) => {\n const t = useI18n();\n\n const selectedContext = contexts.length > 1 ? contexts.find(ctx => ctx.selected)! : contexts[0];\n\n const isMediumOrAbove = useBreakpoint('md');\n const [showSearchButton, setShowSearchButton] = useState(true);\n\n useEffect(() => {\n if (isMediumOrAbove && !showSearchButton) {\n setShowSearchButton(true);\n }\n }, [isMediumOrAbove]);\n\n return (\n <Flex\n as={StyledAppHeader}\n container={{\n justify: 'between',\n alignItems: 'center',\n colGap: 2,\n wrap: 'wrap',\n pad: [0, 1]\n }}\n md={{ container: { wrap: 'nowrap' } }}\n ref={ref}\n >\n {showSearchButton && (\n <Flex\n as={StyledBrandContainer}\n container={{\n justify: 'between',\n alignItems: 'center',\n gap: 1\n }}\n item={{ shrink: 0, alignSelf: 'stretch' }}\n >\n {contexts.length > 1 && (\n <MenuButton\n text={t('switch_to')}\n variant='simple'\n icon='dot-9-solid'\n iconOnly\n menu={{\n mode: 'single-select',\n items: contexts,\n onItemClick: onContextClick\n }}\n />\n )}\n <Flex\n as={brand.onClick || brand.href ? StyledBrandButton : 'div'}\n variant='simple'\n container={{ alignItems: 'center', justify: 'between', gap: 2, pad: 1 }}\n aria-label={`${brand.label} - ${selectedContext.primary}`}\n onClick={brand.onClick}\n href={brand.href}\n >\n <Flex item={{ shrink: 0 }} as={StyledBrandImage} src={brand.logo} alt={brand.label} />\n <Flex container={{ justify: 'between', alignItems: 'center', gap: 1 }}>\n {selectedContext.visual}\n <StyledContext>{selectedContext.primary}</StyledContext>\n </Flex>\n </Flex>\n </Flex>\n )}\n {links && links.length > 0 && <Links links={links} />}\n\n <Flex\n container={{\n gap: 1,\n justify: 'center',\n alignItems: 'center'\n }}\n item={{ grow: showSearchButton ? 0 : 1 }}\n md={{ item: { grow: showSearchButton ? 1 : 0 } }}\n >\n {utils?.search && (\n <AppHeaderSearch\n {...utils.search}\n showSearchButton={showSearchButton}\n setShowSearchButton={setShowSearchButton}\n />\n )}\n {showSearchButton && !isMediumOrAbove && utils?.avatar && (\n <StyledAppAvatar {...utils.avatar} />\n )}\n </Flex>\n {utils && <Utils {...utils} />}\n </Flex>\n );\n }\n);\n\nexport default AppHeader;\n"]}