diff --git a/types/catho__quantum/components/Alert/index.d.ts b/types/catho__quantum/components/Alert/index.d.ts index fb4594f05c..acc74633ea 100644 --- a/types/catho__quantum/components/Alert/index.d.ts +++ b/types/catho__quantum/components/Alert/index.d.ts @@ -1,8 +1,8 @@ import React = require('react'); -export interface AlertProps { +export interface AlertProps { children: React.ReactNode; - onClose: () => void; + onClose: React.MouseEventHandler; icon?: string; skin?: 'primary' | 'success' | 'error' | 'neutral' | 'warning'; theme?: { @@ -16,4 +16,4 @@ export interface AlertProps { }; } -export default class Alert extends React.Component {} +export default class Alert extends React.Component> {} diff --git a/types/catho__quantum/components/Button/index.d.ts b/types/catho__quantum/components/Button/index.d.ts index 1afea90763..e5fc8f1a77 100644 --- a/types/catho__quantum/components/Button/index.d.ts +++ b/types/catho__quantum/components/Button/index.d.ts @@ -1,7 +1,7 @@ import React = require('react'); import IconButton from './IconButton'; -export interface ButtonProps { +export interface ButtonProps { center?: boolean; disabled?: boolean; stroked?: boolean; @@ -12,7 +12,7 @@ export interface ButtonProps { type?: 'button' | 'reset' | 'submit'; children?: React.ReactNode[] | React.ReactNode; $as?: JSX.Element | string; - onClick?: () => void; + onClick?: React.MouseEventHandler; theme?: { baseFontSize?: number; colors?: object; @@ -24,6 +24,6 @@ export interface ButtonProps { }; } -export default class Button extends React.Component { +export default class Button extends React.Component> { static Icon: IconButton; } diff --git a/types/catho__quantum/components/Checkbox/index.d.ts b/types/catho__quantum/components/Checkbox/index.d.ts index cd844aca22..c82579210c 100644 --- a/types/catho__quantum/components/Checkbox/index.d.ts +++ b/types/catho__quantum/components/Checkbox/index.d.ts @@ -1,6 +1,6 @@ import React = require('react'); -export interface CheckboxProps { +export interface CheckboxProps { checked?: boolean; disabled?: boolean; children?: string; @@ -9,7 +9,7 @@ export interface CheckboxProps { label?: string; name: string; value?: string; - onChange?: () => void; + onChange?: React.ChangeEventHandler; theme?: { colors?: object; spacing?: object; @@ -17,10 +17,10 @@ export interface CheckboxProps { }; } -export class Checkbox extends React.Component {} -export type CheckboxType = React.ComponentType; +export class Checkbox extends React.Component> {} +export type CheckboxType = React.ComponentType>; -export interface CheckboxButtonProps { +export interface CheckboxButtonProps { children?: React.ReactNode[] | React.ReactNode; skin?: 'neutral' | 'primary' | 'success' | 'warning' | 'error'; checked?: boolean; @@ -30,24 +30,25 @@ export interface CheckboxButtonProps { icon?: string; label?: string; name: string; - onChange?: () => void; + onChange?: React.ChangeEventHandler; value?: string; } -export type CheckboxButton = React.ComponentType; +export type CheckboxButton = React.ComponentType>; -export interface CheckboxGroupProps { +export type Options = Array<{ + checked?: boolean; + disabled?: boolean; + label?: React.ReactNode; + name: string; + value?: string; +}>; +export interface CheckboxGroupProps { children?: JSX.Element[] | JSX.Element; error?: string; inline?: boolean; - onChange?: () => void; - options?: Array<{ - checked?: boolean; - disabled?: boolean; - label?: React.ReactNode; - name: string; - value?: string; - }>; + onChange?: (items?: Options, event?: React.ChangeEvent) => void; + options?: Options; type: 'checkbox' | 'button'; theme?: { colors?: object; @@ -55,7 +56,7 @@ export interface CheckboxGroupProps { }; } -export class CheckboxGroup extends React.Component { +export class CheckboxGroup extends React.Component> { static Checkbox: CheckboxType; static Button: CheckboxButton; } diff --git a/types/catho__quantum/components/Dropdown/index.d.ts b/types/catho__quantum/components/Dropdown/index.d.ts index 3246639452..e7464f9b68 100644 --- a/types/catho__quantum/components/Dropdown/index.d.ts +++ b/types/catho__quantum/components/Dropdown/index.d.ts @@ -12,7 +12,8 @@ export interface DropdownProps { placeholder?: string; selectedItem?: ItemPropType; helperText?: string; - onChange?: () => void; + /** More about stateAndHelpers parameter here https://github.com/downshift-js/downshift#children-function */ + onChange?: (selectedItem?: React.ElementType | null, stateAndHelpers?: any) => void; items?: ItemPropType[]; theme?: { colors?: object; diff --git a/types/catho__quantum/components/Form/index.d.ts b/types/catho__quantum/components/Form/index.d.ts index 927978aca1..f7f1ea5952 100644 --- a/types/catho__quantum/components/Form/index.d.ts +++ b/types/catho__quantum/components/Form/index.d.ts @@ -2,8 +2,8 @@ import React = require('react'); export interface FormProps { children: React.ReactNode[] | React.ReactNode; - onSubmit?: () => void; - onValidSubmit?: () => void; + onSubmit?: ({ valid }?: { valid: boolean }) => void; + onValidSubmit?: (values?: { [name: string]: string | undefined }) => void; noValidate?: boolean; } diff --git a/types/catho__quantum/components/Input/index.d.ts b/types/catho__quantum/components/Input/index.d.ts index 60f47f6adc..2a638ebe67 100644 --- a/types/catho__quantum/components/Input/index.d.ts +++ b/types/catho__quantum/components/Input/index.d.ts @@ -3,7 +3,7 @@ import React = require('react'); export type MaskFunction = (rawValue: string) => string[]; export type Mask = boolean | RegExp | string | MaskFunction; -export interface InputProps { +export interface InputProps { value?: string; label?: string; helperText?: string; @@ -14,8 +14,8 @@ export interface InputProps { error?: string; id?: string; mask?: Mask | Mask[]; - onClean?: () => void; - onChange?: () => void; + onClean?: React.MouseEventHandler; + onChange?: React.ChangeEventHandler; theme?: { spacing?: object; colors?: object; @@ -23,4 +23,4 @@ export interface InputProps { }; } -export default class Input extends React.Component {} +export default class Input extends React.Component> {} diff --git a/types/catho__quantum/components/Modal/index.d.ts b/types/catho__quantum/components/Modal/index.d.ts index ba6e158238..4b8beb164f 100644 --- a/types/catho__quantum/components/Modal/index.d.ts +++ b/types/catho__quantum/components/Modal/index.d.ts @@ -1,8 +1,8 @@ import React = require('react'); -export interface ModalProps { +export interface ModalProps { children?: React.ReactNode[] | React.ReactNode; - onClose?: () => void; + onClose?: React.MouseEventHandler; closeButtonAriaLabel?: string; theme?: { breakpoints?: object; @@ -14,4 +14,4 @@ export interface ModalProps { }; } -export default class Modal extends React.Component {} +export default class Modal extends React.Component> {} diff --git a/types/catho__quantum/components/Pagination/index.d.ts b/types/catho__quantum/components/Pagination/index.d.ts index e9259af6a7..a5506342fb 100644 --- a/types/catho__quantum/components/Pagination/index.d.ts +++ b/types/catho__quantum/components/Pagination/index.d.ts @@ -8,10 +8,10 @@ export interface PaginationProps { totalPages: number; nextButtonText?: string; pageAriaLabel?: string; - pageHref?: () => void; + pageHref?: (page?: number) => void; prevButtonText?: string; - onPageClick?: () => void; - infoFormatter?: () => void; + onPageClick?: (page?: number) => void; + infoFormatter?: (activePage?: number, lastPage?: number) => void; followOnlyFirstPage?: boolean; } diff --git a/types/catho__quantum/components/RadioGroup/index.d.ts b/types/catho__quantum/components/RadioGroup/index.d.ts index e0e3770df7..4e85d80e37 100644 --- a/types/catho__quantum/components/RadioGroup/index.d.ts +++ b/types/catho__quantum/components/RadioGroup/index.d.ts @@ -1,11 +1,11 @@ import React = require('react'); -export interface RadioProps { +export interface RadioProps { disabled?: boolean; error?: boolean; children?: string; label?: string; - onChange?: () => void; + onChange?: React.ChangeEventHandler; theme?: { colors?: object; spacing?: object; @@ -13,9 +13,9 @@ export interface RadioProps { value: string; } -export type Radio = React.ComponentType; +export type Radio = React.ComponentType>; -export interface RadioButtonProps { +export interface RadioButtonProps { checked?: boolean; children?: string; skin?: 'neutral' | 'primary' | 'success' | 'warning' | 'error'; @@ -25,7 +25,7 @@ export interface RadioButtonProps { id?: string; inline?: boolean; label?: string; - onChange?: () => void; + onChange?: React.ChangeEventHandler; theme?: { baseFontSize?: number; spacing?: object; @@ -37,9 +37,9 @@ export interface RadioButtonProps { value: string; } -export type RadioButton = React.ComponentType; +export type RadioButton = React.ComponentType>; -export interface RadioGroupProps { +export interface RadioGroupProps { type?: 'radio' | 'button'; options?: Array<{ label?: React.ReactNode; @@ -49,7 +49,7 @@ export interface RadioGroupProps { children?: JSX.Element[] | JSX.Element; inline?: boolean; - onChange?: () => void; + onChange?: React.ChangeEventHandler; value?: string; error?: string; theme?: { @@ -59,7 +59,7 @@ export interface RadioGroupProps { name: string; } -export default class RadioGroup extends React.Component { +export default class RadioGroup extends React.Component> { static Radio: Radio; static Button: RadioButton; diff --git a/types/catho__quantum/components/RangeSlider/index.d.ts b/types/catho__quantum/components/RangeSlider/index.d.ts index 9f00135194..7820d95c84 100644 --- a/types/catho__quantum/components/RangeSlider/index.d.ts +++ b/types/catho__quantum/components/RangeSlider/index.d.ts @@ -1,12 +1,12 @@ import React = require('react'); -export interface RangeSliderProps { +export interface RangeSliderProps { step?: number; max?: number; min?: number; disabled?: boolean; - onChange?: () => void; - onChangeCommitted?: () => void; + onChange?: React.ChangeEventHandler; + onChangeCommitted?: React.ChangeEventHandler; marks?: Array<{ value?: string | number; label?: string; @@ -14,7 +14,7 @@ export interface RangeSliderProps { valueLabelDisplay?: 'auto' | 'on' | 'off'; track?: 'normal' | false | 'inverted'; 'aria-labelledby'?: string; - tipFormatter?: () => void; + tipFormatter?: (value?: number, index?: number) => string; value?: number | { from: number; to: number }; defaultValue?: number | { from: number; to: number }; theme?: { @@ -24,4 +24,4 @@ export interface RangeSliderProps { }; } -export default class RangeSlider extends React.Component {} +export default class RangeSlider extends React.Component> {} diff --git a/types/catho__quantum/components/SnackBar/index.d.ts b/types/catho__quantum/components/SnackBar/index.d.ts index 1a9b496efa..341a51e55e 100644 --- a/types/catho__quantum/components/SnackBar/index.d.ts +++ b/types/catho__quantum/components/SnackBar/index.d.ts @@ -1,9 +1,9 @@ import React = require('react'); -export interface SnackBarProps { +export interface SnackBarProps { actionTrigger?: { title?: string; - callback?: () => void; + callback?: React.MouseEventHandler; }; theme?: { baseFontSize?: number; @@ -16,7 +16,7 @@ export interface SnackBarProps { }; }; closeButtonAriaLabel?: string; - onClose?: () => void; + onClose?: React.MouseEventHandler; secondsToClose?: number; skin?: 'primary' | 'success' | 'error' | 'neutral' | 'warning'; text?: string; @@ -24,4 +24,4 @@ export interface SnackBarProps { id?: string; } -export default class SnackBar extends React.Component {} +export default class SnackBar extends React.Component> {} diff --git a/types/catho__quantum/components/Tag/index.d.ts b/types/catho__quantum/components/Tag/index.d.ts index d687be4833..4a03daac64 100644 --- a/types/catho__quantum/components/Tag/index.d.ts +++ b/types/catho__quantum/components/Tag/index.d.ts @@ -1,9 +1,9 @@ import React = require('react'); -export interface TagProps { +export interface TagProps { bold?: boolean; inverted?: boolean; - onClose?: () => void; + onClose?: React.MouseEventHandler; size?: 'small' | 'medium' | 'large'; skin?: 'neutral' | 'primary' | 'success' | 'warning' | 'error'; stroked?: boolean; @@ -17,4 +17,4 @@ export interface TagProps { }; } -export default class Tag extends React.Component {} +export default class Tag extends React.Component> {} diff --git a/types/catho__quantum/components/TextArea/index.d.ts b/types/catho__quantum/components/TextArea/index.d.ts index 1c293177be..067c96eb4a 100644 --- a/types/catho__quantum/components/TextArea/index.d.ts +++ b/types/catho__quantum/components/TextArea/index.d.ts @@ -1,15 +1,15 @@ import React = require('react'); -export interface TextAreaProps { +export interface TextAreaProps { disabled?: boolean; error?: string; helperText?: string; label?: string; - onChange?: () => void; + onChange?: React.ChangeEventHandler; placeholder?: string; required?: boolean; value?: string; id?: string | number; } -export default class TextArea extends React.Component {} +export default class TextArea extends React.Component> {}