1 | import * as React from 'react';
|
2 | import {StyletronComponent} from 'styletron-react';
|
3 | import {Override} from '../overrides';
|
4 |
|
5 | export interface STATE_TYPE {
|
6 | change: 'CHANGE';
|
7 | }
|
8 |
|
9 | export interface ALIGN {
|
10 | vertical: 'vertical';
|
11 | horizontal: 'horizontal';
|
12 | }
|
13 |
|
14 | export type StateReducer = (
|
15 | stateType: string,
|
16 | nextState: State,
|
17 | currentState: State,
|
18 | event: React.SyntheticEvent<HTMLInputElement>,
|
19 | ) => State;
|
20 |
|
21 | export interface State {
|
22 | value?: string;
|
23 | }
|
24 |
|
25 | export interface StatefulContainerProps {
|
26 | overrides?: RadioOverrides & RadioGroupOverrides;
|
27 | children?: React.ReactNode;
|
28 | initialState?: State;
|
29 | stateReducer: StateReducer;
|
30 | onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
31 | autoFocus?: boolean;
|
32 | }
|
33 |
|
34 | export class StatefulContainer extends React.Component<
|
35 | StatefulContainerProps,
|
36 | State
|
37 | > {
|
38 | onChange(e: React.ChangeEventHandler<HTMLInputElement>): void;
|
39 | stateReducer(type: string, e: React.SyntheticEvent<HTMLInputElement>): void;
|
40 | }
|
41 |
|
42 | export interface StatefulRadioGroupProps {
|
43 | overrides?: RadioOverrides & RadioGroupOverrides;
|
44 | children?: React.ReactNode;
|
45 | initialState?: State;
|
46 | autoFocus?: boolean;
|
47 | name?: string;
|
48 | onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
49 | align?: 'horizontal' | 'vertical';
|
50 | }
|
51 |
|
52 | export const StatefulRadioGroup: React.FC<StatefulRadioGroupProps>;
|
53 |
|
54 | export interface RadioGroupProps {
|
55 | 'aria-describedby'?: string;
|
56 | 'aria-errormessage'?: string;
|
57 | 'aria-label'?: string;
|
58 | 'aria-labelledby'?: string;
|
59 | overrides?: RadioOverrides & RadioGroupOverrides;
|
60 | children?: React.ReactNode;
|
61 | value?: string;
|
62 | disabled?: boolean;
|
63 | required?: boolean;
|
64 | isError?: boolean;
|
65 | error?: boolean;
|
66 | autoFocus?: boolean;
|
67 | align?: 'horizontal' | 'vertical';
|
68 | name?: string;
|
69 | labelPlacement?: 'top' | 'right' | 'bottom' | 'left';
|
70 | onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
71 | onMouseEnter?: React.MouseEventHandler<HTMLInputElement>;
|
72 | onMouseLeave?: React.MouseEventHandler<HTMLInputElement>;
|
73 | onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
74 | onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
75 | }
|
76 |
|
77 | export class RadioGroup extends React.Component<RadioGroupProps> {}
|
78 |
|
79 | export interface RadioOverrides {
|
80 | RadioMarkInner?: Override<any>;
|
81 | RadioMarkOuter?: Override<any>;
|
82 | Label?: Override<any>;
|
83 | Root?: Override<any>;
|
84 | Input?: Override<any>;
|
85 | Description?: Override<any>;
|
86 | }
|
87 |
|
88 | export interface RadioGroupOverrides {
|
89 | RadioGroupRoot?: Override<any>;
|
90 | }
|
91 |
|
92 | export interface RadioProps {
|
93 | autoFocus?: boolean;
|
94 | checked?: boolean;
|
95 | children?: React.ReactNode;
|
96 | description?: string;
|
97 | disabled?: boolean;
|
98 | inputRef?: React.Ref<HTMLInputElement>;
|
99 | isError?: boolean;
|
100 | error?: boolean;
|
101 | isFocused?: boolean;
|
102 | isFocusVisible?: boolean;
|
103 | labelPlacement?: 'top' | 'right' | 'bottom' | 'left';
|
104 | name?: string;
|
105 | onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
106 | onMouseEnter?: React.MouseEventHandler<HTMLInputElement>;
|
107 | onMouseLeave?: React.MouseEventHandler<HTMLInputElement>;
|
108 | onFocus?: React.FocusEventHandler<HTMLInputElement>;
|
109 | onBlur?: React.FocusEventHandler<HTMLInputElement>;
|
110 | onMouseDown?: React.MouseEventHandler<HTMLInputElement>;
|
111 | onMouseUp?: React.MouseEventHandler<HTMLInputElement>;
|
112 | overrides?: RadioOverrides & RadioGroupOverrides;
|
113 | required?: boolean;
|
114 | value?: string;
|
115 | tabIndex?: string;
|
116 | }
|
117 |
|
118 | export interface RadioState {
|
119 | isActive: boolean;
|
120 | isHovered: boolean;
|
121 | }
|
122 |
|
123 | export class Radio extends React.Component<RadioProps, RadioState> {
|
124 | onMouseEnter(event: React.MouseEvent<HTMLInputElement>): void;
|
125 | onMouseLeave(event: React.MouseEvent<HTMLInputElement>): void;
|
126 | onMouseDown(event: React.MouseEvent<HTMLInputElement>): void;
|
127 | onMouseUp(event: React.MouseEvent<HTMLInputElement>): void;
|
128 | onFocus(event: React.FocusEvent<HTMLInputElement>): void;
|
129 | onBlur(event: React.FocusEvent<HTMLInputElement>): void;
|
130 | }
|
131 |
|
132 | export const StyledRoot: StyletronComponent<any>;
|
133 | export const StyledLabel: StyletronComponent<any>;
|
134 | export const StyledInput: StyletronComponent<any>;
|
135 | export const StyledDescription: StyletronComponent<any>;
|
136 | export const StyledRadioMarkInner: StyletronComponent<any>;
|
137 | export const StyledRadioMarkOuter: StyletronComponent<any>;
|
138 | export const StyledRadioGroupRoot: StyletronComponent<any>;
|
139 |
|
140 | export const STATE_TYPE: STATE_TYPE;
|
141 | export const ALIGN: ALIGN;
|