@instincthub/react-ui 0.1.50 → 0.1.52

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 (237) hide show
  1. package/dist/node_modules/.pnpm/xlsx@https___cdn.sheetjs.com_xlsx-0.20.3_xlsx-0.20.3.tgz/node_modules/xlsx/xlsx.mjs.js +2 -2
  2. package/dist/node_modules/.pnpm/xlsx@https___cdn.sheetjs.com_xlsx-0.20.3_xlsx-0.20.3.tgz/node_modules/xlsx/xlsx.mjs.js.map +1 -1
  3. package/dist/src/assets/css/forms/input-fields.css +163 -11
  4. package/dist/src/components/auth/LoginForm.js +1 -1
  5. package/dist/src/components/auth/ReactClientProviders.js +1 -1
  6. package/dist/src/components/forms/ChipsInput.js +1 -1
  7. package/dist/src/components/forms/PhoneNumberInput.js +1 -1
  8. package/dist/src/components/forms/SearchFieldDB.js +1 -1
  9. package/dist/src/components/forms/SearchObjectsFromDB.js +1 -1
  10. package/dist/src/components/forms/SearchableDropdown.js +1 -1
  11. package/dist/src/components/forms/uploads/S3MultiUploader.js +1 -1
  12. package/dist/src/components/lib/index.js +1 -1
  13. package/dist/src/components/lib/index.js.map +1 -1
  14. package/dist/src/components/lib/phoneUtils.js +2 -0
  15. package/dist/src/components/lib/phoneUtils.js.map +1 -0
  16. package/dist/src/components/navbar/ChannelListAvatar.js +1 -1
  17. package/dist/src/components/navbar/SideNavbar.js +1 -1
  18. package/dist/src/components/status/ModalExamples.js +1 -1
  19. package/dist/src/components/ui/ComponentLists.js +1 -1
  20. package/dist/src/components/ui/pagination/Pagination.js +1 -1
  21. package/dist/src/components/ui/pagination/PaginationDemo.js +1 -1
  22. package/dist/src/components/ui/tables/IHubTable.js +1 -1
  23. package/dist/src/components/ui/tables/IHubTableServer.js +1 -1
  24. package/dist/src/components/ui/tables/utils/exportValues.js +2 -0
  25. package/dist/src/components/ui/tables/utils/exportValues.js.map +1 -0
  26. package/dist/src/components/ui/tables/utils/exportWriters.js +2 -0
  27. package/dist/src/components/ui/tables/utils/exportWriters.js.map +1 -0
  28. package/dist/src/components/ui/tables/utils/tableExport.js +2 -0
  29. package/dist/src/components/ui/tables/utils/tableExport.js.map +1 -0
  30. package/dist/src/types/__examples__/.next/types/app/components/forms/layout.d.ts +13 -0
  31. package/dist/src/types/__examples__/.next/types/app/components/forms/phone-number-input/page.d.ts +13 -0
  32. package/dist/src/types/__examples__/.next/types/app/components/layout.d.ts +13 -0
  33. package/dist/src/types/__examples__/.next/types/app/components/page.d.ts +13 -0
  34. package/dist/src/types/__examples__/.next/types/app/components/ui/s3-multi-uploader/page.d.ts +13 -0
  35. package/dist/src/types/__examples__/.next/types/app/layout.d.ts +13 -0
  36. package/dist/src/types/__examples__/.next/types/app/page.d.ts +13 -0
  37. package/dist/src/types/__examples__/.next/types/validator.d.ts +1 -0
  38. package/dist/src/types/__examples__/next.config.d.ts +3 -0
  39. package/dist/src/types/__examples__/src/app/api/auth/[...nextauth]/route.d.ts +1 -0
  40. package/dist/src/types/__examples__/src/app/api/auth/login/route.d.ts +2 -0
  41. package/dist/src/types/__examples__/src/app/api/components/docs/route.d.ts +14 -0
  42. package/dist/src/types/__examples__/src/app/api/components/recommend/route.d.ts +14 -0
  43. package/dist/src/types/__examples__/src/app/api/components/search/route.d.ts +50 -0
  44. package/dist/src/types/__examples__/src/app/api/fallback/route.d.ts +34 -0
  45. package/dist/src/types/__examples__/src/app/api/generate/route.d.ts +14 -0
  46. package/dist/src/types/__examples__/src/app/api/help/route.d.ts +14 -0
  47. package/dist/src/types/__examples__/src/app/api/mcp/route.d.ts +10 -0
  48. package/dist/src/types/__examples__/src/app/auth/layout.d.ts +4 -0
  49. package/dist/src/types/__examples__/src/app/auth/login/page.d.ts +2 -0
  50. package/dist/src/types/__examples__/src/app/auth/password-match/page.d.ts +1 -0
  51. package/dist/src/types/__examples__/src/app/code-display/layout.d.ts +4 -0
  52. package/dist/src/types/__examples__/src/app/code-display/page.d.ts +3 -0
  53. package/dist/src/types/__examples__/src/app/components/auth/client-detector/page.d.ts +1 -0
  54. package/dist/src/types/__examples__/src/app/components/auth/login-form/page.d.ts +2 -0
  55. package/dist/src/types/__examples__/src/app/components/auth/signup-form/page.d.ts +1 -0
  56. package/dist/src/types/__examples__/src/app/components/auth/username-email-checker/page.d.ts +1 -0
  57. package/dist/src/types/__examples__/src/app/components/charts/page.d.ts +1 -0
  58. package/dist/src/types/__examples__/src/app/components/forms/action-dropdown/page.d.ts +1 -0
  59. package/dist/src/types/__examples__/src/app/components/forms/animated-box/page.d.ts +1 -0
  60. package/dist/src/types/__examples__/src/app/components/forms/checkboxes/page.d.ts +1 -0
  61. package/dist/src/types/__examples__/src/app/components/forms/chips-input/page.d.ts +1 -0
  62. package/dist/src/types/__examples__/src/app/components/forms/date-input/page.d.ts +1 -0
  63. package/dist/src/types/__examples__/src/app/components/forms/date-input-picker/page.d.ts +1 -0
  64. package/dist/src/types/__examples__/src/app/components/forms/date-range-picker/page.d.ts +1 -0
  65. package/dist/src/types/__examples__/src/app/components/forms/drop-file/page.d.ts +1 -0
  66. package/dist/src/types/__examples__/src/app/components/forms/email-list/page.d.ts +1 -0
  67. package/dist/src/types/__examples__/src/app/components/forms/file-uploader/page.d.ts +1 -0
  68. package/dist/src/types/__examples__/src/app/components/forms/filter-array/page.d.ts +1 -0
  69. package/dist/src/types/__examples__/src/app/components/forms/filter-objects/page.d.ts +1 -0
  70. package/dist/src/types/__examples__/src/app/components/forms/form-error/page.d.ts +1 -0
  71. package/dist/src/types/__examples__/src/app/components/forms/input-amount/page.d.ts +1 -0
  72. package/dist/src/types/__examples__/src/app/components/forms/input-number/page.d.ts +1 -0
  73. package/dist/src/types/__examples__/src/app/components/forms/input-text/page.d.ts +1 -0
  74. package/dist/src/types/__examples__/src/app/components/forms/input-textarea/page.d.ts +1 -0
  75. package/dist/src/types/__examples__/src/app/components/forms/layout.d.ts +4 -0
  76. package/dist/src/types/__examples__/src/app/components/forms/message-display/page.d.ts +1 -0
  77. package/dist/src/types/__examples__/src/app/components/forms/multiple-email/page.d.ts +1 -0
  78. package/dist/src/types/__examples__/src/app/components/forms/password-field/page.d.ts +1 -0
  79. package/dist/src/types/__examples__/src/app/components/forms/phone-number-input/page.d.ts +1 -0
  80. package/dist/src/types/__examples__/src/app/components/forms/radio-button/page.d.ts +1 -0
  81. package/dist/src/types/__examples__/src/app/components/forms/search-field/page.d.ts +1 -0
  82. package/dist/src/types/__examples__/src/app/components/forms/search-objects-from-db/page.d.ts +1 -0
  83. package/dist/src/types/__examples__/src/app/components/forms/searchable-dropdown/page.d.ts +1 -0
  84. package/dist/src/types/__examples__/src/app/components/forms/time-picker/page.d.ts +1 -0
  85. package/dist/src/types/__examples__/src/app/components/forms/toggle-button/page.d.ts +1 -0
  86. package/dist/src/types/__examples__/src/app/components/forms/uploads/ihub-file-uploader/page.d.ts +1 -0
  87. package/dist/src/types/__examples__/src/app/components/layout.d.ts +4 -0
  88. package/dist/src/types/__examples__/src/app/components/navbars/breadcrumb/page.d.ts +1 -0
  89. package/dist/src/types/__examples__/src/app/components/navbars/responsive-navbar/page.d.ts +2 -0
  90. package/dist/src/types/__examples__/src/app/components/navbars/sidenav/page.d.ts +2 -0
  91. package/dist/src/types/__examples__/src/app/components/navbars/tabs/page.d.ts +1 -0
  92. package/dist/src/types/__examples__/src/app/components/page.d.ts +1 -0
  93. package/dist/src/types/__examples__/src/app/components/ui/actions/page.d.ts +1 -0
  94. package/dist/src/types/__examples__/src/app/components/ui/badges/page.d.ts +1 -0
  95. package/dist/src/types/__examples__/src/app/components/ui/card-grid/page.d.ts +1 -0
  96. package/dist/src/types/__examples__/src/app/components/ui/card-list/page.d.ts +1 -0
  97. package/dist/src/types/__examples__/src/app/components/ui/cards/page.d.ts +1 -0
  98. package/dist/src/types/__examples__/src/app/components/ui/color-picker/page.d.ts +1 -0
  99. package/dist/src/types/__examples__/src/app/components/ui/content-view-or-edit/page.d.ts +1 -0
  100. package/dist/src/types/__examples__/src/app/components/ui/content-viewer/page.d.ts +1 -0
  101. package/dist/src/types/__examples__/src/app/components/ui/create-button/page.d.ts +1 -0
  102. package/dist/src/types/__examples__/src/app/components/ui/dangerous-renderer/page.d.ts +1 -0
  103. package/dist/src/types/__examples__/src/app/components/ui/dialogs/page.d.ts +1 -0
  104. package/dist/src/types/__examples__/src/app/components/ui/dropdowns/page.d.ts +1 -0
  105. package/dist/src/types/__examples__/src/app/components/ui/ihub-text-editor/page.d.ts +1 -0
  106. package/dist/src/types/__examples__/src/app/components/ui/modals/page.d.ts +1 -0
  107. package/dist/src/types/__examples__/src/app/components/ui/or-divider/page.d.ts +1 -0
  108. package/dist/src/types/__examples__/src/app/components/ui/pagination/page.d.ts +1 -0
  109. package/dist/src/types/__examples__/src/app/components/ui/random-gradient-image/page.d.ts +1 -0
  110. package/dist/src/types/__examples__/src/app/components/ui/s3-multi-uploader/page.d.ts +1 -0
  111. package/dist/src/types/__examples__/src/app/components/ui/table-examples/page.d.ts +1 -0
  112. package/dist/src/types/__examples__/src/app/components/ui/table-server-examples/page.d.ts +1 -0
  113. package/dist/src/types/__examples__/src/app/components/ui/text-editor/page.d.ts +1 -0
  114. package/dist/src/types/__examples__/src/app/cursors/page.d.ts +2 -0
  115. package/dist/src/types/__examples__/src/app/examples/page.d.ts +1 -0
  116. package/dist/src/types/__examples__/src/app/layout.d.ts +11 -0
  117. package/dist/src/types/__examples__/src/app/libs/examples/loadscript/page.d.ts +8 -0
  118. package/dist/src/types/__examples__/src/app/libs/examples/modals/page.d.ts +1 -0
  119. package/dist/src/types/__examples__/src/app/libs/examples/paystacks/page.d.ts +1 -0
  120. package/dist/src/types/__examples__/src/app/libs/page.d.ts +1 -0
  121. package/dist/src/types/__examples__/src/app/page.d.ts +1 -0
  122. package/dist/src/types/__examples__/src/components/ComponentListing.d.ts +1 -0
  123. package/dist/src/types/__examples__/src/components/Forms.d.ts +2 -0
  124. package/dist/src/types/__examples__/src/components/Modals.d.ts +1 -0
  125. package/dist/src/types/__examples__/src/components/TestComponent.d.ts +1 -0
  126. package/dist/src/types/__examples__/src/components/TestPage.d.ts +2 -0
  127. package/dist/src/types/__examples__/src/components/auth/ClientDetectorExample.d.ts +3 -0
  128. package/dist/src/types/__examples__/src/components/auth/IsUsernameEmailTakenExample.d.ts +3 -0
  129. package/dist/src/types/__examples__/src/components/auth/LoginFormExample.d.ts +4 -0
  130. package/dist/src/types/__examples__/src/components/auth/SignUpFormExample.d.ts +3 -0
  131. package/dist/src/types/__examples__/src/components/auths/LoginExample.d.ts +4 -0
  132. package/dist/src/types/__examples__/src/components/auths/PasswordsMatchExample.d.ts +2 -0
  133. package/dist/src/types/__examples__/src/components/forms/ActionDropdownExample.d.ts +3 -0
  134. package/dist/src/types/__examples__/src/components/forms/AnimatedBoxExample.d.ts +3 -0
  135. package/dist/src/types/__examples__/src/components/forms/CheckboxesFieldExamples.d.ts +3 -0
  136. package/dist/src/types/__examples__/src/components/forms/ChipsInputExample.d.ts +6 -0
  137. package/dist/src/types/__examples__/src/components/forms/DateInputExample.d.ts +3 -0
  138. package/dist/src/types/__examples__/src/components/forms/DateInputPickerExample.d.ts +3 -0
  139. package/dist/src/types/__examples__/src/components/forms/DateInputPickerTimeExample.d.ts +10 -0
  140. package/dist/src/types/__examples__/src/components/forms/DateRangePickerExample.d.ts +3 -0
  141. package/dist/src/types/__examples__/src/components/forms/DateTimePickerExample.d.ts +3 -0
  142. package/dist/src/types/__examples__/src/components/forms/DropFileExample.d.ts +3 -0
  143. package/dist/src/types/__examples__/src/components/forms/EmailListExample.d.ts +3 -0
  144. package/dist/src/types/__examples__/src/components/forms/FileUploaderExample.d.ts +3 -0
  145. package/dist/src/types/__examples__/src/components/forms/FilterArrayExample.d.ts +3 -0
  146. package/dist/src/types/__examples__/src/components/forms/FilterObjectsExample.d.ts +3 -0
  147. package/dist/src/types/__examples__/src/components/forms/FormErrorExample.d.ts +3 -0
  148. package/dist/src/types/__examples__/src/components/forms/InputAmountExample.d.ts +3 -0
  149. package/dist/src/types/__examples__/src/components/forms/InputNumberExample.d.ts +3 -0
  150. package/dist/src/types/__examples__/src/components/forms/InputTextExample.d.ts +3 -0
  151. package/dist/src/types/__examples__/src/components/forms/InputTextareaExample.d.ts +3 -0
  152. package/dist/src/types/__examples__/src/components/forms/MessageDisplayExample.d.ts +3 -0
  153. package/dist/src/types/__examples__/src/components/forms/MultipleEmailExample.d.ts +3 -0
  154. package/dist/src/types/__examples__/src/components/forms/PasswordFieldExample.d.ts +3 -0
  155. package/dist/src/types/__examples__/src/components/forms/PhoneNumberInputExample.d.ts +3 -0
  156. package/dist/src/types/__examples__/src/components/forms/RadioButtonExample.d.ts +6 -0
  157. package/dist/src/types/__examples__/src/components/forms/SearchFieldExample.d.ts +3 -0
  158. package/dist/src/types/__examples__/src/components/forms/SearchObjectsFromDBExample.d.ts +1 -0
  159. package/dist/src/types/__examples__/src/components/forms/SearchableDropdownExample.d.ts +3 -0
  160. package/dist/src/types/__examples__/src/components/forms/SignUpFormExample.d.ts +6 -0
  161. package/dist/src/types/__examples__/src/components/forms/SubmitBtnExample.d.ts +3 -0
  162. package/dist/src/types/__examples__/src/components/forms/TextFieldExample.d.ts +3 -0
  163. package/dist/src/types/__examples__/src/components/forms/TimePickerExample.d.ts +3 -0
  164. package/dist/src/types/__examples__/src/components/forms/ToggleButtonExample.d.ts +1 -0
  165. package/dist/src/types/__examples__/src/components/forms/uploads/IhubFileUploaderDocs.d.ts +3 -0
  166. package/dist/src/types/__examples__/src/components/forms/uploads/IhubFileUploaderSample.d.ts +6 -0
  167. package/dist/src/types/__examples__/src/components/navbars/BreadcrumbExample.d.ts +1 -0
  168. package/dist/src/types/__examples__/src/components/navbars/CursorProviders.d.ts +1 -0
  169. package/dist/src/types/__examples__/src/components/navbars/MainFooter.d.ts +2 -0
  170. package/dist/src/types/__examples__/src/components/navbars/MainNavigation.d.ts +2 -0
  171. package/dist/src/types/__examples__/src/components/navbars/PageNavigation.d.ts +2 -0
  172. package/dist/src/types/__examples__/src/components/navbars/ResponsiveNavbarControlledExample.d.ts +1 -0
  173. package/dist/src/types/__examples__/src/components/navbars/ResponsiveNavbarExample.d.ts +2 -0
  174. package/dist/src/types/__examples__/src/components/navbars/SideNavbarExample.d.ts +3 -0
  175. package/dist/src/types/__examples__/src/components/navbars/TabsExample.d.ts +1 -0
  176. package/dist/src/types/__examples__/src/components/tabs/TabsDemo.d.ts +2 -0
  177. package/dist/src/types/__examples__/src/components/tabs/TabsExample.d.ts +3 -0
  178. package/dist/src/types/__examples__/src/components/tabs/VerticalTabsExample.d.ts +3 -0
  179. package/dist/src/types/__examples__/src/components/ui/ActionExamples.d.ts +2 -0
  180. package/dist/src/types/__examples__/src/components/ui/BadgeExamples.d.ts +3 -0
  181. package/dist/src/types/__examples__/src/components/ui/CardExamples.d.ts +1 -0
  182. package/dist/src/types/__examples__/src/components/ui/CardGridExample.d.ts +3 -0
  183. package/dist/src/types/__examples__/src/components/ui/CardListExample.d.ts +3 -0
  184. package/dist/src/types/__examples__/src/components/ui/ChartExamples.d.ts +3 -0
  185. package/dist/src/types/__examples__/src/components/ui/CodebaseLink.d.ts +4 -0
  186. package/dist/src/types/__examples__/src/components/ui/ColorPickerExample.d.ts +3 -0
  187. package/dist/src/types/__examples__/src/components/ui/ContentFormTextEditor.d.ts +1 -0
  188. package/dist/src/types/__examples__/src/components/ui/ContentViewOrEditExample.d.ts +3 -0
  189. package/dist/src/types/__examples__/src/components/ui/ContentViewOrEditSample.d.ts +1 -0
  190. package/dist/src/types/__examples__/src/components/ui/ContentViewerExample.d.ts +3 -0
  191. package/dist/src/types/__examples__/src/components/ui/CreateButtonExample.d.ts +3 -0
  192. package/dist/src/types/__examples__/src/components/ui/CustomTextEditorExample.d.ts +3 -0
  193. package/dist/src/types/__examples__/src/components/ui/DangerousRendererExample.d.ts +1 -0
  194. package/dist/src/types/__examples__/src/components/ui/DialogExample.d.ts +3 -0
  195. package/dist/src/types/__examples__/src/components/ui/DropdownExamples.d.ts +2 -0
  196. package/dist/src/types/__examples__/src/components/ui/IHubTextEditorExample.d.ts +3 -0
  197. package/dist/src/types/__examples__/src/components/ui/ListStylesDemo.d.ts +1 -0
  198. package/dist/src/types/__examples__/src/components/ui/ListStylesDemoTwo.d.ts +1 -0
  199. package/dist/src/types/__examples__/src/components/ui/OrDividerExample.d.ts +3 -0
  200. package/dist/src/types/__examples__/src/components/ui/PaginationExample.d.ts +3 -0
  201. package/dist/src/types/__examples__/src/components/ui/RandomGradientImageExample.d.ts +3 -0
  202. package/dist/src/types/__examples__/src/components/ui/S3MultiUploaderExample.d.ts +3 -0
  203. package/dist/src/types/__examples__/src/components/ui/StatusIconExample.d.ts +3 -0
  204. package/dist/src/types/__examples__/src/components/ui/TableExamples.d.ts +3 -0
  205. package/dist/src/types/__examples__/src/components/ui/TableServerExamples.d.ts +1 -0
  206. package/dist/src/types/__examples__/src/lib/api.d.ts +29 -0
  207. package/dist/src/types/__examples__/src/lib/hooks.d.ts +76 -0
  208. package/dist/src/types/__examples__/src/types/components.d.ts +144 -0
  209. package/dist/src/types/assets/svgs/SVGs.d.ts +36 -0
  210. package/dist/src/types/components/forms/PhoneNumberInput.d.ts +56 -13
  211. package/dist/src/types/components/forms/uploads/S3MultiUploader.d.ts +12 -6
  212. package/dist/src/types/components/lib/index.d.ts +1 -0
  213. package/dist/src/types/components/lib/phoneUtils.d.ts +99 -0
  214. package/dist/src/types/components/lib/redux/slices/channelSlice/channelDetails.d.ts +1 -1
  215. package/dist/src/types/components/lib/redux/slices/channelSlice/instructorChannelList.d.ts +3 -2
  216. package/dist/src/types/components/lib/redux/slices/courseSlice/courseDetails.d.ts +1 -1
  217. package/dist/src/types/components/lib/redux/slices/courseSlice/courseFilterDuration.d.ts +2 -2
  218. package/dist/src/types/components/lib/redux/slices/courseSlice/courseFilterLevel.d.ts +2 -2
  219. package/dist/src/types/components/lib/redux/slices/courseSlice/courseFilterSubject.d.ts +2 -2
  220. package/dist/src/types/components/lib/redux/slices/courseSlice/courseModules.d.ts +3 -3
  221. package/dist/src/types/components/lib/redux/slices/courseSlice/courseOverview.d.ts +1 -1
  222. package/dist/src/types/components/lib/redux/slices/courseSlice/courseSearch.d.ts +1 -1
  223. package/dist/src/types/components/lib/redux/slices/courseSlice/stepContent.d.ts +1 -1
  224. package/dist/src/types/components/lib/redux/slices/courseSlice/stepQuestions.d.ts +6 -6
  225. package/dist/src/types/components/lib/redux/slices/courseSlice/videoTimestamp.d.ts +1 -1
  226. package/dist/src/types/components/lib/redux/slices/courseSlice/videoTimestampObject.d.ts +1 -1
  227. package/dist/src/types/components/lib/redux/slices/navigationSlice/IPAdress.d.ts +1 -1
  228. package/dist/src/types/components/ui/tables/IHubTable.d.ts +5 -8
  229. package/dist/src/types/components/ui/tables/IHubTableServer.d.ts +5 -8
  230. package/dist/src/types/components/ui/tables/utils/exportValues.d.ts +32 -0
  231. package/dist/src/types/components/ui/tables/utils/exportWriters.d.ts +17 -0
  232. package/dist/src/types/components/ui/tables/utils/tableExport.d.ts +48 -0
  233. package/dist/src/types/index.d.ts +3 -1
  234. package/dist/src/types/types/index.d.ts +91 -15
  235. package/dist/tsconfig.build.tsbuildinfo +1 -1
  236. package/dist/tsconfig.tsbuildinfo +1 -0
  237. package/package.json +17 -17
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var a=require("../../../../_virtual/_rollupPluginBabelHelpers.js"),n=require("react/jsx-runtime"),i=require("react"),e=require("next/link"),t=require("../../lib/helpFunction.js");require("../../lib/utils.js");var o=require("next/navigation");function r(a){return a&&"object"==typeof a&&"default"in a?a:{default:a}}var l=r(e),s=function(a){if(!a)return null;try{return new URL(a).searchParams.get("offset")}catch(a){return null}};exports.default=function(e){var r=e.data,c=e.limit,u=e.urlPath,d=e.setData,h=e.token,p=void 0===h?null:h,f=e.tabsValues,g=void 0===f?"":f,b=e.searchValues,v=void 0===b?"":b,m=e.rangeLimit,x=void 0===m?5:m,j=e.className,w=void 0===j?"":j,N=e.showFirstLast,L=void 0===N||N,y=o.useSearchParams(),P=y.get("offset")||"0",S=y.get("search")||"",k=i.useState([]),q=a.slicedToArray(k,2),I=q[0],G=q[1],M=i.useState(0),A=a.slicedToArray(M,2),R=A[0],T=A[1],C=i.useState(x||5),U=a.slicedToArray(C,2),_=U[0],B=U[1],E=i.useState(!1),F=a.slicedToArray(E,2),O=F[0],V=F[1],Z=i.useRef(!0),D=Number(P),H=Math.floor(D/c),z=s((null==r?void 0:r.next)||""),J=s((null==r?void 0:r.previous)||""),K=function(){var n=a.asyncToGenerator(a.regenerator().m(function n(i){var e,o,r,l,s,h;return a.regenerator().w(function(a){for(;;)switch(a.p=a.n){case 0:return V(!0),a.p=1,e=t.reqOptions("GET",null,p),o=void 0!==i?"&offset=".concat(i):"",r=v||S?"&search=".concat(encodeURIComponent(v||S)):"",l=g?"&cat=".concat(encodeURIComponent(g)):"",s="".concat(u,"?limit=").concat(c).concat(o).concat(r).concat(l),a.n=2,t.fetchAPI(d,s,e,!0);case 2:a.n=4;break;case 3:a.p=3,h=a.v,console.error("Pagination fetch error:",h);case 4:return a.p=4,Q(),V(!1),a.f(4);case 5:return a.a(2)}},n,null,[[1,3,4,5]])}));return function(a){return n.apply(this,arguments)}}(),Q=function(){console.log("updatePageRange called with currentPageIndex:",H,x),H+1>=x?(T(H-2),B(H+3)):(T(0),B(x))};if(i.useEffect(function(){if(D>0||g||v||S?K(D):K(),null!=r&&r.count){var a=Math.ceil(r.count/c);G(Array.from({length:a},function(a,n){return n}))}},[P,null==r?void 0:r.count,g,c]),i.useEffect(function(){if(Z.current)Z.current=!1;else if("undefined"!=typeof window){var a=new URLSearchParams(window.location.search);a.set("offset","0"),window.history.replaceState({},"","".concat(window.location.pathname,"?").concat(a.toString()))}},[v,S]),!I.length&&!O)return null;var W=I.length,X=0===H,Y=H===W-1,$=I.slice(R,_);return n.jsxs("div",{className:"ihub-pagination-container ".concat(w),role:"navigation","aria-label":"Pagination",children:[O&&n.jsxs("div",{className:"ihub-pagination-loading",children:[n.jsx("div",{className:"ihub-loading-spinner"}),n.jsx("span",{children:"Loading..."})]}),n.jsxs("ul",{className:"ihub-pagination-list",children:[n.jsxs("div",{className:"ihub-pagination-nav-group",children:[L&&n.jsx("li",{className:"ihub-pagination-item ".concat(X?"ihub-pagination-disabled":""),children:n.jsx(l.default,{href:"?offset=0",className:"ihub-pagination-link ihub-pagination-first","aria-label":"Go to first page",tabIndex:X?-1:0,children:"First"})}),n.jsx("li",{className:"ihub-pagination-item ".concat(X||null==r||!r.previous?"ihub-pagination-disabled":""),children:n.jsx(l.default,{href:"?offset=".concat(J||0),className:"ihub-pagination-link ihub-pagination-previous","aria-label":"Go to previous page",tabIndex:X||null==r||!r.previous?-1:0,children:n.jsx("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:n.jsx("path",{d:"M7.66927 1.83333L3.08594 6.41667L7.66927 11L6.7526 12.8333L0.335938 6.41667L6.7526 0L7.66927 1.83333Z",fill:"currentColor"})})})})]}),n.jsx("div",{className:"ihub-pagination-pages",children:($||[]).map(function(a){var i=H===a,e=a+1;return n.jsx("li",{className:"ihub-pagination-item ".concat(i?"ihub-pagination-active":""),"data-page":e,children:n.jsx(l.default,{href:"?offset=".concat(a*c),className:"ihub-pagination-link ihub-pagination-number","aria-label":"Go to page ".concat(e),"aria-current":i?"page":void 0,children:e})},a)})}),n.jsxs("div",{className:"ihub-pagination-nav-group ".concat(null!=r&&r.next?"":"ihub-pagination-disabled"),children:[n.jsx("li",{className:"ihub-pagination-item ".concat(Y||null==r||!r.next?"ihub-pagination-disabled":""),children:n.jsx(l.default,{href:"?offset=".concat(z||D),className:"ihub-pagination-link ihub-pagination-next","aria-label":"Go to next page",tabIndex:Y||null==r||!r.next?-1:0,children:n.jsx("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:n.jsx("path",{d:"M0.330731 1.83333L4.91406 6.41667L0.330731 11L1.2474 12.8333L7.66406 6.41667L1.2474 0L0.330731 1.83333Z",fill:"currentColor"})})})}),L&&n.jsx("li",{className:"ihub-pagination-item ".concat(Y?"ihub-pagination-disabled":""),children:n.jsx(l.default,{href:"?offset=".concat((W-1)*c),className:"ihub-pagination-link ihub-pagination-last","aria-label":"Go to last page",tabIndex:Y?-1:0,children:"Last"})})]})]}),n.jsx("div",{className:"ihub-pagination-info",children:n.jsxs("span",{className:"ihub-pagination-summary",children:["Showing ",Math.min(D+1,(null==r?void 0:r.count)||0)," to"," ",Math.min(D+c,(null==r?void 0:r.count)||0)," of"," ",(null==r?void 0:r.count)||0," results"]})})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var a=require("../../../../_virtual/_rollupPluginBabelHelpers.js"),i=require("react/jsx-runtime"),e=require("react"),n=require("next/link"),t=require("../../lib/helpFunction.js");require("../../lib/utils.js"),require("../../lib/phoneUtils.js");var r=require("next/navigation");function o(a){return a&&"object"==typeof a&&"default"in a?a:{default:a}}var l=o(n),s=function(a){if(!a)return null;try{return new URL(a).searchParams.get("offset")}catch(a){return null}};exports.default=function(n){var o=n.data,c=n.limit,u=n.urlPath,h=n.setData,d=n.token,p=void 0===d?null:d,f=n.tabsValues,g=void 0===f?"":f,b=n.searchValues,v=void 0===b?"":b,m=n.rangeLimit,x=void 0===m?5:m,j=n.className,w=void 0===j?"":j,N=n.showFirstLast,L=void 0===N||N,y=r.useSearchParams(),P=y.get("offset")||"0",q=y.get("search")||"",S=e.useState([]),k=a.slicedToArray(S,2),I=k[0],G=k[1],M=e.useState(0),A=a.slicedToArray(M,2),R=A[0],T=A[1],U=e.useState(x||5),C=a.slicedToArray(U,2),_=C[0],B=C[1],E=e.useState(!1),F=a.slicedToArray(E,2),O=F[0],V=F[1],Z=e.useRef(!0),D=Number(P),H=Math.floor(D/c),z=s((null==o?void 0:o.next)||""),J=s((null==o?void 0:o.previous)||""),K=function(){var i=a.asyncToGenerator(a.regenerator().m(function i(e){var n,r,o,l,s,d;return a.regenerator().w(function(a){for(;;)switch(a.p=a.n){case 0:return V(!0),a.p=1,n=t.reqOptions("GET",null,p),r=void 0!==e?"&offset=".concat(e):"",o=v||q?"&search=".concat(encodeURIComponent(v||q)):"",l=g?"&cat=".concat(encodeURIComponent(g)):"",s="".concat(u,"?limit=").concat(c).concat(r).concat(o).concat(l),a.n=2,t.fetchAPI(h,s,n,!0);case 2:a.n=4;break;case 3:a.p=3,d=a.v,console.error("Pagination fetch error:",d);case 4:return a.p=4,Q(),V(!1),a.f(4);case 5:return a.a(2)}},i,null,[[1,3,4,5]])}));return function(a){return i.apply(this,arguments)}}(),Q=function(){console.log("updatePageRange called with currentPageIndex:",H,x),H+1>=x?(T(H-2),B(H+3)):(T(0),B(x))};if(e.useEffect(function(){if(D>0||g||v||q?K(D):K(),null!=o&&o.count){var a=Math.ceil(o.count/c);G(Array.from({length:a},function(a,i){return i}))}},[P,null==o?void 0:o.count,g,c]),e.useEffect(function(){if(Z.current)Z.current=!1;else if("undefined"!=typeof window){var a=new URLSearchParams(window.location.search);a.set("offset","0"),window.history.replaceState({},"","".concat(window.location.pathname,"?").concat(a.toString()))}},[v,q]),!I.length&&!O)return null;var W=I.length,X=0===H,Y=H===W-1,$=I.slice(R,_);return i.jsxs("div",{className:"ihub-pagination-container ".concat(w),role:"navigation","aria-label":"Pagination",children:[O&&i.jsxs("div",{className:"ihub-pagination-loading",children:[i.jsx("div",{className:"ihub-loading-spinner"}),i.jsx("span",{children:"Loading..."})]}),i.jsxs("ul",{className:"ihub-pagination-list",children:[i.jsxs("div",{className:"ihub-pagination-nav-group",children:[L&&i.jsx("li",{className:"ihub-pagination-item ".concat(X?"ihub-pagination-disabled":""),children:i.jsx(l.default,{href:"?offset=0",className:"ihub-pagination-link ihub-pagination-first","aria-label":"Go to first page",tabIndex:X?-1:0,children:"First"})}),i.jsx("li",{className:"ihub-pagination-item ".concat(X||null==o||!o.previous?"ihub-pagination-disabled":""),children:i.jsx(l.default,{href:"?offset=".concat(J||0),className:"ihub-pagination-link ihub-pagination-previous","aria-label":"Go to previous page",tabIndex:X||null==o||!o.previous?-1:0,children:i.jsx("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:i.jsx("path",{d:"M7.66927 1.83333L3.08594 6.41667L7.66927 11L6.7526 12.8333L0.335938 6.41667L6.7526 0L7.66927 1.83333Z",fill:"currentColor"})})})})]}),i.jsx("div",{className:"ihub-pagination-pages",children:($||[]).map(function(a){var e=H===a,n=a+1;return i.jsx("li",{className:"ihub-pagination-item ".concat(e?"ihub-pagination-active":""),"data-page":n,children:i.jsx(l.default,{href:"?offset=".concat(a*c),className:"ihub-pagination-link ihub-pagination-number","aria-label":"Go to page ".concat(n),"aria-current":e?"page":void 0,children:n})},a)})}),i.jsxs("div",{className:"ihub-pagination-nav-group ".concat(null!=o&&o.next?"":"ihub-pagination-disabled"),children:[i.jsx("li",{className:"ihub-pagination-item ".concat(Y||null==o||!o.next?"ihub-pagination-disabled":""),children:i.jsx(l.default,{href:"?offset=".concat(z||D),className:"ihub-pagination-link ihub-pagination-next","aria-label":"Go to next page",tabIndex:Y||null==o||!o.next?-1:0,children:i.jsx("svg",{width:"8",height:"13",viewBox:"0 0 8 13",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:i.jsx("path",{d:"M0.330731 1.83333L4.91406 6.41667L0.330731 11L1.2474 12.8333L7.66406 6.41667L1.2474 0L0.330731 1.83333Z",fill:"currentColor"})})})}),L&&i.jsx("li",{className:"ihub-pagination-item ".concat(Y?"ihub-pagination-disabled":""),children:i.jsx(l.default,{href:"?offset=".concat((W-1)*c),className:"ihub-pagination-link ihub-pagination-last","aria-label":"Go to last page",tabIndex:Y?-1:0,children:"Last"})})]})]}),i.jsx("div",{className:"ihub-pagination-info",children:i.jsxs("span",{className:"ihub-pagination-summary",children:["Showing ",Math.min(D+1,(null==o?void 0:o.count)||0)," to"," ",Math.min(D+c,(null==o?void 0:o.count)||0)," of"," ",(null==o?void 0:o.count)||0," results"]})})]})};
2
2
  //# sourceMappingURL=Pagination.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react/jsx-runtime"),s=require("react"),t=require("./Pagination.js"),i=require("../../lib/helpFunction.js");require("../../lib/utils.js");exports.default=function(){var a=s.useState({count:150,next:"http://127.0.0.1:8000/api/v1/posts/?limit=20&offset=20",previous:null,results:[]}),l=e.slicedToArray(a,2),n=l[0],o=l[1],d=s.useState(""),u=e.slicedToArray(d,2),c=u[0],p=u[1],h=s.useState(""),x=e.slicedToArray(h,2),j=x[0],v=x[1],g=s.useState("0"),m=e.slicedToArray(g,2),f=m[0],y=m[1];return r.jsxs("div",{style:{padding:"2rem",fontFamily:"var(--Nunito, sans-serif)"},children:[r.jsx("h2",{style:{marginBottom:"2rem",color:"var(--DarkCyan)"},children:"Enhanced Pagination with API Integration"}),r.jsxs("div",{style:{marginBottom:"2rem",display:"flex",gap:"1rem",flexWrap:"wrap"},children:[r.jsxs("div",{children:[r.jsx("label",{children:"Search: "}),r.jsx("input",{type:"text",value:c,onChange:function(e){return r=e.target.value,p(r),void y("0");var r},placeholder:"Search posts...",style:{padding:"0.5rem",border:"1px solid #ccc",borderRadius:"4px"}})]}),r.jsxs("div",{children:[r.jsx("label",{children:"Category: "}),r.jsxs("select",{value:j,onChange:function(e){return r=e.target.value,v(r),void y("0");var r},style:{padding:"0.5rem",border:"1px solid #ccc",borderRadius:"4px"},children:[r.jsx("option",{value:"",children:"All Categories"}),r.jsx("option",{value:"tech",children:"Technology"}),r.jsx("option",{value:"design",children:"Design"}),r.jsx("option",{value:"business",children:"Business"})]})]})]}),r.jsxs("div",{style:{marginBottom:"2rem",padding:"1rem",backgroundColor:"#f8f9fa",borderRadius:"8px"},children:[r.jsx("h3",{children:"Current State:"}),r.jsxs("p",{children:["Offset: ",f]}),r.jsxs("p",{children:['Search: "',c,'"']}),r.jsxs("p",{children:['Tab: "',j,'"']}),r.jsxs("p",{children:["Total items: ",n.count]})]}),r.jsx(t.default,{offset:f,data:n,limit:20,urlPath:i.API_HOST_URL+"posts/",setData:o,token:"mock-token",searchValues:c,tabsValues:j,rangeLimit:5,showFirstLast:!0})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react/jsx-runtime"),s=require("react"),t=require("./Pagination.js"),i=require("../../lib/helpFunction.js");require("../../lib/utils.js"),require("../../lib/phoneUtils.js");exports.default=function(){var a=s.useState({count:150,next:"http://127.0.0.1:8000/api/v1/posts/?limit=20&offset=20",previous:null,results:[]}),l=e.slicedToArray(a,2),n=l[0],o=l[1],d=s.useState(""),u=e.slicedToArray(d,2),c=u[0],p=u[1],h=s.useState(""),x=e.slicedToArray(h,2),j=x[0],v=x[1],g=s.useState("0"),m=e.slicedToArray(g,2),f=m[0],y=m[1];return r.jsxs("div",{style:{padding:"2rem",fontFamily:"var(--Nunito, sans-serif)"},children:[r.jsx("h2",{style:{marginBottom:"2rem",color:"var(--DarkCyan)"},children:"Enhanced Pagination with API Integration"}),r.jsxs("div",{style:{marginBottom:"2rem",display:"flex",gap:"1rem",flexWrap:"wrap"},children:[r.jsxs("div",{children:[r.jsx("label",{children:"Search: "}),r.jsx("input",{type:"text",value:c,onChange:function(e){return r=e.target.value,p(r),void y("0");var r},placeholder:"Search posts...",style:{padding:"0.5rem",border:"1px solid #ccc",borderRadius:"4px"}})]}),r.jsxs("div",{children:[r.jsx("label",{children:"Category: "}),r.jsxs("select",{value:j,onChange:function(e){return r=e.target.value,v(r),void y("0");var r},style:{padding:"0.5rem",border:"1px solid #ccc",borderRadius:"4px"},children:[r.jsx("option",{value:"",children:"All Categories"}),r.jsx("option",{value:"tech",children:"Technology"}),r.jsx("option",{value:"design",children:"Design"}),r.jsx("option",{value:"business",children:"Business"})]})]})]}),r.jsxs("div",{style:{marginBottom:"2rem",padding:"1rem",backgroundColor:"#f8f9fa",borderRadius:"8px"},children:[r.jsx("h3",{children:"Current State:"}),r.jsxs("p",{children:["Offset: ",f]}),r.jsxs("p",{children:['Search: "',c,'"']}),r.jsxs("p",{children:['Tab: "',j,'"']}),r.jsxs("p",{children:["Total items: ",n.count]})]}),r.jsx(t.default,{offset:f,data:n,limit:20,urlPath:i.API_HOST_URL+"posts/",setData:o,token:"mock-token",searchValues:c,tabsValues:j,rangeLimit:5,showFirstLast:!0})]})};
2
2
  //# sourceMappingURL=PaginationDemo.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_rollupPluginBabelHelpers.js"),t=require("react/jsx-runtime"),n=require("react"),i=require("@mui/icons-material/FileDownloadOutlined"),r=require("@mui/icons-material/RefreshOutlined"),c=require("@mui/icons-material/InventoryOutlined"),s=require("@mui/icons-material/FilterAltOutlined"),a=require("@mui/icons-material/FilterAltOffOutlined"),o=require("@mui/icons-material/ExpandMoreOutlined"),l=require("@mui/icons-material/ExpandLessOutlined"),u=require("@mui/icons-material/VisibilityOutlined"),d=require("@mui/icons-material/EditOutlined"),h=require("@mui/icons-material/DeleteOutlined"),b=require("@mui/icons-material/UnfoldLessOutlined");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var m=f(n),x=f(i),p=f(r),v=f(c),j=f(s),g=f(a),y=f(o),N=f(l),C=f(u),k=f(d),S=f(h),w=f(b),A=function(i){var r=i.columns,c=i.data,s=i.isLoading,a=void 0!==s&&s,o=i.emptyStateMessage,l=void 0===o?"No data available":o,u=i.emptyStateIcon,d=void 0===u?t.jsx(v.default,{}):u,h=i.title,b=i.showSearch,f=void 0!==b&&b,A=i.pagination,O=void 0===A||A,E=i.rowsPerPageOptions,M=void 0===E?[10,25,50]:E,q=i.defaultRowsPerPage,L=void 0===q?10:q,R=i.actions,T=i.onRowClick,P=i.keyExtractor,F=void 0===P?function(e,t){return t}:P,D=i.hideHeaderOnMobile,H=void 0!==D&&D,_=i.stickyHeader,I=void 0!==_&&_,U=i.maxHeight,V=i.sortable,B=void 0===V||V,J=i.defaultSortColumn,G=i.defaultSortDirection,W=void 0===G?"asc":G,X=i.onSort,Y=i.onFilter,z=i.selectable,K=void 0!==z&&z,Q=i.onSelectionChange,Z=i.expandable,$=void 0!==Z&&Z,ee=i.renderExpandedRow,te=i.exportOptions,ne=i.refreshable,ie=void 0!==ne&&ne,re=i.onRefresh,ce=i.error,se=i.showRowNumbers,ae=void 0!==se&&se,oe=i.rowNumberStartFrom,le=void 0===oe?1:oe,ue=n.useRef(null),de=n.useRef(!0),he=n.useState(""),be=e.slicedToArray(he,2),fe=be[0],me=be[1],xe=n.useState(1),pe=e.slicedToArray(xe,2),ve=pe[0],je=pe[1],ge=n.useState(L),ye=e.slicedToArray(ge,2),Ne=ye[0],Ce=ye[1],ke=n.useState({column:J,direction:W}),Se=e.slicedToArray(ke,2),we=Se[0],Ae=Se[1],Oe=n.useState({}),Ee=e.slicedToArray(Oe,2),Me=Ee[0],qe=Ee[1],Le=n.useState(null),Re=e.slicedToArray(Le,2),Te=Re[0],Pe=Re[1],Fe=n.useState([]),De=e.slicedToArray(Fe,2),He=De[0],_e=De[1],Ie=n.useState([]),Ue=e.slicedToArray(Ie,2),Ve=Ue[0],Be=Ue[1],Je=n.useState(!1),Ge=e.slicedToArray(Je,2),We=Ge[0],Xe=Ge[1],Ye=n.useState({visible:!1,x:0,y:0,row:null}),ze=e.slicedToArray(Ye,2),Ke=ze[0],Qe=ze[1],Ze=n.useCallback(function(e,t){return F(e,t)},[]);n.useEffect(function(){var t=function(t){Te&&ue.current&&!ue.current.contains(t.target)&&Pe(null),Ke.visible&&Qe(function(t){return e.objectSpread2(e.objectSpread2({},t),{},{visible:!1})})};return document.addEventListener("mousedown",t),function(){document.removeEventListener("mousedown",t)}},[Te,Ke.visible]),n.useEffect(function(){de.current?de.current=!1:0!==(c||[]).length?_e(function(e){if(0===(e||[]).length)return e;var t=e.filter(function(e){return c.some(function(t){return JSON.stringify(t)===JSON.stringify(e)})});return(t||[]).length!==(e||[]).length?t:e}):_e([])},[c]),n.useEffect(function(){Q&&!de.current&&Q(He)},[He]);var $e=n.useCallback(function(e){if(B&&e.sortable&&"string"==typeof e.accessor){var t=e.accessor;Ae(function(e){if(e.column===t){var n="asc"===e.direction?"desc":"asc";return X&&X(t,n),{column:t,direction:n}}return X&&X(t,"asc"),{column:t,direction:"asc"}})}},[B,X]),et=n.useCallback(function(t,n){qe(function(i){var r=e.objectSpread2(e.objectSpread2({},i),{},e.defineProperty({},t,n.length>0?n:null));return Y&&Y(r),r})},[Y]),tt=n.useCallback(function(t,n,i){_e(function(r){return n?[].concat(e.toConsumableArray(r),[t]):r.filter(function(e,n){return Ze(e,n)!==Ze(t,i)})})},[Ze]),nt=n.useCallback(function(t){_e(t?e.toConsumableArray(c):[])},[c]),it=n.useCallback(function(e,t){return He.some(function(n,i){return Ze(n,i)===Ze(e,t)})},[He,Ze]),rt=n.useCallback(function(t,n){n.stopPropagation(),Be(function(n){return n.includes(t)?n.filter(function(e){return e!==t}):[].concat(e.toConsumableArray(n),[t])})},[]),ct=n.useCallback(function(e,t){e.preventDefault(),Qe({visible:!0,x:e.clientX,y:e.clientY,row:t})},[]),st=n.useCallback(e.asyncToGenerator(e.regenerator().m(function t(){var n;return e.regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!re){e.n=5;break}return Xe(!0),e.p=1,e.n=2,re();case 2:e.n=4;break;case 3:e.p=3,n=e.v,console.error("Error refreshing data:",n);case 4:return e.p=4,Xe(!1),e.f(4);case 5:return e.a(2)}},t,null,[[1,3,4,5]])})),[re]),at=n.useCallback(function(t){if(te){var n=te.fileName||"table-export";if("csv"===t){var i=[].concat(e.toConsumableArray(ae?["#"]:[]),e.toConsumableArray(r.filter(function(e){return"string"==typeof e.accessor}).map(function(e){return e.header}))),s=c.map(function(t,n){return[].concat(e.toConsumableArray(ae?[String(n+le)]:[]),e.toConsumableArray(r.filter(function(e){return"string"==typeof e.accessor}).map(function(e){var n,i=e.accessor;return String(null!==(n=t[i])&&void 0!==n?n:"")}))).join(",")}),a=[i.join(",")].concat(e.toConsumableArray(s)).join("\n"),o=new Blob([a],{type:"text/csv;charset=utf-8;"}),l=document.createElement("a"),u=URL.createObjectURL(o);l.setAttribute("href",u),l.setAttribute("download","".concat(n,".csv")),l.style.visibility="hidden",document.body.appendChild(l),l.click(),document.body.removeChild(l)}}},[r,c,te]),ot=n.useMemo(function(){var t=c;return fe.trim()&&(t=t.filter(function(e){return r.some(function(t){if("string"==typeof t.accessor){var n=e[t.accessor];return String(n).toLowerCase().includes((fe||"").toLowerCase())}return!1})})),Object.entries(Me).forEach(function(n){var i=e.slicedToArray(n,2),r=i[0],c=i[1];null!==c&&(t=t.filter(function(e){return String(e[r]||"").toLowerCase().includes(String(c).toLowerCase())}))}),t},[c,fe,r,Me]),lt=n.useMemo(function(){return we.column?e.toConsumableArray(ot).sort(function(e,t){var n=we.column,i=e[n],r=t[n];if(i===r)return 0;var c=i<r?-1:1;return"asc"===we.direction?c:-c}):ot},[ot,we.column,we.direction]),ut=n.useMemo(function(){if(!O)return lt;var e=(ve-1)*Ne;return lt.slice(e,e+Ne)},[lt,O,ve,Ne]),dt=n.useMemo(function(){return O?Math.ceil(lt.length/Ne):1},[lt.length,Ne,O]);return n.useEffect(function(){je(1)},[fe,Ne,Me]),a||We?t.jsxs("div",{className:"ihub-data-list-container",children:[h&&t.jsx("h2",{children:h}),t.jsx("div",{className:"ihub-loading-state",children:t.jsx("p",{children:"Loading data..."})})]}):ce&&!a?t.jsxs("div",{className:"ihub-data-list-container",children:[h&&t.jsx("h2",{children:h}),t.jsxs("div",{className:"ihub-error-state",children:[t.jsx("p",{children:ce}),ie&&re&&t.jsx("button",{className:"ihub-important-btn",onClick:st,children:"Retry"})]})]}):a||c&&0!==c.length?t.jsxs("div",{className:"ihub-data-list-container",ref:ue,children:[(h||R||f||te||ie)&&t.jsxs("div",{className:"ihub-data-list-header ihub-table-header ihub-p-0",children:[t.jsx("div",{children:h&&t.jsx("h2",{children:h})}),t.jsxs("div",{className:"ihub-table-controls",children:[f&&t.jsx("div",{className:"ihub-table-search",children:t.jsx("input",{type:"text",placeholder:"Search...",value:fe,onChange:function(e){return me(e.target.value)},className:"ihub-search-input"})}),te&&t.jsxs("div",{className:"ihub-export-buttons",children:[te.csv&&t.jsxs("button",{className:"ihub-export-button ihub-export-csv",onClick:function(){return at("csv")},children:[t.jsx(x.default,{}),"CSV"]}),te.excel&&t.jsxs("button",{className:"ihub-export-button ihub-export-excel",onClick:function(){return at("excel")},children:[t.jsx(x.default,{}),"Excel"]}),te.pdf&&t.jsxs("button",{className:"ihub-export-button ihub-export-pdf",onClick:function(){return at("pdf")},children:[t.jsx(x.default,{}),"PDF"]})]}),ie&&re&&t.jsxs("button",{className:"ihub-export-button",onClick:st,disabled:We,children:[t.jsx(p.default,{}),"Refresh"]}),R&&t.jsx("div",{className:"ihub-data-controls ihub-mb-0",children:R})]})]}),K&&He.length>0&&t.jsxs("div",{className:"ihub-selection-summary",children:[t.jsxs("p",{children:[He.length," item(s) selected"]}),t.jsx("button",{className:"ihub-outlined-btn",onClick:function(){return _e([])},children:"Clear Selection"})]}),t.jsx("div",{className:"ihub-scroll-container ".concat(I?"ihub-sticky-header":""),style:U?{maxHeight:U}:void 0,children:t.jsxs("table",{className:"ihub-table ihub-scroll-container",children:[t.jsx("thead",{className:H?"ihub-hide-on-mobile":"",children:t.jsxs("tr",{children:[ae&&t.jsx("th",{style:{width:"60px",textAlign:"center"},children:"#"}),K&&t.jsx("th",{className:"ihub-checkbox-cell",children:t.jsx("div",{className:"ihub-checkbox-header",children:t.jsx("input",{type:"checkbox",checked:He.length===c.length&&c.length>0,onChange:function(e){return nt(e.target.checked)}})})}),$&&ee&&t.jsx("th",{style:{width:"40px"},children:t.jsx(w.default,{})}),r.map(function(e,n){return t.jsx("th",{className:"".concat(e.sortable&&B?"ihub-sortable-column":""," ").concat(we.column===e.accessor?"ihub-sorted-".concat(we.direction):""),style:e.width?{width:e.width}:void 0,children:t.jsxs("div",{className:"ihub-column-header",children:[t.jsx("span",{onClick:function(){return e.sortable&&B?$e(e):void 0},style:{cursor:e.sortable&&B?"pointer":"default"},children:e.header}),e.sortable&&B&&t.jsx("span",{className:"ihub-sort-icon",onClick:function(){return $e(e)},children:we.column===e.accessor&&"asc"===we.direction?"▲":we.column===e.accessor&&"desc"===we.direction?"▼":"⇅"}),e.filterable&&"string"==typeof e.accessor&&t.jsxs("div",{className:"ihub-column-filter",children:[t.jsx("button",{className:"ihub-filter-button",onClick:function(t){t.stopPropagation(),Pe(Te===e.accessor?null:e.accessor)},children:Me[e.accessor]?t.jsx(g.default,{}):t.jsx(j.default,{})}),Te===e.accessor&&t.jsxs("div",{className:"ihub-filter-dropdown",onClick:function(e){return e.stopPropagation()},children:[t.jsxs("label",{children:["Filter ",e.header]}),t.jsx("input",{type:"text",className:"ihub-filter-input",value:Me[e.accessor]||"",onChange:function(t){return et(e.accessor,t.target.value)},placeholder:"Filter by ".concat((e.header||"").toLowerCase()),autoFocus:!0}),t.jsxs("div",{className:"ihub-filter-actions",children:[t.jsx("button",{className:"ihub-outlined-btn",onClick:function(){et(e.accessor,""),Pe(null)},children:"Clear"}),t.jsx("button",{className:"ihub-important-btn",onClick:function(){return Pe(null)},children:"Apply"})]})]})]})]})},n)})]})}),t.jsx("tbody",{children:ut.map(function(e,n){var i=Ze(e,n),c=Ve.includes(i);return t.jsxs(m.default.Fragment,{children:[t.jsxs("tr",{onClick:function(){return T&&T(e)},onContextMenu:function(t){return ct(t,e)},className:"\n ".concat(T?"ihub-clickable-row":"","\n ").concat(it(e,n)?"ihub-selected-row":"","\n "),children:[ae&&t.jsx("td",{style:{textAlign:"center",fontWeight:"500"},children:(ve-1)*Ne+n+le}),K&&t.jsx("td",{className:"ihub-checkbox-cell",onClick:function(e){return e.stopPropagation()},children:t.jsx("input",{type:"checkbox",checked:it(e,n),onChange:function(t){return tt(e,t.target.checked,n)}})}),$&&ee&&t.jsx("td",{onClick:function(e){return rt(i,e)},children:c?t.jsx(N.default,{}):t.jsx(y.default,{})}),r.map(function(n,i){var r,c,s;return t.jsx("td",{"data-label":H?n.header:void 0,children:n.tooltip&&"string"==typeof n.accessor?t.jsx("div",{className:"ihub-cell-tooltip","data-tooltip":String(null!==(r=e[n.accessor])&&void 0!==r?r:""),children:n.cell?n.cell(e):String(null!==(c=e[n.accessor])&&void 0!==c?c:"")}):n.cell?n.cell(e):"function"==typeof n.accessor?n.accessor(e):String(null!==(s=e[n.accessor])&&void 0!==s?s:"")},i)})]}),$&&ee&&c&&t.jsx("tr",{className:"ihub-expanded-row",children:t.jsx("td",{colSpan:r.length+(K?1:0)+1+(ae?1:0),children:t.jsx("div",{className:"ihub-row-details",children:ee(e)})})})]},i)})})]})}),Ke.visible&&Ke.row&&t.jsxs("div",{className:"ihub-context-menu",style:{top:Ke.y,left:Ke.x},children:[t.jsxs("div",{className:"ihub-context-menu-item",onClick:function(){Ke.row&&T&&T(Ke.row),Qe(function(t){return e.objectSpread2(e.objectSpread2({},t),{},{visible:!1})})},children:[t.jsx(C.default,{}),"View"]}),t.jsxs("div",{className:"ihub-context-menu-item",onClick:function(){Qe(function(t){return e.objectSpread2(e.objectSpread2({},t),{},{visible:!1})})},children:[t.jsx(k.default,{}),"Edit"]}),t.jsx("div",{className:"ihub-context-menu-separator"}),t.jsxs("div",{className:"ihub-context-menu-item",onClick:function(){Qe(function(t){return e.objectSpread2(e.objectSpread2({},t),{},{visible:!1})})},children:[t.jsx(S.default,{}),"Delete"]})]}),O&&dt>1&&t.jsxs("div",{className:"ihub-table-pagination",children:[t.jsxs("div",{className:"ihub-pagination-info",children:["Showing"," ",Math.min((ve-1)*Ne+1,lt.length)," ","to ",Math.min(ve*Ne,lt.length)," of"," ",lt.length," entries"]}),t.jsxs("div",{className:"ihub-pagination-controls",children:[t.jsx("button",{className:"ihub-pagination-button",disabled:1===ve,onClick:function(){return je(1)},children:"«"}),t.jsx("button",{className:"ihub-pagination-button",disabled:1===ve,onClick:function(){return je(function(e){return Math.max(1,e-1)})},children:"‹"}),Array.from({length:Math.min(5,dt)},function(e,n){var i;return i=dt<=5||ve<=3?n+1:ve>=dt-2?dt-4+n:ve-2+n,t.jsx("button",{className:"ihub-pagination-button ".concat(ve===i?"ihub-active":""),onClick:function(){return je(Number(i))},children:i},i)}),t.jsx("button",{className:"ihub-pagination-button",disabled:ve===dt,onClick:function(){return je(function(e){return Math.min(dt,e+1)})},children:"›"}),t.jsx("button",{className:"ihub-pagination-button",disabled:ve===dt,onClick:function(){return je(dt)},children:"»"})]}),t.jsxs("div",{className:"ihub-rows-per-page",children:[t.jsx("span",{children:"Rows per page:"}),t.jsx("select",{value:Ne,onChange:function(e){return Ce(Number(e.target.value))},className:"ihub-rows-select",children:M.map(function(e){return t.jsx("option",{value:e,children:e},e)})})]})]})]}):t.jsxs("div",{className:"ihub-data-list-container",children:[h&&t.jsx("h2",{children:h}),R&&t.jsx("div",{className:"ihub-data-controls ihub-mb-0",children:R}),t.jsx("div",{className:"ihub-empty-state",children:t.jsxs("div",{children:[d,t.jsx("p",{children:l})]})})]})};exports.IHubTable=A,exports.default=A;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_rollupPluginBabelHelpers.js"),t=require("react/jsx-runtime"),n=require("react"),r=require("@mui/icons-material/FileDownloadOutlined"),i=require("@mui/icons-material/RefreshOutlined"),s=require("@mui/icons-material/InventoryOutlined"),a=require("@mui/icons-material/FilterAltOutlined"),c=require("@mui/icons-material/FilterAltOffOutlined"),o=require("@mui/icons-material/ExpandMoreOutlined"),l=require("@mui/icons-material/ExpandLessOutlined"),u=require("@mui/icons-material/VisibilityOutlined"),d=require("@mui/icons-material/EditOutlined"),h=require("@mui/icons-material/DeleteOutlined"),b=require("@mui/icons-material/UnfoldLessOutlined"),f=require("../../lib/modals/modals.js"),m=require("./utils/tableExport.js");function x(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=x(n),j=x(r),v=x(i),g=x(s),N=x(a),y=x(c),C=x(o),k=x(l),w=x(u),S=x(d),A=x(h),E=x(b),O=function(r){var i=r.columns,s=r.data,a=r.isLoading,c=void 0!==a&&a,o=r.emptyStateMessage,l=void 0===o?"No data available":o,u=r.emptyStateIcon,d=void 0===u?t.jsx(g.default,{}):u,h=r.title,b=r.showSearch,x=void 0!==b&&b,O=r.pagination,T=void 0===O||O,q=r.rowsPerPageOptions,R=void 0===q?[10,25,50]:q,M=r.defaultRowsPerPage,F=void 0===M?10:M,P=r.actions,L=r.onRowClick,D=r.keyExtractor,H=void 0===D?function(e,t){return t}:D,I=r.hideHeaderOnMobile,_=void 0!==I&&I,V=r.stickyHeader,G=void 0!==V&&V,J=r.maxHeight,B=r.sortable,U=void 0===B||B,W=r.defaultSortColumn,X=r.defaultSortDirection,Y=void 0===X?"asc":X,z=r.onSort,K=r.onFilter,Q=r.selectable,Z=void 0!==Q&&Q,$=r.onSelectionChange,ee=r.expandable,te=void 0!==ee&&ee,ne=r.renderExpandedRow,re=r.exportOptions,ie=r.refreshable,se=void 0!==ie&&ie,ae=r.onRefresh,ce=r.error,oe=r.showRowNumbers,le=void 0!==oe&&oe,ue=r.rowNumberStartFrom,de=void 0===ue?1:ue,he=n.useRef(null),be=n.useRef(!0),fe=n.useState(""),me=e.slicedToArray(fe,2),xe=me[0],pe=me[1],je=n.useState(1),ve=e.slicedToArray(je,2),ge=ve[0],Ne=ve[1],ye=n.useState(F),Ce=e.slicedToArray(ye,2),ke=Ce[0],we=Ce[1],Se=n.useState({column:W,direction:Y}),Ae=e.slicedToArray(Se,2),Ee=Ae[0],Oe=Ae[1],Te=n.useState({}),qe=e.slicedToArray(Te,2),Re=qe[0],Me=qe[1],Fe=n.useState(null),Pe=e.slicedToArray(Fe,2),Le=Pe[0],De=Pe[1],He=n.useState([]),Ie=e.slicedToArray(He,2),_e=Ie[0],Ve=Ie[1],Ge=n.useState([]),Je=e.slicedToArray(Ge,2),Be=Je[0],Ue=Je[1],We=n.useState(!1),Xe=e.slicedToArray(We,2),Ye=Xe[0],ze=Xe[1],Ke=n.useState({visible:!1,x:0,y:0,row:null}),Qe=e.slicedToArray(Ke,2),Ze=Qe[0],$e=Qe[1],et=n.useCallback(function(e,t){return H(e,t)},[]);n.useEffect(function(){var t=function(t){Le&&he.current&&!he.current.contains(t.target)&&De(null),Ze.visible&&$e(function(t){return e.objectSpread2(e.objectSpread2({},t),{},{visible:!1})})};return document.addEventListener("mousedown",t),function(){document.removeEventListener("mousedown",t)}},[Le,Ze.visible]),n.useEffect(function(){be.current?be.current=!1:0!==(s||[]).length?Ve(function(e){if(0===(e||[]).length)return e;var t=e.filter(function(e){return s.some(function(t){return JSON.stringify(t)===JSON.stringify(e)})});return(t||[]).length!==(e||[]).length?t:e}):Ve([])},[s]),n.useEffect(function(){$&&!be.current&&$(_e)},[_e]);var tt=n.useCallback(function(e){if(U&&e.sortable&&"string"==typeof e.accessor){var t=e.accessor;Oe(function(e){if(e.column===t){var n="asc"===e.direction?"desc":"asc";return z&&z(t,n),{column:t,direction:n}}return z&&z(t,"asc"),{column:t,direction:"asc"}})}},[U,z]),nt=n.useCallback(function(t,n){Me(function(r){var i=e.objectSpread2(e.objectSpread2({},r),{},e.defineProperty({},t,n.length>0?n:null));return K&&K(i),i})},[K]),rt=n.useCallback(function(t,n,r){Ve(function(i){return n?[].concat(e.toConsumableArray(i),[t]):i.filter(function(e,n){return et(e,n)!==et(t,r)})})},[et]),it=n.useCallback(function(t){Ve(t?e.toConsumableArray(s):[])},[s]),st=n.useCallback(function(e,t){return _e.some(function(n,r){return et(n,r)===et(e,t)})},[_e,et]),at=n.useCallback(function(t,n){n.stopPropagation(),Ue(function(n){return n.includes(t)?n.filter(function(e){return e!==t}):[].concat(e.toConsumableArray(n),[t])})},[]),ct=n.useCallback(function(e,t){e.preventDefault(),$e({visible:!0,x:e.clientX,y:e.clientY,row:t})},[]),ot=n.useCallback(e.asyncToGenerator(e.regenerator().m(function t(){var n;return e.regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!ae){e.n=5;break}return ze(!0),e.p=1,e.n=2,ae();case 2:e.n=4;break;case 3:e.p=3,n=e.v,console.error("Error refreshing data:",n);case 4:return e.p=4,ze(!1),e.f(4);case 5:return e.a(2)}},t,null,[[1,3,4,5]])})),[ae]),lt=n.useMemo(function(){var t=s;return xe.trim()&&(t=t.filter(function(e){return i.some(function(t){if("string"==typeof t.accessor){var n=e[t.accessor];return String(n).toLowerCase().includes((xe||"").toLowerCase())}return!1})})),Object.entries(Re).forEach(function(n){var r=e.slicedToArray(n,2),i=r[0],s=r[1];null!==s&&(t=t.filter(function(e){return String(e[i]||"").toLowerCase().includes(String(s).toLowerCase())}))}),t},[s,xe,i,Re]),ut=n.useMemo(function(){return Ee.column?e.toConsumableArray(lt).sort(function(e,t){var n=Ee.column,r=e[n],i=t[n];if(r===i)return 0;var s=r<i?-1:1;return"asc"===Ee.direction?s:-s}):lt},[lt,Ee.column,Ee.direction]),dt=n.useMemo(function(){if(!T)return ut;var e=(ge-1)*ke;return ut.slice(e,e+ke)},[ut,T,ge,ke]),ht=n.useCallback(function(){var t=e.asyncToGenerator(e.regenerator().m(function t(n){var r,s;return e.regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(re){e.n=1;break}return e.a(2);case 1:if(r=m.resolveExportOptions(re),ut.length){e.n=2;break}return f.openToast("There is no data to export.",400),e.a(2);case 2:return e.p=2,e.n=3,m.exportTableData({data:ut.slice(0,r.maxRows),columns:i,format:n,fileName:r.fileName,title:h,showRowNumbers:le,rowNumberStartFrom:de,fields:r.fields,allFields:r.allFields});case 3:ut.length>r.maxRows&&f.openToast("Export capped at ".concat(r.maxRows," rows. Increase exportOptions.maxRows for more."),400),e.n=5;break;case 4:e.p=4,s=e.v,console.error("Export error:",s),f.openToast(s instanceof Error?s.message:"Export failed. Try again.",400);case 5:return e.a(2)}},t,null,[[2,4]])}));return function(e){return t.apply(this,arguments)}}(),[i,re,de,le,ut,h]),bt=n.useMemo(function(){return T?Math.ceil(ut.length/ke):1},[ut.length,ke,T]);return n.useEffect(function(){Ne(1)},[xe,ke,Re]),c||Ye?t.jsxs("div",{className:"ihub-data-list-container",children:[h&&t.jsx("h2",{children:h}),t.jsx("div",{className:"ihub-loading-state",children:t.jsx("p",{children:"Loading data..."})})]}):ce&&!c?t.jsxs("div",{className:"ihub-data-list-container",children:[h&&t.jsx("h2",{children:h}),t.jsxs("div",{className:"ihub-error-state",children:[t.jsx("p",{children:ce}),se&&ae&&t.jsx("button",{className:"ihub-important-btn",onClick:ot,children:"Retry"})]})]}):c||s&&0!==s.length?t.jsxs("div",{className:"ihub-data-list-container",ref:he,children:[(h||P||x||re||se)&&t.jsxs("div",{className:"ihub-data-list-header ihub-table-header ihub-p-0",children:[t.jsx("div",{children:h&&t.jsx("h2",{children:h})}),t.jsxs("div",{className:"ihub-table-controls",children:[x&&t.jsx("div",{className:"ihub-table-search",children:t.jsx("input",{type:"text",placeholder:"Search...",value:xe,onChange:function(e){return pe(e.target.value)},className:"ihub-search-input"})}),re&&t.jsxs("div",{className:"ihub-export-buttons",children:[re.csv&&t.jsxs("button",{className:"ihub-export-button ihub-export-csv",onClick:function(){return ht("csv")},children:[t.jsx(j.default,{}),"CSV"]}),re.excel&&t.jsxs("button",{className:"ihub-export-button ihub-export-excel",onClick:function(){return ht("excel")},children:[t.jsx(j.default,{}),"Excel"]}),re.pdf&&t.jsxs("button",{className:"ihub-export-button ihub-export-pdf",onClick:function(){return ht("pdf")},children:[t.jsx(j.default,{}),"PDF"]})]}),se&&ae&&t.jsxs("button",{className:"ihub-export-button",onClick:ot,disabled:Ye,children:[t.jsx(v.default,{}),"Refresh"]}),P&&t.jsx("div",{className:"ihub-data-controls ihub-mb-0",children:P})]})]}),Z&&_e.length>0&&t.jsxs("div",{className:"ihub-selection-summary",children:[t.jsxs("p",{children:[_e.length," item(s) selected"]}),t.jsx("button",{className:"ihub-outlined-btn",onClick:function(){return Ve([])},children:"Clear Selection"})]}),t.jsx("div",{className:"ihub-scroll-container ".concat(G?"ihub-sticky-header":""),style:J?{maxHeight:J}:void 0,children:t.jsxs("table",{className:"ihub-table ihub-scroll-container",children:[t.jsx("thead",{className:_?"ihub-hide-on-mobile":"",children:t.jsxs("tr",{children:[le&&t.jsx("th",{style:{width:"60px",textAlign:"center"},children:"#"}),Z&&t.jsx("th",{className:"ihub-checkbox-cell",children:t.jsx("div",{className:"ihub-checkbox-header",children:t.jsx("input",{type:"checkbox",checked:_e.length===s.length&&s.length>0,onChange:function(e){return it(e.target.checked)}})})}),te&&ne&&t.jsx("th",{style:{width:"40px"},children:t.jsx(E.default,{})}),i.map(function(e,n){return t.jsx("th",{className:"".concat(e.sortable&&U?"ihub-sortable-column":""," ").concat(Ee.column===e.accessor?"ihub-sorted-".concat(Ee.direction):""),style:e.width?{width:e.width}:void 0,children:t.jsxs("div",{className:"ihub-column-header",children:[t.jsx("span",{onClick:function(){return e.sortable&&U?tt(e):void 0},style:{cursor:e.sortable&&U?"pointer":"default"},children:e.header}),e.sortable&&U&&t.jsx("span",{className:"ihub-sort-icon",onClick:function(){return tt(e)},children:Ee.column===e.accessor&&"asc"===Ee.direction?"▲":Ee.column===e.accessor&&"desc"===Ee.direction?"▼":"⇅"}),e.filterable&&"string"==typeof e.accessor&&t.jsxs("div",{className:"ihub-column-filter",children:[t.jsx("button",{className:"ihub-filter-button",onClick:function(t){t.stopPropagation(),De(Le===e.accessor?null:e.accessor)},children:Re[e.accessor]?t.jsx(y.default,{}):t.jsx(N.default,{})}),Le===e.accessor&&t.jsxs("div",{className:"ihub-filter-dropdown",onClick:function(e){return e.stopPropagation()},children:[t.jsxs("label",{children:["Filter ",e.header]}),t.jsx("input",{type:"text",className:"ihub-filter-input",value:Re[e.accessor]||"",onChange:function(t){return nt(e.accessor,t.target.value)},placeholder:"Filter by ".concat((e.header||"").toLowerCase()),autoFocus:!0}),t.jsxs("div",{className:"ihub-filter-actions",children:[t.jsx("button",{className:"ihub-outlined-btn",onClick:function(){nt(e.accessor,""),De(null)},children:"Clear"}),t.jsx("button",{className:"ihub-important-btn",onClick:function(){return De(null)},children:"Apply"})]})]})]})]})},n)})]})}),t.jsx("tbody",{children:dt.map(function(e,n){var r=et(e,n),s=Be.includes(r);return t.jsxs(p.default.Fragment,{children:[t.jsxs("tr",{onClick:function(){return L&&L(e)},onContextMenu:function(t){return ct(t,e)},className:"\n ".concat(L?"ihub-clickable-row":"","\n ").concat(st(e,n)?"ihub-selected-row":"","\n "),children:[le&&t.jsx("td",{style:{textAlign:"center",fontWeight:"500"},children:(ge-1)*ke+n+de}),Z&&t.jsx("td",{className:"ihub-checkbox-cell",onClick:function(e){return e.stopPropagation()},children:t.jsx("input",{type:"checkbox",checked:st(e,n),onChange:function(t){return rt(e,t.target.checked,n)}})}),te&&ne&&t.jsx("td",{onClick:function(e){return at(r,e)},children:s?t.jsx(k.default,{}):t.jsx(C.default,{})}),i.map(function(n,r){var i,s,a;return t.jsx("td",{"data-label":_?n.header:void 0,children:n.tooltip&&"string"==typeof n.accessor?t.jsx("div",{className:"ihub-cell-tooltip","data-tooltip":String(null!==(i=e[n.accessor])&&void 0!==i?i:""),children:n.cell?n.cell(e):String(null!==(s=e[n.accessor])&&void 0!==s?s:"")}):n.cell?n.cell(e):"function"==typeof n.accessor?n.accessor(e):String(null!==(a=e[n.accessor])&&void 0!==a?a:"")},r)})]}),te&&ne&&s&&t.jsx("tr",{className:"ihub-expanded-row",children:t.jsx("td",{colSpan:i.length+(Z?1:0)+1+(le?1:0),children:t.jsx("div",{className:"ihub-row-details",children:ne(e)})})})]},r)})})]})}),Ze.visible&&Ze.row&&t.jsxs("div",{className:"ihub-context-menu",style:{top:Ze.y,left:Ze.x},children:[t.jsxs("div",{className:"ihub-context-menu-item",onClick:function(){Ze.row&&L&&L(Ze.row),$e(function(t){return e.objectSpread2(e.objectSpread2({},t),{},{visible:!1})})},children:[t.jsx(w.default,{}),"View"]}),t.jsxs("div",{className:"ihub-context-menu-item",onClick:function(){$e(function(t){return e.objectSpread2(e.objectSpread2({},t),{},{visible:!1})})},children:[t.jsx(S.default,{}),"Edit"]}),t.jsx("div",{className:"ihub-context-menu-separator"}),t.jsxs("div",{className:"ihub-context-menu-item",onClick:function(){$e(function(t){return e.objectSpread2(e.objectSpread2({},t),{},{visible:!1})})},children:[t.jsx(A.default,{}),"Delete"]})]}),T&&bt>1&&t.jsxs("div",{className:"ihub-table-pagination",children:[t.jsxs("div",{className:"ihub-pagination-info",children:["Showing"," ",Math.min((ge-1)*ke+1,ut.length)," ","to ",Math.min(ge*ke,ut.length)," of"," ",ut.length," entries"]}),t.jsxs("div",{className:"ihub-pagination-controls",children:[t.jsx("button",{className:"ihub-pagination-button",disabled:1===ge,onClick:function(){return Ne(1)},children:"«"}),t.jsx("button",{className:"ihub-pagination-button",disabled:1===ge,onClick:function(){return Ne(function(e){return Math.max(1,e-1)})},children:"‹"}),Array.from({length:Math.min(5,bt)},function(e,n){var r;return r=bt<=5||ge<=3?n+1:ge>=bt-2?bt-4+n:ge-2+n,t.jsx("button",{className:"ihub-pagination-button ".concat(ge===r?"ihub-active":""),onClick:function(){return Ne(Number(r))},children:r},r)}),t.jsx("button",{className:"ihub-pagination-button",disabled:ge===bt,onClick:function(){return Ne(function(e){return Math.min(bt,e+1)})},children:"›"}),t.jsx("button",{className:"ihub-pagination-button",disabled:ge===bt,onClick:function(){return Ne(bt)},children:"»"})]}),t.jsxs("div",{className:"ihub-rows-per-page",children:[t.jsx("span",{children:"Rows per page:"}),t.jsx("select",{value:ke,onChange:function(e){return we(Number(e.target.value))},className:"ihub-rows-select",children:R.map(function(e){return t.jsx("option",{value:e,children:e},e)})})]})]})]}):t.jsxs("div",{className:"ihub-data-list-container",children:[h&&t.jsx("h2",{children:h}),P&&t.jsx("div",{className:"ihub-data-controls ihub-mb-0",children:P}),t.jsx("div",{className:"ihub-empty-state",children:t.jsxs("div",{children:[d,t.jsx("p",{children:l})]})})]})};exports.IHubTable=O,exports.default=O;
2
2
  //# sourceMappingURL=IHubTable.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_rollupPluginBabelHelpers.js"),t=require("react/jsx-runtime"),r=require("react"),a=require("@mui/icons-material/FileDownloadOutlined"),n=require("@mui/icons-material/RefreshOutlined"),i=require("@mui/icons-material/InventoryOutlined"),s=require("@mui/icons-material/ExpandMoreOutlined"),c=require("@mui/icons-material/ExpandLessOutlined");require("../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js");var o=require("../../lib/helpFunction.js");require("../../lib/utils.js");var l=require("../../../../_virtual/lodash.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=u(r),h=u(a),b=u(n),p=u(i),f=u(s),m=u(c),g=r.forwardRef(function(a,n){var i=a.token,s=a.columns,c=a.defaultData,u=a.endpointPath,g=a.initialParams,x=void 0===g?{}:g,v=a.searchParams,j=a.dataAdapter,N=a.title,y=a.emptyStateMessage,P=void 0===y?"No data available":y,S=a.emptyStateIcon,C=void 0===S?t.jsx(p.default,{}):S,k=a.actions,w=a.showSearch,A=void 0===w||w,E=a.searchPlaceholder,R=void 0===E?"Search...":E,T=a.searchDebounceMs,O=void 0===T?1e3:T,q=a.enableSorting,H=void 0===q||q,M=a.enableExport,_=void 0!==M&&M,F=a.exportOptions,I=void 0===F?{csv:!0}:F,L=a.rowsPerPageOptions,D=void 0===L?[10,25,50,100]:L,G=a.defaultRowsPerPage,U=void 0===G?10:G,V=a.onRowClick,B=a.onFetchError,J=a.expandable,W=void 0!==J&&J,z=a.renderExpandedRow,K=a.keyExtractor,Q=void 0===K?function(e){return JSON.stringify(e)}:K,X=a.stickyHeader,Y=void 0!==X&&X,Z=a.maxHeight,$=a.hideHeaderOnMobile,ee=void 0!==$&&$,te=a.showRowNumbers,re=void 0!==te&&te,ae=a.rowNumberStartFrom,ne=void 0===ae?1:ae,ie=r.useRef(!0),se=r.useRef(null),ce=r.useState(c||[]),oe=e.slicedToArray(ce,2),le=oe[0],ue=oe[1],de=r.useState(!0),he=e.slicedToArray(de,2),be=he[0],pe=he[1],fe=r.useState(null),me=e.slicedToArray(fe,2),ge=me[0],xe=me[1],ve=r.useState({totalCount:0,currentPage:1,perPage:U,totalPages:0}),je=e.slicedToArray(ve,2),Ne=je[0],ye=je[1],Pe=r.useState(e.objectSpread2({page:1,limit:U},x)),Se=e.slicedToArray(Pe,2),Ce=Se[0],ke=Se[1],we=r.useState([]),Ae=e.slicedToArray(we,2),Ee=Ae[0],Re=Ae[1],Te=r.useState(x.search||""),Oe=e.slicedToArray(Te,2),qe=Oe[0],He=Oe[1],Me=r.useCallback(l.lodash.exports.debounce(function(t){ke(function(r){return e.objectSpread2(e.objectSpread2({},r),{},{search:t,page:1})})},O),[]),_e=(c||[]).length,Fe={data:c||[],pagination:{totalCount:_e,currentPage:1,perPage:10,totalPages:Math.ceil(_e/10)||1},links:{next:null,previous:null}},Ie=r.useCallback(function(){var t=e.asyncToGenerator(e.regenerator().m(function t(r){var a,n,s,c,l,d,h,b;return e.regenerator().w(function(t){for(;;)switch(t.p=t.n){case 0:if(pe(!0),t.p=1,u){t.n=2;break}return t.a(2,Fe);case 2:return a=new URLSearchParams({limit:r.limit.toString(),offset:((r.page-1)*r.limit).toString()}),r.search&&a.append("search",r.search),r.sort&&(n="desc"===r.direction?"-":"",a.append("ordering","".concat(n).concat(r.sort))),v&&Object.entries(v).forEach(function(t){var r=e.slicedToArray(t,2),n=r[0],i=r[1];null!=i&&""!==i&&a.append(n,String(i))}),s=o.reqOptions("GET",null,i),c="".concat(o.API_HOST_URL).concat(u,"?").concat(a.toString()),t.n=3,fetch(c,s);case 3:return l=t.v,t.n=4,l.json();case 4:if(d=t.v,l.ok){t.n=5;break}throw h=d.detail||d.error||"Failed to fetch data",new Error(h);case 5:return t.a(2,{data:d.results,pagination:{totalCount:d.count,currentPage:r.page,perPage:r.limit,totalPages:Math.ceil(d.count/r.limit)},links:{next:d.next,previous:d.previous}});case 6:throw t.p=6,b=t.v,console.error("Error fetching program courses:",b),b;case 7:return t.p=7,pe(!1),t.f(7);case 8:return t.a(2)}},t,null,[[1,6,7,8]])}));return function(e){return t.apply(this,arguments)}}(),[v]),Le=r.useCallback(function(e){var t=e.target.value;He(t),Me(t)},[Me]),De=r.useCallback(function(t){ke(function(r){return e.objectSpread2(e.objectSpread2({},r),{},{page:t})})},[]),Ge=r.useCallback(function(t){ke(function(r){return e.objectSpread2(e.objectSpread2({},r),{},{page:1,limit:t})})},[]),Ue=r.useCallback(function(t){if(H&&t.sortable&&"string"==typeof t.accessor){var r=t.accessor;ke(function(t){return t.sort===r?e.objectSpread2(e.objectSpread2({},t),{},{direction:"asc"===t.direction?"desc":"asc"}):e.objectSpread2(e.objectSpread2({},t),{},{sort:r,direction:"asc"})})}},[H]),Ve=r.useCallback(function(){ke(function(t){return e.objectSpread2({},t)})},[]);r.useImperativeHandle(n,function(){return{refresh:Ve}},[Ve]);var Be=r.useCallback(function(){var t=e.asyncToGenerator(e.regenerator().m(function t(r){var a,n,i,c,o,l,u,d,h,b,p;return e.regenerator().w(function(t){for(;;)switch(t.p=t.n){case 0:if(_){t.n=1;break}return t.a(2);case 1:return t.p=1,pe(!0),a=e.objectSpread2(e.objectSpread2({},Ce),{},{page:1,limit:1e3,export:r}),t.n=2,Ie(a);case 2:(n=t.v)&&(i=j?j(n).data:n.data,c=I.fileName||"table-export","csv"===r&&(o=[].concat(e.toConsumableArray(re?["#"]:[]),e.toConsumableArray(s.filter(function(e){return"string"==typeof e.accessor}).map(function(e){return e.header}))),l=i.map(function(t,r){return[].concat(e.toConsumableArray(re?[String(r+ne)]:[]),e.toConsumableArray(s.filter(function(e){return"string"==typeof e.accessor}).map(function(e){var r,a=e.accessor;return String(null!==(r=t[a])&&void 0!==r?r:"")}))).join(",")}),u=[o.join(",")].concat(e.toConsumableArray(l)).join("\n"),d=new Blob([u],{type:"text/csv;charset=utf-8;"}),h=document.createElement("a"),b=URL.createObjectURL(d),h.setAttribute("href",b),h.setAttribute("download","".concat(c,".csv")),h.style.visibility="hidden",document.body.appendChild(h),h.click(),document.body.removeChild(h))),t.n=4;break;case 3:t.p=3,p=t.v,console.error("Export error:",p),B&&B(p);case 4:return t.p=4,pe(!1),t.f(4);case 5:return t.a(2)}},t,null,[[1,3,4,5]])}));return function(e){return t.apply(this,arguments)}}(),[s,Ce,_,I,j,B]),Je=r.useCallback(function(t,r){r.stopPropagation(),Re(function(r){return r.includes(t)?r.filter(function(e){return e!==t}):[].concat(e.toConsumableArray(r),[t])})},[]);return r.useEffect(function(){var t=!0,r=function(){var r=e.asyncToGenerator(e.regenerator().m(function r(){var a,n,i;return e.regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,pe(!0),e.n=1,Ie(Ce);case 1:a=e.v,t&&(j?(n=j(a),ue(n.data),n.pagination&&ye(n.pagination)):a&&(ue(a.data),a.pagination&&ye(a.pagination)),xe(null)),e.n=3;break;case 2:e.p=2,i=e.v,console.error("Error fetching data:",i),t&&(xe(i),B&&B(i));case 3:return e.p=3,t&&(pe(!1),ie.current=!1),e.f(3);case 4:return e.a(2)}},r,null,[[0,2,3,4]])}));return function(){return r.apply(this,arguments)}}();return r(),function(){t=!1}},[Ce,j,B]),r.useEffect(function(){v&&!ie.current&&ke(function(t){return e.objectSpread2({},t)})},[v]),be&&ie.current?t.jsxs("div",{className:"ihub-data-list-container",children:[N&&t.jsx("h2",{children:N}),t.jsx("div",{className:"ihub-loading-state",children:t.jsx("p",{children:"Loading data..."})})]}):ge&&!be&&0===(le||[]).length?t.jsxs("div",{className:"ihub-data-list-container",children:[N&&t.jsx("h2",{children:N}),t.jsxs("div",{className:"ihub-error-state",children:[t.jsx("p",{children:ge.message||"Error loading data. Please try again."}),t.jsx("button",{className:"ihub-important-btn",onClick:Ve,children:"Retry"})]})]}):t.jsxs("div",{className:"ihub-data-list-container",ref:se,children:[(N||k||A||_)&&t.jsxs("div",{className:"ihub-data-list-header ihub-table-header ihub-p-0",children:[t.jsx("div",{children:N&&t.jsx("h2",{children:N})}),t.jsxs("div",{className:"ihub-table-controls",children:[A&&t.jsx("div",{className:"ihub-table-search",children:t.jsxs("div",{className:"ihub-search-input-wrapper",children:[t.jsx("input",{type:"text",placeholder:R,value:qe,onChange:Le,className:"ihub-search-input"}),be&&t.jsx("div",{className:"ihub-search-loading-indicator",children:t.jsx("span",{className:"ihub-loading-dot"})})]})}),_&&t.jsxs("div",{className:"ihub-export-buttons",children:[I.csv&&t.jsxs("button",{className:"ihub-export-button ihub-export-csv",onClick:function(){return Be("csv")},disabled:be,children:[t.jsx(h.default,{}),"CSV"]}),I.excel&&t.jsxs("button",{className:"ihub-export-button ihub-export-excel",onClick:function(){return Be("excel")},disabled:be,children:[t.jsx(h.default,{}),"Excel"]}),I.pdf&&t.jsxs("button",{className:"ihub-export-button ihub-export-pdf",onClick:function(){return Be("pdf")},disabled:be,children:[t.jsx(h.default,{}),"PDF"]})]}),t.jsxs("button",{className:"ihub-refresh-button",onClick:Ve,disabled:be,children:[t.jsx(b.default,{}),"Refresh"]}),k&&t.jsx("div",{className:"ihub-data-controls ihub-mb-0",children:k})]})]}),be&&!ie.current&&t.jsx("div",{className:"ihub-table-loading-overlay",children:t.jsx("div",{className:"ihub-loading-spinner"})}),t.jsxs("div",{className:"ihub-scroll-container ".concat(Y?"ihub-sticky-header":""),style:Z?{maxHeight:Z}:void 0,children:[t.jsxs("table",{className:"ihub-table ihub-scroll-container",children:[t.jsx("thead",{className:ee?"ihub-hide-on-mobile":"",children:t.jsxs("tr",{children:[re&&t.jsx("th",{style:{width:"60px",textAlign:"center"},children:"#"}),W&&z&&t.jsx("th",{style:{width:"40px"}}),s.map(function(e,r){return t.jsx("th",{className:"".concat(e.sortable&&H?"ihub-sortable-column":""," ").concat(Ce.sort===e.accessor?"ihub-sorted-".concat(Ce.direction):""),style:e.width?{width:e.width}:void 0,onClick:function(){return e.sortable&&H?Ue(e):void 0},children:t.jsxs("div",{className:"ihub-column-header",children:[t.jsx("span",{children:e.header}),e.sortable&&H&&t.jsx("span",{className:"ihub-sort-icon",children:Ce.sort===e.accessor&&"asc"===Ce.direction?"▲":Ce.sort===e.accessor&&"desc"===Ce.direction?"▼":"⇅"})]})},r)})]})}),be||0!==(le||[]).length?t.jsx("tbody",{children:le.map(function(e,r){var a=Q(e),n=Ee.includes(a);return t.jsxs(d.default.Fragment,{children:[t.jsxs("tr",{onClick:function(){return V&&V(e)},className:V?"ihub-clickable-row":"",children:[re&&t.jsx("td",{style:{textAlign:"center",fontWeight:"500"},children:(Ne.currentPage-1)*Ne.perPage+r+ne}),W&&z&&t.jsx("td",{onClick:function(e){return Je(a,e)},children:n?t.jsx(m.default,{}):t.jsx(f.default,{})}),s.map(function(r,a){return t.jsx("td",{"data-label":ee?r.header:void 0,children:r.tooltip&&"string"==typeof r.accessor?t.jsx("div",{className:"ihub-cell-tooltip","data-tooltip":String(o.getNestedValue(e,r.accessor)),children:r.cell?r.cell(e):o.getNestedValue(e,r.accessor)}):r.cell?r.cell(e):"function"==typeof r.accessor?r.accessor(e):o.getNestedValue(e,r.accessor)},a)})]}),W&&z&&n&&t.jsx("tr",{className:"ihub-expanded-row",children:t.jsx("td",{colSpan:(s||[]).length+1+(re?1:0),children:t.jsx("div",{className:"ihub-row-details",children:z(e)})})})]},a)})}):""]}),be||0!==(le||[]).length?"":t.jsxs("div",{className:"ihub-data-list-container",children:[k&&t.jsx("div",{className:"ihub-data-controls ihub-mb-0",children:k}),t.jsx("div",{className:"ihub-empty-state",children:t.jsxs("div",{children:[C,t.jsx("p",{children:P})]})})]})]}),Ne&&Ne.totalPages>1&&t.jsxs("div",{className:"ihub-table-pagination",children:[t.jsxs("div",{className:"ihub-pagination-info",children:["Showing ",(Ne.currentPage-1)*Ne.perPage+1," to"," ",Math.min(Ne.currentPage*Ne.perPage,Ne.totalCount)," ","of ",Ne.totalCount," entries"]}),t.jsxs("div",{className:"ihub-pagination-controls",children:[t.jsx("button",{className:"ihub-pagination-button",disabled:1===Ne.currentPage||be,onClick:function(){return De(1)},children:"«"}),t.jsx("button",{className:"ihub-pagination-button",disabled:1===Ne.currentPage||be,onClick:function(){return De(Ne.currentPage-1)},children:"‹"}),Array.from({length:Math.min(5,Ne.totalPages)},function(e,r){var a;return a=Ne.totalPages<=5||Ne.currentPage<=3?r+1:Ne.currentPage>=Ne.totalPages-2?Ne.totalPages-4+r:Ne.currentPage-2+r,t.jsx("button",{className:"ihub-pagination-button ".concat(Ne.currentPage===a?"ihub-active":""),onClick:function(){return De(Number(a))},disabled:be,children:a},a)}),t.jsx("button",{className:"ihub-pagination-button",disabled:Ne.currentPage===Ne.totalPages||be,onClick:function(){return De(Ne.currentPage+1)},children:"›"}),t.jsx("button",{className:"ihub-pagination-button",disabled:Ne.currentPage===Ne.totalPages||be,onClick:function(){return De(Ne.totalPages)},children:"»"})]}),t.jsxs("div",{className:"ihub-rows-per-page",children:[t.jsx("span",{children:"Rows per page:"}),t.jsx("select",{value:Ne.perPage,onChange:function(e){return Ge(Number(e.target.value))},className:"ihub-rows-select",disabled:be,children:D.map(function(e){return t.jsx("option",{value:e,children:e},e)})})]})]})]})});g.displayName="IHubTableServer",exports.IHubTableServer=g,exports.default=g;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_rollupPluginBabelHelpers.js"),a=require("react/jsx-runtime"),t=require("react"),r=require("@mui/icons-material/FileDownloadOutlined"),n=require("@mui/icons-material/RefreshOutlined"),i=require("@mui/icons-material/InventoryOutlined"),s=require("@mui/icons-material/ExpandMoreOutlined"),o=require("@mui/icons-material/ExpandLessOutlined");require("../../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js");var c=require("../../lib/helpFunction.js"),l=require("../../lib/modals/modals.js");require("../../lib/utils.js"),require("../../lib/phoneUtils.js");var u=require("./utils/tableExport.js"),d=require("../../../../_virtual/lodash.js");function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=h(t),b=h(r),f=h(n),g=h(i),m=h(s),x=h(o),v=t.forwardRef(function(r,n){var i=r.token,s=r.columns,o=r.defaultData,h=r.endpointPath,v=r.initialParams,j=void 0===v?{}:v,N=r.searchParams,P=r.dataAdapter,y=r.title,S=r.emptyStateMessage,k=void 0===S?"No data available":S,w=r.emptyStateIcon,C=void 0===w?a.jsx(g.default,{}):w,T=r.actions,E=r.showSearch,q=void 0===E||E,R=r.searchPlaceholder,A=void 0===R?"Search...":R,O=r.searchDebounceMs,F=void 0===O?1e3:O,M=r.enableSorting,H=void 0===M||M,_=r.enableExport,I=void 0!==_&&_,D=r.exportOptions,G=void 0===D?{csv:!0}:D,L=r.rowsPerPageOptions,V=void 0===L?[10,25,50,100]:L,U=r.defaultRowsPerPage,z=void 0===U?10:U,B=r.onRowClick,J=r.onFetchError,W=r.expandable,K=void 0!==W&&W,Q=r.renderExpandedRow,X=r.keyExtractor,Y=void 0===X?function(e){return JSON.stringify(e)}:X,Z=r.stickyHeader,$=void 0!==Z&&Z,ee=r.maxHeight,ae=r.hideHeaderOnMobile,te=void 0!==ae&&ae,re=r.showRowNumbers,ne=void 0!==re&&re,ie=r.rowNumberStartFrom,se=void 0===ie?1:ie,oe=t.useRef(!0),ce=t.useRef(null),le=t.useState(o||[]),ue=e.slicedToArray(le,2),de=ue[0],he=ue[1],pe=t.useState(!0),be=e.slicedToArray(pe,2),fe=be[0],ge=be[1],me=t.useState(null),xe=e.slicedToArray(me,2),ve=xe[0],je=xe[1],Ne=t.useState({totalCount:0,currentPage:1,perPage:z,totalPages:0}),Pe=e.slicedToArray(Ne,2),ye=Pe[0],Se=Pe[1],ke=t.useState(e.objectSpread2({page:1,limit:z},j)),we=e.slicedToArray(ke,2),Ce=we[0],Te=we[1],Ee=t.useState([]),qe=e.slicedToArray(Ee,2),Re=qe[0],Ae=qe[1],Oe=t.useState(j.search||""),Fe=e.slicedToArray(Oe,2),Me=Fe[0],He=Fe[1],_e=t.useCallback(d.lodash.exports.debounce(function(a){Te(function(t){return e.objectSpread2(e.objectSpread2({},t),{},{search:a,page:1})})},F),[]),Ie=(o||[]).length,De={data:o||[],pagination:{totalCount:Ie,currentPage:1,perPage:10,totalPages:Math.ceil(Ie/10)||1},links:{next:null,previous:null}},Ge=t.useCallback(function(){var a=e.asyncToGenerator(e.regenerator().m(function a(t){var r,n,s,o,l,u,d,p;return e.regenerator().w(function(a){for(;;)switch(a.p=a.n){case 0:if(ge(!0),a.p=1,h){a.n=2;break}return a.a(2,De);case 2:return r=new URLSearchParams({limit:t.limit.toString(),offset:((t.page-1)*t.limit).toString()}),t.search&&r.append("search",t.search),t.sort&&(n="desc"===t.direction?"-":"",r.append("ordering","".concat(n).concat(t.sort))),N&&Object.entries(N).forEach(function(a){var t=e.slicedToArray(a,2),n=t[0],i=t[1];null!=i&&""!==i&&r.append(n,String(i))}),s=c.reqOptions("GET",null,i),o="".concat(c.API_HOST_URL).concat(h,"?").concat(r.toString()),a.n=3,fetch(o,s);case 3:return l=a.v,a.n=4,l.json();case 4:if(u=a.v,l.ok){a.n=5;break}throw d=u.detail||u.error||"Failed to fetch data",new Error(d);case 5:return a.a(2,{data:u.results,pagination:{totalCount:u.count,currentPage:t.page,perPage:t.limit,totalPages:Math.ceil(u.count/t.limit)},links:{next:u.next,previous:u.previous}});case 6:throw a.p=6,p=a.v,console.error("Error fetching program courses:",p),p;case 7:return a.p=7,ge(!1),a.f(7);case 8:return a.a(2)}},a,null,[[1,6,7,8]])}));return function(e){return a.apply(this,arguments)}}(),[N]),Le=t.useCallback(function(e){var a=e.target.value;He(a),_e(a)},[_e]),Ve=t.useCallback(function(a){Te(function(t){return e.objectSpread2(e.objectSpread2({},t),{},{page:a})})},[]),Ue=t.useCallback(function(a){Te(function(t){return e.objectSpread2(e.objectSpread2({},t),{},{page:1,limit:a})})},[]),ze=t.useCallback(function(a){if(H&&a.sortable&&"string"==typeof a.accessor){var t=a.accessor;Te(function(a){return a.sort===t?e.objectSpread2(e.objectSpread2({},a),{},{direction:"asc"===a.direction?"desc":"asc"}):e.objectSpread2(e.objectSpread2({},a),{},{sort:t,direction:"asc"})})}},[H]),Be=t.useCallback(function(){Te(function(a){return e.objectSpread2({},a)})},[]);t.useImperativeHandle(n,function(){return{refresh:Be}},[Be]);var Je=t.useCallback(function(){var a=e.asyncToGenerator(e.regenerator().m(function a(t,r){var n,i,s,o,c,l,u;return e.regenerator().w(function(a){for(;;)switch(a.n){case 0:n=[],i=1,s=1/0;case 1:if(!(n.length<Math.min(s,r))){a.n=4;break}return a.n=2,Ge(e.objectSpread2(e.objectSpread2({},Ce),{},{page:i,limit:t}));case 2:if(c=a.v,l=P?P(c):c,u=(null==l?void 0:l.data)||[],n.push.apply(n,e.toConsumableArray(u)),void 0!==(null==l||null===(o=l.pagination)||void 0===o?void 0:o.totalCount)&&(s=l.pagination.totalCount),u.length===t){a.n=3;break}return a.a(3,4);case 3:i+=1,a.n=1;break;case 4:return a.a(2,n.slice(0,r))}},a)}));return function(e,t){return a.apply(this,arguments)}}(),[Ce,P,Ge]),We=t.useCallback(function(){var a=e.asyncToGenerator(e.regenerator().m(function a(t){var r,n,i,o,c;return e.regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(I){e.n=1;break}return e.a(2);case 1:return r=u.resolveExportOptions(G),n=r.batchSize,i=r.maxRows,e.p=2,ge(!0),e.n=3,Je(n,i);case 3:if((o=e.v).length){e.n=4;break}return l.openToast("There is no data to export.",400),e.a(2);case 4:return e.n=5,u.exportTableData({data:o,columns:s,format:t,fileName:r.fileName,title:y,showRowNumbers:ne,rowNumberStartFrom:se,fields:r.fields,allFields:r.allFields});case 5:o.length>=i&&l.openToast("Export capped at ".concat(i," rows. Increase exportOptions.maxRows for more."),400),e.n=7;break;case 6:e.p=6,c=e.v,console.error("Export error:",c),l.openToast(c instanceof Error?c.message:"Export failed. Try again.",400),J&&J(c);case 7:return e.p=7,ge(!1),e.f(7);case 8:return e.a(2)}},a,null,[[2,6,7,8]])}));return function(e){return a.apply(this,arguments)}}(),[s,I,G,Je,J,se,ne,y]),Ke=t.useCallback(function(a,t){t.stopPropagation(),Ae(function(t){return t.includes(a)?t.filter(function(e){return e!==a}):[].concat(e.toConsumableArray(t),[a])})},[]);return t.useEffect(function(){var a=!0,t=function(){var t=e.asyncToGenerator(e.regenerator().m(function t(){var r,n,i;return e.regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:return e.p=0,ge(!0),e.n=1,Ge(Ce);case 1:r=e.v,a&&(P?(n=P(r),he(n.data),n.pagination&&Se(n.pagination)):r&&(he(r.data),r.pagination&&Se(r.pagination)),je(null)),e.n=3;break;case 2:e.p=2,i=e.v,console.error("Error fetching data:",i),a&&(je(i),J&&J(i));case 3:return e.p=3,a&&(ge(!1),oe.current=!1),e.f(3);case 4:return e.a(2)}},t,null,[[0,2,3,4]])}));return function(){return t.apply(this,arguments)}}();return t(),function(){a=!1}},[Ce,P,J]),t.useEffect(function(){N&&!oe.current&&Te(function(a){return e.objectSpread2({},a)})},[N]),fe&&oe.current?a.jsxs("div",{className:"ihub-data-list-container",children:[y&&a.jsx("h2",{children:y}),a.jsx("div",{className:"ihub-loading-state",children:a.jsx("p",{children:"Loading data..."})})]}):ve&&!fe&&0===(de||[]).length?a.jsxs("div",{className:"ihub-data-list-container",children:[y&&a.jsx("h2",{children:y}),a.jsxs("div",{className:"ihub-error-state",children:[a.jsx("p",{children:ve.message||"Error loading data. Please try again."}),a.jsx("button",{className:"ihub-important-btn",onClick:Be,children:"Retry"})]})]}):a.jsxs("div",{className:"ihub-data-list-container",ref:ce,children:[(y||T||q||I)&&a.jsxs("div",{className:"ihub-data-list-header ihub-table-header ihub-p-0",children:[a.jsx("div",{children:y&&a.jsx("h2",{children:y})}),a.jsxs("div",{className:"ihub-table-controls",children:[q&&a.jsx("div",{className:"ihub-table-search",children:a.jsxs("div",{className:"ihub-search-input-wrapper",children:[a.jsx("input",{type:"text",placeholder:A,value:Me,onChange:Le,className:"ihub-search-input"}),fe&&a.jsx("div",{className:"ihub-search-loading-indicator",children:a.jsx("span",{className:"ihub-loading-dot"})})]})}),I&&a.jsxs("div",{className:"ihub-export-buttons",children:[G.csv&&a.jsxs("button",{className:"ihub-export-button ihub-export-csv",onClick:function(){return We("csv")},disabled:fe,children:[a.jsx(b.default,{}),"CSV"]}),G.excel&&a.jsxs("button",{className:"ihub-export-button ihub-export-excel",onClick:function(){return We("excel")},disabled:fe,children:[a.jsx(b.default,{}),"Excel"]}),G.pdf&&a.jsxs("button",{className:"ihub-export-button ihub-export-pdf",onClick:function(){return We("pdf")},disabled:fe,children:[a.jsx(b.default,{}),"PDF"]})]}),a.jsxs("button",{className:"ihub-refresh-button",onClick:Be,disabled:fe,children:[a.jsx(f.default,{}),"Refresh"]}),T&&a.jsx("div",{className:"ihub-data-controls ihub-mb-0",children:T})]})]}),fe&&!oe.current&&a.jsx("div",{className:"ihub-table-loading-overlay",children:a.jsx("div",{className:"ihub-loading-spinner"})}),a.jsxs("div",{className:"ihub-scroll-container ".concat($?"ihub-sticky-header":""),style:ee?{maxHeight:ee}:void 0,children:[a.jsxs("table",{className:"ihub-table ihub-scroll-container",children:[a.jsx("thead",{className:te?"ihub-hide-on-mobile":"",children:a.jsxs("tr",{children:[ne&&a.jsx("th",{style:{width:"60px",textAlign:"center"},children:"#"}),K&&Q&&a.jsx("th",{style:{width:"40px"}}),s.map(function(e,t){return a.jsx("th",{className:"".concat(e.sortable&&H?"ihub-sortable-column":""," ").concat(Ce.sort===e.accessor?"ihub-sorted-".concat(Ce.direction):""),style:e.width?{width:e.width}:void 0,onClick:function(){return e.sortable&&H?ze(e):void 0},children:a.jsxs("div",{className:"ihub-column-header",children:[a.jsx("span",{children:e.header}),e.sortable&&H&&a.jsx("span",{className:"ihub-sort-icon",children:Ce.sort===e.accessor&&"asc"===Ce.direction?"▲":Ce.sort===e.accessor&&"desc"===Ce.direction?"▼":"⇅"})]})},t)})]})}),fe||0!==(de||[]).length?a.jsx("tbody",{children:de.map(function(e,t){var r=Y(e),n=Re.includes(r);return a.jsxs(p.default.Fragment,{children:[a.jsxs("tr",{onClick:function(){return B&&B(e)},className:B?"ihub-clickable-row":"",children:[ne&&a.jsx("td",{style:{textAlign:"center",fontWeight:"500"},children:(ye.currentPage-1)*ye.perPage+t+se}),K&&Q&&a.jsx("td",{onClick:function(e){return Ke(r,e)},children:n?a.jsx(x.default,{}):a.jsx(m.default,{})}),s.map(function(t,r){return a.jsx("td",{"data-label":te?t.header:void 0,children:t.tooltip&&"string"==typeof t.accessor?a.jsx("div",{className:"ihub-cell-tooltip","data-tooltip":String(c.getNestedValue(e,t.accessor)),children:t.cell?t.cell(e):c.getNestedValue(e,t.accessor)}):t.cell?t.cell(e):"function"==typeof t.accessor?t.accessor(e):c.getNestedValue(e,t.accessor)},r)})]}),K&&Q&&n&&a.jsx("tr",{className:"ihub-expanded-row",children:a.jsx("td",{colSpan:(s||[]).length+1+(ne?1:0),children:a.jsx("div",{className:"ihub-row-details",children:Q(e)})})})]},r)})}):""]}),fe||0!==(de||[]).length?"":a.jsxs("div",{className:"ihub-data-list-container",children:[T&&a.jsx("div",{className:"ihub-data-controls ihub-mb-0",children:T}),a.jsx("div",{className:"ihub-empty-state",children:a.jsxs("div",{children:[C,a.jsx("p",{children:k})]})})]})]}),ye&&ye.totalPages>1&&a.jsxs("div",{className:"ihub-table-pagination",children:[a.jsxs("div",{className:"ihub-pagination-info",children:["Showing ",(ye.currentPage-1)*ye.perPage+1," to"," ",Math.min(ye.currentPage*ye.perPage,ye.totalCount)," ","of ",ye.totalCount," entries"]}),a.jsxs("div",{className:"ihub-pagination-controls",children:[a.jsx("button",{className:"ihub-pagination-button",disabled:1===ye.currentPage||fe,onClick:function(){return Ve(1)},children:"«"}),a.jsx("button",{className:"ihub-pagination-button",disabled:1===ye.currentPage||fe,onClick:function(){return Ve(ye.currentPage-1)},children:"‹"}),Array.from({length:Math.min(5,ye.totalPages)},function(e,t){var r;return r=ye.totalPages<=5||ye.currentPage<=3?t+1:ye.currentPage>=ye.totalPages-2?ye.totalPages-4+t:ye.currentPage-2+t,a.jsx("button",{className:"ihub-pagination-button ".concat(ye.currentPage===r?"ihub-active":""),onClick:function(){return Ve(Number(r))},disabled:fe,children:r},r)}),a.jsx("button",{className:"ihub-pagination-button",disabled:ye.currentPage===ye.totalPages||fe,onClick:function(){return Ve(ye.currentPage+1)},children:"›"}),a.jsx("button",{className:"ihub-pagination-button",disabled:ye.currentPage===ye.totalPages||fe,onClick:function(){return Ve(ye.totalPages)},children:"»"})]}),a.jsxs("div",{className:"ihub-rows-per-page",children:[a.jsx("span",{children:"Rows per page:"}),a.jsx("select",{value:ye.perPage,onChange:function(e){return Ue(Number(e.target.value))},className:"ihub-rows-select",disabled:fe,children:V.map(function(e){return a.jsx("option",{value:e,children:e},e)})})]})]})]})});v.displayName="IHubTableServer",exports.IHubTableServer=v,exports.default=v;
2
2
  //# sourceMappingURL=IHubTableServer.js.map
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../_virtual/_rollupPluginBabelHelpers.js"),r=require("react"),t=require("../../../lib/helpFunction.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=n(r),o=["title","name","full_name","label","display_name","username","email","value","slug","id"],u=function(e){if(null==e||"boolean"==typeof e)return"";if("string"==typeof e||"number"==typeof e)return String(e);if(Array.isArray(e))return e.map(u).filter(function(e){return""!==e}).join(" ").trim();if(i.default.isValidElement(e)){var r=e.props,t=u(null==r?void 0:r.children);if(t)return t;if("string"==typeof(null==r?void 0:r.title))return r.title;if("string"==typeof(null==r?void 0:r.alt))return r.alt;if(void 0!==(null==r?void 0:r.value)&&null!==(null==r?void 0:r.value))return String(r.value)}return""},l=function(r){if(null==r)return"";if("string"==typeof r||"number"==typeof r||"boolean"==typeof r||"bigint"==typeof r)return String(r);if(r instanceof Date)return Number.isNaN(r.getTime())?"":r.toISOString();if(Array.isArray(r))return r.map(l).filter(function(e){return""!==e}).join(" | ");if(i.default.isValidElement(r))return u(r);if("object"===e.typeof(r)){for(var t=r,n=0,f=o;n<f.length;n++){var a=t[f[n]];if("string"==typeof a||"number"==typeof a||"boolean"==typeof a)return String(a)}try{return JSON.stringify(t)}catch(e){return""}}return""},f=function(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object.keys(r||{}).forEach(function(i){var o=t?"".concat(t,".").concat(i):i,u=r[i];if(Array.isArray(u))return u.some(function(r){return"object"===e.typeof(r)&&null!==r})?void(n[o]=u.map(function(e){return l(e)}).filter(function(e){return""!==e}).join(" | ")):void(n[o]=l(u));!u||"object"!==e.typeof(u)||u instanceof Date?n[o]=l(u):f(u,o,n)}),n};exports.buildAllFieldsMatrix=function(e){var r=e.map(function(e){return f(e)}),t=[];r.forEach(function(e){Object.keys(e).forEach(function(e){t.includes(e)||t.push(e)})});var n=r.map(function(e){return t.map(function(r){var t;return null!==(t=e[r])&&void 0!==t?t:""})});return{headers:t,rows:n}},exports.extractTextFromNode=u,exports.flattenRecord=f,exports.getExportableColumns=function(e){return e.filter(function(e){return!1!==e.exportable})},exports.resolveColumnExportValue=function(e,r,n){if("function"==typeof r.exportValue)return l(r.exportValue(e,n));if("string"==typeof r.accessor){var i=t.getNestedValue(e,r.accessor),o=l(i);return""!==o?o:r.cell?l(r.cell(e)):""}if("function"==typeof r.accessor){var u=r.accessor(e,n),f=l(u);if(""!==f)return f}return r.cell?l(r.cell(e)):""},exports.stringifyExportValue=l;
2
+ //# sourceMappingURL=exportValues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exportValues.js","sources":["../../../../../../src/components/ui/tables/utils/exportValues.ts"],"sourcesContent":["import React from \"react\";\nimport { TableColumnType } from \"../../../../types\";\nimport { getNestedValue } from \"../../../lib/helpFunction\";\n\n/**\n * Keys that are preferred, in order, when an object needs to be reduced to a\n * single readable label (e.g. `groups: [{title: \"Students\", ...}]` -> \"Students\").\n */\nconst LABEL_KEYS = [\n \"title\",\n \"name\",\n \"full_name\",\n \"label\",\n \"display_name\",\n \"username\",\n \"email\",\n \"value\",\n \"slug\",\n \"id\",\n];\n\n/** Pull readable text out of a React node so `cell`/function accessors can be exported. */\nexport const extractTextFromNode = (node: React.ReactNode): string => {\n if (node === null || node === undefined || typeof node === \"boolean\") {\n return \"\";\n }\n\n if (typeof node === \"string\" || typeof node === \"number\") {\n return String(node);\n }\n\n if (Array.isArray(node)) {\n return node\n .map(extractTextFromNode)\n .filter((text) => text !== \"\")\n .join(\" \")\n .trim();\n }\n\n if (React.isValidElement(node)) {\n const props = node.props as {\n children?: React.ReactNode;\n title?: string;\n alt?: string;\n value?: unknown;\n };\n\n const childText = extractTextFromNode(props?.children);\n if (childText) return childText;\n\n if (typeof props?.title === \"string\") return props.title;\n if (typeof props?.alt === \"string\") return props.alt;\n if (props?.value !== undefined && props?.value !== null) {\n return String(props.value);\n }\n }\n\n return \"\";\n};\n\n/**\n * Flatten any cell value into a single export-safe string.\n * Arrays become \"a | b | c\", objects fall back to a label key then JSON.\n */\nexport const stringifyExportValue = (value: unknown): string => {\n if (value === null || value === undefined) return \"\";\n\n if (\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\" ||\n typeof value === \"bigint\"\n ) {\n return String(value);\n }\n\n if (value instanceof Date) {\n return Number.isNaN(value.getTime()) ? \"\" : value.toISOString();\n }\n\n if (Array.isArray(value)) {\n return value\n .map(stringifyExportValue)\n .filter((text) => text !== \"\")\n .join(\" | \");\n }\n\n if (React.isValidElement(value)) {\n return extractTextFromNode(value);\n }\n\n if (typeof value === \"object\") {\n const record = value as Record<string, unknown>;\n\n for (const key of LABEL_KEYS) {\n const candidate = record[key];\n if (\n typeof candidate === \"string\" ||\n typeof candidate === \"number\" ||\n typeof candidate === \"boolean\"\n ) {\n return String(candidate);\n }\n }\n\n try {\n return JSON.stringify(record);\n } catch {\n return \"\";\n }\n }\n\n return \"\";\n};\n\n/**\n * Resolve the export value for a single column/row pair.\n *\n * Resolution order:\n * 1. `column.exportValue` — explicit, always wins.\n * 2. String accessor — nested lookup (`user.email` works), falling back to\n * `cell` when the raw value is empty.\n * 3. Function accessor — invoked, then flattened (React nodes become text).\n * 4. `cell` — invoked, then flattened.\n */\nexport const resolveColumnExportValue = <T,>(\n row: T,\n column: TableColumnType<T>,\n index: number\n): string => {\n if (typeof column.exportValue === \"function\") {\n return stringifyExportValue(column.exportValue(row, index));\n }\n\n if (typeof column.accessor === \"string\") {\n const raw = getNestedValue(row, column.accessor);\n const text = stringifyExportValue(raw);\n if (text !== \"\") return text;\n\n return column.cell ? stringifyExportValue(column.cell(row)) : \"\";\n }\n\n if (typeof column.accessor === \"function\") {\n const rendered = column.accessor(row, index);\n const text = stringifyExportValue(rendered);\n if (text !== \"\") return text;\n }\n\n return column.cell ? stringifyExportValue(column.cell(row)) : \"\";\n};\n\n/** Columns that should appear in an export (anything not opted out via `exportable: false`). */\nexport const getExportableColumns = <T,>(\n columns: TableColumnType<T>[]\n): TableColumnType<T>[] => columns.filter((column) => column.exportable !== false);\n\n/**\n * Flatten a raw record into `{ header: value }` pairs covering every leaf field,\n * used when `exportOptions.allFields` is enabled so nothing in the API payload is lost.\n */\nexport const flattenRecord = (\n record: Record<string, any>,\n parentKey = \"\",\n accumulator: Record<string, string> = {}\n): Record<string, string> => {\n Object.keys(record || {}).forEach((key) => {\n const nextKey = parentKey ? `${parentKey}.${key}` : key;\n const value = record[key];\n\n if (Array.isArray(value)) {\n const hasObjects = value.some(\n (item) => typeof item === \"object\" && item !== null\n );\n\n if (!hasObjects) {\n accumulator[nextKey] = stringifyExportValue(value);\n return;\n }\n\n accumulator[nextKey] = value\n .map((item) => stringifyExportValue(item))\n .filter((text) => text !== \"\")\n .join(\" | \");\n return;\n }\n\n if (value && typeof value === \"object\" && !(value instanceof Date)) {\n flattenRecord(value as Record<string, any>, nextKey, accumulator);\n return;\n }\n\n accumulator[nextKey] = stringifyExportValue(value);\n });\n\n return accumulator;\n};\n\n/** Build headers + rows from every leaf field across the dataset (union of keys, stable order). */\nexport const buildAllFieldsMatrix = <T,>(\n data: T[]\n): { headers: string[]; rows: string[][] } => {\n const flattened = data.map((row) =>\n flattenRecord(row as Record<string, any>)\n );\n\n const headers: string[] = [];\n flattened.forEach((row) => {\n Object.keys(row).forEach((key) => {\n if (!headers.includes(key)) headers.push(key);\n });\n });\n\n const rows = flattened.map((row) => headers.map((header) => row[header] ?? \"\"));\n\n return { headers, rows };\n};\n"],"names":["LABEL_KEYS","extractTextFromNode","node","String","Array","isArray","map","filter","text","join","trim","React","isValidElement","props","childText","children","title","alt","undefined","value","stringifyExportValue","Date","Number","isNaN","getTime","toISOString","_typeof","record","_i","_LABEL_KEYS","length","candidate","JSON","stringify","_unused","flattenRecord","parentKey","arguments","accumulator","Object","keys","forEach","key","nextKey","concat","some","item","data","flattened","row","headers","includes","push","rows","header","_row$header","columns","column","exportable","index","exportValue","accessor","raw","getNestedValue","cell","rendered"],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../_virtual/_rollupPluginBabelHelpers.js");function t(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var n=function(e,t){var n=URL.createObjectURL(e),r=document.createElement("a");r.setAttribute("href",n),r.setAttribute("download",t),r.style.visibility="hidden",document.body.appendChild(r),r.click(),document.body.removeChild(r),setTimeout(function(){return URL.revokeObjectURL(n)},1e3)},r=function(e){var t=null!=e?e:"",n=!(""!==t&&!Number.isNaN(Number(t)))&&/^[=+\-@\t\r]/.test(t)?"'".concat(t):t;return/[",\n\r]/.test(n)||n!==n.trim()?'"'.concat(n.replace(/"/g,'""'),'"'):n},o=function(t,n){var o=[t.map(r).join(",")].concat(e.toConsumableArray(n.map(function(e){return e.map(r).join(",")})));return"\ufeff".concat(o.join("\r\n"))},a=function(){var t=e.asyncToGenerator(e.regenerator().m(function t(r,o,a){var c,s,i,u,l,p,f,d=arguments;return e.regenerator().w(function(t){for(;;)switch(t.p=t.n){case 0:return c=d.length>3&&void 0!==d[3]?d[3]:"Sheet1",t.p=1,t.n=2,Promise.resolve().then(function(){return require("../../../../../node_modules/.pnpm/xlsx@https___cdn.sheetjs.com_xlsx-0.20.3_xlsx-0.20.3.tgz/node_modules/xlsx/xlsx.mjs.js")});case 2:s=t.v,t.n=4;break;case 3:throw t.p=3,t.v,new Error("Excel export requires the `xlsx` package. Install it with `npm install xlsx`.");case 4:(i=s.utils.aoa_to_sheet([r].concat(e.toConsumableArray(o))))["!cols"]=r.map(function(e,t){var n=o.reduce(function(e,n){return Math.max(e,(n[t]||"").length)},e.length);return{wch:Math.min(Math.max(n+2,10),60)}}),u=s.utils.book_new(),l=c.replace(/[[\]:*?/\\]/g,"").slice(0,31)||"Sheet1",s.utils.book_append_sheet(u,i,l),p=s.write(u,{bookType:"xlsx",type:"array"}),f=new Blob([p],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),n(f,"".concat(a,".xlsx"));case 5:return t.a(2)}},t,null,[[1,3]])}));return function(e,n,r){return t.apply(this,arguments)}}(),c=function(){var n=e.asyncToGenerator(e.regenerator().m(function n(r,o,a,c){var s,i,u,l,p,f,d,h,m,x;return e.regenerator().w(function(n){for(;;)switch(n.p=n.n){case 0:return n.p=0,n.n=1,Promise.resolve().then(function(){return t(require("jspdf"))});case 1:i=n.v,s=i.jsPDF,n.n=3;break;case 2:throw n.p=2,n.v,new Error("PDF export requires the `jspdf` package. Install it with `npm install jspdf`.");case 3:u=new s({orientation:"landscape",unit:"pt",format:"a4"}),l=24,p=u.internal.pageSize.getWidth(),f=u.internal.pageSize.getHeight(),h=(d=p-48)/Math.max(r.length,1),m=l,c&&(u.setFontSize(13),u.text(c,l,m+10),m+=26),(x=function(t,n){u.setFontSize(8),u.setFont("helvetica",n?"bold":"normal");var r=t.map(function(e){return u.splitTextToSize(e||"",h-8).slice(0,4)}),o=11*Math.max.apply(Math,e.toConsumableArray(r.map(function(e){return e.length})).concat([1]))+8;m+o>f-l&&(u.addPage(),m=l),n&&(u.setFillColor(240,240,240),u.rect(l,m,d,o,"F")),r.forEach(function(e,t){u.text(e,l+t*h+4,m+4+11-3)}),u.setDrawColor(210,210,210),u.line(l,m+o,l+d,m+o),m+=o})(r,!0),o.forEach(function(e){return x(e,!1)}),u.save("".concat(a,".pdf"));case 4:return n.a(2)}},n,null,[[0,2]])}));return function(e,t,r,o){return n.apply(this,arguments)}}();exports.buildCsv=o,exports.downloadCsv=function(e,t,r){var a=new Blob([o(e,t)],{type:"text/csv;charset=utf-8;"});n(a,"".concat(r,".csv"))},exports.downloadExcel=a,exports.downloadPdf=c,exports.escapeCsvValue=r;
2
+ //# sourceMappingURL=exportWriters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exportWriters.js","sources":["../../../../../../src/components/ui/tables/utils/exportWriters.ts"],"sourcesContent":["/**\n * Browser file writers for table exports.\n * CSV is dependency-free; Excel uses `xlsx` and PDF uses `jspdf`, both loaded\n * lazily so tables that never export don't pay the bundle cost.\n */\n\n/** Trigger a browser download for an in-memory blob. */\nconst downloadBlob = (blob: Blob, fileName: string): void => {\n const url = URL.createObjectURL(blob);\n const link = document.createElement(\"a\");\n\n link.setAttribute(\"href\", url);\n link.setAttribute(\"download\", fileName);\n link.style.visibility = \"hidden\";\n\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n\n // Give the browser a tick to start the download before revoking.\n setTimeout(() => URL.revokeObjectURL(url), 1000);\n};\n\n/**\n * Escape a single CSV cell: quote when needed, double inner quotes, and\n * neutralise spreadsheet formula injection (`=`, `+`, `-`, `@` prefixes).\n */\nexport const escapeCsvValue = (value: string): string => {\n const text = value ?? \"\";\n const isNumeric = text !== \"\" && !Number.isNaN(Number(text));\n const safeText =\n !isNumeric && /^[=+\\-@\\t\\r]/.test(text) ? `'${text}` : text;\n\n if (/[\",\\n\\r]/.test(safeText) || safeText !== safeText.trim()) {\n return `\"${safeText.replace(/\"/g, '\"\"')}\"`;\n }\n\n return safeText;\n};\n\n/** Build the CSV text (with UTF-8 BOM so Excel renders accents correctly). */\nexport const buildCsv = (headers: string[], rows: string[][]): string => {\n const lines = [\n headers.map(escapeCsvValue).join(\",\"),\n ...rows.map((row) => row.map(escapeCsvValue).join(\",\")),\n ];\n\n return `\\ufeff${lines.join(\"\\r\\n\")}`;\n};\n\nexport const downloadCsv = (\n headers: string[],\n rows: string[][],\n fileName: string\n): void => {\n const blob = new Blob([buildCsv(headers, rows)], {\n type: \"text/csv;charset=utf-8;\",\n });\n\n downloadBlob(blob, `${fileName}.csv`);\n};\n\n/** Write a real .xlsx workbook via SheetJS. Throws if `xlsx` cannot be loaded. */\nexport const downloadExcel = async (\n headers: string[],\n rows: string[][],\n fileName: string,\n sheetName: string = \"Sheet1\"\n): Promise<void> => {\n let XLSX: typeof import(\"xlsx\");\n\n try {\n XLSX = await import(\"xlsx\");\n } catch (error) {\n throw new Error(\n \"Excel export requires the `xlsx` package. Install it with `npm install xlsx`.\"\n );\n }\n\n const worksheet = XLSX.utils.aoa_to_sheet([headers, ...rows]);\n\n // Size columns to their widest cell so the file is readable on open.\n worksheet[\"!cols\"] = headers.map((header, columnIndex) => {\n const widest = rows.reduce(\n (max, row) => Math.max(max, (row[columnIndex] || \"\").length),\n header.length\n );\n return { wch: Math.min(Math.max(widest + 2, 10), 60) };\n });\n\n const workbook = XLSX.utils.book_new();\n // Excel rejects sheet names over 31 chars or containing []:*?/\\\n const safeSheetName = sheetName.replace(/[[\\]:*?/\\\\]/g, \"\").slice(0, 31) || \"Sheet1\";\n XLSX.utils.book_append_sheet(workbook, worksheet, safeSheetName);\n\n const buffer = XLSX.write(workbook, { bookType: \"xlsx\", type: \"array\" });\n const blob = new Blob([buffer], {\n type: \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\",\n });\n\n downloadBlob(blob, `${fileName}.xlsx`);\n};\n\n/** Render a paginated landscape table to PDF via jsPDF. Throws if `jspdf` is missing. */\nexport const downloadPdf = async (\n headers: string[],\n rows: string[][],\n fileName: string,\n title?: string\n): Promise<void> => {\n let jsPDFConstructor: typeof import(\"jspdf\").jsPDF;\n\n try {\n const module = await import(\"jspdf\");\n jsPDFConstructor = module.jsPDF;\n } catch (error) {\n throw new Error(\n \"PDF export requires the `jspdf` package. Install it with `npm install jspdf`.\"\n );\n }\n\n const doc = new jsPDFConstructor({\n orientation: \"landscape\",\n unit: \"pt\",\n format: \"a4\",\n });\n\n const margin = 24;\n const pageWidth = doc.internal.pageSize.getWidth();\n const pageHeight = doc.internal.pageSize.getHeight();\n const usableWidth = pageWidth - margin * 2;\n const columnWidth = usableWidth / Math.max(headers.length, 1);\n const lineHeight = 11;\n const cellPadding = 4;\n\n let cursorY = margin;\n\n if (title) {\n doc.setFontSize(13);\n doc.text(title, margin, cursorY + 10);\n cursorY += 26;\n }\n\n const drawRow = (cells: string[], isHeader: boolean): void => {\n doc.setFontSize(8);\n doc.setFont(\"helvetica\", isHeader ? \"bold\" : \"normal\");\n\n const wrapped = cells.map((cell) =>\n doc.splitTextToSize(cell || \"\", columnWidth - cellPadding * 2).slice(0, 4)\n );\n const rowHeight =\n Math.max(...wrapped.map((lines) => lines.length), 1) * lineHeight +\n cellPadding * 2;\n\n if (cursorY + rowHeight > pageHeight - margin) {\n doc.addPage();\n cursorY = margin;\n }\n\n if (isHeader) {\n doc.setFillColor(240, 240, 240);\n doc.rect(margin, cursorY, usableWidth, rowHeight, \"F\");\n }\n\n wrapped.forEach((lines, columnIndex) => {\n doc.text(\n lines,\n margin + columnIndex * columnWidth + cellPadding,\n cursorY + cellPadding + lineHeight - 3\n );\n });\n\n doc.setDrawColor(210, 210, 210);\n doc.line(margin, cursorY + rowHeight, margin + usableWidth, cursorY + rowHeight);\n\n cursorY += rowHeight;\n };\n\n drawRow(headers, true);\n rows.forEach((row) => drawRow(row, false));\n\n doc.save(`${fileName}.pdf`);\n};\n"],"names":["downloadBlob","blob","fileName","url","URL","createObjectURL","link","document","createElement","setAttribute","style","visibility","body","appendChild","click","removeChild","setTimeout","revokeObjectURL","escapeCsvValue","value","text","safeText","Number","isNaN","test","concat","trim","replace","buildCsv","headers","rows","lines","map","join","_toConsumableArray","toConsumableArray","row","downloadExcel","_ref","_asyncToGenerator","_regenerator","m","_callee","sheetName","XLSX","worksheet","workbook","safeSheetName","buffer","_args","arguments","w","_context","p","n","length","undefined","Promise","resolve","then","require","v","Error","utils","aoa_to_sheet","header","columnIndex","widest","reduce","max","Math","wch","min","book_new","slice","book_append_sheet","write","bookType","type","Blob","a","_x","_x2","_x3","apply","this","downloadPdf","_ref2","regenerator","_callee2","title","jsPDFConstructor","module","doc","margin","pageWidth","pageHeight","usableWidth","columnWidth","cursorY","drawRow","_context2","_interopNamespace","jsPDF","orientation","unit","format","internal","pageSize","getWidth","getHeight","setFontSize","cells","isHeader","setFont","wrapped","cell","splitTextToSize","cellPadding","rowHeight","addPage","setFillColor","rect","forEach","setDrawColor","line","save","_x4","_x5","_x6","_x7"],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../_virtual/_rollupPluginBabelHelpers.js"),r=require("./exportValues.js"),t=require("./exportWriters.js"),o=["format","fileName","title"],n=function(e,r){return e||(!0===r?"all":!1===r?"columns":"both")},a=function(r,t,o){return t?{headers:["#"].concat(e.toConsumableArray(r.headers)),rows:r.rows.map(function(r,t){return[String(t+o)].concat(e.toConsumableArray(r))})}:r},u=function(t){var o=t.data,u=t.columns,s=t.showRowNumbers,i=void 0!==s&&s,l=t.rowNumberStartFrom,c=void 0===l?1:l,d=t.fields,f=t.allFields,p=n(d,f),m=r.getExportableColumns(u);if("all"===p)return a(r.buildAllFieldsMatrix(o),i,c);var b=function(e,t){return{headers:t.map(function(e){return e.header}),rows:e.map(function(e,o){return t.map(function(t){return r.resolveColumnExportValue(e,t,o)})})}}(o,m);if("columns"===p)return a(b,i,c);var h=function(e,t){var o=new Set(t.filter(function(e){return"string"==typeof e.accessor}).map(function(e){return e.accessor})),n=r.buildAllFieldsMatrix(e),a=n.headers,u=n.rows,s=a.map(function(e,r){return{header:e,index:r}}).filter(function(e){var r=e.header;return!o.has(r)});return{headers:s.map(function(e){return e.header}),rows:u.map(function(e){return s.map(function(r){var t=r.index;return e[t]})})}}(o,m);return a({headers:[].concat(e.toConsumableArray(b.headers),e.toConsumableArray(h.headers)),rows:b.rows.map(function(r,t){return[].concat(e.toConsumableArray(r),e.toConsumableArray(h.rows[t]||[]))})},i,c)},s=function(){var r=e.asyncToGenerator(e.regenerator().m(function r(a){var s,i,l,c,d,f,p,m,b,h;return e.regenerator().w(function(r){for(;;)switch(r.n){case 0:if(s=a.format,i=a.fileName,l=void 0===i?"table-export":i,c=a.title,d=e.objectWithoutProperties(a,o),f=!d.fields&&void 0===d.allFields,p="pdf"===s&&f?"columns":n(d.fields,d.allFields),m=u(e.objectSpread2(e.objectSpread2({},d),{},{fields:p})),b=m.headers,h=m.rows,b.length){r.n=1;break}throw new Error("Nothing to export: no exportable fields were found.");case 1:if("excel"!==s){r.n=3;break}return r.n=2,t.downloadExcel(b,h,l,c||"Sheet1");case 2:return r.a(2);case 3:if("pdf"!==s){r.n=5;break}return r.n=4,t.downloadPdf(b,h,l,c);case 4:return r.a(2);case 5:t.downloadCsv(b,h,l);case 6:return r.a(2)}},r)}));return function(e){return r.apply(this,arguments)}}();exports.buildExportMatrix=u,exports.exportTableData=s,exports.resolveExportOptions=function(r){return e.objectSpread2({fileName:"table-export",batchSize:100,maxRows:5e3},r||{})},exports.resolveFieldsMode=n;
2
+ //# sourceMappingURL=tableExport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tableExport.js","sources":["../../../../../../src/components/ui/tables/utils/tableExport.ts"],"sourcesContent":["import { TableColumnType, TableExportOptionsType } from \"../../../../types\";\nimport {\n buildAllFieldsMatrix,\n getExportableColumns,\n resolveColumnExportValue,\n} from \"./exportValues\";\nimport { downloadCsv, downloadExcel, downloadPdf } from \"./exportWriters\";\n\nexport type TableExportFormatType = \"csv\" | \"excel\" | \"pdf\";\n\n/**\n * Which fields end up in the file.\n * - `columns` — only the table's visible columns\n * - `all` — only the raw record, flattened to `parent.child` headers\n * - `both` (default) — the visible columns, then every raw field they don't cover\n */\nexport type TableExportFieldsType = \"columns\" | \"all\" | \"both\";\n\ninterface MatrixType {\n headers: string[];\n rows: string[][];\n}\n\ninterface BuildMatrixParamsType<T> {\n data: T[];\n columns: TableColumnType<T>[];\n showRowNumbers?: boolean;\n rowNumberStartFrom?: number;\n fields?: TableExportFieldsType;\n /** Shorthand kept for backwards compatibility: `true` -> \"all\", `false` -> \"columns\". */\n allFields?: boolean;\n}\n\n/** Reconcile the `fields` option with the older `allFields` boolean. */\nexport const resolveFieldsMode = (\n fields?: TableExportFieldsType,\n allFields?: boolean\n): TableExportFieldsType => {\n if (fields) return fields;\n if (allFields === true) return \"all\";\n if (allFields === false) return \"columns\";\n return \"both\";\n};\n\n/**\n * Matrix from the table's visible columns.\n * Keeps columns with function accessors, resolves dotted accessors, and falls\n * back to `cell` output — so no column is silently dropped from the file.\n */\nconst buildColumnMatrix = <T,>(\n data: T[],\n columns: TableColumnType<T>[]\n): MatrixType => ({\n headers: columns.map((column) => column.header),\n rows: data.map((row, index) =>\n columns.map((column) => resolveColumnExportValue(row, column, index))\n ),\n});\n\n/** Raw-record matrix with the fields already carried by a column removed. */\nconst buildRemainingFieldsMatrix = <T,>(\n data: T[],\n columns: TableColumnType<T>[]\n): MatrixType => {\n const covered = new Set(\n columns\n .filter((column) => typeof column.accessor === \"string\")\n .map((column) => column.accessor as string)\n );\n\n const { headers, rows } = buildAllFieldsMatrix(data);\n const keptIndexes = headers\n .map((header, index) => ({ header, index }))\n .filter(({ header }) => !covered.has(header));\n\n return {\n headers: keptIndexes.map(({ header }) => header),\n rows: rows.map((row) => keptIndexes.map(({ index }) => row[index])),\n };\n};\n\n/** Prefix a row-number column when `showRowNumbers` is on. */\nconst withRowNumbers = (\n matrix: MatrixType,\n showRowNumbers: boolean,\n startFrom: number\n): MatrixType => {\n if (!showRowNumbers) return matrix;\n\n return {\n headers: [\"#\", ...matrix.headers],\n rows: matrix.rows.map((row, index) => [String(index + startFrom), ...row]),\n };\n};\n\n/** Turn table data into a headers/rows matrix according to the fields mode. */\nexport const buildExportMatrix = <T,>({\n data,\n columns,\n showRowNumbers = false,\n rowNumberStartFrom = 1,\n fields,\n allFields,\n}: BuildMatrixParamsType<T>): MatrixType => {\n const mode = resolveFieldsMode(fields, allFields);\n const exportColumns = getExportableColumns(columns);\n\n if (mode === \"all\") {\n return withRowNumbers(\n buildAllFieldsMatrix(data),\n showRowNumbers,\n rowNumberStartFrom\n );\n }\n\n const columnMatrix = buildColumnMatrix(data, exportColumns);\n\n if (mode === \"columns\") {\n return withRowNumbers(columnMatrix, showRowNumbers, rowNumberStartFrom);\n }\n\n const extras = buildRemainingFieldsMatrix(data, exportColumns);\n\n return withRowNumbers(\n {\n headers: [...columnMatrix.headers, ...extras.headers],\n rows: columnMatrix.rows.map((row, index) => [\n ...row,\n ...(extras.rows[index] || []),\n ]),\n },\n showRowNumbers,\n rowNumberStartFrom\n );\n};\n\ninterface ExportTableDataParamsType<T> extends BuildMatrixParamsType<T> {\n format: TableExportFormatType;\n fileName?: string;\n /** Used as the PDF heading and the Excel sheet name. */\n title?: string;\n}\n\n/**\n * Build the matrix for `data` and download it in the requested format.\n * Rejects on failure (missing optional dependency, write error) so callers can\n * surface the problem instead of the button doing nothing.\n */\nexport const exportTableData = async <T,>({\n format,\n fileName = \"table-export\",\n title,\n ...matrixParams\n}: ExportTableDataParamsType<T>): Promise<void> => {\n // A PDF is a printable document, not a data dump: stick to the visible columns\n // unless the caller explicitly asked for the raw fields.\n const isImplicitMode =\n !matrixParams.fields && matrixParams.allFields === undefined;\n const fields: TableExportFieldsType =\n format === \"pdf\" && isImplicitMode\n ? \"columns\"\n : resolveFieldsMode(matrixParams.fields, matrixParams.allFields);\n\n const { headers, rows } = buildExportMatrix({ ...matrixParams, fields });\n\n if (!headers.length) {\n throw new Error(\"Nothing to export: no exportable fields were found.\");\n }\n\n if (format === \"excel\") {\n await downloadExcel(headers, rows, fileName, title || \"Sheet1\");\n return;\n }\n\n if (format === \"pdf\") {\n await downloadPdf(headers, rows, fileName, title);\n return;\n }\n\n downloadCsv(headers, rows, fileName);\n};\n\n/**\n * Fill in file-generation defaults. Button visibility flags (csv/excel/pdf) are\n * left untouched so the caller keeps control of which buttons render.\n */\nexport const resolveExportOptions = (\n exportOptions?: TableExportOptionsType\n): TableExportOptionsType & {\n fileName: string;\n batchSize: number;\n maxRows: number;\n} => ({\n fileName: \"table-export\",\n batchSize: 100,\n maxRows: 5000,\n ...(exportOptions || {}),\n});\n"],"names":["resolveFieldsMode","fields","allFields","withRowNumbers","matrix","showRowNumbers","startFrom","headers","concat","_toConsumableArray","rows","map","row","index","String","buildExportMatrix","_ref4","data","columns","_ref4$showRowNumbers","_ref4$rowNumberStartF","rowNumberStartFrom","mode","exportColumns","getExportableColumns","buildAllFieldsMatrix","columnMatrix","column","header","resolveColumnExportValue","buildColumnMatrix","extras","covered","Set","filter","accessor","_buildAllFieldsMatrix","keptIndexes","_ref","has","_ref2","_ref3","buildRemainingFieldsMatrix","toConsumableArray","exportTableData","_ref6","_asyncToGenerator","_regenerator","regenerator","m","_callee","_ref5","format","_ref5$fileName","fileName","title","matrixParams","isImplicitMode","_buildExportMatrix","w","_context","n","_objectWithoutProperties","objectWithoutProperties","_excluded","undefined","_objectSpread","length","Error","downloadExcel","a","downloadPdf","downloadCsv","_x","apply","this","arguments","exportOptions","batchSize","maxRows"],"mappings":"yOAkCaA,EAAoB,SAC/BC,EACAC,GAEA,OAAID,KACc,IAAdC,EAA2B,OACb,IAAdA,EAA4B,UACzB,OACT,EAwCMC,EAAiB,SACrBC,EACAC,EACAC,GAEA,OAAKD,EAEE,CACLE,QAAO,CAAG,KAAGC,OAAAC,EAAAA,kBAAKL,EAAOG,UACzBG,KAAMN,EAAOM,KAAKC,IAAI,SAACC,EAAKC,GAAK,MAAMC,CAAAA,OAAOD,EAAQP,IAAUE,OAAAC,EAAAA,kBAAKG,OAJ3CR,CAM9B,EAGaW,EAAoB,SAAHC,GAOa,IANzCC,EAAID,EAAJC,KACAC,EAAOF,EAAPE,QAAOC,EAAAH,EACPX,eAAAA,OAAiB,IAAHc,GAAQA,EAAAC,EAAAJ,EACtBK,mBAAAA,OAAqB,IAAHD,EAAG,EAACA,EACtBnB,EAAMe,EAANf,OACAC,EAASc,EAATd,UAEMoB,EAAOtB,EAAkBC,EAAQC,GACjCqB,EAAgBC,uBAAqBN,GAE3C,GAAa,QAATI,EACF,OAAOnB,EACLsB,EAAAA,qBAAqBR,GACrBZ,EACAgB,GAIJ,IAAMK,EAlEkB,SACxBT,EACAC,GAA6B,MACb,CAChBX,QAASW,EAAQP,IAAI,SAACgB,GAAM,OAAKA,EAAOC,SACxClB,KAAMO,EAAKN,IAAI,SAACC,EAAKC,GAAK,OACxBK,EAAQP,IAAI,SAACgB,GAAM,OAAKE,2BAAyBjB,EAAKe,EAAQd,IAAO,GAExE,CA0DsBiB,CAAkBb,EAAMM,GAE7C,GAAa,YAATD,EACF,OAAOnB,EAAeuB,EAAcrB,EAAgBgB,GAGtD,IAAMU,EA7D2B,SACjCd,EACAC,GAEA,IAAMc,EAAU,IAAIC,IAClBf,EACGgB,OAAO,SAACP,GAAM,MAAgC,iBAApBA,EAAOQ,QAAqB,GACtDxB,IAAI,SAACgB,GAAM,OAAKA,EAAOQ,QAAkB,IAG9CC,EAA0BX,EAAoBA,qBAACR,GAAvCV,EAAO6B,EAAP7B,QAASG,EAAI0B,EAAJ1B,KACX2B,EAAc9B,EACjBI,IAAI,SAACiB,EAAQf,GAAK,MAAM,CAAEe,OAAAA,EAAQf,MAAAA,EAAO,GACzCqB,OAAO,SAAAI,GAAA,IAAGV,EAAMU,EAANV,OAAM,OAAQI,EAAQO,IAAIX,KAEvC,MAAO,CACLrB,QAAS8B,EAAY1B,IAAI,SAAA6B,GAAS,OAAAA,EAANZ,SAC5BlB,KAAMA,EAAKC,IAAI,SAACC,GAAG,OAAKyB,EAAY1B,IAAI,SAAA8B,GAAA,IAAG5B,EAAK4B,EAAL5B,MAAK,OAAOD,EAAIC,IAAO,GAEtE,CA0CiB6B,CAA2BzB,EAAMM,GAEhD,OAAOpB,EACL,CACEI,QAAOC,GAAAA,OAAAC,oBAAMiB,EAAanB,SAAOE,EAAAkC,kBAAKZ,EAAOxB,UAC7CG,KAAMgB,EAAahB,KAAKC,IAAI,SAACC,EAAKC,GAAK,MAAA,GAAAL,OAAAC,EAAAkC,kBAClC/B,GAAGH,EAAAA,kBACFsB,EAAOrB,KAAKG,IAAU,QAG9BR,EACAgB,EAEJ,EAcauB,EAAe,WAAA,IAAAC,EAAAC,EAAAA,iBAAAC,EAAAC,cAAAC,EAAG,SAAAC,EAAAC,GAAA,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAxD,EAAAyD,EAAAnD,EAAAG,EAAA,OAAAqC,gBAAAY,EAAA,SAAAC,GAAA,cAAAA,EAAAC,GAAA,KAAA,EAeR,GAdrBT,EAAMD,EAANC,OAAMC,EAAAF,EACNG,SAAAA,OAAQ,IAAAD,EAAG,eAAcA,EACzBE,EAAKJ,EAALI,MACGC,EAAYM,EAAAC,wBAAAZ,EAAAa,GAITP,GACHD,EAAavD,aAAqCgE,IAA3BT,EAAatD,UACjCD,EACO,QAAXmD,GAAoBK,EAChB,UACAzD,EAAkBwD,EAAavD,OAAQuD,EAAatD,WAAUwD,EAE1C3C,EAAiBmD,gBAAAA,EAAAA,iBAAMV,GAAY,GAAA,CAAEvD,OAAAA,KAAvDM,EAAOmD,EAAPnD,QAASG,EAAIgD,EAAJhD,KAEZH,EAAQ4D,OAAM,CAAAP,EAAAC,EAAA,EAAA,KAAA,CAAA,MACX,IAAIO,MAAM,uDAAsD,KAAA,EAAA,GAGzD,UAAXhB,EAAkB,CAAAQ,EAAAC,EAAA,EAAA,KAAA,CAAA,OAAAD,EAAAC,EAAA,EACdQ,EAAAA,cAAc9D,EAASG,EAAM4C,EAAUC,GAAS,UAAS,KAAA,EAAA,OAAAK,EAAAU,EAAA,GAAA,KAAA,EAAA,GAIlD,QAAXlB,EAAgB,CAAAQ,EAAAC,EAAA,EAAA,KAAA,CAAA,OAAAD,EAAAC,EAAA,EACZU,EAAWA,YAAChE,EAASG,EAAM4C,EAAUC,GAAM,KAAA,EAAA,OAAAK,EAAAU,EAAA,GAAA,KAAA,EAInDE,EAAAA,YAAYjE,EAASG,EAAM4C,GAAU,KAAA,EAAA,OAAAM,EAAAU,EAAA,GAAA,EAAApB,EACtC,IAAA,OAhCYN,SAAe6B,GAAA,OAAA5B,EAAA6B,MAAAC,KAAAC,UAAA,CAAA,CAAA,sFAsCQ,SAClCC,GAAsC,OAAAX,gBAAA,CAMtCZ,SAAU,eACVwB,UAAW,IACXC,QAAS,KACLF,GAAiB,CAAA,EAAE"}
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
3
+ [K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
4
+ } : T;
5
+ export interface PageProps {
6
+ params?: Promise<SegmentParams>;
7
+ searchParams?: Promise<any>;
8
+ }
9
+ export interface LayoutProps {
10
+ children?: React.ReactNode;
11
+ params?: Promise<SegmentParams>;
12
+ }
13
+ export {};
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
3
+ [K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
4
+ } : T;
5
+ export interface PageProps {
6
+ params?: Promise<SegmentParams>;
7
+ searchParams?: Promise<any>;
8
+ }
9
+ export interface LayoutProps {
10
+ children?: React.ReactNode;
11
+ params?: Promise<SegmentParams>;
12
+ }
13
+ export {};
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
3
+ [K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
4
+ } : T;
5
+ export interface PageProps {
6
+ params?: Promise<SegmentParams>;
7
+ searchParams?: Promise<any>;
8
+ }
9
+ export interface LayoutProps {
10
+ children?: React.ReactNode;
11
+ params?: Promise<SegmentParams>;
12
+ }
13
+ export {};
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
3
+ [K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
4
+ } : T;
5
+ export interface PageProps {
6
+ params?: Promise<SegmentParams>;
7
+ searchParams?: Promise<any>;
8
+ }
9
+ export interface LayoutProps {
10
+ children?: React.ReactNode;
11
+ params?: Promise<SegmentParams>;
12
+ }
13
+ export {};
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
3
+ [K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
4
+ } : T;
5
+ export interface PageProps {
6
+ params?: Promise<SegmentParams>;
7
+ searchParams?: Promise<any>;
8
+ }
9
+ export interface LayoutProps {
10
+ children?: React.ReactNode;
11
+ params?: Promise<SegmentParams>;
12
+ }
13
+ export {};
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
3
+ [K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
4
+ } : T;
5
+ export interface PageProps {
6
+ params?: Promise<SegmentParams>;
7
+ searchParams?: Promise<any>;
8
+ }
9
+ export interface LayoutProps {
10
+ children?: React.ReactNode;
11
+ params?: Promise<SegmentParams>;
12
+ }
13
+ export {};
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
3
+ [K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
4
+ } : T;
5
+ export interface PageProps {
6
+ params?: Promise<SegmentParams>;
7
+ searchParams?: Promise<any>;
8
+ }
9
+ export interface LayoutProps {
10
+ children?: React.ReactNode;
11
+ params?: Promise<SegmentParams>;
12
+ }
13
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { NextConfig } from "next";
2
+ declare const nextConfig: NextConfig;
3
+ export default nextConfig;
@@ -0,0 +1 @@
1
+ export declare const GET: (req: import("next/server").NextRequest) => Promise<Response>, POST: (req: import("next/server").NextRequest) => Promise<Response>;
@@ -0,0 +1,2 @@
1
+ export function POST(request: any): Promise<NextResponse<any>>;
2
+ import { NextResponse } from "next/server";
@@ -0,0 +1,14 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+ import { DocsResponse } from '@/__examples__/src/types/components';
3
+ export declare function POST(request: NextRequest): Promise<NextResponse<{
4
+ error: string;
5
+ }> | NextResponse<{
6
+ success: boolean;
7
+ data: DocsResponse;
8
+ }>>;
9
+ export declare function GET(request: NextRequest): Promise<NextResponse<{
10
+ error: string;
11
+ }> | NextResponse<{
12
+ success: boolean;
13
+ data: DocsResponse;
14
+ }>>;
@@ -0,0 +1,14 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+ import { RecommendationResponse } from '@/__examples__/src/types/components';
3
+ export declare function POST(request: NextRequest): Promise<NextResponse<{
4
+ error: string;
5
+ }> | NextResponse<{
6
+ success: boolean;
7
+ data: RecommendationResponse;
8
+ }>>;
9
+ export declare function GET(request: NextRequest): Promise<NextResponse<{
10
+ error: string;
11
+ }> | NextResponse<{
12
+ success: boolean;
13
+ data: RecommendationResponse;
14
+ }>>;
@@ -0,0 +1,50 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+ import { ComponentInfo } from '@/__examples__/src/types/components';
3
+ export declare function POST(request: NextRequest): Promise<NextResponse<{
4
+ error: string;
5
+ }> | NextResponse<{
6
+ success: boolean;
7
+ data: {
8
+ query: string;
9
+ total: number;
10
+ results: {
11
+ component: ComponentInfo;
12
+ relevance: number;
13
+ matchReason: string;
14
+ importPath: string;
15
+ repositoryUrl: string;
16
+ }[];
17
+ categories: string[];
18
+ };
19
+ suggestions: string[];
20
+ error?: undefined;
21
+ } | {
22
+ success: boolean;
23
+ error: string;
24
+ data?: undefined;
25
+ suggestions?: undefined;
26
+ }>>;
27
+ export declare function GET(request: NextRequest): Promise<NextResponse<{
28
+ success: boolean;
29
+ data: {
30
+ query: string;
31
+ total: number;
32
+ results: {
33
+ component: ComponentInfo;
34
+ relevance: number;
35
+ matchReason: string;
36
+ importPath: string;
37
+ repositoryUrl: string;
38
+ }[];
39
+ categories: string[];
40
+ };
41
+ suggestions: string[];
42
+ error?: undefined;
43
+ } | {
44
+ success: boolean;
45
+ error: string;
46
+ data?: undefined;
47
+ suggestions?: undefined;
48
+ }> | NextResponse<{
49
+ error: string;
50
+ }>>;
@@ -0,0 +1,34 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+ export declare function GET(request: NextRequest): Promise<Response>;
3
+ export declare function POST(request: NextRequest): Promise<NextResponse<{
4
+ success: boolean;
5
+ issue_type: any;
6
+ context: any;
7
+ guidance: {
8
+ immediate_solution: string;
9
+ long_term_solution: string;
10
+ code_example: string;
11
+ } | {
12
+ immediate_solution: string;
13
+ long_term_solution: string;
14
+ code_example: string;
15
+ } | {
16
+ immediate_solution: string;
17
+ long_term_solution: string;
18
+ code_example: string;
19
+ } | {
20
+ immediate_solution: string;
21
+ long_term_solution: string;
22
+ code_example: string;
23
+ };
24
+ fallback_options: {
25
+ method: string;
26
+ description: string;
27
+ implementation: string;
28
+ benefits: string[];
29
+ }[];
30
+ next_steps: string[];
31
+ }> | NextResponse<{
32
+ success: boolean;
33
+ error: string;
34
+ }>>;
@@ -0,0 +1,14 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+ import { CodeGenerationResponse } from '@/__examples__/src/types/components';
3
+ export declare function POST(request: NextRequest): Promise<NextResponse<{
4
+ error: string;
5
+ }> | NextResponse<{
6
+ success: boolean;
7
+ data: CodeGenerationResponse;
8
+ }>>;
9
+ export declare function GET(request: NextRequest): Promise<NextResponse<{
10
+ error: string;
11
+ }> | NextResponse<{
12
+ success: boolean;
13
+ data: CodeGenerationResponse;
14
+ }>>;
@@ -0,0 +1,14 @@
1
+ import { NextRequest, NextResponse } from 'next/server';
2
+ import { IntegrationHelpResponse } from '@/__examples__/src/types/components';
3
+ export declare function POST(request: NextRequest): Promise<NextResponse<{
4
+ error: string;
5
+ }> | NextResponse<{
6
+ success: boolean;
7
+ data: IntegrationHelpResponse;
8
+ }>>;
9
+ export declare function GET(request: NextRequest): Promise<NextResponse<{
10
+ error: string;
11
+ }> | NextResponse<{
12
+ success: boolean;
13
+ data: IntegrationHelpResponse;
14
+ }>>;