@pega/cosmos-react-core 10.0.0-build.5.8 → 10.0.0-build.6.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 +2 -2
- package/lib/components/AppShell/AppHeader.js.map +1 -1
- package/lib/components/AppShell/AppShell.d.ts +2 -2
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +90 -181
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts +4 -7
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +28 -135
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +42 -0
- package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.types.js.map +1 -1
- package/lib/components/AppShell/DocumentTabs.d.ts +6 -0
- package/lib/components/AppShell/DocumentTabs.d.ts.map +1 -0
- package/lib/components/AppShell/DocumentTabs.js +409 -0
- package/lib/components/AppShell/DocumentTabs.js.map +1 -0
- package/lib/components/AppShell/DocumentTabs.styles.d.ts +231 -0
- package/lib/components/AppShell/DocumentTabs.styles.d.ts.map +1 -0
- package/lib/components/AppShell/DocumentTabs.styles.js +562 -0
- package/lib/components/AppShell/DocumentTabs.styles.js.map +1 -0
- package/lib/components/AppShell/NavigationListItemWrapper.js +3 -3
- package/lib/components/AppShell/NavigationListItemWrapper.js.map +1 -1
- package/lib/components/AppShell/Operator.d.ts.map +1 -1
- package/lib/components/AppShell/Operator.js +8 -5
- package/lib/components/AppShell/Operator.js.map +1 -1
- package/lib/components/AppShell/ThemeSwitcher.d.ts.map +1 -1
- package/lib/components/AppShell/ThemeSwitcher.js +1 -0
- package/lib/components/AppShell/ThemeSwitcher.js.map +1 -1
- package/lib/components/AppShell/TopNavDrawerProvider.d.ts +7 -0
- package/lib/components/AppShell/TopNavDrawerProvider.d.ts.map +1 -0
- package/lib/components/AppShell/TopNavDrawerProvider.js +28 -0
- package/lib/components/AppShell/TopNavDrawerProvider.js.map +1 -0
- package/lib/components/AppShell/TouchAppShell.d.ts +30 -0
- package/lib/components/AppShell/TouchAppShell.d.ts.map +1 -0
- package/lib/components/AppShell/TouchAppShell.js +110 -0
- package/lib/components/AppShell/TouchAppShell.js.map +1 -0
- package/lib/components/AppShell/TouchAppShell.styles.d.ts +8 -0
- package/lib/components/AppShell/TouchAppShell.styles.d.ts.map +1 -0
- package/lib/components/AppShell/TouchAppShell.styles.js +136 -0
- package/lib/components/AppShell/TouchAppShell.styles.js.map +1 -0
- package/lib/components/AppShell/index.d.ts +1 -1
- package/lib/components/AppShell/index.d.ts.map +1 -1
- package/lib/components/AppShell/index.js.map +1 -1
- package/lib/components/Backdrop/Backdrop.d.ts.map +1 -1
- package/lib/components/Backdrop/Backdrop.js +22 -4
- package/lib/components/Backdrop/Backdrop.js.map +1 -1
- package/lib/components/DateTime/Input/DateInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateInput.js +24 -12
- package/lib/components/DateTime/Input/DateInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateTime.styles.d.ts +3 -0
- package/lib/components/DateTime/Input/DateTime.styles.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTime.styles.js +25 -0
- package/lib/components/DateTime/Input/DateTime.styles.js.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/DateTimeInput.js +42 -25
- package/lib/components/DateTime/Input/DateTimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/PartInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/PartInput.js +3 -2
- package/lib/components/DateTime/Input/PartInput.js.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.d.ts +6 -3
- package/lib/components/DateTime/Input/TimeInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/TimeInput.js +58 -27
- package/lib/components/DateTime/Input/TimeInput.js.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.d.ts +6 -3
- package/lib/components/DateTime/Input/WeekInput.d.ts.map +1 -1
- package/lib/components/DateTime/Input/WeekInput.js +29 -16
- package/lib/components/DateTime/Input/WeekInput.js.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.styles.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.styles.js +5 -0
- package/lib/components/DateTime/Picker/Calendar.styles.js.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.styles.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.styles.js +32 -7
- package/lib/components/DateTime/Picker/DatePicker.styles.js.map +1 -1
- package/lib/components/DateTime/Picker/TimePicker.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/TimePicker.js +22 -35
- package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
- package/lib/components/Dialog/Dialog.styles.d.ts +1 -1
- package/lib/components/Dialog/Dialog.styles.d.ts.map +1 -1
- package/lib/components/Dialog/FormDialog.js +1 -1
- package/lib/components/Dialog/FormDialog.js.map +1 -1
- package/lib/components/Dialog/InfoDialog.js +1 -1
- package/lib/components/Dialog/InfoDialog.js.map +1 -1
- package/lib/components/Dialog/TouchDialog.js +1 -1
- package/lib/components/Dialog/TouchDialog.js.map +1 -1
- package/lib/components/Dialog/TouchDialog.styles.d.ts.map +1 -1
- package/lib/components/Dialog/TouchDialog.styles.js +2 -1
- package/lib/components/Dialog/TouchDialog.styles.js.map +1 -1
- package/lib/components/Dialog/TouchInfoDialog.d.ts +1 -1
- package/lib/components/InlineEdit/InlineEdit.js.map +1 -1
- package/lib/components/InlineEdit/InlineEdit.styles.js +1 -1
- package/lib/components/InlineEdit/InlineEdit.styles.js.map +1 -1
- package/lib/components/Link/Link.d.ts +7 -2
- package/lib/components/Link/Link.d.ts.map +1 -1
- package/lib/components/Link/Link.js +44 -19
- package/lib/components/Link/Link.js.map +1 -1
- package/lib/components/Link/Link.test-ids.d.ts +1 -1
- package/lib/components/Link/Link.test-ids.d.ts.map +1 -1
- package/lib/components/Link/Link.test-ids.js +2 -1
- package/lib/components/Link/Link.test-ids.js.map +1 -1
- package/lib/components/Menu/FlyoutMenuList.d.ts.map +1 -1
- package/lib/components/Menu/FlyoutMenuList.js +1 -1
- package/lib/components/Menu/FlyoutMenuList.js.map +1 -1
- package/lib/components/Menu/Menu.d.ts +1 -1
- package/lib/components/Menu/Menu.d.ts.map +1 -1
- package/lib/components/Menu/Menu.js +10 -3
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
- package/lib/components/Menu/Menu.styles.js +6 -0
- package/lib/components/Menu/Menu.styles.js.map +1 -1
- package/lib/components/Menu/Menu.test-ids.d.ts +1 -1
- package/lib/components/Menu/Menu.test-ids.d.ts.map +1 -1
- package/lib/components/Menu/Menu.test-ids.js +1 -1
- package/lib/components/Menu/Menu.test-ids.js.map +1 -1
- package/lib/components/Menu/Menu.types.d.ts +9 -0
- package/lib/components/Menu/Menu.types.d.ts.map +1 -1
- package/lib/components/Menu/Menu.types.js.map +1 -1
- package/lib/components/Menu/helpers.d.ts +14 -0
- package/lib/components/Menu/helpers.d.ts.map +1 -1
- package/lib/components/Menu/helpers.js +26 -0
- package/lib/components/Menu/helpers.js.map +1 -1
- package/lib/components/MenuButton/MenuButton.d.ts.map +1 -1
- package/lib/components/MenuButton/MenuButton.js +5 -1
- package/lib/components/MenuButton/MenuButton.js.map +1 -1
- package/lib/components/Modal/Modal.styles.d.ts.map +1 -1
- package/lib/components/Modal/Modal.styles.js +2 -0
- package/lib/components/Modal/Modal.styles.js.map +1 -1
- package/lib/components/MultiStepForm/FormProgress.styles.d.ts +1 -1
- package/lib/components/MultiStepForm/FormProgress.styles.d.ts.map +1 -1
- package/lib/components/Phone/PhoneDisplay.d.ts +10 -0
- package/lib/components/Phone/PhoneDisplay.d.ts.map +1 -1
- package/lib/components/Phone/PhoneDisplay.js +7 -2
- package/lib/components/Phone/PhoneDisplay.js.map +1 -1
- package/lib/components/Phone/PhoneInput.d.ts +10 -0
- package/lib/components/Phone/PhoneInput.d.ts.map +1 -1
- package/lib/components/Phone/PhoneInput.js +18 -5
- package/lib/components/Phone/PhoneInput.js.map +1 -1
- package/lib/components/Phone/utils.d.ts +4 -2
- package/lib/components/Phone/utils.d.ts.map +1 -1
- package/lib/components/Phone/utils.js +17 -6
- package/lib/components/Phone/utils.js.map +1 -1
- package/lib/components/Popover/Popover.d.ts +4 -66
- package/lib/components/Popover/Popover.d.ts.map +1 -1
- package/lib/components/Popover/Popover.js +229 -80
- package/lib/components/Popover/Popover.js.map +1 -1
- package/lib/components/Popover/Popover.styles.d.ts +1 -0
- package/lib/components/Popover/Popover.styles.d.ts.map +1 -1
- package/lib/components/Popover/Popover.styles.js +20 -14
- package/lib/components/Popover/Popover.styles.js.map +1 -1
- package/lib/components/Popover/Popover.types.d.ts +152 -0
- package/lib/components/Popover/Popover.types.d.ts.map +1 -0
- package/lib/components/Popover/Popover.types.js +2 -0
- package/lib/components/Popover/Popover.types.js.map +1 -0
- package/lib/components/Popover/index.d.ts +2 -2
- package/lib/components/Popover/index.d.ts.map +1 -1
- package/lib/components/Popover/index.js +1 -1
- package/lib/components/Popover/index.js.map +1 -1
- package/lib/components/Popover/modifiers.d.ts +24 -4
- package/lib/components/Popover/modifiers.d.ts.map +1 -1
- package/lib/components/Popover/modifiers.js +202 -125
- package/lib/components/Popover/modifiers.js.map +1 -1
- package/lib/components/Popover/utils.d.ts +74 -0
- package/lib/components/Popover/utils.d.ts.map +1 -0
- package/lib/components/Popover/utils.js +362 -0
- package/lib/components/Popover/utils.js.map +1 -0
- package/lib/components/SkipLinks/SkipLinks.styles.d.ts +1 -1
- package/lib/components/SkipLinks/SkipLinks.styles.d.ts.map +1 -1
- package/lib/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/lib/components/Tooltip/Tooltip.js +8 -2
- package/lib/components/Tooltip/Tooltip.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +15 -0
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/i18n/default.d.ts +15 -0
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +18 -1
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +15 -0
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/styles/GlobalStyle.d.ts.map +1 -1
- package/lib/styles/GlobalStyle.js +6 -0
- package/lib/styles/GlobalStyle.js.map +1 -1
- package/lib/theme/theme.d.ts +18 -0
- package/lib/theme/theme.d.ts.map +1 -1
- package/lib/theme/themeDefinition.json +10 -0
- package/lib/theme/themeOverrides.schema.json +13 -0
- package/package.json +4 -6
- package/lib/components/Popover/getResolvedTarget.d.ts +0 -11
- package/lib/components/Popover/getResolvedTarget.d.ts.map +0 -1
- package/lib/components/Popover/getResolvedTarget.js +0 -13
- package/lib/components/Popover/getResolvedTarget.js.map +0 -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,
|
|
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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EAAE,QAAQ;6BAChB,GACD,CACH,EACA,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 }: 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;A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AAC,qBAAqB,KAAG,CAC1B,EACA,CAAC,cAAc,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,IAC/B,EACN,CAAC,cAAc,IAAI,CAClB,8BACG,iBAAiB,IAAI,CACpB,KAAC,aAAa,IAAC,SAAS,EAAE,SAAS,EAAE,iBAAiB,EAAE,iBAAiB,GAAI,CAC9E,EACA,QAAQ,IAAI,CACX,KAAC,UAAU,IACT,OAAO,EAAC,QAAQ,EAChB,IAAI,EAAC,MAAM,EACX,IAAI,EAAE,CAAC,CAAC,iBAAiB,CAAC,EAC1B,QAAQ,QACR,IAAI,EAAE;gCACJ,KAAK,EAAE,QAAQ;6BAChB,GACD,CACH,EACA,cAAc,IAAI,KAAC,UAAU,OAAK,cAAc,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
|
|
3
|
-
export default
|
|
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":"
|
|
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,
|
|
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,96 +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,
|
|
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 {
|
|
22
|
+
import { isTouchDevice } from '../../utils';
|
|
23
23
|
import useKeyboardCommands from '../KeyboardCommands';
|
|
24
24
|
import Tooltip from '../Tooltip';
|
|
25
|
-
import
|
|
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,
|
|
28
|
+
import { StyledAppMain, StyledBannerRegion, StyledAppShellToggleButton, StyledAppShellTooltip, StyledSidebarNav, AppShellGlobalStyle, StyledShareIcon } from './AppShell.styles';
|
|
32
29
|
import { followingNodes, focusRegion } from './utils';
|
|
33
|
-
import AppNavigationPanel
|
|
30
|
+
import AppNavigationPanel from './AppNavigationPanel';
|
|
34
31
|
import NavigationList from './NavigationList';
|
|
32
|
+
import DocumentTabs, { getTabElementId, getTabPanelId } from './DocumentTabs';
|
|
33
|
+
import { StyledDocumentTabPanel } from './DocumentTabs.styles';
|
|
34
|
+
import TopNavDrawerProvider from './TopNavDrawerProvider';
|
|
35
|
+
import TouchAppShell from './TouchAppShell';
|
|
35
36
|
registerIcon(timesIcon, plusIcon, caseSolidIcon, barsIcon, caretRightIcon, caretLeftIcon, sunIcon, moonIcon, circleMixedLeftIcon, shareIcon);
|
|
36
37
|
registerAction({ id: 'NextRegion', defaultKeyBinding: 'F9' }, { id: 'PrevRegion', defaultKeyBinding: 'Shift+F9' }, { id: 'KeyboardCommands', defaultKeyBinding: 'CommandOrControl+/' });
|
|
37
|
-
function TopNavDrawerProvider({ children }) {
|
|
38
|
-
const [item, setItem] = useState(undefined);
|
|
39
|
-
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
40
|
-
// Delay opening the drawer by one render pass after item is set.
|
|
41
|
-
// The cosmos-core Drawer only fires onAfterOpen on a false→true open transition.
|
|
42
|
-
// Batching setItem + setDrawerOpen(true) in the same event handler causes the
|
|
43
|
-
// Drawer to mount with open=true from the start (no transition), so onAfterOpen
|
|
44
|
-
// never fires and item.onDrawerOpen() (data fetching) is never called.
|
|
45
|
-
// Setting drawerOpen in a separate useEffect gives the Drawer a proper transition.
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (item)
|
|
48
|
-
setDrawerOpen(true);
|
|
49
|
-
}, [item]);
|
|
50
|
-
const ctxValue = useMemo(() => ({
|
|
51
|
-
drawerOpen,
|
|
52
|
-
openItemName: item?.name,
|
|
53
|
-
closeDrawer: () => setDrawerOpen(false),
|
|
54
|
-
openDrawer: (next) => {
|
|
55
|
-
// Spread to create a new object reference each time so useEffect([item])
|
|
56
|
-
// always fires — even when the same item is re-opened after the drawer closes.
|
|
57
|
-
setItem({ ...next });
|
|
58
|
-
},
|
|
59
|
-
refreshDrawer: (next) => {
|
|
60
|
-
setItem({ ...next });
|
|
61
|
-
}
|
|
62
|
-
}), [drawerOpen, item?.name]);
|
|
63
|
-
return (_jsxs(AppShellDrawerContext.Provider, { value: ctxValue, children: [children, item && (_jsx(AppShellDrawer, { drawerOpen: drawerOpen, setDrawerOpen: setDrawerOpen, content: item.drawerView, header: item.drawerHeader || item.name, onDrawerClose: () => {
|
|
64
|
-
setItem(undefined);
|
|
65
|
-
item.onDrawerClose?.();
|
|
66
|
-
}, onDrawerOpen: item.onDrawerOpen }))] }));
|
|
67
|
-
}
|
|
68
38
|
const AppShell = forwardRef(function AppShell(props, ref) {
|
|
69
39
|
const t = useI18n();
|
|
70
|
-
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', ...restProps } = props;
|
|
71
|
-
const
|
|
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]);
|
|
72
47
|
const navRef = useConsolidatedRef(ref);
|
|
73
|
-
const mobileButtonRef = useRef(null);
|
|
74
48
|
const navId = useUID();
|
|
75
49
|
const [expandCollapseEl, setExpandCollapseEl] = useElement();
|
|
76
|
-
const [mobileNavOpen, setMobileNavOpen] = useState(false);
|
|
77
50
|
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
78
|
-
const [mobileNavLinksCount, setMobileNavLinksCount] = useState(0);
|
|
79
51
|
const { previewActive, setPreviewActive } = usePreviewManager();
|
|
80
52
|
const focusedImperatively = useRef(false);
|
|
81
53
|
const [headerEl, setHeaderEl] = useElement();
|
|
82
|
-
const [mobileHeaderEl, setMobileHeaderEl] = useElement();
|
|
83
54
|
const isSmallOrAbove = useBreakpoint('sm');
|
|
84
|
-
|
|
85
|
-
const showMobileNav = !isSmallOrAbove && isTouchDevice;
|
|
86
|
-
const isTopBar = !showMobileNav && (navOrientation === 'top-bar' || !isSmallOrAbove);
|
|
55
|
+
const isTopBar = navOrientation === 'top-bar' || !isSmallOrAbove;
|
|
87
56
|
const showAppHeader = isTopBar || (!!appHeader && isSmallOrAbove);
|
|
88
|
-
const showMainContent = showAppHeader ? !!
|
|
57
|
+
const showMainContent = showAppHeader ? !!headerEl : true;
|
|
89
58
|
const openNavTimeoutId = useRef();
|
|
90
59
|
const closeNavTimeoutId = useRef();
|
|
91
60
|
const [searchContainerEl, setSearchContainerEl] = useState(null);
|
|
92
61
|
const openKeyboardCommands = useKeyboardCommands();
|
|
93
|
-
const theme = useTheme();
|
|
94
62
|
const { state: sidebarNavState, set: setSidebarNavState } = useTransitionState({
|
|
95
63
|
ref: navRef,
|
|
96
64
|
property: 'width',
|
|
97
65
|
states: openCloseStates,
|
|
98
66
|
defaultState: defaultExpanded ? 'open' : 'closed'
|
|
99
67
|
});
|
|
100
|
-
const skipLinks = useMemo(() => [
|
|
101
|
-
{
|
|
102
|
-
label: t('go_to_main_content'),
|
|
103
|
-
target: { ariaLabel: t('main_content'), selector: 'main' }
|
|
104
|
-
}
|
|
105
|
-
], [t]);
|
|
106
68
|
const openNav = useCallback((delay = 0) => {
|
|
107
69
|
if (closeNavTimeoutId.current)
|
|
108
70
|
clearTimeout(closeNavTimeoutId.current);
|
|
@@ -120,59 +82,6 @@ const AppShell = forwardRef(function AppShell(props, ref) {
|
|
|
120
82
|
const onFocus = useCallback(() => {
|
|
121
83
|
focusedImperatively.current = false;
|
|
122
84
|
}, []);
|
|
123
|
-
const mobileNavRef = useRef(null);
|
|
124
|
-
useEffect(() => {
|
|
125
|
-
const ac = new AbortController();
|
|
126
|
-
window.navigation.addEventListener('navigate', () => {
|
|
127
|
-
if (mobileNavOpen) {
|
|
128
|
-
setMobileNavOpen(false);
|
|
129
|
-
}
|
|
130
|
-
}, {
|
|
131
|
-
signal: ac.signal
|
|
132
|
-
});
|
|
133
|
-
return () => {
|
|
134
|
-
ac.abort();
|
|
135
|
-
};
|
|
136
|
-
}, [mobileNavOpen]);
|
|
137
|
-
useEffect(() => {
|
|
138
|
-
if (mobileNavOpen) {
|
|
139
|
-
disableScroll();
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
enableScroll();
|
|
143
|
-
}
|
|
144
|
-
}, [mobileNavOpen]);
|
|
145
|
-
useEffect(() => {
|
|
146
|
-
if (mobileNavOpen) {
|
|
147
|
-
const onKeyDown = ({ key }) => {
|
|
148
|
-
if (key === 'Escape')
|
|
149
|
-
setMobileNavOpen(false);
|
|
150
|
-
};
|
|
151
|
-
document.addEventListener('keydown', onKeyDown);
|
|
152
|
-
return () => {
|
|
153
|
-
document.removeEventListener('keydown', onKeyDown);
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
}, [mobileNavOpen]);
|
|
157
|
-
useEffect(() => {
|
|
158
|
-
if (isSmallOrAbove && mobileNavOpen)
|
|
159
|
-
setMobileNavOpen(false);
|
|
160
|
-
}, [isSmallOrAbove, mobileNavOpen]);
|
|
161
|
-
useLayoutEffect(() => {
|
|
162
|
-
if (!mobileHeaderEl)
|
|
163
|
-
return;
|
|
164
|
-
const resizeObserver = new ResizeObserver(debounce(() => {
|
|
165
|
-
const screenWidth = document.documentElement.clientWidth;
|
|
166
|
-
const regionsPaddingInlinePixels = 2 *
|
|
167
|
-
Number.parseInt(window.getComputedStyle(mobileHeaderEl).getPropertyValue('padding-inline-start'), 10);
|
|
168
|
-
const availableWidth = screenWidth * 0.9 - regionsPaddingInlinePixels;
|
|
169
|
-
setMobileNavLinksCount(Math.max(Math.floor(availableWidth / menuButtonWidth(theme)) - (caseTypes?.length ? 2 : 1), 0));
|
|
170
|
-
}, 0));
|
|
171
|
-
resizeObserver.observe(document.documentElement);
|
|
172
|
-
return () => {
|
|
173
|
-
resizeObserver.disconnect();
|
|
174
|
-
};
|
|
175
|
-
}, [mobileHeaderEl, caseTypes?.length]);
|
|
176
85
|
const activatedEl = useRef(document.body);
|
|
177
86
|
useEvent('click', e => {
|
|
178
87
|
activatedEl.current = document.elementFromPoint(e.clientX, e.clientY) ?? document.body;
|
|
@@ -213,9 +122,62 @@ const AppShell = forwardRef(function AppShell(props, ref) {
|
|
|
213
122
|
useShortcut('KeyboardCommands', () => {
|
|
214
123
|
openKeyboardCommands();
|
|
215
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();
|
|
216
178
|
const contextSwitcherUtilItem = useMemo(() => {
|
|
217
179
|
const { contexts, onContextClick, label: contextSwitcherLabel = t('switch_to') } = contextSwitcher ?? {};
|
|
218
|
-
if (!showAppHeader && contexts && contexts
|
|
180
|
+
if (!showAppHeader && contexts && contexts.length > 1 && onContextClick) {
|
|
219
181
|
return {
|
|
220
182
|
name: contextSwitcherLabel,
|
|
221
183
|
primary: contextSwitcherLabel,
|
|
@@ -225,18 +187,11 @@ const AppShell = forwardRef(function AppShell(props, ref) {
|
|
|
225
187
|
primary: context.primary,
|
|
226
188
|
'aria-current': !!context.selected,
|
|
227
189
|
visual: context.visual,
|
|
228
|
-
onClick: e =>
|
|
229
|
-
onContextClick(context.id, e);
|
|
230
|
-
}
|
|
190
|
+
onClick: e => onContextClick(context.id, e)
|
|
231
191
|
})), singleSelect: true }))
|
|
232
192
|
};
|
|
233
193
|
}
|
|
234
|
-
}, [
|
|
235
|
-
showAppHeader,
|
|
236
|
-
contextSwitcher?.contexts,
|
|
237
|
-
contextSwitcher?.label,
|
|
238
|
-
contextSwitcher?.onContextClick
|
|
239
|
-
]);
|
|
194
|
+
}, [contextSwitcher, showAppHeader, t]);
|
|
240
195
|
const shareLabel = shareApp?.label ?? t('app_shell_share');
|
|
241
196
|
const shareApplicationUtilItem = useMemo(() => {
|
|
242
197
|
if (!showAppHeader && shareApp) {
|
|
@@ -247,7 +202,7 @@ const AppShell = forwardRef(function AppShell(props, ref) {
|
|
|
247
202
|
onClick: shareApp.onClick
|
|
248
203
|
};
|
|
249
204
|
}
|
|
250
|
-
}, [
|
|
205
|
+
}, [shareApp, shareLabel, showAppHeader]);
|
|
251
206
|
const operatorInfoUtilItem = useMemo(() => {
|
|
252
207
|
if (!showAppHeader && operator) {
|
|
253
208
|
return {
|
|
@@ -257,17 +212,14 @@ const AppShell = forwardRef(function AppShell(props, ref) {
|
|
|
257
212
|
items: operator.actions
|
|
258
213
|
};
|
|
259
214
|
}
|
|
260
|
-
}, [showAppHeader,
|
|
261
|
-
const { themeMode, onThemeModeChange } = useThemeMode();
|
|
215
|
+
}, [operator, showAppHeader, t]);
|
|
262
216
|
const themeSwitcherUtilItem = useMemo(() => {
|
|
263
217
|
if (!showAppHeader && onThemeModeChange) {
|
|
264
|
-
let currentThemeIcon = 'circle-mixed-left';
|
|
265
|
-
if (themeMode === 'dark')
|
|
218
|
+
let currentThemeIcon = 'circle-mixed-left';
|
|
219
|
+
if (themeMode === 'dark')
|
|
266
220
|
currentThemeIcon = 'moon';
|
|
267
|
-
|
|
268
|
-
else if (themeMode === 'light') {
|
|
221
|
+
else if (themeMode === 'light')
|
|
269
222
|
currentThemeIcon = 'sun';
|
|
270
|
-
}
|
|
271
223
|
return {
|
|
272
224
|
name: t('theme_mode'),
|
|
273
225
|
primary: t('theme_mode'),
|
|
@@ -294,8 +246,7 @@ const AppShell = forwardRef(function AppShell(props, ref) {
|
|
|
294
246
|
]
|
|
295
247
|
};
|
|
296
248
|
}
|
|
297
|
-
}, [showAppHeader,
|
|
298
|
-
const { start, end } = useDirection();
|
|
249
|
+
}, [onThemeModeChange, showAppHeader, t, themeMode]);
|
|
299
250
|
const utilsList = useMemo(() => [
|
|
300
251
|
...(utils ?? []),
|
|
301
252
|
...(contextSwitcherUtilItem ? [contextSwitcherUtilItem] : []),
|
|
@@ -303,58 +254,16 @@ const AppShell = forwardRef(function AppShell(props, ref) {
|
|
|
303
254
|
...(operatorInfoUtilItem ? [operatorInfoUtilItem] : []),
|
|
304
255
|
...(themeSwitcherUtilItem ? [themeSwitcherUtilItem] : [])
|
|
305
256
|
], [
|
|
306
|
-
utils,
|
|
307
257
|
contextSwitcherUtilItem,
|
|
308
|
-
shareApplicationUtilItem,
|
|
309
258
|
operatorInfoUtilItem,
|
|
310
|
-
|
|
259
|
+
shareApplicationUtilItem,
|
|
260
|
+
themeSwitcherUtilItem,
|
|
261
|
+
utils
|
|
311
262
|
]);
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
collapsedHoverMenus,
|
|
317
|
-
navState: sidebarNavState,
|
|
318
|
-
focusedImperatively,
|
|
319
|
-
headerEl: headerEl || mobileHeaderEl,
|
|
320
|
-
appHeaderEl: headerEl ?? null,
|
|
321
|
-
searchContainerEl,
|
|
322
|
-
setSearchContainerEl,
|
|
323
|
-
isMobileNav: showMobileNav,
|
|
324
|
-
isTopBar,
|
|
325
|
-
previewActive,
|
|
326
|
-
setPreviewActive
|
|
327
|
-
}), [
|
|
328
|
-
sidebarNavState,
|
|
329
|
-
drawerOpen,
|
|
330
|
-
mobileNavOpen,
|
|
331
|
-
showMobileNav,
|
|
332
|
-
isTopBar,
|
|
333
|
-
headerEl,
|
|
334
|
-
mobileHeaderEl,
|
|
335
|
-
searchContainerEl,
|
|
336
|
-
previewActive
|
|
337
|
-
]), 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: {
|
|
338
|
-
direction: 'column',
|
|
339
|
-
justify: 'between'
|
|
340
|
-
}, 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: () => {
|
|
341
|
-
if (['closing', 'closed'].includes(sidebarNavState)) {
|
|
342
|
-
openNav(0);
|
|
343
|
-
}
|
|
344
|
-
else {
|
|
345
|
-
closeNav(0);
|
|
346
|
-
}
|
|
347
|
-
}, agent: agent }), _jsxs(Flex, { container: { justify: 'center' }, children: [_jsx(StyledAppShellToggleButton, { icon: true, ref: setExpandCollapseEl, compact: true, variant: 'simple', onClick: () => {
|
|
348
|
-
setSidebarNavState(sidebarNavState === 'closed' ? 'open' : 'closed');
|
|
349
|
-
}, "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, onFocus: () => {
|
|
350
|
-
setMobileNavOpen(false);
|
|
351
|
-
}, 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 &&
|
|
352
|
-
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: () => {
|
|
353
|
-
setMobileNavOpen(false);
|
|
354
|
-
}, position: 'fixed', placement: 'bottom', size: '100dvh', nullWhenClosed: true, children: _jsx(Flex, { ...restProps, container: {
|
|
355
|
-
direction: 'column',
|
|
356
|
-
justify: 'between'
|
|
357
|
-
}, 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 })] }));
|
|
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 });
|
|
358
267
|
});
|
|
359
|
-
export default
|
|
268
|
+
export default AppShellMain;
|
|
360
269
|
//# sourceMappingURL=AppShell.js.map
|