import React, { useState, type ComponentPropsWithoutRef, type ComponentPropsWithRef, type FC, type MouseEvent, type ReactNode, } from 'react'; import { HiExclamationCircle } from 'react-icons/hi2'; import { PiArrowsCounterClockwiseLight, PiArrowSquareOutLight, PiTrashSimpleLight, PiUserPlusLight, } from 'react-icons/pi'; import { Slot } from '@radix-ui/react-slot'; import { flexRender, useDebounce, type FlexRenderable } from '@wener/reaction'; import type { MaybePromise } from '@wener/utils'; import { clsx } from 'clsx'; import { Daisy } from '../daisy'; import { showErrorToast } from '../toast'; import { cn } from '../utils/cn'; export namespace FunctionButton { export type RefreshButtonProps = ComponentPropsWithoutRef<'button'> & { onRefresh?: (e?: MouseEvent) => void; loading?: boolean; error?: any; size?: Daisy.SizeType; }; export const Refresh: FC = ({ className, children, onClick, onRefresh = onClick, loading, error, size, ...props }) => { const _loading = useDebounce(loading, 250); const sz = Daisy.getSize(size); const btn = ( ); if (error) { return (
{btn}
); } return <>{btn}; }; export type SubmitButtonProps = ComponentPropsWithoutRef<'button'> & { size?: Daisy.SizeType; asChild?: boolean; loading?: boolean; }; export const Submit: FC = ({ children = <>提交, loading, ...props }) => { const sz = Daisy.getSize(props.size); return ( ); }; export type PopupButtonProps = ButtonProps & { onPopup?: (e: MouseEvent) => void; }; export const Popup: FC = ({ onPopup, children, className, ...props }) => { return ( ); }; export type DeleteButtonProps = ButtonProps & { onDelete?: () => void; }; export const Delete: FC = ({ onDelete, children, className, ...props }) => { /* */ return ( ); }; export const BindCustomer: FC = ({ children, className, ...props }) => { return