@pega/cosmos-react-core 10.0.0-build.5.24 → 10.0.0-build.5.26

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 (71) hide show
  1. package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
  2. package/lib/components/AppShell/AppHeader.js +2 -2
  3. package/lib/components/AppShell/AppHeader.js.map +1 -1
  4. package/lib/components/AppShell/AppShell.d.ts +2 -2
  5. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  6. package/lib/components/AppShell/AppShell.js +88 -189
  7. package/lib/components/AppShell/AppShell.js.map +1 -1
  8. package/lib/components/AppShell/AppShell.styles.d.ts +1 -7
  9. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  10. package/lib/components/AppShell/AppShell.styles.js +1 -124
  11. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  12. package/lib/components/AppShell/AppShell.types.d.ts +9 -0
  13. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  14. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  15. package/lib/components/AppShell/TopNavDrawerProvider.d.ts +7 -0
  16. package/lib/components/AppShell/TopNavDrawerProvider.d.ts.map +1 -0
  17. package/lib/components/AppShell/TopNavDrawerProvider.js +28 -0
  18. package/lib/components/AppShell/TopNavDrawerProvider.js.map +1 -0
  19. package/lib/components/AppShell/TouchAppShell.d.ts +30 -0
  20. package/lib/components/AppShell/TouchAppShell.d.ts.map +1 -0
  21. package/lib/components/AppShell/TouchAppShell.js +110 -0
  22. package/lib/components/AppShell/TouchAppShell.js.map +1 -0
  23. package/lib/components/AppShell/TouchAppShell.styles.d.ts +8 -0
  24. package/lib/components/AppShell/TouchAppShell.styles.d.ts.map +1 -0
  25. package/lib/components/AppShell/TouchAppShell.styles.js +136 -0
  26. package/lib/components/AppShell/TouchAppShell.styles.js.map +1 -0
  27. package/lib/components/AppShell/index.d.ts +1 -1
  28. package/lib/components/AppShell/index.d.ts.map +1 -1
  29. package/lib/components/AppShell/index.js.map +1 -1
  30. package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
  31. package/lib/components/DateTime/Input/DateInput.js +9 -3
  32. package/lib/components/DateTime/Input/DateInput.js.map +1 -1
  33. package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
  34. package/lib/components/DateTime/Input/DateTimeInput.js +15 -7
  35. package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
  36. package/lib/components/DateTime/Input/PartInput.d.ts.map +1 -1
  37. package/lib/components/DateTime/Input/PartInput.js +3 -2
  38. package/lib/components/DateTime/Input/PartInput.js.map +1 -1
  39. package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
  40. package/lib/components/DateTime/Input/TimeInput.js +4 -3
  41. package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
  42. package/lib/components/DateTime/Picker/TimePicker.d.ts.map +1 -1
  43. package/lib/components/DateTime/Picker/TimePicker.js +12 -33
  44. package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
  45. package/lib/components/Menu/Menu.d.ts +1 -1
  46. package/lib/components/Menu/Menu.d.ts.map +1 -1
  47. package/lib/components/Menu/Menu.js +10 -3
  48. package/lib/components/Menu/Menu.js.map +1 -1
  49. package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
  50. package/lib/components/Menu/Menu.styles.js +6 -0
  51. package/lib/components/Menu/Menu.styles.js.map +1 -1
  52. package/lib/components/Menu/Menu.test-ids.d.ts +1 -1
  53. package/lib/components/Menu/Menu.test-ids.d.ts.map +1 -1
  54. package/lib/components/Menu/Menu.test-ids.js +1 -1
  55. package/lib/components/Menu/Menu.test-ids.js.map +1 -1
  56. package/lib/components/Menu/Menu.types.d.ts +9 -0
  57. package/lib/components/Menu/Menu.types.d.ts.map +1 -1
  58. package/lib/components/Menu/Menu.types.js.map +1 -1
  59. package/lib/components/Menu/helpers.d.ts +14 -0
  60. package/lib/components/Menu/helpers.d.ts.map +1 -1
  61. package/lib/components/Menu/helpers.js +26 -0
  62. package/lib/components/Menu/helpers.js.map +1 -1
  63. package/lib/hooks/useI18n.d.ts +1 -0
  64. package/lib/hooks/useI18n.d.ts.map +1 -1
  65. package/lib/i18n/default.d.ts +1 -0
  66. package/lib/i18n/default.d.ts.map +1 -1
  67. package/lib/i18n/default.js +1 -0
  68. package/lib/i18n/default.js.map +1 -1
  69. package/lib/i18n/i18n.d.ts +1 -0
  70. package/lib/i18n/i18n.d.ts.map +1 -1
  71. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AppHeader.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,OAAO,CAAC;AAQjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAkBvD,QAAA,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,GAAG,YAAY,CAwN9D,CAAC;AAEH,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"AppHeader.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,OAAO,CAAC;AAQjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAkBvD,QAAA,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,GAAG,YAAY,CA0N9D,CAAC;AAEH,eAAe,SAAS,CAAC"}
@@ -17,7 +17,7 @@ import { StyledShareIcon } from './AppShell.styles';
17
17
  import AppShellContext from './AppShellContext';
18
18
  import { getHeaderTheme } from './style-utils';
19
19
  import ThemeSwitcher from './ThemeSwitcher';
20
- const AppHeader = forwardRef(function AppHeader({ appName, contextSwitcher: { contexts, onContextClick, label: contextSwitcherLabel } = {}, fullImageSrc, imageSrc, imageAltText, href, onClick, portalName, target, appNameHidden, operator, searchInput, searchLabel, searchPage, headerUtils, helpMenu, shareApp }, ref) {
20
+ const AppHeader = forwardRef(function AppHeader({ appName, contextSwitcher: { contexts, onContextClick, label: contextSwitcherLabel } = {}, fullImageSrc, imageSrc, imageAltText, href, onClick, portalName, target, appNameHidden, operator, searchInput, searchLabel, searchPage, headerUtils, helpMenu, shareApp, portalSwitcher }, ref) {
21
21
  const t = useI18n();
22
22
  const isMediumOrAbove = useBreakpoint('md');
23
23
  const isSmallOrAbove = useBreakpoint('sm');
@@ -75,7 +75,7 @@ const AppHeader = forwardRef(function AppHeader({ appName, contextSwitcher: { co
75
75
  setSearchExpanded(false);
76
76
  }) }))) })) : (_jsx(StyledAppHeaderSpacer, {})), !searchTakeover && headerUtils?.[1]] }), !searchTakeover && (_jsxs(_Fragment, { children: [onThemeModeChange && (_jsx(ThemeSwitcher, { themeMode: themeMode, onThemeModeChange: onThemeModeChange })), helpMenu && (_jsx(MenuButton, { variant: 'simple', icon: 'help', text: t('app_header_help'), iconOnly: true, menu: {
77
77
  items: helpMenu
78
- } })), shareApp && (_jsx(Button, { variant: 'secondary', onClick: shareApp.onClick, children: _jsxs(Flex, { container: { gap: 0.5, alignItems: 'center' }, children: [_jsx(StyledShareIcon, { name: 'share' }), _jsx("span", { children: shareLabel })] }) })), _jsx(AppShellOperator, { as: StyledAppHeaderOperator, actions: operator.actions, popover: { placement: 'bottom-start' }, name: operator.name, children: operator.avatar })] }))] }) }));
78
+ } })), portalSwitcher && _jsx(MenuButton, { ...portalSwitcher }), shareApp && (_jsx(Button, { variant: 'secondary', onClick: shareApp.onClick, children: _jsxs(Flex, { container: { gap: 0.5, alignItems: 'center' }, children: [_jsx(StyledShareIcon, { name: 'share' }), _jsx("span", { children: shareLabel })] }) })), _jsx(AppShellOperator, { as: StyledAppHeaderOperator, actions: operator.actions, popover: { placement: 'bottom-start' }, name: operator.name, children: operator.avatar })] }))] }) }));
79
79
  });
80
80
  export default AppHeader;
81
81
  //# sourceMappingURL=AppHeader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppHeader.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGrF,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,MAAM,UAAU,CAAC;AAC7B,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE3E,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,UAAU,MAAM,eAAe,CAAC;AAGvC,OAAO,gBAAgB,MAAM,YAAY,CAAC;AAC1C,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,MAAM,SAAS,GAAqD,UAAU,CAAC,SAAS,SAAS,CAC/F,EACE,OAAO,EACP,eAAe,EAAE,EAAE,QAAQ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EAAE,QAAQ,CAAC,IAAI,YAElB,QAAQ,CAAC,MAAM,GACC,IAClB,CACJ,IACI,GACO,CACjB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,SAAS,CAAC","sourcesContent":["import { forwardRef, useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport type { FunctionComponent, Ref, ElementType } from 'react';\n\nimport Flex from '../Flex';\nimport Image from '../Image';\nimport Button from '../Button';\nimport Icon from '../Icon';\nimport SearchInput from '../SearchInput';\nimport { useBreakpoint, useElement, useI18n, useTheme } from '../../hooks';\nimport type { ForwardProps } from '../../types';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\nimport { ThemeOverride } from '../Configuration';\nimport useThemeMode from '../../hooks/useThemeMode';\nimport MenuButton from '../MenuButton';\n\nimport type { AppHeaderProps } from './AppShell.types';\nimport AppShellOperator from './Operator';\nimport ContextSwitcher from './ContextSwitcher';\nimport {\n StyledAppHeader,\n StyledAppHeaderInfo,\n StyledAppHeaderName,\n StyledAppHeaderSearchForm,\n StyledAppHeaderSpacer,\n StyledAppHeaderText,\n StyledAppHeaderOperator,\n StyledAppHeaderLogo\n} from './AppHeader.styles';\nimport { StyledShareIcon } from './AppShell.styles';\nimport AppShellContext from './AppShellContext';\nimport { getHeaderTheme } from './style-utils';\nimport ThemeSwitcher from './ThemeSwitcher';\n\nconst AppHeader: FunctionComponent<AppHeaderProps & ForwardProps> = forwardRef(function AppHeader(\n {\n appName,\n contextSwitcher: { contexts, onContextClick, label: contextSwitcherLabel } = {},\n fullImageSrc,\n imageSrc,\n imageAltText,\n href,\n onClick,\n portalName,\n target,\n appNameHidden,\n operator,\n searchInput,\n searchLabel,\n searchPage,\n headerUtils,\n helpMenu,\n shareApp\n }: AppHeaderProps,\n ref: Ref<Element>\n) {\n const t = useI18n();\n const isMediumOrAbove = useBreakpoint('md');\n const isSmallOrAbove = useBreakpoint('sm');\n const [searchExpanded, setSearchExpanded] = useState(false);\n const [searchContainer, setSearchContainer] = useElement<HTMLElement>();\n const { drawerOpen, isTopBar, setSearchContainerEl } = useContext(AppShellContext);\n const searchInputRef = useRef<HTMLInputElement>(null);\n const theme = useTheme();\n const headerTheme = useMemo(() => getHeaderTheme(theme), [theme]);\n\n // Below `md` there's no room for the app/portal name side by side, so they stack into two rows.\n const stacked = !isMediumOrAbove;\n const searchCollapsible = !isMediumOrAbove || isTopBar;\n const searchDisplay = (() => {\n if (!searchExpanded) return searchCollapsible ? 'icon' : undefined;\n if (!isSmallOrAbove) return 'fullWidth';\n if (!isMediumOrAbove) return 'grow';\n return undefined;\n })();\n const searchTakeover = searchDisplay === 'fullWidth';\n\n const shareLabel = shareApp?.label ?? t('app_shell_share');\n\n useEffect(() => {\n if (searchPage && searchContainer) {\n setSearchContainerEl(searchContainer);\n } else {\n setSearchContainerEl(null);\n }\n }, [searchPage, searchContainer, setSearchContainerEl]);\n\n // Auto-collapse back to the icon when focus leaves the search area, as long as nothing was typed.\n useEffect(() => {\n if (!searchCollapsible || !searchExpanded || searchInput?.value || !searchContainer)\n return undefined;\n\n const handleFocusOut = (e: FocusEvent) => {\n const nextTarget = e.relatedTarget instanceof Node ? e.relatedTarget : null;\n if (!searchInput?.value && !searchContainer.contains(nextTarget)) setSearchExpanded(false);\n };\n\n searchContainer.addEventListener('focusout', handleFocusOut);\n return () => searchContainer.removeEventListener('focusout', handleFocusOut);\n }, [searchCollapsible, searchExpanded, searchInput?.value, searchContainer]);\n\n const { themeMode, onThemeModeChange } = useThemeMode();\n\n let appInfoAs: ElementType = 'div';\n if (href) appInfoAs = 'a';\n return (\n <ThemeOverride theme={headerTheme}>\n <Flex\n as={StyledAppHeader}\n container={{ alignItems: 'center', pad: 1 }}\n stacked={stacked}\n drawerOpen={drawerOpen}\n ref={ref}\n >\n {!searchTakeover && (\n <>\n {contexts && contexts.length > 1 && onContextClick && (\n <ContextSwitcher\n contexts={contexts}\n onContextClick={onContextClick}\n label={contextSwitcherLabel}\n />\n )}\n\n <Flex\n as={StyledAppHeaderInfo}\n container={{ colGap: 0.5 }}\n item={{ shrink: 1 }}\n centerLogo={!fullImageSrc}\n >\n <Flex\n container={{ inline: true, alignItems: 'center' }}\n item={{ shrink: 1 }}\n as={appInfoAs}\n href={href}\n onClick={href ? onClick : undefined}\n target={target}\n >\n <Flex container={{ alignItems: 'center', gap: 1 }} item={{ shrink: 1 }}>\n {(fullImageSrc || imageSrc) && (\n <Flex\n container={{ alignItems: 'center' }}\n item={{ shrink: 0 }}\n as={StyledAppHeaderLogo}\n >\n <Image\n src={fullImageSrc || imageSrc}\n alt={imageAltText ?? t('application_logo')}\n />\n </Flex>\n )}\n <StyledAppHeaderName stacked={stacked || appNameHidden}>\n <StyledAppHeaderText\n as={appNameHidden ? VisuallyHiddenText : 'span'}\n variant='primary'\n >\n {appName}\n </StyledAppHeaderText>\n {portalName && (\n <StyledAppHeaderText variant='secondary' stacked={stacked || appNameHidden}>\n {portalName}\n </StyledAppHeaderText>\n )}\n </StyledAppHeaderName>\n </Flex>\n </Flex>\n {headerUtils?.[0]}\n </Flex>\n </>\n )}\n\n <Flex item={{ grow: 1 }} container={{ justify: 'end' }}>\n {searchInput ? (\n <StyledAppHeaderSearchForm\n ref={setSearchContainer}\n role='search'\n aria-label={searchLabel}\n onSubmit={e => e.preventDefault()}\n searchDisplay={searchDisplay}\n >\n {!searchPage &&\n (searchDisplay === 'icon' ? (\n <Button\n icon\n variant='simple'\n label={t('search')}\n aria-label={t('expand_search')}\n onClick={() => {\n setSearchExpanded(true);\n setTimeout(() => searchInputRef.current?.focus());\n }}\n >\n <Icon name='search' />\n </Button>\n ) : (\n <SearchInput\n {...searchInput}\n ref={searchInputRef}\n onSearchSubmit={\n searchInput.onSearchSubmit &&\n (value => {\n searchInput.onSearchSubmit?.(value);\n setSearchExpanded(false);\n })\n }\n />\n ))}\n </StyledAppHeaderSearchForm>\n ) : (\n <StyledAppHeaderSpacer />\n )}\n {!searchTakeover && headerUtils?.[1]}\n </Flex>\n {!searchTakeover && (\n <>\n {onThemeModeChange && (\n <ThemeSwitcher themeMode={themeMode} onThemeModeChange={onThemeModeChange} />\n )}\n {helpMenu && (\n <MenuButton\n variant='simple'\n icon='help'\n text={t('app_header_help')}\n iconOnly\n menu={{\n items: helpMenu\n }}\n />\n )}\n {shareApp && (\n <Button variant='secondary' onClick={shareApp.onClick}>\n <Flex container={{ gap: 0.5, alignItems: 'center' }}>\n <StyledShareIcon name='share' />\n <span>{shareLabel}</span>\n </Flex>\n </Button>\n )}\n <AppShellOperator\n as={StyledAppHeaderOperator}\n actions={operator.actions}\n popover={{ placement: 'bottom-start' }}\n name={operator.name}\n >\n {operator.avatar}\n </AppShellOperator>\n </>\n )}\n </Flex>\n </ThemeOverride>\n );\n});\n\nexport default AppHeader;\n"]}
1
+ {"version":3,"file":"AppHeader.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGrF,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,MAAM,UAAU,CAAC;AAC7B,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE3E,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,YAAY,MAAM,0BAA0B,CAAC;AACpD,OAAO,UAAU,MAAM,eAAe,CAAC;AAGvC,OAAO,gBAAgB,MAAM,YAAY,CAAC;AAC1C,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,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Ac,GAAI,EACpD,QAAQ,IAAI,CACX,KAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,YACnD,MAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,QAAQ,EAAE,aACjD,KAAC,eAAe,IAAC,IAAI,EAAC,OAAO,GAAG,EAChC,yBAAO,UAAU,GAAQ,IACpB,GACA,CACV,EACD,KAAC,gBAAgB,IACf,EAAE,EAAE,uBAAuB,EAC3B,OAAO,EAAE,QAAQ,CAAC,OAAO,EACzB,OAAO,EAAE,EAAE,SAAS,EAAE,cAAc,EAAE,EACtC,IAAI,EAAE,QAAQ,CAAC,IAAI,YAElB,QAAQ,CAAC,MAAM,GACC,IAClB,CACJ,IACI,GACO,CACjB,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,SAAS,CAAC","sourcesContent":["import { forwardRef, useContext, useEffect, useMemo, useRef, useState } from 'react';\nimport type { FunctionComponent, Ref, ElementType } from 'react';\n\nimport Flex from '../Flex';\nimport Image from '../Image';\nimport Button from '../Button';\nimport Icon from '../Icon';\nimport SearchInput from '../SearchInput';\nimport { useBreakpoint, useElement, useI18n, useTheme } from '../../hooks';\nimport type { ForwardProps } from '../../types';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\nimport { ThemeOverride } from '../Configuration';\nimport useThemeMode from '../../hooks/useThemeMode';\nimport MenuButton from '../MenuButton';\n\nimport type { AppHeaderProps } from './AppShell.types';\nimport AppShellOperator from './Operator';\nimport ContextSwitcher from './ContextSwitcher';\nimport {\n StyledAppHeader,\n StyledAppHeaderInfo,\n StyledAppHeaderName,\n StyledAppHeaderSearchForm,\n StyledAppHeaderSpacer,\n StyledAppHeaderText,\n StyledAppHeaderOperator,\n StyledAppHeaderLogo\n} from './AppHeader.styles';\nimport { StyledShareIcon } from './AppShell.styles';\nimport AppShellContext from './AppShellContext';\nimport { getHeaderTheme } from './style-utils';\nimport ThemeSwitcher from './ThemeSwitcher';\n\nconst AppHeader: FunctionComponent<AppHeaderProps & ForwardProps> = forwardRef(function AppHeader(\n {\n appName,\n contextSwitcher: { contexts, onContextClick, label: contextSwitcherLabel } = {},\n fullImageSrc,\n imageSrc,\n imageAltText,\n href,\n onClick,\n portalName,\n target,\n appNameHidden,\n operator,\n searchInput,\n searchLabel,\n searchPage,\n headerUtils,\n helpMenu,\n shareApp,\n portalSwitcher\n }: AppHeaderProps,\n ref: Ref<Element>\n) {\n const t = useI18n();\n const isMediumOrAbove = useBreakpoint('md');\n const isSmallOrAbove = useBreakpoint('sm');\n const [searchExpanded, setSearchExpanded] = useState(false);\n const [searchContainer, setSearchContainer] = useElement<HTMLElement>();\n const { drawerOpen, isTopBar, setSearchContainerEl } = useContext(AppShellContext);\n const searchInputRef = useRef<HTMLInputElement>(null);\n const theme = useTheme();\n const headerTheme = useMemo(() => getHeaderTheme(theme), [theme]);\n\n // Below `md` there's no room for the app/portal name side by side, so they stack into two rows.\n const stacked = !isMediumOrAbove;\n const searchCollapsible = !isMediumOrAbove || isTopBar;\n const searchDisplay = (() => {\n if (!searchExpanded) return searchCollapsible ? 'icon' : undefined;\n if (!isSmallOrAbove) return 'fullWidth';\n if (!isMediumOrAbove) return 'grow';\n return undefined;\n })();\n const searchTakeover = searchDisplay === 'fullWidth';\n\n const shareLabel = shareApp?.label ?? t('app_shell_share');\n\n useEffect(() => {\n if (searchPage && searchContainer) {\n setSearchContainerEl(searchContainer);\n } else {\n setSearchContainerEl(null);\n }\n }, [searchPage, searchContainer, setSearchContainerEl]);\n\n // Auto-collapse back to the icon when focus leaves the search area, as long as nothing was typed.\n useEffect(() => {\n if (!searchCollapsible || !searchExpanded || searchInput?.value || !searchContainer)\n return undefined;\n\n const handleFocusOut = (e: FocusEvent) => {\n const nextTarget = e.relatedTarget instanceof Node ? e.relatedTarget : null;\n if (!searchInput?.value && !searchContainer.contains(nextTarget)) setSearchExpanded(false);\n };\n\n searchContainer.addEventListener('focusout', handleFocusOut);\n return () => searchContainer.removeEventListener('focusout', handleFocusOut);\n }, [searchCollapsible, searchExpanded, searchInput?.value, searchContainer]);\n\n const { themeMode, onThemeModeChange } = useThemeMode();\n\n let appInfoAs: ElementType = 'div';\n if (href) appInfoAs = 'a';\n return (\n <ThemeOverride theme={headerTheme}>\n <Flex\n as={StyledAppHeader}\n container={{ alignItems: 'center', pad: 1 }}\n stacked={stacked}\n drawerOpen={drawerOpen}\n ref={ref}\n >\n {!searchTakeover && (\n <>\n {contexts && contexts.length > 1 && onContextClick && (\n <ContextSwitcher\n contexts={contexts}\n onContextClick={onContextClick}\n label={contextSwitcherLabel}\n />\n )}\n\n <Flex\n as={StyledAppHeaderInfo}\n container={{ colGap: 0.5 }}\n item={{ shrink: 1 }}\n centerLogo={!fullImageSrc}\n >\n <Flex\n container={{ inline: true, alignItems: 'center' }}\n item={{ shrink: 1 }}\n as={appInfoAs}\n href={href}\n onClick={href ? onClick : undefined}\n target={target}\n >\n <Flex container={{ alignItems: 'center', gap: 1 }} item={{ shrink: 1 }}>\n {(fullImageSrc || imageSrc) && (\n <Flex\n container={{ alignItems: 'center' }}\n item={{ shrink: 0 }}\n as={StyledAppHeaderLogo}\n >\n <Image\n src={fullImageSrc || imageSrc}\n alt={imageAltText ?? t('application_logo')}\n />\n </Flex>\n )}\n <StyledAppHeaderName stacked={stacked || appNameHidden}>\n <StyledAppHeaderText\n as={appNameHidden ? VisuallyHiddenText : 'span'}\n variant='primary'\n >\n {appName}\n </StyledAppHeaderText>\n {portalName && (\n <StyledAppHeaderText variant='secondary' stacked={stacked || appNameHidden}>\n {portalName}\n </StyledAppHeaderText>\n )}\n </StyledAppHeaderName>\n </Flex>\n </Flex>\n {headerUtils?.[0]}\n </Flex>\n </>\n )}\n\n <Flex item={{ grow: 1 }} container={{ justify: 'end' }}>\n {searchInput ? (\n <StyledAppHeaderSearchForm\n ref={setSearchContainer}\n role='search'\n aria-label={searchLabel}\n onSubmit={e => e.preventDefault()}\n searchDisplay={searchDisplay}\n >\n {!searchPage &&\n (searchDisplay === 'icon' ? (\n <Button\n icon\n variant='simple'\n label={t('search')}\n aria-label={t('expand_search')}\n onClick={() => {\n setSearchExpanded(true);\n setTimeout(() => searchInputRef.current?.focus());\n }}\n >\n <Icon name='search' />\n </Button>\n ) : (\n <SearchInput\n {...searchInput}\n ref={searchInputRef}\n onSearchSubmit={\n searchInput.onSearchSubmit &&\n (value => {\n searchInput.onSearchSubmit?.(value);\n setSearchExpanded(false);\n })\n }\n />\n ))}\n </StyledAppHeaderSearchForm>\n ) : (\n <StyledAppHeaderSpacer />\n )}\n {!searchTakeover && headerUtils?.[1]}\n </Flex>\n {!searchTakeover && (\n <>\n {onThemeModeChange && (\n <ThemeSwitcher themeMode={themeMode} onThemeModeChange={onThemeModeChange} />\n )}\n {helpMenu && (\n <MenuButton\n variant='simple'\n icon='help'\n text={t('app_header_help')}\n iconOnly\n menu={{\n items: helpMenu\n }}\n />\n )}\n {portalSwitcher && <MenuButton {...portalSwitcher} />}\n {shareApp && (\n <Button variant='secondary' onClick={shareApp.onClick}>\n <Flex container={{ gap: 0.5, alignItems: 'center' }}>\n <StyledShareIcon name='share' />\n <span>{shareLabel}</span>\n </Flex>\n </Button>\n )}\n <AppShellOperator\n as={StyledAppHeaderOperator}\n actions={operator.actions}\n popover={{ placement: 'bottom-start' }}\n name={operator.name}\n >\n {operator.avatar}\n </AppShellOperator>\n </>\n )}\n </Flex>\n </ThemeOverride>\n );\n});\n\nexport default AppHeader;\n"]}
@@ -1,4 +1,4 @@
1
1
  import type { AppShellProps } from './AppShell.types';
2
- declare const AppShell: import("react").ForwardRefExoticComponent<AppShellProps & import("react").RefAttributes<HTMLDivElement>>;
3
- export default AppShell;
2
+ declare const AppShellMain: import("react").ForwardRefExoticComponent<AppShellProps & import("react").RefAttributes<HTMLDivElement>>;
3
+ export default AppShellMain;
4
4
  //# sourceMappingURL=AppShell.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.tsx"],"names":[],"mappings":"AAkEA,OAAO,KAAK,EAAE,aAAa,EAAiB,MAAM,kBAAkB,CAAC;AAgFrE,QAAA,MAAM,QAAQ,0GAglBZ,CAAC;AAEH,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.tsx"],"names":[],"mappings":"AAiDA,OAAO,KAAK,EAAE,aAAa,EAAiB,MAAM,kBAAkB,CAAC;AAsWrE,QAAA,MAAM,YAAY,0GAuKjB,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { forwardRef, useState, useCallback, useEffect, useMemo, useRef, useLayoutEffect } from 'react';
3
- import { Alert } from '../Badges';
2
+ import { forwardRef, useState, useCallback, useMemo, useRef } from 'react';
4
3
  import Flex from '../Flex';
5
4
  import Icon, { registerIcon } from '../Icon';
6
5
  import * as timesIcon from '../Icon/icons/times.icon';
@@ -13,98 +12,59 @@ import * as sunIcon from '../Icon/icons/sun.icon';
13
12
  import * as moonIcon from '../Icon/icons/moon.icon';
14
13
  import * as circleMixedLeftIcon from '../Icon/icons/circle-mixed-left.icon';
15
14
  import * as shareIcon from '../Icon/icons/share.icon';
16
- import { useI18n, useBreakpoint, useConsolidatedRef, useElement, useTransitionState, useEvent, useScrollToggle, useTheme, useUID, usePreviewManager, useDirection } from '../../hooks';
15
+ import { useI18n, useBreakpoint, useConsolidatedRef, useElement, useTransitionState, useEvent, useUID, usePreviewManager, useDirection } from '../../hooks';
16
+ import useThemeMode from '../../hooks/useThemeMode';
17
17
  import { openCloseStates } from '../../hooks/useTransitionState';
18
18
  import SkipLinks from '../SkipLinks';
19
19
  import Progress from '../Progress';
20
20
  import { registerAction } from '../ShortcutManager';
21
21
  import useShortcut from '../../hooks/useShortcut';
22
- import { debounce, isTouchDevice, isValidElement } from '../../utils';
22
+ import { isTouchDevice } from '../../utils';
23
23
  import useKeyboardCommands from '../KeyboardCommands';
24
24
  import Tooltip from '../Tooltip';
25
- import Drawer from '../Drawer';
26
- import useThemeMode from '../../hooks/useThemeMode';
27
- import AppShellContext, { AppShellDrawerContext } from './AppShellContext';
25
+ import AppShellContext from './AppShellContext';
28
26
  import AppHeader from './AppHeader';
29
- import AppShellDrawer from './Drawer';
30
27
  import AppTopNav from './AppTopNav';
31
- import { StyledAppMain, StyledBannerRegion, StyledMobileNav, StyledMobileMoreMenuButton, menuButtonWidth, StyledMobileMoreMenu, StyledAppShellToggleButton, StyledAppShellTooltip, StyledSidebarNav, StyledShareIcon, AppShellGlobalStyle } from './AppShell.styles';
28
+ import { StyledAppMain, StyledBannerRegion, StyledAppShellToggleButton, StyledAppShellTooltip, StyledSidebarNav, AppShellGlobalStyle, StyledShareIcon } from './AppShell.styles';
32
29
  import { followingNodes, focusRegion } from './utils';
33
- import AppNavigationPanel, { CaseTypes, Links } from './AppNavigationPanel';
30
+ import AppNavigationPanel from './AppNavigationPanel';
34
31
  import NavigationList from './NavigationList';
35
32
  import DocumentTabs, { getTabElementId, getTabPanelId } from './DocumentTabs';
36
33
  import { StyledDocumentTabPanel } from './DocumentTabs.styles';
34
+ import TopNavDrawerProvider from './TopNavDrawerProvider';
35
+ import TouchAppShell from './TouchAppShell';
37
36
  registerIcon(timesIcon, plusIcon, caseSolidIcon, barsIcon, caretRightIcon, caretLeftIcon, sunIcon, moonIcon, circleMixedLeftIcon, shareIcon);
38
37
  registerAction({ id: 'NextRegion', defaultKeyBinding: 'F9' }, { id: 'PrevRegion', defaultKeyBinding: 'Shift+F9' }, { id: 'KeyboardCommands', defaultKeyBinding: 'CommandOrControl+/' });
39
- function TopNavDrawerProvider({ children }) {
40
- const [item, setItem] = useState(undefined);
41
- const [drawerOpen, setDrawerOpen] = useState(false);
42
- // Delay opening the drawer by one render pass after item is set.
43
- // The cosmos-core Drawer only fires onAfterOpen on a false→true open transition.
44
- // Batching setItem + setDrawerOpen(true) in the same event handler causes the
45
- // Drawer to mount with open=true from the start (no transition), so onAfterOpen
46
- // never fires and item.onDrawerOpen() (data fetching) is never called.
47
- // Setting drawerOpen in a separate useEffect gives the Drawer a proper transition.
48
- useEffect(() => {
49
- if (item)
50
- setDrawerOpen(true);
51
- }, [item]);
52
- const ctxValue = useMemo(() => ({
53
- drawerOpen,
54
- openItemName: item?.name,
55
- closeDrawer: () => setDrawerOpen(false),
56
- openDrawer: (next) => {
57
- // Spread to create a new object reference each time so useEffect([item])
58
- // always fires — even when the same item is re-opened after the drawer closes.
59
- setItem({ ...next });
60
- },
61
- refreshDrawer: (next) => {
62
- setItem({ ...next });
63
- }
64
- }), [drawerOpen, item?.name]);
65
- return (_jsxs(AppShellDrawerContext.Provider, { value: ctxValue, children: [children, item && (_jsx(AppShellDrawer, { drawerOpen: drawerOpen, setDrawerOpen: setDrawerOpen, content: item.drawerView, header: item.drawerHeader || item.name, onDrawerClose: () => {
66
- setItem(undefined);
67
- item.onDrawerClose?.();
68
- }, onDrawerOpen: item.onDrawerOpen }))] }));
69
- }
70
38
  const AppShell = forwardRef(function AppShell(props, ref) {
71
39
  const t = useI18n();
72
- const { appInfo, contextSwitcher, searchInput, appHeader, searchPage, searchLabel = t('sitewide'), caseTypes, links, agent, banners, progress, main, operator, utils, headerUtils, helpMenu, cases, defaultExpanded = false, collapsedHoverMenus = false, shareApp, navOrientation = 'side-rail', documentTabs, ...restProps } = props;
73
- const { disableScroll, enableScroll } = useScrollToggle();
40
+ const { appInfo, contextSwitcher, searchInput, appHeader, searchPage, searchLabel = t('sitewide'), caseTypes, links, agent, banners, progress, main, operator, utils, headerUtils, helpMenu, cases, defaultExpanded = false, collapsedHoverMenus = false, shareApp, portalSwitcher, navOrientation = 'side-rail', documentTabs, utilsList, ...restProps } = props;
41
+ const skipLinks = useMemo(() => [
42
+ {
43
+ label: t('go_to_main_content'),
44
+ target: { ariaLabel: t('main_content'), selector: 'main' }
45
+ }
46
+ ], [t]);
74
47
  const navRef = useConsolidatedRef(ref);
75
- const mobileButtonRef = useRef(null);
76
48
  const navId = useUID();
77
49
  const [expandCollapseEl, setExpandCollapseEl] = useElement();
78
- const [mobileNavOpen, setMobileNavOpen] = useState(false);
79
50
  const [drawerOpen, setDrawerOpen] = useState(false);
80
- const [mobileNavLinksCount, setMobileNavLinksCount] = useState(0);
81
51
  const { previewActive, setPreviewActive } = usePreviewManager();
82
52
  const focusedImperatively = useRef(false);
83
53
  const [headerEl, setHeaderEl] = useElement();
84
- const [mobileHeaderEl, setMobileHeaderEl] = useElement();
85
54
  const isSmallOrAbove = useBreakpoint('sm');
86
- // Narrow touch devices get the bottom nav; tablets and narrow non-touch desktops use the top bar.
87
- const showMobileNav = !isSmallOrAbove && isTouchDevice;
88
- const isTopBar = !showMobileNav && (isTouchDevice || navOrientation === 'top-bar' || !isSmallOrAbove);
55
+ const isTopBar = navOrientation === 'top-bar' || !isSmallOrAbove;
89
56
  const showAppHeader = isTopBar || (!!appHeader && isSmallOrAbove);
90
- const showMainContent = showAppHeader ? !!(headerEl || mobileHeaderEl) : true;
57
+ const showMainContent = showAppHeader ? !!headerEl : true;
91
58
  const openNavTimeoutId = useRef();
92
59
  const closeNavTimeoutId = useRef();
93
60
  const [searchContainerEl, setSearchContainerEl] = useState(null);
94
61
  const openKeyboardCommands = useKeyboardCommands();
95
- const theme = useTheme();
96
62
  const { state: sidebarNavState, set: setSidebarNavState } = useTransitionState({
97
63
  ref: navRef,
98
64
  property: 'width',
99
65
  states: openCloseStates,
100
66
  defaultState: defaultExpanded ? 'open' : 'closed'
101
67
  });
102
- const skipLinks = useMemo(() => [
103
- {
104
- label: t('go_to_main_content'),
105
- target: { ariaLabel: t('main_content'), selector: 'main' }
106
- }
107
- ], [t]);
108
68
  const openNav = useCallback((delay = 0) => {
109
69
  if (closeNavTimeoutId.current)
110
70
  clearTimeout(closeNavTimeoutId.current);
@@ -122,59 +82,6 @@ const AppShell = forwardRef(function AppShell(props, ref) {
122
82
  const onFocus = useCallback(() => {
123
83
  focusedImperatively.current = false;
124
84
  }, []);
125
- const mobileNavRef = useRef(null);
126
- useEffect(() => {
127
- const ac = new AbortController();
128
- window.navigation.addEventListener('navigate', () => {
129
- if (mobileNavOpen) {
130
- setMobileNavOpen(false);
131
- }
132
- }, {
133
- signal: ac.signal
134
- });
135
- return () => {
136
- ac.abort();
137
- };
138
- }, [mobileNavOpen]);
139
- useEffect(() => {
140
- if (mobileNavOpen) {
141
- disableScroll();
142
- }
143
- else {
144
- enableScroll();
145
- }
146
- }, [mobileNavOpen]);
147
- useEffect(() => {
148
- if (mobileNavOpen) {
149
- const onKeyDown = ({ key }) => {
150
- if (key === 'Escape')
151
- setMobileNavOpen(false);
152
- };
153
- document.addEventListener('keydown', onKeyDown);
154
- return () => {
155
- document.removeEventListener('keydown', onKeyDown);
156
- };
157
- }
158
- }, [mobileNavOpen]);
159
- useEffect(() => {
160
- if (isSmallOrAbove && mobileNavOpen)
161
- setMobileNavOpen(false);
162
- }, [isSmallOrAbove, mobileNavOpen]);
163
- useLayoutEffect(() => {
164
- if (!mobileHeaderEl)
165
- return;
166
- const resizeObserver = new ResizeObserver(debounce(() => {
167
- const screenWidth = document.documentElement.clientWidth;
168
- const regionsPaddingInlinePixels = 2 *
169
- Number.parseInt(window.getComputedStyle(mobileHeaderEl).getPropertyValue('padding-inline-start'), 10);
170
- const availableWidth = screenWidth * 0.9 - regionsPaddingInlinePixels;
171
- setMobileNavLinksCount(Math.max(Math.floor(availableWidth / menuButtonWidth(theme)) - (caseTypes?.length ? 2 : 1), 0));
172
- }, 0));
173
- resizeObserver.observe(document.documentElement);
174
- return () => {
175
- resizeObserver.disconnect();
176
- };
177
- }, [mobileHeaderEl, caseTypes?.length]);
178
85
  const activatedEl = useRef(document.body);
179
86
  useEvent('click', e => {
180
87
  activatedEl.current = document.elementFromPoint(e.clientX, e.clientY) ?? document.body;
@@ -215,9 +122,62 @@ const AppShell = forwardRef(function AppShell(props, ref) {
215
122
  useShortcut('KeyboardCommands', () => {
216
123
  openKeyboardCommands();
217
124
  });
125
+ const { start, end } = useDirection();
126
+ return (_jsxs(AppShellContext.Provider, { value: useMemo(() => ({
127
+ navOpen: sidebarNavState === 'open' || sidebarNavState === 'opening',
128
+ drawerOpen,
129
+ setDrawerOpen,
130
+ collapsedHoverMenus,
131
+ navState: sidebarNavState,
132
+ focusedImperatively,
133
+ headerEl,
134
+ appHeaderEl: headerEl ?? null,
135
+ searchContainerEl,
136
+ setSearchContainerEl,
137
+ isMobileNav: false,
138
+ isTopBar,
139
+ previewActive,
140
+ setPreviewActive
141
+ }), [
142
+ sidebarNavState,
143
+ drawerOpen,
144
+ collapsedHoverMenus,
145
+ isTopBar,
146
+ headerEl,
147
+ searchContainerEl,
148
+ previewActive
149
+ ]), children: [_jsx(SkipLinks, { items: skipLinks }), showAppHeader && (_jsx(AppHeader, { ...appInfo, contextSwitcher: contextSwitcher, searchInput: searchInput, searchLabel: searchLabel, operator: operator, headerUtils: headerUtils, helpMenu: helpMenu, searchPage: searchPage, shareApp: shareApp, portalSwitcher: portalSwitcher, ref: setHeaderEl })), isTopBar && (_jsx(TopNavDrawerProvider, { children: _jsx(AppTopNav, { appInfo: appInfo, links: links, caseTypes: caseTypes, cases: cases, agent: agent, utils: utils, searchInput: searchInput, searchPage: searchPage, searchLabel: searchLabel }) })), !isTopBar && isSmallOrAbove && (_jsxs(Flex, { ...restProps, container: {
150
+ direction: 'column',
151
+ justify: 'between'
152
+ }, id: navId, as: StyledSidebarNav, portalAgent: !!agent, ref: navRef, "data-app-region": true, onFocus: onFocus, "aria-label": t('app_shell_main_navigation_label'), children: [_jsx(AppNavigationPanel, { navState: sidebarNavState, appInfo: !showAppHeader ? appInfo : undefined, searchInput: !showAppHeader ? searchInput : undefined, searchLabel: searchLabel, caseTypes: caseTypes, links: links, cases: cases, utils: utilsList, onClick: () => {
153
+ if (['closing', 'closed'].includes(sidebarNavState)) {
154
+ openNav(0);
155
+ }
156
+ else {
157
+ closeNav(0);
158
+ }
159
+ }, agent: agent }), _jsxs(Flex, { container: { justify: 'center' }, children: [_jsx(StyledAppShellToggleButton, { icon: true, ref: setExpandCollapseEl, compact: true, variant: 'simple', onClick: () => {
160
+ setSidebarNavState(sidebarNavState === 'closed' ? 'open' : 'closed');
161
+ }, "aria-label": sidebarNavState === 'closed' ? t('expand_navigation') : t('collapse_navigation'), "aria-expanded": sidebarNavState === 'open' || sidebarNavState === 'opening', "aria-controls": navId, children: ['closed', 'closing'].includes(sidebarNavState) ? (_jsx(Icon, { name: `arrow-micro-${end}` })) : (_jsx(Icon, { name: `arrow-micro-${start}` })) }), ['open', 'closed'].includes(sidebarNavState) && (_jsx(Tooltip, { target: expandCollapseEl, placement: 'right', as: StyledAppShellTooltip, showDelay: 'none', hideDelay: 'none', children: sidebarNavState === 'closed' ? t('expand_navigation') : t('collapse_navigation') }))] })] })), showMainContent && (_jsxs(_Fragment, { children: [documentTabs && _jsx(DocumentTabs, { ...documentTabs }), (() => {
162
+ const mainRegion = (_jsxs(StyledAppMain, { previewActive: previewActive, isTopBar: isTopBar, "aria-busy": !!progress, "data-app-region": true, children: [_jsx(Progress, { visible: !!progress, placement: 'local', message: typeof progress === 'string' ? progress : t('loading') }), banners && _jsx(StyledBannerRegion, { children: banners }), main] }));
163
+ if (!documentTabs)
164
+ return mainRegion;
165
+ return (_jsx(StyledDocumentTabPanel, { role: 'tabpanel', id: documentTabs.currentTabId ? getTabPanelId(documentTabs.currentTabId) : undefined, "aria-labelledby": documentTabs.currentTabId ? getTabElementId(documentTabs.currentTabId) : undefined, tabIndex: 0, children: mainRegion }));
166
+ })()] })), _jsx(AppShellGlobalStyle, { isTopBar: isTopBar, showAppHeader: showAppHeader, isMobile: false, hasDocumentTabs: !!documentTabs, navOpen: sidebarNavState === 'open' || sidebarNavState === 'opening' })] }));
167
+ });
168
+ const AppShellMain = forwardRef(function AppShellMain(props, ref) {
169
+ const t = useI18n();
170
+ const navId = useUID();
171
+ const { appInfo, appHeader, contextSwitcher, searchPage, searchInput, searchLabel = t('sitewide'), caseTypes, links, cases, agent, utils, operator, headerUtils, helpMenu, shareApp, banners, progress, main, documentTabs, navOrientation = 'side-rail', ...restProps } = props;
172
+ const isSmallOrAbove = useBreakpoint('sm');
173
+ const isTopBar = navOrientation === 'top-bar' || !isSmallOrAbove;
174
+ const showAppHeader = isTouchDevice
175
+ ? isSmallOrAbove
176
+ : isTopBar || (!!appHeader && isSmallOrAbove);
177
+ const { themeMode, onThemeModeChange } = useThemeMode();
218
178
  const contextSwitcherUtilItem = useMemo(() => {
219
179
  const { contexts, onContextClick, label: contextSwitcherLabel = t('switch_to') } = contextSwitcher ?? {};
220
- if (!showAppHeader && contexts && contexts?.length > 1 && !!onContextClick) {
180
+ if (!showAppHeader && contexts && contexts.length > 1 && onContextClick) {
221
181
  return {
222
182
  name: contextSwitcherLabel,
223
183
  primary: contextSwitcherLabel,
@@ -227,18 +187,11 @@ const AppShell = forwardRef(function AppShell(props, ref) {
227
187
  primary: context.primary,
228
188
  'aria-current': !!context.selected,
229
189
  visual: context.visual,
230
- onClick: e => {
231
- onContextClick(context.id, e);
232
- }
190
+ onClick: e => onContextClick(context.id, e)
233
191
  })), singleSelect: true }))
234
192
  };
235
193
  }
236
- }, [
237
- showAppHeader,
238
- contextSwitcher?.contexts,
239
- contextSwitcher?.label,
240
- contextSwitcher?.onContextClick
241
- ]);
194
+ }, [contextSwitcher, showAppHeader, t]);
242
195
  const shareLabel = shareApp?.label ?? t('app_shell_share');
243
196
  const shareApplicationUtilItem = useMemo(() => {
244
197
  if (!showAppHeader && shareApp) {
@@ -249,7 +202,7 @@ const AppShell = forwardRef(function AppShell(props, ref) {
249
202
  onClick: shareApp.onClick
250
203
  };
251
204
  }
252
- }, [showAppHeader, shareApp, shareLabel]);
205
+ }, [shareApp, shareLabel, showAppHeader]);
253
206
  const operatorInfoUtilItem = useMemo(() => {
254
207
  if (!showAppHeader && operator) {
255
208
  return {
@@ -259,17 +212,14 @@ const AppShell = forwardRef(function AppShell(props, ref) {
259
212
  items: operator.actions
260
213
  };
261
214
  }
262
- }, [showAppHeader, operator]);
263
- const { themeMode, onThemeModeChange } = useThemeMode();
215
+ }, [operator, showAppHeader, t]);
264
216
  const themeSwitcherUtilItem = useMemo(() => {
265
217
  if (!showAppHeader && onThemeModeChange) {
266
- let currentThemeIcon = 'circle-mixed-left'; // default for system
267
- if (themeMode === 'dark') {
218
+ let currentThemeIcon = 'circle-mixed-left';
219
+ if (themeMode === 'dark')
268
220
  currentThemeIcon = 'moon';
269
- }
270
- else if (themeMode === 'light') {
221
+ else if (themeMode === 'light')
271
222
  currentThemeIcon = 'sun';
272
- }
273
223
  return {
274
224
  name: t('theme_mode'),
275
225
  primary: t('theme_mode'),
@@ -296,8 +246,7 @@ const AppShell = forwardRef(function AppShell(props, ref) {
296
246
  ]
297
247
  };
298
248
  }
299
- }, [showAppHeader, onThemeModeChange, themeMode]);
300
- const { start, end } = useDirection();
249
+ }, [onThemeModeChange, showAppHeader, t, themeMode]);
301
250
  const utilsList = useMemo(() => [
302
251
  ...(utils ?? []),
303
252
  ...(contextSwitcherUtilItem ? [contextSwitcherUtilItem] : []),
@@ -305,66 +254,16 @@ const AppShell = forwardRef(function AppShell(props, ref) {
305
254
  ...(operatorInfoUtilItem ? [operatorInfoUtilItem] : []),
306
255
  ...(themeSwitcherUtilItem ? [themeSwitcherUtilItem] : [])
307
256
  ], [
308
- utils,
309
257
  contextSwitcherUtilItem,
310
- shareApplicationUtilItem,
311
258
  operatorInfoUtilItem,
312
- themeSwitcherUtilItem
259
+ shareApplicationUtilItem,
260
+ themeSwitcherUtilItem,
261
+ utils
313
262
  ]);
314
- return (_jsxs(AppShellContext.Provider, { value: useMemo(() => ({
315
- navOpen: sidebarNavState === 'open' || sidebarNavState === 'opening' || mobileNavOpen,
316
- drawerOpen,
317
- setDrawerOpen,
318
- collapsedHoverMenus,
319
- navState: sidebarNavState,
320
- focusedImperatively,
321
- headerEl: headerEl || mobileHeaderEl,
322
- appHeaderEl: headerEl ?? null,
323
- searchContainerEl,
324
- setSearchContainerEl,
325
- isMobileNav: showMobileNav,
326
- isTopBar,
327
- previewActive,
328
- setPreviewActive
329
- }), [
330
- sidebarNavState,
331
- drawerOpen,
332
- mobileNavOpen,
333
- showMobileNav,
334
- isTopBar,
335
- headerEl,
336
- mobileHeaderEl,
337
- searchContainerEl,
338
- previewActive
339
- ]), children: [_jsx(SkipLinks, { items: skipLinks }), showAppHeader && (_jsx(AppHeader, { ...appInfo, contextSwitcher: contextSwitcher, searchInput: searchInput, searchLabel: searchLabel, operator: operator, headerUtils: headerUtils, helpMenu: helpMenu, searchPage: searchPage, shareApp: shareApp, ref: setHeaderEl })), isTopBar && (_jsx(TopNavDrawerProvider, { children: _jsx(AppTopNav, { appInfo: appInfo, links: links, caseTypes: caseTypes, cases: cases, agent: agent, utils: utils, searchInput: searchInput, searchPage: searchPage, searchLabel: searchLabel }) })), !isTopBar && isSmallOrAbove && (_jsxs(Flex, { ...restProps, container: {
340
- direction: 'column',
341
- justify: 'between'
342
- }, id: navId, as: StyledSidebarNav, portalAgent: !!agent, ref: navRef, "data-app-region": true, onFocus: onFocus, "aria-label": t('app_shell_main_navigation_label'), children: [_jsx(AppNavigationPanel, { navState: sidebarNavState, appInfo: !showAppHeader ? appInfo : undefined, searchInput: !showAppHeader ? searchInput : undefined, searchLabel: searchLabel, caseTypes: caseTypes, links: links, cases: cases, utils: utilsList, onClick: () => {
343
- if (['closing', 'closed'].includes(sidebarNavState)) {
344
- openNav(0);
345
- }
346
- else {
347
- closeNav(0);
348
- }
349
- }, agent: agent }), _jsxs(Flex, { container: { justify: 'center' }, children: [_jsx(StyledAppShellToggleButton, { icon: true, ref: setExpandCollapseEl, compact: true, variant: 'simple', onClick: () => {
350
- setSidebarNavState(sidebarNavState === 'closed' ? 'open' : 'closed');
351
- }, "aria-label": sidebarNavState === 'closed' ? t('expand_navigation') : t('collapse_navigation'), "aria-expanded": sidebarNavState === 'open' || sidebarNavState === 'opening', "aria-controls": navId, children: ['closed', 'closing'].includes(sidebarNavState) ? (_jsx(Icon, { name: `arrow-micro-${end}` })) : (_jsx(Icon, { name: `arrow-micro-${start}` })) }), ['open', 'closed'].includes(sidebarNavState) && (_jsx(Tooltip, { target: expandCollapseEl, placement: 'right', as: StyledAppShellTooltip, showDelay: 'none', hideDelay: 'none', children: sidebarNavState === 'closed' ? t('expand_navigation') : t('collapse_navigation') }))] })] })), showMobileNav && (_jsxs(_Fragment, { children: [_jsxs(Flex, { as: StyledMobileNav, container: { alignItems: 'center', gap: 0.25 }, ref: setMobileHeaderEl, "data-app-region": true, onClick: () => {
352
- setMobileNavOpen(false);
353
- }, children: [caseTypes && caseTypes.length > 0 && _jsx(CaseTypes, { caseTypes: caseTypes, mobileNavBar: true }), links && _jsx(Links, { links: links.slice(0, mobileNavLinksCount), mobileNavBar: true }), _jsxs(StyledMobileMoreMenuButton, { ref: mobileButtonRef, variant: 'simple', onClick: (e) => {
354
- setMobileNavOpen(prev => !prev);
355
- e.stopPropagation();
356
- }, label: t('app_shell_more'), icon: true, "aria-expanded": mobileNavOpen, "aria-controls": navId, children: [_jsx(Icon, { name: 'bars' }), !mobileNavOpen &&
357
- utils?.some(item => (isValidElement(item) ? false : !!item.count)) && (_jsx(Alert, { variant: 'urgent' })), _jsx("span", { children: t('app_shell_more') })] })] }), _jsx(Drawer, { open: mobileNavOpen, ref: mobileNavRef, onAfterClose: () => {
358
- setMobileNavOpen(false);
359
- }, position: 'fixed', placement: 'bottom', size: '100dvh', nullWhenClosed: true, children: _jsx(Flex, { ...restProps, container: {
360
- direction: 'column',
361
- justify: 'between'
362
- }, id: navId, as: StyledMobileMoreMenu, ref: ref, "aria-label": t('app_shell_main_navigation_label'), children: _jsx(AppNavigationPanel, { appInfo: appInfo, navState: 'open', searchInput: searchInput, searchLabel: searchLabel, links: links?.slice(mobileNavLinksCount), cases: cases, utils: utilsList, agent: agent }) }) })] })), showMainContent && (_jsxs(_Fragment, { children: [documentTabs && _jsx(DocumentTabs, { ...documentTabs }), (() => {
363
- const mainRegion = (_jsxs(StyledAppMain, { previewActive: previewActive, isTopBar: isTopBar, "aria-busy": !!progress, "data-app-region": true, children: [_jsx(Progress, { visible: !!progress, placement: 'local', message: typeof progress === 'string' ? progress : t('loading') }), banners && _jsx(StyledBannerRegion, { children: banners }), main] }));
364
- if (!documentTabs)
365
- return mainRegion;
366
- return (_jsx(StyledDocumentTabPanel, { role: 'tabpanel', id: documentTabs.currentTabId ? getTabPanelId(documentTabs.currentTabId) : undefined, "aria-labelledby": documentTabs.currentTabId ? getTabElementId(documentTabs.currentTabId) : undefined, tabIndex: 0, children: mainRegion }));
367
- })()] })), _jsx(AppShellGlobalStyle, { isTopBar: isTopBar, showAppHeader: showAppHeader, isMobile: showMobileNav, hasDocumentTabs: !!documentTabs, navOpen: sidebarNavState === 'open' || sidebarNavState === 'opening' || mobileNavOpen })] }));
263
+ if (isTouchDevice) {
264
+ return (_jsx(TouchAppShell, { appInfo: appInfo, appHeader: appHeader, contextSwitcher: contextSwitcher, searchPage: searchPage, searchInput: searchInput, searchLabel: searchLabel, caseTypes: caseTypes, links: links, cases: cases, agent: agent, utils: utils, utilsList: utilsList, operator: operator, headerUtils: headerUtils, helpMenu: helpMenu, shareApp: shareApp, banners: banners, progress: progress, main: main, documentTabs: documentTabs, navId: navId, restProps: restProps }));
265
+ }
266
+ return _jsx(AppShell, { ...props, utilsList: utilsList, ref: ref });
368
267
  });
369
- export default AppShell;
268
+ export default AppShellMain;
370
269
  //# sourceMappingURL=AppShell.js.map