'use client'; import React, { type PropsWithChildren, useImperativeHandle } from 'react'; import 'jb-button'; // eslint-disable-next-line no-duplicate-imports import type { ColorVariants, JBButtonWebComponent, SizeVariants, StyleVariants } from 'jb-button'; import { type EventProps, useEvents } from './events-hook.js'; import { type JBButtonAttributes, useJBButtonAttribute } from './attributes-hook.js'; import type { JBElementStandardProps } from 'jb-core/react'; import './module-declaration.js'; export const JBButton = React.forwardRef((props:Props, ref) => { const element = React.useRef(null); useImperativeHandle( ref, () => (element ? element.current : undefined), [element], ); const {disabled, loadingText,isLoading, square, variant, size, onClick,color,children, name, ...otherProps} = props; useJBButtonAttribute(element,{disabled,isLoading,square}); useEvents(element,{onClick}); return ( {children} ); }); JBButton.displayName = 'JBButton'; type JBButtonBaseProps = EventProps & JBButtonAttributes & { name?:string, color?:ColorVariants, variant?:StyleVariants, size?:SizeVariants, type?: string, loadingText?: string, } export type Props = PropsWithChildren & JBElementStandardProps