@fluentui/react-list 9.6.18 → 9.7.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +30 -2
  2. package/dist/index.d.cts +119 -15
  3. package/dist/index.d.ts +119 -15
  4. package/lib/List.js +1 -1
  5. package/lib/List.js.map +1 -1
  6. package/lib/ListItem.js +1 -1
  7. package/lib/ListItem.js.map +1 -1
  8. package/lib/components/List/index.js +3 -1
  9. package/lib/components/List/index.js.map +1 -1
  10. package/lib/components/List/useList.js +51 -12
  11. package/lib/components/List/useList.js.map +1 -1
  12. package/lib/components/ListItem/ListItem.types.js +1 -1
  13. package/lib/components/ListItem/ListItem.types.js.map +1 -1
  14. package/lib/components/ListItem/index.js +1 -1
  15. package/lib/components/ListItem/index.js.map +1 -1
  16. package/lib/components/ListItem/useListItem.js +108 -50
  17. package/lib/components/ListItem/useListItem.js.map +1 -1
  18. package/lib/events/ListItemActionEvent.js.map +1 -1
  19. package/lib/index.js +3 -2
  20. package/lib/index.js.map +1 -1
  21. package/lib/utils/index.js +1 -0
  22. package/lib/utils/index.js.map +1 -1
  23. package/lib/utils/validateListItemElement.js +17 -0
  24. package/lib/utils/validateListItemElement.js.map +1 -0
  25. package/lib-commonjs/List.cjs +12 -0
  26. package/lib-commonjs/List.cjs.map +1 -1
  27. package/lib-commonjs/ListItem.cjs +3 -0
  28. package/lib-commonjs/ListItem.cjs.map +1 -1
  29. package/lib-commonjs/components/List/index.cjs +14 -0
  30. package/lib-commonjs/components/List/index.cjs.map +1 -1
  31. package/lib-commonjs/components/List/useList.cjs +53 -14
  32. package/lib-commonjs/components/List/useList.cjs.map +1 -1
  33. package/lib-commonjs/components/ListItem/ListItem.types.cjs +1 -1
  34. package/lib-commonjs/components/ListItem/ListItem.types.cjs.map +1 -1
  35. package/lib-commonjs/components/ListItem/index.cjs +3 -0
  36. package/lib-commonjs/components/ListItem/index.cjs.map +1 -1
  37. package/lib-commonjs/components/ListItem/useListItem.cjs +109 -52
  38. package/lib-commonjs/components/ListItem/useListItem.cjs.map +1 -1
  39. package/lib-commonjs/events/ListItemActionEvent.cjs.map +1 -1
  40. package/lib-commonjs/index.cjs +34 -0
  41. package/lib-commonjs/index.cjs.map +1 -1
  42. package/lib-commonjs/utils/index.cjs +4 -0
  43. package/lib-commonjs/utils/index.cjs.map +1 -1
  44. package/lib-commonjs/utils/validateListItemElement.cjs +22 -0
  45. package/lib-commonjs/utils/validateListItemElement.cjs.map +1 -0
  46. package/package.json +13 -10
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/List/useList.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport type { OnSelectionChangeData } from '@fluentui/react-utilities';\nimport { getIntrinsicElementProps, slot, useControllableState, useEventCallback } from '@fluentui/react-utilities';\nimport { useArrowNavigationGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport type { ListProps, ListState } from './List.types';\nimport { useListSelection } from '../../hooks/useListSelection';\nimport {\n calculateListItemRoleForListRole,\n calculateListRole,\n validateGridCellsArePresent,\n validateProperElementTypes,\n validateProperRolesAreUsed,\n} from '../../utils';\n\nconst DEFAULT_ROOT_EL_TYPE = 'ul';\n\n/**\n * Create the state required to render List.\n *\n * The returned state can be modified with hooks such as useListStyles_unstable,\n * before being passed to renderList_unstable.\n *\n * @param props - props from this instance of List\n * @param ref - reference to root HTMLElement of List\n */\nexport const useList_unstable = (\n props: ListProps,\n ref: React.Ref<HTMLDivElement | HTMLUListElement | HTMLOListElement>,\n): ListState => {\n const { navigationMode, selectionMode, selectedItems, defaultSelectedItems, onSelectionChange } = props;\n\n const as = props.as || navigationMode === 'composite' ? 'div' : DEFAULT_ROOT_EL_TYPE;\n\n const arrowNavigationAttributes = useArrowNavigationGroup({\n axis: 'vertical',\n memorizeCurrent: true,\n });\n\n const [selectionState, setSelectionState] = useControllableState({\n state: selectedItems,\n defaultState: defaultSelectedItems,\n initialState: [],\n });\n\n const onChange = useEventCallback((e: React.SyntheticEvent, data: OnSelectionChangeData) => {\n const selectedItemsAsArray = Array.from(data.selectedItems);\n setSelectionState(selectedItemsAsArray);\n onSelectionChange?.(e, { event: e, type: 'change', selectedItems: selectedItemsAsArray });\n });\n\n const selection = useListSelection({\n onSelectionChange: onChange,\n selectionMode: selectionMode || 'multiselect',\n selectedItems: selectionState,\n });\n\n const listRole = props.role || calculateListRole(navigationMode, !!selectionMode);\n const listItemRole = calculateListItemRoleForListRole(listRole);\n\n const { findAllFocusable } = useFocusFinders();\n\n const validateListItem = useEventCallback((listItemEl: HTMLElement) => {\n if (process.env.NODE_ENV === 'production') {\n return;\n }\n const itemRole = listItemEl.getAttribute('role') || '';\n const focusable = findAllFocusable(listItemEl);\n validateProperElementTypes(as, listItemEl.tagName.toLocaleLowerCase());\n validateProperRolesAreUsed(listRole, itemRole, !!selectionMode, focusable.length > 0);\n validateGridCellsArePresent(listRole, listItemEl);\n });\n\n return {\n components: {\n root: as,\n },\n root: slot.always(\n getIntrinsicElementProps(as, {\n ref,\n role: listRole,\n ...(selectionMode && {\n 'aria-multiselectable': selectionMode === 'multiselect' ? true : undefined,\n }),\n ...arrowNavigationAttributes,\n ...props,\n }),\n { elementType: as },\n ),\n listItemRole,\n validateListItem,\n navigationMode,\n // only pass down selection state if its handled internally, otherwise just report the events\n selection: selectionMode ? selection : undefined,\n };\n};\n"],"names":["getIntrinsicElementProps","slot","useControllableState","useEventCallback","useArrowNavigationGroup","useFocusFinders","useListSelection","calculateListItemRoleForListRole","calculateListRole","validateGridCellsArePresent","validateProperElementTypes","validateProperRolesAreUsed","DEFAULT_ROOT_EL_TYPE","useList_unstable","props","ref","navigationMode","selectionMode","selectedItems","defaultSelectedItems","onSelectionChange","as","arrowNavigationAttributes","axis","memorizeCurrent","selectionState","setSelectionState","state","defaultState","initialState","onChange","e","data","selectedItemsAsArray","Array","from","event","type","selection","listRole","role","listItemRole","findAllFocusable","validateListItem","listItemEl","process","env","NODE_ENV","itemRole","getAttribute","focusable","tagName","toLocaleLowerCase","length","components","root","always","undefined","elementType"],"mappings":"AAAA;AAIA,SAASA,wBAAwB,EAAEC,IAAI,EAAEC,oBAAoB,EAAEC,gBAAgB,QAAQ,4BAA4B;AACnH,SAASC,uBAAuB,EAAEC,eAAe,QAAQ,0BAA0B;AAEnF,SAASC,gBAAgB,QAAQ,kCAA+B;AAChE,SACEC,gCAAgC,EAChCC,iBAAiB,EACjBC,2BAA2B,EAC3BC,0BAA0B,EAC1BC,0BAA0B,QACrB,uBAAc;AAErB,MAAMC,uBAAuB;AAE7B;;;;;;;;CAQC,GACD,OAAO,MAAMC,mBAAmB,CAC9BC,OACAC;IAEA,MAAM,EAAEC,cAAc,EAAEC,aAAa,EAAEC,aAAa,EAAEC,oBAAoB,EAAEC,iBAAiB,EAAE,GAAGN;IAElG,MAAMO,KAAKP,MAAMO,EAAE,IAAIL,mBAAmB,cAAc,QAAQJ;IAEhE,MAAMU,4BAA4BlB,wBAAwB;QACxDmB,MAAM;QACNC,iBAAiB;IACnB;IAEA,MAAM,CAACC,gBAAgBC,kBAAkB,GAAGxB,qBAAqB;QAC/DyB,OAAOT;QACPU,cAAcT;QACdU,cAAc,EAAE;IAClB;IAEA,MAAMC,WAAW3B,iBAAiB,CAAC4B,GAAyBC;QAC1D,MAAMC,uBAAuBC,MAAMC,IAAI,CAACH,KAAKd,aAAa;QAC1DQ,kBAAkBO;QAClBb,8BAAAA,wCAAAA,kBAAoBW,GAAG;YAAEK,OAAOL;YAAGM,MAAM;YAAUnB,eAAee;QAAqB;IACzF;IAEA,MAAMK,YAAYhC,iBAAiB;QACjCc,mBAAmBU;QACnBb,eAAeA,iBAAiB;QAChCC,eAAeO;IACjB;IAEA,MAAMc,WAAWzB,MAAM0B,IAAI,IAAIhC,kBAAkBQ,gBAAgB,CAAC,CAACC;IACnE,MAAMwB,eAAelC,iCAAiCgC;IAEtD,MAAM,EAAEG,gBAAgB,EAAE,GAAGrC;IAE7B,MAAMsC,mBAAmBxC,iBAAiB,CAACyC;QACzC,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YACzC;QACF;QACA,MAAMC,WAAWJ,WAAWK,YAAY,CAAC,WAAW;QACpD,MAAMC,YAAYR,iBAAiBE;QACnClC,2BAA2BW,IAAIuB,WAAWO,OAAO,CAACC,iBAAiB;QACnEzC,2BAA2B4B,UAAUS,UAAU,CAAC,CAAC/B,eAAeiC,UAAUG,MAAM,GAAG;QACnF5C,4BAA4B8B,UAAUK;IACxC;IAEA,OAAO;QACLU,YAAY;YACVC,MAAMlC;QACR;QACAkC,MAAMtD,KAAKuD,MAAM,CACfxD,yBAAyBqB,IAAI;YAC3BN;YACAyB,MAAMD;YACN,GAAItB,iBAAiB;gBACnB,wBAAwBA,kBAAkB,gBAAgB,OAAOwC;YACnE,CAAC;YACD,GAAGnC,yBAAyB;YAC5B,GAAGR,KAAK;QACV,IACA;YAAE4C,aAAarC;QAAG;QAEpBoB;QACAE;QACA3B;QACA,6FAA6F;QAC7FsB,WAAWrB,gBAAgBqB,YAAYmB;IACzC;AACF,EAAE"}
1
+ {"version":3,"sources":["../src/components/List/useList.ts"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport type { OnSelectionChangeData } from '@fluentui/react-utilities';\nimport { getIntrinsicElementProps, slot, useControllableState, useEventCallback } from '@fluentui/react-utilities';\nimport { useArrowNavigationGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport type { ListProps, ListState } from './List.types';\nimport { useListSelection } from '../../hooks/useListSelection';\nimport { calculateListItemRoleForListRole, calculateListRole, validateListItemElement } from '../../utils';\n\nconst DEFAULT_ROOT_EL_TYPE = 'ul';\n\n/**\n * Plain DOM approximation of Tabster's focus finders, used by the base hook which must stay free of\n * any Tabster runtime.\n */\nconst FOCUSABLE_SELECTOR =\n 'a[href], area[href], button, input, select, textarea, iframe, ' +\n '[contenteditable=\"\"], [contenteditable=\"true\" i], [contenteditable=\"plaintext-only\" i], [tabindex]';\nconst NON_FOCUSABLE_SELECTOR = ':disabled, [hidden], input[type=\"hidden\"], [tabindex^=\"-\"]';\n\n/**\n * Create the state required to render List.\n *\n * The returned state can be modified with hooks such as useListStyles_unstable,\n * before being passed to renderList_unstable.\n *\n * @param props - props from this instance of List\n * @param ref - reference to root HTMLElement of List\n */\nexport const useList_unstable = (\n props: ListProps,\n ref: React.Ref<HTMLDivElement | HTMLUListElement | HTMLOListElement>,\n): ListState => {\n const state = useListBase_unstable(props, ref);\n\n const { navigationMode, selectionMode } = props;\n const as = props.as || (navigationMode === 'composite' ? 'div' : DEFAULT_ROOT_EL_TYPE);\n const listRole = props.role || calculateListRole(navigationMode, !!selectionMode);\n\n const arrowNavigationAttributes = useArrowNavigationGroup({\n axis: 'vertical',\n memorizeCurrent: true,\n });\n\n const { findAllFocusable } = useFocusFinders();\n\n const validateListItem = useEventCallback((listItemEl: HTMLElement) => {\n if (process.env.NODE_ENV === 'production') {\n return;\n }\n\n validateListItemElement(listItemEl, {\n listRenderedAs: as,\n listRole,\n hasSelection: !!selectionMode,\n hasFocusableChildren: findAllFocusable(listItemEl).length > 0,\n });\n });\n\n return {\n ...state,\n validateListItem,\n // Consumer props keep winning over the navigation attributes, matching the base slot ordering.\n root: { ...arrowNavigationAttributes, ...state.root },\n };\n};\n\n/**\n * Base state hook for List, free of any focus or keyboard navigation runtime.\n *\n * Arrow key navigation is layered on by the wrapping `useList_unstable` hook, so consumers of this\n * hook are expected to bring their own focus management.\n *\n * @param props - props from this instance of List\n * @param ref - reference to root HTMLElement of List\n */\nexport const useListBase_unstable = (\n props: ListProps,\n ref: React.Ref<HTMLDivElement | HTMLUListElement | HTMLOListElement>,\n): ListState => {\n const { navigationMode, selectionMode, selectedItems, defaultSelectedItems, onSelectionChange } = props;\n\n const as = props.as || (navigationMode === 'composite' ? 'div' : DEFAULT_ROOT_EL_TYPE);\n\n const [selectionState, setSelectionState] = useControllableState({\n state: selectedItems,\n defaultState: defaultSelectedItems,\n initialState: [],\n });\n\n const onChange = useEventCallback((e: React.SyntheticEvent, data: OnSelectionChangeData) => {\n const selectedItemsAsArray = Array.from(data.selectedItems);\n setSelectionState(selectedItemsAsArray);\n onSelectionChange?.(e, { event: e, type: 'change', selectedItems: selectedItemsAsArray });\n });\n\n const selection = useListSelection({\n onSelectionChange: onChange,\n selectionMode: selectionMode || 'multiselect',\n selectedItems: selectionState,\n });\n\n const listRole = props.role || calculateListRole(navigationMode, !!selectionMode);\n const listItemRole = calculateListItemRoleForListRole(listRole);\n\n const validateListItem = useEventCallback((listItemEl: HTMLElement) => {\n if (process.env.NODE_ENV === 'production') {\n return;\n }\n\n validateListItemElement(listItemEl, {\n listRenderedAs: as,\n listRole,\n hasSelection: !!selectionMode,\n hasFocusableChildren: Array.from(listItemEl.querySelectorAll(FOCUSABLE_SELECTOR)).some(\n element => !element.matches(NON_FOCUSABLE_SELECTOR),\n ),\n });\n });\n\n return {\n components: {\n root: as,\n },\n root: slot.always(\n getIntrinsicElementProps(as, {\n ref,\n ...(selectionMode && {\n 'aria-multiselectable': selectionMode === 'multiselect' ? true : undefined,\n }),\n ...props,\n role: listRole,\n }),\n { elementType: as },\n ),\n listItemRole,\n validateListItem,\n navigationMode,\n // only pass down selection state if its handled internally, otherwise just report the events\n selection: selectionMode ? selection : undefined,\n };\n};\n"],"names":["getIntrinsicElementProps","slot","useControllableState","useEventCallback","useArrowNavigationGroup","useFocusFinders","useListSelection","calculateListItemRoleForListRole","calculateListRole","validateListItemElement","DEFAULT_ROOT_EL_TYPE","FOCUSABLE_SELECTOR","NON_FOCUSABLE_SELECTOR","useList_unstable","props","ref","state","useListBase_unstable","navigationMode","selectionMode","as","listRole","role","arrowNavigationAttributes","axis","memorizeCurrent","findAllFocusable","validateListItem","listItemEl","process","env","NODE_ENV","listRenderedAs","hasSelection","hasFocusableChildren","length","root","selectedItems","defaultSelectedItems","onSelectionChange","selectionState","setSelectionState","defaultState","initialState","onChange","e","data","selectedItemsAsArray","Array","from","event","type","selection","listItemRole","querySelect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,aAAazC;QAAG;QAEpBiC;QACA1B;QACAT;QACA,6FAA6F;QAC7FkC,WAAWjC,gBAAgBiC,YAAYQ;IACzC;AACF,EAAE"}
@@ -1,3 +1,3 @@
1
1
  /**
2
- * State used in rendering ListItem
2
+ * State returned by `useListItemBase_unstable`.
3
3
  */ export { };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/ListItem/ListItem.types.ts"],"sourcesContent":["import type { Checkbox } from '@fluentui/react-checkbox';\nimport type { ComponentProps, ComponentState, EventData, EventHandler, Slot } from '@fluentui/react-utilities';\nimport type { ListItemActionEvent, ListItemActionEventName } from '../../events/ListItemActionEvent';\n\nexport type ListItemSlots = {\n root: NonNullable<Slot<'li', 'div'>>;\n checkmark?: Slot<typeof Checkbox>;\n};\n\nexport type ListItemValue = string | number;\n\nexport type ListItemActionEventData = EventData<typeof ListItemActionEventName, ListItemActionEvent> & {\n value: ListItemValue;\n};\n/**\n * ListItem Props\n */\nexport type ListItemProps = ComponentProps<ListItemSlots> & {\n value?: ListItemValue;\n onAction?: EventHandler<ListItemActionEventData>;\n disabledSelection?: boolean;\n};\n\n/**\n * State used in rendering ListItem\n */\nexport type ListItemState = ComponentState<ListItemSlots> & {\n selectable: boolean;\n navigable: boolean;\n disabled?: boolean;\n};\n"],"names":[],"mappings":"AAuBA;;CAEC,GACD,WAIE"}
1
+ {"version":3,"sources":["../src/components/ListItem/ListItem.types.ts"],"sourcesContent":["import type * as React from 'react';\nimport type { Checkbox } from '@fluentui/react-checkbox';\nimport type { ComponentProps, ComponentState, EventData, EventHandler, Slot } from '@fluentui/react-utilities';\n\nexport type ListItemSlots = {\n root: NonNullable<Slot<'li', 'div'>>;\n checkmark?: Slot<typeof Checkbox>;\n};\n\n/**\n * ListItem slots without any design dependency, used by `useListItemBase_unstable`.\n */\nexport type ListItemBaseSlots = {\n root: NonNullable<Slot<'li', 'div'>>;\n checkmark?: Slot<'input'>;\n};\n\nexport type ListItemValue = string | number;\n\nexport type ListItemActionEventData = EventData<\n 'ListItemAction',\n CustomEvent<{ originalEvent: React.MouseEvent | React.KeyboardEvent }>\n> & {\n value: ListItemValue;\n};\n\n/**\n * ListItem Props\n */\nexport type ListItemProps = ComponentProps<ListItemSlots> & {\n value?: ListItemValue;\n onAction?: EventHandler<ListItemActionEventData>;\n disabledSelection?: boolean;\n};\n\n/**\n * ListItem props accepted by `useListItemBase_unstable`.\n */\nexport type ListItemBaseProps = ComponentProps<ListItemBaseSlots> &\n Pick<ListItemProps, 'value' | 'onAction' | 'disabledSelection'>;\n\n/**\n * State used in rendering ListItem\n */\nexport type ListItemState = ComponentState<ListItemSlots> & {\n selectable: boolean;\n navigable: boolean;\n disabled?: boolean;\n};\n\n/**\n * State returned by `useListItemBase_unstable`.\n */\nexport type ListItemBaseState = ComponentState<ListItemBaseSlots> &\n Pick<ListItemState, 'selectable' | 'navigable' | 'disabled'>;\n"],"names":[],"mappings":"AAkDA;;CAEC,GACD,WAC+D"}
@@ -1,4 +1,4 @@
1
1
  export { ListItem } from "./ListItem.js";
2
2
  export { renderListItem_unstable } from "./renderListItem.js";
3
- export { useListItem_unstable } from "./useListItem.js";
3
+ export { useListItem_unstable, useListItemBase_unstable } from "./useListItem.js";
4
4
  export { listItemClassNames, useListItemStyles_unstable } from "./useListItemStyles.styles.js";
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/ListItem/index.ts"],"sourcesContent":["export { ListItem } from './ListItem';\nexport type {\n ListItemActionEventData,\n ListItemProps,\n ListItemSlots,\n ListItemState,\n ListItemValue,\n} from './ListItem.types';\nexport { renderListItem_unstable } from './renderListItem';\nexport { useListItem_unstable } from './useListItem';\nexport { listItemClassNames, useListItemStyles_unstable } from './useListItemStyles.styles';\n"],"names":["ListItem","renderListItem_unstable","useListItem_unstable","listItemClassNames","useListItemStyles_unstable"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAa;AAQtC,SAASC,uBAAuB,QAAQ,sBAAmB;AAC3D,SAASC,oBAAoB,QAAQ,mBAAgB;AACrD,SAASC,kBAAkB,EAAEC,0BAA0B,QAAQ,gCAA6B"}
1
+ {"version":3,"sources":["../src/components/ListItem/index.ts"],"sourcesContent":["export { ListItem } from './ListItem';\nexport type {\n ListItemActionEventData,\n ListItemBaseProps,\n ListItemBaseSlots,\n ListItemBaseState,\n ListItemProps,\n ListItemSlots,\n ListItemState,\n ListItemValue,\n} from './ListItem.types';\nexport { renderListItem_unstable } from './renderListItem';\nexport { useListItem_unstable, useListItemBase_unstable } from './useListItem';\nexport { listItemClassNames, useListItemStyles_unstable } from './useListItemStyles.styles';\n"],"names":["ListItem","renderListItem_unstable","useListItem_unstable","useListItemBase_unstable","listItemClassNames","useListItemStyles_unstable"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAa;AAWtC,SAASC,uBAAuB,QAAQ,sBAAmB;AAC3D,SAASC,oBAAoB,EAAEC,wBAAwB,QAAQ,mBAAgB;AAC/E,SAASC,kBAAkB,EAAEC,0BAA0B,QAAQ,gCAA6B"}
@@ -14,8 +14,108 @@ const DEFAULT_ROOT_EL_TYPE = 'li';
14
14
  * before being passed to renderListItem_unstable.
15
15
  *
16
16
  * @param props - props from this instance of ListItem
17
- * @param ref - reference to root HTMLLIElement | HTMLDivElementof ListItem
17
+ * @param ref - reference to root HTMLLIElement | HTMLDivElement of ListItem
18
18
  */ export const useListItem_unstable = (props, ref)=>{
19
+ var _state_checkmark, _state_checkmark1;
20
+ const { checkmark: checkmarkProp, ...baseProps } = props;
21
+ const state = useListItemBase_unstable({
22
+ ...baseProps,
23
+ // Keep the base ref and event handlers for explicitly rendered Fluent checkmarks.
24
+ checkmark: checkmarkProp === null ? null : checkmarkProp === undefined ? undefined : {}
25
+ }, ref);
26
+ const { navigationMode } = useListSynchronousContext();
27
+ const as = props.as || (navigationMode === 'composite' ? 'div' : DEFAULT_ROOT_EL_TYPE);
28
+ const focusableGroupAttrs = useFocusableGroup({
29
+ ignoreDefaultKeydown: {
30
+ Enter: true
31
+ },
32
+ tabBehavior: 'limited-trap-focus'
33
+ });
34
+ const arrowNavigationAttributes = useArrowNavigationGroup({
35
+ axis: 'horizontal'
36
+ });
37
+ const tabsterAttributes = useMergedTabsterAttributes_unstable(state.navigable ? arrowNavigationAttributes : {}, focusableGroupAttrs, props);
38
+ const baseKeyDown = state.root.onKeyDown;
39
+ const handleKeyDown = useEventCallback((e)=>{
40
+ // Invokes the consumer handler and the base Space/Enter behavior before the Tabster additions.
41
+ baseKeyDown === null || baseKeyDown === void 0 ? void 0 : baseKeyDown(e);
42
+ // If the event is fired from an element inside the list item
43
+ if (e.target !== e.currentTarget) {
44
+ if (e.defaultPrevented || !state.navigable) {
45
+ return;
46
+ }
47
+ // If the items are focusable, we need to handle the arrow keys to move focus to them
48
+ switch(e.key){
49
+ // If it's one of the Arrows defined, jump out of the list item to focus on the ListItem itself
50
+ // The ArrowLeft will only trigger if the target element is the leftmost, otherwise the
51
+ // arrowNavigationAttributes handles it and prevents it from bubbling here.
52
+ case ArrowLeft:
53
+ e.target.dispatchEvent(new GroupperMoveFocusEvent({
54
+ action: GroupperMoveFocusActions.Escape
55
+ }));
56
+ break;
57
+ case ArrowDown:
58
+ case ArrowUp:
59
+ e.preventDefault();
60
+ // Press ESC on the original target to get focus to the parent group (List)
61
+ e.target.dispatchEvent(new GroupperMoveFocusEvent({
62
+ action: GroupperMoveFocusActions.Escape
63
+ }));
64
+ // Now dispatch the original key to move up or down in the list
65
+ e.currentTarget.dispatchEvent(new MoverMoveFocusEvent({
66
+ key: MoverKeys[e.key]
67
+ }));
68
+ }
69
+ return;
70
+ }
71
+ if (e.defaultPrevented) {
72
+ return;
73
+ }
74
+ if (e.key === ArrowRight && navigationMode === 'composite') {
75
+ e.target.dispatchEvent(new GroupperMoveFocusEvent({
76
+ action: GroupperMoveFocusActions.Enter
77
+ }));
78
+ }
79
+ });
80
+ const checkmark = slot.optional(checkmarkProp, {
81
+ defaultProps: {
82
+ checked: (_state_checkmark = state.checkmark) === null || _state_checkmark === void 0 ? void 0 : _state_checkmark.checked,
83
+ tabIndex: -1,
84
+ disabled: props.disabledSelection
85
+ },
86
+ renderByDefault: state.selectable,
87
+ elementType: Checkbox
88
+ });
89
+ const mergedCheckmarkRef = useMergedRefs(checkmark === null || checkmark === void 0 ? void 0 : checkmark.ref, (_state_checkmark1 = state.checkmark) === null || _state_checkmark1 === void 0 ? void 0 : _state_checkmark1.ref);
90
+ if (checkmark) {
91
+ var _state_checkmark2;
92
+ checkmark.onChange = mergeCallbacks(checkmark.onChange, (_state_checkmark2 = state.checkmark) === null || _state_checkmark2 === void 0 ? void 0 : _state_checkmark2.onChange);
93
+ checkmark.ref = mergedCheckmarkRef;
94
+ }
95
+ return {
96
+ ...state,
97
+ components: {
98
+ root: as,
99
+ checkmark: Checkbox
100
+ },
101
+ root: {
102
+ ...state.root,
103
+ ...tabsterAttributes,
104
+ onKeyDown: handleKeyDown
105
+ },
106
+ checkmark
107
+ };
108
+ };
109
+ /**
110
+ * Base state hook for ListItem, free of any focus or keyboard navigation runtime and of the
111
+ * Fluent `Checkbox` used for the selection indicator.
112
+ *
113
+ * The checkmark slot is rendered as a native `input[type="checkbox"]`, and the Tabster driven
114
+ * arrow key handling is layered on by the wrapping `useListItem_unstable` hook.
115
+ *
116
+ * @param props - props from this instance of ListItem
117
+ * @param ref - reference to root HTMLLIElement | HTMLDivElement of ListItem
118
+ */ export const useListItemBase_unstable = (props, ref)=>{
19
119
  const id = useId('listItem');
20
120
  const { value = id, onKeyDown, onClick, tabIndex, role, onAction, disabledSelection } = props;
21
121
  const toggleItem = useListContext_unstable((ctx)=>{
@@ -30,7 +130,7 @@ const DEFAULT_ROOT_EL_TYPE = 'li';
30
130
  return (_ctx_selection = ctx.selection) === null || _ctx_selection === void 0 ? void 0 : _ctx_selection.isSelected(value);
31
131
  })) !== null && _useListContext_unstable !== void 0 ? _useListContext_unstable : false;
32
132
  const validateListItem = useListContext_unstable((ctx)=>ctx.validateListItem);
33
- const as = props.as || navigationMode === 'composite' ? 'div' : DEFAULT_ROOT_EL_TYPE;
133
+ const as = props.as || (navigationMode === 'composite' ? 'div' : DEFAULT_ROOT_EL_TYPE);
34
134
  const finalListItemRole = role || listItemRole;
35
135
  const focusableItems = Boolean(isSelectionModeEnabled || navigationMode || tabIndex === 0);
36
136
  const rootRef = React.useRef(null);
@@ -60,12 +160,6 @@ const DEFAULT_ROOT_EL_TYPE = 'li';
60
160
  handleAction(actionEvent);
61
161
  e.target.dispatchEvent(actionEvent);
62
162
  };
63
- const focusableGroupAttrs = useFocusableGroup({
64
- ignoreDefaultKeydown: {
65
- Enter: true
66
- },
67
- tabBehavior: 'limited-trap-focus'
68
- });
69
163
  const handleClick = useEventCallback((e)=>{
70
164
  onClick === null || onClick === void 0 ? void 0 : onClick(e);
71
165
  if (e.defaultPrevented) {
@@ -82,33 +176,8 @@ const DEFAULT_ROOT_EL_TYPE = 'li';
82
176
  if (e.defaultPrevented) {
83
177
  return;
84
178
  }
85
- // If the event is fired from an element inside the list item
179
+ // Events fired from an element inside the list item are left to the caller's focus management.
86
180
  if (e.target !== e.currentTarget) {
87
- if (focusableItems) {
88
- // If the items are focusable, we need to handle the arrow keys to move focus to them
89
- switch(e.key){
90
- // If it's one of the Arrows defined, jump out of the list item to focus on the ListItem itself
91
- // The ArrowLeft will only trigger if the target element is the leftmost, otherwise the
92
- // arrowNavigationAttributes handles it and prevents it from bubbling here.
93
- case ArrowLeft:
94
- e.target.dispatchEvent(new GroupperMoveFocusEvent({
95
- action: GroupperMoveFocusActions.Escape
96
- }));
97
- break;
98
- case ArrowDown:
99
- case ArrowUp:
100
- e.preventDefault();
101
- // Press ESC on the original target to get focus to the parent group (List)
102
- e.target.dispatchEvent(new GroupperMoveFocusEvent({
103
- action: GroupperMoveFocusActions.Escape
104
- }));
105
- // Now dispatch the original key to move up or down in the list
106
- e.currentTarget.dispatchEvent(new MoverMoveFocusEvent({
107
- key: MoverKeys[e.key]
108
- }));
109
- }
110
- return;
111
- }
112
181
  return;
113
182
  }
114
183
  switch(e.key){
@@ -127,36 +196,24 @@ const DEFAULT_ROOT_EL_TYPE = 'li';
127
196
  case Enter:
128
197
  triggerAction(e);
129
198
  break;
130
- case ArrowRight:
131
- if (navigationMode === 'composite') {
132
- e.target.dispatchEvent(new GroupperMoveFocusEvent({
133
- action: GroupperMoveFocusActions.Enter
134
- }));
135
- }
136
- break;
137
199
  }
138
200
  });
139
- const onCheckboxChange = useEventCallback((e, data)=>{
201
+ const onCheckboxChange = useEventCallback((e)=>{
140
202
  if (!isSelectionModeEnabled || e.defaultPrevented) {
141
203
  return;
142
204
  }
143
205
  toggleItem === null || toggleItem === void 0 ? void 0 : toggleItem(e, value);
144
206
  });
145
- const arrowNavigationAttributes = useArrowNavigationGroup({
146
- axis: 'horizontal'
147
- });
148
- const tabsterAttributes = useMergedTabsterAttributes_unstable(focusableItems ? arrowNavigationAttributes : {}, focusableGroupAttrs, props);
149
207
  const root = slot.always(getIntrinsicElementProps(as, {
150
208
  ref: useMergedRefs(rootRef, ref),
151
209
  tabIndex: focusableItems ? 0 : undefined,
152
- role: finalListItemRole,
153
210
  id: String(value),
154
211
  ...isSelectionModeEnabled && {
155
212
  'aria-selected': isSelected,
156
213
  'aria-disabled': disabledSelection && !onAction || undefined
157
214
  },
158
215
  ...props,
159
- ...tabsterAttributes,
216
+ role: finalListItemRole,
160
217
  onKeyDown: handleKeyDown,
161
218
  onClick: isSelectionModeEnabled || onClick || onAction ? handleClick : undefined
162
219
  }), {
@@ -164,12 +221,13 @@ const DEFAULT_ROOT_EL_TYPE = 'li';
164
221
  });
165
222
  const checkmark = slot.optional(props.checkmark, {
166
223
  defaultProps: {
224
+ type: 'checkbox',
167
225
  checked: isSelected,
168
226
  tabIndex: -1,
169
227
  disabled: disabledSelection
170
228
  },
171
229
  renderByDefault: isSelectionModeEnabled,
172
- elementType: Checkbox
230
+ elementType: 'input'
173
231
  });
174
232
  const mergedCheckmarkRef = useMergedRefs(checkmark === null || checkmark === void 0 ? void 0 : checkmark.ref, checkmarkRef);
175
233
  if (checkmark) {
@@ -179,7 +237,7 @@ const DEFAULT_ROOT_EL_TYPE = 'li';
179
237
  const state = {
180
238
  components: {
181
239
  root: as,
182
- checkmark: Checkbox
240
+ checkmark: 'input'
183
241
  },
184
242
  root,
185
243
  checkmark,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/ListItem/useListItem.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n GroupperMoveFocusEvent,\n MoverMoveFocusEvent,\n GroupperMoveFocusActions,\n MoverKeys,\n useArrowNavigationGroup,\n useFocusableGroup,\n useMergedTabsterAttributes_unstable,\n type TabsterDOMAttribute,\n} from '@fluentui/react-tabster';\nimport {\n elementContains,\n getIntrinsicElementProps,\n mergeCallbacks,\n slot,\n useEventCallback,\n useId,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport type { ListItemProps, ListItemState } from './ListItem.types';\nimport { useListSynchronousContext, useListContext_unstable } from '../List/listContext';\nimport { Enter, Space, ArrowUp, ArrowDown, ArrowRight, ArrowLeft } from '@fluentui/keyboard-keys';\nimport type { CheckboxOnChangeData } from '@fluentui/react-checkbox';\nimport { Checkbox } from '@fluentui/react-checkbox';\nimport type { ListItemActionEvent } from '../../events/ListItemActionEvent';\nimport { createListItemActionEvent, ListItemActionEventName } from '../../events/ListItemActionEvent';\n\nconst DEFAULT_ROOT_EL_TYPE = 'li';\n\n/**\n * Create the state required to render ListItem.\n *\n * The returned state can be modified with hooks such as useListItemStyles_unstable,\n * before being passed to renderListItem_unstable.\n *\n * @param props - props from this instance of ListItem\n * @param ref - reference to root HTMLLIElement | HTMLDivElementof ListItem\n */\nexport const useListItem_unstable = (\n props: ListItemProps,\n ref: React.Ref<HTMLLIElement | HTMLDivElement>,\n): ListItemState => {\n const id = useId('listItem');\n const { value = id, onKeyDown, onClick, tabIndex, role, onAction, disabledSelection } = props;\n\n const toggleItem = useListContext_unstable(ctx => ctx.selection?.toggleItem);\n\n const { navigationMode, listItemRole } = useListSynchronousContext();\n\n const isSelectionModeEnabled = useListContext_unstable(ctx => !!ctx.selection);\n const isSelected = useListContext_unstable(ctx => ctx.selection?.isSelected(value)) ?? false;\n const validateListItem = useListContext_unstable(ctx => ctx.validateListItem);\n\n const as = props.as || navigationMode === 'composite' ? 'div' : DEFAULT_ROOT_EL_TYPE;\n\n const finalListItemRole = role || listItemRole;\n\n const focusableItems = Boolean(isSelectionModeEnabled || navigationMode || tabIndex === 0);\n\n const rootRef = React.useRef<HTMLLIElement | HTMLDivElement>(null);\n const checkmarkRef = React.useRef<HTMLInputElement | null>(null);\n\n const handleAction: (event: ListItemActionEvent) => void = useEventCallback(event => {\n onAction?.(event, { event, value, type: ListItemActionEventName });\n\n if (event.defaultPrevented) {\n return;\n }\n\n if (isSelectionModeEnabled && !disabledSelection) {\n toggleItem?.(event.detail.originalEvent, value);\n }\n });\n\n React.useEffect(() => {\n if (rootRef.current) {\n validateListItem(rootRef.current);\n }\n }, [validateListItem]);\n\n const triggerAction = (e: React.MouseEvent | React.KeyboardEvent) => {\n const actionEvent = createListItemActionEvent(e);\n handleAction(actionEvent);\n e.target.dispatchEvent(actionEvent);\n };\n\n const focusableGroupAttrs = useFocusableGroup({\n ignoreDefaultKeydown: { Enter: true },\n tabBehavior: 'limited-trap-focus',\n });\n\n const handleClick: React.MouseEventHandler<HTMLLIElement & HTMLDivElement> = useEventCallback(e => {\n onClick?.(e);\n\n if (e.defaultPrevented) {\n return;\n }\n\n const isFromCheckbox = elementContains(checkmarkRef.current, e.target as Node);\n if (isFromCheckbox) {\n return;\n }\n\n triggerAction(e);\n });\n\n const handleKeyDown: React.KeyboardEventHandler<HTMLLIElement & HTMLDivElement> = useEventCallback(e => {\n onKeyDown?.(e);\n\n if (e.defaultPrevented) {\n return;\n }\n\n // If the event is fired from an element inside the list item\n if (e.target !== e.currentTarget) {\n if (focusableItems) {\n // If the items are focusable, we need to handle the arrow keys to move focus to them\n switch (e.key) {\n // If it's one of the Arrows defined, jump out of the list item to focus on the ListItem itself\n // The ArrowLeft will only trigger if the target element is the leftmost, otherwise the\n // arrowNavigationAttributes handles it and prevents it from bubbling here.\n case ArrowLeft:\n e.target.dispatchEvent(new GroupperMoveFocusEvent({ action: GroupperMoveFocusActions.Escape }));\n break;\n\n case ArrowDown:\n case ArrowUp:\n e.preventDefault();\n // Press ESC on the original target to get focus to the parent group (List)\n e.target.dispatchEvent(new GroupperMoveFocusEvent({ action: GroupperMoveFocusActions.Escape }));\n // Now dispatch the original key to move up or down in the list\n e.currentTarget.dispatchEvent(new MoverMoveFocusEvent({ key: MoverKeys[e.key] }));\n }\n return;\n }\n return;\n }\n\n switch (e.key) {\n case Space:\n // we have to prevent default here otherwise the space key will scroll the page\n e.preventDefault();\n\n // Space always toggles selection (if enabled)\n if (isSelectionModeEnabled) {\n if (!disabledSelection) {\n toggleItem?.(e, value);\n }\n } else {\n triggerAction(e);\n }\n\n break;\n\n case Enter:\n triggerAction(e);\n break;\n\n case ArrowRight:\n if (navigationMode === 'composite') {\n e.target.dispatchEvent(new GroupperMoveFocusEvent({ action: GroupperMoveFocusActions.Enter }));\n }\n\n break;\n }\n });\n\n const onCheckboxChange = useEventCallback((e: React.ChangeEvent<HTMLInputElement>, data: CheckboxOnChangeData) => {\n if (!isSelectionModeEnabled || e.defaultPrevented) {\n return;\n }\n\n toggleItem?.(e, value);\n });\n\n const arrowNavigationAttributes = useArrowNavigationGroup({\n axis: 'horizontal',\n });\n\n const tabsterAttributes = useMergedTabsterAttributes_unstable(\n focusableItems ? arrowNavigationAttributes : {},\n focusableGroupAttrs,\n props as Partial<TabsterDOMAttribute>,\n );\n\n const root = slot.always(\n getIntrinsicElementProps(as, {\n ref: useMergedRefs(rootRef, ref) as React.Ref<HTMLLIElement & HTMLDivElement>,\n tabIndex: focusableItems ? 0 : undefined,\n role: finalListItemRole,\n id: String(value),\n ...(isSelectionModeEnabled && {\n 'aria-selected': isSelected,\n 'aria-disabled': (disabledSelection && !onAction) || undefined,\n }),\n ...props,\n ...tabsterAttributes,\n onKeyDown: handleKeyDown,\n onClick: isSelectionModeEnabled || onClick || onAction ? handleClick : undefined,\n }),\n { elementType: as },\n );\n\n const checkmark = slot.optional(props.checkmark, {\n defaultProps: {\n checked: isSelected,\n tabIndex: -1,\n disabled: disabledSelection,\n },\n renderByDefault: isSelectionModeEnabled,\n elementType: Checkbox,\n });\n\n const mergedCheckmarkRef = useMergedRefs(checkmark?.ref, checkmarkRef);\n if (checkmark) {\n checkmark.onChange = mergeCallbacks(checkmark.onChange, onCheckboxChange);\n checkmark.ref = mergedCheckmarkRef;\n }\n\n const state: ListItemState = {\n components: {\n root: as,\n checkmark: Checkbox,\n },\n root,\n checkmark,\n disabled: disabledSelection && !onAction,\n selectable: isSelectionModeEnabled,\n navigable: focusableItems,\n };\n\n return state;\n};\n"],"names":["React","GroupperMoveFocusEvent","MoverMoveFocusEvent","GroupperMoveFocusActions","MoverKeys","useArrowNavigationGroup","useFocusableGroup","useMergedTabsterAttributes_unstable","elementContains","getIntrinsicElementProps","mergeCallbacks","slot","useEventCallback","useId","useMergedRefs","useListSynchronousContext","useListContext_unstable","Enter","Space","ArrowUp","ArrowDown","ArrowRight","ArrowLeft","Checkbox","createListItemActionEvent","ListItemActionEventName","DEFAULT_ROOT_EL_TYPE","useListItem_unstable","props","ref","id","value","onKeyDown","onClick","tabIndex","role","onAction","disabledSelection","toggleItem","ctx","selection","navigationMode","listItemRole","isSelectionModeEnabled","isSelected","validateListItem","as","finalListItemRole","focusableItems","Boolean","rootRef","useRef","checkmarkRef","handleAction","event","type","defaultPrevented","detail","originalEvent","useEffect","current","triggerAction","e","actionEvent","target","dispatchEvent","focusableGroupAttrs","ignoreDefaultKeydown","tabBehavior","handleClick","isFromCheckbox","handleKeyDown","currentTarget","key","action","Escape","preventDefault","onCheckboxChange","data","arrowNavigationAttributes","axis","tabsterAttributes","root","always","undefined","String","elementType","checkmark","optional","defaultProps","checked","disabled","renderByDefault","mergedCheckmarkRef","onChange","state","components","selectable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;IAEA,MAAMgD,4BAA4B1E,wBAAwB;QACxD2E,MAAM;IACR;IAEA,MAAMC,oBAAoB1E,oCACxByC,iBAAiB+B,4BAA4B,CAAC,GAC9Cb,qBACAtC;IAGF,MAAMsD,OAAOvE,KAAKwE,MAAM,CACtB1E,yBAAyBqC,IAAI;QAC3BjB,KAAKf,cAAcoC,SAASrB;QAC5BK,UAAUc,iBAAiB,IAAIoC;QAC/BjD,MAAMY;QACNjB,IAAIuD,OAAOtD;QACX,GAAIY,0BAA0B;YAC5B,iBAAiBC;YACjB,iBAAiB,AAACP,qBAAqB,CAACD,YAAagD;QACvD,CAAC;QACD,GAAGxD,KAAK;QACR,GAAGqD,iBAAiB;QACpBjD,WAAWuC;QACXtC,SAASU,0BAA0BV,WAAWG,WAAWiC,cAAce;IACzE,IACA;QAAEE,aAAaxC;IAAG;IAGpB,MAAMyC,YAAY5E,KAAK6E,QAAQ,CAAC5D,MAAM2D,SAAS,EAAE;QAC/CE,cAAc;YACZC,SAAS9C;YACTV,UAAU,CAAC;YACXyD,UAAUtD;QACZ;QACAuD,iBAAiBjD;QACjB2C,aAAa/D;IACf;IAEA,MAAMsE,qBAAqB/E,cAAcyE,sBAAAA,gCAAAA,UAAW1D,GAAG,EAAEuB;IACzD,IAAImC,WAAW;QACbA,UAAUO,QAAQ,GAAGpF,eAAe6E,UAAUO,QAAQ,EAAEjB;QACxDU,UAAU1D,GAAG,GAAGgE;IAClB;IAEA,MAAME,QAAuB;QAC3BC,YAAY;YACVd,MAAMpC;YACNyC,WAAWhE;QACb;QACA2D;QACAK;QACAI,UAAUtD,qBAAqB,CAACD;QAChC6D,YAAYtD;QACZuD,WAAWlD;IACb;IAEA,OAAO+C;AACT,EAAE"}
1
+ {"version":3,"sources":["../src/components/ListItem/useListItem.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n GroupperMoveFocusEvent,\n MoverMoveFocusEvent,\n GroupperMoveFocusActions,\n MoverKeys,\n useArrowNavigationGroup,\n useFocusableGroup,\n useMergedTabsterAttributes_unstable,\n type TabsterDOMAttribute,\n} from '@fluentui/react-tabster';\nimport {\n elementContains,\n getIntrinsicElementProps,\n mergeCallbacks,\n slot,\n useEventCallback,\n useId,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport type { ListItemBaseProps, ListItemBaseState, ListItemProps, ListItemState } from './ListItem.types';\nimport { useListSynchronousContext, useListContext_unstable } from '../List/listContext';\nimport { Enter, Space, ArrowUp, ArrowDown, ArrowRight, ArrowLeft } from '@fluentui/keyboard-keys';\nimport { Checkbox } from '@fluentui/react-checkbox';\nimport type { ListItemActionEvent } from '../../events/ListItemActionEvent';\nimport { createListItemActionEvent, ListItemActionEventName } from '../../events/ListItemActionEvent';\n\nconst DEFAULT_ROOT_EL_TYPE = 'li';\n\n/**\n * Create the state required to render ListItem.\n *\n * The returned state can be modified with hooks such as useListItemStyles_unstable,\n * before being passed to renderListItem_unstable.\n *\n * @param props - props from this instance of ListItem\n * @param ref - reference to root HTMLLIElement | HTMLDivElement of ListItem\n */\nexport const useListItem_unstable = (\n props: ListItemProps,\n ref: React.Ref<HTMLLIElement | HTMLDivElement>,\n): ListItemState => {\n const { checkmark: checkmarkProp, ...baseProps } = props;\n const state = useListItemBase_unstable(\n {\n ...baseProps,\n // Keep the base ref and event handlers for explicitly rendered Fluent checkmarks.\n checkmark: checkmarkProp === null ? null : checkmarkProp === undefined ? undefined : {},\n },\n ref,\n );\n\n const { navigationMode } = useListSynchronousContext();\n\n const as = props.as || (navigationMode === 'composite' ? 'div' : DEFAULT_ROOT_EL_TYPE);\n\n const focusableGroupAttrs = useFocusableGroup({\n ignoreDefaultKeydown: { Enter: true },\n tabBehavior: 'limited-trap-focus',\n });\n\n const arrowNavigationAttributes = useArrowNavigationGroup({\n axis: 'horizontal',\n });\n\n const tabsterAttributes = useMergedTabsterAttributes_unstable(\n state.navigable ? arrowNavigationAttributes : {},\n focusableGroupAttrs,\n props as Partial<TabsterDOMAttribute>,\n );\n\n const baseKeyDown = state.root.onKeyDown;\n\n const handleKeyDown: React.KeyboardEventHandler<HTMLLIElement & HTMLDivElement> = useEventCallback(e => {\n // Invokes the consumer handler and the base Space/Enter behavior before the Tabster additions.\n baseKeyDown?.(e);\n\n // If the event is fired from an element inside the list item\n if (e.target !== e.currentTarget) {\n if (e.defaultPrevented || !state.navigable) {\n return;\n }\n\n // If the items are focusable, we need to handle the arrow keys to move focus to them\n switch (e.key) {\n // If it's one of the Arrows defined, jump out of the list item to focus on the ListItem itself\n // The ArrowLeft will only trigger if the target element is the leftmost, otherwise the\n // arrowNavigationAttributes handles it and prevents it from bubbling here.\n case ArrowLeft:\n e.target.dispatchEvent(new GroupperMoveFocusEvent({ action: GroupperMoveFocusActions.Escape }));\n break;\n\n case ArrowDown:\n case ArrowUp:\n e.preventDefault();\n // Press ESC on the original target to get focus to the parent group (List)\n e.target.dispatchEvent(new GroupperMoveFocusEvent({ action: GroupperMoveFocusActions.Escape }));\n // Now dispatch the original key to move up or down in the list\n e.currentTarget.dispatchEvent(new MoverMoveFocusEvent({ key: MoverKeys[e.key] }));\n }\n return;\n }\n\n if (e.defaultPrevented) {\n return;\n }\n\n if (e.key === ArrowRight && navigationMode === 'composite') {\n e.target.dispatchEvent(new GroupperMoveFocusEvent({ action: GroupperMoveFocusActions.Enter }));\n }\n });\n\n const checkmark = slot.optional(checkmarkProp, {\n defaultProps: {\n checked: state.checkmark?.checked,\n tabIndex: -1,\n disabled: props.disabledSelection,\n },\n renderByDefault: state.selectable,\n elementType: Checkbox,\n });\n\n const mergedCheckmarkRef = useMergedRefs(checkmark?.ref, state.checkmark?.ref);\n if (checkmark) {\n checkmark.onChange = mergeCallbacks(checkmark.onChange, state.checkmark?.onChange);\n checkmark.ref = mergedCheckmarkRef;\n }\n\n return {\n ...state,\n components: {\n root: as,\n checkmark: Checkbox,\n },\n root: { ...state.root, ...tabsterAttributes, onKeyDown: handleKeyDown },\n checkmark,\n };\n};\n\n/**\n * Base state hook for ListItem, free of any focus or keyboard navigation runtime and of the\n * Fluent `Checkbox` used for the selection indicator.\n *\n * The checkmark slot is rendered as a native `input[type=\"checkbox\"]`, and the Tabster driven\n * arrow key handling is layered on by the wrapping `useListItem_unstable` hook.\n *\n * @param props - props from this instance of ListItem\n * @param ref - reference to root HTMLLIElement | HTMLDivElement of ListItem\n */\nexport const useListItemBase_unstable = (\n props: ListItemBaseProps,\n ref: React.Ref<HTMLLIElement | HTMLDivElement>,\n): ListItemBaseState => {\n const id = useId('listItem');\n const { value = id, onKeyDown, onClick, tabIndex, role, onAction, disabledSelection } = props;\n\n const toggleItem = useListContext_unstable(ctx => ctx.selection?.toggleItem);\n\n const { navigationMode, listItemRole } = useListSynchronousContext();\n\n const isSelectionModeEnabled = useListContext_unstable(ctx => !!ctx.selection);\n const isSelected = useListContext_unstable(ctx => ctx.selection?.isSelected(value)) ?? false;\n const validateListItem = useListContext_unstable(ctx => ctx.validateListItem);\n\n const as = props.as || (navigationMode === 'composite' ? 'div' : DEFAULT_ROOT_EL_TYPE);\n\n const finalListItemRole = role || listItemRole;\n\n const focusableItems = Boolean(isSelectionModeEnabled || navigationMode || tabIndex === 0);\n\n const rootRef = React.useRef<HTMLLIElement | HTMLDivElement>(null);\n const checkmarkRef = React.useRef<HTMLInputElement | null>(null);\n\n const handleAction: (event: ListItemActionEvent) => void = useEventCallback(event => {\n onAction?.(event, { event, value, type: ListItemActionEventName });\n\n if (event.defaultPrevented) {\n return;\n }\n\n if (isSelectionModeEnabled && !disabledSelection) {\n toggleItem?.(event.detail.originalEvent, value);\n }\n });\n\n React.useEffect(() => {\n if (rootRef.current) {\n validateListItem(rootRef.current);\n }\n }, [validateListItem]);\n\n const triggerAction = (e: React.MouseEvent | React.KeyboardEvent) => {\n const actionEvent = createListItemActionEvent(e);\n handleAction(actionEvent);\n e.target.dispatchEvent(actionEvent);\n };\n\n const handleClick: React.MouseEventHandler<HTMLLIElement & HTMLDivElement> = useEventCallback(e => {\n onClick?.(e);\n\n if (e.defaultPrevented) {\n return;\n }\n\n const isFromCheckbox = elementContains(checkmarkRef.current, e.target as Node);\n if (isFromCheckbox) {\n return;\n }\n\n triggerAction(e);\n });\n\n const handleKeyDown: React.KeyboardEventHandler<HTMLLIElement & HTMLDivElement> = useEventCallback(e => {\n onKeyDown?.(e);\n\n if (e.defaultPrevented) {\n return;\n }\n\n // Events fired from an element inside the list item are left to the caller's focus management.\n if (e.target !== e.currentTarget) {\n return;\n }\n\n switch (e.key) {\n case Space:\n // we have to prevent default here otherwise the space key will scroll the page\n e.preventDefault();\n\n // Space always toggles selection (if enabled)\n if (isSelectionModeEnabled) {\n if (!disabledSelection) {\n toggleItem?.(e, value);\n }\n } else {\n triggerAction(e);\n }\n\n break;\n\n case Enter:\n triggerAction(e);\n break;\n }\n });\n\n const onCheckboxChange = useEventCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n if (!isSelectionModeEnabled || e.defaultPrevented) {\n return;\n }\n\n toggleItem?.(e, value);\n });\n\n const root = slot.always(\n getIntrinsicElementProps(as, {\n ref: useMergedRefs(rootRef, ref) as React.Ref<HTMLLIElement & HTMLDivElement>,\n tabIndex: focusableItems ? 0 : undefined,\n id: String(value),\n ...(isSelectionModeEnabled && {\n 'aria-selected': isSelected,\n 'aria-disabled': (disabledSelection && !onAction) || undefined,\n }),\n ...props,\n role: finalListItemRole,\n onKeyDown: handleKeyDown,\n onClick: isSelectionModeEnabled || onClick || onAction ? handleClick : undefined,\n }),\n { elementType: as },\n );\n\n const checkmark = slot.optional(props.checkmark, {\n defaultProps: {\n type: 'checkbox',\n checked: isSelected,\n tabIndex: -1,\n disabled: disabledSelection,\n },\n renderByDefault: isSelectionModeEnabled,\n elementType: 'input',\n });\n\n const mergedCheckmarkRef = useMergedRefs(checkmark?.ref, checkmarkRef);\n if (checkmark) {\n checkmark.onChange = mergeCallbacks(checkmark.onChange, onCheckboxChange);\n checkmark.ref = mergedCheckmarkRef;\n }\n\n const state: ListItemBaseState = {\n components: {\n root: as,\n checkmark: 'input',\n },\n root,\n checkmark,\n disabled: disabledSelection && !onAction,\n selectable: isSelectionModeEnabled,\n navigable: focusableItems,\n };\n\n return state;\n};\n"],"names":["React","GroupperMoveFocusEvent","MoverMoveFocusEvent","GroupperMoveFocusActions","MoverKeys","useArrowNavigationGroup","useFocusableGroup","useMergedTabsterAttributes_unstable","elementContains","getIntrinsicElementProps","mergeCallbacks","slot","useEventCallback","useId","useMergedRefs","useListSynchronousContext","useListContext_unstable","Enter","Space","ArrowUp","ArrowDown","ArrowRight","ArrowLeft","Checkbox","createListItemActionEvent","ListItemActionEventName","DEFAULT_ROOT_EL_TYPE","useListItem_unstable","props","ref","state","checkmark","checkmarkProp","baseProps","useListItemBase_unstable","undefined","navigationMode","as","focusableGroupAttrs","ignoreDefaultKeydown","tabBehavior","arrowNavigationAttributes","axis","tabsterAttributes","navigable","baseKeyDown","root","onKeyDown","handleKeyDown","e","target","currentTarget","defaultPrevented","key","dispatchEvent","action","Escape","preventDefault","optional","defaultProps","checked","tabIndex","disabled","disabledSelection","renderByDefault","selectable","elementType","mergedCheckmarkRef","onChange","components","id","value","onClick","role","onAction","toggleItem","ctx","selection","listItemRole","isSelectionModeEnabled","isSelected","validateListItem","finalListItemRole","focusableItems","Boolean","rootRef","useRef","checkmarkRef","handleAction","event","type","detail","originalEvent","useEffect","current","triggerAction","actionEvent","handleClick","isFromCheckbox","onCheckboxChange","always","String"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,sBAAsB,EACtBC,mBAAmB,EACnBC,wBAAwB,EACxBC,SAAS,EACTC,uBAAuB,EACvBC,iBAAiB,EACjBC,mCAAmC,QAE9B,0BAA0B;AACjC,SACEC,eAAe,EACfC,wBAAwB,EACxBC,cAAc,EACdC,IAAI,EACJC,gBAAgB,EAChBC,KAAK,EACLC,aAAa,QACR,4BAA4B;AAEnC,SAASC,yBAAyB,EAAEC,uBAAuB,QAAQ,yBAAsB;AACzF,SAASC,KAAK,EAAEC,KAAK,E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B,GAAGsB;IAClB;IAEA,MAAMzB,OAAOnC,KAAKyF,MAAM,CACtB3F,yBAAyB4B,IAAI;QAC3BR,KAAKf,cAAcuE,SAASxD;QAC5BgC,UAAUsB,iBAAiB,IAAIhD;QAC/BmC,IAAI+B,OAAO9B;QACX,GAAIQ,0BAA0B;YAC5B,iBAAiBC;YACjB,iBAAiB,AAACjB,qBAAqB,CAACW,YAAavC;QACvD,CAAC;QACD,GAAGP,KAAK;QACR6C,MAAMS;QACNnC,WAAWC;QACXwB,SAASO,0BAA0BP,WAAWE,WAAWuB,cAAc9D;IACzE,IACA;QAAE+B,aAAa7B;IAAG;IAGpB,MAAMN,YAAYpB,KAAK+C,QAAQ,CAAC9B,MAAMG,SAAS,EAAE;QAC/C4B,cAAc;YACZ+B,MAAM;YACN9B,SAASoB;YACTnB,UAAU,CAAC;YACXC,UAAUC;QACZ;QACAC,iBAAiBe;QACjBb,aAAa;IACf;IAEA,MAAMC,qBAAqBrD,cAAciB,sBAAAA,gCAAAA,UAAWF,GAAG,EAAE0D;IACzD,IAAIxD,WAAW;QACbA,UAAUqC,QAAQ,GAAG1D,eAAeqB,UAAUqC,QAAQ,EAAE+B;QACxDpE,UAAUF,GAAG,GAAGsC;IAClB;IAEA,MAAMrC,QAA2B;QAC/BuC,YAAY;YACVvB,MAAMT;YACNN,WAAW;QACb;QACAe;QACAf;QACA+B,UAAUC,qBAAqB,CAACW;QAChCT,YAAYc;QACZnC,WAAWuC;IACb;IAEA,OAAOrD;AACT,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/events/ListItemActionEvent.ts"],"sourcesContent":["import type * as React from 'react';\n\nexport const ListItemActionEventName = 'ListItemAction';\n\nexport interface ListItemActionEventDetail {\n originalEvent: React.MouseEvent | React.KeyboardEvent;\n}\n\nexport type ListItemActionEvent = CustomEvent<ListItemActionEventDetail>;\n\nexport const createListItemActionEvent = (\n originalEvent: React.MouseEvent | React.KeyboardEvent,\n): CustomEvent<ListItemActionEventDetail> =>\n new CustomEvent<ListItemActionEventDetail>(ListItemActionEventName, {\n cancelable: true,\n bubbles: true,\n detail: { originalEvent },\n });\n"],"names":["ListItemActionEventName","createListItemActionEvent","originalEvent","CustomEvent","cancelable","bubbles","detail"],"mappings":"AAEA,OAAO,MAAMA,0BAA0B,iBAAiB;AAQxD,OAAO,MAAMC,4BAA4B,CACvCC,gBAEA,IAAIC,YAAuCH,yBAAyB;QAClEI,YAAY;QACZC,SAAS;QACTC,QAAQ;YAAEJ;QAAc;IAC1B,GAAG"}
1
+ {"version":3,"sources":["../src/events/ListItemActionEvent.ts"],"sourcesContent":["import type * as React from 'react';\nimport type { ListItemActionEventData } from '../components/ListItem/ListItem.types';\n\nexport const ListItemActionEventName = 'ListItemAction' satisfies ListItemActionEventData['type'];\n\nexport interface ListItemActionEventDetail {\n originalEvent: Extract<\n ListItemActionEventData,\n { type: typeof ListItemActionEventName }\n >['event']['detail']['originalEvent'];\n}\n\nexport type ListItemActionEvent = CustomEvent<ListItemActionEventDetail>;\n\nexport const createListItemActionEvent = (\n originalEvent: React.MouseEvent | React.KeyboardEvent,\n): CustomEvent<ListItemActionEventDetail> =>\n new CustomEvent<ListItemActionEventDetail>(ListItemActionEventName, {\n cancelable: true,\n bubbles: true,\n detail: { originalEvent },\n });\n"],"names":["ListItemActionEventName","createListItemActionEvent","originalEvent","CustomEvent","cancelable","bubbles","detail"],"mappings":"AAGA,OAAO,MAAMA,0BAA0B,iBAA2D;AAWlG,OAAO,MAAMC,4BAA4B,CACvCC,gBAEA,IAAIC,YAAuCH,yBAAyB;QAClEI,YAAY;QACZC,SAAS;QACTC,QAAQ;YAAEJ;QAAc;IAC1B,GAAG"}
package/lib/index.js CHANGED
@@ -1,2 +1,3 @@
1
- export { List, listClassNames, renderList_unstable, useListStyles_unstable, useList_unstable } from "./List.js";
2
- export { ListItem, listItemClassNames, renderListItem_unstable, useListItemStyles_unstable, useListItem_unstable } from "./ListItem.js";
1
+ export { List, ListContextProvider, listClassNames, renderList_unstable, useListBase_unstable, useListContextValues_unstable, useListContext_unstable, useListStyles_unstable, useList_unstable } from "./List.js";
2
+ export { calculateListItemRoleForListRole, calculateListRole, validateGridCellsArePresent, validateListItemElement, validateProperElementTypes, validateProperRolesAreUsed } from "./utils/index.js";
3
+ export { ListItem, listItemClassNames, renderListItem_unstable, useListItemBase_unstable, useListItemStyles_unstable, useListItem_unstable } from "./ListItem.js";
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export { List, listClassNames, renderList_unstable, useListStyles_unstable, useList_unstable } from './List';\n\nexport type { ListProps, ListSlots, ListState } from './List';\nexport {\n ListItem,\n listItemClassNames,\n renderListItem_unstable,\n useListItemStyles_unstable,\n useListItem_unstable,\n} from './ListItem';\nexport type { ListItemProps, ListItemSlots, ListItemState } from './ListItem';\n"],"names":["List","listClassNames","renderList_unstable","useListStyles_unstable","useList_unstable","ListItem","listItemClassNames","renderListItem_unstable","useListItemStyles_unstable","useListItem_unstable"],"mappings":"AAAA,SAASA,IAAI,EAAEC,cAAc,EAAEC,mBAAmB,EAAEC,sBAAsB,EAAEC,gBAAgB,QAAQ,YAAS;AAG7G,SACEC,QAAQ,EACRC,kBAAkB,EAClBC,uBAAuB,EACvBC,0BAA0B,EAC1BC,oBAAoB,QACf,gBAAa"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n List,\n ListContextProvider,\n listClassNames,\n renderList_unstable,\n useListBase_unstable,\n useListContextValues_unstable,\n useListContext_unstable,\n useListStyles_unstable,\n useList_unstable,\n} from './List';\n\nexport type {\n ListContextValue,\n ListContextValues,\n ListNavigationMode,\n ListProps,\n ListSlots,\n ListState,\n ListSynchronousContextValue,\n OnListSelectionChangeData,\n} from './List';\nexport type { ListSelectionState } from './hooks/types';\nexport {\n calculateListItemRoleForListRole,\n calculateListRole,\n validateGridCellsArePresent,\n validateListItemElement,\n validateProperElementTypes,\n validateProperRolesAreUsed,\n} from './utils';\nexport type { ValidateListItemElementOptions } from './utils';\nexport {\n ListItem,\n listItemClassNames,\n renderListItem_unstable,\n useListItemBase_unstable,\n useListItemStyles_unstable,\n useListItem_unstable,\n} from './ListItem';\nexport type {\n ListItemActionEventData,\n ListItemBaseProps,\n ListItemBaseSlots,\n ListItemBaseState,\n ListItemProps,\n ListItemSlots,\n ListItemState,\n ListItemValue,\n} from './ListItem';\n"],"names":["List","ListContextProvider","listClassNames","renderList_unstable","useListBase_unstable","useListContextValues_unstable","useListContext_unstable","useListStyles_unstable","useList_unstable","calculateListItemRoleForListRole","calculateListRole","validateGridCellsArePresent","validateListItemElement","validateProperElementTypes","validateProperRolesAreUsed","ListItem","listItemClassNames","renderListItem_unstable","useListItemBase_unstable","useListItemStyles_unstable","useListItem_unstable"],"mappings":"AAAA,SACEA,IAAI,EACJC,mBAAmB,EACnBC,cAAc,EACdC,mBAAmB,EACnBC,oBAAoB,EACpBC,6BAA6B,EAC7BC,uBAAuB,EACvBC,sBAAsB,EACtBC,gBAAgB,QACX,YAAS;AAahB,SACEC,gCAAgC,EAChCC,iBAAiB,EACjBC,2BAA2B,EAC3BC,uBAAuB,EACvBC,0BAA0B,EAC1BC,0BAA0B,QACrB,mBAAU;AAEjB,SACEC,QAAQ,EACRC,kBAAkB,EAClBC,uBAAuB,EACvBC,wBAAwB,EACxBC,0BAA0B,EAC1BC,oBAAoB,QACf,gBAAa"}
@@ -1,4 +1,5 @@
1
1
  export { calculateListRole } from "./calculateListRole.js";
2
+ export { validateListItemElement } from "./validateListItemElement.js";
2
3
  export { validateProperElementTypes } from "./validateProperElementTypes.js";
3
4
  export { validateProperRolesAreUsed } from "./validateProperRolesAreUsed.js";
4
5
  export { calculateListItemRoleForListRole } from "./calculateListItemRoleForListRole.js";
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["export { calculateListRole } from './calculateListRole';\nexport { validateProperElementTypes } from './validateProperElementTypes';\nexport { validateProperRolesAreUsed } from './validateProperRolesAreUsed';\nexport { calculateListItemRoleForListRole } from './calculateListItemRoleForListRole';\nexport { validateGridCellsArePresent } from './validateGridCellsArePresent';\n"],"names":["calculateListRole","validateProperElementTypes","validateProperRolesAreUsed","calculateListItemRoleForListRole","validateGridCellsArePresent"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,yBAAsB;AACxD,SAASC,0BAA0B,QAAQ,kCAA+B;AAC1E,SAASC,0BAA0B,QAAQ,kCAA+B;AAC1E,SAASC,gCAAgC,QAAQ,wCAAqC;AACtF,SAASC,2BAA2B,QAAQ,mCAAgC"}
1
+ {"version":3,"sources":["../src/utils/index.ts"],"sourcesContent":["export { calculateListRole } from './calculateListRole';\nexport { validateListItemElement } from './validateListItemElement';\nexport { validateProperElementTypes } from './validateProperElementTypes';\nexport { validateProperRolesAreUsed } from './validateProperRolesAreUsed';\nexport { calculateListItemRoleForListRole } from './calculateListItemRoleForListRole';\nexport { validateGridCellsArePresent } from './validateGridCellsArePresent';\nexport type { ValidateListItemElementOptions } from './validateListItemElement';\n"],"names":["calculateListRole","validateListItemElement","validateProperElementTypes","validateProperRolesAreUsed","calculateListItemRoleForListRole","validateGridCellsArePresent"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,yBAAsB;AACxD,SAASC,uBAAuB,QAAQ,+BAA4B;AACpE,SAASC,0BAA0B,QAAQ,kCAA+B;AAC1E,SAASC,0BAA0B,QAAQ,kCAA+B;AAC1E,SAASC,gCAAgC,QAAQ,wCAAqC;AACtF,SAASC,2BAA2B,QAAQ,mCAAgC"}
@@ -0,0 +1,17 @@
1
+ import { validateGridCellsArePresent } from "./validateGridCellsArePresent.js";
2
+ import { validateProperElementTypes } from "./validateProperElementTypes.js";
3
+ import { validateProperRolesAreUsed } from "./validateProperRolesAreUsed.js";
4
+ /**
5
+ * Runs the development time validations for a single list item element.
6
+ *
7
+ * The focusable children detection is passed in so that callers can choose between a Tabster
8
+ * aware implementation and a plain DOM one.
9
+ */ export const validateListItemElement = (listItemEl, { listRenderedAs, listRole, hasSelection, hasFocusableChildren })=>{
10
+ if (process.env.NODE_ENV === 'production') {
11
+ return;
12
+ }
13
+ const itemRole = listItemEl.getAttribute('role') || '';
14
+ validateProperElementTypes(listRenderedAs, listItemEl.tagName.toLocaleLowerCase());
15
+ validateProperRolesAreUsed(listRole, itemRole, hasSelection, hasFocusableChildren);
16
+ validateGridCellsArePresent(listRole, listItemEl);
17
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/validateListItemElement.ts"],"sourcesContent":["import { validateGridCellsArePresent } from './validateGridCellsArePresent';\nimport { validateProperElementTypes } from './validateProperElementTypes';\nimport { validateProperRolesAreUsed } from './validateProperRolesAreUsed';\n\nexport type ValidateListItemElementOptions = {\n /** The element type the parent List renders as. */\n listRenderedAs: string;\n /** The resolved role of the parent List. */\n listRole: string;\n /** Whether the parent List has selection enabled. */\n hasSelection: boolean;\n /** Whether the list item contains focusable children. */\n hasFocusableChildren: boolean;\n};\n\n/**\n * Runs the development time validations for a single list item element.\n *\n * The focusable children detection is passed in so that callers can choose between a Tabster\n * aware implementation and a plain DOM one.\n */\nexport const validateListItemElement = (\n listItemEl: HTMLElement,\n { listRenderedAs, listRole, hasSelection, hasFocusableChildren }: ValidateListItemElementOptions,\n): void => {\n if (process.env.NODE_ENV === 'production') {\n return;\n }\n\n const itemRole = listItemEl.getAttribute('role') || '';\n\n validateProperElementTypes(listRenderedAs, listItemEl.tagName.toLocaleLowerCase());\n validateProperRolesAreUsed(listRole, itemRole, hasSelection, hasFocusableChildren);\n validateGridCellsArePresent(listRole, listItemEl);\n};\n"],"names":["validateGridCellsArePresent","validateProperElementTypes","validateProperRolesAreUsed","validateListItemElement","listItemEl","listRenderedAs","listRole","hasSelection","hasFocusableChildren","process","env","NODE_ENV","itemRole","getAttribute","tagName","toLocaleLowerCase"],"mappings":"AAAA,SAASA,2BAA2B,QAAQ,mCAAgC;AAC5E,SAASC,0BAA0B,QAAQ,kCAA+B;AAC1E,SAASC,0BAA0B,QAAQ,kCAA+B;AAa1E;;;;;CAKC,GACD,OAAO,MAAMC,0BAA0B,CACrCC,YACA,EAAEC,cAAc,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,oBAAoB,EAAkC;IAEhG,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC;IACF;IAEA,MAAMC,WAAWR,WAAWS,YAAY,CAAC,WAAW;IAEpDZ,2BAA2BI,gBAAgBD,WAAWU,OAAO,CAACC,iBAAiB;IAC/Eb,2BAA2BI,UAAUM,UAAUL,cAAcC;IAC7DR,4BAA4BM,UAAUF;AACxC,EAAE"}
@@ -12,12 +12,24 @@ _export(exports, {
12
12
  List: function() {
13
13
  return _index.List;
14
14
  },
15
+ ListContextProvider: function() {
16
+ return _index.ListContextProvider;
17
+ },
15
18
  listClassNames: function() {
16
19
  return _index.listClassNames;
17
20
  },
18
21
  renderList_unstable: function() {
19
22
  return _index.renderList_unstable;
20
23
  },
24
+ useListBase_unstable: function() {
25
+ return _index.useListBase_unstable;
26
+ },
27
+ useListContextValues_unstable: function() {
28
+ return _index.useListContextValues_unstable;
29
+ },
30
+ useListContext_unstable: function() {
31
+ return _index.useListContext_unstable;
32
+ },
21
33
  useListStyles_unstable: function() {
22
34
  return _index.useListStyles_unstable;
23
35
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/List.ts"],"sourcesContent":["export type {\n ListContextValue,\n ListContextValues,\n ListNavigationMode,\n ListProps,\n ListSlots,\n ListState,\n OnListSelectionChangeData,\n} from './components/List/index';\nexport {\n List,\n listClassNames,\n renderList_unstable,\n useListStyles_unstable,\n useList_unstable,\n} from './components/List/index';\n"],"names":["List","listClassNames","renderList_unstable","useListStyles_unstable","useList_unstable"],"mappings":";;;;;;;;;;;;eAUEA,WAAI;;;eACJC,qBAAc;;;eACdC,0BAAmB;;;eACnBC,6BAAsB;;;eACtBC,uBAAgB;;;uBACX,6BAA0B"}
1
+ {"version":3,"sources":["../src/List.ts"],"sourcesContent":["export type {\n ListContextValue,\n ListContextValues,\n ListNavigationMode,\n ListProps,\n ListSlots,\n ListState,\n ListSynchronousContextValue,\n OnListSelectionChangeData,\n} from './components/List/index';\nexport {\n List,\n ListContextProvider,\n listClassNames,\n renderList_unstable,\n useListBase_unstable,\n useListContextValues_unstable,\n useListContext_unstable,\n useListStyles_unstable,\n useList_unstable,\n} from './components/List/index';\n"],"names":["List","ListContextProvider","listClassNames","renderList_unstable","useListBase_unstable","useListContextValues_unstable","useListContext_unstable","useListStyles_unstable","useList_unstable"],"mappings":";;;;;;;;;;;IAWEA;0BAAI;;;eACJC,0BAAmB;;;eACnBC,qBAAc;;;eACdC,0BAAmB;;;eACnBC,2BAAoB;;;eACpBC,oCAA6B;;;eAC7BC,8BAAuB;;;eACvBC,6BAAsB;;;eACtBC,uBAAgB;;;uBACX,6BAA0B"}
@@ -18,6 +18,9 @@ _export(exports, {
18
18
  renderListItem_unstable: function() {
19
19
  return _index.renderListItem_unstable;
20
20
  },
21
+ useListItemBase_unstable: function() {
22
+ return _index.useListItemBase_unstable;
23
+ },
21
24
  useListItemStyles_unstable: function() {
22
25
  return _index.useListItemStyles_unstable;
23
26
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ListItem.ts"],"sourcesContent":["export type {\n ListItemActionEventData,\n ListItemProps,\n ListItemSlots,\n ListItemState,\n ListItemValue,\n} from './components/ListItem/index';\nexport {\n ListItem,\n listItemClassNames,\n renderListItem_unstable,\n useListItemStyles_unstable,\n useListItem_unstable,\n} from './components/ListItem/index';\n"],"names":["ListItem","listItemClassNames","renderListItem_unstable","useListItemStyles_unstable","useListItem_unstable"],"mappings":";;;;;;;;;;;;eAQEA,eAAQ;;;eACRC,yBAAkB;;;eAClBC,8BAAuB;;;eACvBC,iCAA0B;;;eAC1BC,2BAAoB;;;uBACf,iCAA8B"}
1
+ {"version":3,"sources":["../src/ListItem.ts"],"sourcesContent":["export type {\n ListItemActionEventData,\n ListItemBaseProps,\n ListItemBaseSlots,\n ListItemBaseState,\n ListItemProps,\n ListItemSlots,\n ListItemState,\n ListItemValue,\n} from './components/ListItem/index';\nexport {\n ListItem,\n listItemClassNames,\n renderListItem_unstable,\n useListItemBase_unstable,\n useListItemStyles_unstable,\n useListItem_unstable,\n} from './components/ListItem/index';\n"],"names":["ListItem","listItemClassNames","renderListItem_unstable","useListItemBase_unstable","useListItemStyles_unstable","useListItem_unstable"],"mappings":";;;;;;;;;;;;eAWEA,eAAQ;;;eACRC,yBAAkB;;;eAClBC,8BAAuB;;;eACvBC,+BAAwB;;;eACxBC,iCAA0B;;;eAC1BC,2BAAoB;;;uBACf,iCAA8B"}
@@ -12,12 +12,24 @@ _export(exports, {
12
12
  List: function() {
13
13
  return _List.List;
14
14
  },
15
+ ListContextProvider: function() {
16
+ return _listContext.ListContextProvider;
17
+ },
15
18
  listClassNames: function() {
16
19
  return _useListStylesstyles.listClassNames;
17
20
  },
18
21
  renderList_unstable: function() {
19
22
  return _renderList.renderList_unstable;
20
23
  },
24
+ useListBase_unstable: function() {
25
+ return _useList.useListBase_unstable;
26
+ },
27
+ useListContextValues_unstable: function() {
28
+ return _useListContextValues.useListContextValues_unstable;
29
+ },
30
+ useListContext_unstable: function() {
31
+ return _listContext.useListContext_unstable;
32
+ },
21
33
  useListStyles_unstable: function() {
22
34
  return _useListStylesstyles.useListStyles_unstable;
23
35
  },
@@ -28,4 +40,6 @@ _export(exports, {
28
40
  const _List = require("./List.cjs");
29
41
  const _renderList = require("./renderList.cjs");
30
42
  const _useList = require("./useList.cjs");
43
+ const _useListContextValues = require("./useListContextValues.cjs");
44
+ const _listContext = require("./listContext.cjs");
31
45
  const _useListStylesstyles = require("./useListStyles.styles.cjs");
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/List/index.ts"],"sourcesContent":["export { List } from './List';\nexport type {\n ListContextValue,\n ListContextValues,\n ListNavigationMode,\n ListProps,\n ListSlots,\n ListState,\n OnListSelectionChangeData,\n} from './List.types';\nexport { renderList_unstable } from './renderList';\nexport { useList_unstable } from './useList';\nexport { listClassNames, useListStyles_unstable } from './useListStyles.styles';\n"],"names":["List","renderList_unstable","useList_unstable","listClassNames","useListStyles_unstable"],"mappings":";;;;;;;;;;;;eAASA,UAAI;;;eAYJG,mCAAc;;;eAFdF,+BAAmB;;;eAEHG,2CAAsB;;;eADtCF,yBAAgB;;;sBAXJ,YAAS;4BAUM,kBAAe;yBAClB,eAAY;qCACU,4BAAyB"}
1
+ {"version":3,"sources":["../src/components/List/index.ts"],"sourcesContent":["export { List } from './List';\nexport type {\n ListContextValue,\n ListContextValues,\n ListNavigationMode,\n ListProps,\n ListSlots,\n ListState,\n OnListSelectionChangeData,\n} from './List.types';\nexport { renderList_unstable } from './renderList';\nexport { useList_unstable, useListBase_unstable } from './useList';\nexport { useListContextValues_unstable } from './useListContextValues';\nexport { ListContextProvider, useListContext_unstable } from './listContext';\nexport { listClassNames, useListStyles_unstable } from './useListStyles.styles';\nexport type { ListSynchronousContextValue } from './List.types';\n"],"names":["List","renderList_unstable","useList_unstable","useListBase_unstable","useListContextValues_unstable","ListContextProvider","useListContext_unstable","listClassNames","useListStyles_unstable"],"mappings":";;;;;;;;;;;IAASA;yBAAI;;IAaJK;+CAAmB;;;eACnBE,mCAAc;;;eAJdN,+BAAmB;;;eACDE,6BAAoB;;;eACtCC,mDAA6B;;;eACRE,oCAAuB;;;eAC5BE,2CAAsB;;oBAHtB;eAAhBN;;;sBAXY,YAAS;4BAUM,kBAAe;yBACI,eAAY;sCACrB,4BAAyB;6BACV,mBAAgB;qCACtB,4BAAyB"}