import { BaseUI } from './base'; import { ColorProp } from './color'; import React, { ChangeEvent, HTMLAttributes } from 'react'; import { MarginProp } from './spacing'; import { SizeProp } from './size'; export interface BaseControl extends BaseUI { /** * If `true`, the component is disabled. * @default false */ disabled?: boolean; /** * If `true`, the button will take up the full width of its container. * @default false */ fullWidth?: boolean; /** * Border radius style * @default 'yes' */ rounded?: 'no' | 'yes' | 'pill'; /** * The size of the component. * `slim` is equivalent to the dense button styling. * @default 'normal' */ size?: SizeProp; /** * The color of the component. * @default 'basic' */ color?: ColorProp; /** * The vertical margin of the component. * @default 'none' */ margin?: MarginProp; /** * Changes the inner text alignment of the button * @default 'start' */ textAlign?: 'center' | 'start' | 'end'; } interface BaseField extends BaseControl, Pick, 'onChange' | 'onKeyDown' | 'onKeyUp' | 'onFocus' | 'onBlur'> { /** * The id of the `input` element. */ id?: string; placeholder?: string | undefined; label?: any; name?: string | undefined; /** * The default value. Use when the component is not controlled. */ defaultValue?: unknown; /** * The value of the `input` element, required for a controlled component. */ value?: string | ReadonlyArray | number | undefined; /** * This prop helps users to fill forms faster, especially on mobile devices. * The name can be confusing, as it's more like an autofill. * You can learn more about it [following the specification](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#autofill). */ autoComplete?: string; /** * If `true`, the `input` element is focused during the first mount. */ autoFocus?: boolean | undefined; readOnly?: boolean | undefined; required?: boolean | undefined; helperText?: any; error?: boolean; success?: boolean; } export interface BaseInput extends BaseField { inputProps?: React.InputHTMLAttributes; inputRef?: React.RefObject; max?: number | string | undefined; min?: number | string | undefined; step?: number | string | undefined; } export interface BaseSelect extends BaseField { selectProps?: React.SelectHTMLAttributes; selectRef?: React.Ref; } export declare type ValueChangeHandler = (value?: any, event?: ChangeEvent) => void | boolean; export {};