UNPKG

5.52 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2016 Google Inc.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 */
23import { MDCFoundation } from '@material/base/foundation';
24import { MDCChipTrailingActionNavigationEvent } from '../trailingaction/types';
25import { MDCChipAdapter } from './adapter';
26export declare class MDCChipFoundation extends MDCFoundation<MDCChipAdapter> {
27 static get strings(): {
28 ADDED_ANNOUNCEMENT_ATTRIBUTE: string;
29 ARIA_CHECKED: string;
30 ARROW_DOWN_KEY: string;
31 ARROW_LEFT_KEY: string;
32 ARROW_RIGHT_KEY: string;
33 ARROW_UP_KEY: string;
34 BACKSPACE_KEY: string;
35 CHECKMARK_SELECTOR: string;
36 DELETE_KEY: string;
37 END_KEY: string;
38 ENTER_KEY: string;
39 ENTRY_ANIMATION_NAME: string;
40 HOME_KEY: string;
41 IE_ARROW_DOWN_KEY: string;
42 IE_ARROW_LEFT_KEY: string;
43 IE_ARROW_RIGHT_KEY: string;
44 IE_ARROW_UP_KEY: string;
45 IE_DELETE_KEY: string;
46 INTERACTION_EVENT: string;
47 LEADING_ICON_SELECTOR: string;
48 NAVIGATION_EVENT: string;
49 PRIMARY_ACTION_SELECTOR: string;
50 REMOVED_ANNOUNCEMENT_ATTRIBUTE: string;
51 REMOVAL_EVENT: string;
52 SELECTION_EVENT: string;
53 SPACEBAR_KEY: string;
54 TAB_INDEX: string;
55 TRAILING_ACTION_SELECTOR: string;
56 TRAILING_ICON_INTERACTION_EVENT: string;
57 TRAILING_ICON_SELECTOR: string;
58 };
59 static get cssClasses(): {
60 CHECKMARK: string;
61 CHIP_EXIT: string;
62 DELETABLE: string;
63 EDITABLE: string;
64 EDITING: string;
65 HIDDEN_LEADING_ICON: string;
66 LEADING_ICON: string;
67 PRIMARY_ACTION: string;
68 PRIMARY_ACTION_FOCUSED: string;
69 SELECTED: string;
70 TEXT: string;
71 TRAILING_ACTION: string;
72 TRAILING_ICON: string;
73 };
74 static get defaultAdapter(): MDCChipAdapter;
75 /** Whether a trailing icon click should immediately trigger exit/removal of the chip. */
76 private shouldRemoveOnTrailingIconClick;
77 /**
78 * Whether the primary action should receive focus on click. Should only be
79 * set to true for clients who programmatically give focus to a different
80 * element on the page when a chip is clicked (like a menu).
81 */
82 private shouldFocusPrimaryActionOnClick;
83 constructor(adapter?: Partial<MDCChipAdapter>);
84 isSelected(): boolean;
85 isEditable(): boolean;
86 isEditing(): boolean;
87 setSelected(selected: boolean): void;
88 setSelectedFromChipSet(selected: boolean, shouldNotifyClients: boolean): void;
89 getShouldRemoveOnTrailingIconClick(): boolean;
90 setShouldRemoveOnTrailingIconClick(shouldRemove: boolean): void;
91 setShouldFocusPrimaryActionOnClick(shouldFocus: boolean): void;
92 getDimensions(): DOMRect;
93 /**
94 * Begins the exit animation which leads to removal of the chip.
95 */
96 beginExit(): void;
97 handleClick(): void;
98 handleDoubleClick(): void;
99 /**
100 * Handles a transition end event on the root element.
101 */
102 handleTransitionEnd(evt: TransitionEvent): void;
103 handleFocusIn(evt: FocusEvent): void;
104 handleFocusOut(evt: FocusEvent): void;
105 /**
106 * Handles an interaction event on the trailing icon element. This is used to
107 * prevent the ripple from activating on interaction with the trailing icon.
108 */
109 handleTrailingActionInteraction(): void;
110 /**
111 * Handles a keydown event from the root element.
112 */
113 handleKeydown(evt: KeyboardEvent): void;
114 handleTrailingActionNavigation(evt: MDCChipTrailingActionNavigationEvent): void;
115 /**
116 * Called by the chip set to remove focus from the chip actions.
117 */
118 removeFocus(): void;
119 /**
120 * Called by the chip set to focus the primary action.
121 *
122 */
123 focusPrimaryAction(): void;
124 /**
125 * Called by the chip set to focus the trailing action (if present), otherwise
126 * gives focus to the trailing action.
127 */
128 focusTrailingAction(): void;
129 private setPrimaryActionFocusable;
130 private getFocusBehavior;
131 private focusNextAction;
132 private getDirection;
133 private removeChip;
134 private shouldStartEditing;
135 private shouldFinishEditing;
136 private shouldNotifyInteraction;
137 private isDeleteAction;
138 private setSelectedImpl;
139 private notifySelection;
140 private notifyIgnoredSelection;
141 private eventFromPrimaryAction;
142 private startEditing;
143 private finishEditing;
144}
145export default MDCChipFoundation;