@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,29 @@
|
|
|
1
|
+
import { createModelHook } from '@workday/canvas-kit-react/common';
|
|
2
|
+
import { useComboboxModel } from '@workday/canvas-kit-react/combobox';
|
|
3
|
+
/**
|
|
4
|
+
* `SelectModel` extends the {@link ComboboxModel}. Selecting items from
|
|
5
|
+
* the menu will dispatch an
|
|
6
|
+
* [input](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event) event on the
|
|
7
|
+
* input which should work with form libraries, automation and autofill.
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* const model = useSelectModel({items: ['Mobile', 'Phone', 'E-Mail']})
|
|
11
|
+
*
|
|
12
|
+
* <Select model={model}>
|
|
13
|
+
* ...
|
|
14
|
+
* </Select>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export const useSelectModel = createModelHook({
|
|
18
|
+
defaultConfig: {
|
|
19
|
+
...useComboboxModel.defaultConfig,
|
|
20
|
+
shouldVirtualize: false,
|
|
21
|
+
},
|
|
22
|
+
requiredConfig: {
|
|
23
|
+
...useComboboxModel.requiredConfig,
|
|
24
|
+
},
|
|
25
|
+
contextOverride: useComboboxModel.Context,
|
|
26
|
+
})(config => {
|
|
27
|
+
const model = useComboboxModel(config);
|
|
28
|
+
return model;
|
|
29
|
+
});
|
|
@@ -83,7 +83,7 @@ const FormFieldFieldsetContainer = styled('fieldset')<
|
|
|
83
83
|
}));
|
|
84
84
|
|
|
85
85
|
const FormFieldContainer = styled('div')<FormFieldLabelPositionBehavior & FormFieldProps>(
|
|
86
|
-
({labelPosition, useFieldset}) => {
|
|
86
|
+
({labelPosition, useFieldset, grow}) => {
|
|
87
87
|
if (useFieldset) {
|
|
88
88
|
return {
|
|
89
89
|
display: 'flex',
|
|
@@ -100,6 +100,7 @@ const FormFieldContainer = styled('div')<FormFieldLabelPositionBehavior & FormFi
|
|
|
100
100
|
return {
|
|
101
101
|
display: 'block',
|
|
102
102
|
marginBottom: space.m,
|
|
103
|
+
width: grow ? '100%' : 'inherit',
|
|
103
104
|
};
|
|
104
105
|
}
|
|
105
106
|
);
|
|
@@ -231,7 +232,12 @@ export class FormField extends React.Component<React.PropsWithChildren<FormField
|
|
|
231
232
|
);
|
|
232
233
|
} else {
|
|
233
234
|
return (
|
|
234
|
-
<FormFieldContainer
|
|
235
|
+
<FormFieldContainer
|
|
236
|
+
useFieldset={useFieldset}
|
|
237
|
+
labelPosition={labelPosition}
|
|
238
|
+
grow={grow}
|
|
239
|
+
{...elemProps}
|
|
240
|
+
>
|
|
235
241
|
{field}
|
|
236
242
|
</FormFieldContainer>
|
|
237
243
|
);
|
package/menu/lib/MenuPopper.tsx
CHANGED
|
@@ -15,7 +15,20 @@ export const MenuPopper = createSubcomponent('div')({
|
|
|
15
15
|
elemPropsHook: useMenuPopper,
|
|
16
16
|
})<MenuPopperProps>(({children, ...elemProps}) => {
|
|
17
17
|
return (
|
|
18
|
-
<Popper
|
|
18
|
+
<Popper
|
|
19
|
+
placement="bottom-start"
|
|
20
|
+
popperOptions={{
|
|
21
|
+
modifiers: [
|
|
22
|
+
{
|
|
23
|
+
name: 'offset',
|
|
24
|
+
options: {
|
|
25
|
+
offset: () => [0, 4],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
}}
|
|
30
|
+
{...elemProps}
|
|
31
|
+
>
|
|
19
32
|
{children}
|
|
20
33
|
</Popper>
|
|
21
34
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-react",
|
|
3
|
-
"version": "10.0.0-alpha.
|
|
3
|
+
"version": "10.0.0-alpha.546-next.0",
|
|
4
4
|
"description": "The parent module that contains all Workday Canvas Kit React components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"@emotion/styled": "^11.6.0",
|
|
50
50
|
"@popperjs/core": "^2.5.4",
|
|
51
51
|
"@workday/canvas-colors-web": "^2.0.0",
|
|
52
|
-
"@workday/canvas-kit-popup-stack": "^10.0.0-alpha.
|
|
53
|
-
"@workday/canvas-kit-styling": "^10.0.0-alpha.
|
|
52
|
+
"@workday/canvas-kit-popup-stack": "^10.0.0-alpha.546-next.0",
|
|
53
|
+
"@workday/canvas-kit-styling": "^10.0.0-alpha.546-next.0",
|
|
54
54
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
55
55
|
"@workday/canvas-tokens-web": "0.1.6",
|
|
56
56
|
"@workday/design-assets-types": "^0.2.8",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"@workday/canvas-accent-icons-web": "^3.0.0",
|
|
69
69
|
"@workday/canvas-applet-icons-web": "^2.0.0"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "b7ac77e6032a2cf160d0dcad7bd6b8231c3d9e49"
|
|
72
72
|
}
|
package/popup/lib/Popper.tsx
CHANGED
|
@@ -31,5 +31,21 @@ export const PopupPopper = createSubcomponent('div')({
|
|
|
31
31
|
modelHook: usePopupModel,
|
|
32
32
|
elemPropsHook: usePopupPopper,
|
|
33
33
|
})<PopupPopperProps>(({children, ...elemProps}) => {
|
|
34
|
-
return
|
|
34
|
+
return (
|
|
35
|
+
<Popper
|
|
36
|
+
popperOptions={{
|
|
37
|
+
modifiers: [
|
|
38
|
+
{
|
|
39
|
+
name: 'offset',
|
|
40
|
+
options: {
|
|
41
|
+
offset: () => [0, 4],
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
}}
|
|
46
|
+
{...elemProps}
|
|
47
|
+
>
|
|
48
|
+
{children}
|
|
49
|
+
</Popper>
|
|
50
|
+
);
|
|
35
51
|
});
|
package/select/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './lib/Select';
|
|
2
|
-
export * from './lib/
|
|
2
|
+
export * from './lib/hooks';
|
package/select/lib/Select.tsx
CHANGED
|
@@ -1,129 +1,193 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
ErrorType,
|
|
7
|
-
errorRing,
|
|
8
|
-
styled,
|
|
3
|
+
createSubcomponent,
|
|
4
|
+
ExtractProps,
|
|
5
|
+
createContainer,
|
|
9
6
|
Themeable,
|
|
10
7
|
} from '@workday/canvas-kit-react/common';
|
|
11
|
-
import {
|
|
12
|
-
|
|
8
|
+
import {Combobox} from '@workday/canvas-kit-react/combobox';
|
|
9
|
+
|
|
10
|
+
import {InputGroup, TextInput} from '@workday/canvas-kit-react/text-input';
|
|
13
11
|
import {SystemIcon} from '@workday/canvas-kit-react/icon';
|
|
14
|
-
import {
|
|
12
|
+
import {caretDownSmallIcon} from '@workday/canvas-system-icons-web';
|
|
13
|
+
import {useSelectModel, useSelectCard} from './hooks';
|
|
14
|
+
import {useSelectInput} from './hooks/useSelectInput';
|
|
15
|
+
import {CanvasSystemIcon} from '@workday/design-assets-types';
|
|
15
16
|
|
|
16
|
-
export interface
|
|
17
|
-
/**
|
|
18
|
-
* The SelectOption children of the Select (must be at least two).
|
|
19
|
-
*/
|
|
20
|
-
children: React.ReactElement<SelectOption> | React.ReactElement<SelectOption>[];
|
|
21
|
-
/**
|
|
22
|
-
* If true, set the Select to the disabled state.
|
|
23
|
-
* @default false
|
|
24
|
-
*/
|
|
25
|
-
disabled?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* The type of error associated with the Select (if applicable).
|
|
28
|
-
*/
|
|
29
|
-
error?: ErrorType;
|
|
17
|
+
export interface SelectInputProps extends ExtractProps<typeof TextInput> {
|
|
30
18
|
/**
|
|
31
|
-
* The
|
|
19
|
+
* The Icon to render at the start of the `input`. Use this prop if your options
|
|
20
|
+
* include icons that you would like to render in the `input` when selected.
|
|
21
|
+
* ** Note:An option must be selected in order to render and icon.**
|
|
32
22
|
*/
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* The value of the Select.
|
|
36
|
-
*/
|
|
37
|
-
value?: string;
|
|
23
|
+
inputStartIcon?: CanvasSystemIcon;
|
|
38
24
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
boxShadow: `inset 0 0 0 1px ${inputColors.focusBorder}`,
|
|
64
|
-
outline: 'none',
|
|
65
|
-
},
|
|
66
|
-
'&:disabled': {
|
|
67
|
-
backgroundColor: inputColors.disabled.background,
|
|
68
|
-
borderColor: inputColors.disabled.border,
|
|
69
|
-
color: inputColors.disabled.text,
|
|
70
|
-
'&::placeholder': {
|
|
71
|
-
color: inputColors.disabled.text,
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
({error}) => ({
|
|
76
|
-
...errorRing(error),
|
|
77
|
-
}),
|
|
78
|
-
({grow}) =>
|
|
79
|
-
grow && {
|
|
80
|
-
width: '100%',
|
|
81
|
-
}
|
|
25
|
+
export const SelectInput = createSubcomponent(TextInput)({
|
|
26
|
+
modelHook: useSelectModel,
|
|
27
|
+
elemPropsHook: useSelectInput,
|
|
28
|
+
})<SelectInputProps>(
|
|
29
|
+
({placeholder = 'Choose an option', inputStartIcon, ...elemProps}, Element, model) => {
|
|
30
|
+
return (
|
|
31
|
+
<InputGroup>
|
|
32
|
+
{inputStartIcon && model.state.selectedIds.length > 0 && (
|
|
33
|
+
<InputGroup.InnerStart pointerEvents="none">
|
|
34
|
+
<SystemIcon icon={inputStartIcon} />
|
|
35
|
+
</InputGroup.InnerStart>
|
|
36
|
+
)}
|
|
37
|
+
<InputGroup.Input
|
|
38
|
+
as={Element}
|
|
39
|
+
placeholder={placeholder}
|
|
40
|
+
style={{caretColor: 'transparent', cursor: 'default'}}
|
|
41
|
+
{...elemProps}
|
|
42
|
+
></InputGroup.Input>
|
|
43
|
+
<InputGroup.InnerEnd position="absolute" pointerEvents="none">
|
|
44
|
+
<SystemIcon icon={caretDownSmallIcon} />
|
|
45
|
+
</InputGroup.InnerEnd>
|
|
46
|
+
</InputGroup>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
82
49
|
);
|
|
83
50
|
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
padding: space.xxxs,
|
|
89
|
-
pointerEvents: 'none',
|
|
90
|
-
'& path': {
|
|
91
|
-
transition: '100ms fill',
|
|
51
|
+
export const SelectItem = createSubcomponent('li')({
|
|
52
|
+
modelHook: useSelectModel,
|
|
53
|
+
subComponents: {
|
|
54
|
+
Icon: Combobox.Menu.Item.Icon,
|
|
92
55
|
},
|
|
56
|
+
})<ExtractProps<typeof Combobox.Menu.Item>>(({children, ...elemProps}, Element, _model) => {
|
|
57
|
+
return (
|
|
58
|
+
<Combobox.Menu.Item role="option" as={Element} {...elemProps}>
|
|
59
|
+
{children}
|
|
60
|
+
</Combobox.Menu.Item>
|
|
61
|
+
);
|
|
93
62
|
});
|
|
94
63
|
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
},
|
|
106
|
-
'&:hover path': {
|
|
107
|
-
fill: disabled ? undefined : colors.licorice500,
|
|
108
|
-
},
|
|
109
|
-
})
|
|
110
|
-
);
|
|
64
|
+
export const SelectCard = createSubcomponent('div')({
|
|
65
|
+
modelHook: useSelectModel,
|
|
66
|
+
elemPropsHook: useSelectCard,
|
|
67
|
+
})<ExtractProps<typeof Combobox.Menu.Card>>(({children, ...elemProps}, Element) => {
|
|
68
|
+
return (
|
|
69
|
+
<Combobox.Menu.Card maxHeight={300} as={Element} {...elemProps}>
|
|
70
|
+
{children}
|
|
71
|
+
</Combobox.Menu.Card>
|
|
72
|
+
);
|
|
73
|
+
});
|
|
111
74
|
|
|
112
|
-
export
|
|
75
|
+
export interface SelectProps extends Themeable, ExtractProps<typeof Combobox> {}
|
|
76
|
+
/**
|
|
77
|
+
* Use `Select` to allow users to choose an option from a list or type characters to select a matching option.
|
|
78
|
+
*
|
|
79
|
+
* **Note: `Select` must wrap `FormField` and `FormField` must wrap all `Select` children to ensure proper accessibility. **
|
|
80
|
+
*
|
|
81
|
+
* ```tsx
|
|
82
|
+
* <Select items={options}>
|
|
83
|
+
* <FormField label="Your Label">
|
|
84
|
+
* <Select.Input onChange={e => handleChange(e)} id="contact-select" />
|
|
85
|
+
* <Select.Popper>
|
|
86
|
+
* <Select.Card>
|
|
87
|
+
* <Select.List>
|
|
88
|
+
* {item => <Select.Item>{item.id}</Select.Item>}
|
|
89
|
+
* </Select.List>
|
|
90
|
+
* </Select.Card>
|
|
91
|
+
* </Select.Popper>
|
|
92
|
+
* </FormField>
|
|
93
|
+
* </Select>
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export const Select = createContainer()({
|
|
113
97
|
displayName: 'Select',
|
|
114
|
-
|
|
115
|
-
<SelectWrapper grow={grow} disabled={disabled}>
|
|
116
|
-
<StyledSelect as={Element} disabled={disabled} grow={grow} ref={ref} {...elemProps}>
|
|
117
|
-
{children}
|
|
118
|
-
</StyledSelect>
|
|
119
|
-
<SelectDropdownIcon
|
|
120
|
-
icon={caretDownSmallIcon}
|
|
121
|
-
color={disabled ? colors.licorice100 : colors.licorice200}
|
|
122
|
-
colorHover={disabled ? colors.licorice100 : colors.licorice500}
|
|
123
|
-
/>
|
|
124
|
-
</SelectWrapper>
|
|
125
|
-
),
|
|
98
|
+
modelHook: useSelectModel,
|
|
126
99
|
subComponents: {
|
|
127
|
-
|
|
100
|
+
/**
|
|
101
|
+
* `Select.Input` renders a {@link ComboboxMenu Combobox.Input} that handles keyboard navigation and interaction defined by [WAI](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/).
|
|
102
|
+
* This component can either be [controlled or uncontrolled](https://react.dev/learn/sharing-state-between-components#controlled-and-uncontrolled-components).
|
|
103
|
+
*
|
|
104
|
+
* ```tsx
|
|
105
|
+
* <Select items={options}>
|
|
106
|
+
* <FormField label="Contact">
|
|
107
|
+
* <Select.Input onChange={(event) => handleChange(event)}>
|
|
108
|
+
* ...
|
|
109
|
+
* </FormField>
|
|
110
|
+
* </Select>
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
Input: SelectInput,
|
|
114
|
+
/**
|
|
115
|
+
* `Select.Popper` renders a {@link ComboboxPopper Combobox.Menu.Popper}. You have access to all `Popper` props.
|
|
116
|
+
*
|
|
117
|
+
* ```tsx
|
|
118
|
+
* <Select item={options}>
|
|
119
|
+
* <FormField label="Your Label">
|
|
120
|
+
* <Select.Input onChange={(event) => handleChange(event)}>
|
|
121
|
+
* <Select.Popper>
|
|
122
|
+
* ...
|
|
123
|
+
* </Select.Popper>
|
|
124
|
+
* </FormField>
|
|
125
|
+
* </Select>
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
Popper: Combobox.Menu.Popper,
|
|
129
|
+
/**
|
|
130
|
+
* `Select.Card` renders a {@link ComboboxCard Combobox.Card}. You have access to all `Card` props.
|
|
131
|
+
*
|
|
132
|
+
* **Note: The card will be the width of its corresponding `Select.Input`**.
|
|
133
|
+
*
|
|
134
|
+
* ```tsx
|
|
135
|
+
* <Select item={options}>
|
|
136
|
+
* <FormField label="Your Label">
|
|
137
|
+
* <Select.Input onChange={(event) => handleChange(event)}>
|
|
138
|
+
* <Select.Popper>
|
|
139
|
+
* <Select.Card>
|
|
140
|
+
* ...
|
|
141
|
+
* </Select.Card>
|
|
142
|
+
* </Select.Popper>
|
|
143
|
+
* </FormField>
|
|
144
|
+
* </Select>
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
Card: SelectCard,
|
|
148
|
+
/**
|
|
149
|
+
* `Select.List` renders a {@link ComboboxMenuList Combobox.Menu.List}. You have access to all `ListBox` props.
|
|
150
|
+
*
|
|
151
|
+
* ```tsx
|
|
152
|
+
* <Select item={options}>
|
|
153
|
+
* <FormField label="Your Label">
|
|
154
|
+
* <Select.Input onChange={(event) => handleChange(event)}>
|
|
155
|
+
* <Select.Popper>
|
|
156
|
+
* <Select.Card>
|
|
157
|
+
* <Select.List>
|
|
158
|
+
* {(item) => <Select.Item>{item}</Select.Item>}
|
|
159
|
+
* </Select.List
|
|
160
|
+
* </Select.Card>
|
|
161
|
+
* </Select.Popper>
|
|
162
|
+
* </FormField>
|
|
163
|
+
* </Select>
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
List: Combobox.Menu.List,
|
|
167
|
+
/**
|
|
168
|
+
* `Select.Item` renders a {@link ComboboxMenuItem Combobox.Menu.Item} with aria role of `option`. You can optionally render a `Icon`.
|
|
169
|
+
*
|
|
170
|
+
* ```tsx
|
|
171
|
+
* <Select item={options}>
|
|
172
|
+
* <FormField label="Your Label">
|
|
173
|
+
* <Select.Input onChange={(event) => handleChange(event)}>
|
|
174
|
+
* <Select.Popper>
|
|
175
|
+
* <Select.Card>
|
|
176
|
+
* <Select.List>
|
|
177
|
+
* {(item) => <Select.Item><Select.Item.Icon icon={icon} />{item}</Select.Item>}
|
|
178
|
+
* </Select.List
|
|
179
|
+
* </Select.Card>
|
|
180
|
+
* </Select.Popper>
|
|
181
|
+
* </FormField>
|
|
182
|
+
* </Select>
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
Item: SelectItem,
|
|
128
186
|
},
|
|
187
|
+
})<SelectProps>(({children, ...elemProps}, _, model) => {
|
|
188
|
+
return (
|
|
189
|
+
<Combobox model={model} {...elemProps}>
|
|
190
|
+
{children}
|
|
191
|
+
</Combobox>
|
|
192
|
+
);
|
|
129
193
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {createElemPropsHook} from '@workday/canvas-kit-react/common';
|
|
2
|
+
import {useSelectModel} from './useSelectModel';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Sets the width of the ` SelectCard` to the `Select.Input` width.
|
|
6
|
+
*/
|
|
7
|
+
export const useSelectCard = createElemPropsHook(useSelectModel)(model => {
|
|
8
|
+
return {
|
|
9
|
+
width: model.state.width,
|
|
10
|
+
} as const;
|
|
11
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
composeHooks,
|
|
4
|
+
createElemPropsHook,
|
|
5
|
+
useForkRef,
|
|
6
|
+
useLocalRef,
|
|
7
|
+
useResizeObserver,
|
|
8
|
+
} from '@workday/canvas-kit-react/common';
|
|
9
|
+
import {
|
|
10
|
+
useComboboxInput,
|
|
11
|
+
useComboboxKeyboardTypeAhead,
|
|
12
|
+
useComboboxMoveCursorToSelected,
|
|
13
|
+
useComboboxResetCursorToSelected,
|
|
14
|
+
} from '@workday/canvas-kit-react/combobox';
|
|
15
|
+
import {useSelectModel} from './useSelectModel';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* `useSelectInput` extends {@link useComboboxInput useComboboxInput} and {@link useComboboxKeyboardTypeAhead useComboboxKeyboardTypeAhead} and adds type ahead functionality and Select-specific [keyboard support](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/).
|
|
19
|
+
*/
|
|
20
|
+
export const useSelectInput = composeHooks(
|
|
21
|
+
createElemPropsHook(useSelectModel)((model, ref, elemProps: {keySofar?: string} = {}) => {
|
|
22
|
+
const {localRef, elementRef} = useLocalRef<HTMLInputElement>(
|
|
23
|
+
useForkRef(ref as React.Ref<HTMLElement>, ref)
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
useResizeObserver({
|
|
27
|
+
ref: localRef,
|
|
28
|
+
onResize: data => {
|
|
29
|
+
if (model.state.visibility === 'visible') {
|
|
30
|
+
// Width of the Input + 2px border + 8px padding
|
|
31
|
+
const calculatedWidth = data.width ? data.width + 42 + 8 : 0;
|
|
32
|
+
model.events.setWidth(calculatedWidth);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
onKeyDown(event: React.KeyboardEvent) {
|
|
39
|
+
// Prevent the keys from being enter in the input
|
|
40
|
+
if (event.key !== 'Tab') {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Select should open if Spacebar is typed and nothing has been typed AND the menu is hidden
|
|
45
|
+
if (
|
|
46
|
+
event.key === 'Spacebar' ||
|
|
47
|
+
(event.key === ' ' && model.state.visibility === 'hidden' && elemProps?.keySofar === '')
|
|
48
|
+
) {
|
|
49
|
+
model.events.show();
|
|
50
|
+
}
|
|
51
|
+
// if the menu is visible
|
|
52
|
+
if (
|
|
53
|
+
(event.key === 'Spacebar' || event.key === ' ') &&
|
|
54
|
+
model.state.visibility === 'visible'
|
|
55
|
+
) {
|
|
56
|
+
// If key so far is empty, they're done typing, select the item where the cursor is located and hide the menu
|
|
57
|
+
if (elemProps?.keySofar === '') {
|
|
58
|
+
model.events.select({
|
|
59
|
+
id: model.state.cursorId,
|
|
60
|
+
});
|
|
61
|
+
model.events.hide();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
ref: elementRef,
|
|
66
|
+
autoComplete: 'off',
|
|
67
|
+
defaultValue: model.state.selectedIds[0] || model.state.value,
|
|
68
|
+
} as const;
|
|
69
|
+
}),
|
|
70
|
+
useComboboxKeyboardTypeAhead,
|
|
71
|
+
useComboboxResetCursorToSelected,
|
|
72
|
+
useComboboxMoveCursorToSelected,
|
|
73
|
+
useComboboxInput
|
|
74
|
+
);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {createModelHook} from '@workday/canvas-kit-react/common';
|
|
2
|
+
import {useComboboxModel} from '@workday/canvas-kit-react/combobox';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `SelectModel` extends the {@link ComboboxModel}. Selecting items from
|
|
6
|
+
* the menu will dispatch an
|
|
7
|
+
* [input](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/input_event) event on the
|
|
8
|
+
* input which should work with form libraries, automation and autofill.
|
|
9
|
+
*
|
|
10
|
+
* ```tsx
|
|
11
|
+
* const model = useSelectModel({items: ['Mobile', 'Phone', 'E-Mail']})
|
|
12
|
+
*
|
|
13
|
+
* <Select model={model}>
|
|
14
|
+
* ...
|
|
15
|
+
* </Select>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export const useSelectModel = createModelHook({
|
|
19
|
+
defaultConfig: {
|
|
20
|
+
...useComboboxModel.defaultConfig,
|
|
21
|
+
shouldVirtualize: false,
|
|
22
|
+
},
|
|
23
|
+
requiredConfig: {
|
|
24
|
+
...useComboboxModel.requiredConfig,
|
|
25
|
+
},
|
|
26
|
+
contextOverride: useComboboxModel.Context,
|
|
27
|
+
})(config => {
|
|
28
|
+
const model = useComboboxModel(config);
|
|
29
|
+
return model;
|
|
30
|
+
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useComboboxInputOpenWithArrowKeys.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/useComboboxInputOpenWithArrowKeys.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAEzB,mBAAmB;EAUtC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useComboboxLoader.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/useComboboxLoader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAC,MAAM,sCAAsC,CAAC;AAuBnE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,iBAAiB,EAAE,OAAO,aAqBtC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useComboboxModel.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/useComboboxModel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;;oBAIN,MAAM,WAAW,CAAC,gBAAgB,CAAC;;sBAAnC,MAAM,WAAW,CAAC,gBAAgB,CAAC;;;;;;;;oBAAnC,MAAM,WAAW,CAAC,gBAAgB,CAAC;;;;;sBAAnC,MAAM,WAAW,CAAC,gBAAgB,CAAC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;;;;;QAHH;;;WAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAHH;;;WAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAHH;;;WAGG;;;;QASH;;WAEG;wBACa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA/DN,MAAM,WAAW,CAAC,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;oBAAnC,MAAM,WAAW,CAAC,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgDnD;;;OAGG;;;IASH;;OAEG;oBACa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAftB;;;WAGG;;;;QASH;;WAEG;wBACa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA/DN,MAAM,WAAW,CAAC,gBAAgB,CAAC;;;;EAqErD,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export interface SelectOptionProps extends React.OptionHTMLAttributes<HTMLOptionElement> {
|
|
3
|
-
/**
|
|
4
|
-
* The value of the SelectOption.
|
|
5
|
-
*/
|
|
6
|
-
value?: string;
|
|
7
|
-
/**
|
|
8
|
-
* The text of the SelectOption label.
|
|
9
|
-
*/
|
|
10
|
-
label?: string;
|
|
11
|
-
/**
|
|
12
|
-
* If true, set the SelectOption to the disabled state.
|
|
13
|
-
* @default false
|
|
14
|
-
*/
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
}
|
|
17
|
-
export declare class SelectOption extends React.Component<SelectOptionProps> {
|
|
18
|
-
render(): JSX.Element;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=SelectOption.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SelectOption.d.ts","sourceRoot":"","sources":["../../../../select/lib/SelectOption.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,MAAM,WAAW,iBAAkB,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACtF;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,qBAAa,YAAa,SAAQ,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC;IAC3D,MAAM;CASd"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useComboboxInputOpenWithArrowKeys.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/useComboboxInputOpenWithArrowKeys.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAEzB,mBAAmB;EAUtC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useComboboxLoader.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/useComboboxLoader.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAC,MAAM,sCAAsC,CAAC;AAuBnE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,iBAAiB,EAAE,OAAO,aAqBtC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useComboboxModel.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/useComboboxModel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;;oBAIN,MAAM,WAAW,CAAC,gBAAgB,CAAC;;sBAAnC,MAAM,WAAW,CAAC,gBAAgB,CAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAHH;;;WAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAHH;;;WAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAHH;;;WAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAHH;;;WAGG;;;;QASH;;WAEG;wBACa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA/DN,MAAM,WAAW,CAAC,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;oBAAnC,MAAM,WAAW,CAAC,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgDnD;;;OAGG;;;IASH;;OAEG;oBACa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAftB;;;WAGG;;;;QASH;;WAEG;wBACa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBA/DN,MAAM,WAAW,CAAC,gBAAgB,CAAC;;;;EAqErD,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
export interface SelectOptionProps extends React.OptionHTMLAttributes<HTMLOptionElement> {
|
|
3
|
-
/**
|
|
4
|
-
* The value of the SelectOption.
|
|
5
|
-
*/
|
|
6
|
-
value?: string;
|
|
7
|
-
/**
|
|
8
|
-
* The text of the SelectOption label.
|
|
9
|
-
*/
|
|
10
|
-
label?: string;
|
|
11
|
-
/**
|
|
12
|
-
* If true, set the SelectOption to the disabled state.
|
|
13
|
-
* @default false
|
|
14
|
-
*/
|
|
15
|
-
disabled?: boolean;
|
|
16
|
-
}
|
|
17
|
-
export declare class SelectOption extends React.Component<SelectOptionProps> {
|
|
18
|
-
render(): JSX.Element;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=SelectOption.d.ts.map
|