@pega/cosmos-react-core 9.0.0-build.14.8 → 9.0.0-build.15.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/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +34 -12
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/AppShell/AppShell.styles.d.ts +8 -1
- package/lib/components/AppShell/AppShell.styles.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.styles.js +133 -20
- package/lib/components/AppShell/AppShell.styles.js.map +1 -1
- package/lib/components/AppShell/AppShell.types.d.ts +3 -0
- package/lib/components/AppShell/AppShell.types.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.types.js.map +1 -1
- package/lib/components/AppShell/NavigationList.d.ts.map +1 -1
- package/lib/components/AppShell/NavigationList.js +8 -7
- package/lib/components/AppShell/NavigationList.js.map +1 -1
- package/lib/components/AppShell/NavigationListItemWrapper.d.ts.map +1 -1
- package/lib/components/AppShell/NavigationListItemWrapper.js +66 -45
- package/lib/components/AppShell/NavigationListItemWrapper.js.map +1 -1
- package/lib/components/Menu/Menu.styles.d.ts.map +1 -1
- package/lib/components/Menu/Menu.styles.js +42 -1
- package/lib/components/Menu/Menu.styles.js.map +1 -1
- package/lib/components/Menu/MenuItem.d.ts.map +1 -1
- package/lib/components/Menu/MenuItem.js +4 -3
- package/lib/components/Menu/MenuItem.js.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js +3 -3
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/Switch/Switch.d.ts.map +1 -1
- package/lib/components/Switch/Switch.js +1 -0
- package/lib/components/Switch/Switch.js.map +1 -1
- package/lib/components/Tabs/TabPanel.d.ts.map +1 -1
- package/lib/components/Tabs/TabPanel.js +3 -1
- package/lib/components/Tabs/TabPanel.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +1 -0
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/i18n/default.d.ts +1 -0
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +1 -0
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +1 -0
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/theme/themes/bootes2025Theme.json +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationList.js","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationList.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG7E,OAAO,EACL,QAAQ,EACR,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,MAAM,EACN,OAAO,EACP,SAAS,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAC/C,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAC9C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,MAAM,MAAM,WAAW,CAAC;AAG/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,SAAS,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,aAAa,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,cAAc,MAAM,gCAAgC,CAAC;AAEjE,OAAO,yBAAyB,MAAM,6BAA6B,CAAC;AAOpE,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,+BAA+B,EAC/B,eAAe,EACf,yBAAyB,EACzB,gCAAgC,EACh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KAAK,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK;YACtF,GAAG,QAAQ;SACZ,CAAC;QAEF,SAAS,GAAG,mBAAmB,CAAC;IAClC,CAAC;IAED,OAAO,CACL,KAAC,SAAS,OAAK,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAM,QAAQ,YAClE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAChB,IAAI,cAAc,CAAC,IAAI,CAAC;gBAAE,OAAO,IAAI,CAAC;YAEtC,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC;gBACnD,aAAa,GAAG,cAAc,CAAC;YACjC,CAAC;iBAAM,CAAC;gBACN,aAAa,GAAG,kBAAkB,CAAC;YACrC,CAAC;YAED,OAAO,CACL,KAAC,aAAa,IAEZ,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,kBACZ,IAAI,CAAC,cAAc,CAAC,KAC9B,IAAI,IAJH,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,OAAO,CAK5B,CACH,CAAC;QACJ,CAAC,CAAC,GACQ,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { useCallback, useContext, useEffect, useRef, useState } from 'react';\nimport type { ElementType, FC, MouseEvent, MouseEventHandler } from 'react';\n\nimport {\n useTheme,\n useArrows,\n useConsolidatedRef,\n useDirection,\n useUID,\n useI18n,\n useEscape\n} from '../../hooks';\nimport { isValidElement } from '../../utils';\nimport ExpandCollapse from '../ExpandCollapse';\nimport BareButton from '../Button/BareButton';\nimport Flex from '../Flex';\nimport Icon, { registerIcon } from '../Icon';\nimport Text from '../Text';\nimport Button from '../Button';\nimport type { OmitStrict } from '../../types';\nimport type { PopoverProps } from '../Popover';\nimport Link from '../Link';\nimport * as timesIcon from '../Icon/icons/times.icon';\nimport * as checkIcon from '../Icon/icons/check.icon';\nimport * as caretLeftIcon from '../Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '../Icon/icons/caret-right.icon';\n\nimport NavigationListItemWrapper from './NavigationListItemWrapper';\nimport type {\n NavListItemProps,\n NavListItemWrapperProps,\n NavListProps,\n NavMenuProps\n} from './AppShell.types';\nimport {\n StyledNavList,\n StyledNestedNavList,\n StyledNavItemIconBox,\n StyledNavListItem,\n StyledNavListItemExpandCollapse,\n StyledCaseClose,\n StyledSingleSelectIconBox,\n StyledNavListItemVisualContainer,\n StyledNavListItemGroupIndicator\n} from './AppShell.styles';\nimport AppShellContext from './AppShellContext';\n\nregisterIcon(timesIcon, checkIcon, caretLeftIcon, caretRightIcon);\n\nconst NavigationMenu: FC<NavMenuProps> = props => {\n const { navOpen } = useContext(AppShellContext);\n const {\n visual,\n primary,\n secondary,\n href,\n onClick,\n items,\n onDismiss,\n actions,\n forwardedRef,\n ...restProps\n } = props;\n\n const uid = useUID();\n\n const { navState } = useContext(AppShellContext);\n const [collapsed, setCollapsed] = useState(true);\n\n const toggleCollapsed = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n setCollapsed(state => !state);\n },\n [setCollapsed]\n );\n\n const itemRef = useConsolidatedRef(forwardedRef);\n\n const menuRef = useRef<HTMLLIElement>(null);\n\n useArrows(menuRef, { selector: '[role=\"menuitem\"]', cycle: true });\n\n useEscape(() => {\n setCollapsed(true);\n itemRef.current?.focus();\n }, menuRef);\n\n const { end } = useDirection();\n\n return (\n <StyledNavListItem {...restProps} key={primary} nestedListCollapsed={collapsed} ref={menuRef}>\n <BareButton\n id={uid}\n ref={itemRef}\n aria-expanded={!collapsed}\n aria-controls={`${uid}-menu`}\n aria-label={primary}\n onClick={toggleCollapsed}\n >\n {visual && <StyledNavItemIconBox>{visual}</StyledNavItemIconBox>}\n\n {secondary ? (\n <Flex container={{ direction: 'column', alignItems: 'start' }}>\n <span>{primary}</span>\n <Text variant='secondary'>{secondary}</Text>\n </Flex>\n ) : (\n <span>{primary}</span>\n )}\n\n {navState === 'open' && <StyledNavListItemExpandCollapse name={`caret-${end}`} />}\n </BareButton>\n\n {/* eslint-disable-next-line @typescript-eslint/no-use-before-define */}\n <NavigationList\n id={`${uid}-menu`}\n nestedList\n items={items}\n collapsed={!navOpen || collapsed}\n />\n </StyledNavListItem>\n );\n};\n\nexport const NavigationListItem: FC<NavListItemProps> = ({\n visual,\n primary,\n secondary,\n collapsedItemInfo,\n href,\n onClick,\n items,\n collapseItems = false,\n onDismiss,\n actions,\n forwardedRef,\n isMenuItem,\n count,\n singleSelect,\n selected,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-current': ariaCurrent,\n ...restProps\n}) => {\n const { navOpen, navState } = useContext(AppShellContext);\n const t = useI18n();\n const listItemRef = useConsolidatedRef(forwardedRef);\n const [menuState, setMenuState] = useState('');\n const {\n components: {\n 'app-shell': {\n nav: { detached }\n }\n }\n } = useTheme();\n\n const hasItems =\n (Array.isArray(items) && items.length > 0) || (Array.isArray(actions) && actions.length > 0);\n const compProps: {\n href?: string;\n onClick?: MouseEventHandler<HTMLAnchorElement | HTMLButtonElement | HTMLDivElement>;\n actions?: NavListItemProps['actions'];\n popover?: OmitStrict<PopoverProps, 'show' | 'target' | 'children'>;\n 'aria-label'?: string;\n } = {\n onClick: (e: MouseEvent<HTMLAnchorElement | HTMLButtonElement | HTMLDivElement>) => {\n e.stopPropagation();\n onClick?.(e);\n },\n href\n };\n\n let caseItems: NavListItemWrapperProps['items'] | undefined;\n if (onDismiss) {\n caseItems = [\n {\n primary: t('go_to_noun', [primary]),\n onClick\n },\n {\n primary: t('dismiss_case'),\n onClick: onDismiss\n }\n ];\n }\n\n let Component: ElementType;\n\n if (href) {\n Component = Link;\n } else {\n Component = BareButton;\n }\n\n const shouldShowMenuAttributes = hasItems || (onDismiss && !navOpen);\n\n useEffect(() => {\n if (!navOpen && actions) {\n const node = document.getElementsByTagName('body')[0];\n const clickEvent = document.createEvent('MouseEvent');\n clickEvent.initEvent('mousedown', true, true);\n node.dispatchEvent(clickEvent);\n }\n if (navOpen && isMenuItem && listItemRef.current?.parentElement?.matches(':first-child'))\n listItemRef.current?.focus();\n }, [navOpen]);\n\n const { end } = useDirection();\n const primaryId = useUID();\n\n return (\n <StyledNavListItem {...restProps} key={primary} singleSelect={singleSelect} nestedListCollapsed>\n <NavigationListItemWrapper\n tooltipLabel={secondary ? `${primary} ${secondary}` : primary}\n label={primary}\n childElementRef={listItemRef}\n items={actions || items || caseItems}\n onMenuToggle={setMenuState}\n >\n <Component\n {...compProps}\n ref={listItemRef}\n {...(navOpen && isMenuItem ? { tabIndex: -1, role: 'menuitem' } : {})}\n aria-labelledby={`${primaryId} ${count ? `${primary}-count` : ''} ${ariaLabelledBy ?? ''}`}\n {...(shouldShowMenuAttributes && {\n 'aria-haspopup': 'menu',\n 'aria-expanded': menuState === 'open'\n })}\n aria-current={ariaCurrent}\n >\n {singleSelect && (\n <Flex\n container={{ justify: 'center', alignItems: 'center' }}\n as={StyledSingleSelectIconBox}\n >\n {selected && <Icon name='check' />}\n </Flex>\n )}\n {visual && (\n <Flex\n container={{ direction: 'column', gap: 0.5 }}\n as={StyledNavListItemVisualContainer}\n isCurrent={ariaCurrent === 'page'}\n navOpen={navOpen}\n >\n <StyledNavItemIconBox>{visual}</StyledNavItemIconBox>\n {!navOpen && collapsedItemInfo && (\n <Text variant='secondary'>{collapsedItemInfo}</Text>\n )}\n {hasItems && navState === 'closed' && (\n <StyledNavListItemGroupIndicator name={`caret-${end}`} />\n )}\n </Flex>\n )}\n\n {secondary ? (\n <Flex\n container={{ direction: 'column', alignItems: 'start' }}\n item={{ shrink: !navOpen && detached ? 1 : 0 }}\n as='span'\n >\n <span id={primaryId}>{primary}</span>\n <Text variant='secondary'>{secondary}</Text>\n </Flex>\n ) : (\n <span id={primaryId}>{primary}</span>\n )}\n\n {(hasItems || actions) && navState === 'open' && (\n <StyledNavListItemExpandCollapse name={`caret-${end}`} />\n )}\n </Component>\n </NavigationListItemWrapper>\n\n {onDismiss && navOpen && (\n <Button\n icon\n variant='simple'\n as={StyledCaseClose}\n onClick={onDismiss}\n aria-label={t('dismiss_case')}\n >\n <Icon name='times' />\n </Button>\n )}\n\n {hasItems && (\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n <NavigationList nestedList items={actions || items} collapsed={!navOpen || collapseItems} />\n )}\n </StyledNavListItem>\n );\n};\n\nconst NavigationList: FC<NavListProps> = ({\n items = [],\n nestedList,\n id,\n collapsed,\n singleSelect\n}) => {\n let Component: ElementType = StyledNavList;\n let ItemComponent: ElementType;\n const { navOpen } = useContext(AppShellContext);\n\n let fwdProps: {\n as?: ElementType;\n forwardedAs?: ElementType;\n nullWhenCollapsed?: boolean;\n transitionSpeed?: string;\n collapsed: boolean;\n } = {\n collapsed: !!collapsed\n };\n\n const {\n base: { animation }\n } = useTheme();\n\n if (nestedList) {\n fwdProps = {\n as: ExpandCollapse,\n forwardedAs: 'ul',\n nullWhenCollapsed: true,\n transitionSpeed: items.length >= 10 ? `calc(2 * ${animation.speed})` : animation.speed,\n ...fwdProps\n };\n\n Component = StyledNestedNavList;\n }\n\n return (\n <Component {...(nestedList ? { role: 'menu', id } : {})} {...fwdProps}>\n {items.map(item => {\n if (isValidElement(item)) return item;\n\n if (item.items && item.items.length > 0 && navOpen) {\n ItemComponent = NavigationMenu;\n } else {\n ItemComponent = NavigationListItem;\n }\n\n return (\n <ItemComponent\n key={item.id || item.primary}\n isMenuItem={nestedList}\n singleSelect={singleSelect}\n aria-current={item['aria-current']}\n {...item}\n />\n );\n })}\n </Component>\n );\n};\n\nexport default NavigationList;\n"]}
|
|
1
|
+
{"version":3,"file":"NavigationList.js","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationList.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EA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C,EAAE,CAAC,KAAM,QAAQ,YAClE,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAChB,IAAI,cAAc,CAAC,IAAI,CAAC;gBAAE,OAAO,IAAI,CAAC;YAEtC,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;gBACpE,aAAa,GAAG,cAAc,CAAC;YACjC,CAAC;iBAAM,CAAC;gBACN,aAAa,GAAG,kBAAkB,CAAC;YACrC,CAAC;YAED,OAAO,CACL,KAAC,aAAa,IAEZ,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,kBACZ,IAAI,CAAC,cAAc,CAAC,EAClC,YAAY,EAAE,YAAY,KACtB,IAAI,IALH,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,OAAO,CAM5B,CACH,CAAC;QACJ,CAAC,CAAC,GACQ,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC","sourcesContent":["import { useCallback, useContext, useEffect, useRef, useState } from 'react';\nimport type { ElementType, FC, MouseEvent, MouseEventHandler } from 'react';\n\nimport {\n useTheme,\n useArrows,\n useConsolidatedRef,\n useDirection,\n useUID,\n useI18n,\n useEscape\n} from '../../hooks';\nimport { isValidElement } from '../../utils';\nimport ExpandCollapse from '../ExpandCollapse';\nimport BareButton from '../Button/BareButton';\nimport Flex from '../Flex';\nimport Icon, { registerIcon } from '../Icon';\nimport Text from '../Text';\nimport Button from '../Button';\nimport type { OmitStrict } from '../../types';\nimport type { PopoverProps } from '../Popover';\nimport Link from '../Link';\nimport * as timesIcon from '../Icon/icons/times.icon';\nimport * as checkIcon from '../Icon/icons/check.icon';\nimport * as caretLeftIcon from '../Icon/icons/caret-left.icon';\nimport * as caretRightIcon from '../Icon/icons/caret-right.icon';\n\nimport NavigationListItemWrapper from './NavigationListItemWrapper';\nimport type {\n NavListItemProps,\n NavListItemWrapperProps,\n NavListProps,\n NavMenuProps\n} from './AppShell.types';\nimport {\n StyledNavList,\n StyledNestedNavList,\n StyledNavItemIconBox,\n StyledNavListItem,\n StyledNavListItemExpandCollapse,\n StyledCaseClose,\n StyledSingleSelectIconBox,\n StyledNavListItemVisualContainer,\n StyledNavListItemGroupIndicator\n} from './AppShell.styles';\nimport AppShellContext from './AppShellContext';\n\nregisterIcon(timesIcon, checkIcon, caretLeftIcon, caretRightIcon);\n\nconst NavigationMenu: FC<NavMenuProps> = props => {\n const { navOpen } = useContext(AppShellContext);\n const {\n visual,\n primary,\n secondary,\n href,\n onClick,\n items,\n onDismiss,\n actions,\n forwardedRef,\n ...restProps\n } = props;\n\n const uid = useUID();\n\n const { navState } = useContext(AppShellContext);\n const [collapsed, setCollapsed] = useState(true);\n\n const toggleCollapsed = useCallback(\n (e: MouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n setCollapsed(state => !state);\n },\n [setCollapsed]\n );\n\n const itemRef = useConsolidatedRef(forwardedRef);\n\n const menuRef = useRef<HTMLLIElement>(null);\n\n useArrows(menuRef, { selector: '[role=\"menuitem\"]', cycle: true });\n\n useEscape(() => {\n setCollapsed(true);\n itemRef.current?.focus();\n }, menuRef);\n\n const { end } = useDirection();\n\n return (\n <StyledNavListItem {...restProps} key={primary} nestedListCollapsed={collapsed} ref={menuRef}>\n <BareButton\n id={uid}\n ref={itemRef}\n aria-expanded={!collapsed}\n aria-controls={`${uid}-menu`}\n aria-label={primary}\n onClick={toggleCollapsed}\n >\n {visual && <StyledNavItemIconBox>{visual}</StyledNavItemIconBox>}\n\n {secondary ? (\n <Flex container={{ direction: 'column', alignItems: 'start' }}>\n <span>{primary}</span>\n <Text variant='secondary'>{secondary}</Text>\n </Flex>\n ) : (\n <span>{primary}</span>\n )}\n\n {navState === 'open' && <StyledNavListItemExpandCollapse name={`caret-${end}`} />}\n </BareButton>\n\n {/* eslint-disable-next-line @typescript-eslint/no-use-before-define */}\n <NavigationList\n id={`${uid}-menu`}\n nestedList\n items={items}\n collapsed={!navOpen || collapsed}\n />\n </StyledNavListItem>\n );\n};\n\nexport const NavigationListItem: FC<NavListItemProps> = ({\n visual,\n primary,\n secondary,\n collapsedItemInfo,\n href,\n onClick,\n items,\n collapseItems = false,\n onDismiss,\n actions,\n forwardedRef,\n isMenuItem,\n mobileNavBar,\n count,\n singleSelect,\n selected,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-current': ariaCurrent,\n ...restProps\n}) => {\n const { navOpen: navOpenValue, navState } = useContext(AppShellContext);\n const navOpen = mobileNavBar ? false : navOpenValue;\n const t = useI18n();\n const listItemRef = useConsolidatedRef(forwardedRef);\n const [menuState, setMenuState] = useState('');\n const {\n components: {\n 'app-shell': {\n nav: { detached }\n }\n }\n } = useTheme();\n\n const hasItems =\n (Array.isArray(items) && items.length > 0) || (Array.isArray(actions) && actions.length > 0);\n const compProps: {\n href?: string;\n onClick?: MouseEventHandler<HTMLAnchorElement | HTMLButtonElement | HTMLDivElement>;\n actions?: NavListItemProps['actions'];\n popover?: OmitStrict<PopoverProps, 'show' | 'target' | 'children'>;\n 'aria-label'?: string;\n } = {\n onClick: (e: MouseEvent<HTMLAnchorElement | HTMLButtonElement | HTMLDivElement>) => {\n e.stopPropagation();\n onClick?.(e);\n },\n href\n };\n\n let caseItems: NavListItemWrapperProps['items'] | undefined;\n if (onDismiss) {\n caseItems = [\n {\n primary: t('go_to_noun', [primary]),\n onClick\n },\n {\n primary: t('dismiss_case'),\n onClick: onDismiss\n }\n ];\n }\n\n let Component: ElementType;\n\n if (href) {\n Component = Link;\n } else {\n Component = BareButton;\n }\n\n const shouldShowMenuAttributes = hasItems || (onDismiss && !navOpen);\n\n useEffect(() => {\n if (!navOpen && actions) {\n const node = document.getElementsByTagName('body')[0];\n const clickEvent = document.createEvent('MouseEvent');\n clickEvent.initEvent('mousedown', true, true);\n node.dispatchEvent(clickEvent);\n }\n if (navOpen && isMenuItem && listItemRef.current?.parentElement?.matches(':first-child'))\n listItemRef.current?.focus();\n }, [navOpen]);\n\n const { end } = useDirection();\n const primaryId = useUID();\n\n return (\n <StyledNavListItem {...restProps} key={primary} singleSelect={singleSelect} nestedListCollapsed>\n <NavigationListItemWrapper\n tooltipLabel={secondary ? `${primary} ${secondary}` : primary}\n label={primary}\n childElementRef={listItemRef}\n items={actions || items || caseItems}\n onMenuToggle={setMenuState}\n mobileNavBar={mobileNavBar}\n >\n <Component\n {...compProps}\n ref={listItemRef}\n {...(navOpen && isMenuItem ? { tabIndex: -1, role: 'menuitem' } : {})}\n aria-labelledby={`${primaryId} ${count ? `${primary}-count` : ''} ${ariaLabelledBy ?? ''}`}\n {...(shouldShowMenuAttributes && {\n 'aria-haspopup': 'menu',\n 'aria-expanded': menuState === 'open'\n })}\n aria-current={ariaCurrent}\n >\n {singleSelect && (\n <Flex\n container={{ justify: 'center', alignItems: 'center' }}\n as={StyledSingleSelectIconBox}\n >\n {selected && <Icon name='check' />}\n </Flex>\n )}\n {visual && (\n <Flex\n container={{ direction: 'column', gap: 0.5 }}\n as={StyledNavListItemVisualContainer}\n isCurrent={ariaCurrent === 'page'}\n navOpen={navOpen}\n >\n <StyledNavItemIconBox>{visual}</StyledNavItemIconBox>\n {!navOpen && collapsedItemInfo && (\n <Text variant='secondary'>{collapsedItemInfo}</Text>\n )}\n {hasItems && navState === 'closed' && (\n <StyledNavListItemGroupIndicator name={`caret-${end}`} />\n )}\n </Flex>\n )}\n\n {secondary ? (\n <Flex\n container={{ direction: 'column', alignItems: 'start' }}\n item={{ shrink: !navOpen && detached ? 1 : 0 }}\n as='span'\n >\n <span id={primaryId}>{primary}</span>\n <Text variant='secondary'>{secondary}</Text>\n </Flex>\n ) : (\n <span id={primaryId}>{primary}</span>\n )}\n\n {(hasItems || actions) && navState === 'open' && !mobileNavBar && (\n <StyledNavListItemExpandCollapse name={`caret-${end}`} />\n )}\n </Component>\n </NavigationListItemWrapper>\n\n {onDismiss && navOpen && (\n <Button\n icon\n variant='simple'\n as={StyledCaseClose}\n onClick={onDismiss}\n aria-label={t('dismiss_case')}\n >\n <Icon name='times' />\n </Button>\n )}\n\n {hasItems && (\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n <NavigationList nestedList items={actions || items} collapsed={!navOpen || collapseItems} />\n )}\n </StyledNavListItem>\n );\n};\n\nconst NavigationList: FC<NavListProps> = ({\n items = [],\n nestedList,\n id,\n collapsed,\n singleSelect,\n mobileNavBar\n}) => {\n let Component: ElementType = StyledNavList;\n let ItemComponent: ElementType;\n const { navOpen } = useContext(AppShellContext);\n\n let fwdProps: {\n as?: ElementType;\n forwardedAs?: ElementType;\n nullWhenCollapsed?: boolean;\n transitionSpeed?: string;\n collapsed: boolean;\n } = {\n collapsed: !!collapsed\n };\n\n const {\n base: { animation }\n } = useTheme();\n\n if (nestedList) {\n fwdProps = {\n as: ExpandCollapse,\n forwardedAs: 'ul',\n nullWhenCollapsed: true,\n transitionSpeed: items.length >= 10 ? `calc(2 * ${animation.speed})` : animation.speed,\n ...fwdProps\n };\n\n Component = StyledNestedNavList;\n }\n\n return (\n <Component {...(nestedList ? { role: 'menu', id } : {})} {...fwdProps}>\n {items.map(item => {\n if (isValidElement(item)) return item;\n\n if (item.items && item.items.length > 0 && navOpen && !mobileNavBar) {\n ItemComponent = NavigationMenu;\n } else {\n ItemComponent = NavigationListItem;\n }\n\n return (\n <ItemComponent\n key={item.id || item.primary}\n isMenuItem={nestedList}\n singleSelect={singleSelect}\n aria-current={item['aria-current']}\n mobileNavBar={mobileNavBar}\n {...item}\n />\n );\n })}\n </Component>\n );\n};\n\nexport default NavigationList;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationListItemWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationListItemWrapper.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NavigationListItemWrapper.d.ts","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationListItemWrapper.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAe,EAAE,EAAiC,MAAM,OAAO,CAAC;AAa5E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAwDhE,QAAA,MAAM,eAAe,EAAE,EAAE,CAAC,uBAAuB,CAqPhD,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { remToPx, stripUnit } from 'polished';
|
|
2
3
|
import { useContext, useEffect, useRef, useState } from 'react';
|
|
3
4
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import {
|
|
5
|
+
import { tryCatch, createStringMatcher, isInstance } from '../../utils';
|
|
6
|
+
import { useDirection, useEscape, useOuterEvent, useTheme, useUID } from '../../hooks';
|
|
5
7
|
import Text from '../Text';
|
|
6
8
|
import Tooltip from '../Tooltip';
|
|
7
9
|
import Popover from '../Popover';
|
|
@@ -9,54 +11,57 @@ import Menu from '../Menu';
|
|
|
9
11
|
import { StyledMenu, StyledMenuListContainer, StyledMenuListWrapper } from '../Menu/Menu.styles';
|
|
10
12
|
import { defaultThemeProp } from '../../theme';
|
|
11
13
|
import { calculateFontSize } from '../../styles';
|
|
12
|
-
import { createStringMatcher, isInstance } from '../../utils';
|
|
13
14
|
import AppShellContext from './AppShellContext';
|
|
14
15
|
import { navContrastColors } from './style-utils';
|
|
15
|
-
const StyledNavigationPopover = styled.div(({ theme }) => {
|
|
16
|
+
const StyledNavigationPopover = styled.div(({ theme, mobileNavBar }) => {
|
|
16
17
|
const { hoverBg, foreground, backgroundColor } = navContrastColors(theme);
|
|
17
18
|
const headingFontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']).s;
|
|
18
19
|
return css `
|
|
19
|
-
display: flex;
|
|
20
|
-
background: ${backgroundColor};
|
|
21
|
-
|
|
22
|
-
${StyledMenu} {
|
|
23
20
|
display: flex;
|
|
24
|
-
|
|
25
|
-
}
|
|
21
|
+
background: ${backgroundColor};
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
${StyledMenu} {
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
${mobileNavBar &&
|
|
27
|
+
css `
|
|
28
|
+
width: calc(100vw - (2 * ${theme.base.spacing}));
|
|
29
|
+
`}
|
|
30
|
+
}
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
${StyledMenuListWrapper} {
|
|
33
|
+
overflow: auto;
|
|
34
|
+
}
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
&,
|
|
37
|
+
${StyledMenuListContainer} {
|
|
38
|
+
background: ${backgroundColor};
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
header {
|
|
41
|
+
color: ${foreground};
|
|
42
|
+
border-bottom: none;
|
|
43
|
+
|
|
44
|
+
h2 {
|
|
45
|
+
font-weight: ${theme.base['font-weight']['semi-bold']};
|
|
46
|
+
font-size: ${headingFontSize};
|
|
47
|
+
}
|
|
42
48
|
}
|
|
43
49
|
}
|
|
44
|
-
}
|
|
45
50
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
51
|
+
${StyledMenuListContainer} li {
|
|
52
|
+
color: ${foreground};
|
|
53
|
+
background-color: transparent;
|
|
49
54
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
55
|
+
&:hover,
|
|
56
|
+
&[data-current='true'] {
|
|
57
|
+
background-color: ${hoverBg};
|
|
58
|
+
}
|
|
53
59
|
}
|
|
54
|
-
|
|
55
|
-
`;
|
|
60
|
+
`;
|
|
56
61
|
});
|
|
57
62
|
StyledNavigationPopover.defaultProps = defaultThemeProp;
|
|
58
63
|
const ListItemWrapper = props => {
|
|
59
|
-
const { children, childElementRef, label, tooltipLabel, items = [], filterAt = 5, content, onMenuToggle } = props;
|
|
64
|
+
const { children, childElementRef, label, tooltipLabel, items = [], filterAt = 5, content, onMenuToggle, mobileNavBar } = props;
|
|
60
65
|
const { navOpen, collapsedHoverMenus, headerEl } = useContext(AppShellContext);
|
|
61
66
|
const popoverRef = useRef(null);
|
|
62
67
|
const filterElRef = useRef(null);
|
|
@@ -67,6 +72,7 @@ const ListItemWrapper = props => {
|
|
|
67
72
|
const { end } = useDirection();
|
|
68
73
|
const mousedOverMenu = useRef(false);
|
|
69
74
|
const hidePopoverTimeout = useRef();
|
|
75
|
+
const theme = useTheme();
|
|
70
76
|
const closePopover = (focusChildEl = true) => {
|
|
71
77
|
if (popoverOpen) {
|
|
72
78
|
setFilterValue('');
|
|
@@ -176,23 +182,38 @@ const ListItemWrapper = props => {
|
|
|
176
182
|
onBlur: () => closePopover(false)
|
|
177
183
|
}
|
|
178
184
|
: undefined;
|
|
179
|
-
return (_jsxs(_Fragment, { children: [children, !navOpen && (_jsxs(_Fragment, { children: [!popoverOpen && (_jsx(Tooltip, { target: childElementRef.current, placement: end, showDelay: 'none', hideDelay: 'none', children: tooltipLabel })), popoverOpen && (items.length || content) && (_jsx(Popover, { target: childElementRef.current, placement: `${end}-start`, ref: popoverRef, as: StyledNavigationPopover, arrow: true, modifiers:
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
185
|
+
return (_jsxs(_Fragment, { children: [children, !navOpen && (_jsxs(_Fragment, { children: [!popoverOpen && (_jsx(Tooltip, { target: childElementRef.current, placement: mobileNavBar ? 'top' : end, showDelay: 'none', hideDelay: 'none', children: tooltipLabel })), popoverOpen && (items.length || content) && (_jsx(Popover, { target: childElementRef.current, placement: `${mobileNavBar ? 'top' : end}-start`, ref: popoverRef, as: StyledNavigationPopover, arrow: true, modifiers: [
|
|
186
|
+
...(headerEl
|
|
187
|
+
? [
|
|
188
|
+
{
|
|
189
|
+
name: 'preventOverflow',
|
|
190
|
+
options: {
|
|
191
|
+
padding: {
|
|
192
|
+
top: headerEl.offsetHeight + 8,
|
|
193
|
+
right: 8,
|
|
194
|
+
bottom: 8,
|
|
195
|
+
left: 8
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
]
|
|
200
|
+
: []),
|
|
201
|
+
...(mobileNavBar
|
|
202
|
+
? [
|
|
203
|
+
{
|
|
204
|
+
name: 'offset',
|
|
205
|
+
options: {
|
|
206
|
+
offset: [
|
|
207
|
+
0,
|
|
208
|
+
tryCatch(() => 5.5 + Number(stripUnit(remToPx(theme.base.spacing))), () => 5.5 + 8)
|
|
209
|
+
]
|
|
189
210
|
}
|
|
190
211
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
212
|
+
]
|
|
213
|
+
: [])
|
|
214
|
+
], onClick: (e) => {
|
|
194
215
|
e.stopPropagation();
|
|
195
|
-
}, children: content ? (_jsx("div", { onMouseEnter: onMouseEnterContent, onMouseLeave: onMouseLeaveContent, children: content })) : (_jsx(Menu, { mode: 'action', variant: 'flyout', focusControlEl: childElementRef.current ?? undefined, scrollAt: 99, listId: searchListId, filterInputProps: filterInputProps, items: itemsToRender.map(item => {
|
|
216
|
+
}, mobileNavBar: mobileNavBar, children: content ? (_jsx("div", { onMouseEnter: onMouseEnterContent, onMouseLeave: onMouseLeaveContent, children: content })) : (_jsx(Menu, { mode: 'action', variant: 'flyout', focusControlEl: childElementRef.current ?? undefined, scrollAt: 99, listId: searchListId, filterInputProps: filterInputProps, items: itemsToRender.map(item => {
|
|
196
217
|
return {
|
|
197
218
|
id: (item.primary || item.text),
|
|
198
219
|
primary: (item.primary || item.text),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationListItemWrapper.js","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationListItemWrapper.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM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CACF;6BACF;4BACH,CAAC,CAAC,SAAS,EAEf,OAAO,EAAE,CAAC,CAAkC,EAAE,EAAE;4BAC9C,CAAC,CAAC,eAAe,EAAE,CAAC;wBACtB,CAAC,YAEA,OAAO,CAAC,CAAC,CAAC,CACT,cAAK,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,mBAAmB,YACtE,OAAO,GACJ,CACP,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IACH,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,QAAQ,EAChB,cAAc,EAAE,eAAe,CAAC,OAAO,IAAI,SAAS,EACpD,QAAQ,EAAE,EAAE,EACZ,MAAM,EAAE,YAAY,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,KAAK,EAAE,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;gCAC9B,OAAO;oCACL,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAW;oCACzC,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAW;oCAC9C,IAAI,EAAE,IAAI,CAAC,IAAI;oCACf,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;wCAChB,CAAC,CAAC,eAAe,EAAE,CAAC;wCACpB,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;wCAClB,cAAc,CAAC,KAAK,CAAC,CAAC;oCACxB,CAAC;iCACF,CAAC;4BACJ,CAAC,CAAC,EACF,MAAM,EAAE,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,KAAK,GAAQ,EACzC,YAAY,EAAE,mBAAmB,EACjC,YAAY,EAAE,mBAAmB,GACjC,CACH,GACO,CACX,IACA,CACJ,IACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { useContext, useEffect, useRef, useState } from 'react';\nimport type { ChangeEvent, FC, MouseEvent as ReactMouseEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { useDirection, useEscape, useOuterEvent, useUID } from '../../hooks';\nimport Text from '../Text';\nimport Tooltip from '../Tooltip';\nimport Popover from '../Popover';\nimport Menu from '../Menu';\nimport { StyledMenu, StyledMenuListContainer, StyledMenuListWrapper } from '../Menu/Menu.styles';\nimport { defaultThemeProp } from '../../theme';\nimport { calculateFontSize } from '../../styles';\nimport { createStringMatcher, isInstance } from '../../utils';\n\nimport type { NavListItemWrapperProps } from './AppShell.types';\nimport AppShellContext from './AppShellContext';\nimport { navContrastColors } from './style-utils';\n\nconst StyledNavigationPopover = styled.div(({ theme }) => {\n const { hoverBg, foreground, backgroundColor } = navContrastColors(theme);\n\n const headingFontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']).s;\n return css`\n display: flex;\n background: ${backgroundColor};\n\n ${StyledMenu} {\n display: flex;\n flex-direction: column;\n }\n\n ${StyledMenuListWrapper} {\n overflow: auto;\n }\n\n &,\n ${StyledMenuListContainer} {\n background: ${backgroundColor};\n\n header {\n color: ${foreground};\n border-bottom: none;\n\n h2 {\n font-weight: ${theme.base['font-weight']['semi-bold']};\n font-size: ${headingFontSize};\n }\n }\n }\n\n ${StyledMenuListContainer} li {\n color: ${foreground};\n background-color: transparent;\n\n &:hover,\n &[data-current='true'] {\n background-color: ${hoverBg};\n }\n }\n `;\n});\n\nStyledNavigationPopover.defaultProps = defaultThemeProp;\n\nconst ListItemWrapper: FC<NavListItemWrapperProps> = props => {\n const {\n children,\n childElementRef,\n label,\n tooltipLabel,\n items = [],\n filterAt = 5,\n content,\n onMenuToggle\n } = props;\n const { navOpen, collapsedHoverMenus, headerEl } = useContext(AppShellContext);\n const popoverRef = useRef<HTMLDivElement>(null);\n const filterElRef = useRef<HTMLInputElement>(null);\n const renderFilter = items.length >= filterAt;\n\n const [popoverOpen, setPopoverOpen] = useState(false);\n const [filterValue, setFilterValue] = useState('');\n const filterRegex = createStringMatcher(filterValue, 'contains');\n\n const { end } = useDirection();\n const mousedOverMenu = useRef(false);\n const hidePopoverTimeout = useRef<number | null>();\n\n const closePopover = (focusChildEl: boolean = true) => {\n if (popoverOpen) {\n setFilterValue('');\n setPopoverOpen(false);\n if (focusChildEl) {\n childElementRef.current?.focus();\n }\n if (hidePopoverTimeout.current) {\n clearTimeout(hidePopoverTimeout.current);\n hidePopoverTimeout.current = null;\n }\n }\n };\n\n const onMouseEnterContent = () => {\n if (collapsedHoverMenus) {\n mousedOverMenu.current = true;\n }\n };\n\n const onMouseLeaveContent = () => {\n if (mousedOverMenu.current && collapsedHoverMenus) {\n mousedOverMenu.current = false;\n closePopover();\n }\n };\n\n useOuterEvent('click', [popoverRef], () => closePopover());\n\n useEffect(() => {\n const onClick = (e: Event) => {\n if (items.length || content) {\n if (!navOpen) {\n e.stopPropagation();\n e.preventDefault();\n }\n if (!navOpen && !popoverOpen) setPopoverOpen(true);\n else {\n setTimeout(() => {\n closePopover(false);\n }, 0);\n }\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Tab' && !content) {\n setPopoverOpen(false);\n }\n };\n\n const onMouseOut = (e: MouseEvent) => {\n if (hidePopoverTimeout.current) {\n clearTimeout(hidePopoverTimeout.current);\n hidePopoverTimeout.current = null;\n }\n\n const tag = (e.relatedTarget as HTMLElement | null)?.tagName.toLowerCase();\n\n // If the mouse is mousing out from this nav item onto another nav item\n if (tag && ['a', 'button', 'form'].includes(tag)) {\n closePopover(false);\n } else {\n hidePopoverTimeout.current = window.setTimeout(() => {\n if (!mousedOverMenu.current) {\n closePopover(false);\n }\n }, 1000);\n }\n };\n\n const onBlur = (e: FocusEvent) => {\n if (isInstance(e.relatedTarget, Node) && popoverRef.current?.contains(e.relatedTarget)) {\n return;\n }\n closePopover(false);\n };\n\n childElementRef.current?.addEventListener('click', onClick);\n childElementRef.current?.addEventListener('blur', e => onBlur(e));\n childElementRef.current?.addEventListener('keydown', onKeyDown);\n if (collapsedHoverMenus) {\n childElementRef.current?.addEventListener('mouseenter', onClick);\n childElementRef.current?.addEventListener('mouseleave', onMouseOut);\n }\n return () => {\n childElementRef.current?.removeEventListener('click', onClick);\n childElementRef.current?.removeEventListener('keydown', onKeyDown);\n if (collapsedHoverMenus) {\n childElementRef.current?.removeEventListener('mouseenter', onClick);\n childElementRef.current?.removeEventListener('mouseleave', onMouseOut);\n }\n if (hidePopoverTimeout.current) {\n clearTimeout(hidePopoverTimeout.current);\n hidePopoverTimeout.current = null;\n }\n };\n }, [items, content, navOpen, closePopover, collapsedHoverMenus]);\n\n useEffect(() => {\n onMenuToggle?.(popoverOpen ? 'open' : 'close');\n }, [popoverOpen]);\n\n useEscape(() => closePopover(), childElementRef, [childElementRef]);\n\n useEscape(() => closePopover(), popoverRef, [popoverRef]);\n\n const searchListId = useUID();\n\n const itemsToRender = renderFilter\n ? items.filter(item => {\n return filterRegex.test(item.primary);\n })\n : items;\n\n const filterInputProps = renderFilter\n ? {\n value: filterValue,\n ref: filterElRef,\n onChange: (e: ChangeEvent<HTMLInputElement>) => setFilterValue(e.target.value),\n onBlur: () => closePopover(false)\n }\n : undefined;\n\n return (\n <>\n {children}\n {!navOpen && (\n <>\n {!popoverOpen && (\n <Tooltip\n target={childElementRef.current}\n placement={end}\n showDelay='none'\n hideDelay='none'\n >\n {tooltipLabel}\n </Tooltip>\n )}\n {popoverOpen && (items.length || content) && (\n <Popover\n target={childElementRef.current}\n placement={`${end}-start`}\n ref={popoverRef}\n as={StyledNavigationPopover}\n arrow\n modifiers={\n headerEl\n ? [\n {\n name: 'preventOverflow',\n options: {\n padding: {\n top: headerEl.offsetHeight + 8,\n right: 8,\n bottom: 8,\n left: 8\n }\n }\n }\n ]\n : undefined\n }\n onClick={(e: ReactMouseEvent<HTMLDivElement>) => {\n e.stopPropagation();\n }}\n >\n {content ? (\n <div onMouseEnter={onMouseEnterContent} onMouseLeave={onMouseLeaveContent}>\n {content}\n </div>\n ) : (\n <Menu\n mode='action'\n variant='flyout'\n focusControlEl={childElementRef.current ?? undefined}\n scrollAt={99}\n listId={searchListId}\n filterInputProps={filterInputProps}\n items={itemsToRender.map(item => {\n return {\n id: (item.primary || item.text) as string,\n primary: (item.primary || item.text) as string,\n href: item.href,\n onClick: (_, e) => {\n e.stopPropagation();\n item.onClick?.(e);\n setPopoverOpen(false);\n }\n };\n })}\n header={<Text variant='h2'>{label}</Text>}\n onMouseEnter={onMouseEnterContent}\n onMouseLeave={onMouseLeaveContent}\n />\n )}\n </Popover>\n )}\n </>\n )}\n </>\n );\n};\n\nexport default ListItemWrapper;\n"]}
|
|
1
|
+
{"version":3,"file":"NavigationListItemWrapper.js","sourceRoot":"","sources":["../../../src/components/AppShell/NavigationListItemWrapper.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEhE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAGjD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,M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AC;yBACR,EACD,OAAO,EAAE,CAAC,CAAkC,EAAE,EAAE;4BAC9C,CAAC,CAAC,eAAe,EAAE,CAAC;wBACtB,CAAC,EACD,YAAY,EAAE,YAAY,YAEzB,OAAO,CAAC,CAAC,CAAC,CACT,cAAK,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,mBAAmB,YACtE,OAAO,GACJ,CACP,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IACH,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,QAAQ,EAChB,cAAc,EAAE,eAAe,CAAC,OAAO,IAAI,SAAS,EACpD,QAAQ,EAAE,EAAE,EACZ,MAAM,EAAE,YAAY,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,KAAK,EAAE,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;gCAC9B,OAAO;oCACL,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAW;oCACzC,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAW;oCAC9C,IAAI,EAAE,IAAI,CAAC,IAAI;oCACf,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;wCAChB,CAAC,CAAC,eAAe,EAAE,CAAC;wCACpB,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;wCAClB,cAAc,CAAC,KAAK,CAAC,CAAC;oCACxB,CAAC;iCACF,CAAC;4BACJ,CAAC,CAAC,EACF,MAAM,EAAE,KAAC,IAAI,IAAC,OAAO,EAAC,IAAI,YAAE,KAAK,GAAQ,EACzC,YAAY,EAAE,mBAAmB,EACjC,YAAY,EAAE,mBAAmB,GACjC,CACH,GACO,CACX,IACA,CACJ,IACA,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC","sourcesContent":["import { remToPx, stripUnit } from 'polished';\nimport { useContext, useEffect, useRef, useState } from 'react';\nimport type { ChangeEvent, FC, MouseEvent as ReactMouseEvent } from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { tryCatch, createStringMatcher, isInstance } from '../../utils';\nimport { useDirection, useEscape, useOuterEvent, useTheme, useUID } from '../../hooks';\nimport Text from '../Text';\nimport Tooltip from '../Tooltip';\nimport Popover from '../Popover';\nimport Menu from '../Menu';\nimport { StyledMenu, StyledMenuListContainer, StyledMenuListWrapper } from '../Menu/Menu.styles';\nimport { defaultThemeProp } from '../../theme';\nimport { calculateFontSize } from '../../styles';\n\nimport type { NavListItemWrapperProps } from './AppShell.types';\nimport AppShellContext from './AppShellContext';\nimport { navContrastColors } from './style-utils';\n\nconst StyledNavigationPopover = styled.div<{ mobileNavBar?: boolean }>(\n ({ theme, mobileNavBar }) => {\n const { hoverBg, foreground, backgroundColor } = navContrastColors(theme);\n\n const headingFontSize = calculateFontSize(theme.base['font-size'], theme.base['font-scale']).s;\n return css`\n display: flex;\n background: ${backgroundColor};\n\n ${StyledMenu} {\n display: flex;\n flex-direction: column;\n ${mobileNavBar &&\n css`\n width: calc(100vw - (2 * ${theme.base.spacing}));\n `}\n }\n\n ${StyledMenuListWrapper} {\n overflow: auto;\n }\n\n &,\n ${StyledMenuListContainer} {\n background: ${backgroundColor};\n\n header {\n color: ${foreground};\n border-bottom: none;\n\n h2 {\n font-weight: ${theme.base['font-weight']['semi-bold']};\n font-size: ${headingFontSize};\n }\n }\n }\n\n ${StyledMenuListContainer} li {\n color: ${foreground};\n background-color: transparent;\n\n &:hover,\n &[data-current='true'] {\n background-color: ${hoverBg};\n }\n }\n `;\n }\n);\n\nStyledNavigationPopover.defaultProps = defaultThemeProp;\n\nconst ListItemWrapper: FC<NavListItemWrapperProps> = props => {\n const {\n children,\n childElementRef,\n label,\n tooltipLabel,\n items = [],\n filterAt = 5,\n content,\n onMenuToggle,\n mobileNavBar\n } = props;\n const { navOpen, collapsedHoverMenus, headerEl } = useContext(AppShellContext);\n const popoverRef = useRef<HTMLDivElement>(null);\n const filterElRef = useRef<HTMLInputElement>(null);\n const renderFilter = items.length >= filterAt;\n\n const [popoverOpen, setPopoverOpen] = useState(false);\n const [filterValue, setFilterValue] = useState('');\n const filterRegex = createStringMatcher(filterValue, 'contains');\n\n const { end } = useDirection();\n const mousedOverMenu = useRef(false);\n const hidePopoverTimeout = useRef<number | null>();\n const theme = useTheme();\n\n const closePopover = (focusChildEl: boolean = true) => {\n if (popoverOpen) {\n setFilterValue('');\n setPopoverOpen(false);\n if (focusChildEl) {\n childElementRef.current?.focus();\n }\n if (hidePopoverTimeout.current) {\n clearTimeout(hidePopoverTimeout.current);\n hidePopoverTimeout.current = null;\n }\n }\n };\n\n const onMouseEnterContent = () => {\n if (collapsedHoverMenus) {\n mousedOverMenu.current = true;\n }\n };\n\n const onMouseLeaveContent = () => {\n if (mousedOverMenu.current && collapsedHoverMenus) {\n mousedOverMenu.current = false;\n closePopover();\n }\n };\n\n useOuterEvent('click', [popoverRef], () => closePopover());\n\n useEffect(() => {\n const onClick = (e: Event) => {\n if (items.length || content) {\n if (!navOpen) {\n e.stopPropagation();\n e.preventDefault();\n }\n if (!navOpen && !popoverOpen) setPopoverOpen(true);\n else {\n setTimeout(() => {\n closePopover(false);\n }, 0);\n }\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === 'Tab' && !content) {\n setPopoverOpen(false);\n }\n };\n\n const onMouseOut = (e: MouseEvent) => {\n if (hidePopoverTimeout.current) {\n clearTimeout(hidePopoverTimeout.current);\n hidePopoverTimeout.current = null;\n }\n\n const tag = (e.relatedTarget as HTMLElement | null)?.tagName.toLowerCase();\n\n // If the mouse is mousing out from this nav item onto another nav item\n if (tag && ['a', 'button', 'form'].includes(tag)) {\n closePopover(false);\n } else {\n hidePopoverTimeout.current = window.setTimeout(() => {\n if (!mousedOverMenu.current) {\n closePopover(false);\n }\n }, 1000);\n }\n };\n\n const onBlur = (e: FocusEvent) => {\n if (isInstance(e.relatedTarget, Node) && popoverRef.current?.contains(e.relatedTarget)) {\n return;\n }\n closePopover(false);\n };\n\n childElementRef.current?.addEventListener('click', onClick);\n childElementRef.current?.addEventListener('blur', e => onBlur(e));\n childElementRef.current?.addEventListener('keydown', onKeyDown);\n if (collapsedHoverMenus) {\n childElementRef.current?.addEventListener('mouseenter', onClick);\n childElementRef.current?.addEventListener('mouseleave', onMouseOut);\n }\n return () => {\n childElementRef.current?.removeEventListener('click', onClick);\n childElementRef.current?.removeEventListener('keydown', onKeyDown);\n if (collapsedHoverMenus) {\n childElementRef.current?.removeEventListener('mouseenter', onClick);\n childElementRef.current?.removeEventListener('mouseleave', onMouseOut);\n }\n if (hidePopoverTimeout.current) {\n clearTimeout(hidePopoverTimeout.current);\n hidePopoverTimeout.current = null;\n }\n };\n }, [items, content, navOpen, closePopover, collapsedHoverMenus]);\n\n useEffect(() => {\n onMenuToggle?.(popoverOpen ? 'open' : 'close');\n }, [popoverOpen]);\n\n useEscape(() => closePopover(), childElementRef, [childElementRef]);\n\n useEscape(() => closePopover(), popoverRef, [popoverRef]);\n\n const searchListId = useUID();\n\n const itemsToRender = renderFilter\n ? items.filter(item => {\n return filterRegex.test(item.primary);\n })\n : items;\n\n const filterInputProps = renderFilter\n ? {\n value: filterValue,\n ref: filterElRef,\n onChange: (e: ChangeEvent<HTMLInputElement>) => setFilterValue(e.target.value),\n onBlur: () => closePopover(false)\n }\n : undefined;\n\n return (\n <>\n {children}\n {!navOpen && (\n <>\n {!popoverOpen && (\n <Tooltip\n target={childElementRef.current}\n placement={mobileNavBar ? 'top' : end}\n showDelay='none'\n hideDelay='none'\n >\n {tooltipLabel}\n </Tooltip>\n )}\n {popoverOpen && (items.length || content) && (\n <Popover\n target={childElementRef.current}\n placement={`${mobileNavBar ? 'top' : end}-start`}\n ref={popoverRef}\n as={StyledNavigationPopover}\n arrow\n modifiers={[\n ...(headerEl\n ? [\n {\n name: 'preventOverflow',\n options: {\n padding: {\n top: headerEl.offsetHeight + 8,\n right: 8,\n bottom: 8,\n left: 8\n }\n }\n }\n ]\n : []),\n ...(mobileNavBar\n ? [\n {\n name: 'offset',\n options: {\n offset: [\n 0,\n tryCatch(\n () => 5.5 + Number(stripUnit(remToPx(theme.base.spacing))),\n () => 5.5 + 8\n )\n ]\n }\n }\n ]\n : [])\n ]}\n onClick={(e: ReactMouseEvent<HTMLDivElement>) => {\n e.stopPropagation();\n }}\n mobileNavBar={mobileNavBar}\n >\n {content ? (\n <div onMouseEnter={onMouseEnterContent} onMouseLeave={onMouseLeaveContent}>\n {content}\n </div>\n ) : (\n <Menu\n mode='action'\n variant='flyout'\n focusControlEl={childElementRef.current ?? undefined}\n scrollAt={99}\n listId={searchListId}\n filterInputProps={filterInputProps}\n items={itemsToRender.map(item => {\n return {\n id: (item.primary || item.text) as string,\n primary: (item.primary || item.text) as string,\n href: item.href,\n onClick: (_, e) => {\n e.stopPropagation();\n item.onClick?.(e);\n setPopoverOpen(false);\n }\n };\n })}\n header={<Text variant='h2'>{label}</Text>}\n onMouseEnter={onMouseEnterContent}\n onMouseLeave={onMouseLeaveContent}\n />\n )}\n </Popover>\n )}\n </>\n )}\n </>\n );\n};\n\nexport default ListItemWrapper;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/Menu.styles.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,eAAO,MAAM,kBAAkB,oLAE9B,CAAC;AAEF,eAAO,MAAM,mBAAmB,0KAAiB,CAAC;AAElD,eAAO,MAAM,cAAc;kBACX,OAAO;WACd,SAAS,CAAC,MAAM,CAAC;iBACX,SAAS,CAAC,YAAY,CAAC;gBACxB,OAAO;uBACA,OAAO;
|
|
1
|
+
{"version":3,"file":"Menu.styles.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/Menu.styles.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,eAAO,MAAM,kBAAkB,oLAE9B,CAAC;AAEF,eAAO,MAAM,mBAAmB,0KAAiB,CAAC;AAElD,eAAO,MAAM,cAAc;kBACX,OAAO;WACd,SAAS,CAAC,MAAM,CAAC;iBACX,SAAS,CAAC,YAAY,CAAC;gBACxB,OAAO;uBACA,OAAO;SA2O3B,CAAC;AAIF,eAAO,MAAM,eAAe,yGAS3B,CAAC;AAEF,eAAO,MAAM,sBAAsB,uGAElC,CAAC;AAEF,eAAO,MAAM,eAAe,wGAM1B,CAAC;AAIH,eAAO,MAAM,qBAAqB,yGAUhC,CAAC;AAIH,eAAO,MAAM,oBAAoB,4GA6C/B,CAAC;AAIH,eAAO,MAAM,cAAc,wGAiB1B,CAAC;AAIF,eAAO,MAAM,uBAAuB,8GAMlC,CAAC;AAIH,eAAO,MAAM,6BAA6B,8GAEzC,CAAC;AAEF,eAAO,MAAM,iBAAiB,wGAI7B,CAAC;AAEF,eAAO,MAAM,qBAAqB,yGA0BjC,CAAC;AAIF,eAAO,MAAM,UAAU,yGAmDrB,CAAC;AAIH,eAAO,MAAM,gBAAgB,yGAqC3B,CAAC;AAIH,eAAO,MAAM,gBAAgB,0KAiB3B,CAAC"}
|
|
@@ -8,7 +8,7 @@ import { tryCatch } from '../../utils';
|
|
|
8
8
|
import { StyledText } from '../Text';
|
|
9
9
|
import { StyledVisuallyHiddenText } from '../VisuallyHiddenText/VisuallyHiddenText';
|
|
10
10
|
import { StyledMetaList, StyledMetaListItem } from '../MetaList/MetaList';
|
|
11
|
-
import Button from '../Button';
|
|
11
|
+
import Button, { StyledButton } from '../Button';
|
|
12
12
|
import { readableColor } from '../../styles';
|
|
13
13
|
import { StyledPrimary, StyledSecondary, StyledSummaryItem, StyledSummaryItemActions, StyledVisual } from '../SummaryItem';
|
|
14
14
|
import { ellipsisOverflow } from '../../styles/mixins';
|
|
@@ -30,6 +30,29 @@ export const StyledMenuItem = styled.li(({ theme: { base, components }, isParent
|
|
|
30
30
|
padding-inline: ${base.spacing};
|
|
31
31
|
cursor: pointer;
|
|
32
32
|
|
|
33
|
+
> ${StyledSummaryItem} {
|
|
34
|
+
${StyledSummaryItemActions}, ${StyledVisual} {
|
|
35
|
+
display: grid;
|
|
36
|
+
align-items: center;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
> ${StyledVisual}:has(> :nth-child(2)) {
|
|
40
|
+
grid-template-columns: auto auto;
|
|
41
|
+
grid-column-gap: ${base.spacing};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
${itemLayout === 'stacked' &&
|
|
45
|
+
css `
|
|
46
|
+
&:has(${StyledSecondary})
|
|
47
|
+
> ${StyledVisual},
|
|
48
|
+
&:has(${StyledSecondary})
|
|
49
|
+
> ${StyledSummaryItemActions} {
|
|
50
|
+
height: ${base['hit-area']['mouse-min']};
|
|
51
|
+
align-self: start;
|
|
52
|
+
}
|
|
53
|
+
`}
|
|
54
|
+
}
|
|
55
|
+
|
|
33
56
|
${itemLayout === 'inline' &&
|
|
34
57
|
css `
|
|
35
58
|
justify-content: flex-start;
|
|
@@ -109,6 +132,15 @@ export const StyledMenuItem = styled.li(({ theme: { base, components }, isParent
|
|
|
109
132
|
|
|
110
133
|
@media (pointer: coarse) {
|
|
111
134
|
min-height: ${base['hit-area']['finger-min']};
|
|
135
|
+
${itemLayout === 'stacked' &&
|
|
136
|
+
css `
|
|
137
|
+
&:has(${StyledSecondary})
|
|
138
|
+
> ${StyledVisual},
|
|
139
|
+
&:has(${StyledSecondary})
|
|
140
|
+
> ${StyledSummaryItemActions} {
|
|
141
|
+
height: ${base['hit-area']['finger-min']};
|
|
142
|
+
}
|
|
143
|
+
`}
|
|
112
144
|
}
|
|
113
145
|
|
|
114
146
|
&:focus-within {
|
|
@@ -143,6 +175,15 @@ export const StyledMenuItem = styled.li(({ theme: { base, components }, isParent
|
|
|
143
175
|
color: inherit;
|
|
144
176
|
}
|
|
145
177
|
|
|
178
|
+
/* The enclosing menu item has required min-height already set */
|
|
179
|
+
${isParentItem &&
|
|
180
|
+
selectableParent &&
|
|
181
|
+
css `
|
|
182
|
+
${StyledSummaryItemActions} ${StyledButton} {
|
|
183
|
+
min-height: unset;
|
|
184
|
+
}
|
|
185
|
+
`}
|
|
186
|
+
|
|
146
187
|
${isParentItem &&
|
|
147
188
|
!selectableParent &&
|
|
148
189
|
(mode === 'multi-select' || mode === 'single-select') &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Menu.styles.js","sourceRoot":"","sources":["../../../src/components/Menu/Menu.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACL,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,wBAAwB,EACxB,YAAY,EACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,i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C;;;;GAIjF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC;AAEjD,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IACzD,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;IAE9F,OAAO,GAAG,CAAA;;aAEC,SAAS;mCACa,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO;;qCAE5B,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM;;;;iBAIjD,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC;;;;GAIlD,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,YAAY,GAAG,gBAAgB,CAAC","sourcesContent":["import { hideVisually, mix, rgba, transparentize } from 'polished';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { StyledEmptyState } from '../EmptyState';\nimport Icon, { StyledIcon } from '../Icon';\nimport { StyledGrid } from '../Grid';\nimport { tryCatch } from '../../utils';\nimport { StyledText } from '../Text';\nimport { StyledVisuallyHiddenText } from '../VisuallyHiddenText/VisuallyHiddenText';\nimport { StyledMetaList, StyledMetaListItem } from '../MetaList/MetaList';\nimport Button from '../Button';\nimport { readableColor } from '../../styles';\nimport {\n StyledPrimary,\n StyledSecondary,\n StyledSummaryItem,\n StyledSummaryItemActions,\n StyledVisual\n} from '../SummaryItem';\nimport { ellipsisOverflow } from '../../styles/mixins';\nimport { StyledFlex } from '../Flex';\nimport { StyledFormControl } from '../FormControl';\n\nimport type { MenuProps } from './Menu.types';\n\nexport const StyledExpandButton = styled(Button)`\n align-self: center;\n`;\n\nexport const StyledCheckMarkIcon = styled(Icon)``;\n\nexport const StyledMenuItem = styled.li<{\n isParentItem: boolean;\n mode?: MenuProps['mode'];\n itemLayout?: MenuProps['itemLayout'];\n isChecked?: boolean;\n selectableParent?: boolean;\n}>(\n ({\n theme: { base, components },\n isParentItem,\n itemLayout,\n mode = 'action',\n 'aria-selected': isChecked = false,\n selectableParent = false\n }) => {\n const activeColor = tryCatch(() =>\n mix(0.85, base.palette['primary-background'], base.palette.interactive)\n );\n const hoverColor = tryCatch(() =>\n mix(0.95, base.palette['primary-background'], base.palette.interactive)\n );\n const hoverCheckColor = tryCatch(() =>\n rgba(\n components['radio-check'][':checked']['background-color'],\n base.transparency['transparent-5']\n )\n );\n\n const checkedBackground = components['radio-check'][':checked']['background-color'];\n const checkedForeground = tryCatch(() => readableColor(checkedBackground));\n\n return css`\n min-height: ${base['hit-area']['mouse-min']};\n padding-block: calc(0.75 * ${base.spacing});\n padding-inline: ${base.spacing};\n cursor: pointer;\n\n ${itemLayout === 'inline' &&\n css`\n justify-content: flex-start;\n\n ${StyledSummaryItem} {\n /* Sets grid columns based on SummaryItem content combinations */\n\n &:has(${StyledVisual}):has(${StyledSecondary}):has(${StyledSummaryItemActions}) {\n grid-template-areas: 'visual primary secondary actions';\n grid-template-columns: auto auto 1fr auto;\n }\n\n &:has(${StyledVisual}):has(${StyledSecondary}):not(:has(${StyledSummaryItemActions})) {\n grid-template-areas: 'visual primary secondary';\n grid-template-columns: auto auto 1fr;\n }\n\n &:has(${StyledVisual}):not(:has(${StyledSecondary})):has(${StyledSummaryItemActions}) {\n grid-template-areas: 'visual primary actions';\n grid-template-columns: auto 1fr auto;\n }\n\n &:has(${StyledVisual}):not(:has(${StyledSecondary})):not(\n :has(${StyledSummaryItemActions})\n ) {\n grid-template-areas: 'visual primary';\n grid-template-columns: auto 1fr;\n }\n\n &:not(:has(${StyledVisual})):has(${StyledSecondary}):has(${StyledSummaryItemActions}) {\n grid-template-areas: 'primary secondary actions';\n grid-template-columns: auto 1fr auto;\n }\n\n &:not(:has(${StyledVisual})):has(${StyledSecondary}):not(\n :has(${StyledSummaryItemActions})\n ) {\n grid-template-areas: 'primary secondary';\n grid-template-columns: auto 1fr;\n }\n\n &:not(:has(${StyledVisual})):not(:has(${StyledSecondary})):has(\n ${StyledSummaryItemActions}\n ) {\n grid-template-areas: 'primary actions';\n grid-template-columns: auto 1fr;\n }\n\n &:not(:has(${StyledVisual})):not(:has(${StyledSecondary})):not(\n :has(${StyledSummaryItemActions})\n ) {\n grid-template-areas: 'primary';\n grid-template-columns: 1fr;\n flex-grow: 0;\n }\n\n & > ${StyledPrimary} {\n ${ellipsisOverflow};\n }\n\n & > ${StyledSecondary} {\n ${ellipsisOverflow};\n\n ul {\n li {\n ${ellipsisOverflow};\n }\n justify-content: end;\n }\n }\n\n & > ${StyledSummaryItemActions} > ${StyledFlex} {\n justify-content: end;\n }\n }\n `}\n\n @media (pointer: coarse) {\n min-height: ${base['hit-area']['finger-min']};\n }\n\n &:focus-within {\n background-color: ${activeColor};\n }\n\n &:hover {\n ${StyledCheckMarkIcon} {\n visibility: visible;\n ${mode === 'single-select' &&\n css`\n color: ${isChecked ? checkedBackground : hoverCheckColor};\n `}\n ${mode === 'multi-select' &&\n css`\n ${!isChecked &&\n css`\n border-color: ${components['form-control'][':hover']['border-color']};\n `}\n `}\n }\n }\n\n &:hover:not([aria-disabled='true']) {\n background-color: ${hoverColor};\n }\n\n a:first-of-type {\n display: block;\n width: 100%;\n text-decoration: none;\n color: inherit;\n }\n\n ${isParentItem &&\n !selectableParent &&\n (mode === 'multi-select' || mode === 'single-select') &&\n css`\n padding-inline-start: calc(1.125rem + 2 * ${base.spacing});\n `}\n\n ${StyledGrid} {\n flex-grow: 1;\n }\n\n ${StyledCheckMarkIcon} {\n margin-inline-start: 0;\n ${mode === 'single-select' &&\n css`\n ${isChecked\n ? css`\n color: ${checkedBackground};\n `\n : css`\n visibility: hidden;\n `}\n `}\n ${mode === 'multi-select' &&\n css`\n ${isChecked\n ? css`\n color: ${checkedForeground};\n background-color: ${checkedBackground};\n border: 0.0625rem solid ${components['radio-check'][':checked']['border-color']};\n `\n : css`\n color: transparent;\n border: 0.0625rem solid ${components['radio-check']['border-color']};\n `}\n border-radius: min(\n calc(${base['border-radius']} * ${components.checkbox['border-radius']}),\n 0.25rem\n );\n `}\n }\n\n &[aria-disabled='true'] {\n cursor: not-allowed;\n background-color: ${components['form-control'][':disabled']['background-color']};\n opacity: ${base['disabled-opacity']};\n }\n `;\n }\n);\n\nStyledMenuItem.defaultProps = defaultThemeProp;\n\nexport const StyledAncestors = styled.div`\n ${StyledIcon} {\n width: 1em;\n height: 1em;\n }\n\n & > ${StyledText} {\n ${ellipsisOverflow};\n }\n`;\n\nexport const StyledVisibilityHidden = styled.p`\n ${hideVisually}\n`;\n\nexport const StyledSeparator = styled.li(({ theme }) => {\n return css`\n height: 0.0625rem;\n background-color: ${theme.base.palette['border-line']};\n margin: ${theme.base.spacing} 0;\n `;\n});\n\nStyledSeparator.defaultProps = defaultThemeProp;\n\nexport const StyledMenuGroupHeader = styled.div(({ theme }) => {\n return css`\n min-height: ${theme.base['hit-area']['mouse-min']};\n font-weight: ${theme.base['font-weight']['semi-bold']};\n background-color: ${theme.base.palette['secondary-background']};\n\n @media (pointer: coarse) {\n min-height: ${theme.base['hit-area']['finger-min']};\n }\n `;\n});\n\nStyledMenuGroupHeader.defaultProps = defaultThemeProp;\n\nexport const StyledMenuListHeader = styled.legend(({ theme: { base } }) => {\n const hoverColor = tryCatch(() =>\n mix(0.95, base.palette['primary-background'], base.palette.interactive)\n );\n const activeColor = tryCatch(() =>\n mix(0.85, base.palette['primary-background'], base.palette.interactive)\n );\n\n return css`\n cursor: pointer;\n width: 100%;\n background-color: ${base.palette['primary-background']};\n\n &:first-child {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n\n &:last-child {\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n }\n\n &:focus-within {\n box-shadow: ${base.shadow['focus-inset']};\n background-color: ${activeColor};\n }\n\n &:hover:not([aria-disabled='true']):not([data-current='true']) {\n background-color: ${hoverColor};\n }\n color: ${base.palette['foreground-color']};\n padding: calc(0.5 * ${base.spacing}) ${base.spacing};\n text-align: start;\n border-radius: inherit;\n\n > ${StyledGrid} {\n grid-column-gap: ${base.spacing};\n }\n\n ${StyledIcon} {\n /* Fixes vertical align issue increasing box size beyond square */\n display: block;\n }\n `;\n});\n\nStyledMenuListHeader.defaultProps = defaultThemeProp;\n\nexport const StyledMenuList = styled.ul(\n ({ theme }) => css`\n overflow-x: hidden;\n overflow-y: auto;\n list-style: none;\n height: 100%;\n border-radius: inherit;\n\n ${StyledEmptyState} {\n padding: ${theme.base.spacing};\n height: auto;\n }\n\n li:not(:first-child):not([role='presentation']) > ${StyledMenuGroupHeader} {\n margin-block-start: ${theme.base.spacing};\n }\n `\n);\n\nStyledMenuList.defaultProps = defaultThemeProp;\n\nexport const StyledMenuListContainer = styled.fieldset(({ theme }) => {\n return css`\n background-color: ${theme.base.palette['primary-background']};\n border: 0;\n border-radius: inherit;\n `;\n});\n\nStyledMenuListContainer.defaultProps = defaultThemeProp;\n\nexport const StyledFlyoutMenuListContainer = styled(StyledMenuListContainer)`\n min-width: 10rem;\n`;\n\nexport const StyledLoadingItem = styled.li`\n display: block;\n position: relative;\n height: 2.8rem;\n`;\n\nexport const StyledMenuListWrapper = styled.div(\n ({ theme }) => css`\n position: relative;\n overflow: hidden;\n transition: height ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n\n & > fieldset:first-child {\n position: relative;\n }\n\n &:first-child {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n\n &:last-child {\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n }\n\n ${StyledMetaList} ${StyledMetaListItem} * {\n display: inline;\n vertical-align: baseline;\n margin: 0;\n }\n `\n);\n\nStyledMenuListWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledMenu = styled.div(({ theme }) => {\n const borderStyle = `0.0625rem solid ${theme.base.palette['border-line']}`;\n\n return css`\n display: flex;\n flex-direction: column;\n\n &,\n ${StyledMenuListWrapper} {\n max-height: inherit;\n }\n\n &:focus {\n box-shadow: ${theme.base.shadow.focus};\n outline: none;\n }\n\n &:first-child {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n\n &:last-child {\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n }\n\n &[data-active-scope='true'] [data-current='true'] {\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n\n ${StyledVisuallyHiddenText}:first-child {\n + ${StyledMenuListWrapper}, + header {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n }\n\n > header,\n > footer {\n padding: ${theme.base.spacing};\n }\n\n > header {\n border-bottom: ${borderStyle};\n }\n\n > footer {\n border-top: ${borderStyle};\n }\n `;\n});\n\nStyledMenu.defaultProps = defaultThemeProp;\n\nexport const StyledMenuFilter = styled.div(({ theme }) => {\n const borderRadius = `calc(${theme.components['search-input']['border-radius']} * ${theme.base['border-radius']})`;\n\n return css`\n position: relative;\n min-height: ${theme.components.input.height};\n height: ${theme.components.input.height};\n\n @media (pointer: coarse) {\n min-height: ${theme.base['hit-area']['finger-min']};\n min-width: ${theme.base['hit-area']['finger-min']};\n }\n\n ${StyledFormControl} {\n height: 100%;\n border-radius: ${borderRadius};\n padding-inline-start: calc(1.5 * ${theme.components.input.padding});\n padding-inline-end: calc(4 * ${theme.components.input.padding});\n\n &::-webkit-search-cancel-button {\n display: none;\n }\n\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n\n &:focus:not([disabled]) {\n box-shadow: ${theme.base.shadow['focus-inset']};\n border-color: ${theme.components['form-control']['border-color']};\n\n :hover {\n border-color: ${theme.components['form-control'][':hover']['border-color']};\n }\n }\n }\n `;\n});\n\nStyledMenuFilter.defaultProps = defaultThemeProp;\n\nexport const StyledFilterIcon = styled(Icon)(({ theme }) => {\n const iconColor = tryCatch(() => transparentize(0.3, theme.base.palette['foreground-color']));\n\n return css`\n position: absolute;\n color: ${iconColor};\n inset-inline-end: calc(1.5 * ${theme.components.input.padding});\n /* stylelint-disable unit-allowed-list */\n inset-block-start: calc(0.5 * (${theme.components.input.height} - max(1.125rem, 14px)));\n\n @media (pointer: coarse) {\n inset-block-start: calc(\n 0.5 * (${theme.base['hit-area']['finger-min']} - max(1.125rem, 14px))\n );\n }\n /* stylelint-enable unit-allowed-list */\n `;\n});\n\nStyledFilterIcon.defaultProps = defaultThemeProp;\n"]}
|
|
1
|
+
{"version":3,"file":"Menu.styles.js","sourceRoot":"","sources":["../../../src/components/Menu/Menu.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AACnE,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,MAAM,EAAE,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACL,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,wBAAwB,EACxB,YAAY,EACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,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} from 'polished';\nimport styled, { css } from 'styled-components';\n\nimport { defaultThemeProp } from '../../theme';\nimport { StyledEmptyState } from '../EmptyState';\nimport Icon, { StyledIcon } from '../Icon';\nimport { StyledGrid } from '../Grid';\nimport { tryCatch } from '../../utils';\nimport { StyledText } from '../Text';\nimport { StyledVisuallyHiddenText } from '../VisuallyHiddenText/VisuallyHiddenText';\nimport { StyledMetaList, StyledMetaListItem } from '../MetaList/MetaList';\nimport Button, { StyledButton } from '../Button';\nimport { readableColor } from '../../styles';\nimport {\n StyledPrimary,\n StyledSecondary,\n StyledSummaryItem,\n StyledSummaryItemActions,\n StyledVisual\n} from '../SummaryItem';\nimport { ellipsisOverflow } from '../../styles/mixins';\nimport { StyledFlex } from '../Flex';\nimport { StyledFormControl } from '../FormControl';\n\nimport type { MenuProps } from './Menu.types';\n\nexport const StyledExpandButton = styled(Button)`\n align-self: center;\n`;\n\nexport const StyledCheckMarkIcon = styled(Icon)``;\n\nexport const StyledMenuItem = styled.li<{\n isParentItem: boolean;\n mode?: MenuProps['mode'];\n itemLayout?: MenuProps['itemLayout'];\n isChecked?: boolean;\n selectableParent?: boolean;\n}>(\n ({\n theme: { base, components },\n isParentItem,\n itemLayout,\n mode = 'action',\n 'aria-selected': isChecked = false,\n selectableParent = false\n }) => {\n const activeColor = tryCatch(() =>\n mix(0.85, base.palette['primary-background'], base.palette.interactive)\n );\n const hoverColor = tryCatch(() =>\n mix(0.95, base.palette['primary-background'], base.palette.interactive)\n );\n const hoverCheckColor = tryCatch(() =>\n rgba(\n components['radio-check'][':checked']['background-color'],\n base.transparency['transparent-5']\n )\n );\n\n const checkedBackground = components['radio-check'][':checked']['background-color'];\n const checkedForeground = tryCatch(() => readableColor(checkedBackground));\n\n return css`\n min-height: ${base['hit-area']['mouse-min']};\n padding-block: calc(0.75 * ${base.spacing});\n padding-inline: ${base.spacing};\n cursor: pointer;\n\n > ${StyledSummaryItem} {\n ${StyledSummaryItemActions}, ${StyledVisual} {\n display: grid;\n align-items: center;\n }\n\n > ${StyledVisual}:has(> :nth-child(2)) {\n grid-template-columns: auto auto;\n grid-column-gap: ${base.spacing};\n }\n\n ${itemLayout === 'stacked' &&\n css`\n &:has(${StyledSecondary})\n > ${StyledVisual},\n &:has(${StyledSecondary})\n > ${StyledSummaryItemActions} {\n height: ${base['hit-area']['mouse-min']};\n align-self: start;\n }\n `}\n }\n\n ${itemLayout === 'inline' &&\n css`\n justify-content: flex-start;\n\n ${StyledSummaryItem} {\n /* Sets grid columns based on SummaryItem content combinations */\n\n &:has(${StyledVisual}):has(${StyledSecondary}):has(${StyledSummaryItemActions}) {\n grid-template-areas: 'visual primary secondary actions';\n grid-template-columns: auto auto 1fr auto;\n }\n\n &:has(${StyledVisual}):has(${StyledSecondary}):not(:has(${StyledSummaryItemActions})) {\n grid-template-areas: 'visual primary secondary';\n grid-template-columns: auto auto 1fr;\n }\n\n &:has(${StyledVisual}):not(:has(${StyledSecondary})):has(${StyledSummaryItemActions}) {\n grid-template-areas: 'visual primary actions';\n grid-template-columns: auto 1fr auto;\n }\n\n &:has(${StyledVisual}):not(:has(${StyledSecondary})):not(\n :has(${StyledSummaryItemActions})\n ) {\n grid-template-areas: 'visual primary';\n grid-template-columns: auto 1fr;\n }\n\n &:not(:has(${StyledVisual})):has(${StyledSecondary}):has(${StyledSummaryItemActions}) {\n grid-template-areas: 'primary secondary actions';\n grid-template-columns: auto 1fr auto;\n }\n\n &:not(:has(${StyledVisual})):has(${StyledSecondary}):not(\n :has(${StyledSummaryItemActions})\n ) {\n grid-template-areas: 'primary secondary';\n grid-template-columns: auto 1fr;\n }\n\n &:not(:has(${StyledVisual})):not(:has(${StyledSecondary})):has(\n ${StyledSummaryItemActions}\n ) {\n grid-template-areas: 'primary actions';\n grid-template-columns: auto 1fr;\n }\n\n &:not(:has(${StyledVisual})):not(:has(${StyledSecondary})):not(\n :has(${StyledSummaryItemActions})\n ) {\n grid-template-areas: 'primary';\n grid-template-columns: 1fr;\n flex-grow: 0;\n }\n\n & > ${StyledPrimary} {\n ${ellipsisOverflow};\n }\n\n & > ${StyledSecondary} {\n ${ellipsisOverflow};\n\n ul {\n li {\n ${ellipsisOverflow};\n }\n justify-content: end;\n }\n }\n\n & > ${StyledSummaryItemActions} > ${StyledFlex} {\n justify-content: end;\n }\n }\n `}\n\n @media (pointer: coarse) {\n min-height: ${base['hit-area']['finger-min']};\n ${itemLayout === 'stacked' &&\n css`\n &:has(${StyledSecondary})\n > ${StyledVisual},\n &:has(${StyledSecondary})\n > ${StyledSummaryItemActions} {\n height: ${base['hit-area']['finger-min']};\n }\n `}\n }\n\n &:focus-within {\n background-color: ${activeColor};\n }\n\n &:hover {\n ${StyledCheckMarkIcon} {\n visibility: visible;\n ${mode === 'single-select' &&\n css`\n color: ${isChecked ? checkedBackground : hoverCheckColor};\n `}\n ${mode === 'multi-select' &&\n css`\n ${!isChecked &&\n css`\n border-color: ${components['form-control'][':hover']['border-color']};\n `}\n `}\n }\n }\n\n &:hover:not([aria-disabled='true']) {\n background-color: ${hoverColor};\n }\n\n a:first-of-type {\n display: block;\n width: 100%;\n text-decoration: none;\n color: inherit;\n }\n\n /* The enclosing menu item has required min-height already set */\n ${isParentItem &&\n selectableParent &&\n css`\n ${StyledSummaryItemActions} ${StyledButton} {\n min-height: unset;\n }\n `}\n\n ${isParentItem &&\n !selectableParent &&\n (mode === 'multi-select' || mode === 'single-select') &&\n css`\n padding-inline-start: calc(1.125rem + 2 * ${base.spacing});\n `}\n\n ${StyledGrid} {\n flex-grow: 1;\n }\n\n ${StyledCheckMarkIcon} {\n margin-inline-start: 0;\n ${mode === 'single-select' &&\n css`\n ${isChecked\n ? css`\n color: ${checkedBackground};\n `\n : css`\n visibility: hidden;\n `}\n `}\n ${mode === 'multi-select' &&\n css`\n ${isChecked\n ? css`\n color: ${checkedForeground};\n background-color: ${checkedBackground};\n border: 0.0625rem solid ${components['radio-check'][':checked']['border-color']};\n `\n : css`\n color: transparent;\n border: 0.0625rem solid ${components['radio-check']['border-color']};\n `}\n border-radius: min(\n calc(${base['border-radius']} * ${components.checkbox['border-radius']}),\n 0.25rem\n );\n `}\n }\n\n &[aria-disabled='true'] {\n cursor: not-allowed;\n background-color: ${components['form-control'][':disabled']['background-color']};\n opacity: ${base['disabled-opacity']};\n }\n `;\n }\n);\n\nStyledMenuItem.defaultProps = defaultThemeProp;\n\nexport const StyledAncestors = styled.div`\n ${StyledIcon} {\n width: 1em;\n height: 1em;\n }\n\n & > ${StyledText} {\n ${ellipsisOverflow};\n }\n`;\n\nexport const StyledVisibilityHidden = styled.p`\n ${hideVisually}\n`;\n\nexport const StyledSeparator = styled.li(({ theme }) => {\n return css`\n height: 0.0625rem;\n background-color: ${theme.base.palette['border-line']};\n margin: ${theme.base.spacing} 0;\n `;\n});\n\nStyledSeparator.defaultProps = defaultThemeProp;\n\nexport const StyledMenuGroupHeader = styled.div(({ theme }) => {\n return css`\n min-height: ${theme.base['hit-area']['mouse-min']};\n font-weight: ${theme.base['font-weight']['semi-bold']};\n background-color: ${theme.base.palette['secondary-background']};\n\n @media (pointer: coarse) {\n min-height: ${theme.base['hit-area']['finger-min']};\n }\n `;\n});\n\nStyledMenuGroupHeader.defaultProps = defaultThemeProp;\n\nexport const StyledMenuListHeader = styled.legend(({ theme: { base } }) => {\n const hoverColor = tryCatch(() =>\n mix(0.95, base.palette['primary-background'], base.palette.interactive)\n );\n const activeColor = tryCatch(() =>\n mix(0.85, base.palette['primary-background'], base.palette.interactive)\n );\n\n return css`\n cursor: pointer;\n width: 100%;\n background-color: ${base.palette['primary-background']};\n\n &:first-child {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n\n &:last-child {\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n }\n\n &:focus-within {\n box-shadow: ${base.shadow['focus-inset']};\n background-color: ${activeColor};\n }\n\n &:hover:not([aria-disabled='true']):not([data-current='true']) {\n background-color: ${hoverColor};\n }\n color: ${base.palette['foreground-color']};\n padding: calc(0.5 * ${base.spacing}) ${base.spacing};\n text-align: start;\n border-radius: inherit;\n\n > ${StyledGrid} {\n grid-column-gap: ${base.spacing};\n }\n\n ${StyledIcon} {\n /* Fixes vertical align issue increasing box size beyond square */\n display: block;\n }\n `;\n});\n\nStyledMenuListHeader.defaultProps = defaultThemeProp;\n\nexport const StyledMenuList = styled.ul(\n ({ theme }) => css`\n overflow-x: hidden;\n overflow-y: auto;\n list-style: none;\n height: 100%;\n border-radius: inherit;\n\n ${StyledEmptyState} {\n padding: ${theme.base.spacing};\n height: auto;\n }\n\n li:not(:first-child):not([role='presentation']) > ${StyledMenuGroupHeader} {\n margin-block-start: ${theme.base.spacing};\n }\n `\n);\n\nStyledMenuList.defaultProps = defaultThemeProp;\n\nexport const StyledMenuListContainer = styled.fieldset(({ theme }) => {\n return css`\n background-color: ${theme.base.palette['primary-background']};\n border: 0;\n border-radius: inherit;\n `;\n});\n\nStyledMenuListContainer.defaultProps = defaultThemeProp;\n\nexport const StyledFlyoutMenuListContainer = styled(StyledMenuListContainer)`\n min-width: 10rem;\n`;\n\nexport const StyledLoadingItem = styled.li`\n display: block;\n position: relative;\n height: 2.8rem;\n`;\n\nexport const StyledMenuListWrapper = styled.div(\n ({ theme }) => css`\n position: relative;\n overflow: hidden;\n transition: height ${theme.base.animation.speed} ${theme.base.animation.timing.ease};\n\n & > fieldset:first-child {\n position: relative;\n }\n\n &:first-child {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n\n &:last-child {\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n }\n\n ${StyledMetaList} ${StyledMetaListItem} * {\n display: inline;\n vertical-align: baseline;\n margin: 0;\n }\n `\n);\n\nStyledMenuListWrapper.defaultProps = defaultThemeProp;\n\nexport const StyledMenu = styled.div(({ theme }) => {\n const borderStyle = `0.0625rem solid ${theme.base.palette['border-line']}`;\n\n return css`\n display: flex;\n flex-direction: column;\n\n &,\n ${StyledMenuListWrapper} {\n max-height: inherit;\n }\n\n &:focus {\n box-shadow: ${theme.base.shadow.focus};\n outline: none;\n }\n\n &:first-child {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n\n &:last-child {\n border-bottom-left-radius: inherit;\n border-bottom-right-radius: inherit;\n }\n\n &[data-active-scope='true'] [data-current='true'] {\n box-shadow: ${theme.base.shadow['focus-inset']};\n }\n\n ${StyledVisuallyHiddenText}:first-child {\n + ${StyledMenuListWrapper}, + header {\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n }\n }\n\n > header,\n > footer {\n padding: ${theme.base.spacing};\n }\n\n > header {\n border-bottom: ${borderStyle};\n }\n\n > footer {\n border-top: ${borderStyle};\n }\n `;\n});\n\nStyledMenu.defaultProps = defaultThemeProp;\n\nexport const StyledMenuFilter = styled.div(({ theme }) => {\n const borderRadius = `calc(${theme.components['search-input']['border-radius']} * ${theme.base['border-radius']})`;\n\n return css`\n position: relative;\n min-height: ${theme.components.input.height};\n height: ${theme.components.input.height};\n\n @media (pointer: coarse) {\n min-height: ${theme.base['hit-area']['finger-min']};\n min-width: ${theme.base['hit-area']['finger-min']};\n }\n\n ${StyledFormControl} {\n height: 100%;\n border-radius: ${borderRadius};\n padding-inline-start: calc(1.5 * ${theme.components.input.padding});\n padding-inline-end: calc(4 * ${theme.components.input.padding});\n\n &::-webkit-search-cancel-button {\n display: none;\n }\n\n ::-webkit-search-decoration {\n -webkit-appearance: none;\n }\n\n &:focus:not([disabled]) {\n box-shadow: ${theme.base.shadow['focus-inset']};\n border-color: ${theme.components['form-control']['border-color']};\n\n :hover {\n border-color: ${theme.components['form-control'][':hover']['border-color']};\n }\n }\n }\n `;\n});\n\nStyledMenuFilter.defaultProps = defaultThemeProp;\n\nexport const StyledFilterIcon = styled(Icon)(({ theme }) => {\n const iconColor = tryCatch(() => transparentize(0.3, theme.base.palette['foreground-color']));\n\n return css`\n position: absolute;\n color: ${iconColor};\n inset-inline-end: calc(1.5 * ${theme.components.input.padding});\n /* stylelint-disable unit-allowed-list */\n inset-block-start: calc(0.5 * (${theme.components.input.height} - max(1.125rem, 14px)));\n\n @media (pointer: coarse) {\n inset-block-start: calc(\n 0.5 * (${theme.base['hit-area']['finger-min']} - max(1.125rem, 14px))\n );\n }\n /* stylelint-enable unit-allowed-list */\n `;\n});\n\nStyledFilterIcon.defaultProps = defaultThemeProp;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/MenuItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAc,MAAM,OAAO,CAAC;AAI3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAgBhD,OAAO,KAAK,EAA6B,aAAa,EAAE,MAAM,cAAc,CAAC;;;;
|
|
1
|
+
{"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/MenuItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAc,MAAM,OAAO,CAAC;AAI3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAgBhD,OAAO,KAAK,EAA6B,aAAa,EAAE,MAAM,cAAc,CAAC;;;;AA4P7E,wBAAyD"}
|
|
@@ -34,7 +34,7 @@ const AncestorPath = ({ ancestors = [] }) => {
|
|
|
34
34
|
return (_jsxs(Fragment, { children: [_jsx(Text, { variant: 'secondary', children: label }), i < arr.length - 1 && (_jsxs(_Fragment, { children: [_jsx(Text, { variant: 'secondary', children: _jsx(Icon, { name: `caret-${end}` }) }), truncatedPath && (_jsxs(_Fragment, { children: [_jsx(Text, { variant: 'secondary', children: "\u2026" }), _jsx(Text, { variant: 'secondary', children: _jsx(Icon, { name: `caret-${end}` }) })] }))] }))] }, ancestor.id));
|
|
35
35
|
}) }));
|
|
36
36
|
};
|
|
37
|
-
const MenuItem = ({ testId, id, primary, secondary, ancestors, visual, count, items, selected, partial, href, tooltip, onClick, onExpand, disabled, role = 'menuitem', ...restProps }) => {
|
|
37
|
+
const MenuItem = ({ testId, id, primary, secondary, ancestors, visual: visualProp, count, items, selected, partial, href, tooltip, onClick, onExpand, disabled, role = 'menuitem', ...restProps }) => {
|
|
38
38
|
const t = useI18n();
|
|
39
39
|
const { mode, onItemClick, itemLayout, accent, variant: menuVariant, setFocusDescendant, getScopedItemId, arrowNavigationUnsupported } = useContext(MenuContext);
|
|
40
40
|
const testIds = useTestIds(testId, getMenuItemTestIds);
|
|
@@ -67,6 +67,7 @@ const MenuItem = ({ testId, id, primary, secondary, ancestors, visual, count, it
|
|
|
67
67
|
}
|
|
68
68
|
const secondaryContent = ancestors ? (_jsx(AncestorPath, { ancestors: ancestors })) : (secondary && _jsx(MetaList, { items: secondary, id: secondaryId }));
|
|
69
69
|
const [summaryItemRef, setSummaryItemRef] = useElement();
|
|
70
|
+
const visual = (_jsxs(_Fragment, { children: [selectionMode && (!items || selectableParent) && !disabled && (_jsx(StyledCheckMarkIcon, { name: 'check' })), visualProp] }));
|
|
70
71
|
const summaryItem = (_jsxs(_Fragment, { children: [_jsx(SummaryItem, { ref: setSummaryItemRef, primary: accentedPrimary || (!items ? _jsx(Text, { children: primary }) : primary), secondary: secondaryContent, layout: itemLayout, visual: visual, actions: items || count ? (_jsxs(Flex, { container: { gap: 1, alignItems: 'center', justify: 'center' }, children: [count !== undefined && (_jsx(Count, { id: itemCountId, "aria-label": t('menu_item_count', [count]), children: count })), items && _jsx(DrillDown, { expandHandler: selectableParent ? expandHandler : undefined })] })) : undefined, container: {
|
|
71
72
|
colGap: 1
|
|
72
73
|
} }), tooltip && (_jsx(Tooltip, { target: summaryItemRef, hideDelay: 'none', showDelay: 'short', children: tooltip }))] }));
|
|
@@ -95,14 +96,14 @@ const MenuItem = ({ testId, id, primary, secondary, ancestors, visual, count, it
|
|
|
95
96
|
idString = '';
|
|
96
97
|
return idString;
|
|
97
98
|
}, [items, secondary, itemCountId, secondaryId]);
|
|
98
|
-
return (
|
|
99
|
+
return (_jsx(Flex, { "data-testid": testIds.root, ...restProps, container: { alignItems: 'center', justify: 'between', gap: 1 }, id: itemId, as: StyledMenuItem, "aria-label": itemLabel, "aria-describedby": ariaDescribedBy, role: role, "aria-disabled": disabled, "data-expand": !!items, itemLayout: itemLayout, tabIndex: -1, onMouseDown: (e) => {
|
|
99
100
|
e.preventDefault();
|
|
100
101
|
}, onClick: (e) => {
|
|
101
102
|
if (disabled) {
|
|
102
103
|
return;
|
|
103
104
|
}
|
|
104
105
|
return items && typeof selected !== 'boolean' ? expandHandler(e) : clickHandler(e);
|
|
105
|
-
}, onMouseEnter: menuVariant === 'flyout' ? expandHandler : undefined, href: href, mode: mode, isParentItem: !!items, "aria-selected": selectionMode && (!items || selectableParent) ? !!selected : undefined, selectableParent: selectableParent, children:
|
|
106
|
+
}, onMouseEnter: menuVariant === 'flyout' ? expandHandler : undefined, href: href, mode: mode, isParentItem: !!items, "aria-selected": selectionMode && (!items || selectableParent) ? !!selected : undefined, selectableParent: selectableParent, children: href && !selectionMode ? (_jsx(BareButton, { href: href, tabIndex: '-1', children: summaryItem })) : (summaryItem) }));
|
|
106
107
|
};
|
|
107
108
|
export default withTestIds(MenuItem, getMenuItemTestIds);
|
|
108
109
|
//# sourceMappingURL=MenuItem.js.map
|