flowbite-react
Version:
Official React components built for Flowbite and Tailwind CSS
1 lines • 2.79 kB
Source Map (JSON)
{"version":3,"file":"FileInput.cjs","sources":["../../../src/components/FileInput/FileInput.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps } from \"react\";\nimport { forwardRef } from \"react\";\nimport { get } from \"../../helpers/get\";\nimport { resolveProps } from \"../../helpers/resolve-props\";\nimport { useResolveTheme } from \"../../helpers/resolve-theme\";\nimport { twMerge } from \"../../helpers/tailwind-merge\";\nimport { useThemeProvider } from \"../../theme/provider\";\nimport type { DynamicStringEnumKeysOf, ThemingProps } from \"../../types\";\nimport type { TextInputColors, TextInputSizes } from \"../TextInput\";\nimport { fileInputTheme } from \"./theme\";\n\nexport interface FileInputTheme {\n base: string;\n colors: TextInputColors;\n sizes: TextInputSizes;\n}\n\nexport interface FileInputProps\n extends Omit<ComponentProps<\"input\">, \"type\" | \"ref\" | \"color\">,\n ThemingProps<FileInputTheme> {\n color?: DynamicStringEnumKeysOf<TextInputColors>;\n sizing?: DynamicStringEnumKeysOf<TextInputSizes>;\n}\n\nexport const FileInput = forwardRef<HTMLInputElement, FileInputProps>((props, ref) => {\n const provider = useThemeProvider();\n const theme = useResolveTheme(\n [fileInputTheme, provider.theme?.fileInput, props.theme],\n [get(provider.clearTheme, \"fileInput\"), props.clearTheme],\n [get(provider.applyTheme, \"fileInput\"), props.applyTheme],\n );\n\n const { className, color = \"gray\", sizing = \"md\", ...restProps } = resolveProps(props, provider.props?.fileInput);\n\n return (\n <input\n ref={ref}\n type=\"file\"\n className={twMerge(theme.base, theme.colors[color], theme.sizes[sizing], className)}\n {...restProps}\n />\n );\n});\n\nFileInput.displayName = \"FileInput\";\n"],"names":["forwardRef","provider","useThemeProvider","theme","useResolveTheme","fileInputTheme","get","resolveProps","jsx","twMerge"],"mappings":";;;;;;;;;;;AAUY,MAAC,SAAS,GAAGA,gBAAU,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK;AACpD,EAAE,MAAMC,UAAQ,GAAGC,yBAAgB,EAAE;AACrC,EAAE,MAAMC,OAAK,GAAGC,4BAAe;AAC/B,IAAI,CAACC,oBAAc,EAAEJ,UAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC;AAC5D,IAAI,CAACK,OAAG,CAACL,UAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC;AAC7D,IAAI,CAACK,OAAG,CAACL,UAAQ,CAAC,UAAU,EAAE,WAAW,CAAC,EAAE,KAAK,CAAC,UAAU;AAC5D,GAAG;AACH,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,GAAG,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,SAAS,EAAE,GAAGM,yBAAY,CAAC,KAAK,EAAEN,UAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;AACnH,EAAE,uBAAuBO,cAAG;AAC5B,IAAI,OAAO;AACX,IAAI;AACJ,MAAM,GAAG;AACT,MAAM,IAAI,EAAE,MAAM;AAClB,MAAM,SAAS,EAAEC,qBAAO,CAACN,OAAK,CAAC,IAAI,EAAEA,OAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EAAEA,OAAK,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;AACzF,MAAM,GAAG;AACT;AACA,GAAG;AACH,CAAC;AACD,SAAS,CAAC,WAAW,GAAG,WAAW;;;;"}