UNPKG

@gravity-ui/uikit

Version:

Gravity UI base styling and components

55 lines (54 loc) 2.6 kB
import * as React from 'react'; import type { DOMProps, QAProps } from "../types.js"; import type { PolymorphicComponentProps, PolymorphicCustomElementType, PolymorphicOverloadProps } from "../utils/polymorphic.js"; import type { BUTTON_VIEWS } from "./constants.js"; import "./Button.css"; export type ButtonView = (typeof BUTTON_VIEWS)[number]; export type ButtonSize = 'xs' | 's' | 'm' | 'l' | 'xl'; export type ButtonPin = 'round-round' | 'brick-brick' | 'clear-clear' | 'circle-circle' | 'round-brick' | 'brick-round' | 'round-clear' | 'clear-round' | 'brick-clear' | 'clear-brick' | 'circle-brick' | 'brick-circle' | 'circle-clear' | 'clear-circle'; export type ButtonWidth = 'auto' | 'max'; export interface ButtonCommonProps extends QAProps, DOMProps { view?: ButtonView; size?: ButtonSize; pin?: ButtonPin; selected?: boolean; disabled?: boolean; loading?: boolean; width?: ButtonWidth; children?: React.ReactNode; } export interface ButtonButtonProps extends ButtonCommonProps, Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'disabled' | 'style'> { component?: never; href?: never; /** * @deprecated Use additional props at the root */ extraProps?: React.ButtonHTMLAttributes<HTMLButtonElement>; } export interface ButtonLinkProps extends ButtonCommonProps, Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'style'> { component?: never; href: string; /** * @deprecated Use additional props at the root */ extraProps?: React.AnchorHTMLAttributes<HTMLAnchorElement>; } export type ButtonComponentProps<T extends Exclude<ButtonCustomElementType, undefined>> = PolymorphicComponentProps<ButtonCommonProps, T> & { /** * @deprecated Use additional props at the root */ extraProps?: React.ComponentPropsWithoutRef<T>; }; export type ButtonCustomElementType = PolymorphicCustomElementType; export type ButtonProps<T extends ButtonCustomElementType = undefined> = ButtonLinkProps | ButtonButtonProps | ButtonComponentProps<Exclude<T, undefined>>; export declare const Button: (<T extends ButtonCustomElementType, P extends ButtonProps<T>>(props: PolymorphicOverloadProps<T, P, ButtonComponentProps<Exclude<T, undefined>>, ButtonLinkProps, ButtonButtonProps>) => React.ReactElement) & { Icon: { ({ side, className, children }: { className?: string; side?: "left" | "right" | "start" | "end"; } & { children?: React.ReactNode | undefined; }): import("react/jsx-runtime").JSX.Element; displayName: string; }; };