{"version":3,"file":"index.js","names":["c","_c","useDroppable","getTranslation","React","DocumentIcon","ThreeDotsIcon","useConfig","useFolder","useTranslation","Popup","Thumbnail","ColoredFolderIcon","DraggableWithClick","baseClass","FolderFileCard","id","type","className","disabled","folderType","isDeleting","isFocused","isSelected","itemKey","onClick","onKeyDown","PopupActions","previewUrl","selectedCount","title","disableDrop","isOver","setNodeRef","data","ref","useRef","useEffect","copyOfRef","current","focus","blur","_jsxs","filter","Boolean","join","_jsx","fileSrc","length","AssignedCollections","button","horizontalAlign","size","verticalAlign","config","i18n","collectionsDisplayText","useMemo","reduce","acc","collection","collectionConfig","collections","find","slug","labels","plural","map","label","index","ContextFolderFileCard","t0","$","item","checkIfItemIsDisabled","focusedRowIndex","onItemClick","onItemKeyPress","selectedItemKeys","t1","has","isDisabled","t2","event","t3","event_0","value","url","_folderOrDocumentTitle"],"sources":["../../../../src/elements/FolderView/FolderFileCard/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FolderOrDocument } from 'payload/shared'\n\nimport { useDroppable } from '@dnd-kit/core'\nimport { getTranslation } from '@payloadcms/translations'\nimport React from 'react'\n\nimport { DocumentIcon } from '../../../icons/Document/index.js'\nimport { ThreeDotsIcon } from '../../../icons/ThreeDots/index.js'\nimport { useConfig } from '../../../providers/Config/index.js'\nimport { useFolder } from '../../../providers/Folders/index.js'\nimport { useTranslation } from '../../../providers/Translation/index.js'\nimport { Popup } from '../../Popup/index.js'\nimport { Thumbnail } from '../../Thumbnail/index.js'\nimport { ColoredFolderIcon } from '../ColoredFolderIcon/index.js'\nimport { DraggableWithClick } from '../DraggableWithClick/index.js'\nimport './index.scss'\n\nconst baseClass = 'folder-file-card'\n\ntype Props = {\n readonly className?: string\n readonly disabled?: boolean\n readonly folderType?: string[]\n readonly id: number | string\n readonly isDeleting?: boolean\n readonly isFocused?: boolean\n readonly isSelected?: boolean\n readonly itemKey: string\n readonly onClick?: (e: React.MouseEvent) => void\n readonly onKeyDown?: (e: React.KeyboardEvent) => void\n readonly PopupActions?: React.ReactNode\n readonly previewUrl?: string\n readonly selectedCount?: number\n readonly title: string\n readonly type: 'file' | 'folder'\n}\nexport function FolderFileCard({\n id,\n type,\n className = '',\n disabled = false,\n folderType,\n isDeleting = false,\n isFocused = false,\n isSelected = false,\n itemKey,\n onClick,\n onKeyDown,\n PopupActions,\n previewUrl,\n selectedCount = 0,\n title,\n}: Props) {\n const disableDrop = !id || disabled || type !== 'folder'\n const { isOver, setNodeRef } = useDroppable({\n id: itemKey,\n data: {\n id,\n type,\n folderType,\n },\n disabled: disableDrop,\n })\n const ref = React.useRef(null)\n\n React.useEffect(() => {\n const copyOfRef = ref.current\n if (isFocused && ref.current) {\n ref.current.focus()\n } else if (!isFocused && ref.current) {\n ref.current.blur()\n }\n\n return () => {\n if (copyOfRef) {\n copyOfRef.blur()\n }\n }\n }, [isFocused])\n\n return (\n \n {title}\n
\n {collectionsDisplayText.map((label, index) => (\n \n {label}\n {index < folderType.length - 1 ? ', ' : ''}\n \n ))}\n
\n )\n}\n\ntype ContextCardProps = {\n readonly className?: string\n readonly index: number // todo: possibly remove\n readonly item: FolderOrDocument\n readonly type: 'file' | 'folder'\n}\nexport function ContextFolderFileCard({ type, className, index, item }: ContextCardProps) {\n const { checkIfItemIsDisabled, focusedRowIndex, onItemClick, onItemKeyPress, selectedItemKeys } =\n useFolder()\n const isSelected = selectedItemKeys.has(item.itemKey)\n const isDisabled = checkIfItemIsDisabled(item)\n\n return (\n