@pega/cosmos-react-core 9.33.2 → 9.34.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.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppHeader.styles.js +9 -0
- package/lib/components/AppShell/AppHeader.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.d.ts +3 -2
- package/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +84 -186
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts +2 -7
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +30 -124
- package/lib/components/AppShell/AppShell.styles.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 +15 -0
- package/lib/components/AppShell/TouchAppShell.d.ts.map +1 -0
- package/lib/components/AppShell/TouchAppShell.js +129 -0
- package/lib/components/AppShell/TouchAppShell.js.map +1 -0
- package/lib/components/AppShell/TouchAppShell.styles.d.ts +207 -0
- package/lib/components/AppShell/TouchAppShell.styles.d.ts.map +1 -0
- package/lib/components/AppShell/TouchAppShell.styles.js +188 -0
- package/lib/components/AppShell/TouchAppShell.styles.js.map +1 -0
- package/lib/components/Dialog/TouchDialog.d.ts.map +1 -1
- package/lib/components/Dialog/TouchDialog.js +42 -11
- package/lib/components/Dialog/TouchDialog.js.map +1 -1
- package/lib/components/Dialog/TouchDialog.styles.d.ts +7 -0
- package/lib/components/Dialog/TouchDialog.styles.d.ts.map +1 -1
- package/lib/components/Dialog/TouchDialog.styles.js +15 -0
- package/lib/components/Dialog/TouchDialog.styles.js.map +1 -1
- package/lib/components/Dialog/TouchDialog.types.d.ts +10 -2
- package/lib/components/Dialog/TouchDialog.types.d.ts.map +1 -1
- package/lib/components/Dialog/TouchDialog.types.js.map +1 -1
- package/lib/components/Modal/DockedModals.d.ts.map +1 -1
- package/lib/components/Modal/DockedModals.js +3 -2
- package/lib/components/Modal/DockedModals.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppHeader.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.styles.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIzC,eAAO,MAAM,qBAAqB,6NAIhC,CAAC;AAIH,eAAO,MAAM,mBAAmB;gBAA4B,OAAO;YA2BjE,CAAC;AAIH,eAAO,MAAM,yBAAyB;oBACpB,MAAM,GAAG,MAAM,GAAG,WAAW;YAqF9C,CAAC;AAIF,eAAO,MAAM,qBAAqB,6NAEjC,CAAC;AAEF,eAAO,MAAM,mBAAmB,6NAI9B,CAAC;AAIH,eAAO,MAAM,mBAAmB;cAA0B,OAAO;YAQhE,CAAC;AAGF,eAAO,MAAM,mBAAmB;;;aACrB,SAAS,CAAC,SAAS,CAAC;cACnB,OAAO;8HA+CjB,CAAC;AAIH,eAAO,MAAM,uBAAuB,yOAQnC,CAAC;AAIF,eAAO,MAAM,eAAe;aAA4B,OAAO;gBAAc,OAAO;
|
|
1
|
+
{"version":3,"file":"AppHeader.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.styles.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIzC,eAAO,MAAM,qBAAqB,6NAIhC,CAAC;AAIH,eAAO,MAAM,mBAAmB;gBAA4B,OAAO;YA2BjE,CAAC;AAIH,eAAO,MAAM,yBAAyB;oBACpB,MAAM,GAAG,MAAM,GAAG,WAAW;YAqF9C,CAAC;AAIF,eAAO,MAAM,qBAAqB,6NAEjC,CAAC;AAEF,eAAO,MAAM,mBAAmB,6NAI9B,CAAC;AAIH,eAAO,MAAM,mBAAmB;cAA0B,OAAO;YAQhE,CAAC;AAGF,eAAO,MAAM,mBAAmB;;;aACrB,SAAS,CAAC,SAAS,CAAC;cACnB,OAAO;8HA+CjB,CAAC;AAIH,eAAO,MAAM,uBAAuB,yOAQnC,CAAC;AAIF,eAAO,MAAM,eAAe;aAA4B,OAAO;gBAAc,OAAO;YA2EnF,CAAC"}
|
|
@@ -229,6 +229,15 @@ export const StyledAppHeader = styled.header(({ stacked, drawerOpen, theme }) =>
|
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
+
|
|
233
|
+
&::before {
|
|
234
|
+
content: '';
|
|
235
|
+
position: absolute;
|
|
236
|
+
inset-block-start: calc(-1 * var(--appshell-hard-top-offset));
|
|
237
|
+
inset-inline: 0;
|
|
238
|
+
height: var(--appshell-hard-top-offset);
|
|
239
|
+
background: inherit;
|
|
240
|
+
}
|
|
232
241
|
`;
|
|
233
242
|
});
|
|
234
243
|
StyledAppHeader.defaultProps = defaultThemeProp;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppHeader.styles.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,wBAAwB,EAEzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,uBAAu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AAY,GAAG,gBAAgB,CAAC","sourcesContent":["import { mix, rgba, transparentize } from 'polished';\nimport styled, { css } from 'styled-components';\n\nimport {\n calculateFontSize,\n getHoverColors,\n calculateForegroundColor,\n type FontSize\n} from '../../styles';\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport { StyledImage } from '../Image';\nimport { StyledMenuListContainer } from '../Menu/Menu.styles';\nimport { StyledPopover } from '../Popover';\nimport { StyledSearchInput } from '../SearchInput';\nimport {\n StyledSearchButton,\n StyledSearchFiltersButton,\n StyledSearchTextInput\n} from '../SearchInput/SearchInput.styles';\nimport Text from '../Text';\nimport type { TextProps } from '../Text';\n\nimport { headerHeight, navWidth } from './AppShell.styles';\n\nexport const StyledContextSwitcher = styled.div(({ theme }) => {\n return css`\n width: calc(${navWidth} - 2 * ${theme.base.spacing});\n `;\n});\n\nStyledContextSwitcher.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderInfo = styled.div<{ centerLogo: boolean }>(({ centerLogo, theme }) => {\n return css`\n & > :first-child {\n vertical-align: top;\n }\n\n & > :is(a, button) {\n cursor: pointer;\n text-decoration: none;\n user-select: none;\n -webkit-user-select: none;\n }\n\n & > :is(a, button):focus-visible {\n box-shadow: ${theme.base.shadow.focus};\n outline: none;\n }\n\n ${StyledImage} {\n height: 1.0725rem;\n\n ${centerLogo &&\n css`\n padding-inline-start: ${theme.base.spacing};\n `}\n }\n `;\n});\n\nStyledAppHeaderInfo.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderSearchForm = styled.form<{\n searchDisplay?: 'icon' | 'grow' | 'fullWidth';\n}>(\n ({\n searchDisplay,\n theme: {\n base: { animation },\n components: {\n 'app-shell': { header },\n input\n }\n }\n }) => {\n const {\n background: headerBg,\n 'search-input': {\n 'background-color': searchInputBg,\n 'foreground-color': searchInputFg,\n 'border-color': searchInputBorder\n }\n } = header;\n\n const searchBg = searchInputBg;\n const searchFg = calculateForegroundColor(headerBg, searchInputFg);\n const searchBorder = calculateForegroundColor(headerBg, searchInputBorder);\n\n return css`\n max-width: 33vw;\n min-width: 10rem;\n width: 100%;\n justify-self: center;\n margin-inline-start: 0;\n margin-inline-end: auto;\n transition: max-width ${animation.speed} ${animation.timing.ease};\n\n ${StyledSearchInput} input::placeholder {\n color: ${transparentize(0.4, searchFg)};\n }\n\n ${searchDisplay === 'icon' &&\n css`\n max-width: ${input.height};\n min-width: ${input.height};\n width: auto;\n margin-inline-start: auto;\n margin-inline-end: 0;\n `}\n\n ${searchDisplay === 'grow' &&\n css`\n flex-grow: 1;\n max-width: 100%;\n margin-inline-end: 0;\n `}\n\n ${searchDisplay === 'fullWidth' &&\n css`\n max-width: 100%;\n margin-inline-end: 0;\n `}\n\n &:not([focused]) {\n ${StyledSearchInput} {\n background: ${searchBg};\n border-color: ${searchBorder};\n ${StyledSearchButton} {\n background: ${searchBg};\n color: ${searchFg};\n border-color: ${searchBorder};\n }\n\n ${StyledSearchTextInput} {\n background: ${searchBg};\n color: ${searchFg};\n border-color: ${searchBorder};\n }\n\n ${StyledSearchFiltersButton} {\n background: ${searchBg};\n color: ${searchFg};\n border-color: ${searchBorder};\n }\n }\n }\n `;\n }\n);\n\nStyledAppHeaderSearchForm.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderSpacer = styled.div`\n margin: auto;\n`;\n\nexport const StyledAppHeaderLogo = styled.div(({ theme }) => {\n return css`\n max-width: min(${theme.base['content-width'].sm}, 25vw);\n `;\n});\nStyledAppHeaderLogo.defaultProps = defaultThemeProp;\n\n// Shrinks the app/portal name for ellipsis truncation; stacks vertically below `md` where there's no room for both names side by side.\nexport const StyledAppHeaderName = styled.div<{ stacked?: boolean }>(\n ({ theme, stacked }) => css`\n display: flex;\n flex-direction: ${stacked ? 'column' : 'row'};\n align-items: ${stacked ? 'stretch' : 'baseline'};\n gap: ${stacked ? 0 : theme.base.spacing};\n min-width: 0;\n `\n);\nStyledAppHeaderName.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderText = styled(Text)<{\n variant: TextProps['variant'];\n stacked?: boolean;\n}>(({ theme, variant, stacked }) => {\n const headerBg = theme.components['app-shell'].header.background;\n const headerFgColor = theme.components['app-shell'].header['foreground-color'];\n\n const foregroundColor =\n theme.components['app-shell'].header['app-name-color'] === 'auto'\n ? calculateForegroundColor(headerBg, headerFgColor)\n : theme.components['app-shell'].header['app-name-color'];\n\n const secondaryColor =\n theme.components['app-shell'].header['portal-name-color'] === 'auto'\n ? tryCatch(() =>\n rgba(\n foregroundColor ?? theme.base.palette['foreground-color'],\n theme.base.transparency['transparent-2']\n )\n )\n : theme.components['app-shell'].header['portal-name-color'];\n\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n display: inline-block;\n max-width: 100%;\n min-width: 0;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n color: ${variant === 'secondary' ? secondaryColor : foregroundColor};\n font-family: ${theme.components.text['brand-primary']['font-family']};\n\n ${variant === 'primary' &&\n css`\n font-size: ${fontSize[theme.components.text['brand-primary']['font-size'] as FontSize]};\n font-weight: ${theme.components.text['brand-primary']['font-weight']};\n `}\n\n ${variant === 'secondary' &&\n css`\n font-size: ${fontSize[theme.components.text.secondary['font-size'] as FontSize]};\n ${stacked &&\n css`\n align-self: flex-start;\n `}\n `}\n `;\n});\n\nStyledAppHeaderText.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderOperator = styled.button(\n ({ theme }) => css`\n border-radius: 50%;\n\n :focus-visible {\n box-shadow: ${theme.base.shadow.focus};\n }\n `\n);\n\nStyledAppHeaderOperator.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeader = styled.header<{ stacked: boolean; drawerOpen: boolean }>(\n ({ stacked, drawerOpen, theme }) => {\n const headerBg = theme.components['app-shell'].header.background;\n const headerFgColor = theme.components['app-shell'].header['foreground-color'];\n\n const foregroundColor = calculateForegroundColor(headerBg, headerFgColor);\n\n const hoverColors = getHoverColors(\n tryCatch(\n () => mix(0.01, theme.base.palette.interactive, headerBg),\n () => theme.base.palette.interactive\n )\n );\n\n return css`\n position: sticky;\n z-index: calc(${theme.base['z-index'].backdrop} - 1);\n ${drawerOpen &&\n css`\n z-index: calc(${theme.base['z-index'].backdrop} - 2);\n `}\n top: var(--appshell-hard-top-offset, 0);\n gap: ${theme.base.spacing};\n max-width: 100%;\n height: ${headerHeight};\n background: ${headerBg};\n color: ${foregroundColor};\n border-bottom: solid 0.0625rem ${theme.components['app-shell'].header['border-color']};\n\n ${StyledAppHeaderInfo} {\n justify-self: flex-start;\n min-width: 33vw;\n\n ${stacked &&\n css`\n min-width: 0;\n `}\n }\n\n ${StyledSearchFiltersButton} {\n color: ${foregroundColor};\n }\n\n > ${StyledAppHeaderOperator} {\n justify-self: flex-end;\n\n + ${StyledPopover} {\n &,\n ${StyledMenuListContainer} {\n background: ${headerBg};\n }\n\n ${StyledMenuListContainer} li {\n color: ${foregroundColor};\n background-color: transparent;\n\n &:hover,\n &[data-current='true'] {\n color: ${hoverColors.foreground};\n background-color: ${hoverColors.background};\n }\n }\n }\n }\n `;\n }\n);\n\nStyledAppHeader.defaultProps = defaultThemeProp;\n"]}
|
|
1
|
+
{"version":3,"file":"AppHeader.styles.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppHeader.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,wBAAwB,EAEzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;A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CAAC","sourcesContent":["import { mix, rgba, transparentize } from 'polished';\nimport styled, { css } from 'styled-components';\n\nimport {\n calculateFontSize,\n getHoverColors,\n calculateForegroundColor,\n type FontSize\n} from '../../styles';\nimport { defaultThemeProp } from '../../theme';\nimport { tryCatch } from '../../utils';\nimport { StyledImage } from '../Image';\nimport { StyledMenuListContainer } from '../Menu/Menu.styles';\nimport { StyledPopover } from '../Popover';\nimport { StyledSearchInput } from '../SearchInput';\nimport {\n StyledSearchButton,\n StyledSearchFiltersButton,\n StyledSearchTextInput\n} from '../SearchInput/SearchInput.styles';\nimport Text from '../Text';\nimport type { TextProps } from '../Text';\n\nimport { headerHeight, navWidth } from './AppShell.styles';\n\nexport const StyledContextSwitcher = styled.div(({ theme }) => {\n return css`\n width: calc(${navWidth} - 2 * ${theme.base.spacing});\n `;\n});\n\nStyledContextSwitcher.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderInfo = styled.div<{ centerLogo: boolean }>(({ centerLogo, theme }) => {\n return css`\n & > :first-child {\n vertical-align: top;\n }\n\n & > :is(a, button) {\n cursor: pointer;\n text-decoration: none;\n user-select: none;\n -webkit-user-select: none;\n }\n\n & > :is(a, button):focus-visible {\n box-shadow: ${theme.base.shadow.focus};\n outline: none;\n }\n\n ${StyledImage} {\n height: 1.0725rem;\n\n ${centerLogo &&\n css`\n padding-inline-start: ${theme.base.spacing};\n `}\n }\n `;\n});\n\nStyledAppHeaderInfo.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderSearchForm = styled.form<{\n searchDisplay?: 'icon' | 'grow' | 'fullWidth';\n}>(\n ({\n searchDisplay,\n theme: {\n base: { animation },\n components: {\n 'app-shell': { header },\n input\n }\n }\n }) => {\n const {\n background: headerBg,\n 'search-input': {\n 'background-color': searchInputBg,\n 'foreground-color': searchInputFg,\n 'border-color': searchInputBorder\n }\n } = header;\n\n const searchBg = searchInputBg;\n const searchFg = calculateForegroundColor(headerBg, searchInputFg);\n const searchBorder = calculateForegroundColor(headerBg, searchInputBorder);\n\n return css`\n max-width: 33vw;\n min-width: 10rem;\n width: 100%;\n justify-self: center;\n margin-inline-start: 0;\n margin-inline-end: auto;\n transition: max-width ${animation.speed} ${animation.timing.ease};\n\n ${StyledSearchInput} input::placeholder {\n color: ${transparentize(0.4, searchFg)};\n }\n\n ${searchDisplay === 'icon' &&\n css`\n max-width: ${input.height};\n min-width: ${input.height};\n width: auto;\n margin-inline-start: auto;\n margin-inline-end: 0;\n `}\n\n ${searchDisplay === 'grow' &&\n css`\n flex-grow: 1;\n max-width: 100%;\n margin-inline-end: 0;\n `}\n\n ${searchDisplay === 'fullWidth' &&\n css`\n max-width: 100%;\n margin-inline-end: 0;\n `}\n\n &:not([focused]) {\n ${StyledSearchInput} {\n background: ${searchBg};\n border-color: ${searchBorder};\n ${StyledSearchButton} {\n background: ${searchBg};\n color: ${searchFg};\n border-color: ${searchBorder};\n }\n\n ${StyledSearchTextInput} {\n background: ${searchBg};\n color: ${searchFg};\n border-color: ${searchBorder};\n }\n\n ${StyledSearchFiltersButton} {\n background: ${searchBg};\n color: ${searchFg};\n border-color: ${searchBorder};\n }\n }\n }\n `;\n }\n);\n\nStyledAppHeaderSearchForm.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderSpacer = styled.div`\n margin: auto;\n`;\n\nexport const StyledAppHeaderLogo = styled.div(({ theme }) => {\n return css`\n max-width: min(${theme.base['content-width'].sm}, 25vw);\n `;\n});\nStyledAppHeaderLogo.defaultProps = defaultThemeProp;\n\n// Shrinks the app/portal name for ellipsis truncation; stacks vertically below `md` where there's no room for both names side by side.\nexport const StyledAppHeaderName = styled.div<{ stacked?: boolean }>(\n ({ theme, stacked }) => css`\n display: flex;\n flex-direction: ${stacked ? 'column' : 'row'};\n align-items: ${stacked ? 'stretch' : 'baseline'};\n gap: ${stacked ? 0 : theme.base.spacing};\n min-width: 0;\n `\n);\nStyledAppHeaderName.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderText = styled(Text)<{\n variant: TextProps['variant'];\n stacked?: boolean;\n}>(({ theme, variant, stacked }) => {\n const headerBg = theme.components['app-shell'].header.background;\n const headerFgColor = theme.components['app-shell'].header['foreground-color'];\n\n const foregroundColor =\n theme.components['app-shell'].header['app-name-color'] === 'auto'\n ? calculateForegroundColor(headerBg, headerFgColor)\n : theme.components['app-shell'].header['app-name-color'];\n\n const secondaryColor =\n theme.components['app-shell'].header['portal-name-color'] === 'auto'\n ? tryCatch(() =>\n rgba(\n foregroundColor ?? theme.base.palette['foreground-color'],\n theme.base.transparency['transparent-2']\n )\n )\n : theme.components['app-shell'].header['portal-name-color'];\n\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n display: inline-block;\n max-width: 100%;\n min-width: 0;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n color: ${variant === 'secondary' ? secondaryColor : foregroundColor};\n font-family: ${theme.components.text['brand-primary']['font-family']};\n\n ${variant === 'primary' &&\n css`\n font-size: ${fontSize[theme.components.text['brand-primary']['font-size'] as FontSize]};\n font-weight: ${theme.components.text['brand-primary']['font-weight']};\n `}\n\n ${variant === 'secondary' &&\n css`\n font-size: ${fontSize[theme.components.text.secondary['font-size'] as FontSize]};\n ${stacked &&\n css`\n align-self: flex-start;\n `}\n `}\n `;\n});\n\nStyledAppHeaderText.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeaderOperator = styled.button(\n ({ theme }) => css`\n border-radius: 50%;\n\n :focus-visible {\n box-shadow: ${theme.base.shadow.focus};\n }\n `\n);\n\nStyledAppHeaderOperator.defaultProps = defaultThemeProp;\n\nexport const StyledAppHeader = styled.header<{ stacked: boolean; drawerOpen: boolean }>(\n ({ stacked, drawerOpen, theme }) => {\n const headerBg = theme.components['app-shell'].header.background;\n const headerFgColor = theme.components['app-shell'].header['foreground-color'];\n\n const foregroundColor = calculateForegroundColor(headerBg, headerFgColor);\n\n const hoverColors = getHoverColors(\n tryCatch(\n () => mix(0.01, theme.base.palette.interactive, headerBg),\n () => theme.base.palette.interactive\n )\n );\n\n return css`\n position: sticky;\n z-index: calc(${theme.base['z-index'].backdrop} - 1);\n ${drawerOpen &&\n css`\n z-index: calc(${theme.base['z-index'].backdrop} - 2);\n `}\n top: var(--appshell-hard-top-offset, 0);\n gap: ${theme.base.spacing};\n max-width: 100%;\n height: ${headerHeight};\n background: ${headerBg};\n color: ${foregroundColor};\n border-bottom: solid 0.0625rem ${theme.components['app-shell'].header['border-color']};\n\n ${StyledAppHeaderInfo} {\n justify-self: flex-start;\n min-width: 33vw;\n\n ${stacked &&\n css`\n min-width: 0;\n `}\n }\n\n ${StyledSearchFiltersButton} {\n color: ${foregroundColor};\n }\n\n > ${StyledAppHeaderOperator} {\n justify-self: flex-end;\n\n + ${StyledPopover} {\n &,\n ${StyledMenuListContainer} {\n background: ${headerBg};\n }\n\n ${StyledMenuListContainer} li {\n color: ${foregroundColor};\n background-color: transparent;\n\n &:hover,\n &[data-current='true'] {\n color: ${hoverColors.foreground};\n background-color: ${hoverColors.background};\n }\n }\n }\n }\n\n &::before {\n content: '';\n position: absolute;\n inset-block-start: calc(-1 * var(--appshell-hard-top-offset));\n inset-inline: 0;\n height: var(--appshell-hard-top-offset);\n background: inherit;\n }\n `;\n }\n);\n\nStyledAppHeader.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AppShellProps } from './AppShell.types';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import type { TouchAppShellProps } from './TouchAppShell';
|
|
3
|
+
declare const AppShellMain: import("react").ForwardRefExoticComponent<AppShellProps & Pick<TouchAppShellProps, "bottomTouchPanel"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
4
|
+
export default AppShellMain;
|
|
4
5
|
//# 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;AAMrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AA+T1D,QAAA,MAAM,YAAY,yJAuKhB,CAAC;AAEH,eAAe,YAAY,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
2
|
-
import { forwardRef, useState, useCallback,
|
|
3
|
-
import { Alert } from '../Badges';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
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,57 @@ 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 TopNavDrawerProvider from './TopNavDrawerProvider';
|
|
33
|
+
import TouchAppShell from './TouchAppShell';
|
|
35
34
|
registerIcon(timesIcon, plusIcon, caseSolidIcon, barsIcon, caretRightIcon, caretLeftIcon, sunIcon, moonIcon, circleMixedLeftIcon, shareIcon);
|
|
36
35
|
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
36
|
const AppShell = forwardRef(function AppShell(props, ref) {
|
|
69
37
|
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
|
|
38
|
+
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', utilsList, ...restProps } = props;
|
|
39
|
+
const skipLinks = useMemo(() => [
|
|
40
|
+
{
|
|
41
|
+
label: t('go_to_main_content'),
|
|
42
|
+
target: { ariaLabel: t('main_content'), selector: 'main' }
|
|
43
|
+
}
|
|
44
|
+
], [t]);
|
|
72
45
|
const navRef = useConsolidatedRef(ref);
|
|
73
|
-
const mobileButtonRef = useRef(null);
|
|
74
46
|
const navId = useUID();
|
|
75
47
|
const [expandCollapseEl, setExpandCollapseEl] = useElement();
|
|
76
|
-
const [mobileNavOpen, setMobileNavOpen] = useState(false);
|
|
77
48
|
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
78
|
-
const [mobileNavLinksCount, setMobileNavLinksCount] = useState(0);
|
|
79
49
|
const { previewActive, setPreviewActive } = usePreviewManager();
|
|
80
50
|
const focusedImperatively = useRef(false);
|
|
81
51
|
const [headerEl, setHeaderEl] = useElement();
|
|
82
|
-
const [mobileHeaderEl, setMobileHeaderEl] = useElement();
|
|
83
52
|
const isSmallOrAbove = useBreakpoint('sm');
|
|
84
|
-
|
|
85
|
-
const showMobileNav = !isSmallOrAbove && isTouchDevice;
|
|
86
|
-
const isTopBar = !showMobileNav && (navOrientation === 'top-bar' || !isSmallOrAbove);
|
|
53
|
+
const isTopBar = navOrientation === 'top-bar' || !isSmallOrAbove;
|
|
87
54
|
const showAppHeader = isTopBar || (!!appHeader && isSmallOrAbove);
|
|
88
|
-
const showMainContent = showAppHeader ? !!
|
|
55
|
+
const showMainContent = showAppHeader ? !!headerEl : true;
|
|
89
56
|
const openNavTimeoutId = useRef();
|
|
90
57
|
const closeNavTimeoutId = useRef();
|
|
91
58
|
const [searchContainerEl, setSearchContainerEl] = useState(null);
|
|
92
59
|
const openKeyboardCommands = useKeyboardCommands();
|
|
93
|
-
const theme = useTheme();
|
|
94
60
|
const { state: sidebarNavState, set: setSidebarNavState } = useTransitionState({
|
|
95
61
|
ref: navRef,
|
|
96
62
|
property: 'width',
|
|
97
63
|
states: openCloseStates,
|
|
98
64
|
defaultState: defaultExpanded ? 'open' : 'closed'
|
|
99
65
|
});
|
|
100
|
-
const skipLinks = useMemo(() => [
|
|
101
|
-
{
|
|
102
|
-
label: t('go_to_main_content'),
|
|
103
|
-
target: { ariaLabel: t('main_content'), selector: 'main' }
|
|
104
|
-
}
|
|
105
|
-
], [t]);
|
|
106
66
|
const openNav = useCallback((delay = 0) => {
|
|
107
67
|
if (closeNavTimeoutId.current)
|
|
108
68
|
clearTimeout(closeNavTimeoutId.current);
|
|
@@ -120,60 +80,6 @@ const AppShell = forwardRef(function AppShell(props, ref) {
|
|
|
120
80
|
const onFocus = useCallback(() => {
|
|
121
81
|
focusedImperatively.current = false;
|
|
122
82
|
}, []);
|
|
123
|
-
const mobileNavRef = useRef(null);
|
|
124
|
-
useEffect(() => {
|
|
125
|
-
const ac = new AbortController();
|
|
126
|
-
// @ts-expect-error Navigation API is available in supported browsers.
|
|
127
|
-
window.navigation.addEventListener('navigate', () => {
|
|
128
|
-
if (mobileNavOpen) {
|
|
129
|
-
setMobileNavOpen(false);
|
|
130
|
-
}
|
|
131
|
-
}, {
|
|
132
|
-
signal: ac.signal
|
|
133
|
-
});
|
|
134
|
-
return () => {
|
|
135
|
-
ac.abort();
|
|
136
|
-
};
|
|
137
|
-
}, [mobileNavOpen]);
|
|
138
|
-
useEffect(() => {
|
|
139
|
-
if (mobileNavOpen) {
|
|
140
|
-
disableScroll();
|
|
141
|
-
}
|
|
142
|
-
else {
|
|
143
|
-
enableScroll();
|
|
144
|
-
}
|
|
145
|
-
}, [mobileNavOpen]);
|
|
146
|
-
useEffect(() => {
|
|
147
|
-
if (mobileNavOpen) {
|
|
148
|
-
const onKeyDown = ({ key }) => {
|
|
149
|
-
if (key === 'Escape')
|
|
150
|
-
setMobileNavOpen(false);
|
|
151
|
-
};
|
|
152
|
-
document.addEventListener('keydown', onKeyDown);
|
|
153
|
-
return () => {
|
|
154
|
-
document.removeEventListener('keydown', onKeyDown);
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
}, [mobileNavOpen]);
|
|
158
|
-
useEffect(() => {
|
|
159
|
-
if (isSmallOrAbove && mobileNavOpen)
|
|
160
|
-
setMobileNavOpen(false);
|
|
161
|
-
}, [isSmallOrAbove, mobileNavOpen]);
|
|
162
|
-
useLayoutEffect(() => {
|
|
163
|
-
if (!mobileHeaderEl)
|
|
164
|
-
return;
|
|
165
|
-
const resizeObserver = new ResizeObserver(debounce(() => {
|
|
166
|
-
const screenWidth = document.documentElement.clientWidth;
|
|
167
|
-
const regionsPaddingInlinePixels = 2 *
|
|
168
|
-
Number.parseInt(window.getComputedStyle(mobileHeaderEl).getPropertyValue('padding-inline-start'), 10);
|
|
169
|
-
const availableWidth = screenWidth * 0.9 - regionsPaddingInlinePixels;
|
|
170
|
-
setMobileNavLinksCount(Math.max(Math.floor(availableWidth / menuButtonWidth(theme)) - (caseTypes?.length ? 2 : 1), 0));
|
|
171
|
-
}, 0));
|
|
172
|
-
resizeObserver.observe(document.documentElement);
|
|
173
|
-
return () => {
|
|
174
|
-
resizeObserver.disconnect();
|
|
175
|
-
};
|
|
176
|
-
}, [mobileHeaderEl, caseTypes?.length]);
|
|
177
83
|
const activatedEl = useRef(document.body);
|
|
178
84
|
useEvent('click', e => {
|
|
179
85
|
activatedEl.current = document.elementFromPoint(e.clientX, e.clientY) ?? document.body;
|
|
@@ -214,9 +120,57 @@ const AppShell = forwardRef(function AppShell(props, ref) {
|
|
|
214
120
|
useShortcut('KeyboardCommands', () => {
|
|
215
121
|
openKeyboardCommands();
|
|
216
122
|
});
|
|
123
|
+
const { start, end } = useDirection();
|
|
124
|
+
return (_jsxs(AppShellContext.Provider, { value: useMemo(() => ({
|
|
125
|
+
navOpen: sidebarNavState === 'open' || sidebarNavState === 'opening',
|
|
126
|
+
drawerOpen,
|
|
127
|
+
setDrawerOpen,
|
|
128
|
+
collapsedHoverMenus,
|
|
129
|
+
navState: sidebarNavState,
|
|
130
|
+
focusedImperatively,
|
|
131
|
+
headerEl,
|
|
132
|
+
appHeaderEl: headerEl ?? null,
|
|
133
|
+
searchContainerEl,
|
|
134
|
+
setSearchContainerEl,
|
|
135
|
+
isMobileNav: false,
|
|
136
|
+
isTopBar,
|
|
137
|
+
previewActive,
|
|
138
|
+
setPreviewActive
|
|
139
|
+
}), [
|
|
140
|
+
sidebarNavState,
|
|
141
|
+
drawerOpen,
|
|
142
|
+
collapsedHoverMenus,
|
|
143
|
+
isTopBar,
|
|
144
|
+
headerEl,
|
|
145
|
+
searchContainerEl,
|
|
146
|
+
previewActive
|
|
147
|
+
]), 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: {
|
|
148
|
+
direction: 'column',
|
|
149
|
+
justify: 'between'
|
|
150
|
+
}, 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: () => {
|
|
151
|
+
if (['closing', 'closed'].includes(sidebarNavState)) {
|
|
152
|
+
openNav(0);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
closeNav(0);
|
|
156
|
+
}
|
|
157
|
+
}, agent: agent }), _jsxs(Flex, { container: { justify: 'center' }, children: [_jsx(StyledAppShellToggleButton, { icon: true, ref: setExpandCollapseEl, compact: true, variant: 'simple', onClick: () => {
|
|
158
|
+
setSidebarNavState(sidebarNavState === 'closed' ? 'open' : 'closed');
|
|
159
|
+
}, "aria-label": t('navigation_panel'), "aria-expanded": sidebarNavState === 'open' || sidebarNavState === 'opening', "aria-controls": navId, children: ['closed', 'closing'].includes(sidebarNavState) ? (_jsx(Icon, { name: `arrow-micro-${end}` })) : (_jsx(Icon, { name: `arrow-micro-${start}` })) }), ['open', 'closed'].includes(sidebarNavState) && (_jsx(Tooltip, { target: expandCollapseEl, placement: 'right', describeTarget: false, as: StyledAppShellTooltip, showDelay: 'none', hideDelay: 'none', children: sidebarNavState === 'closed' ? t('expand_navigation') : t('collapse_navigation') }))] })] })), 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: false })] }));
|
|
160
|
+
});
|
|
161
|
+
const AppShellMain = forwardRef(function AppShellMain(props, ref) {
|
|
162
|
+
const t = useI18n();
|
|
163
|
+
const navId = useUID();
|
|
164
|
+
const { appInfo, appHeader, contextSwitcher, searchPage, searchInput, searchLabel = t('sitewide'), caseTypes, links, cases, agent, utils, operator, headerUtils, helpMenu, shareApp, banners, progress, main, bottomTouchPanel, navOrientation = 'side-rail', ...restProps } = props;
|
|
165
|
+
const isSmallOrAbove = useBreakpoint('sm');
|
|
166
|
+
const isTopBar = navOrientation === 'top-bar' || !isSmallOrAbove;
|
|
167
|
+
const showAppHeader = isTouchDevice
|
|
168
|
+
? isSmallOrAbove
|
|
169
|
+
: isTopBar || (!!appHeader && isSmallOrAbove);
|
|
170
|
+
const { themeMode, onThemeModeChange } = useThemeMode();
|
|
217
171
|
const contextSwitcherUtilItem = useMemo(() => {
|
|
218
172
|
const { contexts, onContextClick, label: contextSwitcherLabel = t('switch_to') } = contextSwitcher ?? {};
|
|
219
|
-
if (!showAppHeader && contexts && contexts
|
|
173
|
+
if (!showAppHeader && contexts && contexts.length > 1 && onContextClick) {
|
|
220
174
|
return {
|
|
221
175
|
name: contextSwitcherLabel,
|
|
222
176
|
primary: contextSwitcherLabel,
|
|
@@ -226,18 +180,11 @@ const AppShell = forwardRef(function AppShell(props, ref) {
|
|
|
226
180
|
primary: context.primary,
|
|
227
181
|
'aria-current': !!context.selected,
|
|
228
182
|
visual: context.visual,
|
|
229
|
-
onClick: e =>
|
|
230
|
-
onContextClick(context.id, e);
|
|
231
|
-
}
|
|
183
|
+
onClick: e => onContextClick(context.id, e)
|
|
232
184
|
})), singleSelect: true }))
|
|
233
185
|
};
|
|
234
186
|
}
|
|
235
|
-
}, [
|
|
236
|
-
showAppHeader,
|
|
237
|
-
contextSwitcher?.contexts,
|
|
238
|
-
contextSwitcher?.label,
|
|
239
|
-
contextSwitcher?.onContextClick
|
|
240
|
-
]);
|
|
187
|
+
}, [contextSwitcher, showAppHeader, t]);
|
|
241
188
|
const shareLabel = shareApp?.label ?? t('app_shell_share');
|
|
242
189
|
const shareApplicationUtilItem = useMemo(() => {
|
|
243
190
|
if (!showAppHeader && shareApp) {
|
|
@@ -248,7 +195,7 @@ const AppShell = forwardRef(function AppShell(props, ref) {
|
|
|
248
195
|
onClick: shareApp.onClick
|
|
249
196
|
};
|
|
250
197
|
}
|
|
251
|
-
}, [
|
|
198
|
+
}, [shareApp, shareLabel, showAppHeader]);
|
|
252
199
|
const operatorInfoUtilItem = useMemo(() => {
|
|
253
200
|
if (!showAppHeader && operator) {
|
|
254
201
|
return {
|
|
@@ -258,17 +205,14 @@ const AppShell = forwardRef(function AppShell(props, ref) {
|
|
|
258
205
|
items: operator.actions
|
|
259
206
|
};
|
|
260
207
|
}
|
|
261
|
-
}, [showAppHeader,
|
|
262
|
-
const { themeMode, onThemeModeChange } = useThemeMode();
|
|
208
|
+
}, [operator, showAppHeader, t]);
|
|
263
209
|
const themeSwitcherUtilItem = useMemo(() => {
|
|
264
210
|
if (!showAppHeader && onThemeModeChange) {
|
|
265
|
-
let currentThemeIcon = 'circle-mixed-left';
|
|
266
|
-
if (themeMode === 'dark')
|
|
211
|
+
let currentThemeIcon = 'circle-mixed-left';
|
|
212
|
+
if (themeMode === 'dark')
|
|
267
213
|
currentThemeIcon = 'moon';
|
|
268
|
-
|
|
269
|
-
else if (themeMode === 'light') {
|
|
214
|
+
else if (themeMode === 'light')
|
|
270
215
|
currentThemeIcon = 'sun';
|
|
271
|
-
}
|
|
272
216
|
return {
|
|
273
217
|
name: t('theme_mode'),
|
|
274
218
|
primary: t('theme_mode'),
|
|
@@ -295,8 +239,7 @@ const AppShell = forwardRef(function AppShell(props, ref) {
|
|
|
295
239
|
]
|
|
296
240
|
};
|
|
297
241
|
}
|
|
298
|
-
}, [showAppHeader,
|
|
299
|
-
const { start, end } = useDirection();
|
|
242
|
+
}, [onThemeModeChange, showAppHeader, t, themeMode]);
|
|
300
243
|
const utilsList = useMemo(() => [
|
|
301
244
|
...(utils ?? []),
|
|
302
245
|
...(contextSwitcherUtilItem ? [contextSwitcherUtilItem] : []),
|
|
@@ -304,61 +247,16 @@ const AppShell = forwardRef(function AppShell(props, ref) {
|
|
|
304
247
|
...(operatorInfoUtilItem ? [operatorInfoUtilItem] : []),
|
|
305
248
|
...(themeSwitcherUtilItem ? [themeSwitcherUtilItem] : [])
|
|
306
249
|
], [
|
|
307
|
-
utils,
|
|
308
250
|
contextSwitcherUtilItem,
|
|
309
|
-
shareApplicationUtilItem,
|
|
310
251
|
operatorInfoUtilItem,
|
|
311
|
-
|
|
252
|
+
shareApplicationUtilItem,
|
|
253
|
+
themeSwitcherUtilItem,
|
|
254
|
+
utils
|
|
312
255
|
]);
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
collapsedHoverMenus,
|
|
318
|
-
navState: sidebarNavState,
|
|
319
|
-
focusedImperatively,
|
|
320
|
-
headerEl: headerEl || mobileHeaderEl,
|
|
321
|
-
appHeaderEl: headerEl ?? null,
|
|
322
|
-
searchContainerEl,
|
|
323
|
-
setSearchContainerEl,
|
|
324
|
-
isMobileNav: showMobileNav,
|
|
325
|
-
isTopBar,
|
|
326
|
-
previewActive,
|
|
327
|
-
setPreviewActive
|
|
328
|
-
}), [
|
|
329
|
-
sidebarNavState,
|
|
330
|
-
drawerOpen,
|
|
331
|
-
mobileNavOpen,
|
|
332
|
-
showMobileNav,
|
|
333
|
-
isTopBar,
|
|
334
|
-
headerEl,
|
|
335
|
-
mobileHeaderEl,
|
|
336
|
-
searchContainerEl,
|
|
337
|
-
previewActive
|
|
338
|
-
]), 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: {
|
|
339
|
-
direction: 'column',
|
|
340
|
-
justify: 'between'
|
|
341
|
-
}, 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: () => {
|
|
342
|
-
if (['closing', 'closed'].includes(sidebarNavState)) {
|
|
343
|
-
openNav(0);
|
|
344
|
-
}
|
|
345
|
-
else {
|
|
346
|
-
closeNav(0);
|
|
347
|
-
}
|
|
348
|
-
}, agent: agent }), _jsxs(Flex, { container: { justify: 'center' }, children: [_jsx(StyledAppShellToggleButton, { icon: true, ref: setExpandCollapseEl, compact: true, variant: 'simple', onClick: () => {
|
|
349
|
-
setSidebarNavState(sidebarNavState === 'closed' ? 'open' : 'closed');
|
|
350
|
-
}, "aria-label": t('navigation_panel'), "aria-expanded": sidebarNavState === 'open' || sidebarNavState === 'opening', "aria-controls": navId, children: ['closed', 'closing'].includes(sidebarNavState) ? (_jsx(Icon, { name: `arrow-micro-${end}` })) : (_jsx(Icon, { name: `arrow-micro-${start}` })) }), ['open', 'closed'].includes(sidebarNavState) && (_jsx(Tooltip, { target: expandCollapseEl, placement: 'right', describeTarget: false, as: StyledAppShellTooltip, showDelay: 'none', hideDelay: 'none', children: sidebarNavState === 'closed' ? t('expand_navigation') : t('collapse_navigation') }))] })] })), showMobileNav && (_jsxs(_Fragment, { children: [_jsxs(Flex, { as: StyledMobileNav, container: { alignItems: 'center', gap: 0.25 }, ref: setMobileHeaderEl, "data-app-region": true, onClick: () => {
|
|
351
|
-
setMobileNavOpen(false);
|
|
352
|
-
}, children: [caseTypes && caseTypes.length > 0 && _jsx(CaseTypes, { caseTypes: caseTypes, mobileNavBar: true }), links && _jsx(Links, { links: links.slice(0, mobileNavLinksCount), mobileNavBar: true }), _jsxs(StyledMobileMoreMenuButton, { ref: mobileButtonRef, variant: 'simple', onClick: (e) => {
|
|
353
|
-
setMobileNavOpen(prev => !prev);
|
|
354
|
-
e.stopPropagation();
|
|
355
|
-
}, label: t('app_shell_more'), icon: true, "aria-expanded": mobileNavOpen, "aria-controls": navId, children: [_jsx(Icon, { name: 'bars' }), !mobileNavOpen &&
|
|
356
|
-
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: () => {
|
|
357
|
-
setMobileNavOpen(false);
|
|
358
|
-
}, position: 'fixed', placement: 'bottom', size: '100dvh', nullWhenClosed: true, children: _jsx(Flex, { ...restProps, container: {
|
|
359
|
-
direction: 'column',
|
|
360
|
-
justify: 'between'
|
|
361
|
-
}, 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 })] }));
|
|
256
|
+
if (isTouchDevice) {
|
|
257
|
+
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, bottomTouchPanel: bottomTouchPanel, navId: navId, restProps: restProps }));
|
|
258
|
+
}
|
|
259
|
+
return _jsx(AppShell, { ...props, utilsList: utilsList, ref: ref });
|
|
362
260
|
});
|
|
363
|
-
export default
|
|
261
|
+
export default AppShellMain;
|
|
364
262
|
//# sourceMappingURL=AppShell.js.map
|