import * as React from "react";
import { Theme } from "../../themes";
import type { JSX } from "react";
export type ButtonSize = "small" | "medium" | "large";
export type ButtonColor = "primary" | "primarySubtle" | "secondaryLight" | "secondaryDark" | "danger" | "clear";
export type ButtonColorStyle = {
normal: {
background: string;
color: string;
boxShadow: string;
border: string;
};
hover: {
background?: string;
border: string;
};
active: {
background?: string;
boxShadow: string;
border: string;
};
};
export type Padding = {
theme: Theme;
size: ButtonSize;
color: ButtonColor;
};
type baseProps = {
/**
* The component used for the root node.
* Default: ``
*/
component?: keyof JSX.IntrinsicElements | React.ComponentType<{
className: string;
}>;
color?: ButtonColor;
/**
* テキストカラーを直接指定したい場合に使用
*/
textColor?: string;
/**
* Control whether "inline" or "block" Element.
*/
inline?: boolean;
icon?: React.ReactNode;
size?: ButtonSize;
onClick?: (event: React.MouseEvent) => void;
/**
* `true` のときボーダーとシャドウ(通常・ホバー・アクティブ)を付けず、視覚的に抑えた見た目にする。
* 補足的なヒントやヘルプのトリガーなど、目立たせすぎない操作向け。**アイコン単体**(`icon` のみ)での利用を想定。
* `color` は **`secondaryLight` / `secondaryDark` を主に使う**想定(それ以外は用途に応じて)。
* `:active` は押し込み(位置ずれ)やシャドウの変化はせず、背景のみホバーより一段暗い色に変える。
*/
isQuiet?: boolean;
/**
* ローディング状態を表示するかどうか。文字列を指定した場合はそれがローディングテキストとして使用されます。
* - `true`: デフォルトの"Loading..."テキストを使用
* - `string`: 指定した文字列をローディングテキストとして使用
* - `false` または `undefined`: ローディング状態を表示しない
*
* ボタンの内容に応じた動作:
* - アイコンのみ: スピナーのみを表示(ローディングテキストは無視)
* - テキストのみ: ローディングテキストのみを表示(`true`の場合はデフォルトで"Loading...")
* - アイコン + テキスト: スピナー + ローディングテキストを表示(`true`の場合はデフォルトで"Loading...")
*/
loading?: boolean | string;
} & React.ComponentPropsWithoutRef<"button">;
type AnchorProps = Omit & {
/**
* If added this props, root node becomes ``.
*/
href: string;
target?: "_blank" | "_self" | "_parent" | "_top";
rel?: string;
};
type BaseButtonProps = baseProps & {
href?: undefined;
target?: undefined;
rel?: undefined;
};
export type ButtonProps = BaseButtonProps | AnchorProps;
declare const Button: React.ForwardRefExoticComponent>;
export default Button;