@max-ts/components 0.0.2

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 (962) hide show
  1. package/.storybook/main.ts +26 -0
  2. package/.storybook/preview.ts +14 -0
  3. package/.turbo/turbo-build.log +508 -0
  4. package/.turbo/turbo-type$colon$check.log +760 -0
  5. package/CHANGELOG.md +7 -0
  6. package/dist/components/Accordion/Accordion.d.ts +39 -0
  7. package/dist/components/Accordion/index.d.ts +1 -0
  8. package/dist/components/Accordion/styles.d.ts +21 -0
  9. package/dist/components/ActionCell/ActionCell.d.ts +24 -0
  10. package/dist/components/ActionCell/MainAction/MainAction.d.ts +13 -0
  11. package/dist/components/ActionCell/MainAction/index.d.ts +1 -0
  12. package/dist/components/ActionCell/SecondaryAction/SecondaryActions.d.ts +13 -0
  13. package/dist/components/ActionCell/SecondaryAction/index.d.ts +1 -0
  14. package/dist/components/ActionCell/index.d.ts +1 -0
  15. package/dist/components/ActionCell/styles.d.ts +1 -0
  16. package/dist/components/ActionCell/types.d.ts +66 -0
  17. package/dist/components/ActionCell/useLogic/index.d.ts +1 -0
  18. package/dist/components/ActionCell/useLogic/useLogic.d.ts +11 -0
  19. package/dist/components/AsyncAutocomplete/AsyncAutocomplete.d.ts +61 -0
  20. package/dist/components/AsyncAutocomplete/constants.d.ts +4 -0
  21. package/dist/components/AsyncAutocomplete/index.d.ts +1 -0
  22. package/dist/components/AsyncAutocomplete/useLogic/index.d.ts +1 -0
  23. package/dist/components/AsyncAutocomplete/useLogic/useLogic.d.ts +12 -0
  24. package/dist/components/Autocomplete/Autocomplete.d.ts +47 -0
  25. package/dist/components/Autocomplete/constants.d.ts +2 -0
  26. package/dist/components/Autocomplete/enums.d.ts +4 -0
  27. package/dist/components/Autocomplete/index.d.ts +1 -0
  28. package/dist/components/Autocomplete/styles.d.ts +7 -0
  29. package/dist/components/Autocomplete/useLogic/index.d.ts +1 -0
  30. package/dist/components/Autocomplete/useLogic/useLogic.d.ts +15 -0
  31. package/dist/components/Autocomplete/useLogic/utils/checkIsInputEmpty/checkIsInputEmpty.d.ts +1 -0
  32. package/dist/components/Autocomplete/useLogic/utils/checkIsInputEmpty/index.d.ts +1 -0
  33. package/dist/components/Autocomplete/useLogic/utils/index.d.ts +1 -0
  34. package/dist/components/Badge/Badge.d.ts +18 -0
  35. package/dist/components/Badge/index.d.ts +2 -0
  36. package/dist/components/Badge/styles.d.ts +8 -0
  37. package/dist/components/Badge/types.d.ts +2 -0
  38. package/dist/components/BottomDrawer/BottomDrawer.d.ts +15 -0
  39. package/dist/components/BottomDrawer/constants.d.ts +2 -0
  40. package/dist/components/BottomDrawer/index.d.ts +1 -0
  41. package/dist/components/BottomDrawer/styles.d.ts +20 -0
  42. package/dist/components/Button/Button.d.ts +35 -0
  43. package/dist/components/Button/constants.d.ts +1 -0
  44. package/dist/components/Button/enums.d.ts +23 -0
  45. package/dist/components/Button/index.d.ts +4 -0
  46. package/dist/components/Button/styles.d.ts +5 -0
  47. package/dist/components/Button/types.d.ts +19 -0
  48. package/dist/components/Button/useLogic/index.d.ts +1 -0
  49. package/dist/components/Button/useLogic/useLogic.d.ts +5 -0
  50. package/dist/components/Checkbox/Checkbox.d.ts +9 -0
  51. package/dist/components/Checkbox/icons.d.ts +4 -0
  52. package/dist/components/Checkbox/index.d.ts +1 -0
  53. package/dist/components/Checkbox/styles.d.ts +5 -0
  54. package/dist/components/CheckboxField/CheckboxField.d.ts +24 -0
  55. package/dist/components/CheckboxField/index.d.ts +1 -0
  56. package/dist/components/CheckboxField/styles.d.ts +8 -0
  57. package/dist/components/Chevron/Chevron.d.ts +7 -0
  58. package/dist/components/Chevron/index.d.ts +1 -0
  59. package/dist/components/Chevron/styles.d.ts +5 -0
  60. package/dist/components/CircularProgress/CircularProgress.d.ts +19 -0
  61. package/dist/components/CircularProgress/constants.d.ts +8 -0
  62. package/dist/components/CircularProgress/index.d.ts +1 -0
  63. package/dist/components/CircularProgress/useLogic/index.d.ts +1 -0
  64. package/dist/components/CircularProgress/useLogic/useLogic.d.ts +6 -0
  65. package/dist/components/Collapse/Collapse.d.ts +4 -0
  66. package/dist/components/Collapse/index.d.ts +1 -0
  67. package/dist/components/ConfigProvider/ConfigProvider.d.ts +91 -0
  68. package/dist/components/ConfigProvider/index.d.ts +1 -0
  69. package/dist/components/ConfirmAction/ConfirmAction.d.ts +38 -0
  70. package/dist/components/ConfirmAction/constants.d.ts +8 -0
  71. package/dist/components/ConfirmAction/index.d.ts +1 -0
  72. package/dist/components/ConfirmAction/styles.d.ts +16 -0
  73. package/dist/components/ConfirmAction/useLogic/index.d.ts +1 -0
  74. package/dist/components/ConfirmAction/useLogic/useLogic.d.ts +22 -0
  75. package/dist/components/Container/Container.d.ts +8 -0
  76. package/dist/components/Container/index.d.ts +1 -0
  77. package/dist/components/Container/styles.d.ts +24 -0
  78. package/dist/components/ContentState/ContentState.d.ts +36 -0
  79. package/dist/components/ContentState/index.d.ts +2 -0
  80. package/dist/components/ContentState/styles.d.ts +1 -0
  81. package/dist/components/ContentState/types.d.ts +29 -0
  82. package/dist/components/CopyTypography/CopyTypography.d.ts +17 -0
  83. package/dist/components/CopyTypography/enums.d.ts +5 -0
  84. package/dist/components/CopyTypography/index.d.ts +1 -0
  85. package/dist/components/CopyTypography/styles.d.ts +17 -0
  86. package/dist/components/CopyTypography/useLogic/index.d.ts +1 -0
  87. package/dist/components/CopyTypography/useLogic/useLogic.d.ts +10 -0
  88. package/dist/components/DataGrid/Body/Body.d.ts +99 -0
  89. package/dist/components/DataGrid/Body/index.d.ts +1 -0
  90. package/dist/components/DataGrid/Body/styles.d.ts +4 -0
  91. package/dist/components/DataGrid/Body/useLogic/index.d.ts +1 -0
  92. package/dist/components/DataGrid/Body/useLogic/useLogic.d.ts +11 -0
  93. package/dist/components/DataGrid/Cell/Cell.d.ts +26 -0
  94. package/dist/components/DataGrid/Cell/index.d.ts +1 -0
  95. package/dist/components/DataGrid/Cell/styles.d.ts +8 -0
  96. package/dist/components/DataGrid/Cell/useLogic/index.d.ts +1 -0
  97. package/dist/components/DataGrid/Cell/useLogic/useLogic.d.ts +8 -0
  98. package/dist/components/DataGrid/DataGrid.d.ts +154 -0
  99. package/dist/components/DataGrid/DataGridContext/DataGridContext.d.ts +7 -0
  100. package/dist/components/DataGrid/DataGridContext/DataGridProvider/DataGridProvider.d.ts +6 -0
  101. package/dist/components/DataGrid/DataGridContext/DataGridProvider/index.d.ts +1 -0
  102. package/dist/components/DataGrid/DataGridContext/index.d.ts +2 -0
  103. package/dist/components/DataGrid/Head/Head.d.ts +37 -0
  104. package/dist/components/DataGrid/Head/index.d.ts +1 -0
  105. package/dist/components/DataGrid/Head/styles.d.ts +4 -0
  106. package/dist/components/DataGrid/Head/useLogic/index.d.ts +1 -0
  107. package/dist/components/DataGrid/Head/useLogic/useLogic.d.ts +12 -0
  108. package/dist/components/DataGrid/HeadCell/HeadCell.d.ts +18 -0
  109. package/dist/components/DataGrid/HeadCell/index.d.ts +1 -0
  110. package/dist/components/DataGrid/HeadCell/styles.d.ts +22 -0
  111. package/dist/components/DataGrid/HeadCell/useLogic/index.d.ts +1 -0
  112. package/dist/components/DataGrid/HeadCell/useLogic/useLogic.d.ts +10 -0
  113. package/dist/components/DataGrid/Loader/Loader.d.ts +6 -0
  114. package/dist/components/DataGrid/Loader/index.d.ts +1 -0
  115. package/dist/components/DataGrid/Loader/styles.d.ts +4 -0
  116. package/dist/components/DataGrid/NoData/NoData.d.ts +34 -0
  117. package/dist/components/DataGrid/NoData/index.d.ts +1 -0
  118. package/dist/components/DataGrid/Row/NestedChildren/NestedChildren.d.ts +55 -0
  119. package/dist/components/DataGrid/Row/NestedChildren/index.d.ts +1 -0
  120. package/dist/components/DataGrid/Row/NestedChildren/styles.d.ts +20 -0
  121. package/dist/components/DataGrid/Row/NestedChildren/useLogic/index.d.ts +1 -0
  122. package/dist/components/DataGrid/Row/NestedChildren/useLogic/useLogic.d.ts +18 -0
  123. package/dist/components/DataGrid/Row/Row.d.ts +91 -0
  124. package/dist/components/DataGrid/Row/RowContext/RowContext.d.ts +7 -0
  125. package/dist/components/DataGrid/Row/RowContext/RowProvider/RowProvider.d.ts +6 -0
  126. package/dist/components/DataGrid/Row/RowContext/RowProvider/index.d.ts +1 -0
  127. package/dist/components/DataGrid/Row/RowContext/index.d.ts +2 -0
  128. package/dist/components/DataGrid/Row/constants.d.ts +2 -0
  129. package/dist/components/DataGrid/Row/index.d.ts +2 -0
  130. package/dist/components/DataGrid/Row/styles.d.ts +31 -0
  131. package/dist/components/DataGrid/Row/useLogic/index.d.ts +1 -0
  132. package/dist/components/DataGrid/Row/useLogic/useLogic.d.ts +35 -0
  133. package/dist/components/DataGrid/Row/useLogic/utils/getColumnsMap/getColumnsMap.d.ts +4 -0
  134. package/dist/components/DataGrid/Row/useLogic/utils/getColumnsMap/index.d.ts +1 -0
  135. package/dist/components/DataGrid/Row/useLogic/utils/index.d.ts +2 -0
  136. package/dist/components/DataGrid/Row/useLogic/utils/mergeColumnsOptions/index.d.ts +1 -0
  137. package/dist/components/DataGrid/Row/useLogic/utils/mergeColumnsOptions/mergeColumnsOptions.d.ts +2 -0
  138. package/dist/components/DataGrid/Row/utils/checkIsDisabled/checkIsDisabled.d.ts +1 -0
  139. package/dist/components/DataGrid/Row/utils/checkIsDisabled/index.d.ts +1 -0
  140. package/dist/components/DataGrid/Row/utils/index.d.ts +1 -0
  141. package/dist/components/DataGrid/constants.d.ts +6 -0
  142. package/dist/components/DataGrid/enums.d.ts +8 -0
  143. package/dist/components/DataGrid/faker.d.ts +24 -0
  144. package/dist/components/DataGrid/index.d.ts +6 -0
  145. package/dist/components/DataGrid/styles.d.ts +5 -0
  146. package/dist/components/DataGrid/types.d.ts +91 -0
  147. package/dist/components/DataGrid/useLogic/index.d.ts +1 -0
  148. package/dist/components/DataGrid/useLogic/useLogic.d.ts +32 -0
  149. package/dist/components/DataGrid/useLogic/utils/getGridTemplateColumns/getGridTemplateColumns.d.ts +3 -0
  150. package/dist/components/DataGrid/useLogic/utils/getGridTemplateColumns/index.d.ts +1 -0
  151. package/dist/components/DataGrid/useLogic/utils/index.d.ts +1 -0
  152. package/dist/components/DataGrid/utils/alignToJustifyContent/alignToJustifyContent.d.ts +5 -0
  153. package/dist/components/DataGrid/utils/alignToJustifyContent/constants.d.ts +6 -0
  154. package/dist/components/DataGrid/utils/alignToJustifyContent/index.d.ts +1 -0
  155. package/dist/components/DataGrid/utils/index.d.ts +1 -0
  156. package/dist/components/DataGridActionCell/DataGridActionCell.d.ts +22 -0
  157. package/dist/components/DataGridActionCell/MainAction/MainAction.d.ts +22 -0
  158. package/dist/components/DataGridActionCell/MainAction/MainIconButton/MainIconButton.d.ts +19 -0
  159. package/dist/components/DataGridActionCell/MainAction/MainIconButton/index.d.ts +1 -0
  160. package/dist/components/DataGridActionCell/MainAction/MainIconButton/useLogic/index.d.ts +1 -0
  161. package/dist/components/DataGridActionCell/MainAction/MainIconButton/useLogic/useLogic.d.ts +11 -0
  162. package/dist/components/DataGridActionCell/MainAction/index.d.ts +1 -0
  163. package/dist/components/DataGridActionCell/SecondaryAction/SecondaryAction.d.ts +22 -0
  164. package/dist/components/DataGridActionCell/SecondaryAction/index.d.ts +1 -0
  165. package/dist/components/DataGridActionCell/index.d.ts +1 -0
  166. package/dist/components/DataGridActionCell/styles.d.ts +1 -0
  167. package/dist/components/DataGridActionCell/types.d.ts +98 -0
  168. package/dist/components/DataGridActionCell/useLogic/index.d.ts +1 -0
  169. package/dist/components/DataGridActionCell/useLogic/useLogic.d.ts +10 -0
  170. package/dist/components/DataGridOld/Body/Body.d.ts +13 -0
  171. package/dist/components/DataGridOld/Body/index.d.ts +1 -0
  172. package/dist/components/DataGridOld/Body/styles.d.ts +1 -0
  173. package/dist/components/DataGridOld/Cell/Cell.d.ts +7 -0
  174. package/dist/components/DataGridOld/Cell/index.d.ts +1 -0
  175. package/dist/components/DataGridOld/Cell/styles.d.ts +4 -0
  176. package/dist/components/DataGridOld/DataGridOld.d.ts +20 -0
  177. package/dist/components/DataGridOld/Head/Head.d.ts +7 -0
  178. package/dist/components/DataGridOld/Head/index.d.ts +1 -0
  179. package/dist/components/DataGridOld/Head/styles.d.ts +4 -0
  180. package/dist/components/DataGridOld/HeadCell/HeadCell.d.ts +5 -0
  181. package/dist/components/DataGridOld/HeadCell/index.d.ts +1 -0
  182. package/dist/components/DataGridOld/HeadCell/styles.d.ts +3 -0
  183. package/dist/components/DataGridOld/Row/Row.d.ts +11 -0
  184. package/dist/components/DataGridOld/Row/index.d.ts +1 -0
  185. package/dist/components/DataGridOld/Row/styles.d.ts +5 -0
  186. package/dist/components/DataGridOld/State/State.d.ts +6 -0
  187. package/dist/components/DataGridOld/State/index.d.ts +1 -0
  188. package/dist/components/DataGridOld/State/styles.d.ts +1 -0
  189. package/dist/components/DataGridOld/constants.d.ts +1 -0
  190. package/dist/components/DataGridOld/index.d.ts +2 -0
  191. package/dist/components/DataGridOld/styles.d.ts +7 -0
  192. package/dist/components/DataGridOld/types.d.ts +15 -0
  193. package/dist/components/DataGridPagination/DataGridPagination.d.ts +25 -0
  194. package/dist/components/DataGridPagination/constants.d.ts +2 -0
  195. package/dist/components/DataGridPagination/faker.d.ts +3 -0
  196. package/dist/components/DataGridPagination/index.d.ts +1 -0
  197. package/dist/components/DataGridPagination/styles.d.ts +16 -0
  198. package/dist/components/DataGridPagination/useLogic/index.d.ts +1 -0
  199. package/dist/components/DataGridPagination/useLogic/useLogic.d.ts +10 -0
  200. package/dist/components/Description/Description.d.ts +34 -0
  201. package/dist/components/Description/DescriptionContext/DescriptionContext.d.ts +6 -0
  202. package/dist/components/Description/DescriptionContext/DescriptionContextProvider/DescriptionContextProvider.d.ts +7 -0
  203. package/dist/components/Description/DescriptionContext/DescriptionContextProvider/index.d.ts +1 -0
  204. package/dist/components/Description/DescriptionContext/index.d.ts +2 -0
  205. package/dist/components/Description/Name/Name.d.ts +3 -0
  206. package/dist/components/Description/Name/index.d.ts +1 -0
  207. package/dist/components/Description/Name/styles.d.ts +6 -0
  208. package/dist/components/Description/Value/Value.d.ts +22 -0
  209. package/dist/components/Description/Value/index.d.ts +1 -0
  210. package/dist/components/Description/Value/styles.d.ts +43 -0
  211. package/dist/components/Description/Value/useLogic/index.d.ts +1 -0
  212. package/dist/components/Description/Value/useLogic/useLogic.d.ts +9 -0
  213. package/dist/components/Description/constants.d.ts +3 -0
  214. package/dist/components/Description/index.d.ts +2 -0
  215. package/dist/components/Description/styles.d.ts +4 -0
  216. package/dist/components/Description/useLogic/index.d.ts +1 -0
  217. package/dist/components/Description/useLogic/useLogic.d.ts +9 -0
  218. package/dist/components/DescriptionList/DescriptionList.d.ts +2 -0
  219. package/dist/components/DescriptionList/index.d.ts +2 -0
  220. package/dist/components/DescriptionList/styles.d.ts +22 -0
  221. package/dist/components/DescriptionList/types.d.ts +32 -0
  222. package/dist/components/DescriptionList/utils/getTooltipProps/getTooltipProps.d.ts +3 -0
  223. package/dist/components/DescriptionList/utils/getTooltipProps/index.d.ts +1 -0
  224. package/dist/components/DescriptionList/utils/index.d.ts +1 -0
  225. package/dist/components/Dialog/Dialog.d.ts +20 -0
  226. package/dist/components/Dialog/constants.d.ts +22 -0
  227. package/dist/components/Dialog/index.d.ts +1 -0
  228. package/dist/components/Dialog/styles.d.ts +5 -0
  229. package/dist/components/DialogActions/DialogActions.d.ts +4 -0
  230. package/dist/components/DialogActions/index.d.ts +1 -0
  231. package/dist/components/DialogActions/styles.d.ts +6 -0
  232. package/dist/components/DialogContent/DialogContent.d.ts +4 -0
  233. package/dist/components/DialogContent/index.d.ts +1 -0
  234. package/dist/components/DialogContent/styles.d.ts +2 -0
  235. package/dist/components/DialogContentText/DialogContentText.d.ts +4 -0
  236. package/dist/components/DialogContentText/index.d.ts +1 -0
  237. package/dist/components/DialogContentText/styles.d.ts +1 -0
  238. package/dist/components/DialogHeader/DialogHeader.d.ts +17 -0
  239. package/dist/components/DialogHeader/index.d.ts +1 -0
  240. package/dist/components/DialogHeader/styles.d.ts +18 -0
  241. package/dist/components/DialogTitle/DialogTitle.d.ts +6 -0
  242. package/dist/components/DialogTitle/index.d.ts +1 -0
  243. package/dist/components/Divider/Divider.d.ts +4 -0
  244. package/dist/components/Divider/index.d.ts +1 -0
  245. package/dist/components/ErrorBoundary/ErrorBoundary.d.ts +36 -0
  246. package/dist/components/ErrorBoundary/ErrorBoundary.stubs.d.ts +12 -0
  247. package/dist/components/ErrorBoundary/constants.d.ts +9 -0
  248. package/dist/components/ErrorBoundary/enums.d.ts +9 -0
  249. package/dist/components/ErrorBoundary/index.d.ts +1 -0
  250. package/dist/components/FormControl/FormControl.d.ts +4 -0
  251. package/dist/components/FormControl/index.d.ts +1 -0
  252. package/dist/components/FormControlLabel/FormControlLabel.d.ts +2 -0
  253. package/dist/components/FormControlLabel/index.d.ts +2 -0
  254. package/dist/components/FormControlLabel/styles.d.ts +2 -0
  255. package/dist/components/FormControlLabel/types.d.ts +3 -0
  256. package/dist/components/FormHelperText/FormHelperText.d.ts +7 -0
  257. package/dist/components/FormHelperText/FormHelperTextContent/FormHelperTextContent.d.ts +7 -0
  258. package/dist/components/FormHelperText/FormHelperTextContent/index.d.ts +1 -0
  259. package/dist/components/FormHelperText/FormHelperTextContent/styles.d.ts +9 -0
  260. package/dist/components/FormHelperText/index.d.ts +2 -0
  261. package/dist/components/GuidTypography/GuidTypography.d.ts +3 -0
  262. package/dist/components/GuidTypography/index.d.ts +1 -0
  263. package/dist/components/IconButton/IconButton.d.ts +9 -0
  264. package/dist/components/IconButton/index.d.ts +1 -0
  265. package/dist/components/IconButton/styles.d.ts +23 -0
  266. package/dist/components/IconDropdownButton/IconDropdownButton.d.ts +9 -0
  267. package/dist/components/IconDropdownButton/index.d.ts +1 -0
  268. package/dist/components/InternalErrorPlaceholder/InternalErrorPlaceholder.d.ts +1 -0
  269. package/dist/components/InternalErrorPlaceholder/index.d.ts +1 -0
  270. package/dist/components/Link/Link.d.ts +24 -0
  271. package/dist/components/Link/index.d.ts +1 -0
  272. package/dist/components/Link/styles.d.ts +1 -0
  273. package/dist/components/List/List.d.ts +4 -0
  274. package/dist/components/List/index.d.ts +1 -0
  275. package/dist/components/ListItem/ListItem.d.ts +4 -0
  276. package/dist/components/ListItem/index.d.ts +1 -0
  277. package/dist/components/ListItemButton/ListItemButton.d.ts +21 -0
  278. package/dist/components/ListItemButton/constants.d.ts +5 -0
  279. package/dist/components/ListItemButton/index.d.ts +1 -0
  280. package/dist/components/ListItemIcon/ListItemIcon.d.ts +5 -0
  281. package/dist/components/ListItemIcon/index.d.ts +1 -0
  282. package/dist/components/ListItemIcon/styles.d.ts +1 -0
  283. package/dist/components/ListItemText/ListItemText.d.ts +4 -0
  284. package/dist/components/ListItemText/index.d.ts +1 -0
  285. package/dist/components/ListSubheader/ListSubheader.d.ts +4 -0
  286. package/dist/components/ListSubheader/index.d.ts +1 -0
  287. package/dist/components/Menu/Menu.d.ts +9 -0
  288. package/dist/components/Menu/index.d.ts +1 -0
  289. package/dist/components/MenuItem/MenuItem.d.ts +28 -0
  290. package/dist/components/MenuItem/index.d.ts +1 -0
  291. package/dist/components/MenuList/MenuList.d.ts +2 -0
  292. package/dist/components/MenuList/index.d.ts +2 -0
  293. package/dist/components/MenuList/styles.d.ts +1 -0
  294. package/dist/components/MenuList/types.d.ts +3 -0
  295. package/dist/components/NavMenu/Item/Item.d.ts +16 -0
  296. package/dist/components/NavMenu/Item/ItemButton/ItemButton.d.ts +11 -0
  297. package/dist/components/NavMenu/Item/ItemButton/index.d.ts +1 -0
  298. package/dist/components/NavMenu/Item/ItemButton/styles.d.ts +639 -0
  299. package/dist/components/NavMenu/Item/List/List.d.ts +13 -0
  300. package/dist/components/NavMenu/Item/List/index.d.ts +1 -0
  301. package/dist/components/NavMenu/Item/index.d.ts +1 -0
  302. package/dist/components/NavMenu/NavMenu.d.ts +15 -0
  303. package/dist/components/NavMenu/index.d.ts +1 -0
  304. package/dist/components/OutdatedReleasePlaceholder/OutdatedReleasePlaceholder.d.ts +1 -0
  305. package/dist/components/OutdatedReleasePlaceholder/index.d.ts +1 -0
  306. package/dist/components/OverflowTypography/OverflowTypography.d.ts +35 -0
  307. package/dist/components/OverflowTypography/hooks/index.d.ts +1 -0
  308. package/dist/components/OverflowTypography/hooks/useOverflowed/index.d.ts +1 -0
  309. package/dist/components/OverflowTypography/hooks/useOverflowed/useOverflowed.d.ts +5 -0
  310. package/dist/components/OverflowTypography/index.d.ts +1 -0
  311. package/dist/components/OverflowTypography/styles.d.ts +35 -0
  312. package/dist/components/OverflowTypography/useLogic/index.d.ts +1 -0
  313. package/dist/components/OverflowTypography/useLogic/useLogic.d.ts +8 -0
  314. package/dist/components/OverflowTypography/utils/index.d.ts +1 -0
  315. package/dist/components/OverflowTypography/utils/truncateString/index.d.ts +1 -0
  316. package/dist/components/OverflowTypography/utils/truncateString/truncateString.d.ts +4 -0
  317. package/dist/components/Pagination/Pagination.d.ts +2 -0
  318. package/dist/components/Pagination/index.d.ts +2 -0
  319. package/dist/components/Pagination/types.d.ts +3 -0
  320. package/dist/components/Paper/Paper.d.ts +14 -0
  321. package/dist/components/Paper/index.d.ts +1 -0
  322. package/dist/components/Placeholder/Image/Image.d.ts +21 -0
  323. package/dist/components/Placeholder/Image/index.d.ts +1 -0
  324. package/dist/components/Placeholder/Image/styles.d.ts +4 -0
  325. package/dist/components/Placeholder/Placeholder.d.ts +45 -0
  326. package/dist/components/Placeholder/constants.d.ts +14 -0
  327. package/dist/components/Placeholder/index.d.ts +3 -0
  328. package/dist/components/Placeholder/styles.d.ts +35 -0
  329. package/dist/components/Placeholder/types.d.ts +1 -0
  330. package/dist/components/Popover/Popover.d.ts +9 -0
  331. package/dist/components/Popover/index.d.ts +1 -0
  332. package/dist/components/SearchField/SearchField.d.ts +3 -0
  333. package/dist/components/SearchField/index.d.ts +1 -0
  334. package/dist/components/SearchField/styles.d.ts +22 -0
  335. package/dist/components/Select/Select.d.ts +25 -0
  336. package/dist/components/Select/constants.d.ts +1 -0
  337. package/dist/components/Select/index.d.ts +1 -0
  338. package/dist/components/Select/styles.d.ts +23 -0
  339. package/dist/components/Select/useLogic/index.d.ts +1 -0
  340. package/dist/components/Select/useLogic/useLogic.d.ts +10 -0
  341. package/dist/components/Tag/Tag.d.ts +36 -0
  342. package/dist/components/Tag/enums.d.ts +18 -0
  343. package/dist/components/Tag/index.d.ts +2 -0
  344. package/dist/components/Tag/styles.d.ts +27 -0
  345. package/dist/components/Tag/types.d.ts +5 -0
  346. package/dist/components/TagBadge/TagBadge.d.ts +23 -0
  347. package/dist/components/TagBadge/index.d.ts +1 -0
  348. package/dist/components/TagBadge/styles.d.ts +5 -0
  349. package/dist/components/TagBadge/utils/getCheckableTagBadgeBgColor/getCheckableTagBadgeBgColor.d.ts +15 -0
  350. package/dist/components/TagBadge/utils/getCheckableTagBadgeBgColor/index.d.ts +1 -0
  351. package/dist/components/TagBadge/utils/index.d.ts +1 -0
  352. package/dist/components/TagsList/Tag/Tag.d.ts +25 -0
  353. package/dist/components/TagsList/Tag/index.d.ts +1 -0
  354. package/dist/components/TagsList/Tag/styles.d.ts +11 -0
  355. package/dist/components/TagsList/Tag/useLogic/index.d.ts +1 -0
  356. package/dist/components/TagsList/Tag/useLogic/useLogic.d.ts +4 -0
  357. package/dist/components/TagsList/TagsList.d.ts +34 -0
  358. package/dist/components/TagsList/index.d.ts +2 -0
  359. package/dist/components/TagsList/styles.d.ts +1 -0
  360. package/dist/components/TagsList/types.d.ts +1 -0
  361. package/dist/components/TagsList/useLogic/index.d.ts +1 -0
  362. package/dist/components/TagsList/useLogic/useLogic.d.ts +14 -0
  363. package/dist/components/TagsList/utils/getElementByText/getElementByText.d.ts +4 -0
  364. package/dist/components/TagsList/utils/getElementByText/index.d.ts +1 -0
  365. package/dist/components/TagsList/utils/getKey/getKey.d.ts +2 -0
  366. package/dist/components/TagsList/utils/getKey/index.d.ts +1 -0
  367. package/dist/components/TagsList/utils/index.d.ts +2 -0
  368. package/dist/components/TextField/TextField.d.ts +28 -0
  369. package/dist/components/TextField/index.d.ts +1 -0
  370. package/dist/components/Tooltip/Tooltip.d.ts +16 -0
  371. package/dist/components/Tooltip/constants.d.ts +4 -0
  372. package/dist/components/Tooltip/index.d.ts +2 -0
  373. package/dist/components/Tooltip/styles.d.ts +7 -0
  374. package/dist/components/Tooltip/types.d.ts +2 -0
  375. package/dist/components/Typography/Typography.d.ts +48 -0
  376. package/dist/components/Typography/enums.d.ts +14 -0
  377. package/dist/components/Typography/hooks/index.d.ts +1 -0
  378. package/dist/components/Typography/hooks/useTypographyColor/index.d.ts +1 -0
  379. package/dist/components/Typography/hooks/useTypographyColor/useTypographyColor.d.ts +16 -0
  380. package/dist/components/Typography/index.d.ts +2 -0
  381. package/dist/components/Typography/styles.d.ts +2 -0
  382. package/dist/components/Typography/types.d.ts +4 -0
  383. package/dist/components/index.d.ts +62 -0
  384. package/dist/components/types.d.ts +1 -0
  385. package/dist/hooks/index.d.ts +3 -0
  386. package/dist/hooks/useMenu/index.d.ts +1 -0
  387. package/dist/hooks/useMenu/useMenu.d.ts +21 -0
  388. package/dist/hooks/usePopover/index.d.ts +1 -0
  389. package/dist/hooks/usePopover/usePopover.d.ts +11 -0
  390. package/dist/hooks/useViewportType/index.d.ts +1 -0
  391. package/dist/hooks/useViewportType/useViewportType.d.ts +5 -0
  392. package/dist/index.d.ts +3 -0
  393. package/dist/index.js +1080 -0
  394. package/dist/index.mjs +1080 -0
  395. package/dist/theme/baseTheme/baseTheme.d.ts +9 -0
  396. package/dist/theme/baseTheme/index.d.ts +1 -0
  397. package/dist/theme/breakpoints.d.ts +2 -0
  398. package/dist/theme/components/MuiAlert.d.ts +3 -0
  399. package/dist/theme/components/MuiAutocomplete.d.ts +3 -0
  400. package/dist/theme/components/MuiButton.d.ts +32 -0
  401. package/dist/theme/components/MuiButtonBase.d.ts +3 -0
  402. package/dist/theme/components/MuiCircularProgress.d.ts +4 -0
  403. package/dist/theme/components/MuiDialog.d.ts +3 -0
  404. package/dist/theme/components/MuiDialogActions.d.ts +3 -0
  405. package/dist/theme/components/MuiDialogContent.d.ts +3 -0
  406. package/dist/theme/components/MuiDialogTitle.d.ts +3 -0
  407. package/dist/theme/components/MuiDrawer.d.ts +3 -0
  408. package/dist/theme/components/MuiFormHelperText.d.ts +4 -0
  409. package/dist/theme/components/MuiFormLabel.d.ts +4 -0
  410. package/dist/theme/components/MuiInputLabel.d.ts +4 -0
  411. package/dist/theme/components/MuiLinearProgress.d.ts +4 -0
  412. package/dist/theme/components/MuiListItemButton.d.ts +3 -0
  413. package/dist/theme/components/MuiListItemText.d.ts +3 -0
  414. package/dist/theme/components/MuiMenu.d.ts +4 -0
  415. package/dist/theme/components/MuiMenuItem.d.ts +4 -0
  416. package/dist/theme/components/MuiOutlinedInput.d.ts +4 -0
  417. package/dist/theme/components/MuiPaginationItem.d.ts +3 -0
  418. package/dist/theme/components/MuiPaper.d.ts +3 -0
  419. package/dist/theme/components/MuiStep.d.ts +3 -0
  420. package/dist/theme/components/MuiStepConnector.d.ts +3 -0
  421. package/dist/theme/components/MuiStepLabel.d.ts +3 -0
  422. package/dist/theme/components/MuiSwitch.d.ts +3 -0
  423. package/dist/theme/components/MuiTab.d.ts +3 -0
  424. package/dist/theme/components/MuiTableCell.d.ts +3 -0
  425. package/dist/theme/components/MuiTableHead.d.ts +3 -0
  426. package/dist/theme/components/MuiTableRow.d.ts +3 -0
  427. package/dist/theme/components/MuiTabs.d.ts +3 -0
  428. package/dist/theme/components/MuiTextField.d.ts +3 -0
  429. package/dist/theme/components/MuiToggleButton.d.ts +3 -0
  430. package/dist/theme/components/MuiToggleButtonGroup.d.ts +3 -0
  431. package/dist/theme/components/MuiTypography.d.ts +21 -0
  432. package/dist/theme/components/components.d.ts +21 -0
  433. package/dist/theme/components/index.d.ts +1 -0
  434. package/dist/theme/constants.d.ts +1 -0
  435. package/dist/theme/elevation.d.ts +8 -0
  436. package/dist/theme/hooks/index.d.ts +1 -0
  437. package/dist/theme/hooks/useTheme/index.d.ts +2 -0
  438. package/dist/theme/index.d.ts +7 -0
  439. package/dist/theme/palette/componentsColors/componentsColors.d.ts +5 -0
  440. package/dist/theme/palette/componentsColors/index.d.ts +1 -0
  441. package/dist/theme/palette/componentsColors/linkColors/index.d.ts +1 -0
  442. package/dist/theme/palette/componentsColors/linkColors/linkColors.d.ts +7 -0
  443. package/dist/theme/palette/index.d.ts +3 -0
  444. package/dist/theme/palette/palette.d.ts +2 -0
  445. package/dist/theme/palette/types.d.ts +44 -0
  446. package/dist/theme/shape.d.ts +6 -0
  447. package/dist/theme/types.d.ts +21 -0
  448. package/dist/theme/typography.d.ts +153 -0
  449. package/package.json +47 -0
  450. package/rslib.config.ts +32 -0
  451. package/src/components/Accordion/Accordion.stories.tsx +126 -0
  452. package/src/components/Accordion/Accordion.tsx +80 -0
  453. package/src/components/Accordion/index.ts +1 -0
  454. package/src/components/Accordion/styles.ts +30 -0
  455. package/src/components/ActionCell/ActionCell.stories.tsx +226 -0
  456. package/src/components/ActionCell/ActionCell.tsx +71 -0
  457. package/src/components/ActionCell/MainAction/MainAction.tsx +85 -0
  458. package/src/components/ActionCell/MainAction/index.ts +1 -0
  459. package/src/components/ActionCell/SecondaryAction/SecondaryActions.tsx +45 -0
  460. package/src/components/ActionCell/SecondaryAction/index.ts +1 -0
  461. package/src/components/ActionCell/index.ts +1 -0
  462. package/src/components/ActionCell/styles.ts +6 -0
  463. package/src/components/ActionCell/types.ts +89 -0
  464. package/src/components/ActionCell/useLogic/index.ts +1 -0
  465. package/src/components/ActionCell/useLogic/useLogic.ts +46 -0
  466. package/src/components/AsyncAutocomplete/AsyncAutocomplete.stories.tsx +244 -0
  467. package/src/components/AsyncAutocomplete/AsyncAutocomplete.tsx +139 -0
  468. package/src/components/AsyncAutocomplete/constants.ts +7 -0
  469. package/src/components/AsyncAutocomplete/index.ts +1 -0
  470. package/src/components/AsyncAutocomplete/useLogic/index.ts +1 -0
  471. package/src/components/AsyncAutocomplete/useLogic/useLogic.ts +117 -0
  472. package/src/components/Autocomplete/Autocomplete.stories.tsx +275 -0
  473. package/src/components/Autocomplete/Autocomplete.tsx +301 -0
  474. package/src/components/Autocomplete/constants.ts +3 -0
  475. package/src/components/Autocomplete/enums.ts +4 -0
  476. package/src/components/Autocomplete/index.ts +1 -0
  477. package/src/components/Autocomplete/styles.ts +10 -0
  478. package/src/components/Autocomplete/useLogic/index.ts +1 -0
  479. package/src/components/Autocomplete/useLogic/useLogic.ts +88 -0
  480. package/src/components/Autocomplete/useLogic/utils/checkIsInputEmpty/checkIsInputEmpty.ts +8 -0
  481. package/src/components/Autocomplete/useLogic/utils/checkIsInputEmpty/index.ts +1 -0
  482. package/src/components/Autocomplete/useLogic/utils/index.ts +1 -0
  483. package/src/components/Badge/Badge.stories.tsx +189 -0
  484. package/src/components/Badge/Badge.tsx +43 -0
  485. package/src/components/Badge/index.ts +3 -0
  486. package/src/components/Badge/styles.ts +104 -0
  487. package/src/components/Badge/types.ts +9 -0
  488. package/src/components/BottomDrawer/BottomDrawer.stories.tsx +104 -0
  489. package/src/components/BottomDrawer/BottomDrawer.tsx +52 -0
  490. package/src/components/BottomDrawer/constants.ts +3 -0
  491. package/src/components/BottomDrawer/index.ts +1 -0
  492. package/src/components/BottomDrawer/styles.ts +44 -0
  493. package/src/components/Button/Button.stories.tsx +203 -0
  494. package/src/components/Button/Button.tsx +85 -0
  495. package/src/components/Button/constants.ts +1 -0
  496. package/src/components/Button/enums.ts +26 -0
  497. package/src/components/Button/index.ts +7 -0
  498. package/src/components/Button/styles.ts +19 -0
  499. package/src/components/Button/types.ts +30 -0
  500. package/src/components/Button/useLogic/index.ts +1 -0
  501. package/src/components/Button/useLogic/useLogic.ts +22 -0
  502. package/src/components/Checkbox/Checkbox.stories.tsx +154 -0
  503. package/src/components/Checkbox/Checkbox.tsx +39 -0
  504. package/src/components/Checkbox/icons.tsx +41 -0
  505. package/src/components/Checkbox/index.ts +1 -0
  506. package/src/components/Checkbox/styles.ts +70 -0
  507. package/src/components/CheckboxField/CheckboxField.stories.tsx +50 -0
  508. package/src/components/CheckboxField/CheckboxField.tsx +64 -0
  509. package/src/components/CheckboxField/index.ts +1 -0
  510. package/src/components/CheckboxField/styles.ts +17 -0
  511. package/src/components/Chevron/Chevron.stories.tsx +35 -0
  512. package/src/components/Chevron/Chevron.tsx +12 -0
  513. package/src/components/Chevron/index.ts +1 -0
  514. package/src/components/Chevron/styles.tsx +17 -0
  515. package/src/components/CircularProgress/CircularProgress.stories.tsx +52 -0
  516. package/src/components/CircularProgress/CircularProgress.tsx +42 -0
  517. package/src/components/CircularProgress/constants.ts +9 -0
  518. package/src/components/CircularProgress/index.ts +1 -0
  519. package/src/components/CircularProgress/useLogic/index.ts +1 -0
  520. package/src/components/CircularProgress/useLogic/useLogic.ts +9 -0
  521. package/src/components/Collapse/Collapse.stories.tsx +68 -0
  522. package/src/components/Collapse/Collapse.tsx +10 -0
  523. package/src/components/Collapse/index.ts +1 -0
  524. package/src/components/ConfigProvider/ConfigProvider.tsx +165 -0
  525. package/src/components/ConfigProvider/index.ts +1 -0
  526. package/src/components/ConfirmAction/ConfirmAction.stories.tsx +118 -0
  527. package/src/components/ConfirmAction/ConfirmAction.tsx +97 -0
  528. package/src/components/ConfirmAction/constants.ts +9 -0
  529. package/src/components/ConfirmAction/index.ts +1 -0
  530. package/src/components/ConfirmAction/styles.ts +17 -0
  531. package/src/components/ConfirmAction/useLogic/index.ts +1 -0
  532. package/src/components/ConfirmAction/useLogic/useLogic.ts +46 -0
  533. package/src/components/Container/Container.tsx +15 -0
  534. package/src/components/Container/index.ts +1 -0
  535. package/src/components/Container/styles.ts +76 -0
  536. package/src/components/ContentState/ContentState.stories.tsx +243 -0
  537. package/src/components/ContentState/ContentState.tsx +90 -0
  538. package/src/components/ContentState/index.ts +3 -0
  539. package/src/components/ContentState/styles.ts +11 -0
  540. package/src/components/ContentState/types.ts +30 -0
  541. package/src/components/CopyTypography/CopyTypography.stories.tsx +95 -0
  542. package/src/components/CopyTypography/CopyTypography.tsx +55 -0
  543. package/src/components/CopyTypography/enums.ts +5 -0
  544. package/src/components/CopyTypography/index.ts +1 -0
  545. package/src/components/CopyTypography/styles.ts +28 -0
  546. package/src/components/CopyTypography/useLogic/index.ts +1 -0
  547. package/src/components/CopyTypography/useLogic/useLogic.ts +38 -0
  548. package/src/components/DataGrid/Body/Body.tsx +185 -0
  549. package/src/components/DataGrid/Body/index.ts +1 -0
  550. package/src/components/DataGrid/Body/styles.tsx +16 -0
  551. package/src/components/DataGrid/Body/useLogic/index.ts +1 -0
  552. package/src/components/DataGrid/Body/useLogic/useLogic.ts +20 -0
  553. package/src/components/DataGrid/Cell/Cell.tsx +63 -0
  554. package/src/components/DataGrid/Cell/index.ts +1 -0
  555. package/src/components/DataGrid/Cell/styles.ts +26 -0
  556. package/src/components/DataGrid/Cell/useLogic/index.ts +1 -0
  557. package/src/components/DataGrid/Cell/useLogic/useLogic.ts +35 -0
  558. package/src/components/DataGrid/DataGrid.stories.tsx +1882 -0
  559. package/src/components/DataGrid/DataGrid.tsx +307 -0
  560. package/src/components/DataGrid/DataGridContext/DataGridContext.ts +15 -0
  561. package/src/components/DataGrid/DataGridContext/DataGridProvider/DataGridProvider.tsx +83 -0
  562. package/src/components/DataGrid/DataGridContext/DataGridProvider/index.ts +1 -0
  563. package/src/components/DataGrid/DataGridContext/index.ts +3 -0
  564. package/src/components/DataGrid/Head/Head.tsx +110 -0
  565. package/src/components/DataGrid/Head/index.ts +1 -0
  566. package/src/components/DataGrid/Head/styles.ts +21 -0
  567. package/src/components/DataGrid/Head/useLogic/index.ts +1 -0
  568. package/src/components/DataGrid/Head/useLogic/useLogic.tsx +65 -0
  569. package/src/components/DataGrid/HeadCell/HeadCell.tsx +68 -0
  570. package/src/components/DataGrid/HeadCell/index.ts +1 -0
  571. package/src/components/DataGrid/HeadCell/styles.ts +39 -0
  572. package/src/components/DataGrid/HeadCell/useLogic/index.ts +1 -0
  573. package/src/components/DataGrid/HeadCell/useLogic/useLogic.ts +29 -0
  574. package/src/components/DataGrid/Loader/Loader.tsx +26 -0
  575. package/src/components/DataGrid/Loader/index.ts +1 -0
  576. package/src/components/DataGrid/Loader/styles.ts +26 -0
  577. package/src/components/DataGrid/NoData/NoData.tsx +65 -0
  578. package/src/components/DataGrid/NoData/index.ts +1 -0
  579. package/src/components/DataGrid/Row/NestedChildren/NestedChildren.tsx +158 -0
  580. package/src/components/DataGrid/Row/NestedChildren/index.ts +1 -0
  581. package/src/components/DataGrid/Row/NestedChildren/styles.ts +80 -0
  582. package/src/components/DataGrid/Row/NestedChildren/useLogic/index.ts +1 -0
  583. package/src/components/DataGrid/Row/NestedChildren/useLogic/useLogic.ts +44 -0
  584. package/src/components/DataGrid/Row/Row.tsx +307 -0
  585. package/src/components/DataGrid/Row/RowContext/RowContext.ts +14 -0
  586. package/src/components/DataGrid/Row/RowContext/RowProvider/RowProvider.tsx +35 -0
  587. package/src/components/DataGrid/Row/RowContext/RowProvider/index.ts +1 -0
  588. package/src/components/DataGrid/Row/RowContext/index.ts +3 -0
  589. package/src/components/DataGrid/Row/constants.ts +3 -0
  590. package/src/components/DataGrid/Row/index.ts +3 -0
  591. package/src/components/DataGrid/Row/styles.ts +124 -0
  592. package/src/components/DataGrid/Row/useLogic/index.ts +1 -0
  593. package/src/components/DataGrid/Row/useLogic/useLogic.ts +144 -0
  594. package/src/components/DataGrid/Row/useLogic/utils/getColumnsMap/getColumnsMap.ts +20 -0
  595. package/src/components/DataGrid/Row/useLogic/utils/getColumnsMap/index.ts +1 -0
  596. package/src/components/DataGrid/Row/useLogic/utils/index.ts +3 -0
  597. package/src/components/DataGrid/Row/useLogic/utils/mergeColumnsOptions/index.ts +1 -0
  598. package/src/components/DataGrid/Row/useLogic/utils/mergeColumnsOptions/mergeColumnsOptions.ts +34 -0
  599. package/src/components/DataGrid/Row/utils/checkIsDisabled/checkIsDisabled.ts +15 -0
  600. package/src/components/DataGrid/Row/utils/checkIsDisabled/index.ts +1 -0
  601. package/src/components/DataGrid/Row/utils/index.ts +1 -0
  602. package/src/components/DataGrid/constants.ts +11 -0
  603. package/src/components/DataGrid/enums.ts +9 -0
  604. package/src/components/DataGrid/faker.ts +116 -0
  605. package/src/components/DataGrid/index.ts +11 -0
  606. package/src/components/DataGrid/styles.ts +31 -0
  607. package/src/components/DataGrid/types.ts +118 -0
  608. package/src/components/DataGrid/useLogic/index.ts +1 -0
  609. package/src/components/DataGrid/useLogic/useLogic.tsx +139 -0
  610. package/src/components/DataGrid/useLogic/utils/getGridTemplateColumns/getGridTemplateColumns.ts +7 -0
  611. package/src/components/DataGrid/useLogic/utils/getGridTemplateColumns/index.ts +1 -0
  612. package/src/components/DataGrid/useLogic/utils/index.ts +1 -0
  613. package/src/components/DataGrid/utils/alignToJustifyContent/alignToJustifyContent.ts +20 -0
  614. package/src/components/DataGrid/utils/alignToJustifyContent/constants.ts +7 -0
  615. package/src/components/DataGrid/utils/alignToJustifyContent/index.ts +1 -0
  616. package/src/components/DataGrid/utils/index.ts +1 -0
  617. package/src/components/DataGridActionCell/DataGridActionCell.stories.tsx +271 -0
  618. package/src/components/DataGridActionCell/DataGridActionCell.tsx +70 -0
  619. package/src/components/DataGridActionCell/MainAction/MainAction.tsx +76 -0
  620. package/src/components/DataGridActionCell/MainAction/MainIconButton/MainIconButton.tsx +88 -0
  621. package/src/components/DataGridActionCell/MainAction/MainIconButton/index.ts +1 -0
  622. package/src/components/DataGridActionCell/MainAction/MainIconButton/useLogic/index.ts +1 -0
  623. package/src/components/DataGridActionCell/MainAction/MainIconButton/useLogic/useLogic.ts +31 -0
  624. package/src/components/DataGridActionCell/MainAction/index.ts +1 -0
  625. package/src/components/DataGridActionCell/SecondaryAction/SecondaryAction.tsx +54 -0
  626. package/src/components/DataGridActionCell/SecondaryAction/index.ts +1 -0
  627. package/src/components/DataGridActionCell/index.ts +1 -0
  628. package/src/components/DataGridActionCell/styles.ts +6 -0
  629. package/src/components/DataGridActionCell/types.ts +123 -0
  630. package/src/components/DataGridActionCell/useLogic/index.ts +1 -0
  631. package/src/components/DataGridActionCell/useLogic/useLogic.ts +53 -0
  632. package/src/components/DataGridOld/Body/Body.tsx +56 -0
  633. package/src/components/DataGridOld/Body/index.ts +1 -0
  634. package/src/components/DataGridOld/Body/styles.ts +12 -0
  635. package/src/components/DataGridOld/Cell/Cell.tsx +41 -0
  636. package/src/components/DataGridOld/Cell/index.ts +1 -0
  637. package/src/components/DataGridOld/Cell/styles.ts +25 -0
  638. package/src/components/DataGridOld/DataGridOld.tsx +65 -0
  639. package/src/components/DataGridOld/Head/Head.tsx +31 -0
  640. package/src/components/DataGridOld/Head/index.ts +1 -0
  641. package/src/components/DataGridOld/Head/styles.ts +11 -0
  642. package/src/components/DataGridOld/HeadCell/HeadCell.tsx +14 -0
  643. package/src/components/DataGridOld/HeadCell/index.ts +1 -0
  644. package/src/components/DataGridOld/HeadCell/styles.ts +29 -0
  645. package/src/components/DataGridOld/Row/Row.tsx +53 -0
  646. package/src/components/DataGridOld/Row/index.ts +1 -0
  647. package/src/components/DataGridOld/Row/styles.ts +24 -0
  648. package/src/components/DataGridOld/State/State.tsx +32 -0
  649. package/src/components/DataGridOld/State/index.ts +1 -0
  650. package/src/components/DataGridOld/State/styles.ts +25 -0
  651. package/src/components/DataGridOld/constants.ts +1 -0
  652. package/src/components/DataGridOld/index.ts +2 -0
  653. package/src/components/DataGridOld/styles.ts +24 -0
  654. package/src/components/DataGridOld/types.ts +18 -0
  655. package/src/components/DataGridPagination/DataGridPagination.stories.tsx +206 -0
  656. package/src/components/DataGridPagination/DataGridPagination.tsx +102 -0
  657. package/src/components/DataGridPagination/constants.ts +3 -0
  658. package/src/components/DataGridPagination/faker.ts +36 -0
  659. package/src/components/DataGridPagination/index.ts +1 -0
  660. package/src/components/DataGridPagination/styles.ts +26 -0
  661. package/src/components/DataGridPagination/useLogic/index.ts +1 -0
  662. package/src/components/DataGridPagination/useLogic/useLogic.ts +53 -0
  663. package/src/components/Description/Description.stories.tsx +327 -0
  664. package/src/components/Description/Description.tsx +73 -0
  665. package/src/components/Description/DescriptionContext/DescriptionContext.tsx +15 -0
  666. package/src/components/Description/DescriptionContext/DescriptionContextProvider/DescriptionContextProvider.tsx +21 -0
  667. package/src/components/Description/DescriptionContext/DescriptionContextProvider/index.ts +1 -0
  668. package/src/components/Description/DescriptionContext/index.ts +3 -0
  669. package/src/components/Description/Name/Name.tsx +28 -0
  670. package/src/components/Description/Name/index.ts +1 -0
  671. package/src/components/Description/Name/styles.ts +29 -0
  672. package/src/components/Description/Value/Value.tsx +73 -0
  673. package/src/components/Description/Value/index.ts +1 -0
  674. package/src/components/Description/Value/styles.ts +62 -0
  675. package/src/components/Description/Value/useLogic/index.ts +1 -0
  676. package/src/components/Description/Value/useLogic/useLogic.ts +18 -0
  677. package/src/components/Description/constants.ts +5 -0
  678. package/src/components/Description/index.ts +3 -0
  679. package/src/components/Description/styles.ts +27 -0
  680. package/src/components/Description/useLogic/index.ts +1 -0
  681. package/src/components/Description/useLogic/useLogic.ts +21 -0
  682. package/src/components/DescriptionList/DescriptionList.stories.tsx +475 -0
  683. package/src/components/DescriptionList/DescriptionList.tsx +108 -0
  684. package/src/components/DescriptionList/index.ts +3 -0
  685. package/src/components/DescriptionList/styles.ts +67 -0
  686. package/src/components/DescriptionList/types.ts +46 -0
  687. package/src/components/DescriptionList/utils/getTooltipProps/getTooltipProps.ts +3 -0
  688. package/src/components/DescriptionList/utils/getTooltipProps/index.ts +1 -0
  689. package/src/components/DescriptionList/utils/index.ts +1 -0
  690. package/src/components/Dialog/Dialog.stories.tsx +429 -0
  691. package/src/components/Dialog/Dialog.tsx +68 -0
  692. package/src/components/Dialog/constants.ts +7 -0
  693. package/src/components/Dialog/index.ts +1 -0
  694. package/src/components/Dialog/styles.ts +26 -0
  695. package/src/components/DialogActions/DialogActions.stories.tsx +114 -0
  696. package/src/components/DialogActions/DialogActions.tsx +19 -0
  697. package/src/components/DialogActions/index.ts +1 -0
  698. package/src/components/DialogActions/styles.ts +17 -0
  699. package/src/components/DialogContent/DialogContent.stories.tsx +70 -0
  700. package/src/components/DialogContent/DialogContent.tsx +11 -0
  701. package/src/components/DialogContent/index.ts +1 -0
  702. package/src/components/DialogContent/styles.ts +13 -0
  703. package/src/components/DialogContentText/DialogContentText.stories.tsx +64 -0
  704. package/src/components/DialogContentText/DialogContentText.tsx +12 -0
  705. package/src/components/DialogContentText/index.ts +1 -0
  706. package/src/components/DialogContentText/styles.ts +8 -0
  707. package/src/components/DialogHeader/DialogHeader.stories.tsx +107 -0
  708. package/src/components/DialogHeader/DialogHeader.tsx +58 -0
  709. package/src/components/DialogHeader/index.ts +1 -0
  710. package/src/components/DialogHeader/styles.ts +63 -0
  711. package/src/components/DialogTitle/DialogTitle.tsx +43 -0
  712. package/src/components/DialogTitle/index.ts +1 -0
  713. package/src/components/Divider/Divider.stories.tsx +57 -0
  714. package/src/components/Divider/Divider.tsx +10 -0
  715. package/src/components/Divider/index.ts +1 -0
  716. package/src/components/ErrorBoundary/ErrorBoundary.stories.tsx +57 -0
  717. package/src/components/ErrorBoundary/ErrorBoundary.stubs.tsx +67 -0
  718. package/src/components/ErrorBoundary/ErrorBoundary.tsx +73 -0
  719. package/src/components/ErrorBoundary/constants.ts +15 -0
  720. package/src/components/ErrorBoundary/enums.ts +9 -0
  721. package/src/components/ErrorBoundary/index.ts +1 -0
  722. package/src/components/FormControl/FormControl.tsx +12 -0
  723. package/src/components/FormControl/index.tsx +1 -0
  724. package/src/components/FormControlLabel/FormControlLabel.tsx +6 -0
  725. package/src/components/FormControlLabel/index.ts +3 -0
  726. package/src/components/FormControlLabel/styles.ts +14 -0
  727. package/src/components/FormControlLabel/types.ts +6 -0
  728. package/src/components/FormHelperText/FormHelperText.tsx +29 -0
  729. package/src/components/FormHelperText/FormHelperTextContent/FormHelperTextContent.tsx +38 -0
  730. package/src/components/FormHelperText/FormHelperTextContent/index.ts +1 -0
  731. package/src/components/FormHelperText/FormHelperTextContent/styles.ts +44 -0
  732. package/src/components/FormHelperText/index.ts +3 -0
  733. package/src/components/GuidTypography/GuidTypography.stories.tsx +57 -0
  734. package/src/components/GuidTypography/GuidTypography.tsx +10 -0
  735. package/src/components/GuidTypography/index.ts +1 -0
  736. package/src/components/IconButton/IconButton.stories.tsx +236 -0
  737. package/src/components/IconButton/IconButton.tsx +57 -0
  738. package/src/components/IconButton/index.ts +1 -0
  739. package/src/components/IconButton/styles.ts +52 -0
  740. package/src/components/IconDropdownButton/IconDropdownButton.stories.tsx +196 -0
  741. package/src/components/IconDropdownButton/IconDropdownButton.tsx +38 -0
  742. package/src/components/IconDropdownButton/index.ts +1 -0
  743. package/src/components/InternalErrorPlaceholder/InternalErrorPlaceholder.stories.tsx +33 -0
  744. package/src/components/InternalErrorPlaceholder/InternalErrorPlaceholder.tsx +39 -0
  745. package/src/components/InternalErrorPlaceholder/index.ts +1 -0
  746. package/src/components/Link/Link.stories.tsx +88 -0
  747. package/src/components/Link/Link.tsx +44 -0
  748. package/src/components/Link/index.ts +1 -0
  749. package/src/components/Link/styles.ts +37 -0
  750. package/src/components/List/List.stories.tsx +254 -0
  751. package/src/components/List/List.tsx +9 -0
  752. package/src/components/List/index.ts +1 -0
  753. package/src/components/ListItem/ListItem.stories.tsx +84 -0
  754. package/src/components/ListItem/ListItem.tsx +12 -0
  755. package/src/components/ListItem/index.ts +1 -0
  756. package/src/components/ListItemButton/ListItemButton.stories.tsx +112 -0
  757. package/src/components/ListItemButton/ListItemButton.tsx +74 -0
  758. package/src/components/ListItemButton/constants.ts +5 -0
  759. package/src/components/ListItemButton/index.ts +1 -0
  760. package/src/components/ListItemIcon/ListItemIcon.stories.tsx +41 -0
  761. package/src/components/ListItemIcon/ListItemIcon.tsx +14 -0
  762. package/src/components/ListItemIcon/index.ts +1 -0
  763. package/src/components/ListItemIcon/styles.ts +5 -0
  764. package/src/components/ListItemText/ListItemText.stories.tsx +39 -0
  765. package/src/components/ListItemText/ListItemText.tsx +11 -0
  766. package/src/components/ListItemText/index.ts +1 -0
  767. package/src/components/ListSubheader/ListSubheader.stories.tsx +42 -0
  768. package/src/components/ListSubheader/ListSubheader.tsx +12 -0
  769. package/src/components/ListSubheader/index.ts +1 -0
  770. package/src/components/Menu/Menu.stories.tsx +108 -0
  771. package/src/components/Menu/Menu.tsx +38 -0
  772. package/src/components/Menu/index.ts +1 -0
  773. package/src/components/MenuItem/MenuItem.stories.tsx +110 -0
  774. package/src/components/MenuItem/MenuItem.tsx +68 -0
  775. package/src/components/MenuItem/index.ts +1 -0
  776. package/src/components/MenuList/MenuList.stories.tsx +86 -0
  777. package/src/components/MenuList/MenuList.tsx +6 -0
  778. package/src/components/MenuList/index.ts +3 -0
  779. package/src/components/MenuList/styles.ts +10 -0
  780. package/src/components/MenuList/types.ts +11 -0
  781. package/src/components/NavMenu/Item/Item.tsx +87 -0
  782. package/src/components/NavMenu/Item/ItemButton/ItemButton.tsx +76 -0
  783. package/src/components/NavMenu/Item/ItemButton/index.ts +1 -0
  784. package/src/components/NavMenu/Item/ItemButton/styles.ts +143 -0
  785. package/src/components/NavMenu/Item/List/List.tsx +43 -0
  786. package/src/components/NavMenu/Item/List/index.ts +1 -0
  787. package/src/components/NavMenu/Item/index.ts +1 -0
  788. package/src/components/NavMenu/NavMenu.stories.tsx +116 -0
  789. package/src/components/NavMenu/NavMenu.tsx +32 -0
  790. package/src/components/NavMenu/index.ts +1 -0
  791. package/src/components/OutdatedReleasePlaceholder/OutdatedReleasePlaceholder.stories.tsx +31 -0
  792. package/src/components/OutdatedReleasePlaceholder/OutdatedReleasePlaceholder.tsx +30 -0
  793. package/src/components/OutdatedReleasePlaceholder/index.ts +1 -0
  794. package/src/components/OverflowTypography/OverflowTypography.stories.tsx +112 -0
  795. package/src/components/OverflowTypography/OverflowTypography.tsx +106 -0
  796. package/src/components/OverflowTypography/hooks/index.ts +1 -0
  797. package/src/components/OverflowTypography/hooks/useOverflowed/index.ts +1 -0
  798. package/src/components/OverflowTypography/hooks/useOverflowed/useOverflowed.ts +58 -0
  799. package/src/components/OverflowTypography/index.ts +1 -0
  800. package/src/components/OverflowTypography/styles.ts +39 -0
  801. package/src/components/OverflowTypography/useLogic/index.ts +1 -0
  802. package/src/components/OverflowTypography/useLogic/useLogic.ts +29 -0
  803. package/src/components/OverflowTypography/utils/index.ts +1 -0
  804. package/src/components/OverflowTypography/utils/truncateString/index.ts +1 -0
  805. package/src/components/OverflowTypography/utils/truncateString/truncateString.ts +9 -0
  806. package/src/components/Pagination/Pagination.stories.tsx +55 -0
  807. package/src/components/Pagination/Pagination.tsx +7 -0
  808. package/src/components/Pagination/index.ts +3 -0
  809. package/src/components/Pagination/types.ts +13 -0
  810. package/src/components/Paper/Paper.tsx +25 -0
  811. package/src/components/Paper/index.ts +1 -0
  812. package/src/components/Placeholder/Image/Image.tsx +16 -0
  813. package/src/components/Placeholder/Image/index.ts +1 -0
  814. package/src/components/Placeholder/Image/styles.ts +24 -0
  815. package/src/components/Placeholder/Placeholder.stories.tsx +204 -0
  816. package/src/components/Placeholder/Placeholder.tsx +108 -0
  817. package/src/components/Placeholder/constants.ts +31 -0
  818. package/src/components/Placeholder/index.ts +5 -0
  819. package/src/components/Placeholder/styles.ts +94 -0
  820. package/src/components/Placeholder/types.ts +1 -0
  821. package/src/components/Popover/Popover.stories.tsx +210 -0
  822. package/src/components/Popover/Popover.tsx +39 -0
  823. package/src/components/Popover/index.ts +1 -0
  824. package/src/components/SearchField/SearchField.tsx +93 -0
  825. package/src/components/SearchField/index.ts +1 -0
  826. package/src/components/SearchField/styles.ts +38 -0
  827. package/src/components/Select/Select.stories.tsx +324 -0
  828. package/src/components/Select/Select.tsx +204 -0
  829. package/src/components/Select/constants.ts +1 -0
  830. package/src/components/Select/index.ts +1 -0
  831. package/src/components/Select/styles.ts +60 -0
  832. package/src/components/Select/useLogic/index.ts +1 -0
  833. package/src/components/Select/useLogic/useLogic.ts +53 -0
  834. package/src/components/Tag/Tag.stories.tsx +592 -0
  835. package/src/components/Tag/Tag.tsx +102 -0
  836. package/src/components/Tag/enums.ts +20 -0
  837. package/src/components/Tag/index.ts +3 -0
  838. package/src/components/Tag/styles.ts +332 -0
  839. package/src/components/Tag/types.ts +9 -0
  840. package/src/components/TagBadge/TagBadge.stories.tsx +235 -0
  841. package/src/components/TagBadge/TagBadge.tsx +47 -0
  842. package/src/components/TagBadge/index.ts +1 -0
  843. package/src/components/TagBadge/styles.ts +14 -0
  844. package/src/components/TagBadge/utils/getCheckableTagBadgeBgColor/getCheckableTagBadgeBgColor.ts +31 -0
  845. package/src/components/TagBadge/utils/getCheckableTagBadgeBgColor/index.ts +1 -0
  846. package/src/components/TagBadge/utils/index.ts +1 -0
  847. package/src/components/TagsList/Tag/Tag.tsx +49 -0
  848. package/src/components/TagsList/Tag/index.ts +1 -0
  849. package/src/components/TagsList/Tag/styles.ts +19 -0
  850. package/src/components/TagsList/Tag/useLogic/index.ts +1 -0
  851. package/src/components/TagsList/Tag/useLogic/useLogic.ts +11 -0
  852. package/src/components/TagsList/TagsList.tsx +80 -0
  853. package/src/components/TagsList/index.ts +3 -0
  854. package/src/components/TagsList/styles.ts +6 -0
  855. package/src/components/TagsList/types.ts +1 -0
  856. package/src/components/TagsList/useLogic/index.ts +1 -0
  857. package/src/components/TagsList/useLogic/useLogic.ts +184 -0
  858. package/src/components/TagsList/utils/getElementByText/getElementByText.ts +21 -0
  859. package/src/components/TagsList/utils/getElementByText/index.ts +1 -0
  860. package/src/components/TagsList/utils/getKey/getKey.ts +11 -0
  861. package/src/components/TagsList/utils/getKey/index.ts +1 -0
  862. package/src/components/TagsList/utils/index.ts +3 -0
  863. package/src/components/TextField/TextField.stories.tsx +97 -0
  864. package/src/components/TextField/TextField.tsx +117 -0
  865. package/src/components/TextField/index.ts +1 -0
  866. package/src/components/Tooltip/Tooltip.stories.tsx +237 -0
  867. package/src/components/Tooltip/Tooltip.tsx +48 -0
  868. package/src/components/Tooltip/constants.ts +4 -0
  869. package/src/components/Tooltip/index.ts +3 -0
  870. package/src/components/Tooltip/styles.tsx +65 -0
  871. package/src/components/Tooltip/types.ts +3 -0
  872. package/src/components/Typography/Typography.stories.tsx +193 -0
  873. package/src/components/Typography/Typography.tsx +107 -0
  874. package/src/components/Typography/enums.ts +14 -0
  875. package/src/components/Typography/hooks/index.ts +1 -0
  876. package/src/components/Typography/hooks/useTypographyColor/index.ts +1 -0
  877. package/src/components/Typography/hooks/useTypographyColor/useTypographyColor.tsx +54 -0
  878. package/src/components/Typography/index.ts +3 -0
  879. package/src/components/Typography/styles.ts +9 -0
  880. package/src/components/Typography/types.ts +30 -0
  881. package/src/components/index.ts +123 -0
  882. package/src/components/types.ts +1 -0
  883. package/src/hooks/index.ts +3 -0
  884. package/src/hooks/useMenu/index.ts +1 -0
  885. package/src/hooks/useMenu/useMenu.stories.tsx +31 -0
  886. package/src/hooks/useMenu/useMenu.ts +45 -0
  887. package/src/hooks/usePopover/index.ts +1 -0
  888. package/src/hooks/usePopover/usePopover.ts +27 -0
  889. package/src/hooks/useViewportType/index.ts +1 -0
  890. package/src/hooks/useViewportType/useViewportType.stories.tsx +30 -0
  891. package/src/hooks/useViewportType/useViewportType.ts +13 -0
  892. package/src/illustrations/certificates-not-found.svg +91 -0
  893. package/src/illustrations/data-access-disabled.svg +103 -0
  894. package/src/illustrations/data-access-success.svg +119 -0
  895. package/src/illustrations/drop-files-in.svg +40 -0
  896. package/src/illustrations/drop-files-out.svg +43 -0
  897. package/src/illustrations/error.svg +159 -0
  898. package/src/illustrations/features.svg +35 -0
  899. package/src/illustrations/mail.svg +84 -0
  900. package/src/illustrations/no-data.svg +1 -0
  901. package/src/illustrations/no-notifications.svg +102 -0
  902. package/src/illustrations/outdated-release.svg +173 -0
  903. package/src/illustrations/placeholder.svg +20 -0
  904. package/src/illustrations/search.svg +38 -0
  905. package/src/illustrations/sketchpad.svg +114 -0
  906. package/src/illustrations/technical-support.svg +341 -0
  907. package/src/index.ts +3 -0
  908. package/src/theme/baseTheme/baseTheme.ts +49 -0
  909. package/src/theme/baseTheme/index.ts +1 -0
  910. package/src/theme/breakpoints.ts +11 -0
  911. package/src/theme/components/MuiAlert.ts +70 -0
  912. package/src/theme/components/MuiAutocomplete.ts +94 -0
  913. package/src/theme/components/MuiButton.ts +418 -0
  914. package/src/theme/components/MuiButtonBase.ts +16 -0
  915. package/src/theme/components/MuiCircularProgress.ts +22 -0
  916. package/src/theme/components/MuiDialog.ts +13 -0
  917. package/src/theme/components/MuiDialogActions.ts +17 -0
  918. package/src/theme/components/MuiDialogContent.ts +13 -0
  919. package/src/theme/components/MuiDialogTitle.ts +24 -0
  920. package/src/theme/components/MuiDrawer.ts +15 -0
  921. package/src/theme/components/MuiFormHelperText.ts +23 -0
  922. package/src/theme/components/MuiFormLabel.ts +16 -0
  923. package/src/theme/components/MuiInputLabel.ts +33 -0
  924. package/src/theme/components/MuiLinearProgress.ts +22 -0
  925. package/src/theme/components/MuiListItemButton.ts +16 -0
  926. package/src/theme/components/MuiListItemText.ts +16 -0
  927. package/src/theme/components/MuiMenu.ts +32 -0
  928. package/src/theme/components/MuiMenuItem.ts +36 -0
  929. package/src/theme/components/MuiOutlinedInput.ts +75 -0
  930. package/src/theme/components/MuiPaginationItem.ts +16 -0
  931. package/src/theme/components/MuiPaper.ts +38 -0
  932. package/src/theme/components/MuiStep.ts +16 -0
  933. package/src/theme/components/MuiStepConnector.ts +11 -0
  934. package/src/theme/components/MuiStepLabel.ts +30 -0
  935. package/src/theme/components/MuiSwitch.ts +153 -0
  936. package/src/theme/components/MuiTab.ts +15 -0
  937. package/src/theme/components/MuiTableCell.ts +16 -0
  938. package/src/theme/components/MuiTableHead.ts +15 -0
  939. package/src/theme/components/MuiTableRow.ts +19 -0
  940. package/src/theme/components/MuiTabs.ts +19 -0
  941. package/src/theme/components/MuiTextField.ts +28 -0
  942. package/src/theme/components/MuiToggleButton.ts +14 -0
  943. package/src/theme/components/MuiToggleButtonGroup.ts +10 -0
  944. package/src/theme/components/MuiTypography.ts +41 -0
  945. package/src/theme/components/components.ts +155 -0
  946. package/src/theme/components/index.ts +1 -0
  947. package/src/theme/constants.ts +1 -0
  948. package/src/theme/elevation.ts +15 -0
  949. package/src/theme/hooks/index.ts +1 -0
  950. package/src/theme/hooks/useTheme/index.ts +7 -0
  951. package/src/theme/index.ts +13 -0
  952. package/src/theme/palette/componentsColors/componentsColors.ts +9 -0
  953. package/src/theme/palette/componentsColors/index.ts +1 -0
  954. package/src/theme/palette/componentsColors/linkColors/index.ts +1 -0
  955. package/src/theme/palette/componentsColors/linkColors/linkColors.ts +13 -0
  956. package/src/theme/palette/index.ts +5 -0
  957. package/src/theme/palette/palette.ts +125 -0
  958. package/src/theme/palette/types.ts +55 -0
  959. package/src/theme/shape.ts +11 -0
  960. package/src/theme/types.ts +30 -0
  961. package/src/theme/typography.ts +191 -0
  962. package/tsconfig.json +15 -0
@@ -0,0 +1,1882 @@
1
+ import type { Meta } from '@storybook/react';
2
+ import { type ChangeEvent, useEffect, useMemo, useState } from 'react';
3
+
4
+ import { ConfigProvider } from '../ConfigProvider';
5
+ import {
6
+ DataGridActionCell,
7
+ type DataGridActionCellProps,
8
+ type DataGridActions,
9
+ } from '../DataGridActionCell';
10
+ import { DataGridPagination } from '../DataGridPagination';
11
+
12
+ import { Eye, Pencil, Send, Trash } from 'lucide-react';
13
+ import { DataGrid } from './DataGrid';
14
+ import {
15
+ makeColumns,
16
+ makeDataList,
17
+ makeDataListWithTree,
18
+ makeRandomDate,
19
+ } from './faker';
20
+ import type {
21
+ DataGridColumns,
22
+ DataGridRowWithOptions,
23
+ DataGridSort,
24
+ } from './types';
25
+
26
+ const errorIllustration = '../../illustrations/error.svg';
27
+
28
+ /**
29
+ * DataGrid — отображает информацию в удобном для просмотра виде. Может включать:
30
+ - Соответствующую визуализацию
31
+ - Навигацию
32
+ - Инструменты для запроса и обработки данных
33
+ *
34
+ */
35
+ const meta: Meta<typeof DataGrid> = {
36
+ title: 'Components/Data Display/DataGrid',
37
+ component: DataGrid,
38
+ };
39
+
40
+ export default meta;
41
+
42
+ type DataType = {
43
+ id: string;
44
+ documentName: string;
45
+ recipient: string;
46
+ createDate: string;
47
+ actions?: object;
48
+ };
49
+
50
+ type SortField = 'documentName' | 'recipient' | 'createDate';
51
+
52
+ const FAKE_DATA_TEMPLATE: DataType = {
53
+ id: '1',
54
+ documentName: 'Договор №1',
55
+ recipient: 'ИП Иванов О.В.',
56
+ createDate: '2022-03-24T17:50:40.206Z',
57
+ };
58
+
59
+ const FAKE_ACTIONS: DataGridActions<DataType> = {
60
+ main: [
61
+ {
62
+ icon: <Eye />,
63
+ name: 'Просмотреть',
64
+ onClick: () => console.log('main'),
65
+ isBlockingOperation: true,
66
+ },
67
+ {
68
+ icon: <Send />,
69
+ nested: true,
70
+ name: 'Отправить',
71
+ actions: [
72
+ { name: 'Туда', onClick: () => console.log('nested 1') },
73
+ { name: 'Сюда', onClick: () => console.log('nested 2') },
74
+ ],
75
+ },
76
+ ],
77
+ secondary: [
78
+ { name: 'Редактировать', onClick: () => console.log('secondary 1') },
79
+ { name: 'Удалить', onClick: () => console.log('secondary 2') },
80
+ ],
81
+ };
82
+
83
+ const FAKE_COLUMNS: DataGridColumns<DataType>[] = [
84
+ {
85
+ field: 'documentName',
86
+ label: 'Наименование документа',
87
+ sortable: true,
88
+ },
89
+ {
90
+ field: 'recipient',
91
+ label: 'Получатель',
92
+ sortable: true,
93
+ },
94
+ {
95
+ field: 'createDate',
96
+ label: 'Дата создания',
97
+ sortable: true,
98
+ format: ({ createDate }) => new Date(createDate).toLocaleDateString(),
99
+ },
100
+ {
101
+ field: 'actions',
102
+ label: 'Действия',
103
+ sortable: false,
104
+ align: 'center',
105
+ width: '120px',
106
+ renderCell: (row) => {
107
+ return <DataGridActionCell actions={FAKE_ACTIONS} row={row} />;
108
+ },
109
+ },
110
+ ];
111
+
112
+ type FakeActionCellProps<TRow> = Pick<DataGridActionCellProps<TRow>, 'row'>;
113
+
114
+ /**
115
+ * DataGrid без пагинации
116
+ */
117
+ export const Example = () => {
118
+ const columns = makeColumns(FAKE_COLUMNS);
119
+ const fakeData: DataGridRowWithOptions<DataType>[] = [
120
+ {
121
+ id: '123456789',
122
+ documentName: 'Договор №12345678',
123
+ recipient: 'ПАО "Первый завод"',
124
+ createDate: makeRandomDate(),
125
+ },
126
+ ...makeDataList(FAKE_DATA_TEMPLATE),
127
+ ];
128
+
129
+ const [isLoading, setLoading] = useState(true);
130
+ const [slicedData, setSlicedData] = useState<DataType[]>([]);
131
+
132
+ useEffect(() => {
133
+ setTimeout(() => {
134
+ setSlicedData(fakeData.slice(0, 10));
135
+ setLoading(false);
136
+ }, 1500);
137
+ }, []);
138
+
139
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
140
+
141
+ return (
142
+ <DataGrid<DataType, SortField>
143
+ keyId='id'
144
+ rows={slicedData}
145
+ columns={columns}
146
+ isLoading={isLoading}
147
+ onRowClick={handleRowClick}
148
+ onRetry={() => {}}
149
+ />
150
+ );
151
+ };
152
+
153
+ /**
154
+ * Постраничное отображение данных в таблице.
155
+ * Внизу таблицы есть область, в которой слева отображается счетчик данных на странице из общего количества данных, справа - кнопки с нумерацией страниц таблицы для переключения между ними.
156
+ */
157
+ export const WithPagination = () => {
158
+ const columns = makeColumns(FAKE_COLUMNS);
159
+ const fakeData: DataGridRowWithOptions<DataType>[] = [
160
+ {
161
+ id: '123456789',
162
+ documentName: 'Договор №12345678',
163
+ recipient: 'ПАО "Первый завод"',
164
+ createDate: makeRandomDate(),
165
+ },
166
+ ...makeDataList(FAKE_DATA_TEMPLATE),
167
+ ];
168
+
169
+ const [isLoading, setLoading] = useState(true);
170
+ const [slicedData, setSlicedData] = useState<DataType[]>([]);
171
+ const [page, setPage] = useState<number>(1);
172
+
173
+ useEffect(() => {
174
+ setTimeout(() => {
175
+ setSlicedData(fakeData.slice((page - 1) * 10, page * 10));
176
+ setLoading(false);
177
+ }, 1500);
178
+ }, []);
179
+
180
+ const handleChangePage = (
181
+ _event: ChangeEvent<unknown>,
182
+ newPage: number,
183
+ ): void => {
184
+ setLoading(true);
185
+ setPage(newPage);
186
+
187
+ setTimeout(() => {
188
+ setLoading(false);
189
+ setSlicedData(fakeData.slice((newPage - 1) * 10, newPage * 10));
190
+ }, 1500);
191
+ };
192
+
193
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
194
+
195
+ return (
196
+ <DataGrid<DataType, SortField>
197
+ keyId='id'
198
+ rows={slicedData}
199
+ columns={columns}
200
+ isLoading={isLoading}
201
+ footer={
202
+ <DataGridPagination
203
+ rowsPerPage={10}
204
+ totalCount={fakeData.length}
205
+ onChange={handleChangePage}
206
+ page={page}
207
+ />
208
+ }
209
+ onRowClick={handleRowClick}
210
+ onRetry={() => {}}
211
+ />
212
+ );
213
+ };
214
+
215
+ /**
216
+ * DataGrid с сортировкой
217
+ */
218
+ export const WithSorting = () => {
219
+ const columns = makeColumns(FAKE_COLUMNS);
220
+ const fakeData: DataGridRowWithOptions<DataType>[] = [
221
+ {
222
+ id: '123456789',
223
+ documentName: 'Договор №12345678',
224
+ recipient: 'ПАО "Первый завод"',
225
+ createDate: makeRandomDate(),
226
+ },
227
+ ...makeDataList(FAKE_DATA_TEMPLATE),
228
+ ];
229
+
230
+ const [isLoading, setLoading] = useState(true);
231
+ const [slicedData, setSlicedData] = useState<DataType[]>([]);
232
+ const [sorting, setSorting] = useState<DataGridSort<SortField>>();
233
+
234
+ useEffect(() => {
235
+ setTimeout(() => {
236
+ setSlicedData(fakeData.slice(0, 10));
237
+ setLoading(false);
238
+ }, 1500);
239
+ }, []);
240
+
241
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
242
+
243
+ const handleSort = (newSorting: DataGridSort<SortField> | undefined) => {
244
+ if (newSorting) {
245
+ const sortData = (
246
+ array: DataType[],
247
+ field: SortField,
248
+ sortOrder: 'asc' | 'desc',
249
+ ) => {
250
+ const sortedArray = [...array];
251
+
252
+ sortedArray.sort((a, b) => {
253
+ const valueA = a[field];
254
+ const valueB = b[field];
255
+
256
+ if (valueA === valueB) {
257
+ return 0;
258
+ }
259
+
260
+ if (field === 'documentName') {
261
+ // Разделение текстовой и числовой частей
262
+ const regex = /([^\d]+)(\d+)/;
263
+ const matchA = valueA.match(regex);
264
+ const matchB = valueB.match(regex);
265
+
266
+ // Проверка на null
267
+ if (matchA === null || matchB === null) {
268
+ return 0;
269
+ }
270
+
271
+ const [, textA, numberA] = matchA;
272
+ const [, textB, numberB] = matchB;
273
+
274
+ const comparison =
275
+ textA.localeCompare(textB) || Number(numberA) - Number(numberB);
276
+
277
+ // Определение порядка сортировки
278
+ return sortOrder === 'desc' ? -1 * comparison : comparison;
279
+ }
280
+ // Если не сортируем по полю documentName, используем прежний код сортировки
281
+ if (valueA < valueB) {
282
+ return sortOrder === 'desc' ? 1 : -1;
283
+ }
284
+
285
+ if (valueA > valueB) {
286
+ return sortOrder === 'desc' ? -1 : 1;
287
+ }
288
+
289
+ return 0;
290
+ });
291
+
292
+ return sortedArray;
293
+ };
294
+
295
+ setSlicedData(sortData(slicedData, newSorting.fieldId, newSorting.sort));
296
+ } else {
297
+ setSlicedData(fakeData.slice(0, 10));
298
+ }
299
+
300
+ setSorting(newSorting);
301
+ };
302
+
303
+ return (
304
+ <DataGrid<DataType, SortField>
305
+ keyId='id'
306
+ rows={slicedData}
307
+ columns={columns}
308
+ isLoading={isLoading}
309
+ onSort={handleSort}
310
+ sorting={sorting}
311
+ onRowClick={handleRowClick}
312
+ onRetry={() => {}}
313
+ />
314
+ );
315
+ };
316
+
317
+ /**
318
+ * Prop `activeRowId` позволяет отобразить активный ряд в таблице в зависимости от значения prop `keyId`
319
+ */
320
+ export const WithActiveRow = () => {
321
+ const columns = makeColumns(FAKE_COLUMNS);
322
+ const fakeData: DataGridRowWithOptions<DataType>[] = [
323
+ {
324
+ id: '123456789',
325
+ documentName: 'Договор №12345678',
326
+ recipient: 'ПАО "Первый завод"',
327
+ createDate: makeRandomDate(),
328
+ },
329
+ ...makeDataList(FAKE_DATA_TEMPLATE),
330
+ ];
331
+
332
+ const [isLoading, setLoading] = useState(true);
333
+ const [slicedData, setSlicedData] = useState<DataType[]>([]);
334
+
335
+ useEffect(() => {
336
+ setTimeout(() => {
337
+ setSlicedData(fakeData.slice(0, 10));
338
+ setLoading(false);
339
+ }, 1500);
340
+ }, []);
341
+
342
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
343
+
344
+ return (
345
+ <DataGrid<DataType, SortField>
346
+ keyId='id'
347
+ activeRowId={'3'}
348
+ rows={slicedData}
349
+ columns={columns}
350
+ isLoading={isLoading}
351
+ onRowClick={handleRowClick}
352
+ onRetry={() => {}}
353
+ />
354
+ );
355
+ };
356
+
357
+ /**
358
+ * В таблице может добавляться возможность выбора отдельных строк или всего списка значений посредством использования компонента checkbox.
359
+ * В страничном варинте таблицы при выборе checkbox в datagrid_header выбираются все значения на странице
360
+ */
361
+ export const WithCheckbox = () => {
362
+ const columns = makeColumns(FAKE_COLUMNS);
363
+ const fakeData: DataGridRowWithOptions<DataType>[] = [
364
+ {
365
+ id: '123456789',
366
+ documentName: 'Договор №12345678',
367
+ recipient: 'ПАО "Первый завод"',
368
+ createDate: makeRandomDate(),
369
+ },
370
+ ...makeDataList(FAKE_DATA_TEMPLATE),
371
+ ];
372
+
373
+ const [slicedData, setSlicedData] = useState<DataType[]>([]);
374
+ const [selected, setSelected] = useState<DataType[]>([]);
375
+ const [isLoading, setLoading] = useState(true);
376
+
377
+ useEffect(() => {
378
+ setTimeout(() => {
379
+ setSlicedData(fakeData.slice(0, 10));
380
+ setLoading(false);
381
+ }, 1500);
382
+ }, []);
383
+
384
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
385
+
386
+ const handleSelect = (rows: DataType[]) => setSelected(rows);
387
+
388
+ return (
389
+ <DataGrid<DataType, SortField>
390
+ keyId='id'
391
+ rows={slicedData}
392
+ columns={columns}
393
+ isLoading={isLoading}
394
+ selectedRows={selected}
395
+ onSelectRow={handleSelect}
396
+ onRowClick={handleRowClick}
397
+ onRetry={() => {}}
398
+ />
399
+ );
400
+ };
401
+
402
+ /**
403
+ * В качестве значения параметра width должны указываться явные единицы: `px`, `%`, `fr`.
404
+ * При использовании таких значений, как auto, max-content, min-content, которые автоматически подстраиваются под ширину содержимого, сетка может сломаться.
405
+ * Если значение не указано, то автоматически задается `1fr`
406
+ */
407
+ export const WidthOptions = () => {
408
+ const columns = makeColumns(FAKE_COLUMNS, [
409
+ {
410
+ field: 'documentName',
411
+ width: '2fr',
412
+ },
413
+ {
414
+ field: 'recipient',
415
+ width: '1fr',
416
+ },
417
+ {
418
+ field: 'createDate',
419
+ width: '15%',
420
+ },
421
+ ]);
422
+
423
+ const fakeData: DataGridRowWithOptions<DataType>[] = [
424
+ {
425
+ id: '123456789',
426
+ documentName: 'Договор №12345678',
427
+ recipient: 'ПАО "Первый завод"',
428
+ createDate: makeRandomDate(),
429
+ },
430
+ ...makeDataList(FAKE_DATA_TEMPLATE),
431
+ ];
432
+
433
+ const [slicedData, setSlicedData] = useState<DataType[]>([]);
434
+ const [isLoading, setLoading] = useState(true);
435
+
436
+ useEffect(() => {
437
+ setTimeout(() => {
438
+ setSlicedData(fakeData.slice(0, 10));
439
+ setLoading(false);
440
+ }, 1500);
441
+ }, []);
442
+
443
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
444
+
445
+ return (
446
+ <DataGrid<DataType, SortField>
447
+ keyId='id'
448
+ rows={slicedData}
449
+ columns={columns}
450
+ isLoading={isLoading}
451
+ onRowClick={handleRowClick}
452
+ onRetry={() => {}}
453
+ />
454
+ );
455
+ };
456
+
457
+ export const ConfirmAction = () => {
458
+ const ACTIONS: DataGridActions<DataType> = {
459
+ main: [
460
+ {
461
+ icon: <Trash />,
462
+ name: 'Удалить',
463
+ needConfirm: true,
464
+ confirmText:
465
+ 'Если вы удалите черновик, то черновик с такими же данными нужно будет создать заново. Удалить черновик из списка?',
466
+ confirmButtonProps: {
467
+ text: 'Да, удалить',
468
+ isAccented: true,
469
+ },
470
+ onClick: (row) => alert(`Delete: ${JSON.stringify(row)}`),
471
+ },
472
+ ],
473
+ };
474
+
475
+ const columns = makeColumns(FAKE_COLUMNS, [
476
+ {
477
+ field: 'actions',
478
+ renderCell: (row) => {
479
+ return <DataGridActionCell actions={ACTIONS} row={row} />;
480
+ },
481
+ },
482
+ ]);
483
+
484
+ const fakeData: DataGridRowWithOptions<DataType>[] = [
485
+ {
486
+ id: '123456789',
487
+ documentName: 'Договор №12345678',
488
+ recipient: 'ПАО "Первый завод"',
489
+ createDate: makeRandomDate(),
490
+ },
491
+ ...makeDataList(FAKE_DATA_TEMPLATE),
492
+ ];
493
+
494
+ const [slicedData, setSlicedData] = useState<DataType[]>([]);
495
+ const [selected, setSelected] = useState<DataType[]>([]);
496
+ const [isLoading, setLoading] = useState(true);
497
+
498
+ useEffect(() => {
499
+ setTimeout(() => {
500
+ setSlicedData(fakeData.slice(0, 10));
501
+ setLoading(false);
502
+ }, 1500);
503
+ }, []);
504
+
505
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
506
+
507
+ const handleSelect = (rows: DataType[]) => setSelected(rows);
508
+
509
+ return (
510
+ <DataGrid<DataType, SortField>
511
+ keyId='id'
512
+ rows={slicedData}
513
+ columns={columns}
514
+ isLoading={isLoading}
515
+ selectedRows={selected}
516
+ onSelectRow={handleSelect}
517
+ onRowClick={handleRowClick}
518
+ onRetry={() => {}}
519
+ />
520
+ );
521
+ };
522
+
523
+ /**
524
+ * Prop `disabled` позволяет заблокировать контент
525
+ */
526
+ export const WithDisabledContent = () => {
527
+ const columns = makeColumns(FAKE_COLUMNS);
528
+ const fakeData: DataGridRowWithOptions<DataType>[] = [
529
+ {
530
+ id: '123456789',
531
+ documentName: 'Договор №12345678',
532
+ recipient: 'ПАО "Первый завод"',
533
+ createDate: makeRandomDate(),
534
+ },
535
+ ...makeDataList(FAKE_DATA_TEMPLATE),
536
+ ];
537
+
538
+ const [slicedData, setSlicedData] = useState<DataType[]>([]);
539
+ const [isLoading, setLoading] = useState(true);
540
+
541
+ useEffect(() => {
542
+ setTimeout(() => {
543
+ setSlicedData(fakeData.slice(0, 10));
544
+ setLoading(false);
545
+ }, 1500);
546
+ }, []);
547
+
548
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
549
+
550
+ return (
551
+ <DataGrid<DataType, SortField>
552
+ keyId='id'
553
+ rows={slicedData}
554
+ columns={columns}
555
+ isLoading={isLoading}
556
+ isDisabled={true}
557
+ onRowClick={handleRowClick}
558
+ onRetry={() => {}}
559
+ />
560
+ );
561
+ };
562
+
563
+ export const WithDisabledRow = () => {
564
+ const ACTIONS: DataGridActions<DataType> = {
565
+ main: [
566
+ {
567
+ icon: <Trash />,
568
+ name: 'Удалить',
569
+ onClick: () => console.log('delete'),
570
+ },
571
+ ],
572
+ };
573
+
574
+ const columns = makeColumns(FAKE_COLUMNS, [
575
+ {
576
+ field: 'actions',
577
+ renderCell: (row) => {
578
+ return <DataGridActionCell actions={ACTIONS} row={row} />;
579
+ },
580
+ },
581
+ ]);
582
+
583
+ const fakeData: DataGridRowWithOptions<DataType>[] = [
584
+ {
585
+ id: '123456789',
586
+ documentName: 'Договор №12345678',
587
+ recipient: 'ПАО "Первый завод"',
588
+ createDate: makeRandomDate(),
589
+ options: {
590
+ isDisabled: true,
591
+ disabledReason: 'Нет доступа',
592
+ },
593
+ },
594
+ ...makeDataList(FAKE_DATA_TEMPLATE, {
595
+ isDisabled: true,
596
+ disabledReason: 'Нет доступа',
597
+ }),
598
+ ];
599
+
600
+ const [slicedData, setSlicedData] = useState<DataType[]>([]);
601
+ const [selected, setSelected] = useState<DataType[]>([]);
602
+ const [isLoading, setLoading] = useState(true);
603
+
604
+ useEffect(() => {
605
+ setTimeout(() => {
606
+ setSlicedData(fakeData.slice(0, 10));
607
+ setLoading(false);
608
+ }, 1500);
609
+ }, []);
610
+
611
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
612
+
613
+ const handleSelect = (rows: DataType[]) => setSelected(rows);
614
+
615
+ return (
616
+ <DataGrid<DataType, SortField>
617
+ keyId='id'
618
+ rows={slicedData}
619
+ columns={columns}
620
+ isLoading={isLoading}
621
+ selectedRows={selected}
622
+ onSelectRow={handleSelect}
623
+ onRowClick={handleRowClick}
624
+ onRetry={() => {}}
625
+ />
626
+ );
627
+ };
628
+
629
+ /**
630
+ * `isDisabledLastCell` позволяет не блокировать последнюю ячейку
631
+ */
632
+ export const DisabledLastCell = () => {
633
+ const ACTIONS: DataGridActions<DataType> = {
634
+ main: [
635
+ {
636
+ icon: <Trash />,
637
+ name: 'Удалить',
638
+ onClick: () => console.log('delete'),
639
+ },
640
+ ],
641
+ };
642
+
643
+ const columns = makeColumns(FAKE_COLUMNS, [
644
+ {
645
+ field: 'actions',
646
+ renderCell: (row) => {
647
+ return <DataGridActionCell actions={ACTIONS} row={row} />;
648
+ },
649
+ },
650
+ ]);
651
+
652
+ const fakeData: DataGridRowWithOptions<DataType>[] = [
653
+ {
654
+ id: '123456789',
655
+ documentName: 'Договор №12345678',
656
+ recipient: 'ПАО "Первый завод"',
657
+ createDate: makeRandomDate(),
658
+ options: {
659
+ isDisabled: true,
660
+ isDisabledLastCell: false,
661
+ disabledReason: 'Нет доступа',
662
+ },
663
+ },
664
+ ...makeDataList(FAKE_DATA_TEMPLATE, {
665
+ isDisabled: true,
666
+ isDisabledLastCell: false,
667
+ disabledReason: 'Нет доступа',
668
+ }),
669
+ ];
670
+
671
+ const [slicedData, setSlicedData] = useState<DataType[]>([]);
672
+ const [selected, setSelected] = useState<DataType[]>([]);
673
+ const [isLoading, setLoading] = useState(true);
674
+
675
+ useEffect(() => {
676
+ setTimeout(() => {
677
+ setSlicedData(fakeData.slice(0, 10));
678
+ setLoading(false);
679
+ }, 1500);
680
+ }, []);
681
+
682
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
683
+
684
+ const handleSelect = (rows: DataType[]) => setSelected(rows);
685
+
686
+ return (
687
+ <DataGrid<DataType, SortField>
688
+ keyId='id'
689
+ rows={slicedData}
690
+ columns={columns}
691
+ isLoading={isLoading}
692
+ selectedRows={selected}
693
+ onSelectRow={handleSelect}
694
+ onRowClick={handleRowClick}
695
+ onRetry={() => {}}
696
+ />
697
+ );
698
+ };
699
+
700
+ /**
701
+ * При состоянии `loading=true` и `isBlockingOperation=true` у действия, строка блокируется и появляется тултип с `loadingNote`
702
+ */
703
+ export const ActionsDataGrid = () => {
704
+ const FakeActionCell = <TRow,>({ row }: FakeActionCellProps<TRow>) => {
705
+ const [isEditing, setIsEditing] = useState(false);
706
+ const [isDeleting, setIsDeleting] = useState(false);
707
+ const [isSigning, setIsSigning] = useState(false);
708
+
709
+ const handleEdit = () => {
710
+ setIsEditing(true);
711
+ };
712
+
713
+ const handleDelete = () => {
714
+ setIsDeleting(true);
715
+ };
716
+
717
+ const handleSign = () => {
718
+ setIsSigning(true);
719
+ };
720
+
721
+ useEffect(() => {
722
+ if (isEditing) {
723
+ setTimeout(() => setIsEditing(false), 1500);
724
+ }
725
+
726
+ if (isDeleting) {
727
+ setTimeout(() => setIsDeleting(false), 1500);
728
+ }
729
+
730
+ if (isSigning) {
731
+ setTimeout(() => setIsSigning(false), 1500);
732
+ }
733
+ }, [isEditing, isDeleting, isSigning]);
734
+
735
+ const fakeActions = useMemo(
736
+ () => ({
737
+ main: [
738
+ {
739
+ icon: <Pencil />,
740
+ name: 'Редактировать',
741
+ loading: isEditing,
742
+ onClick: handleEdit,
743
+ },
744
+ {
745
+ icon: <Trash />,
746
+ name: 'Удалить',
747
+ loading: isDeleting,
748
+ loadingNote: 'Происходит удаление',
749
+ isBlockingOperation: true,
750
+ onClick: handleDelete,
751
+ },
752
+ ],
753
+ secondary: [
754
+ {
755
+ name: 'Подписать',
756
+ loading: isSigning,
757
+ loadingNote: 'Происходит подписание',
758
+ isBlockingOperation: true,
759
+ onClick: handleSign,
760
+ },
761
+ ],
762
+ }),
763
+ [isEditing, isDeleting, isSigning],
764
+ );
765
+
766
+ return <DataGridActionCell actions={fakeActions} row={row} />;
767
+ };
768
+
769
+ const fakeColumns: DataGridColumns<DataType>[] = [
770
+ {
771
+ field: 'documentName',
772
+ label: 'Наименование документа',
773
+ sortable: true,
774
+ },
775
+ {
776
+ field: 'recipient',
777
+ label: 'Получатель',
778
+ sortable: true,
779
+ },
780
+ {
781
+ field: 'createDate',
782
+ label: 'Дата создания',
783
+ sortable: true,
784
+ format: ({ createDate }) => new Date(createDate).toLocaleDateString(),
785
+ },
786
+ {
787
+ field: 'actions',
788
+ label: 'Действия',
789
+ sortable: false,
790
+ align: 'center',
791
+ width: '120px',
792
+ renderCell: (row) => {
793
+ return <FakeActionCell row={row} />;
794
+ },
795
+ },
796
+ ];
797
+
798
+ const columns = makeColumns(fakeColumns);
799
+
800
+ const fakeData: DataGridRowWithOptions<DataType>[] = [
801
+ {
802
+ id: '123456789',
803
+ documentName: 'Договор №12345678',
804
+ recipient: 'ПАО "Первый завод"',
805
+ createDate: makeRandomDate(),
806
+ },
807
+ ...makeDataList(FAKE_DATA_TEMPLATE),
808
+ ];
809
+
810
+ const [loading, setLoading] = useState(true);
811
+ const [slicedData, setSlicedData] = useState<DataType[]>([]);
812
+
813
+ useEffect(() => {
814
+ setTimeout(() => {
815
+ setSlicedData(fakeData.slice(0, 10));
816
+ setLoading(false);
817
+ }, 1500);
818
+ }, []);
819
+
820
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
821
+
822
+ return (
823
+ <DataGrid<DataType>
824
+ keyId='id'
825
+ rows={slicedData}
826
+ columns={columns}
827
+ onRowClick={handleRowClick}
828
+ isLoading={loading}
829
+ onRetry={() => {}}
830
+ />
831
+ );
832
+ };
833
+
834
+ export const EmptyCellValue = () => {
835
+ type DataTypeEmptyCell = {
836
+ id: string;
837
+ documentName?: string;
838
+ recipient?: string;
839
+ createDate: string;
840
+ };
841
+
842
+ const fakeDataTemplate: DataTypeEmptyCell = {
843
+ id: '1',
844
+ documentName: 'Договор №1',
845
+ createDate: '2022-03-24T17:50:40.206Z',
846
+ };
847
+
848
+ const fakeColumns: DataGridColumns<DataTypeEmptyCell>[] = [
849
+ {
850
+ field: 'documentName',
851
+ label: 'Наименование документа',
852
+ sortable: true,
853
+ },
854
+ {
855
+ field: 'recipient',
856
+ label: 'Получатель',
857
+ sortable: true,
858
+ },
859
+ {
860
+ field: 'createDate',
861
+ label: 'Дата создания',
862
+ sortable: true,
863
+ format: ({ createDate }) => new Date(createDate).toLocaleDateString(),
864
+ },
865
+ ];
866
+
867
+ const columns = makeColumns(fakeColumns);
868
+ const fakeData: DataGridRowWithOptions<DataTypeEmptyCell>[] = [
869
+ {
870
+ id: '123456789',
871
+ createDate: makeRandomDate(),
872
+ },
873
+ ...makeDataList(fakeDataTemplate),
874
+ ];
875
+
876
+ return (
877
+ <DataGrid<DataTypeEmptyCell>
878
+ keyId='id'
879
+ rows={fakeData}
880
+ columns={columns}
881
+ onRetry={() => {}}
882
+ />
883
+ );
884
+ };
885
+
886
+ /**
887
+ * Таблица можем работать с вложенными структурами
888
+ */
889
+ export const Tree = () => {
890
+ const ACTIONS: DataGridActions<DataType> = {
891
+ main: [
892
+ {
893
+ icon: <Trash />,
894
+ name: 'Удалить',
895
+ onClick: () => console.log('delete'),
896
+ },
897
+ ],
898
+ };
899
+
900
+ const columns = makeColumns(FAKE_COLUMNS, [
901
+ {
902
+ field: 'actions',
903
+ renderCell: (row) => {
904
+ return <DataGridActionCell actions={ACTIONS} row={row} />;
905
+ },
906
+ },
907
+ ]);
908
+
909
+ const fakeData: DataGridRowWithOptions<DataType>[] = [
910
+ {
911
+ id: '123456789',
912
+ documentName: 'Пакет документов',
913
+ recipient: 'ПАО "Первый завод"',
914
+ createDate: makeRandomDate(),
915
+ children: [
916
+ {
917
+ id: '1234567890',
918
+ documentName: 'Договор №12345678',
919
+ recipient: 'ПАО "Первый завод"',
920
+ createDate: makeRandomDate(),
921
+ },
922
+ ],
923
+ },
924
+ ...makeDataListWithTree(9),
925
+ ];
926
+
927
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
928
+
929
+ return (
930
+ <DataGrid
931
+ keyId='id'
932
+ rows={fakeData}
933
+ columns={columns}
934
+ onRowClick={handleRowClick}
935
+ onRetry={() => {}}
936
+ />
937
+ );
938
+ };
939
+
940
+ /**
941
+ * Использую пропс `tree` можно настраивать поведение таблицы при работе с древовидной структурой данных.
942
+ * Параметр `isInitialExpanded` позволяет раскрыть вложенные структуру при первичном отображении
943
+ */
944
+ export const TreeWithInitialExpanded = () => {
945
+ const ACTIONS: DataGridActions<DataType> = {
946
+ main: [
947
+ {
948
+ icon: <Trash />,
949
+ name: 'Удалить',
950
+ onClick: () => console.log('delete'),
951
+ },
952
+ ],
953
+ };
954
+
955
+ const columns = makeColumns(FAKE_COLUMNS, [
956
+ {
957
+ field: 'actions',
958
+ renderCell: (row) => {
959
+ return <DataGridActionCell actions={ACTIONS} row={row} />;
960
+ },
961
+ },
962
+ ]);
963
+
964
+ const fakeData: DataGridRowWithOptions<DataType>[] = [
965
+ {
966
+ id: '123456789',
967
+ documentName: 'Пакет документов',
968
+ recipient: 'ПАО "Первый завод"',
969
+ createDate: makeRandomDate(),
970
+ children: [
971
+ {
972
+ id: '1234567890',
973
+ documentName: 'Договор №12345678',
974
+ recipient: 'ПАО "Первый завод"',
975
+ createDate: makeRandomDate(),
976
+ },
977
+ ],
978
+ },
979
+ ...makeDataListWithTree(9),
980
+ ];
981
+
982
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
983
+
984
+ return (
985
+ <DataGrid
986
+ keyId='id'
987
+ rows={fakeData}
988
+ columns={columns}
989
+ tree={{
990
+ isInitialExpanded: true,
991
+ }}
992
+ onRowClick={handleRowClick}
993
+ onRetry={() => {}}
994
+ />
995
+ );
996
+ };
997
+
998
+ /**
999
+ * Используя пропс `expandedLevel` можно настраивать глубину раскрытия дерева при первичном отображении, если `isInitialExpanded=true`
1000
+ */
1001
+ export const TreeWithExpandedLevel = () => {
1002
+ const ACTIONS: DataGridActions<DataType> = {
1003
+ main: [
1004
+ {
1005
+ icon: <Trash />,
1006
+ name: 'Удалить',
1007
+ onClick: () => console.log('delete'),
1008
+ },
1009
+ ],
1010
+ };
1011
+
1012
+ const columns = makeColumns(FAKE_COLUMNS, [
1013
+ {
1014
+ field: 'actions',
1015
+ renderCell: (row) => {
1016
+ return <DataGridActionCell actions={ACTIONS} row={row} />;
1017
+ },
1018
+ },
1019
+ ]);
1020
+
1021
+ const fakeData: DataGridRowWithOptions<DataType>[] = [
1022
+ {
1023
+ id: '123456789',
1024
+ documentName: 'Пакет документов',
1025
+ recipient: 'ПАО "Первый завод"',
1026
+ createDate: makeRandomDate(),
1027
+ children: [
1028
+ {
1029
+ id: '1234567890',
1030
+ documentName: 'Договор №12345678',
1031
+ recipient: 'ПАО "Первый завод"',
1032
+ createDate: makeRandomDate(),
1033
+ },
1034
+ ],
1035
+ },
1036
+ ...makeDataListWithTree(9),
1037
+ ];
1038
+
1039
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
1040
+
1041
+ return (
1042
+ <DataGrid
1043
+ keyId='id'
1044
+ rows={fakeData}
1045
+ columns={columns}
1046
+ tree={{
1047
+ isInitialExpanded: true,
1048
+ expandedLevel: 3,
1049
+ }}
1050
+ onRowClick={handleRowClick}
1051
+ onRetry={() => {}}
1052
+ />
1053
+ );
1054
+ };
1055
+
1056
+ /**
1057
+ * Пропс `initialVisibleChildrenCount` позволяет настраивать количество отображаемых элементов при раскрытии корневого элемента.
1058
+ * Элементы, сверх этого значения, будут скрыты под кнопку "Показать все"
1059
+ */
1060
+ export const TreeWithInitialVisibleChildrenCount = () => {
1061
+ const ACTIONS: DataGridActions<DataType> = {
1062
+ main: [
1063
+ {
1064
+ icon: <Trash />,
1065
+ name: 'Удалить',
1066
+ onClick: () => console.log('delete'),
1067
+ },
1068
+ ],
1069
+ };
1070
+
1071
+ const columns = makeColumns(FAKE_COLUMNS, [
1072
+ {
1073
+ field: 'actions',
1074
+ renderCell: (row) => {
1075
+ return <DataGridActionCell actions={ACTIONS} row={row} />;
1076
+ },
1077
+ },
1078
+ ]);
1079
+
1080
+ const fakeData: DataGridRowWithOptions<DataType>[] = [
1081
+ {
1082
+ id: '123456789',
1083
+ documentName: 'Пакет документов',
1084
+ recipient: 'ПАО "Первый завод"',
1085
+ createDate: makeRandomDate(),
1086
+ children: [
1087
+ {
1088
+ id: '1234567890',
1089
+ documentName: 'Договор №12345678',
1090
+ recipient: 'ПАО "Первый завод"',
1091
+ createDate: makeRandomDate(),
1092
+ },
1093
+ ],
1094
+ },
1095
+ ...makeDataListWithTree(9),
1096
+ ];
1097
+
1098
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
1099
+
1100
+ return (
1101
+ <DataGrid
1102
+ keyId='id'
1103
+ rows={fakeData}
1104
+ columns={columns}
1105
+ tree={{
1106
+ isInitialExpanded: true,
1107
+ initialVisibleChildrenCount: 5,
1108
+ }}
1109
+ onRowClick={handleRowClick}
1110
+ onRetry={() => {}}
1111
+ />
1112
+ );
1113
+ };
1114
+
1115
+ /**
1116
+ * Таблица с древовидной структурой так же работает в варианте с множественным выбором (чекбоксы)
1117
+ */
1118
+ export const TreeWithCheckbox = () => {
1119
+ const ACTIONS: DataGridActions<DataType> = {
1120
+ main: [
1121
+ {
1122
+ icon: <Trash />,
1123
+ name: 'Удалить',
1124
+ onClick: () => console.log('delete'),
1125
+ },
1126
+ ],
1127
+ };
1128
+
1129
+ const columns = makeColumns(FAKE_COLUMNS, [
1130
+ {
1131
+ field: 'actions',
1132
+ renderCell: (row) => {
1133
+ return <DataGridActionCell actions={ACTIONS} row={row} />;
1134
+ },
1135
+ },
1136
+ ]);
1137
+
1138
+ const fakeData: DataGridRowWithOptions<DataType>[] = [
1139
+ {
1140
+ id: '123456789',
1141
+ documentName: 'Пакет документов',
1142
+ recipient: 'ПАО "Первый завод"',
1143
+ createDate: makeRandomDate(),
1144
+ children: [
1145
+ {
1146
+ id: '1234567890',
1147
+ documentName: 'Договор №12345678',
1148
+ recipient: 'ПАО "Первый завод"',
1149
+ createDate: makeRandomDate(),
1150
+ },
1151
+ ],
1152
+ },
1153
+ ...makeDataListWithTree(9),
1154
+ ];
1155
+
1156
+ const [slicedData, setSlicedData] = useState<DataType[]>([]);
1157
+ const [selected, setSelected] = useState<DataType[]>([]);
1158
+ const [isLoading, setLoading] = useState(true);
1159
+
1160
+ useEffect(() => {
1161
+ setTimeout(() => {
1162
+ setSlicedData(fakeData.slice(0, 10));
1163
+ setLoading(false);
1164
+ }, 1500);
1165
+ }, []);
1166
+
1167
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
1168
+ const handleSelect = (rows: DataType[]) => setSelected(rows);
1169
+
1170
+ return (
1171
+ <DataGrid<DataType, SortField>
1172
+ keyId='id'
1173
+ rows={slicedData}
1174
+ columns={columns}
1175
+ isLoading={isLoading}
1176
+ selectedRows={selected}
1177
+ onSelectRow={handleSelect}
1178
+ onRowClick={handleRowClick}
1179
+ onRetry={() => {}}
1180
+ />
1181
+ );
1182
+ };
1183
+
1184
+ /**
1185
+ * Указав значение `isNotSelectable` в `options` можно сделать строку не доступной для выбора
1186
+ */
1187
+ export const TreeWithOptionIsNotSelectable = () => {
1188
+ const columns = makeColumns(FAKE_COLUMNS);
1189
+
1190
+ const fakeData: DataGridRowWithOptions<DataType>[] = [
1191
+ {
1192
+ id: '123456789',
1193
+ documentName: 'Пакет документов',
1194
+ recipient: 'ПАО "Первый завод"',
1195
+ createDate: makeRandomDate(),
1196
+ options: {
1197
+ isNotSelectable: true,
1198
+ },
1199
+ children: [
1200
+ {
1201
+ id: '1234567890',
1202
+ documentName: 'Договор №12345678',
1203
+ recipient: 'ПАО "Первый завод"',
1204
+ createDate: makeRandomDate(),
1205
+ options: {
1206
+ isNotSelectable: true,
1207
+ },
1208
+ },
1209
+ ],
1210
+ },
1211
+ {
1212
+ id: '1234544545',
1213
+ documentName: 'Пакет документов',
1214
+ recipient: 'ООО "Купи Продай"',
1215
+ createDate: makeRandomDate(),
1216
+ options: {
1217
+ isNotSelectable: true,
1218
+ },
1219
+ children: [
1220
+ {
1221
+ id: '1234567890',
1222
+ documentName: 'Договор №12345678',
1223
+ recipient: 'ПАО "Первый завод"',
1224
+ createDate: makeRandomDate(),
1225
+ },
1226
+ ],
1227
+ },
1228
+ ...makeDataList(FAKE_DATA_TEMPLATE),
1229
+ ];
1230
+
1231
+ const [slicedData, setSlicedData] = useState<DataType[]>([]);
1232
+ const [selected, setSelected] = useState<DataType[]>([]);
1233
+ const [isLoading, setLoading] = useState(true);
1234
+
1235
+ useEffect(() => {
1236
+ setTimeout(() => {
1237
+ setSlicedData(fakeData.slice(0, 10));
1238
+ setLoading(false);
1239
+ }, 1500);
1240
+ }, []);
1241
+
1242
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
1243
+
1244
+ const handleSelect = (rows: DataType[]) => setSelected(rows);
1245
+
1246
+ return (
1247
+ <DataGrid<DataType, SortField>
1248
+ keyId='id'
1249
+ rows={slicedData}
1250
+ columns={columns}
1251
+ isLoading={isLoading}
1252
+ selectedRows={selected}
1253
+ onSelectRow={handleSelect}
1254
+ onRowClick={handleRowClick}
1255
+ onRetry={() => {}}
1256
+ />
1257
+ );
1258
+ };
1259
+
1260
+ /**
1261
+ * `options` и `childrenColumns` на уровне строки, позволяет настраивать отображение дочерних элементов,
1262
+ * например указать кастомный список действий для вложенных элементов
1263
+ */
1264
+ export const TreeWithOverrideColumns = () => {
1265
+ const ACTIONS: DataGridActions<DataType> = {
1266
+ main: [
1267
+ {
1268
+ icon: <Trash />,
1269
+ name: 'Удалить',
1270
+ onClick: () => console.log('delete'),
1271
+ },
1272
+ ],
1273
+ };
1274
+
1275
+ const columns = makeColumns(FAKE_COLUMNS, [
1276
+ {
1277
+ field: 'actions',
1278
+ renderCell: (row) => {
1279
+ return <DataGridActionCell actions={ACTIONS} row={row} />;
1280
+ },
1281
+ },
1282
+ ]);
1283
+
1284
+ const fakeData: DataGridRowWithOptions<DataType>[] = [
1285
+ {
1286
+ id: '123456789',
1287
+ documentName: 'Пакет документов',
1288
+ recipient: 'ПАО "Первый завод"',
1289
+ createDate: makeRandomDate(),
1290
+ children: [
1291
+ {
1292
+ id: '1234567890',
1293
+ documentName: 'Договор №12345678',
1294
+ recipient: 'ПАО "Первый завод"',
1295
+ createDate: makeRandomDate(),
1296
+ },
1297
+ ],
1298
+ options: {
1299
+ childrenColumns: [
1300
+ {
1301
+ field: 'actions',
1302
+ renderCell: (row) => {
1303
+ return (
1304
+ <DataGridActionCell
1305
+ actions={{
1306
+ main: [
1307
+ {
1308
+ icon: <Eye />,
1309
+ name: 'Просмотреть',
1310
+ onClick: () => console.log('main'),
1311
+ },
1312
+ ],
1313
+ }}
1314
+ row={row}
1315
+ />
1316
+ );
1317
+ },
1318
+ },
1319
+ ],
1320
+ },
1321
+ },
1322
+ ...makeDataListWithTree(9, {
1323
+ childrenColumns: [
1324
+ {
1325
+ field: 'actions',
1326
+ renderCell: (row) => {
1327
+ return (
1328
+ <DataGridActionCell
1329
+ actions={{
1330
+ main: [
1331
+ {
1332
+ icon: <Eye />,
1333
+ name: 'Просмотреть',
1334
+ onClick: () => console.log('main'),
1335
+ },
1336
+ ],
1337
+ }}
1338
+ row={row}
1339
+ />
1340
+ );
1341
+ },
1342
+ },
1343
+ ],
1344
+ }),
1345
+ ];
1346
+
1347
+ const [slicedData, setSlicedData] = useState<DataType[]>([]);
1348
+ const [selected, setSelected] = useState<DataType[]>([]);
1349
+ const [isLoading, setLoading] = useState(true);
1350
+
1351
+ useEffect(() => {
1352
+ setTimeout(() => {
1353
+ setSlicedData(fakeData.slice(0, 10));
1354
+ setLoading(false);
1355
+ }, 1500);
1356
+ }, []);
1357
+
1358
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
1359
+
1360
+ const handleSelect = (rows: DataType[]) => setSelected(rows);
1361
+
1362
+ return (
1363
+ <DataGrid<DataType, SortField>
1364
+ keyId='id'
1365
+ rows={slicedData}
1366
+ columns={columns}
1367
+ isLoading={isLoading}
1368
+ selectedRows={selected}
1369
+ onSelectRow={handleSelect}
1370
+ onRowClick={handleRowClick}
1371
+ onRetry={() => {}}
1372
+ />
1373
+ );
1374
+ };
1375
+
1376
+ /**
1377
+ * Возможно отображение дочерних элементов в виде вложенных строк. Для этого необходимо указать `variant="subrows"`
1378
+ * В таком варианте отображения вложенные элементы отображаются сразу и только часть из них прячется под кнопку "Показать все"
1379
+ */
1380
+ export const Subrows = () => {
1381
+ const columns: DataGridColumns<DataType>[] = [
1382
+ {
1383
+ field: 'recipient',
1384
+ label: 'Получатель',
1385
+ sortable: true,
1386
+ },
1387
+ {
1388
+ field: 'documentName',
1389
+ label: 'Наименование документа',
1390
+ sortable: true,
1391
+ },
1392
+ {
1393
+ field: 'createDate',
1394
+ label: 'Дата создания',
1395
+ sortable: true,
1396
+ format: ({ createDate }) => new Date(createDate).toLocaleDateString(),
1397
+ },
1398
+ {
1399
+ field: 'actions',
1400
+ label: 'Действия',
1401
+ sortable: false,
1402
+ align: 'center',
1403
+ width: '120px',
1404
+ renderCell: (row) => {
1405
+ return <DataGridActionCell actions={FAKE_ACTIONS} row={row} />;
1406
+ },
1407
+ },
1408
+ ];
1409
+
1410
+ const fakeData: DataGridRowWithOptions<DataType>[] = [
1411
+ {
1412
+ id: '123456789',
1413
+ documentName: 'УКД № 47',
1414
+ recipient: 'ПАО "Первый завод"',
1415
+ createDate: makeRandomDate(),
1416
+ options: {
1417
+ isNotSelectable: true,
1418
+ childrenColumns: [
1419
+ {
1420
+ field: 'recipient',
1421
+ renderCell: () => null,
1422
+ },
1423
+ {
1424
+ field: 'actions',
1425
+ renderCell: () => null,
1426
+ },
1427
+ ],
1428
+ },
1429
+ children: [
1430
+ {
1431
+ id: '1234567890',
1432
+ documentName: 'Акт № УТ000006319',
1433
+ recipient: 'ПАО "Первый завод"',
1434
+ createDate: makeRandomDate(),
1435
+ options: {
1436
+ isNotSelectable: true,
1437
+ },
1438
+ },
1439
+ {
1440
+ id: '1234567891',
1441
+ documentName: 'Торг-12 № 1446',
1442
+ recipient: 'ПАО "Первый завод"',
1443
+ createDate: makeRandomDate(),
1444
+ options: {
1445
+ isNotSelectable: true,
1446
+ },
1447
+ },
1448
+ {
1449
+ id: '1234567892',
1450
+ documentName: 'Счет-фактура №1237',
1451
+ recipient: 'ПАО "Первый завод"',
1452
+ createDate: makeRandomDate(),
1453
+ options: {
1454
+ isNotSelectable: true,
1455
+ },
1456
+ },
1457
+ ],
1458
+ },
1459
+ {
1460
+ id: '1234544545',
1461
+ documentName: 'УКД № 46',
1462
+ recipient: 'ООО "Купи Продай"',
1463
+ createDate: makeRandomDate(),
1464
+ options: {
1465
+ childrenColumns: [
1466
+ {
1467
+ field: 'recipient',
1468
+ renderCell: () => null,
1469
+ },
1470
+ {
1471
+ field: 'actions',
1472
+ renderCell: () => null,
1473
+ },
1474
+ ],
1475
+ },
1476
+ children: [
1477
+ {
1478
+ id: '1234567890',
1479
+ documentName: 'Счет-фактура №1231',
1480
+ recipient: 'ПАО "Первый завод"',
1481
+ createDate: makeRandomDate(),
1482
+ options: {
1483
+ isNotSelectable: true,
1484
+ },
1485
+ },
1486
+ ],
1487
+ },
1488
+ ...makeDataList(FAKE_DATA_TEMPLATE),
1489
+ ];
1490
+
1491
+ const [slicedData, setSlicedData] = useState<DataType[]>([]);
1492
+ const [selected, setSelected] = useState<DataType[]>([]);
1493
+ const [isLoading, setLoading] = useState(true);
1494
+ const [page, setPage] = useState<number>(1);
1495
+
1496
+ useEffect(() => {
1497
+ setTimeout(() => {
1498
+ setSlicedData(fakeData.slice((page - 1) * 10, page * 10));
1499
+ setLoading(false);
1500
+ }, 1500);
1501
+ }, []);
1502
+
1503
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
1504
+
1505
+ const handleSelect = (rows: DataType[]) => setSelected(rows);
1506
+
1507
+ const handleChangePage = (
1508
+ _event: ChangeEvent<unknown>,
1509
+ newPage: number,
1510
+ ): void => {
1511
+ setLoading(true);
1512
+ setPage(newPage);
1513
+
1514
+ setTimeout(() => {
1515
+ setLoading(false);
1516
+ setSlicedData(fakeData.slice((newPage - 1) * 10, newPage * 10));
1517
+ }, 1500);
1518
+ };
1519
+
1520
+ return (
1521
+ <DataGrid<DataType, SortField>
1522
+ keyId='id'
1523
+ rows={slicedData}
1524
+ columns={columns}
1525
+ variant='subrows'
1526
+ subrows={{
1527
+ moreButtonColumnPosition: 2,
1528
+ }}
1529
+ isLoading={isLoading}
1530
+ selectedRows={selected}
1531
+ footer={
1532
+ <DataGridPagination
1533
+ rowsPerPage={10}
1534
+ totalCount={fakeData.length}
1535
+ onChange={handleChangePage}
1536
+ page={page}
1537
+ />
1538
+ }
1539
+ onSelectRow={handleSelect}
1540
+ onRowClick={handleRowClick}
1541
+ onRetry={() => {}}
1542
+ />
1543
+ );
1544
+ };
1545
+
1546
+ /**
1547
+ * Можно отключить отображение шеврона с помощью параметра `isVisibleCollapseButton=false`
1548
+ */
1549
+ export const IsVisibleCollapseButton = () => {
1550
+ const columns: DataGridColumns<DataType>[] = [
1551
+ {
1552
+ field: 'recipient',
1553
+ label: 'Получатель',
1554
+ sortable: true,
1555
+ },
1556
+ {
1557
+ field: 'documentName',
1558
+ label: 'Наименование документа',
1559
+ sortable: true,
1560
+ },
1561
+ {
1562
+ field: 'createDate',
1563
+ label: 'Дата создания',
1564
+ sortable: true,
1565
+ format: ({ createDate }) => new Date(createDate).toLocaleDateString(),
1566
+ },
1567
+ {
1568
+ field: 'actions',
1569
+ label: 'Действия',
1570
+ sortable: false,
1571
+ align: 'center',
1572
+ width: '120px',
1573
+ renderCell: (row) => {
1574
+ return <DataGridActionCell actions={FAKE_ACTIONS} row={row} />;
1575
+ },
1576
+ },
1577
+ ];
1578
+
1579
+ const fakeData: DataGridRowWithOptions<DataType>[] = [
1580
+ {
1581
+ id: '123456789',
1582
+ documentName: 'УКД № 47',
1583
+ recipient: 'ПАО "Первый завод"',
1584
+ createDate: makeRandomDate(),
1585
+ options: {
1586
+ childrenColumns: [
1587
+ {
1588
+ field: 'recipient',
1589
+ renderCell: () => null,
1590
+ },
1591
+ {
1592
+ field: 'actions',
1593
+ renderCell: () => null,
1594
+ },
1595
+ ],
1596
+ },
1597
+ children: [
1598
+ {
1599
+ id: '1234567890',
1600
+ documentName: 'Акт № УТ000006319',
1601
+ recipient: 'ПАО "Первый завод"',
1602
+ createDate: makeRandomDate(),
1603
+ options: {
1604
+ isNotSelectable: true,
1605
+ },
1606
+ },
1607
+ {
1608
+ id: '1234567891',
1609
+ documentName: 'Торг-12 № 1446',
1610
+ recipient: 'ПАО "Первый завод"',
1611
+ createDate: makeRandomDate(),
1612
+ options: {
1613
+ isNotSelectable: true,
1614
+ },
1615
+ },
1616
+ {
1617
+ id: '1234567892',
1618
+ documentName: 'Счет-фактура №1237',
1619
+ recipient: 'ПАО "Первый завод"',
1620
+ createDate: makeRandomDate(),
1621
+ options: {
1622
+ isNotSelectable: true,
1623
+ },
1624
+ },
1625
+ ],
1626
+ },
1627
+ {
1628
+ id: '1234544545',
1629
+ documentName: 'УКД № 46',
1630
+ recipient: 'ООО "Купи Продай"',
1631
+ createDate: makeRandomDate(),
1632
+ options: {
1633
+ childrenColumns: [
1634
+ {
1635
+ field: 'recipient',
1636
+ renderCell: () => null,
1637
+ },
1638
+ {
1639
+ field: 'actions',
1640
+ renderCell: () => null,
1641
+ },
1642
+ ],
1643
+ },
1644
+ children: [
1645
+ {
1646
+ id: '1234567890',
1647
+ documentName: 'Счет-фактура №1231',
1648
+ recipient: 'ПАО "Первый завод"',
1649
+ createDate: makeRandomDate(),
1650
+ options: {
1651
+ isNotSelectable: true,
1652
+ },
1653
+ },
1654
+ ],
1655
+ },
1656
+ ...makeDataList(FAKE_DATA_TEMPLATE),
1657
+ ];
1658
+
1659
+ const [slicedData, setSlicedData] = useState<DataType[]>([]);
1660
+ const [selected, setSelected] = useState<DataType[]>([]);
1661
+ const [isLoading, setLoading] = useState(true);
1662
+ const [page, setPage] = useState<number>(1);
1663
+
1664
+ useEffect(() => {
1665
+ setTimeout(() => {
1666
+ setSlicedData(fakeData.slice((page - 1) * 10, page * 10));
1667
+ setLoading(false);
1668
+ }, 1500);
1669
+ }, []);
1670
+
1671
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
1672
+
1673
+ const handleSelect = (rows: DataType[]) => setSelected(rows);
1674
+
1675
+ const handleChangePage = (
1676
+ _event: ChangeEvent<unknown>,
1677
+ newPage: number,
1678
+ ): void => {
1679
+ setLoading(true);
1680
+ setPage(newPage);
1681
+
1682
+ setTimeout(() => {
1683
+ setLoading(false);
1684
+ setSlicedData(fakeData.slice((newPage - 1) * 10, newPage * 10));
1685
+ }, 1500);
1686
+ };
1687
+
1688
+ return (
1689
+ <DataGrid<DataType, SortField>
1690
+ keyId='id'
1691
+ rows={slicedData}
1692
+ columns={columns}
1693
+ variant='subrows'
1694
+ subrows={{
1695
+ moreButtonColumnPosition: 2,
1696
+ isVisibleCollapseButton: false,
1697
+ }}
1698
+ isLoading={isLoading}
1699
+ selectedRows={selected}
1700
+ footer={
1701
+ <DataGridPagination
1702
+ rowsPerPage={10}
1703
+ totalCount={fakeData.length}
1704
+ onChange={handleChangePage}
1705
+ page={page}
1706
+ />
1707
+ }
1708
+ onSelectRow={handleSelect}
1709
+ onRowClick={handleRowClick}
1710
+ onRetry={() => {}}
1711
+ />
1712
+ );
1713
+ };
1714
+
1715
+ /**
1716
+ * Состояние загрузки регулируется полем `loading` экшенов переданных в `<ActionCell/>`
1717
+ */
1718
+ export const WithLoaderInButton = () => {
1719
+ const ACTIONS_WITH_LOADER: DataGridActions<DataType> = {
1720
+ main: [
1721
+ {
1722
+ icon: <Eye />,
1723
+ name: 'Просмотреть',
1724
+ onClick: () => console.log('main'),
1725
+ },
1726
+ {
1727
+ icon: <Send />,
1728
+ loading: true,
1729
+ name: 'Отправить',
1730
+ },
1731
+ ],
1732
+ secondary: [
1733
+ { name: 'Редактировать', onClick: () => console.log('secondary 1') },
1734
+ { name: 'Удалить', onClick: () => console.log('secondary 2') },
1735
+ ],
1736
+ };
1737
+
1738
+ const columns = makeColumns(FAKE_COLUMNS, [
1739
+ {
1740
+ field: 'actions',
1741
+ renderCell: (row) => {
1742
+ return <DataGridActionCell actions={ACTIONS_WITH_LOADER} row={row} />;
1743
+ },
1744
+ },
1745
+ ]);
1746
+
1747
+ const fakeData: DataGridRowWithOptions<DataType>[] = [
1748
+ {
1749
+ id: '123456789',
1750
+ documentName: 'Договор №12345678',
1751
+ recipient: 'ПАО "Первый завод"',
1752
+ createDate: makeRandomDate(),
1753
+ },
1754
+ ...makeDataList(FAKE_DATA_TEMPLATE),
1755
+ ];
1756
+
1757
+ const [slicedData, setSlicedData] = useState<DataType[]>([]);
1758
+ const [isLoading, setLoading] = useState(true);
1759
+
1760
+ useEffect(() => {
1761
+ setTimeout(() => {
1762
+ setSlicedData(fakeData.slice(0, 5));
1763
+ setLoading(false);
1764
+ }, 1500);
1765
+ }, []);
1766
+
1767
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
1768
+
1769
+ return (
1770
+ <DataGrid<DataType, SortField>
1771
+ keyId='id'
1772
+ rows={slicedData}
1773
+ columns={columns}
1774
+ isLoading={isLoading}
1775
+ onRowClick={handleRowClick}
1776
+ onRetry={() => {}}
1777
+ />
1778
+ );
1779
+ };
1780
+
1781
+ /**
1782
+ * В случае, когда нет данных для отображения их в таблице, необходимо показать изображение и текст “Нет данных” и убрать сортировку для столбцов, если она присутствует.
1783
+ * Изображение можно передать через ConfigProvider.
1784
+ */
1785
+ export const NoData = () => {
1786
+ const noDataStubSrc = '/no-data-stub.svg';
1787
+ const columns = FAKE_COLUMNS;
1788
+
1789
+ const [isLoading, setLoading] = useState(true);
1790
+ const [slicedData, setSlicedData] = useState<DataType[]>([]);
1791
+
1792
+ useEffect(() => {
1793
+ setTimeout(() => {
1794
+ setSlicedData([]);
1795
+ setLoading(false);
1796
+ }, 1500);
1797
+ }, []);
1798
+
1799
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
1800
+
1801
+ return (
1802
+ <ConfigProvider
1803
+ imagesMap={{
1804
+ defaultErrorImgSrc: '',
1805
+ noDataImgSrc: noDataStubSrc,
1806
+ outdatedReleaseErrorImgSrc: '',
1807
+ }}
1808
+ >
1809
+ <DataGrid<DataType, SortField>
1810
+ keyId='id'
1811
+ activeRowId={'3'}
1812
+ rows={slicedData}
1813
+ columns={columns}
1814
+ isLoading={isLoading}
1815
+ onRowClick={handleRowClick}
1816
+ onRetry={() => {}}
1817
+ noDataOptions={{
1818
+ action: {
1819
+ text: 'Сбросить фильтры',
1820
+ onClick: () => {},
1821
+ },
1822
+ }}
1823
+ />
1824
+ </ConfigProvider>
1825
+ );
1826
+ };
1827
+
1828
+ export const Loading = () => {
1829
+ const noDataStubSrc = '/no-data-stub.svg';
1830
+
1831
+ const columns = FAKE_COLUMNS;
1832
+
1833
+ const handleRetry = () => console.log('retry request');
1834
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
1835
+
1836
+ return (
1837
+ <ConfigProvider
1838
+ imagesMap={{
1839
+ defaultErrorImgSrc: errorIllustration,
1840
+ noDataImgSrc: noDataStubSrc,
1841
+ outdatedReleaseErrorImgSrc: '',
1842
+ }}
1843
+ >
1844
+ <DataGrid<DataType, SortField>
1845
+ keyId='id'
1846
+ isLoading
1847
+ rows={[]}
1848
+ columns={columns}
1849
+ onRowClick={handleRowClick}
1850
+ onRetry={handleRetry}
1851
+ />
1852
+ </ConfigProvider>
1853
+ );
1854
+ };
1855
+
1856
+ export const ErrorExample = () => {
1857
+ const noDataStubSrc = '/no-data-stub.svg';
1858
+ const columns = FAKE_COLUMNS;
1859
+
1860
+ const handleRetry = () => console.log('retry request');
1861
+ const handleRowClick = (row: DataType) => console.log('row clicked', row);
1862
+
1863
+ return (
1864
+ <ConfigProvider
1865
+ imagesMap={{
1866
+ defaultErrorImgSrc: errorIllustration,
1867
+ noDataImgSrc: noDataStubSrc,
1868
+ outdatedReleaseErrorImgSrc: '',
1869
+ }}
1870
+ >
1871
+ <DataGrid<DataType, SortField>
1872
+ keyId='id'
1873
+ isError
1874
+ errorMsg='Ошибка 500'
1875
+ rows={[]}
1876
+ columns={columns}
1877
+ onRowClick={handleRowClick}
1878
+ onRetry={handleRetry}
1879
+ />
1880
+ </ConfigProvider>
1881
+ );
1882
+ };