@workday/canvas-kit-react 10.0.0-alpha.540-next.0 → 10.0.0-alpha.546-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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSelectModel.d.ts","sourceRoot":"","sources":["../../../../../select/lib/hooks/useSelectModel.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYzB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSelectModel = void 0;
|
|
4
|
+
const common_1 = require("@workday/canvas-kit-react/common");
|
|
5
|
+
const combobox_1 = require("@workday/canvas-kit-react/combobox");
|
|
6
|
+
/**
|
|
7
|
+
* `SelectModel` extends the {@link ComboboxModel}. Selecting items from
|
|
8
|
+
* the menu will dispatch an
|
|
9
|
+
* [input](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event) event on the
|
|
10
|
+
* input which should work with form libraries, automation and autofill.
|
|
11
|
+
*
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const model = useSelectModel({items: ['Mobile', 'Phone', 'E-Mail']})
|
|
14
|
+
*
|
|
15
|
+
* <Select model={model}>
|
|
16
|
+
* ...
|
|
17
|
+
* </Select>
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
exports.useSelectModel = common_1.createModelHook({
|
|
21
|
+
defaultConfig: {
|
|
22
|
+
...combobox_1.useComboboxModel.defaultConfig,
|
|
23
|
+
shouldVirtualize: false,
|
|
24
|
+
},
|
|
25
|
+
requiredConfig: {
|
|
26
|
+
...combobox_1.useComboboxModel.requiredConfig,
|
|
27
|
+
},
|
|
28
|
+
contextOverride: combobox_1.useComboboxModel.Context,
|
|
29
|
+
})(config => {
|
|
30
|
+
const model = combobox_1.useComboboxModel(config);
|
|
31
|
+
return model;
|
|
32
|
+
});
|
|
@@ -15,6 +15,7 @@ export * from './lib/useGridModel';
|
|
|
15
15
|
export * from './lib/useListActiveDescendant';
|
|
16
16
|
export * from './lib/useListItemAllowChildStrings';
|
|
17
17
|
export { ListBox, ListBoxProps } from './lib/ListBox';
|
|
18
|
+
export { keyboardEventToCursorEvents } from './lib/keyUtils';
|
|
18
19
|
export { singleSelectionManager, multiSelectionManager, isSelected, } from './lib/useSelectionListModel';
|
|
19
20
|
export { wrappingNavigationManager, navigationManager } from './lib/useCursorListModel';
|
|
20
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../collection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAC1D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oCAAoC,CAAC;AACnD,OAAO,EAAC,OAAO,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACpD,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,UAAU,GACX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAC,yBAAyB,EAAE,iBAAiB,EAAC,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../collection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAC1D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oCAAoC,CAAC;AACnD,OAAO,EAAC,OAAO,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACpD,OAAO,EAAC,2BAA2B,EAAC,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,UAAU,GACX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAC,yBAAyB,EAAE,iBAAiB,EAAC,MAAM,0BAA0B,CAAC"}
|
|
@@ -15,5 +15,6 @@ export * from './lib/useGridModel';
|
|
|
15
15
|
export * from './lib/useListActiveDescendant';
|
|
16
16
|
export * from './lib/useListItemAllowChildStrings';
|
|
17
17
|
export { ListBox } from './lib/ListBox';
|
|
18
|
+
export { keyboardEventToCursorEvents } from './lib/keyUtils';
|
|
18
19
|
export { singleSelectionManager, multiSelectionManager, isSelected, } from './lib/useSelectionListModel';
|
|
19
20
|
export { wrappingNavigationManager, navigationManager } from './lib/useCursorListModel';
|
|
@@ -10,7 +10,7 @@ export interface Item<T> {
|
|
|
10
10
|
/**
|
|
11
11
|
* Used by components that allow jumping to an item based on typing
|
|
12
12
|
*/
|
|
13
|
-
textValue
|
|
13
|
+
textValue: string;
|
|
14
14
|
}
|
|
15
15
|
export declare const useBaseListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
16
16
|
/** IDREF of the list. Children ids can be derived from this id */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBaseListModel.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useBaseListModel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAA+B,OAAO,EAAC,MAAM,kCAAkC,CAAC;AAEvF,oBAAY,WAAW,GAAG,YAAY,GAAG,UAAU,CAAC;AAEpD,eAAO,MAAM,YAAY,SAAU,GAAG,KAAG,MAExC,CAAC;AAEF,eAAO,MAAM,mBAAmB,SAAU,GAAG,KAAG,MAE/C,CAAC;AAEF,MAAM,WAAW,IAAI,CAAC,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,CAAC,CAAC;IACT;;OAEG;IACH,SAAS,
|
|
1
|
+
{"version":3,"file":"useBaseListModel.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useBaseListModel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAA+B,OAAO,EAAC,MAAM,kCAAkC,CAAC;AAEvF,oBAAY,WAAW,GAAG,YAAY,GAAG,UAAU,CAAC;AAEpD,eAAO,MAAM,YAAY,SAAU,GAAG,KAAG,MAExC,CAAC;AAEF,eAAO,MAAM,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AAE;;;;;;;;;;;;;;;;WA0FY,KAAK,OAAO,CAAC,EAAE;;IAiBzC;;;OAGG;uBACgB;QAAC,IAAI,EAAE,OAAO,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAC;IAWrD;;;OAGG;;YACuB,MAAM;;IAUhC;;;;;;;;OAQG;2BACoB;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC;;;;;;;;;;;;;;;;;eAvDZ,KAAK,OAAO,CAAC,EAAE;;;QAiBzC;;;WAGG;2BACgB;YAAC,IAAI,EAAE,OAAO,CAAC;YAAC,SAAS,EAAE,MAAM,CAAA;SAAC;QAWrD;;;WAGG;;gBACuB,MAAM;;QAUhC;;;;;;;;WAQG;+BACoB;YAAC,KAAK,EAAE,MAAM,CAAA;SAAC;;kBAhIxB,OAAO;EAsIvB,CAAC"}
|
|
@@ -5,7 +5,7 @@ export const defaultGetId = (item) => {
|
|
|
5
5
|
return typeof item === 'string' ? item : item.id || '';
|
|
6
6
|
};
|
|
7
7
|
export const defaultGetTextValue = (item) => {
|
|
8
|
-
return typeof item === 'string' ? item : item.text || '';
|
|
8
|
+
return typeof item === 'string' ? item : item.text || item.id || '';
|
|
9
9
|
};
|
|
10
10
|
// interface Collection<T> {
|
|
11
11
|
// getKeys(): string[];
|
|
@@ -91,7 +91,7 @@ export const useBaseListModel = createModelHook({
|
|
|
91
91
|
const getIdRef = React.useRef(defaultGetId);
|
|
92
92
|
const getTextValueRef = React.useRef(defaultGetTextValue);
|
|
93
93
|
const getId = config.getId || defaultGetId;
|
|
94
|
-
const getTextValue = config.getTextValue || defaultGetTextValue;
|
|
94
|
+
const getTextValue = config.getTextValue || config.getId || defaultGetTextValue;
|
|
95
95
|
getIdRef.current = getId;
|
|
96
96
|
getTextValueRef.current = getTextValue;
|
|
97
97
|
const [orientation] = React.useState(config.orientation || 'vertical');
|
|
@@ -15,7 +15,7 @@ import { useListModel } from './useListModel';
|
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
17
|
export const useListItemRegister = createElemPropsHook(useListModel)(({ state, events }, ref, elemProps = {}) => {
|
|
18
|
-
var _a, _b
|
|
18
|
+
var _a, _b;
|
|
19
19
|
const [localId, setLocalId] = React.useState(elemProps['data-id'] || ((_a = elemProps.item) === null || _a === void 0 ? void 0 : _a.id) || '');
|
|
20
20
|
const { localRef, elementRef } = useLocalRef(useForkRef(ref, (_b = elemProps.virtual) === null || _b === void 0 ? void 0 : _b.measureRef));
|
|
21
21
|
// if the list is virtual, force the correct styling. Without this, weird things happen...
|
|
@@ -65,7 +65,7 @@ export const useListItemRegister = createElemPropsHook(useListModel)(({ state, e
|
|
|
65
65
|
disabled: elemProps.disabled || state.nonInteractiveIds.includes(localId) ? true : undefined,
|
|
66
66
|
item: null,
|
|
67
67
|
virtual: null,
|
|
68
|
-
'aria-setsize':
|
|
68
|
+
'aria-setsize': elemProps.virtual ? state.UNSTABLE_virtual.totalSize : undefined,
|
|
69
69
|
'aria-posinset': elemProps.virtual ? elemProps.item.index + 1 : undefined,
|
|
70
70
|
style,
|
|
71
71
|
id: slugify(`${state.id}-${localId}`),
|
|
@@ -25,7 +25,7 @@ export function useListRenderItems(model, children) {
|
|
|
25
25
|
// about capital letters in attributes. React thinks this will be applied to the DOM
|
|
26
26
|
// element even though we remove it later...
|
|
27
27
|
virtual,
|
|
28
|
-
key: item.id,
|
|
28
|
+
key: item.id || item.index,
|
|
29
29
|
item,
|
|
30
30
|
});
|
|
31
31
|
}
|
|
@@ -35,7 +35,7 @@ export function useListRenderItems(model, children) {
|
|
|
35
35
|
const child = children(item.value, item.index);
|
|
36
36
|
if (React.isValidElement(child)) {
|
|
37
37
|
return React.cloneElement(child, {
|
|
38
|
-
key: item.id,
|
|
38
|
+
key: item.id || item.index,
|
|
39
39
|
item: item.value,
|
|
40
40
|
});
|
|
41
41
|
}
|
|
@@ -2,8 +2,5 @@ export { Combobox } from './lib/Combobox';
|
|
|
2
2
|
export { useComboboxCard } from './lib/ComboboxCard';
|
|
3
3
|
export { useComboboxMenuItem } from './lib/ComboboxMenuItem';
|
|
4
4
|
export { useComboboxMenuList } from './lib/ComboboxMenuList';
|
|
5
|
-
export { useComboboxInput } from './lib/
|
|
6
|
-
export { useComboboxLoader } from './lib/useComboboxLoader';
|
|
7
|
-
export { useComboboxModel } from './lib/useComboboxModel';
|
|
8
|
-
export { useComboboxInputOpenWithArrowKeys as useComboboxOpenWithArrowKeys } from './lib/useComboboxInputOpenWithArrowKeys';
|
|
5
|
+
export { useComboboxLoader, useComboboxModel, useComboboxInputOpenWithArrowKeys, useComboboxKeyboardTypeAhead, useSetPopupWidth, useComboboxMoveCursorToSelected, useComboboxInput, useComboboxListKeyboardHandler, useComboboxResetCursorToSelected, } from './lib/hooks';
|
|
9
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../combobox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../combobox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,iCAAiC,EACjC,4BAA4B,EAC5B,gBAAgB,EAChB,+BAA+B,EAC/B,gBAAgB,EAChB,8BAA8B,EAC9B,gCAAgC,GACjC,MAAM,aAAa,CAAC"}
|
|
@@ -2,7 +2,4 @@ export { Combobox } from './lib/Combobox';
|
|
|
2
2
|
export { useComboboxCard } from './lib/ComboboxCard';
|
|
3
3
|
export { useComboboxMenuItem } from './lib/ComboboxMenuItem';
|
|
4
4
|
export { useComboboxMenuList } from './lib/ComboboxMenuList';
|
|
5
|
-
export { useComboboxInput } from './lib/
|
|
6
|
-
export { useComboboxLoader } from './lib/useComboboxLoader';
|
|
7
|
-
export { useComboboxModel } from './lib/useComboboxModel';
|
|
8
|
-
export { useComboboxInputOpenWithArrowKeys as useComboboxOpenWithArrowKeys } from './lib/useComboboxInputOpenWithArrowKeys';
|
|
5
|
+
export { useComboboxLoader, useComboboxModel, useComboboxInputOpenWithArrowKeys, useComboboxKeyboardTypeAhead, useSetPopupWidth, useComboboxMoveCursorToSelected, useComboboxInput, useComboboxListKeyboardHandler, useComboboxResetCursorToSelected, } from './lib/hooks';
|
|
@@ -6,8 +6,8 @@ export interface ComboboxProps {
|
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
}
|
|
8
8
|
export declare const Combobox: import("@workday/canvas-kit-react/common").ComponentM<ComboboxProps & Partial<{
|
|
9
|
-
mode: "multiple" | "single";
|
|
10
9
|
shouldVirtualize: boolean;
|
|
10
|
+
mode: "multiple" | "single";
|
|
11
11
|
returnFocusRef: React.RefObject<any> | undefined;
|
|
12
12
|
initialFocusRef: React.RefObject<any> | undefined;
|
|
13
13
|
id: string;
|
|
@@ -1766,7 +1766,7 @@ export declare const Combobox: import("@workday/canvas-kit-react/common").Compon
|
|
|
1766
1766
|
navigation: import("../../collection/lib/useCursorListModel").NavigationManager;
|
|
1767
1767
|
getId: (item: any) => string;
|
|
1768
1768
|
}> & {
|
|
1769
|
-
Popper: import("@workday/canvas-kit-react/common").ElementComponentM<"div", import("
|
|
1769
|
+
Popper: import("@workday/canvas-kit-react/common").ElementComponentM<"div", import("../..").PopperProps & React.RefAttributes<HTMLDivElement>, {
|
|
1770
1770
|
state: {
|
|
1771
1771
|
stackRef: React.RefObject<HTMLDivElement>;
|
|
1772
1772
|
targetRef: React.RefObject<HTMLButtonElement>;
|
|
@@ -1991,7 +1991,13 @@ export declare const Combobox: import("@workday/canvas-kit-react/common").Compon
|
|
|
1991
1991
|
selection: import("../../collection/lib/useSelectionListModel").SelectionManager;
|
|
1992
1992
|
navigation: import("../../collection/lib/useCursorListModel").NavigationManager;
|
|
1993
1993
|
getId: (item: any) => string;
|
|
1994
|
-
}
|
|
1994
|
+
}> & {
|
|
1995
|
+
Icon: import("@emotion/styled").StyledComponent<import("../..").SystemIconProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "as" | keyof import("../..").SystemIconProps> & {
|
|
1996
|
+
ref?: React.Ref<HTMLSpanElement> | undefined;
|
|
1997
|
+
} & {
|
|
1998
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
1999
|
+
}, {}, {}>;
|
|
2000
|
+
};
|
|
1995
2001
|
Card: import("@workday/canvas-kit-react/common").ElementComponentM<"div", import("./ComboboxCard").ComboboxCardProps, {
|
|
1996
2002
|
state: {
|
|
1997
2003
|
stackRef: React.RefObject<HTMLDivElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/Combobox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIjB;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEH;;;OAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKL,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { createContainer } from '@workday/canvas-kit-react/common';
|
|
3
|
-
import { useComboboxModel } from './
|
|
3
|
+
import { useComboboxModel } from './hooks';
|
|
4
4
|
import { ComboboxInput } from './ComboboxInput';
|
|
5
5
|
import { ComboboxMenu } from './ComboboxMenu';
|
|
6
6
|
export const Combobox = createContainer()({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { createElemPropsHook, createSubcomponent, } from '@workday/canvas-kit-react/common';
|
|
3
3
|
import { Menu } from '@workday/canvas-kit-react/menu';
|
|
4
|
-
import { useComboboxModel } from './
|
|
4
|
+
import { useComboboxModel } from './hooks';
|
|
5
5
|
/**
|
|
6
6
|
* This hook sets the `minWidth` style attribute to match the width of the
|
|
7
7
|
* {@link ComboboxInput Combobox.Input} component.
|
|
@@ -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"}
|
|
@@ -1,74 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { createSubcomponent } from '@workday/canvas-kit-react/common';
|
|
3
3
|
import { TextInput } from '@workday/canvas-kit-react/text-input';
|
|
4
|
-
import {
|
|
5
|
-
import { useListActiveDescendant, useListKeyboardHandler, } from '@workday/canvas-kit-react/collection';
|
|
6
|
-
import { useComboboxModel } from './useComboboxModel';
|
|
7
|
-
import { useComboboxInputOpenWithArrowKeys } from './useComboboxInputOpenWithArrowKeys';
|
|
8
|
-
/**
|
|
9
|
-
* Adds all attributes necessary to start with a {@link ComboboxInput Combobox.Input}. It opens the
|
|
10
|
-
* menu with arrow keys, uses {@link useListActiveDescendant}, and handles keyboard arrows to
|
|
11
|
-
* navigate items of the menu. You may also compose this hook to add more specific behaviors for
|
|
12
|
-
* your {@link ComboboxInput Combobox.Input}.
|
|
13
|
-
*/
|
|
14
|
-
export const useComboboxInput = composeHooks(createElemPropsHook(useComboboxModel)((model, ref) => {
|
|
15
|
-
const elementRef = useForkRef(ref, model.state.inputRef);
|
|
16
|
-
React.useEffect(() => {
|
|
17
|
-
var _a;
|
|
18
|
-
if (model.state.cursorId && model.state.visibility === 'visible') {
|
|
19
|
-
const item = model.navigation.getItem(model.state.cursorId, model);
|
|
20
|
-
if (model.state.isVirtualized && item) {
|
|
21
|
-
model.state.UNSTABLE_virtual.scrollToIndex(item.index);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
const listboxId = (_a = model.state.inputRef.current) === null || _a === void 0 ? void 0 : _a.getAttribute('aria-controls');
|
|
25
|
-
if (listboxId) {
|
|
26
|
-
const menuItem = document.querySelector(`[id="${listboxId}"] [data-id="${model.state.cursorId}"]`);
|
|
27
|
-
if (menuItem) {
|
|
28
|
-
menuItem.scrollIntoView({ block: 'nearest' });
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
// we only want to run this effect if the cursor changes and not any other time
|
|
34
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
-
}, [model.state.cursorId]);
|
|
36
|
-
return {
|
|
37
|
-
onKeyDown(event) {
|
|
38
|
-
if (event.key === 'Escape') {
|
|
39
|
-
dispatchInputEvent(event.currentTarget, '');
|
|
40
|
-
}
|
|
41
|
-
if (event.key === 'Enter' && !event.metaKey && model.state.visibility === 'visible') {
|
|
42
|
-
const element = document.querySelector(`[data-id="${model.state.cursorId}"]`);
|
|
43
|
-
if (element && (element === null || element === void 0 ? void 0 : element.getAttribute('aria-disabled')) !== 'true') {
|
|
44
|
-
model.events.select({ id: model.state.cursorId });
|
|
45
|
-
if (model.state.mode === 'single') {
|
|
46
|
-
model.events.hide(event);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
// We don't want to submit forms while the combobox is open
|
|
50
|
-
event.preventDefault();
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
onBlur(event) {
|
|
54
|
-
model.events.hide(event);
|
|
55
|
-
},
|
|
56
|
-
onChange: model.onChange,
|
|
57
|
-
onClick(event) {
|
|
58
|
-
if (model.state.visibility === 'hidden') {
|
|
59
|
-
model.events.setWidth(event.currentTarget.clientWidth);
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
value: model.state.value,
|
|
63
|
-
role: 'combobox',
|
|
64
|
-
'aria-haspopup': true,
|
|
65
|
-
'aria-expanded': model.state.visibility === 'visible',
|
|
66
|
-
'aria-autocomplete': 'list',
|
|
67
|
-
'aria-controls': `${model.state.id}-list`,
|
|
68
|
-
id: model.state.id,
|
|
69
|
-
ref: elementRef,
|
|
70
|
-
};
|
|
71
|
-
}), useComboboxInputOpenWithArrowKeys, useListActiveDescendant, useListKeyboardHandler, usePopupTarget);
|
|
4
|
+
import { useComboboxModel, useComboboxInput } from './hooks';
|
|
72
5
|
export const ComboboxInput = createSubcomponent(TextInput)({
|
|
73
6
|
modelHook: useComboboxModel,
|
|
74
7
|
elemPropsHook: useComboboxInput,
|
|
@@ -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"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { createSubcomponent } from '@workday/canvas-kit-react/common';
|
|
3
3
|
import { Menu } from '@workday/canvas-kit-react/menu';
|
|
4
|
-
import { useComboboxModel } from './
|
|
4
|
+
import { useComboboxModel } from './hooks';
|
|
5
5
|
import { ComboboxMenuList } from './ComboboxMenuList';
|
|
6
6
|
import { ComboboxMenuItem } from './ComboboxMenuItem';
|
|
7
7
|
import { ComboboxCard } from './ComboboxCard';
|
|
8
|
+
import { ComboboxMenuPopper } from './ComboboxPopper';
|
|
8
9
|
export const ComboboxMenu = createSubcomponent()({
|
|
9
10
|
modelHook: useComboboxModel,
|
|
10
11
|
subComponents: {
|
|
@@ -13,9 +14,9 @@ export const ComboboxMenu = createSubcomponent()({
|
|
|
13
14
|
* {@link ComboboxInput Combobox.Input}. It renders a `div` element that is portalled to the
|
|
14
15
|
* `document.body` which is controlled by the {@link PopupStack}. The `PopupStack` is not part
|
|
15
16
|
* of React. This means no extra props given to this component will be forwarded to the `div`
|
|
16
|
-
* element, but the `ref` will be forwarded.
|
|
17
|
+
* element, but the `ref` will be forwarded. Also fallback placements for the popper with be either `top` or `bottom`.
|
|
17
18
|
*/
|
|
18
|
-
Popper:
|
|
19
|
+
Popper: ComboboxMenuPopper,
|
|
19
20
|
/**
|
|
20
21
|
* The combobox menu list follows the Collections API. A list can either contain static items or
|
|
21
22
|
* 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"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { composeHooks, createElemPropsHook, createSubcomponent, } from '@workday/canvas-kit-react/common';
|
|
2
|
+
import { composeHooks, createElemPropsHook, createSubcomponent, styled, } from '@workday/canvas-kit-react/common';
|
|
3
3
|
import { StyledMenuItem, useMenuModel } from '@workday/canvas-kit-react/menu';
|
|
4
|
+
import { SystemIcon } from '@workday/canvas-kit-react/icon';
|
|
4
5
|
import { useListItemAllowChildStrings, useListItemRegister, } from '@workday/canvas-kit-react/collection';
|
|
5
6
|
import { OverflowTooltip } from '@workday/canvas-kit-react/tooltip';
|
|
6
|
-
import { useComboboxModel } from './
|
|
7
|
+
import { useComboboxModel } from './hooks';
|
|
7
8
|
/**
|
|
8
9
|
* This hook sets up accessibility and behavior of a {@link ComboboxMenuItem Combobox.Menu.Item}
|
|
9
10
|
* component. It prevents focus when clicking so the focus stays on the
|
|
@@ -11,13 +12,9 @@ import { useComboboxModel } from './useComboboxModel';
|
|
|
11
12
|
* also prevents items with an `aria-disabled` attribute from being selected. A `focus` CSS class is
|
|
12
13
|
* added when the item has "focus" (when the cursor is on the item).
|
|
13
14
|
*/
|
|
14
|
-
export const useComboboxMenuItem = composeHooks(createElemPropsHook(useMenuModel)((model,
|
|
15
|
+
export const useComboboxMenuItem = composeHooks(createElemPropsHook(useMenuModel)((model, ref, elemProps = {}) => {
|
|
15
16
|
const id = elemProps['data-id'] || '';
|
|
16
17
|
const onMouseDown = (event) => {
|
|
17
|
-
if (model.state.nonInteractiveIds.includes(id) ||
|
|
18
|
-
event.currentTarget.hasAttribute('aria-disabled')) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
18
|
if (event.currentTarget.getAttribute('aria-disabled') !== 'true') {
|
|
22
19
|
model.events.select({ id });
|
|
23
20
|
if (model.state.mode === 'single') {
|
|
@@ -38,6 +35,9 @@ export const useComboboxMenuItem = composeHooks(createElemPropsHook(useMenuModel
|
|
|
38
35
|
export const ComboboxMenuItem = createSubcomponent('li')({
|
|
39
36
|
modelHook: useComboboxModel,
|
|
40
37
|
elemPropsHook: useComboboxMenuItem,
|
|
38
|
+
subComponents: {
|
|
39
|
+
Icon: styled(SystemIcon)({ alignSelf: 'start' }),
|
|
40
|
+
},
|
|
41
41
|
})(({ children, ...elemProps }, Element) => {
|
|
42
42
|
return (React.createElement(OverflowTooltip, { placement: "left" },
|
|
43
43
|
React.createElement(StyledMenuItem, Object.assign({ minHeight: "xl", as: Element }, elemProps), children)));
|
|
@@ -3,7 +3,7 @@ import { commonColors } from '@workday/canvas-kit-react/tokens';
|
|
|
3
3
|
import { createElemPropsHook, createSubcomponent } from '@workday/canvas-kit-react/common';
|
|
4
4
|
import { useMenuModel } from '@workday/canvas-kit-react/menu';
|
|
5
5
|
import { ListBox } from '@workday/canvas-kit-react/collection';
|
|
6
|
-
import { useComboboxModel } from './
|
|
6
|
+
import { useComboboxModel } from './hooks';
|
|
7
7
|
/**
|
|
8
8
|
* The `listbox` uses `aria-labelledby` pointing to the {@link ComboboxInput Combobox.Input}. This
|
|
9
9
|
* input should be labelled by a form field label for proper accessibility. Use {@link FormField} to
|