@spaced-out/ui-design-system
Version:
Sense UI components library
66 lines • 2.68 kB
TypeScript
import * as React from 'react';
import type { Flow } from 'flow-to-typescript-codemod';
import type { IconType } from '../../components/Icon';
type ClassNames = Readonly<{
wrapper?: string;
icon?: string;
text?: string;
}>;
/**
* Note(Nishant): Although Button supports gradient as a type, its not currently customizable really.
* This only supports pre-defined gradient that moves from left to right.
* If someone wants to add more gradients, the expectation is that they would add it through a wrapper className.
*
* We could have taken an extra prop to take in the Gradient colors but that should not be encouraged
* as it would add an additional overhead on the component to figure out exact color values from string tokens
* and since this is rarely used type anyway, it should be avoided.
*/
export declare const BUTTON_TYPES: Readonly<{
primary: "primary";
secondary: "secondary";
tertiary: "tertiary";
ghost: "ghost";
danger: "danger";
gradient: "gradient";
tertiaryGradient: "tertiaryGradient";
}>;
export declare const BUTTON_ACTION_TYPE: Readonly<{
button: "button";
submit: "submit";
reset: "reset";
}>;
export declare const BUTTON_SIZE: Readonly<{
small: "small";
medium: "medium";
}>;
export type ButtonType = (typeof BUTTON_TYPES)[keyof typeof BUTTON_TYPES];
export type ButtonActionType = (typeof BUTTON_ACTION_TYPE)[keyof typeof BUTTON_ACTION_TYPE];
export type ButtonSize = keyof typeof BUTTON_SIZE;
export interface BaseButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'disabled' | 'actionType' | 'onClick' | 'ariaLabel' | 'tabIndex' | 'isLoading' | 'role'> {
children?: React.ReactNode;
disabled?: boolean;
actionType?: ButtonActionType;
onClick?: React.MouseEventHandler<HTMLButtonElement>;
ariaLabel?: string;
tabIndex?: number;
isLoading?: boolean;
role?: string;
testId?: string;
}
export interface UnstyledButtonProps extends Omit<BaseButtonProps, 'className'> {
className?: string;
}
export interface ButtonProps extends Omit<BaseButtonProps, 'classNames' | 'iconLeftName' | 'iconLeftType' | 'iconRightName' | 'iconRightType' | 'type' | 'isFluid' | 'size'> {
classNames?: ClassNames;
iconLeftName?: string;
iconLeftType?: IconType;
iconRightName?: string;
iconRightType?: IconType;
type?: ButtonType;
isFluid?: boolean;
size?: ButtonSize;
}
export declare const UnstyledButton: Flow.AbstractComponent<UnstyledButtonProps, HTMLButtonElement>;
export declare const Button: Flow.AbstractComponent<ButtonProps, HTMLButtonElement>;
export {};
//# sourceMappingURL=Button.d.ts.map