@dmsi/wedgekit-react 0.0.1242 → 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 (643) hide show
  1. package/README.md +4 -32
  2. package/dist/classNames.d.ts +41 -0
  3. package/dist/classNames.d.ts.map +1 -0
  4. package/dist/components/AccessCard.d.ts +14 -0
  5. package/dist/components/AccessCard.d.ts.map +1 -0
  6. package/dist/components/AccessCardGroup.d.ts +15 -0
  7. package/dist/components/AccessCardGroup.d.ts.map +1 -0
  8. package/dist/components/AccessChangerTabItem.d.ts +11 -0
  9. package/dist/components/AccessChangerTabItem.d.ts.map +1 -0
  10. package/dist/components/Accordion.d.ts +15 -0
  11. package/dist/components/Accordion.d.ts.map +1 -0
  12. package/dist/components/Alert.d.ts +13 -0
  13. package/dist/components/Alert.d.ts.map +1 -0
  14. package/dist/components/Breadcrumbs.d.ts +19 -0
  15. package/dist/components/Breadcrumbs.d.ts.map +1 -0
  16. package/dist/components/Button.d.ts +46 -0
  17. package/dist/components/Button.d.ts.map +1 -0
  18. package/dist/components/CalendarRange.d.ts +28 -0
  19. package/dist/components/CalendarRange.d.ts.map +1 -0
  20. package/dist/components/Caption.d.ts +15 -0
  21. package/dist/components/Caption.d.ts.map +1 -0
  22. package/dist/components/Card.d.ts +28 -0
  23. package/dist/components/Card.d.ts.map +1 -0
  24. package/dist/components/Checkbox.d.ts +12 -0
  25. package/dist/components/Checkbox.d.ts.map +1 -0
  26. package/dist/components/CompactImagesPreview.d.ts +25 -0
  27. package/dist/components/CompactImagesPreview.d.ts.map +1 -0
  28. package/dist/components/ContentTab.d.ts +12 -0
  29. package/dist/components/ContentTab.d.ts.map +1 -0
  30. package/dist/components/ContentTabs.d.ts +23 -0
  31. package/dist/components/ContentTabs.d.ts.map +1 -0
  32. package/dist/components/DMSiLogo.d.ts +2 -0
  33. package/dist/components/DMSiLogo.d.ts.map +1 -0
  34. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.d.ts +8 -0
  35. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.d.ts.map +1 -0
  36. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.d.ts +9 -0
  37. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.d.ts.map +1 -0
  38. package/dist/components/DataGrid/PinnedColumns.d.ts +26 -0
  39. package/dist/components/DataGrid/PinnedColumns.d.ts.map +1 -0
  40. package/dist/components/DataGrid/TableBody/LoadingCell.d.ts +7 -0
  41. package/dist/components/DataGrid/TableBody/LoadingCell.d.ts.map +1 -0
  42. package/dist/components/DataGrid/TableBody/TableBodyRow.d.ts +22 -0
  43. package/dist/components/DataGrid/TableBody/TableBodyRow.d.ts.map +1 -0
  44. package/dist/components/DataGrid/TableBody/index.d.ts +26 -0
  45. package/dist/components/DataGrid/TableBody/index.d.ts.map +1 -0
  46. package/dist/components/DataGrid/index.d.ts +5 -0
  47. package/dist/components/DataGrid/index.d.ts.map +1 -0
  48. package/dist/components/DataGrid/types.d.ts +74 -0
  49. package/dist/components/DataGrid/types.d.ts.map +1 -0
  50. package/dist/components/DataGrid/utils.d.ts +3 -0
  51. package/dist/components/DataGrid/utils.d.ts.map +1 -0
  52. package/dist/components/DataGridCell.d.ts +46 -0
  53. package/dist/components/DataGridCell.d.ts.map +1 -0
  54. package/dist/components/DataTable.d.ts +36 -0
  55. package/dist/components/DataTable.d.ts.map +1 -0
  56. package/dist/components/DateInput.d.ts +38 -0
  57. package/dist/components/DateInput.d.ts.map +1 -0
  58. package/dist/components/DateRangeInput.d.ts +36 -0
  59. package/dist/components/DateRangeInput.d.ts.map +1 -0
  60. package/dist/components/DebugJson.d.ts +5 -0
  61. package/dist/components/DebugJson.d.ts.map +1 -0
  62. package/dist/components/Display.d.ts +14 -0
  63. package/dist/components/Display.d.ts.map +1 -0
  64. package/dist/components/EditingContext.d.ts +14 -0
  65. package/dist/components/EditingContext.d.ts.map +1 -0
  66. package/dist/components/EmblaCarousel/ArrowButtons.d.ts +9 -0
  67. package/dist/components/EmblaCarousel/ArrowButtons.d.ts.map +1 -0
  68. package/dist/components/EmblaCarousel/SelectedSnapDisplay.d.ts +7 -0
  69. package/dist/components/EmblaCarousel/SelectedSnapDisplay.d.ts.map +1 -0
  70. package/dist/components/EmblaCarousel/index.d.ts +20 -0
  71. package/dist/components/EmblaCarousel/index.d.ts.map +1 -0
  72. package/dist/components/EmblaCarousel/usePrevNextButtons.d.ts +10 -0
  73. package/dist/components/EmblaCarousel/usePrevNextButtons.d.ts.map +1 -0
  74. package/dist/components/EmblaCarousel/useSelectedSnapDisplay.d.ts +8 -0
  75. package/dist/components/EmblaCarousel/useSelectedSnapDisplay.d.ts.map +1 -0
  76. package/dist/components/EmptyCartIcon.d.ts +2 -0
  77. package/dist/components/EmptyCartIcon.d.ts.map +1 -0
  78. package/dist/components/FilterGroup.d.ts +29 -0
  79. package/dist/components/FilterGroup.d.ts.map +1 -0
  80. package/dist/components/FullViewportBox.d.ts +6 -0
  81. package/dist/components/FullViewportBox.d.ts.map +1 -0
  82. package/dist/components/Grid.d.ts +22 -0
  83. package/dist/components/Grid.d.ts.map +1 -0
  84. package/dist/components/Heading.d.ts +15 -0
  85. package/dist/components/Heading.d.ts.map +1 -0
  86. package/dist/components/HorizontalDivider.d.ts +8 -0
  87. package/dist/components/HorizontalDivider.d.ts.map +1 -0
  88. package/dist/components/Icon.d.ts +11 -0
  89. package/dist/components/Icon.d.ts.map +1 -0
  90. package/dist/components/ImagePlaceholder.d.ts +3 -0
  91. package/dist/components/ImagePlaceholder.d.ts.map +1 -0
  92. package/dist/components/Input.d.ts +50 -0
  93. package/dist/components/Input.d.ts.map +1 -0
  94. package/dist/components/InputGroup.d.ts +12 -0
  95. package/dist/components/InputGroup.d.ts.map +1 -0
  96. package/dist/components/Label.d.ts +10 -0
  97. package/dist/components/Label.d.ts.map +1 -0
  98. package/dist/components/Link.d.ts +16 -0
  99. package/dist/components/Link.d.ts.map +1 -0
  100. package/dist/components/List.d.ts +7 -0
  101. package/dist/components/List.d.ts.map +1 -0
  102. package/dist/components/ListGroup.d.ts +26 -0
  103. package/dist/components/ListGroup.d.ts.map +1 -0
  104. package/dist/components/LiveChatComponent.d.ts +17 -0
  105. package/dist/components/LiveChatComponent.d.ts.map +1 -0
  106. package/dist/components/LoadingScrim.d.ts +14 -0
  107. package/dist/components/LoadingScrim.d.ts.map +1 -0
  108. package/dist/components/LogoAgilityTopBar.d.ts +2 -0
  109. package/dist/components/LogoAgilityTopBar.d.ts.map +1 -0
  110. package/dist/components/LogoDMSiTopBar.d.ts +2 -0
  111. package/dist/components/LogoDMSiTopBar.d.ts.map +1 -0
  112. package/dist/components/LogoMillworkTopBar.d.ts +2 -0
  113. package/dist/components/LogoMillworkTopBar.d.ts.map +1 -0
  114. package/dist/components/MainBar.d.ts +14 -0
  115. package/dist/components/MainBar.d.ts.map +1 -0
  116. package/dist/components/MaxViewportBox.d.ts +6 -0
  117. package/dist/components/MaxViewportBox.d.ts.map +1 -0
  118. package/dist/components/Menu.d.ts +23 -0
  119. package/dist/components/Menu.d.ts.map +1 -0
  120. package/dist/components/MenuOption.d.ts +65 -0
  121. package/dist/components/MenuOption.d.ts.map +1 -0
  122. package/dist/components/MobileDataGrid/ColumnList.d.ts +13 -0
  123. package/dist/components/MobileDataGrid/ColumnList.d.ts.map +1 -0
  124. package/dist/components/MobileDataGrid/ColumnSelector/index.d.ts +2 -0
  125. package/dist/components/MobileDataGrid/ColumnSelector/index.d.ts.map +1 -0
  126. package/dist/components/MobileDataGrid/GridContextProvider/GridContext.d.ts +24 -0
  127. package/dist/components/MobileDataGrid/GridContextProvider/GridContext.d.ts.map +1 -0
  128. package/dist/components/MobileDataGrid/GridContextProvider/index.d.ts +15 -0
  129. package/dist/components/MobileDataGrid/GridContextProvider/index.d.ts.map +1 -0
  130. package/dist/components/MobileDataGrid/GridContextProvider/useGridContext.d.ts +3 -0
  131. package/dist/components/MobileDataGrid/GridContextProvider/useGridContext.d.ts.map +1 -0
  132. package/dist/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.d.ts +6 -0
  133. package/dist/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.d.ts.map +1 -0
  134. package/dist/components/MobileDataGrid/MobileDataGridCard/index.d.ts +10 -0
  135. package/dist/components/MobileDataGrid/MobileDataGridCard/index.d.ts.map +1 -0
  136. package/dist/components/MobileDataGrid/MobileDataGridHeader.d.ts +7 -0
  137. package/dist/components/MobileDataGrid/MobileDataGridHeader.d.ts.map +1 -0
  138. package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.d.ts +2 -0
  139. package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.d.ts.map +1 -0
  140. package/dist/components/MobileDataGrid/RowDetailModalProvider/index.d.ts +2 -0
  141. package/dist/components/MobileDataGrid/RowDetailModalProvider/index.d.ts.map +1 -0
  142. package/dist/components/MobileDataGrid/dataGridReducer.d.ts +21 -0
  143. package/dist/components/MobileDataGrid/dataGridReducer.d.ts.map +1 -0
  144. package/dist/components/MobileDataGrid/index.d.ts +26 -0
  145. package/dist/components/MobileDataGrid/index.d.ts.map +1 -0
  146. package/dist/components/MobileDataGrid/types.d.ts +4 -0
  147. package/dist/components/MobileDataGrid/types.d.ts.map +1 -0
  148. package/dist/components/MobileNavMenu.d.ts +36 -0
  149. package/dist/components/MobileNavMenu.d.ts.map +1 -0
  150. package/dist/components/Modal.d.ts +30 -0
  151. package/dist/components/Modal.d.ts.map +1 -0
  152. package/dist/components/ModalButtons.d.ts +13 -0
  153. package/dist/components/ModalButtons.d.ts.map +1 -0
  154. package/dist/components/ModalContent.d.ts +7 -0
  155. package/dist/components/ModalContent.d.ts.map +1 -0
  156. package/dist/components/ModalHeader.d.ts +17 -0
  157. package/dist/components/ModalHeader.d.ts.map +1 -0
  158. package/dist/components/ModalScrim.d.ts +13 -0
  159. package/dist/components/ModalScrim.d.ts.map +1 -0
  160. package/dist/components/NavigationTab.d.ts +13 -0
  161. package/dist/components/NavigationTab.d.ts.map +1 -0
  162. package/dist/components/NavigationTabs.d.ts +18 -0
  163. package/dist/components/NavigationTabs.d.ts.map +1 -0
  164. package/dist/components/NestedMenu.d.ts +35 -0
  165. package/dist/components/NestedMenu.d.ts.map +1 -0
  166. package/dist/components/Notification.d.ts +17 -0
  167. package/dist/components/Notification.d.ts.map +1 -0
  168. package/dist/components/OptionPill.d.ts +14 -0
  169. package/dist/components/OptionPill.d.ts.map +1 -0
  170. package/dist/components/OrderCheckIcon.d.ts +5 -0
  171. package/dist/components/OrderCheckIcon.d.ts.map +1 -0
  172. package/dist/components/PDFViewer/DownloadIcon.d.ts +7 -0
  173. package/dist/components/PDFViewer/DownloadIcon.d.ts.map +1 -0
  174. package/dist/components/PDFViewer/PDFElement.d.ts +7 -0
  175. package/dist/components/PDFViewer/PDFElement.d.ts.map +1 -0
  176. package/dist/components/PDFViewer/PDFNavigation.d.ts +12 -0
  177. package/dist/components/PDFViewer/PDFNavigation.d.ts.map +1 -0
  178. package/dist/components/PDFViewer/PDFPage.d.ts +7 -0
  179. package/dist/components/PDFViewer/PDFPage.d.ts.map +1 -0
  180. package/dist/components/PDFViewer/index.d.ts +20 -0
  181. package/dist/components/PDFViewer/index.d.ts.map +1 -0
  182. package/dist/components/Pagination.d.ts +14 -0
  183. package/dist/components/Pagination.d.ts.map +1 -0
  184. package/dist/components/Paragraph.d.ts +10 -0
  185. package/dist/components/Paragraph.d.ts.map +1 -0
  186. package/dist/components/Password.d.ts +4 -0
  187. package/dist/components/Password.d.ts.map +1 -0
  188. package/dist/components/ProductImagePreview/CarouselPagination.d.ts +9 -0
  189. package/dist/components/ProductImagePreview/CarouselPagination.d.ts.map +1 -0
  190. package/dist/components/ProductImagePreview/MobileImageCarousel.d.ts +11 -0
  191. package/dist/components/ProductImagePreview/MobileImageCarousel.d.ts.map +1 -0
  192. package/dist/components/ProductImagePreview/ProductPrimaryImage.d.ts +22 -0
  193. package/dist/components/ProductImagePreview/ProductPrimaryImage.d.ts.map +1 -0
  194. package/dist/components/ProductImagePreview/Thumbnail.d.ts +11 -0
  195. package/dist/components/ProductImagePreview/Thumbnail.d.ts.map +1 -0
  196. package/dist/components/ProductImagePreview/ZoomWindow.d.ts +22 -0
  197. package/dist/components/ProductImagePreview/ZoomWindow.d.ts.map +1 -0
  198. package/dist/components/ProductImagePreview/index.d.ts +23 -0
  199. package/dist/components/ProductImagePreview/index.d.ts.map +1 -0
  200. package/dist/components/ProductImagePreview/useProductImagePreview.d.ts +42 -0
  201. package/dist/components/ProductImagePreview/useProductImagePreview.d.ts.map +1 -0
  202. package/dist/components/ProjectBar.d.ts +12 -0
  203. package/dist/components/ProjectBar.d.ts.map +1 -0
  204. package/dist/components/Radio.d.ts +10 -0
  205. package/dist/components/Radio.d.ts.map +1 -0
  206. package/dist/components/Search.d.ts +20 -0
  207. package/dist/components/Search.d.ts.map +1 -0
  208. package/dist/components/SearchResultImage/index.d.ts +9 -0
  209. package/dist/components/SearchResultImage/index.d.ts.map +1 -0
  210. package/dist/components/Select.d.ts +22 -0
  211. package/dist/components/Select.d.ts.map +1 -0
  212. package/dist/components/SideMenu.d.ts +9 -0
  213. package/dist/components/SideMenu.d.ts.map +1 -0
  214. package/dist/components/SideMenuGroup.d.ts +11 -0
  215. package/dist/components/SideMenuGroup.d.ts.map +1 -0
  216. package/dist/components/SideMenuItem.d.ts +15 -0
  217. package/dist/components/SideMenuItem.d.ts.map +1 -0
  218. package/dist/components/SimpleTable.d.ts +11 -0
  219. package/dist/components/SimpleTable.d.ts.map +1 -0
  220. package/dist/components/SkeletonParagraph.d.ts +16 -0
  221. package/dist/components/SkeletonParagraph.d.ts.map +1 -0
  222. package/dist/components/Spinner.d.ts +7 -0
  223. package/dist/components/Spinner.d.ts.map +1 -0
  224. package/dist/components/Stack.d.ts +64 -0
  225. package/dist/components/Stack.d.ts.map +1 -0
  226. package/dist/components/StatusPill.d.ts +10 -0
  227. package/dist/components/StatusPill.d.ts.map +1 -0
  228. package/dist/components/Stepper.d.ts +26 -0
  229. package/dist/components/Stepper.d.ts.map +1 -0
  230. package/dist/components/Subheader.d.ts +10 -0
  231. package/dist/components/Subheader.d.ts.map +1 -0
  232. package/dist/components/Surface.d.ts +9 -0
  233. package/dist/components/Surface.d.ts.map +1 -0
  234. package/dist/components/Swatch.d.ts +13 -0
  235. package/dist/components/Swatch.d.ts.map +1 -0
  236. package/dist/components/Textarea.d.ts +12 -0
  237. package/dist/components/Textarea.d.ts.map +1 -0
  238. package/dist/components/Theme.d.ts +8 -0
  239. package/dist/components/Theme.d.ts.map +1 -0
  240. package/dist/components/Time.d.ts +13 -0
  241. package/dist/components/Time.d.ts.map +1 -0
  242. package/dist/components/Toast.d.ts +20 -0
  243. package/dist/components/Toast.d.ts.map +1 -0
  244. package/dist/components/Tooltip.d.ts +13 -0
  245. package/dist/components/Tooltip.d.ts.map +1 -0
  246. package/dist/components/TopBar.d.ts +20 -0
  247. package/dist/components/TopBar.d.ts.map +1 -0
  248. package/dist/components/Upload.d.ts +10 -0
  249. package/dist/components/Upload.d.ts.map +1 -0
  250. package/dist/components/WorldpayIframe.d.ts +5 -0
  251. package/dist/components/WorldpayIframe.d.ts.map +1 -0
  252. package/dist/hooks/index.d.ts +9 -0
  253. package/dist/hooks/index.d.ts.map +1 -0
  254. package/dist/hooks/useEditCell.d.ts +9 -0
  255. package/dist/hooks/useEditCell.d.ts.map +1 -0
  256. package/dist/hooks/useInfiniteScroll.d.ts +9 -0
  257. package/dist/hooks/useInfiniteScroll.d.ts.map +1 -0
  258. package/dist/hooks/useKeydown.d.ts +4 -0
  259. package/dist/hooks/useKeydown.d.ts.map +1 -0
  260. package/dist/hooks/useMatchesMedia.d.ts +3 -0
  261. package/dist/hooks/useMatchesMedia.d.ts.map +1 -0
  262. package/dist/hooks/useMenuSystem.d.ts +44 -0
  263. package/dist/hooks/useMenuSystem.d.ts.map +1 -0
  264. package/dist/hooks/useMounted.d.ts +2 -0
  265. package/dist/hooks/useMounted.d.ts.map +1 -0
  266. package/dist/hooks/useTableLayout/computeColumns.d.ts +49 -0
  267. package/dist/hooks/useTableLayout/computeColumns.d.ts.map +1 -0
  268. package/dist/hooks/useTableLayout/index.d.ts +3 -0
  269. package/dist/hooks/useTableLayout/index.d.ts.map +1 -0
  270. package/dist/hooks/useTableLayout/storage.d.ts +41 -0
  271. package/dist/hooks/useTableLayout/storage.d.ts.map +1 -0
  272. package/dist/hooks/useTableLayout/types.d.ts +56 -0
  273. package/dist/hooks/useTableLayout/types.d.ts.map +1 -0
  274. package/dist/hooks/useTableLayout/useTableLayout.d.ts +23 -0
  275. package/dist/hooks/useTableLayout/useTableLayout.d.ts.map +1 -0
  276. package/dist/index.d.ts +94 -0
  277. package/dist/index.d.ts.map +1 -0
  278. package/dist/index.js +52855 -0
  279. package/dist/lib/design-system.d.ts +3 -0
  280. package/dist/lib/design-system.d.ts.map +1 -0
  281. package/dist/pdf-l6QfMa5e.js +17649 -0
  282. package/dist/styles.css +1 -0
  283. package/dist/types.d.ts +33 -0
  284. package/dist/types.d.ts.map +1 -0
  285. package/dist/utils/date-patch-dashes.d.ts +17 -0
  286. package/dist/utils/date-patch-dashes.d.ts.map +1 -0
  287. package/dist/utils/date.d.ts +60 -0
  288. package/dist/utils/date.d.ts.map +1 -0
  289. package/dist/utils/formatting.d.ts +36 -0
  290. package/dist/utils/formatting.d.ts.map +1 -0
  291. package/dist/utils/index.d.ts +6 -0
  292. package/dist/utils/index.d.ts.map +1 -0
  293. package/dist/utils/mergeObjectArrays.d.ts +12 -0
  294. package/dist/utils/mergeObjectArrays.d.ts.map +1 -0
  295. package/dist/utils.d.ts +3 -0
  296. package/dist/utils.d.ts.map +1 -0
  297. package/package.json +17 -83
  298. package/dist/chunk-3JUIYULW.js +0 -231
  299. package/dist/chunk-3PIDINTF.js +0 -52
  300. package/dist/chunk-3UPUZBP5.js +0 -149
  301. package/dist/chunk-4RJKB7LC.js +0 -14
  302. package/dist/chunk-4UGMSWWA.js +0 -57
  303. package/dist/chunk-5IFPG6TS.js +0 -17
  304. package/dist/chunk-5N32SQ3R.js +0 -99
  305. package/dist/chunk-5UH6QUFB.js +0 -38
  306. package/dist/chunk-5UPADXVU.js +0 -2376
  307. package/dist/chunk-6YUQCRMX.js +0 -32
  308. package/dist/chunk-75USUR3I.js +0 -27
  309. package/dist/chunk-7IPESTQS.js +0 -93
  310. package/dist/chunk-7MBRCM3M.js +0 -66
  311. package/dist/chunk-7WDYXRMW.js +0 -110
  312. package/dist/chunk-7YA3TF73.js +0 -32
  313. package/dist/chunk-7Z3WINQ3.js +0 -59
  314. package/dist/chunk-7ZJIGTFN.js +0 -78
  315. package/dist/chunk-AJ5M6MVX.js +0 -7
  316. package/dist/chunk-AT4AWD6B.js +0 -44
  317. package/dist/chunk-BQNPOGD5.js +0 -105
  318. package/dist/chunk-BWPNXY7T.js +0 -78
  319. package/dist/chunk-CIYLALYO.js +0 -72
  320. package/dist/chunk-DNNX5EYX.js +0 -274
  321. package/dist/chunk-E3FOCECQ.js +0 -61
  322. package/dist/chunk-E7LGUC2B.js +0 -35
  323. package/dist/chunk-EA6Y4HXQ.js +0 -112
  324. package/dist/chunk-EWGHVZL5.js +0 -27
  325. package/dist/chunk-F4VE3THQ.js +0 -71
  326. package/dist/chunk-FXXRXLOL.js +0 -329
  327. package/dist/chunk-G242RHWI.js +0 -139
  328. package/dist/chunk-GOGNV5TF.js +0 -68
  329. package/dist/chunk-GYT5CL7R.js +0 -159
  330. package/dist/chunk-I3W5K76C.js +0 -142
  331. package/dist/chunk-J3HNYUSG.js +0 -34
  332. package/dist/chunk-J4IMVWT5.js +0 -183
  333. package/dist/chunk-K6RPFIMB.js +0 -77
  334. package/dist/chunk-KBIEWFQS.js +0 -27
  335. package/dist/chunk-KESCXOG3.js +0 -82
  336. package/dist/chunk-MAEVKATN.js +0 -110
  337. package/dist/chunk-MBZ55T2D.js +0 -51
  338. package/dist/chunk-MOBFZ672.js +0 -134
  339. package/dist/chunk-MVDGHWKO.js +0 -238
  340. package/dist/chunk-NAWP246H.js +0 -65
  341. package/dist/chunk-NKUETCDA.js +0 -44
  342. package/dist/chunk-NSZTJ5R4.js +0 -38
  343. package/dist/chunk-NT26ZKSI.js +0 -82
  344. package/dist/chunk-NW75QACN.js +0 -91
  345. package/dist/chunk-OG2PGA3X.js +0 -154
  346. package/dist/chunk-OM7QLLI2.js +0 -277
  347. package/dist/chunk-ORMEWXMH.js +0 -37
  348. package/dist/chunk-PABII472.js +0 -579
  349. package/dist/chunk-PBJ2MEHM.js +0 -483
  350. package/dist/chunk-PE3EZP56.js +0 -373
  351. package/dist/chunk-QBIEU25R.js +0 -61
  352. package/dist/chunk-QG6NWMGA.js +0 -138
  353. package/dist/chunk-QVWYTQKL.js +0 -29
  354. package/dist/chunk-SATCWGO7.js +0 -166
  355. package/dist/chunk-SBRRNFOP.js +0 -33
  356. package/dist/chunk-SJZNVG4N.js +0 -47
  357. package/dist/chunk-TBZ243DS.js +0 -173
  358. package/dist/chunk-UARCWLMD.js +0 -66
  359. package/dist/chunk-UFX5XIJL.js +0 -178
  360. package/dist/chunk-UZHBKSXJ.js +0 -87
  361. package/dist/chunk-VEEZ7VRJ.js +0 -137
  362. package/dist/chunk-VJVY6NPF.js +0 -32
  363. package/dist/chunk-VUKYIERA.js +0 -89
  364. package/dist/chunk-VXWSAIB5.js +0 -26
  365. package/dist/chunk-W5NXOJ4L.js +0 -104
  366. package/dist/chunk-WVGXD7HT.js +0 -19
  367. package/dist/chunk-WVUIIBRR.js +0 -51
  368. package/dist/chunk-X4OKKRN5.js +0 -140
  369. package/dist/chunk-X7BKBBIH.js +0 -114
  370. package/dist/chunk-XB2S2QMB.js +0 -67
  371. package/dist/chunk-Y5GD2FJA.js +0 -32
  372. package/dist/chunk-YKEPPS2I.js +0 -192
  373. package/dist/chunk-YULGJORA.js +0 -259
  374. package/dist/chunk-Z2HPSFEQ.js +0 -14
  375. package/dist/chunk-Z5YP2GI6.js +0 -142
  376. package/dist/chunk-ZRFXUER3.js +0 -468
  377. package/dist/components/AccessCard.cjs +0 -661
  378. package/dist/components/AccessCard.js +0 -13
  379. package/dist/components/AccessCardGroup.cjs +0 -365
  380. package/dist/components/AccessCardGroup.js +0 -11
  381. package/dist/components/AccessChangerTabItem.cjs +0 -352
  382. package/dist/components/AccessChangerTabItem.js +0 -75
  383. package/dist/components/Accordion.cjs +0 -680
  384. package/dist/components/Accordion.js +0 -13
  385. package/dist/components/Alert.cjs +0 -850
  386. package/dist/components/Alert.js +0 -14
  387. package/dist/components/Breadcrumbs.cjs +0 -456
  388. package/dist/components/Breadcrumbs.js +0 -125
  389. package/dist/components/Button.cjs +0 -401
  390. package/dist/components/Button.js +0 -9
  391. package/dist/components/CalendarRange.cjs +0 -6569
  392. package/dist/components/CalendarRange.css +0 -5546
  393. package/dist/components/CalendarRange.js +0 -78
  394. package/dist/components/Caption.cjs +0 -365
  395. package/dist/components/Caption.js +0 -9
  396. package/dist/components/Card.cjs +0 -128
  397. package/dist/components/Card.js +0 -7
  398. package/dist/components/Checkbox.cjs +0 -421
  399. package/dist/components/Checkbox.js +0 -11
  400. package/dist/components/CompactImagesPreview.cjs +0 -604
  401. package/dist/components/CompactImagesPreview.js +0 -14
  402. package/dist/components/ContentTab.cjs +0 -483
  403. package/dist/components/ContentTab.js +0 -11
  404. package/dist/components/ContentTabs.cjs +0 -599
  405. package/dist/components/ContentTabs.js +0 -125
  406. package/dist/components/DMSiLogo.cjs +0 -97
  407. package/dist/components/DMSiLogo.js +0 -60
  408. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.cjs +0 -6558
  409. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.css +0 -5546
  410. package/dist/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.js +0 -74
  411. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.cjs +0 -6558
  412. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.css +0 -5546
  413. package/dist/components/DataGrid/ColumnSelectorHeaderCell/index.js +0 -74
  414. package/dist/components/DataGrid/PinnedColumns.cjs +0 -6558
  415. package/dist/components/DataGrid/PinnedColumns.css +0 -5546
  416. package/dist/components/DataGrid/PinnedColumns.js +0 -74
  417. package/dist/components/DataGrid/TableBody/LoadingCell.cjs +0 -6560
  418. package/dist/components/DataGrid/TableBody/LoadingCell.css +0 -5546
  419. package/dist/components/DataGrid/TableBody/LoadingCell.js +0 -74
  420. package/dist/components/DataGrid/TableBody/TableBodyRow.cjs +0 -6560
  421. package/dist/components/DataGrid/TableBody/TableBodyRow.css +0 -5546
  422. package/dist/components/DataGrid/TableBody/TableBodyRow.js +0 -74
  423. package/dist/components/DataGrid/TableBody/index.cjs +0 -6560
  424. package/dist/components/DataGrid/TableBody/index.css +0 -5546
  425. package/dist/components/DataGrid/TableBody/index.js +0 -74
  426. package/dist/components/DataGrid/index.cjs +0 -6563
  427. package/dist/components/DataGrid/index.css +0 -5546
  428. package/dist/components/DataGrid/index.js +0 -77
  429. package/dist/components/DataGrid/utils.cjs +0 -6558
  430. package/dist/components/DataGrid/utils.css +0 -5546
  431. package/dist/components/DataGrid/utils.js +0 -74
  432. package/dist/components/DataGridCell.cjs +0 -2531
  433. package/dist/components/DataGridCell.js +0 -30
  434. package/dist/components/DataTable.cjs +0 -847
  435. package/dist/components/DataTable.js +0 -775
  436. package/dist/components/DateInput.cjs +0 -6560
  437. package/dist/components/DateInput.css +0 -5546
  438. package/dist/components/DateInput.js +0 -74
  439. package/dist/components/DateRangeInput.cjs +0 -7151
  440. package/dist/components/DateRangeInput.css +0 -5546
  441. package/dist/components/DateRangeInput.js +0 -652
  442. package/dist/components/DebugJson.cjs +0 -58
  443. package/dist/components/DebugJson.js +0 -35
  444. package/dist/components/Display.cjs +0 -263
  445. package/dist/components/Display.js +0 -12
  446. package/dist/components/EditingContext.cjs +0 -86
  447. package/dist/components/EditingContext.js +0 -12
  448. package/dist/components/EmblaCarousel/ArrowButtons.cjs +0 -151
  449. package/dist/components/EmblaCarousel/ArrowButtons.js +0 -9
  450. package/dist/components/EmblaCarousel/SelectedSnapDisplay.cjs +0 -38
  451. package/dist/components/EmblaCarousel/SelectedSnapDisplay.js +0 -7
  452. package/dist/components/EmblaCarousel/index.cjs +0 -420
  453. package/dist/components/EmblaCarousel/index.js +0 -12
  454. package/dist/components/EmptyCartIcon.cjs +0 -51
  455. package/dist/components/EmptyCartIcon.js +0 -7
  456. package/dist/components/FilterGroup.cjs +0 -1801
  457. package/dist/components/FilterGroup.js +0 -267
  458. package/dist/components/FooterBar.cjs +0 -64
  459. package/dist/components/FooterBar.js +0 -31
  460. package/dist/components/FullViewportBox.cjs +0 -60
  461. package/dist/components/FullViewportBox.js +0 -27
  462. package/dist/components/Grid.cjs +0 -135
  463. package/dist/components/Grid.js +0 -7
  464. package/dist/components/Heading.cjs +0 -267
  465. package/dist/components/Heading.js +0 -14
  466. package/dist/components/HorizontalDivider.cjs +0 -82
  467. package/dist/components/HorizontalDivider.js +0 -26
  468. package/dist/components/Icon.cjs +0 -101
  469. package/dist/components/Icon.js +0 -7
  470. package/dist/components/ImagePlaceholder.cjs +0 -65
  471. package/dist/components/ImagePlaceholder.js +0 -7
  472. package/dist/components/Input.cjs +0 -923
  473. package/dist/components/Input.js +0 -23
  474. package/dist/components/InputGroup.cjs +0 -307
  475. package/dist/components/InputGroup.js +0 -68
  476. package/dist/components/Label.cjs +0 -252
  477. package/dist/components/Label.js +0 -8
  478. package/dist/components/Link.cjs +0 -304
  479. package/dist/components/Link.js +0 -8
  480. package/dist/components/List.cjs +0 -39
  481. package/dist/components/List.js +0 -16
  482. package/dist/components/ListGroup.cjs +0 -568
  483. package/dist/components/ListGroup.js +0 -11
  484. package/dist/components/LiveChatComponent.cjs +0 -63
  485. package/dist/components/LiveChatComponent.js +0 -40
  486. package/dist/components/LoadingScrim.cjs +0 -90
  487. package/dist/components/LoadingScrim.js +0 -28
  488. package/dist/components/LogoAgilityTopBar.cjs +0 -133
  489. package/dist/components/LogoAgilityTopBar.js +0 -96
  490. package/dist/components/LogoDMSiTopBar.cjs +0 -97
  491. package/dist/components/LogoDMSiTopBar.js +0 -7
  492. package/dist/components/LogoMillworkTopBar.cjs +0 -239
  493. package/dist/components/LogoMillworkTopBar.js +0 -202
  494. package/dist/components/MainBar.cjs +0 -234
  495. package/dist/components/MainBar.js +0 -66
  496. package/dist/components/MaxViewportBox.cjs +0 -45
  497. package/dist/components/MaxViewportBox.js +0 -22
  498. package/dist/components/Menu.cjs +0 -505
  499. package/dist/components/Menu.js +0 -14
  500. package/dist/components/MenuOption.cjs +0 -695
  501. package/dist/components/MenuOption.js +0 -18
  502. package/dist/components/MobileDataGrid/ColumnList.cjs +0 -991
  503. package/dist/components/MobileDataGrid/ColumnList.css +0 -5546
  504. package/dist/components/MobileDataGrid/ColumnList.js +0 -20
  505. package/dist/components/MobileDataGrid/ColumnSelector/index.cjs +0 -6668
  506. package/dist/components/MobileDataGrid/ColumnSelector/index.css +0 -5546
  507. package/dist/components/MobileDataGrid/ColumnSelector/index.js +0 -74
  508. package/dist/components/MobileDataGrid/GridContextProvider/GridContext.cjs +0 -31
  509. package/dist/components/MobileDataGrid/GridContextProvider/GridContext.js +0 -7
  510. package/dist/components/MobileDataGrid/GridContextProvider/index.cjs +0 -186
  511. package/dist/components/MobileDataGrid/GridContextProvider/index.js +0 -8
  512. package/dist/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.cjs +0 -333
  513. package/dist/components/MobileDataGrid/MobileDataGridCard/MobileDataGridColumn.js +0 -12
  514. package/dist/components/MobileDataGrid/MobileDataGridCard/index.cjs +0 -907
  515. package/dist/components/MobileDataGrid/MobileDataGridCard/index.js +0 -19
  516. package/dist/components/MobileDataGrid/MobileDataGridHeader.cjs +0 -6978
  517. package/dist/components/MobileDataGrid/MobileDataGridHeader.css +0 -5546
  518. package/dist/components/MobileDataGrid/MobileDataGridHeader.js +0 -74
  519. package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.cjs +0 -620
  520. package/dist/components/MobileDataGrid/RowDetailModalProvider/ModalContent.js +0 -16
  521. package/dist/components/MobileDataGrid/RowDetailModalProvider/index.cjs +0 -1457
  522. package/dist/components/MobileDataGrid/RowDetailModalProvider/index.js +0 -29
  523. package/dist/components/MobileDataGrid/index.cjs +0 -7489
  524. package/dist/components/MobileDataGrid/index.css +0 -5546
  525. package/dist/components/MobileDataGrid/index.js +0 -74
  526. package/dist/components/Modal.cjs +0 -995
  527. package/dist/components/Modal.js +0 -23
  528. package/dist/components/ModalButtons.cjs +0 -491
  529. package/dist/components/ModalButtons.js +0 -11
  530. package/dist/components/ModalContent.cjs +0 -204
  531. package/dist/components/ModalContent.js +0 -8
  532. package/dist/components/ModalHeader.cjs +0 -563
  533. package/dist/components/ModalHeader.js +0 -12
  534. package/dist/components/ModalScrim.cjs +0 -69
  535. package/dist/components/ModalScrim.js +0 -7
  536. package/dist/components/NavigationTab.cjs +0 -522
  537. package/dist/components/NavigationTab.js +0 -11
  538. package/dist/components/NavigationTabs.cjs +0 -572
  539. package/dist/components/NavigationTabs.js +0 -61
  540. package/dist/components/NestedMenu.cjs +0 -1275
  541. package/dist/components/NestedMenu.js +0 -164
  542. package/dist/components/Notification.cjs +0 -871
  543. package/dist/components/Notification.js +0 -126
  544. package/dist/components/OptionPill.cjs +0 -597
  545. package/dist/components/OptionPill.js +0 -12
  546. package/dist/components/OrderCheckIcon.cjs +0 -85
  547. package/dist/components/OrderCheckIcon.js +0 -7
  548. package/dist/components/PDFViewer/DownloadIcon.cjs +0 -618
  549. package/dist/components/PDFViewer/DownloadIcon.js +0 -17
  550. package/dist/components/PDFViewer/PDFElement.cjs +0 -571
  551. package/dist/components/PDFViewer/PDFElement.js +0 -11
  552. package/dist/components/PDFViewer/PDFNavigation.cjs +0 -828
  553. package/dist/components/PDFViewer/PDFNavigation.js +0 -14
  554. package/dist/components/PDFViewer/PDFPage.cjs +0 -56
  555. package/dist/components/PDFViewer/PDFPage.js +0 -7
  556. package/dist/components/PDFViewer/index.cjs +0 -1941
  557. package/dist/components/PDFViewer/index.js +0 -182
  558. package/dist/components/Pagination.cjs +0 -436
  559. package/dist/components/Pagination.js +0 -10
  560. package/dist/components/Paragraph.cjs +0 -261
  561. package/dist/components/Paragraph.js +0 -8
  562. package/dist/components/Password.cjs +0 -1123
  563. package/dist/components/Password.js +0 -75
  564. package/dist/components/ProductImagePreview/CarouselPagination.cjs +0 -75
  565. package/dist/components/ProductImagePreview/CarouselPagination.js +0 -7
  566. package/dist/components/ProductImagePreview/MobileImageCarousel.cjs +0 -216
  567. package/dist/components/ProductImagePreview/MobileImageCarousel.js +0 -7
  568. package/dist/components/ProductImagePreview/ProductPrimaryImage.cjs +0 -214
  569. package/dist/components/ProductImagePreview/ProductPrimaryImage.js +0 -7
  570. package/dist/components/ProductImagePreview/Thumbnail.cjs +0 -112
  571. package/dist/components/ProductImagePreview/Thumbnail.js +0 -8
  572. package/dist/components/ProductImagePreview/ZoomWindow.cjs +0 -198
  573. package/dist/components/ProductImagePreview/ZoomWindow.js +0 -8
  574. package/dist/components/ProductImagePreview/index.cjs +0 -1447
  575. package/dist/components/ProductImagePreview/index.js +0 -22
  576. package/dist/components/ProjectBar.cjs +0 -279
  577. package/dist/components/ProjectBar.js +0 -71
  578. package/dist/components/Radio.cjs +0 -386
  579. package/dist/components/Radio.js +0 -10
  580. package/dist/components/Search.cjs +0 -1033
  581. package/dist/components/Search.js +0 -14
  582. package/dist/components/SearchResultImage/index.cjs +0 -92
  583. package/dist/components/SearchResultImage/index.js +0 -8
  584. package/dist/components/Select.cjs +0 -1012
  585. package/dist/components/Select.js +0 -14
  586. package/dist/components/SideMenu.cjs +0 -61
  587. package/dist/components/SideMenu.js +0 -28
  588. package/dist/components/SideMenuGroup.cjs +0 -593
  589. package/dist/components/SideMenuGroup.js +0 -97
  590. package/dist/components/SideMenuItem.cjs +0 -568
  591. package/dist/components/SideMenuItem.js +0 -95
  592. package/dist/components/SimpleTable.cjs +0 -547
  593. package/dist/components/SimpleTable.js +0 -10
  594. package/dist/components/SkeletonParagraph.cjs +0 -51
  595. package/dist/components/SkeletonParagraph.js +0 -7
  596. package/dist/components/Spinner.cjs +0 -57
  597. package/dist/components/Spinner.js +0 -7
  598. package/dist/components/Stack.cjs +0 -434
  599. package/dist/components/Stack.js +0 -8
  600. package/dist/components/StatusPill.cjs +0 -303
  601. package/dist/components/StatusPill.js +0 -64
  602. package/dist/components/Stepper.cjs +0 -1478
  603. package/dist/components/Stepper.js +0 -239
  604. package/dist/components/Subheader.cjs +0 -255
  605. package/dist/components/Subheader.js +0 -8
  606. package/dist/components/Surface.cjs +0 -101
  607. package/dist/components/Surface.js +0 -7
  608. package/dist/components/Swatch.cjs +0 -2089
  609. package/dist/components/Swatch.js +0 -1513
  610. package/dist/components/Textarea.cjs +0 -330
  611. package/dist/components/Textarea.js +0 -136
  612. package/dist/components/Theme.cjs +0 -51
  613. package/dist/components/Theme.js +0 -7
  614. package/dist/components/Time.cjs +0 -1511
  615. package/dist/components/Time.js +0 -373
  616. package/dist/components/Toast.cjs +0 -764
  617. package/dist/components/Toast.js +0 -243
  618. package/dist/components/Tooltip.cjs +0 -337
  619. package/dist/components/Tooltip.js +0 -14
  620. package/dist/components/TopBar.cjs +0 -392
  621. package/dist/components/TopBar.js +0 -148
  622. package/dist/components/Upload.cjs +0 -823
  623. package/dist/components/Upload.js +0 -132
  624. package/dist/components/WorldpayIframe.cjs +0 -45
  625. package/dist/components/WorldpayIframe.js +0 -22
  626. package/dist/components/index.cjs +0 -9454
  627. package/dist/components/index.css +0 -5546
  628. package/dist/components/index.js +0 -174
  629. package/dist/components/useMenuSystem.cjs +0 -442
  630. package/dist/components/useMenuSystem.js +0 -15
  631. package/dist/components/useMounted.cjs +0 -39
  632. package/dist/components/useMounted.js +0 -8
  633. package/dist/fonts.css +0 -21
  634. package/dist/hooks/index.cjs +0 -523
  635. package/dist/hooks/index.js +0 -22
  636. package/dist/icons-light[FILL]-PPZXOLWS.woff2 +0 -0
  637. package/dist/icons-normal[FILL]-PPZXOLWS.woff2 +0 -0
  638. package/dist/index.css +0 -5524
  639. package/dist/open-sans-55T6A4JE.woff2 +0 -0
  640. package/dist/types.cjs +0 -18
  641. package/dist/types.js +0 -0
  642. package/dist/utils/index.cjs +0 -264
  643. package/dist/utils/index.js +0 -43
@@ -1,2376 +0,0 @@
1
- import {
2
- GridContextProvider
3
- } from "./chunk-3UPUZBP5.js";
4
- import {
5
- RowDetailModalProvider
6
- } from "./chunk-7ZJIGTFN.js";
7
- import {
8
- ColumnList,
9
- no_results_image_default
10
- } from "./chunk-MAEVKATN.js";
11
- import {
12
- useGridContext
13
- } from "./chunk-5IFPG6TS.js";
14
- import {
15
- Theme
16
- } from "./chunk-EWGHVZL5.js";
17
- import {
18
- Select
19
- } from "./chunk-EA6Y4HXQ.js";
20
- import {
21
- Tooltip
22
- } from "./chunk-QG6NWMGA.js";
23
- import {
24
- DataCellHeader,
25
- DataGridCell,
26
- DragAlongCell,
27
- DraggableCellHeader
28
- } from "./chunk-PBJ2MEHM.js";
29
- import {
30
- MenuOption
31
- } from "./chunk-3JUIYULW.js";
32
- import {
33
- Menu
34
- } from "./chunk-OM7QLLI2.js";
35
- import {
36
- Search
37
- } from "./chunk-MOBFZ672.js";
38
- import {
39
- Input,
40
- InputBase
41
- } from "./chunk-PABII472.js";
42
- import {
43
- Label
44
- } from "./chunk-4UGMSWWA.js";
45
- import {
46
- Checkbox
47
- } from "./chunk-I3W5K76C.js";
48
- import {
49
- useInfiniteScroll,
50
- useTableLayout
51
- } from "./chunk-ZRFXUER3.js";
52
- import {
53
- useMatchesMobile
54
- } from "./chunk-WVGXD7HT.js";
55
- import {
56
- findDocumentRoot
57
- } from "./chunk-VXWSAIB5.js";
58
- import {
59
- calculateCursorPosition,
60
- formatDate,
61
- isValidDate
62
- } from "./chunk-TBZ243DS.js";
63
- import {
64
- formatCurrencyDisplay
65
- } from "./chunk-5UH6QUFB.js";
66
- import {
67
- Subheader
68
- } from "./chunk-7Z3WINQ3.js";
69
- import {
70
- Heading3
71
- } from "./chunk-GOGNV5TF.js";
72
- import {
73
- Button
74
- } from "./chunk-J4IMVWT5.js";
75
- import {
76
- Stack
77
- } from "./chunk-MVDGHWKO.js";
78
- import {
79
- Paragraph
80
- } from "./chunk-7MBRCM3M.js";
81
- import {
82
- Icon
83
- } from "./chunk-NKUETCDA.js";
84
- import {
85
- componentGap,
86
- componentPadding,
87
- layoutGap,
88
- layoutPaddding,
89
- typography
90
- } from "./chunk-SATCWGO7.js";
91
- import {
92
- __objRest,
93
- __spreadProps,
94
- __spreadValues
95
- } from "./chunk-ORMEWXMH.js";
96
-
97
- // src/components/DataGrid/utils.tsx
98
- import clsx7 from "clsx";
99
-
100
- // src/components/DataGrid/index.tsx
101
- import React3, {
102
- useCallback,
103
- useEffect,
104
- useId,
105
- useImperativeHandle,
106
- useState as useState3
107
- } from "react";
108
- import {
109
- flexRender as flexRender3,
110
- getCoreRowModel,
111
- getFilteredRowModel,
112
- getSortedRowModel,
113
- useReactTable
114
- } from "@tanstack/react-table";
115
- import {
116
- closestCenter,
117
- DndContext,
118
- KeyboardSensor,
119
- MouseSensor,
120
- TouchSensor,
121
- useSensor,
122
- useSensors
123
- } from "@dnd-kit/core";
124
- import {
125
- arrayMove,
126
- horizontalListSortingStrategy,
127
- SortableContext
128
- } from "@dnd-kit/sortable";
129
- import { restrictToHorizontalAxis } from "@dnd-kit/modifiers";
130
- import { useVirtualizer as useVirtualizer2 } from "@tanstack/react-virtual";
131
- import clsx4 from "clsx";
132
-
133
- // src/components/DataGrid/PinnedColumns.tsx
134
- import { flexRender as flexRender2 } from "@tanstack/react-table";
135
- import clsx3 from "clsx";
136
- import React2 from "react";
137
-
138
- // src/components/DataGrid/TableBody/index.tsx
139
- import { useVirtualizer } from "@tanstack/react-virtual";
140
- import clsx2 from "clsx";
141
-
142
- // src/components/DataGrid/TableBody/TableBodyRow.tsx
143
- import clsx from "clsx";
144
- import { flexRender } from "@tanstack/react-table";
145
- import React from "react";
146
- import { jsx, jsxs } from "react/jsx-runtime";
147
- var valueFormatters = {
148
- date: (value) => typeof value === "string" ? formatDate(value) : "",
149
- currency: (value) => formatCurrencyDisplay(value)
150
- };
151
- function isValueFormatterKey(value) {
152
- return typeof value === "string" && value in valueFormatters;
153
- }
154
- function TableBodyRow({
155
- id,
156
- testid,
157
- columnVirtualizer,
158
- row,
159
- // rowVirtualizer,
160
- virtualPaddingLeft,
161
- virtualPaddingRight,
162
- virtualRow,
163
- showFilterRow,
164
- // enableColumnSelector = false,
165
- locked,
166
- pinDirection,
167
- disabled,
168
- hoveredRowId,
169
- setHoveredRowId
170
- }) {
171
- var _a;
172
- let visibleCells;
173
- if (locked) {
174
- visibleCells = pinDirection === "left" ? row.getLeftVisibleCells() : row.getRightVisibleCells();
175
- } else {
176
- visibleCells = row.getCenterVisibleCells();
177
- }
178
- const virtualColumns = (_a = columnVirtualizer == null ? void 0 : columnVirtualizer.getVirtualItems()) != null ? _a : [];
179
- const columns = locked ? visibleCells : virtualColumns;
180
- const isError = typeof row.original === "object" && row.original !== null && "rowState" in row.original && row.original.rowState === "error";
181
- const CellElement = locked ? DataGridCell : DragAlongCell;
182
- const isHovered = hoveredRowId === row.id;
183
- return /* @__PURE__ */ jsxs(
184
- "tr",
185
- {
186
- className: clsx(
187
- "min-h-10",
188
- "transition-colors",
189
- showFilterRow && !disabled ? "even:bg-background-grouped-primary-normal odd:bg-background-grouped-secondary-normal" : "odd:bg-background-grouped-primary-normal even:bg-background-grouped-secondary-normal",
190
- !disabled && isHovered && "!bg-background-action-secondary-hover",
191
- row.getIsSelected() && !disabled && "!bg-background-action-secondary-hover",
192
- isError && !disabled && "!bg-background-action-critical-secondary-hover"
193
- ),
194
- onMouseEnter: () => setHoveredRowId == null ? void 0 : setHoveredRowId(row.id),
195
- onMouseLeave: () => setHoveredRowId == null ? void 0 : setHoveredRowId(null),
196
- id: id ? `${id}-row-${row.id}` : void 0,
197
- "data-testid": testid ? `${testid}-row-${row.id}` : void 0,
198
- style: {
199
- display: "flex",
200
- position: "absolute",
201
- transform: `translateY(${showFilterRow ? virtualRow.start + 40 : virtualRow.start}px)`,
202
- width: "100%"
203
- },
204
- children: [
205
- !locked && virtualPaddingLeft ? (
206
- // fake empty column to the left for virtualization scroll padding
207
- /* @__PURE__ */ jsx("td", { style: { display: "flex", width: virtualPaddingLeft } })
208
- ) : null,
209
- columns.map((column) => {
210
- var _a2, _b, _c, _d;
211
- const cell = locked ? column : visibleCells[column.index];
212
- if (!cell) {
213
- return;
214
- }
215
- const cellFormat = (_a2 = cell.column.columnDef.meta) == null ? void 0 : _a2.format;
216
- const cellValue = cellFormat && isValueFormatterKey(cellFormat) ? valueFormatters[cellFormat](cell.getValue()) : cell.getValue();
217
- const cellAlignment = (_c = (_b = cell.column.columnDef.meta) == null ? void 0 : _b.align) != null ? _c : typeof cellValue === "number" ? "right" : "left";
218
- return ((_d = cell.column.columnDef.meta) == null ? void 0 : _d.useCustomRenderer) ? /* @__PURE__ */ jsx(React.Fragment, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id) : /* @__PURE__ */ jsx(
219
- CellElement,
220
- {
221
- id: id ? `${id}-row-${row.id}-cell-${cell.id}` : void 0,
222
- testid: testid ? `${testid}-row-${row.id}-cell-${cell.id}` : void 0,
223
- cell,
224
- className: clsx({
225
- "justify-start": cellAlignment === "left",
226
- "justify-end": cellAlignment === "right"
227
- }),
228
- children: /* @__PURE__ */ jsx(
229
- Tooltip,
230
- {
231
- id: id ? `${id}-tooltip-${cell.id}` : void 0,
232
- testid: testid ? `${testid}-tooltip-${cell.id}` : void 0,
233
- showOnTruncation: true,
234
- message: cellValue,
235
- position: "bottom",
236
- children: /* @__PURE__ */ jsx(Paragraph, { addOverflow: true, tall: true, children: cellValue })
237
- }
238
- )
239
- },
240
- cell.id
241
- );
242
- }),
243
- !locked && virtualPaddingRight ? (
244
- // fake empty column to the right for virtualization scroll padding
245
- /* @__PURE__ */ jsx("td", { style: { display: "flex", width: virtualPaddingRight } })
246
- ) : null
247
- ]
248
- },
249
- row.id
250
- );
251
- }
252
-
253
- // src/components/DataGrid/TableBody/LoadingCell.tsx
254
- import { jsx as jsx2 } from "react/jsx-runtime";
255
- function LoadingCell({
256
- id,
257
- testid,
258
- column
259
- }) {
260
- const key = `loading-${column.id}`;
261
- if (column.cell === "checkbox") {
262
- return /* @__PURE__ */ jsx2(DataGridCell, { id: id ? `${id}-${key}` : void 0, testid: testid ? `${testid}-${key}` : void 0, children: /* @__PURE__ */ jsx2(Checkbox, { id: id ? `${id}-${key}-checkbox` : void 0, testid: testid ? `${testid}-${key}-checkbox` : void 0, disabled: true }) }, key);
263
- }
264
- if (column.cell === "input") {
265
- return /* @__PURE__ */ jsx2(
266
- DataGridCell,
267
- {
268
- id: id ? `${id}-${key}` : void 0,
269
- testid: testid ? `${testid}-${key}` : void 0,
270
- component: "input",
271
- children: /* @__PURE__ */ jsx2(
272
- Input,
273
- {
274
- id: id ? `${id}-${key}-input` : void 0,
275
- testid: testid ? `${testid}-${key}-input` : void 0,
276
- align: "left",
277
- disabled: true,
278
- wrapperClassName: "!rounded-none !border-0"
279
- }
280
- )
281
- },
282
- key
283
- );
284
- }
285
- return /* @__PURE__ */ jsx2(DataGridCell, { id: id ? `${id}-${key}` : void 0, testid: testid ? `${testid}-${key}` : void 0, children: /* @__PURE__ */ jsx2("div", { className: "bg-linear-270 to-neutral-300/[24%] from-neutral-300/[12%] rounded-xs w-full max-w-25 h-6" }) }, key);
286
- }
287
-
288
- // src/components/DataGrid/TableBody/index.tsx
289
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
290
- function TableBody({
291
- id,
292
- testid,
293
- columnVirtualizer,
294
- table,
295
- tableContainerRef,
296
- virtualPaddingLeft,
297
- virtualPaddingRight,
298
- pagination,
299
- isLoadingMore,
300
- hasMore,
301
- showFilterRow,
302
- enableColumnSelector = false,
303
- locked,
304
- pinDirection,
305
- rowDisabled,
306
- rowDisabledAccessor,
307
- hoveredRowId,
308
- setHoveredRowId
309
- }) {
310
- const { rows } = table.getRowModel();
311
- const rowVirtualizer = useVirtualizer({
312
- count: rows.length,
313
- estimateSize: () => 40,
314
- getScrollElement: () => tableContainerRef.current,
315
- overscan: 8
316
- });
317
- const virtualRows = rowVirtualizer.getVirtualItems();
318
- const CellElement = locked ? DataGridCell : DragAlongCell;
319
- let headerGroups;
320
- if (pinDirection === "left") {
321
- headerGroups = table.getLeftHeaderGroups();
322
- } else if (pinDirection === "right") {
323
- headerGroups = table.getRightHeaderGroups();
324
- } else {
325
- headerGroups = table.getCenterHeaderGroups();
326
- }
327
- return /* @__PURE__ */ jsxs2(
328
- "tbody",
329
- {
330
- className: clsx2(locked ? "shadow-16" : ""),
331
- style: {
332
- display: "grid",
333
- height: `${showFilterRow ? rowVirtualizer.getTotalSize() + 40 : rowVirtualizer.getTotalSize()}px`,
334
- // tells scrollbar how big the table is
335
- position: "relative"
336
- // needed for absolute positioning of rows
337
- },
338
- children: [
339
- showFilterRow && /* @__PURE__ */ jsx3(
340
- "tr",
341
- {
342
- style: {
343
- display: "flex",
344
- position: "sticky",
345
- top: "40px",
346
- width: "100%",
347
- height: "40px",
348
- zIndex: 10
349
- },
350
- className: "even:bg-background-grouped-primary-normal odd:bg-background-grouped-secondary-normal",
351
- "data-testid": testid ? `${testid}-filter-row` : void 0,
352
- children: headerGroups.flatMap(
353
- (x) => x.headers.map((header) => {
354
- var _a, _b, _c, _d, _e;
355
- return /* @__PURE__ */ jsx3(
356
- CellElement,
357
- {
358
- id: id ? `${id}-filter-cell-${header.id}` : void 0,
359
- testid: testid ? `${testid}-filter-cell-${header.id}` : void 0,
360
- noPadding: true,
361
- cell: header,
362
- width: ((_a = header.column.columnDef.meta) == null ? void 0 : _a.headerWidth) || (locked ? `${header.column.getSize()}px` : ""),
363
- children: header.column.getCanFilter() && ((_e = (_c = (_b = header.column.columnDef.meta) == null ? void 0 : _b.filterRowCell) == null ? void 0 : _c.call(_b, {
364
- header,
365
- table
366
- })) != null ? _e : /* @__PURE__ */ jsx3(
367
- Search,
368
- {
369
- id: id ? `${id}-filter-search-${header.id}` : void 0,
370
- testid: testid ? `${testid}-filter-search-${header.id}` : void 0,
371
- removeRoundness: true,
372
- onChange: (e) => header.column.setFilterValue(e.target.value),
373
- value: (_d = header.column.getFilterValue()) != null ? _d : "",
374
- placeholder: "",
375
- removeSearchIcon: true
376
- }
377
- ))
378
- },
379
- header.id
380
- );
381
- })
382
- )
383
- }
384
- ),
385
- virtualRows.map((virtualRow) => {
386
- const row = rows[virtualRow.index];
387
- return /* @__PURE__ */ jsx3(
388
- TableBodyRow,
389
- {
390
- id,
391
- testid,
392
- columnVirtualizer,
393
- row,
394
- rowVirtualizer,
395
- virtualPaddingLeft,
396
- virtualPaddingRight,
397
- virtualRow,
398
- showFilterRow,
399
- enableColumnSelector,
400
- locked,
401
- pinDirection,
402
- disabled: rowDisabledAccessor ? rowDisabledAccessor(row.original) : rowDisabled,
403
- hoveredRowId,
404
- setHoveredRowId
405
- },
406
- row.id
407
- );
408
- }),
409
- !pagination && isLoadingMore && hasMore && /* @__PURE__ */ jsx3(
410
- "tr",
411
- {
412
- style: {
413
- display: "flex",
414
- position: "absolute",
415
- width: "100%",
416
- transform: `translateY(${virtualRows[virtualRows.length - 1].start + 40}px)`
417
- },
418
- className: "odd:bg-background-grouped-primary-normal even:bg-background-grouped-secondary-normal",
419
- children: table.getAllLeafColumns().map((column) => /* @__PURE__ */ jsx3(
420
- LoadingCell,
421
- {
422
- id,
423
- testid,
424
- column: column.columnDef
425
- },
426
- column.id
427
- ))
428
- }
429
- )
430
- ]
431
- }
432
- );
433
- }
434
-
435
- // src/components/DataGrid/ColumnSelectorHeaderCell/index.tsx
436
- import { useRef, useState as useState2 } from "react";
437
-
438
- // src/components/DataGrid/ColumnSelectorHeaderCell/ColumnSelectorMenuOption.tsx
439
- import { useState } from "react";
440
- import { jsx as jsx4 } from "react/jsx-runtime";
441
- function ColumnSelectorMenuOption({
442
- id,
443
- testid,
444
- column,
445
- toggleColumnVisibility
446
- }) {
447
- const [isVisible, setIsVisible] = useState(column.getIsVisible());
448
- const label = typeof column.columnDef.header === "string" ? column.columnDef.header : null;
449
- return /* @__PURE__ */ jsx4(MenuOption, { id, testid, defaultChecked: isVisible, children: /* @__PURE__ */ jsx4(
450
- Checkbox,
451
- {
452
- id: id ? `${id}-checkbox` : void 0,
453
- testid: testid ? `${testid}-checkbox` : void 0,
454
- label: label != null ? label : "Unknown",
455
- checked: isVisible,
456
- onChange: (e) => {
457
- setIsVisible(e.target.checked);
458
- toggleColumnVisibility(column.id, e.target.checked);
459
- }
460
- }
461
- ) });
462
- }
463
-
464
- // src/components/DataGrid/ColumnSelectorHeaderCell/index.tsx
465
- import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
466
- function ColumnSelectorHeaderCell({
467
- id,
468
- testid,
469
- table,
470
- toggleColumnVisibility,
471
- resetColumnVisibility
472
- }) {
473
- const ref = useRef(null);
474
- const [show, setShow] = useState2(false);
475
- return /* @__PURE__ */ jsxs3(
476
- DataGridCell,
477
- {
478
- id,
479
- testid,
480
- width: "48px",
481
- type: "header",
482
- color: "text-secondary-normal",
483
- ref,
484
- children: [
485
- /* @__PURE__ */ jsx5(
486
- Button,
487
- {
488
- id: id ? `${id}-button` : void 0,
489
- testid: testid ? `${testid}-button` : void 0,
490
- onClick: () => setShow((prev) => !prev),
491
- variant: "navigation",
492
- iconOnly: true,
493
- leftIcon: /* @__PURE__ */ jsx5(Icon, { name: "tune" })
494
- }
495
- ),
496
- /* @__PURE__ */ jsxs3(
497
- Menu,
498
- {
499
- id: id ? `${id}-menu` : void 0,
500
- testid: testid ? `${testid}-menu` : void 0,
501
- positionTo: ref,
502
- position: "bottom-right",
503
- show,
504
- setShow,
505
- calculateMinMaxHeight: true,
506
- children: [
507
- /* @__PURE__ */ jsx5(
508
- Button,
509
- {
510
- id: id ? `${id}-reset-button` : void 0,
511
- testid: testid ? `${testid}-reset-button` : void 0,
512
- variant: "tertiary",
513
- onClick: () => {
514
- resetColumnVisibility();
515
- setShow(false);
516
- },
517
- children: "Reset to default"
518
- }
519
- ),
520
- table.getAllColumns().filter((x) => {
521
- var _a;
522
- return (_a = x.columnDef.meta) == null ? void 0 : _a.inVisibilityMenu;
523
- }).map((column) => /* @__PURE__ */ jsx5(
524
- ColumnSelectorMenuOption,
525
- {
526
- id: id ? `${id}-option-${column.id}` : void 0,
527
- testid: testid ? `${testid}-option-${column.id}` : void 0,
528
- column,
529
- toggleColumnVisibility
530
- },
531
- column.id
532
- ))
533
- ]
534
- }
535
- )
536
- ]
537
- }
538
- );
539
- }
540
-
541
- // src/components/DataGrid/PinnedColumns.tsx
542
- import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
543
- function PinnedColumns(_a) {
544
- var _b = _a, {
545
- id,
546
- pinDirection = "left",
547
- table,
548
- centerHeader,
549
- allSelectedAcrossPages,
550
- someSelectedAcrossPages,
551
- toggleSelectAllAcrossPages,
552
- testid,
553
- enableColumnSelector,
554
- toggleColumnVisibility,
555
- resetColumnVisibility
556
- } = _b, props = __objRest(_b, [
557
- "id",
558
- "pinDirection",
559
- "table",
560
- "centerHeader",
561
- "allSelectedAcrossPages",
562
- "someSelectedAcrossPages",
563
- "toggleSelectAllAcrossPages",
564
- "testid",
565
- "enableColumnSelector",
566
- "toggleColumnVisibility",
567
- "resetColumnVisibility"
568
- ]);
569
- var _a2;
570
- const headerGroups = pinDirection === "left" ? table.getLeftHeaderGroups() : table.getRightHeaderGroups();
571
- const pinnedTestId = testid ? `${pinDirection}-pinned-${testid}` : void 0;
572
- const hasAnyHeaders = ((_a2 = headerGroups[0]) == null ? void 0 : _a2.headers.length) > 0;
573
- if (!hasAnyHeaders && !enableColumnSelector) return;
574
- return /* @__PURE__ */ jsxs4(
575
- "table",
576
- {
577
- className: clsx3(
578
- "flex flex-col min-h-min sticky z-20",
579
- pinDirection === "left" ? "left-0" : "right-0"
580
- ),
581
- "data-testid": pinnedTestId,
582
- children: [
583
- /* @__PURE__ */ jsx6("thead", { className: "sticky top-0 z-20 grid", children: headerGroups.map((headerGroup) => {
584
- return /* @__PURE__ */ jsxs4(
585
- "tr",
586
- {
587
- "data-testid": pinnedTestId ? `${pinnedTestId}-header-row-${headerGroup.id}` : void 0,
588
- className: "flex w-full",
589
- children: [
590
- headerGroup.headers.map((header) => {
591
- var _a3, _b2, _c, _d, _e, _f;
592
- if (!header) {
593
- return;
594
- }
595
- const cellValue = (_a3 = table.getRowModel().rows[0]) == null ? void 0 : _a3.getValue(header.column.id);
596
- const cellAlignment = (_c = (_b2 = header.column.columnDef.meta) == null ? void 0 : _b2.align) != null ? _c : typeof cellValue === "number" ? "right" : "left";
597
- if (typeof header.column.columnDef.header === "string") {
598
- const customHeaderWidth = (_d = header.column.columnDef.meta) == null ? void 0 : _d.headerWidth;
599
- return /* @__PURE__ */ jsxs4(
600
- DataCellHeader,
601
- {
602
- locked: true,
603
- testid: pinnedTestId ? `${pinnedTestId}-header-${header.id}` : void 0,
604
- header,
605
- center: centerHeader,
606
- width: customHeaderWidth,
607
- className: clsx3(
608
- header.column.getCanSort() ? "cursor-pointer" : "cursor-grab",
609
- "group",
610
- {
611
- "justify-start": cellAlignment === "left",
612
- "justify-end": cellAlignment === "right"
613
- }
614
- ),
615
- children: [
616
- /* @__PURE__ */ jsx6(Subheader, { tall: true, children: header.column.columnDef.header }),
617
- getSortIcon(header.column.getIsSorted()),
618
- !header.column.getIsSorted() && header.column.getCanSort() && getSortIcon(header.column.getNextSortingOrder(), true),
619
- header.column.getSortIndex() !== -1 && table.getState().sorting.length > 1 && /* @__PURE__ */ jsx6(Subheader, { tall: true, children: header.column.getSortIndex() + 1 }),
620
- !((_e = header.column.columnDef.meta) == null ? void 0 : _e.locked) && /* @__PURE__ */ jsx6(
621
- "div",
622
- {
623
- onDoubleClick: (e) => {
624
- e.stopPropagation();
625
- header.column.resetSize();
626
- },
627
- onMouseDown: (e) => {
628
- e.stopPropagation();
629
- header.getResizeHandler()(e);
630
- },
631
- onTouchStart: (e) => {
632
- e.stopPropagation();
633
- header.getResizeHandler()(e);
634
- },
635
- className: "absolute right-0 inset-y-0 w-px bg-black cursor-col-resize"
636
- }
637
- )
638
- ]
639
- },
640
- header.id
641
- );
642
- }
643
- return /* @__PURE__ */ jsx6(React2.Fragment, { children: ((_f = header.column.columnDef.meta) == null ? void 0 : _f.checkbox) ? /* @__PURE__ */ jsx6(DataGridCell, { type: "header", component: "checkbox", locked: true, children: /* @__PURE__ */ jsx6(
644
- Checkbox,
645
- {
646
- checked: allSelectedAcrossPages,
647
- indeterminate: someSelectedAcrossPages,
648
- onChange: toggleSelectAllAcrossPages
649
- }
650
- ) }) : flexRender2(
651
- header.column.columnDef.header,
652
- header.getContext()
653
- ) }, header.id);
654
- }),
655
- enableColumnSelector && /* @__PURE__ */ jsx6(
656
- ColumnSelectorHeaderCell,
657
- {
658
- id: id ? `${id}-column-selector` : void 0,
659
- testid: testid ? `${testid}-column-selector` : void 0,
660
- table,
661
- toggleColumnVisibility: toggleColumnVisibility != null ? toggleColumnVisibility : () => {
662
- },
663
- resetColumnVisibility: resetColumnVisibility != null ? resetColumnVisibility : () => {
664
- }
665
- }
666
- )
667
- ]
668
- },
669
- headerGroup.id
670
- );
671
- }) }),
672
- /* @__PURE__ */ jsx6(
673
- TableBody,
674
- __spreadProps(__spreadValues({
675
- testid: pinnedTestId
676
- }, props), {
677
- table,
678
- locked: !enableColumnSelector || pinDirection === "right",
679
- pinDirection,
680
- hoveredRowId: props.hoveredRowId,
681
- setHoveredRowId: props.setHoveredRowId
682
- })
683
- )
684
- ]
685
- }
686
- );
687
- }
688
-
689
- // src/components/DataGrid/index.tsx
690
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
691
- var PAGE_SIZE_OPTIONS = [5, 10, 15, 20, 25, 30, 35];
692
- var NO_RESULTS_HEIGHT = "h-[185px]";
693
- function DataGrid({
694
- id,
695
- rowIdAccessor,
696
- testid,
697
- data,
698
- columns,
699
- status,
700
- isLoadingMore = false,
701
- onLoadMore,
702
- pagination,
703
- showFilterRow = false,
704
- hasMore = false,
705
- sorting: externalSorting,
706
- onSortingChange,
707
- columnFilters: externalColumnFilters,
708
- onColumnFiltersChange,
709
- rowSelection: externalRowSelection,
710
- onRowSelectionChange,
711
- filteredSortedData,
712
- totalRowCount,
713
- hideStatusBar,
714
- centerHeader,
715
- enableColumnSelector,
716
- predeterminedLeftPins = [],
717
- predeterminedRightPins = [],
718
- useMenuDefaultMinWidth,
719
- rowDisabled,
720
- rowDisabledAccessor,
721
- ref
722
- }) {
723
- var _a, _b, _c, _d, _e, _f, _g;
724
- useImperativeHandle(ref, () => ({
725
- getSavedLayout: () => {
726
- return getSavedLayout();
727
- }
728
- }));
729
- const [localSorting, setLocalSorting] = useState3([]);
730
- const [localColumnFilters, setLocalColumnFilters] = useState3([]);
731
- const [localRowSelection, setLocalRowSelection] = useState3({});
732
- const [hoveredRowId, setHoveredRowId] = useState3(null);
733
- const {
734
- columns: tableColumns,
735
- setColumns: setTableColumns,
736
- getSavedLayout,
737
- resetToDefaults
738
- } = useTableLayout(columns, id != null ? id : testid);
739
- const [columnOrder, setColumnOrder] = useState3(
740
- tableColumns.map((c) => c.id)
741
- );
742
- const [columnVisibility, setColumnVisibility] = useState3(
743
- Object.fromEntries(
744
- tableColumns.filter((column) => !!column.id).map((column) => {
745
- var _a2, _b2;
746
- return [column.id, (_b2 = (_a2 = column.meta) == null ? void 0 : _a2.visible) != null ? _b2 : true];
747
- })
748
- )
749
- );
750
- const updateColumnVisibility = useCallback(
751
- (updateOrder) => {
752
- setColumnVisibility(
753
- Object.fromEntries(
754
- tableColumns.filter((column) => !!column.id).map((column) => {
755
- var _a2, _b2;
756
- return [column.id, (_b2 = (_a2 = column.meta) == null ? void 0 : _a2.visible) != null ? _b2 : true];
757
- })
758
- )
759
- );
760
- if (updateOrder) setColumnOrder(tableColumns.map((c) => c.id));
761
- },
762
- [tableColumns]
763
- );
764
- const resetDefaultColumnVisibility = useCallback(() => {
765
- resetToDefaults();
766
- }, [resetToDefaults]);
767
- useEffect(() => {
768
- updateColumnVisibility(true);
769
- }, [updateColumnVisibility]);
770
- const sortingState = pagination ? externalSorting != null ? externalSorting : localSorting : localSorting;
771
- const setSortingState = pagination ? (updaterOrValue) => {
772
- const value = typeof updaterOrValue === "function" ? updaterOrValue(
773
- externalSorting != null ? externalSorting : []
774
- ) : updaterOrValue;
775
- (onSortingChange != null ? onSortingChange : setLocalSorting)(value);
776
- } : setLocalSorting;
777
- const columnFilterState = pagination ? externalColumnFilters != null ? externalColumnFilters : localColumnFilters : localColumnFilters;
778
- const setColumnFilterState = pagination ? (updaterOrValue) => {
779
- const value = typeof updaterOrValue === "function" ? updaterOrValue(externalColumnFilters != null ? externalColumnFilters : []) : updaterOrValue;
780
- (onColumnFiltersChange != null ? onColumnFiltersChange : setLocalColumnFilters)(value);
781
- } : setLocalColumnFilters;
782
- const rowSelection = externalRowSelection != null ? externalRowSelection : localRowSelection;
783
- const setRowSelection = useCallback(
784
- (updaterOrValue) => {
785
- if (pagination) {
786
- const value = typeof updaterOrValue === "function" ? updaterOrValue(externalRowSelection != null ? externalRowSelection : {}) : updaterOrValue;
787
- (onRowSelectionChange != null ? onRowSelectionChange : setLocalRowSelection)(value);
788
- } else if (externalRowSelection && onRowSelectionChange) {
789
- const value = typeof updaterOrValue === "function" ? updaterOrValue(externalRowSelection != null ? externalRowSelection : {}) : updaterOrValue;
790
- onRowSelectionChange(value);
791
- } else {
792
- setLocalRowSelection(updaterOrValue);
793
- }
794
- },
795
- [externalRowSelection, onRowSelectionChange, pagination]
796
- );
797
- const dndId = useId();
798
- const containerRef = React3.useRef(null);
799
- const toggleColumnVisibility = useCallback(
800
- (columnId, isVisible) => {
801
- setTableColumns((prev) => {
802
- const newColumns = prev.map((col) => {
803
- if (col.id === columnId) {
804
- return __spreadProps(__spreadValues({}, col), {
805
- meta: __spreadProps(__spreadValues({}, col.meta), {
806
- visible: isVisible
807
- })
808
- });
809
- }
810
- return col;
811
- });
812
- return newColumns;
813
- });
814
- },
815
- [setTableColumns]
816
- );
817
- const table = useReactTable({
818
- columns: tableColumns,
819
- data,
820
- getCoreRowModel: getCoreRowModel(),
821
- getSortedRowModel: getSortedRowModel(),
822
- getFilteredRowModel: getFilteredRowModel(),
823
- columnResizeMode: "onChange",
824
- getRowId: rowIdAccessor ? (row) => String(row[rowIdAccessor]) : (row, index) => {
825
- var _a2;
826
- return String((_a2 = row.id) != null ? _a2 : index + 1);
827
- },
828
- state: {
829
- columnOrder,
830
- sorting: sortingState,
831
- columnFilters: columnFilterState,
832
- rowSelection,
833
- columnVisibility
834
- },
835
- initialState: {
836
- columnPinning: {
837
- left: predeterminedLeftPins,
838
- right: predeterminedRightPins
839
- }
840
- },
841
- enableColumnPinning: (predeterminedLeftPins == null ? void 0 : predeterminedLeftPins.length) > 0 || predeterminedRightPins.length > 0,
842
- onColumnOrderChange: setColumnOrder,
843
- onSortingChange: adaptTableStateSetter(setSortingState),
844
- onColumnFiltersChange: adaptTableStateSetter(setColumnFilterState),
845
- onRowSelectionChange: adaptTableStateSetter(setRowSelection),
846
- filterFns: {
847
- startsWith: (row, columnId, filterValue) => {
848
- const cellValue = row == null ? void 0 : row.getValue(columnId);
849
- if (!cellValue || !filterValue) {
850
- return true;
851
- }
852
- return String(cellValue).toLowerCase().startsWith(String(filterValue).toLowerCase());
853
- },
854
- endsWith: (row, columnId, filterValue) => {
855
- const cellValue = row == null ? void 0 : row.getValue(columnId);
856
- if (!cellValue || !filterValue) {
857
- return true;
858
- }
859
- return String(cellValue).toLowerCase().endsWith(String(filterValue).toLowerCase());
860
- }
861
- }
862
- });
863
- const allRowIds = pagination ? (_a = filteredSortedData == null ? void 0 : filteredSortedData.map((row) => String(row.id))) != null ? _a : [] : Array.from(
864
- { length: totalRowCount != null ? totalRowCount : data.length },
865
- (_, i) => String(i + 1)
866
- );
867
- const allSelectedAcrossPages = allRowIds.every(
868
- (rowId) => rowSelection[rowId]
869
- );
870
- const someSelectedAcrossPages = !allSelectedAcrossPages && allRowIds.some((rowId) => rowSelection[rowId]);
871
- const toggleSelectAllAcrossPages = () => {
872
- setRowSelection((prev) => {
873
- const isSelecting = !allSelectedAcrossPages;
874
- if (isSelecting) {
875
- const newSelection = {};
876
- for (const rowId of allRowIds) {
877
- newSelection[rowId] = true;
878
- }
879
- return __spreadValues(__spreadValues({}, prev), newSelection);
880
- } else {
881
- const updatedSelection = __spreadValues({}, prev);
882
- for (const rowId of allRowIds) {
883
- delete updatedSelection[rowId];
884
- }
885
- return updatedSelection;
886
- }
887
- });
888
- };
889
- useInfiniteScroll({
890
- containerRef,
891
- onLoadMore: onLoadMore != null ? onLoadMore : () => {
892
- },
893
- isLoading: isLoadingMore,
894
- enabled: !pagination
895
- });
896
- const handleDragEnd = (event) => {
897
- const { active, over } = event;
898
- if (active && over && active.id !== over.id) {
899
- setColumnOrder((prev) => {
900
- const oldIndex = prev.indexOf(active.id);
901
- const newIndex = prev.indexOf(over.id);
902
- const newOrder = arrayMove(prev, oldIndex, newIndex);
903
- setTableColumns((prev2) => {
904
- const res = newOrder.map((id2) => prev2.find((col) => col.id === id2)).filter(Boolean);
905
- return res;
906
- });
907
- return newOrder;
908
- });
909
- }
910
- };
911
- const sensors = useSensors(
912
- useSensor(MouseSensor),
913
- useSensor(TouchSensor),
914
- useSensor(KeyboardSensor)
915
- );
916
- const visibleColumns = table.getVisibleLeafColumns();
917
- const nonPinnedColumnIds = table.getCenterLeafColumns().map((col) => col.id);
918
- const sortableColumnOrder = columnOrder.filter(
919
- (id2) => nonPinnedColumnIds.includes(id2)
920
- );
921
- const columnVirtualizer = useVirtualizer2({
922
- count: visibleColumns.length,
923
- estimateSize: (index) => visibleColumns[index].getSize(),
924
- //estimate width of each column for accurate scrollbar dragging
925
- getScrollElement: () => containerRef.current,
926
- horizontal: true,
927
- overscan: 8
928
- //how many columns to render on each side off screen each way
929
- });
930
- const virtualColumns = columnVirtualizer.getVirtualItems();
931
- let virtualPaddingLeft;
932
- let virtualPaddingRight;
933
- if (columnVirtualizer && (virtualColumns == null ? void 0 : virtualColumns.length)) {
934
- virtualPaddingLeft = (_c = (_b = virtualColumns[0]) == null ? void 0 : _b.start) != null ? _c : 0;
935
- virtualPaddingRight = columnVirtualizer.getTotalSize() - ((_e = (_d = virtualColumns[virtualColumns.length - 1]) == null ? void 0 : _d.end) != null ? _e : 0);
936
- }
937
- const empty = table.getRowModel().rows.length === 0;
938
- return /* @__PURE__ */ jsx7(
939
- DndContext,
940
- {
941
- id: dndId,
942
- collisionDetection: closestCenter,
943
- modifiers: [restrictToHorizontalAxis],
944
- onDragEnd: handleDragEnd,
945
- sensors,
946
- children: /* @__PURE__ */ jsx7(
947
- SortableContext,
948
- {
949
- items: sortableColumnOrder,
950
- strategy: horizontalListSortingStrategy,
951
- children: /* @__PURE__ */ jsxs5(
952
- "div",
953
- {
954
- id,
955
- "data-testid": testid,
956
- className: "flex flex-col grow-0 h-fit w-full rounded border border-border-primary-normal overflow-hidden text-text-primary-normal",
957
- children: [
958
- /* @__PURE__ */ jsxs5(
959
- "div",
960
- {
961
- className: clsx4(
962
- "flex overflow-auto scrollbar-thin relative contain-paint will-change-transform",
963
- empty ? "overflow-y-hidden" : "min-h-[120px]"
964
- ),
965
- ref: containerRef,
966
- children: [
967
- /* @__PURE__ */ jsx7(
968
- PinnedColumns,
969
- {
970
- testid,
971
- pinDirection: "left",
972
- table,
973
- tableContainerRef: containerRef,
974
- pagination,
975
- isLoadingMore,
976
- hasMore,
977
- showFilterRow,
978
- hoveredRowId,
979
- setHoveredRowId
980
- }
981
- ),
982
- /* @__PURE__ */ jsxs5("table", { className: "flex-1 flex flex-col min-h-min", children: [
983
- /* @__PURE__ */ jsx7("thead", { className: "sticky top-0 z-10 grid", children: table.getCenterHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsxs5(
984
- "tr",
985
- {
986
- "data-testid": testid ? `${testid}-header-row-${headerGroup.id}` : void 0,
987
- className: "flex w-full",
988
- children: [
989
- virtualPaddingLeft ? (
990
- // fake empty column to the left for virtualization scroll padding
991
- /* @__PURE__ */ jsx7(
992
- "th",
993
- {
994
- style: { display: "flex", width: virtualPaddingLeft }
995
- }
996
- )
997
- ) : null,
998
- virtualColumns.map((virtualColumn) => {
999
- var _a2, _b2, _c2, _d2, _e2;
1000
- const header = headerGroup.headers[virtualColumn.index];
1001
- if (!header) {
1002
- return;
1003
- }
1004
- if (typeof header.column.columnDef.header === "string") {
1005
- const cellValue = (_a2 = table.getRowModel().rows[0]) == null ? void 0 : _a2.getValue(header.column.id);
1006
- const cellAlignment = (_c2 = (_b2 = header.column.columnDef.meta) == null ? void 0 : _b2.align) != null ? _c2 : typeof cellValue === "number" ? "right" : "left";
1007
- return /* @__PURE__ */ jsxs5(
1008
- DraggableCellHeader,
1009
- {
1010
- minWidth: `${header.column.getSize()}px`,
1011
- id: id ? `${id}-header-${header.id}` : void 0,
1012
- testid: testid ? `${testid}-header-${header.id}` : void 0,
1013
- header,
1014
- locked: (_d2 = header.column.columnDef.meta) == null ? void 0 : _d2.locked,
1015
- center: centerHeader,
1016
- className: clsx4(
1017
- header.column.getCanSort() ? "cursor-pointer" : "cursor-grab",
1018
- "group",
1019
- {
1020
- "justify-start": cellAlignment === "left",
1021
- "justify-end": cellAlignment === "right"
1022
- }
1023
- ),
1024
- useMenuDefaultMinWidth,
1025
- children: [
1026
- cellAlignment === "left" && /* @__PURE__ */ jsx7(Subheader, { tall: true, children: header.column.columnDef.header }),
1027
- getSortIcon(header.column.getIsSorted()),
1028
- !header.column.getIsSorted() && header.column.getCanSort() && getSortIcon(
1029
- header.column.getNextSortingOrder(),
1030
- true
1031
- ),
1032
- header.column.getSortIndex() !== -1 && table.getState().sorting.length > 1 && /* @__PURE__ */ jsx7(Subheader, { tall: true, children: header.column.getSortIndex() + 1 }),
1033
- cellAlignment === "right" && /* @__PURE__ */ jsx7(Subheader, { tall: true, children: header.column.columnDef.header }),
1034
- /* @__PURE__ */ jsx7(
1035
- "div",
1036
- {
1037
- onDoubleClick: (e) => {
1038
- e.stopPropagation();
1039
- header.column.resetSize();
1040
- },
1041
- onMouseDown: (e) => {
1042
- e.stopPropagation();
1043
- header.getResizeHandler()(e);
1044
- },
1045
- onTouchStart: (e) => {
1046
- e.stopPropagation();
1047
- header.getResizeHandler()(e);
1048
- },
1049
- className: "absolute right-0 inset-y-0 w-px bg-black cursor-col-resize"
1050
- }
1051
- )
1052
- ]
1053
- },
1054
- header.id
1055
- );
1056
- }
1057
- return /* @__PURE__ */ jsx7(React3.Fragment, { children: ((_e2 = header.column.columnDef.meta) == null ? void 0 : _e2.checkbox) ? /* @__PURE__ */ jsx7(
1058
- DataGridCell,
1059
- {
1060
- id: id ? `${id}-header-${header.id}` : void 0,
1061
- testid: testid ? `${testid}-header-${header.id}` : void 0,
1062
- type: "header",
1063
- component: "checkbox",
1064
- locked: true,
1065
- children: /* @__PURE__ */ jsx7(
1066
- Checkbox,
1067
- {
1068
- id: id ? `${id}-select-all-checkbox` : void 0,
1069
- testid: testid ? `${testid}-select-all-checkbox` : void 0,
1070
- checked: allSelectedAcrossPages,
1071
- indeterminate: someSelectedAcrossPages,
1072
- onChange: toggleSelectAllAcrossPages
1073
- }
1074
- )
1075
- }
1076
- ) : flexRender3(
1077
- header.column.columnDef.header,
1078
- header.getContext()
1079
- ) }, header.id);
1080
- }),
1081
- virtualPaddingRight ? (
1082
- //fake empty column to the right for virtualization scroll padding
1083
- /* @__PURE__ */ jsx7(
1084
- "th",
1085
- {
1086
- style: { display: "flex", width: virtualPaddingRight }
1087
- }
1088
- )
1089
- ) : null
1090
- ]
1091
- },
1092
- headerGroup.id
1093
- )) }),
1094
- /* @__PURE__ */ jsx7(
1095
- TableBody,
1096
- {
1097
- id,
1098
- testid,
1099
- columnVirtualizer,
1100
- table,
1101
- tableContainerRef: containerRef,
1102
- virtualPaddingLeft,
1103
- virtualPaddingRight,
1104
- pagination,
1105
- isLoadingMore,
1106
- hasMore,
1107
- showFilterRow,
1108
- enableColumnSelector,
1109
- rowDisabled,
1110
- rowDisabledAccessor,
1111
- hoveredRowId,
1112
- setHoveredRowId
1113
- }
1114
- )
1115
- ] }),
1116
- /* @__PURE__ */ jsx7(
1117
- PinnedColumns,
1118
- {
1119
- id,
1120
- enableColumnSelector,
1121
- toggleColumnVisibility,
1122
- resetColumnVisibility: resetDefaultColumnVisibility,
1123
- testid,
1124
- pinDirection: "right",
1125
- table,
1126
- tableContainerRef: containerRef,
1127
- pagination,
1128
- isLoadingMore,
1129
- hasMore,
1130
- showFilterRow,
1131
- hoveredRowId,
1132
- setHoveredRowId
1133
- }
1134
- )
1135
- ]
1136
- }
1137
- ),
1138
- empty && /* @__PURE__ */ jsxs5(
1139
- "div",
1140
- {
1141
- className: clsx4(
1142
- NO_RESULTS_HEIGHT,
1143
- "flex flex-col items-center justify-center",
1144
- componentGap,
1145
- componentPadding
1146
- ),
1147
- "data-testid": testid ? `${testid}-no-results` : void 0,
1148
- children: [
1149
- /* @__PURE__ */ jsx7(
1150
- "img",
1151
- {
1152
- src: (_g = (_f = no_results_image_default) == null ? void 0 : _f.src) != null ? _g : no_results_image_default,
1153
- alt: "No Results",
1154
- className: "h-30 opacity-20",
1155
- width: 120,
1156
- height: 120
1157
- }
1158
- ),
1159
- /* @__PURE__ */ jsx7(Subheader, { color: "text-secondary-normal", children: "No Results" }),
1160
- /* @__PURE__ */ jsx7(Paragraph, { color: "text-secondary-normal", children: "To view results, enter or update your search criteria." })
1161
- ]
1162
- }
1163
- ),
1164
- !hideStatusBar && /* @__PURE__ */ jsxs5("div", { className: "p-2 pt-[7px] border-t border-border-primary-normal h-full min-h-[34px]", children: [
1165
- pagination && /* @__PURE__ */ jsxs5("div", { className: "flex justify-between items-center", children: [
1166
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-1 w-min", children: [
1167
- /* @__PURE__ */ jsx7(
1168
- Select,
1169
- {
1170
- id: id ? `${id}-pagesize-select` : void 0,
1171
- testid: testid ? `${testid}-pagesize-select` : void 0,
1172
- wrapperClassName: "!w-20",
1173
- value: pagination.pageSize.toString(),
1174
- onChange: (e) => {
1175
- var _a2;
1176
- return (_a2 = pagination.onPageSizeChange) == null ? void 0 : _a2.call(pagination, Number(e.target.value));
1177
- },
1178
- renderMenu: (props) => /* @__PURE__ */ jsx7(
1179
- Menu,
1180
- __spreadProps(__spreadValues({}, props), {
1181
- id: id ? `${id}-pagesize-menu` : void 0,
1182
- testid: testid ? `${testid}-pagesize-menu` : void 0,
1183
- children: PAGE_SIZE_OPTIONS.map((option) => /* @__PURE__ */ jsx7(
1184
- MenuOption,
1185
- {
1186
- id: id ? `${id}-pagesize-option-${option}` : void 0,
1187
- selected: pagination.pageSize === option,
1188
- onClick: () => {
1189
- var _a2;
1190
- return (_a2 = pagination.onPageSizeChange) == null ? void 0 : _a2.call(pagination, option);
1191
- },
1192
- children: option
1193
- },
1194
- option
1195
- ))
1196
- })
1197
- )
1198
- }
1199
- ),
1200
- /* @__PURE__ */ jsx7(Label, { children: "Per Page" })
1201
- ] }),
1202
- /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2", children: [
1203
- /* @__PURE__ */ jsx7(
1204
- Button,
1205
- {
1206
- id: id ? `${id}-prev-page-button` : void 0,
1207
- testid: testid ? `${testid}-prev-page-button` : void 0,
1208
- iconOnly: true,
1209
- leftIcon: /* @__PURE__ */ jsx7(Icon, { name: "chevron_left" }),
1210
- onClick: () => pagination.onPageChange(pagination.pageIndex - 1),
1211
- variant: "tertiary",
1212
- disabled: pagination.pageIndex === 0
1213
- }
1214
- ),
1215
- /* @__PURE__ */ jsxs5(Paragraph, { children: [
1216
- pagination.pageIndex * pagination.pageSize + 1,
1217
- " -",
1218
- " ",
1219
- Math.min(
1220
- (pagination.pageIndex + 1) * pagination.pageSize,
1221
- pagination.total
1222
- ),
1223
- " ",
1224
- "of ",
1225
- pagination.total
1226
- ] }),
1227
- /* @__PURE__ */ jsx7(
1228
- Button,
1229
- {
1230
- id: id ? `${id}-next-page-button` : void 0,
1231
- testid: testid ? `${testid}-next-page-button` : void 0,
1232
- iconOnly: true,
1233
- leftIcon: /* @__PURE__ */ jsx7(Icon, { name: "chevron_right" }),
1234
- onClick: () => pagination.onPageChange(pagination.pageIndex + 1),
1235
- variant: "tertiary",
1236
- disabled: (pagination.pageIndex + 1) * pagination.pageSize >= pagination.total
1237
- }
1238
- )
1239
- ] })
1240
- ] }),
1241
- status && /* @__PURE__ */ jsx7(
1242
- Paragraph,
1243
- {
1244
- testid: testid ? `${testid}-status-text` : void 0,
1245
- children: status
1246
- }
1247
- )
1248
- ] })
1249
- ]
1250
- }
1251
- )
1252
- }
1253
- )
1254
- }
1255
- );
1256
- }
1257
- DataGrid.displayName = "DataGrid";
1258
- function adaptTableStateSetter(setter) {
1259
- return (valueOrFn) => {
1260
- setter(
1261
- (prev) => typeof valueOrFn === "function" ? valueOrFn(prev) : valueOrFn
1262
- );
1263
- };
1264
- }
1265
- var DataGrid_default = DataGrid;
1266
-
1267
- // src/components/DateInput.tsx
1268
- import { useRef as useRef3, useEffect as useEffect3, useState as useState5, useLayoutEffect } from "react";
1269
- import { createPortal } from "react-dom";
1270
- import clsx6 from "clsx";
1271
-
1272
- // src/components/CalendarRange.tsx
1273
- import clsx5 from "clsx";
1274
- import React4, { useEffect as useEffect2, useRef as useRef2, useState as useState4 } from "react";
1275
- import { Temporal } from "@js-temporal/polyfill";
1276
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
1277
- function isWeekend(date) {
1278
- return date.dayOfWeek === 6 || date.dayOfWeek === 7;
1279
- }
1280
- function DateCell(_a) {
1281
- var _b = _a, {
1282
- date,
1283
- isInMonth,
1284
- isToday,
1285
- isSelected,
1286
- inRange,
1287
- isDisabled,
1288
- isRangeStart,
1289
- isRangeEnd,
1290
- onClick,
1291
- onMouseEnter,
1292
- onMouseLeave,
1293
- cellPadding = "",
1294
- isRangeDisabled = false,
1295
- id,
1296
- testid
1297
- } = _b, props = __objRest(_b, [
1298
- "date",
1299
- "isInMonth",
1300
- "isToday",
1301
- "isSelected",
1302
- "inRange",
1303
- "isDisabled",
1304
- "isRangeStart",
1305
- "isRangeEnd",
1306
- "onClick",
1307
- "onMouseEnter",
1308
- "onMouseLeave",
1309
- "cellPadding",
1310
- "isRangeDisabled",
1311
- "id",
1312
- "testid"
1313
- ]);
1314
- return /* @__PURE__ */ jsx8(
1315
- "span",
1316
- __spreadProps(__spreadValues({}, props), {
1317
- id,
1318
- "data-testid": testid,
1319
- className: clsx5(
1320
- "flex items-center justify-center aspect-square select-none transition-colors border duration-100 font-medium",
1321
- typography.caption,
1322
- cellPadding,
1323
- !isToday && !isSelected && !inRange && !isDisabled && !isRangeStart && !isRangeEnd && "border-transparent",
1324
- !isInMonth && "border-transparent",
1325
- // Today: subtle border ring
1326
- isToday && !isSelected && !inRange && "rounded-full border-border-primary-normal ",
1327
- // Selected: Figma blue, white text, strong shadow
1328
- isSelected && "bg-action-400 text-white border-action-400 z-10",
1329
- !isSelected && !inRange && "rounded-base",
1330
- // When range is disabled OR when only 'from' is selected (no range yet), apply rounded corners
1331
- (isRangeDisabled || !inRange && isSelected) && "rounded-base",
1332
- inRange && isSelected && "hover:border-action-500",
1333
- // In range: Figma light blue background
1334
- inRange && !isSelected && "bg-action-100 text-text-primary-normal border-y-action-400 border-x-0 ",
1335
- // Disabled: Figma gray, no pointer, no hover
1336
- isDisabled && !inRange ? "text-text-primary-disabled bg-transparent pointer-events-none opacity-40 border-transparent" : [
1337
- "text-text-primary-normal cursor-pointer",
1338
- // Figma hover: blue bg, blue text (or red text if selected)
1339
- isSelected ? "hover:bg-background-action-primary-hover hover:text-white" : "hover:bg-action-100 hover:text-text-action-primary-hover",
1340
- // Figma active: darker blue bg, white text
1341
- "active:bg-action-300 active:text-white",
1342
- // Figma focus: ring
1343
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-action-400"
1344
- ],
1345
- isRangeStart && "rounded-l",
1346
- isRangeEnd && "rounded-r"
1347
- ),
1348
- tabIndex: isDisabled ? -1 : 0,
1349
- "aria-disabled": isDisabled,
1350
- onClick: () => !isDisabled && isInMonth && onClick(),
1351
- onMouseEnter: () => isInMonth && onMouseEnter(),
1352
- onMouseLeave: () => isInMonth && onMouseLeave(),
1353
- children: isInMonth ? date.day : ""
1354
- })
1355
- );
1356
- }
1357
- function CalendarRange({
1358
- from,
1359
- to,
1360
- onChange,
1361
- onPendingFromChange,
1362
- isDateAvailable,
1363
- mode = "double",
1364
- cardStyle = false,
1365
- disableRange = false,
1366
- id,
1367
- testid
1368
- }) {
1369
- const weekDays = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
1370
- const parseDate = (d) => {
1371
- if (!d) {
1372
- return void 0;
1373
- }
1374
- try {
1375
- if (typeof d === "number") {
1376
- return Temporal.PlainDate.from(new Date(d).toISOString().slice(0, 10));
1377
- }
1378
- if (typeof d === "string") {
1379
- return Temporal.PlainDate.from(d);
1380
- }
1381
- return void 0;
1382
- } catch (error) {
1383
- console.error("Invalid date format:", d, error);
1384
- return Temporal.Now.plainDateISO();
1385
- }
1386
- };
1387
- const fromDate = parseDate(from);
1388
- const toDate = parseDate(to);
1389
- const today = Temporal.Now.plainDateISO();
1390
- const [baseMonth, setBaseMonth] = useState4(
1391
- fromDate != null ? fromDate : today.with({ day: 1 })
1392
- );
1393
- const [selecting, setSelecting] = useState4("from");
1394
- const [pendingFrom, setPendingFrom] = useState4(void 0);
1395
- const [hoveredDate, setHoveredDate] = useState4(void 0);
1396
- useEffect2(() => {
1397
- if (fromDate) {
1398
- setBaseMonth(fromDate.with({ day: 1 }));
1399
- } else if (toDate) {
1400
- setBaseMonth(toDate.with({ day: 1 }));
1401
- }
1402
- }, [from, to]);
1403
- useEffect2(() => {
1404
- if (fromDate && toDate) {
1405
- setSelecting("from");
1406
- setPendingFrom(void 0);
1407
- setHoveredDate(void 0);
1408
- }
1409
- }, [from, to]);
1410
- function getMonthData(monthOffset) {
1411
- const monthDate = baseMonth.add({ months: monthOffset }).with({ day: 1 });
1412
- const days = monthDate.daysInMonth;
1413
- const firstDayOffset = monthDate.dayOfWeek % 7;
1414
- return {
1415
- name: monthDate.toLocaleString("en-US", { month: "long" }),
1416
- year: monthDate.year,
1417
- days,
1418
- firstDayOffset,
1419
- date: monthDate
1420
- };
1421
- }
1422
- function getMonthDataWith(monthOffset) {
1423
- const monthDate = baseMonth.with({ month: monthOffset }).with({ day: 1 });
1424
- const days = monthDate.daysInMonth;
1425
- const firstDayOffset = monthDate.dayOfWeek % 7;
1426
- return {
1427
- name: monthDate.toLocaleString("en-US", { month: "long" }),
1428
- year: monthDate.year,
1429
- days,
1430
- firstDayOffset,
1431
- date: monthDate
1432
- };
1433
- }
1434
- function handleDayClick(date) {
1435
- if (isDateAvailable && !isDateAvailable(date)) return;
1436
- if (mode === "single" && disableRange) {
1437
- if (onChange) {
1438
- onChange(date.toString(), date.toString());
1439
- }
1440
- return;
1441
- }
1442
- if (selecting === "from") {
1443
- setPendingFrom(date);
1444
- setSelecting("to");
1445
- setHoveredDate(void 0);
1446
- onPendingFromChange == null ? void 0 : onPendingFromChange(date.toString());
1447
- } else if (pendingFrom) {
1448
- if (onChange) {
1449
- const [start, end] = Temporal.PlainDate.compare(date, pendingFrom) < 0 ? [date, pendingFrom] : [pendingFrom, date];
1450
- onChange(start.toString(), end.toString());
1451
- }
1452
- setPendingFrom(void 0);
1453
- setSelecting("from");
1454
- setHoveredDate(void 0);
1455
- }
1456
- }
1457
- function isInRange(date) {
1458
- if (mode === "single" && disableRange) {
1459
- return false;
1460
- }
1461
- if (pendingFrom && selecting === "to" && hoveredDate) {
1462
- const [start, end] = Temporal.PlainDate.compare(hoveredDate, pendingFrom) < 0 ? [hoveredDate, pendingFrom] : [pendingFrom, hoveredDate];
1463
- return Temporal.PlainDate.compare(date, start) >= 0 && Temporal.PlainDate.compare(date, end) <= 0;
1464
- }
1465
- if (!pendingFrom && fromDate && toDate) {
1466
- return Temporal.PlainDate.compare(date, fromDate) >= 0 && Temporal.PlainDate.compare(date, toDate) <= 0;
1467
- }
1468
- return false;
1469
- }
1470
- return /* @__PURE__ */ jsx8(
1471
- "div",
1472
- {
1473
- id,
1474
- "data-testid": testid,
1475
- className: clsx5(
1476
- "relative bg-background-grouped-primary-normal rounded-base w-fit",
1477
- layoutPaddding,
1478
- layoutGap,
1479
- cardStyle && "shadow-4",
1480
- // baseTransition,
1481
- "overflow-hidden"
1482
- ),
1483
- children: /* @__PURE__ */ jsx8(
1484
- "div",
1485
- {
1486
- className: clsx5(
1487
- "flex flex-row items-start justify-start bg-background-primary-normal overflow-clip",
1488
- layoutGap
1489
- ),
1490
- children: (mode === "double" ? [0, 1] : [0]).map((offset, idx) => {
1491
- return /* @__PURE__ */ jsx8(
1492
- CalendarPane,
1493
- {
1494
- getMonthData,
1495
- getMonthDataWith,
1496
- offset,
1497
- idx,
1498
- id,
1499
- testid,
1500
- baseMonth,
1501
- setBaseMonth,
1502
- mode,
1503
- pendingFrom,
1504
- weekDays,
1505
- fromDate,
1506
- toDate,
1507
- isDateAvailable,
1508
- disableRange,
1509
- hoveredDate,
1510
- isInRange,
1511
- today,
1512
- setHoveredDate,
1513
- handleDayClick
1514
- },
1515
- idx
1516
- );
1517
- })
1518
- }
1519
- )
1520
- }
1521
- );
1522
- }
1523
- function CalendarPane({
1524
- getMonthData,
1525
- getMonthDataWith,
1526
- offset,
1527
- idx,
1528
- id,
1529
- testid,
1530
- baseMonth,
1531
- setBaseMonth,
1532
- mode,
1533
- pendingFrom,
1534
- weekDays,
1535
- fromDate,
1536
- toDate,
1537
- isDateAvailable,
1538
- disableRange,
1539
- hoveredDate,
1540
- isInRange,
1541
- today,
1542
- setHoveredDate,
1543
- handleDayClick
1544
- }) {
1545
- const months = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
1546
- const years = Array.from({ length: 100 }).map(
1547
- (_, i) => baseMonth.year - 50 + i
1548
- );
1549
- const [monthMenuOpen, setMonthMenuOpen] = useState4(false);
1550
- const [yearMenuOpen, setYearMenuOpen] = useState4(false);
1551
- const monthMenuRef = useRef2(null);
1552
- const yearMenuRef = useRef2(null);
1553
- const month = getMonthData(offset);
1554
- const totalCells = 42;
1555
- const emptyCells = month.firstDayOffset;
1556
- return /* @__PURE__ */ jsxs6(React4.Fragment, { children: [
1557
- /* @__PURE__ */ jsxs6(
1558
- "div",
1559
- {
1560
- className: clsx5("flex flex-col"),
1561
- children: [
1562
- /* @__PURE__ */ jsxs6(
1563
- "div",
1564
- {
1565
- className: clsx5(
1566
- "flex flex-row items-center justify-between",
1567
- typography.label,
1568
- "text-text-action-primary-normal"
1569
- ),
1570
- children: [
1571
- idx === 0 ? /* @__PURE__ */ jsx8(
1572
- "button",
1573
- {
1574
- id: id ? `${id}-prev-month-button` : void 0,
1575
- "data-testid": testid ? `${testid}-prev-month-button` : void 0,
1576
- type: "button",
1577
- className: clsx5(
1578
- "flex items-center justify-center rounded-base hover:bg-action-100 active:bg-action-300 text-icon-action-primary-normal",
1579
- componentPadding
1580
- ),
1581
- "aria-label": "Previous month",
1582
- onClick: () => setBaseMonth(baseMonth.subtract({ months: 1 })),
1583
- children: /* @__PURE__ */ jsx8(Icon, { name: "chevron_left", size: 24 })
1584
- }
1585
- ) : /* @__PURE__ */ jsx8("span", { className: clsx5(componentPadding, "mr-1") }),
1586
- /* @__PURE__ */ jsxs6("div", { className: "flex gap-desktop-compact-component-padding", children: [
1587
- /* @__PURE__ */ jsx8(
1588
- "button",
1589
- {
1590
- ref: (el) => {
1591
- monthMenuRef.current = el;
1592
- },
1593
- type: "button",
1594
- onClick: () => {
1595
- setMonthMenuOpen(true);
1596
- setYearMenuOpen(false);
1597
- },
1598
- className: "font-semibold text-text-action-primary-normal text-[14px] py-[2px] truncate",
1599
- children: month.name
1600
- }
1601
- ),
1602
- /* @__PURE__ */ jsx8(
1603
- Menu,
1604
- {
1605
- show: monthMenuOpen,
1606
- positionTo: monthMenuRef,
1607
- setShow: () => setMonthMenuOpen(false),
1608
- children: months.map((x) => [x, getMonthDataWith(x + 1)]).map(([x, m]) => /* @__PURE__ */ jsx8(
1609
- MenuOption,
1610
- {
1611
- selected: baseMonth.month === x + 1,
1612
- onClick: () => {
1613
- setBaseMonth(baseMonth.with({ month: x + 1 }));
1614
- setMonthMenuOpen(false);
1615
- },
1616
- children: m.name
1617
- },
1618
- m.name
1619
- ))
1620
- }
1621
- ),
1622
- /* @__PURE__ */ jsx8(
1623
- "button",
1624
- {
1625
- ref: (el) => {
1626
- yearMenuRef.current = el;
1627
- },
1628
- type: "button",
1629
- onClick: () => {
1630
- setYearMenuOpen(true);
1631
- setMonthMenuOpen(false);
1632
- },
1633
- className: "font-semibold text-text-action-primary-normal text-[14px] py-[2px] truncate",
1634
- children: month.year
1635
- }
1636
- ),
1637
- /* @__PURE__ */ jsx8(
1638
- Menu,
1639
- {
1640
- show: yearMenuOpen,
1641
- positionTo: yearMenuRef,
1642
- setShow: () => setYearMenuOpen(false),
1643
- children: years.map((y) => /* @__PURE__ */ jsx8(
1644
- MenuOption,
1645
- {
1646
- selected: baseMonth.year === y,
1647
- onClick: () => {
1648
- setBaseMonth(baseMonth.with({ year: y }));
1649
- setYearMenuOpen(false);
1650
- },
1651
- children: y
1652
- },
1653
- y
1654
- ))
1655
- }
1656
- )
1657
- ] }),
1658
- (mode === "double" ? idx === 1 : true) ? /* @__PURE__ */ jsx8(
1659
- "button",
1660
- {
1661
- id: id ? `${id}-next-month-button` : void 0,
1662
- "data-testid": testid ? `${testid}-next-month-button` : void 0,
1663
- type: "button",
1664
- className: clsx5(
1665
- "flex items-center justify-center rounded-base hover:bg-action-100 active:bg-action-300 text-icon-action-primary-normal",
1666
- componentPadding
1667
- ),
1668
- "aria-label": "Next month",
1669
- onClick: () => setBaseMonth(baseMonth.add({ months: 1 })),
1670
- children: /* @__PURE__ */ jsx8(Icon, { name: "chevron_right", size: 24 })
1671
- }
1672
- ) : /* @__PURE__ */ jsx8("span", { className: clsx5(componentPadding, "ml-1") })
1673
- ]
1674
- }
1675
- ),
1676
- /* @__PURE__ */ jsx8("div", { className: clsx5("grid grid-cols-7"), children: weekDays.map((d) => /* @__PURE__ */ jsx8(
1677
- "span",
1678
- {
1679
- className: clsx5(
1680
- typography.caption,
1681
- "text-text-secondary-normal text-center",
1682
- "w-10"
1683
- ),
1684
- children: d
1685
- },
1686
- d
1687
- )) }),
1688
- /* @__PURE__ */ jsx8("div", { className: clsx5("grid grid-cols-7"), children: Array.from({ length: totalCells }).map((_, i) => {
1689
- const day = i - emptyCells + 1;
1690
- const date = month.date.with({ day: 1 }).add({
1691
- days: i - emptyCells
1692
- });
1693
- const isInMonth = day > 0 && day <= month.days;
1694
- const isToday = isInMonth && date.equals(today);
1695
- const isSelected = isInMonth && (!pendingFrom && fromDate && date.equals(fromDate) || !pendingFrom && toDate && date.equals(toDate) || pendingFrom && date.equals(pendingFrom));
1696
- const inRange = isInMonth && isInRange(date);
1697
- const isDisabled = !isInMonth || (isDateAvailable ? !isDateAvailable(date) : false);
1698
- const hoverDateIsBeforePendingFrom = hoveredDate && pendingFrom && Temporal.PlainDate.compare(hoveredDate, pendingFrom) < 0;
1699
- const hoverDateIsAfterPendingFrom = hoveredDate && pendingFrom && Temporal.PlainDate.compare(hoveredDate, pendingFrom) >= 0;
1700
- const isRangeStart = mode === "single" && disableRange ? false : !pendingFrom && isInMonth && fromDate && date.equals(fromDate) || hoverDateIsAfterPendingFrom && date.equals(pendingFrom);
1701
- const isRangeEnd = mode === "single" && disableRange ? false : !pendingFrom && isInMonth && toDate && date.equals(toDate) || hoverDateIsBeforePendingFrom && date.equals(pendingFrom);
1702
- return /* @__PURE__ */ jsx8(
1703
- DateCell,
1704
- {
1705
- id: id ? `${id}-date-${date.toString()}` : void 0,
1706
- testid: testid ? `${testid}-date-${date.toString()}` : void 0,
1707
- date,
1708
- isInMonth: !!isInMonth,
1709
- isToday: !!isToday,
1710
- isSelected: !!isSelected,
1711
- inRange: !!inRange,
1712
- isDisabled: !!isDisabled,
1713
- onClick: () => handleDayClick(date),
1714
- onMouseEnter: () => setHoveredDate(date),
1715
- onMouseLeave: () => setHoveredDate(void 0),
1716
- isRangeStart: !!isRangeStart,
1717
- isRangeEnd: !!isRangeEnd,
1718
- isRangeDisabled: mode === "single" && disableRange,
1719
- cellPadding: componentPadding
1720
- },
1721
- i
1722
- );
1723
- }) })
1724
- ]
1725
- }
1726
- ),
1727
- mode === "double" && idx === 0 && /* @__PURE__ */ jsx8(
1728
- "div",
1729
- {
1730
- className: clsx5(
1731
- "self-stretch bg-border-primary-normal rounded-base",
1732
- // 1px width, full height, matches Figma divider
1733
- "w-px"
1734
- )
1735
- }
1736
- )
1737
- ] }, month.name + month.year);
1738
- }
1739
- var CalendarRange_default = CalendarRange;
1740
-
1741
- // src/utils/date-patch-dashes.ts
1742
- function formatInputValueWithDashes(value, dateInDashes) {
1743
- const digits = value.replace(/\D/g, "");
1744
- if (dateInDashes) {
1745
- if (digits.length <= 4) return digits;
1746
- if (digits.length <= 6) return `${digits.slice(0, 4)}-${digits.slice(4)}`;
1747
- return `${digits.slice(4, 6)}-${digits.slice(6, 8)}-${digits.slice(0, 4)}`;
1748
- } else {
1749
- if (digits.length <= 2) return digits;
1750
- if (digits.length <= 4) return `${digits.slice(0, 2)}/${digits.slice(2)}`;
1751
- return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, 8)}`;
1752
- }
1753
- }
1754
- function formatDateWithDashes(value, dateInDashes) {
1755
- if (!value) return "";
1756
- let year = "", month = "", day = "";
1757
- if (/^\d{4}-\d{2}-\d{2}$/.test(value)) {
1758
- [year, month, day] = value.split("-");
1759
- } else if (/^\d{2}-\d{2}-\d{4}$/.test(value)) {
1760
- [month, day, year] = value.split("-");
1761
- } else if (/^\d{2}\/\d{2}\/\d{4}$/.test(value)) {
1762
- [month, day, year] = value.split("/");
1763
- } else {
1764
- return value;
1765
- }
1766
- if (!year || !month || !day) return value;
1767
- if (dateInDashes) {
1768
- return `${month}-${day}-${year}`;
1769
- }
1770
- return `${month}/${day}/${year}`;
1771
- }
1772
- function parseInputDateWithDashes(value, dateInDashes) {
1773
- if (!value) return "";
1774
- let year = "", month = "", day = "";
1775
- if (dateInDashes) {
1776
- let match = value.match(/^(\d{2})-(\d{2})-(\d{4})$/);
1777
- if (match) {
1778
- [, month, day, year] = match;
1779
- } else {
1780
- match = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
1781
- if (match) {
1782
- [, year, month, day] = match;
1783
- }
1784
- }
1785
- } else {
1786
- const match = value.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);
1787
- if (match) {
1788
- [, month, day, year] = match;
1789
- }
1790
- }
1791
- if (!year || !month || !day) return "";
1792
- return `${month}-${day}-${year}`;
1793
- }
1794
-
1795
- // src/components/DateInput.tsx
1796
- import { Fragment, jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1797
- var DateInput = (_a) => {
1798
- var _b = _a, {
1799
- id,
1800
- testid,
1801
- value,
1802
- onChange,
1803
- placeholder = "MM/DD/YYYY",
1804
- disabled,
1805
- readOnly = false,
1806
- label,
1807
- isDateAvailable,
1808
- disableManualInput,
1809
- dateInDashes = false
1810
- } = _b, props = __objRest(_b, [
1811
- "id",
1812
- "testid",
1813
- "value",
1814
- "onChange",
1815
- "placeholder",
1816
- "disabled",
1817
- "readOnly",
1818
- "label",
1819
- "isDateAvailable",
1820
- "disableManualInput",
1821
- "dateInDashes"
1822
- ]);
1823
- const [visible, setVisible] = useState5(false);
1824
- const [inputValue, setInputValue] = useState5("");
1825
- const [isTyping, setIsTyping] = useState5(false);
1826
- const popoverRef = useRef3(null);
1827
- const triggerRef = useRef3(null);
1828
- const rootRef = useRef3(null);
1829
- const isMobile = useMatchesMobile();
1830
- const [calendarPosition, setCalendarPosition] = useState5({
1831
- top: 0,
1832
- left: 0,
1833
- width: 0,
1834
- openAbove: false
1835
- });
1836
- const [from, to] = [value, ""];
1837
- useEffect3(() => {
1838
- if (!isTyping) {
1839
- setInputValue(formatDisplayValue(from, dateInDashes));
1840
- }
1841
- }, [from, isTyping, dateInDashes]);
1842
- useLayoutEffect(() => {
1843
- if (visible) {
1844
- updatePosition();
1845
- }
1846
- }, [visible]);
1847
- const updatePosition = () => {
1848
- if (rootRef.current) {
1849
- const rect = rootRef.current.getBoundingClientRect();
1850
- const viewportWidth = window.innerWidth;
1851
- const viewportHeight = window.innerHeight;
1852
- const calendarWidth = 340;
1853
- const calendarHeight = 400;
1854
- let viewportLeft = rect.left;
1855
- if (viewportLeft + calendarWidth > viewportWidth) {
1856
- viewportLeft = rect.right - calendarWidth;
1857
- if (viewportLeft < 0) {
1858
- viewportLeft = Math.max(0, (viewportWidth - calendarWidth) / 2);
1859
- }
1860
- }
1861
- const left = viewportLeft + window.scrollX;
1862
- const spaceBelow = viewportHeight - rect.bottom;
1863
- const spaceAbove = rect.top;
1864
- const openAbove = spaceBelow < calendarHeight && spaceAbove > spaceBelow;
1865
- let top;
1866
- if (openAbove) {
1867
- top = rect.top + window.scrollY - calendarHeight - 4;
1868
- } else {
1869
- top = rect.bottom + window.scrollY + 4;
1870
- }
1871
- setCalendarPosition({ top, left, width: rect.width, openAbove });
1872
- }
1873
- };
1874
- useEffect3(() => {
1875
- updatePosition();
1876
- const resizeObserver = new ResizeObserver(updatePosition);
1877
- if (triggerRef.current) {
1878
- resizeObserver.observe(triggerRef.current);
1879
- }
1880
- window.addEventListener("scroll", updatePosition);
1881
- return () => {
1882
- resizeObserver.disconnect();
1883
- window.removeEventListener("scroll", updatePosition);
1884
- };
1885
- }, []);
1886
- useEffect3(() => {
1887
- const handleKeyDown2 = (event) => {
1888
- var _a2;
1889
- if (event.key === "Escape" && popoverRef.current) {
1890
- setVisible(false);
1891
- (_a2 = triggerRef.current) == null ? void 0 : _a2.blur();
1892
- }
1893
- };
1894
- document.addEventListener("keydown", handleKeyDown2);
1895
- return () => {
1896
- document.removeEventListener("keydown", handleKeyDown2);
1897
- };
1898
- });
1899
- function handleDateChange(fromValue) {
1900
- onChange(fromValue);
1901
- setVisible(false);
1902
- setIsTyping(false);
1903
- }
1904
- const handleFocus = () => {
1905
- if (readOnly) return;
1906
- setVisible(true);
1907
- };
1908
- const handleClick = () => {
1909
- handleFocus();
1910
- };
1911
- const handleIgnoreFocus = (e) => {
1912
- e.preventDefault();
1913
- e.stopPropagation();
1914
- e.currentTarget.blur();
1915
- };
1916
- const handleInputChange = (event) => {
1917
- if (readOnly) return;
1918
- const rawValue = event.target.value;
1919
- const cursorPosition = event.target.selectionStart || 0;
1920
- setIsTyping(true);
1921
- const formattedValue = formatInputValueWithDashes(rawValue, dateInDashes);
1922
- setInputValue(formattedValue);
1923
- requestAnimationFrame(() => {
1924
- if (triggerRef.current) {
1925
- const newPosition = calculateCursorPosition(
1926
- rawValue,
1927
- formattedValue,
1928
- cursorPosition
1929
- );
1930
- triggerRef.current.setSelectionRange(newPosition, newPosition);
1931
- }
1932
- });
1933
- const parsedDate = parseInputDateWithDashes(formattedValue, dateInDashes);
1934
- if (parsedDate && isValidDate(parsedDate)) {
1935
- onChange(parsedDate);
1936
- }
1937
- };
1938
- const handleBlur = () => {
1939
- setIsTyping(false);
1940
- const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
1941
- if (!parsedDate || !isValidDate(parsedDate)) {
1942
- setInputValue(formatDisplayValue(from, dateInDashes));
1943
- }
1944
- };
1945
- const handleKeyDown = (event) => {
1946
- if (event.key === "Backspace") {
1947
- const input = event.target;
1948
- const cursorPosition = input.selectionStart || 0;
1949
- const value2 = input.value;
1950
- const sep = dateInDashes ? "-" : "/";
1951
- if (cursorPosition > 0 && value2[cursorPosition - 1] === sep) {
1952
- event.preventDefault();
1953
- const newValue = value2.slice(0, cursorPosition - 2) + value2.slice(cursorPosition);
1954
- const formattedValue = formatInputValueWithDashes(
1955
- newValue,
1956
- dateInDashes
1957
- );
1958
- setInputValue(formattedValue);
1959
- requestAnimationFrame(() => {
1960
- if (triggerRef.current) {
1961
- const newPosition = Math.max(0, cursorPosition - 2);
1962
- triggerRef.current.setSelectionRange(newPosition, newPosition);
1963
- }
1964
- });
1965
- setIsTyping(true);
1966
- return;
1967
- }
1968
- }
1969
- if (event.key === "Enter") {
1970
- const parsedDate = parseInputDateWithDashes(inputValue, dateInDashes);
1971
- if (parsedDate && isValidDate(parsedDate)) {
1972
- onChange(parsedDate);
1973
- setVisible(false);
1974
- setIsTyping(false);
1975
- }
1976
- }
1977
- };
1978
- return /* @__PURE__ */ jsxs7("div", { className: "relative", children: [
1979
- /* @__PURE__ */ jsx9(
1980
- InputBase,
1981
- __spreadProps(__spreadValues({
1982
- id,
1983
- testid,
1984
- ref: (el) => {
1985
- triggerRef.current = el;
1986
- }
1987
- }, props), {
1988
- wrapperRef: rootRef,
1989
- value: inputValue,
1990
- placeholder,
1991
- disabled,
1992
- readOnly,
1993
- after: /* @__PURE__ */ jsx9(Icon, { name: "calendar_month" }),
1994
- onFocus: disableManualInput ? handleIgnoreFocus : handleFocus,
1995
- onClick: handleClick,
1996
- onChange: handleInputChange,
1997
- onBlur: handleBlur,
1998
- onKeyDown: handleKeyDown,
1999
- label,
2000
- secondaryIconColor: true
2001
- })
2002
- ),
2003
- visible && !readOnly && createPortal(
2004
- /* @__PURE__ */ jsxs7(Fragment, { children: [
2005
- /* @__PURE__ */ jsx9(
2006
- "div",
2007
- {
2008
- className: clsx6(
2009
- "fixed inset-0 z-50",
2010
- isMobile && "overflow-y-auto bg-neutral-600/50"
2011
- ),
2012
- onClick: () => setVisible(false),
2013
- onMouseDown: (e) => {
2014
- if (!isMobile) {
2015
- e.preventDefault();
2016
- }
2017
- },
2018
- onWheel: (e) => {
2019
- var _a2;
2020
- if (!isMobile) {
2021
- const scrollableParent = (_a2 = document.scrollingElement) != null ? _a2 : document.documentElement;
2022
- scrollableParent.scrollTop += e.deltaY;
2023
- scrollableParent.scrollLeft += e.deltaX;
2024
- }
2025
- },
2026
- onTouchMove: (e) => {
2027
- if (!isMobile) {
2028
- e.stopPropagation();
2029
- }
2030
- },
2031
- style: { touchAction: isMobile ? "auto" : "pan-y pan-x" },
2032
- "aria-hidden": "true",
2033
- children: isMobile && /* @__PURE__ */ jsx9("div", { className: "min-h-full flex items-start justify-center py-4 px-2", children: /* @__PURE__ */ jsx9(
2034
- "div",
2035
- {
2036
- ref: (el) => {
2037
- popoverRef.current = el;
2038
- },
2039
- className: "bg-white rounded-base shadow-4 max-w-full",
2040
- onClick: (e) => e.stopPropagation(),
2041
- children: /* @__PURE__ */ jsx9(
2042
- CalendarRange,
2043
- {
2044
- id: id ? `${id}-calendar` : void 0,
2045
- testid: testid ? `${testid}-calendar` : void 0,
2046
- from,
2047
- to: to || from,
2048
- onChange: handleDateChange,
2049
- cardStyle: true,
2050
- mode: "single",
2051
- disableRange: true,
2052
- isDateAvailable
2053
- }
2054
- )
2055
- }
2056
- ) })
2057
- }
2058
- ),
2059
- !isMobile && /* @__PURE__ */ jsx9(
2060
- "div",
2061
- {
2062
- ref: (el) => {
2063
- popoverRef.current = el;
2064
- },
2065
- className: "absolute z-50 bg-white",
2066
- style: {
2067
- top: `${calendarPosition.top}px`,
2068
- left: `${calendarPosition.left}px`
2069
- },
2070
- children: /* @__PURE__ */ jsx9(
2071
- CalendarRange,
2072
- {
2073
- id: id ? `${id}-calendar` : void 0,
2074
- testid: testid ? `${testid}-calendar` : void 0,
2075
- from,
2076
- to: to || from,
2077
- onChange: handleDateChange,
2078
- cardStyle: true,
2079
- mode: "single",
2080
- disableRange: true,
2081
- isDateAvailable
2082
- }
2083
- )
2084
- }
2085
- )
2086
- ] }),
2087
- findDocumentRoot(popoverRef.current)
2088
- )
2089
- ] });
2090
- };
2091
- DateInput.displayName = "DateInput";
2092
- function formatDisplayValue(from, dateInDashes) {
2093
- if (!from) {
2094
- return "";
2095
- }
2096
- if (!isValidDate(from)) {
2097
- return "";
2098
- }
2099
- return formatDateWithDashes(from, dateInDashes);
2100
- }
2101
-
2102
- // src/components/MobileDataGrid/ColumnSelector/index.tsx
2103
- import { useCallback as useCallback2, useRef as useRef4, useState as useState6 } from "react";
2104
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
2105
- function ColumnSelector() {
2106
- const context = useGridContext();
2107
- const ref = useRef4(null);
2108
- const [show, setShow] = useState6(false);
2109
- const {
2110
- columns,
2111
- id,
2112
- testid,
2113
- visibleColumns,
2114
- numberOfColumnsToShow,
2115
- primaryKey,
2116
- resetColumnVisibility,
2117
- dispatch
2118
- } = context;
2119
- const toggleColumnVisibility = useCallback2(
2120
- (index, visible) => {
2121
- dispatch({ type: "UPDATE", index, payload: { meta: { visible } } });
2122
- },
2123
- [dispatch]
2124
- );
2125
- return /* @__PURE__ */ jsxs8(
2126
- "div",
2127
- {
2128
- id: id ? `${id}-column-selector` : void 0,
2129
- "data-testid": testid,
2130
- className: "text-text-secondary-normal border-l border-brand-200 p-mobile-container-padding",
2131
- ref,
2132
- children: [
2133
- /* @__PURE__ */ jsx10(
2134
- Button,
2135
- {
2136
- id: id ? `${id}-button` : void 0,
2137
- testid: testid ? `${testid}-button` : void 0,
2138
- onClick: () => setShow((prev) => !prev),
2139
- variant: "navigation",
2140
- iconOnly: true,
2141
- size: 24,
2142
- leftIcon: /* @__PURE__ */ jsx10(Icon, { name: "tune" })
2143
- }
2144
- ),
2145
- /* @__PURE__ */ jsxs8(
2146
- Menu,
2147
- {
2148
- id: id ? `${id}-menu` : void 0,
2149
- testid: testid ? `${testid}-menu` : void 0,
2150
- positionTo: ref,
2151
- position: "bottom-right",
2152
- show,
2153
- setShow,
2154
- calculateMinMaxHeight: true,
2155
- children: [
2156
- /* @__PURE__ */ jsx10(
2157
- Button,
2158
- {
2159
- id: id ? `${id}-reset-button` : void 0,
2160
- testid: testid ? `${testid}-reset-button` : void 0,
2161
- variant: "tertiary",
2162
- onClick: () => {
2163
- resetColumnVisibility();
2164
- setShow(false);
2165
- },
2166
- children: "Reset to default"
2167
- }
2168
- ),
2169
- columns.filter((x) => {
2170
- var _a;
2171
- return (_a = x.meta) == null ? void 0 : _a.inVisibilityMenu;
2172
- }).map((column) => {
2173
- var _a, _b, _c;
2174
- return /* @__PURE__ */ jsx10(
2175
- MenuOption,
2176
- {
2177
- testid: testid ? `${testid}-option-${column.id}` : void 0,
2178
- children: /* @__PURE__ */ jsx10(
2179
- Checkbox,
2180
- {
2181
- id: id ? `${id}-checkbox-${column.id}` : void 0,
2182
- testid: testid ? `${testid}-checkbox-${column.id}` : void 0,
2183
- label: (_a = column.header) == null ? void 0 : _a.toString(),
2184
- checked: !!((_b = column.meta) == null ? void 0 : _b.visible) || column.id === String(primaryKey),
2185
- disabled: typeof numberOfColumnsToShow !== "undefined" && // account for header+link occupying one slot
2186
- visibleColumns.length >= numberOfColumnsToShow - 1 && ((_c = column.meta) == null ? void 0 : _c.visible) !== true || column.id === String(primaryKey),
2187
- onChange: (e) => {
2188
- toggleColumnVisibility(
2189
- columns.findIndex(({ id: id2 }) => id2 === column.id),
2190
- e.target.checked
2191
- );
2192
- }
2193
- }
2194
- )
2195
- },
2196
- id ? `${id}-option-${column.id}` : void 0
2197
- );
2198
- })
2199
- ]
2200
- }
2201
- )
2202
- ]
2203
- }
2204
- );
2205
- }
2206
-
2207
- // src/components/MobileDataGrid/MobileDataGridHeader.tsx
2208
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
2209
- function MobileDataGridHeader({
2210
- header: Header,
2211
- enableColumnSelector,
2212
- enableRowSelection
2213
- }) {
2214
- var _a, _b;
2215
- const ctx = useGridContext();
2216
- const {
2217
- id,
2218
- testid,
2219
- selectedRowIds,
2220
- data,
2221
- primaryKey,
2222
- columns,
2223
- handleRowSelectAll
2224
- } = ctx;
2225
- if (typeof Header === "undefined" && !primaryKey) return null;
2226
- if (typeof Header === "function") return /* @__PURE__ */ jsx11(Header, __spreadValues({}, ctx));
2227
- if (typeof Header === "string" || primaryKey)
2228
- return /* @__PURE__ */ jsx11(
2229
- "div",
2230
- {
2231
- id: id ? `${id}-header` : void 0,
2232
- "data-testid": testid ? `${testid}-header` : void 0,
2233
- className: "sticky top-0",
2234
- children: /* @__PURE__ */ jsx11(Theme, { theme: "brand", children: /* @__PURE__ */ jsxs9(
2235
- Stack,
2236
- {
2237
- horizontal: true,
2238
- horizontalMobile: true,
2239
- items: "center",
2240
- justify: "between",
2241
- backgroundColor: "background-primary-normal",
2242
- style: { borderTopRightRadius: 4, borderTopLeftRadius: 4 },
2243
- children: [
2244
- enableRowSelection && /* @__PURE__ */ jsx11("div", { className: "p-mobile-component-padding border-r border-brand-200 max-w-fit h-full", children: /* @__PURE__ */ jsx11(
2245
- Checkbox,
2246
- {
2247
- id: id ? `${id}-select-all-checkbox` : void 0,
2248
- testid: testid ? `${testid}-select-all-checkbox` : void 0,
2249
- checked: selectedRowIds.length === data.length,
2250
- indeterminate: !!selectedRowIds.length && selectedRowIds.length !== data.length,
2251
- onChange: handleRowSelectAll
2252
- }
2253
- ) }),
2254
- /* @__PURE__ */ jsx11(
2255
- Stack,
2256
- {
2257
- horizontal: true,
2258
- horizontalMobile: true,
2259
- items: "center",
2260
- sizing: "component",
2261
- padding: true,
2262
- children: /* @__PURE__ */ jsx11(Heading3, { as: "span", color: "text-primary-normal", children: typeof Header === "string" ? Header : (_b = (_a = columns.find((col) => col.id === primaryKey)) == null ? void 0 : _a.header) == null ? void 0 : _b.toString() })
2263
- }
2264
- ),
2265
- enableColumnSelector && /* @__PURE__ */ jsx11(ColumnSelector, {})
2266
- ]
2267
- }
2268
- ) })
2269
- }
2270
- );
2271
- }
2272
-
2273
- // src/components/MobileDataGrid/index.tsx
2274
- import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
2275
- function MobileDataGrid(props) {
2276
- const {
2277
- columns,
2278
- data,
2279
- renderLink,
2280
- renderChevron,
2281
- getId,
2282
- id,
2283
- testid,
2284
- enableColumnSelector,
2285
- enableRowSelection,
2286
- header,
2287
- withBorder = true,
2288
- footer,
2289
- onRowSelect,
2290
- numberOfColumnsToShow,
2291
- primaryKey,
2292
- hideHeader,
2293
- rowActions,
2294
- rounded,
2295
- isFramed = false
2296
- } = props;
2297
- return /* @__PURE__ */ jsxs10(
2298
- GridContextProvider,
2299
- {
2300
- initialColumns: columns,
2301
- id,
2302
- testid,
2303
- data,
2304
- getId,
2305
- onRowSelect,
2306
- numberOfColumnsToShow,
2307
- primaryKey,
2308
- children: [
2309
- /* @__PURE__ */ jsxs10(
2310
- Stack,
2311
- {
2312
- height: isFramed ? "calc(100dvh - 40dvh)" : "full",
2313
- rounded,
2314
- overflowX: "hidden",
2315
- overflowY: "hidden",
2316
- children: [
2317
- !hideHeader && /* @__PURE__ */ jsx12(
2318
- MobileDataGridHeader,
2319
- {
2320
- header,
2321
- enableColumnSelector,
2322
- enableRowSelection
2323
- }
2324
- ),
2325
- /* @__PURE__ */ jsx12(
2326
- ColumnList,
2327
- {
2328
- withBorder,
2329
- renderLink,
2330
- renderChevron,
2331
- enableRowSelection,
2332
- footer,
2333
- rowActions
2334
- }
2335
- )
2336
- ]
2337
- }
2338
- ),
2339
- /* @__PURE__ */ jsx12(RowDetailModalProvider, {})
2340
- ]
2341
- }
2342
- );
2343
- }
2344
-
2345
- // src/components/DataGrid/utils.tsx
2346
- import { jsx as jsx13 } from "react/jsx-runtime";
2347
- function getSortIcon(sort, nextSort = false) {
2348
- const iconClassName = clsx7(
2349
- "text-icon-on-action-primary-normal",
2350
- nextSort && "hidden group-hover:block"
2351
- );
2352
- if (sort === "asc")
2353
- return /* @__PURE__ */ jsx13(Icon, { size: 16, className: iconClassName, name: "arrow_upward" });
2354
- if (sort === "desc")
2355
- return /* @__PURE__ */ jsx13(Icon, { size: 16, className: iconClassName, name: "arrow_downward" });
2356
- return null;
2357
- }
2358
-
2359
- export {
2360
- getSortIcon,
2361
- TableBodyRow,
2362
- LoadingCell,
2363
- TableBody,
2364
- ColumnSelectorMenuOption,
2365
- ColumnSelectorHeaderCell,
2366
- PinnedColumns,
2367
- DataGrid,
2368
- DataGrid_default,
2369
- DateInput,
2370
- ColumnSelector,
2371
- MobileDataGridHeader,
2372
- MobileDataGrid,
2373
- isWeekend,
2374
- CalendarRange,
2375
- CalendarRange_default
2376
- };