1 | import * as React from "react";
|
2 | import { Alignment } from "../../common";
|
3 | import { HTMLInputProps, Props } from "../../common/props";
|
4 | export interface ControlProps extends Props, HTMLInputProps, React.RefAttributes<HTMLLabelElement> {
|
5 | /**
|
6 | * Alignment of the indicator within container.
|
7 | *
|
8 | * @default Alignment.LEFT
|
9 | */
|
10 | alignIndicator?: Alignment;
|
11 | /** Whether the control is checked. */
|
12 | checked?: boolean;
|
13 | /** JSX label for the control. */
|
14 | children?: React.ReactNode;
|
15 | /** Whether the control is initially checked (uncontrolled mode). */
|
16 | defaultChecked?: boolean;
|
17 | /** Whether the control is non-interactive. */
|
18 | disabled?: boolean;
|
19 | /** Whether the control should appear as an inline element. */
|
20 | inline?: boolean;
|
21 | /** Ref attached to the HTML `<input>` element backing this component. */
|
22 | inputRef?: React.Ref<HTMLInputElement>;
|
23 | /**
|
24 | * Text label for the control.
|
25 | *
|
26 | * Use `children` or `labelElement` to supply JSX content. This prop actually supports JSX elements,
|
27 | * but TypeScript will throw an error because `HTMLAttributes` only allows strings.
|
28 | */
|
29 | label?: string;
|
30 | /**
|
31 | * JSX Element label for the control.
|
32 | *
|
33 | * This prop is a workaround for TypeScript consumers as the type definition for `label` only
|
34 | * accepts strings. JavaScript consumers can provide a JSX element directly to `label`.
|
35 | */
|
36 | labelElement?: React.ReactNode;
|
37 | /** Whether this control should use large styles. */
|
38 | large?: boolean;
|
39 | /** Event handler invoked when input value is changed. */
|
40 | onChange?: React.FormEventHandler<HTMLInputElement>;
|
41 | /**
|
42 | * Name of the HTML tag that wraps the checkbox.
|
43 | *
|
44 | * By default a `<label>` is used, which effectively enlarges the click
|
45 | * target to include all of its children. Supply a different tag name if
|
46 | * this behavior is undesirable or you're listening to click events from a
|
47 | * parent element (as the label can register duplicate clicks).
|
48 | *
|
49 | * @default "label"
|
50 | */
|
51 | tagName?: keyof JSX.IntrinsicElements;
|
52 | }
|
53 | export interface SwitchProps extends ControlProps {
|
54 | /**
|
55 | * Text to display inside the switch indicator when checked.
|
56 | * If `innerLabel` is provided and this prop is omitted, then `innerLabel`
|
57 | * will be used for both states.
|
58 | *
|
59 | * @default innerLabel
|
60 | */
|
61 | innerLabelChecked?: string;
|
62 | /**
|
63 | * Text to display inside the switch indicator when unchecked.
|
64 | */
|
65 | innerLabel?: string;
|
66 | }
|
67 | /**
|
68 | * Switch component.
|
69 | *
|
70 | * @see https://blueprintjs.com/docs/#core/components/switch
|
71 | */
|
72 | export declare const Switch: React.FC<SwitchProps>;
|
73 | export type RadioProps = ControlProps;
|
74 | /**
|
75 | * Radio component.
|
76 | *
|
77 | * @see https://blueprintjs.com/docs/#core/components/radio
|
78 | */
|
79 | export declare const Radio: React.FC<RadioProps>;
|
80 | export interface CheckboxProps extends ControlProps {
|
81 | /** Whether this checkbox is initially indeterminate (uncontrolled mode). */
|
82 | defaultIndeterminate?: boolean;
|
83 | /**
|
84 | * Whether this checkbox is indeterminate, or "partially checked."
|
85 | * The checkbox will appear with a small dash instead of a tick to indicate that the value
|
86 | * is not exactly true or false.
|
87 | *
|
88 | * Note that this prop takes precendence over `checked`: if a checkbox is marked both
|
89 | * `checked` and `indeterminate` via props, it will appear as indeterminate in the DOM.
|
90 | */
|
91 | indeterminate?: boolean;
|
92 | }
|
93 | /**
|
94 | * Checkbox component.
|
95 | *
|
96 | * @see https://blueprintjs.com/docs/#core/components/checkbox
|
97 | */
|
98 | export declare const Checkbox: React.FC<CheckboxProps>;
|