@pega/cosmos-react-core 9.19.0 → 9.21.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 (46) hide show
  1. package/lib/components/AppShell/AppNavigationPanel.js +1 -1
  2. package/lib/components/AppShell/AppNavigationPanel.js.map +1 -1
  3. package/lib/components/AppShell/AppShellList.js +1 -1
  4. package/lib/components/AppShell/AppShellList.js.map +1 -1
  5. package/lib/components/File/FileItem.d.ts +38 -0
  6. package/lib/components/File/FileItem.d.ts.map +1 -1
  7. package/lib/components/File/FileItem.js +167 -23
  8. package/lib/components/File/FileItem.js.map +1 -1
  9. package/lib/components/File/FileList.d.ts.map +1 -1
  10. package/lib/components/File/FileList.js +6 -2
  11. package/lib/components/File/FileList.js.map +1 -1
  12. package/lib/components/File/index.d.ts +1 -1
  13. package/lib/components/File/index.d.ts.map +1 -1
  14. package/lib/components/File/index.js.map +1 -1
  15. package/lib/components/Icon/Icon.d.ts +5 -0
  16. package/lib/components/Icon/Icon.d.ts.map +1 -1
  17. package/lib/components/Icon/Icon.js +33 -4
  18. package/lib/components/Icon/Icon.js.map +1 -1
  19. package/lib/components/Icon/icons/search-solid.icon.d.ts +1 -1
  20. package/lib/components/Icon/icons/search-solid.icon.js +3 -3
  21. package/lib/components/Icon/icons/search-solid.icon.js.map +1 -1
  22. package/lib/components/ListToolbar/ListToolbar.d.ts.map +1 -1
  23. package/lib/components/ListToolbar/ListToolbar.js +1 -1
  24. package/lib/components/ListToolbar/ListToolbar.js.map +1 -1
  25. package/lib/components/PageTemplates/PageTemplates.js +1 -1
  26. package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
  27. package/lib/components/SpeechToTextButton/SpeechToTextButton.js +1 -1
  28. package/lib/components/SpeechToTextButton/SpeechToTextButton.js.map +1 -1
  29. package/lib/hooks/useAnimatedText.d.ts.map +1 -1
  30. package/lib/hooks/useAnimatedText.js +12 -1
  31. package/lib/hooks/useAnimatedText.js.map +1 -1
  32. package/lib/hooks/useI18n.d.ts +7 -0
  33. package/lib/hooks/useI18n.d.ts.map +1 -1
  34. package/lib/i18n/default.d.ts +7 -0
  35. package/lib/i18n/default.d.ts.map +1 -1
  36. package/lib/i18n/default.js +8 -0
  37. package/lib/i18n/default.js.map +1 -1
  38. package/lib/i18n/i18n.d.ts +7 -0
  39. package/lib/i18n/i18n.d.ts.map +1 -1
  40. package/lib/theme/theme.d.ts +6 -0
  41. package/lib/theme/theme.d.ts.map +1 -1
  42. package/lib/theme/themeDefinition.json +4 -0
  43. package/lib/theme/themeOverrides.schema.json +4 -0
  44. package/lib/theme/themes/aurigaDarkTheme.json +7 -7
  45. package/lib/theme/themes/aurigaTheme.json +7 -7
  46. package/package.json +1 -1
@@ -41,7 +41,7 @@ export const Links = (props) => {
41
41
  ...link,
42
42
  primary: link.name,
43
43
  'aria-current': link.active ? 'page' : null,
44
- visual: link.icon ? _jsx(Icon, { name: link.icon }) : null,
44
+ visual: link.icon ? _jsx(Icon, { name: link.icon, emphasized: link.active }) : null,
45
45
  onClick: link.links ? undefined : link.onClick,
46
46
  items: link.links ? mergedNavLinks(link.links) : undefined
47
47
  };
@@ -1 +1 @@
1
- {"version":3,"file":"AppNavigationPanel.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppNavigationPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG9E,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,MAAM,UAAU,CAAC;AAC7B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAA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Content":["import { useState, useEffect, useCallback, useMemo, useContext } from 'react';\nimport type { ElementType, MouseEvent } from 'react';\n\nimport Button from '../Button';\nimport Grid from '../Grid';\nimport Icon from '../Icon';\nimport Image from '../Image';\nimport Link from '../Link';\nimport Tooltip from '../Tooltip';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\nimport { useI18n, useElement } from '../../hooks';\nimport { isValidElement } from '../../utils';\n\nimport NavigationList from './NavigationList';\nimport AppShellContext, { AppShellDrawerContext } from './AppShellContext';\nimport AppShellDrawer from './Drawer';\nimport { AppShellSearch } from './AppShellSearch';\nimport {\n StyledAppInfo,\n StyledCaseTypes,\n StyledScrollWrap,\n StyledUtils,\n StyledNavCasesList,\n StyledCountIcon,\n StyledUtilIconCount,\n StyledAppShellTooltip,\n StyledUtilsSeparator,\n StyledAIAssistant\n} from './AppShell.styles';\nimport type {\n AgentProps,\n AppInfoProps,\n CaseProps,\n CaseTypeProps,\n LinkProps,\n NavListItemProps,\n UtilItemProps,\n UtilsProps\n} from './AppShell.types';\nimport type { AppNavigationPanelProps } from './AppNavigationPanel.types';\n\nexport const CaseTypes = ({\n caseTypes,\n mobileNavBar\n}: {\n caseTypes: CaseTypeProps[];\n mobileNavBar?: boolean;\n}) => {\n const t = useI18n();\n\n const transformedCaseTypes = caseTypes.map(caseType => {\n return {\n ...caseType,\n visual: caseType.icon ? <Icon name={caseType.icon} /> : undefined,\n primary: caseType.name\n };\n });\n\n return useMemo(\n () => (\n <StyledCaseTypes>\n <NavigationList\n items={[\n {\n primary: t('app_shell_create'),\n visual: <Icon name='plus' />,\n items: transformedCaseTypes\n }\n ]}\n mobileNavBar={mobileNavBar}\n />\n </StyledCaseTypes>\n ),\n [caseTypes, mobileNavBar]\n );\n};\n\nexport const Links = (props: { links: LinkProps[]; mobileNavBar?: boolean }) => {\n const { links, mobileNavBar } = props;\n const [transformedLinks, setTransformedLinks] = useState<NavListItemProps[]>([]);\n\n // TODO: Can this be a memo instead of a state and an effect?\n const mergedNavLinks = (items: LinkProps[]): NavListItemProps[] => {\n return items.map((link: LinkProps) => {\n return {\n ...link,\n primary: link.name,\n 'aria-current': link.active ? 'page' : null,\n visual: link.icon ? <Icon name={link.icon} /> : null,\n onClick: link.links ? undefined : link.onClick,\n items: link.links ? mergedNavLinks(link.links) : undefined\n };\n });\n };\n\n useEffect(() => {\n setTransformedLinks(mergedNavLinks(links));\n }, [links]);\n\n if (!links.length) return null;\n\n return (\n <div>\n <NavigationList items={transformedLinks} mobileNavBar={mobileNavBar} />\n </div>\n );\n};\n\nconst AIAssistant = ({ agent }: { agent: AgentProps }) => (\n <StyledAIAssistant>\n <NavigationList\n items={[\n {\n id: agent.id,\n primary: agent.name,\n visual: agent.icon,\n 'aria-current': agent.active ? 'page' : null,\n onClick: agent.onClick\n }\n ]}\n />\n </StyledAIAssistant>\n);\n\nconst Cases = (props: { cases: CaseProps[] }) => {\n const { cases } = props;\n\n const setupCases = (items: CaseProps[]): NavListItemProps[] => {\n return items.map((item: CaseProps) => {\n const {\n id,\n primary,\n secondary,\n collapsedItemInfo,\n visual = <Icon name='case-solid' />,\n active,\n onClick,\n onDismiss,\n ...restProps\n } = item;\n return {\n ...restProps,\n id,\n 'aria-current': active ? 'page' : undefined,\n primary,\n secondary,\n collapsedItemInfo,\n active: !!active,\n onClick,\n onDismiss,\n visual\n };\n });\n };\n\n return (\n <StyledNavCasesList>\n <NavigationList items={setupCases(cases)} />\n </StyledNavCasesList>\n );\n};\n\nexport const Utils = ({ items }: UtilsProps) => {\n const { navOpen, navState, drawerOpen, setDrawerOpen } = useContext(AppShellContext);\n const [item, setItem] = useState<UtilItemProps>();\n\n useEffect(() => {\n if (drawerOpen && item) {\n setItem(\n items?.find<UtilItemProps>(\n (utilItem): utilItem is UtilItemProps =>\n !isValidElement(utilItem) && utilItem.name === item.name\n )\n );\n }\n }, [items]);\n\n const transform = useCallback(\n (utilItem: UtilItemProps): NavListItemProps => {\n const uItem = { ...utilItem };\n delete uItem.onDrawerClose;\n delete uItem.onDrawerOpen;\n return {\n onClick: () => {\n if (utilItem.drawerView) {\n setItem(utilItem);\n }\n },\n ...uItem,\n primary: utilItem.name,\n visual: utilItem.count ? (\n <StyledUtilIconCount>\n {utilItem.visual}\n <StyledCountIcon variant='urgent' id={`${utilItem.name}-count`}>\n {utilItem.count}\n </StyledCountIcon>\n </StyledUtilIconCount>\n ) : (\n utilItem.visual\n ),\n collapseItems: !navOpen\n };\n },\n [navOpen]\n );\n\n const utilItems = useMemo(() => {\n return [\n ...(items ?? []).map(uItem => {\n return isValidElement(uItem) ? uItem : transform(uItem);\n })\n ];\n }, [items, transform]);\n\n useEffect(() => {\n if (item) setDrawerOpen(true);\n }, [item]);\n\n useEffect(() => {\n if (navState === 'closed' || navState === 'closing') setDrawerOpen(false);\n }, [navState]);\n\n // setDrawerOpen comes from AppShellContext (raw useState setter — stable reference).\n // setItem is the local useState setter — also stable. Neither needs to be in deps.\n // openDrawer and refreshDrawer have identical bodies: both spread `next` to create\n // a new object reference so useEffect([item]) always fires, even when the same item\n // is re-opened. The semantic distinction is: openDrawer starts a new drawer session\n // (useEffect triggers setDrawerOpen(true)); refreshDrawer replaces an already-open\n // item's content (setDrawerOpen(true) is a no-op when already open).\n const ctxValue = useMemo(\n () => ({\n drawerOpen,\n openItemName: item?.name,\n closeDrawer: () => {\n setDrawerOpen(false);\n },\n openDrawer: (next: UtilItemProps) => {\n setItem({ ...next });\n },\n refreshDrawer: (next: UtilItemProps) => {\n setItem({ ...next });\n }\n }),\n [drawerOpen, item?.name]\n );\n\n return (\n <AppShellDrawerContext.Provider value={ctxValue}>\n <StyledUtils>\n <NavigationList items={utilItems} collapsed />\n </StyledUtils>\n\n {item && (\n <AppShellDrawer\n drawerOpen={drawerOpen}\n setDrawerOpen={setDrawerOpen}\n content={item.drawerView}\n header={item.drawerHeader || item.name}\n onDrawerClose={() => {\n setItem(undefined);\n item.onDrawerClose?.();\n }}\n onDrawerOpen={item.onDrawerOpen}\n />\n )}\n </AppShellDrawerContext.Provider>\n );\n};\n\nconst AppInfo = ({ appInfo }: { appInfo: AppInfoProps }) => {\n const [appInfoEl, setAppInfoEl] = useElement<HTMLAnchorElement>();\n const { navState } = useContext(AppShellContext);\n\n const {\n appName,\n portalName,\n href: appInfoHref,\n onClick: appInfoOnClick,\n imageSrc: logoSrc,\n appNameHidden,\n ...appInfoRestProps\n } = appInfo;\n\n let appInfoAs: ElementType = 'div';\n if (appInfoHref) appInfoAs = Link;\n else if (appInfoOnClick) appInfoAs = Button;\n\n return (\n <>\n <StyledAppInfo\n as={Grid}\n forwardedAs={appInfoAs}\n variant='link'\n href={appInfoHref}\n onClick={appInfoOnClick}\n aria-label={`${appName}${portalName ? ` - ${portalName}` : ''}`}\n {...appInfoRestProps}\n container={{\n alignItems: 'center',\n areas: portalName ? '\"logo app\" \"logo portal\"' : '\"logo app\"'\n }}\n ref={setAppInfoEl}\n icon\n >\n <Grid item={{ area: 'logo' }} as={Image} src={logoSrc} alt={appName} />\n <Grid item={{ area: 'app' }} as={appNameHidden ? VisuallyHiddenText : 'span'}>\n {appName}\n </Grid>\n {portalName && (\n <Grid item={{ area: 'portal' }} as='span'>\n {portalName}\n </Grid>\n )}\n </StyledAppInfo>\n {navState === 'closed' && (!appNameHidden || portalName) && (\n <Tooltip\n target={appInfoEl}\n placement='right'\n as={StyledAppShellTooltip}\n showDelay='none'\n hideDelay='none'\n >\n {`${appNameHidden ? '' : appName} ${portalName ?? ''}`.trim()}\n </Tooltip>\n )}\n </>\n );\n};\n\nconst AppNavigationPanel = ({\n appInfo,\n navState,\n searchInput,\n searchLabel,\n onClick,\n caseTypes,\n links,\n cases,\n utils,\n agent\n}: AppNavigationPanelProps) => {\n return (\n <>\n {appInfo && <AppInfo appInfo={appInfo} />}\n {searchInput && (\n <AppShellSearch\n searchLabel={searchLabel}\n collapsed={['closed', 'closing'].includes(navState)}\n searchInput={searchInput}\n />\n )}\n <StyledScrollWrap\n container={{ direction: 'column' }}\n item={{ grow: 1 }}\n tabIndex={-1}\n onClick={(e: MouseEvent<HTMLElement>) => {\n // Ensure that clicks on the container (not on interactive child elements) trigger the onClick handler\n if (e.target === e.currentTarget) onClick?.();\n }}\n >\n {caseTypes && caseTypes.length > 0 && <CaseTypes caseTypes={caseTypes} />}\n {links && <Links links={links} />}\n {cases && <Cases cases={cases} />}\n {['open', 'opening'].includes(navState) && (\n <StyledUtilsSeparator navOpen={['open', 'opening'].includes(navState)} />\n )}\n </StyledScrollWrap>\n {['closed', 'closing'].includes(navState) && <StyledUtilsSeparator />}\n <Utils items={utils} />\n {agent && <AIAssistant agent={agent} />}\n </>\n );\n};\n\nexport default AppNavigationPanel;\n"]}
1
+ {"version":3,"file":"AppNavigationPanel.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppNavigationPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAG9E,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,KAAK,MAAM,UAAU,CAAC;AAC7B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,kBAAkB,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,eAAe,EAAE,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,cAAc,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACL,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,kB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SAAS,EAAE,QAAQ,EAAE,EAClC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EACjB,QAAQ,EAAE,CAAC,CAAC,EACZ,OAAO,EAAE,CAAC,CAA0B,EAAE,EAAE;oBACtC,sGAAsG;oBACtG,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,aAAa;wBAAE,OAAO,EAAE,EAAE,CAAC;gBAChD,CAAC,aAEA,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,KAAC,SAAS,IAAC,SAAS,EAAE,SAAS,GAAI,EACxE,KAAK,IAAI,KAAC,KAAK,IAAC,KAAK,EAAE,KAAK,GAAI,EAChC,KAAK,IAAI,KAAC,KAAK,IAAC,KAAK,EAAE,KAAK,GAAI,EAChC,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CACzC,KAAC,oBAAoB,IAAC,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAI,CAC1E,IACgB,EAClB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,KAAC,oBAAoB,KAAG,EACrE,KAAC,KAAK,IAAC,KAAK,EAAE,KAAK,GAAI,EACtB,KAAK,IAAI,KAAC,WAAW,IAAC,KAAK,EAAE,KAAK,GAAI,IACtC,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC","sourcesContent":["import { useState, useEffect, useCallback, useMemo, useContext } from 'react';\nimport type { ElementType, MouseEvent } from 'react';\n\nimport Button from '../Button';\nimport Grid from '../Grid';\nimport Icon from '../Icon';\nimport Image from '../Image';\nimport Link from '../Link';\nimport Tooltip from '../Tooltip';\nimport VisuallyHiddenText from '../VisuallyHiddenText';\nimport { useI18n, useElement } from '../../hooks';\nimport { isValidElement } from '../../utils';\n\nimport NavigationList from './NavigationList';\nimport AppShellContext, { AppShellDrawerContext } from './AppShellContext';\nimport AppShellDrawer from './Drawer';\nimport { AppShellSearch } from './AppShellSearch';\nimport {\n StyledAppInfo,\n StyledCaseTypes,\n StyledScrollWrap,\n StyledUtils,\n StyledNavCasesList,\n StyledCountIcon,\n StyledUtilIconCount,\n StyledAppShellTooltip,\n StyledUtilsSeparator,\n StyledAIAssistant\n} from './AppShell.styles';\nimport type {\n AgentProps,\n AppInfoProps,\n CaseProps,\n CaseTypeProps,\n LinkProps,\n NavListItemProps,\n UtilItemProps,\n UtilsProps\n} from './AppShell.types';\nimport type { AppNavigationPanelProps } from './AppNavigationPanel.types';\n\nexport const CaseTypes = ({\n caseTypes,\n mobileNavBar\n}: {\n caseTypes: CaseTypeProps[];\n mobileNavBar?: boolean;\n}) => {\n const t = useI18n();\n\n const transformedCaseTypes = caseTypes.map(caseType => {\n return {\n ...caseType,\n visual: caseType.icon ? <Icon name={caseType.icon} /> : undefined,\n primary: caseType.name\n };\n });\n\n return useMemo(\n () => (\n <StyledCaseTypes>\n <NavigationList\n items={[\n {\n primary: t('app_shell_create'),\n visual: <Icon name='plus' />,\n items: transformedCaseTypes\n }\n ]}\n mobileNavBar={mobileNavBar}\n />\n </StyledCaseTypes>\n ),\n [caseTypes, mobileNavBar]\n );\n};\n\nexport const Links = (props: { links: LinkProps[]; mobileNavBar?: boolean }) => {\n const { links, mobileNavBar } = props;\n const [transformedLinks, setTransformedLinks] = useState<NavListItemProps[]>([]);\n\n // TODO: Can this be a memo instead of a state and an effect?\n const mergedNavLinks = (items: LinkProps[]): NavListItemProps[] => {\n return items.map((link: LinkProps) => {\n return {\n ...link,\n primary: link.name,\n 'aria-current': link.active ? 'page' : null,\n visual: link.icon ? <Icon name={link.icon} emphasized={link.active} /> : null,\n onClick: link.links ? undefined : link.onClick,\n items: link.links ? mergedNavLinks(link.links) : undefined\n };\n });\n };\n\n useEffect(() => {\n setTransformedLinks(mergedNavLinks(links));\n }, [links]);\n\n if (!links.length) return null;\n\n return (\n <div>\n <NavigationList items={transformedLinks} mobileNavBar={mobileNavBar} />\n </div>\n );\n};\n\nconst AIAssistant = ({ agent }: { agent: AgentProps }) => (\n <StyledAIAssistant>\n <NavigationList\n items={[\n {\n id: agent.id,\n primary: agent.name,\n visual: agent.icon,\n 'aria-current': agent.active ? 'page' : null,\n onClick: agent.onClick\n }\n ]}\n />\n </StyledAIAssistant>\n);\n\nconst Cases = (props: { cases: CaseProps[] }) => {\n const { cases } = props;\n\n const setupCases = (items: CaseProps[]): NavListItemProps[] => {\n return items.map((item: CaseProps) => {\n const {\n id,\n primary,\n secondary,\n collapsedItemInfo,\n visual = <Icon name='case-solid' />,\n active,\n onClick,\n onDismiss,\n ...restProps\n } = item;\n return {\n ...restProps,\n id,\n 'aria-current': active ? 'page' : undefined,\n primary,\n secondary,\n collapsedItemInfo,\n active: !!active,\n onClick,\n onDismiss,\n visual\n };\n });\n };\n\n return (\n <StyledNavCasesList>\n <NavigationList items={setupCases(cases)} />\n </StyledNavCasesList>\n );\n};\n\nexport const Utils = ({ items }: UtilsProps) => {\n const { navOpen, navState, drawerOpen, setDrawerOpen } = useContext(AppShellContext);\n const [item, setItem] = useState<UtilItemProps>();\n\n useEffect(() => {\n if (drawerOpen && item) {\n setItem(\n items?.find<UtilItemProps>(\n (utilItem): utilItem is UtilItemProps =>\n !isValidElement(utilItem) && utilItem.name === item.name\n )\n );\n }\n }, [items]);\n\n const transform = useCallback(\n (utilItem: UtilItemProps): NavListItemProps => {\n const uItem = { ...utilItem };\n delete uItem.onDrawerClose;\n delete uItem.onDrawerOpen;\n return {\n onClick: () => {\n if (utilItem.drawerView) {\n setItem(utilItem);\n }\n },\n ...uItem,\n primary: utilItem.name,\n visual: utilItem.count ? (\n <StyledUtilIconCount>\n {utilItem.visual}\n <StyledCountIcon variant='urgent' id={`${utilItem.name}-count`}>\n {utilItem.count}\n </StyledCountIcon>\n </StyledUtilIconCount>\n ) : (\n utilItem.visual\n ),\n collapseItems: !navOpen\n };\n },\n [navOpen]\n );\n\n const utilItems = useMemo(() => {\n return [\n ...(items ?? []).map(uItem => {\n return isValidElement(uItem) ? uItem : transform(uItem);\n })\n ];\n }, [items, transform]);\n\n useEffect(() => {\n if (item) setDrawerOpen(true);\n }, [item]);\n\n useEffect(() => {\n if (navState === 'closed' || navState === 'closing') setDrawerOpen(false);\n }, [navState]);\n\n // setDrawerOpen comes from AppShellContext (raw useState setter — stable reference).\n // setItem is the local useState setter — also stable. Neither needs to be in deps.\n // openDrawer and refreshDrawer have identical bodies: both spread `next` to create\n // a new object reference so useEffect([item]) always fires, even when the same item\n // is re-opened. The semantic distinction is: openDrawer starts a new drawer session\n // (useEffect triggers setDrawerOpen(true)); refreshDrawer replaces an already-open\n // item's content (setDrawerOpen(true) is a no-op when already open).\n const ctxValue = useMemo(\n () => ({\n drawerOpen,\n openItemName: item?.name,\n closeDrawer: () => {\n setDrawerOpen(false);\n },\n openDrawer: (next: UtilItemProps) => {\n setItem({ ...next });\n },\n refreshDrawer: (next: UtilItemProps) => {\n setItem({ ...next });\n }\n }),\n [drawerOpen, item?.name]\n );\n\n return (\n <AppShellDrawerContext.Provider value={ctxValue}>\n <StyledUtils>\n <NavigationList items={utilItems} collapsed />\n </StyledUtils>\n\n {item && (\n <AppShellDrawer\n drawerOpen={drawerOpen}\n setDrawerOpen={setDrawerOpen}\n content={item.drawerView}\n header={item.drawerHeader || item.name}\n onDrawerClose={() => {\n setItem(undefined);\n item.onDrawerClose?.();\n }}\n onDrawerOpen={item.onDrawerOpen}\n />\n )}\n </AppShellDrawerContext.Provider>\n );\n};\n\nconst AppInfo = ({ appInfo }: { appInfo: AppInfoProps }) => {\n const [appInfoEl, setAppInfoEl] = useElement<HTMLAnchorElement>();\n const { navState } = useContext(AppShellContext);\n\n const {\n appName,\n portalName,\n href: appInfoHref,\n onClick: appInfoOnClick,\n imageSrc: logoSrc,\n appNameHidden,\n ...appInfoRestProps\n } = appInfo;\n\n let appInfoAs: ElementType = 'div';\n if (appInfoHref) appInfoAs = Link;\n else if (appInfoOnClick) appInfoAs = Button;\n\n return (\n <>\n <StyledAppInfo\n as={Grid}\n forwardedAs={appInfoAs}\n variant='link'\n href={appInfoHref}\n onClick={appInfoOnClick}\n aria-label={`${appName}${portalName ? ` - ${portalName}` : ''}`}\n {...appInfoRestProps}\n container={{\n alignItems: 'center',\n areas: portalName ? '\"logo app\" \"logo portal\"' : '\"logo app\"'\n }}\n ref={setAppInfoEl}\n icon\n >\n <Grid item={{ area: 'logo' }} as={Image} src={logoSrc} alt={appName} />\n <Grid item={{ area: 'app' }} as={appNameHidden ? VisuallyHiddenText : 'span'}>\n {appName}\n </Grid>\n {portalName && (\n <Grid item={{ area: 'portal' }} as='span'>\n {portalName}\n </Grid>\n )}\n </StyledAppInfo>\n {navState === 'closed' && (!appNameHidden || portalName) && (\n <Tooltip\n target={appInfoEl}\n placement='right'\n as={StyledAppShellTooltip}\n showDelay='none'\n hideDelay='none'\n >\n {`${appNameHidden ? '' : appName} ${portalName ?? ''}`.trim()}\n </Tooltip>\n )}\n </>\n );\n};\n\nconst AppNavigationPanel = ({\n appInfo,\n navState,\n searchInput,\n searchLabel,\n onClick,\n caseTypes,\n links,\n cases,\n utils,\n agent\n}: AppNavigationPanelProps) => {\n return (\n <>\n {appInfo && <AppInfo appInfo={appInfo} />}\n {searchInput && (\n <AppShellSearch\n searchLabel={searchLabel}\n collapsed={['closed', 'closing'].includes(navState)}\n searchInput={searchInput}\n />\n )}\n <StyledScrollWrap\n container={{ direction: 'column' }}\n item={{ grow: 1 }}\n tabIndex={-1}\n onClick={(e: MouseEvent<HTMLElement>) => {\n // Ensure that clicks on the container (not on interactive child elements) trigger the onClick handler\n if (e.target === e.currentTarget) onClick?.();\n }}\n >\n {caseTypes && caseTypes.length > 0 && <CaseTypes caseTypes={caseTypes} />}\n {links && <Links links={links} />}\n {cases && <Cases cases={cases} />}\n {['open', 'opening'].includes(navState) && (\n <StyledUtilsSeparator navOpen={['open', 'opening'].includes(navState)} />\n )}\n </StyledScrollWrap>\n {['closed', 'closing'].includes(navState) && <StyledUtilsSeparator />}\n <Utils items={utils} />\n {agent && <AIAssistant agent={agent} />}\n </>\n );\n};\n\nexport default AppNavigationPanel;\n"]}
@@ -47,7 +47,7 @@ const List = ({ headingText, emptyText, items, loading = false, displayPins = fa
47
47
  onPinToggle?.(id);
48
48
  onItemPinToggle?.(id);
49
49
  }
50
- }, role: 'button', tabIndex: 0, label: t(pinned ? 'app_shell_unpin' : 'app_shell_pin'), "aria-label": `${t(pinned ? 'app_shell_unpin' : 'app_shell_pin')} - ${primary}`, children: _jsx(Icon, { name: pinned ? 'pin-solid' : 'pin' }) })) : undefined, tabIndex: 0 }) }, id));
50
+ }, role: 'button', tabIndex: 0, label: t(pinned ? 'app_shell_unpin' : 'app_shell_pin'), "aria-label": `${t(pinned ? 'app_shell_unpin' : 'app_shell_pin')} - ${primary}`, children: _jsx(Icon, { name: pinned ? 'pin-solid' : 'pin', emphasized: pinned }) })) : undefined, tabIndex: 0 }) }, id));
51
51
  }) })) : (_jsx(Flex, { as: EmptyStateColorContrast, container: { justify: 'center', alignItems: 'center' }, item: { grow: 1 }, children: _jsx(EmptyState, { message: emptyText }) }));
52
52
  return (_jsxs(Flex, { as: StyledAppShellListSection, container: { direction: 'column' }, children: [headingText && (_jsx(Text, { variant: 'h3', as: StyledAppShellListHeading, children: headingText })), loading ? (_jsx(Flex, { container: { justify: 'center', alignItems: 'center' }, item: { grow: 1 }, children: _jsx(Progress, { as: StyledLoading, placement: 'inline' }) })) : (renderContent), (viewAllProps?.href || viewAllProps?.onClick) && !!items.length && !loading && (_jsx(StyledDrawerViewAll, { ...viewAllProps, as: viewAllProps.href ? 'a' : 'button', children: t('view_all') }))] }));
53
53
  };
@@ -1 +1 @@
1
- {"version":3,"file":"AppShellList.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShellList.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC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C,CAAC,UAAU,CAAC,GACM,CACvB,IACI,CACR,CAAC;AACJ,CAAC,CAAC;AACF,MAAM,YAAY,GAAyC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC1E,OAAO,CACL,KAAC,IAAI,IAAC,EAAE,EAAE,yBAAyB,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,YACpE,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CACxB,eAAC,IAAI,OAAK,QAAQ,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,GAAI,CACzC,CAAC,GACG,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { useContext, useRef } from 'react';\nimport type { FunctionComponent, Ref, MouseEvent, ReactNode, KeyboardEvent } from 'react';\n\nimport type { BaseProps, ForwardProps } from '../../types';\nimport Alert from '../Badges/Alert';\nimport Button from '../Button';\nimport Flex from '../Flex';\nimport Icon, { registerIcon } from '../Icon';\nimport * as pinIcon from '../Icon/icons/pin.icon';\nimport * as pinSolidIcon from '../Icon/icons/pin-solid.icon';\nimport MetaList from '../MetaList';\nimport EmptyState from '../EmptyState';\nimport Progress from '../Progress';\nimport SummaryItem from '../SummaryItem';\nimport Text from '../Text';\nimport { useI18n } from '../../hooks';\n\nimport { StyledLoading } from './AppShell.styles';\nimport {\n StyledAppShellListWrapper,\n StyledAppShellList,\n StyledAppShellSummaryList,\n StyledAppShellMetaList,\n StyledNotificationPrimary,\n StyledNotificationSecondary,\n StyledAppShellPinButton,\n EmptyStateColorContrast,\n StyledAppShellListSection,\n StyledAppShellListHeading,\n StyledNotificationVisual\n} from './AppShellList.styles';\nimport { StyledDrawerViewAll } from './Drawer.styles';\nimport { AppShellDrawerContext } from './AppShellContext';\n\nregisterIcon(pinIcon, pinSolidIcon);\n\nexport type ListInteractionEvent = MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>;\nexport interface ListProps {\n /** An id representing the item. */\n id: string;\n ref?: Ref<HTMLDivElement>;\n items: (AppShellListItemProps & ForwardProps)[];\n headingText?: string;\n emptyText: string;\n loading?: boolean;\n viewAll?: {\n onClick?: (e: MouseEvent) => void;\n href?: string;\n } & ForwardProps;\n newNotifications?: number;\n displayPins?: boolean;\n onItemClick?: (id: string, event: ListInteractionEvent) => void;\n onItemPinToggle?: (id: string) => void;\n}\nexport interface AppShellListProps {\n listView: ListProps[];\n}\nexport interface AppShellListItemProps extends BaseProps {\n /** An id representing the item. */\n id: string;\n /** The primary text for the item. */\n primary: string;\n /** Secondary text that will be rendered as a Meta List. */\n secondary?: string[];\n /** A visual associated with the item. */\n visual?: ReactNode;\n /** A flag indicating if the item has been read. */\n unread?: boolean;\n /** Icon for displaying at the end of items */\n pinned?: boolean;\n /** URL or DOM id to navigate to. */\n href?: string;\n /** The onClick handler for the item. */\n onClick?: (id: string, event: ListInteractionEvent) => void;\n /** The handler hat is called when a pin icon is toggled on an item. */\n onPinToggle?: (id: string) => void;\n}\n\nconst List = ({\n headingText,\n emptyText,\n items,\n loading = false,\n displayPins = false,\n onItemClick,\n onItemPinToggle,\n viewAll: viewAllProps\n}: ListProps) => {\n const t = useI18n();\n const { closeDrawer } = useContext(AppShellDrawerContext);\n const pinButtons = useRef<Record<string, HTMLElement>>({});\n\n const renderContent = items.length ? (\n <Flex as={StyledAppShellList} item={{ grow: 1 }}>\n {items.map(\n ({\n id,\n primary,\n secondary,\n visual,\n unread,\n href,\n onClick,\n pinned,\n onPinToggle,\n ...restProps\n }: AppShellListItemProps) => {\n const onSummaryItemClick = (e: ListInteractionEvent) => {\n onClick?.(id, e);\n onItemClick?.(id, e);\n\n if (!pinButtons.current[id]?.contains(e.target as Node)) {\n closeDrawer();\n }\n };\n\n return (\n <StyledAppShellSummaryList key={id}>\n <SummaryItem\n {...restProps}\n as={href ? 'a' : 'button'}\n primary={\n <StyledNotificationPrimary unread={unread}>{primary}</StyledNotificationPrimary>\n }\n secondary={\n secondary?.length ? (\n <StyledNotificationSecondary unread={unread}>\n <MetaList as={StyledAppShellMetaList} items={secondary} />\n </StyledNotificationSecondary>\n ) : undefined\n }\n visual={\n visual || unread ? (\n <StyledNotificationVisual unread={unread} visualIncluded={!!visual}>\n {visual} <Alert variant='urgent' />\n </StyledNotificationVisual>\n ) : undefined\n }\n href={href}\n onClick={onSummaryItemClick}\n onKeyDown={(e: KeyboardEvent<HTMLElement>) => {\n if (e.key === 'Enter' || e.key === ' ') {\n onSummaryItemClick(e);\n }\n }}\n actions={\n displayPins ? (\n <Button\n ref={el => {\n if (!el) delete pinButtons.current[id];\n else pinButtons.current[id] = el;\n }}\n icon\n as={StyledAppShellPinButton}\n forwardedAs='div'\n onClick={() => {\n onPinToggle?.(id);\n onItemPinToggle?.(id);\n }}\n onKeyDown={(e: KeyboardEvent<HTMLElement>) => {\n if (e.key === 'Enter') {\n onPinToggle?.(id);\n onItemPinToggle?.(id);\n }\n }}\n role='button'\n tabIndex={0}\n label={t(pinned ? 'app_shell_unpin' : 'app_shell_pin')}\n aria-label={`${t(pinned ? 'app_shell_unpin' : 'app_shell_pin')} - ${primary}`}\n >\n <Icon name={pinned ? 'pin-solid' : 'pin'} />\n </Button>\n ) : undefined\n }\n tabIndex={0}\n />\n </StyledAppShellSummaryList>\n );\n }\n )}\n </Flex>\n ) : (\n <Flex\n as={EmptyStateColorContrast}\n container={{ justify: 'center', alignItems: 'center' }}\n item={{ grow: 1 }}\n >\n <EmptyState message={emptyText} />\n </Flex>\n );\n\n return (\n <Flex as={StyledAppShellListSection} container={{ direction: 'column' }}>\n {headingText && (\n <Text variant='h3' as={StyledAppShellListHeading}>\n {headingText}\n </Text>\n )}\n {loading ? (\n <Flex container={{ justify: 'center', alignItems: 'center' }} item={{ grow: 1 }}>\n <Progress as={StyledLoading} placement='inline' />\n </Flex>\n ) : (\n renderContent\n )}\n {(viewAllProps?.href || viewAllProps?.onClick) && !!items.length && !loading && (\n <StyledDrawerViewAll {...viewAllProps} as={viewAllProps.href ? 'a' : 'button'}>\n {t('view_all')}\n </StyledDrawerViewAll>\n )}\n </Flex>\n );\n};\nconst AppShellList: FunctionComponent<AppShellListProps> = ({ listView }) => {\n return (\n <Flex as={StyledAppShellListWrapper} container={{ direction: 'column' }}>\n {listView.map(listItem => (\n <List {...listItem} key={listItem.id} />\n ))}\n </Flex>\n );\n};\n\nexport default AppShellList;\n"]}
1
+ {"version":3,"file":"AppShellList.js","sourceRoot":"","sources":["../../../src/components/AppShell/AppShellList.tsx"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAI3C,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAC;AAClD,OAAO,KAAK,YAAY,MAAM,8BAA8B,CAAC;AAC7D,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,QAAQ,MAAM,aAAa,CAAC;AACnC,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EACL,yBAAyB,EACzB,kBAAkB,EAClB,yBAAyB,EACzB,sBAAsB,EACtB,yBAAyB,EACzB,2BAA2B,EAC3B,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CA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,EAAE,IAAI,EAAE,CAAC,EAAE,YAC7E,KAAC,QAAQ,IAAC,EAAE,EAAE,aAAa,EAAE,SAAS,EAAC,QAAQ,GAAG,GAC7C,CACR,CAAC,CAAC,CAAC,CACF,aAAa,CACd,EACA,CAAC,YAAY,EAAE,IAAI,IAAI,YAAY,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,OAAO,IAAI,CAC9E,KAAC,mBAAmB,OAAK,YAAY,EAAE,EAAE,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,YAC1E,CAAC,CAAC,UAAU,CAAC,GACM,CACvB,IACI,CACR,CAAC;AACJ,CAAC,CAAC;AACF,MAAM,YAAY,GAAyC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IAC1E,OAAO,CACL,KAAC,IAAI,IAAC,EAAE,EAAE,yBAAyB,EAAE,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,YACpE,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CACxB,eAAC,IAAI,OAAK,QAAQ,EAAE,GAAG,EAAE,QAAQ,CAAC,EAAE,GAAI,CACzC,CAAC,GACG,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import { useContext, useRef } from 'react';\nimport type { FunctionComponent, Ref, MouseEvent, ReactNode, KeyboardEvent } from 'react';\n\nimport type { BaseProps, ForwardProps } from '../../types';\nimport Alert from '../Badges/Alert';\nimport Button from '../Button';\nimport Flex from '../Flex';\nimport Icon, { registerIcon } from '../Icon';\nimport * as pinIcon from '../Icon/icons/pin.icon';\nimport * as pinSolidIcon from '../Icon/icons/pin-solid.icon';\nimport MetaList from '../MetaList';\nimport EmptyState from '../EmptyState';\nimport Progress from '../Progress';\nimport SummaryItem from '../SummaryItem';\nimport Text from '../Text';\nimport { useI18n } from '../../hooks';\n\nimport { StyledLoading } from './AppShell.styles';\nimport {\n StyledAppShellListWrapper,\n StyledAppShellList,\n StyledAppShellSummaryList,\n StyledAppShellMetaList,\n StyledNotificationPrimary,\n StyledNotificationSecondary,\n StyledAppShellPinButton,\n EmptyStateColorContrast,\n StyledAppShellListSection,\n StyledAppShellListHeading,\n StyledNotificationVisual\n} from './AppShellList.styles';\nimport { StyledDrawerViewAll } from './Drawer.styles';\nimport { AppShellDrawerContext } from './AppShellContext';\n\nregisterIcon(pinIcon, pinSolidIcon);\n\nexport type ListInteractionEvent = MouseEvent<HTMLElement> | KeyboardEvent<HTMLElement>;\nexport interface ListProps {\n /** An id representing the item. */\n id: string;\n ref?: Ref<HTMLDivElement>;\n items: (AppShellListItemProps & ForwardProps)[];\n headingText?: string;\n emptyText: string;\n loading?: boolean;\n viewAll?: {\n onClick?: (e: MouseEvent) => void;\n href?: string;\n } & ForwardProps;\n newNotifications?: number;\n displayPins?: boolean;\n onItemClick?: (id: string, event: ListInteractionEvent) => void;\n onItemPinToggle?: (id: string) => void;\n}\nexport interface AppShellListProps {\n listView: ListProps[];\n}\nexport interface AppShellListItemProps extends BaseProps {\n /** An id representing the item. */\n id: string;\n /** The primary text for the item. */\n primary: string;\n /** Secondary text that will be rendered as a Meta List. */\n secondary?: string[];\n /** A visual associated with the item. */\n visual?: ReactNode;\n /** A flag indicating if the item has been read. */\n unread?: boolean;\n /** Icon for displaying at the end of items */\n pinned?: boolean;\n /** URL or DOM id to navigate to. */\n href?: string;\n /** The onClick handler for the item. */\n onClick?: (id: string, event: ListInteractionEvent) => void;\n /** The handler hat is called when a pin icon is toggled on an item. */\n onPinToggle?: (id: string) => void;\n}\n\nconst List = ({\n headingText,\n emptyText,\n items,\n loading = false,\n displayPins = false,\n onItemClick,\n onItemPinToggle,\n viewAll: viewAllProps\n}: ListProps) => {\n const t = useI18n();\n const { closeDrawer } = useContext(AppShellDrawerContext);\n const pinButtons = useRef<Record<string, HTMLElement>>({});\n\n const renderContent = items.length ? (\n <Flex as={StyledAppShellList} item={{ grow: 1 }}>\n {items.map(\n ({\n id,\n primary,\n secondary,\n visual,\n unread,\n href,\n onClick,\n pinned,\n onPinToggle,\n ...restProps\n }: AppShellListItemProps) => {\n const onSummaryItemClick = (e: ListInteractionEvent) => {\n onClick?.(id, e);\n onItemClick?.(id, e);\n\n if (!pinButtons.current[id]?.contains(e.target as Node)) {\n closeDrawer();\n }\n };\n\n return (\n <StyledAppShellSummaryList key={id}>\n <SummaryItem\n {...restProps}\n as={href ? 'a' : 'button'}\n primary={\n <StyledNotificationPrimary unread={unread}>{primary}</StyledNotificationPrimary>\n }\n secondary={\n secondary?.length ? (\n <StyledNotificationSecondary unread={unread}>\n <MetaList as={StyledAppShellMetaList} items={secondary} />\n </StyledNotificationSecondary>\n ) : undefined\n }\n visual={\n visual || unread ? (\n <StyledNotificationVisual unread={unread} visualIncluded={!!visual}>\n {visual} <Alert variant='urgent' />\n </StyledNotificationVisual>\n ) : undefined\n }\n href={href}\n onClick={onSummaryItemClick}\n onKeyDown={(e: KeyboardEvent<HTMLElement>) => {\n if (e.key === 'Enter' || e.key === ' ') {\n onSummaryItemClick(e);\n }\n }}\n actions={\n displayPins ? (\n <Button\n ref={el => {\n if (!el) delete pinButtons.current[id];\n else pinButtons.current[id] = el;\n }}\n icon\n as={StyledAppShellPinButton}\n forwardedAs='div'\n onClick={() => {\n onPinToggle?.(id);\n onItemPinToggle?.(id);\n }}\n onKeyDown={(e: KeyboardEvent<HTMLElement>) => {\n if (e.key === 'Enter') {\n onPinToggle?.(id);\n onItemPinToggle?.(id);\n }\n }}\n role='button'\n tabIndex={0}\n label={t(pinned ? 'app_shell_unpin' : 'app_shell_pin')}\n aria-label={`${t(pinned ? 'app_shell_unpin' : 'app_shell_pin')} - ${primary}`}\n >\n <Icon name={pinned ? 'pin-solid' : 'pin'} emphasized={pinned} />\n </Button>\n ) : undefined\n }\n tabIndex={0}\n />\n </StyledAppShellSummaryList>\n );\n }\n )}\n </Flex>\n ) : (\n <Flex\n as={EmptyStateColorContrast}\n container={{ justify: 'center', alignItems: 'center' }}\n item={{ grow: 1 }}\n >\n <EmptyState message={emptyText} />\n </Flex>\n );\n\n return (\n <Flex as={StyledAppShellListSection} container={{ direction: 'column' }}>\n {headingText && (\n <Text variant='h3' as={StyledAppShellListHeading}>\n {headingText}\n </Text>\n )}\n {loading ? (\n <Flex container={{ justify: 'center', alignItems: 'center' }} item={{ grow: 1 }}>\n <Progress as={StyledLoading} placement='inline' />\n </Flex>\n ) : (\n renderContent\n )}\n {(viewAllProps?.href || viewAllProps?.onClick) && !!items.length && !loading && (\n <StyledDrawerViewAll {...viewAllProps} as={viewAllProps.href ? 'a' : 'button'}>\n {t('view_all')}\n </StyledDrawerViewAll>\n )}\n </Flex>\n );\n};\nconst AppShellList: FunctionComponent<AppShellListProps> = ({ listView }) => {\n return (\n <Flex as={StyledAppShellListWrapper} container={{ direction: 'column' }}>\n {listView.map(listItem => (\n <List {...listItem} key={listItem.id} />\n ))}\n </Flex>\n );\n};\n\nexport default AppShellList;\n"]}
@@ -1,11 +1,44 @@
1
1
  import type { Ref } from 'react';
2
2
  import type { ForwardRefForwardPropsComponent, BaseProps } from '../../types';
3
3
  import type { FileVisualProps } from './FileVisual';
4
+ interface FileMetadataFieldBase {
5
+ /** Unique identifier for this metadata field. */
6
+ id: string;
7
+ /** Display label for the field. */
8
+ label: string;
9
+ /** Additional info shown alongside the field label. */
10
+ additionalInfo?: {
11
+ heading?: string;
12
+ content: string;
13
+ };
14
+ /** Callback fired when the field value changes. */
15
+ onChange: (value: string) => void;
16
+ }
17
+ export interface FileMetadataTextField extends FileMetadataFieldBase {
18
+ /** Current value of the text input. */
19
+ value?: string;
20
+ selected?: never;
21
+ options?: never;
22
+ }
23
+ export interface FileMetadataSelectField extends FileMetadataFieldBase {
24
+ /** The id of the currently selected option. */
25
+ selected?: string;
26
+ /** Selectable options rendered as a ComboBox. */
27
+ options: {
28
+ id: string;
29
+ label: string;
30
+ }[];
31
+ value?: never;
32
+ }
33
+ export type FileMetadataField = FileMetadataTextField | FileMetadataSelectField;
34
+ export type FileMetadata = FileMetadataField[];
4
35
  export interface FileItemProps extends BaseProps {
5
36
  /** Unique id for item. */
6
37
  id: string;
7
38
  /** Name of the file. */
8
39
  name: string;
40
+ /** File metadata and edit configuration. When provided, enables edit mode with stacked single-column layout and inline editable fields. */
41
+ metadata?: FileMetadata;
9
42
  /** A string to be used as an image src for a attachment thumbnail. Falls back to a provided icon or the default attachment icon. */
10
43
  thumbnail?: FileVisualProps['thumbnail'];
11
44
  /** File extension. Use 'url' for link */
@@ -49,9 +82,14 @@ export declare const StyledPreviewTitle: import("styled-components/dist/types").
49
82
  export declare const StyledTextTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<import("../Text").TextProps, "ref"> & import("react").RefAttributes<HTMLHeadingElement | HTMLSpanElement> & import("../../types").ForwardProps, "ref"> & {
50
83
  ref?: ((instance: HTMLHeadingElement | HTMLSpanElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLHeadingElement | HTMLSpanElement> | null | undefined;
51
84
  }, never>> & string & Omit<ForwardRefForwardPropsComponent<import("../Text").TextProps>, keyof import("react").Component<any, {}, any>>;
85
+ export declare const StyledErrorTextTitle: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<Omit<Omit<import("../Text").TextProps, "ref"> & import("react").RefAttributes<HTMLHeadingElement | HTMLSpanElement> & import("../../types").ForwardProps, "ref"> & {
86
+ ref?: ((instance: HTMLHeadingElement | HTMLSpanElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLHeadingElement | HTMLSpanElement> | null | undefined;
87
+ }, never>, never>> & string;
52
88
  export declare const StyledFileItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
53
89
  compactMode: FileItemProps["compact"];
54
90
  isDisabled?: FileItemProps["disabled"];
91
+ hasMetadata?: boolean;
92
+ isErrorOrProgressItem?: boolean;
55
93
  }>> & string;
56
94
  declare const FileItem: ForwardRefForwardPropsComponent<FileItemProps>;
57
95
  export default FileItem;
@@ -1 +1 @@
1
- {"version":3,"file":"FileItem.d.ts","sourceRoot":"","sources":["../../../src/components/File/FileItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAmB,GAAG,EAAuC,MAAM,OAAO,CAAC;AAYvF,OAAO,KAAK,EAAE,+BAA+B,EAAE,SAAS,EAAU,MAAM,aAAa,CAAC;AAyBtF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAIpD,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C,0BAA0B;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,oIAAoI;IACpI,SAAS,CAAC,EAAE,eAAe,CAAC,WAAW,CAAC,CAAC;IACzC,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,8IAA8I;IAC9I,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,aAAa,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;IAC7C,yGAAyG;IACzG,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,aAAa,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;IAC3C,6IAA6I;IAC7I,SAAS,CAAC,EAAE,CAAC,EAAE,EAAE,aAAa,CAAC,IAA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AM,QAAQ,EAAE,+BAA+B,CAAC,aAAa,CAoY3D,CAAC;AAEH,eAAe,QAAQ,CAAC"}
@@ -2,6 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import { forwardRef, useEffect, useState } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
4
  import Icon, { registerIcon } from '../Icon';
5
+ import Input from '../Input';
6
+ import ComboBox from '../ComboBox';
5
7
  import * as openIcon from '../Icon/icons/open.icon';
6
8
  import * as timesIcon from '../Icon/icons/times.icon';
7
9
  import * as previewIcon from '../Icon/icons/preview.icon';
@@ -18,8 +20,9 @@ import Progress from '../Progress';
18
20
  import { StyledProgressRing } from '../Progress/Progress.styles';
19
21
  import { formatNumber } from '../Number';
20
22
  import Flex from '../Flex';
23
+ import Grid from '../Grid';
21
24
  import { StyledIconShape } from '../Icon/Icon';
22
- import { getActiveElement, getFocusables } from '../../utils';
25
+ import { getActiveElement, getFocusables, isInstance } from '../../utils';
23
26
  import { ellipsisOverflow } from '../../styles/mixins';
24
27
  import { StyledLinkPopover, StyledLinkPreviewPopoverBtn } from '../Link/Link';
25
28
  import Popover from '../Popover';
@@ -34,6 +37,28 @@ const StyledErrorIcon = styled(Icon)(({ theme }) => {
34
37
  `;
35
38
  });
36
39
  StyledErrorIcon.defaultProps = defaultThemeProp;
40
+ const StyledStatusVisualInEditableLayout = styled.div(({ theme: { components: { input } } }) => {
41
+ return css `
42
+ min-inline-size: ${input.height};
43
+ min-block-size: ${input.height};
44
+
45
+ > ${StyledErrorIcon} {
46
+ margin-inline-start: 0;
47
+ }
48
+
49
+ > ${StyledProgressRing} {
50
+ margin-inline-start: 0;
51
+ inline-size: ${input.height};
52
+ block-size: ${input.height};
53
+
54
+ > svg {
55
+ width: 100%;
56
+ height: 100%;
57
+ }
58
+ }
59
+ `;
60
+ });
61
+ StyledStatusVisualInEditableLayout.defaultProps = defaultThemeProp;
37
62
  const titleEllipsisStyle = css `
38
63
  flex-shrink: 1;
39
64
  ${ellipsisOverflow}
@@ -44,11 +69,17 @@ export const StyledPreviewTitle = styled(Button) `
44
69
  export const StyledTextTitle = styled(Text) `
45
70
  ${titleEllipsisStyle}
46
71
  `;
47
- const StyledMeta = styled(StyledText)(({ theme, error }) => {
72
+ export const StyledErrorTextTitle = styled(StyledTextTitle)(({ theme }) => {
73
+ return css `
74
+ font-weight: ${theme.base['font-weight']['semi-bold']};
75
+ `;
76
+ });
77
+ StyledErrorTextTitle.defaultProps = defaultThemeProp;
78
+ const StyledMeta = styled(StyledText)(({ theme, error, alignStart }) => {
48
79
  return css `
49
80
  /* min width to show percentage in full */
50
81
  min-width: 4ch;
51
- margin-inline-start: auto;
82
+ margin-inline-start: ${alignStart ? 'unset' : 'auto'};
52
83
  ${titleEllipsisStyle}
53
84
  ${error &&
54
85
  css `
@@ -63,14 +94,51 @@ const StyledActionsWrapper = styled.div(({ meta }) => {
63
94
  `;
64
95
  });
65
96
  StyledActionsWrapper.defaultProps = defaultThemeProp;
66
- export const StyledFileItem = styled.div(({ theme: { base: { palette, spacing, 'hit-area': { compact }, 'disabled-opacity': disabledOpacity }, components: { input, 'form-control': { ':disabled': { 'background-color': disabledBackgroundColor, 'border-color': disabledBorderColor } } } }, compactMode, isDisabled }) => {
97
+ const StyledMetadataGrid = styled(Grid)(({ theme }) => {
98
+ return css `
99
+ grid-template-columns: repeat(2, 1fr);
100
+
101
+ @container (width < ${theme.base.breakpoints.sm}) {
102
+ grid-template-columns: 1fr;
103
+ }
104
+ `;
105
+ });
106
+ StyledMetadataGrid.defaultProps = defaultThemeProp;
107
+ export const StyledFileItem = styled.div(({ theme: { base: { palette, spacing, 'hit-area': { compact, 'compact-min': compactMin, 'mouse-min': mouseMin, 'finger-min': fingerMin }, 'disabled-opacity': disabledOpacity }, components: { input, 'form-control': { ':disabled': { 'background-color': disabledBackgroundColor, 'border-color': disabledBorderColor } } } }, compactMode, isDisabled, hasMetadata, isErrorOrProgressItem }) => {
108
+ const labelOffset = `calc(${compactMin} + 0.25 * ${spacing})`;
67
109
  return css `
68
110
  border-radius: calc(var(--container-border-radius) * 0.5);
69
111
  border: 0.0625rem solid ${palette['border-line']};
70
- background-color: ${palette['primary-background']};
112
+ ${!hasMetadata &&
113
+ css `
114
+ background-color: ${palette['primary-background']};
115
+ `}
71
116
  height: ${input.height};
72
117
  min-width: calc(${input.height} + 12ch + 1.5 * ${spacing} + ${compact});
73
118
 
119
+ ${hasMetadata &&
120
+ css `
121
+ container-type: inline-size;
122
+ border: none;
123
+ border-block-start: 0.0625rem solid ${palette['border-line']};
124
+ border-start-start-radius: 0;
125
+ border-start-end-radius: 0;
126
+ height: auto;
127
+ min-height: ${input.height};
128
+
129
+ &:first-child {
130
+ border-block-start: none;
131
+ }
132
+
133
+ > ${StyledActionsWrapper} {
134
+ align-self: flex-start;
135
+ margin-block-start: ${isErrorOrProgressItem ? '0' : labelOffset};
136
+ margin-inline-end: calc(-0.5 * ${spacing});
137
+ inline-size: ${input.height};
138
+ block-size: ${input.height};
139
+ }
140
+ `}
141
+
74
142
  ${compactMode &&
75
143
  css `
76
144
  height: ${compact};
@@ -100,12 +168,32 @@ export const StyledFileItem = styled.div(({ theme: { base: { palette, spacing, '
100
168
  border-start-end-radius: 0;
101
169
  border-end-end-radius: 0;
102
170
  width: ${input.height};
171
+ min-width: ${mouseMin};
103
172
  flex-shrink: 0;
104
173
 
174
+ @media (pointer: coarse) {
175
+ min-width: ${fingerMin};
176
+ }
177
+
178
+ ${hasMetadata &&
179
+ css `
180
+ height: ${input.height};
181
+ min-height: ${mouseMin};
182
+ overflow: hidden;
183
+ border-radius: calc(var(--container-border-radius) * 0.5);
184
+ margin-block-start: ${isErrorOrProgressItem ? '0' : labelOffset};
185
+
186
+ @media (pointer: coarse) {
187
+ min-height: ${fingerMin};
188
+ }
189
+ `}
190
+
105
191
  ${compactMode &&
106
192
  css `
107
193
  height: ${compact};
108
194
  width: ${compact};
195
+ min-width: unset;
196
+ min-height: unset;
109
197
  `}
110
198
  }
111
199
  ${isDisabled &&
@@ -118,7 +206,7 @@ export const StyledFileItem = styled.div(({ theme: { base: { palette, spacing, '
118
206
  });
119
207
  StyledFileItem.defaultProps = defaultThemeProp;
120
208
  const FileItem = forwardRef(function FileItem(props, ref) {
121
- const { id, name, thumbnail, format, error, onCancel, onEdit, onPreview, onPreviewPopoverClick, onDownload, onDelete, onOpen, progress, compact = false, previewFromActions = false, disabled = false, ...restProps } = props;
209
+ const { id, name, metadata, thumbnail, format, error, onCancel, onEdit, onPreview, onPreviewPopoverClick, onDownload, onDelete, onOpen, progress, compact = false, previewFromActions = false, disabled = false, ...restProps } = props;
122
210
  const [thumbnailError, setThumbnailError] = useState(false);
123
211
  const [textTarget, setTextTarget] = useElement();
124
212
  const [metaTarget, setMetaTarget] = useElement();
@@ -129,7 +217,9 @@ const FileItem = forwardRef(function FileItem(props, ref) {
129
217
  const { previewTriggerRef } = usePreviewContext();
130
218
  const t = useI18n();
131
219
  const uploading = typeof progress === 'number' && progress < 100;
220
+ const isErrorOrProgressItem = Boolean(error || uploading);
132
221
  const itemRef = useConsolidatedRef(ref);
222
+ const hasMetadata = !!metadata;
133
223
  const activeElement = getActiveElement();
134
224
  const activeElementInItem = itemRef.current?.contains(activeElement);
135
225
  let metaMessage;
@@ -148,7 +238,7 @@ const FileItem = forwardRef(function FileItem(props, ref) {
148
238
  }
149
239
  const definedActions = [
150
240
  previewFromActions ? { onClick: onPreview, text: t('preview'), icon: 'preview' } : undefined,
151
- { onClick: onEdit, text: t('edit'), icon: 'pencil' },
241
+ { onClick: hasMetadata ? undefined : onEdit, text: t('edit'), icon: 'pencil' },
152
242
  { onClick: onDownload, text: t('download'), icon: 'download' },
153
243
  { onClick: onDelete, text: t('delete'), icon: 'trash' },
154
244
  { onClick: onOpen, text: t('link_open_in_tab_text'), icon: 'open' }
@@ -168,11 +258,11 @@ const FileItem = forwardRef(function FileItem(props, ref) {
168
258
  let visual;
169
259
  let contextualLabel;
170
260
  if (uploading) {
171
- visual = _jsx(Progress, { variant: 'ring', placement: 'inline', value: progress });
261
+ visual = hasMetadata ? (_jsx(Flex, { container: { alignItems: 'center', justify: 'center' }, item: { shrink: 0 }, as: StyledStatusVisualInEditableLayout, children: _jsx(Progress, { variant: 'ring', placement: 'inline', value: progress }) })) : (_jsx(Progress, { variant: 'ring', placement: 'inline', value: progress }));
172
262
  contextualLabel = t('uploading_file', [name]);
173
263
  }
174
264
  else if (error) {
175
- visual = _jsx(StyledErrorIcon, { name: 'warn-solid' });
265
+ visual = hasMetadata ? (_jsx(Flex, { container: { alignItems: 'center', justify: 'center' }, item: { shrink: 0 }, as: StyledStatusVisualInEditableLayout, children: _jsx(StyledErrorIcon, { name: 'warn-solid' }) })) : (_jsx(StyledErrorIcon, { name: 'warn-solid' }));
176
266
  contextualLabel = t('upload_failed', [name, error]);
177
267
  }
178
268
  else {
@@ -186,25 +276,79 @@ const FileItem = forwardRef(function FileItem(props, ref) {
186
276
  getFocusables(itemRef.current)[0]?.focus();
187
277
  }
188
278
  }, [progress, error, onCancel, onDelete, onPreview, onEdit, onDownload]);
279
+ const showInlinePreview = !hasMetadata &&
280
+ !previewFromActions &&
281
+ ((!inModal && onPreviewPopoverClick) || onPreview) &&
282
+ !(error || uploading);
283
+ let primaryContent;
284
+ if (metadata && metadata.length > 0 && !error && !uploading) {
285
+ primaryContent = (_jsx(StyledMetadataGrid, { container: { gap: 1 }, children: metadata.map((field, index) => {
286
+ const spanFull = index === metadata.length - 1 && metadata.length % 2 !== 0;
287
+ const gridItem = spanFull ? { colStartEnd: '1 / -1' } : {};
288
+ if (field.options && field.options.length > 0) {
289
+ return (_jsx(Grid, { item: gridItem, children: _jsx(ComboBox, { label: field.label, selected: (() => {
290
+ if (!field.selected)
291
+ return;
292
+ const selectedItem = field.options.find(opt => opt.id === field.selected);
293
+ if (!selectedItem)
294
+ return;
295
+ return {
296
+ items: {
297
+ id: selectedItem.id,
298
+ text: selectedItem.label
299
+ }
300
+ };
301
+ })(), menu: {
302
+ mode: 'single-select',
303
+ items: field.options.map(opt => ({ id: opt.id, primary: opt.label })),
304
+ onItemClick: (optionId) => field.onChange(optionId)
305
+ }, disabled: disabled }) }, field.id));
306
+ }
307
+ return (_jsx(Grid, { item: gridItem, children: _jsx(Input, { label: field.label, value: field.value, onChange: (e) => field.onChange(e.target.value), additionalInfo: field.additionalInfo, disabled: disabled }) }, field.id));
308
+ }) }));
309
+ }
310
+ else if (showInlinePreview) {
311
+ primaryContent = (_jsxs(Button, { ...restProps, as: StyledPreviewTitle, variant: 'link', ref: setTextTarget, onClick: () => {
312
+ onPreview?.(id);
313
+ }, onKeyDown: (e) => {
314
+ if (e.getModifierState('Alt') && e.code === 'KeyP') {
315
+ if (isInstance(e.currentTarget, HTMLElement)) {
316
+ previewTriggerRef.current = e.currentTarget;
317
+ }
318
+ onPreviewPopoverClick?.(id);
319
+ }
320
+ }, onMouseEnter: onPreviewPopoverClick ? () => setPopover(true) : undefined, onMouseLeave: onPreviewPopoverClick ? () => setPopover(false) : undefined, onFocus: onPreviewPopoverClick ? () => setPreviewPopover(true) : undefined, onBlur: onPreviewPopoverClick ? () => setPreviewPopover(false) : undefined, "aria-label": t('preview_file', [name]), disabled: disabled, children: [name, format === 'url' && _jsx(Icon, { name: 'open' })] }));
321
+ }
322
+ else {
323
+ primaryContent = (_jsx(Text, { ...restProps, as: hasMetadata && !!error ? StyledErrorTextTitle : StyledTextTitle, ref: setTextTarget, children: name }));
324
+ }
325
+ let detailsContent;
326
+ const containerPad = hasMetadata
327
+ ? [1, 0.5, 1, undefined]
328
+ : [undefined, 0.5, undefined, undefined];
329
+ const metaContent = metaMessage ? (_jsxs(_Fragment, { children: [_jsx(Text, { as: StyledMeta, variant: 'secondary', error: !!error && !uploading, alignStart: hasMetadata && (!!error || uploading), ref: setMetaTarget, children: metaMessage }), metaTarget && (_jsx(Tooltip, { target: metaTarget, describeTarget: false, smart: true, children: metaMessage }))] })) : null;
330
+ if (hasMetadata) {
331
+ detailsContent = (_jsxs(Flex, { item: { grow: 1 }, container: {
332
+ direction: 'column'
333
+ }, children: [primaryContent, metaContent] }));
334
+ }
335
+ else {
336
+ detailsContent = (_jsxs(_Fragment, { children: [primaryContent, metaContent] }));
337
+ }
189
338
  return (_jsxs(Flex, { as: StyledFileItem, container: {
190
- pad: [undefined, 0.5, undefined, undefined],
191
- alignItems: 'center',
339
+ pad: containerPad,
340
+ alignItems: hasMetadata ? 'start' : 'center',
192
341
  justify: 'start',
193
342
  gap: 1
194
- }, isDisabled: disabled, compactMode: compact, ref: itemRef, children: [visual, !previewFromActions &&
195
- ((!inModal && onPreviewPopoverClick) || onPreview) &&
196
- !(error || uploading) ? (_jsxs(Button, { ...restProps, as: StyledPreviewTitle, variant: 'link', ref: setTextTarget, onClick: () => {
197
- onPreview?.(id);
198
- }, onKeyDown: (e) => {
199
- if (e.getModifierState('Alt') && e.code === 'KeyP') {
200
- previewTriggerRef.current = e.currentTarget;
201
- onPreviewPopoverClick?.(id);
202
- }
203
- }, onMouseEnter: onPreviewPopoverClick ? () => setPopover(true) : undefined, onMouseLeave: onPreviewPopoverClick ? () => setPopover(false) : undefined, onFocus: onPreviewPopoverClick ? () => setPreviewPopover(true) : undefined, onBlur: onPreviewPopoverClick ? () => setPreviewPopover(false) : undefined, "aria-label": t('preview_file', [name]), disabled: disabled, children: [name, format === 'url' && _jsx(Icon, { name: 'open' })] })) : (_jsx(Text, { ...restProps, as: StyledTextTitle, ref: setTextTarget, children: name })), metaMessage && (_jsxs(_Fragment, { children: [_jsx(Text, { as: StyledMeta, variant: 'secondary', error: error && !uploading, ref: setMetaTarget, children: metaMessage }), metaTarget && (_jsx(Tooltip, { target: metaTarget, describeTarget: false, smart: true, children: metaMessage }))] })), (error || uploading) && onCancel && (_jsx(StyledActionsWrapper, { meta: !!metaMessage, children: _jsx(Button, { label: t('cancel'), "aria-label": `${t('cancel')} - ${contextualLabel}`, variant: 'simple', compact: true, icon: true, onClick: () => onCancel(id), children: _jsx(Icon, { name: 'times' }) }) })), !(error || uploading) && !!definedActions.length && (_jsx(StyledActionsWrapper, { meta: !!metaMessage, children: _jsx(Actions, { items: definedActions, compact: true, iconOnly: true, contextualLabel: name, disabled: disabled }) })), textTarget && !onPreviewPopoverClick && (_jsx(Tooltip, { target: textTarget, smart: true, describeTarget: false, children: name })), onPreviewPopoverClick && !inModal && !previewFromActions && (_jsx(Popover, { as: StyledLinkPopover, show: popover, placement: 'top', groupId: 'tooltip', showDelay: 'short', target: textTarget, onMouseEnter: () => setPopover(true), onMouseLeave: () => setPopover(false), arrow: true, portal: true, children: _jsx(StyledLinkPreviewPopoverBtn, { type: 'button', onClick: () => {
204
- previewTriggerRef.current = textTarget;
343
+ }, isDisabled: disabled, compactMode: compact, hasMetadata: hasMetadata, isErrorOrProgressItem: isErrorOrProgressItem, ref: itemRef, children: [visual, detailsContent, (error || uploading) && onCancel && (_jsx(StyledActionsWrapper, { meta: !!metaMessage, children: _jsx(Button, { label: t('cancel'), "aria-label": `${t('cancel')} - ${contextualLabel}`, variant: 'simple', compact: !hasMetadata, icon: true, onClick: () => onCancel(id), children: _jsx(Icon, { name: 'times' }) }) })), !(error || uploading) && !!definedActions.length && (_jsx(StyledActionsWrapper, { meta: !!metaMessage, children: _jsx(Actions, { items: definedActions, compact: !hasMetadata, iconOnly: true, contextualLabel: name, disabled: disabled }) })), textTarget && !onPreviewPopoverClick && (_jsx(Tooltip, { target: textTarget, smart: true, describeTarget: false, children: name })), onPreviewPopoverClick && !inModal && !previewFromActions && (_jsx(Popover, { as: StyledLinkPopover, show: popover, placement: 'top', groupId: 'tooltip', showDelay: 'short', target: textTarget, onMouseEnter: () => setPopover(true), onMouseLeave: () => setPopover(false), arrow: true, portal: true, children: _jsx(StyledLinkPreviewPopoverBtn, { type: 'button', onClick: () => {
344
+ if (isInstance(textTarget, HTMLElement)) {
345
+ previewTriggerRef.current = textTarget;
346
+ }
205
347
  onPreviewPopoverClick?.(id);
206
348
  }, tabIndex: -1, children: _jsx("div", { children: _jsx("span", { children: t('preview') }) }) }) })), onPreviewPopoverClick && !inModal && !previewFromActions && (_jsx(Popover, { as: StyledLinkPopover, show: previewPopover, placement: 'top', groupId: 'tooltip', showDelay: 'short', target: textTarget, arrow: true, portal: true, children: _jsx(StyledLinkPreviewPopoverBtn, { type: 'button', onClick: () => {
207
- previewTriggerRef.current = textTarget;
349
+ if (isInstance(textTarget, HTMLElement)) {
350
+ previewTriggerRef.current = textTarget;
351
+ }
208
352
  onPreviewPopoverClick?.(id);
209
353
  }, tabIndex: -1, children: _jsxs("div", { children: [_jsx("span", { children: t('preview') }), _jsxs(Flex, { container: { inline: true, justify: 'end' }, children: [_jsx(Keyboard, { keyName: 'Alt' }), _jsx(Keyboard, { keyName: 'P' })] })] }) }) }))] }));
210
354
  });