@fluentui/react-table 0.0.0-nightly-20221007-1237.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 (319) hide show
  1. package/CHANGELOG.json +354 -0
  2. package/CHANGELOG.md +104 -0
  3. package/LICENSE +15 -0
  4. package/README.md +5 -0
  5. package/Spec.md +63 -0
  6. package/dist/index.d.ts +647 -0
  7. package/lib/Table.js +2 -0
  8. package/lib/Table.js.map +1 -0
  9. package/lib/TableBody.js +2 -0
  10. package/lib/TableBody.js.map +1 -0
  11. package/lib/TableCell.js +2 -0
  12. package/lib/TableCell.js.map +1 -0
  13. package/lib/TableCellActions.js +2 -0
  14. package/lib/TableCellActions.js.map +1 -0
  15. package/lib/TableCellLayout.js +2 -0
  16. package/lib/TableCellLayout.js.map +1 -0
  17. package/lib/TableCellPrimaryLayout.js +2 -0
  18. package/lib/TableCellPrimaryLayout.js.map +1 -0
  19. package/lib/TableHeader.js +2 -0
  20. package/lib/TableHeader.js.map +1 -0
  21. package/lib/TableHeaderCell.js +2 -0
  22. package/lib/TableHeaderCell.js.map +1 -0
  23. package/lib/TableRow.js +2 -0
  24. package/lib/TableRow.js.map +1 -0
  25. package/lib/TableSelectionCell.js +2 -0
  26. package/lib/TableSelectionCell.js.map +1 -0
  27. package/lib/components/Table/Table.js +16 -0
  28. package/lib/components/Table/Table.js.map +1 -0
  29. package/lib/components/Table/Table.types.js +2 -0
  30. package/lib/components/Table/Table.types.js.map +1 -0
  31. package/lib/components/Table/index.js +6 -0
  32. package/lib/components/Table/index.js.map +1 -0
  33. package/lib/components/Table/renderTable.js +18 -0
  34. package/lib/components/Table/renderTable.js.map +1 -0
  35. package/lib/components/Table/useTable.js +30 -0
  36. package/lib/components/Table/useTable.js.map +1 -0
  37. package/lib/components/Table/useTableContextValues.js +17 -0
  38. package/lib/components/Table/useTableContextValues.js.map +1 -0
  39. package/lib/components/Table/useTableStyles.js +53 -0
  40. package/lib/components/Table/useTableStyles.js.map +1 -0
  41. package/lib/components/TableBody/TableBody.js +15 -0
  42. package/lib/components/TableBody/TableBody.js.map +1 -0
  43. package/lib/components/TableBody/TableBody.types.js +2 -0
  44. package/lib/components/TableBody/TableBody.types.js.map +1 -0
  45. package/lib/components/TableBody/index.js +6 -0
  46. package/lib/components/TableBody/index.js.map +1 -0
  47. package/lib/components/TableBody/renderTableBody.js +16 -0
  48. package/lib/components/TableBody/renderTableBody.js.map +1 -0
  49. package/lib/components/TableBody/useTableBody.js +32 -0
  50. package/lib/components/TableBody/useTableBody.js.map +1 -0
  51. package/lib/components/TableBody/useTableBodyStyles.js +35 -0
  52. package/lib/components/TableBody/useTableBodyStyles.js.map +1 -0
  53. package/lib/components/TableCell/TableCell.js +15 -0
  54. package/lib/components/TableCell/TableCell.js.map +1 -0
  55. package/lib/components/TableCell/TableCell.types.js +2 -0
  56. package/lib/components/TableCell/TableCell.types.js.map +1 -0
  57. package/lib/components/TableCell/index.js +6 -0
  58. package/lib/components/TableCell/index.js.map +1 -0
  59. package/lib/components/TableCell/renderTableCell.js +15 -0
  60. package/lib/components/TableCell/renderTableCell.js.map +1 -0
  61. package/lib/components/TableCell/useTableCell.js +32 -0
  62. package/lib/components/TableCell/useTableCell.js.map +1 -0
  63. package/lib/components/TableCell/useTableCellStyles.js +59 -0
  64. package/lib/components/TableCell/useTableCellStyles.js.map +1 -0
  65. package/lib/components/TableCellActions/TableCellActions.js +15 -0
  66. package/lib/components/TableCellActions/TableCellActions.js.map +1 -0
  67. package/lib/components/TableCellActions/TableCellActions.types.js +2 -0
  68. package/lib/components/TableCellActions/TableCellActions.types.js.map +1 -0
  69. package/lib/components/TableCellActions/index.js +6 -0
  70. package/lib/components/TableCellActions/index.js.map +1 -0
  71. package/lib/components/TableCellActions/renderTableCellActions.js +16 -0
  72. package/lib/components/TableCellActions/renderTableCellActions.js.map +1 -0
  73. package/lib/components/TableCellActions/useTableCellActions.js +27 -0
  74. package/lib/components/TableCellActions/useTableCellActions.js.map +1 -0
  75. package/lib/components/TableCellActions/useTableCellActionsStyles.js +40 -0
  76. package/lib/components/TableCellActions/useTableCellActionsStyles.js.map +1 -0
  77. package/lib/components/TableCellLayout/TableCellLayout.js +16 -0
  78. package/lib/components/TableCellLayout/TableCellLayout.js.map +1 -0
  79. package/lib/components/TableCellLayout/TableCellLayout.types.js +2 -0
  80. package/lib/components/TableCellLayout/TableCellLayout.types.js.map +1 -0
  81. package/lib/components/TableCellLayout/index.js +6 -0
  82. package/lib/components/TableCellLayout/index.js.map +1 -0
  83. package/lib/components/TableCellLayout/renderTableCellLayout.js +22 -0
  84. package/lib/components/TableCellLayout/renderTableCellLayout.js.map +1 -0
  85. package/lib/components/TableCellLayout/useTableCellLayout.js +46 -0
  86. package/lib/components/TableCellLayout/useTableCellLayout.js.map +1 -0
  87. package/lib/components/TableCellLayout/useTableCellLayoutContextValues.js +13 -0
  88. package/lib/components/TableCellLayout/useTableCellLayoutContextValues.js.map +1 -0
  89. package/lib/components/TableCellLayout/useTableCellLayoutStyles.js +74 -0
  90. package/lib/components/TableCellLayout/useTableCellLayoutStyles.js.map +1 -0
  91. package/lib/components/TableHeader/TableHeader.js +15 -0
  92. package/lib/components/TableHeader/TableHeader.js.map +1 -0
  93. package/lib/components/TableHeader/TableHeader.types.js +2 -0
  94. package/lib/components/TableHeader/TableHeader.types.js.map +1 -0
  95. package/lib/components/TableHeader/index.js +6 -0
  96. package/lib/components/TableHeader/index.js.map +1 -0
  97. package/lib/components/TableHeader/renderTableHeader.js +15 -0
  98. package/lib/components/TableHeader/renderTableHeader.js.map +1 -0
  99. package/lib/components/TableHeader/useTableHeader.js +39 -0
  100. package/lib/components/TableHeader/useTableHeader.js.map +1 -0
  101. package/lib/components/TableHeader/useTableHeaderStyles.js +41 -0
  102. package/lib/components/TableHeader/useTableHeaderStyles.js.map +1 -0
  103. package/lib/components/TableHeaderCell/TableHeaderCell.js +15 -0
  104. package/lib/components/TableHeaderCell/TableHeaderCell.js.map +1 -0
  105. package/lib/components/TableHeaderCell/TableHeaderCell.types.js +2 -0
  106. package/lib/components/TableHeaderCell/TableHeaderCell.types.js.map +1 -0
  107. package/lib/components/TableHeaderCell/index.js +6 -0
  108. package/lib/components/TableHeaderCell/index.js.map +1 -0
  109. package/lib/components/TableHeaderCell/renderTableHeaderCell.js +17 -0
  110. package/lib/components/TableHeaderCell/renderTableHeaderCell.js.map +1 -0
  111. package/lib/components/TableHeaderCell/useTableHeaderCell.js +62 -0
  112. package/lib/components/TableHeaderCell/useTableHeaderCell.js.map +1 -0
  113. package/lib/components/TableHeaderCell/useTableHeaderCellStyles.js +106 -0
  114. package/lib/components/TableHeaderCell/useTableHeaderCellStyles.js.map +1 -0
  115. package/lib/components/TableRow/TableRow.js +15 -0
  116. package/lib/components/TableRow/TableRow.js.map +1 -0
  117. package/lib/components/TableRow/TableRow.types.js +2 -0
  118. package/lib/components/TableRow/TableRow.types.js.map +1 -0
  119. package/lib/components/TableRow/index.js +6 -0
  120. package/lib/components/TableRow/index.js.map +1 -0
  121. package/lib/components/TableRow/renderTableRow.js +16 -0
  122. package/lib/components/TableRow/renderTableRow.js.map +1 -0
  123. package/lib/components/TableRow/useTableRow.js +34 -0
  124. package/lib/components/TableRow/useTableRow.js.map +1 -0
  125. package/lib/components/TableRow/useTableRowStyles.js +88 -0
  126. package/lib/components/TableRow/useTableRowStyles.js.map +1 -0
  127. package/lib/components/TableSelectionCell/TableSelectionCell.js +15 -0
  128. package/lib/components/TableSelectionCell/TableSelectionCell.js.map +1 -0
  129. package/lib/components/TableSelectionCell/TableSelectionCell.types.js +2 -0
  130. package/lib/components/TableSelectionCell/TableSelectionCell.types.js.map +1 -0
  131. package/lib/components/TableSelectionCell/index.js +6 -0
  132. package/lib/components/TableSelectionCell/index.js.map +1 -0
  133. package/lib/components/TableSelectionCell/renderTableSelectionCell.js +17 -0
  134. package/lib/components/TableSelectionCell/renderTableSelectionCell.js.map +1 -0
  135. package/lib/components/TableSelectionCell/useTableSelectionCell.js +47 -0
  136. package/lib/components/TableSelectionCell/useTableSelectionCell.js.map +1 -0
  137. package/lib/components/TableSelectionCell/useTableSelectionCellStyles.js +81 -0
  138. package/lib/components/TableSelectionCell/useTableSelectionCellStyles.js.map +1 -0
  139. package/lib/contexts/tableContext.js +14 -0
  140. package/lib/contexts/tableContext.js.map +1 -0
  141. package/lib/hooks/index.js +5 -0
  142. package/lib/hooks/index.js.map +1 -0
  143. package/lib/hooks/selectionManager.js +89 -0
  144. package/lib/hooks/selectionManager.js.map +1 -0
  145. package/lib/hooks/types.js +2 -0
  146. package/lib/hooks/types.js.map +1 -0
  147. package/lib/hooks/useSelection.js +74 -0
  148. package/lib/hooks/useSelection.js.map +1 -0
  149. package/lib/hooks/useSort.js +94 -0
  150. package/lib/hooks/useSort.js.map +1 -0
  151. package/lib/hooks/useTable.js +32 -0
  152. package/lib/hooks/useTable.js.map +1 -0
  153. package/lib/index.js +12 -0
  154. package/lib/index.js.map +1 -0
  155. package/lib/navigationModes/cell.js +250 -0
  156. package/lib/navigationModes/cell.js.map +1 -0
  157. package/lib/navigationModes/composite.js +208 -0
  158. package/lib/navigationModes/composite.js.map +1 -0
  159. package/lib/navigationModes/index.js +3 -0
  160. package/lib/navigationModes/index.js.map +1 -0
  161. package/lib/navigationModes/useNavigationMode.js +42 -0
  162. package/lib/navigationModes/useNavigationMode.js.map +1 -0
  163. package/lib-commonjs/Table.js +10 -0
  164. package/lib-commonjs/Table.js.map +1 -0
  165. package/lib-commonjs/TableBody.js +10 -0
  166. package/lib-commonjs/TableBody.js.map +1 -0
  167. package/lib-commonjs/TableCell.js +10 -0
  168. package/lib-commonjs/TableCell.js.map +1 -0
  169. package/lib-commonjs/TableCellActions.js +10 -0
  170. package/lib-commonjs/TableCellActions.js.map +1 -0
  171. package/lib-commonjs/TableCellLayout.js +10 -0
  172. package/lib-commonjs/TableCellLayout.js.map +1 -0
  173. package/lib-commonjs/TableCellPrimaryLayout.js +10 -0
  174. package/lib-commonjs/TableCellPrimaryLayout.js.map +1 -0
  175. package/lib-commonjs/TableHeader.js +10 -0
  176. package/lib-commonjs/TableHeader.js.map +1 -0
  177. package/lib-commonjs/TableHeaderCell.js +10 -0
  178. package/lib-commonjs/TableHeaderCell.js.map +1 -0
  179. package/lib-commonjs/TableRow.js +10 -0
  180. package/lib-commonjs/TableRow.js.map +1 -0
  181. package/lib-commonjs/TableSelectionCell.js +10 -0
  182. package/lib-commonjs/TableSelectionCell.js.map +1 -0
  183. package/lib-commonjs/components/Table/Table.js +28 -0
  184. package/lib-commonjs/components/Table/Table.js.map +1 -0
  185. package/lib-commonjs/components/Table/Table.types.js +6 -0
  186. package/lib-commonjs/components/Table/Table.types.js.map +1 -0
  187. package/lib-commonjs/components/Table/index.js +18 -0
  188. package/lib-commonjs/components/Table/index.js.map +1 -0
  189. package/lib-commonjs/components/Table/renderTable.js +30 -0
  190. package/lib-commonjs/components/Table/renderTable.js.map +1 -0
  191. package/lib-commonjs/components/Table/useTable.js +40 -0
  192. package/lib-commonjs/components/Table/useTable.js.map +1 -0
  193. package/lib-commonjs/components/Table/useTableContextValues.js +27 -0
  194. package/lib-commonjs/components/Table/useTableContextValues.js.map +1 -0
  195. package/lib-commonjs/components/Table/useTableStyles.js +64 -0
  196. package/lib-commonjs/components/Table/useTableStyles.js.map +1 -0
  197. package/lib-commonjs/components/TableBody/TableBody.js +26 -0
  198. package/lib-commonjs/components/TableBody/TableBody.js.map +1 -0
  199. package/lib-commonjs/components/TableBody/TableBody.types.js +6 -0
  200. package/lib-commonjs/components/TableBody/TableBody.types.js.map +1 -0
  201. package/lib-commonjs/components/TableBody/index.js +18 -0
  202. package/lib-commonjs/components/TableBody/index.js.map +1 -0
  203. package/lib-commonjs/components/TableBody/renderTableBody.js +27 -0
  204. package/lib-commonjs/components/TableBody/renderTableBody.js.map +1 -0
  205. package/lib-commonjs/components/TableBody/useTableBody.js +43 -0
  206. package/lib-commonjs/components/TableBody/useTableBody.js.map +1 -0
  207. package/lib-commonjs/components/TableBody/useTableBodyStyles.js +44 -0
  208. package/lib-commonjs/components/TableBody/useTableBodyStyles.js.map +1 -0
  209. package/lib-commonjs/components/TableCell/TableCell.js +26 -0
  210. package/lib-commonjs/components/TableCell/TableCell.js.map +1 -0
  211. package/lib-commonjs/components/TableCell/TableCell.types.js +6 -0
  212. package/lib-commonjs/components/TableCell/TableCell.types.js.map +1 -0
  213. package/lib-commonjs/components/TableCell/index.js +18 -0
  214. package/lib-commonjs/components/TableCell/index.js.map +1 -0
  215. package/lib-commonjs/components/TableCell/renderTableCell.js +26 -0
  216. package/lib-commonjs/components/TableCell/renderTableCell.js.map +1 -0
  217. package/lib-commonjs/components/TableCell/useTableCell.js +43 -0
  218. package/lib-commonjs/components/TableCell/useTableCell.js.map +1 -0
  219. package/lib-commonjs/components/TableCell/useTableCellStyles.js +70 -0
  220. package/lib-commonjs/components/TableCell/useTableCellStyles.js.map +1 -0
  221. package/lib-commonjs/components/TableCellActions/TableCellActions.js +26 -0
  222. package/lib-commonjs/components/TableCellActions/TableCellActions.js.map +1 -0
  223. package/lib-commonjs/components/TableCellActions/TableCellActions.types.js +6 -0
  224. package/lib-commonjs/components/TableCellActions/TableCellActions.types.js.map +1 -0
  225. package/lib-commonjs/components/TableCellActions/index.js +18 -0
  226. package/lib-commonjs/components/TableCellActions/index.js.map +1 -0
  227. package/lib-commonjs/components/TableCellActions/renderTableCellActions.js +27 -0
  228. package/lib-commonjs/components/TableCellActions/renderTableCellActions.js.map +1 -0
  229. package/lib-commonjs/components/TableCellActions/useTableCellActions.js +38 -0
  230. package/lib-commonjs/components/TableCellActions/useTableCellActions.js.map +1 -0
  231. package/lib-commonjs/components/TableCellActions/useTableCellActionsStyles.js +51 -0
  232. package/lib-commonjs/components/TableCellActions/useTableCellActionsStyles.js.map +1 -0
  233. package/lib-commonjs/components/TableCellLayout/TableCellLayout.js +28 -0
  234. package/lib-commonjs/components/TableCellLayout/TableCellLayout.js.map +1 -0
  235. package/lib-commonjs/components/TableCellLayout/TableCellLayout.types.js +6 -0
  236. package/lib-commonjs/components/TableCellLayout/TableCellLayout.types.js.map +1 -0
  237. package/lib-commonjs/components/TableCellLayout/index.js +18 -0
  238. package/lib-commonjs/components/TableCellLayout/index.js.map +1 -0
  239. package/lib-commonjs/components/TableCellLayout/renderTableCellLayout.js +34 -0
  240. package/lib-commonjs/components/TableCellLayout/renderTableCellLayout.js.map +1 -0
  241. package/lib-commonjs/components/TableCellLayout/useTableCellLayout.js +57 -0
  242. package/lib-commonjs/components/TableCellLayout/useTableCellLayout.js.map +1 -0
  243. package/lib-commonjs/components/TableCellLayout/useTableCellLayoutContextValues.js +23 -0
  244. package/lib-commonjs/components/TableCellLayout/useTableCellLayoutContextValues.js.map +1 -0
  245. package/lib-commonjs/components/TableCellLayout/useTableCellLayoutStyles.js +85 -0
  246. package/lib-commonjs/components/TableCellLayout/useTableCellLayoutStyles.js.map +1 -0
  247. package/lib-commonjs/components/TableHeader/TableHeader.js +26 -0
  248. package/lib-commonjs/components/TableHeader/TableHeader.js.map +1 -0
  249. package/lib-commonjs/components/TableHeader/TableHeader.types.js +6 -0
  250. package/lib-commonjs/components/TableHeader/TableHeader.types.js.map +1 -0
  251. package/lib-commonjs/components/TableHeader/index.js +18 -0
  252. package/lib-commonjs/components/TableHeader/index.js.map +1 -0
  253. package/lib-commonjs/components/TableHeader/renderTableHeader.js +26 -0
  254. package/lib-commonjs/components/TableHeader/renderTableHeader.js.map +1 -0
  255. package/lib-commonjs/components/TableHeader/useTableHeader.js +51 -0
  256. package/lib-commonjs/components/TableHeader/useTableHeader.js.map +1 -0
  257. package/lib-commonjs/components/TableHeader/useTableHeaderStyles.js +51 -0
  258. package/lib-commonjs/components/TableHeader/useTableHeaderStyles.js.map +1 -0
  259. package/lib-commonjs/components/TableHeaderCell/TableHeaderCell.js +26 -0
  260. package/lib-commonjs/components/TableHeaderCell/TableHeaderCell.js.map +1 -0
  261. package/lib-commonjs/components/TableHeaderCell/TableHeaderCell.types.js +6 -0
  262. package/lib-commonjs/components/TableHeaderCell/TableHeaderCell.types.js.map +1 -0
  263. package/lib-commonjs/components/TableHeaderCell/index.js +18 -0
  264. package/lib-commonjs/components/TableHeaderCell/index.js.map +1 -0
  265. package/lib-commonjs/components/TableHeaderCell/renderTableHeaderCell.js +28 -0
  266. package/lib-commonjs/components/TableHeaderCell/renderTableHeaderCell.js.map +1 -0
  267. package/lib-commonjs/components/TableHeaderCell/useTableHeaderCell.js +76 -0
  268. package/lib-commonjs/components/TableHeaderCell/useTableHeaderCell.js.map +1 -0
  269. package/lib-commonjs/components/TableHeaderCell/useTableHeaderCellStyles.js +117 -0
  270. package/lib-commonjs/components/TableHeaderCell/useTableHeaderCellStyles.js.map +1 -0
  271. package/lib-commonjs/components/TableRow/TableRow.js +26 -0
  272. package/lib-commonjs/components/TableRow/TableRow.js.map +1 -0
  273. package/lib-commonjs/components/TableRow/TableRow.types.js +6 -0
  274. package/lib-commonjs/components/TableRow/TableRow.types.js.map +1 -0
  275. package/lib-commonjs/components/TableRow/index.js +18 -0
  276. package/lib-commonjs/components/TableRow/index.js.map +1 -0
  277. package/lib-commonjs/components/TableRow/renderTableRow.js +27 -0
  278. package/lib-commonjs/components/TableRow/renderTableRow.js.map +1 -0
  279. package/lib-commonjs/components/TableRow/useTableRow.js +45 -0
  280. package/lib-commonjs/components/TableRow/useTableRow.js.map +1 -0
  281. package/lib-commonjs/components/TableRow/useTableRowStyles.js +100 -0
  282. package/lib-commonjs/components/TableRow/useTableRowStyles.js.map +1 -0
  283. package/lib-commonjs/components/TableSelectionCell/TableSelectionCell.js +26 -0
  284. package/lib-commonjs/components/TableSelectionCell/TableSelectionCell.js.map +1 -0
  285. package/lib-commonjs/components/TableSelectionCell/TableSelectionCell.types.js +6 -0
  286. package/lib-commonjs/components/TableSelectionCell/TableSelectionCell.types.js.map +1 -0
  287. package/lib-commonjs/components/TableSelectionCell/index.js +18 -0
  288. package/lib-commonjs/components/TableSelectionCell/index.js.map +1 -0
  289. package/lib-commonjs/components/TableSelectionCell/renderTableSelectionCell.js +28 -0
  290. package/lib-commonjs/components/TableSelectionCell/renderTableSelectionCell.js.map +1 -0
  291. package/lib-commonjs/components/TableSelectionCell/useTableSelectionCell.js +62 -0
  292. package/lib-commonjs/components/TableSelectionCell/useTableSelectionCell.js.map +1 -0
  293. package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.js +91 -0
  294. package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.js.map +1 -0
  295. package/lib-commonjs/contexts/tableContext.js +25 -0
  296. package/lib-commonjs/contexts/tableContext.js.map +1 -0
  297. package/lib-commonjs/hooks/index.js +16 -0
  298. package/lib-commonjs/hooks/index.js.map +1 -0
  299. package/lib-commonjs/hooks/selectionManager.js +98 -0
  300. package/lib-commonjs/hooks/selectionManager.js.map +1 -0
  301. package/lib-commonjs/hooks/types.js +6 -0
  302. package/lib-commonjs/hooks/types.js.map +1 -0
  303. package/lib-commonjs/hooks/useSelection.js +89 -0
  304. package/lib-commonjs/hooks/useSelection.js.map +1 -0
  305. package/lib-commonjs/hooks/useSort.js +107 -0
  306. package/lib-commonjs/hooks/useSort.js.map +1 -0
  307. package/lib-commonjs/hooks/useTable.js +42 -0
  308. package/lib-commonjs/hooks/useTable.js.map +1 -0
  309. package/lib-commonjs/index.js +377 -0
  310. package/lib-commonjs/index.js.map +1 -0
  311. package/lib-commonjs/navigationModes/cell.js +259 -0
  312. package/lib-commonjs/navigationModes/cell.js.map +1 -0
  313. package/lib-commonjs/navigationModes/composite.js +217 -0
  314. package/lib-commonjs/navigationModes/composite.js.map +1 -0
  315. package/lib-commonjs/navigationModes/index.js +16 -0
  316. package/lib-commonjs/navigationModes/index.js.map +1 -0
  317. package/lib-commonjs/navigationModes/useNavigationMode.js +55 -0
  318. package/lib-commonjs/navigationModes/useNavigationMode.js.map +1 -0
  319. package/package.json +50 -0
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./TableSelectionCell"), exports);
10
+
11
+ tslib_1.__exportStar(require("./TableSelectionCell.types"), exports);
12
+
13
+ tslib_1.__exportStar(require("./renderTableSelectionCell"), exports);
14
+
15
+ tslib_1.__exportStar(require("./useTableSelectionCell"), exports);
16
+
17
+ tslib_1.__exportStar(require("./useTableSelectionCellStyles"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../../packages/react-components/react-table/src/components/TableSelectionCell/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,sBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,4BAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,4BAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,yBAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,+BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './TableSelectionCell';\nexport * from './TableSelectionCell.types';\nexport * from './renderTableSelectionCell';\nexport * from './useTableSelectionCell';\nexport * from './useTableSelectionCellStyles';\n"],"sourceRoot":""}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.renderTableSelectionCell_unstable = void 0;
7
+
8
+ const React = /*#__PURE__*/require("react");
9
+
10
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
11
+ /**
12
+ * Render the final JSX of TableSelectionCell
13
+ */
14
+
15
+
16
+ const renderTableSelectionCell_unstable = state => {
17
+ const {
18
+ slots,
19
+ slotProps
20
+ } = react_utilities_1.getSlots(state);
21
+ return React.createElement(slots.root, { ...slotProps.root
22
+ }, state.type === 'checkbox' && slots.checkboxIndicator && React.createElement(slots.checkboxIndicator, { ...slotProps.checkboxIndicator
23
+ }), state.type === 'radio' && slots.radioIndicator && React.createElement(slots.radioIndicator, { ...slotProps.radioIndicator
24
+ }));
25
+ };
26
+
27
+ exports.renderTableSelectionCell_unstable = renderTableSelectionCell_unstable;
28
+ //# sourceMappingURL=renderTableSelectionCell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../../packages/react-components/react-table/src/components/TableSelectionCell/renderTableSelectionCell.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,iCAAiC,GAAI,KAAD,IAAmC;EAClF,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,iBAAA,CAAA,QAAA,CAAkC,KAAlC,CAA7B;EAEA,OACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,EACG,KAAK,CAAC,IAAN,KAAe,UAAf,IAA6B,KAAK,CAAC,iBAAnC,IACC,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,iBAAP,EAAwB,EAAA,GAAK,SAAS,CAAC;EAAf,CAAxB,CAFJ,EAIG,KAAK,CAAC,IAAN,KAAe,OAAf,IAA0B,KAAK,CAAC,cAAhC,IAAkD,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,cAAP,EAAqB,EAAA,GAAK,SAAS,CAAC;EAAf,CAArB,CAJrD,CADF;AAQD,CAXM;;AAAM,OAAA,CAAA,iCAAA,GAAiC,iCAAjC","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { TableSelectionCellState, TableSelectionCellSlots } from './TableSelectionCell.types';\n\n/**\n * Render the final JSX of TableSelectionCell\n */\nexport const renderTableSelectionCell_unstable = (state: TableSelectionCellState) => {\n const { slots, slotProps } = getSlots<TableSelectionCellSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {state.type === 'checkbox' && slots.checkboxIndicator && (\n <slots.checkboxIndicator {...slotProps.checkboxIndicator} />\n )}\n {state.type === 'radio' && slots.radioIndicator && <slots.radioIndicator {...slotProps.radioIndicator} />}\n </slots.root>\n );\n};\n"],"sourceRoot":""}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useTableSelectionCell_unstable = void 0;
7
+
8
+ const React = /*#__PURE__*/require("react");
9
+
10
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
11
+
12
+ const react_checkbox_1 = /*#__PURE__*/require("@fluentui/react-checkbox");
13
+
14
+ const react_icons_1 = /*#__PURE__*/require("@fluentui/react-icons");
15
+
16
+ const useTableCell_1 = /*#__PURE__*/require("../TableCell/useTableCell");
17
+
18
+ const tableContext_1 = /*#__PURE__*/require("../../contexts/tableContext");
19
+ /**
20
+ * Create the state required to render TableSelectionCell.
21
+ *
22
+ * The returned state can be modified with hooks such as useTableSelectionCellStyles_unstable,
23
+ * before being passed to renderTableSelectionCell_unstable.
24
+ *
25
+ * @param props - props from this instance of TableSelectionCell
26
+ * @param ref - reference to root HTMLElement of TableSelectionCell
27
+ */
28
+
29
+
30
+ const useTableSelectionCell_unstable = (props, ref) => {
31
+ var _a, _b;
32
+
33
+ const tableCellState = useTableCell_1.useTableCell_unstable(props, ref);
34
+ const {
35
+ noNativeElements
36
+ } = tableContext_1.useTableContext();
37
+ const type = (_a = props.type) !== null && _a !== void 0 ? _a : 'checkbox';
38
+ return { ...tableCellState,
39
+ components: { ...tableCellState.components,
40
+ checkboxIndicator: react_checkbox_1.Checkbox,
41
+ radioIndicator: 'span'
42
+ },
43
+ checkboxIndicator: react_utilities_1.resolveShorthand(props.checkboxIndicator, {
44
+ required: type === 'checkbox',
45
+ defaultProps: {
46
+ checked: props.checked
47
+ }
48
+ }),
49
+ radioIndicator: react_utilities_1.resolveShorthand(props.radioIndicator, {
50
+ required: type === 'radio',
51
+ defaultProps: {
52
+ children: React.createElement(react_icons_1.CheckmarkFilled, null)
53
+ }
54
+ }),
55
+ type,
56
+ checked: (_b = props.checked) !== null && _b !== void 0 ? _b : false,
57
+ noNativeElements
58
+ };
59
+ };
60
+
61
+ exports.useTableSelectionCell_unstable = useTableSelectionCell_unstable;
62
+ //# sourceMappingURL=useTableSelectionCell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../../packages/react-components/react-table/src/components/TableSelectionCell/useTableSelectionCell.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,gBAAA,gBAAA,OAAA,CAAA,0BAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AAEA,MAAA,cAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;AAEA;;;;;;;;AAQG;;;AACI,MAAM,8BAA8B,GAAG,CAC5C,KAD4C,EAE5C,GAF4C,KAGjB;;;EAC3B,MAAM,cAAc,GAAG,cAAA,CAAA,qBAAA,CAAsB,KAAtB,EAA6B,GAA7B,CAAvB;EACA,MAAM;IAAE;EAAF,IAAuB,cAAA,CAAA,eAAA,EAA7B;EACA,MAAM,IAAI,GAAG,CAAA,EAAA,GAAA,KAAK,CAAC,IAAN,MAAU,IAAV,IAAU,EAAA,KAAA,KAAA,CAAV,GAAU,EAAV,GAAc,UAA3B;EAEA,OAAO,EACL,GAAG,cADE;IAEL,UAAU,EAAE,EACV,GAAG,cAAc,CAAC,UADR;MAEV,iBAAiB,EAAE,gBAAA,CAAA,QAFT;MAGV,cAAc,EAAE;IAHN,CAFP;IAOL,iBAAiB,EAAE,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,iBAAvB,EAA0C;MAC3D,QAAQ,EAAE,IAAI,KAAK,UADwC;MAE3D,YAAY,EAAE;QAAE,OAAO,EAAE,KAAK,CAAC;MAAjB;IAF6C,CAA1C,CAPd;IAWL,cAAc,EAAE,iBAAA,CAAA,gBAAA,CAAiB,KAAK,CAAC,cAAvB,EAAuC;MACrD,QAAQ,EAAE,IAAI,KAAK,OADkC;MAErD,YAAY,EAAE;QAAE,QAAQ,EAAE,KAAA,CAAA,aAAA,CAAC,aAAA,CAAA,eAAD,EAAgB,IAAhB;MAAZ;IAFuC,CAAvC,CAXX;IAeL,IAfK;IAgBL,OAAO,EAAE,CAAA,EAAA,GAAA,KAAK,CAAC,OAAN,MAAa,IAAb,IAAa,EAAA,KAAA,KAAA,CAAb,GAAa,EAAb,GAAiB,KAhBrB;IAiBL;EAjBK,CAAP;AAmBD,CA3BM;;AAAM,OAAA,CAAA,8BAAA,GAA8B,8BAA9B","sourcesContent":["import * as React from 'react';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { Checkbox } from '@fluentui/react-checkbox';\nimport { CheckmarkFilled } from '@fluentui/react-icons';\nimport type { TableSelectionCellProps, TableSelectionCellState } from './TableSelectionCell.types';\nimport { useTableCell_unstable } from '../TableCell/useTableCell';\nimport { useTableContext } from '../../contexts/tableContext';\n\n/**\n * Create the state required to render TableSelectionCell.\n *\n * The returned state can be modified with hooks such as useTableSelectionCellStyles_unstable,\n * before being passed to renderTableSelectionCell_unstable.\n *\n * @param props - props from this instance of TableSelectionCell\n * @param ref - reference to root HTMLElement of TableSelectionCell\n */\nexport const useTableSelectionCell_unstable = (\n props: TableSelectionCellProps,\n ref: React.Ref<HTMLElement>,\n): TableSelectionCellState => {\n const tableCellState = useTableCell_unstable(props, ref);\n const { noNativeElements } = useTableContext();\n const type = props.type ?? 'checkbox';\n\n return {\n ...tableCellState,\n components: {\n ...tableCellState.components,\n checkboxIndicator: Checkbox,\n radioIndicator: 'span',\n },\n checkboxIndicator: resolveShorthand(props.checkboxIndicator, {\n required: type === 'checkbox',\n defaultProps: { checked: props.checked },\n }),\n radioIndicator: resolveShorthand(props.radioIndicator, {\n required: type === 'radio',\n defaultProps: { children: <CheckmarkFilled /> },\n }),\n type,\n checked: props.checked ?? false,\n noNativeElements,\n };\n};\n"],"sourceRoot":""}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useTableSelectionCellStyles_unstable = exports.tableSelectionCellClassNames = void 0;
7
+
8
+ const react_1 = /*#__PURE__*/require("@griffel/react");
9
+
10
+ exports.tableSelectionCellClassNames = {
11
+ root: 'fui-TableSelectionCell',
12
+ checkboxIndicator: 'fui-TableSelectionCell__checkboxIndicator',
13
+ radioIndicator: 'fui-TableSelectionCell__radioIndicator'
14
+ };
15
+
16
+ const useTableLayoutStyles = /*#__PURE__*/react_1.__styles({
17
+ "root": {
18
+ "mc9l5x": "f15pt5es",
19
+ "a9b677": "fksc0bp"
20
+ }
21
+ }, {
22
+ "d": [".f15pt5es{display:table-cell;}", ".fksc0bp{width:44px;}"]
23
+ });
24
+
25
+ const useFlexLayoutStyles = /*#__PURE__*/react_1.__styles({
26
+ "root": {
27
+ "mc9l5x": "f22iagw",
28
+ "Bh6795r": "fqerorx",
29
+ "Bnnss6s": "f1neuvcm",
30
+ "xawz": "fkjuxzh",
31
+ "Bf4jedk": "fvrlu0f",
32
+ "B2u0y6b": "f1c71y05",
33
+ "Brf1p80": "f4d9j23"
34
+ }
35
+ }, {
36
+ "d": [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".fqerorx{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".f1neuvcm{-webkit-flex-shrink:1;-ms-flex-negative:1;flex-shrink:1;}", ".fkjuxzh{-webkit-flex-basis:0px;-ms-flex-preferred-size:0px;flex-basis:0px;}", ".fvrlu0f{min-width:44px;}", ".f1c71y05{max-width:44px;}", ".f4d9j23{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;}"]
37
+ });
38
+ /**
39
+ * Styles for the root slot
40
+ */
41
+
42
+
43
+ const useStyles = /*#__PURE__*/react_1.__styles({
44
+ "root": {
45
+ "fsow6f": "f17mccla",
46
+ "Huce71": "fz5stix",
47
+ "z8tnut": "f1g0x7ka",
48
+ "z189sj": ["fhxju0i", "f1cnd47f"],
49
+ "Byoj8tv": "f1qch9an",
50
+ "uwmqm3": ["f1cnd47f", "fhxju0i"]
51
+ },
52
+ "radioIndicator": {
53
+ "mc9l5x": "f22iagw",
54
+ "Bh6795r": "fqerorx",
55
+ "Bt984gj": "f122n59",
56
+ "Brf1p80": "f4d9j23",
57
+ "B5pe6w7": "f1cqkysu",
58
+ "p4uzdd": "f1sgf1mg"
59
+ },
60
+ "hidden": {
61
+ "Bcdw1i0": "fd7fpy0"
62
+ }
63
+ }, {
64
+ "d": [".f17mccla{text-align:center;}", ".fz5stix{white-space:nowrap;}", ".f1g0x7ka{padding-top:0;}", ".fhxju0i{padding-right:0;}", ".f1cnd47f{padding-left:0;}", ".f1qch9an{padding-bottom:0;}", ".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".fqerorx{-webkit-box-flex:1;-webkit-flex-grow:1;-ms-flex-positive:1;flex-grow:1;}", ".f122n59{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".f4d9j23{-webkit-box-pack:center;-ms-flex-pack:center;-webkit-justify-content:center;justify-content:center;}", ".f1cqkysu svg{width:16px;}", ".f1sgf1mg svg{height:16px;}", ".fd7fpy0{visibility:hidden;}"]
65
+ });
66
+ /**
67
+ * Apply styling to the TableSelectionCell slots based on the state
68
+ */
69
+
70
+
71
+ const useTableSelectionCellStyles_unstable = state => {
72
+ const styles = useStyles();
73
+ const layoutStyles = {
74
+ table: useTableLayoutStyles(),
75
+ flex: useFlexLayoutStyles()
76
+ };
77
+ state.root.className = react_1.mergeClasses(exports.tableSelectionCellClassNames.root, styles.root, state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root, state.root.className);
78
+
79
+ if (state.checkboxIndicator) {
80
+ state.checkboxIndicator.className = react_1.mergeClasses(exports.tableSelectionCellClassNames.checkboxIndicator, state.checkboxIndicator.className);
81
+ }
82
+
83
+ if (state.radioIndicator) {
84
+ state.radioIndicator.className = react_1.mergeClasses(exports.tableSelectionCellClassNames.radioIndicator, styles.radioIndicator, state.checked === false && styles.hidden, state.radioIndicator.className);
85
+ }
86
+
87
+ return state;
88
+ };
89
+
90
+ exports.useTableSelectionCellStyles_unstable = useTableSelectionCellStyles_unstable;
91
+ //# sourceMappingURL=useTableSelectionCellStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../../packages/react-components/react-table/src/components/TableSelectionCell/useTableSelectionCellStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AAIa,OAAA,CAAA,4BAAA,GAAwE;EACnF,IAAI,EAAE,wBAD6E;EAEnF,iBAAiB,EAAE,2CAFgE;EAGnF,cAAc,EAAE;AAHmE,CAAxE;;AAMb,MAAM,oBAAoB,gBAAG,OAAA,SAAA;EAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAA7B;;AAOA,MAAM,mBAAmB,gBAAG,OAAA,SAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAA5B;AAUA;;AAEG;;;AACH,MAAM,SAAS,gBAAG,OAAA,SAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAlB;AAuBA;;AAEG;;;AACI,MAAM,oCAAoC,GAAI,KAAD,IAA4D;EAC9G,MAAM,MAAM,GAAG,SAAS,EAAxB;EACA,MAAM,YAAY,GAAG;IACnB,KAAK,EAAE,oBAAoB,EADR;IAEnB,IAAI,EAAE,mBAAmB;EAFN,CAArB;EAIA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,OAAA,CAAA,YAAA,CACrB,OAAA,CAAA,4BAAA,CAA6B,IADR,EAErB,MAAM,CAAC,IAFc,EAGrB,KAAK,CAAC,gBAAN,GAAyB,YAAY,CAAC,IAAb,CAAkB,IAA3C,GAAkD,YAAY,CAAC,KAAb,CAAmB,IAHhD,EAIrB,KAAK,CAAC,IAAN,CAAW,SAJU,CAAvB;;EAMA,IAAI,KAAK,CAAC,iBAAV,EAA6B;IAC3B,KAAK,CAAC,iBAAN,CAAwB,SAAxB,GAAoC,OAAA,CAAA,YAAA,CAClC,OAAA,CAAA,4BAAA,CAA6B,iBADK,EAElC,KAAK,CAAC,iBAAN,CAAwB,SAFU,CAApC;EAID;;EAED,IAAI,KAAK,CAAC,cAAV,EAA0B;IACxB,KAAK,CAAC,cAAN,CAAqB,SAArB,GAAiC,OAAA,CAAA,YAAA,CAC/B,OAAA,CAAA,4BAAA,CAA6B,cADE,EAE/B,MAAM,CAAC,cAFwB,EAG/B,KAAK,CAAC,OAAN,KAAkB,KAAlB,IAA2B,MAAM,CAAC,MAHH,EAI/B,KAAK,CAAC,cAAN,CAAqB,SAJU,CAAjC;EAMD;;EAED,OAAO,KAAP;AACD,CA7BM;;AAAM,OAAA,CAAA,oCAAA,GAAoC,oCAApC","sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { TableSelectionCellSlots, TableSelectionCellState } from './TableSelectionCell.types';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\n\nexport const tableSelectionCellClassNames: SlotClassNames<TableSelectionCellSlots> = {\n root: 'fui-TableSelectionCell',\n checkboxIndicator: 'fui-TableSelectionCell__checkboxIndicator',\n radioIndicator: 'fui-TableSelectionCell__radioIndicator',\n};\n\nconst useTableLayoutStyles = makeStyles({\n root: {\n display: 'table-cell',\n width: '44px',\n },\n});\n\nconst useFlexLayoutStyles = makeStyles({\n root: {\n display: 'flex',\n ...shorthands.flex(1, 1, '0px'),\n minWidth: '44px',\n maxWidth: '44px',\n justifyContent: 'center',\n },\n});\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n textAlign: 'center',\n whiteSpace: 'nowrap',\n ...shorthands.padding(0),\n },\n\n radioIndicator: {\n display: 'flex',\n flexGrow: 1,\n alignItems: 'center',\n justifyContent: 'center',\n '& svg': {\n width: '16px',\n height: '16px',\n },\n },\n\n hidden: {\n visibility: 'hidden',\n },\n});\n\n/**\n * Apply styling to the TableSelectionCell slots based on the state\n */\nexport const useTableSelectionCellStyles_unstable = (state: TableSelectionCellState): TableSelectionCellState => {\n const styles = useStyles();\n const layoutStyles = {\n table: useTableLayoutStyles(),\n flex: useFlexLayoutStyles(),\n };\n state.root.className = mergeClasses(\n tableSelectionCellClassNames.root,\n styles.root,\n state.noNativeElements ? layoutStyles.flex.root : layoutStyles.table.root,\n state.root.className,\n );\n if (state.checkboxIndicator) {\n state.checkboxIndicator.className = mergeClasses(\n tableSelectionCellClassNames.checkboxIndicator,\n state.checkboxIndicator.className,\n );\n }\n\n if (state.radioIndicator) {\n state.radioIndicator.className = mergeClasses(\n tableSelectionCellClassNames.radioIndicator,\n styles.radioIndicator,\n state.checked === false && styles.hidden,\n state.radioIndicator.className,\n );\n }\n\n return state;\n};\n"],"sourceRoot":""}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useTableContext = exports.TableContextProvider = exports.tableContextDefaultValue = void 0;
7
+
8
+ const React = /*#__PURE__*/require("react");
9
+
10
+ const tableContext = /*#__PURE__*/React.createContext(undefined);
11
+ exports.tableContextDefaultValue = {
12
+ size: 'medium',
13
+ noNativeElements: false,
14
+ sortable: false
15
+ };
16
+ exports.TableContextProvider = tableContext.Provider;
17
+
18
+ const useTableContext = () => {
19
+ var _a;
20
+
21
+ return (_a = React.useContext(tableContext)) !== null && _a !== void 0 ? _a : exports.tableContextDefaultValue;
22
+ };
23
+
24
+ exports.useTableContext = useTableContext;
25
+ //# sourceMappingURL=tableContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../packages/react-components/react-table/src/contexts/tableContext.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AAGA,MAAM,YAAY,gBAAG,KAAK,CAAC,aAAN,CAAmD,SAAnD,CAArB;AAEa,OAAA,CAAA,wBAAA,GAA8C;EACzD,IAAI,EAAE,QADmD;EAEzD,gBAAgB,EAAE,KAFuC;EAGzD,QAAQ,EAAE;AAH+C,CAA9C;AAMA,OAAA,CAAA,oBAAA,GAAuB,YAAY,CAAC,QAApC;;AACN,MAAM,eAAe,GAAG,MAAK;EAAA,IAAA,EAAA;;EAAC,OAAA,CAAA,EAAA,GAAA,KAAK,CAAC,UAAN,CAAiB,YAAjB,CAAA,MAA8B,IAA9B,IAA8B,EAAA,KAAA,KAAA,CAA9B,GAA8B,EAA9B,GAAkC,OAAA,CAAA,wBAAlC;AAA0D,CAAxF;;AAAM,OAAA,CAAA,eAAA,GAAe,eAAf","sourcesContent":["import * as React from 'react';\nimport { TableContextValue } from '../components/Table/Table.types';\n\nconst tableContext = React.createContext<TableContextValue | undefined>(undefined);\n\nexport const tableContextDefaultValue: TableContextValue = {\n size: 'medium',\n noNativeElements: false,\n sortable: false,\n};\n\nexport const TableContextProvider = tableContext.Provider;\nexport const useTableContext = () => React.useContext(tableContext) ?? tableContextDefaultValue;\n"],"sourceRoot":""}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./types"), exports);
10
+
11
+ tslib_1.__exportStar(require("./useTable"), exports);
12
+
13
+ tslib_1.__exportStar(require("./useSort"), exports);
14
+
15
+ tslib_1.__exportStar(require("./useSelection"), exports);
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../packages/react-components/react-table/src/hooks/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,YAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,WAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './types';\nexport * from './useTable';\nexport * from './useSort';\nexport * from './useSelection';\n"],"sourceRoot":""}
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createSelectionManager = void 0;
7
+
8
+ function createSelectionManager(mode, onSelectionChange = () => undefined) {
9
+ const managerFactory = mode === 'multiselect' ? createMultipleSelectionManager : createSingleSelectionManager;
10
+ return managerFactory(onSelectionChange);
11
+ }
12
+
13
+ exports.createSelectionManager = createSelectionManager;
14
+
15
+ function createMultipleSelectionManager(onSelectionChange) {
16
+ const toggleAllItems = (itemIds, selectedItems) => {
17
+ const allItemsSelected = itemIds.every(itemId => selectedItems.has(itemId));
18
+
19
+ if (allItemsSelected) {
20
+ selectedItems.clear();
21
+ } else {
22
+ itemIds.forEach(itemId => selectedItems.add(itemId));
23
+ }
24
+
25
+ onSelectionChange(new Set(selectedItems));
26
+ };
27
+
28
+ const toggleItem = (itemId, selectedItems) => {
29
+ if (selectedItems.has(itemId)) {
30
+ selectedItems.delete(itemId);
31
+ } else {
32
+ selectedItems.add(itemId);
33
+ }
34
+
35
+ onSelectionChange(new Set(selectedItems));
36
+ };
37
+
38
+ const selectItem = (itemId, selectedItems) => {
39
+ selectedItems.add(itemId);
40
+ onSelectionChange(new Set(selectedItems));
41
+ };
42
+
43
+ const deselectItem = (itemId, selectedItems) => {
44
+ selectedItems.delete(itemId);
45
+ onSelectionChange(new Set(selectedItems));
46
+ };
47
+
48
+ const clearItems = () => {
49
+ onSelectionChange(new Set());
50
+ };
51
+
52
+ const isSelected = (itemId, selectedItems) => {
53
+ return selectedItems.has(itemId);
54
+ };
55
+
56
+ return {
57
+ toggleItem,
58
+ selectItem,
59
+ deselectItem,
60
+ clearItems,
61
+ isSelected,
62
+ toggleAllItems
63
+ };
64
+ }
65
+
66
+ function createSingleSelectionManager(onSelectionChange) {
67
+ const toggleItem = itemId => {
68
+ onSelectionChange(new Set([itemId]));
69
+ };
70
+
71
+ const clearItems = () => {
72
+ onSelectionChange(new Set());
73
+ };
74
+
75
+ const isSelected = (itemId, selectedItems) => {
76
+ return selectedItems.has(itemId);
77
+ };
78
+
79
+ const selectItem = itemId => {
80
+ onSelectionChange(new Set([itemId]));
81
+ };
82
+
83
+ return {
84
+ deselectItem: clearItems,
85
+ selectItem,
86
+ toggleAllItems: () => {
87
+ if (process.env.NODE_ENV !== 'production') {
88
+ throw new Error('[react-table]: `toggleAllItems` should not be used in single selection mode');
89
+ }
90
+
91
+ return undefined;
92
+ },
93
+ toggleItem,
94
+ clearItems,
95
+ isSelected
96
+ };
97
+ }
98
+ //# sourceMappingURL=selectionManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../packages/react-components/react-table/src/hooks/selectionManager.ts"],"names":[],"mappings":";;;;;;;AAeA,SAAgB,sBAAhB,CACE,IADF,EAEE,iBAAA,GAA+C,MAAM,SAFvD,EAEgE;EAE9D,MAAM,cAAc,GAAG,IAAI,KAAK,aAAT,GAAyB,8BAAzB,GAA0D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FD;;EAIA,MAAM,UAAU,GAAG,CAAC,MAAD,EAA0B,aAA1B,KAAiE;IAClF,OAAO,aAAa,CAAC,GAAd,CAAkB,MAAlB,CAAP;EACD,CAFD;;EAIA,OAAO;IACL,UADK;IAEL,UAFK;IAGL,YAHK;IAIL,UAJK;IAKL,UALK;IAML;EANK,CAAP;AAQD;;AAED,SAAS,4BAAT,CAAsC,iBAAtC,EAAkF;EAChF,MAAM,UAAU,GAAI,MAAD,IAA4B;IAC7C,iBAAiB,CAAC,IAAI,GAAJ,CAAQ,CAAC,MAAD,CAAR,CAAD,CAAjB;EACD,CAFD;;EAIA,MAAM,UAAU,GAAG,MAAK;IACtB,iBAAiB,CAAC,IAAI,GAAJ,EAAD,CAAjB;EACD,CAFD;;EAIA,MAAM,UAAU,GAAG,CAAC,MAAD,EAA0B,aAA1B,KAAiE;IAClF,OAAO,aAAa,CAAC,GAAd,CAAkB,MAAlB,CAAP;EACD,CAFD;;EAIA,MAAM,UAAU,GAAI,MAAD,IAA4B;IAC7C,iBAAiB,CAAC,IAAI,GAAJ,CAAQ,CAAC,MAAD,CAAR,CAAD,CAAjB;EACD,CAFD;;EAIA,OAAO;IACL,YAAY,EAAE,UADT;IAEL,UAFK;IAGL,cAAc,EAAE,MAAK;MACnB,IAAI,OAAO,CAAC,GAAR,CAAY,QAAZ,KAAyB,YAA7B,EAA2C;QACzC,MAAM,IAAI,KAAJ,CAAU,6EAAV,CAAN;MACD;;MAED,OAAO,SAAP;IACD,CATI;IAUL,UAVK;IAWL,UAXK;IAYL;EAZK,CAAP;AAcD","sourcesContent":["import { SelectionMode } from './types';\n\ntype OnSelectionChangeCallback = (selectedItems: Set<SelectionItemId>) => void;\n\nexport interface SelectionManager {\n toggleItem(id: SelectionItemId, selectedItems: Set<SelectionItemId>): void;\n selectItem(id: SelectionItemId, selectedItems: Set<SelectionItemId>): void;\n deselectItem(id: SelectionItemId, selectedItems: Set<SelectionItemId>): void;\n clearItems(): void;\n isSelected(id: SelectionItemId, selectedItems: Set<SelectionItemId>): boolean;\n toggleAllItems(itemIds: SelectionItemId[], selectedItems: Set<SelectionItemId>): void;\n}\n\nexport type SelectionItemId = string | number;\n\nexport function createSelectionManager(\n mode: SelectionMode,\n onSelectionChange: OnSelectionChangeCallback = () => undefined,\n): SelectionManager {\n const managerFactory = mode === 'multiselect' ? createMultipleSelectionManager : createSingleSelectionManager;\n\n return managerFactory(onSelectionChange);\n}\n\nfunction createMultipleSelectionManager(onSelectionChange: OnSelectionChangeCallback): SelectionManager {\n const toggleAllItems = (itemIds: SelectionItemId[], selectedItems: Set<SelectionItemId>) => {\n const allItemsSelected = itemIds.every(itemId => selectedItems.has(itemId));\n\n if (allItemsSelected) {\n selectedItems.clear();\n } else {\n itemIds.forEach(itemId => selectedItems.add(itemId));\n }\n\n onSelectionChange(new Set(selectedItems));\n };\n\n const toggleItem = (itemId: SelectionItemId, selectedItems: Set<SelectionItemId>) => {\n if (selectedItems.has(itemId)) {\n selectedItems.delete(itemId);\n } else {\n selectedItems.add(itemId);\n }\n\n onSelectionChange(new Set(selectedItems));\n };\n\n const selectItem = (itemId: SelectionItemId, selectedItems: Set<SelectionItemId>) => {\n selectedItems.add(itemId);\n onSelectionChange(new Set(selectedItems));\n };\n\n const deselectItem = (itemId: SelectionItemId, selectedItems: Set<SelectionItemId>) => {\n selectedItems.delete(itemId);\n onSelectionChange(new Set(selectedItems));\n };\n\n const clearItems = () => {\n onSelectionChange(new Set());\n };\n\n const isSelected = (itemId: SelectionItemId, selectedItems: Set<SelectionItemId>) => {\n return selectedItems.has(itemId);\n };\n\n return {\n toggleItem,\n selectItem,\n deselectItem,\n clearItems,\n isSelected,\n toggleAllItems,\n };\n}\n\nfunction createSingleSelectionManager(onSelectionChange: OnSelectionChangeCallback): SelectionManager {\n const toggleItem = (itemId: SelectionItemId) => {\n onSelectionChange(new Set([itemId]));\n };\n\n const clearItems = () => {\n onSelectionChange(new Set<SelectionItemId>());\n };\n\n const isSelected = (itemId: SelectionItemId, selectedItems: Set<SelectionItemId>) => {\n return selectedItems.has(itemId);\n };\n\n const selectItem = (itemId: SelectionItemId) => {\n onSelectionChange(new Set([itemId]));\n };\n\n return {\n deselectItem: clearItems,\n selectItem,\n toggleAllItems: () => {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error('[react-table]: `toggleAllItems` should not be used in single selection mode');\n }\n\n return undefined;\n },\n toggleItem,\n clearItems,\n isSelected,\n };\n}\n"],"sourceRoot":""}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":""}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useSelectionState = exports.useSelection = exports.defaultTableSelectionState = void 0;
7
+
8
+ const React = /*#__PURE__*/require("react");
9
+
10
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
11
+
12
+ const selectionManager_1 = /*#__PURE__*/require("./selectionManager");
13
+
14
+ const noop = () => undefined;
15
+
16
+ exports.defaultTableSelectionState = {
17
+ allRowsSelected: false,
18
+ clearRows: noop,
19
+ deselectRow: noop,
20
+ isRowSelected: () => false,
21
+ selectRow: noop,
22
+ selectedRows: /*#__PURE__*/new Set(),
23
+ someRowsSelected: false,
24
+ toggleAllRows: noop,
25
+ toggleRow: noop
26
+ };
27
+
28
+ function useSelection(options) {
29
+ // False positive, these plugin hooks are intended to be run on every render
30
+ // eslint-disable-next-line react-hooks/rules-of-hooks
31
+ return tableState => useSelectionState(tableState, options);
32
+ }
33
+
34
+ exports.useSelection = useSelection;
35
+
36
+ function useSelectionState(tableState, options) {
37
+ const {
38
+ items,
39
+ getRowId
40
+ } = tableState;
41
+ const {
42
+ selectionMode,
43
+ defaultSelectedItems,
44
+ selectedItems,
45
+ onSelectionChange
46
+ } = options;
47
+ const [selected, setSelected] = react_utilities_1.useControllableState({
48
+ initialState: new Set(),
49
+ defaultState: defaultSelectedItems,
50
+ state: selectedItems
51
+ });
52
+ const selectionManager = React.useMemo(() => {
53
+ return selectionManager_1.createSelectionManager(selectionMode, newSelectedItems => {
54
+ setSelected(() => {
55
+ onSelectionChange === null || onSelectionChange === void 0 ? void 0 : onSelectionChange(newSelectedItems);
56
+ return newSelectedItems;
57
+ });
58
+ });
59
+ }, [onSelectionChange, selectionMode, setSelected]);
60
+ const toggleAllRows = react_utilities_1.useEventCallback(() => {
61
+ selectionManager.toggleAllItems(items.map((item, i) => {
62
+ var _a;
63
+
64
+ return (_a = getRowId === null || getRowId === void 0 ? void 0 : getRowId(item)) !== null && _a !== void 0 ? _a : i;
65
+ }), selected);
66
+ });
67
+ const toggleRow = react_utilities_1.useEventCallback(rowId => selectionManager.toggleItem(rowId, selected));
68
+ const deselectRow = react_utilities_1.useEventCallback(rowId => selectionManager.deselectItem(rowId, selected));
69
+ const selectRow = react_utilities_1.useEventCallback(rowId => selectionManager.selectItem(rowId, selected));
70
+
71
+ const isRowSelected = rowId => selectionManager.isSelected(rowId, selected);
72
+
73
+ return { ...tableState,
74
+ selection: {
75
+ someRowsSelected: selected.size > 0,
76
+ allRowsSelected: selectionMode === 'single' ? selected.size > 0 : selected.size === items.length,
77
+ selectedRows: selected,
78
+ toggleRow,
79
+ toggleAllRows,
80
+ clearRows: selectionManager.clearItems,
81
+ deselectRow,
82
+ selectRow,
83
+ isRowSelected
84
+ }
85
+ };
86
+ }
87
+
88
+ exports.useSelectionState = useSelectionState;
89
+ //# sourceMappingURL=useSelection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../packages/react-components/react-table/src/hooks/useSelection.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MA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,aALS;MAMT,SAAS,EAAE,gBAAgB,CAAC,UANnB;MAOT,WAPS;MAQT,SARS;MAST;IATS;EAFN,CAAP;AAcD;;AA1DD,OAAA,CAAA,iBAAA,GAAA,iBAAA","sourcesContent":["import * as React from 'react';\nimport { useControllableState, useEventCallback } from '@fluentui/react-utilities';\nimport { createSelectionManager } from './selectionManager';\nimport type { RowId, TableSelectionState, TableState, UseSelectionOptions } from './types';\n\nconst noop = () => undefined;\n\nexport const defaultTableSelectionState: TableSelectionState = {\n allRowsSelected: false,\n clearRows: noop,\n deselectRow: noop,\n isRowSelected: () => false,\n selectRow: noop,\n selectedRows: new Set(),\n someRowsSelected: false,\n toggleAllRows: noop,\n toggleRow: noop,\n};\n\nexport function useSelection<TItem>(options: UseSelectionOptions) {\n // False positive, these plugin hooks are intended to be run on every render\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return (tableState: TableState<TItem>) => useSelectionState(tableState, options);\n}\n\nexport function useSelectionState<TItem>(\n tableState: TableState<TItem>,\n options: UseSelectionOptions,\n): TableState<TItem> {\n const { items, getRowId } = tableState;\n const { selectionMode, defaultSelectedItems, selectedItems, onSelectionChange } = options;\n\n const [selected, setSelected] = useControllableState({\n initialState: new Set<RowId>(),\n defaultState: defaultSelectedItems,\n state: selectedItems,\n });\n\n const selectionManager = React.useMemo(() => {\n return createSelectionManager(selectionMode, newSelectedItems => {\n setSelected(() => {\n onSelectionChange?.(newSelectedItems);\n return newSelectedItems;\n });\n });\n }, [onSelectionChange, selectionMode, setSelected]);\n\n const toggleAllRows: TableSelectionState['toggleAllRows'] = useEventCallback(() => {\n selectionManager.toggleAllItems(\n items.map((item, i) => getRowId?.(item) ?? i),\n selected,\n );\n });\n\n const toggleRow: TableSelectionState['toggleRow'] = useEventCallback((rowId: RowId) =>\n selectionManager.toggleItem(rowId, selected),\n );\n\n const deselectRow: TableSelectionState['deselectRow'] = useEventCallback((rowId: RowId) =>\n selectionManager.deselectItem(rowId, selected),\n );\n\n const selectRow: TableSelectionState['selectRow'] = useEventCallback((rowId: RowId) =>\n selectionManager.selectItem(rowId, selected),\n );\n\n const isRowSelected: TableSelectionState['isRowSelected'] = (rowId: RowId) =>\n selectionManager.isSelected(rowId, selected);\n\n return {\n ...tableState,\n selection: {\n someRowsSelected: selected.size > 0,\n allRowsSelected: selectionMode === 'single' ? selected.size > 0 : selected.size === items.length,\n selectedRows: selected,\n toggleRow,\n toggleAllRows,\n clearRows: selectionManager.clearItems,\n deselectRow,\n selectRow,\n isRowSelected,\n },\n };\n}\n"],"sourceRoot":""}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useSortState = exports.useSort = exports.defaultTableSortState = void 0;
7
+
8
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
9
+
10
+ const noop = () => undefined;
11
+
12
+ exports.defaultTableSortState = {
13
+ getSortDirection: () => 'ascending',
14
+ setColumnSort: noop,
15
+ sort: rows => [...rows],
16
+ sortColumn: undefined,
17
+ sortDirection: 'ascending',
18
+ toggleColumnSort: noop
19
+ };
20
+
21
+ function useSort(options) {
22
+ // False positive, these plugin hooks are intended to be run on every render
23
+ // eslint-disable-next-line react-hooks/rules-of-hooks
24
+ return tableState => useSortState(tableState, options);
25
+ }
26
+
27
+ exports.useSort = useSort;
28
+
29
+ function useSortState(tableState, options) {
30
+ const {
31
+ columns
32
+ } = tableState;
33
+ const {
34
+ sortState,
35
+ defaultSortState,
36
+ onSortChange
37
+ } = options;
38
+ const [sorted, setSorted] = react_utilities_1.useControllableState({
39
+ initialState: {
40
+ sortDirection: 'ascending',
41
+ sortColumn: undefined
42
+ },
43
+ defaultState: defaultSortState,
44
+ state: sortState
45
+ });
46
+ const {
47
+ sortColumn,
48
+ sortDirection
49
+ } = sorted;
50
+
51
+ const toggleColumnSort = columnId => {
52
+ setSorted(s => {
53
+ const newState = { ...s,
54
+ sortColumn: columnId
55
+ };
56
+
57
+ if (s.sortColumn === columnId) {
58
+ newState.sortDirection = s.sortDirection === 'ascending' ? 'descending' : 'ascending';
59
+ } else {
60
+ newState.sortDirection = 'ascending';
61
+ }
62
+
63
+ onSortChange === null || onSortChange === void 0 ? void 0 : onSortChange(newState);
64
+ return newState;
65
+ });
66
+ };
67
+
68
+ const setColumnSort = (nextSortColumn, nextSortDirection) => {
69
+ const newState = {
70
+ sortColumn: nextSortColumn,
71
+ sortDirection: nextSortDirection
72
+ };
73
+ onSortChange === null || onSortChange === void 0 ? void 0 : onSortChange(newState);
74
+ setSorted(newState);
75
+ };
76
+
77
+ const sort = rows => {
78
+ return rows.slice().sort((a, b) => {
79
+ const sortColumnDef = columns.find(column => column.columnId === sortColumn);
80
+
81
+ if (!(sortColumnDef === null || sortColumnDef === void 0 ? void 0 : sortColumnDef.compare)) {
82
+ return 0;
83
+ }
84
+
85
+ const mod = sortDirection === 'ascending' ? 1 : -1;
86
+ return sortColumnDef.compare(a.item, b.item) * mod;
87
+ });
88
+ };
89
+
90
+ const getSortDirection = columnId => {
91
+ return sortColumn === columnId ? sortDirection : undefined;
92
+ };
93
+
94
+ return { ...tableState,
95
+ sort: {
96
+ sort,
97
+ sortColumn,
98
+ sortDirection,
99
+ setColumnSort,
100
+ toggleColumnSort,
101
+ getSortDirection
102
+ }
103
+ };
104
+ }
105
+
106
+ exports.useSortState = useSortState;
107
+ //# sourceMappingURL=useSort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../../packages/react-components/react-table/src/hooks/useSort.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AAGA,MAAM,IAAI,GAAG,MAAM,SAAnB;;AAEa,OAAA,CAAA,qBAAA,GAAiD;EAC5D,gBAAgB,EAAE,MAAM,WADoC;EAE5D,aAAa,EAAE,IAF6C;EAG5D,IAAI,EAAG,IAAD,IAA+B,CAAC,GAAG,IAAJ,CAHuB;EAI5D,UAAU,EAAE,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,GAAG;MAAE,UAAU,EAAE,cAAd;MAA8B,aAAa,EAAE;IAA7C,CAAjB;IACA,YAAY,KAAA,IAAZ,IAAA,YAAY,KAAA,KAAA,CAAZ,GAAY,KAAA,CAAZ,GAAA,YAAY,CAAG,QAAH,CAAZ;IACA,SAAS,CAAC,QAAD,CAAT;EACD,CAJD;;EAMA,MAAM,IAAI,GAAI,IAAD,IAA4B;IACvC,OAAO,IAAI,CAAC,KAAL,GAAa,IAAb,CAAkB,CAAC,CAAD,EAAI,CAAJ,KAAS;MAChC,MAAM,aAAa,GAAG,OAAO,CAAC,IAAR,CAAa,MAAM,IAAI,MAAM,CAAC,QAAP,KAAoB,UAA3C,CAAtB;;MACA,IAAI,EAAC,aAAa,KAAA,IAAb,IAAA,aAAa,KAAA,KAAA,CAAb,GAAa,KAAA,CAAb,GAAA,aAAa,CAAE,OAAhB,CAAJ,EAA6B;QAC3B,OAAO,CAAP;MACD;;MAED,MAAM,GAAG,GAAG,aAAa,KAAK,WAAlB,GAAgC,CAAhC,GAAoC,CAAC,CAAjD;MACA,OAAO,aAAa,CAAC,OAAd,CAAsB,CAAC,CAAC,IAAxB,EAA8B,CAAC,CAAC,IAAhC,IAAwC,GAA/C;IACD,CARM,CAAP;EASD,CAVD;;EAYA,MAAM,gBAAgB,GAA+C,QAAD,IAAuB;IACzF,OAAO,UAAU,KAAK,QAAf,GAA0B,aAA1B,GAA0C,SAAjD;EACD,CAFD;;EAIA,OAAO,EACL,GAAG,UADE;IAEL,IAAI,EAAE;MACJ,IADI;MAEJ,UAFI;MAGJ,aAHI;MAIJ,aAJI;MAKJ,gBALI;MAMJ;IANI;EAFD,CAAP;AAWD;;AA9DD,OAAA,CAAA,YAAA,GAAA,YAAA","sourcesContent":["import { useControllableState } from '@fluentui/react-utilities';\nimport type { ColumnId, RowState, SortState, TableSortState, TableState, UseSortOptions } from './types';\n\nconst noop = () => undefined;\n\nexport const defaultTableSortState: TableSortState<unknown> = {\n getSortDirection: () => 'ascending',\n setColumnSort: noop,\n sort: (rows: RowState<unknown>[]) => [...rows],\n sortColumn: undefined,\n sortDirection: 'ascending',\n toggleColumnSort: noop,\n};\n\nexport function useSort<TItem>(options: UseSortOptions) {\n // False positive, these plugin hooks are intended to be run on every render\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return (tableState: TableState<TItem>) => useSortState(tableState, options);\n}\n\nexport function useSortState<TItem>(tableState: TableState<TItem>, options: UseSortOptions): TableState<TItem> {\n const { columns } = tableState;\n const { sortState, defaultSortState, onSortChange } = options;\n\n const [sorted, setSorted] = useControllableState<SortState>({\n initialState: {\n sortDirection: 'ascending' as const,\n sortColumn: undefined,\n },\n defaultState: defaultSortState,\n state: sortState,\n });\n\n const { sortColumn, sortDirection } = sorted;\n\n const toggleColumnSort = (columnId: ColumnId | undefined) => {\n setSorted(s => {\n const newState = { ...s, sortColumn: columnId };\n if (s.sortColumn === columnId) {\n newState.sortDirection = s.sortDirection === 'ascending' ? 'descending' : 'ascending';\n } else {\n newState.sortDirection = 'ascending';\n }\n\n onSortChange?.(newState);\n return newState;\n });\n };\n\n const setColumnSort: TableSortState<TItem>['setColumnSort'] = (nextSortColumn, nextSortDirection) => {\n const newState = { sortColumn: nextSortColumn, sortDirection: nextSortDirection };\n onSortChange?.(newState);\n setSorted(newState);\n };\n\n const sort = (rows: RowState<TItem>[]) => {\n return rows.slice().sort((a, b) => {\n const sortColumnDef = columns.find(column => column.columnId === sortColumn);\n if (!sortColumnDef?.compare) {\n return 0;\n }\n\n const mod = sortDirection === 'ascending' ? 1 : -1;\n return sortColumnDef.compare(a.item, b.item) * mod;\n });\n };\n\n const getSortDirection: TableSortState<TItem>['getSortDirection'] = (columnId: ColumnId) => {\n return sortColumn === columnId ? sortDirection : undefined;\n };\n\n return {\n ...tableState,\n sort: {\n sort,\n sortColumn,\n sortDirection,\n setColumnSort,\n toggleColumnSort,\n getSortDirection,\n },\n };\n}\n"],"sourceRoot":""}