@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
@@ -3,9 +3,17 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "useList_unstable", {
7
- enumerable: true,
8
- get: function() {
6
+ function _export(target, all) {
7
+ for(var name in all)Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
13
+ useListBase_unstable: function() {
14
+ return useListBase_unstable;
15
+ },
16
+ useList_unstable: function() {
9
17
  return useList_unstable;
10
18
  }
11
19
  });
@@ -14,13 +22,45 @@ const _reacttabster = require("@fluentui/react-tabster");
14
22
  const _useListSelection = require("../../hooks/useListSelection.cjs");
15
23
  const _index = require("../../utils/index.cjs");
16
24
  const DEFAULT_ROOT_EL_TYPE = 'ul';
25
+ /**
26
+ * Plain DOM approximation of Tabster's focus finders, used by the base hook which must stay free of
27
+ * any Tabster runtime.
28
+ */ const FOCUSABLE_SELECTOR = 'a[href], area[href], button, input, select, textarea, iframe, ' + '[contenteditable=""], [contenteditable="true" i], [contenteditable="plaintext-only" i], [tabindex]';
29
+ const NON_FOCUSABLE_SELECTOR = ':disabled, [hidden], input[type="hidden"], [tabindex^="-"]';
17
30
  const useList_unstable = (props, ref)=>{
18
- const { navigationMode, selectionMode, selectedItems, defaultSelectedItems, onSelectionChange } = props;
19
- const as = props.as || navigationMode === 'composite' ? 'div' : DEFAULT_ROOT_EL_TYPE;
31
+ const state = useListBase_unstable(props, ref);
32
+ const { navigationMode, selectionMode } = props;
33
+ const as = props.as || (navigationMode === 'composite' ? 'div' : DEFAULT_ROOT_EL_TYPE);
34
+ const listRole = props.role || (0, _index.calculateListRole)(navigationMode, !!selectionMode);
20
35
  const arrowNavigationAttributes = (0, _reacttabster.useArrowNavigationGroup)({
21
36
  axis: 'vertical',
22
37
  memorizeCurrent: true
23
38
  });
39
+ const { findAllFocusable } = (0, _reacttabster.useFocusFinders)();
40
+ const validateListItem = (0, _reactutilities.useEventCallback)((listItemEl)=>{
41
+ if (process.env.NODE_ENV === 'production') {
42
+ return;
43
+ }
44
+ (0, _index.validateListItemElement)(listItemEl, {
45
+ listRenderedAs: as,
46
+ listRole,
47
+ hasSelection: !!selectionMode,
48
+ hasFocusableChildren: findAllFocusable(listItemEl).length > 0
49
+ });
50
+ });
51
+ return {
52
+ ...state,
53
+ validateListItem,
54
+ // Consumer props keep winning over the navigation attributes, matching the base slot ordering.
55
+ root: {
56
+ ...arrowNavigationAttributes,
57
+ ...state.root
58
+ }
59
+ };
60
+ };
61
+ const useListBase_unstable = (props, ref)=>{
62
+ const { navigationMode, selectionMode, selectedItems, defaultSelectedItems, onSelectionChange } = props;
63
+ const as = props.as || (navigationMode === 'composite' ? 'div' : DEFAULT_ROOT_EL_TYPE);
24
64
  const [selectionState, setSelectionState] = (0, _reactutilities.useControllableState)({
25
65
  state: selectedItems,
26
66
  defaultState: defaultSelectedItems,
@@ -42,16 +82,16 @@ const useList_unstable = (props, ref)=>{
42
82
  });
43
83
  const listRole = props.role || (0, _index.calculateListRole)(navigationMode, !!selectionMode);
44
84
  const listItemRole = (0, _index.calculateListItemRoleForListRole)(listRole);
45
- const { findAllFocusable } = (0, _reacttabster.useFocusFinders)();
46
85
  const validateListItem = (0, _reactutilities.useEventCallback)((listItemEl)=>{
47
86
  if (process.env.NODE_ENV === 'production') {
48
87
  return;
49
88
  }
50
- const itemRole = listItemEl.getAttribute('role') || '';
51
- const focusable = findAllFocusable(listItemEl);
52
- (0, _index.validateProperElementTypes)(as, listItemEl.tagName.toLocaleLowerCase());
53
- (0, _index.validateProperRolesAreUsed)(listRole, itemRole, !!selectionMode, focusable.length > 0);
54
- (0, _index.validateGridCellsArePresent)(listRole, listItemEl);
89
+ (0, _index.validateListItemElement)(listItemEl, {
90
+ listRenderedAs: as,
91
+ listRole,
92
+ hasSelection: !!selectionMode,
93
+ hasFocusableChildren: Array.from(listItemEl.querySelectorAll(FOCUSABLE_SELECTOR)).some((element)=>!element.matches(NON_FOCUSABLE_SELECTOR))
94
+ });
55
95
  });
56
96
  return {
57
97
  components: {
@@ -59,12 +99,11 @@ const useList_unstable = (props, ref)=>{
59
99
  },
60
100
  root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)(as, {
61
101
  ref,
62
- role: listRole,
63
102
  ...selectionMode && {
64
103
  'aria-multiselectable': selectionMode === 'multiselect' ? true : undefined
65
104
  },
66
- ...arrowNavigationAttributes,
67
- ...props
105
+ ...props,
106
+ role: listRole
68
107
  }), {
69
108
  elementType: as
70
109
  }),
@@ -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;;;;;+BA2Baa;;;;;;gCAvB0E,4BAA4B;8BAC1D,0BAA0B;kCAElD,kCAA+B;uBAOzD,uBAAc;AAErB,MAAMD,uBAAuB;AAWtB,yBAAyB,CAC9BE,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,gCAA4BlB,qCAAAA,EAAwB;QACxDmB,MAAM;QACNC,iBAAiB;IACnB;IAEA,MAAM,CAACC,gBAAgBC,kBAAkB,OAAGxB,oCAAAA,EAAqB;QAC/DyB,OAAOT;QACPU,cAAcT;QACdU,cAAc,EAAE;IAClB;IAEA,MAAMC,eAAW3B,gCAAAA,EAAiB,CAAC4B,GAAyBC;QAC1D,MAAMC,uBAAuBC,MAAMC,IAAI,CAACH,KAAKd,aAAa;QAC1DQ,kBAAkBO;QAClBb,sBAAAA,QAAAA,sBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,kBAAoBW,GAAG;YAAEK,OAAOL;YAAGM,MAAM;YAAUnB,eAAee;QAAqB;IACzF;IAEA,MAAMK,gBAAYhC,kCAAAA,EAAiB;QACjCc,mBAAmBU;QACnBb,eAAeA,iBAAiB;QAChCC,eAAeO;IACjB;IAEA,MAAMc,WAAWzB,MAAM0B,IAAI,QAAIhC,wBAAAA,EAAkBQ,gBAAgB,CAAC,CAACC;IACnE,MAAMwB,mBAAelC,uCAAAA,EAAiCgC;IAEtD,MAAM,EAAEG,gBAAgB,EAAE,OAAGrC,6BAAAA;IAE7B,MAAMsC,uBAAmBxC,gCAAAA,EAAiB,CAACyC;QACzC,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YACzC;QACF;QACA,MAAMC,WAAWJ,WAAWK,YAAY,CAAC,WAAW;QACpD,MAAMC,YAAYR,iBAAiBE;YACnClC,iCAAAA,EAA2BW,IAAIuB,WAAWO,OAAO,CAACC,iBAAiB;YACnEzC,iCAAAA,EAA2B4B,UAAUS,UAAU,CAAC,CAAC/B,eAAeiC,UAAUG,MAAM,GAAG;YACnF5C,kCAAAA,EAA4B8B,UAAUK;IACxC;IAEA,OAAO;QACLU,YAAY;YACVC,MAAMlC;QACR;QACAkC,MAAMtD,oBAAAA,CAAKuD,MAAM,KACfxD,wCAAAA,EAAyBqB,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","querySelectorAll","some","element","matches","components","always","undefined","elementType"],"mappings":"AAAA;;;;;;;;;;;;wBA6EaiB;eAAAA;;IA/CAJ,gBAAAA;;;;gCA1B0E,4BAA4B;8BAC1D,0BAA0B;kCAElD,kCAA+B;uBAC6B,uBAAc;AAE3G,MAAMH,uBAAuB;AAE7B;;;CAGC,GACD,MAAMC,qBACJ,mEACA;AACF,MAAMC,yBAAyB;AAWxB,yBAAyB,CAC9BE,OACAC;IAEA,MAAMC,QAAQC,qBAAqBH,OAAOC;IAE1C,MAAM,EAAEG,cAAc,EAAEC,aAAa,EAAE,GAAGL;IAC1C,MAAMM,KAAKN,MAAMM,EAAE,IAAKF,CAAAA,mBAAmB,cAAc,QAAQR,oBAAAA,CAAmB;IACpF,MAAMW,WAAWP,MAAMQ,IAAI,QAAId,wBAAAA,EAAkBU,gBAAgB,CAAC,CAACC;IAEnE,MAAMI,gCAA4BnB,qCAAAA,EAAwB;QACxDoB,MAAM;QACNC,iBAAiB;IACnB;IAEA,MAAM,EAAEC,gBAAgB,EAAE,OAAGrB,6BAAAA;IAE7B,MAAMsB,uBAAmBxB,gCAAAA,EAAiB,CAACyB;QACzC,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YACzC;QACF;YAEAtB,8BAAAA,EAAwBmB,YAAY;YAClCI,gBAAgBZ;YAChBC;YACAY,cAAc,CAAC,CAACd;YAChBe,sBAAsBR,iBAAiBE,YAAYO,MAAM,GAAG;QAC9D;IACF;IAEA,OAAO;QACL,GAAGnB,KAAK;QACRW;QACA,+FAA+F;QAC/FS,MAAM;YAAE,GAAGb,yBAAyB;Y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AMhB;QACR;QACAgB,MAAMnC,oBAAAA,CAAK0D,MAAM,KACf3D,wCAAAA,EAAyBoB,IAAI;YAC3BL;YACA,GAAII,iBAAiB;gBACnB,wBAAwBA,kBAAkB,gBAAgB,OAAOyC;YACnE,CAAC;YACD,GAAG9C,KAAK;YACRQ,MAAMD;QACR,IACA;YAAEwC,aAAazC;QAAG;QAEpBiC;QACA1B;QACAT;QACA,6FAA6F;QAC7FkC,WAAWjC,gBAAgBiC,YAAYQ;IACzC;AACF,EAAE"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * State used in rendering ListItem
2
+ * State returned by `useListItemBase_unstable`.
3
3
  */ "use strict";
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
@@ -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"}
@@ -18,6 +18,9 @@ _export(exports, {
18
18
  renderListItem_unstable: function() {
19
19
  return _renderListItem.renderListItem_unstable;
20
20
  },
21
+ useListItemBase_unstable: function() {
22
+ return _useListItem.useListItemBase_unstable;
23
+ },
21
24
  useListItemStyles_unstable: function() {
22
25
  return _useListItemStylesstyles.useListItemStyles_unstable;
23
26
  },
@@ -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":";;;;;;;;;;;;eAASA,kBAAQ;;;eAURG,2CAAkB;;;eAFlBF,uCAAuB;;;eAEHG,mDAA0B;;;eAD9CF,iCAAoB;;;0BATJ,gBAAa;gCAQE,sBAAmB;6BACtB,mBAAgB;yCACU,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":";;;;;;;;;;;;eAASA,kBAAQ;;;eAaRI,2CAAkB;;;eAFlBH,uCAAuB;;;eACDE,qCAAwB;;;eAC1BE,mDAA0B;;;eAD9CH,iCAAoB;;;0BAZJ,gBAAa;gCAWE,sBAAmB;6BACI,mBAAgB;yCAChB,gCAA6B"}
@@ -3,9 +3,17 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- Object.defineProperty(exports, "useListItem_unstable", {
7
- enumerable: true,
8
- get: function() {
6
+ function _export(target, all) {
7
+ for(var name in all)Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
13
+ useListItemBase_unstable: function() {
14
+ return useListItemBase_unstable;
15
+ },
16
+ useListItem_unstable: function() {
9
17
  return useListItem_unstable;
10
18
  }
11
19
  });
@@ -19,6 +27,97 @@ const _reactcheckbox = require("@fluentui/react-checkbox");
19
27
  const _ListItemActionEvent = require("../../events/ListItemActionEvent.cjs");
20
28
  const DEFAULT_ROOT_EL_TYPE = 'li';
21
29
  const useListItem_unstable = (props, ref)=>{
30
+ var _state_checkmark, _state_checkmark1;
31
+ const { checkmark: checkmarkProp, ...baseProps } = props;
32
+ const state = useListItemBase_unstable({
33
+ ...baseProps,
34
+ // Keep the base ref and event handlers for explicitly rendered Fluent checkmarks.
35
+ checkmark: checkmarkProp === null ? null : checkmarkProp === undefined ? undefined : {}
36
+ }, ref);
37
+ const { navigationMode } = (0, _listContext.useListSynchronousContext)();
38
+ const as = props.as || (navigationMode === 'composite' ? 'div' : DEFAULT_ROOT_EL_TYPE);
39
+ const focusableGroupAttrs = (0, _reacttabster.useFocusableGroup)({
40
+ ignoreDefaultKeydown: {
41
+ Enter: true
42
+ },
43
+ tabBehavior: 'limited-trap-focus'
44
+ });
45
+ const arrowNavigationAttributes = (0, _reacttabster.useArrowNavigationGroup)({
46
+ axis: 'horizontal'
47
+ });
48
+ const tabsterAttributes = (0, _reacttabster.useMergedTabsterAttributes_unstable)(state.navigable ? arrowNavigationAttributes : {}, focusableGroupAttrs, props);
49
+ const baseKeyDown = state.root.onKeyDown;
50
+ const handleKeyDown = (0, _reactutilities.useEventCallback)((e)=>{
51
+ // Invokes the consumer handler and the base Space/Enter behavior before the Tabster additions.
52
+ baseKeyDown === null || baseKeyDown === void 0 ? void 0 : baseKeyDown(e);
53
+ // If the event is fired from an element inside the list item
54
+ if (e.target !== e.currentTarget) {
55
+ if (e.defaultPrevented || !state.navigable) {
56
+ return;
57
+ }
58
+ // If the items are focusable, we need to handle the arrow keys to move focus to them
59
+ switch(e.key){
60
+ // If it's one of the Arrows defined, jump out of the list item to focus on the ListItem itself
61
+ // The ArrowLeft will only trigger if the target element is the leftmost, otherwise the
62
+ // arrowNavigationAttributes handles it and prevents it from bubbling here.
63
+ case _keyboardkeys.ArrowLeft:
64
+ e.target.dispatchEvent(new _reacttabster.GroupperMoveFocusEvent({
65
+ action: _reacttabster.GroupperMoveFocusActions.Escape
66
+ }));
67
+ break;
68
+ case _keyboardkeys.ArrowDown:
69
+ case _keyboardkeys.ArrowUp:
70
+ e.preventDefault();
71
+ // Press ESC on the original target to get focus to the parent group (List)
72
+ e.target.dispatchEvent(new _reacttabster.GroupperMoveFocusEvent({
73
+ action: _reacttabster.GroupperMoveFocusActions.Escape
74
+ }));
75
+ // Now dispatch the original key to move up or down in the list
76
+ e.currentTarget.dispatchEvent(new _reacttabster.MoverMoveFocusEvent({
77
+ key: _reacttabster.MoverKeys[e.key]
78
+ }));
79
+ }
80
+ return;
81
+ }
82
+ if (e.defaultPrevented) {
83
+ return;
84
+ }
85
+ if (e.key === _keyboardkeys.ArrowRight && navigationMode === 'composite') {
86
+ e.target.dispatchEvent(new _reacttabster.GroupperMoveFocusEvent({
87
+ action: _reacttabster.GroupperMoveFocusActions.Enter
88
+ }));
89
+ }
90
+ });
91
+ const checkmark = _reactutilities.slot.optional(checkmarkProp, {
92
+ defaultProps: {
93
+ checked: (_state_checkmark = state.checkmark) === null || _state_checkmark === void 0 ? void 0 : _state_checkmark.checked,
94
+ tabIndex: -1,
95
+ disabled: props.disabledSelection
96
+ },
97
+ renderByDefault: state.selectable,
98
+ elementType: _reactcheckbox.Checkbox
99
+ });
100
+ const mergedCheckmarkRef = (0, _reactutilities.useMergedRefs)(checkmark === null || checkmark === void 0 ? void 0 : checkmark.ref, (_state_checkmark1 = state.checkmark) === null || _state_checkmark1 === void 0 ? void 0 : _state_checkmark1.ref);
101
+ if (checkmark) {
102
+ var _state_checkmark2;
103
+ checkmark.onChange = (0, _reactutilities.mergeCallbacks)(checkmark.onChange, (_state_checkmark2 = state.checkmark) === null || _state_checkmark2 === void 0 ? void 0 : _state_checkmark2.onChange);
104
+ checkmark.ref = mergedCheckmarkRef;
105
+ }
106
+ return {
107
+ ...state,
108
+ components: {
109
+ root: as,
110
+ checkmark: _reactcheckbox.Checkbox
111
+ },
112
+ root: {
113
+ ...state.root,
114
+ ...tabsterAttributes,
115
+ onKeyDown: handleKeyDown
116
+ },
117
+ checkmark
118
+ };
119
+ };
120
+ const useListItemBase_unstable = (props, ref)=>{
22
121
  const id = (0, _reactutilities.useId)('listItem');
23
122
  const { value = id, onKeyDown, onClick, tabIndex, role, onAction, disabledSelection } = props;
24
123
  const toggleItem = (0, _listContext.useListContext_unstable)((ctx)=>{
@@ -33,7 +132,7 @@ const useListItem_unstable = (props, ref)=>{
33
132
  return (_ctx_selection = ctx.selection) === null || _ctx_selection === void 0 ? void 0 : _ctx_selection.isSelected(value);
34
133
  })) !== null && _useListContext_unstable !== void 0 ? _useListContext_unstable : false;
35
134
  const validateListItem = (0, _listContext.useListContext_unstable)((ctx)=>ctx.validateListItem);
36
- const as = props.as || navigationMode === 'composite' ? 'div' : DEFAULT_ROOT_EL_TYPE;
135
+ const as = props.as || (navigationMode === 'composite' ? 'div' : DEFAULT_ROOT_EL_TYPE);
37
136
  const finalListItemRole = role || listItemRole;
38
137
  const focusableItems = Boolean(isSelectionModeEnabled || navigationMode || tabIndex === 0);
39
138
  const rootRef = _react.useRef(null);
@@ -63,12 +162,6 @@ const useListItem_unstable = (props, ref)=>{
63
162
  handleAction(actionEvent);
64
163
  e.target.dispatchEvent(actionEvent);
65
164
  };
66
- const focusableGroupAttrs = (0, _reacttabster.useFocusableGroup)({
67
- ignoreDefaultKeydown: {
68
- Enter: true
69
- },
70
- tabBehavior: 'limited-trap-focus'
71
- });
72
165
  const handleClick = (0, _reactutilities.useEventCallback)((e)=>{
73
166
  onClick === null || onClick === void 0 ? void 0 : onClick(e);
74
167
  if (e.defaultPrevented) {
@@ -85,33 +178,8 @@ const useListItem_unstable = (props, ref)=>{
85
178
  if (e.defaultPrevented) {
86
179
  return;
87
180
  }
88
- // If the event is fired from an element inside the list item
181
+ // Events fired from an element inside the list item are left to the caller's focus management.
89
182
  if (e.target !== e.currentTarget) {
90
- if (focusableItems) {
91
- // If the items are focusable, we need to handle the arrow keys to move focus to them
92
- switch(e.key){
93
- // If it's one of the Arrows defined, jump out of the list item to focus on the ListItem itself
94
- // The ArrowLeft will only trigger if the target element is the leftmost, otherwise the
95
- // arrowNavigationAttributes handles it and prevents it from bubbling here.
96
- case _keyboardkeys.ArrowLeft:
97
- e.target.dispatchEvent(new _reacttabster.GroupperMoveFocusEvent({
98
- action: _reacttabster.GroupperMoveFocusActions.Escape
99
- }));
100
- break;
101
- case _keyboardkeys.ArrowDown:
102
- case _keyboardkeys.ArrowUp:
103
- e.preventDefault();
104
- // Press ESC on the original target to get focus to the parent group (List)
105
- e.target.dispatchEvent(new _reacttabster.GroupperMoveFocusEvent({
106
- action: _reacttabster.GroupperMoveFocusActions.Escape
107
- }));
108
- // Now dispatch the original key to move up or down in the list
109
- e.currentTarget.dispatchEvent(new _reacttabster.MoverMoveFocusEvent({
110
- key: _reacttabster.MoverKeys[e.key]
111
- }));
112
- }
113
- return;
114
- }
115
183
  return;
116
184
  }
117
185
  switch(e.key){
@@ -130,36 +198,24 @@ const useListItem_unstable = (props, ref)=>{
130
198
  case _keyboardkeys.Enter:
131
199
  triggerAction(e);
132
200
  break;
133
- case _keyboardkeys.ArrowRight:
134
- if (navigationMode === 'composite') {
135
- e.target.dispatchEvent(new _reacttabster.GroupperMoveFocusEvent({
136
- action: _reacttabster.GroupperMoveFocusActions.Enter
137
- }));
138
- }
139
- break;
140
201
  }
141
202
  });
142
- const onCheckboxChange = (0, _reactutilities.useEventCallback)((e, data)=>{
203
+ const onCheckboxChange = (0, _reactutilities.useEventCallback)((e)=>{
143
204
  if (!isSelectionModeEnabled || e.defaultPrevented) {
144
205
  return;
145
206
  }
146
207
  toggleItem === null || toggleItem === void 0 ? void 0 : toggleItem(e, value);
147
208
  });
148
- const arrowNavigationAttributes = (0, _reacttabster.useArrowNavigationGroup)({
149
- axis: 'horizontal'
150
- });
151
- const tabsterAttributes = (0, _reacttabster.useMergedTabsterAttributes_unstable)(focusableItems ? arrowNavigationAttributes : {}, focusableGroupAttrs, props);
152
209
  const root = _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)(as, {
153
210
  ref: (0, _reactutilities.useMergedRefs)(rootRef, ref),
154
211
  tabIndex: focusableItems ? 0 : undefined,
155
- role: finalListItemRole,
156
212
  id: String(value),
157
213
  ...isSelectionModeEnabled && {
158
214
  'aria-selected': isSelected,
159
215
  'aria-disabled': disabledSelection && !onAction || undefined
160
216
  },
161
217
  ...props,
162
- ...tabsterAttributes,
218
+ role: finalListItemRole,
163
219
  onKeyDown: handleKeyDown,
164
220
  onClick: isSelectionModeEnabled || onClick || onAction ? handleClick : undefined
165
221
  }), {
@@ -167,12 +223,13 @@ const useListItem_unstable = (props, ref)=>{
167
223
  });
168
224
  const checkmark = _reactutilities.slot.optional(props.checkmark, {
169
225
  defaultProps: {
226
+ type: 'checkbox',
170
227
  checked: isSelected,
171
228
  tabIndex: -1,
172
229
  disabled: disabledSelection
173
230
  },
174
231
  renderByDefault: isSelectionModeEnabled,
175
- elementType: _reactcheckbox.Checkbox
232
+ elementType: 'input'
176
233
  });
177
234
  const mergedCheckmarkRef = (0, _reactutilities.useMergedRefs)(checkmark === null || checkmark === void 0 ? void 0 : checkmark.ref, checkmarkRef);
178
235
  if (checkmark) {
@@ -182,7 +239,7 @@ const useListItem_unstable = (props, ref)=>{
182
239
  const state = {
183
240
  components: {
184
241
  root: as,
185
- checkmark: _reactcheckbox.Checkbox
242
+ checkmark: 'input'
186
243
  },
187
244
  root,
188
245
  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","navigable"],"mappings":"AAAA;;;;;+BAyCa2B;;;;;;;iEAvCU,QAAQ;8BAUxB,0BAA0B;gCAS1B,4BAA4B;6BAEgC,yBAAsB;8BACjB,0BAA0B;+BAEzE,2BAA2B;qCAEe,sCAAmC;AAEtG,MAAMD,uBAAuB;AAWtB,6BAA6B,CAClCE,OACAC;IAEA,MAAMC,SAAKjB,qBAAAA,EAAM;IACjB,MAAM,EAAEkB,QAAQD,EAAE,EAAEE,SAAS,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,iBAAiB,EAAE,GAAGT;IAExF,MAAMU,iBAAatB,oCAAAA,EAAwBuB,CAAAA;YAAOA;gBAAAA,iBAAAA,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QACX,GAAIY,0BAA0B;YAC5B,iBAAiBC;YACjB,iBAAkBP,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,oBAAAA,CAAK6E,QAAQ,CAAC5D,MAAM2D,SAAS,EAAE;QAC/CE,cAAc;YACZC,SAAS9C;YACTV,UAAU,CAAC;YACXyD,UAAUtD;QACZ;QACAuD,iBAAiBjD;QACjB2C,aAAa/D,uBAAAA;IACf;IAEA,MAAMsE,yBAAqB/E,6BAAAA,EAAcyE,cAAAA,QAAAA,cAAAA,KAAAA,IAAAA,KAAAA,IAAAA,UAAW1D,GAAG,EAAEuB;IACzD,IAAImC,WAAW;QACbA,UAAUO,QAAQ,OAAGpF,8BAAAA,EAAe6E,UAAUO,QAAQ,EAAEjB;QACxDU,UAAU1D,GAAG,GAAGgE;IAClB;IAEA,MAAME,QAAuB;QAC3BC,YAAY;YACVd,MAAMpC;YACNyC,WAAWhE,uBAAAA;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;;;;;;;;;;;;4BAuJakC;eAAAA;;IA/GAP,oBAAAA;;;;;iEAtCU,QAAQ;8BAUxB,0BAA0B;gCAS1B,4BAA4B;6BAEgC,yBAAsB;8BACjB,0BAA0B;+BACzE,2BAA2B;qCAEe,sCAAmC;AAEtG,MAAMD,uBAAuB;AAWtB,6BAA6B,CAClCE,OACAC;QA0EaC,kBAQ4CA;IAhFzD,MAAM,EAAEC,WAAWC,aAAa,EAAE,GAAGC,WAAW,GAAGL;IACnD,MAAME,QAAQI,yBACZ;QACE,GAAGD,SAAS;QACZ,kFAAkF;QAClFF,WAAWC,kBAAkB,OAAO,OAAOA,kBAAkBG,YAAYA,YAAY,CAAC;IACxF,GACAN;IAGF,MAAM,EAAEO,cAAc,EAAE,OAAGrB,sCAAAA;IAE3B,MAAMsB,KAAKT,MAAMS,EAAE,IAAKD,CAAAA,mBAAmB,cAAc,QAAQV,oBAAAA,CAAmB;IAEpF,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/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":";;;;;;;;;;;2BAEaA;;;6BAQAC;;;;AARN,MAAMD,0BAA0B,iBAAiB;AAQjD,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":";;;;;;;;;;;2BAGaA;;;6BAWAC;;;;AAXN,MAAMD,0BAA0B,iBAA2D;AAW3F,MAAMC,4BAA4B,CACvCC,gBAEA,IAAIC,YAAuCH,yBAAyB;QAClEI,YAAY;QACZC,SAAS;QACTC,QAAQ;YAAEJ;QAAc;IAC1B,GAAG"}
@@ -12,9 +12,18 @@ _export(exports, {
12
12
  List: function() {
13
13
  return _List.List;
14
14
  },
15
+ ListContextProvider: function() {
16
+ return _List.ListContextProvider;
17
+ },
15
18
  ListItem: function() {
16
19
  return _ListItem.ListItem;
17
20
  },
21
+ calculateListItemRoleForListRole: function() {
22
+ return _index.calculateListItemRoleForListRole;
23
+ },
24
+ calculateListRole: function() {
25
+ return _index.calculateListRole;
26
+ },
18
27
  listClassNames: function() {
19
28
  return _List.listClassNames;
20
29
  },
@@ -27,6 +36,18 @@ _export(exports, {
27
36
  renderList_unstable: function() {
28
37
  return _List.renderList_unstable;
29
38
  },
39
+ useListBase_unstable: function() {
40
+ return _List.useListBase_unstable;
41
+ },
42
+ useListContextValues_unstable: function() {
43
+ return _List.useListContextValues_unstable;
44
+ },
45
+ useListContext_unstable: function() {
46
+ return _List.useListContext_unstable;
47
+ },
48
+ useListItemBase_unstable: function() {
49
+ return _ListItem.useListItemBase_unstable;
50
+ },
30
51
  useListItemStyles_unstable: function() {
31
52
  return _ListItem.useListItemStyles_unstable;
32
53
  },
@@ -38,7 +59,20 @@ _export(exports, {
38
59
  },
39
60
  useList_unstable: function() {
40
61
  return _List.useList_unstable;
62
+ },
63
+ validateGridCellsArePresent: function() {
64
+ return _index.validateGridCellsArePresent;
65
+ },
66
+ validateListItemElement: function() {
67
+ return _index.validateListItemElement;
68
+ },
69
+ validateProperElementTypes: function() {
70
+ return _index.validateProperElementTypes;
71
+ },
72
+ validateProperRolesAreUsed: function() {
73
+ return _index.validateProperRolesAreUsed;
41
74
  }
42
75
  });
43
76
  const _List = require("./List.cjs");
77
+ const _index = require("./utils/index.cjs");
44
78
  const _ListItem = require("./ListItem.cjs");
@@ -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":";;;;;;;;;;;IAASA;yBAAI;;IAIXK;iCAAQ;;;eAJKJ,oBAAc;;sBAKT;eAAlBK;;;eACAC,iCAAuB;;;eANML,yBAAmB;;;eAOhDM,oCAA0B;;;eAC1BC,8BAAoB;;;eAR8BN,4BAAsB;;;eAAEC,sBAAgB;;;sBAAQ,YAAS;0BAStG,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":";;;;;;;;;;;IACEA;yBAAI;;;eACJC,yBAAmB;;;eA+BnBc,kBAAQ;;;eATRN,uCAAgC;;;eAChCC,wBAAiB;;;eAtBjBR,oBAAc;;IA+Bdc;2CAAkB;;;eAClBC,iCAAuB;;;eA/BvBd,yBAAmB;;;eACnBC,0BAAoB;;;eACpBC,mCAA6B;;;eAC7BC,6BAAuB;;;eA6BvBY,kCAAwB;;;eACxBC,oCAA0B;;;eAC1BC,8BAAoB;;;eA9BpBb,4BAAsB;;;eACtBC,sBAAgB;;;eAiBhBG,kCAA2B;;;eAC3BC,8BAAuB;;IACvBC;gDAA0B;;;eAC1BC,iCAA0B;;;sBAnBrB,YAAS;uBAoBT,mBAAU;0BASV,gBAAa"}
@@ -18,6 +18,9 @@ _export(exports, {
18
18
  validateGridCellsArePresent: function() {
19
19
  return _validateGridCellsArePresent.validateGridCellsArePresent;
20
20
  },
21
+ validateListItemElement: function() {
22
+ return _validateListItemElement.validateListItemElement;
23
+ },
21
24
  validateProperElementTypes: function() {
22
25
  return _validateProperElementTypes.validateProperElementTypes;
23
26
  },
@@ -26,6 +29,7 @@ _export(exports, {
26
29
  }
27
30
  });
28
31
  const _calculateListRole = require("./calculateListRole.cjs");
32
+ const _validateListItemElement = require("./validateListItemElement.cjs");
29
33
  const _validateProperElementTypes = require("./validateProperElementTypes.cjs");
30
34
  const _validateProperRolesAreUsed = require("./validateProperRolesAreUsed.cjs");
31
35
  const _calculateListItemRoleForListRole = require("./calculateListItemRoleForListRole.cjs");
@@ -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":";;;;;;;;;;;;eAGSG,kEAAgC;;;eAHhCH,oCAAiB;;;eAIjBI,wDAA2B;;;eAH3BH,sDAA0B;;;eAC1BC,sDAA0B;;;mCAFD,yBAAsB;4CACb,kCAA+B;4CAC/B,kCAA+B;kDACzB,wCAAqC;6CAC1C,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":";;;;;;;;;;;;eAISI,kEAAgC;;;eAJhCJ,oCAAiB;;;eAKjBK,wDAA2B;;;eAJ3BJ,gDAAuB;;;eACvBC,sDAA0B;;;eAC1BC,sDAA0B;;;mCAHD,yBAAsB;yCAChB,+BAA4B;4CACzB,kCAA+B;4CAC/B,kCAA+B;kDACzB,wCAAqC;6CAC1C,mCAAgC"}