{"version":3,"file":"FileDropzone.cjs","sources":["../../../../src/components/FileDropzone/FileDropzone.tsx"],"sourcesContent":["import { lazy, Suspense, type ReactNode } from 'react';\nimport type { Accept, DropzoneOptions } from 'react-dropzone';\n\nexport { FileDropzoneDefaultChildren } from './FileDropzoneDefaultChildren';\n\nexport type BackwardsCompatibleDropzoneOptions = Omit<DropzoneOptions, 'accept'> & {\n  // For backward compatibility we are still allowing the old `string | string[]` format for adding accepted file types (format changed in v13.0.0)\n  accept?: string | string[] | Accept;\n};\n\nexport interface FileDropzoneProps {\n  /**\n   * Use the children property to have custom dropzone view.\n   */\n  children?: ReactNode;\n  /**\n   * Use this property to override the default behaviour for the react-dropzone options.\n   * @default {\n   *  maxSize: Infinity,\n   *  minSize: 0,\n   *  multiple: true,\n   *  useFsAccessApi: false,\n   *  maxFiles: 0,\n   * }\n   */\n  options?: BackwardsCompatibleDropzoneOptions;\n  /**\n   * Use this to change the FileReader's read.\n   */\n  readAs?: 'readAsArrayBuffer' | 'readAsText' | 'readAsBinaryString' | 'readAsDataURL';\n  /**\n   * Use the onLoad function to get the result from FileReader.\n   */\n  onLoad?: (result: string | ArrayBuffer | null) => void;\n  /**\n   * The fileListRenderer property can be used to overwrite the list of files. To not to show\n   * any list return null in the function.\n   */\n  fileListRenderer?: (file: DropzoneFile, removeFile: (file: DropzoneFile) => void) => ReactNode;\n  onFileRemove?: (file: DropzoneFile) => void;\n  /**\n   * Optional id attribute for the underlying input element\n   * Use to link a label to the input for accessibility\n   */\n  id?: string;\n}\n\nexport interface DropzoneFile {\n  file: File;\n  id: string;\n  error: DOMException | null;\n  progress?: number;\n  abortUpload?: () => void;\n  retryUpload?: () => void;\n}\n\n// react-dropzone is only needed once a dropzone actually renders, so load the\n// implementation on demand to keep it out of the initial bundle.\nconst FileDropzoneInner = lazy(() =>\n  import(/* webpackChunkName: \"file-dropzone\" */ './FileDropzoneInner').then((m) => ({\n    default: m.FileDropzoneInner,\n  }))\n);\n\n/**\n * A dropzone component to use for file uploads.\n *\n * https://developers.grafana.com/ui/latest/index.html?path=/docs/inputs-filedropzone--docs\n */\nexport function FileDropzone(props: FileDropzoneProps) {\n  return (\n    <Suspense fallback={null}>\n      <FileDropzoneInner {...props} />\n    </Suspense>\n  );\n}\n"],"names":["lazy","jsx","Suspense"],"mappings":";;;;;;;;;AA0DA,MAAM,iBAAA,GAAoBA,UAAA;AAAA,EAAK,MAC7B;AAAA;AAAA,IAA+C;AAAA,EAAqB,KAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO;AAAA,IACjF,SAAS,CAAA,CAAE;AAAA,GACb,CAAE;AACJ,CAAA;AAOO,SAAS,aAAa,KAAA,EAA0B;AACrD,EAAA,uBACEC,cAAA,CAACC,kBAAS,QAAA,EAAU,IAAA,EAClB,yCAAC,iBAAA,EAAA,EAAmB,GAAG,OAAO,CAAA,EAChC,CAAA;AAEJ;;;;;"}