import { h, type FunctionComponent, type PointerEventHandler } from 'preact' import cn from 'classnames' type Styles = { base: string autoHeight?: string fullWidth?: string icon?: string invert?: string } & Record & Record & Record type Props = { autoHeight?: boolean className?: string color?: C design?: D disabled?: boolean fullWidth?: boolean icon?: I iconSize?: string invert?: boolean onClick?: PointerEventHandler size?: S tabIndex?: number tag?: string title?: string type?: 'button' | 'reset' | 'submit' } type Options = { defaults: Partial> icons: Record styles: Styles } export default function buttonFactory< C extends string = never, D extends string = never, I extends string = never, S extends string = never, >({ defaults, icons, styles }: Options) { const Button: FunctionComponent> = ({ autoHeight = defaults?.autoHeight, children, className, color = defaults?.color, design = defaults?.design, disabled, fullWidth = defaults?.fullWidth, icon = defaults?.icon, iconSize, invert = defaults?.invert, onClick, size = defaults?.size, tabIndex, title, type, }) => ( ) return Button }