@workday/canvas-kit-react 10.0.0-alpha.540-next.0 → 10.0.0-alpha.543-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/collection/index.ts +1 -0
- package/collection/lib/useBaseListModel.tsx +3 -3
- package/collection/lib/useListItemRegister.tsx +1 -1
- package/collection/lib/useListRenderItem.tsx +2 -2
- package/combobox/index.ts +11 -4
- package/combobox/lib/Combobox.tsx +1 -1
- package/combobox/lib/ComboboxCard.tsx +1 -1
- package/combobox/lib/ComboboxInput.tsx +2 -90
- package/combobox/lib/ComboboxMenu.tsx +4 -3
- package/combobox/lib/ComboboxMenuItem.tsx +9 -8
- package/combobox/lib/ComboboxMenuList.tsx +1 -1
- package/combobox/lib/ComboboxPopper.tsx +20 -0
- package/combobox/lib/hooks/index.ts +9 -0
- package/combobox/lib/hooks/useComboboxInput.ts +88 -0
- package/combobox/lib/hooks/useComboboxKeyboardTypeAhead.ts +127 -0
- package/combobox/lib/hooks/useComboboxListKeyboardHandler.ts +23 -0
- package/combobox/lib/{useComboboxModel.tsx → hooks/useComboboxModel.tsx} +6 -2
- package/combobox/lib/hooks/useComboboxMoveCursorToSelected.tsx +27 -0
- package/combobox/lib/hooks/useComboboxResetCursorToSelected.tsx +18 -0
- package/combobox/lib/hooks/useSetPopupWidth.ts +16 -0
- package/common/lib/utils/components.ts +284 -274
- package/common/lib/utils/models.ts +67 -84
- package/dist/commonjs/collection/index.d.ts +1 -0
- package/dist/commonjs/collection/index.d.ts.map +1 -1
- package/dist/commonjs/collection/index.js +3 -1
- package/dist/commonjs/collection/lib/useBaseListModel.d.ts +1 -1
- package/dist/commonjs/collection/lib/useBaseListModel.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useBaseListModel.js +2 -2
- package/dist/commonjs/collection/lib/useListItemRegister.js +2 -2
- package/dist/commonjs/collection/lib/useListRenderItem.js +2 -2
- package/dist/commonjs/combobox/index.d.ts +1 -4
- package/dist/commonjs/combobox/index.d.ts.map +1 -1
- package/dist/commonjs/combobox/index.js +11 -9
- package/dist/commonjs/combobox/lib/Combobox.d.ts +9 -3
- package/dist/commonjs/combobox/lib/Combobox.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/Combobox.js +2 -2
- package/dist/commonjs/combobox/lib/ComboboxCard.js +3 -3
- package/dist/commonjs/combobox/lib/ComboboxInput.d.ts +1 -106
- package/dist/commonjs/combobox/lib/ComboboxInput.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/ComboboxInput.js +4 -71
- package/dist/commonjs/combobox/lib/ComboboxMenu.d.ts +9 -3
- package/dist/commonjs/combobox/lib/ComboboxMenu.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/ComboboxMenu.js +5 -4
- package/dist/commonjs/combobox/lib/ComboboxMenuItem.d.ts +7 -1
- package/dist/commonjs/combobox/lib/ComboboxMenuItem.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/ComboboxMenuItem.js +7 -7
- package/dist/commonjs/combobox/lib/ComboboxMenuList.js +2 -2
- package/dist/commonjs/combobox/lib/ComboboxPopper.d.ts +97 -0
- package/dist/commonjs/combobox/lib/ComboboxPopper.d.ts.map +1 -0
- package/dist/commonjs/{select/lib/SelectOption.js → combobox/lib/ComboboxPopper.js} +12 -8
- package/dist/commonjs/combobox/lib/hooks/index.d.ts +10 -0
- package/dist/commonjs/combobox/lib/hooks/index.d.ts.map +1 -0
- package/dist/commonjs/combobox/lib/hooks/index.js +21 -0
- package/dist/commonjs/combobox/lib/hooks/useComboboxInput.d.ts +107 -0
- package/dist/commonjs/combobox/lib/hooks/useComboboxInput.d.ts.map +1 -0
- package/dist/commonjs/combobox/lib/hooks/useComboboxInput.js +74 -0
- package/dist/{es6/combobox/lib → commonjs/combobox/lib/hooks}/useComboboxInputOpenWithArrowKeys.d.ts +6 -6
- package/dist/commonjs/combobox/lib/hooks/useComboboxInputOpenWithArrowKeys.d.ts.map +1 -0
- package/dist/commonjs/combobox/lib/hooks/useComboboxKeyboardTypeAhead.d.ts +101 -0
- package/dist/commonjs/combobox/lib/hooks/useComboboxKeyboardTypeAhead.d.ts.map +1 -0
- package/dist/commonjs/combobox/lib/hooks/useComboboxKeyboardTypeAhead.js +109 -0
- package/dist/commonjs/combobox/lib/hooks/useComboboxListKeyboardHandler.d.ts +84 -0
- package/dist/commonjs/combobox/lib/hooks/useComboboxListKeyboardHandler.d.ts.map +1 -0
- package/dist/commonjs/combobox/lib/hooks/useComboboxListKeyboardHandler.js +22 -0
- package/dist/commonjs/combobox/lib/hooks/useComboboxLoader.d.ts.map +1 -0
- package/dist/commonjs/combobox/lib/{useComboboxModel.d.ts → hooks/useComboboxModel.d.ts} +196 -196
- package/dist/commonjs/combobox/lib/hooks/useComboboxModel.d.ts.map +1 -0
- package/dist/commonjs/combobox/lib/{useComboboxModel.js → hooks/useComboboxModel.js} +3 -2
- package/dist/commonjs/combobox/lib/hooks/useComboboxMoveCursorToSelected.d.ts +82 -0
- package/dist/commonjs/combobox/lib/hooks/useComboboxMoveCursorToSelected.d.ts.map +1 -0
- package/dist/commonjs/combobox/lib/hooks/useComboboxMoveCursorToSelected.js +33 -0
- package/dist/commonjs/combobox/lib/hooks/useComboboxResetCursorToSelected.d.ts +82 -0
- package/dist/commonjs/combobox/lib/hooks/useComboboxResetCursorToSelected.d.ts.map +1 -0
- package/dist/commonjs/combobox/lib/hooks/useComboboxResetCursorToSelected.js +23 -0
- package/dist/commonjs/combobox/lib/hooks/useSetPopupWidth.d.ts +82 -0
- package/dist/commonjs/combobox/lib/hooks/useSetPopupWidth.d.ts.map +1 -0
- package/dist/commonjs/combobox/lib/hooks/useSetPopupWidth.js +22 -0
- package/dist/commonjs/common/lib/utils/components.d.ts.map +1 -1
- package/dist/commonjs/common/lib/utils/models.d.ts +4 -4
- package/dist/commonjs/common/lib/utils/models.d.ts.map +1 -1
- package/dist/commonjs/common/lib/utils/models.js +7 -8
- package/dist/commonjs/form-field/lib/FormField.d.ts.map +1 -1
- package/dist/commonjs/form-field/lib/FormField.js +3 -2
- package/dist/commonjs/menu/lib/MenuPopper.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/MenuPopper.js +10 -1
- package/dist/commonjs/popup/lib/PopupPopper.d.ts.map +1 -1
- package/dist/commonjs/popup/lib/PopupPopper.js +10 -1
- package/dist/commonjs/select/index.d.ts +1 -1
- package/dist/commonjs/select/index.d.ts.map +1 -1
- package/dist/commonjs/select/index.js +1 -1
- package/dist/commonjs/select/lib/Select.d.ts +2634 -18
- package/dist/commonjs/select/lib/Select.d.ts.map +1 -1
- package/dist/commonjs/select/lib/Select.js +141 -84
- package/dist/commonjs/select/lib/hooks/index.d.ts +4 -0
- package/dist/commonjs/select/lib/hooks/index.d.ts.map +1 -0
- package/dist/commonjs/select/lib/hooks/index.js +15 -0
- package/dist/commonjs/select/lib/hooks/useSelectCard.d.ts +83 -0
- package/dist/commonjs/select/lib/hooks/useSelectCard.d.ts.map +1 -0
- package/dist/commonjs/select/lib/hooks/useSelectCard.js +13 -0
- package/dist/commonjs/select/lib/hooks/useSelectInput.d.ts +112 -0
- package/dist/commonjs/select/lib/hooks/useSelectInput.d.ts.map +1 -0
- package/dist/commonjs/select/lib/hooks/useSelectInput.js +49 -0
- package/dist/commonjs/select/lib/hooks/useSelectModel.d.ts +1779 -0
- package/dist/commonjs/select/lib/hooks/useSelectModel.d.ts.map +1 -0
- package/dist/commonjs/select/lib/hooks/useSelectModel.js +32 -0
- package/dist/es6/collection/index.d.ts +1 -0
- package/dist/es6/collection/index.d.ts.map +1 -1
- package/dist/es6/collection/index.js +1 -0
- package/dist/es6/collection/lib/useBaseListModel.d.ts +1 -1
- package/dist/es6/collection/lib/useBaseListModel.d.ts.map +1 -1
- package/dist/es6/collection/lib/useBaseListModel.js +2 -2
- package/dist/es6/collection/lib/useListItemRegister.js +2 -2
- package/dist/es6/collection/lib/useListRenderItem.js +2 -2
- package/dist/es6/combobox/index.d.ts +1 -4
- package/dist/es6/combobox/index.d.ts.map +1 -1
- package/dist/es6/combobox/index.js +1 -4
- package/dist/es6/combobox/lib/Combobox.d.ts +9 -3
- package/dist/es6/combobox/lib/Combobox.d.ts.map +1 -1
- package/dist/es6/combobox/lib/Combobox.js +1 -1
- package/dist/es6/combobox/lib/ComboboxCard.js +1 -1
- package/dist/es6/combobox/lib/ComboboxInput.d.ts +1 -106
- package/dist/es6/combobox/lib/ComboboxInput.d.ts.map +1 -1
- package/dist/es6/combobox/lib/ComboboxInput.js +2 -69
- package/dist/es6/combobox/lib/ComboboxMenu.d.ts +9 -3
- package/dist/es6/combobox/lib/ComboboxMenu.d.ts.map +1 -1
- package/dist/es6/combobox/lib/ComboboxMenu.js +4 -3
- package/dist/es6/combobox/lib/ComboboxMenuItem.d.ts +7 -1
- package/dist/es6/combobox/lib/ComboboxMenuItem.d.ts.map +1 -1
- package/dist/es6/combobox/lib/ComboboxMenuItem.js +7 -7
- package/dist/es6/combobox/lib/ComboboxMenuList.js +1 -1
- package/dist/es6/combobox/lib/ComboboxPopper.d.ts +97 -0
- package/dist/es6/combobox/lib/ComboboxPopper.d.ts.map +1 -0
- package/dist/es6/combobox/lib/ComboboxPopper.js +12 -0
- package/dist/es6/combobox/lib/hooks/index.d.ts +10 -0
- package/dist/es6/combobox/lib/hooks/index.d.ts.map +1 -0
- package/dist/es6/combobox/lib/hooks/index.js +9 -0
- package/dist/es6/combobox/lib/hooks/useComboboxInput.d.ts +107 -0
- package/dist/es6/combobox/lib/hooks/useComboboxInput.d.ts.map +1 -0
- package/dist/es6/combobox/lib/hooks/useComboboxInput.js +68 -0
- package/dist/{commonjs/combobox/lib → es6/combobox/lib/hooks}/useComboboxInputOpenWithArrowKeys.d.ts +6 -6
- package/dist/es6/combobox/lib/hooks/useComboboxInputOpenWithArrowKeys.d.ts.map +1 -0
- package/dist/es6/combobox/lib/hooks/useComboboxKeyboardTypeAhead.d.ts +101 -0
- package/dist/es6/combobox/lib/hooks/useComboboxKeyboardTypeAhead.d.ts.map +1 -0
- package/dist/es6/combobox/lib/hooks/useComboboxKeyboardTypeAhead.js +103 -0
- package/dist/es6/combobox/lib/hooks/useComboboxListKeyboardHandler.d.ts +84 -0
- package/dist/es6/combobox/lib/hooks/useComboboxListKeyboardHandler.d.ts.map +1 -0
- package/dist/es6/combobox/lib/hooks/useComboboxListKeyboardHandler.js +19 -0
- package/dist/es6/combobox/lib/hooks/useComboboxLoader.d.ts.map +1 -0
- package/dist/es6/combobox/lib/{useComboboxModel.d.ts → hooks/useComboboxModel.d.ts} +196 -196
- package/dist/es6/combobox/lib/hooks/useComboboxModel.d.ts.map +1 -0
- package/dist/es6/combobox/lib/{useComboboxModel.js → hooks/useComboboxModel.js} +3 -2
- package/dist/es6/combobox/lib/hooks/useComboboxMoveCursorToSelected.d.ts +82 -0
- package/dist/es6/combobox/lib/hooks/useComboboxMoveCursorToSelected.d.ts.map +1 -0
- package/dist/es6/combobox/lib/hooks/useComboboxMoveCursorToSelected.js +27 -0
- package/dist/es6/combobox/lib/hooks/useComboboxResetCursorToSelected.d.ts +82 -0
- package/dist/es6/combobox/lib/hooks/useComboboxResetCursorToSelected.d.ts.map +1 -0
- package/dist/es6/combobox/lib/hooks/useComboboxResetCursorToSelected.js +17 -0
- package/dist/es6/combobox/lib/hooks/useSetPopupWidth.d.ts +82 -0
- package/dist/es6/combobox/lib/hooks/useSetPopupWidth.d.ts.map +1 -0
- package/dist/es6/combobox/lib/hooks/useSetPopupWidth.js +16 -0
- package/dist/es6/common/lib/utils/components.d.ts.map +1 -1
- package/dist/es6/common/lib/utils/models.d.ts +4 -4
- package/dist/es6/common/lib/utils/models.d.ts.map +1 -1
- package/dist/es6/common/lib/utils/models.js +7 -8
- package/dist/es6/form-field/lib/FormField.d.ts.map +1 -1
- package/dist/es6/form-field/lib/FormField.js +3 -2
- package/dist/es6/menu/lib/MenuPopper.d.ts.map +1 -1
- package/dist/es6/menu/lib/MenuPopper.js +10 -1
- package/dist/es6/popup/lib/PopupPopper.d.ts.map +1 -1
- package/dist/es6/popup/lib/PopupPopper.js +10 -1
- package/dist/es6/select/index.d.ts +1 -1
- package/dist/es6/select/index.d.ts.map +1 -1
- package/dist/es6/select/index.js +1 -1
- package/dist/es6/select/lib/Select.d.ts +2634 -18
- package/dist/es6/select/lib/Select.d.ts.map +1 -1
- package/dist/es6/select/lib/Select.js +139 -66
- package/dist/es6/select/lib/hooks/index.d.ts +4 -0
- package/dist/es6/select/lib/hooks/index.d.ts.map +1 -0
- package/dist/es6/select/lib/hooks/index.js +3 -0
- package/dist/es6/select/lib/hooks/useSelectCard.d.ts +83 -0
- package/dist/es6/select/lib/hooks/useSelectCard.d.ts.map +1 -0
- package/dist/es6/select/lib/hooks/useSelectCard.js +10 -0
- package/dist/es6/select/lib/hooks/useSelectInput.d.ts +112 -0
- package/dist/es6/select/lib/hooks/useSelectInput.d.ts.map +1 -0
- package/dist/es6/select/lib/hooks/useSelectInput.js +46 -0
- package/dist/es6/select/lib/hooks/useSelectModel.d.ts +1779 -0
- package/dist/es6/select/lib/hooks/useSelectModel.d.ts.map +1 -0
- package/dist/es6/select/lib/hooks/useSelectModel.js +29 -0
- package/form-field/lib/FormField.tsx +8 -2
- package/menu/lib/MenuPopper.tsx +14 -1
- package/package.json +4 -4
- package/popup/lib/Popper.tsx +1 -1
- package/popup/lib/PopupPopper.tsx +17 -1
- package/select/index.ts +1 -1
- package/select/lib/Select.tsx +175 -111
- package/select/lib/hooks/index.ts +3 -0
- package/select/lib/hooks/useSelectCard.ts +11 -0
- package/select/lib/hooks/useSelectInput.ts +74 -0
- package/select/lib/hooks/useSelectModel.tsx +30 -0
- package/dist/commonjs/combobox/lib/useComboboxInputOpenWithArrowKeys.d.ts.map +0 -1
- package/dist/commonjs/combobox/lib/useComboboxLoader.d.ts.map +0 -1
- package/dist/commonjs/combobox/lib/useComboboxModel.d.ts.map +0 -1
- package/dist/commonjs/select/lib/SelectOption.d.ts +0 -20
- package/dist/commonjs/select/lib/SelectOption.d.ts.map +0 -1
- package/dist/es6/combobox/lib/useComboboxInputOpenWithArrowKeys.d.ts.map +0 -1
- package/dist/es6/combobox/lib/useComboboxLoader.d.ts.map +0 -1
- package/dist/es6/combobox/lib/useComboboxModel.d.ts.map +0 -1
- package/dist/es6/select/lib/SelectOption.d.ts +0 -20
- package/dist/es6/select/lib/SelectOption.d.ts.map +0 -1
- package/dist/es6/select/lib/SelectOption.js +0 -7
- package/select/lib/SelectOption.tsx +0 -33
- /package/combobox/lib/{useComboboxInputOpenWithArrowKeys.ts → hooks/useComboboxInputOpenWithArrowKeys.ts} +0 -0
- /package/combobox/lib/{useComboboxLoader.ts → hooks/useComboboxLoader.ts} +0 -0
- /package/dist/commonjs/combobox/lib/{useComboboxInputOpenWithArrowKeys.js → hooks/useComboboxInputOpenWithArrowKeys.js} +0 -0
- /package/dist/commonjs/combobox/lib/{useComboboxLoader.d.ts → hooks/useComboboxLoader.d.ts} +0 -0
- /package/dist/commonjs/combobox/lib/{useComboboxLoader.js → hooks/useComboboxLoader.js} +0 -0
- /package/dist/es6/combobox/lib/{useComboboxInputOpenWithArrowKeys.js → hooks/useComboboxInputOpenWithArrowKeys.js} +0 -0
- /package/dist/es6/combobox/lib/{useComboboxLoader.d.ts → hooks/useComboboxLoader.d.ts} +0 -0
- /package/dist/es6/combobox/lib/{useComboboxLoader.js → hooks/useComboboxLoader.js} +0 -0
|
@@ -1,109 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Adds all attributes necessary to start with a {@link ComboboxInput Combobox.Input}. It opens the
|
|
4
|
-
* menu with arrow keys, uses {@link useListActiveDescendant}, and handles keyboard arrows to
|
|
5
|
-
* navigate items of the menu. You may also compose this hook to add more specific behaviors for
|
|
6
|
-
* your {@link ComboboxInput Combobox.Input}.
|
|
7
|
-
*/
|
|
8
|
-
export declare const useComboboxInput: import("@workday/canvas-kit-react/common").BehaviorHook<{
|
|
9
|
-
state: {
|
|
10
|
-
stackRef: React.RefObject<HTMLDivElement>;
|
|
11
|
-
targetRef: React.RefObject<HTMLButtonElement>;
|
|
12
|
-
initialFocusRef: React.RefObject<any> | undefined;
|
|
13
|
-
returnFocusRef: React.RefObject<any> | undefined;
|
|
14
|
-
placement: import("@popperjs/core").Placement;
|
|
15
|
-
id: string;
|
|
16
|
-
visibility: "hidden" | "visible";
|
|
17
|
-
selectedIds: string[] | "all";
|
|
18
|
-
unselectedIds: string[];
|
|
19
|
-
cursorId: string;
|
|
20
|
-
columnCount: number;
|
|
21
|
-
pageSizeRef: React.MutableRefObject<number>;
|
|
22
|
-
cursorIndexRef: {
|
|
23
|
-
readonly current: number;
|
|
24
|
-
};
|
|
25
|
-
UNSTABLE_virtual: {
|
|
26
|
-
virtualItems: import("../../collection/lib/react-virtual").VirtualItem[];
|
|
27
|
-
totalSize: number;
|
|
28
|
-
scrollToOffset: (index: number, options?: import("../../collection/lib/react-virtual").ScrollToOffsetOptions | undefined) => void;
|
|
29
|
-
scrollToIndex: (index: number, options?: import("../../collection/lib/react-virtual").ScrollToIndexOptions | undefined) => void;
|
|
30
|
-
measure: () => void;
|
|
31
|
-
};
|
|
32
|
-
UNSTABLE_defaultItemHeight: number;
|
|
33
|
-
containerRef: React.RefObject<HTMLDivElement>;
|
|
34
|
-
orientation: "horizontal" | "vertical";
|
|
35
|
-
indexRef: React.MutableRefObject<number>;
|
|
36
|
-
nonInteractiveIds: string[];
|
|
37
|
-
isVirtualized: boolean;
|
|
38
|
-
items: import("@workday/canvas-kit-react/collection").Item<any>[];
|
|
39
|
-
mode: "multiple" | "single";
|
|
40
|
-
value: string | undefined;
|
|
41
|
-
inputRef: React.RefObject<HTMLInputElement>;
|
|
42
|
-
width: number;
|
|
43
|
-
};
|
|
44
|
-
events: {
|
|
45
|
-
setWidth(width: number): void;
|
|
46
|
-
updatePlacement(data: {
|
|
47
|
-
placement: import("@popperjs/core").Placement;
|
|
48
|
-
}): void;
|
|
49
|
-
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
50
|
-
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
51
|
-
select(data: {
|
|
52
|
-
id: string;
|
|
53
|
-
}): void;
|
|
54
|
-
selectAll(): void;
|
|
55
|
-
unselectAll(): void;
|
|
56
|
-
goTo(data: {
|
|
57
|
-
id: string;
|
|
58
|
-
}): void;
|
|
59
|
-
goToNext(): void;
|
|
60
|
-
goToPrevious(): void;
|
|
61
|
-
goToPreviousRow(): void;
|
|
62
|
-
goToNextRow(): void;
|
|
63
|
-
goToFirst(): void;
|
|
64
|
-
goToLast(): void;
|
|
65
|
-
goToFirstOfRow(): void;
|
|
66
|
-
goToLastOfRow(): void;
|
|
67
|
-
goToNextPage(): void;
|
|
68
|
-
goToPreviousPage(): void;
|
|
69
|
-
registerItem(data: {
|
|
70
|
-
item: any;
|
|
71
|
-
textValue: string;
|
|
72
|
-
}): void;
|
|
73
|
-
unregisterItem(data: {
|
|
74
|
-
id: string;
|
|
75
|
-
}): void;
|
|
76
|
-
updateItemHeight(data: {
|
|
77
|
-
value: number;
|
|
78
|
-
}): void;
|
|
79
|
-
};
|
|
80
|
-
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
81
|
-
selection: import("../../collection/lib/useSelectionListModel").SelectionManager;
|
|
82
|
-
navigation: import("../../collection/lib/useCursorListModel").NavigationManager;
|
|
83
|
-
getId: (item: any) => string;
|
|
84
|
-
}, {
|
|
85
|
-
readonly onKeyDown: (event: React.KeyboardEvent) => void;
|
|
86
|
-
readonly onBlur: (event: React.FocusEvent) => void;
|
|
87
|
-
readonly onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
88
|
-
readonly onClick: (event: React.MouseEvent) => void;
|
|
89
|
-
readonly value: string | undefined;
|
|
90
|
-
readonly role: "combobox";
|
|
91
|
-
readonly 'aria-haspopup': true;
|
|
92
|
-
readonly 'aria-expanded': boolean;
|
|
93
|
-
readonly 'aria-autocomplete': "list";
|
|
94
|
-
readonly 'aria-controls': `${string}-list`;
|
|
95
|
-
readonly id: string;
|
|
96
|
-
readonly ref: (instance: unknown) => void;
|
|
97
|
-
} & {
|
|
98
|
-
onKeyDown(event: React.KeyboardEvent<Element>): void;
|
|
99
|
-
} & {
|
|
100
|
-
'aria-activedescendant': string | undefined;
|
|
101
|
-
} & {
|
|
102
|
-
onKeyDown(event: React.KeyboardEvent<Element>): void;
|
|
103
|
-
} & {
|
|
104
|
-
ref: (instance: unknown) => void;
|
|
105
|
-
onClick: (event: React.MouseEvent<Element, MouseEvent>) => void;
|
|
106
|
-
}>;
|
|
107
2
|
export declare const ComboboxInput: import("@workday/canvas-kit-react/common").ElementComponentM<import("@workday/canvas-kit-react/common").ElementComponent<"input", import("@workday/canvas-kit-react/text-input").TextInputProps> & {
|
|
108
3
|
ErrorType: typeof import("@workday/canvas-kit-react/common").ErrorType;
|
|
109
4
|
}, import("@workday/canvas-kit-react/text-input").TextInputProps, {
|
|
@@ -136,7 +31,7 @@ export declare const ComboboxInput: import("@workday/canvas-kit-react/common").E
|
|
|
136
31
|
indexRef: React.MutableRefObject<number>;
|
|
137
32
|
nonInteractiveIds: string[];
|
|
138
33
|
isVirtualized: boolean;
|
|
139
|
-
items: import("
|
|
34
|
+
items: import("../..").Item<any>[];
|
|
140
35
|
mode: "multiple" | "single";
|
|
141
36
|
value: string | undefined;
|
|
142
37
|
inputRef: React.RefObject<HTMLInputElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxInput.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/ComboboxInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ComboboxInput.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/ComboboxInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKxB,CAAC"}
|
|
@@ -3,81 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ComboboxInput =
|
|
6
|
+
exports.ComboboxInput = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const common_1 = require("@workday/canvas-kit-react/common");
|
|
9
9
|
const text_input_1 = require("@workday/canvas-kit-react/text-input");
|
|
10
|
-
const
|
|
11
|
-
const collection_1 = require("@workday/canvas-kit-react/collection");
|
|
12
|
-
const useComboboxModel_1 = require("./useComboboxModel");
|
|
13
|
-
const useComboboxInputOpenWithArrowKeys_1 = require("./useComboboxInputOpenWithArrowKeys");
|
|
14
|
-
/**
|
|
15
|
-
* Adds all attributes necessary to start with a {@link ComboboxInput Combobox.Input}. It opens the
|
|
16
|
-
* menu with arrow keys, uses {@link useListActiveDescendant}, and handles keyboard arrows to
|
|
17
|
-
* navigate items of the menu. You may also compose this hook to add more specific behaviors for
|
|
18
|
-
* your {@link ComboboxInput Combobox.Input}.
|
|
19
|
-
*/
|
|
20
|
-
exports.useComboboxInput = common_1.composeHooks(common_1.createElemPropsHook(useComboboxModel_1.useComboboxModel)((model, ref) => {
|
|
21
|
-
const elementRef = common_1.useForkRef(ref, model.state.inputRef);
|
|
22
|
-
react_1.default.useEffect(() => {
|
|
23
|
-
var _a;
|
|
24
|
-
if (model.state.cursorId && model.state.visibility === 'visible') {
|
|
25
|
-
const item = model.navigation.getItem(model.state.cursorId, model);
|
|
26
|
-
if (model.state.isVirtualized && item) {
|
|
27
|
-
model.state.UNSTABLE_virtual.scrollToIndex(item.index);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
const listboxId = (_a = model.state.inputRef.current) === null || _a === void 0 ? void 0 : _a.getAttribute('aria-controls');
|
|
31
|
-
if (listboxId) {
|
|
32
|
-
const menuItem = document.querySelector(`[id="${listboxId}"] [data-id="${model.state.cursorId}"]`);
|
|
33
|
-
if (menuItem) {
|
|
34
|
-
menuItem.scrollIntoView({ block: 'nearest' });
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
// we only want to run this effect if the cursor changes and not any other time
|
|
40
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
41
|
-
}, [model.state.cursorId]);
|
|
42
|
-
return {
|
|
43
|
-
onKeyDown(event) {
|
|
44
|
-
if (event.key === 'Escape') {
|
|
45
|
-
common_1.dispatchInputEvent(event.currentTarget, '');
|
|
46
|
-
}
|
|
47
|
-
if (event.key === 'Enter' && !event.metaKey && model.state.visibility === 'visible') {
|
|
48
|
-
const element = document.querySelector(`[data-id="${model.state.cursorId}"]`);
|
|
49
|
-
if (element && (element === null || element === void 0 ? void 0 : element.getAttribute('aria-disabled')) !== 'true') {
|
|
50
|
-
model.events.select({ id: model.state.cursorId });
|
|
51
|
-
if (model.state.mode === 'single') {
|
|
52
|
-
model.events.hide(event);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
// We don't want to submit forms while the combobox is open
|
|
56
|
-
event.preventDefault();
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
onBlur(event) {
|
|
60
|
-
model.events.hide(event);
|
|
61
|
-
},
|
|
62
|
-
onChange: model.onChange,
|
|
63
|
-
onClick(event) {
|
|
64
|
-
if (model.state.visibility === 'hidden') {
|
|
65
|
-
model.events.setWidth(event.currentTarget.clientWidth);
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
value: model.state.value,
|
|
69
|
-
role: 'combobox',
|
|
70
|
-
'aria-haspopup': true,
|
|
71
|
-
'aria-expanded': model.state.visibility === 'visible',
|
|
72
|
-
'aria-autocomplete': 'list',
|
|
73
|
-
'aria-controls': `${model.state.id}-list`,
|
|
74
|
-
id: model.state.id,
|
|
75
|
-
ref: elementRef,
|
|
76
|
-
};
|
|
77
|
-
}), useComboboxInputOpenWithArrowKeys_1.useComboboxInputOpenWithArrowKeys, collection_1.useListActiveDescendant, collection_1.useListKeyboardHandler, popup_1.usePopupTarget);
|
|
10
|
+
const hooks_1 = require("./hooks");
|
|
78
11
|
exports.ComboboxInput = common_1.createSubcomponent(text_input_1.TextInput)({
|
|
79
|
-
modelHook:
|
|
80
|
-
elemPropsHook:
|
|
12
|
+
modelHook: hooks_1.useComboboxModel,
|
|
13
|
+
elemPropsHook: hooks_1.useComboboxInput,
|
|
81
14
|
})(({ children, ...elemProps }, Element) => {
|
|
82
15
|
return react_1.default.createElement(Element, Object.assign({}, elemProps), children);
|
|
83
16
|
});
|
|
@@ -87,9 +87,9 @@ export declare const ComboboxMenu: import("@workday/canvas-kit-react/common").El
|
|
|
87
87
|
* {@link ComboboxInput Combobox.Input}. It renders a `div` element that is portalled to the
|
|
88
88
|
* `document.body` which is controlled by the {@link PopupStack}. The `PopupStack` is not part
|
|
89
89
|
* of React. This means no extra props given to this component will be forwarded to the `div`
|
|
90
|
-
* element, but the `ref` will be forwarded.
|
|
90
|
+
* element, but the `ref` will be forwarded. Also fallback placements for the popper with be either `top` or `bottom`.
|
|
91
91
|
*/
|
|
92
|
-
Popper: import("@workday/canvas-kit-react/common").ElementComponentM<"div", import("
|
|
92
|
+
Popper: import("@workday/canvas-kit-react/common").ElementComponentM<"div", import("../..").PopperProps & React.RefAttributes<HTMLDivElement>, {
|
|
93
93
|
state: {
|
|
94
94
|
stackRef: React.RefObject<HTMLDivElement>;
|
|
95
95
|
targetRef: React.RefObject<HTMLButtonElement>;
|
|
@@ -340,7 +340,13 @@ export declare const ComboboxMenu: import("@workday/canvas-kit-react/common").El
|
|
|
340
340
|
selection: import("../../collection/lib/useSelectionListModel").SelectionManager;
|
|
341
341
|
navigation: import("../../collection/lib/useCursorListModel").NavigationManager;
|
|
342
342
|
getId: (item: any) => string;
|
|
343
|
-
}
|
|
343
|
+
}> & {
|
|
344
|
+
Icon: import("@emotion/styled").StyledComponent<import("../..").SystemIconProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "as" | keyof import("../..").SystemIconProps> & {
|
|
345
|
+
ref?: React.Ref<HTMLSpanElement> | undefined;
|
|
346
|
+
} & {
|
|
347
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
348
|
+
}, {}, {}>;
|
|
349
|
+
};
|
|
344
350
|
/**
|
|
345
351
|
* `Combobox.Menu.Card` is a non-semantic element used to give the dropdown menu its distinct visual
|
|
346
352
|
* cue that the dropdown menu is floating above other content. `Combobox.Menu.Card` usually contains a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxMenu.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/ComboboxMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ComboboxMenu.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/ComboboxMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGrB;;;;;;OAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEH;;;;;;;;;;;;;;;;;;;;OAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAML,CAAC"}
|
|
@@ -7,21 +7,22 @@ exports.ComboboxMenu = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const common_1 = require("@workday/canvas-kit-react/common");
|
|
9
9
|
const menu_1 = require("@workday/canvas-kit-react/menu");
|
|
10
|
-
const
|
|
10
|
+
const hooks_1 = require("./hooks");
|
|
11
11
|
const ComboboxMenuList_1 = require("./ComboboxMenuList");
|
|
12
12
|
const ComboboxMenuItem_1 = require("./ComboboxMenuItem");
|
|
13
13
|
const ComboboxCard_1 = require("./ComboboxCard");
|
|
14
|
+
const ComboboxPopper_1 = require("./ComboboxPopper");
|
|
14
15
|
exports.ComboboxMenu = common_1.createSubcomponent()({
|
|
15
|
-
modelHook:
|
|
16
|
+
modelHook: hooks_1.useComboboxModel,
|
|
16
17
|
subComponents: {
|
|
17
18
|
/**
|
|
18
19
|
* The "Popper" of a {@link ComboboxMenu Combobox.Menu}. The popper will appear around the
|
|
19
20
|
* {@link ComboboxInput Combobox.Input}. It renders a `div` element that is portalled to the
|
|
20
21
|
* `document.body` which is controlled by the {@link PopupStack}. The `PopupStack` is not part
|
|
21
22
|
* of React. This means no extra props given to this component will be forwarded to the `div`
|
|
22
|
-
* element, but the `ref` will be forwarded.
|
|
23
|
+
* element, but the `ref` will be forwarded. Also fallback placements for the popper with be either `top` or `bottom`.
|
|
23
24
|
*/
|
|
24
|
-
Popper:
|
|
25
|
+
Popper: ComboboxPopper_1.ComboboxMenuPopper,
|
|
25
26
|
/**
|
|
26
27
|
* The combobox menu list follows the Collections API. A list can either contain static items or
|
|
27
28
|
* a render prop and `items` to the model.
|
|
@@ -174,5 +174,11 @@ export declare const ComboboxMenuItem: import("@workday/canvas-kit-react/common"
|
|
|
174
174
|
selection: import("../../collection/lib/useSelectionListModel").SelectionManager;
|
|
175
175
|
navigation: import("../../collection/lib/useCursorListModel").NavigationManager;
|
|
176
176
|
getId: (item: any) => string;
|
|
177
|
-
}
|
|
177
|
+
}> & {
|
|
178
|
+
Icon: import("@emotion/styled").StyledComponent<import("@workday/canvas-kit-react/icon").SystemIconProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "as" | keyof import("@workday/canvas-kit-react/icon").SystemIconProps> & {
|
|
179
|
+
ref?: React.Ref<HTMLSpanElement> | undefined;
|
|
180
|
+
} & {
|
|
181
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
182
|
+
}, {}, {}>;
|
|
183
|
+
};
|
|
178
184
|
//# sourceMappingURL=ComboboxMenuItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxMenuItem.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/ComboboxMenuItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ComboboxMenuItem.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/ComboboxMenuItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAkB1B,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kCAIA,gBAAgB,CAAC,WAAW,CAAC;;;;;;;;;;;;;;EAyB5D,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAc3B,CAAC"}
|
|
@@ -7,9 +7,10 @@ exports.ComboboxMenuItem = exports.useComboboxMenuItem = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const common_1 = require("@workday/canvas-kit-react/common");
|
|
9
9
|
const menu_1 = require("@workday/canvas-kit-react/menu");
|
|
10
|
+
const icon_1 = require("@workday/canvas-kit-react/icon");
|
|
10
11
|
const collection_1 = require("@workday/canvas-kit-react/collection");
|
|
11
12
|
const tooltip_1 = require("@workday/canvas-kit-react/tooltip");
|
|
12
|
-
const
|
|
13
|
+
const hooks_1 = require("./hooks");
|
|
13
14
|
/**
|
|
14
15
|
* This hook sets up accessibility and behavior of a {@link ComboboxMenuItem Combobox.Menu.Item}
|
|
15
16
|
* component. It prevents focus when clicking so the focus stays on the
|
|
@@ -17,13 +18,9 @@ const useComboboxModel_1 = require("./useComboboxModel");
|
|
|
17
18
|
* also prevents items with an `aria-disabled` attribute from being selected. A `focus` CSS class is
|
|
18
19
|
* added when the item has "focus" (when the cursor is on the item).
|
|
19
20
|
*/
|
|
20
|
-
exports.useComboboxMenuItem = common_1.composeHooks(common_1.createElemPropsHook(menu_1.useMenuModel)((model,
|
|
21
|
+
exports.useComboboxMenuItem = common_1.composeHooks(common_1.createElemPropsHook(menu_1.useMenuModel)((model, ref, elemProps = {}) => {
|
|
21
22
|
const id = elemProps['data-id'] || '';
|
|
22
23
|
const onMouseDown = (event) => {
|
|
23
|
-
if (model.state.nonInteractiveIds.includes(id) ||
|
|
24
|
-
event.currentTarget.hasAttribute('aria-disabled')) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
24
|
if (event.currentTarget.getAttribute('aria-disabled') !== 'true') {
|
|
28
25
|
model.events.select({ id });
|
|
29
26
|
if (model.state.mode === 'single') {
|
|
@@ -42,8 +39,11 @@ exports.useComboboxMenuItem = common_1.composeHooks(common_1.createElemPropsHook
|
|
|
42
39
|
};
|
|
43
40
|
}), collection_1.useListItemRegister, collection_1.useListItemAllowChildStrings);
|
|
44
41
|
exports.ComboboxMenuItem = common_1.createSubcomponent('li')({
|
|
45
|
-
modelHook:
|
|
42
|
+
modelHook: hooks_1.useComboboxModel,
|
|
46
43
|
elemPropsHook: exports.useComboboxMenuItem,
|
|
44
|
+
subComponents: {
|
|
45
|
+
Icon: common_1.styled(icon_1.SystemIcon)({ alignSelf: 'start' }),
|
|
46
|
+
},
|
|
47
47
|
})(({ children, ...elemProps }, Element) => {
|
|
48
48
|
return (react_1.default.createElement(tooltip_1.OverflowTooltip, { placement: "left" },
|
|
49
49
|
react_1.default.createElement(menu_1.StyledMenuItem, Object.assign({ minHeight: "xl", as: Element }, elemProps), children)));
|
|
@@ -9,7 +9,7 @@ const tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
|
9
9
|
const common_1 = require("@workday/canvas-kit-react/common");
|
|
10
10
|
const menu_1 = require("@workday/canvas-kit-react/menu");
|
|
11
11
|
const collection_1 = require("@workday/canvas-kit-react/collection");
|
|
12
|
-
const
|
|
12
|
+
const hooks_1 = require("./hooks");
|
|
13
13
|
/**
|
|
14
14
|
* The `listbox` uses `aria-labelledby` pointing to the {@link ComboboxInput Combobox.Input}. This
|
|
15
15
|
* input should be labelled by a form field label for proper accessibility. Use {@link FormField} to
|
|
@@ -24,7 +24,7 @@ exports.useComboboxMenuList = common_1.createElemPropsHook(menu_1.useMenuModel)(
|
|
|
24
24
|
};
|
|
25
25
|
});
|
|
26
26
|
exports.ComboboxMenuList = common_1.createSubcomponent('ul')({
|
|
27
|
-
modelHook:
|
|
27
|
+
modelHook: hooks_1.useComboboxModel,
|
|
28
28
|
elemPropsHook: exports.useComboboxMenuList,
|
|
29
29
|
})(({ children, ...elemProps }, Element, model) => {
|
|
30
30
|
return (react_1.default.createElement(collection_1.ListBox, Object.assign({ as: Element, model: model, background: tokens_1.commonColors.background, borderRadius: "zero", padding: "zero", marginY: "xxs", gap: "zero", overflowY: "auto" }, elemProps), children));
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare const useMenuPopper: import("@workday/canvas-kit-react/common").BehaviorHook<{
|
|
3
|
+
state: {
|
|
4
|
+
stackRef: React.RefObject<HTMLDivElement>;
|
|
5
|
+
targetRef: React.RefObject<HTMLButtonElement>;
|
|
6
|
+
initialFocusRef: React.RefObject<any> | undefined;
|
|
7
|
+
returnFocusRef: React.RefObject<any> | undefined;
|
|
8
|
+
placement: import("@popperjs/core").Placement;
|
|
9
|
+
id: string;
|
|
10
|
+
visibility: "hidden" | "visible";
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
updatePlacement(data: {
|
|
14
|
+
placement: import("@popperjs/core").Placement;
|
|
15
|
+
}): void;
|
|
16
|
+
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
17
|
+
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
18
|
+
};
|
|
19
|
+
}, {
|
|
20
|
+
open: boolean;
|
|
21
|
+
anchorElement: React.RefObject<HTMLButtonElement>;
|
|
22
|
+
ref: (instance: unknown) => void;
|
|
23
|
+
onPlacementChange: (placement: import("@popperjs/core").Placement) => void;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const ComboboxMenuPopper: import("@workday/canvas-kit-react/common").ElementComponentM<"div", import("@workday/canvas-kit-react/popup").PopperProps & React.RefAttributes<HTMLDivElement>, {
|
|
26
|
+
state: {
|
|
27
|
+
stackRef: React.RefObject<HTMLDivElement>;
|
|
28
|
+
targetRef: React.RefObject<HTMLButtonElement>;
|
|
29
|
+
initialFocusRef: React.RefObject<any> | undefined;
|
|
30
|
+
returnFocusRef: React.RefObject<any> | undefined;
|
|
31
|
+
placement: import("@popperjs/core").Placement;
|
|
32
|
+
id: string;
|
|
33
|
+
visibility: "hidden" | "visible";
|
|
34
|
+
selectedIds: string[] | "all";
|
|
35
|
+
unselectedIds: string[];
|
|
36
|
+
cursorId: string;
|
|
37
|
+
columnCount: number;
|
|
38
|
+
pageSizeRef: React.MutableRefObject<number>;
|
|
39
|
+
cursorIndexRef: {
|
|
40
|
+
readonly current: number;
|
|
41
|
+
};
|
|
42
|
+
UNSTABLE_virtual: {
|
|
43
|
+
virtualItems: import("../../collection/lib/react-virtual").VirtualItem[];
|
|
44
|
+
totalSize: number;
|
|
45
|
+
scrollToOffset: (index: number, options?: import("../../collection/lib/react-virtual").ScrollToOffsetOptions | undefined) => void;
|
|
46
|
+
scrollToIndex: (index: number, options?: import("../../collection/lib/react-virtual").ScrollToIndexOptions | undefined) => void;
|
|
47
|
+
measure: () => void;
|
|
48
|
+
};
|
|
49
|
+
UNSTABLE_defaultItemHeight: number;
|
|
50
|
+
containerRef: React.RefObject<HTMLDivElement>;
|
|
51
|
+
orientation: "horizontal" | "vertical";
|
|
52
|
+
indexRef: React.MutableRefObject<number>;
|
|
53
|
+
nonInteractiveIds: string[];
|
|
54
|
+
isVirtualized: boolean;
|
|
55
|
+
items: import("../..").Item<any>[];
|
|
56
|
+
mode: "multiple" | "single";
|
|
57
|
+
};
|
|
58
|
+
events: {
|
|
59
|
+
updatePlacement(data: {
|
|
60
|
+
placement: import("@popperjs/core").Placement;
|
|
61
|
+
}): void;
|
|
62
|
+
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
63
|
+
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
64
|
+
select(data: {
|
|
65
|
+
id: string;
|
|
66
|
+
}): void;
|
|
67
|
+
selectAll(): void;
|
|
68
|
+
unselectAll(): void;
|
|
69
|
+
goTo(data: {
|
|
70
|
+
id: string;
|
|
71
|
+
}): void;
|
|
72
|
+
goToNext(): void;
|
|
73
|
+
goToPrevious(): void;
|
|
74
|
+
goToPreviousRow(): void;
|
|
75
|
+
goToNextRow(): void;
|
|
76
|
+
goToFirst(): void;
|
|
77
|
+
goToLast(): void;
|
|
78
|
+
goToFirstOfRow(): void;
|
|
79
|
+
goToLastOfRow(): void;
|
|
80
|
+
goToNextPage(): void;
|
|
81
|
+
goToPreviousPage(): void;
|
|
82
|
+
registerItem(data: {
|
|
83
|
+
item: any;
|
|
84
|
+
textValue: string;
|
|
85
|
+
}): void;
|
|
86
|
+
unregisterItem(data: {
|
|
87
|
+
id: string;
|
|
88
|
+
}): void;
|
|
89
|
+
updateItemHeight(data: {
|
|
90
|
+
value: number;
|
|
91
|
+
}): void;
|
|
92
|
+
};
|
|
93
|
+
selection: import("../../collection/lib/useSelectionListModel").SelectionManager;
|
|
94
|
+
navigation: import("../../collection/lib/useCursorListModel").NavigationManager;
|
|
95
|
+
getId: (item: any) => string;
|
|
96
|
+
}>;
|
|
97
|
+
//# sourceMappingURL=ComboboxPopper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComboboxPopper.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/ComboboxPopper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;EAAiB,CAAC;AAE5C,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU7B,CAAC"}
|
|
@@ -19,12 +19,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.
|
|
22
|
+
exports.ComboboxMenuPopper = exports.useMenuPopper = void 0;
|
|
23
23
|
const React = __importStar(require("react"));
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
const common_1 = require("@workday/canvas-kit-react/common");
|
|
25
|
+
const popup_1 = require("@workday/canvas-kit-react/popup");
|
|
26
|
+
const menu_1 = require("@workday/canvas-kit-react/menu");
|
|
27
|
+
exports.useMenuPopper = popup_1.usePopupPopper;
|
|
28
|
+
exports.ComboboxMenuPopper = common_1.createSubcomponent('div')({
|
|
29
|
+
displayName: 'Combobox.Menu.Popper',
|
|
30
|
+
modelHook: menu_1.useMenuModel,
|
|
31
|
+
elemPropsHook: exports.useMenuPopper,
|
|
32
|
+
})(({ children, ...elemProps }) => {
|
|
33
|
+
return (React.createElement(menu_1.Menu.Popper, Object.assign({ fallbackPlacements: ['top', 'bottom'] }, elemProps), children));
|
|
34
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './useComboboxInputOpenWithArrowKeys';
|
|
2
|
+
export * from './useComboboxLoader';
|
|
3
|
+
export * from './useComboboxModel';
|
|
4
|
+
export * from './useComboboxMoveCursorToSelected';
|
|
5
|
+
export * from './useSetPopupWidth';
|
|
6
|
+
export * from './useComboboxKeyboardTypeAhead';
|
|
7
|
+
export * from './useComboboxListKeyboardHandler';
|
|
8
|
+
export * from './useComboboxInput';
|
|
9
|
+
export * from './useComboboxResetCursorToSelected';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../combobox/lib/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AACpD,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mCAAmC,CAAC;AAClD,cAAc,oBAAoB,CAAC;AACnC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,oBAAoB,CAAC;AACnC,cAAc,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./useComboboxInputOpenWithArrowKeys"), exports);
|
|
14
|
+
__exportStar(require("./useComboboxLoader"), exports);
|
|
15
|
+
__exportStar(require("./useComboboxModel"), exports);
|
|
16
|
+
__exportStar(require("./useComboboxMoveCursorToSelected"), exports);
|
|
17
|
+
__exportStar(require("./useSetPopupWidth"), exports);
|
|
18
|
+
__exportStar(require("./useComboboxKeyboardTypeAhead"), exports);
|
|
19
|
+
__exportStar(require("./useComboboxListKeyboardHandler"), exports);
|
|
20
|
+
__exportStar(require("./useComboboxInput"), exports);
|
|
21
|
+
__exportStar(require("./useComboboxResetCursorToSelected"), exports);
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* `useComboboxInput` Adds all attributes necessary to start with a {@link ComboboxInput Combobox.Input}. It opens the
|
|
4
|
+
* menu with arrow keys, uses {@link useListActiveDescendant}, and handles keyboard arrows to
|
|
5
|
+
* navigate items of the menu. You may also compose this hook to add more specific behaviors for
|
|
6
|
+
* your {@link ComboboxInput Combobox.Input}.
|
|
7
|
+
*/
|
|
8
|
+
export declare const useComboboxInput: import("@workday/canvas-kit-react/common").BehaviorHook<{
|
|
9
|
+
state: {
|
|
10
|
+
stackRef: React.RefObject<HTMLDivElement>;
|
|
11
|
+
targetRef: React.RefObject<HTMLButtonElement>;
|
|
12
|
+
initialFocusRef: React.RefObject<any> | undefined;
|
|
13
|
+
returnFocusRef: React.RefObject<any> | undefined;
|
|
14
|
+
placement: import("@popperjs/core").Placement;
|
|
15
|
+
id: string;
|
|
16
|
+
visibility: "hidden" | "visible";
|
|
17
|
+
selectedIds: string[] | "all";
|
|
18
|
+
unselectedIds: string[];
|
|
19
|
+
cursorId: string;
|
|
20
|
+
columnCount: number;
|
|
21
|
+
pageSizeRef: React.MutableRefObject<number>;
|
|
22
|
+
cursorIndexRef: {
|
|
23
|
+
readonly current: number;
|
|
24
|
+
};
|
|
25
|
+
UNSTABLE_virtual: {
|
|
26
|
+
virtualItems: import("../../../collection/lib/react-virtual").VirtualItem[];
|
|
27
|
+
totalSize: number;
|
|
28
|
+
scrollToOffset: (index: number, options?: import("../../../collection/lib/react-virtual").ScrollToOffsetOptions | undefined) => void;
|
|
29
|
+
scrollToIndex: (index: number, options?: import("../../../collection/lib/react-virtual").ScrollToIndexOptions | undefined) => void;
|
|
30
|
+
measure: () => void;
|
|
31
|
+
};
|
|
32
|
+
UNSTABLE_defaultItemHeight: number;
|
|
33
|
+
containerRef: React.RefObject<HTMLDivElement>;
|
|
34
|
+
orientation: "horizontal" | "vertical";
|
|
35
|
+
indexRef: React.MutableRefObject<number>;
|
|
36
|
+
nonInteractiveIds: string[];
|
|
37
|
+
isVirtualized: boolean;
|
|
38
|
+
items: import("@workday/canvas-kit-react/collection").Item<any>[];
|
|
39
|
+
mode: "multiple" | "single";
|
|
40
|
+
value: string | undefined;
|
|
41
|
+
inputRef: React.RefObject<HTMLInputElement>;
|
|
42
|
+
width: number;
|
|
43
|
+
};
|
|
44
|
+
events: {
|
|
45
|
+
setWidth(width: number): void;
|
|
46
|
+
updatePlacement(data: {
|
|
47
|
+
placement: import("@popperjs/core").Placement;
|
|
48
|
+
}): void;
|
|
49
|
+
show(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
50
|
+
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
51
|
+
select(data: {
|
|
52
|
+
id: string;
|
|
53
|
+
}): void;
|
|
54
|
+
selectAll(): void;
|
|
55
|
+
unselectAll(): void;
|
|
56
|
+
goTo(data: {
|
|
57
|
+
id: string;
|
|
58
|
+
}): void;
|
|
59
|
+
goToNext(): void;
|
|
60
|
+
goToPrevious(): void;
|
|
61
|
+
goToPreviousRow(): void;
|
|
62
|
+
goToNextRow(): void;
|
|
63
|
+
goToFirst(): void;
|
|
64
|
+
goToLast(): void;
|
|
65
|
+
goToFirstOfRow(): void;
|
|
66
|
+
goToLastOfRow(): void;
|
|
67
|
+
goToNextPage(): void;
|
|
68
|
+
goToPreviousPage(): void;
|
|
69
|
+
registerItem(data: {
|
|
70
|
+
item: any;
|
|
71
|
+
textValue: string;
|
|
72
|
+
}): void;
|
|
73
|
+
unregisterItem(data: {
|
|
74
|
+
id: string;
|
|
75
|
+
}): void;
|
|
76
|
+
updateItemHeight(data: {
|
|
77
|
+
value: number;
|
|
78
|
+
}): void;
|
|
79
|
+
};
|
|
80
|
+
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
81
|
+
selection: import("../../../collection/lib/useSelectionListModel").SelectionManager;
|
|
82
|
+
navigation: import("../../../collection/lib/useCursorListModel").NavigationManager;
|
|
83
|
+
getId: (item: any) => string;
|
|
84
|
+
}, {
|
|
85
|
+
readonly onKeyDown: (event: React.KeyboardEvent) => void;
|
|
86
|
+
readonly onBlur: (event: React.FocusEvent) => void;
|
|
87
|
+
readonly onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
88
|
+
readonly onClick: (event: React.MouseEvent) => void;
|
|
89
|
+
readonly value: string | undefined;
|
|
90
|
+
readonly role: "combobox";
|
|
91
|
+
readonly 'aria-haspopup': true;
|
|
92
|
+
readonly 'aria-expanded': boolean;
|
|
93
|
+
readonly 'aria-autocomplete': "list";
|
|
94
|
+
readonly 'aria-controls': `${string}-list`;
|
|
95
|
+
readonly id: string;
|
|
96
|
+
readonly ref: (instance: unknown) => void;
|
|
97
|
+
} & {
|
|
98
|
+
onKeyDown(event: React.KeyboardEvent<Element>): void;
|
|
99
|
+
} & {
|
|
100
|
+
'aria-activedescendant': string | undefined;
|
|
101
|
+
} & {
|
|
102
|
+
onKeyDown(event: React.KeyboardEvent<Element>): void;
|
|
103
|
+
} & {
|
|
104
|
+
ref: (instance: unknown) => void;
|
|
105
|
+
onClick: (event: React.MouseEvent<Element, MouseEvent>) => void;
|
|
106
|
+
}>;
|
|
107
|
+
//# sourceMappingURL=useComboboxInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useComboboxInput.d.ts","sourceRoot":"","sources":["../../../../../combobox/lib/hooks/useComboboxInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCA6BN,mBAAmB;6BActB,gBAAgB;;8BAIf,gBAAgB;;;;;;;;;;;;;;;;;;EAoBpC,CAAC"}
|