@pagamio/frontend-commons-lib 0.8.175 → 0.8.183

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 (508) hide show
  1. package/lib/api/client.d.ts +88 -0
  2. package/lib/api/client.js +339 -0
  3. package/lib/api/context.d.ts +112 -0
  4. package/lib/api/context.js +105 -0
  5. package/lib/api/index.d.ts +4 -0
  6. package/lib/api/index.js +4 -0
  7. package/lib/api/swr.d.ts +46 -0
  8. package/lib/api/swr.js +124 -0
  9. package/lib/api/types.d.ts +145 -0
  10. package/lib/api/types.js +10 -0
  11. package/lib/auth/authenticators/AuthenticatorFactory.d.ts +25 -0
  12. package/lib/auth/authenticators/AuthenticatorFactory.js +32 -0
  13. package/lib/auth/authenticators/index.d.ts +7 -0
  14. package/lib/auth/authenticators/index.js +7 -0
  15. package/lib/auth/authenticators/processors/DefaultAuthenticatorProcessor.d.ts +21 -0
  16. package/lib/auth/authenticators/processors/DefaultAuthenticatorProcessor.js +26 -0
  17. package/lib/auth/authenticators/processors/StrapiAuthenticatorProcessor.d.ts +74 -0
  18. package/lib/auth/authenticators/processors/StrapiAuthenticatorProcessor.js +99 -0
  19. package/lib/auth/authenticators/types.d.ts +26 -0
  20. package/lib/auth/authenticators/types.js +9 -0
  21. package/lib/auth/components/AppBanner.d.ts +7 -0
  22. package/lib/auth/components/AppBanner.js +9 -0
  23. package/lib/auth/components/AuthCard.d.ts +8 -0
  24. package/lib/auth/components/AuthCard.js +14 -0
  25. package/lib/auth/components/AuthFormUtils.d.ts +58 -0
  26. package/lib/auth/components/AuthFormUtils.js +52 -0
  27. package/lib/auth/components/AuthPageLayout.d.ts +45 -0
  28. package/lib/auth/components/AuthPageLayout.js +12 -0
  29. package/lib/auth/components/ChangePasswordPage.d.ts +12 -0
  30. package/lib/auth/components/ChangePasswordPage.js +59 -0
  31. package/lib/auth/components/CustomerRegistrationPage.d.ts +50 -0
  32. package/lib/auth/components/CustomerRegistrationPage.js +140 -0
  33. package/lib/auth/components/ForgotPasswordPage.d.ts +38 -0
  34. package/lib/auth/components/ForgotPasswordPage.js +76 -0
  35. package/lib/auth/components/LoginPage.d.ts +73 -0
  36. package/lib/auth/components/LoginPage.js +115 -0
  37. package/lib/auth/components/LogoutButton.d.ts +30 -0
  38. package/lib/auth/components/LogoutButton.js +47 -0
  39. package/lib/auth/components/ResetPasswordPage.d.ts +42 -0
  40. package/lib/auth/components/ResetPasswordPage.js +88 -0
  41. package/lib/auth/components/hooks/useChangeUserPassword.d.ts +26 -0
  42. package/lib/auth/components/hooks/useChangeUserPassword.js +63 -0
  43. package/lib/auth/components/index.d.ts +8 -0
  44. package/lib/auth/components/index.js +7 -0
  45. package/lib/auth/context/AuthContext.d.ts +65 -0
  46. package/lib/auth/context/AuthContext.js +150 -0
  47. package/lib/auth/context/index.d.ts +1 -0
  48. package/lib/auth/context/index.js +1 -0
  49. package/lib/auth/index.d.ts +7 -0
  50. package/lib/auth/index.js +7 -0
  51. package/lib/auth/services/AuthService.d.ts +230 -0
  52. package/lib/auth/services/AuthService.js +475 -0
  53. package/lib/auth/services/LogoutService.d.ts +27 -0
  54. package/lib/auth/services/LogoutService.js +98 -0
  55. package/lib/auth/services/index.d.ts +2 -0
  56. package/lib/auth/services/index.js +2 -0
  57. package/lib/auth/shared/index.d.ts +1 -0
  58. package/lib/auth/shared/index.js +1 -0
  59. package/lib/auth/shared/layout/AuthPageLayout.d.ts +10 -0
  60. package/lib/auth/shared/layout/AuthPageLayout.js +16 -0
  61. package/lib/auth/shared/layout/index.d.ts +1 -0
  62. package/lib/auth/shared/layout/index.js +1 -0
  63. package/lib/auth/types/auth.types.d.ts +234 -0
  64. package/lib/auth/types/auth.types.js +14 -0
  65. package/lib/auth/types/index.d.ts +1 -0
  66. package/lib/auth/types/index.js +1 -0
  67. package/lib/auth/utils/TokenManager.d.ts +43 -0
  68. package/lib/auth/utils/TokenManager.js +171 -0
  69. package/lib/auth/utils/Transformers.d.ts +158 -0
  70. package/lib/auth/utils/Transformers.js +263 -0
  71. package/lib/auth/utils/errorDetection.d.ts +22 -0
  72. package/lib/auth/utils/errorDetection.js +190 -0
  73. package/lib/auth/utils/index.d.ts +3 -0
  74. package/lib/auth/utils/index.js +3 -0
  75. package/lib/components/charts/LineGraph.d.ts +15 -0
  76. package/lib/components/charts/LineGraph.js +131 -0
  77. package/lib/components/icons/Icon.d.ts +8 -0
  78. package/lib/components/icons/Icon.js +13 -0
  79. package/lib/components/icons/index.d.ts +2 -0
  80. package/lib/components/icons/index.js +2 -0
  81. package/lib/components/icons/types.d.ts +26 -0
  82. package/lib/components/icons/types.js +33 -0
  83. package/lib/components/index.d.ts +3 -0
  84. package/lib/components/index.js +3 -0
  85. package/lib/components/layout/AppLayout.d.ts +34 -0
  86. package/lib/components/layout/AppLayout.js +19 -0
  87. package/lib/components/layout/AuthPageLayout.d.ts +13 -0
  88. package/lib/components/layout/AuthPageLayout.js +15 -0
  89. package/lib/components/layout/BreadcrumbNav.d.ts +2 -0
  90. package/lib/components/layout/BreadcrumbNav.js +10 -0
  91. package/lib/components/layout/LayoutContent.d.ts +6 -0
  92. package/lib/components/layout/LayoutContent.js +10 -0
  93. package/lib/components/layout/Navbar.d.ts +106 -0
  94. package/lib/components/layout/Navbar.js +66 -0
  95. package/lib/components/layout/PageHeader.d.ts +8 -0
  96. package/lib/components/layout/PageHeader.js +7 -0
  97. package/lib/components/layout/SessionExpiryModal.d.ts +10 -0
  98. package/lib/components/layout/SessionExpiryModal.js +9 -0
  99. package/lib/components/layout/Sidebar.d.ts +6 -0
  100. package/lib/components/layout/Sidebar.js +87 -0
  101. package/lib/components/layout/VerticalTabsLayout.d.ts +12 -0
  102. package/lib/components/layout/VerticalTabsLayout.js +14 -0
  103. package/lib/components/layout/index.d.ts +9 -0
  104. package/lib/components/layout/index.js +9 -0
  105. package/lib/components/ui/Avatar.d.ts +6 -0
  106. package/lib/components/ui/Avatar.js +11 -0
  107. package/lib/components/ui/AvatarIcon.d.ts +4 -0
  108. package/lib/components/ui/AvatarIcon.js +6 -0
  109. package/lib/components/ui/Button.d.ts +14 -0
  110. package/lib/components/ui/Button.js +30 -0
  111. package/lib/components/ui/Calendar.d.ts +9 -0
  112. package/lib/components/ui/Calendar.js +35 -0
  113. package/lib/components/ui/Card.d.ts +16 -0
  114. package/lib/components/ui/Card.js +6 -0
  115. package/lib/components/ui/Chart.d.ts +2 -0
  116. package/lib/components/ui/Chart.js +16 -0
  117. package/lib/components/ui/Checkbox.d.ts +4 -0
  118. package/lib/components/ui/Checkbox.js +8 -0
  119. package/lib/components/ui/Command.d.ts +80 -0
  120. package/lib/components/ui/Command.js +28 -0
  121. package/lib/components/ui/ContainedTab.d.ts +21 -0
  122. package/lib/components/ui/ContainedTab.js +37 -0
  123. package/lib/components/ui/DateFormat.d.ts +6 -0
  124. package/lib/components/ui/DateFormat.js +8 -0
  125. package/lib/components/ui/DatePicker.d.ts +14 -0
  126. package/lib/components/ui/DatePicker.js +91 -0
  127. package/lib/components/ui/DateRangeModal.d.ts +38 -0
  128. package/lib/components/ui/DateRangeModal.js +89 -0
  129. package/lib/components/ui/DetailsCard.d.ts +16 -0
  130. package/lib/components/ui/DetailsCard.js +14 -0
  131. package/lib/components/ui/DetailsPage.d.ts +36 -0
  132. package/lib/components/ui/DetailsPage.js +50 -0
  133. package/lib/components/ui/Dialog.d.ts +19 -0
  134. package/lib/components/ui/Dialog.js +22 -0
  135. package/lib/components/ui/EmptyState.d.ts +6 -0
  136. package/lib/components/ui/EmptyState.js +6 -0
  137. package/lib/components/ui/FilterComponent.d.ts +30 -0
  138. package/lib/components/ui/FilterComponent.js +80 -0
  139. package/lib/components/ui/FilterList.d.ts +52 -0
  140. package/lib/components/ui/FilterList.js +62 -0
  141. package/lib/components/ui/FilterSection.d.ts +31 -0
  142. package/lib/components/ui/FilterSection.js +21 -0
  143. package/lib/components/ui/FilterWrapper.d.ts +6 -0
  144. package/lib/components/ui/FilterWrapper.js +7 -0
  145. package/lib/components/ui/Form.d.ts +23 -0
  146. package/lib/components/ui/Form.js +62 -0
  147. package/lib/components/ui/HoverableValue.d.ts +7 -0
  148. package/lib/components/ui/HoverableValue.js +8 -0
  149. package/lib/components/ui/IconButton.d.ts +10 -0
  150. package/lib/components/ui/IconButton.js +10 -0
  151. package/lib/components/ui/ImageComponent.d.ts +8 -0
  152. package/lib/components/ui/ImageComponent.js +5 -0
  153. package/lib/components/ui/ImageUploader.d.ts +17 -0
  154. package/lib/components/ui/ImageUploader.js +144 -0
  155. package/lib/components/ui/Input.d.ts +4 -0
  156. package/lib/components/ui/Input.js +8 -0
  157. package/lib/components/ui/Label.d.ts +5 -0
  158. package/lib/components/ui/Label.js +9 -0
  159. package/lib/components/ui/Loader.d.ts +10 -0
  160. package/lib/components/ui/Loader.js +7 -0
  161. package/lib/components/ui/Modal.d.ts +72 -0
  162. package/lib/components/ui/Modal.js +31 -0
  163. package/lib/components/ui/MultiSelect.d.ts +16 -0
  164. package/lib/components/ui/MultiSelect.js +59 -0
  165. package/lib/components/ui/NotificationModal.d.ts +18 -0
  166. package/lib/components/ui/NotificationModal.js +40 -0
  167. package/lib/components/ui/PhoneInput.d.ts +12 -0
  168. package/lib/components/ui/PhoneInput.js +58 -0
  169. package/lib/components/ui/Popover.d.ts +7 -0
  170. package/lib/components/ui/Popover.js +10 -0
  171. package/lib/components/ui/Progress.d.ts +7 -0
  172. package/lib/components/ui/Progress.js +7 -0
  173. package/lib/components/ui/Radio.d.ts +5 -0
  174. package/lib/components/ui/Radio.js +14 -0
  175. package/lib/components/ui/RangeDatePicker.d.ts +78 -0
  176. package/lib/components/ui/RangeDatePicker.js +68 -0
  177. package/lib/components/ui/Select.d.ts +13 -0
  178. package/lib/components/ui/Select.js +57 -0
  179. package/lib/components/ui/Separator.d.ts +4 -0
  180. package/lib/components/ui/Separator.js +7 -0
  181. package/lib/components/ui/Sheet.d.ts +26 -0
  182. package/lib/components/ui/Sheet.js +37 -0
  183. package/lib/components/ui/StatusCell.d.ts +9 -0
  184. package/lib/components/ui/StatusCell.js +6 -0
  185. package/lib/components/ui/Switch.d.ts +10 -0
  186. package/lib/components/ui/Switch.js +22 -0
  187. package/lib/components/ui/Tab.d.ts +15 -0
  188. package/lib/components/ui/Tab.js +13 -0
  189. package/lib/components/ui/TableDownload.d.ts +11 -0
  190. package/lib/components/ui/TableDownload.js +82 -0
  191. package/lib/components/ui/TailwindIndicator.d.ts +1 -0
  192. package/lib/components/ui/TailwindIndicator.js +6 -0
  193. package/lib/components/ui/TextField.d.ts +60 -0
  194. package/lib/components/ui/TextField.js +42 -0
  195. package/lib/components/ui/Textarea.d.ts +5 -0
  196. package/lib/components/ui/Textarea.js +8 -0
  197. package/lib/components/ui/Toast.d.ts +12 -0
  198. package/lib/components/ui/Toast.js +25 -0
  199. package/lib/components/ui/UploadField.d.ts +15 -0
  200. package/lib/components/ui/UploadField.js +45 -0
  201. package/lib/components/ui/VerticalTab.d.ts +16 -0
  202. package/lib/components/ui/VerticalTab.js +13 -0
  203. package/lib/components/ui/index.d.ts +49 -0
  204. package/lib/components/ui/index.js +47 -0
  205. package/lib/context/BreadcrumbContext.d.ts +28 -0
  206. package/lib/context/BreadcrumbContext.js +238 -0
  207. package/lib/context/FormEngineDrawerProvider.d.ts +21 -0
  208. package/lib/context/FormEngineDrawerProvider.js +38 -0
  209. package/lib/context/MultiFormEngineDrawerProvider.d.ts +25 -0
  210. package/lib/context/MultiFormEngineDrawerProvider.js +89 -0
  211. package/lib/context/SidebarContext.d.ts +65 -0
  212. package/lib/context/SidebarContext.js +47 -0
  213. package/lib/context/ToastContext.d.ts +17 -0
  214. package/lib/context/ToastContext.js +29 -0
  215. package/lib/context/index.d.ts +5 -0
  216. package/lib/context/index.js +5 -0
  217. package/lib/dashboard-visuals/components/BaseChart.d.ts +55 -0
  218. package/lib/dashboard-visuals/components/BaseChart.js +201 -0
  219. package/lib/dashboard-visuals/components/CardWrapper.d.ts +10 -0
  220. package/lib/dashboard-visuals/components/CardWrapper.js +13 -0
  221. package/lib/dashboard-visuals/components/ChartDetailsModal.d.ts +57 -0
  222. package/lib/dashboard-visuals/components/ChartDetailsModal.js +27 -0
  223. package/lib/dashboard-visuals/components/ChartDetailsModalWrapper.d.ts +29 -0
  224. package/lib/dashboard-visuals/components/ChartDetailsModalWrapper.js +4 -0
  225. package/lib/dashboard-visuals/components/ChartFormatter.d.ts +22 -0
  226. package/lib/dashboard-visuals/components/ChartFormatter.js +46 -0
  227. package/lib/dashboard-visuals/components/ChartWrapper.d.ts +11 -0
  228. package/lib/dashboard-visuals/components/ChartWrapper.js +14 -0
  229. package/lib/dashboard-visuals/components/DashboardFilter.d.ts +8 -0
  230. package/lib/dashboard-visuals/components/DashboardFilter.js +17 -0
  231. package/lib/dashboard-visuals/components/DataTable.d.ts +3 -0
  232. package/lib/dashboard-visuals/components/DataTable.js +57 -0
  233. package/lib/dashboard-visuals/components/EmptyState.d.ts +6 -0
  234. package/lib/dashboard-visuals/components/EmptyState.js +6 -0
  235. package/lib/dashboard-visuals/components/ErrorState.d.ts +7 -0
  236. package/lib/dashboard-visuals/components/ErrorState.js +5 -0
  237. package/lib/dashboard-visuals/components/FilterComponentSkeleton.d.ts +3 -0
  238. package/lib/dashboard-visuals/components/FilterComponentSkeleton.js +11 -0
  239. package/lib/dashboard-visuals/components/Pagination.d.ts +10 -0
  240. package/lib/dashboard-visuals/components/Pagination.js +7 -0
  241. package/lib/dashboard-visuals/components/Switch.d.ts +8 -0
  242. package/lib/dashboard-visuals/components/Switch.js +10 -0
  243. package/lib/dashboard-visuals/components/TileSkeleton.d.ts +2 -0
  244. package/lib/dashboard-visuals/components/TileSkeleton.js +5 -0
  245. package/lib/dashboard-visuals/components/molecules/Analytics.d.ts +11 -0
  246. package/lib/dashboard-visuals/components/molecules/Analytics.js +9 -0
  247. package/lib/dashboard-visuals/components/molecules/DataGrid.d.ts +15 -0
  248. package/lib/dashboard-visuals/components/molecules/DataGrid.js +124 -0
  249. package/lib/dashboard-visuals/components/molecules/NoChartData.d.ts +6 -0
  250. package/lib/dashboard-visuals/components/molecules/NoChartData.js +6 -0
  251. package/lib/dashboard-visuals/components/molecules/VisualChart.d.ts +16 -0
  252. package/lib/dashboard-visuals/components/molecules/VisualChart.js +8 -0
  253. package/lib/dashboard-visuals/components/types.d.ts +62 -0
  254. package/lib/dashboard-visuals/components/types.js +1 -0
  255. package/lib/dashboard-visuals/hooks/useChartData.d.ts +15 -0
  256. package/lib/dashboard-visuals/hooks/useChartData.js +82 -0
  257. package/lib/dashboard-visuals/hooks/useTooltipFormatter.d.ts +13 -0
  258. package/lib/dashboard-visuals/hooks/useTooltipFormatter.js +10 -0
  259. package/lib/dashboard-visuals/index.d.ts +39 -0
  260. package/lib/dashboard-visuals/index.js +168 -0
  261. package/lib/dashboard-visuals/types/index.d.ts +83 -0
  262. package/lib/dashboard-visuals/types/index.js +1 -0
  263. package/lib/dashboard-visuals/types/metricDetailData.d.ts +25 -0
  264. package/lib/dashboard-visuals/types/metricDetailData.js +1 -0
  265. package/lib/dashboard-visuals/utils/api.d.ts +5 -0
  266. package/lib/dashboard-visuals/utils/api.js +6 -0
  267. package/lib/dashboard-visuals/utils/chartOptions.d.ts +481 -0
  268. package/lib/dashboard-visuals/utils/chartOptions.js +393 -0
  269. package/lib/dashboard-visuals/utils/chunkArray.d.ts +1 -0
  270. package/lib/dashboard-visuals/utils/chunkArray.js +7 -0
  271. package/lib/dashboard-visuals/utils/defaultColors.d.ts +1 -0
  272. package/lib/dashboard-visuals/utils/defaultColors.js +1 -0
  273. package/lib/dashboard-visuals/utils/formatUtil.d.ts +203 -0
  274. package/lib/dashboard-visuals/utils/formatUtil.js +472 -0
  275. package/lib/dashboard-visuals/utils/gridUtil.d.ts +11 -0
  276. package/lib/dashboard-visuals/utils/gridUtil.js +32 -0
  277. package/lib/dashboard-visuals/utils/index.d.ts +6 -0
  278. package/lib/dashboard-visuals/utils/index.js +6 -0
  279. package/lib/dashboard-visuals/utils/tooltipUtils.d.ts +11 -0
  280. package/lib/dashboard-visuals/utils/tooltipUtils.js +180 -0
  281. package/lib/dashboard-visuals/visualRegistry.d.ts +4 -0
  282. package/lib/dashboard-visuals/visualRegistry.js +41 -0
  283. package/lib/dashboard-visuals/visuals/BarChart.d.ts +58 -0
  284. package/lib/dashboard-visuals/visuals/BarChart.js +95 -0
  285. package/lib/dashboard-visuals/visuals/BarLineHybridChart.d.ts +33 -0
  286. package/lib/dashboard-visuals/visuals/BarLineHybridChart.js +60 -0
  287. package/lib/dashboard-visuals/visuals/BubbleChart.d.ts +25 -0
  288. package/lib/dashboard-visuals/visuals/BubbleChart.js +101 -0
  289. package/lib/dashboard-visuals/visuals/DistributionChart.d.ts +11 -0
  290. package/lib/dashboard-visuals/visuals/DistributionChart.js +48 -0
  291. package/lib/dashboard-visuals/visuals/DonutChart.d.ts +50 -0
  292. package/lib/dashboard-visuals/visuals/DonutChart.js +105 -0
  293. package/lib/dashboard-visuals/visuals/GaugeChart.d.ts +32 -0
  294. package/lib/dashboard-visuals/visuals/GaugeChart.js +53 -0
  295. package/lib/dashboard-visuals/visuals/GroupedBarChart.d.ts +47 -0
  296. package/lib/dashboard-visuals/visuals/GroupedBarChart.js +131 -0
  297. package/lib/dashboard-visuals/visuals/HeatmapChart.d.ts +79 -0
  298. package/lib/dashboard-visuals/visuals/HeatmapChart.js +146 -0
  299. package/lib/dashboard-visuals/visuals/HorizontalBarChart.d.ts +50 -0
  300. package/lib/dashboard-visuals/visuals/HorizontalBarChart.js +131 -0
  301. package/lib/dashboard-visuals/visuals/ItemPerformanceCard.d.ts +30 -0
  302. package/lib/dashboard-visuals/visuals/ItemPerformanceCard.js +31 -0
  303. package/lib/dashboard-visuals/visuals/LineChart.d.ts +56 -0
  304. package/lib/dashboard-visuals/visuals/LineChart.js +80 -0
  305. package/lib/dashboard-visuals/visuals/LineGraph.d.ts +50 -0
  306. package/lib/dashboard-visuals/visuals/LineGraph.js +189 -0
  307. package/lib/dashboard-visuals/visuals/MetricSummaryCard.d.ts +14 -0
  308. package/lib/dashboard-visuals/visuals/MetricSummaryCard.js +8 -0
  309. package/lib/dashboard-visuals/visuals/MultiGaugeChart.d.ts +39 -0
  310. package/lib/dashboard-visuals/visuals/MultiGaugeChart.js +119 -0
  311. package/lib/dashboard-visuals/visuals/PieChart.d.ts +59 -0
  312. package/lib/dashboard-visuals/visuals/PieChart.js +194 -0
  313. package/lib/dashboard-visuals/visuals/SelectedEventTile.d.ts +14 -0
  314. package/lib/dashboard-visuals/visuals/SelectedEventTile.js +35 -0
  315. package/lib/dashboard-visuals/visuals/SpeedometerChart.d.ts +53 -0
  316. package/lib/dashboard-visuals/visuals/SpeedometerChart.js +94 -0
  317. package/lib/dashboard-visuals/visuals/Table.d.ts +26 -0
  318. package/lib/dashboard-visuals/visuals/Table.js +113 -0
  319. package/lib/dashboard-visuals/visuals/Tile.d.ts +16 -0
  320. package/lib/dashboard-visuals/visuals/Tile.js +16 -0
  321. package/lib/dashboard-visuals/visuals/TreeMap.d.ts +25 -0
  322. package/lib/dashboard-visuals/visuals/TreeMap.js +45 -0
  323. package/lib/dashboard-visuals/visuals/WaterfallChart.d.ts +52 -0
  324. package/lib/dashboard-visuals/visuals/WaterfallChart.js +266 -0
  325. package/lib/form-engine/Form.d.ts +4 -0
  326. package/lib/form-engine/Form.js +14 -0
  327. package/lib/form-engine/FormEngine.d.ts +3 -0
  328. package/lib/form-engine/FormEngine.js +121 -0
  329. package/lib/form-engine/components/FieldWrapper.d.ts +18 -0
  330. package/lib/form-engine/components/FieldWrapper.js +63 -0
  331. package/lib/form-engine/components/index.d.ts +2 -0
  332. package/lib/form-engine/components/index.js +2 -0
  333. package/lib/form-engine/components/inputs/card-expiry-input/CardExpiryInput.d.ts +16 -0
  334. package/lib/form-engine/components/inputs/card-expiry-input/CardExpiryInput.js +48 -0
  335. package/lib/form-engine/components/inputs/checkbox-input/CheckboxInput.d.ts +4 -0
  336. package/lib/form-engine/components/inputs/checkbox-input/CheckboxInput.js +5 -0
  337. package/lib/form-engine/components/inputs/credit-card-input/CreditCardInput.d.ts +4 -0
  338. package/lib/form-engine/components/inputs/credit-card-input/CreditCardInput.js +82 -0
  339. package/lib/form-engine/components/inputs/date-input/DateInput.d.ts +4 -0
  340. package/lib/form-engine/components/inputs/date-input/DateInput.js +7 -0
  341. package/lib/form-engine/components/inputs/date-input/index.d.ts +1 -0
  342. package/lib/form-engine/components/inputs/date-input/index.js +1 -0
  343. package/lib/form-engine/components/inputs/email-input/EmailInput.d.ts +4 -0
  344. package/lib/form-engine/components/inputs/email-input/EmailInput.js +5 -0
  345. package/lib/form-engine/components/inputs/email-input/index.d.ts +1 -0
  346. package/lib/form-engine/components/inputs/email-input/index.js +1 -0
  347. package/lib/form-engine/components/inputs/index.d.ts +13 -0
  348. package/lib/form-engine/components/inputs/index.js +13 -0
  349. package/lib/form-engine/components/inputs/label-input/LabelInput.d.ts +4 -0
  350. package/lib/form-engine/components/inputs/label-input/LabelInput.js +7 -0
  351. package/lib/form-engine/components/inputs/label-input/index.d.ts +1 -0
  352. package/lib/form-engine/components/inputs/label-input/index.js +1 -0
  353. package/lib/form-engine/components/inputs/multi-select-input/MultiSelectInput.d.ts +4 -0
  354. package/lib/form-engine/components/inputs/multi-select-input/MultiSelectInput.js +5 -0
  355. package/lib/form-engine/components/inputs/number-input/NumberInput.d.ts +4 -0
  356. package/lib/form-engine/components/inputs/number-input/NumberInput.js +5 -0
  357. package/lib/form-engine/components/inputs/number-input/index.d.ts +1 -0
  358. package/lib/form-engine/components/inputs/number-input/index.js +1 -0
  359. package/lib/form-engine/components/inputs/password-input/PasswordInput.d.ts +4 -0
  360. package/lib/form-engine/components/inputs/password-input/PasswordInput.js +9 -0
  361. package/lib/form-engine/components/inputs/password-input/index.d.ts +1 -0
  362. package/lib/form-engine/components/inputs/password-input/index.js +1 -0
  363. package/lib/form-engine/components/inputs/radio-button/RadioInput.d.ts +4 -0
  364. package/lib/form-engine/components/inputs/radio-button/RadioInput.js +6 -0
  365. package/lib/form-engine/components/inputs/radio-button/index.d.ts +1 -0
  366. package/lib/form-engine/components/inputs/radio-button/index.js +1 -0
  367. package/lib/form-engine/components/inputs/select/SelectInput.d.ts +4 -0
  368. package/lib/form-engine/components/inputs/select/SelectInput.js +6 -0
  369. package/lib/form-engine/components/inputs/select/index.d.ts +1 -0
  370. package/lib/form-engine/components/inputs/select/index.js +1 -0
  371. package/lib/form-engine/components/inputs/textarea-input/TextareaInput.d.ts +4 -0
  372. package/lib/form-engine/components/inputs/textarea-input/TextareaInput.js +5 -0
  373. package/lib/form-engine/components/inputs/textarea-input/index.d.ts +1 -0
  374. package/lib/form-engine/components/inputs/textarea-input/index.js +1 -0
  375. package/lib/form-engine/components/inputs/time-input/TimeInput.d.ts +4 -0
  376. package/lib/form-engine/components/inputs/time-input/TimeInput.js +5 -0
  377. package/lib/form-engine/components/inputs/time-input/index.d.ts +1 -0
  378. package/lib/form-engine/components/inputs/time-input/index.js +1 -0
  379. package/lib/form-engine/components/inputs/toggle-switch-input/ToggleSwitchInput.d.ts +4 -0
  380. package/lib/form-engine/components/inputs/toggle-switch-input/ToggleSwitchInput.js +7 -0
  381. package/lib/form-engine/components/inputs/toggle-switch-input/index.d.ts +1 -0
  382. package/lib/form-engine/components/inputs/toggle-switch-input/index.js +1 -0
  383. package/lib/form-engine/components/inputs/upload-field/UploadFieldForm.d.ts +4 -0
  384. package/lib/form-engine/components/inputs/upload-field/UploadFieldForm.js +59 -0
  385. package/lib/form-engine/components/inputs/upload-field/index.d.ts +1 -0
  386. package/lib/form-engine/components/inputs/upload-field/index.js +1 -0
  387. package/lib/form-engine/hooks/useFormPersistence.d.ts +11 -0
  388. package/lib/form-engine/hooks/useFormPersistence.js +46 -0
  389. package/lib/form-engine/index.d.ts +5 -0
  390. package/lib/form-engine/index.js +5 -0
  391. package/lib/form-engine/registry/RegisterComponents.d.ts +1 -0
  392. package/lib/form-engine/registry/RegisterComponents.js +35 -0
  393. package/lib/form-engine/registry/Registry.d.ts +5 -0
  394. package/lib/form-engine/registry/Registry.js +13 -0
  395. package/lib/form-engine/registry/index.d.ts +2 -0
  396. package/lib/form-engine/registry/index.js +2 -0
  397. package/lib/form-engine/types/index.d.ts +311 -0
  398. package/lib/form-engine/types/index.js +1 -0
  399. package/lib/helpers/index.d.ts +2 -0
  400. package/lib/helpers/index.js +2 -0
  401. package/lib/helpers/utils.d.ts +37 -0
  402. package/lib/helpers/utils.js +77 -0
  403. package/lib/helpers/validations.d.ts +80 -0
  404. package/lib/helpers/validations.js +39 -0
  405. package/lib/index.d.ts +21 -0
  406. package/lib/index.js +30 -0
  407. package/lib/mocks/mockApiRequestsConfig.d.ts +2 -0
  408. package/lib/mocks/mockApiRequestsConfig.js +343 -0
  409. package/lib/pagamio-drawer/TopUpWalletDrawer/TopUpWalletContent.d.ts +14 -0
  410. package/lib/pagamio-drawer/TopUpWalletDrawer/TopUpWalletContent.js +40 -0
  411. package/lib/pagamio-drawer/TopUpWalletDrawer/index.d.ts +11 -0
  412. package/lib/pagamio-drawer/TopUpWalletDrawer/index.js +7 -0
  413. package/lib/pagamio-drawer/components/BaseDrawer.d.ts +11 -0
  414. package/lib/pagamio-drawer/components/BaseDrawer.js +10 -0
  415. package/lib/pagamio-drawer/components/DrawerContent.d.ts +27 -0
  416. package/lib/pagamio-drawer/components/DrawerContent.js +237 -0
  417. package/lib/pagamio-drawer/index.d.ts +22 -0
  418. package/lib/pagamio-drawer/index.js +133 -0
  419. package/lib/pagamio-table/data-table/ExportButton.d.ts +57 -0
  420. package/lib/pagamio-table/data-table/ExportButton.js +96 -0
  421. package/lib/pagamio-table/data-table/MantineCoreTable.d.ts +44 -0
  422. package/lib/pagamio-table/data-table/MantineCoreTable.js +129 -0
  423. package/lib/pagamio-table/data-table/Pagination.d.ts +10 -0
  424. package/lib/pagamio-table/data-table/Pagination.js +5 -0
  425. package/lib/pagamio-table/data-table/TableDownload.d.ts +8 -0
  426. package/lib/pagamio-table/data-table/TableDownload.js +81 -0
  427. package/lib/pagamio-table/data-table/TableToolbar.d.ts +3 -0
  428. package/lib/pagamio-table/data-table/TableToolbar.js +16 -0
  429. package/lib/pagamio-table/data-table/exportUtils.d.ts +42 -0
  430. package/lib/pagamio-table/data-table/exportUtils.js +782 -0
  431. package/lib/pagamio-table/data-table/index.d.ts +5 -0
  432. package/lib/pagamio-table/data-table/index.js +11 -0
  433. package/lib/pagamio-table/data-table/pdfExportUtils.d.ts +111 -0
  434. package/lib/pagamio-table/data-table/pdfExportUtils.js +113 -0
  435. package/lib/pagamio-table/data-table/types.d.ts +169 -0
  436. package/lib/pagamio-table/data-table/types.js +1 -0
  437. package/lib/pagamio-table/index.d.ts +4 -0
  438. package/lib/pagamio-table/index.js +4 -0
  439. package/lib/pagamio-table/utils/functionHelper.d.ts +12 -0
  440. package/lib/pagamio-table/utils/functionHelper.js +24 -0
  441. package/lib/pagamio-table/utils/index.d.ts +1 -0
  442. package/lib/pagamio-table/utils/index.js +1 -0
  443. package/lib/rbac/hooks.d.ts +39 -0
  444. package/lib/rbac/hooks.js +51 -0
  445. package/lib/rbac/index.d.ts +8 -0
  446. package/lib/rbac/index.js +11 -0
  447. package/lib/rbac/store.d.ts +24 -0
  448. package/lib/rbac/store.js +37 -0
  449. package/lib/rbac/types.d.ts +39 -0
  450. package/lib/rbac/types.js +4 -0
  451. package/lib/rbac/utils.d.ts +44 -0
  452. package/lib/rbac/utils.js +117 -0
  453. package/lib/shared/constants/index.d.ts +2 -0
  454. package/lib/shared/constants/index.js +2 -0
  455. package/lib/shared/hooks/index.d.ts +4 -0
  456. package/lib/shared/hooks/index.js +4 -0
  457. package/lib/shared/hooks/useAnyDrawerOpen.d.ts +4 -0
  458. package/lib/shared/hooks/useAnyDrawerOpen.js +18 -0
  459. package/lib/shared/hooks/useContainerWidth.d.ts +2 -0
  460. package/lib/shared/hooks/useContainerWidth.js +18 -0
  461. package/lib/shared/hooks/useImageUpload.d.ts +15 -0
  462. package/lib/shared/hooks/useImageUpload.js +66 -0
  463. package/lib/shared/hooks/useMediaQueries.d.ts +5 -0
  464. package/lib/shared/hooks/useMediaQueries.js +35 -0
  465. package/lib/shared/hooks/usePagamioTable.d.ts +158 -0
  466. package/lib/shared/hooks/usePagamioTable.js +475 -0
  467. package/lib/shared/hooks/useSessionTimer.d.ts +33 -0
  468. package/lib/shared/hooks/useSessionTimer.js +96 -0
  469. package/lib/shared/index.d.ts +4 -0
  470. package/lib/shared/index.js +4 -0
  471. package/lib/shared/types/index.d.ts +1 -0
  472. package/lib/shared/types/index.js +1 -0
  473. package/lib/shared/url/index.d.ts +9 -0
  474. package/lib/shared/url/index.js +20 -0
  475. package/lib/shared/utils/filterUtils.d.ts +5 -0
  476. package/lib/shared/utils/filterUtils.js +31 -0
  477. package/lib/shared/utils/functionHelper.d.ts +27 -0
  478. package/lib/shared/utils/functionHelper.js +124 -0
  479. package/lib/shared/utils/index.d.ts +2 -0
  480. package/lib/shared/utils/index.js +2 -0
  481. package/lib/shared/utils/localStorage.d.ts +53 -0
  482. package/lib/shared/utils/localStorage.js +139 -0
  483. package/lib/styles.css +6247 -0
  484. package/lib/translations/components/LocaleSwitcher.d.ts +7 -0
  485. package/lib/translations/components/LocaleSwitcher.js +18 -0
  486. package/lib/translations/components/index.d.ts +1 -0
  487. package/lib/translations/components/index.js +1 -0
  488. package/lib/translations/context/TranslationContext.d.ts +5 -0
  489. package/lib/translations/context/TranslationContext.js +151 -0
  490. package/lib/translations/context/index.d.ts +1 -0
  491. package/lib/translations/context/index.js +1 -0
  492. package/lib/translations/hooks/index.d.ts +2 -0
  493. package/lib/translations/hooks/index.js +2 -0
  494. package/lib/translations/hooks/useLibTranslations.d.ts +7 -0
  495. package/lib/translations/hooks/useLibTranslations.js +46 -0
  496. package/lib/translations/hooks/useTranslation.d.ts +7 -0
  497. package/lib/translations/hooks/useTranslation.js +11 -0
  498. package/lib/translations/index.d.ts +91 -0
  499. package/lib/translations/index.js +11 -0
  500. package/lib/translations/locales/en.json +21 -0
  501. package/lib/translations/locales/es.json +21 -0
  502. package/lib/translations/locales/fr.json +21 -0
  503. package/lib/translations/locales/pt.json +21 -0
  504. package/lib/translations/types/index.d.ts +24 -0
  505. package/lib/translations/types/index.js +1 -0
  506. package/lib/translations/utils/index.d.ts +6 -0
  507. package/lib/translations/utils/index.js +25 -0
  508. package/package.json +9 -1
@@ -0,0 +1,91 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import 'flowbite';
3
+ import { Datepicker } from 'flowbite-react';
4
+ import { useEffect, useState } from 'react';
5
+ function DatePicker({ value, disabled, name, onChange }) {
6
+ // Ensure initial value is a valid Date object
7
+ const getValidDate = (date) => {
8
+ if (!date)
9
+ return new Date(); // Return current date if no date is provided
10
+ const parsedDate = new Date(date);
11
+ return Number.isNaN(parsedDate.getTime()) ? new Date() : parsedDate;
12
+ };
13
+ // Initialize selectedDate with defaultValue or current date
14
+ const initialDate = value === undefined ? new Date() : getValidDate(value);
15
+ const [selectedDate, setSelectedDate] = useState(initialDate);
16
+ // Update selectedDate when value prop changes
17
+ useEffect(() => {
18
+ if (value === undefined)
19
+ return;
20
+ setSelectedDate(getValidDate(value));
21
+ }, [value]);
22
+ // Initialize defaultValue for the Datepicker component
23
+ const datepickerDefaultValue = new Date();
24
+ const datepickerTheme = {
25
+ root: {
26
+ input: {
27
+ field: {
28
+ base: 'w-full h-[36px] [&>input]:rounded-md [&>input]:border [&>input]:bg-transparent [&>input]:h-[36px]', // Added fixed height
29
+ },
30
+ },
31
+ },
32
+ popup: {
33
+ root: {
34
+ base: '!z-[1000] !absolute',
35
+ placement: '!z-[1000] top-12',
36
+ },
37
+ header: {
38
+ // Customize calendar header if needed
39
+ },
40
+ footer: {
41
+ button: {
42
+ today: 'bg-primary-500 text-white hover:bg-primary-600 dark:bg-primary-500 dark:hover:bg-primary-600',
43
+ clear: 'border border-gray-300 bg-white text-gray-900 hover:bg-gray-100 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:hover:bg-gray-600',
44
+ },
45
+ },
46
+ },
47
+ views: {
48
+ days: {
49
+ items: {
50
+ item: {
51
+ selected: 'bg-primary-500 text-white hover:bg-primary-600',
52
+ base: 'block flex-1 cursor-pointer rounded-lg border-0 text-center text-sm font-semibold leading-9 text-gray-900 hover:bg-gray-100 dark:text-white dark:hover:bg-gray-600',
53
+ },
54
+ },
55
+ },
56
+ months: {
57
+ items: {
58
+ item: {
59
+ selected: 'bg-primary-500 text-white hover:bg-primary-600',
60
+ base: 'block flex-1 cursor-pointer rounded-lg border-0 text-center text-sm font-semibold leading-9 text-gray-900 hover:bg-gray-100 dark:text-white dark:hover:bg-gray-600',
61
+ },
62
+ },
63
+ },
64
+ years: {
65
+ items: {
66
+ item: {
67
+ selected: 'bg-primary-500 text-white hover:bg-primary-600',
68
+ base: 'block flex-1 cursor-pointer rounded-lg border-0 text-center text-sm font-semibold leading-9 text-gray-900 hover:bg-gray-100 dark:text-white dark:hover:bg-gray-600',
69
+ },
70
+ },
71
+ },
72
+ decades: {
73
+ items: {
74
+ item: {
75
+ selected: 'bg-primary-500 text-white hover:bg-primary-600',
76
+ base: 'block flex-1 cursor-pointer rounded-lg border-0 text-center text-sm font-semibold leading-9 text-gray-900 hover:bg-gray-100 dark:text-white dark:hover:bg-gray-600',
77
+ },
78
+ },
79
+ },
80
+ },
81
+ };
82
+ return (_jsx("div", { children: _jsx(Datepicker, { value: selectedDate, onChange: (date) => {
83
+ // Ensure we're working with a valid Date object
84
+ const validDate = date ? new Date(date) : new Date();
85
+ setSelectedDate(validDate);
86
+ if (onChange && !Number.isNaN(validDate.getTime())) {
87
+ onChange(validDate);
88
+ }
89
+ }, defaultValue: datepickerDefaultValue, name: name, className: "", disabled: disabled, theme: datepickerTheme }) }));
90
+ }
91
+ export default DatePicker;
@@ -0,0 +1,38 @@
1
+ import 'react-datepicker/dist/react-datepicker.css';
2
+ import React from 'react';
3
+ /**
4
+ * Props for the CustomDateRangeModal component
5
+ */
6
+ interface CustomDateRangeModalProps {
7
+ isOpen: boolean;
8
+ showTimeSelect: boolean;
9
+ onClose: () => void;
10
+ onApply: (startDate: string, endDate: string) => void;
11
+ initialStartDate?: string;
12
+ initialEndDate?: string;
13
+ minDate?: Date;
14
+ maxDate?: Date;
15
+ timeIntervals?: number;
16
+ /**
17
+ * Date format string using date-fns formatting tokens
18
+ * @see https://date-fns.org/v2.30.0/docs/format
19
+ * @example 'dd/MM/yyyy' - 01/04/2023
20
+ * @example 'MM/dd/yyyy' - 04/01/2023
21
+ * @example 'yyyy-MM-dd' - 2023-04-01
22
+ * @example 'MMMM d, yyyy' - April 1, 2023
23
+ * @default 'dd/MM/yyyy'
24
+ */
25
+ dateFormat?: string;
26
+ /**
27
+ * Time format string using date-fns formatting tokens
28
+ * @see https://date-fns.org/v2.30.0/docs/format
29
+ * @example 'h:mm aa' - 2:30 pm
30
+ * @example 'HH:mm' - 14:30
31
+ * @example 'h:mm:ss a' - 2:30:00 pm
32
+ * @example 'HH:mm:ss' - 14:30:00
33
+ * @default 'h:mm aa'
34
+ */
35
+ timeFormat?: string;
36
+ }
37
+ declare const CustomDateRangeModal: React.FC<CustomDateRangeModalProps>;
38
+ export default CustomDateRangeModal;
@@ -0,0 +1,89 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { endOfDay, format, isBefore, isEqual, isValid, parse, parseISO, startOfDay } from 'date-fns';
3
+ import { Modal } from 'flowbite-react';
4
+ import DatePicker from 'react-datepicker';
5
+ import 'react-datepicker/dist/react-datepicker.css';
6
+ import { useEffect, useState } from 'react';
7
+ import { Button } from '../ui';
8
+ const CustomDateRangeModal = ({ isOpen, showTimeSelect, onClose, onApply, initialStartDate, initialEndDate, minDate, maxDate, dateFormat = 'dd/MM/yyyy', timeFormat = 'h:mm aa', timeIntervals = 15, }) => {
9
+ // Parse date string to Date object using the specified format
10
+ const parseInitialDate = (dateString, isEndDate = false) => {
11
+ if (!dateString) {
12
+ const now = new Date();
13
+ return isEndDate ? endOfDay(now) : startOfDay(now);
14
+ }
15
+ try {
16
+ // Try to parse using the provided format
17
+ const parsedDate = parse(dateString, dateFormat, new Date());
18
+ // Check if the date is valid
19
+ if (!isValid(parsedDate)) {
20
+ throw new Error('Invalid date');
21
+ }
22
+ return isEndDate ? endOfDay(parsedDate) : startOfDay(parsedDate);
23
+ }
24
+ catch (error) {
25
+ // Fallback to ISO format if the format parsing fails
26
+ try {
27
+ const isoDate = parseISO(dateString);
28
+ if (isValid(isoDate)) {
29
+ return isEndDate ? endOfDay(isoDate) : startOfDay(isoDate);
30
+ }
31
+ }
32
+ catch {
33
+ // Ignore ISO parsing error
34
+ console.error(error);
35
+ }
36
+ // Return current date if all parsing attempts fail
37
+ const now = new Date();
38
+ return isEndDate ? endOfDay(now) : startOfDay(now);
39
+ }
40
+ };
41
+ const [startDate, setStartDate] = useState(parseInitialDate(initialStartDate));
42
+ const [endDate, setEndDate] = useState(parseInitialDate(initialEndDate, true));
43
+ const [isValidRange, setIsValidRange] = useState(true);
44
+ // Define the complete format for DatePicker
45
+ const datePickerFormat = showTimeSelect ? `${dateFormat} ${timeFormat}` : dateFormat;
46
+ // Update internal state when initial values change
47
+ useEffect(() => {
48
+ if (initialStartDate)
49
+ setStartDate(parseInitialDate(initialStartDate));
50
+ if (initialEndDate)
51
+ setEndDate(parseInitialDate(initialEndDate, true));
52
+ }, [initialStartDate, initialEndDate, dateFormat]);
53
+ // Validate date range whenever dates change
54
+ useEffect(() => {
55
+ setIsValidRange(isBefore(startDate, endDate) ?? isEqual(startDate, endDate));
56
+ }, [startDate, endDate]);
57
+ const handleApply = () => {
58
+ if (!isValidRange)
59
+ return;
60
+ // Format dates appropriately before applying
61
+ const formattedStartDate = showTimeSelect
62
+ ? format(startDate, `${dateFormat} ${timeFormat}`)
63
+ : format(startOfDay(startDate), dateFormat);
64
+ const formattedEndDate = showTimeSelect
65
+ ? format(endDate, `${dateFormat} ${timeFormat}`)
66
+ : format(endOfDay(endDate), dateFormat);
67
+ onApply(formattedStartDate, formattedEndDate);
68
+ onClose();
69
+ };
70
+ const handleStartDateChange = (date) => {
71
+ if (date) {
72
+ const newDate = showTimeSelect ? date : startOfDay(date);
73
+ setStartDate(newDate);
74
+ // Auto-adjust end date if it's before start date
75
+ if (isBefore(endDate, newDate)) {
76
+ const newEndDate = showTimeSelect ? newDate : endOfDay(newDate);
77
+ setEndDate(newEndDate);
78
+ }
79
+ }
80
+ };
81
+ const handleEndDateChange = (date) => {
82
+ if (date) {
83
+ const newDate = showTimeSelect ? date : endOfDay(date);
84
+ setEndDate(newDate);
85
+ }
86
+ };
87
+ return (_jsxs(Modal, { show: isOpen, size: "xl", popup: true, onClose: onClose, dismissible: true, children: [_jsx(Modal.Header, { className: "border-b border-gray-200", children: _jsx("h3", { className: "px-4 text-lg font-bold text-gray-900", children: "Select Custom Date Range" }) }), _jsx(Modal.Body, { className: "p-6", children: _jsxs("div", { className: "flex flex-col space-y-4", children: [_jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [_jsxs("div", { className: "flex flex-col", children: [_jsx("label", { htmlFor: "startDate", className: "mb-2 text-sm font-medium text-gray-700", children: "Start Date" }), _jsx(DatePicker, { selected: startDate, onChange: handleStartDateChange, selectsStart: true, startDate: startDate, endDate: endDate, showTimeSelect: showTimeSelect, timeIntervals: timeIntervals, dateFormat: datePickerFormat, placeholderText: "Select start date", className: `w-full rounded-md border ${!isValidRange ? 'border-red-500' : 'border-gray-300'} px-3 py-2 shadow-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500`, minDate: minDate, maxDate: maxDate })] }), _jsxs("div", { className: "flex flex-col", children: [_jsx("label", { htmlFor: "endDate", className: "mb-2 text-sm font-medium text-gray-700", children: "End Date" }), _jsx(DatePicker, { selected: endDate, onChange: handleEndDateChange, selectsEnd: true, startDate: startDate, endDate: endDate, minDate: startDate, maxDate: maxDate, showTimeSelect: showTimeSelect, timeIntervals: timeIntervals, dateFormat: datePickerFormat, placeholderText: "Select end date", className: `w-full rounded-md border ${!isValidRange ? 'border-red-500' : 'border-gray-300'} px-3 py-2 shadow-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500` })] })] }), !isValidRange && _jsx("p", { className: "text-sm text-red-600 mt-2", children: "End date must be on or after start date." })] }) }), _jsxs(Modal.Footer, { className: "flex justify-end space-x-3 border-t border-gray-200 px-6 py-4", children: [_jsx(Button, { variant: "outline", onClick: onClose, className: "px-4 py-2", children: "Cancel" }), _jsx(Button, { variant: "primary", onClick: handleApply, disabled: !isValidRange, className: "px-4 py-2 disabled:opacity-50 disabled:cursor-not-allowed", children: "Apply" })] })] }));
88
+ };
89
+ export default CustomDateRangeModal;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ export interface DataItem {
3
+ label: string;
4
+ value: React.ReactNode;
5
+ id?: string | number;
6
+ }
7
+ interface DetailsCardProps {
8
+ loading: boolean;
9
+ data: DataItem[];
10
+ buttonText: string;
11
+ showButton?: boolean;
12
+ onClickButton: () => void;
13
+ actionContent?: React.ReactNode;
14
+ }
15
+ declare const DetailsCard: ({ data, loading, buttonText, showButton, onClickButton, actionContent, }: DetailsCardProps) => JSX.Element | null;
16
+ export default DetailsCard;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Card } from 'flowbite-react';
3
+ import Button from './Button';
4
+ import LoaderComponent from './Loader';
5
+ const DetailsCard = ({ data, loading, buttonText, showButton = true, onClickButton, actionContent, }) => {
6
+ if (!loading && (!data || data.length === 0)) {
7
+ return null;
8
+ }
9
+ return (_jsx("div", { className: "flex flex-col", children: _jsxs(Card, { children: [loading ? (_jsx("div", { className: "mb-2 grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-4", children: _jsx("div", { className: "flex items-center justify-center col-span-full", children: _jsx(LoaderComponent, {}) }) })) : (_jsx("div", { className: "mb-2 grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-4", children: data.map((item) => {
10
+ const capitalizedLabel = item.label.charAt(0).toUpperCase() + item.label.slice(1);
11
+ return (_jsxs("div", { className: "flex flex-col", children: [_jsx("div", { className: "mb-1 font-medium text-sm text-gray-500 dark:text-gray-300", children: capitalizedLabel }), _jsx("div", { className: "text-gray-900 text-sm dark:text-white break-words", children: item.value })] }, item.id));
12
+ }) })), !loading && (_jsxs("div", { className: "flex justify-end gap-2 items-center", children: [actionContent && _jsx("div", { className: "flex-1 flex flex-row text-sm justify-end", children: actionContent }), showButton && (_jsx("div", { className: `flex ${actionContent ? 'justify-end' : 'justify-center sm:justify-end'}`, children: _jsx(Button, { type: "button", variant: "primary", disabled: loading, onClick: onClickButton, className: "text-sm", children: buttonText }) }))] }))] }) }));
13
+ };
14
+ export default DetailsCard;
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import type { Field } from '../../form-engine';
3
+ import type { DataItem } from './DetailsCard';
4
+ interface FormEngineConfig {
5
+ title: string;
6
+ isOpen: boolean;
7
+ onClose: () => void;
8
+ onSubmit: (data: any) => Promise<void>;
9
+ fields: Field[];
10
+ initialValues: Record<string, any>;
11
+ submitButtonText: string;
12
+ marginTop?: string;
13
+ drawerKey?: string;
14
+ persistenceKey?: string;
15
+ onFieldChange?: (fieldName: string, value: any) => void;
16
+ onFieldUpdate?: Record<string, any[]>;
17
+ children?: React.ReactNode;
18
+ }
19
+ export interface DetailsPageProps {
20
+ id: string;
21
+ parentId?: string;
22
+ title: string;
23
+ loading: boolean;
24
+ detailsData: DataItem[];
25
+ canEdit?: boolean;
26
+ onEdit?: () => void;
27
+ editButtonText?: string;
28
+ actionContent?: React.ReactNode;
29
+ entityName?: string;
30
+ parentEntityName?: string;
31
+ formEngineConfig?: FormEngineConfig;
32
+ tabComponent?: React.ComponentType<any>;
33
+ tabProps?: any;
34
+ }
35
+ declare const DetailsPage: React.FC<DetailsPageProps>;
36
+ export default DetailsPage;
@@ -0,0 +1,50 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useEffect, useMemo } from 'react';
3
+ import { useAppBreadcrumbs } from '../../context';
4
+ import { truncateId } from '../../dashboard-visuals/utils/formatUtil';
5
+ import FormEngineDrawer from '../../pagamio-drawer/index';
6
+ import { AppPageHeader } from '../layout';
7
+ import DetailsCard from './DetailsCard';
8
+ import HoverableValue from './HoverableValue';
9
+ const formatId = (value) => (_jsx(HoverableValue, { value: value.toString(), truncatedValue: truncateId(value, { startChars: 4, endChars: 4 }) }));
10
+ const DetailsPage = ({ id, parentId, title, loading, detailsData, canEdit, onEdit, editButtonText = 'Edit', actionContent, entityName, parentEntityName, formEngineConfig, tabComponent, tabProps, }) => {
11
+ const { updateBreadcrumb } = useAppBreadcrumbs();
12
+ // Format IDs in details data
13
+ const formattedDetailsData = useMemo(() => detailsData.map((item) => {
14
+ // Only format ID fields specially
15
+ if (item.label.toLowerCase() === 'id') {
16
+ let displayValue = '';
17
+ if (typeof item.value === 'string' || typeof item.value === 'number') {
18
+ displayValue = item.value.toString();
19
+ }
20
+ else if (React.isValidElement(item.value)) {
21
+ displayValue = 'React Component';
22
+ }
23
+ else if (typeof item.value === 'object' && item.value !== null) {
24
+ displayValue = 'Object';
25
+ }
26
+ else if (item.value != null) {
27
+ displayValue = String(item.value);
28
+ }
29
+ return {
30
+ ...item,
31
+ value: formatId(displayValue),
32
+ };
33
+ }
34
+ // For non-ID fields, return as-is (React components are fine)
35
+ return item;
36
+ }), [detailsData]);
37
+ // Handle breadcrumb updates
38
+ useEffect(() => {
39
+ if (parentId && parentEntityName) {
40
+ updateBreadcrumb(parentId, parentEntityName);
41
+ }
42
+ if (id && entityName) {
43
+ updateBreadcrumb(id, entityName);
44
+ }
45
+ }, [id, parentId, entityName, parentEntityName, updateBreadcrumb]);
46
+ // Capitalize the component for JSX usage
47
+ const TabComponent = tabComponent;
48
+ return (_jsxs("div", { children: [_jsx(AppPageHeader, { title: title }), _jsx(DetailsCard, { loading: loading, data: formattedDetailsData, buttonText: editButtonText, showButton: canEdit, onClickButton: onEdit || (() => { }), actionContent: actionContent }), TabComponent && _jsx(TabComponent, { ...tabProps }), formEngineConfig && (_jsx(FormEngineDrawer, { title: formEngineConfig.title, isOpen: formEngineConfig.isOpen, onClose: formEngineConfig.onClose, onSubmit: formEngineConfig.onSubmit, fields: formEngineConfig.fields, initialValues: formEngineConfig.initialValues, submitButtonText: formEngineConfig.submitButtonText, marginTop: formEngineConfig.marginTop, onFieldChange: formEngineConfig.onFieldChange, onFieldUpdate: formEngineConfig.onFieldUpdate, persistenceKey: formEngineConfig.persistenceKey, children: formEngineConfig.children }, formEngineConfig.drawerKey))] }));
49
+ };
50
+ export default DetailsPage;
@@ -0,0 +1,19 @@
1
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
2
+ import * as React from 'react';
3
+ declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
4
+ declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
5
+ declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
6
+ declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
7
+ declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
8
+ declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
9
+ declare const DialogHeader: {
10
+ ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
11
+ displayName: string;
12
+ };
13
+ declare const DialogFooter: {
14
+ ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
15
+ displayName: string;
16
+ };
17
+ declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
18
+ declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
19
+ export { Dialog, DialogPortal, DialogOverlay, DialogTrigger, DialogClose, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, };
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
3
+ import { Cross2Icon } from '@radix-ui/react-icons';
4
+ import * as React from 'react';
5
+ import { cn } from '../../helpers/utils';
6
+ const Dialog = DialogPrimitive.Root;
7
+ const DialogTrigger = DialogPrimitive.Trigger;
8
+ const DialogPortal = DialogPrimitive.Portal;
9
+ const DialogClose = DialogPrimitive.Close;
10
+ const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Overlay, { ref: ref, className: cn('fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0', className), ...props })));
11
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
12
+ const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { ref: ref, className: cn('fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg', className), ...props, children: [children, _jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [_jsx(Cross2Icon, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: "Close" })] })] })] })));
13
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
14
+ const DialogHeader = ({ className, ...props }) => (_jsx("div", { className: cn('flex flex-col space-y-1.5 text-center sm:text-left', className), ...props }));
15
+ DialogHeader.displayName = 'DialogHeader';
16
+ const DialogFooter = ({ className, ...props }) => (_jsx("div", { className: cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className), ...props }));
17
+ DialogFooter.displayName = 'DialogFooter';
18
+ const DialogTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Title, { ref: ref, className: cn('text-lg font-semibold leading-none tracking-tight', className), ...props })));
19
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
20
+ const DialogDescription = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Description, { ref: ref, className: cn('text-sm text-muted-foreground', className), ...props })));
21
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
22
+ export { Dialog, DialogPortal, DialogOverlay, DialogTrigger, DialogClose, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription, };
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ interface EmptyStateProps {
3
+ title: string;
4
+ }
5
+ declare const EmptyState: React.FC<EmptyStateProps>;
6
+ export default EmptyState;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { MdOutlineFolder } from 'react-icons/md';
3
+ const EmptyState = ({ title }) => {
4
+ return (_jsxs("div", { className: "flex flex-col items-center justify-center rounded-lg border border-gray-300 bg-gray-50 p-8 text-center", children: [_jsx("div", { className: "mb-4 flex h-32 w-32 items-center justify-center", children: _jsx(MdOutlineFolder, { className: "h-full w-full text-gray-400" }) }), _jsxs("h2", { className: "mb-2 text-lg font-semibold text-gray-800", children: ["No ", title, " Data Found"] }), _jsxs("p", { className: "text-gray-600", children: ["We couldn't find any ", title.toLowerCase(), " data at this moment. Please try again later or adjust your filters."] })] }));
5
+ };
6
+ export default EmptyState;
@@ -0,0 +1,30 @@
1
+ import type { ChangeEvent } from 'react';
2
+ import React from 'react';
3
+ interface FilterComponentProps {
4
+ filters: Array<{
5
+ name: string;
6
+ placeholder?: string;
7
+ type: 'select' | 'multi-select' | 'date';
8
+ options?: Array<{
9
+ label: string;
10
+ value: string;
11
+ }>;
12
+ dateValue?: Date | null;
13
+ onDateChange?: (date: Date) => void;
14
+ }>;
15
+ searctInputPlaceHolder?: string;
16
+ showApplyFilterButton?: boolean;
17
+ showClearFilters: boolean;
18
+ showApplyFilters?: boolean;
19
+ selectedFilters: Record<string, string | string[] | Date | null>;
20
+ showSearch?: boolean;
21
+ searchQuery?: string;
22
+ isNarrow: boolean;
23
+ children?: React.ReactNode;
24
+ handleFilterChange: (name: string, value: string | string[] | Date | null) => void;
25
+ handleApplyFilters: () => void;
26
+ resetFilters: () => void;
27
+ onSearch?: (e: ChangeEvent<HTMLInputElement>) => void;
28
+ }
29
+ declare const FilterComponent: React.FC<FilterComponentProps>;
30
+ export default FilterComponent;
@@ -0,0 +1,80 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Input, MultiSelect, Select } from '@mantine/core';
3
+ import { IconSearch } from '@tabler/icons-react';
4
+ import { isDefaultFilterValue } from '../../shared/utils/filterUtils';
5
+ import Button from './Button';
6
+ import DatePicker from './DatePicker';
7
+ import FilterWrapper from './FilterWrapper';
8
+ const sharedStyles = {
9
+ input: {
10
+ borderRadius: '6px',
11
+ },
12
+ label: {
13
+ fontSize: '13px',
14
+ },
15
+ width: '100%',
16
+ };
17
+ const selectComponentProps = {
18
+ input: {
19
+ '&[type="search"]': {
20
+ borderRadius: '6px',
21
+ fontSize: '0.8rem',
22
+ height: '39px',
23
+ },
24
+ },
25
+ dropdown: {
26
+ '& .mantine-Select-item': {
27
+ fontSize: '0.75rem',
28
+ },
29
+ },
30
+ };
31
+ const commonProps = {
32
+ size: 'md',
33
+ style: { width: 240 },
34
+ };
35
+ const FilterComponent = ({ filters, selectedFilters, showApplyFilterButton = true, showClearFilters, searctInputPlaceHolder = 'Search...', showApplyFilters = true, showSearch = false, searchQuery = '', children, isNarrow, handleFilterChange, handleApplyFilters, resetFilters, onSearch = () => { }, }) => {
36
+ const hasSelectedActiveFilters = Object.entries(selectedFilters).some(([key, v]) => !isDefaultFilterValue(v, key));
37
+ const shouldShowActionButtons = hasSelectedActiveFilters || (showSearch && searchQuery.length > 0);
38
+ // Keyboard handler for search input
39
+ const handleSearchKeyDown = (e) => {
40
+ if (e.key === 'Enter') {
41
+ handleApplyFilters();
42
+ }
43
+ else if (e.key === 'Escape') {
44
+ onSearch({ target: { value: '' } });
45
+ resetFilters();
46
+ }
47
+ };
48
+ // Keyboard handler for select/multiselect (dropdown) filters
49
+ const handleFilterKeyDown = (e, name) => {
50
+ if (e.key === 'Enter') {
51
+ handleApplyFilters();
52
+ }
53
+ else if (e.key === 'Escape') {
54
+ handleFilterChange(name, '');
55
+ resetFilters();
56
+ }
57
+ };
58
+ return (_jsxs(FilterWrapper, { isNarrow: isNarrow, children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [showSearch && (_jsx("div", { className: "w-full sm:w-[300px]", children: _jsx(Input, { icon: _jsx(IconSearch, { size: 16 }), placeholder: searctInputPlaceHolder, value: searchQuery, onChange: (event) => onSearch(event), onKeyDown: handleSearchKeyDown, className: "w-full", sx: { input: { height: 39 } }, "aria-label": "Search" }) })), filters.map((filter) => {
59
+ const { name, type, options } = filter;
60
+ const value = selectedFilters[name];
61
+ const renderFilterInput = () => {
62
+ if (type === 'date') {
63
+ return (_jsx(DatePicker, { value: value || null, onChange: (date) => handleFilterChange(name, date), placeholder: filter.placeholder ?? `Select ${name}` }));
64
+ }
65
+ if (type === 'multi-select') {
66
+ return (_jsx(MultiSelect, { data: options || [], placeholder: filter.placeholder ?? `Select ${name}`, value: value || [], onChange: (val) => handleFilterChange(name, val), searchable: true, clearable: true, className: "w-full", styles: { ...sharedStyles }, sx: {
67
+ 'input[type="search"]': {
68
+ fontSize: '0.9rem',
69
+ },
70
+ }, ...commonProps, onKeyDown: (e) => handleFilterKeyDown(e, name), "aria-label": filter.placeholder ?? name }));
71
+ }
72
+ return (_jsx(Select, { data: options || [], placeholder: filter.placeholder ?? `Select ${name}`, value: value || null, onChange: (val) => handleFilterChange(name, val), searchable: true, clearable: true, className: "w-full", styles: {
73
+ ...sharedStyles,
74
+ ...selectComponentProps,
75
+ }, onKeyDown: (e) => handleFilterKeyDown(e, name), "aria-label": filter.placeholder ?? name }));
76
+ };
77
+ return (_jsx("div", { className: "w-full sm:w-[240px]", children: renderFilterInput() }, name));
78
+ }), showApplyFilterButton && shouldShowActionButtons && (_jsx(Button, { onClick: handleApplyFilters, variant: "primary", className: "w-full sm:w-auto", style: { height: 39 }, tabIndex: 0, "aria-label": "Apply Filters", children: "Apply Filters" })), showClearFilters && shouldShowActionButtons && (_jsx(Button, { onClick: resetFilters, variant: "outline-primary", className: "w-full sm:w-auto", style: { height: 39 }, tabIndex: 0, "aria-label": "Clear Filters", children: "Clear Filters" }))] }), children] }));
79
+ };
80
+ export default FilterComponent;
@@ -0,0 +1,52 @@
1
+ import React from 'react';
2
+ import { type SelectOption } from '../../form-engine';
3
+ /**
4
+ * Props for FilterList component
5
+ */
6
+ interface FilterListProps<T extends SelectOption = SelectOption> {
7
+ /** Array of options to display in the list */
8
+ options: T[];
9
+ /** Selected value for single-select mode */
10
+ selectedValue?: string;
11
+ /** Array of selected values for multi-select mode */
12
+ selectedValues?: string[];
13
+ /** Input name attribute for radio buttons (required for single-select) */
14
+ name?: string;
15
+ /** Whether the list allows multiple selections */
16
+ isMultiSelect?: boolean;
17
+ /** Handler function called when a selection changes */
18
+ onChange: (value: string) => void;
19
+ /** Prefix for input IDs to ensure uniqueness */
20
+ idPrefix: string;
21
+ /** ItemsPerPage, the options list is paginated */
22
+ itemsPerPage?: number;
23
+ }
24
+ /**
25
+ * FilterList component for displaying filterable, searchable lists of options
26
+ * Supports both single-select (radio buttons) and multi-select (checkboxes)
27
+ * Generic type T extends SelectOption to allow for custom option types
28
+ *
29
+ * @example
30
+ * ```tsx
31
+ * // Single-select mode
32
+ * <FilterList
33
+ * options={categoryOptions}
34
+ * selectedValue={filters.categoryId}
35
+ * name="category"
36
+ * onChange={handleCategoryChange}
37
+ * idPrefix="category"
38
+ * />
39
+ *
40
+ * // Multi-select mode
41
+ * <FilterList
42
+ * options={locationOptions}
43
+ * selectedValues={filters.locations}
44
+ * isMultiSelect={true}
45
+ * onChange={handleLocationChange}
46
+ * idPrefix="location"
47
+ * />
48
+ * ```
49
+ */
50
+ declare const FilterList: React.FC<FilterListProps>;
51
+ export default FilterList;
52
+ export type { FilterListProps };
@@ -0,0 +1,62 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Checkbox, Radio } from 'flowbite-react';
4
+ import { FiChevronLeft, FiChevronRight } from 'react-icons/fi';
5
+ import { RiSearchLine } from 'react-icons/ri';
6
+ import { useMemo, useState } from 'react';
7
+ /**
8
+ * FilterList component for displaying filterable, searchable lists of options
9
+ * Supports both single-select (radio buttons) and multi-select (checkboxes)
10
+ * Generic type T extends SelectOption to allow for custom option types
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * // Single-select mode
15
+ * <FilterList
16
+ * options={categoryOptions}
17
+ * selectedValue={filters.categoryId}
18
+ * name="category"
19
+ * onChange={handleCategoryChange}
20
+ * idPrefix="category"
21
+ * />
22
+ *
23
+ * // Multi-select mode
24
+ * <FilterList
25
+ * options={locationOptions}
26
+ * selectedValues={filters.locations}
27
+ * isMultiSelect={true}
28
+ * onChange={handleLocationChange}
29
+ * idPrefix="location"
30
+ * />
31
+ * ```
32
+ */
33
+ const FilterList = ({ options, selectedValue, selectedValues = [], name, isMultiSelect = false, onChange, idPrefix, itemsPerPage = 10, }) => {
34
+ const [searchQuery, setSearchQuery] = useState('');
35
+ const [currentPage, setCurrentPage] = useState(1);
36
+ const filteredOptions = useMemo(() => {
37
+ return options?.filter((option) => option.label.toLowerCase().includes(searchQuery.toLowerCase())) ?? [];
38
+ }, [options, searchQuery]);
39
+ const totalPages = Math.ceil(filteredOptions?.length / itemsPerPage);
40
+ const displayedOptions = useMemo(() => {
41
+ const startIndex = (currentPage - 1) * itemsPerPage;
42
+ return filteredOptions?.slice(startIndex, startIndex + itemsPerPage) ?? [];
43
+ }, [filteredOptions, currentPage, itemsPerPage]);
44
+ const handleNextPage = () => {
45
+ if (currentPage < totalPages) {
46
+ setCurrentPage(currentPage + 1);
47
+ }
48
+ };
49
+ const handlePrevPage = () => {
50
+ if (currentPage > 1) {
51
+ setCurrentPage(currentPage - 1);
52
+ }
53
+ };
54
+ const handleChange = (optionValue) => {
55
+ onChange(optionValue);
56
+ };
57
+ return (_jsxs("div", { children: [_jsxs("div", { className: "relative mb-3", children: [_jsx("div", { className: "pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3", children: _jsx(RiSearchLine, { className: "text-gray-500", "aria-hidden": "true" }) }), _jsx("input", { type: "text", className: "block w-full rounded-lg border border-gray-300 bg-white p-2 pl-10 text-sm text-gray-900 focus:border-primary-500 focus:ring-primary-500", placeholder: `Search ${isMultiSelect ? 'locations' : ''}...`, value: searchQuery, onChange: (e) => {
58
+ setSearchQuery(e.target.value);
59
+ setCurrentPage(1);
60
+ }, "aria-label": `Search ${isMultiSelect ? 'locations' : 'options'}` })] }), _jsx("fieldset", { className: "max-h-100 space-y-1 overflow-y-auto", children: displayedOptions?.length > 0 ? (displayedOptions.map((option) => (_jsxs("div", { className: "flex items-center rounded-md p-1 transition-colors hover:bg-primary-50", children: [isMultiSelect ? (_jsx(Checkbox, { id: `${idPrefix}-${option.value}`, checked: selectedValues.includes(option.value), onChange: () => handleChange(option.value), className: "text-primary-600 focus:ring-primary-500" })) : (_jsx(Radio, { id: `${idPrefix}-${option.value}`, name: name, value: option.value, checked: selectedValue === option.value, onChange: () => handleChange(option.value), className: "text-primary-600 focus:ring-primary-500" })), _jsx("label", { htmlFor: `${idPrefix}-${option.value}`, className: "ml-2 text-sm font-medium text-gray-900", children: option.label })] }, `${option.value}`)))) : (_jsx("p", { className: "text-sm text-gray-500", children: "No options found" })) }), filteredOptions?.length > itemsPerPage && (_jsxs("div", { className: "mt-3 flex items-center justify-between text-sm", children: [_jsxs("button", { onClick: handlePrevPage, disabled: currentPage === 1, className: `flex items-center ${currentPage === 1 ? 'cursor-not-allowed text-gray-300' : 'text-primary-600 hover:text-primary-700'}`, "aria-label": "Previous page", children: [_jsx(FiChevronLeft, { className: "mr-1", "aria-hidden": "true" }), "Prev"] }), _jsxs("span", { className: "text-xs text-gray-500", children: ["Page ", currentPage, " of ", totalPages] }), _jsxs("button", { onClick: handleNextPage, disabled: currentPage >= totalPages, className: `flex items-center ${currentPage >= totalPages ? 'cursor-not-allowed text-gray-300' : 'text-primary-600 hover:text-primary-700'}`, "aria-label": "Next page", children: ["Next", _jsx(FiChevronRight, { className: "ml-1", "aria-hidden": "true" })] })] }))] }));
61
+ };
62
+ export default FilterList;