{"version":3,"file":"FileInput.cjs","sources":["../../../../src/components/FileInput/FileInput.tsx"],"sourcesContent":["import type { ComponentProps, ReactNode } from \"react\";\nimport { forwardRef } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport { mergeDeep } from \"../../helpers/merge-deep\";\nimport { getTheme } from \"../../theme-store\";\nimport type { DeepPartial } from \"../../types\";\nimport { HelperText } from \"../HelperText\";\nimport type { FlowbiteTextInputColors, FlowbiteTextInputSizes } from \"../TextInput\";\n\nexport interface FlowbiteFileInputTheme {\n  root: FlowbiteFileInputRootTheme;\n  field: FlowbiteFileInputFieldTheme;\n}\n\nexport interface FlowbiteFileInputRootTheme {\n  base: string;\n}\n\nexport interface FlowbiteFileInputFieldTheme {\n  base: string;\n  input: FlowbiteFileInputFieldInputTheme;\n}\n\nexport interface FlowbiteFileInputFieldInputTheme {\n  base: string;\n  colors: FlowbiteTextInputColors;\n  sizes: FlowbiteTextInputSizes;\n}\n\nexport interface FileInputProps extends Omit<ComponentProps<\"input\">, \"type\" | \"ref\" | \"color\"> {\n  color?: keyof FlowbiteTextInputColors;\n  helperText?: ReactNode;\n  sizing?: keyof FlowbiteTextInputSizes;\n  theme?: DeepPartial<FlowbiteFileInputTheme>;\n}\n\nexport const FileInput = forwardRef<HTMLInputElement, FileInputProps>(\n  ({ className, color = \"gray\", helperText, sizing = \"md\", theme: customTheme = {}, ...props }, ref) => {\n    const theme = mergeDeep(getTheme().fileInput, customTheme);\n\n    return (\n      <>\n        <div className={twMerge(theme.root.base, className)}>\n          <div className={theme.field.base}>\n            <input\n              className={twMerge(\n                theme.field.input.base,\n                theme.field.input.colors[color],\n                theme.field.input.sizes[sizing],\n              )}\n              {...props}\n              type=\"file\"\n              ref={ref}\n            />\n          </div>\n        </div>\n        {helperText && <HelperText color={color}>{helperText}</HelperText>}\n      </>\n    );\n  },\n);\n\nFileInput.displayName = \"FileInput\";\n"],"names":["forwardRef","mergeDeep","getTheme","jsxs","Fragment","jsx","twMerge","HelperText"],"m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