UNPKG

@cfxjs/react-ui

Version:

Modern and minimalist React UI library.

69 lines (68 loc) 2.65 kB
import React, { PropsWithoutRef, RefAttributes } from 'react'; import { ButtonColors, ButtonVariants, TagVariants, NormalSizes } from '../utils/prop-types'; interface ButtonBaseProps { variant?: ButtonVariants; color?: ButtonColors; size?: NormalSizes; ghost?: boolean; loading?: boolean; shadow?: boolean; auto?: boolean; effect?: boolean; disabled?: boolean; htmlType?: React.ButtonHTMLAttributes<any>['type']; icon?: React.ReactNode; iconRight?: React.ReactNode; onClick?: React.MouseEventHandler<HTMLButtonElement>; className?: string; isTag?: boolean; } interface TagBaseProps { toggleable: boolean; variant?: TagVariants; color?: ButtonColors; size?: NormalSizes; disabled?: boolean; icon?: React.ReactNode; iconRight?: React.ReactNode; onClick?: React.MouseEventHandler<HTMLSpanElement>; className?: string; isTag?: boolean; dashed: boolean; } declare const defaultButtonProps: { toggleable: boolean; isTag: boolean; variant: "solid" | "line" | "text"; color: "default" | "primary" | "secondary" | "success" | "warning" | "error"; size: "mini" | "small" | "medium" | "large"; htmlType: "button" | "reset" | "submit" | undefined; ghost: boolean; loading: boolean; shadow: boolean; auto: boolean; effect: boolean; disabled: boolean; className: string; dashed: boolean; }; declare const defaultTagProps: { toggleable: boolean; isTag: boolean; variant: "solid" | "line" | "text"; color: "default" | "primary" | "secondary" | "success" | "warning" | "error"; size: "small" | "medium" | "large"; effect: boolean; disabled: boolean; className: string; }; declare type ButtonNativeAttrs = Omit<React.ButtonHTMLAttributes<any>, keyof ButtonBaseProps>; export declare type ButtonProps = ButtonBaseProps & typeof defaultButtonProps & ButtonNativeAttrs; declare type TagNativeAttrs = Omit<React.HTMLAttributes<any>, keyof TagBaseProps>; export declare type TagProps = TagBaseProps & typeof defaultTagProps & TagNativeAttrs; declare type ButtonComponent<T, P = {}> = React.ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>; declare type ComponentProps = Partial<typeof defaultButtonProps> & Omit<ButtonBaseProps, keyof typeof defaultButtonProps> & ButtonNativeAttrs; declare type TagComponent<T, P = {}> = React.ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>; declare const _default: ButtonComponent<HTMLButtonElement, ComponentProps>; export default _default; export declare const Tag: TagComponent<HTMLSpanElement, ComponentProps>;