@pega/cosmos-react-core 9.17.2 → 9.19.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.
- package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
- package/lib/components/AppShell/AppHeader.js +44 -7
- package/lib/components/AppShell/AppHeader.js.map +1 -1
- package/lib/components/AppShell/AppHeader.styles.d.ts +6 -2
- package/lib/components/AppShell/AppHeader.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppHeader.styles.js +36 -18
- package/lib/components/AppShell/AppHeader.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +28 -9
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShellContext.d.ts +1 -0
- package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
- package/lib/components/AppShell/AppShellContext.js +1 -0
- package/lib/components/AppShell/AppShellContext.js.map +1 -1
- package/lib/components/Dialog/InfoDialogWrapper.d.ts +4 -0
- package/lib/components/Dialog/InfoDialogWrapper.d.ts.map +1 -0
- package/lib/components/Dialog/InfoDialogWrapper.js +13 -0
- package/lib/components/Dialog/InfoDialogWrapper.js.map +1 -0
- package/lib/components/Dialog/TouchDialog.d.ts +5 -0
- package/lib/components/Dialog/TouchDialog.d.ts.map +1 -0
- package/lib/components/Dialog/TouchDialog.js +85 -0
- package/lib/components/Dialog/TouchDialog.js.map +1 -0
- package/lib/components/Dialog/TouchDialog.styles.d.ts +7 -0
- package/lib/components/Dialog/TouchDialog.styles.d.ts.map +1 -0
- package/lib/components/Dialog/TouchDialog.styles.js +62 -0
- package/lib/components/Dialog/TouchDialog.styles.js.map +1 -0
- package/lib/components/Dialog/TouchDialog.test-ids.d.ts +2 -0
- package/lib/components/Dialog/TouchDialog.test-ids.d.ts.map +1 -0
- package/lib/components/Dialog/TouchDialog.test-ids.js +3 -0
- package/lib/components/Dialog/TouchDialog.test-ids.js.map +1 -0
- package/lib/components/Dialog/TouchDialog.types.d.ts +42 -0
- package/lib/components/Dialog/TouchDialog.types.d.ts.map +1 -0
- package/lib/components/Dialog/TouchDialog.types.js +2 -0
- package/lib/components/Dialog/TouchDialog.types.js.map +1 -0
- package/lib/components/Dialog/TouchInfoDialog.d.ts +4 -0
- package/lib/components/Dialog/TouchInfoDialog.d.ts.map +1 -0
- package/lib/components/Dialog/TouchInfoDialog.js +14 -0
- package/lib/components/Dialog/TouchInfoDialog.js.map +1 -0
- package/lib/components/Dialog/index.d.ts +4 -1
- package/lib/components/Dialog/index.d.ts.map +1 -1
- package/lib/components/Dialog/index.js +3 -1
- package/lib/components/Dialog/index.js.map +1 -1
- package/lib/components/File/CompactList.js +1 -1
- package/lib/components/File/CompactList.js.map +1 -1
- package/lib/components/ListToolbar/PresetMenuPopover.d.ts.map +1 -1
- package/lib/components/ListToolbar/PresetMenuPopover.js +16 -5
- package/lib/components/ListToolbar/PresetMenuPopover.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +33 -7
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/MultiStepForm/HorizontalFormProgress.js +1 -1
- package/lib/components/MultiStepForm/HorizontalFormProgress.js.map +1 -1
- package/lib/components/ResponsiveActions/ResponsiveActions.d.ts.map +1 -1
- package/lib/components/ResponsiveActions/ResponsiveActions.js +1 -0
- package/lib/components/ResponsiveActions/ResponsiveActions.js.map +1 -1
- package/lib/components/TextArea/TextArea.d.ts.map +1 -1
- package/lib/components/TextArea/TextArea.js +7 -21
- package/lib/components/TextArea/TextArea.js.map +1 -1
- package/lib/components/TextArea/TextArea.styles.d.ts +0 -1
- package/lib/components/TextArea/TextArea.styles.d.ts.map +1 -1
- package/lib/components/TextArea/TextArea.styles.js +1 -2
- package/lib/components/TextArea/TextArea.styles.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +3 -0
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/i18n/default.d.ts +3 -0
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +5 -2
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +3 -0
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/theme/themes/aurigaDarkTheme.json +45 -58
- package/lib/theme/themes/aurigaTheme.json +40 -53
- package/lib/theme/themes/virgoTheme.json +3 -3
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js +1 -0
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/isTouchDevice.d.ts +3 -0
- package/lib/utils/isTouchDevice.d.ts.map +1 -0
- package/lib/utils/isTouchDevice.js +4 -0
- package/lib/utils/isTouchDevice.js.map +1 -0
- 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;
|
|
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,8 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useContext, useEffect, useMemo } from 'react';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
3
|
import Flex from '../Flex';
|
|
4
4
|
import Image from '../Image';
|
|
5
5
|
import Button from '../Button';
|
|
6
|
+
import Icon from '../Icon';
|
|
6
7
|
import SearchInput from '../SearchInput';
|
|
7
8
|
import { useBreakpoint, useElement, useI18n, useTheme } from '../../hooks';
|
|
8
9
|
import VisuallyHiddenText from '../VisuallyHiddenText';
|
|
@@ -11,7 +12,7 @@ import useThemeMode from '../../hooks/useThemeMode';
|
|
|
11
12
|
import MenuButton from '../MenuButton';
|
|
12
13
|
import AppShellOperator from './Operator';
|
|
13
14
|
import ContextSwitcher from './ContextSwitcher';
|
|
14
|
-
import { StyledAppHeader, StyledAppHeaderInfo, StyledAppHeaderSearchForm, StyledAppHeaderSpacer, StyledAppHeaderText, StyledAppHeaderOperator, StyledAppHeaderLogo } from './AppHeader.styles';
|
|
15
|
+
import { StyledAppHeader, StyledAppHeaderInfo, StyledAppHeaderName, StyledAppHeaderSearchForm, StyledAppHeaderSpacer, StyledAppHeaderText, StyledAppHeaderOperator, StyledAppHeaderLogo } from './AppHeader.styles';
|
|
15
16
|
import { StyledShareIcon } from './AppShell.styles';
|
|
16
17
|
import AppShellContext from './AppShellContext';
|
|
17
18
|
import { getHeaderTheme } from './style-utils';
|
|
@@ -19,10 +20,26 @@ import ThemeSwitcher from './ThemeSwitcher';
|
|
|
19
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
21
|
const t = useI18n();
|
|
21
22
|
const isMediumOrAbove = useBreakpoint('md');
|
|
23
|
+
const isSmallOrAbove = useBreakpoint('sm');
|
|
24
|
+
const [searchExpanded, setSearchExpanded] = useState(false);
|
|
22
25
|
const [searchContainer, setSearchContainer] = useElement();
|
|
23
|
-
const { drawerOpen, setSearchContainerEl } = useContext(AppShellContext);
|
|
26
|
+
const { drawerOpen, isTopBar, setSearchContainerEl } = useContext(AppShellContext);
|
|
27
|
+
const searchInputRef = useRef(null);
|
|
24
28
|
const theme = useTheme();
|
|
25
29
|
const headerTheme = useMemo(() => getHeaderTheme(theme), [theme]);
|
|
30
|
+
// Below `md` there's no room for the app/portal name side by side, so they stack into two rows.
|
|
31
|
+
const stacked = !isMediumOrAbove;
|
|
32
|
+
const searchCollapsible = !isMediumOrAbove || isTopBar;
|
|
33
|
+
const searchDisplay = (() => {
|
|
34
|
+
if (!searchExpanded)
|
|
35
|
+
return searchCollapsible ? 'icon' : undefined;
|
|
36
|
+
if (!isSmallOrAbove)
|
|
37
|
+
return 'fullWidth';
|
|
38
|
+
if (!isMediumOrAbove)
|
|
39
|
+
return 'grow';
|
|
40
|
+
return undefined;
|
|
41
|
+
})();
|
|
42
|
+
const searchTakeover = searchDisplay === 'fullWidth';
|
|
26
43
|
const shareLabel = shareApp?.label ?? t('app_shell_share');
|
|
27
44
|
useEffect(() => {
|
|
28
45
|
if (searchPage && searchContainer) {
|
|
@@ -32,13 +49,33 @@ const AppHeader = forwardRef(function AppHeader({ appName, contextSwitcher: { co
|
|
|
32
49
|
setSearchContainerEl(null);
|
|
33
50
|
}
|
|
34
51
|
}, [searchPage, searchContainer, setSearchContainerEl]);
|
|
52
|
+
// Auto-collapse back to the icon when focus leaves the search area, as long as nothing was typed.
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (!searchCollapsible || !searchExpanded || searchInput?.value || !searchContainer)
|
|
55
|
+
return undefined;
|
|
56
|
+
const handleFocusOut = (e) => {
|
|
57
|
+
const nextTarget = e.relatedTarget instanceof Node ? e.relatedTarget : null;
|
|
58
|
+
if (!searchInput?.value && !searchContainer.contains(nextTarget))
|
|
59
|
+
setSearchExpanded(false);
|
|
60
|
+
};
|
|
61
|
+
searchContainer.addEventListener('focusout', handleFocusOut);
|
|
62
|
+
return () => searchContainer.removeEventListener('focusout', handleFocusOut);
|
|
63
|
+
}, [searchCollapsible, searchExpanded, searchInput?.value, searchContainer]);
|
|
35
64
|
const { themeMode, onThemeModeChange } = useThemeMode();
|
|
36
65
|
let appInfoAs = 'div';
|
|
37
66
|
if (href)
|
|
38
67
|
appInfoAs = 'a';
|
|
39
|
-
return (_jsx(ThemeOverride, { theme: headerTheme, children: _jsxs(Flex, { as: StyledAppHeader, container: { alignItems: 'center', pad: 1 },
|
|
40
|
-
|
|
41
|
-
|
|
68
|
+
return (_jsx(ThemeOverride, { theme: headerTheme, children: _jsxs(Flex, { as: StyledAppHeader, container: { alignItems: 'center', pad: 1 }, stacked: stacked, drawerOpen: drawerOpen, ref: ref, children: [!searchTakeover && (_jsxs(_Fragment, { children: [contexts && contexts.length > 1 && onContextClick && (_jsx(ContextSwitcher, { contexts: contexts, onContextClick: onContextClick, label: contextSwitcherLabel })), _jsxs(Flex, { as: StyledAppHeaderInfo, container: { colGap: 0.5 }, item: { shrink: 1 }, centerLogo: !fullImageSrc, children: [_jsx(Flex, { container: { inline: true, alignItems: 'center' }, item: { shrink: 1 }, as: appInfoAs, href: href, onClick: href ? onClick : undefined, target: target, children: _jsxs(Flex, { container: { alignItems: 'center', gap: 1 }, item: { shrink: 1 }, children: [(fullImageSrc || imageSrc) && (_jsx(Flex, { container: { alignItems: 'center' }, item: { shrink: 0 }, as: StyledAppHeaderLogo, children: _jsx(Image, { src: fullImageSrc || imageSrc, alt: imageAltText ?? t('application_logo') }) })), _jsxs(StyledAppHeaderName, { stacked: stacked || appNameHidden, children: [_jsx(StyledAppHeaderText, { as: appNameHidden ? VisuallyHiddenText : 'span', variant: 'primary', children: appName }), portalName && (_jsx(StyledAppHeaderText, { variant: 'secondary', stacked: stacked || appNameHidden, children: portalName }))] })] }) }), headerUtils?.[0]] })] })), _jsxs(Flex, { item: { grow: 1 }, container: { justify: 'end' }, children: [searchInput ? (_jsx(StyledAppHeaderSearchForm, { ref: setSearchContainer, role: 'search', "aria-label": searchLabel, onSubmit: e => e.preventDefault(), searchDisplay: searchDisplay, children: !searchPage &&
|
|
69
|
+
(searchDisplay === 'icon' ? (_jsx(Button, { icon: true, variant: 'simple', label: t('search'), "aria-label": t('expand_search'), onClick: () => {
|
|
70
|
+
setSearchExpanded(true);
|
|
71
|
+
setTimeout(() => searchInputRef.current?.focus());
|
|
72
|
+
}, children: _jsx(Icon, { name: 'search' }) })) : (_jsx(SearchInput, { ...searchInput, ref: searchInputRef, onSearchSubmit: searchInput.onSearchSubmit &&
|
|
73
|
+
(value => {
|
|
74
|
+
searchInput.onSearchSubmit?.(value);
|
|
75
|
+
setSearchExpanded(false);
|
|
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
|
+
items: helpMenu
|
|
78
|
+
} })), shareApp && (_jsx(Button, { variant: 'secondary', compact: true, 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 })] }))] }) }));
|
|
42
79
|
});
|
|
43
80
|
export default AppHeader;
|
|
44
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,OAAO,CAAC;AAGn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ffect, useMemo } from 'react';\nimport type { FunctionComponent, Ref, ElementType } from 'react';\n\nimport Flex from '../Flex';\nimport Image from '../Image';\nimport Button from '../Button';\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 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 [searchContainer, setSearchContainer] = useElement<HTMLElement>();\n const { drawerOpen, setSearchContainerEl } = useContext(AppShellContext);\n const theme = useTheme();\n const headerTheme = useMemo(() => getHeaderTheme(theme), [theme]);\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 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 hideTitle={!isMediumOrAbove}\n drawerOpen={drawerOpen}\n ref={ref}\n >\n {contexts && contexts.length > 1 && onContextClick && (\n <ContextSwitcher\n contexts={contexts}\n onContextClick={onContextClick}\n label={contextSwitcherLabel}\n />\n )}\n\n <Flex as={StyledAppHeaderInfo} container={{ colGap: 0.5 }} centerLogo={!fullImageSrc}>\n <Flex\n container={{ inline: true, alignItems: 'center' }}\n as={appInfoAs}\n href={href}\n onClick={href ? onClick : undefined}\n target={target}\n >\n <Flex container={{ alignItems: 'center', gap: 1 }}>\n {(fullImageSrc || imageSrc) && (\n <Flex container={{ alignItems: 'center' }} as={StyledAppHeaderLogo}>\n <Image\n src={fullImageSrc || imageSrc}\n alt={imageAltText ?? t('application_logo')}\n />\n </Flex>\n )}\n <div>\n <StyledAppHeaderText\n as={appNameHidden || !isMediumOrAbove ? VisuallyHiddenText : 'span'}\n variant='primary'\n >\n {appName}\n </StyledAppHeaderText>\n {portalName && (\n <StyledAppHeaderText\n as={!isMediumOrAbove ? VisuallyHiddenText : 'span'}\n variant='secondary'\n >\n {portalName}\n </StyledAppHeaderText>\n )}\n </div>\n </Flex>\n </Flex>\n {headerUtils?.[0]}\n </Flex>\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 isMediumOrAbove={isMediumOrAbove}\n >\n {!searchPage && <SearchInput {...searchInput} />}\n </StyledAppHeaderSearchForm>\n ) : (\n <StyledAppHeaderSpacer />\n )}\n {headerUtils?.[1]}\n </Flex>\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' compact 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 </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,EACnB,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB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C,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 }: 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' compact 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"]}
|
|
@@ -4,18 +4,22 @@ export declare const StyledAppHeaderInfo: import("styled-components/dist/types")
|
|
|
4
4
|
centerLogo: boolean;
|
|
5
5
|
}>> & string;
|
|
6
6
|
export declare const StyledAppHeaderSearchForm: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, {
|
|
7
|
-
|
|
7
|
+
searchDisplay?: "icon" | "grow" | "fullWidth";
|
|
8
8
|
}>> & string;
|
|
9
9
|
export declare const StyledAppHeaderSpacer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
10
10
|
export declare const StyledAppHeaderLogo: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
11
|
+
export declare const StyledAppHeaderName: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
12
|
+
stacked?: boolean;
|
|
13
|
+
}>> & string;
|
|
11
14
|
export declare const StyledAppHeaderText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<Omit<Omit<TextProps, "ref"> & import("react").RefAttributes<HTMLHeadingElement | HTMLSpanElement> & import("../..").ForwardProps, "ref"> & {
|
|
12
15
|
ref?: ((instance: HTMLHeadingElement | HTMLSpanElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLHeadingElement | HTMLSpanElement> | null | undefined;
|
|
13
16
|
}, {
|
|
14
17
|
variant: TextProps["variant"];
|
|
18
|
+
stacked?: boolean;
|
|
15
19
|
}>> & string & Omit<import("../..").ForwardRefForwardPropsComponent<TextProps>, keyof import("react").Component<any, {}, any>>;
|
|
16
20
|
export declare const StyledAppHeaderOperator: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
17
21
|
export declare const StyledAppHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {
|
|
18
|
-
|
|
22
|
+
stacked: boolean;
|
|
19
23
|
drawerOpen: boolean;
|
|
20
24
|
}>> & string;
|
|
21
25
|
//# sourceMappingURL=AppHeader.styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppHeader.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.styles.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"AppHeader.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.styles.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIzC,eAAO,MAAM,qBAAqB,6NAIhC,CAAC;AAIH,eAAO,MAAM,mBAAmB;gBAA4B,OAAO;YA2BjE,CAAC;AAIH,eAAO,MAAM,yBAAyB;oBACpB,MAAM,GAAG,MAAM,GAAG,WAAW;YAqF9C,CAAC;AAIF,eAAO,MAAM,qBAAqB,6NAEjC,CAAC;AAEF,eAAO,MAAM,mBAAmB,6NAI9B,CAAC;AAIH,eAAO,MAAM,mBAAmB;cAA0B,OAAO;YAQhE,CAAC;AAGF,eAAO,MAAM,mBAAmB;;;aACrB,SAAS,CAAC,SAAS,CAAC;cACnB,OAAO;8HAwCjB,CAAC;AAIH,eAAO,MAAM,uBAAuB,yOAQnC,CAAC;AAIF,eAAO,MAAM,eAAe;aAA4B,OAAO;gBAAc,OAAO;YAkEnF,CAAC"}
|
|
@@ -9,7 +9,6 @@ import { StyledPopover } from '../Popover';
|
|
|
9
9
|
import { StyledSearchInput } from '../SearchInput';
|
|
10
10
|
import { StyledSearchButton, StyledSearchFiltersButton, StyledSearchTextInput } from '../SearchInput/SearchInput.styles';
|
|
11
11
|
import Text from '../Text';
|
|
12
|
-
import { StyledVisuallyHiddenText } from '../VisuallyHiddenText/VisuallyHiddenText';
|
|
13
12
|
import { headerHeight, navWidth } from './AppShell.styles';
|
|
14
13
|
export const StyledContextSwitcher = styled.div(({ theme }) => {
|
|
15
14
|
return css `
|
|
@@ -46,7 +45,7 @@ export const StyledAppHeaderInfo = styled.div(({ centerLogo, theme }) => {
|
|
|
46
45
|
`;
|
|
47
46
|
});
|
|
48
47
|
StyledAppHeaderInfo.defaultProps = defaultThemeProp;
|
|
49
|
-
export const StyledAppHeaderSearchForm = styled.form(({
|
|
48
|
+
export const StyledAppHeaderSearchForm = styled.form(({ searchDisplay, theme: { base: { animation }, components: { 'app-shell': { header }, input } } }) => {
|
|
50
49
|
const { background: headerBg, 'search-input': { 'background-color': searchInputBg, 'foreground-color': searchInputFg, 'border-color': searchInputBorder } } = header;
|
|
51
50
|
const searchBg = searchInputBg;
|
|
52
51
|
const searchFg = calculateForegroundColor(headerBg, searchInputFg);
|
|
@@ -64,16 +63,28 @@ export const StyledAppHeaderSearchForm = styled.form(({ isMediumOrAbove, theme:
|
|
|
64
63
|
color: ${transparentize(0.4, searchFg)};
|
|
65
64
|
}
|
|
66
65
|
|
|
67
|
-
${
|
|
66
|
+
${searchDisplay === 'icon' &&
|
|
68
67
|
css `
|
|
69
|
-
max-width:
|
|
70
|
-
min-width:
|
|
68
|
+
max-width: ${input.height};
|
|
69
|
+
min-width: ${input.height};
|
|
70
|
+
width: auto;
|
|
71
71
|
margin-inline-start: auto;
|
|
72
|
+
margin-inline-end: 0;
|
|
73
|
+
`}
|
|
72
74
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
${searchDisplay === 'grow' &&
|
|
76
|
+
css `
|
|
77
|
+
flex-grow: 1;
|
|
78
|
+
max-width: 100%;
|
|
79
|
+
margin-inline-end: 0;
|
|
80
|
+
`}
|
|
81
|
+
|
|
82
|
+
${searchDisplay === 'fullWidth' &&
|
|
83
|
+
css `
|
|
84
|
+
max-width: 100%;
|
|
85
|
+
margin-inline-end: 0;
|
|
76
86
|
`}
|
|
87
|
+
|
|
77
88
|
&:not([focused]) {
|
|
78
89
|
${StyledSearchInput} {
|
|
79
90
|
background: ${searchBg};
|
|
@@ -109,7 +120,16 @@ export const StyledAppHeaderLogo = styled.div(({ theme }) => {
|
|
|
109
120
|
`;
|
|
110
121
|
});
|
|
111
122
|
StyledAppHeaderLogo.defaultProps = defaultThemeProp;
|
|
112
|
-
|
|
123
|
+
// Shrinks the app/portal name for ellipsis truncation; stacks vertically below `md` where there's no room for both names side by side.
|
|
124
|
+
export const StyledAppHeaderName = styled.div(({ theme, stacked }) => css `
|
|
125
|
+
display: flex;
|
|
126
|
+
flex-direction: ${stacked ? 'column' : 'row'};
|
|
127
|
+
align-items: ${stacked ? 'stretch' : 'baseline'};
|
|
128
|
+
gap: ${stacked ? 0 : theme.base.spacing};
|
|
129
|
+
min-width: 0;
|
|
130
|
+
`);
|
|
131
|
+
StyledAppHeaderName.defaultProps = defaultThemeProp;
|
|
132
|
+
export const StyledAppHeaderText = styled(Text)(({ theme, variant, stacked }) => {
|
|
113
133
|
const headerBg = theme.components['app-shell'].header.background;
|
|
114
134
|
const headerFgColor = theme.components['app-shell'].header['foreground-color'];
|
|
115
135
|
const foregroundColor = theme.components['app-shell'].header['app-name-color'] === 'auto'
|
|
@@ -118,6 +138,9 @@ export const StyledAppHeaderText = styled(Text)(({ theme, variant }) => {
|
|
|
118
138
|
const secondaryColor = tryCatch(() => rgba(foregroundColor ?? theme.base.palette['foreground-color'], theme.base.transparency['transparent-2']));
|
|
119
139
|
const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);
|
|
120
140
|
return css `
|
|
141
|
+
display: inline-block;
|
|
142
|
+
max-width: 100%;
|
|
143
|
+
min-width: 0;
|
|
121
144
|
text-overflow: ellipsis;
|
|
122
145
|
overflow: hidden;
|
|
123
146
|
white-space: nowrap;
|
|
@@ -132,13 +155,8 @@ export const StyledAppHeaderText = styled(Text)(({ theme, variant }) => {
|
|
|
132
155
|
|
|
133
156
|
${variant === 'secondary' &&
|
|
134
157
|
css `
|
|
135
|
-
display: inline;
|
|
136
158
|
font-size: ${fontSize};
|
|
137
|
-
align-self: flex-end;
|
|
138
|
-
|
|
139
|
-
&:not(${StyledVisuallyHiddenText}) + & {
|
|
140
|
-
margin-inline-start: ${theme.base.spacing};
|
|
141
|
-
}
|
|
159
|
+
align-self: ${stacked ? 'flex-start' : 'flex-end'};
|
|
142
160
|
`}
|
|
143
161
|
`;
|
|
144
162
|
});
|
|
@@ -151,7 +169,7 @@ export const StyledAppHeaderOperator = styled.button(({ theme }) => css `
|
|
|
151
169
|
}
|
|
152
170
|
`);
|
|
153
171
|
StyledAppHeaderOperator.defaultProps = defaultThemeProp;
|
|
154
|
-
export const StyledAppHeader = styled.header(({
|
|
172
|
+
export const StyledAppHeader = styled.header(({ stacked, drawerOpen, theme }) => {
|
|
155
173
|
const headerBg = theme.components['app-shell'].header.background;
|
|
156
174
|
const headerFgColor = theme.components['app-shell'].header['foreground-color'];
|
|
157
175
|
const foregroundColor = calculateForegroundColor(headerBg, headerFgColor);
|
|
@@ -175,9 +193,9 @@ export const StyledAppHeader = styled.header(({ hideTitle, drawerOpen, theme })
|
|
|
175
193
|
justify-self: flex-start;
|
|
176
194
|
min-width: 33vw;
|
|
177
195
|
|
|
178
|
-
${
|
|
196
|
+
${stacked &&
|
|
179
197
|
css `
|
|
180
|
-
min-width:
|
|
198
|
+
min-width: 0;
|
|
181
199
|
`}
|
|
182
200
|
}
|
|
183
201
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppHeader.styles.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,wBAAwB,EAEzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC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AAS,CAAC,CAAC,QAAQ;QAC5C,UAAU;QACZ,GAAG,CAAA;wBACe,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ;OAC/C;;aAEM,KAAK,CAAC,IAAI,CAAC,OAAO;;gBAEf,YAAY;oBACR,QAAQ;eACb,eAAe;uCACS,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC;;QAEnF,mBAAmB;;;;UAIjB,SAAS;QACX,GAAG,CAAA;;SAEF;;;QAGD,yBAAyB;iBAChB,eAAe;;;UAGtB,uBAAuB;;;YAGrB,aAAa;;YAEb,uBAAuB;0BACT,QAAQ;;;YAGtB,uBAAuB;qBACd,eAAe;;;;;uBAKb,WAAW,CAAC,UAAU;kCACX,WAAW,CAAC,UAAU;;;;;KAKnD,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import { mix, rgba, transparentize } from 'polished';\nimport styled, { css } from 'styled-components';\n\nimport {\n calculateFontSize,\n getHoverColors,\n calculateForegroundColor,\n type FontSize\n} from '../../styles';\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport { StyledImage } from '../Image';\nimport { StyledMenuListContainer } from '../Menu/Menu.styles';\nimport { StyledPopover } from '../Popover';\nimport { StyledSearchInput } from '../SearchInput';\nimport {\n StyledSearchButton,\n StyledSearchFiltersButton,\n StyledSearchTextInput\n} from '../SearchInput/SearchInput.styles';\nimport Text from '../Text';\nimport type { TextProps } from '../Text';\nimport { StyledVisuallyHiddenText } from '../VisuallyHiddenText/VisuallyHiddenText';\n\nimport { headerHeight, navWidth } from './AppShell.styles';\n\nexport const StyledContextSwitcher = styled.div(({ theme }) => {\n return css`\n width: calc(${navWidth} - 2 * ${theme.base.spacing});\n `;\n});\n\nStyledContextSwitcher.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderInfo = styled.div<{ centerLogo: boolean }>(({ centerLogo, theme }) => {\n return css`\n & > :first-child {\n vertical-align: top;\n }\n\n & > :is(a, button) {\n cursor: pointer;\n text-decoration: none;\n user-select: none;\n -webkit-user-select: none;\n }\n\n & > :is(a, button):focus-visible {\n box-shadow: ${theme.base.shadow.focus};\n outline: none;\n }\n\n ${StyledImage} {\n height: 1.0725rem;\n\n ${centerLogo &&\n css`\n padding-inline-start: ${theme.base.spacing};\n `}\n }\n `;\n});\n\nStyledAppHeaderInfo.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderSearchForm = styled.form<{ isMediumOrAbove: boolean }>(\n ({\n isMediumOrAbove,\n theme: {\n base: { animation },\n components: {\n 'app-shell': { header }\n }\n }\n }) => {\n const {\n background: headerBg,\n 'search-input': {\n 'background-color': searchInputBg,\n 'foreground-color': searchInputFg,\n 'border-color': searchInputBorder\n }\n } = header;\n\n const searchBg = searchInputBg;\n const searchFg = calculateForegroundColor(headerBg, searchInputFg);\n const searchBorder = calculateForegroundColor(headerBg, searchInputBorder);\n\n return css`\n max-width: 33vw;\n min-width: 10rem;\n width: 100%;\n justify-self: center;\n margin-inline-start: 0;\n margin-inline-end: auto;\n transition: max-width ${animation.speed} ${animation.timing.ease};\n\n ${StyledSearchInput} input::placeholder {\n color: ${transparentize(0.4, searchFg)};\n }\n\n ${!isMediumOrAbove &&\n css`\n max-width: 75%;\n min-width: 2rem;\n margin-inline-start: auto;\n\n &:focus-within {\n min-width: 10rem;\n }\n `}\n &:not([focused]) {\n ${StyledSearchInput} {\n background: ${searchBg};\n border-color: ${searchBorder};\n ${StyledSearchButton} {\n background: ${searchBg};\n color: ${searchFg};\n border-color: ${searchBorder};\n }\n\n ${StyledSearchTextInput} {\n background: ${searchBg};\n color: ${searchFg};\n border-color: ${searchBorder};\n }\n\n ${StyledSearchFiltersButton} {\n background: ${searchBg};\n color: ${searchFg};\n border-color: ${searchBorder};\n }\n }\n }\n `;\n }\n);\n\nStyledAppHeaderSearchForm.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderSpacer = styled.div`\n margin: auto;\n`;\n\nexport const StyledAppHeaderLogo = styled.div(({ theme }) => {\n return css`\n max-width: min(${theme.base['content-width'].sm}, 25vw);\n `;\n});\nStyledAppHeaderLogo.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderText = styled(Text)<{ variant: TextProps['variant'] }>(({\n theme,\n variant\n}) => {\n const headerBg = theme.components['app-shell'].header.background;\n const headerFgColor = theme.components['app-shell'].header['foreground-color'];\n\n const foregroundColor =\n theme.components['app-shell'].header['app-name-color'] === 'auto'\n ? calculateForegroundColor(headerBg, headerFgColor)\n : theme.components['app-shell'].header['app-name-color'];\n\n const secondaryColor = tryCatch(() =>\n rgba(\n foregroundColor ?? theme.base.palette['foreground-color'],\n theme.base.transparency['transparent-2']\n )\n );\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n color: ${variant === 'secondary' ? secondaryColor : foregroundColor};\n font-family: ${theme.components.text['brand-primary']['font-family']};\n\n ${variant === 'primary' &&\n css`\n font-size: ${fontSize[theme.components.text['brand-primary']['font-size'] as FontSize]};\n font-weight: ${theme.components.text['brand-primary']['font-weight']};\n `}\n\n ${variant === 'secondary' &&\n css`\n display: inline;\n font-size: ${fontSize};\n align-self: flex-end;\n\n &:not(${StyledVisuallyHiddenText}) + & {\n margin-inline-start: ${theme.base.spacing};\n }\n `}\n `;\n});\n\nStyledAppHeaderText.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderOperator = styled.button(\n ({ theme }) => css`\n border-radius: 50%;\n\n :focus-visible {\n box-shadow: ${theme.base.shadow.focus};\n }\n `\n);\n\nStyledAppHeaderOperator.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeader = styled.header<{ hideTitle: boolean; drawerOpen: boolean }>(\n ({ hideTitle, drawerOpen, theme }) => {\n const headerBg = theme.components['app-shell'].header.background;\n const headerFgColor = theme.components['app-shell'].header['foreground-color'];\n\n const foregroundColor = calculateForegroundColor(headerBg, headerFgColor);\n\n const hoverColors = getHoverColors(\n tryCatch(\n () => mix(0.01, theme.base.palette.interactive, headerBg),\n () => theme.base.palette.interactive\n )\n );\n\n return css`\n position: sticky;\n z-index: calc(${theme.base['z-index'].backdrop} - 1);\n ${drawerOpen &&\n css`\n z-index: calc(${theme.base['z-index'].backdrop} - 2);\n `}\n top: var(--appshell-hard-top-offset, 0);\n gap: ${theme.base.spacing};\n max-width: 100%;\n height: ${headerHeight};\n background: ${headerBg};\n color: ${foregroundColor};\n border-bottom: solid 0.0625rem ${theme.components['app-shell'].header['border-color']};\n\n ${StyledAppHeaderInfo} {\n justify-self: flex-start;\n min-width: 33vw;\n\n ${hideTitle &&\n css`\n min-width: fit-content;\n `}\n }\n\n ${StyledSearchFiltersButton} {\n color: ${foregroundColor};\n }\n\n > ${StyledAppHeaderOperator} {\n justify-self: flex-end;\n\n + ${StyledPopover} {\n &,\n ${StyledMenuListContainer} {\n background: ${headerBg};\n }\n\n ${StyledMenuListContainer} li {\n color: ${foregroundColor};\n background-color: transparent;\n\n &:hover,\n &[data-current='true'] {\n color: ${hoverColors.foreground};\n background-color: ${hoverColors.background};\n }\n }\n }\n }\n `;\n }\n);\n\nStyledAppHeader.defaultProps = defaultThemeProp;\n"]}
|
|
1
|
+
{"version":3,"file":"AppHeader.styles.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,wBAAwB,EAEzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,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C,CAAC,MAAM,CAAC,UAAU,CAAC;IACjE,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAE/E,MAAM,eAAe,GAAG,wBAAwB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IAE1E,MAAM,WAAW,GAAG,cAAc,CAChC,QAAQ,CACN,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,EACzD,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CACrC,CACF,CAAC;IAEF,OAAO,GAAG,CAAA;;sBAEQ,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ;QAC5C,UAAU;QACZ,GAAG,CAAA;wBACe,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ;OAC/C;;aAEM,KAAK,CAAC,IAAI,CAAC,OAAO;;gBAEf,YAAY;oBACR,QAAQ;eACb,eAAe;uCACS,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC;;QAEnF,mBAAmB;;;;UAIjB,OAAO;QACT,GAAG,CAAA;;SAEF;;;QAGD,yBAAyB;iBAChB,eAAe;;;UAGtB,uBAAuB;;;YAGrB,aAAa;;YAEb,uBAAuB;0BACT,QAAQ;;;YAGtB,uBAAuB;qBACd,eAAe;;;;;uBAKb,WAAW,CAAC,UAAU;kCACX,WAAW,CAAC,UAAU;;;;;KAKnD,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import { mix, rgba, transparentize } from 'polished';\nimport styled, { css } from 'styled-components';\n\nimport {\n calculateFontSize,\n getHoverColors,\n calculateForegroundColor,\n type FontSize\n} from '../../styles';\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport { StyledImage } from '../Image';\nimport { StyledMenuListContainer } from '../Menu/Menu.styles';\nimport { StyledPopover } from '../Popover';\nimport { StyledSearchInput } from '../SearchInput';\nimport {\n StyledSearchButton,\n StyledSearchFiltersButton,\n StyledSearchTextInput\n} from '../SearchInput/SearchInput.styles';\nimport Text from '../Text';\nimport type { TextProps } from '../Text';\n\nimport { headerHeight, navWidth } from './AppShell.styles';\n\nexport const StyledContextSwitcher = styled.div(({ theme }) => {\n return css`\n width: calc(${navWidth} - 2 * ${theme.base.spacing});\n `;\n});\n\nStyledContextSwitcher.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderInfo = styled.div<{ centerLogo: boolean }>(({ centerLogo, theme }) => {\n return css`\n & > :first-child {\n vertical-align: top;\n }\n\n & > :is(a, button) {\n cursor: pointer;\n text-decoration: none;\n user-select: none;\n -webkit-user-select: none;\n }\n\n & > :is(a, button):focus-visible {\n box-shadow: ${theme.base.shadow.focus};\n outline: none;\n }\n\n ${StyledImage} {\n height: 1.0725rem;\n\n ${centerLogo &&\n css`\n padding-inline-start: ${theme.base.spacing};\n `}\n }\n `;\n});\n\nStyledAppHeaderInfo.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderSearchForm = styled.form<{\n searchDisplay?: 'icon' | 'grow' | 'fullWidth';\n}>(\n ({\n searchDisplay,\n theme: {\n base: { animation },\n components: {\n 'app-shell': { header },\n input\n }\n }\n }) => {\n const {\n background: headerBg,\n 'search-input': {\n 'background-color': searchInputBg,\n 'foreground-color': searchInputFg,\n 'border-color': searchInputBorder\n }\n } = header;\n\n const searchBg = searchInputBg;\n const searchFg = calculateForegroundColor(headerBg, searchInputFg);\n const searchBorder = calculateForegroundColor(headerBg, searchInputBorder);\n\n return css`\n max-width: 33vw;\n min-width: 10rem;\n width: 100%;\n justify-self: center;\n margin-inline-start: 0;\n margin-inline-end: auto;\n transition: max-width ${animation.speed} ${animation.timing.ease};\n\n ${StyledSearchInput} input::placeholder {\n color: ${transparentize(0.4, searchFg)};\n }\n\n ${searchDisplay === 'icon' &&\n css`\n max-width: ${input.height};\n min-width: ${input.height};\n width: auto;\n margin-inline-start: auto;\n margin-inline-end: 0;\n `}\n\n ${searchDisplay === 'grow' &&\n css`\n flex-grow: 1;\n max-width: 100%;\n margin-inline-end: 0;\n `}\n\n ${searchDisplay === 'fullWidth' &&\n css`\n max-width: 100%;\n margin-inline-end: 0;\n `}\n\n &:not([focused]) {\n ${StyledSearchInput} {\n background: ${searchBg};\n border-color: ${searchBorder};\n ${StyledSearchButton} {\n background: ${searchBg};\n color: ${searchFg};\n border-color: ${searchBorder};\n }\n\n ${StyledSearchTextInput} {\n background: ${searchBg};\n color: ${searchFg};\n border-color: ${searchBorder};\n }\n\n ${StyledSearchFiltersButton} {\n background: ${searchBg};\n color: ${searchFg};\n border-color: ${searchBorder};\n }\n }\n }\n `;\n }\n);\n\nStyledAppHeaderSearchForm.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderSpacer = styled.div`\n margin: auto;\n`;\n\nexport const StyledAppHeaderLogo = styled.div(({ theme }) => {\n return css`\n max-width: min(${theme.base['content-width'].sm}, 25vw);\n `;\n});\nStyledAppHeaderLogo.defaultProps = defaultThemeProp;\n\n// Shrinks the app/portal name for ellipsis truncation; stacks vertically below `md` where there's no room for both names side by side.\nexport const StyledAppHeaderName = styled.div<{ stacked?: boolean }>(\n ({ theme, stacked }) => css`\n display: flex;\n flex-direction: ${stacked ? 'column' : 'row'};\n align-items: ${stacked ? 'stretch' : 'baseline'};\n gap: ${stacked ? 0 : theme.base.spacing};\n min-width: 0;\n `\n);\nStyledAppHeaderName.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderText = styled(Text)<{\n variant: TextProps['variant'];\n stacked?: boolean;\n}>(({ theme, variant, stacked }) => {\n const headerBg = theme.components['app-shell'].header.background;\n const headerFgColor = theme.components['app-shell'].header['foreground-color'];\n\n const foregroundColor =\n theme.components['app-shell'].header['app-name-color'] === 'auto'\n ? calculateForegroundColor(headerBg, headerFgColor)\n : theme.components['app-shell'].header['app-name-color'];\n\n const secondaryColor = tryCatch(() =>\n rgba(\n foregroundColor ?? theme.base.palette['foreground-color'],\n theme.base.transparency['transparent-2']\n )\n );\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n display: inline-block;\n max-width: 100%;\n min-width: 0;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n color: ${variant === 'secondary' ? secondaryColor : foregroundColor};\n font-family: ${theme.components.text['brand-primary']['font-family']};\n\n ${variant === 'primary' &&\n css`\n font-size: ${fontSize[theme.components.text['brand-primary']['font-size'] as FontSize]};\n font-weight: ${theme.components.text['brand-primary']['font-weight']};\n `}\n\n ${variant === 'secondary' &&\n css`\n font-size: ${fontSize};\n align-self: ${stacked ? 'flex-start' : 'flex-end'};\n `}\n `;\n});\n\nStyledAppHeaderText.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderOperator = styled.button(\n ({ theme }) => css`\n border-radius: 50%;\n\n :focus-visible {\n box-shadow: ${theme.base.shadow.focus};\n }\n `\n);\n\nStyledAppHeaderOperator.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeader = styled.header<{ stacked: boolean; drawerOpen: boolean }>(\n ({ stacked, drawerOpen, theme }) => {\n const headerBg = theme.components['app-shell'].header.background;\n const headerFgColor = theme.components['app-shell'].header['foreground-color'];\n\n const foregroundColor = calculateForegroundColor(headerBg, headerFgColor);\n\n const hoverColors = getHoverColors(\n tryCatch(\n () => mix(0.01, theme.base.palette.interactive, headerBg),\n () => theme.base.palette.interactive\n )\n );\n\n return css`\n position: sticky;\n z-index: calc(${theme.base['z-index'].backdrop} - 1);\n ${drawerOpen &&\n css`\n z-index: calc(${theme.base['z-index'].backdrop} - 2);\n `}\n top: var(--appshell-hard-top-offset, 0);\n gap: ${theme.base.spacing};\n max-width: 100%;\n height: ${headerHeight};\n background: ${headerBg};\n color: ${foregroundColor};\n border-bottom: solid 0.0625rem ${theme.components['app-shell'].header['border-color']};\n\n ${StyledAppHeaderInfo} {\n justify-self: flex-start;\n min-width: 33vw;\n\n ${stacked &&\n css`\n min-width: 0;\n `}\n }\n\n ${StyledSearchFiltersButton} {\n color: ${foregroundColor};\n }\n\n > ${StyledAppHeaderOperator} {\n justify-self: flex-end;\n\n + ${StyledPopover} {\n &,\n ${StyledMenuListContainer} {\n background: ${headerBg};\n }\n\n ${StyledMenuListContainer} li {\n color: ${foregroundColor};\n background-color: transparent;\n\n &:hover,\n &[data-current='true'] {\n color: ${hoverColors.foreground};\n background-color: ${hoverColors.background};\n }\n }\n }\n }\n `;\n }\n);\n\nStyledAppHeader.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.tsx"],"names":[],"mappings":"
|
|
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;AA8ErE,QAAA,MAAM,QAAQ,0GAojBZ,CAAC;AAEH,eAAe,QAAQ,CAAC"}
|
|
@@ -13,13 +13,13 @@ import * as sunIcon from '../Icon/icons/sun.icon';
|
|
|
13
13
|
import * as moonIcon from '../Icon/icons/moon.icon';
|
|
14
14
|
import * as circleMixedLeftIcon from '../Icon/icons/circle-mixed-left.icon';
|
|
15
15
|
import * as shareIcon from '../Icon/icons/share.icon';
|
|
16
|
-
import { useI18n, useBreakpoint, useConsolidatedRef, useElement, useTransitionState, useEvent,
|
|
16
|
+
import { useI18n, useBreakpoint, useConsolidatedRef, useElement, useTransitionState, useEvent, useScrollToggle, useTheme, useUID, usePreviewManager, useDirection } from '../../hooks';
|
|
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, isValidElement } from '../../utils';
|
|
22
|
+
import { debounce, isTouchDevice, isValidElement } from '../../utils';
|
|
23
23
|
import useKeyboardCommands from '../KeyboardCommands';
|
|
24
24
|
import Tooltip from '../Tooltip';
|
|
25
25
|
import Drawer from '../Drawer';
|
|
@@ -81,8 +81,10 @@ const AppShell = forwardRef(function AppShell(props, ref) {
|
|
|
81
81
|
const [headerEl, setHeaderEl] = useElement();
|
|
82
82
|
const [mobileHeaderEl, setMobileHeaderEl] = useElement();
|
|
83
83
|
const isSmallOrAbove = useBreakpoint('sm');
|
|
84
|
-
|
|
85
|
-
const
|
|
84
|
+
// Touch devices at narrow widths get the bottom nav; non-touch narrow desktops fall back to top-bar.
|
|
85
|
+
const showMobileNav = !isSmallOrAbove && isTouchDevice;
|
|
86
|
+
const isTopBar = !showMobileNav && (navOrientation === 'top-bar' || !isSmallOrAbove);
|
|
87
|
+
const showAppHeader = isTopBar || (!!appHeader && isSmallOrAbove);
|
|
86
88
|
const showMainContent = showAppHeader ? !!(headerEl || mobileHeaderEl) : true;
|
|
87
89
|
const openNavTimeoutId = useRef();
|
|
88
90
|
const closeNavTimeoutId = useRef();
|
|
@@ -119,7 +121,20 @@ const AppShell = forwardRef(function AppShell(props, ref) {
|
|
|
119
121
|
focusedImperatively.current = false;
|
|
120
122
|
}, []);
|
|
121
123
|
const mobileNavRef = useRef(null);
|
|
122
|
-
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
const ac = new AbortController();
|
|
126
|
+
// @ts-expect-error Navigation API is available in supported browsers.
|
|
127
|
+
window.navigation.addEventListener('navigate', () => {
|
|
128
|
+
if (mobileNavOpen) {
|
|
129
|
+
setMobileNavOpen(false);
|
|
130
|
+
}
|
|
131
|
+
}, {
|
|
132
|
+
signal: ac.signal
|
|
133
|
+
});
|
|
134
|
+
return () => {
|
|
135
|
+
ac.abort();
|
|
136
|
+
};
|
|
137
|
+
}, [mobileNavOpen]);
|
|
123
138
|
useEffect(() => {
|
|
124
139
|
if (mobileNavOpen) {
|
|
125
140
|
disableScroll();
|
|
@@ -306,14 +321,16 @@ const AppShell = forwardRef(function AppShell(props, ref) {
|
|
|
306
321
|
appHeaderEl: headerEl ?? null,
|
|
307
322
|
searchContainerEl,
|
|
308
323
|
setSearchContainerEl,
|
|
309
|
-
isMobileNav:
|
|
324
|
+
isMobileNav: showMobileNav,
|
|
325
|
+
isTopBar,
|
|
310
326
|
previewActive,
|
|
311
327
|
setPreviewActive
|
|
312
328
|
}), [
|
|
313
329
|
sidebarNavState,
|
|
314
330
|
drawerOpen,
|
|
315
331
|
mobileNavOpen,
|
|
316
|
-
|
|
332
|
+
showMobileNav,
|
|
333
|
+
isTopBar,
|
|
317
334
|
headerEl,
|
|
318
335
|
mobileHeaderEl,
|
|
319
336
|
searchContainerEl,
|
|
@@ -330,13 +347,15 @@ const AppShell = forwardRef(function AppShell(props, ref) {
|
|
|
330
347
|
}
|
|
331
348
|
}, agent: agent }), _jsxs(Flex, { container: { justify: 'center' }, children: [_jsx(StyledAppShellToggleButton, { icon: true, ref: setExpandCollapseEl, compact: true, variant: 'simple', onClick: () => {
|
|
332
349
|
setSidebarNavState(sidebarNavState === 'closed' ? 'open' : 'closed');
|
|
333
|
-
}, "aria-label":
|
|
350
|
+
}, "aria-label": t('navigation_panel'), "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', describeTarget: false, 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, onFocus: () => {
|
|
351
|
+
setMobileNavOpen(false);
|
|
352
|
+
}, 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: () => setMobileNavOpen(prev => !prev), label: t('app_shell_more'), icon: true, "aria-expanded": mobileNavOpen, "aria-controls": navId, children: [_jsx(Icon, { name: 'bars' }), !mobileNavOpen &&
|
|
334
353
|
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: () => {
|
|
335
354
|
setMobileNavOpen(false);
|
|
336
355
|
}, position: 'fixed', placement: 'bottom', size: '100dvh', nullWhenClosed: true, children: _jsx(Flex, { ...restProps, container: {
|
|
337
356
|
direction: 'column',
|
|
338
357
|
justify: 'between'
|
|
339
|
-
}, 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(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] })), _jsx(AppShellGlobalStyle, { isTopBar: isTopBar, showAppHeader: showAppHeader, isMobile:
|
|
358
|
+
}, 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(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] })), _jsx(AppShellGlobalStyle, { isTopBar: isTopBar, showAppHeader: showAppHeader, isMobile: showMobileNav })] }));
|
|
340
359
|
});
|
|
341
360
|
export default AppShell;
|
|
342
361
|
//# sourceMappingURL=AppShell.js.map
|