@cognite/aura 0.3.4 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (540) hide show
  1. package/CHANGELOG.md +274 -0
  2. package/DESIGN.md +664 -281
  3. package/LICENSE +21 -0
  4. package/README.md +48 -13
  5. package/dist/colors-deprecated.css +618 -0
  6. package/dist/colors.css +803 -830
  7. package/dist/components/index.d.ts +63 -57
  8. package/dist/components/index.js +62 -59
  9. package/dist/components/index.js.map +1 -0
  10. package/dist/components/ui/core/accordion/accordion.d.ts +19 -18
  11. package/dist/components/ui/core/accordion/accordion.js +99 -78
  12. package/dist/components/ui/core/accordion/accordion.js.map +1 -0
  13. package/dist/components/ui/core/action-toolbar/action-toolbar-motion.d.ts +8 -0
  14. package/dist/components/ui/core/action-toolbar/action-toolbar-motion.js +132 -0
  15. package/dist/components/ui/core/action-toolbar/action-toolbar-motion.js.map +1 -0
  16. package/dist/components/ui/core/action-toolbar/action-toolbar.d.ts +31 -31
  17. package/dist/components/ui/core/action-toolbar/action-toolbar.js +156 -106
  18. package/dist/components/ui/core/action-toolbar/action-toolbar.js.map +1 -0
  19. package/dist/components/ui/core/alert/alert.d.ts +25 -25
  20. package/dist/components/ui/core/alert/alert.gallery.d.ts +2 -0
  21. package/dist/components/ui/core/alert/alert.gallery.js +54 -0
  22. package/dist/components/ui/core/alert/alert.gallery.js.map +1 -0
  23. package/dist/components/ui/core/alert/alert.js +181 -152
  24. package/dist/components/ui/core/alert/alert.js.map +1 -0
  25. package/dist/components/ui/core/avatar/avatar.d.ts +10 -9
  26. package/dist/components/ui/core/avatar/avatar.gallery.d.ts +2 -0
  27. package/dist/components/ui/core/avatar/avatar.gallery.js +67 -0
  28. package/dist/components/ui/core/avatar/avatar.gallery.js.map +1 -0
  29. package/dist/components/ui/core/avatar/avatar.js +75 -65
  30. package/dist/components/ui/core/avatar/avatar.js.map +1 -0
  31. package/dist/components/ui/core/badge/badge.d.ts +13 -12
  32. package/dist/components/ui/core/badge/badge.gallery.d.ts +2 -0
  33. package/dist/components/ui/core/badge/badge.gallery.js +64 -0
  34. package/dist/components/ui/core/badge/badge.gallery.js.map +1 -0
  35. package/dist/components/ui/core/badge/badge.js +88 -72
  36. package/dist/components/ui/core/badge/badge.js.map +1 -0
  37. package/dist/components/ui/core/banner/banner.d.ts +18 -18
  38. package/dist/components/ui/core/banner/banner.gallery.d.ts +2 -0
  39. package/dist/components/ui/core/banner/banner.gallery.js +56 -0
  40. package/dist/components/ui/core/banner/banner.gallery.js.map +1 -0
  41. package/dist/components/ui/core/banner/banner.js +179 -142
  42. package/dist/components/ui/core/banner/banner.js.map +1 -0
  43. package/dist/components/ui/core/breadcrumb/breadcrumb.d.ts +12 -12
  44. package/dist/components/ui/core/breadcrumb/breadcrumb.gallery.d.ts +2 -0
  45. package/dist/components/ui/core/breadcrumb/breadcrumb.gallery.js +31 -0
  46. package/dist/components/ui/core/breadcrumb/breadcrumb.gallery.js.map +1 -0
  47. package/dist/components/ui/core/breadcrumb/breadcrumb.js +139 -104
  48. package/dist/components/ui/core/breadcrumb/breadcrumb.js.map +1 -0
  49. package/dist/components/ui/core/button/button.d.ts +7 -7
  50. package/dist/components/ui/core/button/button.gallery.d.ts +2 -0
  51. package/dist/components/ui/core/button/button.gallery.js +76 -0
  52. package/dist/components/ui/core/button/button.gallery.js.map +1 -0
  53. package/dist/components/ui/core/button/button.js +57 -47
  54. package/dist/components/ui/core/button/button.js.map +1 -0
  55. package/dist/components/ui/core/button-group/button-group.d.ts +9 -9
  56. package/dist/components/ui/core/button-group/button-group.gallery.d.ts +2 -0
  57. package/dist/components/ui/core/button-group/button-group.gallery.js +62 -0
  58. package/dist/components/ui/core/button-group/button-group.gallery.js.map +1 -0
  59. package/dist/components/ui/core/button-group/button-group.js +50 -40
  60. package/dist/components/ui/core/button-group/button-group.js.map +1 -0
  61. package/dist/components/ui/core/calendar/calendar-header.d.ts +7 -7
  62. package/dist/components/ui/core/calendar/calendar-header.js +102 -63
  63. package/dist/components/ui/core/calendar/calendar-header.js.map +1 -0
  64. package/dist/components/ui/core/calendar/calendar-utils.d.ts +30 -30
  65. package/dist/components/ui/core/calendar/calendar-utils.js +116 -39
  66. package/dist/components/ui/core/calendar/calendar-utils.js.map +1 -0
  67. package/dist/components/ui/core/calendar/calendar.d.ts +10 -10
  68. package/dist/components/ui/core/calendar/calendar.js +95 -66
  69. package/dist/components/ui/core/calendar/calendar.js.map +1 -0
  70. package/dist/components/ui/core/calendar/constants.js +3 -0
  71. package/dist/components/ui/core/calendar/constants.js.map +1 -0
  72. package/dist/components/ui/core/card/card.d.ts +20 -20
  73. package/dist/components/ui/core/card/card.js +133 -104
  74. package/dist/components/ui/core/card/card.js.map +1 -0
  75. package/dist/components/ui/core/chart/chart.d.ts +55 -53
  76. package/dist/components/ui/core/chart/chart.js +196 -116
  77. package/dist/components/ui/core/chart/chart.js.map +1 -0
  78. package/dist/components/ui/core/chart/index.d.ts +2 -2
  79. package/dist/components/ui/core/chart/index.js +3 -2
  80. package/dist/components/ui/core/chart/index.js.map +1 -0
  81. package/dist/components/ui/core/checkbox/checkbox.d.ts +9 -9
  82. package/dist/components/ui/core/checkbox/checkbox.gallery.d.ts +2 -0
  83. package/dist/components/ui/core/checkbox/checkbox.gallery.js +36 -0
  84. package/dist/components/ui/core/checkbox/checkbox.gallery.js.map +1 -0
  85. package/dist/components/ui/core/checkbox/checkbox.js +88 -68
  86. package/dist/components/ui/core/checkbox/checkbox.js.map +1 -0
  87. package/dist/components/ui/core/checkbox/checkbox.metadata.d.ts +1 -1
  88. package/dist/components/ui/core/checkbox/checkbox.metadata.js +6 -7
  89. package/dist/components/ui/core/checkbox/checkbox.metadata.js.map +1 -0
  90. package/dist/components/ui/core/code-block/code-block.d.ts +19 -19
  91. package/dist/components/ui/core/code-block/code-block.js +260 -175
  92. package/dist/components/ui/core/code-block/code-block.js.map +1 -0
  93. package/dist/components/ui/core/collapsible/collapsible.d.ts +5 -5
  94. package/dist/components/ui/core/collapsible/collapsible.gallery.d.ts +2 -0
  95. package/dist/components/ui/core/collapsible/collapsible.gallery.js +39 -0
  96. package/dist/components/ui/core/collapsible/collapsible.gallery.js.map +1 -0
  97. package/dist/components/ui/core/collapsible/collapsible.js +36 -30
  98. package/dist/components/ui/core/collapsible/collapsible.js.map +1 -0
  99. package/dist/components/ui/core/combobox/combobox.d.ts +13 -13
  100. package/dist/components/ui/core/combobox/combobox.js +89 -40
  101. package/dist/components/ui/core/combobox/combobox.js.map +1 -0
  102. package/dist/components/ui/core/command/command.d.ts +20 -18
  103. package/dist/components/ui/core/command/command.js +137 -85
  104. package/dist/components/ui/core/command/command.js.map +1 -0
  105. package/dist/components/ui/core/conversation/conversation.d.ts +14 -0
  106. package/dist/components/ui/core/conversation/conversation.js +51 -0
  107. package/dist/components/ui/core/conversation/conversation.js.map +1 -0
  108. package/dist/components/ui/core/count/count.d.ts +8 -6
  109. package/dist/components/ui/core/count/count.gallery.d.ts +2 -0
  110. package/dist/components/ui/core/count/count.gallery.js +55 -0
  111. package/dist/components/ui/core/count/count.gallery.js.map +1 -0
  112. package/dist/components/ui/core/count/count.js +51 -21
  113. package/dist/components/ui/core/count/count.js.map +1 -0
  114. package/dist/components/ui/core/data-grid/data-grid-cell.d.ts +5 -7
  115. package/dist/components/ui/core/data-grid/data-grid-cell.js +19 -0
  116. package/dist/components/ui/core/data-grid/data-grid-cell.js.map +1 -0
  117. package/dist/components/ui/core/data-grid/data-grid-column-filter.d.ts +4 -0
  118. package/dist/components/ui/core/data-grid/data-grid-column-filter.js +13 -0
  119. package/dist/components/ui/core/data-grid/data-grid-column-filter.js.map +1 -0
  120. package/dist/components/ui/core/data-grid/data-grid-column-resizer.d.ts +8 -0
  121. package/dist/components/ui/core/data-grid/data-grid-column-resizer.js +25 -0
  122. package/dist/components/ui/core/data-grid/data-grid-column-resizer.js.map +1 -0
  123. package/dist/components/ui/core/data-grid/data-grid-filter-clauses.d.ts +14 -0
  124. package/dist/components/ui/core/data-grid/data-grid-filter-clauses.js +36 -0
  125. package/dist/components/ui/core/data-grid/data-grid-filter-clauses.js.map +1 -0
  126. package/dist/components/ui/core/data-grid/data-grid-filter-panel.d.ts +43 -0
  127. package/dist/components/ui/core/data-grid/data-grid-filter-panel.js +287 -0
  128. package/dist/components/ui/core/data-grid/data-grid-filter-panel.js.map +1 -0
  129. package/dist/components/ui/core/data-grid/data-grid-footer.d.ts +6 -0
  130. package/dist/components/ui/core/data-grid/data-grid-footer.js +34 -0
  131. package/dist/components/ui/core/data-grid/data-grid-footer.js.map +1 -0
  132. package/dist/components/ui/core/data-grid/data-grid-header-row.d.ts +10 -10
  133. package/dist/components/ui/core/data-grid/data-grid-header-row.js +86 -0
  134. package/dist/components/ui/core/data-grid/data-grid-header-row.js.map +1 -0
  135. package/dist/components/ui/core/data-grid/data-grid-header.d.ts +11 -0
  136. package/dist/components/ui/core/data-grid/data-grid-header.js +67 -0
  137. package/dist/components/ui/core/data-grid/data-grid-header.js.map +1 -0
  138. package/dist/components/ui/core/data-grid/data-grid-row.d.ts +13 -15
  139. package/dist/components/ui/core/data-grid/data-grid-row.js +118 -0
  140. package/dist/components/ui/core/data-grid/data-grid-row.js.map +1 -0
  141. package/dist/components/ui/core/data-grid/data-grid-selection-state.d.ts +15 -0
  142. package/dist/components/ui/core/data-grid/data-grid-selection-state.js +32 -0
  143. package/dist/components/ui/core/data-grid/data-grid-selection-state.js.map +1 -0
  144. package/dist/components/ui/core/data-grid/data-grid-selection-toolbar.d.ts +11 -0
  145. package/dist/components/ui/core/data-grid/data-grid-selection-toolbar.js +129 -0
  146. package/dist/components/ui/core/data-grid/data-grid-selection-toolbar.js.map +1 -0
  147. package/dist/components/ui/core/data-grid/data-grid-selection.types.d.ts +24 -0
  148. package/dist/components/ui/core/data-grid/data-grid-selection.types.js +3 -0
  149. package/dist/components/ui/core/data-grid/data-grid-selection.types.js.map +1 -0
  150. package/dist/components/ui/core/data-grid/data-grid.d.ts +125 -35
  151. package/dist/components/ui/core/data-grid/data-grid.fixtures.d.ts +7 -7
  152. package/dist/components/ui/core/data-grid/data-grid.fixtures.js +139 -0
  153. package/dist/components/ui/core/data-grid/data-grid.fixtures.js.map +1 -0
  154. package/dist/components/ui/core/data-grid/data-grid.js +542 -0
  155. package/dist/components/ui/core/data-grid/data-grid.js.map +1 -0
  156. package/dist/components/ui/core/data-grid/data-grid.utils.d.ts +3 -4
  157. package/dist/components/ui/core/data-grid/data-grid.utils.js +53 -0
  158. package/dist/components/ui/core/data-grid/data-grid.utils.js.map +1 -0
  159. package/dist/components/ui/core/data-grid/index.d.ts +6 -0
  160. package/dist/components/ui/core/data-grid/index.js +6 -0
  161. package/dist/components/ui/core/data-grid/index.js.map +1 -0
  162. package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.d.ts +11 -13
  163. package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js +85 -61
  164. package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js.map +1 -0
  165. package/dist/components/ui/core/date-time-pickers/date-picker/index.d.ts +3 -3
  166. package/dist/components/ui/core/date-time-pickers/date-picker/index.js +3 -0
  167. package/dist/components/ui/core/date-time-pickers/date-picker/index.js.map +1 -0
  168. package/dist/components/ui/core/date-time-pickers/date-picker/types.d.ts +14 -14
  169. package/dist/components/ui/core/date-time-pickers/date-picker/types.js +3 -0
  170. package/dist/components/ui/core/date-time-pickers/date-picker/types.js.map +1 -0
  171. package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.d.ts +2 -2
  172. package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js +51 -36
  173. package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js.map +1 -0
  174. package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.d.ts +11 -13
  175. package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +89 -64
  176. package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js.map +1 -0
  177. package/dist/components/ui/core/date-time-pickers/date-range-picker/index.d.ts +3 -3
  178. package/dist/components/ui/core/date-time-pickers/date-range-picker/index.js +3 -0
  179. package/dist/components/ui/core/date-time-pickers/date-range-picker/index.js.map +1 -0
  180. package/dist/components/ui/core/date-time-pickers/date-range-picker/types.d.ts +20 -20
  181. package/dist/components/ui/core/date-time-pickers/date-range-picker/types.js +3 -0
  182. package/dist/components/ui/core/date-time-pickers/date-range-picker/types.js.map +1 -0
  183. package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.d.ts +4 -4
  184. package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +95 -60
  185. package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js.map +1 -0
  186. package/dist/components/ui/core/date-time-pickers/date-time-picker/date-time-picker.d.ts +15 -0
  187. package/dist/components/ui/core/date-time-pickers/date-time-picker/date-time-picker.js +120 -0
  188. package/dist/components/ui/core/date-time-pickers/date-time-picker/date-time-picker.js.map +1 -0
  189. package/dist/components/ui/core/date-time-pickers/date-time-picker/index.d.ts +3 -1
  190. package/dist/components/ui/core/date-time-pickers/date-time-picker/index.js +3 -0
  191. package/dist/components/ui/core/date-time-pickers/date-time-picker/index.js.map +1 -0
  192. package/dist/components/ui/core/date-time-pickers/date-time-picker/types.d.ts +25 -32
  193. package/dist/components/ui/core/date-time-pickers/date-time-picker/types.js +3 -0
  194. package/dist/components/ui/core/date-time-pickers/date-time-picker/types.js.map +1 -0
  195. package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.d.ts +2 -2
  196. package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.js +78 -0
  197. package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.js.map +1 -0
  198. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.d.ts +13 -15
  199. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +165 -119
  200. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js.map +1 -0
  201. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/index.d.ts +3 -3
  202. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/index.js +3 -0
  203. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/index.js.map +1 -0
  204. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.d.ts +37 -37
  205. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.js +3 -0
  206. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.js.map +1 -0
  207. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.d.ts +3 -3
  208. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +163 -104
  209. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js.map +1 -0
  210. package/dist/components/ui/core/date-time-pickers/index.d.ts +17 -12
  211. package/dist/components/ui/core/date-time-pickers/index.js +10 -6
  212. package/dist/components/ui/core/date-time-pickers/index.js.map +1 -0
  213. package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.d.ts +5 -5
  214. package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js +52 -42
  215. package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js.map +1 -0
  216. package/dist/components/ui/core/date-time-pickers/shared/constants.d.ts +6 -1
  217. package/dist/components/ui/core/date-time-pickers/shared/constants.js +23 -0
  218. package/dist/components/ui/core/date-time-pickers/shared/constants.js.map +1 -0
  219. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.d.ts +16 -15
  220. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +87 -64
  221. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js.map +1 -0
  222. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.d.ts +10 -9
  223. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js +89 -38
  224. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js.map +1 -0
  225. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.d.ts +5 -5
  226. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js +34 -23
  227. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js.map +1 -0
  228. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.d.ts +23 -23
  229. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js +95 -52
  230. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js.map +1 -0
  231. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.d.ts +5 -5
  232. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js +22 -18
  233. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js.map +1 -0
  234. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.d.ts +19 -19
  235. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js +41 -24
  236. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js.map +1 -0
  237. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.d.ts +13 -13
  238. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js +33 -24
  239. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js.map +1 -0
  240. package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.d.ts +5 -5
  241. package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js +9 -4
  242. package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js.map +1 -0
  243. package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.d.ts +13 -9
  244. package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js +22 -17
  245. package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js.map +1 -0
  246. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.d.ts +2 -2
  247. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.js +3 -0
  248. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.js.map +1 -0
  249. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.d.ts +13 -13
  250. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js +49 -40
  251. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js.map +1 -0
  252. package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.d.ts +7 -7
  253. package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js +41 -34
  254. package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js.map +1 -0
  255. package/dist/components/ui/core/date-time-pickers/time-picker/index.d.ts +3 -3
  256. package/dist/components/ui/core/date-time-pickers/time-picker/index.js +3 -0
  257. package/dist/components/ui/core/date-time-pickers/time-picker/index.js.map +1 -0
  258. package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.d.ts +12 -14
  259. package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js +99 -79
  260. package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js.map +1 -0
  261. package/dist/components/ui/core/date-time-pickers/time-picker/types.d.ts +20 -20
  262. package/dist/components/ui/core/date-time-pickers/time-picker/types.js +3 -0
  263. package/dist/components/ui/core/date-time-pickers/time-picker/types.js.map +1 -0
  264. package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.d.ts +2 -2
  265. package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js +63 -41
  266. package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js.map +1 -0
  267. package/dist/components/ui/core/date-time-pickers/time-range-picker/index.d.ts +3 -1
  268. package/dist/components/ui/core/date-time-pickers/time-range-picker/index.js +3 -0
  269. package/dist/components/ui/core/date-time-pickers/time-range-picker/index.js.map +1 -0
  270. package/dist/components/ui/core/date-time-pickers/time-range-picker/time-range-picker.d.ts +14 -0
  271. package/dist/components/ui/core/date-time-pickers/time-range-picker/time-range-picker.js +115 -0
  272. package/dist/components/ui/core/date-time-pickers/time-range-picker/time-range-picker.js.map +1 -0
  273. package/dist/components/ui/core/date-time-pickers/time-range-picker/types.d.ts +30 -36
  274. package/dist/components/ui/core/date-time-pickers/time-range-picker/types.js +3 -0
  275. package/dist/components/ui/core/date-time-pickers/time-range-picker/types.js.map +1 -0
  276. package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.d.ts +2 -2
  277. package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.js +145 -0
  278. package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.js.map +1 -0
  279. package/dist/components/ui/core/date-time-pickers/utils/date-input.d.ts +56 -0
  280. package/dist/components/ui/core/date-time-pickers/utils/date-input.js +67 -0
  281. package/dist/components/ui/core/date-time-pickers/utils/date-input.js.map +1 -0
  282. package/dist/components/ui/core/date-time-pickers/utils/date-range-utils.d.ts +18 -18
  283. package/dist/components/ui/core/date-time-pickers/utils/date-range-utils.js +42 -0
  284. package/dist/components/ui/core/date-time-pickers/utils/date-range-utils.js.map +1 -0
  285. package/dist/components/ui/core/date-time-pickers/utils/format-utils.d.ts +31 -29
  286. package/dist/components/ui/core/date-time-pickers/utils/format-utils.js +56 -0
  287. package/dist/components/ui/core/date-time-pickers/utils/format-utils.js.map +1 -0
  288. package/dist/components/ui/core/date-time-pickers/utils/segment-utils.d.ts +21 -21
  289. package/dist/components/ui/core/date-time-pickers/utils/segment-utils.js +170 -0
  290. package/dist/components/ui/core/date-time-pickers/utils/segment-utils.js.map +1 -0
  291. package/dist/components/ui/core/date-time-pickers/utils/time-utils.d.ts +28 -28
  292. package/dist/components/ui/core/date-time-pickers/utils/time-utils.js +88 -7
  293. package/dist/components/ui/core/date-time-pickers/utils/time-utils.js.map +1 -0
  294. package/dist/components/ui/core/date-time-pickers/utils/time-validation.d.ts +17 -17
  295. package/dist/components/ui/core/date-time-pickers/utils/time-validation.js +43 -0
  296. package/dist/components/ui/core/date-time-pickers/utils/time-validation.js.map +1 -0
  297. package/dist/components/ui/core/dialog/dialog.d.ts +12 -9
  298. package/dist/components/ui/core/dialog/dialog.js +90 -82
  299. package/dist/components/ui/core/dialog/dialog.js.map +1 -0
  300. package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +22 -19
  301. package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +204 -149
  302. package/dist/components/ui/core/dropdown-menu/dropdown-menu.js.map +1 -0
  303. package/dist/components/ui/core/empty-state/empty-state.context.d.ts +4 -4
  304. package/dist/components/ui/core/empty-state/empty-state.context.js +8 -5
  305. package/dist/components/ui/core/empty-state/empty-state.context.js.map +1 -0
  306. package/dist/components/ui/core/empty-state/empty-state.d.ts +14 -14
  307. package/dist/components/ui/core/empty-state/empty-state.js +96 -82
  308. package/dist/components/ui/core/empty-state/empty-state.js.map +1 -0
  309. package/dist/components/ui/core/helper-text/helper-text.d.ts +7 -7
  310. package/dist/components/ui/core/helper-text/helper-text.js +55 -36
  311. package/dist/components/ui/core/helper-text/helper-text.js.map +1 -0
  312. package/dist/components/ui/core/hover-card/hover-card.d.ts +7 -6
  313. package/dist/components/ui/core/hover-card/hover-card.js +56 -52
  314. package/dist/components/ui/core/hover-card/hover-card.js.map +1 -0
  315. package/dist/components/ui/core/inline-citation/inline-citation.d.ts +26 -25
  316. package/dist/components/ui/core/inline-citation/inline-citation.js +121 -97
  317. package/dist/components/ui/core/inline-citation/inline-citation.js.map +1 -0
  318. package/dist/components/ui/core/input/input.d.ts +2 -2
  319. package/dist/components/ui/core/input/input.gallery.d.ts +2 -0
  320. package/dist/components/ui/core/input/input.gallery.js +89 -0
  321. package/dist/components/ui/core/input/input.gallery.js.map +1 -0
  322. package/dist/components/ui/core/input/input.js +15 -13
  323. package/dist/components/ui/core/input/input.js.map +1 -0
  324. package/dist/components/ui/core/input-group/input-group.d.ts +25 -14
  325. package/dist/components/ui/core/input-group/input-group.js +149 -76
  326. package/dist/components/ui/core/input-group/input-group.js.map +1 -0
  327. package/dist/components/ui/core/item/item.d.ts +20 -0
  328. package/dist/components/ui/core/item/item.js +93 -0
  329. package/dist/components/ui/core/item/item.js.map +1 -0
  330. package/dist/components/ui/core/kbd/kbd.d.ts +3 -3
  331. package/dist/components/ui/core/kbd/kbd.js +24 -20
  332. package/dist/components/ui/core/kbd/kbd.js.map +1 -0
  333. package/dist/components/ui/core/label/label.d.ts +3 -3
  334. package/dist/components/ui/core/label/label.gallery.d.ts +2 -0
  335. package/dist/components/ui/core/label/label.gallery.js +57 -0
  336. package/dist/components/ui/core/label/label.gallery.js.map +1 -0
  337. package/dist/components/ui/core/label/label.js +33 -26
  338. package/dist/components/ui/core/label/label.js.map +1 -0
  339. package/dist/components/ui/core/loader/loader.d.ts +6 -6
  340. package/dist/components/ui/core/loader/loader.js +97 -80
  341. package/dist/components/ui/core/loader/loader.js.map +1 -0
  342. package/dist/components/ui/core/message/message-response-default-streamdown-controls.d.ts +8 -9
  343. package/dist/components/ui/core/message/message-response-default-streamdown-controls.js +18 -12
  344. package/dist/components/ui/core/message/message-response-default-streamdown-controls.js.map +1 -0
  345. package/dist/components/ui/core/message/message-response-math-plugin.d.ts +3 -0
  346. package/dist/components/ui/core/message/message-response-math-plugin.js +6 -0
  347. package/dist/components/ui/core/message/message-response-math-plugin.js.map +1 -0
  348. package/dist/components/ui/core/message/message.d.ts +27 -23
  349. package/dist/components/ui/core/message/message.js +458 -316
  350. package/dist/components/ui/core/message/message.js.map +1 -0
  351. package/dist/components/ui/core/overflow-list/overflow-list.d.ts +21 -0
  352. package/dist/components/ui/core/overflow-list/overflow-list.js +197 -0
  353. package/dist/components/ui/core/overflow-list/overflow-list.js.map +1 -0
  354. package/dist/components/ui/core/overflow-list/overflow-list.utils.d.ts +37 -35
  355. package/dist/components/ui/core/overflow-list/overflow-list.utils.js +206 -0
  356. package/dist/components/ui/core/overflow-list/overflow-list.utils.js.map +1 -0
  357. package/dist/components/ui/core/pagination/pagination-size-context.d.ts +2 -2
  358. package/dist/components/ui/core/pagination/pagination-size-context.js +6 -5
  359. package/dist/components/ui/core/pagination/pagination-size-context.js.map +1 -0
  360. package/dist/components/ui/core/pagination/pagination-teleport.d.ts +9 -9
  361. package/dist/components/ui/core/pagination/pagination-teleport.js +127 -84
  362. package/dist/components/ui/core/pagination/pagination-teleport.js.map +1 -0
  363. package/dist/components/ui/core/pagination/pagination-teleport.utils.js +6 -6
  364. package/dist/components/ui/core/pagination/pagination-teleport.utils.js.map +1 -0
  365. package/dist/components/ui/core/pagination/pagination.d.ts +39 -39
  366. package/dist/components/ui/core/pagination/pagination.js +294 -234
  367. package/dist/components/ui/core/pagination/pagination.js.map +1 -0
  368. package/dist/components/ui/core/popover/popover.d.ts +12 -11
  369. package/dist/components/ui/core/popover/popover.js +104 -89
  370. package/dist/components/ui/core/popover/popover.js.map +1 -0
  371. package/dist/components/ui/core/progress/progress.d.ts +9 -8
  372. package/dist/components/ui/core/progress/progress.js +50 -35
  373. package/dist/components/ui/core/progress/progress.js.map +1 -0
  374. package/dist/components/ui/core/prompt-input/prompt-input.d.ts +27 -27
  375. package/dist/components/ui/core/prompt-input/prompt-input.js +342 -271
  376. package/dist/components/ui/core/prompt-input/prompt-input.js.map +1 -0
  377. package/dist/components/ui/core/radio-group/radio-group.d.ts +12 -12
  378. package/dist/components/ui/core/radio-group/radio-group.gallery.d.ts +2 -0
  379. package/dist/components/ui/core/radio-group/radio-group.gallery.js +44 -0
  380. package/dist/components/ui/core/radio-group/radio-group.gallery.js.map +1 -0
  381. package/dist/components/ui/core/radio-group/radio-group.js +88 -58
  382. package/dist/components/ui/core/radio-group/radio-group.js.map +1 -0
  383. package/dist/components/ui/core/reasoning/reasoning.d.ts +7 -7
  384. package/dist/components/ui/core/reasoning/reasoning.js +68 -56
  385. package/dist/components/ui/core/reasoning/reasoning.js.map +1 -0
  386. package/dist/components/ui/core/scroll-area/scroll-area.d.ts +4 -4
  387. package/dist/components/ui/core/scroll-area/scroll-area.js +50 -40
  388. package/dist/components/ui/core/scroll-area/scroll-area.js.map +1 -0
  389. package/dist/components/ui/core/search/search.d.ts +8 -8
  390. package/dist/components/ui/core/search/search.js +122 -76
  391. package/dist/components/ui/core/search/search.js.map +1 -0
  392. package/dist/components/ui/core/segmented-control/segmented-control.d.ts +17 -11
  393. package/dist/components/ui/core/segmented-control/segmented-control.js +204 -108
  394. package/dist/components/ui/core/segmented-control/segmented-control.js.map +1 -0
  395. package/dist/components/ui/core/select/select.d.ts +33 -26
  396. package/dist/components/ui/core/select/select.js +262 -168
  397. package/dist/components/ui/core/select/select.js.map +1 -0
  398. package/dist/components/ui/core/separator/separator.d.ts +2 -2
  399. package/dist/components/ui/core/separator/separator.gallery.d.ts +2 -0
  400. package/dist/components/ui/core/separator/separator.gallery.js +63 -0
  401. package/dist/components/ui/core/separator/separator.gallery.js.map +1 -0
  402. package/dist/components/ui/core/separator/separator.js +13 -13
  403. package/dist/components/ui/core/separator/separator.js.map +1 -0
  404. package/dist/components/ui/core/shimmer/shimmer.d.ts +8 -8
  405. package/dist/components/ui/core/shimmer/shimmer.js +64 -40
  406. package/dist/components/ui/core/shimmer/shimmer.js.map +1 -0
  407. package/dist/components/ui/core/skeleton/skeleton.d.ts +2 -2
  408. package/dist/components/ui/core/skeleton/skeleton.gallery.d.ts +2 -0
  409. package/dist/components/ui/core/skeleton/skeleton.gallery.js +22 -0
  410. package/dist/components/ui/core/skeleton/skeleton.gallery.js.map +1 -0
  411. package/dist/components/ui/core/skeleton/skeleton.js +13 -13
  412. package/dist/components/ui/core/skeleton/skeleton.js.map +1 -0
  413. package/dist/components/ui/core/slider/slider.d.ts +7 -7
  414. package/dist/components/ui/core/slider/slider.gallery.d.ts +2 -0
  415. package/dist/components/ui/core/slider/slider.gallery.js +62 -0
  416. package/dist/components/ui/core/slider/slider.gallery.js.map +1 -0
  417. package/dist/components/ui/core/slider/slider.js +51 -39
  418. package/dist/components/ui/core/slider/slider.js.map +1 -0
  419. package/dist/components/ui/core/sonner-toast/sonner-toast.d.ts +2 -2
  420. package/dist/components/ui/core/sonner-toast/sonner-toast.js +67 -54
  421. package/dist/components/ui/core/sonner-toast/sonner-toast.js.map +1 -0
  422. package/dist/components/ui/core/sources/sources.d.ts +12 -12
  423. package/dist/components/ui/core/sources/sources.js +87 -58
  424. package/dist/components/ui/core/sources/sources.js.map +1 -0
  425. package/dist/components/ui/core/status-text/status-text.d.ts +4 -0
  426. package/dist/components/ui/core/status-text/status-text.js +14 -0
  427. package/dist/components/ui/core/status-text/status-text.js.map +1 -0
  428. package/dist/components/ui/core/switch/switch.d.ts +9 -9
  429. package/dist/components/ui/core/switch/switch.gallery.d.ts +2 -0
  430. package/dist/components/ui/core/switch/switch.gallery.js +67 -0
  431. package/dist/components/ui/core/switch/switch.gallery.js.map +1 -0
  432. package/dist/components/ui/core/switch/switch.js +83 -61
  433. package/dist/components/ui/core/switch/switch.js.map +1 -0
  434. package/dist/components/ui/core/switch/switch.metadata.d.ts +1 -1
  435. package/dist/components/ui/core/switch/switch.metadata.js +8 -0
  436. package/dist/components/ui/core/switch/switch.metadata.js.map +1 -0
  437. package/dist/components/ui/core/tabs/tabs.d.ts +20 -18
  438. package/dist/components/ui/core/tabs/tabs.js +176 -147
  439. package/dist/components/ui/core/tabs/tabs.js.map +1 -0
  440. package/dist/components/ui/core/tabs/tabs.utils.d.ts +1 -1
  441. package/dist/components/ui/core/tabs/tabs.utils.js +10 -6
  442. package/dist/components/ui/core/tabs/tabs.utils.js.map +1 -0
  443. package/dist/components/ui/core/textarea/textarea.d.ts +2 -2
  444. package/dist/components/ui/core/textarea/textarea.gallery.d.ts +2 -0
  445. package/dist/components/ui/core/textarea/textarea.gallery.js +51 -0
  446. package/dist/components/ui/core/textarea/textarea.gallery.js.map +1 -0
  447. package/dist/components/ui/core/textarea/textarea.js +13 -13
  448. package/dist/components/ui/core/textarea/textarea.js.map +1 -0
  449. package/dist/components/ui/core/toggle/toggle.d.ts +9 -9
  450. package/dist/components/ui/core/toggle/toggle.gallery.d.ts +2 -0
  451. package/dist/components/ui/core/toggle/toggle.gallery.js +32 -0
  452. package/dist/components/ui/core/toggle/toggle.gallery.js.map +1 -0
  453. package/dist/components/ui/core/toggle/toggle.js +60 -54
  454. package/dist/components/ui/core/toggle/toggle.js.map +1 -0
  455. package/dist/components/ui/core/tool/tool.d.ts +18 -18
  456. package/dist/components/ui/core/tool/tool.js +167 -126
  457. package/dist/components/ui/core/tool/tool.js.map +1 -0
  458. package/dist/components/ui/core/toolbar/toolbar.d.ts +37 -0
  459. package/dist/components/ui/core/toolbar/toolbar.js +171 -0
  460. package/dist/components/ui/core/toolbar/toolbar.js.map +1 -0
  461. package/dist/components/ui/core/tooltip/tooltip.d.ts +8 -7
  462. package/dist/components/ui/core/tooltip/tooltip.gallery.d.ts +2 -0
  463. package/dist/components/ui/core/tooltip/tooltip.gallery.js +52 -0
  464. package/dist/components/ui/core/tooltip/tooltip.gallery.js.map +1 -0
  465. package/dist/components/ui/core/tooltip/tooltip.js +53 -46
  466. package/dist/components/ui/core/tooltip/tooltip.js.map +1 -0
  467. package/dist/components/ui/core/topbar/topbar.d.ts +26 -26
  468. package/dist/components/ui/core/topbar/topbar.js +160 -105
  469. package/dist/components/ui/core/topbar/topbar.js.map +1 -0
  470. package/dist/components/ui/core/tree/tree.d.ts +20 -0
  471. package/dist/components/ui/core/tree/tree.js +100 -0
  472. package/dist/components/ui/core/tree/tree.js.map +1 -0
  473. package/dist/eslint/index.d.ts +5 -5
  474. package/dist/eslint/index.js +9 -5
  475. package/dist/eslint/index.js.map +1 -0
  476. package/dist/eslint/no-overriding-styles.d.ts +1 -1
  477. package/dist/eslint/no-overriding-styles.js +341 -201
  478. package/dist/eslint/no-overriding-styles.js.map +1 -0
  479. package/dist/icons/index.d.ts +1 -1
  480. package/dist/icons/index.js +2 -0
  481. package/dist/icons/index.js.map +1 -0
  482. package/dist/index.d.ts +1 -1
  483. package/dist/index.js +3 -0
  484. package/dist/index.js.map +1 -0
  485. package/dist/lib/ai/types.d.ts +43 -43
  486. package/dist/lib/ai/types.js +3 -0
  487. package/dist/lib/ai/types.js.map +1 -0
  488. package/dist/lib/decorative-variant-classes.d.ts +53 -0
  489. package/dist/lib/decorative-variant-classes.js +58 -0
  490. package/dist/lib/decorative-variant-classes.js.map +1 -0
  491. package/dist/lib/highlight-code.d.ts +11 -8
  492. package/dist/lib/highlight-code.js +58 -40
  493. package/dist/lib/highlight-code.js.map +1 -0
  494. package/dist/lib/portal-container-context.d.ts +1 -1
  495. package/dist/lib/portal-container-context.js +8 -8
  496. package/dist/lib/portal-container-context.js.map +1 -0
  497. package/dist/lib/shared-theme-from-url.d.ts +13 -0
  498. package/dist/lib/shared-theme-from-url.js +61 -0
  499. package/dist/lib/shared-theme-from-url.js.map +1 -0
  500. package/dist/lib/style-scope.d.ts +2 -2
  501. package/dist/lib/style-scope.js +6 -6
  502. package/dist/lib/style-scope.js.map +1 -0
  503. package/dist/lib/theme-share-url.d.ts +31 -0
  504. package/dist/lib/theme-share-url.js +116 -0
  505. package/dist/lib/theme-share-url.js.map +1 -0
  506. package/dist/lib/types.d.ts +39 -39
  507. package/dist/lib/types.js +3 -0
  508. package/dist/lib/types.js.map +1 -0
  509. package/dist/lib/use-controllable-state.d.ts +4 -7
  510. package/dist/lib/use-controllable-state.js +34 -21
  511. package/dist/lib/use-controllable-state.js.map +1 -0
  512. package/dist/lib/utils.d.ts +63 -34
  513. package/dist/lib/utils.js +134 -32
  514. package/dist/lib/utils.js.map +1 -0
  515. package/dist/styles.css +2 -1
  516. package/dist/styles.source.css +46 -16
  517. package/dist/utils/assign-ref.d.ts +3 -0
  518. package/dist/utils/assign-ref.js +13 -0
  519. package/dist/utils/assign-ref.js.map +1 -0
  520. package/package.json +53 -14
  521. package/src/components/ui/core/alert/alert.md +46 -0
  522. package/src/components/ui/core/avatar/avatar.md +30 -0
  523. package/src/components/ui/core/badge/badge.md +32 -0
  524. package/src/components/ui/core/banner/banner.md +51 -0
  525. package/src/components/ui/core/breadcrumb/breadcrumb.md +45 -0
  526. package/src/components/ui/core/button/button.md +93 -0
  527. package/src/components/ui/core/button-group/button-group.md +38 -0
  528. package/src/components/ui/core/checkbox/checkbox.md +37 -0
  529. package/src/components/ui/core/collapsible/collapsible.md +42 -0
  530. package/src/components/ui/core/count/count.md +33 -0
  531. package/src/components/ui/core/input/input.md +48 -0
  532. package/src/components/ui/core/label/label.md +35 -0
  533. package/src/components/ui/core/radio-group/radio-group.md +38 -0
  534. package/src/components/ui/core/separator/separator.md +32 -0
  535. package/src/components/ui/core/skeleton/skeleton.md +33 -0
  536. package/src/components/ui/core/slider/slider.md +41 -0
  537. package/src/components/ui/core/switch/switch.md +26 -0
  538. package/src/components/ui/core/textarea/textarea.md +42 -0
  539. package/src/components/ui/core/toggle/toggle.md +39 -0
  540. package/src/components/ui/core/tooltip/tooltip.md +41 -0
@@ -1,18 +1,16 @@
1
- import { ReactElement } from 'react';
2
- import { Row } from '@tanstack/react-table';
3
- import { VirtualItem } from '@tanstack/react-virtual';
1
+ import type { ReactElement } from "react";
2
+ import { type Row } from "@tanstack/react-table";
3
+ import type { VirtualItem } from "@tanstack/react-virtual";
4
4
  type DataGridRowProps<TData> = {
5
- row: Row<TData>;
6
- virtualRow: VirtualItem;
7
- headerGroupCount: number;
8
- gridTemplateColumns: string;
9
- pinnedColumnIds: Set<string>;
10
- lastPinnedColumnId: string | undefined;
11
- pinnedLeftByColumnId: Map<string, number>;
12
- customCellColumnIds: Set<string>;
13
- maxDepth: number;
14
- hasExpanding: boolean;
15
- onRowClick?: (row: Row<TData>) => void;
5
+ row: Row<TData>;
6
+ virtualRow: VirtualItem;
7
+ headerGroupCount: number;
8
+ pinnedColumnIds: Set<string>;
9
+ lastPinnedColumnId: string | undefined;
10
+ maxDepth: number;
11
+ hasExpanding: boolean;
12
+ striped?: boolean;
13
+ onRowClick?: (row: Row<TData>) => void;
16
14
  };
17
- declare function DataGridRow<TData>({ row, virtualRow, headerGroupCount, gridTemplateColumns, pinnedColumnIds, lastPinnedColumnId, pinnedLeftByColumnId, customCellColumnIds, maxDepth, hasExpanding, onRowClick, }: DataGridRowProps<TData>): ReactElement;
15
+ declare function DataGridRow<TData>({ row, virtualRow, headerGroupCount, pinnedColumnIds, lastPinnedColumnId, maxDepth, hasExpanding, striped, onRowClick }: DataGridRowProps<TData>): ReactElement;
18
16
  export { DataGridRow, type DataGridRowProps };
@@ -0,0 +1,118 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { IconChevronRight } from "@tabler/icons-react";
3
+ import { flexRender } from "@tanstack/react-table";
4
+ import { cn, focusState } from "../../../../lib/utils.js";
5
+ import { Button } from "../button/button.js";
6
+ import { DataGridCell } from "./data-grid-cell.js";
7
+ import { isDataGridRowHighlighted } from "./data-grid-selection-state.js";
8
+ import { PINNED_COLUMN_Z_INDEX, getTextValue, isAccessorColumn, isFromExpandToggleTarget, isFromIgnoredCellTarget } from "./data-grid.utils.js";
9
+ function DataGridRow({ row, virtualRow, headerGroupCount, pinnedColumnIds, lastPinnedColumnId, maxDepth, hasExpanding, striped = false, onRowClick }) {
10
+ const canExpand = row.getCanExpand();
11
+ const isRowInteractive = onRowClick !== undefined;
12
+ const isHighlighted = isDataGridRowHighlighted(row);
13
+ // Rows are virtualized and absolutely positioned, so DOM order doesn't match
14
+ // table order and `even:` selectors can't be used; stripe by the row's index instead.
15
+ const isStripedRow = striped && virtualRow.index % 2 === 1;
16
+ // A hover shade on read-only striped rows reads as another stripe, so only clickable rows get one.
17
+ const showHover = !striped || isRowInteractive;
18
+ const handleRowActivation = isRowInteractive ? (triggerTarget)=>{
19
+ if (isFromIgnoredCellTarget(triggerTarget)) return;
20
+ if (isFromExpandToggleTarget(triggerTarget)) return;
21
+ onRowClick?.(row);
22
+ } : undefined;
23
+ const visibleCells = row.getVisibleCells();
24
+ const resolvedTreeColumnIndex = visibleCells.findIndex((cell)=>isAccessorColumn(cell.column.columnDef));
25
+ const treeColumnIndex = resolvedTreeColumnIndex >= 0 ? resolvedTreeColumnIndex : 0;
26
+ return /*#__PURE__*/ _jsx("div", {
27
+ "data-slot": "data-grid-row",
28
+ role: "row",
29
+ "aria-rowindex": virtualRow.index + 1 + headerGroupCount,
30
+ "aria-expanded": canExpand ? row.getIsExpanded() : undefined,
31
+ "aria-selected": row.getIsSelected() ? true : undefined,
32
+ className: cn('group absolute left-0 right-0 grid border-b bg-base-background transition-colors', isStripedRow && 'bg-muted-background', isHighlighted && 'bg-medium-background', showHover && (isHighlighted ? 'hover:bg-medium-background-hover' : 'hover:bg-active-muted-background'), isRowInteractive && cn('cursor-pointer focus-visible:bg-active-muted-background', focusState)),
33
+ style: {
34
+ gridTemplateColumns: 'var(--data-grid-template-columns)',
35
+ height: virtualRow.size,
36
+ transform: `translateY(${virtualRow.start}px)`
37
+ },
38
+ tabIndex: isRowInteractive ? 0 : undefined,
39
+ onClick: handleRowActivation ? (event)=>handleRowActivation(event.target) : undefined,
40
+ onKeyDown: handleRowActivation ? (event)=>{
41
+ if (event.key !== 'Enter' && event.key !== ' ') return;
42
+ if (isFromIgnoredCellTarget(event.target)) return;
43
+ if (isFromExpandToggleTarget(event.target)) return;
44
+ event.preventDefault();
45
+ handleRowActivation(event.target);
46
+ } : undefined,
47
+ children: visibleCells.map((cell, cellIndex)=>{
48
+ const isPinned = pinnedColumnIds.has(cell.column.id);
49
+ const isLastPinned = isPinned && lastPinnedColumnId === cell.column.id;
50
+ const cellContext = cell.getContext();
51
+ const cellRenderer = cell.column.columnDef.cell;
52
+ let renderedCell;
53
+ let cellTitle;
54
+ if (typeof cellRenderer === 'function') {
55
+ const cellContent = cellRenderer(cellContext);
56
+ cellTitle = getTextValue(cellContent);
57
+ renderedCell = cellContent;
58
+ } else {
59
+ renderedCell = flexRender(cellRenderer, cellContext);
60
+ cellTitle = getTextValue(renderedCell);
61
+ }
62
+ const isTreeColumn = cellIndex === treeColumnIndex;
63
+ const depth = Math.min(row.depth, maxDepth);
64
+ const indentPx = isTreeColumn && depth > 0 ? depth * 16 : 0;
65
+ const showChevron = isTreeColumn && canExpand;
66
+ const showChevronSpacer = isTreeColumn && hasExpanding && !canExpand && depth > 0;
67
+ const pinnedStyle = isPinned ? {
68
+ position: 'sticky',
69
+ left: cell.column.getStart('left'),
70
+ zIndex: PINNED_COLUMN_Z_INDEX
71
+ } : undefined;
72
+ const cellStyle = indentPx > 0 || pinnedStyle ? {
73
+ ...pinnedStyle,
74
+ ...indentPx > 0 ? {
75
+ paddingInlineStart: `${indentPx + 12}px`
76
+ } : {}
77
+ } : undefined;
78
+ return /*#__PURE__*/ _jsxs(DataGridCell, {
79
+ "data-row-activation": isAccessorColumn(cell.column.columnDef) ? undefined : 'ignore',
80
+ isPinned: isPinned,
81
+ isLastPinned: isLastPinned,
82
+ colIndex: cellIndex + 1,
83
+ style: cellStyle,
84
+ children: [
85
+ showChevron && /*#__PURE__*/ _jsx(Button, {
86
+ size: "icon-sm",
87
+ variant: "ghost",
88
+ className: "mr-2",
89
+ "data-row-expand-toggle": "true",
90
+ onClick: (event)=>{
91
+ event.stopPropagation();
92
+ row.toggleExpanded();
93
+ },
94
+ "aria-label": row.getIsExpanded() ? 'Collapse row' : 'Expand row',
95
+ children: /*#__PURE__*/ _jsx(IconChevronRight, {
96
+ width: 5,
97
+ height: 8,
98
+ className: cn(row.getIsExpanded() && 'rotate-90'),
99
+ "aria-hidden": "true"
100
+ })
101
+ }),
102
+ showChevronSpacer && /*#__PURE__*/ _jsx("span", {
103
+ className: "mr-2 inline-block h-7 w-7 shrink-0",
104
+ "aria-hidden": "true"
105
+ }),
106
+ /*#__PURE__*/ _jsx("span", {
107
+ className: "block min-w-0 flex-1 not-has-[*]:truncate",
108
+ title: cellTitle,
109
+ children: renderedCell
110
+ })
111
+ ]
112
+ }, cell.id);
113
+ })
114
+ });
115
+ }
116
+ export { DataGridRow };
117
+
118
+ //# sourceMappingURL=data-grid-row.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/ui/core/data-grid/data-grid-row.tsx"],"sourcesContent":["import type {\n CSSProperties,\n KeyboardEvent,\n MouseEvent,\n ReactElement,\n ReactNode,\n} from 'react';\n\nimport { IconChevronRight } from '@tabler/icons-react';\nimport { type Cell, type Row, flexRender } from '@tanstack/react-table';\nimport type { VirtualItem } from '@tanstack/react-virtual';\n\nimport { cn, focusState } from '../../../../lib/utils';\nimport { Button } from '../button/button';\n\nimport { DataGridCell } from './data-grid-cell';\nimport { isDataGridRowHighlighted } from './data-grid-selection-state';\nimport {\n PINNED_COLUMN_Z_INDEX,\n getTextValue,\n isAccessorColumn,\n isFromExpandToggleTarget,\n isFromIgnoredCellTarget,\n} from './data-grid.utils';\n\ntype DataGridRowProps<TData> = {\n row: Row<TData>;\n virtualRow: VirtualItem;\n headerGroupCount: number;\n pinnedColumnIds: Set<string>;\n lastPinnedColumnId: string | undefined;\n maxDepth: number;\n hasExpanding: boolean;\n striped?: boolean;\n onRowClick?: (row: Row<TData>) => void;\n};\n\nfunction DataGridRow<TData>({\n row,\n virtualRow,\n headerGroupCount,\n pinnedColumnIds,\n lastPinnedColumnId,\n maxDepth,\n hasExpanding,\n striped = false,\n onRowClick,\n}: DataGridRowProps<TData>): ReactElement {\n const canExpand = row.getCanExpand();\n const isRowInteractive = onRowClick !== undefined;\n const isHighlighted = isDataGridRowHighlighted(row);\n // Rows are virtualized and absolutely positioned, so DOM order doesn't match\n // table order and `even:` selectors can't be used; stripe by the row's index instead.\n const isStripedRow = striped && virtualRow.index % 2 === 1;\n // A hover shade on read-only striped rows reads as another stripe, so only clickable rows get one.\n const showHover = !striped || isRowInteractive;\n\n const handleRowActivation = isRowInteractive\n ? (triggerTarget?: EventTarget | null) => {\n if (isFromIgnoredCellTarget(triggerTarget)) return;\n if (isFromExpandToggleTarget(triggerTarget)) return;\n onRowClick?.(row);\n }\n : undefined;\n\n const visibleCells = row.getVisibleCells();\n const resolvedTreeColumnIndex = visibleCells.findIndex((cell) =>\n isAccessorColumn(cell.column.columnDef)\n );\n const treeColumnIndex =\n resolvedTreeColumnIndex >= 0 ? resolvedTreeColumnIndex : 0;\n\n return (\n <div\n data-slot=\"data-grid-row\"\n role=\"row\"\n aria-rowindex={virtualRow.index + 1 + headerGroupCount}\n aria-expanded={canExpand ? row.getIsExpanded() : undefined}\n aria-selected={row.getIsSelected() ? true : undefined}\n className={cn(\n 'group absolute left-0 right-0 grid border-b bg-base-background transition-colors',\n isStripedRow && 'bg-muted-background',\n isHighlighted && 'bg-medium-background',\n showHover &&\n (isHighlighted\n ? 'hover:bg-medium-background-hover'\n : 'hover:bg-active-muted-background'),\n isRowInteractive &&\n cn(\n 'cursor-pointer focus-visible:bg-active-muted-background',\n focusState\n )\n )}\n style={{\n gridTemplateColumns: 'var(--data-grid-template-columns)',\n height: virtualRow.size,\n transform: `translateY(${virtualRow.start}px)`,\n }}\n tabIndex={isRowInteractive ? 0 : undefined}\n onClick={\n handleRowActivation\n ? (event: MouseEvent<HTMLDivElement>) =>\n handleRowActivation(event.target)\n : undefined\n }\n onKeyDown={\n handleRowActivation\n ? (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key !== 'Enter' && event.key !== ' ') return;\n if (isFromIgnoredCellTarget(event.target)) return;\n if (isFromExpandToggleTarget(event.target)) return;\n event.preventDefault();\n handleRowActivation(event.target);\n }\n : undefined\n }\n >\n {visibleCells.map((cell: Cell<TData, unknown>, cellIndex: number) => {\n const isPinned = pinnedColumnIds.has(cell.column.id);\n const isLastPinned = isPinned && lastPinnedColumnId === cell.column.id;\n const cellContext = cell.getContext();\n const cellRenderer = cell.column.columnDef.cell;\n let renderedCell: ReactNode;\n let cellTitle: string | undefined;\n\n if (typeof cellRenderer === 'function') {\n const cellContent = cellRenderer(cellContext);\n cellTitle = getTextValue(cellContent);\n renderedCell = cellContent;\n } else {\n renderedCell = flexRender(cellRenderer, cellContext);\n cellTitle = getTextValue(renderedCell);\n }\n\n const isTreeColumn = cellIndex === treeColumnIndex;\n const depth = Math.min(row.depth, maxDepth);\n const indentPx = isTreeColumn && depth > 0 ? depth * 16 : 0;\n const showChevron = isTreeColumn && canExpand;\n const showChevronSpacer =\n isTreeColumn && hasExpanding && !canExpand && depth > 0;\n\n const pinnedStyle: CSSProperties | undefined = isPinned\n ? {\n position: 'sticky',\n left: cell.column.getStart('left'),\n zIndex: PINNED_COLUMN_Z_INDEX,\n }\n : undefined;\n\n const cellStyle: CSSProperties | undefined =\n indentPx > 0 || pinnedStyle\n ? {\n ...pinnedStyle,\n ...(indentPx > 0\n ? { paddingInlineStart: `${indentPx + 12}px` }\n : {}),\n }\n : undefined;\n\n return (\n <DataGridCell\n key={cell.id}\n data-row-activation={\n isAccessorColumn(cell.column.columnDef) ? undefined : 'ignore'\n }\n isPinned={isPinned}\n isLastPinned={isLastPinned}\n colIndex={cellIndex + 1}\n style={cellStyle}\n >\n {showChevron && (\n <Button\n size=\"icon-sm\"\n variant=\"ghost\"\n className=\"mr-2\"\n data-row-expand-toggle=\"true\"\n onClick={(event: MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n row.toggleExpanded();\n }}\n aria-label={row.getIsExpanded() ? 'Collapse row' : 'Expand row'}\n >\n <IconChevronRight\n width={5}\n height={8}\n className={cn(row.getIsExpanded() && 'rotate-90')}\n aria-hidden=\"true\"\n />\n </Button>\n )}\n {showChevronSpacer && (\n <span\n className=\"mr-2 inline-block h-7 w-7 shrink-0\"\n aria-hidden=\"true\"\n />\n )}\n <span\n className=\"block min-w-0 flex-1 not-has-[*]:truncate\"\n title={cellTitle}\n >\n {renderedCell}\n </span>\n </DataGridCell>\n );\n })}\n </div>\n );\n}\n\nexport { DataGridRow, type DataGridRowProps };\n"],"names":["IconChevronRight","flexRender","cn","focusState","Button","DataGridCell","isDataGridRowHighlighted","PINNED_COLUMN_Z_INDEX","getTextValue","isAccessorColumn","isFromExpandToggleTarget","isFromIgnoredCellTarget","DataGridRow","row","virtualRow","headerGroupCount","pinnedColumnIds","lastPinnedColumnId","maxDepth","hasExpanding","striped","onRowClick","canExpand","getCanExpand","isRowInteractive","undefined","isHighlighted","isStripedRow","index","showHover","handleRowActivation","triggerTarget","visibleCells","getVisibleCells","resolvedTreeColumnIndex","findIndex","cell","column","columnDef","treeColumnIndex","div","data-slot","role","aria-rowindex","aria-expanded","getIsExpanded","aria-selected","getIsSelected","className","style","gridTemplateColumns","height","size","transform","start","tabIndex","onClick","event","target","onKeyDown","key","preventDefault","map","cellIndex","isPinned","has","id","isLastPinned","cellContext","getContext","cellRenderer","renderedCell","cellTitle","cellContent","isTreeColumn","depth","Math","min","indentPx","showChevron","showChevronSpacer","pinnedStyle","position","left","getStart","zIndex","cellStyle","paddingInlineStart","data-row-activation","colIndex","variant","data-row-expand-toggle","stopPropagation","toggleExpanded","aria-label","width","aria-hidden","span","title"],"mappings":";AAQA,SAASA,gBAAgB,QAAQ,sBAAsB;AACvD,SAA8BC,UAAU,QAAQ,wBAAwB;AAGxE,SAASC,EAAE,EAAEC,UAAU,QAAQ,2BAAwB;AACvD,SAASC,MAAM,QAAQ,sBAAmB;AAE1C,SAASC,YAAY,QAAQ,sBAAmB;AAChD,SAASC,wBAAwB,QAAQ,iCAA8B;AACvE,SACEC,qBAAqB,EACrBC,YAAY,EACZC,gBAAgB,EAChBC,wBAAwB,EACxBC,uBAAuB,QAClB,uBAAoB;AAc3B,SAASC,YAAmB,EAC1BC,GAAG,EACHC,UAAU,EACVC,gBAAgB,EAChBC,eAAe,EACfC,kBAAkB,EAClBC,QAAQ,EACRC,YAAY,EACZC,UAAU,KAAK,EACfC,UAAU,EACc;IACxB,MAAMC,YAAYT,IAAIU,YAAY;IAClC,MAAMC,mBAAmBH,eAAeI;IACxC,MAAMC,gBAAgBpB,yBAAyBO;IAC/C,6EAA6E;IAC7E,sFAAsF;IACtF,MAAMc,eAAeP,WAAWN,WAAWc,KAAK,GAAG,MAAM;IACzD,mGAAmG;IACnG,MAAMC,YAAY,CAACT,WAAWI;IAE9B,MAAMM,sBAAsBN,mBACxB,CAACO;QACC,IAAIpB,wBAAwBoB,gBAAgB;QAC5C,IAAIrB,yBAAyBqB,gBAAgB;QAC7CV,aAAaR;IACf,IACAY;IAEJ,MAAMO,eAAenB,IAAIoB,eAAe;IACxC,MAAMC,0BAA0BF,aAAaG,SAAS,CAAC,CAACC,OACtD3B,iBAAiB2B,KAAKC,MAAM,CAACC,SAAS;IAExC,MAAMC,kBACJL,2BAA2B,IAAIA,0BAA0B;IAE3D,qBACE,KAACM;QACCC,aAAU;QACVC,MAAK;QACLC,iBAAe7B,WAAWc,KAAK,GAAG,IAAIb;QACtC6B,iBAAetB,YAAYT,IAAIgC,aAAa,KAAKpB;QACjDqB,iBAAejC,IAAIkC,aAAa,KAAK,OAAOtB;QAC5CuB,WAAW9C,GACT,oFACAyB,gBAAgB,uBAChBD,iBAAiB,wBACjBG,aACGH,CAAAA,gBACG,qCACA,kCAAiC,GACvCF,oBACEtB,GACE,2DACAC;QAGN8C,OAAO;YACLC,qBAAqB;YACrBC,QAAQrC,WAAWsC,IAAI;YACvBC,WAAW,CAAC,WAAW,EAAEvC,WAAWwC,KAAK,CAAC,GAAG,CAAC;QAChD;QACAC,UAAU/B,mBAAmB,IAAIC;QACjC+B,SACE1B,sBACI,CAAC2B,QACC3B,oBAAoB2B,MAAMC,MAAM,IAClCjC;QAENkC,WACE7B,sBACI,CAAC2B;YACC,IAAIA,MAAMG,GAAG,KAAK,WAAWH,MAAMG,GAAG,KAAK,KAAK;YAChD,IAAIjD,wBAAwB8C,MAAMC,MAAM,GAAG;YAC3C,IAAIhD,yBAAyB+C,MAAMC,MAAM,GAAG;YAC5CD,MAAMI,cAAc;YACpB/B,oBAAoB2B,MAAMC,MAAM;QAClC,IACAjC;kBAGLO,aAAa8B,GAAG,CAAC,CAAC1B,MAA4B2B;YAC7C,MAAMC,WAAWhD,gBAAgBiD,GAAG,CAAC7B,KAAKC,MAAM,CAAC6B,EAAE;YACnD,MAAMC,eAAeH,YAAY/C,uBAAuBmB,KAAKC,MAAM,CAAC6B,EAAE;YACtE,MAAME,cAAchC,KAAKiC,UAAU;YACnC,MAAMC,eAAelC,KAAKC,MAAM,CAACC,SAAS,CAACF,IAAI;YAC/C,IAAImC;YACJ,IAAIC;YAEJ,IAAI,OAAOF,iBAAiB,YAAY;gBACtC,MAAMG,cAAcH,aAAaF;gBACjCI,YAAYhE,aAAaiE;gBACzBF,eAAeE;YACjB,OAAO;gBACLF,eAAetE,WAAWqE,cAAcF;gBACxCI,YAAYhE,aAAa+D;YAC3B;YAEA,MAAMG,eAAeX,cAAcxB;YACnC,MAAMoC,QAAQC,KAAKC,GAAG,CAAChE,IAAI8D,KAAK,EAAEzD;YAClC,MAAM4D,WAAWJ,gBAAgBC,QAAQ,IAAIA,QAAQ,KAAK;YAC1D,MAAMI,cAAcL,gBAAgBpD;YACpC,MAAM0D,oBACJN,gBAAgBvD,gBAAgB,CAACG,aAAaqD,QAAQ;YAExD,MAAMM,cAAyCjB,WAC3C;gBACEkB,UAAU;gBACVC,MAAM/C,KAAKC,MAAM,CAAC+C,QAAQ,CAAC;gBAC3BC,QAAQ9E;YACV,IACAkB;YAEJ,MAAM6D,YACJR,WAAW,KAAKG,cACZ;gBACE,GAAGA,WAAW;gBACd,GAAIH,WAAW,IACX;oBAAES,oBAAoB,GAAGT,WAAW,GAAG,EAAE,CAAC;gBAAC,IAC3C,CAAC,CAAC;YACR,IACArD;YAEN,qBACE,MAACpB;gBAECmF,uBACE/E,iBAAiB2B,KAAKC,MAAM,CAACC,SAAS,IAAIb,YAAY;gBAExDuC,UAAUA;gBACVG,cAAcA;gBACdsB,UAAU1B,YAAY;gBACtBd,OAAOqC;;oBAENP,6BACC,KAAC3E;wBACCgD,MAAK;wBACLsC,SAAQ;wBACR1C,WAAU;wBACV2C,0BAAuB;wBACvBnC,SAAS,CAACC;4BACRA,MAAMmC,eAAe;4BACrB/E,IAAIgF,cAAc;wBACpB;wBACAC,cAAYjF,IAAIgC,aAAa,KAAK,iBAAiB;kCAEnD,cAAA,KAAC7C;4BACC+F,OAAO;4BACP5C,QAAQ;4BACRH,WAAW9C,GAAGW,IAAIgC,aAAa,MAAM;4BACrCmD,eAAY;;;oBAIjBhB,mCACC,KAACiB;wBACCjD,WAAU;wBACVgD,eAAY;;kCAGhB,KAACC;wBACCjD,WAAU;wBACVkD,OAAO1B;kCAEND;;;eAvCEnC,KAAK8B,EAAE;QA2ClB;;AAGN;AAEA,SAAStD,WAAW,GAA0B"}
@@ -0,0 +1,15 @@
1
+ import type { Row, RowSelectionState } from "@tanstack/react-table";
2
+ type DataGridCheckboxState = boolean | "indeterminate";
3
+ type DataGridSelectionRow<TData> = Pick<Row<TData>, "getIsSelected" | "getIsSomeSelected" | "getIsAllSubRowsSelected"> & {
4
+ subRows: Pick<Row<TData>["subRows"], "length">;
5
+ };
6
+ declare function getDataGridCheckboxState<TData>(row: DataGridSelectionRow<TData>): DataGridCheckboxState;
7
+ declare function isDataGridRowHighlighted<TData>(row: DataGridSelectionRow<TData>): boolean;
8
+ type DataGridToggleableRow = {
9
+ getIsSelected: () => boolean;
10
+ toggleSelected: (value?: boolean) => void;
11
+ subRows: readonly DataGridToggleableRow[];
12
+ };
13
+ declare function selectDataGridRowTree(row: DataGridToggleableRow): void;
14
+ declare function countSelectedRowIds(rowSelection: RowSelectionState): number;
15
+ export { countSelectedRowIds, getDataGridCheckboxState, isDataGridRowHighlighted, selectDataGridRowTree, type DataGridCheckboxState, type DataGridSelectionRow };
@@ -0,0 +1,32 @@
1
+ function getDataGridCheckboxState(row) {
2
+ if (row.subRows.length === 0) {
3
+ return row.getIsSelected();
4
+ }
5
+ if (row.getIsAllSubRowsSelected()) {
6
+ return true;
7
+ }
8
+ if (row.getIsSomeSelected()) {
9
+ return 'indeterminate';
10
+ }
11
+ return false;
12
+ }
13
+ function isDataGridRowHighlighted(row) {
14
+ return row.getIsSelected() || row.getIsSomeSelected();
15
+ }
16
+ // TanStack ignores toggleSelected(true) when the row id is already selected.
17
+ // A partial parent is in that state, so its missing descendants must be selected directly.
18
+ function selectDataGridRowTree(row) {
19
+ if (!row.getIsSelected()) {
20
+ row.toggleSelected(true);
21
+ return;
22
+ }
23
+ for (const subRow of row.subRows){
24
+ selectDataGridRowTree(subRow);
25
+ }
26
+ }
27
+ function countSelectedRowIds(rowSelection) {
28
+ return Object.values(rowSelection).filter(Boolean).length;
29
+ }
30
+ export { countSelectedRowIds, getDataGridCheckboxState, isDataGridRowHighlighted, selectDataGridRowTree };
31
+
32
+ //# sourceMappingURL=data-grid-selection-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/ui/core/data-grid/data-grid-selection-state.ts"],"sourcesContent":["import type { Row, RowSelectionState } from '@tanstack/react-table';\n\ntype DataGridCheckboxState = boolean | 'indeterminate';\n\n// This is the slice of `Row<TData>` that selection reads.\ntype DataGridSelectionRow<TData> = Pick<\n Row<TData>,\n 'getIsSelected' | 'getIsSomeSelected' | 'getIsAllSubRowsSelected'\n> & {\n subRows: Pick<Row<TData>['subRows'], 'length'>;\n};\n\nfunction getDataGridCheckboxState<TData>(\n row: DataGridSelectionRow<TData>\n): DataGridCheckboxState {\n if (row.subRows.length === 0) {\n return row.getIsSelected();\n }\n\n if (row.getIsAllSubRowsSelected()) {\n return true;\n }\n\n if (row.getIsSomeSelected()) {\n return 'indeterminate';\n }\n\n return false;\n}\n\nfunction isDataGridRowHighlighted<TData>(\n row: DataGridSelectionRow<TData>\n): boolean {\n return row.getIsSelected() || row.getIsSomeSelected();\n}\n\ntype DataGridToggleableRow = {\n getIsSelected: () => boolean;\n toggleSelected: (value?: boolean) => void;\n subRows: readonly DataGridToggleableRow[];\n};\n\n// TanStack ignores toggleSelected(true) when the row id is already selected.\n// A partial parent is in that state, so its missing descendants must be selected directly.\nfunction selectDataGridRowTree(row: DataGridToggleableRow): void {\n if (!row.getIsSelected()) {\n row.toggleSelected(true);\n return;\n }\n\n for (const subRow of row.subRows) {\n selectDataGridRowTree(subRow);\n }\n}\n\nfunction countSelectedRowIds(rowSelection: RowSelectionState): number {\n return Object.values(rowSelection).filter(Boolean).length;\n}\n\nexport {\n countSelectedRowIds,\n getDataGridCheckboxState,\n isDataGridRowHighlighted,\n selectDataGridRowTree,\n type DataGridCheckboxState,\n type DataGridSelectionRow,\n};\n"],"names":["getDataGridCheckboxState","row","subRows","length","getIsSelected","getIsAllSubRowsSelected","getIsSomeSelected","isDataGridRowHighlighted","selectDataGridRowTree","toggleSelected","subRow","countSelectedRowIds","rowSelection","Object","values","filter","Boolean"],"mappings":"AAYA,SAASA,yBACPC,GAAgC;IAEhC,IAAIA,IAAIC,OAAO,CAACC,MAAM,KAAK,GAAG;QAC5B,OAAOF,IAAIG,aAAa;IAC1B;IAEA,IAAIH,IAAII,uBAAuB,IAAI;QACjC,OAAO;IACT;IAEA,IAAIJ,IAAIK,iBAAiB,IAAI;QAC3B,OAAO;IACT;IAEA,OAAO;AACT;AAEA,SAASC,yBACPN,GAAgC;IAEhC,OAAOA,IAAIG,aAAa,MAAMH,IAAIK,iBAAiB;AACrD;AAQA,6EAA6E;AAC7E,2FAA2F;AAC3F,SAASE,sBAAsBP,GAA0B;IACvD,IAAI,CAACA,IAAIG,aAAa,IAAI;QACxBH,IAAIQ,cAAc,CAAC;QACnB;IACF;IAEA,KAAK,MAAMC,UAAUT,IAAIC,OAAO,CAAE;QAChCM,sBAAsBE;IACxB;AACF;AAEA,SAASC,oBAAoBC,YAA+B;IAC1D,OAAOC,OAAOC,MAAM,CAACF,cAAcG,MAAM,CAACC,SAASb,MAAM;AAC3D;AAEA,SACEQ,mBAAmB,EACnBX,wBAAwB,EACxBO,wBAAwB,EACxBC,qBAAqB,GAGrB"}
@@ -0,0 +1,11 @@
1
+ import { type ReactElement } from "react";
2
+ import type { RowSelectionState } from "@tanstack/react-table";
3
+ import type { DataGridSelectionActions } from "./data-grid-selection.types";
4
+ type DataGridSelectionToolbarProps = {
5
+ selectedCount: number;
6
+ rowSelection: RowSelectionState;
7
+ selectionActions?: DataGridSelectionActions;
8
+ onClear: () => void;
9
+ };
10
+ declare function DataGridSelectionToolbar({ selectedCount, rowSelection, selectionActions, onClear }: DataGridSelectionToolbarProps): ReactElement;
11
+ export { DataGridSelectionToolbar };
@@ -0,0 +1,129 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect } from "react";
3
+ import { IconDotsVertical } from "@tabler/icons-react";
4
+ import { ActionToolbar, ActionToolbarAction, ActionToolbarActionClear, ActionToolbarActions, ActionToolbarPrimaryAction, ActionToolbarSelection, ActionToolbarSelectionSummary } from "../action-toolbar/action-toolbar.js";
5
+ import { Button } from "../button/button.js";
6
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../dropdown-menu/dropdown-menu.js";
7
+ const MAX_SECONDARY_ACTIONS = 5;
8
+ function DataGridSelectionToolbar({ selectedCount, rowSelection, selectionActions, onClear }) {
9
+ const primaryAction = selectionActions?.primaryAction;
10
+ const requestedSecondaryActions = selectionActions?.secondaryActions ?? [];
11
+ const secondaryActions = limitSecondaryActions(requestedSecondaryActions);
12
+ const menuActions = selectionActions?.menuActions ?? [];
13
+ const secondaryActionCount = requestedSecondaryActions.length;
14
+ useEffect(()=>{
15
+ if (secondaryActionCount <= MAX_SECONDARY_ACTIONS) return;
16
+ console.warn(`[Aura DataGrid] The selection toolbar shows at most ${MAX_SECONDARY_ACTIONS} secondary actions. ` + 'Move the rest to menuActions.');
17
+ }, [
18
+ secondaryActionCount
19
+ ]);
20
+ return(// z-[20]: cogs defines `.z-20` as box-shadow; EOS loads it and would shadow the toolbar.
21
+ /*#__PURE__*/ _jsx("div", {
22
+ className: "pointer-events-none sticky bottom-4 z-[20] flex justify-center px-4",
23
+ children: /*#__PURE__*/ _jsxs(ActionToolbar, {
24
+ selectedCount: selectedCount,
25
+ width: "full",
26
+ "aria-label": "Selection actions",
27
+ className: "pointer-events-auto",
28
+ children: [
29
+ /*#__PURE__*/ _jsxs(ActionToolbarSelection, {
30
+ "aria-label": "Selected rows",
31
+ children: [
32
+ /*#__PURE__*/ _jsx(ActionToolbarSelectionSummary, {}),
33
+ /*#__PURE__*/ _jsx(ActionToolbarActionClear, {
34
+ onClick: onClear
35
+ })
36
+ ]
37
+ }),
38
+ /*#__PURE__*/ _jsxs(ActionToolbarActions, {
39
+ "aria-label": "Actions",
40
+ children: [
41
+ menuActions.length > 0 ? /*#__PURE__*/ _jsx(DataGridSelectionMenu, {
42
+ actions: menuActions,
43
+ rowSelection: rowSelection
44
+ }) : null,
45
+ secondaryActions.map((action)=>/*#__PURE__*/ _jsx(DataGridSecondaryToolbarAction, {
46
+ action: action,
47
+ rowSelection: rowSelection
48
+ }, actionListKey(secondaryActions, action))),
49
+ primaryAction ? /*#__PURE__*/ _jsxs(ActionToolbarPrimaryAction, {
50
+ onClick: ()=>primaryAction.onClick(rowSelection),
51
+ children: [
52
+ primaryAction.icon ? /*#__PURE__*/ _jsx("span", {
53
+ "aria-hidden": "true",
54
+ children: primaryAction.icon
55
+ }) : null,
56
+ primaryAction.label
57
+ ]
58
+ }) : null
59
+ ]
60
+ })
61
+ ]
62
+ })
63
+ }));
64
+ }
65
+ function DataGridSecondaryToolbarAction({ action, rowSelection }) {
66
+ if (action.label != null) {
67
+ return /*#__PURE__*/ _jsxs(ActionToolbarAction, {
68
+ onClick: ()=>action.onClick(rowSelection),
69
+ children: [
70
+ action.icon ? /*#__PURE__*/ _jsx("span", {
71
+ "aria-hidden": "true",
72
+ children: action.icon
73
+ }) : null,
74
+ action.label
75
+ ]
76
+ });
77
+ }
78
+ return /*#__PURE__*/ _jsx(ActionToolbarAction, {
79
+ iconOnly: true,
80
+ "aria-label": action['aria-label'],
81
+ onClick: ()=>action.onClick(rowSelection),
82
+ children: /*#__PURE__*/ _jsx("span", {
83
+ "aria-hidden": "true",
84
+ children: action.icon
85
+ })
86
+ });
87
+ }
88
+ function DataGridSelectionMenu({ actions, rowSelection }) {
89
+ return /*#__PURE__*/ _jsxs(DropdownMenu, {
90
+ children: [
91
+ /*#__PURE__*/ _jsx(DropdownMenuTrigger, {
92
+ render: /*#__PURE__*/ _jsx(Button, {
93
+ variant: "ghostOnDark",
94
+ size: "icon",
95
+ "aria-label": "More actions",
96
+ children: /*#__PURE__*/ _jsx(IconDotsVertical, {
97
+ "aria-hidden": "true"
98
+ })
99
+ })
100
+ }),
101
+ /*#__PURE__*/ _jsx(DropdownMenuContent, {
102
+ side: "top",
103
+ align: "end",
104
+ children: actions.map((action)=>/*#__PURE__*/ _jsxs(DropdownMenuItem, {
105
+ onClick: ()=>action.onClick(rowSelection),
106
+ children: [
107
+ action.icon ? /*#__PURE__*/ _jsx("span", {
108
+ "aria-hidden": "true",
109
+ children: action.icon
110
+ }) : null,
111
+ action.label
112
+ ]
113
+ }, actionListKey(actions, action)))
114
+ })
115
+ ]
116
+ });
117
+ }
118
+ function actionListKey(actions, action) {
119
+ const name = action.label ?? action['aria-label'] ?? '';
120
+ const earlierDuplicates = actions.slice(0, actions.indexOf(action)).filter((candidate)=>(candidate.label ?? candidate['aria-label']) === name).length;
121
+ if (earlierDuplicates === 0) return name;
122
+ return `${name}-${earlierDuplicates + 1}`;
123
+ }
124
+ function limitSecondaryActions(actions) {
125
+ return actions.slice(0, MAX_SECONDARY_ACTIONS);
126
+ }
127
+ export { DataGridSelectionToolbar };
128
+
129
+ //# sourceMappingURL=data-grid-selection-toolbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/ui/core/data-grid/data-grid-selection-toolbar.tsx"],"sourcesContent":["import { useEffect, type ReactElement } from 'react';\n\nimport { IconDotsVertical } from '@tabler/icons-react';\nimport type { RowSelectionState } from '@tanstack/react-table';\n\nimport {\n ActionToolbar,\n ActionToolbarAction,\n ActionToolbarActionClear,\n ActionToolbarActions,\n ActionToolbarPrimaryAction,\n ActionToolbarSelection,\n ActionToolbarSelectionSummary,\n} from '../action-toolbar/action-toolbar';\nimport { Button } from '../button/button';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from '../dropdown-menu/dropdown-menu';\n\nimport type {\n DataGridSecondaryAction,\n DataGridSelectionAction,\n DataGridSelectionActions,\n} from './data-grid-selection.types';\n\ntype DataGridSelectionToolbarProps = {\n selectedCount: number;\n rowSelection: RowSelectionState;\n selectionActions?: DataGridSelectionActions;\n onClear: () => void;\n};\n\nconst MAX_SECONDARY_ACTIONS = 5;\n\nfunction DataGridSelectionToolbar({\n selectedCount,\n rowSelection,\n selectionActions,\n onClear,\n}: DataGridSelectionToolbarProps): ReactElement {\n const primaryAction = selectionActions?.primaryAction;\n const requestedSecondaryActions = selectionActions?.secondaryActions ?? [];\n const secondaryActions = limitSecondaryActions(requestedSecondaryActions);\n const menuActions = selectionActions?.menuActions ?? [];\n\n const secondaryActionCount = requestedSecondaryActions.length;\n\n useEffect(() => {\n if (secondaryActionCount <= MAX_SECONDARY_ACTIONS) return;\n console.warn(\n `[Aura DataGrid] The selection toolbar shows at most ${MAX_SECONDARY_ACTIONS} secondary actions. ` +\n 'Move the rest to menuActions.'\n );\n }, [secondaryActionCount]);\n\n return (\n // z-[20]: cogs defines `.z-20` as box-shadow; EOS loads it and would shadow the toolbar.\n <div className=\"pointer-events-none sticky bottom-4 z-[20] flex justify-center px-4\">\n <ActionToolbar\n selectedCount={selectedCount}\n width=\"full\"\n aria-label=\"Selection actions\"\n className=\"pointer-events-auto\"\n >\n <ActionToolbarSelection aria-label=\"Selected rows\">\n <ActionToolbarSelectionSummary />\n <ActionToolbarActionClear onClick={onClear} />\n </ActionToolbarSelection>\n <ActionToolbarActions aria-label=\"Actions\">\n {menuActions.length > 0 ? (\n <DataGridSelectionMenu\n actions={menuActions}\n rowSelection={rowSelection}\n />\n ) : null}\n {secondaryActions.map((action: DataGridSecondaryAction) => (\n <DataGridSecondaryToolbarAction\n key={actionListKey(secondaryActions, action)}\n action={action}\n rowSelection={rowSelection}\n />\n ))}\n {primaryAction ? (\n <ActionToolbarPrimaryAction\n onClick={() => primaryAction.onClick(rowSelection)}\n >\n {primaryAction.icon ? (\n <span aria-hidden=\"true\">{primaryAction.icon}</span>\n ) : null}\n {primaryAction.label}\n </ActionToolbarPrimaryAction>\n ) : null}\n </ActionToolbarActions>\n </ActionToolbar>\n </div>\n );\n}\n\nfunction DataGridSecondaryToolbarAction({\n action,\n rowSelection,\n}: {\n action: DataGridSecondaryAction;\n rowSelection: RowSelectionState;\n}): ReactElement {\n if (action.label != null) {\n return (\n <ActionToolbarAction onClick={() => action.onClick(rowSelection)}>\n {action.icon ? <span aria-hidden=\"true\">{action.icon}</span> : null}\n {action.label}\n </ActionToolbarAction>\n );\n }\n\n return (\n <ActionToolbarAction\n iconOnly\n aria-label={action['aria-label']}\n onClick={() => action.onClick(rowSelection)}\n >\n <span aria-hidden=\"true\">{action.icon}</span>\n </ActionToolbarAction>\n );\n}\n\nfunction DataGridSelectionMenu({\n actions,\n rowSelection,\n}: {\n actions: readonly DataGridSelectionAction[];\n rowSelection: RowSelectionState;\n}): ReactElement {\n return (\n <DropdownMenu>\n <DropdownMenuTrigger\n render={\n <Button variant=\"ghostOnDark\" size=\"icon\" aria-label=\"More actions\">\n <IconDotsVertical aria-hidden=\"true\" />\n </Button>\n }\n />\n <DropdownMenuContent side=\"top\" align=\"end\">\n {actions.map((action: DataGridSelectionAction) => (\n <DropdownMenuItem\n key={actionListKey(actions, action)}\n onClick={() => action.onClick(rowSelection)}\n >\n {action.icon ? <span aria-hidden=\"true\">{action.icon}</span> : null}\n {action.label}\n </DropdownMenuItem>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\nfunction actionListKey<T extends { label?: string; 'aria-label'?: string }>(\n actions: readonly T[],\n action: T\n): string {\n const name = action.label ?? action['aria-label'] ?? '';\n const earlierDuplicates = actions\n .slice(0, actions.indexOf(action))\n .filter(\n (candidate) => (candidate.label ?? candidate['aria-label']) === name\n ).length;\n if (earlierDuplicates === 0) return name;\n return `${name}-${earlierDuplicates + 1}`;\n}\n\nfunction limitSecondaryActions(\n actions: readonly DataGridSecondaryAction[]\n): readonly DataGridSecondaryAction[] {\n return actions.slice(0, MAX_SECONDARY_ACTIONS);\n}\n\nexport { DataGridSelectionToolbar };\n"],"names":["useEffect","IconDotsVertical","ActionToolbar","ActionToolbarAction","ActionToolbarActionClear","ActionToolbarActions","ActionToolbarPrimaryAction","ActionToolbarSelection","ActionToolbarSelectionSummary","Button","DropdownMenu","DropdownMenuContent","DropdownMenuItem","DropdownMenuTrigger","MAX_SECONDARY_ACTIONS","DataGridSelectionToolbar","selectedCount","rowSelection","selectionActions","onClear","primaryAction","requestedSecondaryActions","secondaryActions","limitSecondaryActions","menuActions","secondaryActionCount","length","console","warn","div","className","width","aria-label","onClick","DataGridSelectionMenu","actions","map","action","DataGridSecondaryToolbarAction","actionListKey","icon","span","aria-hidden","label","iconOnly","render","variant","size","side","align","name","earlierDuplicates","slice","indexOf","filter","candidate"],"mappings":"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"}
@@ -0,0 +1,24 @@
1
+ import type { ReactNode } from "react";
2
+ import type { RowSelectionState } from "@tanstack/react-table";
3
+ type DataGridSelectionActionClick = (rowSelection: RowSelectionState) => void;
4
+ type DataGridSelectionAction = {
5
+ label: string;
6
+ icon?: ReactNode;
7
+ onClick: DataGridSelectionActionClick;
8
+ };
9
+ type DataGridSecondaryAction = {
10
+ onClick: DataGridSelectionActionClick;
11
+ } & ({
12
+ label: string;
13
+ icon?: ReactNode;
14
+ } | {
15
+ icon: ReactNode;
16
+ label?: undefined;
17
+ "aria-label": string;
18
+ });
19
+ type DataGridSelectionActions = {
20
+ primaryAction?: DataGridSelectionAction;
21
+ secondaryActions?: readonly DataGridSecondaryAction[];
22
+ menuActions?: readonly DataGridSelectionAction[];
23
+ };
24
+ export type { DataGridSecondaryAction, DataGridSelectionAction, DataGridSelectionActions };
@@ -0,0 +1,3 @@
1
+ export { };
2
+
3
+ //# sourceMappingURL=data-grid-selection.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/components/ui/core/data-grid/data-grid-selection.types.ts"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport type { RowSelectionState } from '@tanstack/react-table';\n\n// The grid passes the current selection.\ntype DataGridSelectionActionClick = (rowSelection: RowSelectionState) => void;\n\ntype DataGridSelectionAction = {\n label: string;\n icon?: ReactNode;\n onClick: DataGridSelectionActionClick;\n};\n\ntype DataGridSecondaryAction = {\n onClick: DataGridSelectionActionClick;\n} & (\n | { label: string; icon?: ReactNode }\n | { icon: ReactNode; label?: undefined; 'aria-label': string }\n);\n\ntype DataGridSelectionActions = {\n primaryAction?: DataGridSelectionAction;\n secondaryActions?: readonly DataGridSecondaryAction[];\n menuActions?: readonly DataGridSelectionAction[];\n};\n\nexport type {\n DataGridSecondaryAction,\n DataGridSelectionAction,\n DataGridSelectionActions,\n};\n"],"names":[],"mappings":"AA0BA,WAIE"}
@@ -1,43 +1,133 @@
1
- import { ReactElement, ReactNode, RefObject } from 'react';
2
- import { ColumnDef, ExpandedState, FilterFnOption, Row, SortingState } from '@tanstack/react-table';
3
- type DataGridSize = 'default' | 'compact';
1
+ import { type ComponentProps, type ComponentRef, type ForwardRefExoticComponent, type ReactElement, type ReactNode, type RefAttributes, type RefObject } from "react";
2
+ import { type ColumnDef, type ColumnFiltersState, type ColumnSizingState, type ExpandedState, type FilterFnOption, type PaginationState, type Row, type RowSelectionState, type Table, type SortingState } from "@tanstack/react-table";
3
+ import { Button } from "../button/button";
4
+ import { Search } from "../search/search";
5
+ import type { DataGridSelectionActions } from "./data-grid-selection.types";
6
+ type DataGridContextValue = {
7
+ searchValue: string;
8
+ setSearchValue: (value: string) => void;
9
+ filteredCount?: number;
10
+ totalCount?: number;
11
+ };
12
+ type DataGridSize = "default" | "compact";
13
+ type DataGridQueryMode = "client" | "server";
14
+ type DataGridLoadingVariant = "skeleton" | "none";
15
+ type DataGridStateCopyFields = {
16
+ title: string;
17
+ description: string;
18
+ action: ReactNode;
19
+ };
20
+ type AtLeastOne<
21
+ T,
22
+ Keys extends keyof T = keyof T
23
+ > = Keys extends keyof T ? Pick<Required<T>, Keys> & Partial<Omit<T, Keys>> : never;
24
+ type DataGridStateCopy = AtLeastOne<DataGridStateCopyFields>;
25
+ type DataGridLabels = {
26
+ clearSearch: string;
27
+ clearFilters: string;
28
+ };
29
+ type DataGridLoadingCellContext = {
30
+ rowIndex: number;
31
+ columnId: string;
32
+ columnIndex: number;
33
+ size: DataGridSize;
34
+ };
4
35
  type DataGridHandle = {
5
- scrollToRow: (index: number) => void;
6
- resetSorting: () => void;
36
+ scrollToRow: (index: number) => void;
37
+ resetSorting: () => void;
38
+ resetSelection: () => void;
39
+ resetSearch: () => void;
7
40
  };
8
41
  type DataGridBaseProps<TData> = {
9
- data: TData[];
10
- columns: ColumnDef<TData>[];
11
- getRowId?: (originalRow: TData, index: number) => string;
12
- rowCount?: number;
13
- globalFilterFn?: FilterFnOption<TData>;
14
- enableSorting?: boolean;
15
- manualSorting?: boolean;
16
- sorting?: SortingState;
17
- defaultSorting?: SortingState;
18
- onSortingChange?: (value: SortingState) => void;
19
- getSubRows?: (row: TData, index: number) => TData[] | undefined;
20
- expanded?: ExpandedState;
21
- defaultExpanded?: ExpandedState;
22
- onExpandedChange?: (value: ExpandedState) => void;
23
- getRowCanExpand?: (row: Row<TData>) => boolean;
24
- maxDepth?: number;
25
- pinnedColumns?: string[];
26
- gridRef?: RefObject<DataGridHandle | null>;
27
- size?: DataGridSize;
28
- children?: ReactNode;
29
- className?: string;
30
- onRowClick?: (row: Row<TData>) => void;
31
- rowHeight?: number;
32
- headerHeight?: number;
42
+ data: TData[];
43
+ columns: ColumnDef<TData>[];
44
+ getRowId?: (originalRow: TData, index: number) => string;
45
+ rowCount?: number;
46
+ globalFilterFn?: FilterFnOption<TData>;
47
+ enableRowSelection?: boolean | ((row: Row<TData>) => boolean);
48
+ enableSorting?: boolean;
49
+ enableColumnResizing?: boolean;
50
+ columnGrow?: boolean;
51
+ columnSizing?: ColumnSizingState;
52
+ defaultColumnSizing?: ColumnSizingState;
53
+ onColumnSizingChange?: (value: ColumnSizingState) => void;
54
+ manualPagination?: boolean;
55
+ manualSorting?: boolean;
56
+ rowSelection?: RowSelectionState;
57
+ defaultRowSelection?: RowSelectionState;
58
+ onRowSelectionChange?: (value: RowSelectionState) => void;
59
+ selectionActions?: DataGridSelectionActions;
60
+ sorting?: SortingState;
61
+ defaultSorting?: SortingState;
62
+ onSortingChange?: (value: SortingState) => void;
63
+ columnFilters?: ColumnFiltersState;
64
+ defaultColumnFilters?: ColumnFiltersState;
65
+ onColumnFiltersChange?: (value: ColumnFiltersState) => void;
66
+ pagination?: PaginationState;
67
+ defaultPagination?: PaginationState;
68
+ onPaginationChange?: (value: PaginationState) => void;
69
+ getSubRows?: (row: TData, index: number) => TData[] | undefined;
70
+ expanded?: ExpandedState;
71
+ defaultExpanded?: ExpandedState;
72
+ onExpandedChange?: (value: ExpandedState) => void;
73
+ getRowCanExpand?: (row: Row<TData>) => boolean;
74
+ maxDepth?: number;
75
+ /** Shades every other row to help scan long, read-only tables. */
76
+ striped?: boolean;
77
+ /** Shows column titles semibold in the primary text color instead of muted. */
78
+ emphasizeHeader?: boolean;
79
+ pinnedColumns?: string[];
80
+ gridRef?: RefObject<DataGridHandle | null>;
81
+ size?: DataGridSize;
82
+ children?: ReactNode;
83
+ className?: string;
84
+ onRowClick?: (row: Row<TData>) => void;
85
+ searchValue?: string;
86
+ defaultSearchValue?: string;
87
+ onSearchValueChange?: (value: string) => void;
88
+ queryMode?: DataGridQueryMode;
89
+ loading?: boolean;
90
+ loadingVariant?: DataGridLoadingVariant;
91
+ loadingRowCount?: number;
92
+ renderLoadingCell?: (ctx: DataGridLoadingCellContext) => ReactNode;
93
+ emptyState?: ReactNode | DataGridStateCopy;
94
+ noResultsState?: ReactNode | DataGridStateCopy;
95
+ onClearSearch?: () => void;
96
+ onClearFilters?: () => void;
97
+ labels?: Partial<DataGridLabels>;
98
+ filteredResultCount?: number;
99
+ totalResultCount?: number;
100
+ rowHeight?: number;
101
+ headerHeight?: number;
33
102
  };
34
103
  type DataGridAccessibleNameProps = {
35
- 'aria-label': string;
36
- 'aria-labelledby'?: string;
104
+ "aria-label": string;
105
+ "aria-labelledby"?: string;
37
106
  } | {
38
- 'aria-labelledby': string;
39
- 'aria-label'?: string;
107
+ "aria-labelledby": string;
108
+ "aria-label"?: string;
40
109
  };
41
110
  type DataGridProps<TData> = DataGridBaseProps<TData> & DataGridAccessibleNameProps;
42
- declare function DataGrid<TData>({ data, columns, getRowId, rowCount, globalFilterFn, enableSorting, manualSorting, sorting, defaultSorting, onSortingChange, getSubRows, expanded, defaultExpanded, onExpandedChange, getRowCanExpand, maxDepth, pinnedColumns, gridRef, size, children, className, onRowClick, rowHeight, headerHeight, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, }: DataGridProps<TData>): ReactElement;
43
- export { DataGrid, type DataGridHandle };
111
+ declare function DataGrid<TData>({ data, columns, getRowId, rowCount, globalFilterFn, enableRowSelection, enableSorting, enableColumnResizing, columnGrow, columnSizing, defaultColumnSizing, onColumnSizingChange, manualPagination, manualSorting, rowSelection, defaultRowSelection, onRowSelectionChange, selectionActions, sorting, defaultSorting, onSortingChange, columnFilters, defaultColumnFilters, onColumnFiltersChange, pagination, defaultPagination, onPaginationChange, getSubRows, expanded, defaultExpanded, onExpandedChange, getRowCanExpand, maxDepth, striped, emphasizeHeader, pinnedColumns, gridRef, size, children, className, onRowClick, searchValue, defaultSearchValue, onSearchValueChange, queryMode, loading, loadingVariant, loadingRowCount, renderLoadingCell, emptyState, noResultsState, filteredResultCount, totalResultCount, onClearSearch, onClearFilters, labels: labelOverrides, rowHeight, headerHeight, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy }: DataGridProps<TData>): ReactElement;
112
+ declare function DataGridCheckboxHeader<TData>({ table }: {
113
+ table: Table<TData>;
114
+ }): ReactElement;
115
+ declare function DataGridCheckboxCell<TData>({ row }: {
116
+ row: Row<TData>;
117
+ }): ReactElement;
118
+ type DataGridSearchProps = Omit<ComponentProps<typeof Search>, "value" | "onChange" | "onClear">;
119
+ declare const DataGridSearch: ForwardRefExoticComponent<DataGridSearchProps & RefAttributes<ComponentRef<typeof Search>>>;
120
+ type DataGridResultCountProps = Omit<ComponentProps<"output">, "children"> & {
121
+ formatLabel?: (filteredCount: number, totalCount?: number) => ReactNode;
122
+ };
123
+ declare const DataGridResultCount: ForwardRefExoticComponent<DataGridResultCountProps & RefAttributes<HTMLOutputElement>>;
124
+ type DataGridFilterTriggerProps = ComponentProps<typeof Button> & {
125
+ activeCount?: number;
126
+ label?: string;
127
+ };
128
+ declare const DataGridFilterTrigger: ForwardRefExoticComponent<DataGridFilterTriggerProps & RefAttributes<ComponentRef<typeof Button>>>;
129
+ declare function useDataGridContext(): DataGridContextValue;
130
+ export { DataGrid, DataGridCheckboxCell, DataGridCheckboxHeader, DataGridResultCount, DataGridFilterTrigger, DataGridSearch, useDataGridContext, type DataGridContextValue, type DataGridHandle, type DataGridLabels };
131
+ export { DataGridFilterPanel, type DataGridFilterColumn, type DataGridFilterPanelLabels } from "./data-grid-filter-panel";
132
+ export { DataGridFooter, DataGridFooterEnd, DataGridFooterStart } from "./data-grid-footer";
133
+ export { DataGridHeader, DataGridHeaderActions, DataGridHeaderEnd, DataGridHeaderStart, DataGridSubtitle, DataGridTitle } from "./data-grid-header";
@@ -1,11 +1,11 @@
1
- import { ColumnDef } from '@tanstack/react-table';
1
+ import type { ColumnDef } from "@tanstack/react-table";
2
2
  type AssetRow = {
3
- id: string;
4
- name: string;
5
- type: string;
6
- status: 'Running' | 'Stopped' | 'Needs attention';
7
- area: string;
8
- updated: string;
3
+ id: string;
4
+ name: string;
5
+ type: string;
6
+ status: "Running" | "Stopped" | "Needs attention";
7
+ area: string;
8
+ updated: string;
9
9
  };
10
10
  declare const assetRows: AssetRow[];
11
11
  declare const assetColumns: ColumnDef<AssetRow>[];