{"version":3,"file":"MaxSize.cjs","sources":["../../../../../src/components/file-input/internal/MaxSize.tsx"],"sourcesContent":["import React, { type ComponentPropsWithoutRef, type FC } from \"react\";\nimport { formatBytes } from \"../../../utilities/formatters/bytes/formatBytes.js\";\nimport { useFileInputContext } from \"./fileInputContext.js\";\n\ntype Props = Omit<ComponentPropsWithoutRef<\"div\">, \"id\"> & {\n    id: string;\n};\n\nexport const MaxSize: FC<Props> = ({ id }) => {\n    const context = useFileInputContext();\n    if (!context) {\n        return <p>MaxSize must be placed inside a FileInputContextProvider.</p>;\n    }\n    const { maxSizeBytes } = context;\n\n    if (typeof maxSizeBytes === \"undefined\") {\n        return false;\n    }\n\n    return (\n        <div id={id} className=\"jkl-file-input__max-size-text\">\n            Maks {formatBytes(maxSizeBytes)} per fil\n        </div>\n    );\n};\n"],"names":["id","context","useFileInputContext","jsx","children","maxSizeBytes","jsxs","className","formatBytes"],"mappings":"iQAQkC,EAAGA,GAAAA,MACjC,MAAMC,EAAUC,EAAAA,sBAChB,IAAKD,EACD,OAAOE,EAAAA,IAAC,KAAEC,SAAA,8DAEd,MAAQC,aAAAA,GAAiBJ,EAEzB,eAAWI,EAAiB,MAKxBC,EAAAA,KAAC,MAAA,CAAIN,GAAAA,EAAQO,UAAU,gCAAgCH,SAAA,CAAA,QAC7CI,EAAAA,YAAYH,GAAc"}