@workday/canvas-kit-react 9.0.0-alpha.418-next.20 → 9.0.0-alpha.420-next.22
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/breadcrumbs/lib/BreadcrumbsItem.tsx +1 -1
- package/collection/index.ts +2 -0
- package/collection/lib/ListBox.tsx +12 -10
- package/collection/lib/useBaseListModel.tsx +6 -4
- package/collection/lib/useCursorListModel.tsx +1 -1
- package/collection/lib/useListActiveDescendant.ts +24 -0
- package/collection/lib/useListItemAllowChildStrings.ts +2 -1
- package/collection/lib/useListItemRegister.tsx +10 -3
- package/collection/lib/useListItemSelect.tsx +1 -1
- package/collection/lib/useListKeyboardHandler.ts +28 -0
- package/collection/lib/useListLoader.ts +116 -54
- package/collection/lib/useOverflowListItemMeasure.tsx +2 -2
- package/collection/lib/useOverflowListMeasure.ts +11 -13
- package/collection/lib/useOverflowListTarget.tsx +28 -30
- package/collection/lib/useSelectionListModel.tsx +1 -0
- package/combobox/LICENSE +52 -0
- package/combobox/README.md +7 -0
- package/combobox/index.ts +8 -0
- package/combobox/lib/Combobox.tsx +32 -0
- package/combobox/lib/ComboboxCard.tsx +33 -0
- package/combobox/lib/ComboboxInput.tsx +104 -0
- package/combobox/lib/ComboboxMenu.tsx +67 -0
- package/combobox/lib/ComboboxMenuItem.tsx +74 -0
- package/combobox/lib/ComboboxMenuList.tsx +45 -0
- package/combobox/lib/useComboboxInputOpenWithArrowKeys.ts +21 -0
- package/combobox/lib/useComboboxLoader.ts +72 -0
- package/combobox/lib/useComboboxModel.tsx +85 -0
- package/combobox/package.json +6 -0
- package/common/lib/utils/components.ts +20 -16
- package/common/lib/utils/models.ts +2 -2
- package/dist/commonjs/action-bar/lib/ActionBar.d.ts +2 -2
- package/dist/commonjs/action-bar/lib/ActionBarList.d.ts +1 -1
- package/dist/commonjs/action-bar/lib/useActionBarModel.d.ts +2 -2
- package/dist/commonjs/breadcrumbs/lib/Breadcrumbs.d.ts +2 -2
- package/dist/commonjs/breadcrumbs/lib/BreadcrumbsMenu.d.ts +1 -1
- package/dist/commonjs/breadcrumbs/lib/hooks/useBreadcrumbsModel.d.ts +2 -2
- package/dist/commonjs/collection/index.d.ts +2 -0
- package/dist/commonjs/collection/index.d.ts.map +1 -1
- package/dist/commonjs/collection/index.js +2 -0
- package/dist/commonjs/collection/lib/ListBox.d.ts +7 -6
- package/dist/commonjs/collection/lib/ListBox.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/ListBox.js +5 -3
- package/dist/commonjs/collection/lib/useBaseListModel.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useBaseListModel.js +4 -4
- package/dist/commonjs/collection/lib/useCursorListModel.d.ts +0 -34
- package/dist/commonjs/collection/lib/useCursorListModel.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useCursorListModel.js +1 -1
- package/dist/commonjs/collection/lib/useListActiveDescendant.d.ts +68 -0
- package/dist/commonjs/collection/lib/useListActiveDescendant.d.ts.map +1 -0
- package/dist/commonjs/collection/lib/useListActiveDescendant.js +25 -0
- package/dist/commonjs/collection/lib/useListItemAllowChildStrings.d.ts +2 -1
- package/dist/commonjs/collection/lib/useListItemAllowChildStrings.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useListItemAllowChildStrings.js +2 -1
- package/dist/commonjs/collection/lib/useListItemRegister.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useListItemRegister.js +5 -1
- package/dist/commonjs/collection/lib/useListKeyboardHandler.d.ts +66 -0
- package/dist/commonjs/collection/lib/useListKeyboardHandler.d.ts.map +1 -0
- package/dist/commonjs/collection/lib/useListKeyboardHandler.js +27 -0
- package/dist/commonjs/collection/lib/useListLoader.d.ts +46 -7
- package/dist/commonjs/collection/lib/useListLoader.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useListLoader.js +61 -35
- package/dist/commonjs/collection/lib/useOverflowListMeasure.d.ts +1 -1
- package/dist/commonjs/collection/lib/useOverflowListMeasure.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useOverflowListTarget.d.ts +5 -2
- package/dist/commonjs/collection/lib/useOverflowListTarget.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useOverflowListTarget.js +1 -1
- package/dist/commonjs/collection/lib/useSelectionListModel.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useSelectionListModel.js +1 -0
- package/dist/commonjs/combobox/index.d.ts +9 -0
- package/dist/commonjs/combobox/index.d.ts.map +1 -0
- package/dist/commonjs/combobox/index.js +19 -0
- package/dist/commonjs/combobox/lib/Combobox.d.ts +2075 -0
- package/dist/commonjs/combobox/lib/Combobox.d.ts.map +1 -0
- package/dist/commonjs/combobox/lib/Combobox.js +29 -0
- package/dist/commonjs/combobox/lib/ComboboxCard.d.ts +166 -0
- package/dist/commonjs/combobox/lib/ComboboxCard.d.ts.map +1 -0
- package/dist/commonjs/combobox/lib/ComboboxCard.js +25 -0
- package/dist/commonjs/combobox/lib/ComboboxInput.d.ts +186 -0
- package/dist/commonjs/combobox/lib/ComboboxInput.d.ts.map +1 -0
- package/dist/commonjs/combobox/lib/ComboboxInput.js +84 -0
- package/dist/commonjs/combobox/lib/ComboboxMenu.d.ts +428 -0
- package/dist/commonjs/combobox/lib/ComboboxMenu.d.ts.map +1 -0
- package/dist/commonjs/combobox/lib/ComboboxMenu.js +63 -0
- package/dist/commonjs/combobox/lib/ComboboxMenuItem.d.ts +178 -0
- package/dist/commonjs/combobox/lib/ComboboxMenuItem.d.ts.map +1 -0
- package/dist/commonjs/combobox/lib/ComboboxMenuItem.js +50 -0
- package/dist/commonjs/combobox/lib/ComboboxMenuList.d.ts +164 -0
- package/dist/commonjs/combobox/lib/ComboboxMenuList.d.ts.map +1 -0
- package/dist/commonjs/combobox/lib/ComboboxMenuList.js +31 -0
- package/dist/commonjs/combobox/lib/useComboboxInputOpenWithArrowKeys.d.ts +84 -0
- package/dist/commonjs/combobox/lib/useComboboxInputOpenWithArrowKeys.d.ts.map +1 -0
- package/dist/commonjs/combobox/lib/useComboboxInputOpenWithArrowKeys.js +20 -0
- package/dist/commonjs/combobox/lib/useComboboxLoader.d.ts +28 -0
- package/dist/commonjs/combobox/lib/useComboboxLoader.d.ts.map +1 -0
- package/dist/commonjs/combobox/lib/useComboboxLoader.js +65 -0
- package/dist/commonjs/combobox/lib/useComboboxModel.d.ts +1998 -0
- package/dist/commonjs/combobox/lib/useComboboxModel.d.ts.map +1 -0
- package/dist/commonjs/combobox/lib/useComboboxModel.js +82 -0
- package/dist/commonjs/common/lib/utils/components.d.ts +9 -23
- package/dist/commonjs/common/lib/utils/components.d.ts.map +1 -1
- package/dist/commonjs/common/lib/utils/components.js +6 -2
- package/dist/commonjs/common/lib/utils/models.js +2 -2
- package/dist/commonjs/index.d.ts +1 -0
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +1 -0
- package/dist/commonjs/menu/index.d.ts +1 -1
- package/dist/commonjs/menu/index.d.ts.map +1 -1
- package/dist/commonjs/menu/index.js +2 -1
- package/dist/commonjs/menu/lib/Menu.d.ts +7 -5
- package/dist/commonjs/menu/lib/Menu.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/Menu.js +6 -4
- package/dist/commonjs/menu/lib/MenuContextTarget.d.ts +2 -2
- package/dist/commonjs/menu/lib/MenuItem.d.ts +7 -1
- package/dist/commonjs/menu/lib/MenuItem.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/MenuItem.js +9 -11
- package/dist/commonjs/menu/lib/MenuList.d.ts +3 -3
- package/dist/commonjs/menu/lib/MenuList.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/MenuList.js +3 -2
- package/dist/commonjs/menu/lib/MenuPopper.d.ts +1 -1
- package/dist/commonjs/menu/lib/MenuTarget.d.ts +2 -2
- package/dist/commonjs/menu/lib/useMenuModel.d.ts +2 -2
- package/dist/commonjs/menu/lib/useMenuModel.d.ts.map +1 -1
- package/dist/commonjs/menu/lib/useMenuModel.js +3 -5
- package/dist/commonjs/popup/lib/hooks/usePopupPopper.d.ts +1 -1
- package/dist/commonjs/popup/lib/hooks/usePopupTarget.d.ts +1 -1
- package/dist/commonjs/popup/lib/hooks/usePopupTargetContext.d.ts +1 -1
- package/dist/commonjs/tabs/lib/Tabs.d.ts +18 -120
- package/dist/commonjs/tabs/lib/Tabs.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsItem.d.ts +0 -1
- package/dist/commonjs/tabs/lib/TabsItem.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsItem.js +0 -1
- package/dist/commonjs/tabs/lib/TabsList.d.ts +1 -1
- package/dist/commonjs/tabs/lib/TabsMenuPopper.d.ts +1 -1
- package/dist/commonjs/tabs/lib/TabsPanel.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/useTabsModel.d.ts +8 -20
- package/dist/commonjs/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/useTabsModel.js +1 -0
- package/dist/commonjs/text-input/index.d.ts +1 -1
- package/dist/commonjs/text-input/index.d.ts.map +1 -1
- package/dist/commonjs/text-input/index.js +2 -1
- package/dist/commonjs/text-input/lib/InputGroup.d.ts +94 -9
- package/dist/commonjs/text-input/lib/InputGroup.d.ts.map +1 -1
- package/dist/commonjs/text-input/lib/InputGroup.js +129 -63
- package/dist/es6/action-bar/lib/ActionBar.d.ts +2 -2
- package/dist/es6/action-bar/lib/ActionBarList.d.ts +1 -1
- package/dist/es6/action-bar/lib/useActionBarModel.d.ts +2 -2
- package/dist/es6/breadcrumbs/lib/Breadcrumbs.d.ts +2 -2
- package/dist/es6/breadcrumbs/lib/BreadcrumbsMenu.d.ts +1 -1
- package/dist/es6/breadcrumbs/lib/hooks/useBreadcrumbsModel.d.ts +2 -2
- package/dist/es6/collection/index.d.ts +2 -0
- package/dist/es6/collection/index.d.ts.map +1 -1
- package/dist/es6/collection/index.js +2 -0
- package/dist/es6/collection/lib/ListBox.d.ts +7 -6
- package/dist/es6/collection/lib/ListBox.d.ts.map +1 -1
- package/dist/es6/collection/lib/ListBox.js +6 -4
- package/dist/es6/collection/lib/useBaseListModel.d.ts.map +1 -1
- package/dist/es6/collection/lib/useBaseListModel.js +4 -4
- package/dist/es6/collection/lib/useCursorListModel.d.ts +0 -34
- package/dist/es6/collection/lib/useCursorListModel.d.ts.map +1 -1
- package/dist/es6/collection/lib/useCursorListModel.js +1 -1
- package/dist/es6/collection/lib/useListActiveDescendant.d.ts +68 -0
- package/dist/es6/collection/lib/useListActiveDescendant.d.ts.map +1 -0
- package/dist/es6/collection/lib/useListActiveDescendant.js +22 -0
- package/dist/es6/collection/lib/useListItemAllowChildStrings.d.ts +2 -1
- package/dist/es6/collection/lib/useListItemAllowChildStrings.d.ts.map +1 -1
- package/dist/es6/collection/lib/useListItemAllowChildStrings.js +2 -1
- package/dist/es6/collection/lib/useListItemRegister.d.ts.map +1 -1
- package/dist/es6/collection/lib/useListItemRegister.js +5 -1
- package/dist/es6/collection/lib/useListKeyboardHandler.d.ts +66 -0
- package/dist/es6/collection/lib/useListKeyboardHandler.d.ts.map +1 -0
- package/dist/es6/collection/lib/useListKeyboardHandler.js +24 -0
- package/dist/es6/collection/lib/useListLoader.d.ts +46 -7
- package/dist/es6/collection/lib/useListLoader.d.ts.map +1 -1
- package/dist/es6/collection/lib/useListLoader.js +61 -35
- package/dist/es6/collection/lib/useOverflowListMeasure.d.ts +1 -1
- package/dist/es6/collection/lib/useOverflowListMeasure.d.ts.map +1 -1
- package/dist/es6/collection/lib/useOverflowListTarget.d.ts +5 -2
- package/dist/es6/collection/lib/useOverflowListTarget.d.ts.map +1 -1
- package/dist/es6/collection/lib/useOverflowListTarget.js +1 -1
- package/dist/es6/collection/lib/useSelectionListModel.d.ts.map +1 -1
- package/dist/es6/collection/lib/useSelectionListModel.js +1 -0
- package/dist/es6/combobox/index.d.ts +9 -0
- package/dist/es6/combobox/index.d.ts.map +1 -0
- package/dist/es6/combobox/index.js +8 -0
- package/dist/es6/combobox/lib/Combobox.d.ts +2075 -0
- package/dist/es6/combobox/lib/Combobox.d.ts.map +1 -0
- package/dist/es6/combobox/lib/Combobox.js +23 -0
- package/dist/es6/combobox/lib/ComboboxCard.d.ts +166 -0
- package/dist/es6/combobox/lib/ComboboxCard.d.ts.map +1 -0
- package/dist/es6/combobox/lib/ComboboxCard.js +19 -0
- package/dist/es6/combobox/lib/ComboboxInput.d.ts +186 -0
- package/dist/es6/combobox/lib/ComboboxInput.d.ts.map +1 -0
- package/dist/es6/combobox/lib/ComboboxInput.js +78 -0
- package/dist/es6/combobox/lib/ComboboxMenu.d.ts +428 -0
- package/dist/es6/combobox/lib/ComboboxMenu.d.ts.map +1 -0
- package/dist/es6/combobox/lib/ComboboxMenu.js +57 -0
- package/dist/es6/combobox/lib/ComboboxMenuItem.d.ts +178 -0
- package/dist/es6/combobox/lib/ComboboxMenuItem.d.ts.map +1 -0
- package/dist/es6/combobox/lib/ComboboxMenuItem.js +44 -0
- package/dist/es6/combobox/lib/ComboboxMenuList.d.ts +164 -0
- package/dist/es6/combobox/lib/ComboboxMenuList.d.ts.map +1 -0
- package/dist/es6/combobox/lib/ComboboxMenuList.js +25 -0
- package/dist/es6/combobox/lib/useComboboxInputOpenWithArrowKeys.d.ts +84 -0
- package/dist/es6/combobox/lib/useComboboxInputOpenWithArrowKeys.d.ts.map +1 -0
- package/dist/es6/combobox/lib/useComboboxInputOpenWithArrowKeys.js +17 -0
- package/dist/es6/combobox/lib/useComboboxLoader.d.ts +28 -0
- package/dist/es6/combobox/lib/useComboboxLoader.d.ts.map +1 -0
- package/dist/es6/combobox/lib/useComboboxLoader.js +58 -0
- package/dist/es6/combobox/lib/useComboboxModel.d.ts +1998 -0
- package/dist/es6/combobox/lib/useComboboxModel.d.ts.map +1 -0
- package/dist/es6/combobox/lib/useComboboxModel.js +76 -0
- package/dist/es6/common/lib/utils/components.d.ts +9 -23
- package/dist/es6/common/lib/utils/components.d.ts.map +1 -1
- package/dist/es6/common/lib/utils/components.js +6 -2
- package/dist/es6/common/lib/utils/models.js +2 -2
- package/dist/es6/index.d.ts +1 -0
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +1 -0
- package/dist/es6/menu/index.d.ts +1 -1
- package/dist/es6/menu/index.d.ts.map +1 -1
- package/dist/es6/menu/index.js +1 -1
- package/dist/es6/menu/lib/Menu.d.ts +7 -5
- package/dist/es6/menu/lib/Menu.d.ts.map +1 -1
- package/dist/es6/menu/lib/Menu.js +6 -4
- package/dist/es6/menu/lib/MenuContextTarget.d.ts +2 -2
- package/dist/es6/menu/lib/MenuItem.d.ts +7 -1
- package/dist/es6/menu/lib/MenuItem.d.ts.map +1 -1
- package/dist/es6/menu/lib/MenuItem.js +8 -10
- package/dist/es6/menu/lib/MenuList.d.ts +3 -3
- package/dist/es6/menu/lib/MenuList.d.ts.map +1 -1
- package/dist/es6/menu/lib/MenuList.js +4 -3
- package/dist/es6/menu/lib/MenuPopper.d.ts +1 -1
- package/dist/es6/menu/lib/MenuTarget.d.ts +2 -2
- package/dist/es6/menu/lib/useMenuModel.d.ts +2 -2
- package/dist/es6/menu/lib/useMenuModel.d.ts.map +1 -1
- package/dist/es6/menu/lib/useMenuModel.js +4 -6
- package/dist/es6/popup/lib/hooks/usePopupPopper.d.ts +1 -1
- package/dist/es6/popup/lib/hooks/usePopupTarget.d.ts +1 -1
- package/dist/es6/popup/lib/hooks/usePopupTargetContext.d.ts +1 -1
- package/dist/es6/tabs/lib/Tabs.d.ts +18 -120
- package/dist/es6/tabs/lib/Tabs.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsItem.d.ts +0 -1
- package/dist/es6/tabs/lib/TabsItem.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsItem.js +0 -1
- package/dist/es6/tabs/lib/TabsList.d.ts +1 -1
- package/dist/es6/tabs/lib/TabsMenuPopper.d.ts +1 -1
- package/dist/es6/tabs/lib/TabsPanel.d.ts.map +1 -1
- package/dist/es6/tabs/lib/useTabsModel.d.ts +8 -20
- package/dist/es6/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/dist/es6/tabs/lib/useTabsModel.js +1 -0
- package/dist/es6/text-input/index.d.ts +1 -1
- package/dist/es6/text-input/index.d.ts.map +1 -1
- package/dist/es6/text-input/index.js +1 -1
- package/dist/es6/text-input/lib/InputGroup.d.ts +94 -9
- package/dist/es6/text-input/lib/InputGroup.d.ts.map +1 -1
- package/dist/es6/text-input/lib/InputGroup.js +129 -63
- package/index.ts +1 -0
- package/menu/index.ts +1 -1
- package/menu/lib/Menu.tsx +6 -4
- package/menu/lib/MenuItem.tsx +9 -12
- package/menu/lib/MenuList.tsx +16 -10
- package/menu/lib/useMenuModel.tsx +4 -7
- package/modal/lib/hooks/useModalHeading.ts +2 -2
- package/package.json +3 -3
- package/tabs/lib/TabsItem.tsx +10 -13
- package/tabs/lib/TabsPanel.tsx +1 -5
- package/tabs/lib/useTabsModel.tsx +1 -0
- package/text-input/index.ts +1 -1
- package/text-input/lib/InputGroup.tsx +177 -95
|
@@ -242,10 +242,10 @@ export const createContainer = <
|
|
|
242
242
|
>(
|
|
243
243
|
as?: E
|
|
244
244
|
) => <
|
|
245
|
-
TModelHook extends ((config: any) =>
|
|
245
|
+
TModelHook extends ((config: any) => Model<any, any>) & {
|
|
246
246
|
Context?: React.Context<any>;
|
|
247
247
|
} & {defaultConfig?: Record<string, any>},
|
|
248
|
-
TDefaultContext extends
|
|
248
|
+
TDefaultContext extends Model<any, any>,
|
|
249
249
|
TElemPropsHook,
|
|
250
250
|
SubComponents = {}
|
|
251
251
|
>({
|
|
@@ -294,6 +294,11 @@ export const createContainer = <
|
|
|
294
294
|
? (elemPropsHook as any)(localModel, elemProps, ref)
|
|
295
295
|
: elemProps;
|
|
296
296
|
|
|
297
|
+
// make sure there's always a ref being passed, even if there are no elemProps hooks to run
|
|
298
|
+
if (ref && !finalElemProps.hasOwnProperty('ref')) {
|
|
299
|
+
finalElemProps.ref = ref;
|
|
300
|
+
}
|
|
301
|
+
|
|
297
302
|
return React.createElement(
|
|
298
303
|
Context.Provider,
|
|
299
304
|
{value: localModel},
|
|
@@ -375,7 +380,7 @@ export const createSubcomponent = <
|
|
|
375
380
|
as?: E
|
|
376
381
|
) => <
|
|
377
382
|
TElemPropsHook, // normally we'd put a constraint here, but doing so causes the `infer` below to fail to infer the return props
|
|
378
|
-
TModelHook extends ((config: any) =>
|
|
383
|
+
TModelHook extends ((config: any) => Model<any, any>) & {Context?: React.Context<any>},
|
|
379
384
|
SubComponents = {}
|
|
380
385
|
>({
|
|
381
386
|
displayName,
|
|
@@ -587,10 +592,8 @@ export const createElemPropsHook = <TModelHook extends (config: any) => Model<an
|
|
|
587
592
|
modelHook: TModelHook
|
|
588
593
|
) => <PO extends {}, PI extends {}>(
|
|
589
594
|
fn: (
|
|
590
|
-
model: TModelHook extends (config: any) => infer TModel
|
|
591
|
-
|
|
592
|
-
: {state: Record<string, any>; events: Record<string, any>},
|
|
593
|
-
ref?: React.Ref<any>,
|
|
595
|
+
model: TModelHook extends (config: any) => infer TModel ? TModel : Model<any, any>,
|
|
596
|
+
ref?: React.Ref<unknown>,
|
|
594
597
|
elemProps?: PI
|
|
595
598
|
) => PO
|
|
596
599
|
): BehaviorHook<
|
|
@@ -628,10 +631,10 @@ export const createElemPropsHook = <TModelHook extends (config: any) => Model<an
|
|
|
628
631
|
* });
|
|
629
632
|
*
|
|
630
633
|
* // Equivalent to:
|
|
631
|
-
* const useMyHook = <P extends {}
|
|
634
|
+
* const useMyHook = <P extends {}>(
|
|
632
635
|
* model: MyModel,
|
|
633
636
|
* elemProps: P,
|
|
634
|
-
* ref: React.Ref<
|
|
637
|
+
* ref: React.Ref<unknown>
|
|
635
638
|
* ) => {
|
|
636
639
|
* const { localRef, elementRef } = useLocalRef(ref);
|
|
637
640
|
* // do whatever with `localRef` which is a RefObject
|
|
@@ -645,7 +648,7 @@ export const createElemPropsHook = <TModelHook extends (config: any) => Model<an
|
|
|
645
648
|
* @param fn Function that takes a model and optional ref and returns props
|
|
646
649
|
*/
|
|
647
650
|
export const createHook = <M extends Model<any, any>, PO extends {}, PI extends {}>(
|
|
648
|
-
fn: (model: M, ref?: React.Ref<
|
|
651
|
+
fn: (model: M, ref?: React.Ref<unknown>, elemProps?: PI) => PO
|
|
649
652
|
): BehaviorHook<M, PO> => {
|
|
650
653
|
return ((model, elemProps, ref) => {
|
|
651
654
|
const props = mergeProps(fn(model, ref, elemProps || ({} as any)), elemProps || ({} as any));
|
|
@@ -664,7 +667,7 @@ export const subModelHook = <M extends Model<any, any>, SM extends Model<any, an
|
|
|
664
667
|
fn: (model: M) => SM,
|
|
665
668
|
hook: BehaviorHook<SM, O>
|
|
666
669
|
): BehaviorHook<M, O> => {
|
|
667
|
-
return ((model: M, props: any, ref: React.Ref<
|
|
670
|
+
return ((model: M, props: any, ref: React.Ref<unknown>) => {
|
|
668
671
|
return hook(fn(model), props, ref);
|
|
669
672
|
}) as BehaviorHook<M, O>;
|
|
670
673
|
};
|
|
@@ -699,7 +702,7 @@ export function createSubModelElemPropsHook<M extends () => Model<any, any>>(mod
|
|
|
699
702
|
fn: (model: ReturnType<M>) => SM,
|
|
700
703
|
elemPropsHook: BehaviorHook<SM, O>
|
|
701
704
|
): BehaviorHook<ReturnType<M>, O> => {
|
|
702
|
-
return ((model: ReturnType<M>, props: any, ref: React.Ref<
|
|
705
|
+
return ((model: ReturnType<M>, props: any, ref: React.Ref<unknown>) => {
|
|
703
706
|
return elemPropsHook(fn(model), props, ref);
|
|
704
707
|
}) as BehaviorHook<ReturnType<M>, O>;
|
|
705
708
|
};
|
|
@@ -737,9 +740,7 @@ interface BaseHook<M extends Model<any, any>, O extends {}> {
|
|
|
737
740
|
* attributes to apply to an element or component.
|
|
738
741
|
*/
|
|
739
742
|
export interface BehaviorHook<M extends Model<any, any>, O extends {}> extends BaseHook<M, O> {
|
|
740
|
-
<P extends {}
|
|
741
|
-
P &
|
|
742
|
-
(R extends HTMLOrSVGElement ? {ref: React.Ref<R>} : {});
|
|
743
|
+
<P extends {}>(model: M, elemProps?: P, ref?: React.Ref<unknown>): O & P;
|
|
743
744
|
}
|
|
744
745
|
|
|
745
746
|
function setRef<T>(ref: React.Ref<T> | undefined, value: T): void {
|
|
@@ -918,7 +919,10 @@ export function composeHooks<
|
|
|
918
919
|
hook3?: H3,
|
|
919
920
|
hook4?: H4,
|
|
920
921
|
hook5?: H5,
|
|
921
|
-
hook6?: H6
|
|
922
|
+
hook6?: H6,
|
|
923
|
+
// TypeScript will only infer up to 6, but the types will still exist for those 6. The rest of the
|
|
924
|
+
// hooks won't add to the interface, but that seems to be an okay fallback
|
|
925
|
+
...hooks: BehaviorHook<any, any>[]
|
|
922
926
|
): H1 extends BaseHook<infer M, infer O1>
|
|
923
927
|
? H2 extends BaseHook<any, infer O2>
|
|
924
928
|
? H3 extends BaseHook<any, infer O3>
|
|
@@ -513,10 +513,10 @@ export const createModelHook = <TDefaultConfig extends {}, TRequiredConfig exten
|
|
|
513
513
|
const elemProps = {};
|
|
514
514
|
for (const key in props) {
|
|
515
515
|
if (
|
|
516
|
-
!defaultConfig.hasOwnProperty(key) &&
|
|
516
|
+
(!defaultConfig.hasOwnProperty(key) &&
|
|
517
517
|
!requiredConfig.hasOwnProperty(key) &&
|
|
518
518
|
!callbacksRef.current.includes(key) &&
|
|
519
|
-
!guardsRef.current.includes(key)
|
|
519
|
+
!guardsRef.current.includes(key)) || key === 'id'
|
|
520
520
|
) {
|
|
521
521
|
// @ts-ignore Typescript complains about index signatures and this type is never exposed in definitions, so suppress the error
|
|
522
522
|
elemProps[key] = props[key];
|
|
@@ -28,6 +28,7 @@ export declare const ActionBar: import("@workday/canvas-kit-react/common").Compo
|
|
|
28
28
|
orientation: import("../../collection/lib/useBaseListModel").Orientation;
|
|
29
29
|
menuConfig: Partial<{
|
|
30
30
|
mode: "multiple" | "single";
|
|
31
|
+
shouldVirtualize: boolean;
|
|
31
32
|
returnFocusRef: React.RefObject<any> | undefined;
|
|
32
33
|
initialFocusRef: React.RefObject<any> | undefined;
|
|
33
34
|
id: string;
|
|
@@ -44,7 +45,6 @@ export declare const ActionBar: import("@workday/canvas-kit-react/common").Compo
|
|
|
44
45
|
nonInteractiveIds: string[];
|
|
45
46
|
orientation: import("../../collection/lib/useBaseListModel").Orientation;
|
|
46
47
|
defaultItemHeight: number;
|
|
47
|
-
shouldVirtualize: boolean;
|
|
48
48
|
items: any[];
|
|
49
49
|
}>;
|
|
50
50
|
initialHiddenIds: string[];
|
|
@@ -2557,6 +2557,7 @@ export declare const ActionBar: import("@workday/canvas-kit-react/common").Compo
|
|
|
2557
2557
|
*/
|
|
2558
2558
|
Menu: import("@workday/canvas-kit-react/common").ComponentM<import("../../menu/lib/Menu").MenuProps & Partial<{
|
|
2559
2559
|
mode: "multiple" | "single";
|
|
2560
|
+
shouldVirtualize: boolean;
|
|
2560
2561
|
returnFocusRef: React.RefObject<any> | undefined;
|
|
2561
2562
|
initialFocusRef: React.RefObject<any> | undefined;
|
|
2562
2563
|
id: string;
|
|
@@ -2573,7 +2574,6 @@ export declare const ActionBar: import("@workday/canvas-kit-react/common").Compo
|
|
|
2573
2574
|
nonInteractiveIds: string[];
|
|
2574
2575
|
orientation: import("../../collection/lib/useBaseListModel").Orientation;
|
|
2575
2576
|
defaultItemHeight: number;
|
|
2576
|
-
shouldVirtualize: boolean;
|
|
2577
2577
|
items: any[];
|
|
2578
2578
|
}> & {
|
|
2579
2579
|
onUpdatePlacement?: ((data: {
|
|
@@ -105,7 +105,7 @@ export declare const useActionBarList: import("@workday/canvas-kit-react/common"
|
|
|
105
105
|
navigation: import("../../collection/lib/useCursorListModel").NavigationManager;
|
|
106
106
|
getId: (item: any) => string;
|
|
107
107
|
}, {
|
|
108
|
-
ref: (instance:
|
|
108
|
+
ref: (instance: unknown) => void;
|
|
109
109
|
}>;
|
|
110
110
|
export declare const ActionBarList: import("@workday/canvas-kit-react/common").ElementComponentM<"div", ActionBarListProps<any>, {
|
|
111
111
|
state: {
|
|
@@ -13,6 +13,7 @@ export declare const useActionBarModel: (<TT_Special_Generic>(config?: (Partial<
|
|
|
13
13
|
orientation: import("../../collection/lib/useBaseListModel").Orientation;
|
|
14
14
|
menuConfig: Partial<{
|
|
15
15
|
mode: "multiple" | "single";
|
|
16
|
+
shouldVirtualize: boolean;
|
|
16
17
|
returnFocusRef: React.RefObject<any> | undefined;
|
|
17
18
|
initialFocusRef: React.RefObject<any> | undefined;
|
|
18
19
|
id: string;
|
|
@@ -29,7 +30,6 @@ export declare const useActionBarModel: (<TT_Special_Generic>(config?: (Partial<
|
|
|
29
30
|
nonInteractiveIds: string[];
|
|
30
31
|
orientation: import("../../collection/lib/useBaseListModel").Orientation;
|
|
31
32
|
defaultItemHeight: number;
|
|
32
|
-
shouldVirtualize: boolean;
|
|
33
33
|
items: any[];
|
|
34
34
|
}>;
|
|
35
35
|
initialHiddenIds: string[];
|
|
@@ -1600,6 +1600,7 @@ export declare const useActionBarModel: (<TT_Special_Generic>(config?: (Partial<
|
|
|
1600
1600
|
orientation: import("../../collection/lib/useBaseListModel").Orientation;
|
|
1601
1601
|
menuConfig: Partial<{
|
|
1602
1602
|
mode: "multiple" | "single";
|
|
1603
|
+
shouldVirtualize: boolean;
|
|
1603
1604
|
returnFocusRef: React.RefObject<any> | undefined;
|
|
1604
1605
|
initialFocusRef: React.RefObject<any> | undefined;
|
|
1605
1606
|
id: string;
|
|
@@ -1616,7 +1617,6 @@ export declare const useActionBarModel: (<TT_Special_Generic>(config?: (Partial<
|
|
|
1616
1617
|
nonInteractiveIds: string[];
|
|
1617
1618
|
orientation: import("../../collection/lib/useBaseListModel").Orientation;
|
|
1618
1619
|
defaultItemHeight: number;
|
|
1619
|
-
shouldVirtualize: boolean;
|
|
1620
1620
|
items: any[];
|
|
1621
1621
|
}>;
|
|
1622
1622
|
initialHiddenIds: string[];
|
|
@@ -61,6 +61,7 @@ export declare const Breadcrumbs: import("@workday/canvas-kit-react/common").Ele
|
|
|
61
61
|
orientation: import("../../collection/lib/useBaseListModel").Orientation;
|
|
62
62
|
menuConfig: Partial<{
|
|
63
63
|
mode: "multiple" | "single";
|
|
64
|
+
shouldVirtualize: boolean;
|
|
64
65
|
returnFocusRef: React.RefObject<any> | undefined;
|
|
65
66
|
initialFocusRef: React.RefObject<any> | undefined;
|
|
66
67
|
id: string;
|
|
@@ -77,7 +78,6 @@ export declare const Breadcrumbs: import("@workday/canvas-kit-react/common").Ele
|
|
|
77
78
|
nonInteractiveIds: string[];
|
|
78
79
|
orientation: import("../../collection/lib/useBaseListModel").Orientation;
|
|
79
80
|
defaultItemHeight: number;
|
|
80
|
-
shouldVirtualize: boolean;
|
|
81
81
|
items: any[];
|
|
82
82
|
}>;
|
|
83
83
|
initialHiddenIds: string[];
|
|
@@ -2343,6 +2343,7 @@ export declare const Breadcrumbs: import("@workday/canvas-kit-react/common").Ele
|
|
|
2343
2343
|
*/
|
|
2344
2344
|
Menu: import("@workday/canvas-kit-react/common").ComponentM<import("../../menu/lib/Menu").MenuProps & Partial<{
|
|
2345
2345
|
mode: "multiple" | "single";
|
|
2346
|
+
shouldVirtualize: boolean;
|
|
2346
2347
|
returnFocusRef: React.RefObject<any> | undefined;
|
|
2347
2348
|
initialFocusRef: React.RefObject<any> | undefined;
|
|
2348
2349
|
id: string;
|
|
@@ -2359,7 +2360,6 @@ export declare const Breadcrumbs: import("@workday/canvas-kit-react/common").Ele
|
|
|
2359
2360
|
nonInteractiveIds: string[];
|
|
2360
2361
|
orientation: import("../../collection/lib/useBaseListModel").Orientation;
|
|
2361
2362
|
defaultItemHeight: number;
|
|
2362
|
-
shouldVirtualize: boolean;
|
|
2363
2363
|
items: any[];
|
|
2364
2364
|
}> & {
|
|
2365
2365
|
onUpdatePlacement?: ((data: {
|
|
@@ -75,6 +75,7 @@ export declare const BreadcrumbsMenuItem: import("@workday/canvas-kit-react/comm
|
|
|
75
75
|
}, {}>>;
|
|
76
76
|
export declare const BreadcrumbsMenu: import("@workday/canvas-kit-react/common").ComponentM<import("../../menu/lib/Menu").MenuProps & Partial<{
|
|
77
77
|
mode: "multiple" | "single";
|
|
78
|
+
shouldVirtualize: boolean;
|
|
78
79
|
returnFocusRef: React.RefObject<any> | undefined;
|
|
79
80
|
initialFocusRef: React.RefObject<any> | undefined;
|
|
80
81
|
id: string;
|
|
@@ -91,7 +92,6 @@ export declare const BreadcrumbsMenu: import("@workday/canvas-kit-react/common")
|
|
|
91
92
|
nonInteractiveIds: string[];
|
|
92
93
|
orientation: import("../../collection/lib/useBaseListModel").Orientation;
|
|
93
94
|
defaultItemHeight: number;
|
|
94
|
-
shouldVirtualize: boolean;
|
|
95
95
|
items: any[];
|
|
96
96
|
}> & {
|
|
97
97
|
onUpdatePlacement?: ((data: {
|
|
@@ -13,6 +13,7 @@ export declare const useBreadcrumbsModel: (<TT_Special_Generic>(config?: (Partia
|
|
|
13
13
|
orientation: import("../../../collection/lib/useBaseListModel").Orientation;
|
|
14
14
|
menuConfig: Partial<{
|
|
15
15
|
mode: "multiple" | "single";
|
|
16
|
+
shouldVirtualize: boolean;
|
|
16
17
|
returnFocusRef: React.RefObject<any> | undefined;
|
|
17
18
|
initialFocusRef: React.RefObject<any> | undefined;
|
|
18
19
|
id: string;
|
|
@@ -29,7 +30,6 @@ export declare const useBreadcrumbsModel: (<TT_Special_Generic>(config?: (Partia
|
|
|
29
30
|
nonInteractiveIds: string[];
|
|
30
31
|
orientation: import("../../../collection/lib/useBaseListModel").Orientation;
|
|
31
32
|
defaultItemHeight: number;
|
|
32
|
-
shouldVirtualize: boolean;
|
|
33
33
|
items: any[];
|
|
34
34
|
}>;
|
|
35
35
|
initialHiddenIds: string[];
|
|
@@ -1600,6 +1600,7 @@ export declare const useBreadcrumbsModel: (<TT_Special_Generic>(config?: (Partia
|
|
|
1600
1600
|
orientation: import("../../../collection/lib/useBaseListModel").Orientation;
|
|
1601
1601
|
menuConfig: Partial<{
|
|
1602
1602
|
mode: "multiple" | "single";
|
|
1603
|
+
shouldVirtualize: boolean;
|
|
1603
1604
|
returnFocusRef: React.RefObject<any> | undefined;
|
|
1604
1605
|
initialFocusRef: React.RefObject<any> | undefined;
|
|
1605
1606
|
id: string;
|
|
@@ -1616,7 +1617,6 @@ export declare const useBreadcrumbsModel: (<TT_Special_Generic>(config?: (Partia
|
|
|
1616
1617
|
nonInteractiveIds: string[];
|
|
1617
1618
|
orientation: import("../../../collection/lib/useBaseListModel").Orientation;
|
|
1618
1619
|
defaultItemHeight: number;
|
|
1619
|
-
shouldVirtualize: boolean;
|
|
1620
1620
|
items: any[];
|
|
1621
1621
|
}>;
|
|
1622
1622
|
initialHiddenIds: string[];
|
|
@@ -8,9 +8,11 @@ export * from './lib/useListRenderItem';
|
|
|
8
8
|
export * from './lib/useListResetCursorOnBlur';
|
|
9
9
|
export * from './lib/useListItemRovingFocus';
|
|
10
10
|
export * from './lib/useListItemSelect';
|
|
11
|
+
export * from './lib/useListKeyboardHandler';
|
|
11
12
|
export * from './lib/useListLoader';
|
|
12
13
|
export * from './lib/useListModel';
|
|
13
14
|
export * from './lib/useGridModel';
|
|
15
|
+
export * from './lib/useListActiveDescendant';
|
|
14
16
|
export * from './lib/useListItemAllowChildStrings';
|
|
15
17
|
export { ListBox, ListBoxProps } from './lib/ListBox';
|
|
16
18
|
export { singleSelectionManager, multiSelectionManager, isSelected, } from './lib/useSelectionListModel';
|
|
@@ -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,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,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,EACL,sBAAsB,EACtB,qBAAqB,EACrB,UAAU,GACX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAC,yBAAyB,EAAE,iBAAiB,EAAC,MAAM,0BAA0B,CAAC"}
|
|
@@ -22,9 +22,11 @@ __exportStar(require("./lib/useListRenderItem"), exports);
|
|
|
22
22
|
__exportStar(require("./lib/useListResetCursorOnBlur"), exports);
|
|
23
23
|
__exportStar(require("./lib/useListItemRovingFocus"), exports);
|
|
24
24
|
__exportStar(require("./lib/useListItemSelect"), exports);
|
|
25
|
+
__exportStar(require("./lib/useListKeyboardHandler"), exports);
|
|
25
26
|
__exportStar(require("./lib/useListLoader"), exports);
|
|
26
27
|
__exportStar(require("./lib/useListModel"), exports);
|
|
27
28
|
__exportStar(require("./lib/useGridModel"), exports);
|
|
29
|
+
__exportStar(require("./lib/useListActiveDescendant"), exports);
|
|
28
30
|
__exportStar(require("./lib/useListItemAllowChildStrings"), exports);
|
|
29
31
|
var ListBox_1 = require("./lib/ListBox");
|
|
30
32
|
Object.defineProperty(exports, "ListBox", { enumerable: true, get: function () { return ListBox_1.ListBox; } });
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { Flex } from '@workday/canvas-kit-react/layout';
|
|
4
|
+
export interface ListBoxProps<T = any> extends Omit<ExtractProps<typeof Flex, never>, 'children'> {
|
|
5
|
+
children?: React.ReactNode | ((item: T, index: number) => React.ReactNode);
|
|
5
6
|
}
|
|
6
|
-
export declare const ListBoxItem: import("@workday/canvas-kit-react/common").ElementComponentM<"li", BoxProps, {
|
|
7
|
+
export declare const ListBoxItem: import("@workday/canvas-kit-react/common").ElementComponentM<"li", Omit<import("@workday/canvas-kit-react/layout").BoxProps, "display"> & import("@workday/canvas-kit-react/layout").FlexStyleProps, {
|
|
7
8
|
state: {
|
|
8
9
|
selectedIds: string[] | "all";
|
|
9
10
|
unselectedIds: string[];
|
|
@@ -145,7 +146,7 @@ export declare const useListBox: import("@workday/canvas-kit-react/common").Beha
|
|
|
145
146
|
* - Inner Box: The element responsible for the virtual container. Height is controlled by the model
|
|
146
147
|
* and cannot be changed by the developer. All props and ref will be spread to this element.
|
|
147
148
|
*/
|
|
148
|
-
export declare const ListBox: import("@workday/canvas-kit-react/common").ElementComponentM<"ul", ListBoxProps & Partial<{
|
|
149
|
+
export declare const ListBox: import("@workday/canvas-kit-react/common").ElementComponentM<"ul", ListBoxProps<any> & Partial<{
|
|
149
150
|
initialSelectedIds: import("./useSelectionListModel").SelectedIds;
|
|
150
151
|
initialUnselectedIds: string[];
|
|
151
152
|
selection: import("./useSelectionListModel").SelectionManager;
|
|
@@ -1104,7 +1105,7 @@ export declare const ListBox: import("@workday/canvas-kit-react/common").Element
|
|
|
1104
1105
|
* functionality. `elemPropsHook` is provided on all compound components and is useful in the
|
|
1105
1106
|
* example to add additional functionality without making a new component.
|
|
1106
1107
|
*/
|
|
1107
|
-
Item: import("@workday/canvas-kit-react/common").ElementComponentM<"li", BoxProps, {
|
|
1108
|
+
Item: import("@workday/canvas-kit-react/common").ElementComponentM<"li", Omit<import("@workday/canvas-kit-react/layout").BoxProps, "display"> & import("@workday/canvas-kit-react/layout").FlexStyleProps, {
|
|
1108
1109
|
state: {
|
|
1109
1110
|
selectedIds: string[] | "all";
|
|
1110
1111
|
unselectedIds: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListBox.d.ts","sourceRoot":"","sources":["../../../../collection/lib/ListBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ListBox.d.ts","sourceRoot":"","sources":["../../../../collection/lib/ListBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIL,YAAY,EACb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAM,IAAI,EAAC,MAAM,kCAAkC,CAAC;AAM3D,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,IAAI,CAAC,YAAY,CAAC,OAAO,IAAI,EAAE,KAAK,CAAC,EAAE,UAAU,CAAC;IAC/F,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;CAC5E;AAED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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKhB;;;;;;;;OAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoBL,CAAC"}
|
|
@@ -58,8 +58,10 @@ exports.ListBox = common_1.createContainer('ul')({
|
|
|
58
58
|
*/
|
|
59
59
|
Item: exports.ListBoxItem,
|
|
60
60
|
},
|
|
61
|
-
})(({ height, maxHeight, ...elemProps }, Element, model) => {
|
|
61
|
+
})(({ height, maxHeight, marginY, ...elemProps }, Element, model) => {
|
|
62
|
+
// We're moving `marginY` to the container to not interfere with the virtualization size. We set
|
|
63
|
+
// the `marginY` on the Flex to `0` to avoid inaccurate scrollbars
|
|
62
64
|
// TODO figure out what style props should go to which `Box`
|
|
63
|
-
return (react_1.default.createElement(layout_1.Box, { ref: model.state.containerRef,
|
|
64
|
-
react_1.default.createElement(layout_1.
|
|
65
|
+
return (react_1.default.createElement(layout_1.Box, { ref: model.state.containerRef, marginY: marginY, maxHeight: maxHeight, overflowY: model.state.orientation === 'vertical' ? 'auto' : undefined },
|
|
66
|
+
react_1.default.createElement(layout_1.Flex, Object.assign({ as: Element, flexDirection: "column" }, elemProps, { marginY: 0 }), useListRenderItem_1.useListRenderItems(model, elemProps.children))));
|
|
65
67
|
});
|
|
@@ -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,MAA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8
8
|
const react_virtual_1 = require("./react-virtual");
|
|
9
9
|
const common_1 = require("@workday/canvas-kit-react/common");
|
|
10
10
|
const defaultGetId = (item) => {
|
|
11
|
-
return item.id || '';
|
|
11
|
+
return typeof item === 'string' ? item : item.id || '';
|
|
12
12
|
};
|
|
13
13
|
exports.defaultGetId = defaultGetId;
|
|
14
14
|
const defaultGetTextValue = (item) => {
|
|
15
|
-
return item.text || '';
|
|
15
|
+
return typeof item === 'string' ? item : item.text || '';
|
|
16
16
|
};
|
|
17
17
|
exports.defaultGetTextValue = defaultGetTextValue;
|
|
18
18
|
// interface Collection<T> {
|
|
@@ -62,13 +62,13 @@ exports.useBaseListModel = common_1.createModelHook({
|
|
|
62
62
|
* JSX, the list will create an internal array of items where `id` is the only property and the
|
|
63
63
|
* default `getId` will return the desired result.
|
|
64
64
|
*/
|
|
65
|
-
getId: (item) => item.id,
|
|
65
|
+
getId: (item) => typeof item === 'string' ? item : item === undefined ? '' : item.id,
|
|
66
66
|
/**
|
|
67
67
|
* Optional function to return the text representation of an item. If not provided, the default
|
|
68
68
|
* function will return the `text` property of the object of each item or an empty string if
|
|
69
69
|
* there is no `text` property. If you did not provide `items`, do not override this function.
|
|
70
70
|
*/
|
|
71
|
-
getTextValue: (item) => (item.text || ''),
|
|
71
|
+
getTextValue: (item) => (typeof item === 'string' ? item : item === undefined ? '' : item.text || ''),
|
|
72
72
|
/**
|
|
73
73
|
* Array of all ids which are currently disabled. This is used for navigation to skip over items
|
|
74
74
|
* which are not focusable.
|
|
@@ -139,23 +139,6 @@ export declare const useCursorListModel: (<TT_Special_Generic>(config?: (Partial
|
|
|
139
139
|
pageSize: number;
|
|
140
140
|
id: string;
|
|
141
141
|
getId: (item: any) => string;
|
|
142
|
-
/**
|
|
143
|
-
* Factory function that does type checking to create navigation managers. Navigation managers
|
|
144
|
-
* are expected to handle all methods of a grid. If your use-case isn't meant to handle a grid,
|
|
145
|
-
* pick one of the existing navigation managers and override the methods you wish to implement.
|
|
146
|
-
*
|
|
147
|
-
* For example,
|
|
148
|
-
* ```tsx
|
|
149
|
-
* import {createNavigationManager, wrappingNavigationManager} from '@workday/canvas-kit-react/collection'
|
|
150
|
-
*
|
|
151
|
-
* const navigationManager = createNavigationManager({
|
|
152
|
-
* ...wrappingNavigationManager,
|
|
153
|
-
* getNext(id, {state}) {
|
|
154
|
-
* //
|
|
155
|
-
* }
|
|
156
|
-
* })
|
|
157
|
-
* ```
|
|
158
|
-
*/
|
|
159
142
|
getTextValue: (item: any) => string;
|
|
160
143
|
nonInteractiveIds: string[];
|
|
161
144
|
orientation: import("./useBaseListModel").Orientation;
|
|
@@ -1425,23 +1408,6 @@ export declare const useCursorListModel: (<TT_Special_Generic>(config?: (Partial
|
|
|
1425
1408
|
pageSize: number;
|
|
1426
1409
|
id: string;
|
|
1427
1410
|
getId: (item: any) => string;
|
|
1428
|
-
/**
|
|
1429
|
-
* Factory function that does type checking to create navigation managers. Navigation managers
|
|
1430
|
-
* are expected to handle all methods of a grid. If your use-case isn't meant to handle a grid,
|
|
1431
|
-
* pick one of the existing navigation managers and override the methods you wish to implement.
|
|
1432
|
-
*
|
|
1433
|
-
* For example,
|
|
1434
|
-
* ```tsx
|
|
1435
|
-
* import {createNavigationManager, wrappingNavigationManager} from '@workday/canvas-kit-react/collection'
|
|
1436
|
-
*
|
|
1437
|
-
* const navigationManager = createNavigationManager({
|
|
1438
|
-
* ...wrappingNavigationManager,
|
|
1439
|
-
* getNext(id, {state}) {
|
|
1440
|
-
* //
|
|
1441
|
-
* }
|
|
1442
|
-
* })
|
|
1443
|
-
* ```
|
|
1444
|
-
*/
|
|
1445
1411
|
getTextValue: (item: any) => string;
|
|
1446
1412
|
nonInteractiveIds: string[];
|
|
1447
1413
|
orientation: import("./useBaseListModel").Orientation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCursorListModel.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useCursorListModel.tsx"],"names":[],"mappings":"AAAA,OAAO,K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G;;QAEH;;;WAGG;;QAEH;;;;;;WAMG;;8BArCyD,MAAM;;;;;;;;;;;;;;;;;;;QA2ClE,mEAAmE;mBACxD;YAAC,EAAE,EAAE,MAAM,CAAA;SAAC;QAIvB;;;;;WAKG;;QAKH;;;WAGG;;QAKH;;;;;WAKG;;QAOH;;;;;WAKG;;QAKH,mDAAmD;;QAKnD,kDAAkD;;;;;;;;;;;;;;;;;;;EA0BpD,CAAC"}
|
|
@@ -135,7 +135,7 @@ const getWrappingOffsetItem = (offset) => (index, { state }, tries = state.items
|
|
|
135
135
|
nextIndex = nextIndex - idealLength;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
if (state.nonInteractiveIds.includes(items[nextIndex].id) && tries > 0) {
|
|
138
|
+
if (items.length > 1 && state.nonInteractiveIds.includes(items[nextIndex].id) && tries > 0) {
|
|
139
139
|
// The next item is disabled, try again, but only if we haven't already tried everything.
|
|
140
140
|
// Avoid an infinite loop with `tries`
|
|
141
141
|
return exports.getWrappingOffsetItem(offset)(nextIndex, { state }, tries - 1);
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This elemProps hook is used for cursor navigation by using [Active
|
|
3
|
+
* Descendant](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_focus_activedescendant).
|
|
4
|
+
* `aria-activedescendant` tells assistive technology which element has "focus" within the component
|
|
5
|
+
* while this single element maintains focus.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* const useMyItem = composeHooks(
|
|
9
|
+
* useListActiveDescendant, // adds `aria-activedescendant` support
|
|
10
|
+
* useListItemRegister
|
|
11
|
+
* );
|
|
12
|
+
```
|
|
13
|
+
*/
|
|
14
|
+
export declare const useListActiveDescendant: import("@workday/canvas-kit-react/common").BehaviorHook<{
|
|
15
|
+
state: {
|
|
16
|
+
cursorId: string;
|
|
17
|
+
columnCount: number;
|
|
18
|
+
pageSizeRef: import("react").MutableRefObject<number>;
|
|
19
|
+
cursorIndexRef: {
|
|
20
|
+
readonly current: number;
|
|
21
|
+
};
|
|
22
|
+
UNSTABLE_virtual: {
|
|
23
|
+
virtualItems: import("./react-virtual").VirtualItem[];
|
|
24
|
+
totalSize: number;
|
|
25
|
+
scrollToOffset: (index: number, options?: import("./react-virtual").ScrollToOffsetOptions | undefined) => void;
|
|
26
|
+
scrollToIndex: (index: number, options?: import("./react-virtual").ScrollToIndexOptions | undefined) => void;
|
|
27
|
+
measure: () => void;
|
|
28
|
+
};
|
|
29
|
+
UNSTABLE_defaultItemHeight: number;
|
|
30
|
+
containerRef: import("react").RefObject<HTMLDivElement>;
|
|
31
|
+
id: string;
|
|
32
|
+
orientation: "horizontal" | "vertical";
|
|
33
|
+
indexRef: import("react").MutableRefObject<number>;
|
|
34
|
+
nonInteractiveIds: string[];
|
|
35
|
+
isVirtualized: boolean;
|
|
36
|
+
items: import("./useBaseListModel").Item<any>[];
|
|
37
|
+
};
|
|
38
|
+
events: {
|
|
39
|
+
goTo(data: {
|
|
40
|
+
id: string;
|
|
41
|
+
}): void;
|
|
42
|
+
goToNext(): void;
|
|
43
|
+
goToPrevious(): void;
|
|
44
|
+
goToPreviousRow(): void;
|
|
45
|
+
goToNextRow(): void;
|
|
46
|
+
goToFirst(): void;
|
|
47
|
+
goToLast(): void;
|
|
48
|
+
goToFirstOfRow(): void;
|
|
49
|
+
goToLastOfRow(): void;
|
|
50
|
+
goToNextPage(): void;
|
|
51
|
+
goToPreviousPage(): void;
|
|
52
|
+
registerItem(data: {
|
|
53
|
+
item: any;
|
|
54
|
+
textValue: string;
|
|
55
|
+
}): void;
|
|
56
|
+
unregisterItem(data: {
|
|
57
|
+
id: string;
|
|
58
|
+
}): void;
|
|
59
|
+
updateItemHeight(data: {
|
|
60
|
+
value: number;
|
|
61
|
+
}): void;
|
|
62
|
+
};
|
|
63
|
+
navigation: import("./useCursorListModel").NavigationManager;
|
|
64
|
+
getId: (item: any) => string;
|
|
65
|
+
}, {
|
|
66
|
+
'aria-activedescendant': string | undefined;
|
|
67
|
+
}>;
|
|
68
|
+
//# sourceMappingURL=useListActiveDescendant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useListActiveDescendant.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useListActiveDescendant.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMlC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useListActiveDescendant = void 0;
|
|
4
|
+
const common_1 = require("@workday/canvas-kit-react/common");
|
|
5
|
+
const useCursorListModel_1 = require("./useCursorListModel");
|
|
6
|
+
/**
|
|
7
|
+
* This elemProps hook is used for cursor navigation by using [Active
|
|
8
|
+
* Descendant](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_focus_activedescendant).
|
|
9
|
+
* `aria-activedescendant` tells assistive technology which element has "focus" within the component
|
|
10
|
+
* while this single element maintains focus.
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* const useMyItem = composeHooks(
|
|
14
|
+
* useListActiveDescendant, // adds `aria-activedescendant` support
|
|
15
|
+
* useListItemRegister
|
|
16
|
+
* );
|
|
17
|
+
```
|
|
18
|
+
*/
|
|
19
|
+
exports.useListActiveDescendant = common_1.createElemPropsHook(useCursorListModel_1.useCursorListModel)(model => {
|
|
20
|
+
return {
|
|
21
|
+
'aria-activedescendant': model.state.cursorId
|
|
22
|
+
? common_1.slugify(`${model.state.id}-${model.state.cursorId}`)
|
|
23
|
+
: undefined,
|
|
24
|
+
};
|
|
25
|
+
});
|
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
* attribute if one hasn't been defined by the application.
|
|
6
6
|
*
|
|
7
7
|
* An example might look like:
|
|
8
|
+
*
|
|
8
9
|
* ```tsx
|
|
9
10
|
* const useMyListItem = composeHooks(
|
|
10
11
|
* // any other hooks here
|
|
11
12
|
* useListItemSelect,
|
|
12
13
|
* useListItemRegister,
|
|
13
|
-
* useListItemAllowChildStrings
|
|
14
|
+
* useListItemAllowChildStrings // always the last in the list
|
|
14
15
|
* )
|
|
15
16
|
*
|
|
16
17
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useListItemAllowChildStrings.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useListItemAllowChildStrings.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"useListItemAllowChildStrings.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useListItemAllowChildStrings.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASxC,CAAC"}
|
|
@@ -10,12 +10,13 @@ const collection_1 = require("@workday/canvas-kit-react/collection");
|
|
|
10
10
|
* attribute if one hasn't been defined by the application.
|
|
11
11
|
*
|
|
12
12
|
* An example might look like:
|
|
13
|
+
*
|
|
13
14
|
* ```tsx
|
|
14
15
|
* const useMyListItem = composeHooks(
|
|
15
16
|
* // any other hooks here
|
|
16
17
|
* useListItemSelect,
|
|
17
18
|
* useListItemRegister,
|
|
18
|
-
* useListItemAllowChildStrings
|
|
19
|
+
* useListItemAllowChildStrings // always the last in the list
|
|
19
20
|
* )
|
|
20
21
|
*
|
|
21
22
|
*
|