1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 | import { MDCFoundation } from '@material/base/foundation';
|
24 | import { MDCChipActionType } from '../action/constants';
|
25 | import { MDCChipSetAdapter } from './adapter';
|
26 | import { ChipAnimationEvent, ChipInteractionEvent, ChipNavigationEvent } from './types';
|
27 |
|
28 |
|
29 |
|
30 | export declare class MDCChipSetFoundation extends MDCFoundation<MDCChipSetAdapter> {
|
31 | static get defaultAdapter(): MDCChipSetAdapter;
|
32 | constructor(adapter?: Partial<MDCChipSetAdapter>);
|
33 | handleChipAnimation({ detail }: ChipAnimationEvent): void;
|
34 | handleChipInteraction({ detail }: ChipInteractionEvent): void;
|
35 | handleChipNavigation({ detail }: ChipNavigationEvent): void;
|
36 | /** Returns the unique selected indexes of the chips. */
|
37 | getSelectedChipIndexes(): ReadonlySet<number>;
|
38 | /** Sets the selected state of the chip at the given index and action. */
|
39 | setChipSelected(index: number, action: MDCChipActionType, isSelected: boolean): void;
|
40 | /** Returns the selected state of the chip at the given index and action. */
|
41 | isChipSelected(index: number, action: MDCChipActionType): boolean;
|
42 | /** Removes the chip at the given index. */
|
43 | removeChip(index: number): void;
|
44 | addChip(index: number): void;
|
45 | /**
|
46 | * Increments to find the first focusable chip.
|
47 | */
|
48 | private focusNextChipFrom;
|
49 | /**
|
50 | * Decrements to find the first focusable chip. Takes an optional target
|
51 | * action that can be used to focus the first matching focusable action.
|
52 | */
|
53 | private focusPrevChipFrom;
|
54 | /** Returns the appropriate focusable action, or null if none exist. */
|
55 | private getFocusableAction;
|
56 | /**
|
57 | * Returs the first focusable action, regardless of type, or null if no
|
58 | * focusable actions exist.
|
59 | */
|
60 | private getFirstFocusableAction;
|
61 | /**
|
62 | * If the actions contain a focusable action that matches the target action,
|
63 | * return that. Otherwise, return the first focusable action, or null if no
|
64 | * focusable action exists.
|
65 | */
|
66 | private getMatchingFocusableAction;
|
67 | private focusChip;
|
68 | private supportsMultiSelect;
|
69 | private setSelection;
|
70 | private removeAfterAnimation;
|
71 | /**
|
72 | * Find the first focusable action by moving bidirectionally horizontally
|
73 | * from the start index.
|
74 | *
|
75 | * Given chip set [A, B, C, D, E, F, G]...
|
76 | * Let's say we remove chip "F". We don't know where the nearest focusable
|
77 | * action is since any of them could be disabled. The nearest focusable
|
78 | * action could be E, it could be G, it could even be A. To find it, we
|
79 | * start from the source index (5 for "F" in this case) and move out
|
80 | * horizontally, checking each chip at each index.
|
81 | *
|
82 | */
|
83 | private focusNearestFocusableAction;
|
84 | private getNearestFocusableAction;
|
85 | }
|
86 | export default MDCChipSetFoundation;
|