UNPKG

flowbite-react

Version:

Official React components built for Flowbite and Tailwind CSS

1 lines 1.24 kB
{"version":3,"file":"ButtonBase.cjs","sources":["../../../src/components/Button/ButtonBase.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentPropsWithoutRef, ElementType, ForwardedRef } from \"react\";\nimport { createElement, forwardRef } from \"react\";\n\nexport type ButtonBaseProps<T extends ElementType = \"button\"> = {\n as?: T;\n href?: string;\n} & ComponentPropsWithoutRef<T>;\n\nexport const ButtonBase = forwardRef(\n <T extends ElementType = \"button\">(\n { children, as: Component, href, type = \"button\", ...props }: ButtonBaseProps<T>,\n ref: ForwardedRef<T>,\n ) => {\n const BaseComponent = Component || (href ? \"a\" : \"button\");\n\n return createElement(BaseComponent, { ref, href, type, ...props }, children);\n },\n);\n\nButtonBase.displayName = \"ButtonBase\";\n"],"names":["forwardRef","createElement"],"mappings":";;;;AAGY,MAAC,UAAU,GAAGA,gBAAU;AACpC,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,KAAK;AACzE,IAAI,MAAM,aAAa,GAAG,SAAS,KAAK,IAAI,GAAG,GAAG,GAAG,QAAQ,CAAC;AAC9D,IAAI,OAAOC,mBAAa,CAAC,aAAa,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,QAAQ,CAAC;AAChF;AACA;AACA,UAAU,CAAC,WAAW,GAAG,YAAY;;;;"}