UNPKG

8.2 kBTypeScriptView Raw
1// Generated by dts-bundle v0.7.3
2// Dependencies for this module:
3// ../../@material/base/component
4// ../../@material/ripple/component
5// ../../@material/ripple/types
6// ../../@material/base/foundation
7
8declare module '@material/switch' {
9 /**
10 * @license
11 * Copyright 2019 Google Inc.
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining a copy
14 * of this software and associated documentation files (the "Software"), to deal
15 * in the Software without restriction, including without limitation the rights
16 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17 * copies of the Software, and to permit persons to whom the Software is
18 * furnished to do so, subject to the following conditions:
19 *
20 * The above copyright notice and this permission notice shall be included in
21 * all copies or substantial portions of the Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29 * THE SOFTWARE.
30 */
31 export * from '@material/switch/adapter';
32 export * from '@material/switch/component';
33 export * from '@material/switch/constants';
34 export * from '@material/switch/foundation';
35}
36
37declare module '@material/switch/adapter' {
38 /**
39 * Defines the shape of the adapter expected by the foundation.
40 * Implement this adapter for your framework of choice to delegate updates to
41 * the component in your framework of choice. See architecture documentation
42 * for more details.
43 * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
44 */
45 export interface MDCSwitchAdapter {
46 /**
47 * Adds a CSS class to the root element.
48 */
49 addClass(className: string): void;
50 /**
51 * Removes a CSS class from the root element.
52 */
53 removeClass(className: string): void;
54 /**
55 * Sets checked state of the native HTML control underlying the switch.
56 */
57 setNativeControlChecked(checked: boolean): void;
58 /**
59 * Sets the disabled state of the native HTML control underlying the switch.
60 */
61 setNativeControlDisabled(disabled: boolean): void;
62 /**
63 * Sets an attribute value of the native HTML control underlying the switch.
64 */
65 setNativeControlAttr(attr: string, value: string): void;
66 }
67}
68
69declare module '@material/switch/component' {
70 /**
71 * @license
72 * Copyright 2018 Google Inc.
73 *
74 * Permission is hereby granted, free of charge, to any person obtaining a copy
75 * of this software and associated documentation files (the "Software"), to deal
76 * in the Software without restriction, including without limitation the rights
77 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
78 * copies of the Software, and to permit persons to whom the Software is
79 * furnished to do so, subject to the following conditions:
80 *
81 * The above copyright notice and this permission notice shall be included in
82 * all copies or substantial portions of the Software.
83 *
84 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
85 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
86 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
87 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
88 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
89 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
90 * THE SOFTWARE.
91 */
92 import { MDCComponent } from '@material/base/component';
93 import { MDCRipple } from '@material/ripple/component';
94 import { MDCRippleCapableSurface } from '@material/ripple/types';
95 import { MDCSwitchFoundation } from '@material/switch/foundation';
96 export class MDCSwitch extends MDCComponent<MDCSwitchFoundation> implements MDCRippleCapableSurface {
97 static attachTo(root: HTMLElement): MDCSwitch;
98 destroy(): void;
99 initialSyncWithDOM(): void;
100 getDefaultFoundation(): MDCSwitchFoundation;
101 get ripple(): MDCRipple;
102 get checked(): boolean;
103 set checked(checked: boolean);
104 get disabled(): boolean;
105 set disabled(disabled: boolean);
106 }
107}
108
109declare module '@material/switch/constants' {
110 /** CSS classes used by the switch. */
111 const cssClasses: {
112 /** Class used for a switch that is in the "checked" (on) position. */
113 CHECKED: string;
114 /** Class used for a switch that is disabled. */
115 DISABLED: string;
116 };
117 /** String constants used by the switch. */
118 const strings: {
119 /** Aria attribute for checked or unchecked state of switch */
120 ARIA_CHECKED_ATTR: string;
121 /** A CSS selector used to locate the native HTML control for the switch. */
122 NATIVE_CONTROL_SELECTOR: string;
123 /** A CSS selector used to locate the ripple surface element for the switch. */
124 RIPPLE_SURFACE_SELECTOR: string;
125 };
126 export { cssClasses, strings };
127}
128
129declare module '@material/switch/foundation' {
130 /**
131 * @license
132 * Copyright 2018 Google Inc.
133 *
134 * Permission is hereby granted, free of charge, to any person obtaining a copy
135 * of this software and associated documentation files (the "Software"), to deal
136 * in the Software without restriction, including without limitation the rights
137 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
138 * copies of the Software, and to permit persons to whom the Software is
139 * furnished to do so, subject to the following conditions:
140 *
141 * The above copyright notice and this permission notice shall be included in
142 * all copies or substantial portions of the Software.
143 *
144 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
145 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
146 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
147 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
148 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
149 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
150 * THE SOFTWARE.
151 */
152 import { MDCFoundation } from '@material/base/foundation';
153 import { MDCSwitchAdapter } from '@material/switch/adapter';
154 export class MDCSwitchFoundation extends MDCFoundation<MDCSwitchAdapter> {
155 /** The string constants used by the switch. */
156 static get strings(): {
157 ARIA_CHECKED_ATTR: string;
158 NATIVE_CONTROL_SELECTOR: string;
159 RIPPLE_SURFACE_SELECTOR: string;
160 };
161 /** The CSS classes used by the switch. */
162 static get cssClasses(): {
163 CHECKED: string;
164 DISABLED: string;
165 };
166 /** The default Adapter for the switch. */
167 static get defaultAdapter(): MDCSwitchAdapter;
168 constructor(adapter?: Partial<MDCSwitchAdapter>);
169 /** Sets the checked state of the switch. */
170 setChecked(checked: boolean): void;
171 /** Sets the disabled state of the switch. */
172 setDisabled(disabled: boolean): void;
173 /** Handles the change event for the switch native control. */
174 handleChange(evt: Event): void;
175 }
176 export default MDCSwitchFoundation;
177}
178