{"version":3,"file":"icons.mjs","sources":["../../../admin/src/utils/icons.ts"],"sourcesContent":["import { SVGProps } from 'react';\n\nimport { File, FileCsv, FilePdf, FileXls, FileZip } from '@strapi/icons';\nimport { DefaultTheme } from 'styled-components';\n\nimport { DocType } from '../enums';\n\n// The IconProps interface is not exported from our design library package, so we need to redefine it here\ninterface IconProps extends Omit<SVGProps<SVGSVGElement>, 'fill' | 'stroke'> {\n  /**\n   * @default \"currentColor\"\n   */\n  fill?: keyof DefaultTheme['colors'] | string;\n  stroke?: keyof DefaultTheme['colors'] | string;\n}\n\ntype IconComponent = React.FC<IconProps>;\n\nexport const FILE_TYPE_ICON_COMPONENT_MAP: Record<string, IconComponent> = {\n  [DocType.Pdf]: FilePdf,\n  [DocType.Csv]: FileCsv,\n  [DocType.Xls]: FileXls,\n  [DocType.Zip]: FileZip,\n} as const;\n\nexport const DEFAULT_FILE_ICON: IconComponent = File;\n\nexport const getFileIconComponent = (docType?: string) => {\n  if (Object.values(DocType).some((type) => docType?.includes(type))) {\n    return FILE_TYPE_ICON_COMPONENT_MAP[docType as DocType] ?? DEFAULT_FILE_ICON;\n  }\n  return DEFAULT_FILE_ICON;\n};\n"],"names":["FILE_TYPE_ICON_COMPONENT_MAP","DocType","Pdf","FilePdf","Csv","FileCsv","Xls","FileXls","Zip","FileZip","DEFAULT_FILE_ICON","File","getFileIconComponent","docType","Object","values","some","type","includes"],"mappings":";;;MAkBaA,4BAAAA,GAA8D;IACzE,CAACC,OAAAA,CAAQC,GAAG,GAAGC,OAAAA;IACf,CAACF,OAAAA,CAAQG,GAAG,GAAGC,OAAAA;IACf,CAACJ,OAAAA,CAAQK,GAAG,GAAGC,OAAAA;IACf,CAACN,OAAAA,CAAQO,GAAG,GAAGC;AACjB;AAEO,MAAMC,oBAAmCC;AAEzC,MAAMC,uBAAuB,CAACC,OAAAA,GAAAA;IACnC,IAAIC,MAAAA,CAAOC,MAAM,CAACd,OAAAA,CAAAA,CAASe,IAAI,CAAC,CAACC,IAAAA,GAASJ,OAAAA,EAASK,QAAAA,CAASD,IAAAA,CAAAA,CAAAA,EAAQ;QAClE,OAAOjB,4BAA4B,CAACa,OAAAA,CAAmB,IAAIH,iBAAAA;AAC7D,IAAA;IACA,OAAOA,iBAAAA;AACT;;;;"}