@transkripid/flowbite-react
Version:
Official React components built for Flowbite and Tailwind CSS - Transkrip.id fork
1 lines • 1.19 kB
Source Map (JSON)
{"version":3,"file":"ButtonBase.mjs","sources":["../../../src/components/Button/ButtonBase.tsx"],"sourcesContent":["import { createElement, type ComponentPropsWithoutRef, type ElementType, type ForwardedRef, 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 = 'ButtonBaseComponent';\n"],"names":["ButtonBase","forwardRef","children","as","Component","href","type","props","ref","createElement","displayName"],"mappings":";AAOaA,MAAAA,IAAaC,EACxB,CACE;AAAA,EAAEC,UAAAA;AAAAA,EAAUC,IAAIC;AAAAA,EAAWC,MAAAA;AAAAA,EAAMC,MAAAA,IAAO;AAAA,EAAU,GAAGC;AAA0B,GAC/EC,MAIOC,EAFeL,MAAcC,IAAO,MAAM,WAEb;AAAA,EAAEG,KAAAA;AAAAA,EAAKH,MAAAA;AAAAA,EAAMC,MAAAA;AAAAA,EAAM,GAAGC;GAASL,CAAQ,CAE/E;AAEAF,EAAWU,cAAc;"}