diff --git a/index.d.ts b/index.d.ts index 586aa526..c901356e 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,193 +1,563 @@ -// Type definitions for react-toolbox 1.0.2 +// Type definitions for react-toolbox // Project: https://github.com/react-toolbox/react-toolbox // Definitions by: Per Bergqwist +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "react-toolbox" { + export import AppBar = __ReactToolbox.AppBar; + export import Autocomplete = __ReactToolbox.Autocomplete; + export import Avatar = __ReactToolbox.Avatar; + export import Button = __ReactToolbox.Button.Button; + export import IconButton = __ReactToolbox.Button.IconButton; + export import Card = __ReactToolbox.Card.Card; + export import CardTitle = __ReactToolbox.Card.CardTitle; + export import CardMedia = __ReactToolbox.Card.CardMedia; + export import CardText = __ReactToolbox.Card.CardText; + export import CardActions = __ReactToolbox.Card.CardActions; + export import Checkbox = __ReactToolbox.Checkbox; + export import Chip = __ReactToolbox.Chip; + export import DatePicker = __ReactToolbox.DatePicker; + export import Dialog = __ReactToolbox.Dialog; + export import Drawer = __ReactToolbox.Drawer; + export import Dropdown = __ReactToolbox.Dropdown; + export import FontIcon = __ReactToolbox.FontIcon; + export import Input = __ReactToolbox.Input; + export import Layout = __ReactToolbox.Layout.Layout; + export import Panel = __ReactToolbox.Layout.Panel; + export import NavDrawer = __ReactToolbox.Layout.NavDrawer; + export import Sidebar = __ReactToolbox.Layout.Sidebar; + export import Link = __ReactToolbox.Link; + export import List = __ReactToolbox.List.List; + export import ListCheckbox = __ReactToolbox.List.ListCheckbox; + export import ListItem = __ReactToolbox.List.ListItem; + export import ListDivider = __ReactToolbox.List.ListDivider; + export import ListSubHeader = __ReactToolbox.List.ListSubHeader; + export import Menu = __ReactToolbox.Menu.Menu; + export import MenuDivider = __ReactToolbox.Menu.MenuDivider; + export import MenuItem = __ReactToolbox.Menu.MenuItem; + export import IconMenu = __ReactToolbox.Menu.IconMenu; + export import Navigation = __ReactToolbox.Navigation; + export import ProgressBar = __ReactToolbox.ProgressBar; + export import RadioGroup = __ReactToolbox.Radio.RadioGroup; + export import RadioButton = __ReactToolbox.Radio.RadioButton; + export import Ripple = __ReactToolbox.Ripple; + export import Slider = __ReactToolbox.Slider; + export import Snackbar = __ReactToolbox.Snackbar; + export import Switch = __ReactToolbox.Switch; + export import Tabs = __ReactToolbox.Tabs.Tabs; + export import Tab = __ReactToolbox.Tabs.Tab; + export import TimePicker = __ReactToolbox.TimePicker; + export import Tooltip = __ReactToolbox.Tooltip; + + export import AppBarTheme = __ReactToolbox.AppBarTheme; + export import AutocompleteTheme = __ReactToolbox.AutocompleteTheme; + export import AvatarTheme = __ReactToolbox.AvatarTheme; + export import ButtonTheme = __ReactToolbox.Button.ButtonTheme; + export import IconButtonTheme = __ReactToolbox.Button.IconButtonTheme; + export import CardTheme = __ReactToolbox.Card.CardTheme; + export import CardTitleTheme = __ReactToolbox.Card.CardTitleTheme; + export import CardMediaTheme = __ReactToolbox.Card.CardMediaTheme; + export import CardTextTheme = __ReactToolbox.Card.CardTextTheme; + export import CardActionsTheme = __ReactToolbox.Card.CardActionsTheme; + export import CheckboxTheme = __ReactToolbox.CheckboxTheme; + export import ChipTheme = __ReactToolbox.ChipTheme; + export import DatePickerTheme = __ReactToolbox.DatePickerTheme; + export import DialogTheme = __ReactToolbox.DialogTheme; + export import DrawerTheme = __ReactToolbox.DrawerTheme; + export import DropdownTheme = __ReactToolbox.DropdownTheme; + export import InputTheme = __ReactToolbox.InputTheme; + export import LayoutTheme = __ReactToolbox.Layout.LayoutTheme; + export import PanelTheme = __ReactToolbox.Layout.PanelTheme; + export import NavDrawerTheme = __ReactToolbox.Layout.NavDrawerTheme; + export import SidebarTheme = __ReactToolbox.Layout.SidebarTheme; + export import LinkTheme = __ReactToolbox.LinkTheme; + export import ListTheme = __ReactToolbox.List.ListTheme; + export import ListCheckboxTheme = __ReactToolbox.List.ListCheckboxTheme; + export import ListItemTheme = __ReactToolbox.List.ListItemTheme; + export import ListDividerTheme = __ReactToolbox.List.ListDividerTheme; + export import ListSubHeaderTheme = __ReactToolbox.List.ListSubHeaderTheme; + export import MenuTheme = __ReactToolbox.Menu.MenuTheme; + export import MenuDividerTheme = __ReactToolbox.Menu.MenuDividerTheme; + export import MenuItemTheme = __ReactToolbox.Menu.MenuItemTheme; + export import IconMenuTheme = __ReactToolbox.Menu.IconMenuTheme; + export import NavigationTheme = __ReactToolbox.NavigationTheme; + export import ProgressBarTheme = __ReactToolbox.ProgressBarTheme; + export import RadioButtonTheme = __ReactToolbox.Radio.RadioButtonTheme; + export import RippleTheme = __ReactToolbox.RippleTheme; + export import SliderTheme = __ReactToolbox.SliderTheme; + export import SnackbarTheme = __ReactToolbox.SnackbarTheme; + export import SwitchTheme = __ReactToolbox.SwitchTheme; + export import TabsTheme = __ReactToolbox.Tabs.TabsTheme; + export import TabTheme = __ReactToolbox.Tabs.TabTheme; + export import TimePickerTheme = __ReactToolbox.TimePickerTheme; + export import TooltipTheme = __ReactToolbox.TooltipTheme; +} -// __ReactToolbox declare namespace __ReactToolbox { import React = __React; interface Props { + /** + * Set a class for the root component. + */ className?: string; + /** + * Key used to uniquely identify the element within an Array. + */ key?: string | number; + /** + * Callback called when the component is clicked. + */ onClick?: React.MouseEventHandler; + /** + * Set inline style for the root component. + */ style?: React.CSSProperties; } - /** - * - */ - interface AppBarThemeProps { + export interface AppBarTheme { + /** + * Used for the component root element. + */ appBar?: string; + /** + * Added to the root element when the app bar is fixed. + */ fixed?: string; + /** + * Added to the root element when the app bar is flat. + */ flat?: string; } interface AppBarProps extends Props { + /** + * Children to pass through the component. + */ children?: React.ReactNode; + /** + * Determine if the bar should have position fixed or relative. + * @default false + */ fixed?: boolean; + /** + * If true, the AppBar shows a shadow. + * @default false + */ flat?: boolean; - theme?: AppBarThemeProps; + /** + * Classnames object defining the component style. + */ + theme?: AppBarTheme; } export class AppBar extends React.Component { } - /** - * - */ - interface AutocompleteThemeProps { + export interface AutocompleteTheme { + /** + * Used for a suggestion when it's active. + */ active?: string; + /** + * Used for the root element. + */ autocomplete?: string; + /** + * Used when the input is focused. + */ focus?: string; + /** + * Used to style the Input component. + */ input?: string; + /** + * Used for the label. + */ label?: string; + /** + * Used to style each suggestion. + */ suggestion?: string; + /** + * Used to style the suggestions container. + */ suggestions?: string; + /** + * Used for the suggestions when it's opening to the top. + */ up?: string; + /** + * Classname used for a single value. + */ value?: string; + /** + * Classname used for the values container. + */ values?: string; } interface AutocompleteProps extends Props { + /** + * Determines the opening direction. It can be auto, up or down. + * @default auto + */ direction?: "auto" | "up" | "down"; + /** + * If true, component will be disabled. + */ disabled?: boolean; + /** + * Sets the error string for the internal input element. + * @default false + */ error?: string; + /** + * The text string to use for the floating label element. + */ label?: string; + /** + * If true, component can hold multiple values. + */ multiple?: boolean; + /** + * Callback function that is fired when the components's value changes. + * @default auto + */ onChange?: React.FormEventHandler; + /** + * Determines if the selected list is shown above or below input. It can be above or below. + * @default above + */ selectedPosition?: "above" | "below"; + /** + * If true, the list of suggestions will not be filtered when a value is selected. + * @default false + */ showSuggestionsWHenValueIsSet?: boolean; + /** + * Object of key/values or array representing all items suggested. + */ source?: any; + /** + * Determines how suggestions are supplied. + * @default start + */ suggestionMatch?: "start" | "anywhere" | "word"; - style?: React.CSSProperties; - theme?: AutocompleteThemeProps; + /** + * Classnames object defining the component style. + */ + theme?: AutocompleteTheme; + /** + * Value or array of values currently selected component. + */ value?: any; } export class Autocomplete extends React.Component { } - /** - * - */ - interface AvatarThemeProps { + export interface AvatarTheme { + /** + * Used for the root class of the element. + */ avatar?: string; + /** + * Added to the root element when the component has image. + */ image?: string; + /** + * Used for the root element if the component shows the letter. + */ letter?: string; } interface AvatarProps extends Props { + /** + * Children to pass through the component. + */ children?: React.ReactNode; + /** + * Set to true if your image is not squared so it will be used as a cover for the element. + */ cover?: boolean; + /** + * A key to identify an Icon from Material Design Icons or a custom Icon Element. + */ icon?: React.ReactNode | string; + /** + * An image source or an image element. + */ image?: React.ReactNode | string; - theme?: AvatarThemeProps; + /** + * Classnames object defining the component style. + */ + theme?: AvatarTheme; + /** + * A title for the image. If no image is provided, the first letter will be displayed as the avatar. + */ title?: string; } export class Avatar extends React.Component { } - // Button namespace Button { - /** - *