@pega/cosmos-react-core 10.0.0-build.9.11 → 10.0.0-build.9.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/lib/components/AppShell/AppHeader.d.ts.map +1 -1
  2. package/lib/components/AppShell/AppHeader.js +46 -3
  3. package/lib/components/AppShell/AppHeader.js.map +1 -1
  4. package/lib/components/AppShell/AppNavigationPanel.d.ts.map +1 -1
  5. package/lib/components/AppShell/AppNavigationPanel.js +12 -3
  6. package/lib/components/AppShell/AppNavigationPanel.js.map +1 -1
  7. package/lib/components/AppShell/AppShell.d.ts.map +1 -1
  8. package/lib/components/AppShell/AppShell.js +40 -10
  9. package/lib/components/AppShell/AppShell.js.map +1 -1
  10. package/lib/components/AppShell/AppShell.styles.d.ts +8 -0
  11. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  12. package/lib/components/AppShell/AppShell.styles.js +53 -3
  13. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  14. package/lib/components/AppShell/AppShell.types.d.ts +50 -0
  15. package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
  16. package/lib/components/AppShell/AppShell.types.js.map +1 -1
  17. package/lib/components/AppShell/AppShellContext.d.ts +2 -0
  18. package/lib/components/AppShell/AppShellContext.d.ts.map +1 -1
  19. package/lib/components/AppShell/AppShellContext.js.map +1 -1
  20. package/lib/components/AppShell/AppShellList.d.ts.map +1 -1
  21. package/lib/components/AppShell/AppShellList.js +2 -1
  22. package/lib/components/AppShell/AppShellList.js.map +1 -1
  23. package/lib/components/AppShell/AppTopNav.styles.d.ts.map +1 -1
  24. package/lib/components/AppShell/AppTopNav.styles.js +5 -1
  25. package/lib/components/AppShell/AppTopNav.styles.js.map +1 -1
  26. package/lib/components/AppShell/DocumentTabs.styles.d.ts.map +1 -1
  27. package/lib/components/AppShell/DocumentTabs.styles.js +4 -2
  28. package/lib/components/AppShell/DocumentTabs.styles.js.map +1 -1
  29. package/lib/components/AppShell/HeaderActionButton.d.ts +20 -0
  30. package/lib/components/AppShell/HeaderActionButton.d.ts.map +1 -0
  31. package/lib/components/AppShell/HeaderActionButton.js +78 -0
  32. package/lib/components/AppShell/HeaderActionButton.js.map +1 -0
  33. package/lib/components/AppShell/Panel/Panel.d.ts +15 -0
  34. package/lib/components/AppShell/Panel/Panel.d.ts.map +1 -0
  35. package/lib/components/AppShell/Panel/Panel.js +80 -0
  36. package/lib/components/AppShell/Panel/Panel.js.map +1 -0
  37. package/lib/components/AppShell/Panel/Panel.styles.d.ts +188 -0
  38. package/lib/components/AppShell/Panel/Panel.styles.d.ts.map +1 -0
  39. package/lib/components/AppShell/Panel/Panel.styles.js +85 -0
  40. package/lib/components/AppShell/Panel/Panel.styles.js.map +1 -0
  41. package/lib/components/AppShell/Panel/Panel.test-ids.d.ts +2 -0
  42. package/lib/components/AppShell/Panel/Panel.test-ids.d.ts.map +1 -0
  43. package/lib/components/AppShell/Panel/Panel.test-ids.js +3 -0
  44. package/lib/components/AppShell/Panel/Panel.test-ids.js.map +1 -0
  45. package/lib/components/AppShell/Panel/Panel.types.d.ts +33 -0
  46. package/lib/components/AppShell/Panel/Panel.types.d.ts.map +1 -0
  47. package/lib/components/AppShell/Panel/Panel.types.js +2 -0
  48. package/lib/components/AppShell/Panel/Panel.types.js.map +1 -0
  49. package/lib/components/AppShell/Panel/PanelHeaderActions.d.ts +8 -0
  50. package/lib/components/AppShell/Panel/PanelHeaderActions.d.ts.map +1 -0
  51. package/lib/components/AppShell/Panel/PanelHeaderActions.js +17 -0
  52. package/lib/components/AppShell/Panel/PanelHeaderActions.js.map +1 -0
  53. package/lib/components/AppShell/Panel/index.d.ts +4 -0
  54. package/lib/components/AppShell/Panel/index.d.ts.map +1 -0
  55. package/lib/components/AppShell/Panel/index.js +4 -0
  56. package/lib/components/AppShell/Panel/index.js.map +1 -0
  57. package/lib/components/AppShell/Panel/usePanel.d.ts +12 -0
  58. package/lib/components/AppShell/Panel/usePanel.d.ts.map +1 -0
  59. package/lib/components/AppShell/Panel/usePanel.js +30 -0
  60. package/lib/components/AppShell/Panel/usePanel.js.map +1 -0
  61. package/lib/components/AppShell/TopNavDrawerProvider.d.ts +5 -1
  62. package/lib/components/AppShell/TopNavDrawerProvider.d.ts.map +1 -1
  63. package/lib/components/AppShell/TopNavDrawerProvider.js +18 -3
  64. package/lib/components/AppShell/TopNavDrawerProvider.js.map +1 -1
  65. package/lib/components/AppShell/TouchAppShell.d.ts +1 -1
  66. package/lib/components/AppShell/TouchAppShell.d.ts.map +1 -1
  67. package/lib/components/AppShell/TouchAppShell.js +34 -7
  68. package/lib/components/AppShell/TouchAppShell.js.map +1 -1
  69. package/lib/components/AppShell/TouchAppShell.styles.d.ts.map +1 -1
  70. package/lib/components/AppShell/TouchAppShell.styles.js +10 -0
  71. package/lib/components/AppShell/TouchAppShell.styles.js.map +1 -1
  72. package/lib/components/AppShell/headerActionUtils.d.ts +12 -0
  73. package/lib/components/AppShell/headerActionUtils.d.ts.map +1 -0
  74. package/lib/components/AppShell/headerActionUtils.js +69 -0
  75. package/lib/components/AppShell/headerActionUtils.js.map +1 -0
  76. package/lib/components/AppShell/index.d.ts +2 -1
  77. package/lib/components/AppShell/index.d.ts.map +1 -1
  78. package/lib/components/AppShell/index.js.map +1 -1
  79. package/lib/components/Drawer/Drawer.d.ts +12 -1
  80. package/lib/components/Drawer/Drawer.d.ts.map +1 -1
  81. package/lib/components/Drawer/Drawer.js +22 -23
  82. package/lib/components/Drawer/Drawer.js.map +1 -1
  83. package/lib/components/Drawer/ResizeHandle.d.ts +9 -2
  84. package/lib/components/Drawer/ResizeHandle.d.ts.map +1 -1
  85. package/lib/components/Drawer/ResizeHandle.js +41 -17
  86. package/lib/components/Drawer/ResizeHandle.js.map +1 -1
  87. package/lib/components/Link/Link.d.ts +2 -0
  88. package/lib/components/Link/Link.d.ts.map +1 -1
  89. package/lib/components/Link/Link.js +2 -2
  90. package/lib/components/Link/Link.js.map +1 -1
  91. package/lib/components/Location/LocationInput.d.ts +1 -1
  92. package/lib/components/Location/LocationInput.d.ts.map +1 -1
  93. package/lib/components/Location/LocationInput.js.map +1 -1
  94. package/lib/components/Signature/Signature.d.ts +28 -0
  95. package/lib/components/Signature/Signature.d.ts.map +1 -0
  96. package/lib/components/Signature/Signature.js +397 -0
  97. package/lib/components/Signature/Signature.js.map +1 -0
  98. package/lib/components/Signature/Signature.styles.d.ts +197 -0
  99. package/lib/components/Signature/Signature.styles.d.ts.map +1 -0
  100. package/lib/components/Signature/Signature.styles.js +119 -0
  101. package/lib/components/Signature/Signature.styles.js.map +1 -0
  102. package/lib/components/Signature/Signature.test-ids.d.ts +2 -0
  103. package/lib/components/Signature/Signature.test-ids.d.ts.map +1 -0
  104. package/lib/components/Signature/Signature.test-ids.js +3 -0
  105. package/lib/components/Signature/Signature.test-ids.js.map +1 -0
  106. package/lib/components/Signature/index.d.ts +4 -0
  107. package/lib/components/Signature/index.d.ts.map +1 -0
  108. package/lib/components/Signature/index.js +3 -0
  109. package/lib/components/Signature/index.js.map +1 -0
  110. package/lib/hooks/useBreakpoint.d.ts.map +1 -1
  111. package/lib/hooks/useBreakpoint.js +3 -1
  112. package/lib/hooks/useBreakpoint.js.map +1 -1
  113. package/lib/hooks/useI18n.d.ts +23 -0
  114. package/lib/hooks/useI18n.d.ts.map +1 -1
  115. package/lib/i18n/default.d.ts +23 -0
  116. package/lib/i18n/default.d.ts.map +1 -1
  117. package/lib/i18n/default.js +24 -0
  118. package/lib/i18n/default.js.map +1 -1
  119. package/lib/i18n/i18n.d.ts +23 -0
  120. package/lib/i18n/i18n.d.ts.map +1 -1
  121. package/lib/index.d.ts +2 -0
  122. package/lib/index.d.ts.map +1 -1
  123. package/lib/index.js +2 -0
  124. package/lib/index.js.map +1 -1
  125. package/package.json +2 -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,CAiO9D,CAAC;AAEH,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"AppHeader.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAoB,MAAM,OAAO,CAAC;AASjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAMhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAqBvD,QAAA,MAAM,SAAS,EAAE,iBAAiB,CAAC,cAAc,GAAG,YAAY,CA8S9D,CAAC;AAEH,eAAe,SAAS,CAAC"}
@@ -3,7 +3,8 @@ import { forwardRef, useContext, useEffect, useMemo, useRef, useState } from 're
3
3
  import Flex from '../Flex';
4
4
  import Image from '../Image';
5
5
  import Button from '../Button';
6
- import Icon from '../Icon';
6
+ import Icon, { registerIcon } from '../Icon';
7
+ import * as moreAltIcon from '../Icon/icons/more-alt.icon';
7
8
  import SearchInput from '../SearchInput';
8
9
  import { useBreakpoint, useElement, useI18n, useTheme } from '../../hooks';
9
10
  import VisuallyHiddenText from '../VisuallyHiddenText';
@@ -17,14 +18,18 @@ import { StyledAppHeader, StyledAppHeaderInfo, StyledAppHeaderName, StyledAppHea
17
18
  import AppShellContext from './AppShellContext';
18
19
  import { getHeaderTheme } from './style-utils';
19
20
  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, notifications, searchInput, searchLabel, searchPage, headerUtils, helpMenu, shareApp, portalSwitcher }, ref) {
21
+ import HeaderActionButton, { ActionPopoverDialog } from './HeaderActionButton';
22
+ registerIcon(moreAltIcon);
23
+ const AppHeader = forwardRef(function AppHeader({ appName, contextSwitcher: { contexts, onContextClick, label: contextSwitcherLabel } = {}, fullImageSrc, imageSrc, imageAltText, href, onClick, portalName, target, appNameHidden, operator, notifications, searchInput, searchLabel, searchPage, headerUtils, helpMenu, shareApp, portalSwitcher, headerActions, panel1, popover }, ref) {
21
24
  const t = useI18n();
22
25
  const isMediumOrAbove = useBreakpoint('md');
26
+ const isLargeOrAbove = useBreakpoint('lg');
23
27
  const isSmallOrAbove = useBreakpoint('sm');
24
28
  const [searchExpanded, setSearchExpanded] = useState(false);
25
29
  const [searchContainer, setSearchContainer] = useElement();
26
30
  const { drawerOpen, isTopBar, setSearchContainerEl } = useContext(AppShellContext);
27
31
  const searchInputRef = useRef(null);
32
+ const [compactActionMenuButton, setCompactActionMenuButton] = useElement();
28
33
  const theme = useTheme();
29
34
  const headerTheme = useMemo(() => getHeaderTheme(theme), [theme]);
30
35
  // Below `md` there's no room for the app/portal name side by side, so they stack into two rows.
@@ -40,6 +45,13 @@ const AppHeader = forwardRef(function AppHeader({ appName, contextSwitcher: { co
40
45
  return undefined;
41
46
  })();
42
47
  const searchTakeover = searchDisplay === 'fullWidth';
48
+ const compactHeaderActions = isTopBar && !isSmallOrAbove && !!headerActions?.length;
49
+ const compactPopoverAction = compactHeaderActions
50
+ ? headerActions?.find(action => action.id === popover?.actionId &&
51
+ action.type === 'render' &&
52
+ action.renderTarget === 'popover')
53
+ : undefined;
54
+ const compactActionPopoverOpen = !!compactPopoverAction && popover?.children !== undefined && popover.children !== null;
43
55
  const shareLabel = shareApp?.label ?? t('app_shell_share');
44
56
  useEffect(() => {
45
57
  if (searchPage && searchContainer) {
@@ -73,7 +85,38 @@ const AppHeader = forwardRef(function AppHeader({ appName, contextSwitcher: { co
73
85
  (value => {
74
86
  searchInput.onSearchSubmit?.(value);
75
87
  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: {
88
+ }) }))) })) : (_jsx(StyledAppHeaderSpacer, {})), !searchTakeover && headerUtils?.[1]] }), !searchTakeover && (_jsxs(_Fragment, { children: [compactHeaderActions ? (_jsx(MenuButton, { ref: setCompactActionMenuButton, testId: 'app-header-actions-menu', text: t('app_shell_more'), icon: 'more-alt', iconOnly: true, showArrow: false, variant: 'simple', onClick: () => {
89
+ if (compactActionPopoverOpen)
90
+ popover?.onDismiss();
91
+ }, menu: {
92
+ 'aria-label': t('app_shell_more'),
93
+ items: headerActions.map(action => ({
94
+ id: action.id,
95
+ primary: action.label,
96
+ visual: action.icon ? _jsx(Icon, { name: action.icon }) : undefined,
97
+ count: action.count,
98
+ ...(action.type === 'navigation'
99
+ ? {
100
+ href: action.href,
101
+ onClick: (_id, e) => {
102
+ e.preventDefault();
103
+ action.onClick();
104
+ window.open(action.href, '_blank', 'noopener,noreferrer');
105
+ }
106
+ }
107
+ : {
108
+ onClick: () => {
109
+ if (action.renderTarget === 'panel1' && panel1?.actionId === action.id)
110
+ panel1.onClose?.();
111
+ else
112
+ action.onClick();
113
+ }
114
+ })
115
+ }))
116
+ } })) : (headerActions?.map(action => (_jsx(HeaderActionButton, { action: action, iconOnly: !isLargeOrAbove, panel1: panel1, popover: popover }, action.id)))), compactActionPopoverOpen &&
117
+ compactPopoverAction &&
118
+ compactActionMenuButton &&
119
+ popover && (_jsx(ActionPopoverDialog, { target: compactActionMenuButton, label: compactPopoverAction.label, onDismiss: popover.onDismiss, children: popover.children })), onThemeModeChange && (_jsx(ThemeSwitcher, { themeMode: themeMode, onThemeModeChange: onThemeModeChange })), helpMenu && (_jsx(MenuButton, { variant: 'simple', icon: 'help', text: t('app_header_help'), iconOnly: true, menu: {
77
120
  items: helpMenu
78
121
  } })), portalSwitcher && _jsx(MenuButton, { ...portalSwitcher, iconOnly: !isSmallOrAbove }), shareApp &&
79
122
  (isSmallOrAbove ? (_jsx(Button, { variant: 'secondary', onClick: shareApp.onClick, children: _jsxs(Flex, { container: { gap: 0.5, alignItems: 'center' }, children: [_jsx(Icon, { name: 'share-external' }), _jsx("span", { children: shareLabel })] }) })) : (_jsx(Button, { variant: 'secondary', icon: true, label: shareLabel, onClick: shareApp.onClick, children: _jsx(Icon, { name: 'share-external' }) }))), notifications && _jsx(AppShellNotifications, { ...notifications }), _jsx(AppShellOperator, { as: StyledAppHeaderOperator, actions: operator.actions, popover: { placement: 'bottom-start' }, name: operator.name, children: operator.avatar })] }))] }) }));
@@ -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,M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1B,QAAQ,QACR,IAAI,EAAE;gCACJ,KAAK,EAAE,QAAQ;6BAChB,GACD,CACH,EACA,cAAc,IAAI,KAAC,UAAU,OAAK,cAAc,EAAE,QAAQ,EAAE,CAAC,cAAc,GAAI,EAC/E,QAAQ;4BACP,CAAC,cAAc,CAAC,CAAC,CAAC,CAChB,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,IAAI,IAAC,IAAI,EAAC,gBAAgB,GAAG,EAC9B,yBAAO,UAAU,GAAQ,IACpB,GACA,CACV,CAAC,CAAC,CAAC,CACF,KAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,IAAI,QAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,YAC3E,KAAC,IAAI,IAAC,IAAI,EAAC,gBAAgB,GAAG,GACvB,CACV,CAAC,EACH,aAAa,IAAI,KAAC,qBAAqB,OAAK,aAAa,GAAI,EAC9D,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 AppShellNotifications from './Notifications';\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 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 notifications,\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} iconOnly={!isSmallOrAbove} />}\n {shareApp &&\n (isSmallOrAbove ? (\n <Button variant='secondary' onClick={shareApp.onClick}>\n <Flex container={{ gap: 0.5, alignItems: 'center' }}>\n <Icon name='share-external' />\n <span>{shareLabel}</span>\n </Flex>\n </Button>\n ) : (\n <Button variant='secondary' icon label={shareLabel} onClick={shareApp.onClick}>\n <Icon name='share-external' />\n </Button>\n ))}\n {notifications && <AppShellNotifications {...notifications} />}\n <AppShellOperator\n as={StyledAppHeaderOperator}\n actions={operator.actions}\n popover={{ placement: 'bottom-start' }}\n name={operator.name}\n >\n {operator.avatar}\n </AppShellOperator>\n </>\n )}\n </Flex>\n </ThemeOverride>\n );\n});\n\nexport default AppHeader;\n"]}
1
+ {"version":3,"file":"AppHeader.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGrF,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,MAAM,UAAU,CAAC;AAC7B,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,WAAW,MAAM,6BAA6B,CAAC;AAC3D,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,qBAAqB,MAAM,iBAAiB,CAAC;AACpD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EAC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C,cAAc,GAAI,EAC/E,QAAQ;4BACP,CAAC,cAAc,CAAC,CAAC,CAAC,CAChB,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,IAAI,IAAC,IAAI,EAAC,gBAAgB,GAAG,EAC9B,yBAAO,UAAU,GAAQ,IACpB,GACA,CACV,CAAC,CAAC,CAAC,CACF,KAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,IAAI,QAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,YAC3E,KAAC,IAAI,IAAC,IAAI,EAAC,gBAAgB,GAAG,GACvB,CACV,CAAC,EACH,aAAa,IAAI,KAAC,qBAAqB,OAAK,aAAa,GAAI,EAC9D,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, { registerIcon } from '../Icon';\nimport * as moreAltIcon from '../Icon/icons/more-alt.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 AppShellNotifications from './Notifications';\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 AppShellContext from './AppShellContext';\nimport { getHeaderTheme } from './style-utils';\nimport ThemeSwitcher from './ThemeSwitcher';\nimport HeaderActionButton, { ActionPopoverDialog } from './HeaderActionButton';\n\nregisterIcon(moreAltIcon);\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 notifications,\n searchInput,\n searchLabel,\n searchPage,\n headerUtils,\n helpMenu,\n shareApp,\n portalSwitcher,\n headerActions,\n panel1,\n popover\n }: AppHeaderProps,\n ref: Ref<Element>\n) {\n const t = useI18n();\n const isMediumOrAbove = useBreakpoint('md');\n const isLargeOrAbove = useBreakpoint('lg');\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 [compactActionMenuButton, setCompactActionMenuButton] = useElement<HTMLButtonElement>();\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 const compactHeaderActions = isTopBar && !isSmallOrAbove && !!headerActions?.length;\n const compactPopoverAction = compactHeaderActions\n ? headerActions?.find(\n action =>\n action.id === popover?.actionId &&\n action.type === 'render' &&\n action.renderTarget === 'popover'\n )\n : undefined;\n const compactActionPopoverOpen =\n !!compactPopoverAction && popover?.children !== undefined && popover.children !== null;\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 {compactHeaderActions ? (\n <MenuButton\n ref={setCompactActionMenuButton}\n testId='app-header-actions-menu'\n text={t('app_shell_more')}\n icon='more-alt'\n iconOnly\n showArrow={false}\n variant='simple'\n onClick={() => {\n if (compactActionPopoverOpen) popover?.onDismiss();\n }}\n menu={{\n 'aria-label': t('app_shell_more'),\n items: headerActions.map(action => ({\n id: action.id,\n primary: action.label,\n visual: action.icon ? <Icon name={action.icon} /> : undefined,\n count: action.count,\n ...(action.type === 'navigation'\n ? {\n href: action.href,\n onClick: (_id, e) => {\n e.preventDefault();\n action.onClick();\n window.open(action.href, '_blank', 'noopener,noreferrer');\n }\n }\n : {\n onClick: () => {\n if (action.renderTarget === 'panel1' && panel1?.actionId === action.id)\n panel1.onClose?.();\n else action.onClick();\n }\n })\n }))\n }}\n />\n ) : (\n headerActions?.map(action => (\n <HeaderActionButton\n key={action.id}\n action={action}\n iconOnly={!isLargeOrAbove}\n panel1={panel1}\n popover={popover}\n />\n ))\n )}\n {compactActionPopoverOpen &&\n compactPopoverAction &&\n compactActionMenuButton &&\n popover && (\n <ActionPopoverDialog\n target={compactActionMenuButton}\n label={compactPopoverAction.label}\n onDismiss={popover.onDismiss}\n >\n {popover.children}\n </ActionPopoverDialog>\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} iconOnly={!isSmallOrAbove} />}\n {shareApp &&\n (isSmallOrAbove ? (\n <Button variant='secondary' onClick={shareApp.onClick}>\n <Flex container={{ gap: 0.5, alignItems: 'center' }}>\n <Icon name='share-external' />\n <span>{shareLabel}</span>\n </Flex>\n </Button>\n ) : (\n <Button variant='secondary' icon label={shareLabel} onClick={shareApp.onClick}>\n <Icon name='share-external' />\n </Button>\n ))}\n {notifications && <AppShellNotifications {...notifications} />}\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 +1 @@
1
- {"version":3,"file":"AppNavigationPanel.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppNavigationPanel.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAIV,aAAa,EACb,SAAS,EAGT,UAAU,EACX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAE1E,eAAO,MAAM,SAAS,GAAI,6BAGvB;IACD,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,4CA4BA,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,OAAO;IAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,mDA6B1E,CAAC;AAwDF,eAAO,MAAM,KAAK,GAAI,WAAW,UAAU,4CAyG1C,CAAC;AA8DF,QAAA,MAAM,kBAAkB,GAAI,iGAWzB,uBAAuB,4CAgCzB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"AppNavigationPanel.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppNavigationPanel.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAIV,aAAa,EACb,SAAS,EAGT,UAAU,EACX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAE1E,eAAO,MAAM,SAAS,GAAI,6BAGvB;IACD,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,4CA4BA,CAAC;AAEF,eAAO,MAAM,KAAK,GAAI,OAAO;IAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,mDA6B1E,CAAC;AAwDF,eAAO,MAAM,KAAK,GAAI,WAAW,UAAU,4CA+G1C,CAAC;AA8DF,QAAA,MAAM,kBAAkB,GAAI,iGAWzB,uBAAuB,4CAgCzB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useState, useEffect, useCallback, useMemo, useContext } from 'react';
2
+ import { useState, useEffect, useCallback, useMemo, useContext, useRef } from 'react';
3
3
  import Button from '../Button';
4
4
  import Grid from '../Grid';
5
5
  import Icon from '../Icon';
@@ -87,9 +87,15 @@ const Cases = (props) => {
87
87
  export const Utils = ({ items }) => {
88
88
  const { navOpen, navState, drawerOpen, setDrawerOpen } = useContext(AppShellContext);
89
89
  const [item, setItem] = useState();
90
+ // A refresh only replaces the content of the item; it must not reopen a drawer closed in the meantime.
91
+ const refreshingRef = useRef(false);
90
92
  useEffect(() => {
91
93
  if (drawerOpen && item) {
92
- setItem(items?.find((utilItem) => !isValidElement(utilItem) && utilItem.name === item.name));
94
+ const refreshed = items?.find((utilItem) => !isValidElement(utilItem) && utilItem.name === item.name);
95
+ // Only a changed item triggers the effect below that consumes the flag.
96
+ if (refreshed !== item)
97
+ refreshingRef.current = true;
98
+ setItem(refreshed);
93
99
  }
94
100
  }, [items]);
95
101
  const transform = useCallback((utilItem) => {
@@ -116,7 +122,9 @@ export const Utils = ({ items }) => {
116
122
  ];
117
123
  }, [items, transform]);
118
124
  useEffect(() => {
119
- if (item)
125
+ const refreshing = refreshingRef.current;
126
+ refreshingRef.current = false;
127
+ if (item && !refreshing)
120
128
  setDrawerOpen(true);
121
129
  }, [item]);
122
130
  useEffect(() => {
@@ -140,6 +148,7 @@ export const Utils = ({ items }) => {
140
148
  setItem({ ...next });
141
149
  },
142
150
  refreshDrawer: (next) => {
151
+ refreshingRef.current = true;
143
152
  setItem({ ...next });
144
153
  }
145
154
  }), [drawerOpen, item?.name]);
@@ -1 +1 @@
1
- {"version":3,"file":"AppNavigationPanel.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppNavigationPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG9E,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,MAAM,UAAU,CAAC;AAC7B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,eAAe,EAAE,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,cAAc,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACL,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAa3B,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EACxB,SAAS,EACT,YAAY,EAIb,EAAE,EAAE;IACH,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IAEpB,MAAM,oBAAoB,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;QACpD,OAAO;YACL,GAAG,QAAQ;YACX,MAAM,EAAE,QAAQ,CAAC,IAAI,C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,KAAK,IAAI,KAAC,KAAK,IAAC,KAAK,EAAE,KAAK,GAAI,EAChC,KAAK,IAAI,KAAC,KAAK,IAAC,KAAK,EAAE,KAAK,GAAI,EAChC,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CACzC,KAAC,oBAAoB,IAAC,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAI,CAC1E,IACgB,EAClB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,KAAC,oBAAoB,KAAG,EACrE,KAAC,KAAK,IAAC,KAAK,EAAE,KAAK,GAAI,EACtB,KAAK,IAAI,KAAC,WAAW,IAAC,KAAK,EAAE,KAAK,GAAI,IACtC,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import { useState, useEffect, useCallback, useMemo, useContext } from 'react';\nimport type { ElementType, MouseEvent } from 'react';\n\nimport Button from '../Button';\nimport Grid from '../Grid';\nimport Icon from '../Icon';\nimport Image from '../Image';\nimport Link from '../Link';\nimport Tooltip from '../Tooltip';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\nimport { useI18n, useElement } from '../../hooks';\nimport { isValidElement } from '../../utils';\n\nimport NavigationList from './NavigationList';\nimport AppShellContext, { AppShellDrawerContext } from './AppShellContext';\nimport AppShellDrawer from './Drawer';\nimport { AppShellSearch } from './AppShellSearch';\nimport {\n StyledAppInfo,\n StyledCaseTypes,\n StyledScrollWrap,\n StyledUtils,\n StyledNavCasesList,\n StyledCountIcon,\n StyledUtilIconCount,\n StyledAppShellTooltip,\n StyledUtilsSeparator,\n StyledAIAssistant\n} from './AppShell.styles';\nimport type {\n AgentProps,\n AppInfoProps,\n CaseProps,\n CaseTypeProps,\n LinkProps,\n NavListItemProps,\n UtilItemProps,\n UtilsProps\n} from './AppShell.types';\nimport type { AppNavigationPanelProps } from './AppNavigationPanel.types';\n\nexport const CaseTypes = ({\n caseTypes,\n mobileNavBar\n}: {\n caseTypes: CaseTypeProps[];\n mobileNavBar?: boolean;\n}) => {\n const t = useI18n();\n\n const transformedCaseTypes = caseTypes.map(caseType => {\n return {\n ...caseType,\n visual: caseType.icon ? <Icon name={caseType.icon} /> : undefined,\n primary: caseType.name\n };\n });\n\n return useMemo(\n () => (\n <StyledCaseTypes>\n <NavigationList\n items={[\n {\n primary: t('app_shell_create'),\n visual: <Icon name='plus' />,\n items: transformedCaseTypes\n }\n ]}\n mobileNavBar={mobileNavBar}\n />\n </StyledCaseTypes>\n ),\n [caseTypes, mobileNavBar]\n );\n};\n\nexport const Links = (props: { links: LinkProps[]; mobileNavBar?: boolean }) => {\n const { links, mobileNavBar } = props;\n const [transformedLinks, setTransformedLinks] = useState<NavListItemProps[]>([]);\n\n // TODO: Can this be a memo instead of a state and an effect?\n const mergedNavLinks = (items: LinkProps[]): NavListItemProps[] => {\n return items.map((link: LinkProps) => {\n return {\n ...link,\n primary: link.name,\n 'aria-current': link.active ? 'page' : null,\n visual: link.icon ? <Icon name={link.icon} emphasized={link.active} /> : null,\n onClick: link.links ? undefined : link.onClick,\n items: link.links ? mergedNavLinks(link.links) : undefined\n };\n });\n };\n\n useEffect(() => {\n setTransformedLinks(mergedNavLinks(links));\n }, [links]);\n\n if (!links.length) return null;\n\n return (\n <div>\n <NavigationList items={transformedLinks} mobileNavBar={mobileNavBar} />\n </div>\n );\n};\n\nconst AIAssistant = ({ agent }: { agent: AgentProps }) => (\n <StyledAIAssistant>\n <NavigationList\n items={[\n {\n id: agent.id,\n primary: agent.name,\n visual: agent.icon,\n 'aria-current': agent.active ? 'page' : null,\n onClick: agent.onClick\n }\n ]}\n />\n </StyledAIAssistant>\n);\n\nconst Cases = (props: { cases: CaseProps[] }) => {\n const { cases } = props;\n\n const setupCases = (items: CaseProps[]): NavListItemProps[] => {\n return items.map((item: CaseProps) => {\n const {\n id,\n primary,\n secondary,\n collapsedItemInfo,\n visual = <Icon name='case-solid' />,\n active,\n onClick,\n onDismiss,\n ...restProps\n } = item;\n return {\n ...restProps,\n id,\n 'aria-current': active ? 'page' : undefined,\n primary,\n secondary,\n collapsedItemInfo,\n active: !!active,\n onClick,\n onDismiss,\n visual\n };\n });\n };\n\n return (\n <StyledNavCasesList>\n <NavigationList items={setupCases(cases)} />\n </StyledNavCasesList>\n );\n};\n\nexport const Utils = ({ items }: UtilsProps) => {\n const { navOpen, navState, drawerOpen, setDrawerOpen } = useContext(AppShellContext);\n const [item, setItem] = useState<UtilItemProps>();\n\n useEffect(() => {\n if (drawerOpen && item) {\n setItem(\n items?.find<UtilItemProps>(\n (utilItem): utilItem is UtilItemProps =>\n !isValidElement(utilItem) && utilItem.name === item.name\n )\n );\n }\n }, [items]);\n\n const transform = useCallback(\n (utilItem: UtilItemProps): NavListItemProps => {\n const uItem = { ...utilItem };\n delete uItem.onDrawerClose;\n delete uItem.onDrawerOpen;\n return {\n onClick: () => {\n if (utilItem.drawerView) {\n setItem(utilItem);\n }\n },\n ...uItem,\n primary: utilItem.name,\n visual: utilItem.count ? (\n <StyledUtilIconCount>\n {utilItem.visual}\n <StyledCountIcon variant='urgent' id={`${utilItem.name}-count`}>\n {utilItem.count}\n </StyledCountIcon>\n </StyledUtilIconCount>\n ) : (\n utilItem.visual\n ),\n collapseItems: !navOpen\n };\n },\n [navOpen]\n );\n\n const utilItems = useMemo(() => {\n return [\n ...(items ?? []).map(uItem => {\n return isValidElement(uItem) ? uItem : transform(uItem);\n })\n ];\n }, [items, transform]);\n\n useEffect(() => {\n if (item) setDrawerOpen(true);\n }, [item]);\n\n useEffect(() => {\n if (navState === 'closed' || navState === 'closing') setDrawerOpen(false);\n }, [navState]);\n\n // setDrawerOpen comes from AppShellContext (raw useState setter — stable reference).\n // setItem is the local useState setter — also stable. Neither needs to be in deps.\n // openDrawer and refreshDrawer have identical bodies: both spread `next` to create\n // a new object reference so useEffect([item]) always fires, even when the same item\n // is re-opened. The semantic distinction is: openDrawer starts a new drawer session\n // (useEffect triggers setDrawerOpen(true)); refreshDrawer replaces an already-open\n // item's content (setDrawerOpen(true) is a no-op when already open).\n const ctxValue = useMemo(\n () => ({\n drawerOpen,\n openItemName: item?.name,\n closeDrawer: () => {\n setDrawerOpen(false);\n },\n openDrawer: (next: UtilItemProps) => {\n setItem({ ...next });\n },\n refreshDrawer: (next: UtilItemProps) => {\n setItem({ ...next });\n }\n }),\n [drawerOpen, item?.name]\n );\n\n return (\n <AppShellDrawerContext.Provider value={ctxValue}>\n <StyledUtils>\n <NavigationList items={utilItems} collapsed />\n </StyledUtils>\n\n {item && (\n <AppShellDrawer\n drawerOpen={drawerOpen}\n setDrawerOpen={setDrawerOpen}\n content={item.drawerView}\n header={item.drawerHeader || item.name}\n onDrawerClose={() => {\n setItem(undefined);\n item.onDrawerClose?.();\n }}\n onDrawerOpen={item.onDrawerOpen}\n />\n )}\n </AppShellDrawerContext.Provider>\n );\n};\n\nconst AppInfo = ({ appInfo }: { appInfo: AppInfoProps }) => {\n const [appInfoEl, setAppInfoEl] = useElement<HTMLAnchorElement>();\n const { navState } = useContext(AppShellContext);\n\n const {\n appName,\n portalName,\n href: appInfoHref,\n onClick: appInfoOnClick,\n imageSrc: logoSrc,\n appNameHidden,\n ...appInfoRestProps\n } = appInfo;\n\n let appInfoAs: ElementType = 'div';\n if (appInfoHref) appInfoAs = Link;\n else if (appInfoOnClick) appInfoAs = Button;\n\n return (\n <>\n <StyledAppInfo\n as={Grid}\n forwardedAs={appInfoAs}\n variant='link'\n href={appInfoHref}\n onClick={appInfoOnClick}\n aria-label={`${appName}${portalName ? ` - ${portalName}` : ''}`}\n {...appInfoRestProps}\n container={{\n alignItems: 'center',\n areas: portalName ? '\"logo app\" \"logo portal\"' : '\"logo app\"'\n }}\n ref={setAppInfoEl}\n icon\n >\n <Grid item={{ area: 'logo' }} as={Image} src={logoSrc} alt={appName} />\n <Grid item={{ area: 'app' }} as={appNameHidden ? VisuallyHiddenText : 'span'}>\n {appName}\n </Grid>\n {portalName && (\n <Grid item={{ area: 'portal' }} as='span'>\n {portalName}\n </Grid>\n )}\n </StyledAppInfo>\n {navState === 'closed' && (!appNameHidden || portalName) && (\n <Tooltip\n target={appInfoEl}\n placement='right'\n as={StyledAppShellTooltip}\n showDelay='none'\n hideDelay='none'\n >\n {`${appNameHidden ? '' : appName} ${portalName ?? ''}`.trim()}\n </Tooltip>\n )}\n </>\n );\n};\n\nconst AppNavigationPanel = ({\n appInfo,\n navState,\n searchInput,\n searchLabel,\n onClick,\n caseTypes,\n links,\n cases,\n utils,\n agent\n}: AppNavigationPanelProps) => {\n return (\n <>\n {appInfo && <AppInfo appInfo={appInfo} />}\n {searchInput && (\n <AppShellSearch\n searchLabel={searchLabel}\n collapsed={['closed', 'closing'].includes(navState)}\n searchInput={searchInput}\n />\n )}\n <StyledScrollWrap\n container={{ direction: 'column' }}\n item={{ grow: 1 }}\n tabIndex={-1}\n onClick={(e: MouseEvent<HTMLElement>) => {\n // Ensure that clicks on the container (not on interactive child elements) trigger the onClick handler\n if (e.target === e.currentTarget) onClick?.();\n }}\n >\n {caseTypes && caseTypes.length > 0 && <CaseTypes caseTypes={caseTypes} />}\n {links && <Links links={links} />}\n {cases && <Cases cases={cases} />}\n {['open', 'opening'].includes(navState) && (\n <StyledUtilsSeparator navOpen={['open', 'opening'].includes(navState)} />\n )}\n </StyledScrollWrap>\n {['closed', 'closing'].includes(navState) && <StyledUtilsSeparator />}\n <Utils items={utils} />\n {agent && <AIAssistant agent={agent} />}\n </>\n );\n};\n\nexport default AppNavigationPanel;\n"]}
1
+ {"version":3,"file":"AppNavigationPanel.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppNavigationPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAGtF,OAAO,MAAM,MAAM,WA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IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,KAAC,SAAS,IAAC,SAAS,EAAE,SAAS,GAAI,EACxE,KAAK,IAAI,KAAC,KAAK,IAAC,KAAK,EAAE,KAAK,GAAI,EAChC,KAAK,IAAI,KAAC,KAAK,IAAC,KAAK,EAAE,KAAK,GAAI,EAChC,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CACzC,KAAC,oBAAoB,IAAC,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAI,CAC1E,IACgB,EAClB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,KAAC,oBAAoB,KAAG,EACrE,KAAC,KAAK,IAAC,KAAK,EAAE,KAAK,GAAI,EACtB,KAAK,IAAI,KAAC,WAAW,IAAC,KAAK,EAAE,KAAK,GAAI,IACtC,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import { useState, useEffect, useCallback, useMemo, useContext, useRef } from 'react';\nimport type { ElementType, MouseEvent } from 'react';\n\nimport Button from '../Button';\nimport Grid from '../Grid';\nimport Icon from '../Icon';\nimport Image from '../Image';\nimport Link from '../Link';\nimport Tooltip from '../Tooltip';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\nimport { useI18n, useElement } from '../../hooks';\nimport { isValidElement } from '../../utils';\n\nimport NavigationList from './NavigationList';\nimport AppShellContext, { AppShellDrawerContext } from './AppShellContext';\nimport AppShellDrawer from './Drawer';\nimport { AppShellSearch } from './AppShellSearch';\nimport {\n StyledAppInfo,\n StyledCaseTypes,\n StyledScrollWrap,\n StyledUtils,\n StyledNavCasesList,\n StyledCountIcon,\n StyledUtilIconCount,\n StyledAppShellTooltip,\n StyledUtilsSeparator,\n StyledAIAssistant\n} from './AppShell.styles';\nimport type {\n AgentProps,\n AppInfoProps,\n CaseProps,\n CaseTypeProps,\n LinkProps,\n NavListItemProps,\n UtilItemProps,\n UtilsProps\n} from './AppShell.types';\nimport type { AppNavigationPanelProps } from './AppNavigationPanel.types';\n\nexport const CaseTypes = ({\n caseTypes,\n mobileNavBar\n}: {\n caseTypes: CaseTypeProps[];\n mobileNavBar?: boolean;\n}) => {\n const t = useI18n();\n\n const transformedCaseTypes = caseTypes.map(caseType => {\n return {\n ...caseType,\n visual: caseType.icon ? <Icon name={caseType.icon} /> : undefined,\n primary: caseType.name\n };\n });\n\n return useMemo(\n () => (\n <StyledCaseTypes>\n <NavigationList\n items={[\n {\n primary: t('app_shell_create'),\n visual: <Icon name='plus' />,\n items: transformedCaseTypes\n }\n ]}\n mobileNavBar={mobileNavBar}\n />\n </StyledCaseTypes>\n ),\n [caseTypes, mobileNavBar]\n );\n};\n\nexport const Links = (props: { links: LinkProps[]; mobileNavBar?: boolean }) => {\n const { links, mobileNavBar } = props;\n const [transformedLinks, setTransformedLinks] = useState<NavListItemProps[]>([]);\n\n // TODO: Can this be a memo instead of a state and an effect?\n const mergedNavLinks = (items: LinkProps[]): NavListItemProps[] => {\n return items.map((link: LinkProps) => {\n return {\n ...link,\n primary: link.name,\n 'aria-current': link.active ? 'page' : null,\n visual: link.icon ? <Icon name={link.icon} emphasized={link.active} /> : null,\n onClick: link.links ? undefined : link.onClick,\n items: link.links ? mergedNavLinks(link.links) : undefined\n };\n });\n };\n\n useEffect(() => {\n setTransformedLinks(mergedNavLinks(links));\n }, [links]);\n\n if (!links.length) return null;\n\n return (\n <div>\n <NavigationList items={transformedLinks} mobileNavBar={mobileNavBar} />\n </div>\n );\n};\n\nconst AIAssistant = ({ agent }: { agent: AgentProps }) => (\n <StyledAIAssistant>\n <NavigationList\n items={[\n {\n id: agent.id,\n primary: agent.name,\n visual: agent.icon,\n 'aria-current': agent.active ? 'page' : null,\n onClick: agent.onClick\n }\n ]}\n />\n </StyledAIAssistant>\n);\n\nconst Cases = (props: { cases: CaseProps[] }) => {\n const { cases } = props;\n\n const setupCases = (items: CaseProps[]): NavListItemProps[] => {\n return items.map((item: CaseProps) => {\n const {\n id,\n primary,\n secondary,\n collapsedItemInfo,\n visual = <Icon name='case-solid' />,\n active,\n onClick,\n onDismiss,\n ...restProps\n } = item;\n return {\n ...restProps,\n id,\n 'aria-current': active ? 'page' : undefined,\n primary,\n secondary,\n collapsedItemInfo,\n active: !!active,\n onClick,\n onDismiss,\n visual\n };\n });\n };\n\n return (\n <StyledNavCasesList>\n <NavigationList items={setupCases(cases)} />\n </StyledNavCasesList>\n );\n};\n\nexport const Utils = ({ items }: UtilsProps) => {\n const { navOpen, navState, drawerOpen, setDrawerOpen } = useContext(AppShellContext);\n const [item, setItem] = useState<UtilItemProps>();\n // A refresh only replaces the content of the item; it must not reopen a drawer closed in the meantime.\n const refreshingRef = useRef(false);\n\n useEffect(() => {\n if (drawerOpen && item) {\n const refreshed = items?.find<UtilItemProps>(\n (utilItem): utilItem is UtilItemProps =>\n !isValidElement(utilItem) && utilItem.name === item.name\n );\n // Only a changed item triggers the effect below that consumes the flag.\n if (refreshed !== item) refreshingRef.current = true;\n setItem(refreshed);\n }\n }, [items]);\n\n const transform = useCallback(\n (utilItem: UtilItemProps): NavListItemProps => {\n const uItem = { ...utilItem };\n delete uItem.onDrawerClose;\n delete uItem.onDrawerOpen;\n return {\n onClick: () => {\n if (utilItem.drawerView) {\n setItem(utilItem);\n }\n },\n ...uItem,\n primary: utilItem.name,\n visual: utilItem.count ? (\n <StyledUtilIconCount>\n {utilItem.visual}\n <StyledCountIcon variant='urgent' id={`${utilItem.name}-count`}>\n {utilItem.count}\n </StyledCountIcon>\n </StyledUtilIconCount>\n ) : (\n utilItem.visual\n ),\n collapseItems: !navOpen\n };\n },\n [navOpen]\n );\n\n const utilItems = useMemo(() => {\n return [\n ...(items ?? []).map(uItem => {\n return isValidElement(uItem) ? uItem : transform(uItem);\n })\n ];\n }, [items, transform]);\n\n useEffect(() => {\n const refreshing = refreshingRef.current;\n refreshingRef.current = false;\n if (item && !refreshing) setDrawerOpen(true);\n }, [item]);\n\n useEffect(() => {\n if (navState === 'closed' || navState === 'closing') setDrawerOpen(false);\n }, [navState]);\n\n // setDrawerOpen comes from AppShellContext (raw useState setter — stable reference).\n // setItem is the local useState setter — also stable. Neither needs to be in deps.\n // openDrawer and refreshDrawer have identical bodies: both spread `next` to create\n // a new object reference so useEffect([item]) always fires, even when the same item\n // is re-opened. The semantic distinction is: openDrawer starts a new drawer session\n // (useEffect triggers setDrawerOpen(true)); refreshDrawer replaces an already-open\n // item's content (setDrawerOpen(true) is a no-op when already open).\n const ctxValue = useMemo(\n () => ({\n drawerOpen,\n openItemName: item?.name,\n closeDrawer: () => {\n setDrawerOpen(false);\n },\n openDrawer: (next: UtilItemProps) => {\n setItem({ ...next });\n },\n refreshDrawer: (next: UtilItemProps) => {\n refreshingRef.current = true;\n setItem({ ...next });\n }\n }),\n [drawerOpen, item?.name]\n );\n\n return (\n <AppShellDrawerContext.Provider value={ctxValue}>\n <StyledUtils>\n <NavigationList items={utilItems} collapsed />\n </StyledUtils>\n\n {item && (\n <AppShellDrawer\n drawerOpen={drawerOpen}\n setDrawerOpen={setDrawerOpen}\n content={item.drawerView}\n header={item.drawerHeader || item.name}\n onDrawerClose={() => {\n setItem(undefined);\n item.onDrawerClose?.();\n }}\n onDrawerOpen={item.onDrawerOpen}\n />\n )}\n </AppShellDrawerContext.Provider>\n );\n};\n\nconst AppInfo = ({ appInfo }: { appInfo: AppInfoProps }) => {\n const [appInfoEl, setAppInfoEl] = useElement<HTMLAnchorElement>();\n const { navState } = useContext(AppShellContext);\n\n const {\n appName,\n portalName,\n href: appInfoHref,\n onClick: appInfoOnClick,\n imageSrc: logoSrc,\n appNameHidden,\n ...appInfoRestProps\n } = appInfo;\n\n let appInfoAs: ElementType = 'div';\n if (appInfoHref) appInfoAs = Link;\n else if (appInfoOnClick) appInfoAs = Button;\n\n return (\n <>\n <StyledAppInfo\n as={Grid}\n forwardedAs={appInfoAs}\n variant='link'\n href={appInfoHref}\n onClick={appInfoOnClick}\n aria-label={`${appName}${portalName ? ` - ${portalName}` : ''}`}\n {...appInfoRestProps}\n container={{\n alignItems: 'center',\n areas: portalName ? '\"logo app\" \"logo portal\"' : '\"logo app\"'\n }}\n ref={setAppInfoEl}\n icon\n >\n <Grid item={{ area: 'logo' }} as={Image} src={logoSrc} alt={appName} />\n <Grid item={{ area: 'app' }} as={appNameHidden ? VisuallyHiddenText : 'span'}>\n {appName}\n </Grid>\n {portalName && (\n <Grid item={{ area: 'portal' }} as='span'>\n {portalName}\n </Grid>\n )}\n </StyledAppInfo>\n {navState === 'closed' && (!appNameHidden || portalName) && (\n <Tooltip\n target={appInfoEl}\n placement='right'\n as={StyledAppShellTooltip}\n showDelay='none'\n hideDelay='none'\n >\n {`${appNameHidden ? '' : appName} ${portalName ?? ''}`.trim()}\n </Tooltip>\n )}\n </>\n );\n};\n\nconst AppNavigationPanel = ({\n appInfo,\n navState,\n searchInput,\n searchLabel,\n onClick,\n caseTypes,\n links,\n cases,\n utils,\n agent\n}: AppNavigationPanelProps) => {\n return (\n <>\n {appInfo && <AppInfo appInfo={appInfo} />}\n {searchInput && (\n <AppShellSearch\n searchLabel={searchLabel}\n collapsed={['closed', 'closing'].includes(navState)}\n searchInput={searchInput}\n />\n )}\n <StyledScrollWrap\n container={{ direction: 'column' }}\n item={{ grow: 1 }}\n tabIndex={-1}\n onClick={(e: MouseEvent<HTMLElement>) => {\n // Ensure that clicks on the container (not on interactive child elements) trigger the onClick handler\n if (e.target === e.currentTarget) onClick?.();\n }}\n >\n {caseTypes && caseTypes.length > 0 && <CaseTypes caseTypes={caseTypes} />}\n {links && <Links links={links} />}\n {cases && <Cases cases={cases} />}\n {['open', 'opening'].includes(navState) && (\n <StyledUtilsSeparator navOpen={['open', 'opening'].includes(navState)} />\n )}\n </StyledScrollWrap>\n {['closed', 'closing'].includes(navState) && <StyledUtilsSeparator />}\n <Utils items={utils} />\n {agent && <AIAssistant agent={agent} />}\n </>\n );\n};\n\nexport default AppNavigationPanel;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.tsx"],"names":[],"mappings":"AAgDA,OAAO,KAAK,EAAE,aAAa,EAAiB,MAAM,kBAAkB,CAAC;AAQrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAmW1D,QAAA,MAAM,YAAY,yJA6LhB,CAAC;AAEH,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.tsx"],"names":[],"mappings":"AAgDA,OAAO,KAAK,EAAE,aAAa,EAAiB,MAAM,kBAAkB,CAAC;AAQrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAsY1D,QAAA,MAAM,YAAY,yJAgNhB,CAAC;AAEH,eAAe,YAAY,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { forwardRef, useState, useCallback, useMemo, useRef } from 'react';
2
+ import { forwardRef, useState, useCallback, useEffect, useMemo, useRef } from 'react';
3
3
  import Flex from '../Flex';
4
4
  import Icon, { registerIcon } from '../Icon';
5
5
  import * as timesIcon from '../Icon/icons/times.icon';
@@ -34,11 +34,13 @@ import { StyledDocumentTabPanel } from './DocumentTabs.styles';
34
34
  import TopNavDrawerProvider from './TopNavDrawerProvider';
35
35
  import TouchAppShell from './TouchAppShell';
36
36
  import { useNotificationsPopover } from './Notifications';
37
+ import { usePanel } from './Panel';
38
+ import getHeaderActionUtilItems from './headerActionUtils';
37
39
  registerIcon(timesIcon, plusIcon, caseSolidIcon, barsIcon, caretRightIcon, caretLeftIcon, sunIcon, moonIcon, circleMixedLeftIcon, shareExternalIcon);
38
40
  registerAction({ id: 'NextRegion', defaultKeyBinding: 'F9' }, { id: 'PrevRegion', defaultKeyBinding: 'Shift+F9' }, { id: 'KeyboardCommands', defaultKeyBinding: 'CommandOrControl+/' });
39
41
  const AppShell = forwardRef(function AppShell(props, ref) {
40
42
  const t = useI18n();
41
- const { appInfo, contextSwitcher, searchInput, appHeader, searchPage, searchLabel = t('sitewide'), caseTypes, links, agent, banners, progress, main, operator, notifications, utils, headerUtils, helpMenu, cases, defaultExpanded = false, collapsedHoverMenus = false, shareApp, portalSwitcher, navOrientation = 'side-rail', documentTabs, utilsList, ...restProps } = props;
43
+ const { appInfo, contextSwitcher, searchInput, appHeader, searchPage, searchLabel = t('sitewide'), caseTypes, links, agent, banners, progress, main, operator, notifications, utils, headerUtils, helpMenu, cases, defaultExpanded = false, collapsedHoverMenus = false, shareApp, portalSwitcher, navOrientation = 'side-rail', documentTabs, utilsList, headerActions, panel1, popover, ...restProps } = props;
42
44
  const skipLinks = useMemo(() => [
43
45
  {
44
46
  label: t('go_to_main_content'),
@@ -53,6 +55,7 @@ const AppShell = forwardRef(function AppShell(props, ref) {
53
55
  const focusedImperatively = useRef(false);
54
56
  const [headerEl, setHeaderEl] = useElement();
55
57
  const isSmallOrAbove = useBreakpoint('sm');
58
+ const isMediumOrAbove = useBreakpoint('md');
56
59
  const isTopBar = navOrientation === 'top-bar' || !isSmallOrAbove;
57
60
  const showAppHeader = isTopBar || (!!appHeader && isSmallOrAbove);
58
61
  const showMainContent = showAppHeader ? !!headerEl : true;
@@ -124,6 +127,19 @@ const AppShell = forwardRef(function AppShell(props, ref) {
124
127
  openKeyboardCommands();
125
128
  });
126
129
  const { start, end } = useDirection();
130
+ const { panel: panel1Element, panelOpen: panel1Open } = usePanel(panel1);
131
+ // Panel1 replaces the util drawer.
132
+ useEffect(() => {
133
+ if (!panel1Open)
134
+ return;
135
+ setDrawerOpen(false);
136
+ closeNav();
137
+ }, [panel1Open]);
138
+ // Opening a util while panel1 is open makes the consumer close panel1.
139
+ useEffect(() => {
140
+ if (drawerOpen && panel1Open)
141
+ panel1?.onClose?.();
142
+ }, [drawerOpen]);
127
143
  return (_jsxs(AppShellContext.Provider, { value: useMemo(() => ({
128
144
  navOpen: sidebarNavState === 'open' || sidebarNavState === 'opening',
129
145
  drawerOpen,
@@ -138,7 +154,8 @@ const AppShell = forwardRef(function AppShell(props, ref) {
138
154
  isMobileNav: false,
139
155
  isTopBar,
140
156
  previewActive,
141
- setPreviewActive
157
+ setPreviewActive,
158
+ startPanelOpen: panel1Open
142
159
  }), [
143
160
  sidebarNavState,
144
161
  drawerOpen,
@@ -146,11 +163,15 @@ const AppShell = forwardRef(function AppShell(props, ref) {
146
163
  isTopBar,
147
164
  headerEl,
148
165
  searchContainerEl,
149
- previewActive
150
- ]), children: [_jsx(SkipLinks, { items: skipLinks }), showAppHeader && (_jsx(AppHeader, { ...appInfo, contextSwitcher: contextSwitcher, searchInput: searchInput, searchLabel: searchLabel, operator: operator, notifications: notifications, 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: {
166
+ previewActive,
167
+ panel1Open
168
+ ]), children: [_jsx(SkipLinks, { items: skipLinks }), showAppHeader && (_jsx(AppHeader, { ...appInfo, contextSwitcher: contextSwitcher, searchInput: searchInput, searchLabel: searchLabel, operator: operator, notifications: notifications, headerUtils: headerUtils, helpMenu: helpMenu, searchPage: searchPage, shareApp: shareApp, portalSwitcher: portalSwitcher, headerActions: headerActions, panel1: panel1, popover: popover, ref: setHeaderEl })), isTopBar && (_jsx(TopNavDrawerProvider, { forceClosed: panel1Open, onOpen: () => {
169
+ if (panel1Open)
170
+ panel1?.onClose?.();
171
+ }, 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: {
151
172
  direction: 'column',
152
173
  justify: 'between'
153
- }, 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: () => {
174
+ }, id: navId, as: StyledSidebarNav, portalAgent: !!agent, ref: navRef, "data-app-region": true, inert: panel1Open && !isMediumOrAbove ? '' : undefined, 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: () => {
154
175
  if (['closing', 'closed'].includes(sidebarNavState)) {
155
176
  openNav(0);
156
177
  }
@@ -159,18 +180,18 @@ const AppShell = forwardRef(function AppShell(props, ref) {
159
180
  }
160
181
  }, agent: agent }), _jsxs(Flex, { container: { justify: 'center' }, children: [_jsx(StyledAppShellToggleButton, { icon: true, ref: setExpandCollapseEl, compact: true, variant: 'simple', onClick: () => {
161
182
  setSidebarNavState(sidebarNavState === 'closed' ? 'open' : 'closed');
162
- }, "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 }), (() => {
183
+ }, "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') }))] })] })), panel1Element, showMainContent && (_jsxs(_Fragment, { children: [documentTabs && _jsx(DocumentTabs, { ...documentTabs }), (() => {
163
184
  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] }));
164
185
  if (!documentTabs)
165
186
  return mainRegion;
166
187
  return (_jsx(StyledDocumentTabPanel, { role: 'tabpanel', id: documentTabs.currentTabId ? getTabPanelId(documentTabs.currentTabId) : undefined, "aria-labelledby": documentTabs.currentTabId ? getTabElementId(documentTabs.currentTabId) : undefined, tabIndex: 0, children: mainRegion }));
167
- })()] })), _jsx(AppShellGlobalStyle, { isTopBar: isTopBar, showAppHeader: showAppHeader, isTouchDevice: false, isExtraSmallScreen: !isSmallOrAbove, hasDocumentTabs: !!documentTabs, navOpen: sidebarNavState === 'open' || sidebarNavState === 'opening' })] }));
188
+ })()] })), _jsx(AppShellGlobalStyle, { isTopBar: isTopBar, showAppHeader: showAppHeader, isTouchDevice: false, isExtraSmallScreen: !isSmallOrAbove, hasDocumentTabs: !!documentTabs, navOpen: sidebarNavState === 'open' || sidebarNavState === 'opening', startPanelOpen: panel1Open, startPanelWidth: panel1?.width })] }));
168
189
  });
169
190
  const AppShellMain = forwardRef(function AppShellMain(props, ref) {
170
191
  const t = useI18n();
171
192
  const { start } = useDirection();
172
193
  const navId = useUID();
173
- const { appInfo, appHeader, contextSwitcher, searchPage, searchInput, searchLabel = t('sitewide'), caseTypes, links, cases, agent, utils, operator, notifications, headerUtils, helpMenu, shareApp, banners, progress, main, bottomTouchPanel, documentTabs, navOrientation = 'side-rail', ...restProps } = props;
194
+ const { appInfo, appHeader, contextSwitcher, searchPage, searchInput, searchLabel = t('sitewide'), caseTypes, links, cases, agent, utils, operator, notifications, headerUtils, helpMenu, shareApp, banners, progress, main, bottomTouchPanel, documentTabs, navOrientation = 'side-rail', headerActions, panel1, popover, ...restProps } = props;
174
195
  const isSmallOrAbove = useBreakpoint('sm');
175
196
  const isTopBar = navOrientation === 'top-bar' || !isSmallOrAbove;
176
197
  const showAppHeader = isTouchDevice
@@ -195,6 +216,13 @@ const AppShellMain = forwardRef(function AppShellMain(props, ref) {
195
216
  }
196
217
  }, [contextSwitcher, showAppHeader, t]);
197
218
  const shareLabel = shareApp?.label ?? t('app_shell_share');
219
+ const headerActionUtilItems = useMemo(() => !showAppHeader && headerActions?.length
220
+ ? getHeaderActionUtilItems(headerActions, {
221
+ panel1,
222
+ popover,
223
+ newTabHint: t('opens_in_a_new_tab')
224
+ })
225
+ : [], [headerActions, panel1, popover, showAppHeader, t]);
198
226
  const shareApplicationUtilItem = useMemo(() => {
199
227
  if (!showAppHeader && shareApp) {
200
228
  return {
@@ -262,18 +290,20 @@ const AppShellMain = forwardRef(function AppShellMain(props, ref) {
262
290
  ...(utils ?? []),
263
291
  ...(notificationsUtilItem ? [notificationsUtilItem] : []),
264
292
  ...(contextSwitcherUtilItem ? [contextSwitcherUtilItem] : []),
293
+ ...headerActionUtilItems,
265
294
  ...(shareApplicationUtilItem ? [shareApplicationUtilItem] : []),
266
295
  ...(operatorInfoUtilItem ? [operatorInfoUtilItem] : []),
267
296
  ...(themeSwitcherUtilItem ? [themeSwitcherUtilItem] : [])
268
297
  ], [
269
298
  contextSwitcherUtilItem,
270
299
  notificationsUtilItem,
300
+ headerActionUtilItems,
271
301
  operatorInfoUtilItem,
272
302
  shareApplicationUtilItem,
273
303
  themeSwitcherUtilItem,
274
304
  utils
275
305
  ]);
276
- return (_jsxs(_Fragment, { children: [isTouchDevice ? (_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, notifications: notifications, headerUtils: headerUtils, helpMenu: helpMenu, shareApp: shareApp, banners: banners, progress: progress, main: main, bottomTouchPanel: bottomTouchPanel, documentTabs: documentTabs, navId: navId, restProps: restProps })) : (_jsx(AppShell, { ...props, utilsList: utilsList, ref: ref })), notificationsPopover] }));
306
+ return (_jsxs(_Fragment, { children: [isTouchDevice ? (_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, notifications: notifications, headerUtils: headerUtils, helpMenu: helpMenu, shareApp: shareApp, banners: banners, progress: progress, main: main, bottomTouchPanel: bottomTouchPanel, documentTabs: documentTabs, headerActions: headerActions, panel1: panel1, popover: popover, navId: navId, restProps: restProps })) : (_jsx(AppShell, { ...props, utilsList: utilsList, ref: ref })), notificationsPopover] }));
277
307
  });
278
308
  export default AppShellMain;
279
309
  //# sourceMappingURL=AppShell.js.map