@fluentui/react-table 9.0.0-alpha.2 → 9.0.0-alpha.20

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 (508) hide show
  1. package/CHANGELOG.json +1071 -1
  2. package/CHANGELOG.md +280 -2
  3. package/dist/index.d.ts +551 -113
  4. package/lib/DataGrid.js +2 -0
  5. package/lib/DataGrid.js.map +1 -0
  6. package/lib/DataGridBody.js +2 -0
  7. package/lib/DataGridBody.js.map +1 -0
  8. package/lib/DataGridCell.js +2 -0
  9. package/lib/DataGridCell.js.map +1 -0
  10. package/lib/DataGridHeader.js +2 -0
  11. package/lib/DataGridHeader.js.map +1 -0
  12. package/lib/DataGridHeaderCell.js +2 -0
  13. package/lib/DataGridHeaderCell.js.map +1 -0
  14. package/lib/DataGridRow.js +2 -0
  15. package/lib/DataGridRow.js.map +1 -0
  16. package/lib/DataGridSelectionCell.js +2 -0
  17. package/lib/DataGridSelectionCell.js.map +1 -0
  18. package/lib/Table.js.map +1 -1
  19. package/lib/TableBody.js.map +1 -1
  20. package/lib/TableCell.js.map +1 -1
  21. package/lib/TableCellActions.js.map +1 -1
  22. package/lib/TableCellLayout.js.map +1 -1
  23. package/lib/TableCellPrimaryLayout.js.map +1 -1
  24. package/lib/TableHeader.js.map +1 -1
  25. package/lib/TableHeaderCell.js.map +1 -1
  26. package/lib/TableRow.js.map +1 -1
  27. package/lib/TableSelectionCell.js.map +1 -1
  28. package/lib/components/DataGrid/DataGrid.js +15 -0
  29. package/lib/components/DataGrid/DataGrid.js.map +1 -0
  30. package/lib/components/DataGrid/DataGrid.types.js +2 -0
  31. package/lib/components/DataGrid/DataGrid.types.js.map +1 -0
  32. package/lib/components/DataGrid/index.js +6 -0
  33. package/lib/components/DataGrid/index.js.map +1 -0
  34. package/lib/components/DataGrid/renderDataGrid.js +12 -0
  35. package/lib/components/DataGrid/renderDataGrid.js.map +1 -0
  36. package/lib/components/DataGrid/useDataGrid.js +63 -0
  37. package/lib/components/DataGrid/useDataGrid.js.map +1 -0
  38. package/lib/components/DataGrid/useDataGridContextValues.js +15 -0
  39. package/lib/components/DataGrid/useDataGridContextValues.js.map +1 -0
  40. package/lib/components/DataGrid/useDataGridStyles.js +14 -0
  41. package/lib/components/DataGrid/useDataGridStyles.js.map +1 -0
  42. package/lib/components/DataGridBody/DataGridBody.js +14 -0
  43. package/lib/components/DataGridBody/DataGridBody.js.map +1 -0
  44. package/lib/components/DataGridBody/DataGridBody.types.js +2 -0
  45. package/lib/components/DataGridBody/DataGridBody.types.js.map +1 -0
  46. package/lib/components/DataGridBody/index.js +6 -0
  47. package/lib/components/DataGridBody/index.js.map +1 -0
  48. package/lib/components/DataGridBody/renderDataGridBody.js +19 -0
  49. package/lib/components/DataGridBody/renderDataGridBody.js.map +1 -0
  50. package/lib/components/DataGridBody/useDataGridBody.js +31 -0
  51. package/lib/components/DataGridBody/useDataGridBody.js.map +1 -0
  52. package/lib/components/DataGridBody/useDataGridBodyStyles.js +14 -0
  53. package/lib/components/DataGridBody/useDataGridBodyStyles.js.map +1 -0
  54. package/lib/components/DataGridCell/DataGridCell.js +14 -0
  55. package/lib/components/DataGridCell/DataGridCell.js.map +1 -0
  56. package/lib/components/DataGridCell/DataGridCell.types.js +2 -0
  57. package/lib/components/DataGridCell/DataGridCell.types.js.map +1 -0
  58. package/lib/components/DataGridCell/index.js +6 -0
  59. package/lib/components/DataGridCell/index.js.map +1 -0
  60. package/lib/components/DataGridCell/renderDataGridCell.js +8 -0
  61. package/lib/components/DataGridCell/renderDataGridCell.js.map +1 -0
  62. package/lib/components/DataGridCell/useDataGridCell.js +21 -0
  63. package/lib/components/DataGridCell/useDataGridCell.js.map +1 -0
  64. package/lib/components/DataGridCell/useDataGridCellStyles.js +14 -0
  65. package/lib/components/DataGridCell/useDataGridCellStyles.js.map +1 -0
  66. package/lib/components/DataGridHeader/DataGridHeader.js +14 -0
  67. package/lib/components/DataGridHeader/DataGridHeader.js.map +1 -0
  68. package/lib/components/DataGridHeader/DataGridHeader.types.js +2 -0
  69. package/lib/components/DataGridHeader/DataGridHeader.types.js.map +1 -0
  70. package/lib/components/DataGridHeader/index.js +6 -0
  71. package/lib/components/DataGridHeader/index.js.map +1 -0
  72. package/lib/components/DataGridHeader/renderDataGridHeader.js +8 -0
  73. package/lib/components/DataGridHeader/renderDataGridHeader.js.map +1 -0
  74. package/lib/components/DataGridHeader/useDataGridHeader.js +17 -0
  75. package/lib/components/DataGridHeader/useDataGridHeader.js.map +1 -0
  76. package/lib/components/DataGridHeader/useDataGridHeaderStyles.js +14 -0
  77. package/lib/components/DataGridHeader/useDataGridHeaderStyles.js.map +1 -0
  78. package/lib/components/DataGridHeaderCell/DataGridHeaderCell.js +14 -0
  79. package/lib/components/DataGridHeaderCell/DataGridHeaderCell.js.map +1 -0
  80. package/lib/components/DataGridHeaderCell/DataGridHeaderCell.types.js +2 -0
  81. package/lib/components/DataGridHeaderCell/DataGridHeaderCell.types.js.map +1 -0
  82. package/lib/components/DataGridHeaderCell/index.js +6 -0
  83. package/lib/components/DataGridHeaderCell/index.js.map +1 -0
  84. package/lib/components/DataGridHeaderCell/renderDataGridHeaderCell.js +8 -0
  85. package/lib/components/DataGridHeaderCell/renderDataGridHeaderCell.js.map +1 -0
  86. package/lib/components/DataGridHeaderCell/useDataGridHeaderCell.js +37 -0
  87. package/lib/components/DataGridHeaderCell/useDataGridHeaderCell.js.map +1 -0
  88. package/lib/components/DataGridHeaderCell/useDataGridHeaderCellStyles.js +22 -0
  89. package/lib/components/DataGridHeaderCell/useDataGridHeaderCellStyles.js.map +1 -0
  90. package/lib/components/DataGridRow/DataGridRow.js +14 -0
  91. package/lib/components/DataGridRow/DataGridRow.js.map +1 -0
  92. package/lib/components/DataGridRow/DataGridRow.types.js +2 -0
  93. package/lib/components/DataGridRow/DataGridRow.types.js.map +1 -0
  94. package/lib/components/DataGridRow/index.js +6 -0
  95. package/lib/components/DataGridRow/index.js.map +1 -0
  96. package/lib/components/DataGridRow/renderDataGridRow.js +21 -0
  97. package/lib/components/DataGridRow/renderDataGridRow.js.map +1 -0
  98. package/lib/components/DataGridRow/useDataGridRow.js +70 -0
  99. package/lib/components/DataGridRow/useDataGridRow.js.map +1 -0
  100. package/lib/components/DataGridRow/useDataGridRowStyles.js +18 -0
  101. package/lib/components/DataGridRow/useDataGridRowStyles.js.map +1 -0
  102. package/lib/components/DataGridSelectionCell/DataGridSelectionCell.js +14 -0
  103. package/lib/components/DataGridSelectionCell/DataGridSelectionCell.js.map +1 -0
  104. package/lib/components/DataGridSelectionCell/DataGridSelectionCell.types.js +2 -0
  105. package/lib/components/DataGridSelectionCell/DataGridSelectionCell.types.js.map +1 -0
  106. package/lib/components/DataGridSelectionCell/index.js +6 -0
  107. package/lib/components/DataGridSelectionCell/index.js.map +1 -0
  108. package/lib/components/DataGridSelectionCell/renderDataGridSelectionCell.js +8 -0
  109. package/lib/components/DataGridSelectionCell/renderDataGridSelectionCell.js.map +1 -0
  110. package/lib/components/DataGridSelectionCell/useDataGridSelectionCell.js +47 -0
  111. package/lib/components/DataGridSelectionCell/useDataGridSelectionCell.js.map +1 -0
  112. package/lib/components/DataGridSelectionCell/useDataGridSelectionCellStyles.js +22 -0
  113. package/lib/components/DataGridSelectionCell/useDataGridSelectionCellStyles.js.map +1 -0
  114. package/lib/components/Table/Table.js +1 -2
  115. package/lib/components/Table/Table.js.map +1 -1
  116. package/lib/components/Table/Table.types.js.map +1 -1
  117. package/lib/components/Table/index.js.map +1 -1
  118. package/lib/components/Table/renderTable.js +2 -2
  119. package/lib/components/Table/renderTable.js.map +1 -1
  120. package/lib/components/Table/useTable.js +0 -2
  121. package/lib/components/Table/useTable.js.map +1 -1
  122. package/lib/components/Table/useTableContextValues.js.map +1 -1
  123. package/lib/components/Table/useTableStyles.js +26 -11
  124. package/lib/components/Table/useTableStyles.js.map +1 -1
  125. package/lib/components/TableBody/TableBody.js +1 -2
  126. package/lib/components/TableBody/TableBody.js.map +1 -1
  127. package/lib/components/TableBody/TableBody.types.js.map +1 -1
  128. package/lib/components/TableBody/index.js.map +1 -1
  129. package/lib/components/TableBody/renderTableBody.js +3 -4
  130. package/lib/components/TableBody/renderTableBody.js.map +1 -1
  131. package/lib/components/TableBody/useTableBody.js +2 -3
  132. package/lib/components/TableBody/useTableBody.js.map +1 -1
  133. package/lib/components/TableBody/useTableBodyStyles.js +16 -9
  134. package/lib/components/TableBody/useTableBodyStyles.js.map +1 -1
  135. package/lib/components/TableCell/TableCell.js +1 -2
  136. package/lib/components/TableCell/TableCell.js.map +1 -1
  137. package/lib/components/TableCell/TableCell.types.js.map +1 -1
  138. package/lib/components/TableCell/index.js.map +1 -1
  139. package/lib/components/TableCell/renderTableCell.js +2 -2
  140. package/lib/components/TableCell/renderTableCell.js.map +1 -1
  141. package/lib/components/TableCell/useTableCell.js +5 -4
  142. package/lib/components/TableCell/useTableCell.js.map +1 -1
  143. package/lib/components/TableCell/useTableCellStyles.js +58 -13
  144. package/lib/components/TableCell/useTableCellStyles.js.map +1 -1
  145. package/lib/components/TableCellActions/TableCellActions.js +1 -2
  146. package/lib/components/TableCellActions/TableCellActions.js.map +1 -1
  147. package/lib/components/TableCellActions/TableCellActions.types.js.map +1 -1
  148. package/lib/components/TableCellActions/index.js.map +1 -1
  149. package/lib/components/TableCellActions/renderTableCellActions.js +3 -4
  150. package/lib/components/TableCellActions/renderTableCellActions.js.map +1 -1
  151. package/lib/components/TableCellActions/useTableCellActions.js +5 -5
  152. package/lib/components/TableCellActions/useTableCellActions.js.map +1 -1
  153. package/lib/components/TableCellActions/useTableCellActionsStyles.js +12 -20
  154. package/lib/components/TableCellActions/useTableCellActionsStyles.js.map +1 -1
  155. package/lib/components/TableCellLayout/TableCellLayout.js +3 -3
  156. package/lib/components/TableCellLayout/TableCellLayout.js.map +1 -1
  157. package/lib/components/TableCellLayout/TableCellLayout.types.js.map +1 -1
  158. package/lib/components/TableCellLayout/index.js.map +1 -1
  159. package/lib/components/TableCellLayout/renderTableCellLayout.js +14 -7
  160. package/lib/components/TableCellLayout/renderTableCellLayout.js.map +1 -1
  161. package/lib/components/TableCellLayout/useTableCellLayout.js +14 -4
  162. package/lib/components/TableCellLayout/useTableCellLayout.js.map +1 -1
  163. package/lib/components/TableCellLayout/useTableCellLayoutContextValues.js +13 -0
  164. package/lib/components/TableCellLayout/useTableCellLayoutContextValues.js.map +1 -0
  165. package/lib/components/TableCellLayout/useTableCellLayoutStyles.js +41 -35
  166. package/lib/components/TableCellLayout/useTableCellLayoutStyles.js.map +1 -1
  167. package/lib/components/TableHeader/TableHeader.js +1 -2
  168. package/lib/components/TableHeader/TableHeader.js.map +1 -1
  169. package/lib/components/TableHeader/TableHeader.types.js.map +1 -1
  170. package/lib/components/TableHeader/index.js.map +1 -1
  171. package/lib/components/TableHeader/renderTableHeader.js +6 -3
  172. package/lib/components/TableHeader/renderTableHeader.js.map +1 -1
  173. package/lib/components/TableHeader/useTableHeader.js +3 -11
  174. package/lib/components/TableHeader/useTableHeader.js.map +1 -1
  175. package/lib/components/TableHeader/useTableHeaderStyles.js +16 -9
  176. package/lib/components/TableHeader/useTableHeaderStyles.js.map +1 -1
  177. package/lib/components/TableHeaderCell/TableHeaderCell.js +1 -2
  178. package/lib/components/TableHeaderCell/TableHeaderCell.js.map +1 -1
  179. package/lib/components/TableHeaderCell/TableHeaderCell.types.js.map +1 -1
  180. package/lib/components/TableHeaderCell/index.js.map +1 -1
  181. package/lib/components/TableHeaderCell/renderTableHeaderCell.js +6 -4
  182. package/lib/components/TableHeaderCell/renderTableHeaderCell.js.map +1 -1
  183. package/lib/components/TableHeaderCell/useTableHeaderCell.js +13 -9
  184. package/lib/components/TableHeaderCell/useTableHeaderCell.js.map +1 -1
  185. package/lib/components/TableHeaderCell/useTableHeaderCellStyles.js +83 -50
  186. package/lib/components/TableHeaderCell/useTableHeaderCellStyles.js.map +1 -1
  187. package/lib/components/TableRow/TableRow.js +1 -2
  188. package/lib/components/TableRow/TableRow.js.map +1 -1
  189. package/lib/components/TableRow/TableRow.types.js.map +1 -1
  190. package/lib/components/TableRow/index.js.map +1 -1
  191. package/lib/components/TableRow/renderTableRow.js +3 -4
  192. package/lib/components/TableRow/renderTableRow.js.map +1 -1
  193. package/lib/components/TableRow/useTableRow.js +12 -6
  194. package/lib/components/TableRow/useTableRow.js.map +1 -1
  195. package/lib/components/TableRow/useTableRowStyles.js +196 -28
  196. package/lib/components/TableRow/useTableRowStyles.js.map +1 -1
  197. package/lib/components/TableSelectionCell/TableSelectionCell.js +1 -2
  198. package/lib/components/TableSelectionCell/TableSelectionCell.js.map +1 -1
  199. package/lib/components/TableSelectionCell/TableSelectionCell.types.js.map +1 -1
  200. package/lib/components/TableSelectionCell/index.js.map +1 -1
  201. package/lib/components/TableSelectionCell/renderTableSelectionCell.js +6 -4
  202. package/lib/components/TableSelectionCell/renderTableSelectionCell.js.map +1 -1
  203. package/lib/components/TableSelectionCell/useTableSelectionCell.js +25 -12
  204. package/lib/components/TableSelectionCell/useTableSelectionCell.js.map +1 -1
  205. package/lib/components/TableSelectionCell/useTableSelectionCellStyles.js +59 -27
  206. package/lib/components/TableSelectionCell/useTableSelectionCellStyles.js.map +1 -1
  207. package/lib/contexts/columnIdContext.js +9 -0
  208. package/lib/contexts/columnIdContext.js.map +1 -0
  209. package/lib/contexts/dataGridContext.js +13 -0
  210. package/lib/contexts/dataGridContext.js.map +1 -0
  211. package/lib/contexts/rowIdContext.js +9 -0
  212. package/lib/contexts/rowIdContext.js.map +1 -0
  213. package/lib/contexts/tableContext.js +0 -1
  214. package/lib/contexts/tableContext.js.map +1 -1
  215. package/lib/contexts/tableHeaderContext.js +6 -0
  216. package/lib/contexts/tableHeaderContext.js.map +1 -0
  217. package/lib/hooks/createColumn.js +35 -0
  218. package/lib/hooks/createColumn.js.map +1 -0
  219. package/lib/hooks/index.js +4 -1
  220. package/lib/hooks/index.js.map +1 -1
  221. package/lib/hooks/selectionManager.js +16 -32
  222. package/lib/hooks/selectionManager.js.map +1 -1
  223. package/lib/hooks/types.js.map +1 -1
  224. package/lib/hooks/useTableFeatures.js +35 -0
  225. package/lib/hooks/useTableFeatures.js.map +1 -0
  226. package/lib/hooks/useTableSelection.js +74 -0
  227. package/lib/hooks/useTableSelection.js.map +1 -0
  228. package/lib/hooks/useTableSort.js +85 -0
  229. package/lib/hooks/useTableSort.js.map +1 -0
  230. package/lib/index.js +9 -1
  231. package/lib/index.js.map +1 -1
  232. package/lib-commonjs/DataGrid.js +8 -0
  233. package/lib-commonjs/DataGrid.js.map +1 -0
  234. package/lib-commonjs/DataGridBody.js +8 -0
  235. package/lib-commonjs/DataGridBody.js.map +1 -0
  236. package/lib-commonjs/DataGridCell.js +8 -0
  237. package/lib-commonjs/DataGridCell.js.map +1 -0
  238. package/lib-commonjs/DataGridHeader.js +8 -0
  239. package/lib-commonjs/DataGridHeader.js.map +1 -0
  240. package/lib-commonjs/DataGridHeaderCell.js +8 -0
  241. package/lib-commonjs/DataGridHeaderCell.js.map +1 -0
  242. package/lib-commonjs/DataGridRow.js +8 -0
  243. package/lib-commonjs/DataGridRow.js.map +1 -0
  244. package/lib-commonjs/DataGridSelectionCell.js +8 -0
  245. package/lib-commonjs/DataGridSelectionCell.js.map +1 -0
  246. package/lib-commonjs/Table.js +0 -2
  247. package/lib-commonjs/Table.js.map +1 -1
  248. package/lib-commonjs/TableBody.js +0 -2
  249. package/lib-commonjs/TableBody.js.map +1 -1
  250. package/lib-commonjs/TableCell.js +0 -2
  251. package/lib-commonjs/TableCell.js.map +1 -1
  252. package/lib-commonjs/TableCellActions.js +0 -2
  253. package/lib-commonjs/TableCellActions.js.map +1 -1
  254. package/lib-commonjs/TableCellLayout.js +0 -2
  255. package/lib-commonjs/TableCellLayout.js.map +1 -1
  256. package/lib-commonjs/TableCellPrimaryLayout.js +0 -2
  257. package/lib-commonjs/TableCellPrimaryLayout.js.map +1 -1
  258. package/lib-commonjs/TableHeader.js +0 -2
  259. package/lib-commonjs/TableHeader.js.map +1 -1
  260. package/lib-commonjs/TableHeaderCell.js +0 -2
  261. package/lib-commonjs/TableHeaderCell.js.map +1 -1
  262. package/lib-commonjs/TableRow.js +0 -2
  263. package/lib-commonjs/TableRow.js.map +1 -1
  264. package/lib-commonjs/TableSelectionCell.js +0 -2
  265. package/lib-commonjs/TableSelectionCell.js.map +1 -1
  266. package/lib-commonjs/components/DataGrid/DataGrid.js +21 -0
  267. package/lib-commonjs/components/DataGrid/DataGrid.js.map +1 -0
  268. package/lib-commonjs/components/DataGrid/DataGrid.types.js +6 -0
  269. package/lib-commonjs/components/DataGrid/DataGrid.types.js.map +1 -0
  270. package/lib-commonjs/components/DataGrid/index.js +12 -0
  271. package/lib-commonjs/components/DataGrid/index.js.map +1 -0
  272. package/lib-commonjs/components/DataGrid/renderDataGrid.js +19 -0
  273. package/lib-commonjs/components/DataGrid/renderDataGrid.js.map +1 -0
  274. package/lib-commonjs/components/DataGrid/useDataGrid.js +70 -0
  275. package/lib-commonjs/components/DataGrid/useDataGrid.js.map +1 -0
  276. package/lib-commonjs/components/DataGrid/useDataGridContextValues.js +22 -0
  277. package/lib-commonjs/components/DataGrid/useDataGridContextValues.js.map +1 -0
  278. package/lib-commonjs/components/DataGrid/useDataGridStyles.js +21 -0
  279. package/lib-commonjs/components/DataGrid/useDataGridStyles.js.map +1 -0
  280. package/lib-commonjs/components/DataGridBody/DataGridBody.js +20 -0
  281. package/lib-commonjs/components/DataGridBody/DataGridBody.js.map +1 -0
  282. package/lib-commonjs/components/DataGridBody/DataGridBody.types.js +6 -0
  283. package/lib-commonjs/components/DataGridBody/DataGridBody.types.js.map +1 -0
  284. package/lib-commonjs/components/DataGridBody/index.js +12 -0
  285. package/lib-commonjs/components/DataGridBody/index.js.map +1 -0
  286. package/lib-commonjs/components/DataGridBody/renderDataGridBody.js +26 -0
  287. package/lib-commonjs/components/DataGridBody/renderDataGridBody.js.map +1 -0
  288. package/lib-commonjs/components/DataGridBody/useDataGridBody.js +38 -0
  289. package/lib-commonjs/components/DataGridBody/useDataGridBody.js.map +1 -0
  290. package/lib-commonjs/components/DataGridBody/useDataGridBodyStyles.js +21 -0
  291. package/lib-commonjs/components/DataGridBody/useDataGridBodyStyles.js.map +1 -0
  292. package/lib-commonjs/components/DataGridCell/DataGridCell.js +20 -0
  293. package/lib-commonjs/components/DataGridCell/DataGridCell.js.map +1 -0
  294. package/lib-commonjs/components/DataGridCell/DataGridCell.types.js +6 -0
  295. package/lib-commonjs/components/DataGridCell/DataGridCell.types.js.map +1 -0
  296. package/lib-commonjs/components/DataGridCell/index.js +12 -0
  297. package/lib-commonjs/components/DataGridCell/index.js.map +1 -0
  298. package/lib-commonjs/components/DataGridCell/renderDataGridCell.js +15 -0
  299. package/lib-commonjs/components/DataGridCell/renderDataGridCell.js.map +1 -0
  300. package/lib-commonjs/components/DataGridCell/useDataGridCell.js +28 -0
  301. package/lib-commonjs/components/DataGridCell/useDataGridCell.js.map +1 -0
  302. package/lib-commonjs/components/DataGridCell/useDataGridCellStyles.js +21 -0
  303. package/lib-commonjs/components/DataGridCell/useDataGridCellStyles.js.map +1 -0
  304. package/lib-commonjs/components/DataGridHeader/DataGridHeader.js +20 -0
  305. package/lib-commonjs/components/DataGridHeader/DataGridHeader.js.map +1 -0
  306. package/lib-commonjs/components/DataGridHeader/DataGridHeader.types.js +6 -0
  307. package/lib-commonjs/components/DataGridHeader/DataGridHeader.types.js.map +1 -0
  308. package/lib-commonjs/components/DataGridHeader/index.js +12 -0
  309. package/lib-commonjs/components/DataGridHeader/index.js.map +1 -0
  310. package/lib-commonjs/components/DataGridHeader/renderDataGridHeader.js +15 -0
  311. package/lib-commonjs/components/DataGridHeader/renderDataGridHeader.js.map +1 -0
  312. package/lib-commonjs/components/DataGridHeader/useDataGridHeader.js +24 -0
  313. package/lib-commonjs/components/DataGridHeader/useDataGridHeader.js.map +1 -0
  314. package/lib-commonjs/components/DataGridHeader/useDataGridHeaderStyles.js +21 -0
  315. package/lib-commonjs/components/DataGridHeader/useDataGridHeaderStyles.js.map +1 -0
  316. package/lib-commonjs/components/DataGridHeaderCell/DataGridHeaderCell.js +20 -0
  317. package/lib-commonjs/components/DataGridHeaderCell/DataGridHeaderCell.js.map +1 -0
  318. package/lib-commonjs/components/DataGridHeaderCell/DataGridHeaderCell.types.js +6 -0
  319. package/lib-commonjs/components/DataGridHeaderCell/DataGridHeaderCell.types.js.map +1 -0
  320. package/lib-commonjs/components/DataGridHeaderCell/index.js +12 -0
  321. package/lib-commonjs/components/DataGridHeaderCell/index.js.map +1 -0
  322. package/lib-commonjs/components/DataGridHeaderCell/renderDataGridHeaderCell.js +15 -0
  323. package/lib-commonjs/components/DataGridHeaderCell/renderDataGridHeaderCell.js.map +1 -0
  324. package/lib-commonjs/components/DataGridHeaderCell/useDataGridHeaderCell.js +44 -0
  325. package/lib-commonjs/components/DataGridHeaderCell/useDataGridHeaderCell.js.map +1 -0
  326. package/lib-commonjs/components/DataGridHeaderCell/useDataGridHeaderCellStyles.js +29 -0
  327. package/lib-commonjs/components/DataGridHeaderCell/useDataGridHeaderCellStyles.js.map +1 -0
  328. package/lib-commonjs/components/DataGridRow/DataGridRow.js +20 -0
  329. package/lib-commonjs/components/DataGridRow/DataGridRow.js.map +1 -0
  330. package/lib-commonjs/components/DataGridRow/DataGridRow.types.js +6 -0
  331. package/lib-commonjs/components/DataGridRow/DataGridRow.types.js.map +1 -0
  332. package/lib-commonjs/components/DataGridRow/index.js +12 -0
  333. package/lib-commonjs/components/DataGridRow/index.js.map +1 -0
  334. package/lib-commonjs/components/DataGridRow/renderDataGridRow.js +28 -0
  335. package/lib-commonjs/components/DataGridRow/renderDataGridRow.js.map +1 -0
  336. package/lib-commonjs/components/DataGridRow/useDataGridRow.js +77 -0
  337. package/lib-commonjs/components/DataGridRow/useDataGridRow.js.map +1 -0
  338. package/lib-commonjs/components/DataGridRow/useDataGridRowStyles.js +25 -0
  339. package/lib-commonjs/components/DataGridRow/useDataGridRowStyles.js.map +1 -0
  340. package/lib-commonjs/components/DataGridSelectionCell/DataGridSelectionCell.js +20 -0
  341. package/lib-commonjs/components/DataGridSelectionCell/DataGridSelectionCell.js.map +1 -0
  342. package/lib-commonjs/components/DataGridSelectionCell/DataGridSelectionCell.types.js +6 -0
  343. package/lib-commonjs/components/DataGridSelectionCell/DataGridSelectionCell.types.js.map +1 -0
  344. package/lib-commonjs/components/DataGridSelectionCell/index.js +12 -0
  345. package/lib-commonjs/components/DataGridSelectionCell/index.js.map +1 -0
  346. package/lib-commonjs/components/DataGridSelectionCell/renderDataGridSelectionCell.js +15 -0
  347. package/lib-commonjs/components/DataGridSelectionCell/renderDataGridSelectionCell.js.map +1 -0
  348. package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCell.js +54 -0
  349. package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCell.js.map +1 -0
  350. package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCellStyles.js +29 -0
  351. package/lib-commonjs/components/DataGridSelectionCell/useDataGridSelectionCellStyles.js.map +1 -0
  352. package/lib-commonjs/components/Table/Table.js +1 -8
  353. package/lib-commonjs/components/Table/Table.js.map +1 -1
  354. package/lib-commonjs/components/Table/Table.types.js.map +1 -1
  355. package/lib-commonjs/components/Table/index.js +0 -6
  356. package/lib-commonjs/components/Table/index.js.map +1 -1
  357. package/lib-commonjs/components/Table/renderTable.js +2 -7
  358. package/lib-commonjs/components/Table/renderTable.js.map +1 -1
  359. package/lib-commonjs/components/Table/useTable.js +0 -5
  360. package/lib-commonjs/components/Table/useTable.js.map +1 -1
  361. package/lib-commonjs/components/Table/useTableContextValues.js +0 -3
  362. package/lib-commonjs/components/Table/useTableContextValues.js.map +1 -1
  363. package/lib-commonjs/components/Table/useTableStyles.js +26 -15
  364. package/lib-commonjs/components/Table/useTableStyles.js.map +1 -1
  365. package/lib-commonjs/components/TableBody/TableBody.js +1 -7
  366. package/lib-commonjs/components/TableBody/TableBody.js.map +1 -1
  367. package/lib-commonjs/components/TableBody/TableBody.types.js.map +1 -1
  368. package/lib-commonjs/components/TableBody/index.js +0 -6
  369. package/lib-commonjs/components/TableBody/index.js.map +1 -1
  370. package/lib-commonjs/components/TableBody/renderTableBody.js +3 -8
  371. package/lib-commonjs/components/TableBody/renderTableBody.js.map +1 -1
  372. package/lib-commonjs/components/TableBody/useTableBody.js +2 -7
  373. package/lib-commonjs/components/TableBody/useTableBody.js.map +1 -1
  374. package/lib-commonjs/components/TableBody/useTableBodyStyles.js +16 -11
  375. package/lib-commonjs/components/TableBody/useTableBodyStyles.js.map +1 -1
  376. package/lib-commonjs/components/TableCell/TableCell.js +1 -7
  377. package/lib-commonjs/components/TableCell/TableCell.js.map +1 -1
  378. package/lib-commonjs/components/TableCell/TableCell.types.js.map +1 -1
  379. package/lib-commonjs/components/TableCell/index.js +0 -6
  380. package/lib-commonjs/components/TableCell/index.js.map +1 -1
  381. package/lib-commonjs/components/TableCell/renderTableCell.js +2 -6
  382. package/lib-commonjs/components/TableCell/renderTableCell.js.map +1 -1
  383. package/lib-commonjs/components/TableCell/useTableCell.js +5 -8
  384. package/lib-commonjs/components/TableCell/useTableCell.js.map +1 -1
  385. package/lib-commonjs/components/TableCell/useTableCellStyles.js +58 -17
  386. package/lib-commonjs/components/TableCell/useTableCellStyles.js.map +1 -1
  387. package/lib-commonjs/components/TableCellActions/TableCellActions.js +1 -7
  388. package/lib-commonjs/components/TableCellActions/TableCellActions.js.map +1 -1
  389. package/lib-commonjs/components/TableCellActions/TableCellActions.types.js.map +1 -1
  390. package/lib-commonjs/components/TableCellActions/index.js +0 -6
  391. package/lib-commonjs/components/TableCellActions/index.js.map +1 -1
  392. package/lib-commonjs/components/TableCellActions/renderTableCellActions.js +3 -8
  393. package/lib-commonjs/components/TableCellActions/renderTableCellActions.js.map +1 -1
  394. package/lib-commonjs/components/TableCellActions/useTableCellActions.js +4 -8
  395. package/lib-commonjs/components/TableCellActions/useTableCellActions.js.map +1 -1
  396. package/lib-commonjs/components/TableCellActions/useTableCellActionsStyles.js +12 -25
  397. package/lib-commonjs/components/TableCellActions/useTableCellActionsStyles.js.map +1 -1
  398. package/lib-commonjs/components/TableCellLayout/TableCellLayout.js +3 -8
  399. package/lib-commonjs/components/TableCellLayout/TableCellLayout.js.map +1 -1
  400. package/lib-commonjs/components/TableCellLayout/TableCellLayout.types.js.map +1 -1
  401. package/lib-commonjs/components/TableCellLayout/index.js +0 -6
  402. package/lib-commonjs/components/TableCellLayout/index.js.map +1 -1
  403. package/lib-commonjs/components/TableCellLayout/renderTableCellLayout.js +14 -11
  404. package/lib-commonjs/components/TableCellLayout/renderTableCellLayout.js.map +1 -1
  405. package/lib-commonjs/components/TableCellLayout/useTableCellLayout.js +14 -7
  406. package/lib-commonjs/components/TableCellLayout/useTableCellLayout.js.map +1 -1
  407. package/lib-commonjs/components/TableCellLayout/useTableCellLayoutContextValues.js +20 -0
  408. package/lib-commonjs/components/TableCellLayout/useTableCellLayoutContextValues.js.map +1 -0
  409. package/lib-commonjs/components/TableCellLayout/useTableCellLayoutStyles.js +41 -39
  410. package/lib-commonjs/components/TableCellLayout/useTableCellLayoutStyles.js.map +1 -1
  411. package/lib-commonjs/components/TableHeader/TableHeader.js +1 -7
  412. package/lib-commonjs/components/TableHeader/TableHeader.js.map +1 -1
  413. package/lib-commonjs/components/TableHeader/TableHeader.types.js.map +1 -1
  414. package/lib-commonjs/components/TableHeader/index.js +0 -6
  415. package/lib-commonjs/components/TableHeader/index.js.map +1 -1
  416. package/lib-commonjs/components/TableHeader/renderTableHeader.js +6 -7
  417. package/lib-commonjs/components/TableHeader/renderTableHeader.js.map +1 -1
  418. package/lib-commonjs/components/TableHeader/useTableHeader.js +3 -16
  419. package/lib-commonjs/components/TableHeader/useTableHeader.js.map +1 -1
  420. package/lib-commonjs/components/TableHeader/useTableHeaderStyles.js +16 -12
  421. package/lib-commonjs/components/TableHeader/useTableHeaderStyles.js.map +1 -1
  422. package/lib-commonjs/components/TableHeaderCell/TableHeaderCell.js +1 -7
  423. package/lib-commonjs/components/TableHeaderCell/TableHeaderCell.js.map +1 -1
  424. package/lib-commonjs/components/TableHeaderCell/TableHeaderCell.types.js.map +1 -1
  425. package/lib-commonjs/components/TableHeaderCell/index.js +0 -6
  426. package/lib-commonjs/components/TableHeaderCell/index.js.map +1 -1
  427. package/lib-commonjs/components/TableHeaderCell/renderTableHeaderCell.js +6 -8
  428. package/lib-commonjs/components/TableHeaderCell/renderTableHeaderCell.js.map +1 -1
  429. package/lib-commonjs/components/TableHeaderCell/useTableHeaderCell.js +12 -15
  430. package/lib-commonjs/components/TableHeaderCell/useTableHeaderCell.js.map +1 -1
  431. package/lib-commonjs/components/TableHeaderCell/useTableHeaderCellStyles.js +83 -54
  432. package/lib-commonjs/components/TableHeaderCell/useTableHeaderCellStyles.js.map +1 -1
  433. package/lib-commonjs/components/TableRow/TableRow.js +1 -7
  434. package/lib-commonjs/components/TableRow/TableRow.js.map +1 -1
  435. package/lib-commonjs/components/TableRow/TableRow.types.js.map +1 -1
  436. package/lib-commonjs/components/TableRow/index.js +0 -6
  437. package/lib-commonjs/components/TableRow/index.js.map +1 -1
  438. package/lib-commonjs/components/TableRow/renderTableRow.js +3 -8
  439. package/lib-commonjs/components/TableRow/renderTableRow.js.map +1 -1
  440. package/lib-commonjs/components/TableRow/useTableRow.js +11 -9
  441. package/lib-commonjs/components/TableRow/useTableRow.js.map +1 -1
  442. package/lib-commonjs/components/TableRow/useTableRowStyles.js +196 -33
  443. package/lib-commonjs/components/TableRow/useTableRowStyles.js.map +1 -1
  444. package/lib-commonjs/components/TableSelectionCell/TableSelectionCell.js +1 -7
  445. package/lib-commonjs/components/TableSelectionCell/TableSelectionCell.js.map +1 -1
  446. package/lib-commonjs/components/TableSelectionCell/TableSelectionCell.types.js.map +1 -1
  447. package/lib-commonjs/components/TableSelectionCell/index.js +0 -6
  448. package/lib-commonjs/components/TableSelectionCell/index.js.map +1 -1
  449. package/lib-commonjs/components/TableSelectionCell/renderTableSelectionCell.js +6 -8
  450. package/lib-commonjs/components/TableSelectionCell/renderTableSelectionCell.js.map +1 -1
  451. package/lib-commonjs/components/TableSelectionCell/useTableSelectionCell.js +24 -18
  452. package/lib-commonjs/components/TableSelectionCell/useTableSelectionCell.js.map +1 -1
  453. package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.js +59 -30
  454. package/lib-commonjs/components/TableSelectionCell/useTableSelectionCellStyles.js.map +1 -1
  455. package/lib-commonjs/contexts/columnIdContext.js +16 -0
  456. package/lib-commonjs/contexts/columnIdContext.js.map +1 -0
  457. package/lib-commonjs/contexts/dataGridContext.js +20 -0
  458. package/lib-commonjs/contexts/dataGridContext.js.map +1 -0
  459. package/lib-commonjs/contexts/rowIdContext.js +16 -0
  460. package/lib-commonjs/contexts/rowIdContext.js.map +1 -0
  461. package/lib-commonjs/contexts/tableContext.js +0 -5
  462. package/lib-commonjs/contexts/tableContext.js.map +1 -1
  463. package/lib-commonjs/contexts/tableHeaderContext.js +13 -0
  464. package/lib-commonjs/contexts/tableHeaderContext.js.map +1 -0
  465. package/lib-commonjs/hooks/createColumn.js +42 -0
  466. package/lib-commonjs/hooks/createColumn.js.map +1 -0
  467. package/lib-commonjs/hooks/index.js +4 -4
  468. package/lib-commonjs/hooks/index.js.map +1 -1
  469. package/lib-commonjs/hooks/selectionManager.js +16 -34
  470. package/lib-commonjs/hooks/selectionManager.js.map +1 -1
  471. package/lib-commonjs/hooks/types.js.map +1 -1
  472. package/lib-commonjs/hooks/useTableFeatures.js +42 -0
  473. package/lib-commonjs/hooks/useTableFeatures.js.map +1 -0
  474. package/lib-commonjs/hooks/useTableSelection.js +82 -0
  475. package/lib-commonjs/hooks/useTableSelection.js.map +1 -0
  476. package/lib-commonjs/hooks/useTableSort.js +93 -0
  477. package/lib-commonjs/hooks/useTableSort.js.map +1 -0
  478. package/lib-commonjs/index.js +252 -26
  479. package/lib-commonjs/index.js.map +1 -1
  480. package/package.json +30 -17
  481. package/lib/hooks/useSelection.js +0 -47
  482. package/lib/hooks/useSelection.js.map +0 -1
  483. package/lib/hooks/useSort.js +0 -72
  484. package/lib/hooks/useSort.js.map +0 -1
  485. package/lib/hooks/useTable.js +0 -87
  486. package/lib/hooks/useTable.js.map +0 -1
  487. package/lib/navigationModes/cell.js +0 -250
  488. package/lib/navigationModes/cell.js.map +0 -1
  489. package/lib/navigationModes/composite.js +0 -208
  490. package/lib/navigationModes/composite.js.map +0 -1
  491. package/lib/navigationModes/index.js +0 -3
  492. package/lib/navigationModes/index.js.map +0 -1
  493. package/lib/navigationModes/useNavigationMode.js +0 -42
  494. package/lib/navigationModes/useNavigationMode.js.map +0 -1
  495. package/lib-commonjs/hooks/useSelection.js +0 -59
  496. package/lib-commonjs/hooks/useSelection.js.map +0 -1
  497. package/lib-commonjs/hooks/useSort.js +0 -82
  498. package/lib-commonjs/hooks/useSort.js.map +0 -1
  499. package/lib-commonjs/hooks/useTable.js +0 -99
  500. package/lib-commonjs/hooks/useTable.js.map +0 -1
  501. package/lib-commonjs/navigationModes/cell.js +0 -259
  502. package/lib-commonjs/navigationModes/cell.js.map +0 -1
  503. package/lib-commonjs/navigationModes/composite.js +0 -217
  504. package/lib-commonjs/navigationModes/composite.js.map +0 -1
  505. package/lib-commonjs/navigationModes/index.js +0 -16
  506. package/lib-commonjs/navigationModes/index.js.map +0 -1
  507. package/lib-commonjs/navigationModes/useNavigationMode.js +0 -55
  508. package/lib-commonjs/navigationModes/useNavigationMode.js.map +0 -1
@@ -1,259 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.applyCellNavigation = void 0;
7
-
8
- function applyCellNavigation(element) {
9
- const container = element;
10
- let column = 0;
11
- let mode = undefined;
12
- let movingOut = false;
13
- const pre = document.createElement('div');
14
- const post = document.createElement('div');
15
-
16
- if (!pre || !post) {
17
- return;
18
- }
19
-
20
- pre.tabIndex = 0;
21
- post.tabIndex = 0;
22
- pre.addEventListener('focus', () => {
23
- if (movingOut) {
24
- movingOut = false;
25
- return;
26
- } else {
27
- treeWalker.currentNode = container;
28
- const candidate = treeWalker.nextNode();
29
-
30
- if (isHTMLElement(candidate)) {
31
- column = 0;
32
- candidate.focus();
33
- }
34
- }
35
- });
36
- post.addEventListener('focus', () => {
37
- if (movingOut) {
38
- movingOut = false;
39
- return;
40
- } else {
41
- treeWalker.currentNode = post;
42
- const candidate = treeWalker.previousNode();
43
-
44
- if (isHTMLElement(candidate)) {
45
- column = findColumnCount(candidate);
46
- candidate.focus();
47
- }
48
- }
49
- });
50
- container.before(pre);
51
- container.after(post);
52
-
53
- const acceptNode = node => {
54
- if (!isHTMLElement(node)) {
55
- return NodeFilter.FILTER_SKIP;
56
- }
57
-
58
- if (mode === 'column') {
59
- return acceptCell(node);
60
- }
61
-
62
- if (mode === 'row') {
63
- return acceptRow(node);
64
- }
65
-
66
- if (node.tabIndex >= 0) {
67
- return NodeFilter.FILTER_ACCEPT;
68
- }
69
-
70
- return NodeFilter.FILTER_SKIP;
71
- };
72
-
73
- const acceptCell = node => {
74
- if (isRow(node)) {
75
- return NodeFilter.FILTER_REJECT;
76
- }
77
-
78
- if (node.tabIndex < 0) {
79
- return NodeFilter.FILTER_SKIP;
80
- }
81
-
82
- return NodeFilter.FILTER_ACCEPT;
83
- };
84
-
85
- const acceptRow = node => {
86
- if (isRow(node)) {
87
- return NodeFilter.FILTER_ACCEPT;
88
- }
89
-
90
- return NodeFilter.FILTER_SKIP;
91
- };
92
-
93
- const treeWalker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
94
- acceptNode
95
- });
96
-
97
- const up = current => {
98
- mode = 'row';
99
- treeWalker.currentNode = current;
100
- treeWalker.previousNode(); // current row
101
-
102
- const row = treeWalker.previousNode();
103
-
104
- if (!row) {
105
- return null;
106
- }
107
-
108
- mode = 'column';
109
- treeWalker.currentNode = row;
110
- let curCol = 0;
111
- let node = null;
112
-
113
- while (curCol <= column) {
114
- node = treeWalker.nextNode();
115
- curCol++;
116
- }
117
-
118
- if (isHTMLElement(node)) {
119
- return node;
120
- }
121
-
122
- return null;
123
- };
124
-
125
- const down = current => {
126
- mode = 'row';
127
- treeWalker.currentNode = current;
128
- const row = treeWalker.nextNode();
129
-
130
- if (!row) {
131
- return null;
132
- }
133
-
134
- mode = 'column';
135
- treeWalker.currentNode = row;
136
- let curCol = 0;
137
- let node = null;
138
-
139
- while (curCol <= column) {
140
- node = treeWalker.nextNode();
141
- curCol++;
142
- }
143
-
144
- if (isHTMLElement(node)) {
145
- return node;
146
- }
147
-
148
- return null;
149
- };
150
-
151
- const left = current => {
152
- treeWalker.currentNode = current;
153
- mode = 'column';
154
- const node = treeWalker.previousNode();
155
-
156
- if (isHTMLElement(node)) {
157
- column--;
158
- return node;
159
- }
160
-
161
- return null;
162
- };
163
-
164
- const right = current => {
165
- mode = 'column';
166
- treeWalker.currentNode = current;
167
- const node = treeWalker.nextNode();
168
-
169
- if (isHTMLElement(node)) {
170
- column++;
171
- return node;
172
- }
173
-
174
- return null;
175
- };
176
-
177
- const onKeyDown = e => {
178
- const target = e.target;
179
-
180
- if (!target || !isHTMLElement(target)) {
181
- return;
182
- }
183
-
184
- let next = null;
185
-
186
- switch (e.key) {
187
- case 'ArrowDown':
188
- next = down(target);
189
- break;
190
-
191
- case 'ArrowUp':
192
- next = up(target);
193
- break;
194
-
195
- case 'ArrowLeft':
196
- next = left(target);
197
- break;
198
-
199
- case 'ArrowRight':
200
- next = right(target);
201
- break;
202
-
203
- case 'Tab':
204
- movingOut = true;
205
-
206
- if (e.shiftKey) {
207
- pre.focus();
208
- } else {
209
- post.focus();
210
- }
211
-
212
- break;
213
-
214
- default:
215
- return;
216
- }
217
-
218
- if (next) {
219
- e.preventDefault();
220
- next.focus();
221
- }
222
- };
223
-
224
- const onFocusOut = () => {
225
- mode = undefined;
226
- };
227
-
228
- container.addEventListener('keydown', onKeyDown);
229
- container.addEventListener('focusout', onFocusOut);
230
- return () => {
231
- container.removeEventListener('focusout', onFocusOut);
232
- container.removeEventListener('keydown', onKeyDown);
233
- };
234
- }
235
-
236
- exports.applyCellNavigation = applyCellNavigation;
237
-
238
- function isHTMLElement(node) {
239
- return node instanceof HTMLElement;
240
- }
241
-
242
- function isRow(element) {
243
- if (element.getAttribute('role') === 'row' || element.tagName === 'TR') {
244
- return true;
245
- }
246
-
247
- return false;
248
- }
249
-
250
- function findColumnCount(node) {
251
- let cur = node;
252
-
253
- while (cur.parentElement && !isRow(cur)) {
254
- cur = cur.parentElement;
255
- }
256
-
257
- return cur.querySelectorAll('[role="cell"], [role="gridcell"], td').length - 1;
258
- }
259
- //# sourceMappingURL=cell.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["navigationModes/cell.ts"],"names":[],"mappings":";;;;;;;AAAA,SAAgB,mBAAhB,CAAoC,OAApC,EAAwD;EACtD,MAAM,SAAS,GAAG,OAAlB;EACA,IAAI,MAAM,GAAG,CAAb;EACA,IAAI,IAAI,GAAiC,SAAzC;EACA,IAAI,SAAS,GAAG,KAAhB;EAEA,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAT,CAAuB,KAAvB,CAAZ;EACA,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAT,CAAuB,KAAvB,CAAb;;EAEA,IAAI,CAAC,GAAD,IAAQ,CAAC,IAAb,EAAmB;IACjB;EACD;;EAED,GAAG,CAAC,QAAJ,GAAe,CAAf;EACA,IAAI,CAAC,QAAL,GAAgB,CAAhB;EAEA,GAAG,CAAC,gBAAJ,CAAqB,OAArB,EAA8B,MAAK;IACjC,IAAI,SAAJ,EAAe;MACb,SAAS,GAAG,KAAZ;MACA;IACD,CAHD,MAGO;MACL,UAAU,CAAC,WAAX,GAAyB,SAAzB;MACA,MAAM,SAAS,GAAG,UAAU,CAAC,QAAX,EAAlB;;MACA,IAAI,aAAa,CAAC,SAAD,CAAjB,EAA8B;QAC5B,MAAM,GAAG,CAAT;QACA,SAAS,CAAC,KAAV;MACD;IACF;EACF,CAZD;EAcA,IAAI,CAAC,gBAAL,CAAsB,OAAtB,EAA+B,MAAK;IAClC,IAAI,SA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gBAAV,CAA2B,SAA3B,EAAsC,SAAtC;EACA,SAAS,CAAC,gBAAV,CAA2B,UAA3B,EAAuC,UAAvC;EACA,OAAO,MAAK;IACV,SAAS,CAAC,mBAAV,CAA8B,UAA9B,EAA0C,UAA1C;IACA,SAAS,CAAC,mBAAV,CAA8B,SAA9B,EAAyC,SAAzC;EACD,CAHD;AAID;;AA/MD,OAAA,CAAA,mBAAA,GAAA,mBAAA;;AAiNA,SAAS,aAAT,CAAuB,IAAvB,EAAoC;EAClC,OAAO,IAAI,YAAY,WAAvB;AACD;;AAED,SAAS,KAAT,CAAe,OAAf,EAAmC;EACjC,IAAI,OAAO,CAAC,YAAR,CAAqB,MAArB,MAAiC,KAAjC,IAA0C,OAAO,CAAC,OAAR,KAAoB,IAAlE,EAAwE;IACtE,OAAO,IAAP;EACD;;EAED,OAAO,KAAP;AACD;;AAED,SAAS,eAAT,CAAyB,IAAzB,EAA0C;EACxC,IAAI,GAAG,GAAG,IAAV;;EACA,OAAO,GAAG,CAAC,aAAJ,IAAqB,CAAC,KAAK,CAAC,GAAD,CAAlC,EAAyC;IACvC,GAAG,GAAG,GAAG,CAAC,aAAV;EACD;;EAED,OAAO,GAAG,CAAC,gBAAJ,CAAqB,sCAArB,EAA6D,MAA7D,GAAsE,CAA7E;AACD","sourcesContent":["export function applyCellNavigation(element: HTMLElement) {\n const container = element;\n let column = 0;\n let mode: 'row' | 'column' | undefined = undefined;\n let movingOut = false;\n\n const pre = document.createElement('div');\n const post = document.createElement('div');\n\n if (!pre || !post) {\n return;\n }\n\n pre.tabIndex = 0;\n post.tabIndex = 0;\n\n pre.addEventListener('focus', () => {\n if (movingOut) {\n movingOut = false;\n return;\n } else {\n treeWalker.currentNode = container;\n const candidate = treeWalker.nextNode();\n if (isHTMLElement(candidate)) {\n column = 0;\n candidate.focus();\n }\n }\n });\n\n post.addEventListener('focus', () => {\n if (movingOut) {\n movingOut = false;\n return;\n } else {\n treeWalker.currentNode = post;\n const candidate = treeWalker.previousNode();\n if (isHTMLElement(candidate)) {\n column = findColumnCount(candidate);\n candidate.focus();\n }\n }\n });\n\n container.before(pre);\n container.after(post);\n\n const acceptNode = (node: Node) => {\n if (!isHTMLElement(node)) {\n return NodeFilter.FILTER_SKIP;\n }\n\n if (mode === 'column') {\n return acceptCell(node);\n }\n\n if (mode === 'row') {\n return acceptRow(node);\n }\n\n if (node.tabIndex >= 0) {\n return NodeFilter.FILTER_ACCEPT;\n }\n\n return NodeFilter.FILTER_SKIP;\n };\n\n const acceptCell = (node: HTMLElement) => {\n if (isRow(node)) {\n return NodeFilter.FILTER_REJECT;\n }\n\n if (node.tabIndex < 0) {\n return NodeFilter.FILTER_SKIP;\n }\n\n return NodeFilter.FILTER_ACCEPT;\n };\n\n const acceptRow = (node: HTMLElement) => {\n if (isRow(node)) {\n return NodeFilter.FILTER_ACCEPT;\n }\n\n return NodeFilter.FILTER_SKIP;\n };\n\n const treeWalker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, { acceptNode });\n\n const up = (current: HTMLElement) => {\n mode = 'row';\n treeWalker.currentNode = current;\n treeWalker.previousNode(); // current row\n const row = treeWalker.previousNode();\n if (!row) {\n return null;\n }\n\n mode = 'column';\n treeWalker.currentNode = row;\n let curCol = 0;\n let node: Node | null = null;\n while (curCol <= column) {\n node = treeWalker.nextNode();\n curCol++;\n }\n if (isHTMLElement(node)) {\n return node;\n }\n return null;\n };\n\n const down = (current: HTMLElement) => {\n mode = 'row';\n treeWalker.currentNode = current;\n const row = treeWalker.nextNode();\n if (!row) {\n return null;\n }\n\n mode = 'column';\n treeWalker.currentNode = row;\n let curCol = 0;\n let node: Node | null = null;\n while (curCol <= column) {\n node = treeWalker.nextNode();\n curCol++;\n }\n if (isHTMLElement(node)) {\n return node;\n }\n return null;\n };\n\n const left = (current: HTMLElement) => {\n treeWalker.currentNode = current;\n mode = 'column';\n const node = treeWalker.previousNode();\n\n if (isHTMLElement(node)) {\n column--;\n return node;\n }\n return null;\n };\n\n const right = (current: HTMLElement) => {\n mode = 'column';\n treeWalker.currentNode = current;\n const node = treeWalker.nextNode();\n if (isHTMLElement(node)) {\n column++;\n return node;\n }\n return null;\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n const target = e.target;\n if (!target || !isHTMLElement(target)) {\n return;\n }\n\n let next: HTMLElement | null = null;\n\n switch (e.key) {\n case 'ArrowDown':\n next = down(target);\n break;\n case 'ArrowUp':\n next = up(target);\n break;\n case 'ArrowLeft':\n next = left(target);\n break;\n case 'ArrowRight':\n next = right(target);\n break;\n case 'Tab':\n movingOut = true;\n if (e.shiftKey) {\n pre.focus();\n } else {\n post.focus();\n }\n\n break;\n default:\n return;\n }\n\n if (next) {\n e.preventDefault();\n next.focus();\n }\n };\n\n const onFocusOut = () => {\n mode = undefined;\n };\n\n container.addEventListener('keydown', onKeyDown);\n container.addEventListener('focusout', onFocusOut);\n return () => {\n container.removeEventListener('focusout', onFocusOut);\n container.removeEventListener('keydown', onKeyDown);\n };\n}\n\nfunction isHTMLElement(node: unknown): node is HTMLElement {\n return node instanceof HTMLElement;\n}\n\nfunction isRow(element: HTMLElement) {\n if (element.getAttribute('role') === 'row' || element.tagName === 'TR') {\n return true;\n }\n\n return false;\n}\n\nfunction findColumnCount(node: HTMLElement) {\n let cur = node;\n while (cur.parentElement && !isRow(cur)) {\n cur = cur.parentElement;\n }\n\n return cur.querySelectorAll('[role=\"cell\"], [role=\"gridcell\"], td').length - 1;\n}\n"],"sourceRoot":"../src/"}
@@ -1,217 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.applyCompositeNavigation = void 0;
7
-
8
- function applyCompositeNavigation(element) {
9
- const container = element;
10
- let mode = 'row';
11
- let movingOut = false;
12
- const pre = document.createElement('div');
13
- const post = document.createElement('div');
14
-
15
- if (!pre || !post) {
16
- return;
17
- }
18
-
19
- pre.tabIndex = 0;
20
- post.tabIndex = 0;
21
- pre.addEventListener('focus', () => {
22
- if (movingOut) {
23
- movingOut = false;
24
- return;
25
- } else {
26
- treeWalker.currentNode = container;
27
- mode = 'row';
28
- const candidate = treeWalker.nextNode();
29
-
30
- if (isHTMLElement(candidate)) {
31
- candidate.focus();
32
- }
33
- }
34
- });
35
- post.addEventListener('focus', () => {
36
- if (movingOut) {
37
- movingOut = false;
38
- return;
39
- } else {
40
- treeWalker.currentNode = post;
41
- mode = 'row';
42
- const candidate = treeWalker.previousNode();
43
-
44
- if (isHTMLElement(candidate)) {
45
- candidate.focus();
46
- }
47
- }
48
- });
49
- container.before(pre);
50
- container.after(post);
51
-
52
- const acceptNode = node => {
53
- if (!isHTMLElement(node)) {
54
- return NodeFilter.FILTER_SKIP;
55
- }
56
-
57
- if (!isCell(node) && !isRow(node)) {
58
- return NodeFilter.FILTER_SKIP;
59
- }
60
-
61
- if (mode === 'column' && isRow(node)) {
62
- return NodeFilter.FILTER_REJECT;
63
- }
64
-
65
- if (mode === 'row' && isCell(node)) {
66
- return NodeFilter.FILTER_REJECT;
67
- }
68
-
69
- if (node.tabIndex < 0) {
70
- return NodeFilter.FILTER_SKIP;
71
- }
72
-
73
- return NodeFilter.FILTER_ACCEPT;
74
- };
75
-
76
- const treeWalker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {
77
- acceptNode
78
- });
79
-
80
- const up = current => {
81
- const prevMode = mode;
82
- mode = 'row';
83
- treeWalker.currentNode = current;
84
-
85
- if (prevMode === 'column') {
86
- treeWalker.previousNode();
87
- }
88
-
89
- const node = treeWalker.previousNode();
90
-
91
- if (isHTMLElement(node)) {
92
- return node;
93
- }
94
-
95
- return null;
96
- };
97
-
98
- const down = current => {
99
- mode = 'row';
100
- treeWalker.currentNode = current;
101
- const node = treeWalker.nextNode();
102
-
103
- if (isHTMLElement(node)) {
104
- return node;
105
- }
106
-
107
- return null;
108
- };
109
-
110
- const left = current => {
111
- treeWalker.currentNode = current;
112
- const prevMode = mode;
113
- mode = 'column';
114
- let node = null;
115
-
116
- if (prevMode === 'row') {
117
- let tmp = null;
118
-
119
- while (tmp = treeWalker.nextNode()) {
120
- node = tmp;
121
- }
122
- } else {
123
- node = treeWalker.previousNode();
124
- }
125
-
126
- if (isHTMLElement(node)) {
127
- return node;
128
- }
129
-
130
- return null;
131
- };
132
-
133
- const right = current => {
134
- mode = 'column';
135
- treeWalker.currentNode = current;
136
- const node = treeWalker.nextNode();
137
-
138
- if (isHTMLElement(node)) {
139
- return node;
140
- }
141
-
142
- return null;
143
- };
144
-
145
- const onKeyDown = e => {
146
- const target = e.target;
147
-
148
- if (!target || !isHTMLElement(target)) {
149
- return;
150
- }
151
-
152
- let next = null;
153
-
154
- switch (e.key) {
155
- case 'ArrowDown':
156
- next = down(target);
157
- break;
158
-
159
- case 'ArrowUp':
160
- next = up(target);
161
- break;
162
-
163
- case 'ArrowLeft':
164
- next = left(target);
165
- break;
166
-
167
- case 'ArrowRight':
168
- next = right(target);
169
- break;
170
-
171
- case 'Tab':
172
- movingOut = true;
173
-
174
- if (e.shiftKey) {
175
- pre.focus();
176
- } else {
177
- post.focus();
178
- }
179
-
180
- break;
181
-
182
- default:
183
- break;
184
- }
185
-
186
- if (next) {
187
- e.preventDefault();
188
- next.focus();
189
- }
190
- };
191
-
192
- container.addEventListener('keydown', onKeyDown);
193
- return () => container.removeEventListener('keydown', onKeyDown);
194
- }
195
-
196
- exports.applyCompositeNavigation = applyCompositeNavigation;
197
-
198
- function isHTMLElement(node) {
199
- return node instanceof HTMLElement;
200
- }
201
-
202
- function isRow(element) {
203
- if (element.getAttribute('role') === 'row' || element.tagName === 'TR') {
204
- return true;
205
- }
206
-
207
- return false;
208
- }
209
-
210
- function isCell(element) {
211
- if (element.getAttribute('role') === 'cell' || element.getAttribute('role') === 'gridcell' || element.tagName === 'TD') {
212
- return true;
213
- }
214
-
215
- return false;
216
- }
217
- //# sourceMappingURL=composite.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["navigationModes/composite.ts"],"names":[],"mappings":";;;;;;;AAAA,SAA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UACd,GAAG,CAAC,KAAJ;QACD,CAFD,MAEO;UACL,IAAI,CAAC,KAAL;QACD;;QAED;;MACF;QACE;IAvBJ;;IA0BA,IAAI,IAAJ,EAAU;MACR,CAAC,CAAC,cAAF;MACA,IAAI,CAAC,KAAL;IACD;EACF,CAtCD;;EAwCA,SAAS,CAAC,gBAAV,CAA2B,SAA3B,EAAsC,SAAtC;EACA,OAAO,MAAM,SAAS,CAAC,mBAAV,CAA8B,SAA9B,EAAyC,SAAzC,CAAb;AACD;;AA3KD,OAAA,CAAA,wBAAA,GAAA,wBAAA;;AA6KA,SAAS,aAAT,CAAuB,IAAvB,EAAoC;EAClC,OAAO,IAAI,YAAY,WAAvB;AACD;;AAED,SAAS,KAAT,CAAe,OAAf,EAAmC;EACjC,IAAI,OAAO,CAAC,YAAR,CAAqB,MAArB,MAAiC,KAAjC,IAA0C,OAAO,CAAC,OAAR,KAAoB,IAAlE,EAAwE;IACtE,OAAO,IAAP;EACD;;EAED,OAAO,KAAP;AACD;;AAED,SAAS,MAAT,CAAgB,OAAhB,EAAoC;EAClC,IACE,OAAO,CAAC,YAAR,CAAqB,MAArB,MAAiC,MAAjC,IACA,OAAO,CAAC,YAAR,CAAqB,MAArB,MAAiC,UADjC,IAEA,OAAO,CAAC,OAAR,KAAoB,IAHtB,EAIE;IACA,OAAO,IAAP;EACD;;EAED,OAAO,KAAP;AACD","sourcesContent":["export function applyCompositeNavigation(element: HTMLElement) {\n const container = element;\n let mode: 'row' | 'column' = 'row';\n let movingOut = false;\n\n const pre = document.createElement('div');\n const post = document.createElement('div');\n\n if (!pre || !post) {\n return;\n }\n\n pre.tabIndex = 0;\n post.tabIndex = 0;\n\n pre.addEventListener('focus', () => {\n if (movingOut) {\n movingOut = false;\n return;\n } else {\n treeWalker.currentNode = container;\n mode = 'row';\n const candidate = treeWalker.nextNode();\n if (isHTMLElement(candidate)) {\n candidate.focus();\n }\n }\n });\n\n post.addEventListener('focus', () => {\n if (movingOut) {\n movingOut = false;\n return;\n } else {\n treeWalker.currentNode = post;\n mode = 'row';\n const candidate = treeWalker.previousNode();\n if (isHTMLElement(candidate)) {\n candidate.focus();\n }\n }\n });\n\n container.before(pre);\n container.after(post);\n\n const acceptNode = (node: Node) => {\n if (!isHTMLElement(node)) {\n return NodeFilter.FILTER_SKIP;\n }\n\n if (!isCell(node) && !isRow(node)) {\n return NodeFilter.FILTER_SKIP;\n }\n\n if (mode === 'column' && isRow(node)) {\n return NodeFilter.FILTER_REJECT;\n }\n\n if (mode === 'row' && isCell(node)) {\n return NodeFilter.FILTER_REJECT;\n }\n\n if (node.tabIndex < 0) {\n return NodeFilter.FILTER_SKIP;\n }\n\n return NodeFilter.FILTER_ACCEPT;\n };\n\n const treeWalker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, { acceptNode });\n\n const up = (current: HTMLElement) => {\n const prevMode = mode;\n mode = 'row';\n treeWalker.currentNode = current;\n\n if (prevMode === 'column') {\n treeWalker.previousNode();\n }\n\n const node = treeWalker.previousNode();\n if (isHTMLElement(node)) {\n return node;\n }\n return null;\n };\n\n const down = (current: HTMLElement) => {\n mode = 'row';\n treeWalker.currentNode = current;\n const node = treeWalker.nextNode();\n if (isHTMLElement(node)) {\n return node;\n }\n return null;\n };\n\n const left = (current: HTMLElement) => {\n treeWalker.currentNode = current;\n const prevMode = mode;\n mode = 'column';\n let node: Node | null = null;\n\n if (prevMode === 'row') {\n let tmp: Node | null = null;\n while ((tmp = treeWalker.nextNode())) {\n node = tmp;\n }\n } else {\n node = treeWalker.previousNode();\n }\n\n if (isHTMLElement(node)) {\n return node;\n }\n return null;\n };\n\n const right = (current: HTMLElement) => {\n mode = 'column';\n treeWalker.currentNode = current;\n const node = treeWalker.nextNode();\n if (isHTMLElement(node)) {\n return node;\n }\n return null;\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n const target = e.target;\n if (!target || !isHTMLElement(target)) {\n return;\n }\n\n let next: HTMLElement | null = null;\n\n switch (e.key) {\n case 'ArrowDown':\n next = down(target);\n break;\n case 'ArrowUp':\n next = up(target);\n break;\n case 'ArrowLeft':\n next = left(target);\n break;\n case 'ArrowRight':\n next = right(target);\n break;\n case 'Tab':\n movingOut = true;\n if (e.shiftKey) {\n pre.focus();\n } else {\n post.focus();\n }\n\n break;\n default:\n break;\n }\n\n if (next) {\n e.preventDefault();\n next.focus();\n }\n };\n\n container.addEventListener('keydown', onKeyDown);\n return () => container.removeEventListener('keydown', onKeyDown);\n}\n\nfunction isHTMLElement(node: unknown): node is HTMLElement {\n return node instanceof HTMLElement;\n}\n\nfunction isRow(element: HTMLElement) {\n if (element.getAttribute('role') === 'row' || element.tagName === 'TR') {\n return true;\n }\n\n return false;\n}\n\nfunction isCell(element: HTMLElement) {\n if (\n element.getAttribute('role') === 'cell' ||\n element.getAttribute('role') === 'gridcell' ||\n element.tagName === 'TD'\n ) {\n return true;\n }\n\n return false;\n}\n"],"sourceRoot":"../src/"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useNavigationMode = void 0; // eslint-disable-next-line deprecation/deprecation
7
-
8
- var useNavigationMode_1 = /*#__PURE__*/require("./useNavigationMode");
9
-
10
- Object.defineProperty(exports, "useNavigationMode", {
11
- enumerable: true,
12
- get: function () {
13
- return useNavigationMode_1.useNavigationMode;
14
- }
15
- });
16
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["navigationModes/index.ts"],"names":[],"mappings":";;;;;oCAAA;;AACA,IAAA,mBAAA,gBAAA,OAAA,CAAA,qBAAA,CAAA;;AAAS,MAAA,CAAA,cAAA,CAAA,OAAA,EAAA,mBAAA,EAAA;EAAA,UAAA,EAAA,IAAA;EAAA,GAAA,EAAA,YAAA;IAAA,OAAA,mBAAA,CAAA,iBAAA;EAAiB;AAAjB,CAAA","sourcesContent":["// eslint-disable-next-line deprecation/deprecation\nexport { useNavigationMode } from './useNavigationMode';\n"],"sourceRoot":"../src/"}
@@ -1,55 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.useNavigationMode = void 0;
7
-
8
- const React = /*#__PURE__*/require("react");
9
-
10
- const react_tabster_1 = /*#__PURE__*/require("@fluentui/react-tabster");
11
-
12
- const composite_1 = /*#__PURE__*/require("./composite");
13
-
14
- const cell_1 = /*#__PURE__*/require("./cell");
15
- /**
16
- * THIS HOOK WILL NOT EXIST IN STABLE RELEASE
17
- * Just a quick workaround before tabster fully supports these navigation modes with grid mode
18
- * https://github.com/microsoft/fluentui/issues/24382
19
- * @internal
20
- * @deprecated
21
- */
22
-
23
-
24
- function useNavigationMode(mode) {
25
- const rowNavigationAttr = react_tabster_1.useArrowNavigationGroup({
26
- axis: 'vertical'
27
- });
28
- const ref = React.useRef(null);
29
- React.useEffect(() => {
30
- if (!ref.current) {
31
- return;
32
- }
33
-
34
- switch (mode) {
35
- case 'cell':
36
- cell_1.applyCellNavigation(ref.current);
37
- break;
38
-
39
- case 'composite':
40
- composite_1.applyCompositeNavigation(ref.current);
41
- break;
42
-
43
- case 'row':
44
- if (rowNavigationAttr['data-tabster']) {
45
- ref.current.setAttribute('data-tabster', rowNavigationAttr['data-tabster']);
46
- }
47
-
48
- break;
49
- }
50
- }, [rowNavigationAttr, mode]);
51
- return ref;
52
- }
53
-
54
- exports.useNavigationMode = useNavigationMode;
55
- //# sourceMappingURL=useNavigationMode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["navigationModes/useNavigationMode.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,eAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,WAAA,gBAAA,OAAA,CAAA,aAAA,CAAA;;AACA,MAAA,MAAA,gBAAA,OAAA,CAAA,QAAA,CAAA;AAIA;;;;;;AAMG;;;AACH,SAAgB,iBAAhB,CAAgE,IAAhE,EAAoF;EAClF,MAAM,iBAAiB,GAAG,eAAA,CAAA,uBAAA,CAAwB;IAAE,IAAI,EAAE;EAAR,CAAxB,CAA1B;EACA,MAAM,GAAG,GAAG,KAAK,CAAC,MAAN,CAAuB,IAAvB,CAAZ;EAEA,KAAK,CAAC,SAAN,CAAgB,MAAK;IACnB,IAAI,CAAC,GAAG,CAAC,OAAT,EAAkB;MAChB;IACD;;IAED,QAAQ,IAAR;MACE,KAAK,MAAL;QACE,MAAA,CAAA,mBAAA,CAAoB,GAAG,CAAC,OAAxB;QACA;;MACF,KAAK,WAAL;QACE,WAAA,CAAA,wBAAA,CAAyB,GAAG,CAAC,OAA7B;QACA;;MACF,KAAK,KAAL;QACE,IAAI,iBAAiB,CAAC,cAAD,CAArB,EAAuC;UACrC,GAAG,CAAC,OAAJ,CAAY,YAAZ,CAAyB,cAAzB,EAAyC,iBAAiB,CAAC,cAAD,CAA1D;QACD;;QACD;IAXJ;EAaD,CAlBD,EAkBG,CAAC,iBAAD,EAAoB,IAApB,CAlBH;EAoBA,OAAO,GAAP;AACD;;AAzBD,OAAA,CAAA,iBAAA,GAAA,iBAAA","sourcesContent":["import * as React from 'react';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { applyCompositeNavigation } from './composite';\nimport { applyCellNavigation } from './cell';\n\nexport type NavigationMode = 'row' | 'cell' | 'composite';\n\n/**\n * THIS HOOK WILL NOT EXIST IN STABLE RELEASE\n * Just a quick workaround before tabster fully supports these navigation modes with grid mode\n * https://github.com/microsoft/fluentui/issues/24382\n * @internal\n * @deprecated\n */\nexport function useNavigationMode<TElement extends HTMLElement>(mode: NavigationMode) {\n const rowNavigationAttr = useArrowNavigationGroup({ axis: 'vertical' });\n const ref = React.useRef<TElement>(null);\n\n React.useEffect(() => {\n if (!ref.current) {\n return;\n }\n\n switch (mode) {\n case 'cell':\n applyCellNavigation(ref.current);\n break;\n case 'composite':\n applyCompositeNavigation(ref.current);\n break;\n case 'row':\n if (rowNavigationAttr['data-tabster']) {\n ref.current.setAttribute('data-tabster', rowNavigationAttr['data-tabster']);\n }\n break;\n }\n }, [rowNavigationAttr, mode]);\n\n return ref;\n}\n"],"sourceRoot":"../src/"}