@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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @deprecated
|
|
5
|
+
* @deprecated The returned model is now inferred from `createModelHook`
|
|
6
6
|
*/
|
|
7
7
|
export type Model<State, Events extends IEvent> = {
|
|
8
8
|
state: State;
|
|
@@ -64,7 +64,7 @@ type ToCallbackConfig<
|
|
|
64
64
|
* id?: string
|
|
65
65
|
* } & Partial<ToModelConfig<State, Events, typeof eventMap>>
|
|
66
66
|
*
|
|
67
|
-
* @deprecated
|
|
67
|
+
* @deprecated `createModelHook` now infers the config type
|
|
68
68
|
*/
|
|
69
69
|
export type ToModelConfig<
|
|
70
70
|
TState extends Record<string, any>,
|
|
@@ -97,17 +97,19 @@ export type ToModelConfig<
|
|
|
97
97
|
* }
|
|
98
98
|
* })
|
|
99
99
|
*
|
|
100
|
-
* @deprecated
|
|
100
|
+
* @deprecated `createModelHook` uses Template Literal Types to create event map types
|
|
101
101
|
*/
|
|
102
|
-
export const createEventMap =
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
102
|
+
export const createEventMap =
|
|
103
|
+
<TEvents extends IEvent>() =>
|
|
104
|
+
<
|
|
105
|
+
TGuardMap extends Record<string, keyof TEvents>,
|
|
106
|
+
TCallbackMap extends Record<string, keyof TEvents>
|
|
107
|
+
>(
|
|
108
|
+
config: Partial<EventMap<TEvents, TGuardMap, TCallbackMap>>
|
|
109
|
+
): EventMap<TEvents, TGuardMap, TCallbackMap> => {
|
|
110
|
+
// Instruct Typescript that all valid guards and callbacks exist
|
|
111
|
+
return config as EventMap<TEvents, TGuardMap, TCallbackMap>;
|
|
112
|
+
};
|
|
111
113
|
|
|
112
114
|
// small wrapper to get `keyof T` instead of `string | number | symbol`
|
|
113
115
|
const keys = <T extends object>(input: T) => Object.keys(input) as (keyof T)[];
|
|
@@ -131,7 +133,7 @@ const keys = <T extends object>(input: T) => Object.keys(input) as (keyof T)[];
|
|
|
131
133
|
* }
|
|
132
134
|
* }
|
|
133
135
|
* })
|
|
134
|
-
* @deprecated
|
|
136
|
+
* @deprecated Use `createModelHook` instead
|
|
135
137
|
*/
|
|
136
138
|
export const useEventMap = <
|
|
137
139
|
TEvents extends IEvent,
|
|
@@ -207,14 +209,16 @@ type ToEvent<TEvents extends EventCreator> = {
|
|
|
207
209
|
};
|
|
208
210
|
|
|
209
211
|
// use this?
|
|
210
|
-
export const createEvents =
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
212
|
+
export const createEvents =
|
|
213
|
+
<TEvents extends EventCreator>(events: TEvents) =>
|
|
214
|
+
<
|
|
215
|
+
TGuardMap extends Record<string, keyof TEvents>,
|
|
216
|
+
TCallbackMap extends Record<string, keyof TEvents>
|
|
217
|
+
>(
|
|
218
|
+
config?: Partial<EventMap<ToEvent<TEvents>, TGuardMap, TCallbackMap>>
|
|
219
|
+
) => {
|
|
220
|
+
return {events, eventMap: config as EventMap<ToEvent<TEvents>, TGuardMap, TCallbackMap>};
|
|
221
|
+
};
|
|
218
222
|
|
|
219
223
|
/**
|
|
220
224
|
* Special type that will be a placeholder during development. At build time, this generic will be
|
|
@@ -222,8 +226,7 @@ export const createEvents = <TEvents extends EventCreator>(events: TEvents) => <
|
|
|
222
226
|
* explicit type for your configs to preserve the `Generic` symbol, otherwise Typescript will
|
|
223
227
|
* convert to `any`.
|
|
224
228
|
*/
|
|
225
|
-
export type Generic = any
|
|
226
|
-
|
|
229
|
+
export type Generic = any;
|
|
227
230
|
|
|
228
231
|
export type ModelExtras<TDefaultConfig, TRequiredConfig, TState, TEvents, TModel> = {
|
|
229
232
|
/** Default config of the model. Useful when composing models to reused config */
|
|
@@ -245,12 +248,7 @@ export type ModelExtras<TDefaultConfig, TRequiredConfig, TState, TEvents, TModel
|
|
|
245
248
|
* */
|
|
246
249
|
getElemProps: <P extends {}>(
|
|
247
250
|
props: P
|
|
248
|
-
) => Omit<
|
|
249
|
-
P,
|
|
250
|
-
| keyof TDefaultConfig
|
|
251
|
-
| keyof TRequiredConfig
|
|
252
|
-
| keyof ToEventConfig<TState, TEvents>
|
|
253
|
-
>;
|
|
251
|
+
) => Omit<P, keyof TDefaultConfig | keyof TRequiredConfig | keyof ToEventConfig<TState, TEvents>>;
|
|
254
252
|
/**
|
|
255
253
|
* A typed function to merge config when composing models together. Guards and Callbacks haven't
|
|
256
254
|
* been resolved yet. `mergeConfig` is a type-attached function that includes guard and callback
|
|
@@ -277,9 +275,7 @@ export type ModelExtras<TDefaultConfig, TRequiredConfig, TState, TEvents, TModel
|
|
|
277
275
|
*/
|
|
278
276
|
mergeConfig: (
|
|
279
277
|
source: Partial<TDefaultConfig> & TRequiredConfig,
|
|
280
|
-
target: Partial<
|
|
281
|
-
TDefaultConfig & TRequiredConfig & ToEventConfig<TState, TEvents>
|
|
282
|
-
>
|
|
278
|
+
target: Partial<TDefaultConfig & TRequiredConfig & ToEventConfig<TState, TEvents>>
|
|
283
279
|
) => TDefaultConfig & TRequiredConfig & ToEventConfig<TState, TEvents>;
|
|
284
280
|
};
|
|
285
281
|
|
|
@@ -287,16 +283,13 @@ export type ModelExtras<TDefaultConfig, TRequiredConfig, TState, TEvents, TModel
|
|
|
287
283
|
* Generic type for all models. It makes `defaultConfig` have optional keys and adds `getElemProps`
|
|
288
284
|
* statically to the model function.
|
|
289
285
|
*/
|
|
290
|
-
export type ModelFn<
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
> = TModel extends { state: infer TState; events: infer TEvents }
|
|
286
|
+
export type ModelFn<TDefaultConfig, TRequiredConfig, TModel> = TModel extends {
|
|
287
|
+
state: infer TState;
|
|
288
|
+
events: infer TEvents;
|
|
289
|
+
}
|
|
295
290
|
? (<TT_Special_Generic>( // special generic used by post processing to handle generic models
|
|
296
|
-
config?: Partial<TDefaultConfig> &
|
|
297
|
-
|
|
298
|
-
ToEventConfig<TState, TEvents>
|
|
299
|
-
) => TModel ) &
|
|
291
|
+
config?: Partial<TDefaultConfig> & TRequiredConfig & ToEventConfig<TState, TEvents>
|
|
292
|
+
) => TModel) &
|
|
300
293
|
ModelExtras<TDefaultConfig, TRequiredConfig, TState, TEvents, TModel>
|
|
301
294
|
: never;
|
|
302
295
|
|
|
@@ -320,15 +313,13 @@ export type ModelFn<
|
|
|
320
313
|
// contain `state` that are incompatible. More info:
|
|
321
314
|
// https://github.com/damianc/dev-notes/blob/master/typescript/bivariance-hack.md
|
|
322
315
|
export type ToEventConfig<TState, TEvents extends Record<string, any>> = {
|
|
323
|
-
[K in keyof TEvents as `on${Capitalize<string & K>}`]?: {
|
|
324
|
-
data: Parameters<TEvents[K]>[0],
|
|
325
|
-
|
|
326
|
-
): void}['bivarianceHack'];
|
|
316
|
+
[K in keyof TEvents as `on${Capitalize<string & K>}`]?: {
|
|
317
|
+
bivarianceHack(data: Parameters<TEvents[K]>[0], prevState: TState): void;
|
|
318
|
+
}['bivarianceHack'];
|
|
327
319
|
} & {
|
|
328
|
-
[K in keyof TEvents as `should${Capitalize<string & K>}`]?: {
|
|
329
|
-
data: Parameters<TEvents[K]>[0],
|
|
330
|
-
|
|
331
|
-
): boolean}['bivarianceHack'];
|
|
320
|
+
[K in keyof TEvents as `should${Capitalize<string & K>}`]?: {
|
|
321
|
+
bivarianceHack(data: Parameters<TEvents[K]>[0], state: TState): boolean;
|
|
322
|
+
}['bivarianceHack'];
|
|
332
323
|
};
|
|
333
324
|
|
|
334
325
|
function capitalize(string: string) {
|
|
@@ -349,12 +340,12 @@ function mergeConfig<TConfig extends Record<string, any>>(
|
|
|
349
340
|
sourceConfig: Partial<TConfig>,
|
|
350
341
|
newConfig: Partial<TConfig>
|
|
351
342
|
): TConfig {
|
|
352
|
-
const result = {
|
|
343
|
+
const result = {...sourceConfig} as TConfig;
|
|
353
344
|
for (const key in newConfig) {
|
|
354
345
|
if (
|
|
355
|
-
typeof newConfig[key] ===
|
|
346
|
+
typeof newConfig[key] === 'function' &&
|
|
356
347
|
/(on)[A-Z]/.test(key) &&
|
|
357
|
-
typeof sourceConfig[key] ===
|
|
348
|
+
typeof sourceConfig[key] === 'function'
|
|
358
349
|
) {
|
|
359
350
|
// merge callbacks and ignore Typescript's errors. We've already tested call signatures
|
|
360
351
|
// @ts-ignore
|
|
@@ -364,11 +355,7 @@ function mergeConfig<TConfig extends Record<string, any>>(
|
|
|
364
355
|
// @ts-ignore
|
|
365
356
|
newConfig[key](data, state);
|
|
366
357
|
};
|
|
367
|
-
} else if (
|
|
368
|
-
newConfig[key] &&
|
|
369
|
-
/(should)[A-Z]/.test(key) &&
|
|
370
|
-
sourceConfig[key]
|
|
371
|
-
) {
|
|
358
|
+
} else if (newConfig[key] && /(should)[A-Z]/.test(key) && sourceConfig[key]) {
|
|
372
359
|
// merge guards and ignore Typescript's errors. We've already tested call signatures
|
|
373
360
|
// @ts-ignore
|
|
374
361
|
result[key] = (data: any, state: any) => {
|
|
@@ -377,14 +364,16 @@ function mergeConfig<TConfig extends Record<string, any>>(
|
|
|
377
364
|
};
|
|
378
365
|
} else {
|
|
379
366
|
// @ts-ignore
|
|
380
|
-
result[key] = newConfig[key]
|
|
367
|
+
result[key] = newConfig[key];
|
|
381
368
|
}
|
|
382
369
|
}
|
|
383
370
|
|
|
384
371
|
return result;
|
|
385
372
|
}
|
|
386
373
|
|
|
387
|
-
export type ExtractModelConfig<T extends (config: any) => any> = T extends (config: infer P) => any
|
|
374
|
+
export type ExtractModelConfig<T extends (config: any) => any> = T extends (config: infer P) => any
|
|
375
|
+
? Required<P>
|
|
376
|
+
: {};
|
|
388
377
|
|
|
389
378
|
export type ModelConfig<TDefaultConfig, TRequiredConfig> = {
|
|
390
379
|
/**
|
|
@@ -465,7 +454,7 @@ export type ModelConfig<TDefaultConfig, TRequiredConfig> = {
|
|
|
465
454
|
* model.state.value // `string`
|
|
466
455
|
* })
|
|
467
456
|
*/
|
|
468
|
-
contextOverride?: React.Context<any
|
|
457
|
+
contextOverride?: React.Context<any>;
|
|
469
458
|
};
|
|
470
459
|
|
|
471
460
|
/**
|
|
@@ -494,15 +483,15 @@ export type ModelConfig<TDefaultConfig, TRequiredConfig> = {
|
|
|
494
483
|
export const createModelHook = <TDefaultConfig extends {}, TRequiredConfig extends {}>(
|
|
495
484
|
options: ModelConfig<TDefaultConfig, TRequiredConfig>
|
|
496
485
|
) => {
|
|
497
|
-
const {
|
|
498
|
-
options;
|
|
486
|
+
const {defaultConfig = {}, requiredConfig = {}, defaultContext, contextOverride} = options;
|
|
499
487
|
|
|
500
488
|
// create a bunch of refs so we can define the `wrappedModel` function once.
|
|
501
|
-
const fnRef: {
|
|
489
|
+
const fnRef: {current: any} = {current: null};
|
|
502
490
|
|
|
503
|
-
const callbacksRef: {
|
|
504
|
-
const guardsRef: {
|
|
505
|
-
const Context =
|
|
491
|
+
const callbacksRef: {current: string[]} = {current: []};
|
|
492
|
+
const guardsRef: {current: string[]} = {current: []};
|
|
493
|
+
const Context =
|
|
494
|
+
contextOverride || React.createContext<any>(defaultContext || {state: {}, events: {}});
|
|
506
495
|
|
|
507
496
|
const getElemProps = (props: object) => {
|
|
508
497
|
// if (eventsRef.current === null) {
|
|
@@ -514,9 +503,10 @@ export const createModelHook = <TDefaultConfig extends {}, TRequiredConfig exten
|
|
|
514
503
|
for (const key in props) {
|
|
515
504
|
if (
|
|
516
505
|
(!defaultConfig.hasOwnProperty(key) &&
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
506
|
+
!requiredConfig.hasOwnProperty(key) &&
|
|
507
|
+
!callbacksRef.current.includes(key) &&
|
|
508
|
+
!guardsRef.current.includes(key)) ||
|
|
509
|
+
key === 'id'
|
|
520
510
|
) {
|
|
521
511
|
// @ts-ignore Typescript complains about index signatures and this type is never exposed in definitions, so suppress the error
|
|
522
512
|
elemProps[key] = props[key];
|
|
@@ -529,11 +519,11 @@ export const createModelHook = <TDefaultConfig extends {}, TRequiredConfig exten
|
|
|
529
519
|
// we use `any` here because we don't know what the type is here and it is internal. No use
|
|
530
520
|
// slowing down Typescript to bother type checking
|
|
531
521
|
function wrappedModelHook(config: Record<string, any>) {
|
|
532
|
-
const stateRef = React.useRef<Record<string, any>>({})
|
|
533
|
-
const configRef = React.useRef<Record<string, any>>({})
|
|
534
|
-
const eventsRef = React.useRef<Record<string, any>>({})
|
|
522
|
+
const stateRef = React.useRef<Record<string, any>>({});
|
|
523
|
+
const configRef = React.useRef<Record<string, any>>({});
|
|
524
|
+
const eventsRef = React.useRef<Record<string, any>>({});
|
|
535
525
|
|
|
536
|
-
const {
|
|
526
|
+
const {state, events, ...rest} = fnRef.current({
|
|
537
527
|
...defaultConfig,
|
|
538
528
|
...config,
|
|
539
529
|
});
|
|
@@ -558,10 +548,7 @@ export const createModelHook = <TDefaultConfig extends {}, TRequiredConfig exten
|
|
|
558
548
|
|
|
559
549
|
if (
|
|
560
550
|
configRef.current[guardFnName] &&
|
|
561
|
-
!configRef.current[guardFnName](
|
|
562
|
-
data,
|
|
563
|
-
stateRef.current,
|
|
564
|
-
)
|
|
551
|
+
!configRef.current[guardFnName](data, stateRef.current)
|
|
565
552
|
) {
|
|
566
553
|
return;
|
|
567
554
|
}
|
|
@@ -572,12 +559,8 @@ export const createModelHook = <TDefaultConfig extends {}, TRequiredConfig exten
|
|
|
572
559
|
|
|
573
560
|
const callbackFnName = getCallbackName(key);
|
|
574
561
|
if (!(eventsRef.current[key] as any)._wrapped) {
|
|
575
|
-
|
|
576
562
|
if (configRef.current[callbackFnName]) {
|
|
577
|
-
configRef.current[callbackFnName](
|
|
578
|
-
data,
|
|
579
|
-
stateRef.current,
|
|
580
|
-
);
|
|
563
|
+
configRef.current[callbackFnName](data, stateRef.current);
|
|
581
564
|
}
|
|
582
565
|
}
|
|
583
566
|
};
|
|
@@ -588,8 +571,8 @@ export const createModelHook = <TDefaultConfig extends {}, TRequiredConfig exten
|
|
|
588
571
|
}, {} as Record<string, any>);
|
|
589
572
|
}, []);
|
|
590
573
|
|
|
591
|
-
|
|
592
|
-
return {
|
|
574
|
+
// The model context is private and should never be used
|
|
575
|
+
return {state, events: wrappedEvents, __UNSTABLE_modelContext: Context, ...rest};
|
|
593
576
|
}
|
|
594
577
|
|
|
595
578
|
wrappedModelHook.getElemProps = getElemProps;
|
|
@@ -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"}
|
|
@@ -10,7 +10,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.navigationManager = exports.wrappingNavigationManager = exports.isSelected = exports.multiSelectionManager = exports.singleSelectionManager = exports.ListBox = exports.defaultGetId = void 0;
|
|
13
|
+
exports.navigationManager = exports.wrappingNavigationManager = exports.isSelected = exports.multiSelectionManager = exports.singleSelectionManager = exports.keyboardEventToCursorEvents = exports.ListBox = exports.defaultGetId = void 0;
|
|
14
14
|
var useBaseListModel_1 = require("./lib/useBaseListModel");
|
|
15
15
|
Object.defineProperty(exports, "defaultGetId", { enumerable: true, get: function () { return useBaseListModel_1.defaultGetId; } });
|
|
16
16
|
__exportStar(require("./lib/useListItemRegister"), exports);
|
|
@@ -30,6 +30,8 @@ __exportStar(require("./lib/useListActiveDescendant"), exports);
|
|
|
30
30
|
__exportStar(require("./lib/useListItemAllowChildStrings"), exports);
|
|
31
31
|
var ListBox_1 = require("./lib/ListBox");
|
|
32
32
|
Object.defineProperty(exports, "ListBox", { enumerable: true, get: function () { return ListBox_1.ListBox; } });
|
|
33
|
+
var keyUtils_1 = require("./lib/keyUtils");
|
|
34
|
+
Object.defineProperty(exports, "keyboardEventToCursorEvents", { enumerable: true, get: function () { return keyUtils_1.keyboardEventToCursorEvents; } });
|
|
33
35
|
var useSelectionListModel_1 = require("./lib/useSelectionListModel");
|
|
34
36
|
Object.defineProperty(exports, "singleSelectionManager", { enumerable: true, get: function () { return useSelectionListModel_1.singleSelectionManager; } });
|
|
35
37
|
Object.defineProperty(exports, "multiSelectionManager", { enumerable: true, get: function () { return useSelectionListModel_1.multiSelectionManager; } });
|
|
@@ -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,"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AAM,CAAA;SAAC;QAWrD;;;WAGG;;gBACuB,MAAM;;QAUhC;;;;;;;;WAQG;+BACoB;YAAC,KAAK,EAAE,MAAM,CAAA;SAAC;;kBAhIxB,OAAO;;IATrB,kEAAkE;;IAElE;;;;;;OAMG;kBACW,OAAO;IAErB;;;;OAIG;yBACkB,OAAO;IAE5B;;;OAGG;;IAEH;;;;;OAKG;;IAEH;;;;;OAKG;;;IAhDL;;;;OAIG;WACI,OAAO,EAAE;;;;;;;;;;;;;;;;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"}
|
|
@@ -12,7 +12,7 @@ const defaultGetId = (item) => {
|
|
|
12
12
|
};
|
|
13
13
|
exports.defaultGetId = defaultGetId;
|
|
14
14
|
const defaultGetTextValue = (item) => {
|
|
15
|
-
return typeof item === 'string' ? item : item.text || '';
|
|
15
|
+
return typeof item === 'string' ? item : item.text || item.id || '';
|
|
16
16
|
};
|
|
17
17
|
exports.defaultGetTextValue = defaultGetTextValue;
|
|
18
18
|
// interface Collection<T> {
|
|
@@ -99,7 +99,7 @@ exports.useBaseListModel = common_1.createModelHook({
|
|
|
99
99
|
const getIdRef = react_1.default.useRef(exports.defaultGetId);
|
|
100
100
|
const getTextValueRef = react_1.default.useRef(exports.defaultGetTextValue);
|
|
101
101
|
const getId = config.getId || exports.defaultGetId;
|
|
102
|
-
const getTextValue = config.getTextValue || exports.defaultGetTextValue;
|
|
102
|
+
const getTextValue = config.getTextValue || config.getId || exports.defaultGetTextValue;
|
|
103
103
|
getIdRef.current = getId;
|
|
104
104
|
getTextValueRef.current = getTextValue;
|
|
105
105
|
const [orientation] = react_1.default.useState(config.orientation || 'vertical');
|
|
@@ -21,7 +21,7 @@ const useListModel_1 = require("./useListModel");
|
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
exports.useListItemRegister = common_1.createElemPropsHook(useListModel_1.useListModel)(({ state, events }, ref, elemProps = {}) => {
|
|
24
|
-
var _a, _b
|
|
24
|
+
var _a, _b;
|
|
25
25
|
const [localId, setLocalId] = react_1.default.useState(elemProps['data-id'] || ((_a = elemProps.item) === null || _a === void 0 ? void 0 : _a.id) || '');
|
|
26
26
|
const { localRef, elementRef } = common_1.useLocalRef(common_1.useForkRef(ref, (_b = elemProps.virtual) === null || _b === void 0 ? void 0 : _b.measureRef));
|
|
27
27
|
// if the list is virtual, force the correct styling. Without this, weird things happen...
|
|
@@ -71,7 +71,7 @@ exports.useListItemRegister = common_1.createElemPropsHook(useListModel_1.useLis
|
|
|
71
71
|
disabled: elemProps.disabled || state.nonInteractiveIds.includes(localId) ? true : undefined,
|
|
72
72
|
item: null,
|
|
73
73
|
virtual: null,
|
|
74
|
-
'aria-setsize':
|
|
74
|
+
'aria-setsize': elemProps.virtual ? state.UNSTABLE_virtual.totalSize : undefined,
|
|
75
75
|
'aria-posinset': elemProps.virtual ? elemProps.item.index + 1 : undefined,
|
|
76
76
|
style,
|
|
77
77
|
id: common_1.slugify(`${state.id}-${localId}`),
|
|
@@ -31,7 +31,7 @@ function useListRenderItems(model, children) {
|
|
|
31
31
|
// about capital letters in attributes. React thinks this will be applied to the DOM
|
|
32
32
|
// element even though we remove it later...
|
|
33
33
|
virtual,
|
|
34
|
-
key: item.id,
|
|
34
|
+
key: item.id || item.index,
|
|
35
35
|
item,
|
|
36
36
|
});
|
|
37
37
|
}
|
|
@@ -41,7 +41,7 @@ function useListRenderItems(model, children) {
|
|
|
41
41
|
const child = children(item.value, item.index);
|
|
42
42
|
if (react_1.default.isValidElement(child)) {
|
|
43
43
|
return react_1.default.cloneElement(child, {
|
|
44
|
-
key: item.id,
|
|
44
|
+
key: item.id || item.index,
|
|
45
45
|
item: item.value,
|
|
46
46
|
});
|
|
47
47
|
}
|
|
@@ -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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.useComboboxResetCursorToSelected = exports.useComboboxListKeyboardHandler = exports.useComboboxInput = exports.useComboboxMoveCursorToSelected = exports.useSetPopupWidth = exports.useComboboxKeyboardTypeAhead = exports.useComboboxInputOpenWithArrowKeys = exports.useComboboxModel = exports.useComboboxLoader = exports.useComboboxMenuList = exports.useComboboxMenuItem = exports.useComboboxCard = exports.Combobox = void 0;
|
|
4
4
|
var Combobox_1 = require("./lib/Combobox");
|
|
5
5
|
Object.defineProperty(exports, "Combobox", { enumerable: true, get: function () { return Combobox_1.Combobox; } });
|
|
6
6
|
var ComboboxCard_1 = require("./lib/ComboboxCard");
|
|
@@ -9,11 +9,13 @@ var ComboboxMenuItem_1 = require("./lib/ComboboxMenuItem");
|
|
|
9
9
|
Object.defineProperty(exports, "useComboboxMenuItem", { enumerable: true, get: function () { return ComboboxMenuItem_1.useComboboxMenuItem; } });
|
|
10
10
|
var ComboboxMenuList_1 = require("./lib/ComboboxMenuList");
|
|
11
11
|
Object.defineProperty(exports, "useComboboxMenuList", { enumerable: true, get: function () { return ComboboxMenuList_1.useComboboxMenuList; } });
|
|
12
|
-
var
|
|
13
|
-
Object.defineProperty(exports, "
|
|
14
|
-
|
|
15
|
-
Object.defineProperty(exports, "
|
|
16
|
-
|
|
17
|
-
Object.defineProperty(exports, "
|
|
18
|
-
|
|
19
|
-
Object.defineProperty(exports, "
|
|
12
|
+
var hooks_1 = require("./lib/hooks");
|
|
13
|
+
Object.defineProperty(exports, "useComboboxLoader", { enumerable: true, get: function () { return hooks_1.useComboboxLoader; } });
|
|
14
|
+
Object.defineProperty(exports, "useComboboxModel", { enumerable: true, get: function () { return hooks_1.useComboboxModel; } });
|
|
15
|
+
Object.defineProperty(exports, "useComboboxInputOpenWithArrowKeys", { enumerable: true, get: function () { return hooks_1.useComboboxInputOpenWithArrowKeys; } });
|
|
16
|
+
Object.defineProperty(exports, "useComboboxKeyboardTypeAhead", { enumerable: true, get: function () { return hooks_1.useComboboxKeyboardTypeAhead; } });
|
|
17
|
+
Object.defineProperty(exports, "useSetPopupWidth", { enumerable: true, get: function () { return hooks_1.useSetPopupWidth; } });
|
|
18
|
+
Object.defineProperty(exports, "useComboboxMoveCursorToSelected", { enumerable: true, get: function () { return hooks_1.useComboboxMoveCursorToSelected; } });
|
|
19
|
+
Object.defineProperty(exports, "useComboboxInput", { enumerable: true, get: function () { return hooks_1.useComboboxInput; } });
|
|
20
|
+
Object.defineProperty(exports, "useComboboxListKeyboardHandler", { enumerable: true, get: function () { return hooks_1.useComboboxListKeyboardHandler; } });
|
|
21
|
+
Object.defineProperty(exports, "useComboboxResetCursorToSelected", { enumerable: true, get: function () { return hooks_1.useComboboxResetCursorToSelected; } });
|
|
@@ -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"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;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKL,CAAC"}
|
|
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.Combobox = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const common_1 = require("@workday/canvas-kit-react/common");
|
|
9
|
-
const
|
|
9
|
+
const hooks_1 = require("./hooks");
|
|
10
10
|
const ComboboxInput_1 = require("./ComboboxInput");
|
|
11
11
|
const ComboboxMenu_1 = require("./ComboboxMenu");
|
|
12
12
|
exports.Combobox = common_1.createContainer()({
|
|
13
13
|
displayName: 'Combobox',
|
|
14
|
-
modelHook:
|
|
14
|
+
modelHook: hooks_1.useComboboxModel,
|
|
15
15
|
subComponents: {
|
|
16
16
|
/**
|
|
17
17
|
* The input of the `Combobox`. This element will have `role="combobox"` applied, along with
|
|
@@ -7,18 +7,18 @@ exports.ComboboxCard = exports.useComboboxCard = 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
|
/**
|
|
12
12
|
* This hook sets the `minWidth` style attribute to match the width of the
|
|
13
13
|
* {@link ComboboxInput Combobox.Input} component.
|
|
14
14
|
*/
|
|
15
|
-
exports.useComboboxCard = common_1.createElemPropsHook(
|
|
15
|
+
exports.useComboboxCard = common_1.createElemPropsHook(hooks_1.useComboboxModel)(model => {
|
|
16
16
|
return {
|
|
17
17
|
minWidth: model.state.width,
|
|
18
18
|
};
|
|
19
19
|
});
|
|
20
20
|
exports.ComboboxCard = common_1.createSubcomponent('div')({
|
|
21
|
-
modelHook:
|
|
21
|
+
modelHook: hooks_1.useComboboxModel,
|
|
22
22
|
elemPropsHook: exports.useComboboxCard,
|
|
23
23
|
})(({ children, ...elemProps }, Element) => {
|
|
24
24
|
return (react_1.default.createElement(menu_1.Menu.Card, Object.assign({ as: Element }, elemProps), children));
|