mtxuilib 0.1.589 → 0.1.591

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 (475) hide show
  1. package/dist/common/DebugFormState.d.ts +2 -2
  2. package/dist/common/DebugFormState.js +2 -1
  3. package/dist/common/DeleteComfirm.js +5 -5
  4. package/dist/common/MtErrorBoundary.js +3 -9
  5. package/dist/common/index.d.ts +3 -0
  6. package/dist/common/index.js +3 -0
  7. package/dist/common/pip/PipExamplePage.js +1 -1
  8. package/dist/common/table/data-table-pagination.js +2 -2
  9. package/dist/common/table/data-table-view-options.js +2 -2
  10. package/dist/common/table/datatable-view-options.d.ts +1 -1
  11. package/dist/common/table/datatable-view-options.js +1 -1
  12. package/dist/components/ShowError.js +2 -2
  13. package/dist/data-table/data-table-column-header.d.ts +7 -0
  14. package/dist/data-table/data-table-column-header.js +12 -0
  15. package/dist/data-table/data-table-faceted-filter.d.ts +16 -0
  16. package/dist/data-table/data-table-faceted-filter.js +66 -0
  17. package/dist/data-table/data-table-pagination.d.ts +7 -0
  18. package/dist/data-table/data-table-pagination.js +14 -0
  19. package/dist/data-table/data-table-row-actions.d.ts +11 -0
  20. package/dist/data-table/data-table-row-actions.js +10 -0
  21. package/dist/data-table/data-table-toolbar.d.ts +31 -0
  22. package/dist/data-table/data-table-toolbar.js +18 -0
  23. package/dist/data-table/data-table-view-options.d.ts +6 -0
  24. package/dist/data-table/data-table-view-options.js +13 -0
  25. package/dist/data-table/data-table.d.ts +47 -0
  26. package/dist/data-table/data-table.js +68 -0
  27. package/dist/form/EditFormToolbar.js +5 -5
  28. package/dist/form/deleteConform.js +7 -9
  29. package/dist/hooks/use-can-back.d.ts +1 -1
  30. package/dist/hooks/use-can-back.js +1 -1
  31. package/dist/hooks/use-router.d.ts +1 -0
  32. package/dist/hooks/use-router.js +5 -0
  33. package/dist/hooks/use-scroll-to-bottom.d.ts +5 -0
  34. package/dist/hooks/use-scroll-to-bottom.js +22 -0
  35. package/dist/icons/LoaderI3con.d.ts +3 -0
  36. package/dist/icons/LoaderI3con.js +4 -0
  37. package/dist/icons/icons.d.ts +2 -0
  38. package/dist/icons/icons.js +3 -0
  39. package/dist/icons/index.d.ts +1 -4
  40. package/dist/icons/index.js +1 -4
  41. package/dist/layouts/web/WebLayoutHeader.js +1 -1
  42. package/dist/lib/htmlparse/components/ItemActionButton.js +2 -2
  43. package/dist/lib/htmlparse/htmlParse.js +1 -1
  44. package/dist/lib/index.d.ts +1 -0
  45. package/dist/lib/index.js +1 -0
  46. package/dist/lib/service-worker/ServiceWorkerMain.js +1 -1
  47. package/dist/lib/utils.d.ts +8 -0
  48. package/dist/lib/utils.js +94 -0
  49. package/dist/motion/mtmotion-variants.js +1 -1
  50. package/dist/{ui/mt → mt}/Button.d.ts +1 -1
  51. package/dist/{ui/mt → mt}/Button.js +1 -1
  52. package/dist/{ui/mt → mt}/DropdownMenuItemLink.d.ts +1 -1
  53. package/dist/{ui/mt → mt}/DropdownMenuItemLink.js +1 -1
  54. package/dist/mt/GoBackButton.d.ts +5 -0
  55. package/dist/mt/GoBackButton.js +19 -0
  56. package/dist/{ui/mt → mt}/IconButton.js +1 -1
  57. package/dist/{ui/mt → mt}/MtScrollArea copy.js +1 -1
  58. package/dist/{ui/mt → mt}/MtScrollArea.js +1 -1
  59. package/dist/{ui/mt → mt}/MtSlider.js +2 -2
  60. package/dist/{ui/mt → mt}/NavTag.js +4 -4
  61. package/dist/{ui/mt → mt}/ScreenPanel.d.ts +1 -1
  62. package/dist/{ui/mt → mt}/ScreenPanel.js +3 -3
  63. package/dist/{ui/mt → mt}/Separator.js +1 -1
  64. package/dist/{ui/mt → mt}/Slider.js +2 -2
  65. package/dist/{ui/mt → mt}/Tree.js +1 -1
  66. package/dist/mt/WithLinkIf.d.ts +4 -0
  67. package/dist/mt/code-editor.d.ts +17 -0
  68. package/dist/mt/code-editor.js +126 -0
  69. package/dist/mt/code-highlighter.d.ts +12 -0
  70. package/dist/mt/code-highlighter.js +33 -0
  71. package/dist/mt/copy-to-clipboard.d.ts +9 -0
  72. package/dist/mt/copy-to-clipboard.js +20 -0
  73. package/dist/{ui/mt → mt}/dialog/MtDialog.d.ts +2 -2
  74. package/dist/{ui/mt → mt}/dialog/MtDialog.js +3 -3
  75. package/dist/{ui/mt → mt}/input-field/InputField.js +3 -3
  76. package/dist/{ui/mt → mt}/input-field/TextArea.js +3 -3
  77. package/dist/{ui/mt → mt}/input-field/select/InputSelect.js +2 -2
  78. package/dist/{ui/mt → mt}/inputs/SearchInput.js +1 -1
  79. package/dist/{ui/mt → mt}/inputs/TagsInput.d.ts +1 -1
  80. package/dist/{ui/mt → mt}/inputs/TagsInput.js +1 -1
  81. package/dist/{ui/mt → mt}/inputs/TaskStatusInput.d.ts +1 -1
  82. package/dist/{ui/mt → mt}/inputs/UrlsInput.d.ts +1 -1
  83. package/dist/{ui/mt → mt}/inputs/UrlsInput.js +1 -1
  84. package/dist/mt/inputs/input.d.ts +1 -0
  85. package/dist/mt/inputs/input.js +2 -0
  86. package/dist/mt/loading.d.ts +4 -0
  87. package/dist/mt/loading.js +9 -0
  88. package/dist/mt/logging/logs.d.ts +15 -0
  89. package/dist/mt/logging/logs.js +132 -0
  90. package/dist/{ui/mt → mt}/mtlink.d.ts +1 -1
  91. package/dist/{ui/mt → mt}/mtlink.js +1 -1
  92. package/dist/{ui/mt → mt}/multi-select.js +6 -7
  93. package/dist/mt/relative-date.d.ts +7 -0
  94. package/dist/mt/relative-date.js +47 -0
  95. package/dist/mt/secret-copier.d.ts +10 -0
  96. package/dist/mt/secret-copier.js +77 -0
  97. package/dist/{ui/mt → mt}/skeleton/NewLoading.js +1 -1
  98. package/dist/{ui/mt → mt}/skeleton/SkeletonInput.d.ts +1 -1
  99. package/dist/{ui/mt → mt}/skeleton/SkeletonInput.js +1 -1
  100. package/dist/{ui/mt → mt}/skeleton/SkeletonLayout.js +1 -1
  101. package/dist/{ui/mt → mt}/skeleton/SkeletonLoading.js +1 -1
  102. package/dist/{ui/mt → mt}/skeleton/skeleton-card.js +1 -1
  103. package/dist/{ui/mt → mt}/skeleton/skeletons.js +2 -2
  104. package/dist/{ui/mt → mt}/skeleton.js +1 -1
  105. package/dist/mt/submit-button.d.ts +4 -0
  106. package/dist/mt/submit-button.js +9 -0
  107. package/dist/mt/tabs.d.ts +11 -0
  108. package/dist/mt/tabs.js +34 -0
  109. package/dist/ui/badge.d.ts +2 -2
  110. package/dist/ui/badge.js +3 -0
  111. package/dist/ui/button.d.ts +1 -1
  112. package/dist/ui/button.js +1 -0
  113. package/dist/ui/tooltip.d.ts +4 -0
  114. package/dist/ui/tooltip.js +4 -1
  115. package/package.json +53 -43
  116. package/src/common/DebugFormState.tsx +19 -0
  117. package/src/common/DeleteComfirm.tsx +123 -0
  118. package/src/common/FullCenter.tsx +16 -0
  119. package/src/common/GlobalSearch.tsx +43 -0
  120. package/src/common/HtmlChangesObserver.tsx +71 -0
  121. package/src/common/MtErrorBoundary.tsx +51 -0
  122. package/src/common/MtImage.tsx +42 -0
  123. package/src/common/MtProgressBar.tsx +6 -0
  124. package/src/common/NotFoundGoBack.tsx +19 -0
  125. package/src/common/SlntTree/Slnt.z.tsx +19 -0
  126. package/src/common/SlntTree/SlntTreeNode.tsx +104 -0
  127. package/src/common/index.tsx +3 -0
  128. package/src/common/markdown.tsx +9 -0
  129. package/src/common/mtlink.tsx +61 -0
  130. package/src/common/pip/PipExamplePage.tsx +84 -0
  131. package/src/common/pip/ReactDocumentPictureInPicture.tsx +248 -0
  132. package/src/common/pip/globals.d.ts +8 -0
  133. package/src/common/react-markdown/Code.tsx +23 -0
  134. package/src/common/react-markdown/MarkdownToolbar.tsx +35 -0
  135. package/src/common/react-markdown/ReactMarkdownExample.tsx +42 -0
  136. package/src/common/schema-form/SchemaFormFieldsRender.tsx +38 -0
  137. package/src/common/schema-form/SchemaFormView.tsx +48 -0
  138. package/src/common/schema-form/schema-form.z.ts +25 -0
  139. package/src/common/table/SimpleTable.tsx +45 -0
  140. package/src/common/table/cells/ExpenderCell.tsx +20 -0
  141. package/src/common/table/cells/SelectCell.tsx +53 -0
  142. package/src/common/table/cells/SortOrderCell.tsx-- +29 -0
  143. package/src/common/table/cells/Text.tsx +29 -0
  144. package/src/common/table/cells/ViewLink.tsx +54 -0
  145. package/src/common/table/cells/container/cellWrapper.tsx +12 -0
  146. package/src/common/table/cells/number.tsx +15 -0
  147. package/src/common/table/cells/string.tsx +75 -0
  148. package/src/common/table/columns/columns-example.tsx-- +83 -0
  149. package/src/common/table/data-table-pagination.tsx +97 -0
  150. package/src/common/table/data-table-view-options.tsx +57 -0
  151. package/src/common/table/datatable-view-options.tsx +20 -0
  152. package/src/common/table/example/ExampleTable.tsx +149 -0
  153. package/src/common/table/header/SimpleHeader.tsx +76 -0
  154. package/src/common/table/header/header.tsx +29 -0
  155. package/src/common/table/index.ts +21 -0
  156. package/src/common/table/row/CommonRow.tsx-- +27 -0
  157. package/src/common/table/row/DraggableRow.tsx-- +56 -0
  158. package/src/common/table/table.z.ts +56 -0
  159. package/src/common/tailwind-indicator.tsx +16 -0
  160. package/src/components/AutoResizingTextarea.tsx +51 -0
  161. package/src/components/ChatMessageBubble.tsx +55 -0
  162. package/src/components/ClipboardCopy.tsx +47 -0
  163. package/src/components/InlineCode.tsx +19 -0
  164. package/src/components/IntermediateStep.tsx +53 -0
  165. package/src/components/ShowError.tsx +20 -0
  166. package/src/components/button-scroll-to-bottom.tsx +35 -0
  167. package/src/components/confirm/ConfirmProvider.tsx +145 -0
  168. package/src/components/confirm/Confrom.tsx +52 -0
  169. package/src/components/devtools/DebugValue.tsx +57 -0
  170. package/src/components/devtools/DevTools.tsx +48 -0
  171. package/src/components/empty-screen.tsx +21 -0
  172. package/src/components/external-link.tsx +30 -0
  173. package/src/components/hidden-copyable-input.tsx +45 -0
  174. package/src/components/index.ts-- +8 -0
  175. package/src/components/skeletons/SkeletonListView.tsx +16 -0
  176. package/src/components/skeletons/SkeletonLoading.tsx +16 -0
  177. package/src/components/spinner.tsx +17 -0
  178. package/src/components/theme-toggle.tsx +42 -0
  179. package/src/components/themes/ThemeProvider.tsx +11 -0
  180. package/src/components/themes/theme-toggle.tsx +26 -0
  181. package/src/data-table/data-table-column-header.tsx +72 -0
  182. package/src/data-table/data-table-faceted-filter.tsx +267 -0
  183. package/src/data-table/data-table-pagination.tsx +115 -0
  184. package/src/data-table/data-table-row-actions.tsx +53 -0
  185. package/src/data-table/data-table-toolbar.tsx +90 -0
  186. package/src/data-table/data-table-view-options.tsx +57 -0
  187. package/src/data-table/data-table.tsx +267 -0
  188. package/src/fonts.ts +62 -0
  189. package/src/form/EditFormToolbar.tsx +143 -0
  190. package/src/form/PopupFormV2.tsx +184 -0
  191. package/src/form/SchemaFormFieldRender.tsx +79 -0
  192. package/src/form/ZodForm.tsx +92 -0
  193. package/src/form/deleteConform.tsx +100 -0
  194. package/src/hooks/use-block-stream.tsx-- +95 -0
  195. package/src/hooks/use-can-back.ts +15 -0
  196. package/src/hooks/use-config.ts +21 -0
  197. package/src/hooks/use-copy-to-clipboard.tsx +33 -0
  198. package/src/hooks/use-enter-submit.tsx +17 -0
  199. package/src/hooks/use-local-storage.ts +21 -0
  200. package/src/hooks/use-lock-body.ts +12 -0
  201. package/src/hooks/use-media-query.ts +39 -0
  202. package/src/hooks/use-mobile.tsx +21 -0
  203. package/src/hooks/use-mounted.ts +18 -0
  204. package/src/hooks/use-mutation-observer.ts +20 -0
  205. package/src/hooks/use-router.ts +120 -0
  206. package/src/hooks/use-router.ts.backup +69 -0
  207. package/src/hooks/use-scroll-anchor.tsx +85 -0
  208. package/src/hooks/use-scroll-to-bottom.ts +31 -0
  209. package/src/hooks/use-streamable-text.ts +25 -0
  210. package/src/hooks/useAgentEventStream.ts +60 -0
  211. package/src/hooks/useHighlighter.tsx +34 -0
  212. package/src/hooks/useIsIntersecting.tsx +24 -0
  213. package/src/hooks/useLayoutPath.ts-- +27 -0
  214. package/src/hooks/useLeaveConfirm.ts +38 -0
  215. package/src/hooks/useScript.ts +107 -0
  216. package/src/hooks/useSnapScroll.ts +57 -0
  217. package/src/i18n/I18nProvider.tsx +12 -0
  218. package/src/i18n/i18n.tsx +60 -0
  219. package/src/icons/Auth0.tsx +14 -0
  220. package/src/icons/Cognito.tsx +44 -0
  221. package/src/icons/CopliotIcon.tsx +21 -0
  222. package/src/icons/Cross2Icon.tsx +1 -0
  223. package/src/icons/Descope.tsx +328 -0
  224. package/src/icons/GarbageIcon.tsx +26 -0
  225. package/src/icons/Gitlab.tsx +27 -0
  226. package/src/icons/IconSpinner.tsx +18 -0
  227. package/src/icons/Image.tsx-- +24 -0
  228. package/src/icons/LoaderI3con.tsx +74 -0
  229. package/src/icons/MessageCircle.tsx-- +21 -0
  230. package/src/icons/Okta.tsx +17 -0
  231. package/src/icons/SaveIcon.tsx +22 -0
  232. package/src/icons/Telegram.tsx +22 -0
  233. package/src/icons/attachment.tsx-- +21 -0
  234. package/src/icons/copy.tsx-- +22 -0
  235. package/src/icons/crazy-spinner.tsx +11 -0
  236. package/src/icons/font-default.tsx +20 -0
  237. package/src/icons/font-mono.tsx +21 -0
  238. package/src/icons/font-serif.tsx +21 -0
  239. package/src/icons/github.tsx +15 -0
  240. package/src/icons/icons-ai.tsx +507 -0
  241. package/src/icons/icons.tsx +495 -0
  242. package/src/icons/index.ts +1 -0
  243. package/src/icons/index.tsx +4 -0
  244. package/src/icons/loading-circle.tsx +22 -0
  245. package/src/icons/magic.tsx +30 -0
  246. package/src/icons/messageBubble.tsx-- +21 -0
  247. package/src/icons/microphone.tsx-- +23 -0
  248. package/src/icons/minimize.tsx-- +24 -0
  249. package/src/icons/pencil.tsx-- +22 -0
  250. package/src/icons/squarePen.tsx +21 -0
  251. package/src/icons/thumbs.tsx-- +73 -0
  252. package/src/icons/user.tsx-- +22 -0
  253. package/src/index.ts +4 -0
  254. package/src/layouts/dash/DashLayout.tsx +76 -0
  255. package/src/layouts/dash/MainHeader.tsx +104 -0
  256. package/src/layouts/dash/nav.tsx +46 -0
  257. package/src/layouts/dash5/DashBreadcrumb.tsx +78 -0
  258. package/src/layouts/dash5/DetailViewExample.tsx +9 -0
  259. package/src/layouts/dash5/ListViewExample.tsx +9 -0
  260. package/src/layouts/dash5/MainHeader.tsx +130 -0
  261. package/src/layouts/dash5/SiderDebug.tsx +9 -0
  262. package/src/layouts/dash5/SiderNavItem.tsx +104 -0
  263. package/src/layouts/dash5/SiderToggleButton.tsx +52 -0
  264. package/src/layouts/dash5/dash5.store.tsx +137 -0
  265. package/src/layouts/dash5/index.tsx +155 -0
  266. package/src/layouts/dash5/main-nav.tsx-- +51 -0
  267. package/src/layouts/dash5/nav.tsx-- +137 -0
  268. package/src/layouts/types.tsx +25 -0
  269. package/src/layouts/web/WebLayout.tsx +15 -0
  270. package/src/layouts/web/WebLayoutHeader.tsx +57 -0
  271. package/src/layouts//345/270/203/345/261/200/350/256/276/350/256/241/345/217/202/350/200/203.md +3 -0
  272. package/src/lib/clientlib.ts +57 -0
  273. package/src/lib/componentHelper.ts +79 -0
  274. package/src/lib/copyText.ts +26 -0
  275. package/src/lib/debounce.ts +21 -0
  276. package/src/lib/domutils.ts +29 -0
  277. package/src/lib/errors.ts +9 -0
  278. package/src/lib/highlight-code.ts +33 -0
  279. package/src/lib/htmlparse/components/ItemActionButton.tsx +103 -0
  280. package/src/lib/htmlparse/htmlParse.tsx +112 -0
  281. package/src/lib/index.ts +1 -0
  282. package/src/lib/logger.ts +120 -0
  283. package/src/lib/react-query/ReactQueryProvider.tsx +81 -0
  284. package/src/lib/react.ts +14 -0
  285. package/src/lib/render.tsx +55 -0
  286. package/src/lib/service-worker/ServiceWorkerMain.tsx +57 -0
  287. package/src/lib/service-worker/sw.ts +49 -0
  288. package/src/lib/service-worker.js-- +36 -0
  289. package/src/lib/timeFormat.ts +22 -0
  290. package/src/lib/types.ts +25 -0
  291. package/src/lib/utils.ts +565 -0
  292. package/src/lib/zustand.ts +45 -0
  293. package/src/motion/mtmotion-variants.tsx +21 -0
  294. package/src/mt/Boundary.tsx +37 -0
  295. package/src/mt/Button.tsx +7 -0
  296. package/src/mt/Dialog.tsx +154 -0
  297. package/src/mt/DropdownMenuItemLink.tsx +21 -0
  298. package/src/mt/ErrorMessage.tsx +12 -0
  299. package/src/mt/ExampleTree.tsx +100 -0
  300. package/src/mt/GoBackButton.tsx +46 -0
  301. package/src/mt/IconButton.tsx +100 -0
  302. package/src/mt/LoadingDots.tsx +27 -0
  303. package/src/mt/MtCollapse.tsx +15 -0
  304. package/src/mt/MtScrollArea copy.tsx +130 -0
  305. package/src/mt/MtScrollArea.tsx +142 -0
  306. package/src/mt/MtSlider.tsx +83 -0
  307. package/src/mt/NavTag.tsx +87 -0
  308. package/src/mt/ScreenPanel.tsx +65 -0
  309. package/src/mt/Separator.tsx +4 -0
  310. package/src/mt/SimpleTag.tsx +16 -0
  311. package/src/mt/Slider.tsx +91 -0
  312. package/src/mt/Tree.tsx +279 -0
  313. package/src/mt/WithLinkIf.tsx +14 -0
  314. package/src/mt/code-editor.tsx +218 -0
  315. package/src/mt/code-highlighter.tsx +96 -0
  316. package/src/mt/copy-to-clipboard.tsx +52 -0
  317. package/src/mt/dialog/MtDialog.tsx +35 -0
  318. package/src/mt/headline.tsx +16 -0
  319. package/src/mt/index.ts-- +1 -0
  320. package/src/mt/input-field/InputField.tsx +85 -0
  321. package/src/mt/input-field/SingleUploadForm.tsx +151 -0
  322. package/src/mt/input-field/TextArea.tsx +67 -0
  323. package/src/mt/input-field/TextFileInput.tsx +89 -0
  324. package/src/mt/input-field/select/InputSelect.tsx +114 -0
  325. package/src/mt/inputs/SearchInput.tsx +28 -0
  326. package/src/mt/inputs/TagsInput.tsx +80 -0
  327. package/src/mt/inputs/TaskStatusInput.tsx +62 -0
  328. package/src/mt/inputs/UrlsInput.tsx +21 -0
  329. package/src/mt/inputs/input.tsx +3 -0
  330. package/src/mt/inputs/mui-chips-input.tsx +64 -0
  331. package/src/mt/loading.tsx +13 -0
  332. package/src/mt/logging/logs.tsx +213 -0
  333. package/src/mt/mt-tree-view/mt-tree-view-api.tsx-- +398 -0
  334. package/src/mt/mt-tree-view/mt-treeview.tsx-- +135 -0
  335. package/src/mt/mtlink.tsx +63 -0
  336. package/src/mt/multi-select.tsx +361 -0
  337. package/src/mt/pagination.tsx +98 -0
  338. package/src/mt/relative-date.tsx +92 -0
  339. package/src/mt/secret-copier.tsx +194 -0
  340. package/src/mt/skeleton/NewLoading.tsx +35 -0
  341. package/src/mt/skeleton/SkeletonInput.tsx +14 -0
  342. package/src/mt/skeleton/SkeletonLayout.tsx +38 -0
  343. package/src/mt/skeleton/SkeletonLoading.tsx +12 -0
  344. package/src/mt/skeleton/skeleton-card.tsx +13 -0
  345. package/src/mt/skeleton/skeleton2.tsx +10 -0
  346. package/src/mt/skeleton/skeletons.tsx +73 -0
  347. package/src/mt/skeleton.tsx +25 -0
  348. package/src/mt/spinner/Spinner1.tsx +32 -0
  349. package/src/mt/submit-button.tsx +40 -0
  350. package/src/mt/tabs.tsx +66 -0
  351. package/src/mt/types.tsx +4 -0
  352. package/src/mt/utils/easings.ts +3 -0
  353. package/src/styles/CalSans-SemiBold.otf +0 -0
  354. package/src/styles/globals.css +144 -0
  355. package/src/tailwind.ts +76 -0
  356. package/src/types/common.ts +13 -0
  357. package/src/types/index.d.ts +312 -0
  358. package/src/ui/accordion.tsx +60 -0
  359. package/src/ui/alert-dialog.tsx +132 -0
  360. package/src/ui/alert.tsx +59 -0
  361. package/src/ui/aspect-ratio.tsx +7 -0
  362. package/src/ui/avatar.tsx +50 -0
  363. package/src/ui/badge.tsx +42 -0
  364. package/src/ui/breadcrumb.tsx +111 -0
  365. package/src/ui/button.tsx +60 -0
  366. package/src/ui/calendar.tsx +71 -0
  367. package/src/ui/card.tsx +76 -0
  368. package/src/ui/checkbox.tsx +31 -0
  369. package/src/ui/codeblock.tsx +144 -0
  370. package/src/ui/collapsible.tsx +11 -0
  371. package/src/ui/command.tsx +153 -0
  372. package/src/ui/context-menu.tsx +193 -0
  373. package/src/ui/dialog.tsx +97 -0
  374. package/src/ui/drawer.tsx +139 -0
  375. package/src/ui/dropdown-menu.tsx +194 -0
  376. package/src/ui/form.tsx +172 -0
  377. package/src/ui/hover-card.tsx +29 -0
  378. package/src/ui/index.ts-- +1 -0
  379. package/src/ui/input.tsx +25 -0
  380. package/src/ui/label.tsx +26 -0
  381. package/src/ui/menubar.tsx +240 -0
  382. package/src/ui/navigation-menu.tsx +122 -0
  383. package/src/ui/pagination.tsx +120 -0
  384. package/src/ui/popover.tsx +31 -0
  385. package/src/ui/progress.tsx +28 -0
  386. package/src/ui/radio-group.tsx +44 -0
  387. package/src/ui/resizable.tsx +43 -0
  388. package/src/ui/scroll-area.tsx +90 -0
  389. package/src/ui/select.tsx +151 -0
  390. package/src/ui/separator.tsx +31 -0
  391. package/src/ui/sheet.tsx +140 -0
  392. package/src/ui/sidebar.tsx +774 -0
  393. package/src/ui/skeleton.tsx +15 -0
  394. package/src/ui/slider.tsx +28 -0
  395. package/src/ui/sonner.tsx +44 -0
  396. package/src/ui/switch.tsx +29 -0
  397. package/src/ui/table.tsx +111 -0
  398. package/src/ui/tabs.tsx +55 -0
  399. package/src/ui/textarea.tsx +24 -0
  400. package/src/ui/toast.tsx +131 -0
  401. package/src/ui/toaster.tsx +41 -0
  402. package/src/ui/toggle.tsx +45 -0
  403. package/src/ui/tooltip.tsx +49 -0
  404. package/src/ui/use-toast.ts +203 -0
  405. package/src/video-player/video-player2/modal-video-player.tsx-- +128 -0
  406. package/dist/common/tiptap/MenuBar.d.ts +0 -1
  407. package/dist/common/tiptap/MenuBar.js +0 -34
  408. package/dist/common/tiptap/TiptapEditor.d.ts +0 -5
  409. package/dist/common/tiptap/TiptapEditor.js +0 -46
  410. package/dist/common/tiptap/examples/Demo-Default.d.ts +0 -1
  411. package/dist/common/tiptap/examples/Demo-Default.js +0 -84
  412. package/dist/common/tiptap/examples/Demo-Tiptap.d.ts +0 -1
  413. package/dist/common/tiptap/examples/Demo-Tiptap.js +0 -13
  414. package/dist/components/themes/useTheme.d.ts +0 -0
  415. package/dist/components/themes/useTheme.js +0 -1
  416. package/dist/layouts/dash5/Dash5Debug.d.ts +0 -1
  417. package/dist/layouts/dash5/Dash5Debug.js +0 -6
  418. package/dist/ui/mt/MtForm.d.ts +0 -2
  419. package/dist/ui/mt/MtForm.js +0 -5
  420. package/dist/ui/mt/WithLinkIf.d.ts +0 -4
  421. package/dist/ui/mt/inputs/input.d.ts +0 -1
  422. package/dist/ui/mt/inputs/input.js +0 -2
  423. /package/dist/{ui/mt → mt}/Boundary.d.ts +0 -0
  424. /package/dist/{ui/mt → mt}/Boundary.js +0 -0
  425. /package/dist/{ui/mt → mt}/Dialog.d.ts +0 -0
  426. /package/dist/{ui/mt → mt}/Dialog.js +0 -0
  427. /package/dist/{ui/mt → mt}/ErrorMessage.d.ts +0 -0
  428. /package/dist/{ui/mt → mt}/ErrorMessage.js +0 -0
  429. /package/dist/{ui/mt → mt}/ExampleTree.d.ts +0 -0
  430. /package/dist/{ui/mt → mt}/ExampleTree.js +0 -0
  431. /package/dist/{ui/mt → mt}/IconButton.d.ts +0 -0
  432. /package/dist/{ui/mt → mt}/LoadingDots.d.ts +0 -0
  433. /package/dist/{ui/mt → mt}/LoadingDots.js +0 -0
  434. /package/dist/{ui/mt → mt}/MtCollapse.d.ts +0 -0
  435. /package/dist/{ui/mt → mt}/MtCollapse.js +0 -0
  436. /package/dist/{ui/mt → mt}/MtScrollArea copy.d.ts +0 -0
  437. /package/dist/{ui/mt → mt}/MtScrollArea.d.ts +0 -0
  438. /package/dist/{ui/mt → mt}/MtSlider.d.ts +0 -0
  439. /package/dist/{ui/mt → mt}/NavTag.d.ts +0 -0
  440. /package/dist/{ui/mt → mt}/Separator.d.ts +0 -0
  441. /package/dist/{ui/mt → mt}/SimpleTag.d.ts +0 -0
  442. /package/dist/{ui/mt → mt}/SimpleTag.js +0 -0
  443. /package/dist/{ui/mt → mt}/Slider.d.ts +0 -0
  444. /package/dist/{ui/mt → mt}/Tree.d.ts +0 -0
  445. /package/dist/{ui/mt → mt}/WithLinkIf.js +0 -0
  446. /package/dist/{ui/mt → mt}/headline.d.ts +0 -0
  447. /package/dist/{ui/mt → mt}/headline.js +0 -0
  448. /package/dist/{ui/mt → mt}/input-field/InputField.d.ts +0 -0
  449. /package/dist/{ui/mt → mt}/input-field/SingleUploadForm.d.ts +0 -0
  450. /package/dist/{ui/mt → mt}/input-field/SingleUploadForm.js +0 -0
  451. /package/dist/{ui/mt → mt}/input-field/TextArea.d.ts +0 -0
  452. /package/dist/{ui/mt → mt}/input-field/TextFileInput.d.ts +0 -0
  453. /package/dist/{ui/mt → mt}/input-field/TextFileInput.js +0 -0
  454. /package/dist/{ui/mt → mt}/input-field/select/InputSelect.d.ts +0 -0
  455. /package/dist/{ui/mt → mt}/inputs/SearchInput.d.ts +0 -0
  456. /package/dist/{ui/mt → mt}/inputs/TaskStatusInput.js +0 -0
  457. /package/dist/{ui/mt → mt}/inputs/mui-chips-input.d.ts +0 -0
  458. /package/dist/{ui/mt → mt}/inputs/mui-chips-input.js +0 -0
  459. /package/dist/{ui/mt → mt}/multi-select.d.ts +0 -0
  460. /package/dist/{ui/mt → mt}/pagination.d.ts +0 -0
  461. /package/dist/{ui/mt → mt}/pagination.js +0 -0
  462. /package/dist/{ui/mt → mt}/skeleton/NewLoading.d.ts +0 -0
  463. /package/dist/{ui/mt → mt}/skeleton/SkeletonLayout.d.ts +0 -0
  464. /package/dist/{ui/mt → mt}/skeleton/SkeletonLoading.d.ts +0 -0
  465. /package/dist/{ui/mt → mt}/skeleton/skeleton-card.d.ts +0 -0
  466. /package/dist/{ui/mt → mt}/skeleton/skeleton2.d.ts +0 -0
  467. /package/dist/{ui/mt → mt}/skeleton/skeleton2.js +0 -0
  468. /package/dist/{ui/mt → mt}/skeleton/skeletons.d.ts +0 -0
  469. /package/dist/{ui/mt → mt}/skeleton.d.ts +0 -0
  470. /package/dist/{ui/mt → mt}/spinner/Spinner1.d.ts +0 -0
  471. /package/dist/{ui/mt → mt}/spinner/Spinner1.js +0 -0
  472. /package/dist/{ui/mt → mt}/types.d.ts +0 -0
  473. /package/dist/{ui/mt → mt}/types.js +0 -0
  474. /package/dist/{ui/mt → mt}/utils/easings.d.ts +0 -0
  475. /package/dist/{ui/mt → mt}/utils/easings.js +0 -0
@@ -1,4 +1,4 @@
1
- import { UseFormReturn } from "react-hook-form";
1
+ import type { UseFormReturn } from "react-hook-form";
2
2
  export declare const DebugFormState: (props: {
3
- form: UseFormReturn<any>;
3
+ form: UseFormReturn;
4
4
  }) => null;
@@ -3,7 +3,8 @@ import { useMemo } from "react";
3
3
  export const DebugFormState = (props) => {
4
4
  const { form } = props;
5
5
  useMemo(() => {
6
- if (form?.formState?.errors && Object.keys(form?.formState?.errors).length > 0) {
6
+ if (form?.formState?.errors &&
7
+ Object.keys(form?.formState?.errors).length > 0) {
7
8
  console.warn("DebugFormState", form?.formState?.errors);
8
9
  }
9
10
  }, [form?.formState?.errors]);
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { createContext, useCallback, useContext, useMemo, } from "react";
4
4
  import { createStore, useStore } from "zustand";
5
5
  import { immer } from "zustand/middleware/immer";
6
- import { MtButton } from "../ui/mt/Button";
6
+ import { Button } from "../ui/button";
7
7
  import { Dialog, DialogContent, DialogDescription, DialogTitle, } from "../ui/dialog";
8
8
  export const createFormSlice = (set, get) => ({
9
9
  setOpen: (open) => set({ open }),
@@ -42,11 +42,11 @@ export const DeleteConfirmDlg = () => {
42
42
  const open = useDeleteConfirmStore((x) => x.open);
43
43
  const setOpen = useDeleteConfirmStore((x) => x.setOpen);
44
44
  const confirmCallback = useDeleteConfirmStore((x) => x.confirmCallback);
45
- return (_jsx(Dialog, { open: open, onOpenChange: setOpen, children: _jsxs(DialogContent, { children: [_jsx(DialogTitle, { children: "delete confirm" }), _jsx(DialogDescription, { children: "will delete item, continue?" }), _jsx(MtButton, { variant: "destructive", onClick: async () => {
45
+ return (_jsx(Dialog, { open: open, onOpenChange: setOpen, children: _jsxs(DialogContent, { children: [_jsx(DialogTitle, { children: "delete confirm" }), _jsx(DialogDescription, { children: "will delete item, continue?" }), _jsx(Button, { variant: "destructive", onClick: async () => {
46
46
  setOpen(false);
47
- confirmCallback && confirmCallback();
48
- }, children: "Continue" }), _jsx(MtButton, { variant: "outline", onClick: () => {
47
+ confirmCallback?.();
48
+ }, children: "Continue" }), _jsx(Button, { variant: "outline", onClick: () => {
49
49
  setOpen(false);
50
- confirmCallback && confirmCallback();
50
+ confirmCallback?.();
51
51
  }, children: "Cancel" })] }) }));
52
52
  };
@@ -1,16 +1,10 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { ErrorBoundary } from "react-error-boundary";
3
- import { MtButton } from "../ui/mt/Button";
3
+ import { Button } from "../ui/button";
4
4
  export const MtErrorBoundary = (props) => {
5
5
  const { children } = props;
6
6
  return (_jsx(ErrorBoundary, { fallbackRender: ({ error, resetErrorBoundary }) => {
7
7
  console.log("💥💥💥", error);
8
- return (_jsx("div", { className: "flex items-center justify-center h-full w-full", children: _jsx(MtButton, { onClick: () => resetErrorBoundary(), className: "min-w-24 p-4", children: "\u91CD\u8BD5" }) }));
8
+ return (_jsx("div", { className: "flex items-center justify-center h-full w-full", children: _jsx(Button, { onClick: () => resetErrorBoundary(), className: "min-w-24 p-4", children: "\u91CD\u8BD5" }) }));
9
9
  }, onReset: () => { }, children: children }));
10
10
  };
11
- const CustomErrorRetry = (props) => {
12
- const { message, onRetry } = props;
13
- return (_jsxs("div", { className: "flex flex-col space-y-4 bg-red-200 p-2", children: [message && _jsx("h2", { children: message }), _jsx(MtButton, { onClick: () => {
14
- onRetry();
15
- }, children: "retry" })] }));
16
- };
@@ -0,0 +1,3 @@
1
+ export * from "./mtlink";
2
+ export * from "./MtErrorBoundary";
3
+ export * from "./markdown";
@@ -0,0 +1,3 @@
1
+ export * from "./mtlink";
2
+ export * from "./MtErrorBoundary";
3
+ export * from "./markdown";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import ReactDocumentPictureInPicture from "mtxuilib/common/pip/ReactDocumentPictureInPicture";
4
- import { MtButton } from "mtxuilib/ui/mt/Button";
4
+ import { MtButton } from "mtxuilib/mt/Button";
5
5
  import { useRef, useState } from "react";
6
6
  export default function PipExamplePage() {
7
7
  const pipWindowRef = useRef(null);
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
3
3
  import { ChevronLeftIcon, ChevronRightIcon, DoubleArrowLeftIcon, DoubleArrowRightIcon, } from "@radix-ui/react-icons";
4
- import { MtButton } from "../../ui/mt/Button";
4
+ import { Button } from "../../ui/button";
5
5
  import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "../../ui/select";
6
6
  export function DataTablePagination({ table, }) {
7
7
  return (_jsxs("div", { className: "flex items-center justify-between px-2", children: [_jsxs("div", { className: "text-muted-foreground flex-1 text-sm", children: [table.getFilteredSelectedRowModel().rows.length, " of", " ", table.getFilteredRowModel().rows.length, " row(s) selected."] }), _jsxs("div", { className: "flex items-center space-x-6 lg:space-x-8", children: [_jsxs("div", { className: "flex items-center space-x-2", children: [_jsx("p", { className: "text-sm font-medium", children: "Rows per page" }), _jsxs(Select, { value: `${table.getState().pagination.pageSize}`, onValueChange: (value) => {
8
8
  table.setPageSize(Number(value));
9
- }, children: [_jsx(SelectTrigger, { className: "h-8 w-[70px]", children: _jsx(SelectValue, { placeholder: table.getState().pagination.pageSize }) }), _jsx(SelectContent, { side: "top", children: [10, 20, 30, 40, 50].map((pageSize) => (_jsx(SelectItem, { value: `${pageSize}`, children: pageSize }, pageSize))) })] })] }), _jsxs("div", { className: "flex w-[100px] items-center justify-center text-sm font-medium", children: ["Page ", table.getState().pagination.pageIndex + 1, " of", " ", table.getPageCount()] }), _jsxs("div", { className: "flex items-center space-x-2", children: [_jsxs(MtButton, { variant: "outline", className: "hidden h-8 w-8 p-0 lg:flex", onClick: () => table.setPageIndex(0), disabled: !table.getCanPreviousPage(), children: [_jsx("span", { className: "sr-only", children: "Go to first page" }), _jsx(DoubleArrowLeftIcon, { className: "h-4 w-4" })] }), _jsxs(MtButton, { variant: "outline", className: "h-8 w-8 p-0", onClick: () => table.previousPage(), disabled: !table.getCanPreviousPage(), children: [_jsx("span", { className: "sr-only", children: "Go to previous page" }), _jsx(ChevronLeftIcon, { className: "h-4 w-4" })] }), _jsxs(MtButton, { variant: "outline", className: "h-8 w-8 p-0", onClick: () => table.nextPage(), disabled: !table.getCanNextPage(), children: [_jsx("span", { className: "sr-only", children: "Go to next page" }), _jsx(ChevronRightIcon, { className: "h-4 w-4" })] }), _jsxs(MtButton, { variant: "outline", className: "hidden h-8 w-8 p-0 lg:flex", onClick: () => table.setPageIndex(table.getPageCount() - 1), disabled: !table.getCanNextPage(), children: [_jsx("span", { className: "sr-only", children: "Go to last page" }), _jsx(DoubleArrowRightIcon, { className: "h-4 w-4" })] })] })] })] }));
9
+ }, children: [_jsx(SelectTrigger, { className: "h-8 w-[70px]", children: _jsx(SelectValue, { placeholder: table.getState().pagination.pageSize }) }), _jsx(SelectContent, { side: "top", children: [10, 20, 30, 40, 50].map((pageSize) => (_jsx(SelectItem, { value: `${pageSize}`, children: pageSize }, pageSize))) })] })] }), _jsxs("div", { className: "flex w-[100px] items-center justify-center text-sm font-medium", children: ["Page ", table.getState().pagination.pageIndex + 1, " of", " ", table.getPageCount()] }), _jsxs("div", { className: "flex items-center space-x-2", children: [_jsxs(Button, { variant: "outline", className: "hidden h-8 w-8 p-0 lg:flex", onClick: () => table.setPageIndex(0), disabled: !table.getCanPreviousPage(), children: [_jsx("span", { className: "sr-only", children: "Go to first page" }), _jsx(DoubleArrowLeftIcon, { className: "h-4 w-4" })] }), _jsxs(Button, { variant: "outline", className: "h-8 w-8 p-0", onClick: () => table.previousPage(), disabled: !table.getCanPreviousPage(), children: [_jsx("span", { className: "sr-only", children: "Go to previous page" }), _jsx(ChevronLeftIcon, { className: "h-4 w-4" })] }), _jsxs(Button, { variant: "outline", className: "h-8 w-8 p-0", onClick: () => table.nextPage(), disabled: !table.getCanNextPage(), children: [_jsx("span", { className: "sr-only", children: "Go to next page" }), _jsx(ChevronRightIcon, { className: "h-4 w-4" })] }), _jsxs(Button, { variant: "outline", className: "hidden h-8 w-8 p-0 lg:flex", onClick: () => table.setPageIndex(table.getPageCount() - 1), disabled: !table.getCanNextPage(), children: [_jsx("span", { className: "sr-only", children: "Go to last page" }), _jsx(DoubleArrowRightIcon, { className: "h-4 w-4" })] })] })] })] }));
10
10
  }
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { MixerHorizontalIcon } from "@radix-ui/react-icons";
4
- import { MtButton } from "../../ui/mt/Button";
4
+ import { Button } from "../../ui/button";
5
5
  import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "../../ui/dropdown-menu";
6
6
  export function DataTableViewOptions({ table, }) {
7
- return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(MtButton, { variant: "outline", size: "sm", className: "ml-auto hidden h-8 lg:flex", children: [_jsx(MixerHorizontalIcon, { className: "mr-2 h-4 w-4" }), "View"] }) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-[150px]", children: [_jsx(DropdownMenuLabel, { children: "Toggle columns" }), _jsx(DropdownMenuSeparator, {}), table
7
+ return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", size: "sm", className: "ml-auto hidden h-8 lg:flex", children: [_jsx(MixerHorizontalIcon, { className: "mr-2 h-4 w-4" }), "View"] }) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-[150px]", children: [_jsx(DropdownMenuLabel, { children: "Toggle columns" }), _jsx(DropdownMenuSeparator, {}), table
8
8
  .getAllColumns()
9
9
  .filter((column) => typeof column.accessorFn !== "undefined" && column.getCanHide())
10
10
  .map((column) => {
@@ -1,4 +1,4 @@
1
- import { UseMutationResult } from "@tanstack/react-query";
1
+ import type { UseMutationResult } from "@tanstack/react-query";
2
2
  interface ViewAction {
3
3
  label: string;
4
4
  link: string;
@@ -1,2 +1,2 @@
1
- 'use client';
1
+ "use client";
2
2
  export {};
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { MtButton } from "../ui/mt/Button";
3
+ import { Button } from "../ui/button";
4
4
  export const ShowError = (props) => {
5
- return (_jsxs("div", { className: "bg-orange-400 p-4 flex items-center justify-center flex-col", children: [_jsx("h3", { children: "\u5185\u90E8\u51FA\u9519" }), _jsx(MtButton, { type: "button", onClick: () => props.reset(), children: "\u91CD\u8BD5" })] }));
5
+ return (_jsxs("div", { className: "bg-orange-400 p-4 flex items-center justify-center flex-col", children: [_jsx("h3", { children: "\u5185\u90E8\u51FA\u9519" }), _jsx(Button, { type: "button", onClick: () => props.reset(), children: "\u91CD\u8BD5" })] }));
6
6
  };
@@ -0,0 +1,7 @@
1
+ import type { Column } from "@tanstack/react-table";
2
+ interface DataTableColumnHeaderProps<TData, TValue> extends React.HTMLAttributes<HTMLDivElement> {
3
+ column: Column<TData, TValue>;
4
+ title: string;
5
+ }
6
+ export declare function DataTableColumnHeader<TData, TValue>({ column, title, className, }: DataTableColumnHeaderProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { ArrowDownIcon, ArrowUpIcon, CaretSortIcon, EyeNoneIcon, } from "@radix-ui/react-icons";
4
+ import { cn } from "mtxuilib/lib/utils";
5
+ import { Button } from "mtxuilib/ui/button";
6
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "mtxuilib/ui/dropdown-menu";
7
+ export function DataTableColumnHeader({ column, title, className, }) {
8
+ if (!column.getCanSort()) {
9
+ return _jsx("div", { className: cn(className, "text-xs"), children: title });
10
+ }
11
+ return (_jsx("div", { className: cn("flex items-center space-x-2", className), children: _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", size: "sm", className: "-ml-3 h-8 data-[state=open]:bg-accent", children: [_jsx("span", { children: title }), column.getIsSorted() === "desc" ? (_jsx(ArrowDownIcon, { className: "ml-2 h-4 w-4" })) : column.getIsSorted() === "asc" ? (_jsx(ArrowUpIcon, { className: "ml-2 h-4 w-4" })) : (_jsx(CaretSortIcon, { className: "ml-2 h-4 w-4" }))] }) }), _jsxs(DropdownMenuContent, { align: "start", children: [_jsxs(DropdownMenuItem, { onClick: () => column.toggleSorting(false), children: [_jsx(ArrowUpIcon, { className: "mr-2 h-3.5 w-3.5 text-gray-600 dark:text-gray-400/70" }), "Asc"] }), _jsxs(DropdownMenuItem, { onClick: () => column.toggleSorting(true), children: [_jsx(ArrowDownIcon, { className: "mr-2 h-3.5 w-3.5 text-gray-600 dark:text-gray-400/70" }), "Desc"] }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuItem, { onClick: () => column.toggleVisibility(false), children: [_jsx(EyeNoneIcon, { className: "mr-2 h-3.5 w-3.5 text-gray-600 dark:text-gray-400/70" }), "Hide"] })] })] }) }));
12
+ }
@@ -0,0 +1,16 @@
1
+ import type { Column } from "@tanstack/react-table";
2
+ import { ToolbarType } from "./data-table-toolbar";
3
+ interface DataTableFacetedFilterProps<TData, TValue> {
4
+ column?: Column<TData, TValue>;
5
+ title?: string;
6
+ type?: ToolbarType;
7
+ options?: {
8
+ label: string;
9
+ value: string;
10
+ icon?: React.ComponentType<{
11
+ className?: string;
12
+ }>;
13
+ }[];
14
+ }
15
+ export declare function DataTableFacetedFilter<TData, TValue>({ column, title, type, options, }: DataTableFacetedFilterProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
16
+ export {};
@@ -0,0 +1,66 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { CheckIcon, CircleIcon, PlusCircledIcon } from "@radix-ui/react-icons";
4
+ import { zodResolver } from "@hookform/resolvers/zod";
5
+ import { cn } from "mtxuilib/lib/utils";
6
+ import { Badge } from "mtxuilib/ui/badge";
7
+ import { Button } from "mtxuilib/ui/button";
8
+ import { Command, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, } from "mtxuilib/ui/command";
9
+ import { Input } from "mtxuilib/ui/input";
10
+ import { Popover, PopoverContent, PopoverTrigger } from "mtxuilib/ui/popover";
11
+ import { Separator } from "mtxuilib/ui/separator";
12
+ import { useForm } from "react-hook-form";
13
+ import { BiX } from "react-icons/bi";
14
+ import { z } from "zod";
15
+ import { ToolbarType } from "./data-table-toolbar";
16
+ const keyValuePairSchema = z.object({
17
+ key: z.string().min(1, "Key is required"),
18
+ value: z.string().min(1, "Value is required"),
19
+ });
20
+ const arrayInputSchema = z.object({
21
+ values: z.string().min(1, "At least one value is required"),
22
+ });
23
+ export function DataTableFacetedFilter({ column, title, type = ToolbarType.Checkbox, options, }) {
24
+ const selectedValues = new Set(column?.getFilterValue());
25
+ const { register, handleSubmit, reset } = useForm({
26
+ resolver: zodResolver(type === ToolbarType.KeyValue ? keyValuePairSchema : arrayInputSchema),
27
+ defaultValues: type === ToolbarType.KeyValue ? { key: "", value: "" } : { values: "" },
28
+ });
29
+ const onSubmit = (data) => {
30
+ if ("key" in data) {
31
+ selectedValues.add(`${data.key}:${data.value}`);
32
+ }
33
+ else {
34
+ data.values
35
+ .split(",")
36
+ .forEach((value) => selectedValues.add(value.trim()));
37
+ }
38
+ const filterValues = Array.from(selectedValues);
39
+ column?.setFilterValue(filterValues.length ? filterValues : undefined);
40
+ reset();
41
+ };
42
+ const handleRemove = (filter) => {
43
+ selectedValues.delete(filter);
44
+ const filterValues = Array.from(selectedValues);
45
+ column?.setFilterValue(filterValues.length ? filterValues : undefined);
46
+ };
47
+ return (_jsxs(Popover, { children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", size: "sm", className: "h-8 border-dashed", children: [_jsx(PlusCircledIcon, { className: "mr-2 h-4 w-4" }), title, selectedValues?.size > 0 && (_jsxs(_Fragment, { children: [_jsx(Separator, { orientation: "vertical", className: "mx-2 h-4" }), _jsx(Badge, { variant: "secondary", className: "rounded-sm px-1 font-normal lg:hidden", children: selectedValues.size }), _jsx("div", { className: "hidden space-x-1 lg:flex", children: selectedValues.size > 2 ? (_jsxs(Badge, { variant: "secondary", className: "rounded-sm px-1 font-normal", children: [selectedValues.size, " selected"] })) : (Array.from(selectedValues).map((option, index) => (_jsxs(Badge, { variant: "secondary", className: "rounded-sm px-1 font-normal flex items-center space-x-1", children: [options?.find(({ value }) => value == option)?.label ||
48
+ option, _jsx(Button, { variant: "ghost", size: "xs", className: "ml-2", onClick: () => handleRemove(option), children: _jsx(BiX, { className: "h-3 w-3" }) })] }, index)))) })] }))] }) }), _jsxs(PopoverContent, { className: "w-[300px] p-2", align: "start", children: [[ToolbarType.Array, ToolbarType.KeyValue].includes(type) && (_jsxs("div", { children: [_jsx("div", { className: "", children: Array.from(selectedValues).map((filter, index) => (_jsxs(Badge, { variant: "secondary", className: "mr-2 mb-2 rounded-sm px-1 font-normal flex items-center space-x-1 font-normal pl-2", children: [_jsx("span", { className: "grow", children: filter }), _jsx(Button, { variant: "ghost", size: "icon", className: "ml-2 shrink-0", onClick: () => handleRemove(filter), children: _jsx(BiX, { className: "h-4 w-4" }) })] }, index))) }), _jsxs("form", { onSubmit: handleSubmit(onSubmit), children: [type === ToolbarType.KeyValue ? (_jsxs("div", { className: "flex items-center space-x-2 mb-2", children: [_jsx(Input, { type: "text", placeholder: "Key", ...register("key"), className: "flex-1" }), _jsx(Input, { type: "text", placeholder: "Value", ...register("value"), className: "flex-1" })] })) : (_jsx("div", { className: "mb-2", children: _jsx(Input, { type: "text", placeholder: "Enter values (comma-separated)", ...register("values"), className: "w-full" }) })), _jsxs(Button, { type: "submit", className: "w-full", size: "sm", children: ["Add ", title, " Filter"] }), selectedValues.size > 0 && (_jsx(Button, { onClick: () => column?.setFilterValue(undefined), className: "w-full mt-2", size: "sm", variant: "ghost", children: "Reset" }))] })] })), [ToolbarType.Checkbox, ToolbarType.Radio].includes(type) && (_jsxs(Command, { children: [_jsx(CommandInput, { placeholder: title }), _jsxs(CommandList, { children: [_jsx(CommandEmpty, { children: "No results found." }), _jsx(CommandGroup, { children: options?.map((option) => {
49
+ const isSelected = selectedValues.has(option.value);
50
+ return (_jsxs(CommandItem, { onSelect: () => {
51
+ if (isSelected) {
52
+ selectedValues.delete(option.value);
53
+ }
54
+ else {
55
+ if (type == "radio") {
56
+ selectedValues.clear();
57
+ }
58
+ selectedValues.add(option.value);
59
+ }
60
+ const filterValues = Array.from(selectedValues);
61
+ column?.setFilterValue(filterValues.length ? filterValues : undefined);
62
+ }, children: [_jsx("div", { className: cn("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary", isSelected
63
+ ? "bg-primary text-primary-foreground"
64
+ : "opacity-50 [&_svg]:invisible"), children: type === "checkbox" ? (_jsx(CheckIcon, { className: cn("h-4 w-4") })) : (_jsx(CircleIcon, { className: cn("h-4 w-4") })) }), option.icon && (_jsx(option.icon, { className: "mr-2 h-4 w-4 text-gray-700 dark:text-gray-300" })), _jsx("span", { children: option.label })] }, option.value));
65
+ }) }), selectedValues.size > 0 && (_jsxs(_Fragment, { children: [_jsx(CommandSeparator, {}), _jsx(CommandGroup, { children: _jsx(CommandItem, { onSelect: () => column?.setFilterValue(undefined), className: "justify-center text-center", children: "Reset" }) })] }))] })] }))] })] }));
66
+ }
@@ -0,0 +1,7 @@
1
+ import type { Table } from "@tanstack/react-table";
2
+ interface DataTablePaginationProps<TData> {
3
+ table: Table<TData>;
4
+ onSetPageSize?: (pageSize: number) => void;
5
+ }
6
+ export declare function DataTablePagination<TData>({ table, onSetPageSize, }: DataTablePaginationProps<TData>): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,14 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ import { ChevronLeftIcon, ChevronRightIcon, DoubleArrowLeftIcon, DoubleArrowRightIcon, } from "@radix-ui/react-icons";
3
+ import { Button } from "../ui/button";
4
+ import { Label } from "../ui/label";
5
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "../ui/select";
6
+ export function DataTablePagination({ table, onSetPageSize, }) {
7
+ const pagination = table.getState().pagination;
8
+ return (_jsxs("div", { className: "flex items-center justify-between px-2", children: [_jsxs("div", { className: "flex-1 text-sm text-gray-600 dark:text-gray-400", children: [table.getFilteredSelectedRowModel().rows.length, " of", " ", table.getFilteredRowModel().rows.length, " row(s) selected."] }), _jsxs("div", { className: "flex items-center space-x-6 lg:space-x-8", children: [_jsxs("div", { className: "flex items-center space-x-2", children: [_jsx(Label, { className: "text-sm font-medium text-gray-600 dark:text-gray-400", htmlFor: "rows-per-page", id: "rows-per-page-label", children: "Rows per page" }), _jsxs(Select, { value: `${pagination.pageSize}`, onValueChange: (value) => {
9
+ table.setPageSize(Number(value));
10
+ if (onSetPageSize) {
11
+ onSetPageSize(Number(value));
12
+ }
13
+ }, children: [_jsx(SelectTrigger, { className: "h-8 w-[70px]", id: "rows-per-page", "aria-labelledby": "rows-per-page-label", children: _jsx(SelectValue, { placeholder: pagination.pageSize }) }), _jsx(SelectContent, { side: "top", children: [50, 100, 200, 500].map((pageSize) => (_jsx(SelectItem, { value: `${pageSize}`, children: pageSize }, pageSize))) })] })] }), _jsxs("div", { className: "flex w-[100px] items-center justify-center text-sm font-medium", children: ["Page ", pagination.pageIndex + 1, " of ", table.getPageCount()] }), _jsxs("div", { className: "flex items-center space-x-2", children: [_jsxs(Button, { variant: "outline", className: "hidden h-8 w-8 p-0 lg:flex", onClick: () => table.setPageIndex(0), disabled: !table.getCanPreviousPage(), children: [_jsx("span", { className: "sr-only", children: "Go to first page" }), _jsx(DoubleArrowLeftIcon, { className: "h-4 w-4" })] }), _jsxs(Button, { variant: "outline", className: "h-8 w-8 p-0", onClick: () => table.previousPage(), disabled: !table.getCanPreviousPage(), children: [_jsx("span", { className: "sr-only", children: "Go to previous page" }), _jsx(ChevronLeftIcon, { className: "h-4 w-4" })] }), _jsxs(Button, { variant: "outline", className: "h-8 w-8 p-0", onClick: () => table.nextPage(), disabled: !table.getCanNextPage(), children: [_jsx("span", { className: "sr-only", children: "Go to next page" }), _jsx(ChevronRightIcon, { className: "h-4 w-4" })] }), _jsxs(Button, { variant: "outline", className: "hidden h-8 w-8 p-0 lg:flex", onClick: () => table.setPageIndex(table.getPageCount() - 1), disabled: !table.getCanNextPage(), children: [_jsx("span", { className: "sr-only", children: "Go to last page" }), _jsx(DoubleArrowRightIcon, { className: "h-4 w-4" })] })] })] })] }));
14
+ }
@@ -0,0 +1,11 @@
1
+ import type { Row } from "@tanstack/react-table";
2
+ import type { IDGetter } from "./data-table";
3
+ interface DataTableRowActionsProps<TData extends IDGetter> {
4
+ row: Row<TData>;
5
+ actions?: {
6
+ label: string;
7
+ onClick: (data: TData) => void;
8
+ }[];
9
+ }
10
+ export declare function DataTableRowActions<TData extends IDGetter>({ row, actions, }: DataTableRowActionsProps<TData>): import("react/jsx-runtime").JSX.Element | null;
11
+ export {};
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DotsHorizontalIcon } from "@radix-ui/react-icons";
3
+ import { Button } from "mtxuilib/ui/button";
4
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "mtxuilib/ui/dropdown-menu";
5
+ export function DataTableRowActions({ row, actions, }) {
6
+ if (!actions?.length) {
7
+ return null;
8
+ }
9
+ return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "ghost", className: "flex h-8 w-8 p-0 data-[state=open]:bg-muted", children: [_jsx(DotsHorizontalIcon, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: "Open menu" })] }) }), _jsx(DropdownMenuContent, { align: "end", className: "w-[160px]", children: actions?.map((action) => (_jsx(DropdownMenuItem, { onClick: () => action.onClick(row.original), children: action.label }, action.label))) })] }));
10
+ }
@@ -0,0 +1,31 @@
1
+ import type { Table } from "@tanstack/react-table";
2
+ export interface FilterOption {
3
+ label: string;
4
+ value: string;
5
+ icon?: React.ComponentType<{
6
+ className?: string;
7
+ }>;
8
+ }
9
+ export declare enum ToolbarType {
10
+ Checkbox = "checkbox",
11
+ Radio = "radio",
12
+ KeyValue = "key-value",
13
+ Array = "array"
14
+ }
15
+ export type ToolbarFilters = {
16
+ columnId: string;
17
+ title: string;
18
+ type?: ToolbarType;
19
+ options?: FilterOption[];
20
+ }[];
21
+ interface DataTableToolbarProps<TData> {
22
+ table: Table<TData>;
23
+ filters: ToolbarFilters;
24
+ actions: JSX.Element[];
25
+ setSearch?: (search: string) => void;
26
+ search?: string;
27
+ showColumnToggle?: boolean;
28
+ isLoading?: boolean;
29
+ }
30
+ export declare function DataTableToolbar<TData>({ table, filters, actions, setSearch, search, showColumnToggle, isLoading, }: DataTableToolbarProps<TData>): import("react/jsx-runtime").JSX.Element;
31
+ export {};
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Cross2Icon } from "@radix-ui/react-icons";
3
+ import { Button } from "mtxuilib/ui/button";
4
+ import { DataTableViewOptions } from "./data-table-view-options";
5
+ import { Spinner } from "mtxuilib/mt/loading";
6
+ import { Input } from "mtxuilib/ui/input";
7
+ import { DataTableFacetedFilter } from "./data-table-faceted-filter";
8
+ export var ToolbarType;
9
+ (function (ToolbarType) {
10
+ ToolbarType["Checkbox"] = "checkbox";
11
+ ToolbarType["Radio"] = "radio";
12
+ ToolbarType["KeyValue"] = "key-value";
13
+ ToolbarType["Array"] = "array";
14
+ })(ToolbarType || (ToolbarType = {}));
15
+ export function DataTableToolbar({ table, filters, actions, setSearch, search, showColumnToggle, isLoading = false, }) {
16
+ const isFiltered = table.getState().columnFilters?.length > 0;
17
+ return (_jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex flex-1 items-center space-x-2", children: [setSearch && (_jsx(Input, { placeholder: "Search...", value: search, onChange: (e) => setSearch(e.target.value), className: "h-8 w-[150px] lg:w-[250px]" })), filters.map((filter) => (_jsx(DataTableFacetedFilter, { column: table.getColumn(filter.columnId), title: filter.title, type: filter.type, options: filter.options }, filter.columnId))), isFiltered && (_jsxs(Button, { variant: "ghost", onClick: () => table.resetColumnFilters(), className: "h-8 px-2 lg:px-3", children: ["Reset", _jsx(Cross2Icon, { className: "ml-2 h-4 w-4" })] }))] }), _jsxs("div", { className: "flex flex-row gap-4 items-center", children: [isLoading && _jsx(Spinner, {}), actions && actions.length > 0 && actions, showColumnToggle && _jsx(DataTableViewOptions, { table: table })] })] }));
18
+ }
@@ -0,0 +1,6 @@
1
+ import type { Table } from "@tanstack/react-table";
2
+ interface DataTableViewOptionsProps<TData> {
3
+ table: Table<TData>;
4
+ }
5
+ export declare function DataTableViewOptions<TData>({ table, }: DataTableViewOptionsProps<TData>): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,13 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DropdownMenuTrigger } from "@radix-ui/react-dropdown-menu";
3
+ import { MixerHorizontalIcon } from "@radix-ui/react-icons";
4
+ import { Button } from "mtxuilib/ui/button";
5
+ import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuLabel, DropdownMenuSeparator, } from "mtxuilib/ui/dropdown-menu";
6
+ export function DataTableViewOptions({ table, }) {
7
+ return (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(Button, { variant: "outline", size: "sm", className: "ml-auto hidden h-8 lg:flex", children: [_jsx(MixerHorizontalIcon, { className: "mr-2 h-4 w-4" }), "View"] }) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-[150px]", children: [_jsx(DropdownMenuLabel, { children: "Toggle columns" }), _jsx(DropdownMenuSeparator, {}), table
8
+ .getAllColumns()
9
+ .filter((column) => typeof column.accessorFn !== "undefined" && column.getCanHide())
10
+ .map((column) => {
11
+ return (_jsx(DropdownMenuCheckboxItem, { className: "capitalize", checked: column.getIsVisible(), onCheckedChange: (value) => column.toggleVisibility(!!value), children: column.id }, column.id));
12
+ })] })] }));
13
+ }
@@ -0,0 +1,47 @@
1
+ import { type ColumnDef, type ColumnFiltersState, type OnChangeFn, type PaginationState, type Row, type RowSelectionState, type SortingState, type VisibilityState } from "@tanstack/react-table";
2
+ import * as React from "react";
3
+ import { type ToolbarFilters } from "./data-table-toolbar";
4
+ export interface IDGetter {
5
+ metadata: {
6
+ id: string;
7
+ };
8
+ getRow?: () => JSX.Element;
9
+ onClick?: () => void;
10
+ isExpandable?: boolean;
11
+ }
12
+ interface DataTableProps<TData extends IDGetter, TValue> {
13
+ columns: ColumnDef<TData, TValue>[];
14
+ data: TData[];
15
+ error?: Error | null;
16
+ filters: ToolbarFilters;
17
+ actions?: JSX.Element[];
18
+ sorting?: SortingState;
19
+ setSorting?: OnChangeFn<SortingState>;
20
+ setSearch?: (search: string) => void;
21
+ search?: string;
22
+ columnFilters?: ColumnFiltersState;
23
+ setColumnFilters?: OnChangeFn<ColumnFiltersState>;
24
+ pagination?: PaginationState;
25
+ setPagination?: OnChangeFn<PaginationState>;
26
+ pageCount?: number;
27
+ onSetPageSize?: (pageSize: number) => void;
28
+ showColumnToggle?: boolean;
29
+ columnVisibility?: VisibilityState;
30
+ setColumnVisibility?: OnChangeFn<VisibilityState>;
31
+ rowSelection?: RowSelectionState;
32
+ setRowSelection?: OnChangeFn<RowSelectionState>;
33
+ isLoading?: boolean;
34
+ enableRowSelection?: boolean;
35
+ getRowId?: ((originalRow: TData, index: number, parent?: Row<TData> | undefined) => string) | undefined;
36
+ manualSorting?: boolean;
37
+ manualFiltering?: boolean;
38
+ }
39
+ interface ExtraDataTableProps {
40
+ emptyState?: JSX.Element;
41
+ card?: {
42
+ containerStyle?: string;
43
+ component: React.FC<any> | ((data: any) => JSX.Element);
44
+ };
45
+ }
46
+ export declare function DataTable<TData extends IDGetter, TValue>({ columns, error, data, filters, actions, sorting, setSorting, setSearch, search, columnFilters, setColumnFilters, pagination, setPagination, pageCount, onSetPageSize, showColumnToggle, columnVisibility, setColumnVisibility, rowSelection, setRowSelection, isLoading, getRowId, emptyState, card, manualSorting, manualFiltering, }: DataTableProps<TData, TValue> & ExtraDataTableProps): import("react/jsx-runtime").JSX.Element;
47
+ export {};
@@ -0,0 +1,68 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { flexRender, getCoreRowModel, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable, } from "@tanstack/react-table";
3
+ import * as React from "react";
4
+ import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "mtxuilib/ui/table";
5
+ import { cn } from "mtxuilib/lib/utils";
6
+ import { Skeleton } from "mtxuilib/ui/skeleton";
7
+ import { DataTablePagination } from "./data-table-pagination";
8
+ import { DataTableToolbar } from "./data-table-toolbar";
9
+ export function DataTable({ columns, error, data, filters, actions = [], sorting, setSorting, setSearch, search, columnFilters, setColumnFilters, pagination, setPagination, pageCount, onSetPageSize, showColumnToggle, columnVisibility, setColumnVisibility, rowSelection, setRowSelection, isLoading, getRowId, emptyState, card, manualSorting = true, manualFiltering = true, }) {
10
+ const loadingNoData = isLoading && !data.length;
11
+ const tableData = React.useMemo(() => (loadingNoData ? Array(10).fill({ metadata: {} }) : data), [loadingNoData, data]);
12
+ const tableColumns = React.useMemo(() => loadingNoData
13
+ ? columns.map((column) => ({
14
+ ...column,
15
+ cell: () => _jsx(Skeleton, { className: "h-4 w-[100px]" }),
16
+ }))
17
+ : columns, [loadingNoData, columns]);
18
+ const table = useReactTable({
19
+ data: tableData,
20
+ columns: tableColumns,
21
+ state: {
22
+ sorting,
23
+ columnVisibility,
24
+ rowSelection: rowSelection || {},
25
+ columnFilters,
26
+ pagination,
27
+ },
28
+ pageCount,
29
+ enableRowSelection: !!rowSelection,
30
+ onRowSelectionChange: setRowSelection,
31
+ onSortingChange: setSorting,
32
+ onColumnFiltersChange: setColumnFilters,
33
+ onColumnVisibilityChange: setColumnVisibility,
34
+ onPaginationChange: setPagination,
35
+ getCoreRowModel: getCoreRowModel(),
36
+ getFilteredRowModel: getFilteredRowModel(),
37
+ getPaginationRowModel: getPaginationRowModel(),
38
+ getSortedRowModel: getSortedRowModel(),
39
+ getFacetedRowModel: getFacetedRowModel(),
40
+ getFacetedUniqueValues: getFacetedUniqueValues(),
41
+ manualSorting,
42
+ manualFiltering,
43
+ manualPagination: true,
44
+ getRowId,
45
+ });
46
+ const getTableRow = (row) => {
47
+ if (row.original.getRow) {
48
+ return row.original.getRow();
49
+ }
50
+ return (_jsx(TableRow, { "data-state": row.getIsSelected() && "selected", className: cn(row.original.isExpandable && "cursor-pointer hover:bg-muted"), onClick: row.original.onClick, children: row.getVisibleCells().map((cell) => (_jsx(TableCell, { children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id));
51
+ };
52
+ const getTable = () => (_jsxs(Table, { children: [_jsx(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => (_jsx(TableRow, { children: headerGroup.headers.map((header) => {
53
+ return (_jsx(TableHead, { colSpan: header.colSpan, children: header.isPlaceholder
54
+ ? null
55
+ : flexRender(header.column.columnDef.header, header.getContext()) }, header.id));
56
+ }) }, headerGroup.id))) }), _jsx(TableBody, { children: error ? (_jsx(TableRow, { className: "p-4 text-center text-red-500", children: _jsx(TableCell, { colSpan: columns.length, children: error.message || "An error occurred." }) })) : table.getRowModel().rows?.length ? (table.getRowModel().rows.map((row) => getTableRow(row))) : (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: columns.length, className: "h-24 text-center", children: emptyState || "No results." }) })) })] }));
57
+ const getCards = () => (_jsx("div", { className: card?.containerStyle ||
58
+ "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3", children: error
59
+ ? error.message || "An error occurred."
60
+ : table.getRowModel().rows?.length
61
+ ? table
62
+ .getRowModel()
63
+ .rows.map((row) => card?.component
64
+ ? card?.component({ data: row.original })
65
+ : null)
66
+ : emptyState || "No results." }));
67
+ return (_jsxs("div", { className: "space-y-4", children: [(setSearch || actions || (filters && filters.length > 0)) && (_jsx(DataTableToolbar, { table: table, filters: filters, isLoading: isLoading, actions: actions, search: search, setSearch: setSearch, showColumnToggle: showColumnToggle })), _jsx("div", { className: `rounded-md ${!card && "border"}`, children: !card ? getTable() : getCards() }), pagination && (_jsx(DataTablePagination, { table: table, onSetPageSize: onSetPageSize }))] }));
68
+ }
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { forwardRef, useMemo, useState } from "react";
4
4
  import { useFormContext } from "react-hook-form";
5
5
  import { cn } from "../lib/utils";
6
- import { MtButton } from "../ui/mt/Button";
6
+ import { Button } from "../ui/button";
7
7
  import { ConformDeleteBtn } from "./deleteConform";
8
8
  export const EditFormToolbar = forwardRef((props, forwardedRef) => {
9
9
  const { submitText, onSubmit, onCancel, children, enableCancelConform, enableDeleteButton, onDelete, } = props;
@@ -22,7 +22,7 @@ export const EditFormToolbar = forwardRef((props, forwardedRef) => {
22
22
  if (!form) {
23
23
  throw new Error("SubmitButton must be used within a Form or have a form prop");
24
24
  }
25
- return (_jsxs("div", { className: "flex w-full flex-col p-1", children: [!openConform && (_jsxs("div", { className: "flex justify-end gap-2", children: [_jsx(MtButton, { variant: "outline", className: " min-w-24", onClick: (e) => {
25
+ return (_jsxs("div", { className: "flex w-full flex-col p-1", children: [!openConform && (_jsxs("div", { className: "flex justify-end gap-2", children: [_jsx(Button, { variant: "outline", className: " min-w-24", onClick: (e) => {
26
26
  e.preventDefault();
27
27
  if (enableCancelConform && form?.formState?.isDirty) {
28
28
  setOpenConform(true);
@@ -30,7 +30,7 @@ export const EditFormToolbar = forwardRef((props, forwardedRef) => {
30
30
  else {
31
31
  onCancel?.();
32
32
  }
33
- }, children: "\u53D6\u6D88" }), _jsx(MtButton, { form: props.form?.id, type: "submit", disabled: formState.isSubmitting, className: "min-w-24", children: formState.isSubmitting ? "Loading" : submitText || "确定" }), enableDeleteButton && (_jsx(ConformDeleteBtn, { callback: async () => {
33
+ }, children: "\u53D6\u6D88" }), _jsx(Button, { form: props.form?.id, type: "submit", disabled: formState.isSubmitting, className: "min-w-24", children: formState.isSubmitting ? "Loading" : submitText || "确定" }), enableDeleteButton && (_jsx(ConformDeleteBtn, { callback: async () => {
34
34
  onDelete?.();
35
35
  }, disabled: form.formState.isSubmitting, variant: "destructive", children: "\u5220\u9664" }))] })), openConform && (_jsx(ComformCancel, { onBack: () => {
36
36
  setOpenConform(false);
@@ -41,10 +41,10 @@ export const EditFormToolbar = forwardRef((props, forwardedRef) => {
41
41
  EditFormToolbar.displayName = "EditFormToolbar";
42
42
  const ComformCancel = (props) => {
43
43
  const { onContinue, onBack } = props;
44
- return (_jsxs("div", { className: "flex gap-2", children: ["\u672A\u4FDD\u5B58\u66F4\u6539\uFF0C\u786E\u5B9A\u7EE7\u7EED\u5417\uFF1F", _jsx(MtButton, { onClick: (e) => {
44
+ return (_jsxs("div", { className: "flex gap-2", children: ["\u672A\u4FDD\u5B58\u66F4\u6539\uFF0C\u786E\u5B9A\u7EE7\u7EED\u5417\uFF1F", _jsx(Button, { onClick: (e) => {
45
45
  e.preventDefault();
46
46
  onBack();
47
- }, children: "\u7EE7\u7EED\u7F16\u8F91" }), _jsx(MtButton, { variant: "destructive", className: cn(""), onClick: (e) => {
47
+ }, children: "\u7EE7\u7EED\u7F16\u8F91" }), _jsx(Button, { variant: "destructive", className: cn(""), onClick: (e) => {
48
48
  e.preventDefault();
49
49
  onContinue();
50
50
  }, children: "\u5173\u95ED" })] }));
@@ -1,21 +1,19 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Dialog, DialogContent, DialogDescription, DialogTitle, } from "@radix-ui/react-dialog";
3
2
  import { Slot } from "@radix-ui/react-slot";
4
3
  import React, { useState } from "react";
5
4
  import { cn } from "../lib/utils";
6
- import { MtButton } from "../ui/mt/Button";
7
- import { buttonVariants } from "../ui/button";
8
- import { DialogTrigger } from "../ui/dialog";
5
+ import { Button, buttonVariants } from "../ui/button";
6
+ import { Dialog, DialogContent, DialogDescription, DialogTitle, DialogTrigger, } from "../ui/dialog";
9
7
  export const DeleteConformDlg = (props) => {
10
8
  const { handleOk } = props;
11
9
  const [open, setOpen] = useState(false);
12
10
  return (_jsxs(Dialog, { open: open, onOpenChange: setOpen, children: [_jsx(DialogTrigger, { asChild: true, onClick: (e) => {
13
11
  e.preventDefault();
14
12
  setOpen(true);
15
- }, children: _jsx(MtButton, { children: "\u5220\u9664" }) }), _jsx(DialogContent, { children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(MtButton, { onClick: (e) => {
13
+ }, children: _jsx(Button, { children: "\u5220\u9664" }) }), _jsx(DialogContent, { children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Button, { onClick: (e) => {
16
14
  e.preventDefault();
17
- handleOk && handleOk();
18
- }, children: "\u786E\u5B9A\u5220\u9664" }), _jsx(MtButton, { onClick: (e) => {
15
+ handleOk?.();
16
+ }, children: "\u786E\u5B9A\u5220\u9664" }), _jsx(Button, { onClick: (e) => {
19
17
  e.preventDefault();
20
18
  setOpen(false);
21
19
  }, children: "cancel" })] }) })] }));
@@ -26,12 +24,12 @@ export const ConformDeleteBtn = React.forwardRef(({ callback, className, variant
26
24
  return (_jsxs(_Fragment, { children: [_jsx(Comp, { className: cn(buttonVariants({ variant, size, className })), ref: ref, ...props, onClick: (e) => {
27
25
  e.preventDefault();
28
26
  setDeleteConformOpen(true);
29
- } }), deleteConformOpen && (_jsx(Dialog, { open: deleteConformOpen, onOpenChange: setDeleteConformOpen, children: _jsxs(DialogContent, { children: [_jsx(DialogTitle, { children: "\u786E\u8BA4" }), _jsx(DialogDescription, { children: "\u5C06\u5220\u9664\u8BB0\u5F55\uFF0C\u786E\u8BA4\u7EE7\u7EED\u5417\uFF1F" }), _jsx(MtButton, { variant: "destructive", onClick: async () => {
27
+ } }), deleteConformOpen && (_jsx(Dialog, { open: deleteConformOpen, onOpenChange: setDeleteConformOpen, children: _jsxs(DialogContent, { children: [_jsx(DialogTitle, { children: "\u786E\u8BA4" }), _jsx(DialogDescription, { children: "\u5C06\u5220\u9664\u8BB0\u5F55\uFF0C\u786E\u8BA4\u7EE7\u7EED\u5417\uFF1F" }), _jsx(Button, { variant: "destructive", onClick: async () => {
30
28
  if (callback) {
31
29
  await callback();
32
30
  setDeleteConformOpen(false);
33
31
  }
34
- }, children: "\u5220\u9664\u786E\u8BA4" }), _jsx(MtButton, { variant: "outline", onClick: () => {
32
+ }, children: "\u5220\u9664\u786E\u8BA4" }), _jsx(Button, { variant: "outline", onClick: () => {
35
33
  setDeleteConformOpen(false);
36
34
  }, children: "Cancel" })] }) }))] }));
37
35
  });
@@ -1 +1 @@
1
- export declare function useCanBack(): boolean;
1
+ export declare function useCanGoBack(): boolean;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { useEffect, useState } from "react";
3
- export function useCanBack() {
3
+ export function useCanGoBack() {
4
4
  const [canGoBack, setCanGoBack] = useState(false);
5
5
  useEffect(() => {
6
6
  if (typeof window !== "undefined") {