@lobehub/ui
Version:
Lobe UI is an open-source UI component library for building AIGC web apps
54 lines • 2.14 kB
text/typescript
import { IconProps } from "../../Icon/type.mjs";
import "../../Icon/index.mjs";
import { AnchorHTMLAttributes, ButtonHTMLAttributes, CSSProperties, ReactNode, Ref } from "react";
//#region src/base-ui/Button/type.d.ts
type ButtonType = 'default' | 'primary' | 'dashed' | 'fill' | 'link' | 'text';
type ButtonShape = 'default' | 'circle' | 'round';
type ButtonSize = 'small' | 'middle' | 'large';
type ButtonIconPosition = 'start' | 'end';
type ButtonOutdent = boolean | 'start' | 'end';
interface BaseButtonOwnProps {
block?: boolean;
children?: ReactNode;
classNames?: {
icon?: string;
};
danger?: boolean;
disabled?: boolean;
/**
* Strips the fill and the border, leaving only the type's semantic color and a hover
* wash. Unlike antd's `ghost`, this is not an on-dark-background variant. It is a no-op
* on `text` and `link`, which already carry no surface.
*/
ghost?: boolean;
href?: string;
htmlType?: ButtonHTMLAttributes<HTMLButtonElement>['type'];
icon?: IconProps['icon'] | ReactNode;
iconPosition?: ButtonIconPosition;
loading?: boolean;
ref?: Ref<HTMLButtonElement | HTMLAnchorElement>;
shape?: ButtonShape;
size?: ButtonSize;
styles?: {
icon?: CSSProperties;
};
target?: string;
}
type TextOutdentProps<T extends ButtonType> = [T] extends ['text'] ? {
/**
* Cancels this size's `padding-inline` with a negative margin so a `text`
* button lines up with adjacent copy. `true` / `'start'` outdent the start
* edge; `'end'` outdents the end edge.
*/
outdent?: ButtonOutdent;
type?: T;
} : {
outdent?: never;
type?: T;
};
type NativeButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof BaseButtonOwnProps | 'type' | 'outdent'>;
type NativeAnchorProps = Omit<AnchorHTMLAttributes<HTMLAnchorElement>, keyof BaseButtonOwnProps | 'type' | 'outdent'>;
type ButtonProps<T extends ButtonType = ButtonType> = BaseButtonOwnProps & NativeButtonProps & Partial<NativeAnchorProps> & TextOutdentProps<T>;
//#endregion
export { ButtonIconPosition, ButtonOutdent, ButtonProps, ButtonShape, ButtonSize, ButtonType };
//# sourceMappingURL=type.d.mts.map