UNPKG

94 kBTypeScriptView Raw
1// Generated by dts-bundle v0.7.3
2// Dependencies for this module:
3// ../../@material/base/component
4// ../../@material/base/foundation
5// ../../@material/ripple/component
6// ../../@material/ripple/types
7
8declare module '@material/chips' {
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/chips/chip-set/index';
32 /**
33 * Backwards compatibility for existing clients.
34 */
35 import * as deprecated from '@material/chips/deprecated/index';
36 export { deprecated, };
37}
38
39declare module '@material/chips/chip-set/index' {
40 /**
41 * @license
42 * Copyright 2020 Google Inc.
43 *
44 * Permission is hereby granted, free of charge, to any person obtaining a copy
45 * of this software and associated documentation files (the "Software"), to deal
46 * in the Software without restriction, including without limitation the rights
47 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
48 * copies of the Software, and to permit persons to whom the Software is
49 * furnished to do so, subject to the following conditions:
50 *
51 * The above copyright notice and this permission notice shall be included in
52 * all copies or substantial portions of the Software.
53 *
54 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
55 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
56 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
57 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
58 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
59 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
60 * THE SOFTWARE.
61 */
62 export * from '@material/chips/chip-set/adapter';
63 export * from '@material/chips/chip-set/component';
64 export * from '@material/chips/chip-set/constants';
65 export * from '@material/chips/chip-set/foundation';
66}
67
68declare module '@material/chips/deprecated/index' {
69 /**
70 * @license
71 * Copyright 2019 Google Inc.
72 *
73 * Permission is hereby granted, free of charge, to any person obtaining a copy
74 * of this software and associated documentation files (the "Software"), to deal
75 * in the Software without restriction, including without limitation the rights
76 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
77 * copies of the Software, and to permit persons to whom the Software is
78 * furnished to do so, subject to the following conditions:
79 *
80 * The above copyright notice and this permission notice shall be included in
81 * all copies or substantial portions of the Software.
82 *
83 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
84 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
85 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
86 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
87 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
88 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
89 * THE SOFTWARE.
90 */
91 export * from '@material/chips/deprecated/trailingaction/index';
92 export * from '@material/chips/deprecated/chip/index';
93 export * from '@material/chips/deprecated/chip-set/index';
94}
95
96declare module '@material/chips/chip-set/adapter' {
97 /**
98 * @license
99 * Copyright 2020 Google Inc.
100 *
101 * Permission is hereby granted, free of charge, to any person obtaining a copy
102 * of this software and associated documentation files (the "Software"), to deal
103 * in the Software without restriction, including without limitation the rights
104 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
105 * copies of the Software, and to permit persons to whom the Software is
106 * furnished to do so, subject to the following conditions:
107 *
108 * The above copyright notice and this permission notice shall be included in
109 * all copies or substantial portions of the Software.
110 *
111 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
112 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
113 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
114 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
115 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
116 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
117 * THE SOFTWARE.
118 */
119 import { ActionType, FocusBehavior } from '@material/chips/action/constants';
120 import { Animation } from '@material/chips/chip/constants';
121 import { Attributes, Events } from '@material/chips/chip-set/constants';
122 /**
123 * Defines the shape of the adapter expected by the foundation.
124 * Implement this adapter for your framework of choice to delegate updates to
125 * the component in your framework of choice. See architecture documentation
126 * for more details.
127 * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
128 */
129 export interface MDCChipSetAdapter {
130 /** Announces the message via an aria-live region */
131 announceMessage(message: string): void;
132 /** Emits the given event with the given detail. */
133 emitEvent<D extends object>(eventName: Events, eventDetail: D): void;
134 /** Returns the value for the given attribute, if it exists. */
135 getAttribute(attrName: Attributes): string | null;
136 /** Returns the actions provided by the child chip at the given index. */
137 getChipActionsAtIndex(index: number): ActionType[];
138 /** Returns the number of child chips. */
139 getChipCount(): number;
140 /** Returns the ID of the chip at the given index. */
141 getChipIdAtIndex(index: number): string;
142 /** Returns the index of the child chip with the matching ID. */
143 getChipIndexById(chipID: string): number;
144 /** Proxies to the MDCChip#isActionFocusable method. */
145 isChipFocusableAtIndex(index: number, actionType: ActionType): boolean;
146 /** Proxies to the MDCChip#isActionSelectable method. */
147 isChipSelectableAtIndex(index: number, actionType: ActionType): boolean;
148 /** Proxies to the MDCChip#isActionSelected method. */
149 isChipSelectedAtIndex(index: number, actionType: ActionType): boolean;
150 /** Removes the chip at the given index. */
151 removeChipAtIndex(index: number): void;
152 /** Proxies to the MDCChip#setActionFocus method. */
153 setChipFocusAtIndex(index: number, action: ActionType, focus: FocusBehavior): void;
154 /** Proxies to the MDCChip#setActionSelected method. */
155 setChipSelectedAtIndex(index: number, actionType: ActionType, isSelected: boolean): void;
156 /** Starts the chip animation at the given index. */
157 startChipAnimationAtIndex(index: number, animation: Animation): void;
158 }
159}
160
161declare module '@material/chips/chip-set/component' {
162 /**
163 * @license
164 * Copyright 2018 Google Inc.
165 *
166 * Permission is hereby granted, free of charge, to any person obtaining a copy
167 * of this software and associated documentation files (the "Software"), to deal
168 * in the Software without restriction, including without limitation the rights
169 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
170 * copies of the Software, and to permit persons to whom the Software is
171 * furnished to do so, subject to the following conditions:
172 *
173 * The above copyright notice and this permission notice shall be included in
174 * all copies or substantial portions of the Software.
175 *
176 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
177 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
178 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
179 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
180 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
181 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
182 * THE SOFTWARE.
183 */
184 import { MDCComponent } from '@material/base/component';
185 import { ActionType } from '@material/chips/action/constants';
186 import { MDCChipFactory } from '@material/chips/chip/component';
187 import { MDCChipSetFoundation } from '@material/chips/chip-set/foundation';
188 /**
189 * MDCChip provides component encapsulation of the foundation implementation.
190 */
191 export class MDCChipSet extends MDCComponent<MDCChipSetFoundation> {
192 static attachTo(root: Element): MDCChipSet;
193 initialize(chipFactory?: MDCChipFactory): void;
194 initialSyncWithDOM(): void;
195 destroy(): void;
196 getDefaultFoundation(): MDCChipSetFoundation;
197 /** Returns the index of the chip with the given ID or -1 if none exists. */
198 getChipIndexByID(chipID: string): number;
199 /**
200 * Returns the ID of the chip at the given index or an empty string if the
201 * index is out of bounds.
202 */
203 getChipIdAtIndex(index: number): string;
204 /** Returns the unique indexes of the selected chips. */
205 getSelectedChipIndexes(): ReadonlySet<number>;
206 /** Sets the selection state of the chip. */
207 setChipSelected(index: number, action: ActionType, isSelected: boolean): void;
208 /** Returns the selection state of the chip. */
209 isChipSelected(index: number, action: ActionType): boolean;
210 /** Animates the chip addition at the given index. */
211 addChip(index: number): void;
212 /** Removes the chip at the given index. */
213 removeChip(index: number): void;
214 }
215}
216
217declare module '@material/chips/chip-set/constants' {
218 /**
219 * Events provides the named constants for strings used by the foundation.
220 */
221 export enum Attributes {
222 ARIA_MULTISELECTABLE = "aria-multiselectable"
223 }
224 /**
225 * CssClasses provides the named constants for class names.
226 */
227 export enum CssClasses {
228 CHIP = "mdc-evolution-chip"
229 }
230 /**
231 * Events provides the constants for emitted events.
232 */
233 export enum Events {
234 INTERACTION = "MDCChipSet:interaction",
235 REMOVAL = "MDCChipSet:removal",
236 SELECTION = "MDCChipSet:selection"
237 }
238}
239
240declare module '@material/chips/chip-set/foundation' {
241 /**
242 * @license
243 * Copyright 2020 Google Inc.
244 *
245 * Permission is hereby granted, free of charge, to any person obtaining a copy
246 * of this software and associated documentation files (the "Software"), to deal
247 * in the Software without restriction, including without limitation the rights
248 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
249 * copies of the Software, and to permit persons to whom the Software is
250 * furnished to do so, subject to the following conditions:
251 *
252 * The above copyright notice and this permission notice shall be included in
253 * all copies or substantial portions of the Software.
254 *
255 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
256 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
257 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
258 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
259 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
260 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
261 * THE SOFTWARE.
262 */
263 import { MDCFoundation } from '@material/base/foundation';
264 import { ActionType } from '@material/chips/action/constants';
265 import { MDCChipSetAdapter } from '@material/chips/chip-set/adapter';
266 import { ChipAnimationEvent, ChipInteractionEvent, ChipNavigationEvent } from '@material/chips/chip-set/types';
267 /**
268 * MDCChipSetFoundation provides a foundation for all chips.
269 */
270 export class MDCChipSetFoundation extends MDCFoundation<MDCChipSetAdapter> {
271 static get defaultAdapter(): MDCChipSetAdapter;
272 constructor(adapter?: Partial<MDCChipSetAdapter>);
273 handleChipAnimation({ detail }: ChipAnimationEvent): void;
274 handleChipInteraction({ detail }: ChipInteractionEvent): void;
275 handleChipNavigation({ detail }: ChipNavigationEvent): void;
276 /** Returns the unique selected indexes of the chips. */
277 getSelectedChipIndexes(): ReadonlySet<number>;
278 /** Sets the selected state of the chip at the given index and action. */
279 setChipSelected(index: number, action: ActionType, isSelected: boolean): void;
280 /** Returns the selected state of the chip at the given index and action. */
281 isChipSelected(index: number, action: ActionType): boolean;
282 /** Removes the chip at the given index. */
283 removeChip(index: number): void;
284 addChip(index: number): void;
285 }
286 export default MDCChipSetFoundation;
287}
288
289declare module '@material/chips/deprecated/trailingaction/index' {
290 /**
291 * @license
292 * Copyright 2020 Google Inc.
293 *
294 * Permission is hereby granted, free of charge, to any person obtaining a copy
295 * of this software and associated documentation files (the "Software"), to deal
296 * in the Software without restriction, including without limitation the rights
297 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
298 * copies of the Software, and to permit persons to whom the Software is
299 * furnished to do so, subject to the following conditions:
300 *
301 * The above copyright notice and this permission notice shall be included in
302 * all copies or substantial portions of the Software.
303 *
304 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
305 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
306 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
307 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
308 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
309 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
310 * THE SOFTWARE.
311 */
312 export * from '@material/chips/deprecated/trailingaction/adapter';
313 export * from '@material/chips/deprecated/trailingaction/component';
314 export * from '@material/chips/deprecated/trailingaction/foundation';
315 export * from '@material/chips/deprecated/trailingaction/types';
316 export { strings as trailingActionStrings } from '@material/chips/deprecated/trailingaction/constants';
317}
318
319declare module '@material/chips/deprecated/chip/index' {
320 /**
321 * @license
322 * Copyright 2019 Google Inc.
323 *
324 * Permission is hereby granted, free of charge, to any person obtaining a copy
325 * of this software and associated documentation files (the "Software"), to deal
326 * in the Software without restriction, including without limitation the rights
327 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
328 * copies of the Software, and to permit persons to whom the Software is
329 * furnished to do so, subject to the following conditions:
330 *
331 * The above copyright notice and this permission notice shall be included in
332 * all copies or substantial portions of the Software.
333 *
334 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
335 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
336 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
337 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
338 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
339 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
340 * THE SOFTWARE.
341 */
342 export * from '@material/chips/deprecated/chip/adapter';
343 export * from '@material/chips/deprecated/chip/component';
344 export * from '@material/chips/deprecated/chip/foundation';
345 export * from '@material/chips/deprecated/chip/types';
346 export { cssClasses as chipCssClasses, strings as chipStrings } from '@material/chips/deprecated/chip/constants';
347}
348
349declare module '@material/chips/deprecated/chip-set/index' {
350 /**
351 * @license
352 * Copyright 2019 Google Inc.
353 *
354 * Permission is hereby granted, free of charge, to any person obtaining a copy
355 * of this software and associated documentation files (the "Software"), to deal
356 * in the Software without restriction, including without limitation the rights
357 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
358 * copies of the Software, and to permit persons to whom the Software is
359 * furnished to do so, subject to the following conditions:
360 *
361 * The above copyright notice and this permission notice shall be included in
362 * all copies or substantial portions of the Software.
363 *
364 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
365 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
366 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
367 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
368 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
369 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
370 * THE SOFTWARE.
371 */
372 export * from '@material/chips/deprecated/chip-set/adapter';
373 export * from '@material/chips/deprecated/chip-set/component';
374 export * from '@material/chips/deprecated/chip-set/foundation';
375 export { cssClasses as chipSetCssClasses, strings as chipSetStrings } from '@material/chips/deprecated/chip-set/constants';
376}
377
378declare module '@material/chips/action/constants' {
379 /**
380 * CssClasses provides the classes to be queried and manipulated on the root.
381 */
382 export enum CssClasses {
383 PRIMARY_ACTION = "mdc-evolution-chip__action--primary",
384 TRAILING_ACTION = "mdc-evolution-chip__action--trailing",
385 CHIP_ROOT = "mdc-evolution-chip"
386 }
387 /**
388 * InteractionTrigger provides detail of the different triggers for action
389 * interactions.
390 */
391 export enum InteractionTrigger {
392 UNSPECIFIED = 0,
393 CLICK = 1,
394 BACKSPACE_KEY = 2,
395 DELETE_KEY = 3,
396 SPACEBAR_KEY = 4,
397 ENTER_KEY = 5
398 }
399 /**
400 * ActionType provides the different types of available actions.
401 */
402 export enum ActionType {
403 UNSPECIFIED = 0,
404 PRIMARY = 1,
405 TRAILING = 2
406 }
407 /**
408 * Events provides the different events emitted by the action.
409 */
410 export enum Events {
411 INTERACTION = "MDCChipAction:interaction",
412 NAVIGATION = "MDCChipAction:navigation"
413 }
414 /**
415 * FocusBehavior provides configurations for focusing or unfocusing an action.
416 */
417 export enum FocusBehavior {
418 FOCUSABLE = 0,
419 FOCUSABLE_AND_FOCUSED = 1,
420 NOT_FOCUSABLE = 2
421 }
422 /**
423 * Attributes provides the HTML attributes used by the foundation.
424 */
425 export enum Attributes {
426 ARIA_DISABLED = "aria-disabled",
427 ARIA_HIDDEN = "aria-hidden",
428 ARIA_SELECTED = "aria-selected",
429 DATA_DELETABLE = "data-mdc-deletable",
430 DISABLED = "disabled",
431 ROLE = "role",
432 TAB_INDEX = "tabindex"
433 }
434}
435
436declare module '@material/chips/chip/constants' {
437 /**
438 * CssClasses provides the named constants for class names.
439 */
440 export enum CssClasses {
441 SELECTING = "mdc-evolution-chip--selecting",
442 DESELECTING = "mdc-evolution-chip--deselecting",
443 SELECTING_WITH_PRIMARY_ICON = "mdc-evolution-chip--selecting-with-primary-icon",
444 DESELECTING_WITH_PRIMARY_ICON = "mdc-evolution-chip--deselecting-with-primary-icon",
445 DISABLED = "mdc-evolution-chip--disabled",
446 ENTER = "mdc-evolution-chip--enter",
447 EXIT = "mdc-evolution-chip--exit",
448 SELECTED = "mdc-evolution-chip--selected",
449 HIDDEN = "mdc-evolution-chip--hidden",
450 WITH_PRIMARY_ICON = "mdc-evolution-chip--with-primary-icon"
451 }
452 /**
453 * Events provides the named constants for emitted events.
454 */
455 export enum Events {
456 INTERACTION = "MDCChip:interaction",
457 NAVIGATION = "MDCChip:navigation",
458 ANIMATION = "MDCChip:animation"
459 }
460 /**
461 * Events provides the named constants for strings used by the foundation.
462 */
463 export enum Attributes {
464 DATA_REMOVED_ANNOUNCEMENT = "data-mdc-removed-announcement",
465 DATA_ADDED_ANNOUNCEMENT = "data-mdc-added-announcement"
466 }
467 /**
468 * Animation provides the names of runnable animations.
469 */
470 export enum Animation {
471 ENTER = "mdc-evolution-chip-enter",
472 EXIT = "mdc-evolution-chip-exit"
473 }
474}
475
476declare module '@material/chips/chip/component' {
477 /**
478 * @license
479 * Copyright 2018 Google Inc.
480 *
481 * Permission is hereby granted, free of charge, to any person obtaining a copy
482 * of this software and associated documentation files (the "Software"), to deal
483 * in the Software without restriction, including without limitation the rights
484 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
485 * copies of the Software, and to permit persons to whom the Software is
486 * furnished to do so, subject to the following conditions:
487 *
488 * The above copyright notice and this permission notice shall be included in
489 * all copies or substantial portions of the Software.
490 *
491 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
492 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
493 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
494 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
495 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
496 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
497 * THE SOFTWARE.
498 */
499 import { MDCComponent } from '@material/base/component';
500 import { MDCChipActionFactory } from '@material/chips/action/component';
501 import { ActionType, FocusBehavior } from '@material/chips/action/constants';
502 import { Animation } from '@material/chips/chip/constants';
503 import { MDCChipFoundation } from '@material/chips/chip/foundation';
504 /**
505 * MDCChipFactory is used by the parent MDCChipSet component to initialize
506 * chips.
507 */
508 export type MDCChipFactory = (el: Element, foundation?: MDCChipFoundation) => MDCChip;
509 /**
510 * MDCChip provides component encapsulation of the foundation implementation.
511 */
512 export class MDCChip extends MDCComponent<MDCChipFoundation> {
513 static attachTo(root: Element): MDCChip;
514 initialize(actionFactory?: MDCChipActionFactory): void;
515 initialSyncWithDOM(): void;
516 destroy(): void;
517 getDefaultFoundation(): MDCChipFoundation;
518 /** Exposed to be called by the parent chip set. */
519 remove(): void;
520 /** Returns the ActionTypes for the encapsulated actions. */
521 getActions(): ActionType[];
522 /** Returns the ID of the root element. */
523 getElementID(): string;
524 isDisabled(): boolean;
525 setDisabled(isDisabled: boolean): void;
526 /** Returns the focusability of the action. */
527 isActionFocusable(action: ActionType): boolean;
528 /** Returns the selectability of the action. */
529 isActionSelectable(action: ActionType): boolean;
530 /** Returns the selected state of the action. */
531 isActionSelected(action: ActionType): boolean;
532 /** Sets the focus behavior of the action. */
533 setActionFocus(action: ActionType, focus: FocusBehavior): void;
534 /** Sets the selected state of the action. */
535 setActionSelected(action: ActionType, isSelected: boolean): void;
536 /** Starts the animation on the chip. */
537 startAnimation(animation: Animation): void;
538 }
539}
540
541declare module '@material/chips/chip-set/types' {
542 /**
543 * @license
544 * Copyright 2020 Google Inc.
545 *
546 * Permission is hereby granted, free of charge, to any person obtaining a copy
547 * of this software and associated documentation files (the "Software"), to deal
548 * in the Software without restriction, including without limitation the rights
549 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
550 * copies of the Software, and to permit persons to whom the Software is
551 * furnished to do so, subject to the following conditions:
552 *
553 * The above copyright notice and this permission notice shall be included in
554 * all copies or substantial portions of the Software.
555 *
556 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
557 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
558 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
559 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
560 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
561 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
562 * THE SOFTWARE.
563 */
564 import { MDCChipAnimationEventDetail, MDCChipInteractionEventDetail, MDCChipNavigationEventDetail } from '@material/chips/chip/types';
565 /**
566 * MDCChipSetInteractionEventDetail provides detail about the interaction event.
567 */
568 export interface MDCChipSetInteractionEventDetail {
569 chipID: string;
570 chipIndex: number;
571 }
572 /**
573 * MDCChipSetRemovalEventDetail provides detail about the removal event.
574 */
575 export interface MDCChipSetRemovalEventDetail {
576 chipID: string;
577 chipIndex: number;
578 isComplete: boolean;
579 }
580 /**
581 * MDCChipSetSelectionEventDetail provides detail about the selection event.
582 */
583 export interface MDCChipSetSelectionEventDetail {
584 chipID: string;
585 chipIndex: number;
586 isSelected: boolean;
587 }
588 /**
589 * ChipInteractionEvent is the custom event for the interaction event.
590 */
591 export type ChipInteractionEvent = CustomEvent<MDCChipInteractionEventDetail>;
592 /**
593 * ChipNavigationEvent is the custom event for the navigation event.
594 */
595 export type ChipNavigationEvent = CustomEvent<MDCChipNavigationEventDetail>;
596 /**
597 * ChipAnimationEvent is the custom event for the animation event.
598 */
599 export type ChipAnimationEvent = CustomEvent<MDCChipAnimationEventDetail>;
600}
601
602declare module '@material/chips/deprecated/trailingaction/adapter' {
603 /**
604 * @license
605 * Copyright 2020 Google Inc.
606 *
607 * Permission is hereby granted, free of charge, to any person obtaining a copy
608 * of this software and associated documentation files (the "Software"), to deal
609 * in the Software without restriction, including without limitation the rights
610 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
611 * copies of the Software, and to permit persons to whom the Software is
612 * furnished to do so, subject to the following conditions:
613 *
614 * The above copyright notice and this permission notice shall be included in
615 * all copies or substantial portions of the Software.
616 *
617 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
618 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
619 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
620 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
621 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
622 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
623 * THE SOFTWARE.
624 */
625 import { InteractionTrigger } from '@material/chips/deprecated/trailingaction/constants';
626 /**
627 * Defines the shape of the adapter expected by the foundation.
628 * Implement this adapter for your framework of choice to delegate updates to
629 * the component in your framework of choice. See architecture documentation
630 * for more details.
631 * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
632 */
633 export interface MDCChipTrailingActionAdapter {
634 focus(): void;
635 getAttribute(attr: string): string | null;
636 notifyInteraction(trigger: InteractionTrigger): void;
637 notifyNavigation(key: string): void;
638 setAttribute(attr: string, value: string): void;
639 }
640}
641
642declare module '@material/chips/deprecated/trailingaction/component' {
643 /**
644 * @license
645 * Copyright 2020 Google Inc.
646 *
647 * Permission is hereby granted, free of charge, to any person obtaining a copy
648 * of this software and associated documentation files (the "Software"), to deal
649 * in the Software without restriction, including without limitation the rights
650 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
651 * copies of the Software, and to permit persons to whom the Software is
652 * furnished to do so, subject to the following conditions:
653 *
654 * The above copyright notice and this permission notice shall be included in
655 * all copies or substantial portions of the Software.
656 *
657 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
658 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
659 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
660 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
661 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
662 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
663 * THE SOFTWARE.
664 */
665 import { MDCComponent } from '@material/base/component';
666 import { MDCRipple, MDCRippleFactory } from '@material/ripple/component';
667 import { MDCRippleCapableSurface } from '@material/ripple/types';
668 import { MDCChipTrailingActionFoundation } from '@material/chips/deprecated/trailingaction/foundation';
669 /**
670 * Creates a trailing action component on the given element.
671 */
672 export type MDCChipTrailingActionFactory = (el: Element, foundation?: MDCChipTrailingActionFoundation) => MDCChipTrailingAction;
673 export class MDCChipTrailingAction extends MDCComponent<MDCChipTrailingActionFoundation> implements MDCRippleCapableSurface {
674 get ripple(): MDCRipple;
675 static attachTo(root: Element): MDCChipTrailingAction;
676 initialize(rippleFactory?: MDCRippleFactory): void;
677 initialSyncWithDOM(): void;
678 destroy(): void;
679 getDefaultFoundation(): MDCChipTrailingActionFoundation;
680 isNavigable(): boolean;
681 focus(): void;
682 removeFocus(): void;
683 }
684}
685
686declare module '@material/chips/deprecated/trailingaction/foundation' {
687 /**
688 * @license
689 * Copyright 2020 Google Inc.
690 *
691 * Permission is hereby granted, free of charge, to any person obtaining a copy
692 * of this software and associated documentation files (the "Software"), to deal
693 * in the Software without restriction, including without limitation the rights
694 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
695 * copies of the Software, and to permit persons to whom the Software is
696 * furnished to do so, subject to the following conditions:
697 *
698 * The above copyright notice and this permission notice shall be included in
699 * all copies or substantial portions of the Software.
700 *
701 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
702 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
703 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
704 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
705 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
706 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
707 * THE SOFTWARE.
708 */
709 import { MDCFoundation } from '@material/base/foundation';
710 import { MDCChipTrailingActionAdapter } from '@material/chips/deprecated/trailingaction/adapter';
711 export class MDCChipTrailingActionFoundation extends MDCFoundation<MDCChipTrailingActionAdapter> {
712 static get strings(): {
713 ARIA_HIDDEN: string;
714 INTERACTION_EVENT: string;
715 NAVIGATION_EVENT: string;
716 TAB_INDEX: string;
717 };
718 static get defaultAdapter(): MDCChipTrailingActionAdapter;
719 constructor(adapter?: Partial<MDCChipTrailingActionAdapter>);
720 handleClick(evt: MouseEvent): void;
721 handleKeydown(evt: KeyboardEvent): void;
722 removeFocus(): void;
723 focus(): void;
724 isNavigable(): boolean;
725 }
726 export default MDCChipTrailingActionFoundation;
727}
728
729declare module '@material/chips/deprecated/trailingaction/types' {
730 /**
731 * @license
732 * Copyright 2020 Google Inc.
733 *
734 * Permission is hereby granted, free of charge, to any person obtaining a copy
735 * of this software and associated documentation files (the "Software"), to deal
736 * in the Software without restriction, including without limitation the rights
737 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
738 * copies of the Software, and to permit persons to whom the Software is
739 * furnished to do so, subject to the following conditions:
740 *
741 * The above copyright notice and this permission notice shall be included in
742 * all copies or substantial portions of the Software.
743 *
744 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
745 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
746 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
747 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
748 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
749 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
750 * THE SOFTWARE.
751 */
752 import { InteractionTrigger } from '@material/chips/deprecated/trailingaction/constants';
753 export interface MDCChipTrailingActionInteractionEventDetail {
754 trigger: InteractionTrigger;
755 }
756 export interface MDCChipTrailingActionNavigationEventDetail {
757 key: string;
758 }
759 export interface MDCChipTrailingActionInteractionEvent extends Event {
760 readonly detail: MDCChipTrailingActionInteractionEventDetail;
761 }
762 export interface MDCChipTrailingActionNavigationEvent extends Event {
763 readonly detail: MDCChipTrailingActionNavigationEventDetail;
764 }
765}
766
767declare module '@material/chips/deprecated/trailingaction/constants' {
768 /**
769 * @license
770 * Copyright 2020 Google Inc.
771 *
772 * Permission is hereby granted, free of charge, to any person obtaining a copy
773 * of this software and associated documentation files (the "Software"), to deal
774 * in the Software without restriction, including without limitation the rights
775 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
776 * copies of the Software, and to permit persons to whom the Software is
777 * furnished to do so, subject to the following conditions:
778 *
779 * The above copyright notice and this permission notice shall be included in
780 * all copies or substantial portions of the Software.
781 *
782 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
783 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
784 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
785 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
786 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
787 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
788 * THE SOFTWARE.
789 */
790 export enum InteractionTrigger {
791 UNSPECIFIED = 0,
792 CLICK = 1,
793 BACKSPACE_KEY = 2,
794 DELETE_KEY = 3,
795 SPACEBAR_KEY = 4,
796 ENTER_KEY = 5
797 }
798 export const strings: {
799 ARIA_HIDDEN: string;
800 INTERACTION_EVENT: string;
801 NAVIGATION_EVENT: string;
802 TAB_INDEX: string;
803 };
804}
805
806declare module '@material/chips/deprecated/chip/adapter' {
807 /**
808 * @license
809 * Copyright 2017 Google Inc.
810 *
811 * Permission is hereby granted, free of charge, to any person obtaining a copy
812 * of this software and associated documentation files (the "Software"), to deal
813 * in the Software without restriction, including without limitation the rights
814 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
815 * copies of the Software, and to permit persons to whom the Software is
816 * furnished to do so, subject to the following conditions:
817 *
818 * The above copyright notice and this permission notice shall be included in
819 * all copies or substantial portions of the Software.
820 *
821 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
822 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
823 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
824 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
825 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
826 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
827 * THE SOFTWARE.
828 */
829 import { EventSource } from '@material/chips/deprecated/chip/constants';
830 /**
831 * Defines the shape of the adapter expected by the foundation.
832 * Implement this adapter for your framework of choice to delegate updates to
833 * the component in your framework of choice. See architecture documentation
834 * for more details.
835 * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
836 */
837 export interface MDCChipAdapter {
838 /**
839 * Adds a class to the root element.
840 */
841 addClass(className: string): void;
842 /**
843 * Removes a class from the root element.
844 */
845 removeClass(className: string): void;
846 /**
847 * @return true if the root element contains the given class.
848 */
849 hasClass(className: string): boolean;
850 /**
851 * Adds a class to the leading icon element.
852 */
853 addClassToLeadingIcon(className: string): void;
854 /**
855 * Removes a class from the leading icon element.
856 */
857 removeClassFromLeadingIcon(className: string): void;
858 /**
859 * @return true if target has className, false otherwise.
860 */
861 eventTargetHasClass(target: EventTarget | null, className: string): boolean;
862 /**
863 * @return the attribute string value if present, otherwise null
864 */
865 getAttribute(attr: string): string | null;
866 /**
867 * Emits a custom "MDCChip:interaction" event denoting the chip has been
868 * interacted with (typically on click or keydown).
869 */
870 notifyInteraction(): void;
871 /**
872 * Emits a custom "MDCChip:selection" event denoting the chip has been selected or deselected.
873 */
874 notifySelection(selected: boolean, chipSetShouldIgnore: boolean): void;
875 /**
876 * Emits a custom "MDCChip:trailingIconInteraction" event denoting the trailing icon has been
877 * interacted with (typically on click or keydown).
878 */
879 notifyTrailingIconInteraction(): void;
880 /**
881 * Emits a custom event "MDCChip:removal" denoting the chip will be removed.
882 */
883 notifyRemoval(removedAnnouncement: string | null): void;
884 /**
885 * Emits a custom event "MDCChip:navigation" denoting a focus navigation event.
886 */
887 notifyNavigation(key: string, source: EventSource): void;
888 /**
889 * Emits when editing starts.
890 */
891 notifyEditStart(): void;
892 /**
893 * Emits when editing finishes.
894 */
895 notifyEditFinish(): void;
896 /**
897 * @return The computed property value of the given style property on the root element.
898 */
899 getComputedStyleValue(propertyName: string): string;
900 /**
901 * Sets the property value of the given style property on the root element.
902 */
903 setStyleProperty(propertyName: string, value: string): void;
904 /**
905 * @return Whether the chip has a leading icon.
906 */
907 hasLeadingIcon(): boolean;
908 /**
909 * @return The bounding client rect of the root element.
910 */
911 getRootBoundingClientRect(): ClientRect;
912 /**
913 * @return The bounding client rect of the checkmark element or null if it doesn't exist.
914 */
915 getCheckmarkBoundingClientRect(): ClientRect | null;
916 /**
917 * Sets the value of the attribute on the primary action content.
918 */
919 setPrimaryActionAttr(attr: string, value: string): void;
920 /**
921 * Gives focus to the primary action.
922 */
923 focusPrimaryAction(): void;
924 /**
925 * Sets focus to the trailing action.
926 */
927 focusTrailingAction(): void;
928 /**
929 * Removes focus from the trailing action.
930 */
931 removeTrailingActionFocus(): void;
932 /**
933 * Returns true if the trailing action is navigable.
934 * Should return the value of MDCChipTrailingAction#isNavigable() or false.
935 */
936 isTrailingActionNavigable(): boolean;
937 /**
938 * @return true if the text direction is right-to-left.
939 */
940 isRTL(): boolean;
941 }
942}
943
944declare module '@material/chips/deprecated/chip/component' {
945 /**
946 * @license
947 * Copyright 2016 Google Inc.
948 *
949 * Permission is hereby granted, free of charge, to any person obtaining a copy
950 * of this software and associated documentation files (the "Software"), to deal
951 * in the Software without restriction, including without limitation the rights
952 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
953 * copies of the Software, and to permit persons to whom the Software is
954 * furnished to do so, subject to the following conditions:
955 *
956 * The above copyright notice and this permission notice shall be included in
957 * all copies or substantial portions of the Software.
958 *
959 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
960 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
961 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
962 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
963 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
964 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
965 * THE SOFTWARE.
966 */
967 import { MDCComponent } from '@material/base/component';
968 import { MDCRipple, MDCRippleFactory } from '@material/ripple/component';
969 import { MDCRippleCapableSurface } from '@material/ripple/types';
970 import { MDCChipTrailingActionFactory } from '@material/chips/deprecated/trailingaction/component';
971 import { MDCChipFoundation } from '@material/chips/deprecated/chip/foundation';
972 export type MDCChipFactory = (el: Element, foundation?: MDCChipFoundation) => MDCChip;
973 export class MDCChip extends MDCComponent<MDCChipFoundation> implements MDCRippleCapableSurface {
974 /**
975 * @return Whether the chip is selected.
976 */
977 get selected(): boolean;
978 /**
979 * Sets selected state on the chip.
980 */
981 set selected(selected: boolean);
982 /**
983 * @return Whether a trailing icon click should trigger exit/removal of the chip.
984 */
985 get shouldRemoveOnTrailingIconClick(): boolean;
986 /**
987 * Sets whether a trailing icon click should trigger exit/removal of the chip.
988 */
989 set shouldRemoveOnTrailingIconClick(shouldRemove: boolean);
990 /**
991 * Sets whether a clicking on the chip should focus the primary action.
992 */
993 set setShouldFocusPrimaryActionOnClick(shouldFocus: boolean);
994 get ripple(): MDCRipple;
995 get id(): string;
996 static attachTo(root: Element): MDCChip;
997 initialize(rippleFactory?: MDCRippleFactory, trailingActionFactory?: MDCChipTrailingActionFactory): void;
998 initialSyncWithDOM(): void;
999 destroy(): void;
1000 /**
1001 * Begins the exit animation which leads to removal of the chip.
1002 */
1003 beginExit(): void;
1004 getDefaultFoundation(): MDCChipFoundation;
1005 setSelectedFromChipSet(selected: boolean, shouldNotifyClients: boolean): void;
1006 focusPrimaryAction(): void;
1007 focusTrailingAction(): void;
1008 removeFocus(): void;
1009 remove(): void;
1010 }
1011}
1012
1013declare module '@material/chips/deprecated/chip/foundation' {
1014 /**
1015 * @license
1016 * Copyright 2016 Google Inc.
1017 *
1018 * Permission is hereby granted, free of charge, to any person obtaining a copy
1019 * of this software and associated documentation files (the "Software"), to deal
1020 * in the Software without restriction, including without limitation the rights
1021 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1022 * copies of the Software, and to permit persons to whom the Software is
1023 * furnished to do so, subject to the following conditions:
1024 *
1025 * The above copyright notice and this permission notice shall be included in
1026 * all copies or substantial portions of the Software.
1027 *
1028 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1029 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1030 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1031 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1032 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1033 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1034 * THE SOFTWARE.
1035 */
1036 import { MDCFoundation } from '@material/base/foundation';
1037 import { MDCChipTrailingActionNavigationEvent } from '@material/chips/deprecated/trailingaction/types';
1038 import { MDCChipAdapter } from '@material/chips/deprecated/chip/adapter';
1039 export class MDCChipFoundation extends MDCFoundation<MDCChipAdapter> {
1040 static get strings(): {
1041 ADDED_ANNOUNCEMENT_ATTRIBUTE: string;
1042 ARIA_CHECKED: string;
1043 ARROW_DOWN_KEY: string;
1044 ARROW_LEFT_KEY: string;
1045 ARROW_RIGHT_KEY: string;
1046 ARROW_UP_KEY: string;
1047 BACKSPACE_KEY: string;
1048 CHECKMARK_SELECTOR: string;
1049 DELETE_KEY: string;
1050 END_KEY: string;
1051 ENTER_KEY: string;
1052 ENTRY_ANIMATION_NAME: string;
1053 HOME_KEY: string;
1054 IE_ARROW_DOWN_KEY: string;
1055 IE_ARROW_LEFT_KEY: string;
1056 IE_ARROW_RIGHT_KEY: string;
1057 IE_ARROW_UP_KEY: string;
1058 IE_DELETE_KEY: string;
1059 INTERACTION_EVENT: string;
1060 LEADING_ICON_SELECTOR: string;
1061 NAVIGATION_EVENT: string;
1062 PRIMARY_ACTION_SELECTOR: string;
1063 REMOVED_ANNOUNCEMENT_ATTRIBUTE: string;
1064 REMOVAL_EVENT: string;
1065 SELECTION_EVENT: string;
1066 SPACEBAR_KEY: string;
1067 TAB_INDEX: string;
1068 TRAILING_ACTION_SELECTOR: string;
1069 TRAILING_ICON_INTERACTION_EVENT: string;
1070 TRAILING_ICON_SELECTOR: string;
1071 };
1072 static get cssClasses(): {
1073 CHECKMARK: string;
1074 CHIP_EXIT: string;
1075 DELETABLE: string;
1076 EDITABLE: string;
1077 EDITING: string;
1078 HIDDEN_LEADING_ICON: string;
1079 LEADING_ICON: string;
1080 PRIMARY_ACTION: string;
1081 PRIMARY_ACTION_FOCUSED: string;
1082 SELECTED: string;
1083 TEXT: string;
1084 TRAILING_ACTION: string;
1085 TRAILING_ICON: string;
1086 };
1087 static get defaultAdapter(): MDCChipAdapter;
1088 constructor(adapter?: Partial<MDCChipAdapter>);
1089 isSelected(): boolean;
1090 isEditable(): boolean;
1091 isEditing(): boolean;
1092 setSelected(selected: boolean): void;
1093 setSelectedFromChipSet(selected: boolean, shouldNotifyClients: boolean): void;
1094 getShouldRemoveOnTrailingIconClick(): boolean;
1095 setShouldRemoveOnTrailingIconClick(shouldRemove: boolean): void;
1096 setShouldFocusPrimaryActionOnClick(shouldFocus: boolean): void;
1097 getDimensions(): ClientRect;
1098 /**
1099 * Begins the exit animation which leads to removal of the chip.
1100 */
1101 beginExit(): void;
1102 handleClick(): void;
1103 handleDoubleClick(): void;
1104 /**
1105 * Handles a transition end event on the root element.
1106 */
1107 handleTransitionEnd(evt: TransitionEvent): void;
1108 handleFocusIn(evt: FocusEvent): void;
1109 handleFocusOut(evt: FocusEvent): void;
1110 /**
1111 * Handles an interaction event on the trailing icon element. This is used to
1112 * prevent the ripple from activating on interaction with the trailing icon.
1113 */
1114 handleTrailingActionInteraction(): void;
1115 /**
1116 * Handles a keydown event from the root element.
1117 */
1118 handleKeydown(evt: KeyboardEvent): void;
1119 handleTrailingActionNavigation(evt: MDCChipTrailingActionNavigationEvent): void;
1120 /**
1121 * Called by the chip set to remove focus from the chip actions.
1122 */
1123 removeFocus(): void;
1124 /**
1125 * Called by the chip set to focus the primary action.
1126 *
1127 */
1128 focusPrimaryAction(): void;
1129 /**
1130 * Called by the chip set to focus the trailing action (if present), otherwise
1131 * gives focus to the trailing action.
1132 */
1133 focusTrailingAction(): void;
1134 }
1135 export default MDCChipFoundation;
1136}
1137
1138declare module '@material/chips/deprecated/chip/types' {
1139 /**
1140 * @license
1141 * Copyright 2019 Google Inc.
1142 *
1143 * Permission is hereby granted, free of charge, to any person obtaining a copy
1144 * of this software and associated documentation files (the "Software"), to deal
1145 * in the Software without restriction, including without limitation the rights
1146 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1147 * copies of the Software, and to permit persons to whom the Software is
1148 * furnished to do so, subject to the following conditions:
1149 *
1150 * The above copyright notice and this permission notice shall be included in
1151 * all copies or substantial portions of the Software.
1152 *
1153 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1154 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1155 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1156 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1157 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1158 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1159 * THE SOFTWARE.
1160 */
1161 import { EventSource } from '@material/chips/deprecated/chip/constants';
1162 export interface MDCChipInteractionEventDetail {
1163 chipId: string;
1164 }
1165 export interface MDCChipSelectionEventDetail extends MDCChipInteractionEventDetail {
1166 selected: boolean;
1167 shouldIgnore: boolean;
1168 }
1169 export interface MDCChipRemovalEventDetail extends MDCChipInteractionEventDetail {
1170 removedAnnouncement: string | null;
1171 }
1172 export interface MDCChipNavigationEventDetail extends MDCChipInteractionEventDetail {
1173 key: string;
1174 source: EventSource;
1175 }
1176 export interface MDCChipInteractionEvent extends Event {
1177 readonly detail: MDCChipInteractionEventDetail;
1178 }
1179 export interface MDCChipSelectionEvent extends Event {
1180 readonly detail: MDCChipSelectionEventDetail;
1181 }
1182 export interface MDCChipRemovalEvent extends Event {
1183 readonly detail: MDCChipRemovalEventDetail;
1184 }
1185 export interface MDCChipNavigationEvent extends Event {
1186 readonly detail: MDCChipNavigationEventDetail;
1187 }
1188}
1189
1190declare module '@material/chips/deprecated/chip/constants' {
1191 /**
1192 * @license
1193 * Copyright 2016 Google Inc.
1194 *
1195 * Permission is hereby granted, free of charge, to any person obtaining a copy
1196 * of this software and associated documentation files (the "Software"), to deal
1197 * in the Software without restriction, including without limitation the rights
1198 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1199 * copies of the Software, and to permit persons to whom the Software is
1200 * furnished to do so, subject to the following conditions:
1201 *
1202 * The above copyright notice and this permission notice shall be included in
1203 * all copies or substantial portions of the Software.
1204 *
1205 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1206 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1207 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1208 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1209 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1210 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1211 * THE SOFTWARE.
1212 */
1213 export enum Direction {
1214 LEFT = "left",
1215 RIGHT = "right"
1216 }
1217 export enum EventSource {
1218 PRIMARY = "primary",
1219 TRAILING = "trailing",
1220 NONE = "none"
1221 }
1222 export const strings: {
1223 ADDED_ANNOUNCEMENT_ATTRIBUTE: string;
1224 ARIA_CHECKED: string;
1225 ARROW_DOWN_KEY: string;
1226 ARROW_LEFT_KEY: string;
1227 ARROW_RIGHT_KEY: string;
1228 ARROW_UP_KEY: string;
1229 BACKSPACE_KEY: string;
1230 CHECKMARK_SELECTOR: string;
1231 DELETE_KEY: string;
1232 END_KEY: string;
1233 ENTER_KEY: string;
1234 ENTRY_ANIMATION_NAME: string;
1235 HOME_KEY: string;
1236 IE_ARROW_DOWN_KEY: string;
1237 IE_ARROW_LEFT_KEY: string;
1238 IE_ARROW_RIGHT_KEY: string;
1239 IE_ARROW_UP_KEY: string;
1240 IE_DELETE_KEY: string;
1241 INTERACTION_EVENT: string;
1242 LEADING_ICON_SELECTOR: string;
1243 NAVIGATION_EVENT: string;
1244 PRIMARY_ACTION_SELECTOR: string;
1245 REMOVED_ANNOUNCEMENT_ATTRIBUTE: string;
1246 REMOVAL_EVENT: string;
1247 SELECTION_EVENT: string;
1248 SPACEBAR_KEY: string;
1249 TAB_INDEX: string;
1250 TRAILING_ACTION_SELECTOR: string;
1251 TRAILING_ICON_INTERACTION_EVENT: string;
1252 TRAILING_ICON_SELECTOR: string;
1253 };
1254 export const cssClasses: {
1255 CHECKMARK: string;
1256 CHIP_EXIT: string;
1257 DELETABLE: string;
1258 EDITABLE: string;
1259 EDITING: string;
1260 HIDDEN_LEADING_ICON: string;
1261 LEADING_ICON: string;
1262 PRIMARY_ACTION: string;
1263 PRIMARY_ACTION_FOCUSED: string;
1264 SELECTED: string;
1265 TEXT: string;
1266 TRAILING_ACTION: string;
1267 TRAILING_ICON: string;
1268 };
1269 export const navigationKeys: Set<string>;
1270 export const jumpChipKeys: Set<string>;
1271}
1272
1273declare module '@material/chips/deprecated/chip-set/adapter' {
1274 /**
1275 * Defines the shape of the adapter expected by the foundation.
1276 * Implement this adapter for your framework of choice to delegate updates to
1277 * the component in your framework of choice. See architecture documentation
1278 * for more details.
1279 * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
1280 */
1281 export interface MDCChipSetAdapter {
1282 /**
1283 * @return true if the root element contains the given class name.
1284 */
1285 hasClass(className: string): boolean;
1286 /**
1287 * Removes the chip with the given index from the chip set.
1288 * Make sure to remove it from the chip list, too.
1289 */
1290 removeChipAtIndex(index: number): void;
1291 /**
1292 * Sets the selected state of the chip at the given index.
1293 */
1294 selectChipAtIndex(index: number, isSelected: boolean, shouldNotifyClients: boolean): void;
1295 /**
1296 * Returns the index of the chip at the given ID.
1297 * @param chipId the unique ID of the chip
1298 * @return the numerical index of the chip with the matching id or -1.
1299 */
1300 getIndexOfChipById(chipId: string): number;
1301 /**
1302 * Calls Chip#focusPrimaryAction() on the chip at the given index.
1303 * @param index the index of the chip
1304 */
1305 focusChipPrimaryActionAtIndex(index: number): void;
1306 /**
1307 * Calls Chip#focusTrailingAction() on the chip at the given index.
1308 * @param index the index of the chip
1309 */
1310 focusChipTrailingActionAtIndex(index: number): void;
1311 /**
1312 * Removes focus from the chip at the given index.
1313 * @param index the index of the chip
1314 */
1315 removeFocusFromChipAtIndex(index: number): void;
1316 /**
1317 * @return true if the text direction is RTL.
1318 */
1319 isRTL(): boolean;
1320 /**
1321 * @return the number of chips in the chip set.
1322 */
1323 getChipListCount(): number;
1324 /**
1325 * Announces the message via an aria-live region.
1326 */
1327 announceMessage(message: string): void;
1328 }
1329}
1330
1331declare module '@material/chips/deprecated/chip-set/component' {
1332 /**
1333 * @license
1334 * Copyright 2016 Google Inc.
1335 *
1336 * Permission is hereby granted, free of charge, to any person obtaining a copy
1337 * of this software and associated documentation files (the "Software"), to deal
1338 * in the Software without restriction, including without limitation the rights
1339 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1340 * copies of the Software, and to permit persons to whom the Software is
1341 * furnished to do so, subject to the following conditions:
1342 *
1343 * The above copyright notice and this permission notice shall be included in
1344 * all copies or substantial portions of the Software.
1345 *
1346 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1347 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1348 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1349 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1350 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1351 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1352 * THE SOFTWARE.
1353 */
1354 import { MDCComponent } from '@material/base/component';
1355 import { MDCChip, MDCChipFactory } from '@material/chips/deprecated/chip/component';
1356 import { MDCChipSetFoundation } from '@material/chips/deprecated/chip-set/foundation';
1357 export class MDCChipSet extends MDCComponent<MDCChipSetFoundation> {
1358 static attachTo(root: Element): MDCChipSet;
1359 get chips(): ReadonlyArray<MDCChip>;
1360 /**
1361 * @return An array of the IDs of all selected chips.
1362 */
1363 get selectedChipIds(): ReadonlyArray<string>;
1364 /**
1365 * @param chipFactory A function which creates a new MDCChip.
1366 */
1367 initialize(chipFactory?: MDCChipFactory): void;
1368 initialSyncWithDOM(): void;
1369 destroy(): void;
1370 /**
1371 * Adds a new chip object to the chip set from the given chip element.
1372 */
1373 addChip(chipEl: Element): void;
1374 getDefaultFoundation(): MDCChipSetFoundation;
1375 }
1376}
1377
1378declare module '@material/chips/deprecated/chip-set/foundation' {
1379 /**
1380 * @license
1381 * Copyright 2017 Google Inc.
1382 *
1383 * Permission is hereby granted, free of charge, to any person obtaining a copy
1384 * of this software and associated documentation files (the "Software"), to deal
1385 * in the Software without restriction, including without limitation the rights
1386 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1387 * copies of the Software, and to permit persons to whom the Software is
1388 * furnished to do so, subject to the following conditions:
1389 *
1390 * The above copyright notice and this permission notice shall be included in
1391 * all copies or substantial portions of the Software.
1392 *
1393 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1394 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1395 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1396 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1397 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1398 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1399 * THE SOFTWARE.
1400 */
1401 import { MDCFoundation } from '@material/base/foundation';
1402 import { MDCChipInteractionEventDetail, MDCChipNavigationEventDetail, MDCChipRemovalEventDetail, MDCChipSelectionEventDetail } from '@material/chips/deprecated/chip/types';
1403 import { MDCChipSetAdapter } from '@material/chips/deprecated/chip-set/adapter';
1404 export class MDCChipSetFoundation extends MDCFoundation<MDCChipSetAdapter> {
1405 static get strings(): {
1406 CHIP_SELECTOR: string;
1407 };
1408 static get cssClasses(): {
1409 CHOICE: string;
1410 FILTER: string;
1411 };
1412 static get defaultAdapter(): MDCChipSetAdapter;
1413 constructor(adapter?: Partial<MDCChipSetAdapter>);
1414 /**
1415 * Returns an array of the IDs of all selected chips.
1416 */
1417 getSelectedChipIds(): ReadonlyArray<string>;
1418 /**
1419 * Selects the chip with the given id. Deselects all other chips if the chip set is of the choice variant.
1420 * Does not notify clients of the updated selection state.
1421 */
1422 select(chipId: string): void;
1423 /**
1424 * Handles a chip interaction event
1425 */
1426 handleChipInteraction({ chipId }: MDCChipInteractionEventDetail): void;
1427 /**
1428 * Handles a chip selection event, used to handle discrepancy when selection state is set directly on the Chip.
1429 */
1430 handleChipSelection({ chipId, selected, shouldIgnore }: MDCChipSelectionEventDetail): void;
1431 /**
1432 * Handles the event when a chip is removed.
1433 */
1434 handleChipRemoval({ chipId, removedAnnouncement }: MDCChipRemovalEventDetail): void;
1435 /**
1436 * Handles a chip navigation event.
1437 */
1438 handleChipNavigation({ chipId, key, source }: MDCChipNavigationEventDetail): void;
1439 }
1440 export default MDCChipSetFoundation;
1441}
1442
1443declare module '@material/chips/deprecated/chip-set/constants' {
1444 /**
1445 * @license
1446 * Copyright 2016 Google Inc.
1447 *
1448 * Permission is hereby granted, free of charge, to any person obtaining a copy
1449 * of this software and associated documentation files (the "Software"), to deal
1450 * in the Software without restriction, including without limitation the rights
1451 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1452 * copies of the Software, and to permit persons to whom the Software is
1453 * furnished to do so, subject to the following conditions:
1454 *
1455 * The above copyright notice and this permission notice shall be included in
1456 * all copies or substantial portions of the Software.
1457 *
1458 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1459 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1460 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1461 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1462 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1463 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1464 * THE SOFTWARE.
1465 */
1466 export const strings: {
1467 CHIP_SELECTOR: string;
1468 };
1469 export const cssClasses: {
1470 CHOICE: string;
1471 FILTER: string;
1472 };
1473}
1474
1475declare module '@material/chips/action/component' {
1476 /**
1477 * @license
1478 * Copyright 2020 Google Inc.
1479 *
1480 * Permission is hereby granted, free of charge, to any person obtaining a copy
1481 * of this software and associated documentation files (the "Software"), to deal
1482 * in the Software without restriction, including without limitation the rights
1483 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1484 * copies of the Software, and to permit persons to whom the Software is
1485 * furnished to do so, subject to the following conditions:
1486 *
1487 * The above copyright notice and this permission notice shall be included in
1488 * all copies or substantial portions of the Software.
1489 *
1490 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1491 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1492 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1493 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1494 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1495 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1496 * THE SOFTWARE.
1497 */
1498 import { MDCComponent } from '@material/base/component';
1499 import { MDCRipple, MDCRippleFactory } from '@material/ripple/component';
1500 import { MDCRippleCapableSurface } from '@material/ripple/types';
1501 import { ActionType, FocusBehavior } from '@material/chips/action/constants';
1502 import { MDCChipActionFoundation } from '@material/chips/action/foundation';
1503 import { MDCChipPrimaryActionFoundation } from '@material/chips/action/primary-foundation';
1504 import { MDCChipTrailingActionFoundation } from '@material/chips/action/trailing-foundation';
1505 /**
1506 * MDCChipActionFactory is used by the parent MDCChip component to initialize
1507 * chip actions.
1508 */
1509 export type MDCChipActionFactory = (el: Element, foundation?: MDCChipActionFoundation) => MDCChipAction;
1510 /**
1511 * MDCChipAction provides component encapsulation of the different foundation
1512 * implementations.
1513 */
1514 export class MDCChipAction extends MDCComponent<MDCChipActionFoundation> implements MDCRippleCapableSurface {
1515 static attachTo(root: Element): MDCChipAction;
1516 get ripple(): MDCRipple;
1517 initialize(rippleFactory?: MDCRippleFactory): void;
1518 initialSyncWithDOM(): void;
1519 destroy(): void;
1520 getDefaultFoundation(): MDCChipPrimaryActionFoundation | MDCChipTrailingActionFoundation;
1521 setDisabled(isDisabled: boolean): void;
1522 isDisabled(): boolean;
1523 setFocus(behavior: FocusBehavior): void;
1524 isFocusable(): boolean;
1525 setSelected(isSelected: boolean): void;
1526 isSelected(): boolean;
1527 isSelectable(): boolean;
1528 actionType(): ActionType;
1529 }
1530}
1531
1532declare module '@material/chips/chip/foundation' {
1533 /**
1534 * @license
1535 * Copyright 2020 Google Inc.
1536 *
1537 * Permission is hereby granted, free of charge, to any person obtaining a copy
1538 * of this software and associated documentation files (the "Software"), to deal
1539 * in the Software without restriction, including without limitation the rights
1540 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1541 * copies of the Software, and to permit persons to whom the Software is
1542 * furnished to do so, subject to the following conditions:
1543 *
1544 * The above copyright notice and this permission notice shall be included in
1545 * all copies or substantial portions of the Software.
1546 *
1547 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1548 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1549 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1550 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1551 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1552 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1553 * THE SOFTWARE.
1554 */
1555 import { MDCFoundation } from '@material/base/foundation';
1556 import { ActionType, FocusBehavior } from '@material/chips/action/constants';
1557 import { MDCChipAdapter } from '@material/chips/chip/adapter';
1558 import { Animation } from '@material/chips/chip/constants';
1559 import { ActionInteractionEvent, ActionNavigationEvent } from '@material/chips/chip/types';
1560 /**
1561 * MDCChipFoundation provides a foundation for all chips.
1562 */
1563 export class MDCChipFoundation extends MDCFoundation<MDCChipAdapter> {
1564 static get defaultAdapter(): MDCChipAdapter;
1565 constructor(adapter?: Partial<MDCChipAdapter>);
1566 destroy(): void;
1567 getElementID(): string;
1568 setDisabled(isDisabled: boolean): void;
1569 isDisabled(): boolean;
1570 getActions(): ActionType[];
1571 isActionFocusable(action: ActionType): boolean;
1572 isActionSelectable(action: ActionType): boolean;
1573 isActionSelected(action: ActionType): boolean;
1574 setActionFocus(action: ActionType, focus: FocusBehavior): void;
1575 setActionSelected(action: ActionType, isSelected: boolean): void;
1576 startAnimation(animation: Animation): void;
1577 handleAnimationEnd(event: AnimationEvent): void;
1578 handleTransitionEnd(): void;
1579 handleActionInteraction({ detail }: ActionInteractionEvent): void;
1580 handleActionNavigation({ detail }: ActionNavigationEvent): void;
1581 }
1582 export default MDCChipFoundation;
1583}
1584
1585declare module '@material/chips/chip/types' {
1586 /**
1587 * @license
1588 * Copyright 2020 Google Inc.
1589 *
1590 * Permission is hereby granted, free of charge, to any person obtaining a copy
1591 * of this software and associated documentation files (the "Software"), to deal
1592 * in the Software without restriction, including without limitation the rights
1593 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1594 * copies of the Software, and to permit persons to whom the Software is
1595 * furnished to do so, subject to the following conditions:
1596 *
1597 * The above copyright notice and this permission notice shall be included in
1598 * all copies or substantial portions of the Software.
1599 *
1600 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1601 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1602 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1603 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1604 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1605 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1606 * THE SOFTWARE.
1607 */
1608 import { ActionType } from '@material/chips/action/constants';
1609 import { MDCChipActionInteractionEventDetail, MDCChipActionNavigationEventDetail } from '@material/chips/action/types';
1610 import { Animation } from '@material/chips/chip/constants';
1611 /** MDCChipInteractionEventDetail provides details for the interaction event. */
1612 export interface MDCChipInteractionEventDetail {
1613 actionID: string;
1614 chipID: string;
1615 source: ActionType;
1616 shouldRemove: boolean;
1617 isSelectable: boolean;
1618 isSelected: boolean;
1619 }
1620 /** MDCChipNavigationEventDetail provides details for the navigation event. */
1621 export interface MDCChipNavigationEventDetail {
1622 chipID: string;
1623 source: ActionType;
1624 key: string;
1625 isRTL: boolean;
1626 }
1627 /** MDCChipAnimationEventDetail provides details for the animation event. */
1628 export interface MDCChipAnimationEventDetail {
1629 chipID: string;
1630 animation: Animation;
1631 isComplete: boolean;
1632 addedAnnouncement?: string;
1633 removedAnnouncement?: string;
1634 }
1635 /**
1636 * MDCChipActionInteractionEvent is the custom event for the interaction event.
1637 */
1638 export type ActionInteractionEvent = CustomEvent<MDCChipActionInteractionEventDetail>;
1639 /**
1640 * MDCChipActionInteractionEvent is the custom event for the interaction event.
1641 */
1642 export type ActionNavigationEvent = CustomEvent<MDCChipActionNavigationEventDetail>;
1643}
1644
1645declare module '@material/chips/action/foundation' {
1646 /**
1647 * @license
1648 * Copyright 2020 Google Inc.
1649 *
1650 * Permission is hereby granted, free of charge, to any person obtaining a copy
1651 * of this software and associated documentation files (the "Software"), to deal
1652 * in the Software without restriction, including without limitation the rights
1653 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1654 * copies of the Software, and to permit persons to whom the Software is
1655 * furnished to do so, subject to the following conditions:
1656 *
1657 * The above copyright notice and this permission notice shall be included in
1658 * all copies or substantial portions of the Software.
1659 *
1660 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1661 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1662 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1663 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1664 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1665 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1666 * THE SOFTWARE.
1667 */
1668 import { MDCFoundation } from '@material/base/foundation';
1669 import { MDCChipActionAdapter } from '@material/chips/action/adapter';
1670 import { ActionType, FocusBehavior } from '@material/chips/action/constants';
1671 /**
1672 * MDCChipActionFoundation provides a base abstract foundation for all chip
1673 * actions.
1674 */
1675 export abstract class MDCChipActionFoundation extends MDCFoundation<MDCChipActionAdapter> {
1676 static get defaultAdapter(): MDCChipActionAdapter;
1677 constructor(adapter?: Partial<MDCChipActionAdapter>);
1678 handleClick(): void;
1679 handleKeydown(event: KeyboardEvent): void;
1680 setDisabled(isDisabled: boolean): void;
1681 isDisabled(): boolean;
1682 setFocus(behavior: FocusBehavior): void;
1683 isFocusable(): boolean;
1684 setSelected(isSelected: boolean): void;
1685 isSelected(): boolean;
1686 abstract actionType(): ActionType;
1687 abstract isSelectable(): boolean;
1688 protected abstract shouldEmitInteractionOnRemoveKey(): boolean;
1689 }
1690 export default MDCChipActionFoundation;
1691}
1692
1693declare module '@material/chips/action/primary-foundation' {
1694 /**
1695 * @license
1696 * Copyright 2020 Google Inc.
1697 *
1698 * Permission is hereby granted, free of charge, to any person obtaining a copy
1699 * of this software and associated documentation files (the "Software"), to deal
1700 * in the Software without restriction, including without limitation the rights
1701 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1702 * copies of the Software, and to permit persons to whom the Software is
1703 * furnished to do so, subject to the following conditions:
1704 *
1705 * The above copyright notice and this permission notice shall be included in
1706 * all copies or substantial portions of the Software.
1707 *
1708 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1709 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1710 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1711 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1712 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1713 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1714 * THE SOFTWARE.
1715 */
1716 import { ActionType } from '@material/chips/action/constants';
1717 import { MDCChipActionFoundation } from '@material/chips/action/foundation';
1718 /**
1719 * MDCChipPrimaryActionFoundation provides the business logic for the primary
1720 * chip action.
1721 */
1722 export class MDCChipPrimaryActionFoundation extends MDCChipActionFoundation {
1723 isSelectable(): boolean;
1724 actionType(): ActionType;
1725 protected shouldEmitInteractionOnRemoveKey(): boolean;
1726 }
1727 export default MDCChipPrimaryActionFoundation;
1728}
1729
1730declare module '@material/chips/action/trailing-foundation' {
1731 /**
1732 * @license
1733 * Copyright 2020 Google Inc.
1734 *
1735 * Permission is hereby granted, free of charge, to any person obtaining a copy
1736 * of this software and associated documentation files (the "Software"), to deal
1737 * in the Software without restriction, including without limitation the rights
1738 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1739 * copies of the Software, and to permit persons to whom the Software is
1740 * furnished to do so, subject to the following conditions:
1741 *
1742 * The above copyright notice and this permission notice shall be included in
1743 * all copies or substantial portions of the Software.
1744 *
1745 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1746 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1747 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1748 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1749 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1750 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1751 * THE SOFTWARE.
1752 */
1753 import { ActionType } from '@material/chips/action/constants';
1754 import { MDCChipActionFoundation } from '@material/chips/action/foundation';
1755 /**
1756 * MDCChipTrailingActionFoundation provides the business logic for the trailing
1757 * chip action.
1758 */
1759 export class MDCChipTrailingActionFoundation extends MDCChipActionFoundation {
1760 isSelectable(): boolean;
1761 actionType(): ActionType;
1762 protected shouldEmitInteractionOnRemoveKey(): boolean;
1763 }
1764 export default MDCChipTrailingActionFoundation;
1765}
1766
1767declare module '@material/chips/chip/adapter' {
1768 /**
1769 * @license
1770 * Copyright 2017 Google Inc.
1771 *
1772 * Permission is hereby granted, free of charge, to any person obtaining a copy
1773 * of this software and associated documentation files (the "Software"), to deal
1774 * in the Software without restriction, including without limitation the rights
1775 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1776 * copies of the Software, and to permit persons to whom the Software is
1777 * furnished to do so, subject to the following conditions:
1778 *
1779 * The above copyright notice and this permission notice shall be included in
1780 * all copies or substantial portions of the Software.
1781 *
1782 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1783 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1784 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1785 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1786 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1787 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1788 * THE SOFTWARE.
1789 */
1790 import { ActionType, FocusBehavior } from '@material/chips/action/constants';
1791 import { Attributes, CssClasses, Events } from '@material/chips/chip/constants';
1792 /**
1793 * Defines the shape of the adapter expected by the foundation.
1794 * Implement this adapter for your framework of choice to delegate updates to
1795 * the component in your framework of choice. See architecture documentation
1796 * for more details.
1797 * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
1798 */
1799 export interface MDCChipAdapter {
1800 /** Adds the given class to the root element. */
1801 addClass(className: CssClasses): void;
1802 /** Emits the given event with the given detail. */
1803 emitEvent<D extends object>(eventName: Events, eventDetail: D): void;
1804 /** Returns the child actions provided by the chip. */
1805 getActions(): ActionType[];
1806 /** Returns the value for the given attribute, if it exists. */
1807 getAttribute(attrName: Attributes): string | null;
1808 /** Returns the ID of the root element. */
1809 getElementID(): string;
1810 /** Returns the offset width of the root element. */
1811 getOffsetWidth(): number;
1812 /** Returns true if the root element has the given class. */
1813 hasClass(className: CssClasses): boolean;
1814 /** Proxies to the MDCChipAction#isSelectable method. */
1815 isActionSelectable(action: ActionType): boolean;
1816 /** Proxies to the MDCChipAction#isSelected method. */
1817 isActionSelected(action: ActionType): boolean;
1818 /** Proxies to the MDCChipAction#isFocusable method. */
1819 isActionFocusable(action: ActionType): boolean;
1820 /** Proxies to the MDCChipAction#isDisabled method. */
1821 isActionDisabled(action: ActionType): boolean;
1822 /** Returns true if the text direction is right-to-left. */
1823 isRTL(): boolean;
1824 /** Removes the given class from the root element. */
1825 removeClass(className: CssClasses): void;
1826 /** Proxies to the MDCChipAction#setDisabled method. */
1827 setActionDisabled(action: ActionType, isDisabled: boolean): void;
1828 /** Proxies to the MDCChipAction#setFocus method. */
1829 setActionFocus(action: ActionType, behavior: FocusBehavior): void;
1830 /** Proxies to the MDCChipAction#setSelected method. */
1831 setActionSelected(action: ActionType, isSelected: boolean): void;
1832 /** Sets the style property to the given value. */
1833 setStyleProperty(property: string, value: string): void;
1834 }
1835}
1836
1837declare module '@material/chips/action/types' {
1838 /**
1839 * @license
1840 * Copyright 2020 Google Inc.
1841 *
1842 * Permission is hereby granted, free of charge, to any person obtaining a copy
1843 * of this software and associated documentation files (the "Software"), to deal
1844 * in the Software without restriction, including without limitation the rights
1845 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1846 * copies of the Software, and to permit persons to whom the Software is
1847 * furnished to do so, subject to the following conditions:
1848 *
1849 * The above copyright notice and this permission notice shall be included in
1850 * all copies or substantial portions of the Software.
1851 *
1852 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1853 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1854 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1855 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1856 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1857 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1858 * THE SOFTWARE.
1859 */
1860 import { ActionType, InteractionTrigger } from '@material/chips/action/constants';
1861 /**
1862 * MDCChipActionInteractionEventDetail provides the details for the interaction
1863 * event.
1864 */
1865 export interface MDCChipActionInteractionEventDetail {
1866 actionID: string;
1867 source: ActionType;
1868 trigger: InteractionTrigger;
1869 }
1870 /**
1871 * MDCChipActionNavigationEventDetail provides the details for the navigation
1872 * event.
1873 */
1874 export interface MDCChipActionNavigationEventDetail {
1875 source: ActionType;
1876 key: string;
1877 }
1878}
1879
1880declare module '@material/chips/action/adapter' {
1881 /**
1882 * @license
1883 * Copyright 2020 Google Inc.
1884 *
1885 * Permission is hereby granted, free of charge, to any person obtaining a copy
1886 * of this software and associated documentation files (the "Software"), to deal
1887 * in the Software without restriction, including without limitation the rights
1888 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1889 * copies of the Software, and to permit persons to whom the Software is
1890 * furnished to do so, subject to the following conditions:
1891 *
1892 * The above copyright notice and this permission notice shall be included in
1893 * all copies or substantial portions of the Software.
1894 *
1895 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1896 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1897 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1898 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1899 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1900 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1901 * THE SOFTWARE.
1902 */
1903 import { Attributes, Events } from '@material/chips/action/constants';
1904 /**
1905 * Defines the shape of the adapter expected by the foundation.
1906 * Implement this adapter for your framework of choice to delegate updates to
1907 * the component in your framework of choice. See architecture documentation
1908 * for more details.
1909 * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
1910 */
1911 export interface MDCChipActionAdapter {
1912 emitEvent<D extends object>(eventName: Events, eventDetail: D): void;
1913 focus(): void;
1914 getAttribute(attr: Attributes): string | null;
1915 getElementID(): string;
1916 removeAttribute(attr: Attributes): void;
1917 setAttribute(attr: Attributes, value: string): void;
1918 }
1919}
1920