@pega/cosmos-react-core 8.34.13 → 8.36.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.
Files changed (36) hide show
  1. package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
  2. package/lib/components/AppShell/AppShell.styles.js +2 -8
  3. package/lib/components/AppShell/AppShell.styles.js.map +1 -1
  4. package/lib/components/Badges/Status.js +2 -2
  5. package/lib/components/Badges/Status.js.map +1 -1
  6. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts +2 -3
  7. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.d.ts.map +1 -1
  8. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js +90 -81
  9. package/lib/components/ComboBox/MultiSelectInput/MultiSelectInput.js.map +1 -1
  10. package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
  11. package/lib/components/Menu/Menu.styles.js +8 -2
  12. package/lib/components/Menu/Menu.styles.js.map +1 -1
  13. package/lib/components/PageTemplates/GridLayout/EditorBackground.d.ts.map +1 -1
  14. package/lib/components/PageTemplates/GridLayout/EditorBackground.js +2 -1
  15. package/lib/components/PageTemplates/GridLayout/EditorBackground.js.map +1 -1
  16. package/lib/hooks/useI18n.d.ts +2 -0
  17. package/lib/hooks/useI18n.d.ts.map +1 -1
  18. package/lib/i18n/default.d.ts +2 -0
  19. package/lib/i18n/default.d.ts.map +1 -1
  20. package/lib/i18n/default.js +2 -0
  21. package/lib/i18n/default.js.map +1 -1
  22. package/lib/i18n/i18n.d.ts +2 -0
  23. package/lib/i18n/i18n.d.ts.map +1 -1
  24. package/lib/theme/theme.d.ts +18 -0
  25. package/lib/theme/theme.d.ts.map +1 -1
  26. package/lib/theme/themeDefinition.json +8 -0
  27. package/lib/theme/themeOverrides.schema.json +16 -0
  28. package/lib/utils/cssQuoteAndEscape.d.ts +7 -0
  29. package/lib/utils/cssQuoteAndEscape.d.ts.map +1 -0
  30. package/lib/utils/cssQuoteAndEscape.js +28 -0
  31. package/lib/utils/cssQuoteAndEscape.js.map +1 -0
  32. package/lib/utils/index.d.ts +1 -0
  33. package/lib/utils/index.d.ts.map +1 -1
  34. package/lib/utils/index.js +1 -0
  35. package/lib/utils/index.js.map +1 -1
  36. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AppShell.styles.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.styles.ts"],"names":[],"mappings":"AA4BA,eAAO,MAAM,QAAQ,SAAS,CAAC;AAC/B,eAAO,MAAM,YAAY,aAAa,CAAC;AACvC,eAAO,MAAM,YAAY,SAAS,CAAC;AAGnC,eAAO,MAAM,aAAa,uGA8CxB,CAAC;AAIH,eAAO,MAAM,gBAAgB,yGAU3B,CAAC;AAIH,eAAO,MAAM,eAAe;;uDAiB1B,CAAC;AAIH,eAAO,MAAM,yBAAyB,0GAOpC,CAAC;AAIH,eAAO,MAAM,+BAA+B,0KAAiB,CAAC;AAE9D,eAAO,MAAM,mBAAmB,0GAE/B,CAAC;AAEF,eAAO,MAAM,oBAAoB,0GAe/B,CAAC;AAIH,eAAO,MAAM,YAAY;eAA2B,OAAO;aAAW,OAAO;SAgD5E,CAAC;AAIF,eAAO,MAAM,eAAe,4GAAkB,CAAC;AAE/C,eAAO,MAAM,gCAAgC;eAChC,OAAO;aACT,OAAO;SAwCjB,CAAC;AAIF,eAAO,MAAM,iBAAiB;yBACP,OAAO;kBACd,OAAO;SAqJrB,CAAC;AAIH,eAAO,MAAM,aAAa,wGAezB,CAAC;AAGF,eAAO,MAAM,kBAAkB,yGAQ7B,CAAC;AAIH,eAAO,MAAM,mBAAmB,wGA+B9B,CAAC;AAIH,eAAO,MAAM,eAAe,yGA2B1B,CAAC;AAIH,eAAO,MAAM,WAAW,yGAQtB,CAAC;AAIH,eAAO,MAAM,eAAe,4GAqB1B,CAAC;AAIH,eAAO,MAAM,aAAa,yGAEzB,CAAC;AAEF,eAAO,MAAM,aAAa;eACb,OAAO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O;aACT,OAAO;mBACD,OAAO;mBACP,MAAM;SAyDrB,CAAC;AAIH,eAAO,MAAM,kBAAkB,yGAI7B,CAAC;AAIH,eAAO,MAAM,qBAAqB,yGAsBhC,CAAC;AAIH,eAAO,MAAM,0BAA0B,oLA2BrC,CAAC"}
@@ -231,20 +231,14 @@ export const StyledNavListItem = styled.li(({ theme, nestedListCollapsed, single
231
231
  `}
232
232
  }
233
233
  padding: calc(var(--nav-padding) / 8) var(--nav-padding);
234
- ${!navOpen &&
235
- detached &&
236
- css `
237
- padding-inline: 0;
238
- width: calc(${navWidth} - 2 * var(--nav-padding));
239
- margin: auto;
240
- `}
241
234
 
242
235
  > :first-child {
243
236
  position: relative;
244
237
  display: flex;
245
238
  align-items: center;
246
239
  width: 100%;
247
- padding: calc(1.25 * ${theme.base.spacing}) 0;
240
+ padding-block: calc(1.25 * ${theme.base.spacing});
241
+ padding-inline: 0;
248
242
  white-space: nowrap;
249
243
  color: ${foreground};
250
244
  cursor: pointer;
@@ -1 +1 @@
1
- {"version":3,"file":"AppShell.styles.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,mCAAmC,EACnC,aAAa,EACd,M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AK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;;;GAG1C,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,qBAAqB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEtD,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACrE,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC;IAC3D,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IACzE,MAAM,EAAE,eAAe,EAAE,GAAG,mCAAmC,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IACnF,IAAI,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;IAEtC,IAAI,WAAW,CAAC,eAAe,EAAE,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC;QAC3C,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,GAAG,CAAA;kBACM,EAAE;aACP,UAAU;;2BAEI,KAAK,CAAC,IAAI,CAAC,OAAO;;MAEvC,UAAU;;;;;;;;oBAQI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;;GAExC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,0BAA0B,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { darken, getContrast, lighten, transparentize } from 'polished';\nimport { useContext } from 'react';\n\nimport { Count } from '../Badges';\nimport { StyledAvatar } from '../Avatar';\nimport { StyledIcon } from '../Icon';\nimport { StyledImage } from '../Image/Image';\nimport { defaultThemeProp } from '../../theme';\nimport {\n calculateFontSize,\n calculateForegroundColor,\n calculateBackgroundAndContrastColor,\n readableColor\n} from '../../styles';\nimport { StyledMenuItem } from '../Menu/Menu.styles';\nimport { useDirection } from '../../hooks';\nimport { StyledBareButton } from '../Button/BareButton';\nimport Button from '../Button';\nimport { StyledTooltip } from '../Tooltip';\nimport { StyledProgressBackdrop } from '../Progress';\nimport Icon from '../Icon/Icon';\nimport { StyledText } from '../Text';\nimport { resizeDrawerMaxWidth } from '../../styles/constants';\n\nimport AppShellContext from './AppShellContext';\nimport { navContrastColors, pxToRem } from './style-utils';\n\nexport const navWidth = '4rem';\nexport const navOpenWidth = '18.75rem';\nexport const headerHeight = '3rem';\nconst iconWidth = '1.125rem';\n\nexport const StyledAppInfo = styled.a(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n const { hoverBg, foreground } = navContrastColors(theme);\n\n return css`\n padding: ${theme.base.spacing} calc(${navWidth} / 4);\n grid-template-columns: calc(${navWidth} / 2) auto;\n column-gap: calc(${navWidth} / 4);\n vertical-align: middle;\n\n &:hover,\n button&:hover {\n background-color: ${hoverBg};\n text-decoration: none;\n }\n\n &:focus:not([disabled]) {\n outline: none;\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n\n ${StyledImage} {\n display: inline-block;\n width: calc(${navWidth} / 2);\n margin-inline-end: calc(${theme.base.spacing} * 2);\n vertical-align: middle;\n }\n\n span {\n overflow: hidden;\n text-overflow: ellipsis;\n vertical-align: middle;\n }\n\n span:last-of-type {\n font-size: ${fontSize.xs};\n color: ${foreground};\n }\n\n span:first-of-type {\n font-size: ${fontSize.s};\n color: ${foreground};\n margin-inline-end: calc(${theme.base.spacing});\n vertical-align: middle;\n }\n `;\n});\n\nStyledAppInfo.defaultProps = defaultThemeProp;\n\nexport const StyledScrollWrap = styled.div(({ theme }) => {\n return css`\n flex-grow: 1;\n overflow-x: hidden;\n overflow-y: auto;\n @media (height <= ${theme.base.breakpoints.sm}) {\n overflow: visible;\n flex-shrink: 0;\n }\n `;\n});\n\nStyledScrollWrap.defaultProps = defaultThemeProp;\n\nexport const StyledCountIcon = styled(Count)(({\n theme: {\n base: { spacing },\n components: {\n 'app-shell': {\n nav: { detached }\n }\n }\n }\n}) => {\n const insetInlineStartOffsetMultiplier = detached ? 3 : 4;\n return css`\n position: absolute;\n inset-inline-start: calc(${insetInlineStartOffsetMultiplier} * ${spacing});\n top: calc(0.5 * ${spacing});\n padding: 0 calc(0.5 * ${spacing});\n `;\n});\n\nStyledCountIcon.defaultProps = defaultThemeProp;\n\nexport const StyledSingleSelectIconBox = styled.span(({ theme }) => {\n return css`\n flex-shrink: 0;\n height: ${theme.base['hit-area']['mouse-min']};\n width: ${theme.base['hit-area']['mouse-min']};\n margin-inline-start: calc(2 * ${theme.base.spacing});\n `;\n});\n\nStyledSingleSelectIconBox.defaultProps = defaultThemeProp;\n\nexport const StyledNavListItemExpandCollapse = styled(Icon)``;\n\nexport const StyledUtilIconCount = styled.span`\n flex-shrink: 0;\n`;\n\nexport const StyledNavItemIconBox = styled.span(({ theme }) => {\n return css`\n flex-shrink: 0;\n > ${StyledIcon}, ${StyledUtilIconCount} > ${StyledIcon} {\n margin-inline: calc((${navWidth} - ${iconWidth} - 2 * var(--nav-padding)) / 2);\n }\n\n ${StyledAvatar} {\n margin-inline: calc(\n (${navWidth} - ${theme.base['hit-area']['mouse-min']} - 2 * var(--nav-padding)) / 2\n );\n margin-block: calc(0.5 * ${theme.base.spacing});\n font-weight: ${theme.base['font-weight'].normal};\n }\n `;\n});\n\nStyledNavItemIconBox.defaultProps = defaultThemeProp;\n\nexport const StyledAppNav = styled.nav<{ appHeader: boolean; showEnv: boolean }>(\n ({ appHeader, showEnv, theme }) => {\n const { navOpen } = useContext(AppShellContext);\n\n const navBg = theme.components['app-shell'].nav.background;\n const navFgColor = theme.components['app-shell'].nav['foreground-color'];\n\n const foregroundColor = calculateForegroundColor(navBg, navFgColor);\n\n return css`\n position: fixed;\n z-index: calc(${theme.base['z-index'].backdrop} - 2);\n background: ${navBg};\n color: ${foregroundColor};\n max-width: calc(100vw - ${theme.base['hit-area']['mouse-min']});\n width: ${navOpen ? navOpenWidth : navWidth};\n height: calc(100vh - ${appHeader ? headerHeight : '0rem'});\n overflow: hidden;\n white-space: nowrap;\n transition: width ${`${theme.base.animation.speed} ${theme.base.animation.timing.ease}`};\n padding-block-end: ${theme.base.spacing};\n border-inline-end: ${pxToRem(1)} solid ${transparentize(0.9, '#000')};\n border-color: ${theme.components['app-shell'].nav['border-color']};\n ${!showEnv &&\n css`\n padding-block-start: ${theme.base.spacing};\n `}\n @media (pointer: coarse) {\n max-width: calc(100vw - ${theme.base['hit-area']['finger-min']});\n }\n\n @media (height <= ${theme.base.breakpoints.sm}) {\n overflow: auto;\n }\n\n /* App navigation can be focused with shortcut */\n :focus-visible {\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n\n ${theme.base['custom-scrollbar'] &&\n css`\n * {\n scrollbar-width: thin;\n }\n `}\n `;\n }\n);\n\nStyledAppNav.defaultProps = defaultThemeProp;\n\nexport const StyledCaseClose = styled.button``;\n\nexport const StyledNavListItemVisualContainer = styled.div<{\n isCurrent: boolean;\n navOpen: boolean;\n}>(\n ({\n theme: {\n base: { spacing },\n components: {\n 'app-shell': {\n nav: { detached }\n }\n }\n },\n isCurrent,\n navOpen\n }) => {\n return css`\n max-width: ${navWidth};\n padding-block: calc(var(--nav-padding) / 8);\n padding-inline: var(--nav-padding);\n\n ${!navOpen &&\n detached &&\n css`\n padding-inline: 0;\n width: calc(${navWidth} - 2 * var(--nav-padding));\n margin: auto;\n `}\n\n & > ${StyledText} {\n padding-inline: ${isCurrent\n ? `${spacing} calc(0.5 * ${spacing})`\n : `calc(0.5 * ${spacing})`};\n\n ${!navOpen &&\n detached &&\n css`\n padding-inline: 0;\n `}\n }\n `;\n }\n);\n\nStyledNavListItemVisualContainer.defaultProps = defaultThemeProp;\n\nexport const StyledNavListItem = styled.li<{\n nestedListCollapsed: boolean;\n singleSelect: boolean;\n}>(({ theme, nestedListCollapsed, singleSelect }) => {\n const {\n base: {\n 'font-weight': { 'semi-bold': semiBold }\n },\n components: {\n 'app-shell': {\n nav: { detached }\n }\n }\n } = theme;\n\n const { navOpen } = useContext(AppShellContext);\n const { foreground } = navContrastColors(theme);\n const { rtl } = useDirection();\n\n return css`\n display: block;\n position: relative;\n\n ${StyledIcon} {\n font-size: 1.25rem;\n }\n\n ${StyledCaseClose} {\n display: flex;\n position: absolute;\n opacity: 0;\n left: ${navOpen ? 'auto' : '100%'};\n top: 50%;\n bottom: 50%;\n margin: auto 0;\n color: ${foreground};\n transition-property: transform, opacity;\n transition-duration: ${theme.base.animation.speed};\n transition-timing-function: ${theme.base.animation.timing.ease};\n ${navOpen &&\n css`\n inset-inline-end: 1rem;\n\n &:hover,\n &:focus {\n opacity: 1;\n }\n `}\n }\n padding: calc(var(--nav-padding) / 8) var(--nav-padding);\n ${!navOpen &&\n detached &&\n css`\n padding-inline: 0;\n width: calc(${navWidth} - 2 * var(--nav-padding));\n margin: auto;\n `}\n\n > :first-child {\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n padding: calc(1.25 * ${theme.base.spacing}) 0;\n white-space: nowrap;\n color: ${foreground};\n cursor: pointer;\n text-decoration: none;\n border-block: ${pxToRem(1)} solid transparent;\n ${detached &&\n css`\n border-radius: ${theme.base['border-radius']};\n `}\n span:not(${StyledCountIcon}) {\n overflow: hidden;\n text-overflow: ellipsis;\n color: inherit;\n white-space: nowrap;\n }\n\n &:hover,\n &:focus {\n color: ${foreground};\n background: ${transparentize(0.9, foreground)};\n }\n\n &:hover + ${StyledCaseClose}, &:focus + ${StyledCaseClose} {\n ${navOpen &&\n css`\n opacity: 1;\n `}\n }\n &:focus {\n box-shadow: ${theme.base.shadow['focus-inset']};\n\n @media (forced-colors: none) {\n outline: none;\n }\n }\n\n ${StyledNavListItemExpandCollapse} {\n position: absolute;\n left: ${navOpen ? 'auto' : '100%'};\n ${navOpen &&\n css`\n inset-inline-end: 1rem;\n `}\n margin: 0;\n opacity: ${navOpen ? '1' : '0'};\n transition-property: transform, opacity;\n transition-duration: ${theme.base.animation.speed};\n transition-timing-function: ${theme.base.animation.timing.ease};\n\n ${!nestedListCollapsed &&\n css`\n transform: rotateZ(${rtl ? '-90deg' : '90deg'});\n `}\n }\n\n ${singleSelect &&\n css`\n ${StyledNavItemIconBox} > ${StyledIcon} {\n margin-inline: calc(${theme.base.spacing} - var(--nav-padding));\n }\n `}\n\n ${StyledSingleSelectIconBox} + span {\n margin-inline-start: ${theme.base.spacing};\n }\n }\n\n [aria-current='page'],\n [aria-expanded='false']:has(+ ul [aria-current='page']) {\n position: relative;\n font-weight: ${semiBold};\n border-block: ${pxToRem(1)} solid ${theme.components['app-shell'].nav['border-color']};\n background: ${transparentize(0.85, foreground)};\n ${!detached &&\n css`\n &::before {\n content: '';\n position: absolute;\n width: ${pxToRem(4)};\n inset-inline-start: 0;\n top: 0;\n bottom: 0;\n background-color: ${foreground};\n }\n `}\n }\n `;\n});\n\nStyledNavListItem.defaultProps = defaultThemeProp;\n\nexport const StyledNavList = styled.ul(\n ({\n theme: {\n base: { spacing },\n components: {\n 'app-shell': {\n nav: { detached }\n }\n }\n }\n }) => {\n return css`\n --nav-padding: ${detached ? spacing : '0px'};\n `;\n }\n);\nStyledNavList.defaultProps = defaultThemeProp;\n\nexport const StyledNavCasesList = styled.div(({ theme }) => {\n return css`\n ${StyledNavListItem} {\n > :first-child {\n padding: ${theme.base.spacing} 0;\n }\n }\n `;\n});\n\nStyledNavCasesList.defaultProps = defaultThemeProp;\n\nexport const StyledNestedNavList = styled(StyledNavList)(({ theme }) => {\n const {\n base: { 'border-radius': borderRadius },\n components: {\n 'app-shell': {\n nav: { detached }\n }\n }\n } = theme;\n\n const { nestedList } = navContrastColors(theme);\n\n return css`\n background: ${nestedList};\n border-radius: ${detached ? borderRadius : '0px'};\n padding-block: var(--nav-padding);\n\n ${StyledNavListItem} {\n > :first-child {\n &:has(${StyledIcon}) {\n padding-inline-start: calc(\n ((${navWidth} - (3 * var(--nav-padding)) - ${iconWidth}) / 2) + ${iconWidth}\n );\n }\n\n &:not(:has(${StyledIcon})) {\n padding-inline-start: calc(${navWidth} - 3 * var(--nav-padding));\n }\n }\n }\n `;\n});\n\nStyledNestedNavList.defaultProps = defaultThemeProp;\n\nexport const StyledCaseTypes = styled.div(props => {\n const {\n theme: {\n base: {\n animation: {\n speed,\n timing: { ease: acceleration }\n }\n }\n }\n } = props;\n\n return css`\n button {\n ${StyledNavItemIconBox} {\n transition: transform ${speed} ${acceleration};\n }\n\n &[aria-expanded='false'] ${StyledNavItemIconBox} {\n transform: none;\n }\n\n &[aria-expanded='true'] ${StyledNavItemIconBox} {\n transform: rotateZ(45deg);\n }\n }\n `;\n});\n\nStyledCaseTypes.defaultProps = defaultThemeProp;\n\nexport const StyledUtils = styled.div(({ theme }) => {\n return css`\n border-top: 0.0625rem solid ${theme.components['app-shell'].nav['border-color']};\n\n ${StyledBareButton} > ${StyledIcon}:first-child, ${StyledBareButton} > ${StyledUtilIconCount} {\n margin: 0 calc((${navWidth} - ${iconWidth}) / 2);\n }\n `;\n});\n\nStyledUtils.defaultProps = defaultThemeProp;\n\nexport const StyledMobileNav = styled.header(({ theme }) => {\n const mobileNavColor = theme.components['app-shell'].nav.background;\n const { foreground } = navContrastColors(theme);\n\n return css`\n min-width: 100%;\n min-height: ${headerHeight};\n z-index: ${theme.base['z-index'].drawer};\n background: ${mobileNavColor};\n color: ${foreground};\n padding-inline-start: ${theme.base.spacing};\n\n @media (pointer: coarse) {\n padding-inline-start: 0;\n }\n\n @media (height >= ${theme.base.breakpoints.sm}) {\n inset-block-start: 0;\n position: sticky;\n }\n `;\n});\n\nStyledMobileNav.defaultProps = defaultThemeProp;\n\nexport const StyledLoading = styled.div`\n font-size: 2rem;\n`;\n\nexport const StyledAppMain = styled.main<{\n appHeader: boolean;\n mobileNav: boolean;\n navOpen: boolean;\n previewActive: boolean;\n headerOffset?: number;\n}>(({ appHeader, mobileNav, navOpen, previewActive, headerOffset = 0, theme }) => {\n const heightOffset = appHeader || mobileNav ? headerHeight : '0rem';\n const appBackground = theme.base.palette['app-background'];\n\n return css`\n --appshell-offset: ${headerOffset}px;\n /* stylelint-disable-next-line length-zero-no-unit */\n --appshell-horizontal-offset: 0rem;\n\n @media (min-width: ${theme.base.breakpoints.sm}) {\n --appshell-horizontal-offset: ${navOpen ? navOpenWidth : navWidth};\n }\n position: relative;\n margin-inline-start: ${mobileNav ? 0 : navWidth};\n min-height: calc(100vh - ${heightOffset});\n background: ${appBackground};\n\n &:focus {\n outline: none;\n }\n\n ${navOpen &&\n !mobileNav &&\n css`\n margin-inline-start: ${navOpenWidth};\n `}\n\n ${!mobileNav &&\n css`\n transition: margin-inline-start\n ${`${theme.base.animation.speed} ${theme.base.animation.timing.ease}`};\n `}\n\n & > ${StyledProgressBackdrop} {\n max-height: calc(100vh - ${heightOffset});\n max-width: calc(100vw - ${navOpen ? navOpenWidth : navWidth});\n inset-block-start: ${heightOffset};\n inset-inline-start: ${navOpen ? navOpenWidth : navWidth};\n position: fixed;\n transition-property: opacity, max-height, max-width, inset-block-start, inset-inline-start;\n transition-duration: ${theme.base.animation.speed};\n transition-timing-function: ${theme.base.animation.timing.ease};\n }\n\n @media (min-width: ${theme.base.breakpoints.xl}) {\n transition: margin-inline-end ${!mobileNav ? ', margin-inline-start' : ''};\n transition-duration: ${theme.base.animation.speed};\n transition-timing-function: ${theme.base.animation.timing.ease};\n\n ${previewActive &&\n css`\n transition: none;\n margin-inline-end: min(var(--resize-drawer-width), ${resizeDrawerMaxWidth});\n `}\n }\n `;\n});\n\nStyledAppMain.defaultProps = defaultThemeProp;\n\nexport const StyledBannerRegion = styled.div(({ theme }) => {\n return css`\n padding: calc(2 * ${theme.base.spacing});\n `;\n});\n\nStyledBannerRegion.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellTooltip = styled(StyledTooltip)(({ theme }) => {\n const bg = theme.components.tooltip['background-color'];\n const color = readableColor(bg);\n\n return css`\n background-color: ${bg};\n padding: 0;\n header {\n color: ${color};\n border-bottom: none;\n }\n ${StyledMenuItem} {\n background-color: ${bg};\n color: ${color};\n\n &:hover,\n &:focus {\n background-color: ${bg};\n box-shadow: ${theme.base.shadow.focus};\n }\n }\n `;\n});\n\nStyledAppShellTooltip.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellToggleButton = styled(Button)(({ theme }) => {\n const navBg = theme.components['app-shell'].nav.background;\n const navFgColor = theme.components['app-shell'].nav['foreground-color'];\n const { backgroundColor } = calculateBackgroundAndContrastColor(navBg, navFgColor);\n let bg = darken(0.2, backgroundColor);\n\n if (getContrast(backgroundColor, bg) < 1.3) {\n bg = lighten(0.2, backgroundColor);\n }\n\n return css`\n background: ${bg};\n color: ${navFgColor};\n border: none;\n margin-top: calc(1 * ${theme.base.spacing});\n\n ${StyledIcon} {\n width: 1.25rem;\n height: 1.25rem;\n font-weight: bold;\n }\n\n &:enabled:focus,\n :not([disabled]):focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n `;\n});\n\nStyledAppShellToggleButton.defaultProps = defaultThemeProp;\n"]}
1
+ {"version":3,"file":"AppShell.styles.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShell.styles.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,mCAAmC,EACnC,aA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,CAAC,CAAC,CAAC;AAEH,qBAAqB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEtD,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACrE,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC;IAC3D,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IACzE,MAAM,EAAE,eAAe,EAAE,GAAG,mCAAmC,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IACnF,IAAI,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;IAEtC,IAAI,WAAW,CAAC,eAAe,EAAE,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC;QAC3C,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,GAAG,CAAA;kBACM,EAAE;aACP,UAAU;;2BAEI,KAAK,CAAC,IAAI,CAAC,OAAO;;MAEvC,UAAU;;;;;;;;oBAQI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK;;GAExC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,0BAA0B,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import styled, { css } from 'styled-components';\nimport { darken, getContrast, lighten, transparentize } from 'polished';\nimport { useContext } from 'react';\n\nimport { Count } from '../Badges';\nimport { StyledAvatar } from '../Avatar';\nimport { StyledIcon } from '../Icon';\nimport { StyledImage } from '../Image/Image';\nimport { defaultThemeProp } from '../../theme';\nimport {\n calculateFontSize,\n calculateForegroundColor,\n calculateBackgroundAndContrastColor,\n readableColor\n} from '../../styles';\nimport { StyledMenuItem } from '../Menu/Menu.styles';\nimport { useDirection } from '../../hooks';\nimport { StyledBareButton } from '../Button/BareButton';\nimport Button from '../Button';\nimport { StyledTooltip } from '../Tooltip';\nimport { StyledProgressBackdrop } from '../Progress';\nimport Icon from '../Icon/Icon';\nimport { StyledText } from '../Text';\nimport { resizeDrawerMaxWidth } from '../../styles/constants';\n\nimport AppShellContext from './AppShellContext';\nimport { navContrastColors, pxToRem } from './style-utils';\n\nexport const navWidth = '4rem';\nexport const navOpenWidth = '18.75rem';\nexport const headerHeight = '3rem';\nconst iconWidth = '1.125rem';\n\nexport const StyledAppInfo = styled.a(({ theme }) => {\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n const { hoverBg, foreground } = navContrastColors(theme);\n\n return css`\n padding: ${theme.base.spacing} calc(${navWidth} / 4);\n grid-template-columns: calc(${navWidth} / 2) auto;\n column-gap: calc(${navWidth} / 4);\n vertical-align: middle;\n\n &:hover,\n button&:hover {\n background-color: ${hoverBg};\n text-decoration: none;\n }\n\n &:focus:not([disabled]) {\n outline: none;\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n\n ${StyledImage} {\n display: inline-block;\n width: calc(${navWidth} / 2);\n margin-inline-end: calc(${theme.base.spacing} * 2);\n vertical-align: middle;\n }\n\n span {\n overflow: hidden;\n text-overflow: ellipsis;\n vertical-align: middle;\n }\n\n span:last-of-type {\n font-size: ${fontSize.xs};\n color: ${foreground};\n }\n\n span:first-of-type {\n font-size: ${fontSize.s};\n color: ${foreground};\n margin-inline-end: calc(${theme.base.spacing});\n vertical-align: middle;\n }\n `;\n});\n\nStyledAppInfo.defaultProps = defaultThemeProp;\n\nexport const StyledScrollWrap = styled.div(({ theme }) => {\n return css`\n flex-grow: 1;\n overflow-x: hidden;\n overflow-y: auto;\n @media (height <= ${theme.base.breakpoints.sm}) {\n overflow: visible;\n flex-shrink: 0;\n }\n `;\n});\n\nStyledScrollWrap.defaultProps = defaultThemeProp;\n\nexport const StyledCountIcon = styled(Count)(({\n theme: {\n base: { spacing },\n components: {\n 'app-shell': {\n nav: { detached }\n }\n }\n }\n}) => {\n const insetInlineStartOffsetMultiplier = detached ? 3 : 4;\n return css`\n position: absolute;\n inset-inline-start: calc(${insetInlineStartOffsetMultiplier} * ${spacing});\n top: calc(0.5 * ${spacing});\n padding: 0 calc(0.5 * ${spacing});\n `;\n});\n\nStyledCountIcon.defaultProps = defaultThemeProp;\n\nexport const StyledSingleSelectIconBox = styled.span(({ theme }) => {\n return css`\n flex-shrink: 0;\n height: ${theme.base['hit-area']['mouse-min']};\n width: ${theme.base['hit-area']['mouse-min']};\n margin-inline-start: calc(2 * ${theme.base.spacing});\n `;\n});\n\nStyledSingleSelectIconBox.defaultProps = defaultThemeProp;\n\nexport const StyledNavListItemExpandCollapse = styled(Icon)``;\n\nexport const StyledUtilIconCount = styled.span`\n flex-shrink: 0;\n`;\n\nexport const StyledNavItemIconBox = styled.span(({ theme }) => {\n return css`\n flex-shrink: 0;\n > ${StyledIcon}, ${StyledUtilIconCount} > ${StyledIcon} {\n margin-inline: calc((${navWidth} - ${iconWidth} - 2 * var(--nav-padding)) / 2);\n }\n\n ${StyledAvatar} {\n margin-inline: calc(\n (${navWidth} - ${theme.base['hit-area']['mouse-min']} - 2 * var(--nav-padding)) / 2\n );\n margin-block: calc(0.5 * ${theme.base.spacing});\n font-weight: ${theme.base['font-weight'].normal};\n }\n `;\n});\n\nStyledNavItemIconBox.defaultProps = defaultThemeProp;\n\nexport const StyledAppNav = styled.nav<{ appHeader: boolean; showEnv: boolean }>(\n ({ appHeader, showEnv, theme }) => {\n const { navOpen } = useContext(AppShellContext);\n\n const navBg = theme.components['app-shell'].nav.background;\n const navFgColor = theme.components['app-shell'].nav['foreground-color'];\n\n const foregroundColor = calculateForegroundColor(navBg, navFgColor);\n\n return css`\n position: fixed;\n z-index: calc(${theme.base['z-index'].backdrop} - 2);\n background: ${navBg};\n color: ${foregroundColor};\n max-width: calc(100vw - ${theme.base['hit-area']['mouse-min']});\n width: ${navOpen ? navOpenWidth : navWidth};\n height: calc(100vh - ${appHeader ? headerHeight : '0rem'});\n overflow: hidden;\n white-space: nowrap;\n transition: width ${`${theme.base.animation.speed} ${theme.base.animation.timing.ease}`};\n padding-block-end: ${theme.base.spacing};\n border-inline-end: ${pxToRem(1)} solid ${transparentize(0.9, '#000')};\n border-color: ${theme.components['app-shell'].nav['border-color']};\n ${!showEnv &&\n css`\n padding-block-start: ${theme.base.spacing};\n `}\n @media (pointer: coarse) {\n max-width: calc(100vw - ${theme.base['hit-area']['finger-min']});\n }\n\n @media (height <= ${theme.base.breakpoints.sm}) {\n overflow: auto;\n }\n\n /* App navigation can be focused with shortcut */\n :focus-visible {\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n\n ${theme.base['custom-scrollbar'] &&\n css`\n * {\n scrollbar-width: thin;\n }\n `}\n `;\n }\n);\n\nStyledAppNav.defaultProps = defaultThemeProp;\n\nexport const StyledCaseClose = styled.button``;\n\nexport const StyledNavListItemVisualContainer = styled.div<{\n isCurrent: boolean;\n navOpen: boolean;\n}>(\n ({\n theme: {\n base: { spacing },\n components: {\n 'app-shell': {\n nav: { detached }\n }\n }\n },\n isCurrent,\n navOpen\n }) => {\n return css`\n max-width: ${navWidth};\n padding-block: calc(var(--nav-padding) / 8);\n padding-inline: var(--nav-padding);\n\n ${!navOpen &&\n detached &&\n css`\n padding-inline: 0;\n width: calc(${navWidth} - 2 * var(--nav-padding));\n margin: auto;\n `}\n\n & > ${StyledText} {\n padding-inline: ${isCurrent\n ? `${spacing} calc(0.5 * ${spacing})`\n : `calc(0.5 * ${spacing})`};\n\n ${!navOpen &&\n detached &&\n css`\n padding-inline: 0;\n `}\n }\n `;\n }\n);\n\nStyledNavListItemVisualContainer.defaultProps = defaultThemeProp;\n\nexport const StyledNavListItem = styled.li<{\n nestedListCollapsed: boolean;\n singleSelect: boolean;\n}>(({ theme, nestedListCollapsed, singleSelect }) => {\n const {\n base: {\n 'font-weight': { 'semi-bold': semiBold }\n },\n components: {\n 'app-shell': {\n nav: { detached }\n }\n }\n } = theme;\n\n const { navOpen } = useContext(AppShellContext);\n const { foreground } = navContrastColors(theme);\n const { rtl } = useDirection();\n\n return css`\n display: block;\n position: relative;\n\n ${StyledIcon} {\n font-size: 1.25rem;\n }\n\n ${StyledCaseClose} {\n display: flex;\n position: absolute;\n opacity: 0;\n left: ${navOpen ? 'auto' : '100%'};\n top: 50%;\n bottom: 50%;\n margin: auto 0;\n color: ${foreground};\n transition-property: transform, opacity;\n transition-duration: ${theme.base.animation.speed};\n transition-timing-function: ${theme.base.animation.timing.ease};\n ${navOpen &&\n css`\n inset-inline-end: 1rem;\n\n &:hover,\n &:focus {\n opacity: 1;\n }\n `}\n }\n padding: calc(var(--nav-padding) / 8) var(--nav-padding);\n\n > :first-child {\n position: relative;\n display: flex;\n align-items: center;\n width: 100%;\n padding-block: calc(1.25 * ${theme.base.spacing});\n padding-inline: 0;\n white-space: nowrap;\n color: ${foreground};\n cursor: pointer;\n text-decoration: none;\n border-block: ${pxToRem(1)} solid transparent;\n ${detached &&\n css`\n border-radius: ${theme.base['border-radius']};\n `}\n span:not(${StyledCountIcon}) {\n overflow: hidden;\n text-overflow: ellipsis;\n color: inherit;\n white-space: nowrap;\n }\n\n &:hover,\n &:focus {\n color: ${foreground};\n background: ${transparentize(0.9, foreground)};\n }\n\n &:hover + ${StyledCaseClose}, &:focus + ${StyledCaseClose} {\n ${navOpen &&\n css`\n opacity: 1;\n `}\n }\n &:focus {\n box-shadow: ${theme.base.shadow['focus-inset']};\n\n @media (forced-colors: none) {\n outline: none;\n }\n }\n\n ${StyledNavListItemExpandCollapse} {\n position: absolute;\n left: ${navOpen ? 'auto' : '100%'};\n ${navOpen &&\n css`\n inset-inline-end: 1rem;\n `}\n margin: 0;\n opacity: ${navOpen ? '1' : '0'};\n transition-property: transform, opacity;\n transition-duration: ${theme.base.animation.speed};\n transition-timing-function: ${theme.base.animation.timing.ease};\n\n ${!nestedListCollapsed &&\n css`\n transform: rotateZ(${rtl ? '-90deg' : '90deg'});\n `}\n }\n\n ${singleSelect &&\n css`\n ${StyledNavItemIconBox} > ${StyledIcon} {\n margin-inline: calc(${theme.base.spacing} - var(--nav-padding));\n }\n `}\n\n ${StyledSingleSelectIconBox} + span {\n margin-inline-start: ${theme.base.spacing};\n }\n }\n\n [aria-current='page'],\n [aria-expanded='false']:has(+ ul [aria-current='page']) {\n position: relative;\n font-weight: ${semiBold};\n border-block: ${pxToRem(1)} solid ${theme.components['app-shell'].nav['border-color']};\n background: ${transparentize(0.85, foreground)};\n ${!detached &&\n css`\n &::before {\n content: '';\n position: absolute;\n width: ${pxToRem(4)};\n inset-inline-start: 0;\n top: 0;\n bottom: 0;\n background-color: ${foreground};\n }\n `}\n }\n `;\n});\n\nStyledNavListItem.defaultProps = defaultThemeProp;\n\nexport const StyledNavList = styled.ul(\n ({\n theme: {\n base: { spacing },\n components: {\n 'app-shell': {\n nav: { detached }\n }\n }\n }\n }) => {\n return css`\n --nav-padding: ${detached ? spacing : '0px'};\n `;\n }\n);\nStyledNavList.defaultProps = defaultThemeProp;\n\nexport const StyledNavCasesList = styled.div(({ theme }) => {\n return css`\n ${StyledNavListItem} {\n > :first-child {\n padding: ${theme.base.spacing} 0;\n }\n }\n `;\n});\n\nStyledNavCasesList.defaultProps = defaultThemeProp;\n\nexport const StyledNestedNavList = styled(StyledNavList)(({ theme }) => {\n const {\n base: { 'border-radius': borderRadius },\n components: {\n 'app-shell': {\n nav: { detached }\n }\n }\n } = theme;\n\n const { nestedList } = navContrastColors(theme);\n\n return css`\n background: ${nestedList};\n border-radius: ${detached ? borderRadius : '0px'};\n padding-block: var(--nav-padding);\n\n ${StyledNavListItem} {\n > :first-child {\n &:has(${StyledIcon}) {\n padding-inline-start: calc(\n ((${navWidth} - (3 * var(--nav-padding)) - ${iconWidth}) / 2) + ${iconWidth}\n );\n }\n\n &:not(:has(${StyledIcon})) {\n padding-inline-start: calc(${navWidth} - 3 * var(--nav-padding));\n }\n }\n }\n `;\n});\n\nStyledNestedNavList.defaultProps = defaultThemeProp;\n\nexport const StyledCaseTypes = styled.div(props => {\n const {\n theme: {\n base: {\n animation: {\n speed,\n timing: { ease: acceleration }\n }\n }\n }\n } = props;\n\n return css`\n button {\n ${StyledNavItemIconBox} {\n transition: transform ${speed} ${acceleration};\n }\n\n &[aria-expanded='false'] ${StyledNavItemIconBox} {\n transform: none;\n }\n\n &[aria-expanded='true'] ${StyledNavItemIconBox} {\n transform: rotateZ(45deg);\n }\n }\n `;\n});\n\nStyledCaseTypes.defaultProps = defaultThemeProp;\n\nexport const StyledUtils = styled.div(({ theme }) => {\n return css`\n border-top: 0.0625rem solid ${theme.components['app-shell'].nav['border-color']};\n\n ${StyledBareButton} > ${StyledIcon}:first-child, ${StyledBareButton} > ${StyledUtilIconCount} {\n margin: 0 calc((${navWidth} - ${iconWidth}) / 2);\n }\n `;\n});\n\nStyledUtils.defaultProps = defaultThemeProp;\n\nexport const StyledMobileNav = styled.header(({ theme }) => {\n const mobileNavColor = theme.components['app-shell'].nav.background;\n const { foreground } = navContrastColors(theme);\n\n return css`\n min-width: 100%;\n min-height: ${headerHeight};\n z-index: ${theme.base['z-index'].drawer};\n background: ${mobileNavColor};\n color: ${foreground};\n padding-inline-start: ${theme.base.spacing};\n\n @media (pointer: coarse) {\n padding-inline-start: 0;\n }\n\n @media (height >= ${theme.base.breakpoints.sm}) {\n inset-block-start: 0;\n position: sticky;\n }\n `;\n});\n\nStyledMobileNav.defaultProps = defaultThemeProp;\n\nexport const StyledLoading = styled.div`\n font-size: 2rem;\n`;\n\nexport const StyledAppMain = styled.main<{\n appHeader: boolean;\n mobileNav: boolean;\n navOpen: boolean;\n previewActive: boolean;\n headerOffset?: number;\n}>(({ appHeader, mobileNav, navOpen, previewActive, headerOffset = 0, theme }) => {\n const heightOffset = appHeader || mobileNav ? headerHeight : '0rem';\n const appBackground = theme.base.palette['app-background'];\n\n return css`\n --appshell-offset: ${headerOffset}px;\n /* stylelint-disable-next-line length-zero-no-unit */\n --appshell-horizontal-offset: 0rem;\n\n @media (min-width: ${theme.base.breakpoints.sm}) {\n --appshell-horizontal-offset: ${navOpen ? navOpenWidth : navWidth};\n }\n position: relative;\n margin-inline-start: ${mobileNav ? 0 : navWidth};\n min-height: calc(100vh - ${heightOffset});\n background: ${appBackground};\n\n &:focus {\n outline: none;\n }\n\n ${navOpen &&\n !mobileNav &&\n css`\n margin-inline-start: ${navOpenWidth};\n `}\n\n ${!mobileNav &&\n css`\n transition: margin-inline-start\n ${`${theme.base.animation.speed} ${theme.base.animation.timing.ease}`};\n `}\n\n & > ${StyledProgressBackdrop} {\n max-height: calc(100vh - ${heightOffset});\n max-width: calc(100vw - ${navOpen ? navOpenWidth : navWidth});\n inset-block-start: ${heightOffset};\n inset-inline-start: ${navOpen ? navOpenWidth : navWidth};\n position: fixed;\n transition-property: opacity, max-height, max-width, inset-block-start, inset-inline-start;\n transition-duration: ${theme.base.animation.speed};\n transition-timing-function: ${theme.base.animation.timing.ease};\n }\n\n @media (min-width: ${theme.base.breakpoints.xl}) {\n transition: margin-inline-end ${!mobileNav ? ', margin-inline-start' : ''};\n transition-duration: ${theme.base.animation.speed};\n transition-timing-function: ${theme.base.animation.timing.ease};\n\n ${previewActive &&\n css`\n transition: none;\n margin-inline-end: min(var(--resize-drawer-width), ${resizeDrawerMaxWidth});\n `}\n }\n `;\n});\n\nStyledAppMain.defaultProps = defaultThemeProp;\n\nexport const StyledBannerRegion = styled.div(({ theme }) => {\n return css`\n padding: calc(2 * ${theme.base.spacing});\n `;\n});\n\nStyledBannerRegion.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellTooltip = styled(StyledTooltip)(({ theme }) => {\n const bg = theme.components.tooltip['background-color'];\n const color = readableColor(bg);\n\n return css`\n background-color: ${bg};\n padding: 0;\n header {\n color: ${color};\n border-bottom: none;\n }\n ${StyledMenuItem} {\n background-color: ${bg};\n color: ${color};\n\n &:hover,\n &:focus {\n background-color: ${bg};\n box-shadow: ${theme.base.shadow.focus};\n }\n }\n `;\n});\n\nStyledAppShellTooltip.defaultProps = defaultThemeProp;\n\nexport const StyledAppShellToggleButton = styled(Button)(({ theme }) => {\n const navBg = theme.components['app-shell'].nav.background;\n const navFgColor = theme.components['app-shell'].nav['foreground-color'];\n const { backgroundColor } = calculateBackgroundAndContrastColor(navBg, navFgColor);\n let bg = darken(0.2, backgroundColor);\n\n if (getContrast(backgroundColor, bg) < 1.3) {\n bg = lighten(0.2, backgroundColor);\n }\n\n return css`\n background: ${bg};\n color: ${navFgColor};\n border: none;\n margin-top: calc(1 * ${theme.base.spacing});\n\n ${StyledIcon} {\n width: 1.25rem;\n height: 1.25rem;\n font-weight: bold;\n }\n\n &:enabled:focus,\n :not([disabled]):focus {\n box-shadow: ${theme.base.shadow.focus};\n }\n `;\n});\n\nStyledAppShellToggleButton.defaultProps = defaultThemeProp;\n"]}
@@ -4,7 +4,7 @@ import styled, { css } from 'styled-components';
4
4
  import { rgba } from 'polished';
5
5
  import { calculateFontSize } from '../../styles';
6
6
  import { defaultThemeProp } from '../../theme';
7
- import { tryCatch, withTestIds } from '../../utils';
7
+ import { cssQuoteAndEscape, tryCatch, withTestIds } from '../../utils';
8
8
  import { useTestIds } from '../../hooks';
9
9
  import VisuallyHiddenText from '../VisuallyHiddenText';
10
10
  import { getStatusTestIds } from './Badges.test-ids';
@@ -29,7 +29,7 @@ export const StyledStatus = styled.span(({ theme, variant, afterContent }) => {
29
29
  padding-inline: calc(${spacing} / 2);
30
30
 
31
31
  &::after {
32
- content: '${afterContent}' / '';
32
+ content: ${cssQuoteAndEscape(`${afterContent}`)} / '';
33
33
  text-transform: uppercase;
34
34
  }
35
35
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"Status.js","sourceRoot":"","sources":["../../../src/components/Badges/Status.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM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,CACxB,UAAU,CAAwD,SAAS,MAAM,CAC/E,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,EACpD,GAAG;IAEH,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAErD,OAAO,CACL,KAAC,YAAY,mBACE,OAAO,CAAC,IAAI,KACrB,SAAS,EACb,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,EACR,YAAY,EAAE,QAAQ,YAEtB,KAAC,kBAAkB,cAAE,GAAG,QAAQ,EAAE,GAAsB,GAC3C,CAChB,CAAC;AACJ,CAAC,CAAC,EACF,gBAAgB,CACjB,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { PropsWithoutRef, ReactText } from 'react';\nimport styled, { css } from 'styled-components';\nimport { rgba } from 'polished';\n\nimport { calculateFontSize } from '../../styles';\nimport { defaultThemeProp } from '../../theme';\nimport type { RefElement, WithAttributes, TestIdProp } from '../../types';\nimport { tryCatch, withTestIds } from '../../utils';\nimport { useTestIds } from '../../hooks';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\n\nimport { getStatusTestIds } from './Badges.test-ids';\n\nexport type StatusProps = WithAttributes<\n 'span',\n TestIdProp & {\n /** Determines the color to render the Badge as. This color is derived from the Theme. */\n variant: 'success' | 'urgent' | 'warn' | 'pending' | 'info';\n /** The content of the Badge, transformed to uppercase. */\n children: ReactText;\n }\n>;\n\nexport const StyledStatus = styled.span<\n Pick<StatusProps, 'variant'> & { afterContent: StatusProps['children'] }\n>(({ theme, variant, afterContent }) => {\n const { spacing } = theme.base;\n const borderRadius = theme.base['border-radius'];\n const { 'font-stretch': fontStretch, status } = theme.components.badges;\n\n const { background, foreground } = status[variant];\n const shadow = tryCatch(() => rgba(foreground, 0.1));\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n display: inline-block;\n position: relative;\n background-color: ${background};\n border-radius: calc(0.25 * ${borderRadius});\n color: ${foreground};\n box-shadow: inset 0 0 0 0.0625rem ${shadow};\n font-size: ${fontSize.xxs};\n font-weight: bold;\n font-stretch: ${fontStretch};\n line-height: 1rem;\n padding-inline: calc(${spacing} / 2);\n\n &::after {\n content: '${afterContent}' / '';\n text-transform: uppercase;\n }\n `;\n});\n\nStyledStatus.defaultProps = defaultThemeProp;\n\nexport default withTestIds(\n forwardRef<RefElement<StatusProps>, PropsWithoutRef<StatusProps>>(function Status(\n { testId, variant = 'info', children, ...restProps },\n ref\n ) {\n const testIds = useTestIds(testId, getStatusTestIds);\n\n return (\n <StyledStatus\n data-testid={testIds.root}\n {...restProps}\n variant={variant}\n ref={ref}\n afterContent={children}\n >\n <VisuallyHiddenText>{`${children}`}</VisuallyHiddenText>\n </StyledStatus>\n );\n }),\n getStatusTestIds\n);\n"]}
1
+ {"version":3,"file":"Status.js","sourceRoot":"","sources":["../../../src/components/Badges/Status.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAYrD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAErC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE;IACrC,MAAM,EAAE,OAAO,EA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jB,CAAC","sourcesContent":["import { forwardRef } from 'react';\nimport type { PropsWithoutRef, ReactText } from 'react';\nimport styled, { css } from 'styled-components';\nimport { rgba } from 'polished';\n\nimport { calculateFontSize } from '../../styles';\nimport { defaultThemeProp } from '../../theme';\nimport type { RefElement, WithAttributes, TestIdProp } from '../../types';\nimport { cssQuoteAndEscape, tryCatch, withTestIds } from '../../utils';\nimport { useTestIds } from '../../hooks';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\n\nimport { getStatusTestIds } from './Badges.test-ids';\n\nexport type StatusProps = WithAttributes<\n 'span',\n TestIdProp & {\n /** Determines the color to render the Badge as. This color is derived from the Theme. */\n variant: 'success' | 'urgent' | 'warn' | 'pending' | 'info';\n /** The content of the Badge, transformed to uppercase. */\n children: ReactText;\n }\n>;\n\nexport const StyledStatus = styled.span<\n Pick<StatusProps, 'variant'> & { afterContent: StatusProps['children'] }\n>(({ theme, variant, afterContent }) => {\n const { spacing } = theme.base;\n const borderRadius = theme.base['border-radius'];\n const { 'font-stretch': fontStretch, status } = theme.components.badges;\n\n const { background, foreground } = status[variant];\n const shadow = tryCatch(() => rgba(foreground, 0.1));\n const fontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']);\n\n return css`\n display: inline-block;\n position: relative;\n background-color: ${background};\n border-radius: calc(0.25 * ${borderRadius});\n color: ${foreground};\n box-shadow: inset 0 0 0 0.0625rem ${shadow};\n font-size: ${fontSize.xxs};\n font-weight: bold;\n font-stretch: ${fontStretch};\n line-height: 1rem;\n padding-inline: calc(${spacing} / 2);\n\n &::after {\n content: ${cssQuoteAndEscape(`${afterContent}`)} / '';\n text-transform: uppercase;\n }\n `;\n});\n\nStyledStatus.defaultProps = defaultThemeProp;\n\nexport default withTestIds(\n forwardRef<RefElement<StatusProps>, PropsWithoutRef<StatusProps>>(function Status(\n { testId, variant = 'info', children, ...restProps },\n ref\n ) {\n const testIds = useTestIds(testId, getStatusTestIds);\n\n return (\n <StyledStatus\n data-testid={testIds.root}\n {...restProps}\n variant={variant}\n ref={ref}\n afterContent={children}\n >\n <VisuallyHiddenText>{`${children}`}</VisuallyHiddenText>\n </StyledStatus>\n );\n }),\n getStatusTestIds\n);\n"]}
@@ -1,7 +1,6 @@
1
- import type { FunctionComponent } from 'react';
2
- import type { ForwardProps } from '../../../types';
1
+ import type { WithAttributes } from '../../../types';
3
2
  import type { MultiSelectInputProps } from './MultiSelectInput.types';
4
3
  export declare const StyledMultiSelectInput: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
5
- declare const MultiSelectInput: FunctionComponent<MultiSelectInputProps & ForwardProps>;
4
+ declare const MultiSelectInput: import("react").ForwardRefExoticComponent<Omit<WithAttributes<"input", MultiSelectInputProps>, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
6
5
  export default MultiSelectInput;
7
6
  //# sourceMappingURL=MultiSelectInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MultiSelectInput.d.ts","sourceRoot":"","sources":["../../../../src/components/ComboBox/MultiSelectInput/MultiSelectInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAmD,MAAM,OAAO,CAAC;AAGhG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAiBnD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEtE,eAAO,MAAM,sBAAsB,yGAYlC,CAAC;AAIF,QAAA,MAAM,gBAAgB,EAAE,iBAAiB,CAAC,qBAAqB,GAAG,YAAY,CAuO7E,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"MultiSelectInput.d.ts","sourceRoot":"","sources":["../../../../src/components/ComboBox/MultiSelectInput/MultiSelectInput.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAkBrD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEtE,eAAO,MAAM,sBAAsB,yGAiBlC,CAAC;AAIF,QAAA,MAAM,gBAAgB,0JAuOpB,CAAC;AAEH,eAAe,gBAAgB,CAAC"}
@@ -5,8 +5,8 @@ import { defaultThemeProp } from '../../../theme';
5
5
  import Selectable from '../../Badges/Selection';
6
6
  import { StyledFormControl } from '../../FormControl';
7
7
  import Flex from '../../Flex';
8
- import { useConsolidatedRef, useActiveDescendant, useDirection, useI18n, useUID } from '../../../hooks';
9
- import { cap } from '../../../utils';
8
+ import { useArrows, useConsolidatedRef, useDirection, useFocusWithin, useI18n, useUID } from '../../../hooks';
9
+ import { isInstance, getActiveElement } from '../../../utils';
10
10
  import VisuallyHiddenText from '../../VisuallyHiddenText';
11
11
  import { StyledSelectInput } from '../ComboBox.styles';
12
12
  export const StyledMultiSelectInput = styled(StyledSelectInput) `
@@ -15,6 +15,11 @@ export const StyledMultiSelectInput = styled(StyledSelectInput) `
15
15
  ul {
16
16
  list-style: none;
17
17
  display: contents;
18
+
19
+ /* The pill's own focus ring is enough; suppress the inner link's ring so it does not distort it. */
20
+ a[href]:focus-visible {
21
+ box-shadow: none;
22
+ }
18
23
  }
19
24
 
20
25
  input {
@@ -29,90 +34,90 @@ const MultiSelectInput = forwardRef(function MultiSelectInput(props, ref) {
29
34
  const id = useUID();
30
35
  const inputRef = useConsolidatedRef(ref);
31
36
  const listRef = useRef(null);
32
- const [focusDescendant, setFocusDescendant] = useState(null);
33
- const [activeItemId, setActiveItemId] = useState(null);
34
- const { start, end } = useDirection();
35
- const uadConfig = useMemo(() => ({
36
- focusEl: inputRef.current,
37
- scope: listRef.current,
38
- selector: 'li[role="option"]',
39
- orientation: 'horizontal',
40
- focusReturnEl: focusDescendant,
41
- clearFocusReturn: () => {
42
- setFocusDescendant(null);
43
- },
44
- pauseDescendantEvaluation,
45
- preventInitialScroll: true,
46
- onClick: (el) => {
47
- el.click();
48
- }
49
- }), [pauseDescendantEvaluation, selected, focusDescendant]);
50
- const { activeDescendant } = useActiveDescendant(uadConfig, [selected]);
37
+ const [lastFocusedId, setLastFocusedId] = useState();
38
+ const { start } = useDirection();
39
+ const selectionDescriptionId = `${id}-selectionDescription`;
40
+ const selector = ':scope > li';
41
+ const focusSelector = '[data-selection-focus]';
42
+ const tabStopId = lastFocusedId && selected.some(item => item.id.toString() === lastFocusedId)
43
+ ? lastFocusedId
44
+ : selected[selected.length - 1]?.id.toString();
51
45
  const handleSelectedRemoval = useCallback((selectionId, idx) => {
52
- if (!pauseDescendantEvaluation) {
53
- if (idx === selected.length - 1) {
54
- // If removing last selected item
55
- if (selected.length > 1) {
56
- // If other selected items, focus previous
57
- setFocusDescendant(listRef.current?.querySelectorAll(uadConfig.selector)[idx - 1] ||
58
- null);
59
- }
60
- else {
61
- // Blur selected if final only item removed
46
+ const items = Array.from(listRef.current?.querySelectorAll(selector) ?? []);
47
+ const sibling = items[idx > 0 ? idx - 1 : 1];
48
+ if (listRef.current?.contains(getActiveElement())) {
49
+ if (sibling)
50
+ (sibling.querySelector('a') ?? sibling).focus();
51
+ else {
52
+ inputRef.current?.focus();
53
+ // Focusing the input fires onListBlur; notify here only when focus could not move.
54
+ if (listRef.current?.contains(getActiveElement()))
62
55
  onSelectedBlur?.();
63
- }
64
- }
65
- else if (selected.length > 1) {
66
- // If not last item removed and other selected items, focus next
67
- setFocusDescendant(listRef.current?.querySelectorAll(uadConfig.selector)[idx + 1] ||
68
- null);
69
56
  }
70
57
  }
71
58
  onRemove?.(selectionId, idx);
72
- inputRef.current?.focus();
73
- }, [selected, onRemove, onSelectedBlur, uadConfig]);
59
+ }, [onRemove, onSelectedBlur]);
60
+ // Selected items are a single tab stop, separate from the input.
74
61
  useEffect(() => {
75
- // Maintain active item & prev. val only as it changes.
76
- if (activeDescendant?.id && activeDescendant.id !== activeItemId) {
77
- setActiveItemId(activeDescendant.id);
62
+ listRef.current?.querySelectorAll(selector).forEach(item => {
63
+ const target = item.querySelector('a') ?? item;
64
+ target.setAttribute('data-selection-focus', '');
65
+ target.tabIndex = !disabled && item.dataset.selection === tabStopId ? 0 : -1;
66
+ });
67
+ }, [disabled, selected, tabStopId]);
68
+ useArrows(listRef, { selector: focusSelector, dir: 'left-right', cycle: false, updateTabIndex: false }, [selected.length]);
69
+ useFocusWithin([listRef], isFocused => {
70
+ if (isFocused)
71
+ onSelectedFocus?.();
72
+ else
73
+ onSelectedBlur?.();
74
+ });
75
+ const onListTabKeyDown = useCallback((e) => {
76
+ // Tab (forward) from within the list: move focus to the input
77
+ if (e.key === 'Tab' && !e.shiftKey && !disabled) {
78
+ e.preventDefault();
79
+ inputRef.current?.focus();
80
+ return;
78
81
  }
79
- }, [activeDescendant]);
82
+ // Shift+Tab from within the list: exit the combobox entirely
83
+ if (e.key === 'Tab' && e.shiftKey) {
84
+ const focusables = Array.from(listRef.current?.querySelectorAll('a, button') ?? []);
85
+ const elementsToRestore = inputRef.current ? [...focusables, inputRef.current] : focusables;
86
+ const previousTabIndexes = elementsToRestore.map(el => ({
87
+ el,
88
+ tabindex: el.getAttribute('tabindex')
89
+ }));
90
+ elementsToRestore.forEach(el => el.setAttribute('tabindex', '-1'));
91
+ requestAnimationFrame(() => {
92
+ previousTabIndexes.forEach(({ el, tabindex }) => {
93
+ if (tabindex === null) {
94
+ el.removeAttribute('tabindex');
95
+ }
96
+ else {
97
+ el.setAttribute('tabindex', tabindex);
98
+ }
99
+ });
100
+ });
101
+ }
102
+ }, [disabled]);
80
103
  const onInputKeyDown = useCallback((e) => {
81
- if (selected.length &&
82
- inputRef.current?.selectionStart === 0 &&
83
- inputRef.current?.selectionEnd === 0) {
84
- const lastIndex = selected.length - 1;
85
- if (pauseDescendantEvaluation && e.key === `Arrow${cap(start)}`) {
86
- setFocusDescendant(listRef.current?.querySelectorAll(uadConfig.selector)[lastIndex] ||
87
- null);
88
- onSelectedFocus?.();
89
- }
90
- const lastSelectableId = listRef.current?.querySelectorAll(uadConfig.selector)[lastIndex]
91
- ?.id;
92
- const onLastItem = activeItemId === lastSelectableId;
93
- if (!pauseDescendantEvaluation &&
94
- ((onLastItem && e.key === `Arrow${cap(end)}`) || e.key === 'ArrowDown')) {
95
- onSelectedBlur?.();
96
- }
97
- if (['Backspace', 'Delete'].includes(e.key) && !(readOnly || disabled)) {
98
- handleSelectedRemoval(selected[lastIndex].id, lastIndex);
104
+ // Shift+Tab: Focus the selected items tab stop
105
+ if (e.key === 'Tab' && e.shiftKey && selected.length) {
106
+ const target = listRef.current?.querySelector('[tabindex="0"]');
107
+ if (target) {
108
+ e.preventDefault();
109
+ e.stopPropagation();
110
+ target.focus();
111
+ return;
99
112
  }
100
113
  }
101
114
  onKeyDown?.(e);
102
- }, [
103
- pauseDescendantEvaluation,
104
- activeItemId,
105
- onKeyDown,
106
- handleSelectedRemoval,
107
- selected,
108
- readOnly,
109
- disabled
110
- ]);
111
- const ariaDescribedBy = useMemo(() => {
112
- return onChange
113
- ? `${id}-inputDescription ${id}-searchDescription`
114
- : `${id}-inputDescription`;
115
- }, [id]);
115
+ }, [onKeyDown, selected.length]);
116
+ const onListFocus = useCallback((e) => {
117
+ const item = isInstance(e.target, HTMLElement) ? e.target.closest('li') : null;
118
+ if (item?.dataset.selection)
119
+ setLastFocusedId(item.dataset.selection);
120
+ }, []);
116
121
  const ariaControlsValue = useMemo(() => {
117
122
  if (!pauseDescendantEvaluation) {
118
123
  return selected.length > 0 ? id : undefined;
@@ -121,22 +126,26 @@ const MultiSelectInput = forwardRef(function MultiSelectInput(props, ref) {
121
126
  }, [pauseDescendantEvaluation, selected.length]);
122
127
  return (_jsxs(Flex, { as: StyledMultiSelectInput, forwardedAs: StyledFormControl, hasSuggestion: status === 'pending' && !!onResolveSuggestion, container: { alignItems: 'center', justify: 'between' }, readOnly: readOnly, disabled: disabled, status: status, children: [_jsxs(Flex, { container: { alignContent: 'center', wrap: 'wrap', rowGap: 0.5, colGap: 0.25, pad: 0.25 }, item: { grow: 1 }, onClick: (e) => {
123
128
  // Ignore clicks on selection items
124
- if (e.target instanceof HTMLElement &&
125
- !(e.target instanceof HTMLInputElement) &&
129
+ if (isInstance(e.target, HTMLElement) &&
130
+ !isInstance(e.target, HTMLInputElement) &&
126
131
  !e.currentTarget.contains(e.target.closest('li'))) {
127
132
  e.stopPropagation();
128
133
  inputRef.current?.focus();
129
134
  inputRef.current?.click();
130
135
  }
131
- }, children: [selected.length > 0 && (_jsx("ul", { ref: listRef, id: id, role: 'listbox', "aria-label": t('selected_items'), children: selected.map((element, idx) => {
132
- return (_jsx(Selectable, { as: 'li', role: 'option', id: element.id.toString(), status: status, onRemove: !readOnly && !disabled
136
+ }, children: [selected.length > 0 && (
137
+ // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
138
+ _jsx("ul", { ref: listRef, id: id, "aria-label": t('selected_items'), onKeyDown: onListTabKeyDown, onFocus: onListFocus, children: selected.map((element, idx) => {
139
+ return (_jsx(Selectable, { as: 'li', id: element.id.toString(), "data-selection": element.id.toString(), status: status, contextualLabel: element.text, onRemove: !readOnly && !disabled
133
140
  ? () => {
134
141
  handleSelectedRemoval(element.id, idx);
135
142
  }
136
- : undefined, tabIndex: -1, "aria-label": `${t('remove')} ${element.text}`, "aria-describedby": ariaDescribedBy, children: element.text }, element.id));
143
+ : undefined, tabIndex: -1, "aria-label": !readOnly && !disabled && onRemove
144
+ ? `${t('remove')} ${element.text}`
145
+ : element.text, "aria-describedby": selectionDescriptionId, children: element.text }, element.id));
137
146
  }) })), _jsx(Flex, { item: { grow: 1 }, as: 'input', size: 1, ref: inputRef, value: value,
138
147
  // no-op avoids react uncontrolled warning
139
- onChange: onChange || (() => { }), onKeyDown: onInputKeyDown, readOnly: readOnly || !onChange, disabled: disabled, placeholder: selected?.length ? undefined : placeholder, autoComplete: 'off', autoFocus: autoFocus, "aria-controls": ariaControlsValue, "aria-required": !!required, ...restProps })] }), actions, _jsx(VisuallyHiddenText, { id: `${id}-inputDescription`, children: `${t('combobox_open_close')} ` }), _jsx(VisuallyHiddenText, { id: `${id}-searchDescription`, children: t('combobox_search_instructions') })] }));
148
+ onChange: onChange || (() => { }), onKeyDown: onInputKeyDown, readOnly: readOnly || !onChange, disabled: disabled, placeholder: selected?.length ? undefined : placeholder, autoComplete: 'off', autoFocus: autoFocus, "aria-controls": ariaControlsValue, "aria-required": !!required, ...restProps })] }), actions, _jsx(VisuallyHiddenText, { id: selectionDescriptionId, children: `${t('multiselect_instructions', [start])}${!disabled ? ` ${t('multiselect_tab_to_input')}` : ''}` })] }));
140
149
  });
141
150
  export default MultiSelectInput;
142
151
  //# sourceMappingURL=MultiSelectInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MultiSelectInput.js","sourceRoot":"","sources":["../../../../src/components/ComboBox/MultiSelectInput/MultiSelectInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtF,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAGvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,UAAU,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,YAAY,EACZ,OAAO,EACP,MAAM,EACP,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,kBAAkB,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAKvD,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,iBAAiB,CAAC,CAAA;;;;;;;;;;;;CAY9D,CAAC;AAEF,sBAAsB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEvD,MAAM,gBAAgB,GAA4D,UAAU,CAC1F,SAAS,gBAAgB,C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,EAAE,EAAC,OAAO,EACV,IAAI,EAAE,CAAC,EACP,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,KAAK;wBACZ,0CAA0C;wBAC1C,QAAQ,EAAE,QAAQ,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,EAChC,SAAS,EAAE,cAAc,EACzB,QAAQ,EAAE,QAAQ,IAAI,CAAC,QAAQ,EAC/B,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,EACvD,YAAY,EAAC,KAAK,EAClB,SAAS,EAAE,SAAS,mBACL,iBAAiB,mBACjB,CAAC,CAAC,QAAQ,KACrB,SAAS,GACb,IACG,EACN,OAAO,EAER,KAAC,kBAAkB,IAAC,EAAE,EAAE,GAAG,EAAE,mBAAmB,YAC7C,GAAG,CAAC,CAAC,qBAAqB,CAAC,GAAG,GACZ,EACrB,KAAC,kBAAkB,IAAC,EAAE,EAAE,GAAG,EAAE,oBAAoB,YAC9C,CAAC,CAAC,8BAA8B,CAAC,GACf,IAChB,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import { forwardRef, useRef, useCallback, useMemo, useState, useEffect } from 'react';\nimport type { FunctionComponent, Ref, PropsWithoutRef, KeyboardEvent, MouseEvent } from 'react';\nimport styled from 'styled-components';\n\nimport type { ForwardProps } from '../../../types';\nimport { defaultThemeProp } from '../../../theme';\nimport Selectable from '../../Badges/Selection';\nimport { StyledFormControl } from '../../FormControl';\nimport Flex from '../../Flex';\nimport {\n useConsolidatedRef,\n useActiveDescendant,\n useDirection,\n useI18n,\n useUID\n} from '../../../hooks';\nimport { cap } from '../../../utils';\nimport VisuallyHiddenText from '../../VisuallyHiddenText';\nimport { StyledSelectInput } from '../ComboBox.styles';\nimport type { Selected } from '../ComboBox.types';\n\nimport type { MultiSelectInputProps } from './MultiSelectInput.types';\n\nexport const StyledMultiSelectInput = styled(StyledSelectInput)`\n cursor: text;\n\n ul {\n list-style: none;\n display: contents;\n }\n\n input {\n width: 8ch;\n height: 1.125rem;\n }\n`;\n\nStyledMultiSelectInput.defaultProps = defaultThemeProp;\n\nconst MultiSelectInput: FunctionComponent<MultiSelectInputProps & ForwardProps> = forwardRef(\n function MultiSelectInput(\n props: PropsWithoutRef<MultiSelectInputProps>,\n ref: Ref<HTMLInputElement>\n ) {\n const {\n selected = [],\n value,\n onRemove,\n onChange,\n onKeyDown,\n onResolveSuggestion,\n actions,\n readOnly,\n disabled,\n status,\n placeholder,\n autoFocus,\n pauseDescendantEvaluation,\n onSelectedFocus,\n onSelectedBlur,\n 'aria-controls': ariaControls,\n required,\n ...restProps\n } = props;\n const t = useI18n();\n const id = useUID();\n\n const inputRef = useConsolidatedRef<HTMLInputElement>(ref);\n const listRef = useRef<HTMLUListElement>(null);\n const [focusDescendant, setFocusDescendant] = useState<HTMLElement | null>(null);\n const [activeItemId, setActiveItemId] = useState<string | null>(null);\n const { start, end } = useDirection();\n\n const uadConfig = useMemo(\n () => ({\n focusEl: inputRef.current,\n scope: listRef.current,\n selector: 'li[role=\"option\"]',\n orientation: 'horizontal' as const,\n focusReturnEl: focusDescendant,\n clearFocusReturn: () => {\n setFocusDescendant(null);\n },\n pauseDescendantEvaluation,\n preventInitialScroll: true,\n onClick: (el: HTMLElement) => {\n el.click();\n }\n }),\n [pauseDescendantEvaluation, selected, focusDescendant]\n );\n\n const { activeDescendant } = useActiveDescendant(uadConfig, [selected]);\n\n const handleSelectedRemoval = useCallback(\n (selectionId: Selected['id'], idx: number) => {\n if (!pauseDescendantEvaluation) {\n if (idx === selected.length - 1) {\n // If removing last selected item\n if (selected.length > 1) {\n // If other selected items, focus previous\n setFocusDescendant(\n (listRef.current?.querySelectorAll(uadConfig.selector)[idx - 1] as HTMLElement) ||\n null\n );\n } else {\n // Blur selected if final only item removed\n onSelectedBlur?.();\n }\n } else if (selected.length > 1) {\n // If not last item removed and other selected items, focus next\n setFocusDescendant(\n (listRef.current?.querySelectorAll(uadConfig.selector)[idx + 1] as HTMLElement) ||\n null\n );\n }\n }\n onRemove?.(selectionId, idx);\n inputRef.current?.focus();\n },\n [selected, onRemove, onSelectedBlur, uadConfig]\n );\n\n useEffect(() => {\n // Maintain active item & prev. val only as it changes.\n if (activeDescendant?.id && activeDescendant.id !== activeItemId) {\n setActiveItemId(activeDescendant.id);\n }\n }, [activeDescendant]);\n\n const onInputKeyDown = useCallback(\n (e: KeyboardEvent<HTMLInputElement>) => {\n if (\n selected.length &&\n inputRef.current?.selectionStart === 0 &&\n inputRef.current?.selectionEnd === 0\n ) {\n const lastIndex = selected.length - 1;\n if (pauseDescendantEvaluation && e.key === `Arrow${cap(start)}`) {\n setFocusDescendant(\n (listRef.current?.querySelectorAll(uadConfig.selector)[lastIndex] as HTMLElement) ||\n null\n );\n onSelectedFocus?.();\n }\n\n const lastSelectableId = listRef.current?.querySelectorAll(uadConfig.selector)[lastIndex]\n ?.id;\n const onLastItem = activeItemId === lastSelectableId;\n\n if (\n !pauseDescendantEvaluation &&\n ((onLastItem && e.key === `Arrow${cap(end)}`) || e.key === 'ArrowDown')\n ) {\n onSelectedBlur?.();\n }\n\n if (['Backspace', 'Delete'].includes(e.key) && !(readOnly || disabled)) {\n handleSelectedRemoval(selected[lastIndex].id, lastIndex);\n }\n }\n onKeyDown?.(e);\n },\n [\n pauseDescendantEvaluation,\n activeItemId,\n onKeyDown,\n handleSelectedRemoval,\n selected,\n readOnly,\n disabled\n ]\n );\n\n const ariaDescribedBy = useMemo(() => {\n return onChange\n ? `${id}-inputDescription ${id}-searchDescription`\n : `${id}-inputDescription`;\n }, [id]);\n\n const ariaControlsValue = useMemo(() => {\n if (!pauseDescendantEvaluation) {\n return selected.length > 0 ? id : undefined;\n }\n return ariaControls;\n }, [pauseDescendantEvaluation, selected.length]);\n\n return (\n <Flex\n as={StyledMultiSelectInput}\n forwardedAs={StyledFormControl}\n hasSuggestion={status === 'pending' && !!onResolveSuggestion}\n container={{ alignItems: 'center', justify: 'between' }}\n readOnly={readOnly}\n disabled={disabled}\n status={status}\n >\n <Flex\n container={{ alignContent: 'center', wrap: 'wrap', rowGap: 0.5, colGap: 0.25, pad: 0.25 }}\n item={{ grow: 1 }}\n onClick={(e: MouseEvent<HTMLDivElement>) => {\n // Ignore clicks on selection items\n if (\n e.target instanceof HTMLElement &&\n !(e.target instanceof HTMLInputElement) &&\n !e.currentTarget.contains(e.target.closest('li'))\n ) {\n e.stopPropagation();\n inputRef.current?.focus();\n inputRef.current?.click();\n }\n }}\n >\n {selected.length > 0 && (\n <ul ref={listRef} id={id} role='listbox' aria-label={t('selected_items')}>\n {selected.map((element, idx) => {\n return (\n <Selectable\n as='li'\n key={element.id}\n role='option'\n id={element.id.toString()}\n status={status}\n onRemove={\n !readOnly && !disabled\n ? () => {\n handleSelectedRemoval(element.id, idx);\n }\n : undefined\n }\n tabIndex={-1}\n aria-label={`${t('remove')} ${element.text}`}\n aria-describedby={ariaDescribedBy}\n >\n {element.text}\n </Selectable>\n );\n })}\n </ul>\n )}\n <Flex\n item={{ grow: 1 }}\n as='input'\n size={1}\n ref={inputRef}\n value={value}\n // no-op avoids react uncontrolled warning\n onChange={onChange || (() => {})}\n onKeyDown={onInputKeyDown}\n readOnly={readOnly || !onChange}\n disabled={disabled}\n placeholder={selected?.length ? undefined : placeholder}\n autoComplete='off'\n autoFocus={autoFocus}\n aria-controls={ariaControlsValue}\n aria-required={!!required}\n {...restProps}\n />\n </Flex>\n {actions}\n\n <VisuallyHiddenText id={`${id}-inputDescription`}>\n {`${t('combobox_open_close')} `}\n </VisuallyHiddenText>\n <VisuallyHiddenText id={`${id}-searchDescription`}>\n {t('combobox_search_instructions')}\n </VisuallyHiddenText>\n </Flex>\n );\n }\n);\n\nexport default MultiSelectInput;\n"]}
1
+ {"version":3,"file":"MultiSelectInput.js","sourceRoot":"","sources":["../../../../src/components/ComboBox/MultiSelectInput/MultiSelectInput.tsx"],"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AQ,KACrB,SAAS,GACb,IACG,EACN,OAAO,EAER,KAAC,kBAAkB,IAAC,EAAE,EAAE,sBAAsB,YAC3C,GAAG,CAAC,CAAC,0BAA0B,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,0BAA0B,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,GAChF,IAChB,CACR,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,gBAAgB,CAAC","sourcesContent":["import { forwardRef, useRef, useCallback, useMemo, useState, useEffect } from 'react';\nimport type { Ref, PropsWithoutRef, KeyboardEvent, FocusEvent, MouseEvent } from 'react';\nimport styled from 'styled-components';\n\nimport type { WithAttributes } from '../../../types';\nimport { defaultThemeProp } from '../../../theme';\nimport Selectable from '../../Badges/Selection';\nimport { StyledFormControl } from '../../FormControl';\nimport Flex from '../../Flex';\nimport {\n useArrows,\n useConsolidatedRef,\n useDirection,\n useFocusWithin,\n useI18n,\n useUID\n} from '../../../hooks';\nimport { isInstance, getActiveElement } from '../../../utils';\nimport VisuallyHiddenText from '../../VisuallyHiddenText';\nimport { StyledSelectInput } from '../ComboBox.styles';\nimport type { Selected } from '../ComboBox.types';\n\nimport type { MultiSelectInputProps } from './MultiSelectInput.types';\n\nexport const StyledMultiSelectInput = styled(StyledSelectInput)`\n cursor: text;\n\n ul {\n list-style: none;\n display: contents;\n\n /* The pill's own focus ring is enough; suppress the inner link's ring so it does not distort it. */\n a[href]:focus-visible {\n box-shadow: none;\n }\n }\n\n input {\n width: 8ch;\n height: 1.125rem;\n }\n`;\n\nStyledMultiSelectInput.defaultProps = defaultThemeProp;\n\nconst MultiSelectInput = forwardRef(function MultiSelectInput(\n props: PropsWithoutRef<WithAttributes<'input', MultiSelectInputProps>>,\n ref: Ref<HTMLInputElement>\n) {\n const {\n selected = [],\n value,\n onRemove,\n onChange,\n onKeyDown,\n onResolveSuggestion,\n actions,\n readOnly,\n disabled,\n status,\n placeholder,\n autoFocus,\n pauseDescendantEvaluation,\n onSelectedFocus,\n onSelectedBlur,\n 'aria-controls': ariaControls,\n required,\n ...restProps\n } = props;\n const t = useI18n();\n const id = useUID();\n\n const inputRef = useConsolidatedRef<HTMLInputElement>(ref);\n const listRef = useRef<HTMLUListElement>(null);\n const [lastFocusedId, setLastFocusedId] = useState<string>();\n const { start } = useDirection();\n const selectionDescriptionId = `${id}-selectionDescription`;\n const selector = ':scope > li';\n const focusSelector = '[data-selection-focus]';\n\n const tabStopId =\n lastFocusedId && selected.some(item => item.id.toString() === lastFocusedId)\n ? lastFocusedId\n : selected[selected.length - 1]?.id.toString();\n\n const handleSelectedRemoval = useCallback(\n (selectionId: Selected['id'], idx: number) => {\n const items = Array.from(listRef.current?.querySelectorAll<HTMLElement>(selector) ?? []);\n const sibling = items[idx > 0 ? idx - 1 : 1];\n\n if (listRef.current?.contains(getActiveElement())) {\n if (sibling) (sibling.querySelector<HTMLElement>('a') ?? sibling).focus();\n else {\n inputRef.current?.focus();\n // Focusing the input fires onListBlur; notify here only when focus could not move.\n if (listRef.current?.contains(getActiveElement())) onSelectedBlur?.();\n }\n }\n onRemove?.(selectionId, idx);\n },\n [onRemove, onSelectedBlur]\n );\n\n // Selected items are a single tab stop, separate from the input.\n useEffect(() => {\n listRef.current?.querySelectorAll<HTMLElement>(selector).forEach(item => {\n const target = item.querySelector<HTMLElement>('a') ?? item;\n target.setAttribute('data-selection-focus', '');\n target.tabIndex = !disabled && item.dataset.selection === tabStopId ? 0 : -1;\n });\n }, [disabled, selected, tabStopId]);\n\n useArrows(\n listRef,\n { selector: focusSelector, dir: 'left-right', cycle: false, updateTabIndex: false },\n [selected.length]\n );\n\n useFocusWithin([listRef], isFocused => {\n if (isFocused) onSelectedFocus?.();\n else onSelectedBlur?.();\n });\n\n const onListTabKeyDown = useCallback(\n (e: KeyboardEvent<HTMLUListElement>) => {\n // Tab (forward) from within the list: move focus to the input\n if (e.key === 'Tab' && !e.shiftKey && !disabled) {\n e.preventDefault();\n inputRef.current?.focus();\n return;\n }\n\n // Shift+Tab from within the list: exit the combobox entirely\n if (e.key === 'Tab' && e.shiftKey) {\n const focusables = Array.from(listRef.current?.querySelectorAll('a, button') ?? []);\n const elementsToRestore = inputRef.current ? [...focusables, inputRef.current] : focusables;\n const previousTabIndexes = elementsToRestore.map(el => ({\n el,\n tabindex: el.getAttribute('tabindex')\n }));\n elementsToRestore.forEach(el => el.setAttribute('tabindex', '-1'));\n requestAnimationFrame(() => {\n previousTabIndexes.forEach(({ el, tabindex }) => {\n if (tabindex === null) {\n el.removeAttribute('tabindex');\n } else {\n el.setAttribute('tabindex', tabindex);\n }\n });\n });\n }\n },\n [disabled]\n );\n\n const onInputKeyDown = useCallback(\n (e: KeyboardEvent<HTMLInputElement>) => {\n // Shift+Tab: Focus the selected items tab stop\n if (e.key === 'Tab' && e.shiftKey && selected.length) {\n const target = listRef.current?.querySelector<HTMLElement>('[tabindex=\"0\"]');\n\n if (target) {\n e.preventDefault();\n e.stopPropagation();\n target.focus();\n return;\n }\n }\n onKeyDown?.(e);\n },\n [onKeyDown, selected.length]\n );\n\n const onListFocus = useCallback((e: FocusEvent<HTMLUListElement>) => {\n const item = isInstance(e.target, HTMLElement) ? e.target.closest('li') : null;\n if (item?.dataset.selection) setLastFocusedId(item.dataset.selection);\n }, []);\n\n const ariaControlsValue = useMemo(() => {\n if (!pauseDescendantEvaluation) {\n return selected.length > 0 ? id : undefined;\n }\n return ariaControls;\n }, [pauseDescendantEvaluation, selected.length]);\n\n return (\n <Flex\n as={StyledMultiSelectInput}\n forwardedAs={StyledFormControl}\n hasSuggestion={status === 'pending' && !!onResolveSuggestion}\n container={{ alignItems: 'center', justify: 'between' }}\n readOnly={readOnly}\n disabled={disabled}\n status={status}\n >\n <Flex\n container={{ alignContent: 'center', wrap: 'wrap', rowGap: 0.5, colGap: 0.25, pad: 0.25 }}\n item={{ grow: 1 }}\n onClick={(e: MouseEvent<HTMLDivElement>) => {\n // Ignore clicks on selection items\n if (\n isInstance(e.target, HTMLElement) &&\n !isInstance(e.target, HTMLInputElement) &&\n !e.currentTarget.contains(e.target.closest('li'))\n ) {\n e.stopPropagation();\n inputRef.current?.focus();\n inputRef.current?.click();\n }\n }}\n >\n {selected.length > 0 && (\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n <ul\n ref={listRef}\n id={id}\n aria-label={t('selected_items')}\n onKeyDown={onListTabKeyDown}\n onFocus={onListFocus}\n >\n {selected.map((element, idx) => {\n return (\n <Selectable\n as='li'\n key={element.id}\n id={element.id.toString()}\n data-selection={element.id.toString()}\n status={status}\n contextualLabel={element.text}\n onRemove={\n !readOnly && !disabled\n ? () => {\n handleSelectedRemoval(element.id, idx);\n }\n : undefined\n }\n tabIndex={-1}\n aria-label={\n !readOnly && !disabled && onRemove\n ? `${t('remove')} ${element.text}`\n : element.text\n }\n aria-describedby={selectionDescriptionId}\n >\n {element.text}\n </Selectable>\n );\n })}\n </ul>\n )}\n <Flex\n item={{ grow: 1 }}\n as='input'\n size={1}\n ref={inputRef}\n value={value}\n // no-op avoids react uncontrolled warning\n onChange={onChange || (() => {})}\n onKeyDown={onInputKeyDown}\n readOnly={readOnly || !onChange}\n disabled={disabled}\n placeholder={selected?.length ? undefined : placeholder}\n autoComplete='off'\n autoFocus={autoFocus}\n aria-controls={ariaControlsValue}\n aria-required={!!required}\n {...restProps}\n />\n </Flex>\n {actions}\n\n <VisuallyHiddenText id={selectionDescriptionId}>\n {`${t('multiselect_instructions', [start])}${!disabled ? ` ${t('multiselect_tab_to_input')}` : ''}`}\n </VisuallyHiddenText>\n </Flex>\n );\n});\n\nexport default MultiSelectInput;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/Menu.styles.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,eAAO,MAAM,kBAAkB,oLAE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AIF,eAAO,MAAM,uBAAuB,8GAMlC,CAAC;AAIH,eAAO,MAAM,6BAA6B,8GAEzC,CAAC;AAEF,eAAO,MAAM,iBAAiB,wGAI7B,CAAC;AAEF,eAAO,MAAM,qBAAqB,yGAoBjC,CAAC;AAIF,eAAO,MAAM,UAAU,yGAwDrB,CAAC"}
@@ -115,7 +115,9 @@ export const StyledMenuItem = styled.li(({ theme: { base, components }, isParent
115
115
  &:hover {
116
116
  ${StyledCheckMarkIcon} {
117
117
  visibility: visible;
118
- ${mode === 'single-select' &&
118
+ ${(mode === 'single-select' ||
119
+ (mode === 'multi-select' &&
120
+ components.menu['multi-select']['selection-indicator'] !== 'checkbox')) &&
119
121
  css `
120
122
  ${isChecked
121
123
  ? css `
@@ -126,6 +128,7 @@ export const StyledMenuItem = styled.li(({ theme: { base, components }, isParent
126
128
  `}
127
129
  `}
128
130
  ${mode === 'multi-select' &&
131
+ components.menu['multi-select']['selection-indicator'] === 'checkbox' &&
129
132
  css `
130
133
  ${!isChecked &&
131
134
  css `
@@ -159,7 +162,9 @@ export const StyledMenuItem = styled.li(({ theme: { base, components }, isParent
159
162
 
160
163
  ${StyledCheckMarkIcon} {
161
164
  margin-inline-start: 0;
162
- ${mode === 'single-select' &&
165
+ ${(mode === 'single-select' ||
166
+ (mode === 'multi-select' &&
167
+ components.menu['multi-select']['selection-indicator'] !== 'checkbox')) &&
163
168
  css `
164
169
  ${isChecked
165
170
  ? css `
@@ -170,6 +175,7 @@ export const StyledMenuItem = styled.li(({ theme: { base, components }, isParent
170
175
  `}
171
176
  `}
172
177
  ${mode === 'multi-select' &&
178
+ components.menu['multi-select']['selection-indicator'] === 'checkbox' &&
173
179
  css `
174
180
  ${isChecked
175
181
  ? css `