{"version":3,"file":"FilesUploaderTip.mjs","sources":[""],"sourcesContent":["import type { ReactElement } from \"react\";\r\nimport { useContext } from \"react\";\r\nimport { Locale } from \"../../locale\";\r\nimport { FilesUploaderCtx } from \"../context/index\";\r\n\r\n/**\r\n * Компонент вывода подсказки загрузчика\r\n * @returns\r\n * */\r\nexport const FilesUploaderTip = (): ReactElement => {\r\n\r\n  const {\r\n    getCN,\r\n    fileTypes,\r\n    maxSize,\r\n    isMultiple,\r\n    maxFiles,\r\n    maxSizeType,\r\n  } = useContext(FilesUploaderCtx);\r\n\r\n  const types = fileTypes.length === 0 ? \"*\" : fileTypes.map((type) => type.toUpperCase()).join(\", \");\r\n\r\n  const isMaxSize = typeof maxSize === \"number\" && maxSize > 0 && maxSize !== Infinity;\r\n\r\n  return (\r\n    <div className={getCN(\"tip\")} role={\"tooltip\"}>\r\n      {isMaxSize && <div className={getCN(\"tipSize\")}>\r\n        <Locale options={{ maxSize: maxSize.toString(), isMultiple, maxSizeType }} code={\"filesUploader.maxSize\"} />\r\n      </div>}\r\n      <div className={getCN(\"tipLength\")}>\r\n        <Locale options={{ maxFiles: maxFiles.toString(), isMultiple, maxSizeType }} code={\"filesUploader.maxLength\"} />\r\n      </div>\r\n      <div className={getCN(\"tipTypes\")}>\r\n        <Locale options={{ types, isMultiple }} code={types === \"*\" ? \"filesUploader.allTypes\" : \"filesUploader.specificTypes\"} />\r\n      </div>\r\n    </div>\r\n  );\r\n};\r\n"],"names":["FilesUploaderTip","getCN","fileTypes","maxSize","isMultiple","maxFiles","maxSizeType","useContext","FilesUploaderCtx","types","length","map","type","toUpperCase","join","isMaxSize","Infinity","_jsxs","className","role","children","_jsx","Locale","options","toString","code"],"mappings":"oKASO,MAAMA,iBAAmB,KAE9B,MAAMC,MACJA,MAAKC,UACLA,UAASC,QACTA,QAAOC,WACPA,WAAUC,SACVA,SAAQC,YACRA,aACEC,WAAWC,kBAEf,MAAMC,MAAQP,UAAUQ,SAAW,EAAI,IAAMR,UAAUS,IAAKC,MAASA,KAAKC,eAAeC,KAAK,MAE9F,MAAMC,iBAAmBZ,UAAY,UAAYA,QAAU,GAAKA,UAAYa;AAE5E,OACEC,KAAA,MAAA,CAAKC,UAAWjB,MAAM,OAAQkB,KAAM,UAAUC,SAAA,CAC3CL,WAAaM,IAAA,MAAA,CAAKH,UAAWjB,MAAM,WAAWmB,SAC7CC,IAACC,OAAM,CAACC,QAAS,CAAEpB,QAASA,QAAQqB,WAAYpB,sBAAYE,yBAAemB,KAAM,4BAEnFJ,IAAA,MAAA,CAAKH,UAAWjB,MAAM,aAAamB,SACjCC,IAACC,OAAM,CAACC,QAAS,CAAElB,SAAUA,SAASmB,WAAYpB,sBAAYE,yBAAemB,KAAM,8BAErFJ,IAAA,MAAA,CAAKH,UAAWjB,MAAM,YAAYmB,SAChCC,IAACC,OAAM,CAACC,QAAS,CAAEd,YAAOL,uBAAcqB,KAAMhB,QAAU,IAAM,yBAA2B"}