@fluentui/react-list 0.0.0-nightly-20250107-0406.1

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 (113) hide show
  1. package/CHANGELOG.md +352 -0
  2. package/LICENSE +15 -0
  3. package/README.md +5 -0
  4. package/dist/index.d.ts +148 -0
  5. package/lib/List.js +1 -0
  6. package/lib/List.js.map +1 -0
  7. package/lib/ListItem.js +1 -0
  8. package/lib/ListItem.js.map +1 -0
  9. package/lib/components/List/List.js +14 -0
  10. package/lib/components/List/List.js.map +1 -0
  11. package/lib/components/List/List.types.js +1 -0
  12. package/lib/components/List/List.types.js.map +1 -0
  13. package/lib/components/List/index.js +4 -0
  14. package/lib/components/List/index.js.map +1 -0
  15. package/lib/components/List/listContext.js +11 -0
  16. package/lib/components/List/listContext.js.map +1 -0
  17. package/lib/components/List/renderList.js +12 -0
  18. package/lib/components/List/renderList.js.map +1 -0
  19. package/lib/components/List/useList.js +75 -0
  20. package/lib/components/List/useList.js.map +1 -0
  21. package/lib/components/List/useListContextValues.js +12 -0
  22. package/lib/components/List/useListContextValues.js.map +1 -0
  23. package/lib/components/List/useListStyles.styles.js +15 -0
  24. package/lib/components/List/useListStyles.styles.js.map +1 -0
  25. package/lib/components/ListItem/ListItem.js +12 -0
  26. package/lib/components/ListItem/ListItem.js.map +1 -0
  27. package/lib/components/ListItem/ListItem.types.js +3 -0
  28. package/lib/components/ListItem/ListItem.types.js.map +1 -0
  29. package/lib/components/ListItem/index.js +4 -0
  30. package/lib/components/ListItem/index.js.map +1 -0
  31. package/lib/components/ListItem/renderListItem.js +13 -0
  32. package/lib/components/ListItem/renderListItem.js.map +1 -0
  33. package/lib/components/ListItem/useListItem.js +185 -0
  34. package/lib/components/ListItem/useListItem.js.map +1 -0
  35. package/lib/components/ListItem/useListItemStyles.styles.js +48 -0
  36. package/lib/components/ListItem/useListItemStyles.styles.js.map +1 -0
  37. package/lib/events/ListItemActionEvent.js +9 -0
  38. package/lib/events/ListItemActionEvent.js.map +1 -0
  39. package/lib/hooks/index.js +1 -0
  40. package/lib/hooks/index.js.map +1 -0
  41. package/lib/hooks/types.js +1 -0
  42. package/lib/hooks/types.js.map +1 -0
  43. package/lib/hooks/useListSelection.js +41 -0
  44. package/lib/hooks/useListSelection.js.map +1 -0
  45. package/lib/index.js +2 -0
  46. package/lib/index.js.map +1 -0
  47. package/lib/utils/calculateListItemRoleForListRole.js +16 -0
  48. package/lib/utils/calculateListItemRoleForListRole.js.map +1 -0
  49. package/lib/utils/calculateListRole.js +14 -0
  50. package/lib/utils/calculateListRole.js.map +1 -0
  51. package/lib/utils/index.js +5 -0
  52. package/lib/utils/index.js.map +1 -0
  53. package/lib/utils/validateGridCellsArePresent.js +16 -0
  54. package/lib/utils/validateGridCellsArePresent.js.map +1 -0
  55. package/lib/utils/validateProperElementTypes.js +12 -0
  56. package/lib/utils/validateProperElementTypes.js.map +1 -0
  57. package/lib/utils/validateProperRolesAreUsed.js +36 -0
  58. package/lib/utils/validateProperRolesAreUsed.js.map +1 -0
  59. package/lib-commonjs/List.js +28 -0
  60. package/lib-commonjs/List.js.map +1 -0
  61. package/lib-commonjs/ListItem.js +28 -0
  62. package/lib-commonjs/ListItem.js.map +1 -0
  63. package/lib-commonjs/components/List/List.js +25 -0
  64. package/lib-commonjs/components/List/List.js.map +1 -0
  65. package/lib-commonjs/components/List/List.types.js +6 -0
  66. package/lib-commonjs/components/List/List.types.js.map +1 -0
  67. package/lib-commonjs/components/List/index.js +31 -0
  68. package/lib-commonjs/components/List/index.js.map +1 -0
  69. package/lib-commonjs/components/List/listContext.js +32 -0
  70. package/lib-commonjs/components/List/listContext.js.map +1 -0
  71. package/lib-commonjs/components/List/renderList.js +20 -0
  72. package/lib-commonjs/components/List/renderList.js.map +1 -0
  73. package/lib-commonjs/components/List/useList.js +78 -0
  74. package/lib-commonjs/components/List/useList.js.map +1 -0
  75. package/lib-commonjs/components/List/useListContextValues.js +22 -0
  76. package/lib-commonjs/components/List/useListContextValues.js.map +1 -0
  77. package/lib-commonjs/components/List/useListStyles.styles.js +31 -0
  78. package/lib-commonjs/components/List/useListStyles.styles.js.map +1 -0
  79. package/lib-commonjs/components/ListItem/ListItem.js +23 -0
  80. package/lib-commonjs/components/ListItem/ListItem.js.map +1 -0
  81. package/lib-commonjs/components/ListItem/ListItem.types.js +6 -0
  82. package/lib-commonjs/components/ListItem/ListItem.types.js.map +1 -0
  83. package/lib-commonjs/components/ListItem/index.js +31 -0
  84. package/lib-commonjs/components/ListItem/index.js.map +1 -0
  85. package/lib-commonjs/components/ListItem/renderListItem.js +21 -0
  86. package/lib-commonjs/components/ListItem/renderListItem.js.map +1 -0
  87. package/lib-commonjs/components/ListItem/useListItem.js +188 -0
  88. package/lib-commonjs/components/ListItem/useListItem.js.map +1 -0
  89. package/lib-commonjs/components/ListItem/useListItemStyles.styles.js +71 -0
  90. package/lib-commonjs/components/ListItem/useListItemStyles.styles.js.map +1 -0
  91. package/lib-commonjs/events/ListItemActionEvent.js +28 -0
  92. package/lib-commonjs/events/ListItemActionEvent.js.map +1 -0
  93. package/lib-commonjs/hooks/index.js +11 -0
  94. package/lib-commonjs/hooks/index.js.map +1 -0
  95. package/lib-commonjs/hooks/types.js +6 -0
  96. package/lib-commonjs/hooks/types.js.map +1 -0
  97. package/lib-commonjs/hooks/useListSelection.js +52 -0
  98. package/lib-commonjs/hooks/useListSelection.js.map +1 -0
  99. package/lib-commonjs/index.js +44 -0
  100. package/lib-commonjs/index.js.map +1 -0
  101. package/lib-commonjs/utils/calculateListItemRoleForListRole.js +26 -0
  102. package/lib-commonjs/utils/calculateListItemRoleForListRole.js.map +1 -0
  103. package/lib-commonjs/utils/calculateListRole.js +24 -0
  104. package/lib-commonjs/utils/calculateListRole.js.map +1 -0
  105. package/lib-commonjs/utils/index.js +32 -0
  106. package/lib-commonjs/utils/index.js.map +1 -0
  107. package/lib-commonjs/utils/validateGridCellsArePresent.js +26 -0
  108. package/lib-commonjs/utils/validateGridCellsArePresent.js.map +1 -0
  109. package/lib-commonjs/utils/validateProperElementTypes.js +22 -0
  110. package/lib-commonjs/utils/validateProperElementTypes.js.map +1 -0
  111. package/lib-commonjs/utils/validateProperRolesAreUsed.js +46 -0
  112. package/lib-commonjs/utils/validateProperRolesAreUsed.js.map +1 -0
  113. package/package.json +56 -0
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Validates that grid cells are present in a grid list item. This is necessary for proper screen reader support.
3
+ * If grid cells are not present and we're not running in production mode, a warning will be logged to the console.
4
+ * @param listRole - The role of the list
5
+ * @param listItemEl - The list item element
6
+ * @returns
7
+ */ export const validateGridCellsArePresent = (listRole, listItemEl)=>{
8
+ if (listRole !== 'grid') {
9
+ return;
10
+ }
11
+ const gridCells = listItemEl.querySelectorAll(':scope > [role="gridcell"]');
12
+ if (gridCells.length === 0) {
13
+ //eslint-disable-next-line no-console
14
+ console.warn(`@fluentui/react-list [useList]:\nList items in List with "grid" role (which is automatically assigned when navigationMode is set to "composite") must contain at least one "gridcell" as direct child of <ListItem /> for proper screen reader support.`, `Ideally, each focus target should be in it's own "gridcell", which is a direct child of <ListItem />.\n`);
15
+ }
16
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/validateGridCellsArePresent.ts"],"sourcesContent":["/**\n * Validates that grid cells are present in a grid list item. This is necessary for proper screen reader support.\n * If grid cells are not present and we're not running in production mode, a warning will be logged to the console.\n * @param listRole - The role of the list\n * @param listItemEl - The list item element\n * @returns\n */\nexport const validateGridCellsArePresent = (listRole: string, listItemEl: HTMLElement) => {\n if (listRole !== 'grid') {\n return;\n }\n\n const gridCells = listItemEl.querySelectorAll(':scope > [role=\"gridcell\"]');\n if (gridCells.length === 0) {\n //eslint-disable-next-line no-console\n console.warn(\n `@fluentui/react-list [useList]:\\nList items in List with \"grid\" role (which is automatically assigned when navigationMode is set to \"composite\") must contain at least one \"gridcell\" as direct child of <ListItem /> for proper screen reader support.`,\n `Ideally, each focus target should be in it's own \"gridcell\", which is a direct child of <ListItem />.\\n`,\n );\n }\n};\n"],"names":["validateGridCellsArePresent","listRole","listItemEl","gridCells","querySelectorAll","length","console","warn"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":"AAAA;;;;;;CAMC,GACD,OAAO,MAAMA,8BAA8B,CAACC,UAAkBC;IAC5D,IAAID,aAAa,QAAQ;QACvB;IACF;IAEA,MAAME,YAAYD,WAAWE,gBAAgB,CAAC;IAC9C,IAAID,UAAUE,MAAM,KAAK,GAAG;QAC1B,qCAAqC;QACrCC,QAAQC,IAAI,CACV,CAAC,uPAAuP,CAAC,EACzP,CAAC,uGAAuG,CAAC;IAE7G;AACF,EAAE"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Validates that the List and ListItem elements are compatible
3
+ * @param listRenderedAs - the type of the parent element
4
+ * @param listItemRenderedAs - the type of the child element
5
+ */ export function validateProperElementTypes(listRenderedAs, listItemRenderedAs) {
6
+ if (listItemRenderedAs === 'div' && listRenderedAs !== 'div') {
7
+ throw new Error('ListItem cannot be rendered as a div when its parent is not a div.');
8
+ }
9
+ if (listItemRenderedAs === 'li' && listRenderedAs === 'div') {
10
+ throw new Error('ListItem cannot be rendered as a li when its parent is a div.');
11
+ }
12
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/validateProperElementTypes.ts"],"sourcesContent":["/**\n * Validates that the List and ListItem elements are compatible\n * @param listRenderedAs - the type of the parent element\n * @param listItemRenderedAs - the type of the child element\n */\nexport function validateProperElementTypes(listRenderedAs?: string, listItemRenderedAs?: string) {\n if (listItemRenderedAs === 'div' && listRenderedAs !== 'div') {\n throw new Error('ListItem cannot be rendered as a div when its parent is not a div.');\n }\n if (listItemRenderedAs === 'li' && listRenderedAs === 'div') {\n throw new Error('ListItem cannot be rendered as a li when its parent is a div.');\n }\n}\n"],"names":["validateProperElementTypes","listRenderedAs","listItemRenderedAs","Error"],"rangeMappings":";;;;;;;;;;;","mappings":"AAAA;;;;CAIC,GACD,OAAO,SAASA,2BAA2BC,cAAuB,EAAEC,kBAA2B;IAC7F,IAAIA,uBAAuB,SAASD,mBAAmB,OAAO;QAC5D,MAAM,IAAIE,MAAM;IAClB;IACA,IAAID,uBAAuB,QAAQD,mBAAmB,OAAO;QAC3D,MAAM,IAAIE,MAAM;IAClB;AACF"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Validate that the proper roles are used for the given combination of roles and states.
3
+ * If the roles are invalid and we're not running in production mode, an warning will be logged to the console.
4
+ *
5
+ * @param role - the role of the list
6
+ * @param listItemRole - the role of the list item
7
+ * @param hasSelection - whether the list has selection enabled
8
+ * @param hasFocusableChildren - whether the list has focusable children
9
+ * @returns
10
+ */ export const validateProperRolesAreUsed = (role, listItemRole, hasSelection, hasFocusableChildren)=>{
11
+ // Explode when the pair of roles is invalid
12
+ if (role === 'list' && listItemRole !== 'listitem') {
13
+ throw new Error('When the List role is "list", ListItem role must be "listitem".');
14
+ }
15
+ if (role === 'listbox' && listItemRole !== 'option') {
16
+ throw new Error('When the List role is "listbox", ListItem role must be "option".');
17
+ }
18
+ if (role === 'grid' && listItemRole !== 'row') {
19
+ throw new Error('When the List role is "grid", ListItem role must be "row".');
20
+ }
21
+ const expectedRole = (()=>{
22
+ if (hasFocusableChildren) {
23
+ return 'grid';
24
+ } else {
25
+ if (hasSelection) {
26
+ return 'listbox';
27
+ } else {
28
+ return 'list';
29
+ }
30
+ }
31
+ })();
32
+ if (role !== expectedRole) {
33
+ /* eslint-disable-next-line no-console */ console.warn(`@fluentui/react-list [useList]:\nThe role "${role}" does not match the expected role "${expectedRole}".\nPlease use the "navigationMode" property for automatic role assignment and keyboard navigation.\nIf you are using this role intentionally, make sure to verify screen reader support.
34
+ `);
35
+ }
36
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/validateProperRolesAreUsed.ts"],"sourcesContent":["/**\n * Validate that the proper roles are used for the given combination of roles and states.\n * If the roles are invalid and we're not running in production mode, an warning will be logged to the console.\n *\n * @param role - the role of the list\n * @param listItemRole - the role of the list item\n * @param hasSelection - whether the list has selection enabled\n * @param hasFocusableChildren - whether the list has focusable children\n * @returns\n */\nexport const validateProperRolesAreUsed = (\n role: string,\n listItemRole: string,\n hasSelection: boolean,\n hasFocusableChildren: boolean,\n) => {\n // Explode when the pair of roles is invalid\n if (role === 'list' && listItemRole !== 'listitem') {\n throw new Error('When the List role is \"list\", ListItem role must be \"listitem\".');\n }\n if (role === 'listbox' && listItemRole !== 'option') {\n throw new Error('When the List role is \"listbox\", ListItem role must be \"option\".');\n }\n if (role === 'grid' && listItemRole !== 'row') {\n throw new Error('When the List role is \"grid\", ListItem role must be \"row\".');\n }\n\n const expectedRole = (() => {\n if (hasFocusableChildren) {\n return 'grid';\n } else {\n if (hasSelection) {\n return 'listbox';\n } else {\n return 'list';\n }\n }\n })();\n\n if (role !== expectedRole) {\n /* eslint-disable-next-line no-console */\n console.warn(`@fluentui/react-list [useList]:\\nThe role \"${role}\" does not match the expected role \"${expectedRole}\".\\nPlease use the \"navigationMode\" property for automatic role assignment and keyboard navigation.\\nIf you are using this role intentionally, make sure to verify screen reader support.\n `);\n }\n};\n"],"names":["validateProperRolesAreUsed","role","listItemRole","hasSelection","hasFocusableChildren","Error","expectedRole","console","warn"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;;;;;;;;CASC,GACD,OAAO,MAAMA,6BAA6B,CACxCC,MACAC,cACAC,cACAC;IAEA,4CAA4C;IAC5C,IAAIH,SAAS,UAAUC,iBAAiB,YAAY;QAClD,MAAM,IAAIG,MAAM;IAClB;IACA,IAAIJ,SAAS,aAAaC,iBAAiB,UAAU;QACnD,MAAM,IAAIG,MAAM;IAClB;IACA,IAAIJ,SAAS,UAAUC,iBAAiB,OAAO;QAC7C,MAAM,IAAIG,MAAM;IAClB;IAEA,MAAMC,eAAe,AAAC,CAAA;QACpB,IAAIF,sBAAsB;YACxB,OAAO;QACT,OAAO;YACL,IAAID,cAAc;gBAChB,OAAO;YACT,OAAO;gBACL,OAAO;YACT;QACF;IACF,CAAA;IAEA,IAAIF,SAASK,cAAc;QACzB,uCAAuC,GACvCC,QAAQC,IAAI,CAAC,CAAC,2CAA2C,EAAEP,KAAK,oCAAoC,EAAEK,aAAa;IACnH,CAAC;IACH;AACF,EAAE"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ List: function() {
13
+ return _index.List;
14
+ },
15
+ listClassNames: function() {
16
+ return _index.listClassNames;
17
+ },
18
+ renderList_unstable: function() {
19
+ return _index.renderList_unstable;
20
+ },
21
+ useListStyles_unstable: function() {
22
+ return _index.useListStyles_unstable;
23
+ },
24
+ useList_unstable: function() {
25
+ return _index.useList_unstable;
26
+ }
27
+ });
28
+ const _index = require("./components/List/index");
@@ -0,0 +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"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAUEA,IAAI;eAAJA,WAAI;;IACJC,cAAc;eAAdA,qBAAc;;IACdC,mBAAmB;eAAnBA,0BAAmB;;IACnBC,sBAAsB;eAAtBA,6BAAsB;;IACtBC,gBAAgB;eAAhBA,uBAAgB;;;uBACX"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ ListItem: function() {
13
+ return _index.ListItem;
14
+ },
15
+ listItemClassNames: function() {
16
+ return _index.listItemClassNames;
17
+ },
18
+ renderListItem_unstable: function() {
19
+ return _index.renderListItem_unstable;
20
+ },
21
+ useListItemStyles_unstable: function() {
22
+ return _index.useListItemStyles_unstable;
23
+ },
24
+ useListItem_unstable: function() {
25
+ return _index.useListItem_unstable;
26
+ }
27
+ });
28
+ const _index = require("./components/ListItem/index");
@@ -0,0 +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"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAQEA,QAAQ;eAARA,eAAQ;;IACRC,kBAAkB;eAAlBA,yBAAkB;;IAClBC,uBAAuB;eAAvBA,8BAAuB;;IACvBC,0BAA0B;eAA1BA,iCAA0B;;IAC1BC,oBAAoB;eAApBA,2BAAoB;;;uBACf"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "List", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return List;
9
+ }
10
+ });
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
14
+ const _useList = require("./useList");
15
+ const _renderList = require("./renderList");
16
+ const _useListStylesstyles = require("./useListStyles.styles");
17
+ const _useListContextValues = require("./useListContextValues");
18
+ const List = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
19
+ const state = (0, _useList.useList_unstable)(props, ref);
20
+ const contextValues = (0, _useListContextValues.useListContextValues_unstable)(state);
21
+ (0, _useListStylesstyles.useListStyles_unstable)(state);
22
+ (0, _reactsharedcontexts.useCustomStyleHook_unstable)('useListStyles_unstable')(state);
23
+ return (0, _renderList.renderList_unstable)(state, contextValues);
24
+ });
25
+ List.displayName = 'List';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/List/List.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\nimport { useList_unstable } from './useList';\nimport { renderList_unstable } from './renderList';\nimport { useListStyles_unstable } from './useListStyles.styles';\nimport type { ListProps } from './List.types';\nimport { useListContextValues_unstable } from './useListContextValues';\n\nexport const List: ForwardRefComponent<ListProps> = React.forwardRef((props, ref) => {\n const state = useList_unstable(props, ref);\n const contextValues = useListContextValues_unstable(state);\n\n useListStyles_unstable(state);\n useCustomStyleHook_unstable('useListStyles_unstable')(state);\n\n return renderList_unstable(state, contextValues);\n});\n\nList.displayName = 'List';\n"],"names":["List","React","forwardRef","props","ref","state","useList_unstable","contextValues","useListContextValues_unstable","useListStyles_unstable","useCustomStyleHook_unstable","renderList_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;;iEATU;qCAEqB;yBACX;4BACG;qCACG;sCAEO;AAEvC,MAAMA,OAAAA,WAAAA,GAAuCC,OAAMC,UAAU,CAAC,CAACC,OAAOC;IAC3E,MAAMC,QAAQC,IAAAA,yBAAAA,EAAiBH,OAAOC;IACtC,MAAMG,gBAAgBC,IAAAA,mDAAAA,EAA8BH;IAEpDI,IAAAA,2CAAAA,EAAuBJ;IACvBK,IAAAA,gDAAAA,EAA4B,0BAA0BL;IAEtD,OAAOM,IAAAA,+BAAAA,EAAoBN,OAAOE;AACpC;AAEAP,KAAKY,WAAW,GAAG"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
6
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/List/List.types.ts"],"sourcesContent":["import * as React from 'react';\n\nimport type {\n ComponentProps,\n ComponentState,\n Slot,\n SelectionMode,\n SelectionItemId,\n EventHandler,\n EventData,\n} from '@fluentui/react-utilities';\nimport type { ListSelectionState } from '../../hooks/types';\n\nexport type ListSlots = {\n root: NonNullable<Slot<'ul', 'div' | 'ol'>>;\n};\n\nexport type OnListSelectionChangeData = EventData<'change', React.SyntheticEvent> & {\n selectedItems: SelectionItemId[];\n};\n\nexport type ListNavigationMode = 'items' | 'composite';\n\n/**\n * List Props\n */\nexport type ListProps = ComponentProps<ListSlots> & {\n navigationMode?: ListNavigationMode;\n selectionMode?: SelectionMode;\n selectedItems?: SelectionItemId[];\n defaultSelectedItems?: SelectionItemId[];\n onSelectionChange?: EventHandler<OnListSelectionChangeData>;\n};\n\nexport type ListContextValue = {\n navigationMode: ListNavigationMode | undefined;\n selection?: ListSelectionState;\n listItemRole: string;\n validateListItem: (listItemElement: HTMLElement) => void;\n};\n\nexport type ListContextValues = {\n listContext: ListContextValue;\n};\n\n/**\n * State used in rendering List\n */\nexport type ListState = ComponentState<ListSlots> & ListContextValue;\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;iEAAuB"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ List: function() {
13
+ return _List.List;
14
+ },
15
+ listClassNames: function() {
16
+ return _useListStylesstyles.listClassNames;
17
+ },
18
+ renderList_unstable: function() {
19
+ return _renderList.renderList_unstable;
20
+ },
21
+ useListStyles_unstable: function() {
22
+ return _useListStylesstyles.useListStyles_unstable;
23
+ },
24
+ useList_unstable: function() {
25
+ return _useList.useList_unstable;
26
+ }
27
+ });
28
+ const _List = require("./List");
29
+ const _renderList = require("./renderList");
30
+ const _useList = require("./useList");
31
+ const _useListStylesstyles = require("./useListStyles.styles");
@@ -0,0 +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","listClassNames","renderList_unstable","useListStyles_unstable","useList_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,IAAI;eAAJA,UAAI;;IAYJC,cAAc;eAAdA,mCAAc;;IAFdC,mBAAmB;eAAnBA,+BAAmB;;IAEHC,sBAAsB;eAAtBA,2CAAsB;;IADtCC,gBAAgB;eAAhBA,yBAAgB;;;sBAXJ;4BAUe;yBACH;qCACsB"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ ListContextProvider: function() {
13
+ return ListContextProvider;
14
+ },
15
+ listContextDefaultValue: function() {
16
+ return listContextDefaultValue;
17
+ },
18
+ useListContext_unstable: function() {
19
+ return useListContext_unstable;
20
+ }
21
+ });
22
+ const _reactcontextselector = require("@fluentui/react-context-selector");
23
+ const listContextDefaultValue = {
24
+ navigationMode: undefined,
25
+ selection: undefined,
26
+ listItemRole: 'listitem',
27
+ validateListItem: ()=>{
28
+ /* noop */ }
29
+ };
30
+ const listContext = (0, _reactcontextselector.createContext)(undefined);
31
+ const ListContextProvider = listContext.Provider;
32
+ const useListContext_unstable = (selector)=>(0, _reactcontextselector.useContextSelector)(listContext, (ctx = listContextDefaultValue)=>selector(ctx));
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/List/listContext.ts"],"sourcesContent":["import { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { ContextSelector } from '@fluentui/react-context-selector';\nimport { ListContextValue } from './List.types';\n\nexport const listContextDefaultValue: ListContextValue = {\n navigationMode: undefined,\n selection: undefined,\n listItemRole: 'listitem',\n validateListItem: () => {\n /* noop */\n },\n};\n\nconst listContext = createContext<ListContextValue | undefined>(undefined);\n\nexport const ListContextProvider = listContext.Provider;\n\nexport const useListContext_unstable = <T>(selector: ContextSelector<ListContextValue, T>): T =>\n useContextSelector(listContext, (ctx = listContextDefaultValue) => selector(ctx));\n"],"names":["ListContextProvider","listContextDefaultValue","useListContext_unstable","navigationMode","undefined","selection","listItemRole","validateListItem","listContext","createContext","Provider","selector","useContextSelector","ctx"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAeaA,mBAAAA;eAAAA;;IAXAC,uBAAAA;eAAAA;;IAaAC,uBAAAA;eAAAA;;;sCAjBqC;AAI3C,MAAMD,0BAA4C;IACvDE,gBAAgBC;IAChBC,WAAWD;IACXE,cAAc;IACdC,kBAAkB;IAChB,QAAQ,GACV;AACF;AAEA,MAAMC,cAAcC,IAAAA,mCAAAA,EAA4CL;AAEzD,MAAMJ,sBAAsBQ,YAAYE,QAAQ;AAEhD,MAAMR,0BAA0B,CAAIS,WACzCC,IAAAA,wCAAAA,EAAmBJ,aAAa,CAACK,MAAMZ,uBAAuB,GAAKU,SAASE"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "renderList_unstable", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return renderList_unstable;
9
+ }
10
+ });
11
+ const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
12
+ const _reactutilities = require("@fluentui/react-utilities");
13
+ const _listContext = require("./listContext");
14
+ const renderList_unstable = (state, contextValues)=>{
15
+ (0, _reactutilities.assertSlots)(state);
16
+ return /*#__PURE__*/ (0, _jsxruntime.jsx)(_listContext.ListContextProvider, {
17
+ value: contextValues.listContext,
18
+ children: /*#__PURE__*/ (0, _jsxruntime.jsx)(state.root, {})
19
+ });
20
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/List/renderList.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { ListState, ListSlots, ListContextValues } from './List.types';\nimport { ListContextProvider } from './listContext';\n\n/**\n * Render the final JSX of List\n */\nexport const renderList_unstable = (state: ListState, contextValues: ListContextValues) => {\n assertSlots<ListSlots>(state);\n\n return (\n <ListContextProvider value={contextValues.listContext}>\n <state.root />\n </ListContextProvider>\n );\n};\n"],"names":["renderList_unstable","state","contextValues","assertSlots","_jsx","ListContextProvider","value","listContext","root"],"rangeMappings":";;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAUaA;;;eAAAA;;;4BATb;gCAE4B;6BAEQ;AAK7B,MAAMA,sBAAsB,CAACC,OAAkBC;IACpDC,IAAAA,2BAAAA,EAAuBF;IAEvB,OAAA,WAAA,GACEG,IAAAA,eAAA,EAACC,gCAAAA,EAAAA;QAAoBC,OAAOJ,cAAcK,WAAW;kBACnD,WAAA,GAAAH,IAAAA,eAAA,EAACH,MAAMO,IAAI,EAAA,CAAA;;AAGjB"}
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useList_unstable", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return useList_unstable;
9
+ }
10
+ });
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const _reactutilities = require("@fluentui/react-utilities");
14
+ const _reacttabster = require("@fluentui/react-tabster");
15
+ const _useListSelection = require("../../hooks/useListSelection");
16
+ const _utils = require("../../utils");
17
+ const DEFAULT_ROOT_EL_TYPE = 'ul';
18
+ const useList_unstable = (props, ref)=>{
19
+ const { navigationMode, selectionMode, selectedItems, defaultSelectedItems, onSelectionChange } = props;
20
+ const as = props.as || navigationMode === 'composite' ? 'div' : DEFAULT_ROOT_EL_TYPE;
21
+ const arrowNavigationAttributes = (0, _reacttabster.useArrowNavigationGroup)({
22
+ axis: 'vertical',
23
+ memorizeCurrent: true
24
+ });
25
+ const [selectionState, setSelectionState] = (0, _reactutilities.useControllableState)({
26
+ state: selectedItems,
27
+ defaultState: defaultSelectedItems,
28
+ initialState: []
29
+ });
30
+ const onChange = (0, _reactutilities.useEventCallback)((e, data)=>{
31
+ const selectedItemsAsArray = Array.from(data.selectedItems);
32
+ setSelectionState(selectedItemsAsArray);
33
+ onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(e, {
34
+ event: e,
35
+ type: 'change',
36
+ selectedItems: selectedItemsAsArray
37
+ });
38
+ });
39
+ const selection = (0, _useListSelection.useListSelection)({
40
+ onSelectionChange: onChange,
41
+ selectionMode: selectionMode || 'multiselect',
42
+ selectedItems: selectionState
43
+ });
44
+ const listRole = props.role || (0, _utils.calculateListRole)(navigationMode, !!selectionMode);
45
+ const listItemRole = (0, _utils.calculateListItemRoleForListRole)(listRole);
46
+ const { findAllFocusable } = (0, _reacttabster.useFocusFinders)();
47
+ const validateListItem = (0, _reactutilities.useEventCallback)((listItemEl)=>{
48
+ if (process.env.NODE_ENV === 'production') {
49
+ return;
50
+ }
51
+ const itemRole = listItemEl.getAttribute('role') || '';
52
+ const focusable = findAllFocusable(listItemEl);
53
+ (0, _utils.validateProperElementTypes)(as, listItemEl.tagName.toLocaleLowerCase());
54
+ (0, _utils.validateProperRolesAreUsed)(listRole, itemRole, !!selectionMode, focusable.length > 0);
55
+ (0, _utils.validateGridCellsArePresent)(listRole, listItemEl);
56
+ });
57
+ return {
58
+ components: {
59
+ root: as
60
+ },
61
+ root: _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)(as, {
62
+ ref,
63
+ role: listRole,
64
+ ...selectionMode && {
65
+ 'aria-multiselectable': selectionMode === 'multiselect' ? true : undefined
66
+ },
67
+ ...arrowNavigationAttributes,
68
+ ...props
69
+ }), {
70
+ elementType: as
71
+ }),
72
+ listItemRole,
73
+ validateListItem,
74
+ navigationMode,
75
+ // only pass down selection state if its handled internally, otherwise just report the events
76
+ selection: selectionMode ? selection : undefined
77
+ };
78
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/List/useList.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n getIntrinsicElementProps,\n OnSelectionChangeData,\n slot,\n useControllableState,\n useEventCallback,\n} from '@fluentui/react-utilities';\nimport { useArrowNavigationGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { 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":["useList_unstable","DEFAULT_ROOT_EL_TYPE","props","ref","navigationMode","selectionMode","selectedItems","defaultSelectedItems","onSelectionChange","as","arrowNavigationAttributes","useArrowNavigationGroup","axis","memorizeCurrent","selectionState","setSelectionState","useControllableState","state","defaultState","initialState","onChange","useEventCallback","e","data","selectedItemsAsArray","Array","from","event","type","selection","useListSelection","listRole","role","calculateListRole","listItemRole","calculateListItemRoleForListRole","findAllFocusable","useFocusFinders","validateListItem","listItemEl","process","env","NODE_ENV","itemRole","getAttribute","focusable","validateProperElementTypes","tagName","toLocaleLowerCase","validateProperRolesAreUsed","length","validateGridCellsArePresent","components","root","slot","always","getIntrinsicElementProps","undefined","elementType"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BA8BaA;;;eAAAA;;;;iEA9BU;gCAOhB;8BACkD;kCAExB;uBAO1B;AAEP,MAAMC,uBAAuB;AAWtB,MAAMD,mBAAmB,CAC9BE,OACAC;IAEA,MAAM,EAAEC,cAAc,EAAEC,aAAa,EAAEC,aAAa,EAAEC,oBAAoB,EAAEC,iBAAiB,EAAE,GAAGN;IAElG,MAAMO,KAAKP,MAAMO,EAAE,IAAIL,mBAAmB,cAAc,QAAQH;IAEhE,MAAMS,4BAA4BC,IAAAA,qCAAAA,EAAwB;QACxDC,MAAM;QACNC,iBAAiB;IACnB;IAEA,MAAM,CAACC,gBAAgBC,kBAAkB,GAAGC,IAAAA,oCAAAA,EAAqB;QAC/DC,OAAOX;QACPY,cAAcX;QACdY,cAAc,EAAE;IAClB;IAEA,MAAMC,WAAWC,IAAAA,gCAAAA,EAAiB,CAACC,GAAyBC;QAC1D,MAAMC,uBAAuBC,MAAMC,IAAI,CAACH,KAAKjB,aAAa;QAC1DS,kBAAkBS;QAClBhB,sBAAAA,QAAAA,sBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,kBAAoBc,GAAG;YAAEK,OAAOL;YAAGM,MAAM;YAAUtB,eAAekB;QAAqB;IACzF;IAEA,MAAMK,YAAYC,IAAAA,kCAAAA,EAAiB;QACjCtB,mBAAmBY;QACnBf,eAAeA,iBAAiB;QAChCC,eAAeQ;IACjB;IAEA,MAAMiB,WAAW7B,MAAM8B,IAAI,IAAIC,IAAAA,wBAAAA,EAAkB7B,gBAAgB,CAAC,CAACC;IACnE,MAAM6B,eAAeC,IAAAA,uCAAAA,EAAiCJ;IAEtD,MAAM,EAAEK,gBAAgB,EAAE,GAAGC,IAAAA,6BAAAA;IAE7B,MAAMC,mBAAmBjB,IAAAA,gCAAAA,EAAiB,CAACkB;QACzC,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;YACzC;QACF;QACA,MAAMC,WAAWJ,WAAWK,YAAY,CAAC,WAAW;QACpD,MAAMC,YAAYT,iBAAiBG;QACnCO,IAAAA,iCAAAA,EAA2BrC,IAAI8B,WAAWQ,OAAO,CAACC,iBAAiB;QACnEC,IAAAA,iCAAAA,EAA2BlB,UAAUY,UAAU,CAAC,CAACtC,eAAewC,UAAUK,MAAM,GAAG;QACnFC,IAAAA,kCAAAA,EAA4BpB,UAAUQ;IACxC;IAEA,OAAO;QACLa,YAAY;YACVC,MAAM5C;QACR;QACA4C,MAAMC,oBAAAA,CAAKC,MAAM,CACfC,IAAAA,wCAAAA,EAAyB/C,IAAI;YAC3BN;YACA6B,MAAMD;YACN,GAAI1B,iBAAiB;gBACnB,wBAAwBA,kBAAkB,gBAAgB,OAAOoD;YACnE,CAAC;YACD,GAAG/C,yBAAyB;YAC5B,GAAGR,KAAK;QACV,IACA;YAAEwD,aAAajD;QAAG;QAEpByB;QACAI;QACAlC;QACA,6FAA6F;QAC7FyB,WAAWxB,gBAAgBwB,YAAY4B;IACzC;AACF"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useListContextValues_unstable", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return useListContextValues_unstable;
9
+ }
10
+ });
11
+ function useListContextValues_unstable(state) {
12
+ const { selection, navigationMode, listItemRole, validateListItem } = state;
13
+ const listContext = {
14
+ selection,
15
+ listItemRole,
16
+ navigationMode,
17
+ validateListItem
18
+ };
19
+ return {
20
+ listContext
21
+ };
22
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/List/useListContextValues.ts"],"sourcesContent":["import { ListContextValues, ListState } from './List.types';\n\nexport function useListContextValues_unstable(state: ListState): ListContextValues {\n const { selection, navigationMode, listItemRole, validateListItem } = state;\n\n const listContext = {\n selection,\n listItemRole,\n navigationMode,\n validateListItem,\n };\n\n return {\n listContext,\n };\n}\n"],"names":["useListContextValues_unstable","state","selection","navigationMode","listItemRole","validateListItem","listContext"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAEgBA;;;eAAAA;;;AAAT,SAASA,8BAA8BC,KAAgB;IAC5D,MAAM,EAAEC,SAAS,EAAEC,cAAc,EAAEC,YAAY,EAAEC,gBAAgB,EAAE,GAAGJ;IAEtE,MAAMK,cAAc;QAClBJ;QACAE;QACAD;QACAE;IACF;IAEA,OAAO;QACLC;IACF;AACF"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ listClassNames: function() {
13
+ return listClassNames;
14
+ },
15
+ useListStyles_unstable: function() {
16
+ return useListStyles_unstable;
17
+ }
18
+ });
19
+ const _react = require("@griffel/react");
20
+ const listClassNames = {
21
+ root: 'fui-List'
22
+ };
23
+ const useRootBaseStyles = /*#__PURE__*/ (0, _react.__resetStyles)("r1m6yby2", null, [
24
+ ".r1m6yby2{padding:0;margin:0;text-indent:0;list-style-type:none;}"
25
+ ]);
26
+ const useListStyles_unstable = (state)=>{
27
+ 'use no memo';
28
+ const rootStyles = useRootBaseStyles();
29
+ state.root.className = (0, _react.mergeClasses)(listClassNames.root, rootStyles, state.root.className);
30
+ return state;
31
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["useListStyles.styles.js"],"sourcesContent":["import { makeResetStyles, mergeClasses } from '@griffel/react';\nexport const listClassNames = {\n root: 'fui-List'\n};\nconst useRootBaseStyles = makeResetStyles({\n padding: 0,\n margin: 0,\n textIndent: 0,\n listStyleType: 'none'\n});\n/**\n * Apply styling to the List slots based on the state\n */ export const useListStyles_unstable = (state)=>{\n 'use no memo';\n const rootStyles = useRootBaseStyles();\n state.root.className = mergeClasses(listClassNames.root, rootStyles, state.root.className);\n return state;\n};\n"],"names":["listClassNames","useListStyles_unstable","root","useRootBaseStyles","__resetStyles","state","rootStyles","className","mergeClasses"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IACaA,cAAc;eAAdA;;IAWIC,sBAAsB;eAAtBA;;;uBAZ6B;AACvC,MAAMD,iBAAiB;IAC1BE,MAAM;AACV;AACA,MAAMC,oBAAiB,WAAA,GAAGC,IAAAA,oBAAA,EAAA,YAAA,MAAA;IAAA;CAKzB;AAGU,MAAMH,yBAA0BI,CAAAA;IACvC;IACA,MAAMC,aAAaH;IACnBE,MAAMH,IAAI,CAACK,SAAS,GAAGC,IAAAA,mBAAY,EAACR,eAAeE,IAAI,EAAEI,YAAYD,MAAMH,IAAI,CAACK,SAAS;IACzF,OAAOF;AACX"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "ListItem", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return ListItem;
9
+ }
10
+ });
11
+ const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
+ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
+ const _reactsharedcontexts = require("@fluentui/react-shared-contexts");
14
+ const _useListItem = require("./useListItem");
15
+ const _renderListItem = require("./renderListItem");
16
+ const _useListItemStylesstyles = require("./useListItemStyles.styles");
17
+ const ListItem = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
18
+ const state = (0, _useListItem.useListItem_unstable)(props, ref);
19
+ (0, _useListItemStylesstyles.useListItemStyles_unstable)(state);
20
+ (0, _reactsharedcontexts.useCustomStyleHook_unstable)('useListItemStyles_unstable')(state);
21
+ return (0, _renderListItem.renderListItem_unstable)(state);
22
+ });
23
+ ListItem.displayName = 'ListItem';
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/ListItem/ListItem.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\nimport { useListItem_unstable } from './useListItem';\nimport { renderListItem_unstable } from './renderListItem';\nimport { useListItemStyles_unstable } from './useListItemStyles.styles';\nimport type { ListItemProps } from './ListItem.types';\n\nexport const ListItem: ForwardRefComponent<ListItemProps> = React.forwardRef<HTMLLIElement | HTMLDivElement>(\n (props, ref) => {\n const state = useListItem_unstable(props, ref);\n\n useListItemStyles_unstable(state);\n useCustomStyleHook_unstable('useListItemStyles_unstable')(state);\n return renderListItem_unstable(state);\n },\n);\n\nListItem.displayName = 'ListItem';\n"],"names":["ListItem","React","forwardRef","props","ref","state","useListItem_unstable","useListItemStyles_unstable","useCustomStyleHook_unstable","renderListItem_unstable","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAQaA;;;eAAAA;;;;iEARU;qCAEqB;6BACP;gCACG;yCACG;AAGpC,MAAMA,WAAAA,WAAAA,GAA+CC,OAAMC,UAAU,CAC1E,CAACC,OAAOC;IACN,MAAMC,QAAQC,IAAAA,iCAAAA,EAAqBH,OAAOC;IAE1CG,IAAAA,mDAAAA,EAA2BF;IAC3BG,IAAAA,gDAAAA,EAA4B,8BAA8BH;IAC1D,OAAOI,IAAAA,uCAAAA,EAAwBJ;AACjC;AAGFL,SAASU,WAAW,GAAG"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * State used in rendering ListItem
3
+ */ "use strict";
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/ListItem/ListItem.types.ts"],"sourcesContent":["import { Checkbox } from '@fluentui/react-checkbox';\nimport type { ComponentProps, ComponentState, EventData, EventHandler, Slot } from '@fluentui/react-utilities';\nimport { 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};\n\n/**\n * State used in rendering ListItem\n */\nexport type ListItemState = ComponentState<ListItemSlots> & { selectable: boolean; navigable: boolean };\n"],"names":[],"rangeMappings":";;","mappings":"AAsBA;;CAEC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ ListItem: function() {
13
+ return _ListItem.ListItem;
14
+ },
15
+ listItemClassNames: function() {
16
+ return _useListItemStylesstyles.listItemClassNames;
17
+ },
18
+ renderListItem_unstable: function() {
19
+ return _renderListItem.renderListItem_unstable;
20
+ },
21
+ useListItemStyles_unstable: function() {
22
+ return _useListItemStylesstyles.useListItemStyles_unstable;
23
+ },
24
+ useListItem_unstable: function() {
25
+ return _useListItem.useListItem_unstable;
26
+ }
27
+ });
28
+ const _ListItem = require("./ListItem");
29
+ const _renderListItem = require("./renderListItem");
30
+ const _useListItem = require("./useListItem");
31
+ const _useListItemStylesstyles = require("./useListItemStyles.styles");
@@ -0,0 +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","listItemClassNames","renderListItem_unstable","useListItemStyles_unstable","useListItem_unstable"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAASA,QAAQ;eAARA,kBAAQ;;IAURC,kBAAkB;eAAlBA,2CAAkB;;IAFlBC,uBAAuB;eAAvBA,uCAAuB;;IAEHC,0BAA0B;eAA1BA,mDAA0B;;IAD9CC,oBAAoB;eAApBA,iCAAoB;;;0BATJ;gCAQe;6BACH;yCAC0B"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "renderListItem_unstable", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return renderListItem_unstable;
9
+ }
10
+ });
11
+ const _jsxruntime = require("@fluentui/react-jsx-runtime/jsx-runtime");
12
+ const _reactutilities = require("@fluentui/react-utilities");
13
+ const renderListItem_unstable = (state)=>{
14
+ (0, _reactutilities.assertSlots)(state);
15
+ return /*#__PURE__*/ (0, _jsxruntime.jsxs)(state.root, {
16
+ children: [
17
+ state.checkmark && /*#__PURE__*/ (0, _jsxruntime.jsx)(state.checkmark, {}),
18
+ state.root.children
19
+ ]
20
+ });
21
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/ListItem/renderListItem.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { ListItemState, ListItemSlots } from './ListItem.types';\n\n/**\n * Render the final JSX of ListItem\n */\nexport const renderListItem_unstable = (state: ListItemState) => {\n assertSlots<ListItemSlots>(state);\n\n return (\n <state.root>\n {state.checkmark && <state.checkmark />}\n {state.root.children}\n </state.root>\n );\n};\n"],"names":["renderListItem_unstable","state","assertSlots","_jsxs","root","checkmark","_jsx","children"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BASaA;;;eAAAA;;;4BARb;gCAE4B;AAMrB,MAAMA,0BAA0B,CAACC;IACtCC,IAAAA,2BAAAA,EAA2BD;IAE3B,OAAA,WAAA,GACEE,IAAAA,gBAAA,EAACF,MAAMG,IAAI,EAAA;;YACRH,MAAMI,SAAS,IAAA,WAAA,GAAIC,IAAAA,eAAA,EAACL,MAAMI,SAAS,EAAA,CAAA;YACnCJ,MAAMG,IAAI,CAACG,QAAQ;;;AAG1B"}