@ifto/mantine-kit 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (301) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +475 -2
  3. package/dist/component/atom/AppMain/App.module.js +7 -0
  4. package/dist/component/atom/AppMain/App.module.js.map +1 -0
  5. package/dist/component/atom/AppMain/AppMain.d.ts +7 -0
  6. package/dist/component/atom/AppMain/AppMain.js +14 -0
  7. package/dist/component/atom/AppMain/AppMain.js.map +1 -0
  8. package/dist/component/atom/CancelEditButton/CancelEditButton.d.ts +6 -0
  9. package/dist/component/atom/CancelEditButton/CancelEditButton.js +24 -0
  10. package/dist/component/atom/CancelEditButton/CancelEditButton.js.map +1 -0
  11. package/dist/component/atom/ConfirmEditButton/ConfirmEditButton.d.ts +13 -0
  12. package/dist/component/atom/ConfirmEditButton/ConfirmEditButton.js +30 -0
  13. package/dist/component/atom/ConfirmEditButton/ConfirmEditButton.js.map +1 -0
  14. package/dist/component/atom/DateField/DateField.d.ts +7 -0
  15. package/dist/component/atom/DateField/DateField.js +21 -0
  16. package/dist/component/atom/DateField/DateField.js.map +1 -0
  17. package/dist/component/atom/EditValueButton/EditValueButton.d.ts +6 -0
  18. package/dist/component/atom/EditValueButton/EditValueButton.js +24 -0
  19. package/dist/component/atom/EditValueButton/EditValueButton.js.map +1 -0
  20. package/dist/component/atom/ErrorAlert/ErrorAlert.d.ts +8 -0
  21. package/dist/component/atom/ErrorAlert/ErrorAlert.js +21 -0
  22. package/dist/component/atom/ErrorAlert/ErrorAlert.js.map +1 -0
  23. package/dist/component/atom/Surface/Surface.d.ts +20 -0
  24. package/dist/component/atom/Surface/Surface.js +15 -0
  25. package/dist/component/atom/Surface/Surface.js.map +1 -0
  26. package/dist/component/molecule/Breadcrumb/Breadcrumb.d.ts +12 -0
  27. package/dist/component/molecule/Breadcrumb/Breadcrumb.js +38 -0
  28. package/dist/component/molecule/Breadcrumb/Breadcrumb.js.map +1 -0
  29. package/dist/component/molecule/ExportMenuButton/ExportMenuButton.d.ts +25 -0
  30. package/dist/component/molecule/ExportMenuButton/ExportMenuButton.js +49 -0
  31. package/dist/component/molecule/ExportMenuButton/ExportMenuButton.js.map +1 -0
  32. package/dist/component/molecule/PaperCard/PaperCard.d.ts +7 -0
  33. package/dist/component/molecule/PaperCard/PaperCard.js +17 -0
  34. package/dist/component/molecule/PaperCard/PaperCard.js.map +1 -0
  35. package/dist/component/molecule/PrintSection/PrintSection.d.ts +14 -0
  36. package/dist/component/molecule/PrintSection/PrintSection.js +29 -0
  37. package/dist/component/molecule/PrintSection/PrintSection.js.map +1 -0
  38. package/dist/component/molecule/SelectField/SelectField.d.ts +32 -0
  39. package/dist/component/molecule/SelectField/SelectField.js +38 -0
  40. package/dist/component/molecule/SelectField/SelectField.js.map +1 -0
  41. package/dist/component/molecule/StatsCard/Stats.module.js +15 -0
  42. package/dist/component/molecule/StatsCard/Stats.module.js.map +1 -0
  43. package/dist/component/molecule/StatsCard/StatsCard.d.ts +18 -0
  44. package/dist/component/molecule/StatsCard/StatsCard.js +60 -0
  45. package/dist/component/molecule/StatsCard/StatsCard.js.map +1 -0
  46. package/dist/component/organism/DataForm/DataForm.d.ts +26 -0
  47. package/dist/component/organism/DataForm/DataForm.js +83 -0
  48. package/dist/component/organism/DataForm/DataForm.js.map +1 -0
  49. package/dist/component/organism/DataTabList/DataTabList.d.ts +24 -0
  50. package/dist/component/organism/DataTabList/DataTabList.js +37 -0
  51. package/dist/component/organism/DataTabList/DataTabList.js.map +1 -0
  52. package/dist/component/organism/DataTabList/DataTabList.module.js +13 -0
  53. package/dist/component/organism/DataTabList/DataTabList.module.js.map +1 -0
  54. package/dist/component/organism/EChart/EChart.d.ts +47 -0
  55. package/dist/component/organism/EChart/EChart.js +37 -0
  56. package/dist/component/organism/EChart/EChart.js.map +1 -0
  57. package/dist/component/organism/EChart/buildEChartOption.d.ts +40 -0
  58. package/dist/component/organism/EChart/buildEChartOption.js +57 -0
  59. package/dist/component/organism/EChart/buildEChartOption.js.map +1 -0
  60. package/dist/component/organism/EChart/chart/BarChart.d.ts +22 -0
  61. package/dist/component/organism/EChart/chart/BarChart.js +34 -0
  62. package/dist/component/organism/EChart/chart/BarChart.js.map +1 -0
  63. package/dist/component/organism/EChart/chart/CartesianChart.d.ts +48 -0
  64. package/dist/component/organism/EChart/chart/CartesianChart.js +63 -0
  65. package/dist/component/organism/EChart/chart/CartesianChart.js.map +1 -0
  66. package/dist/component/organism/EChart/chart/ChartHeader.d.ts +36 -0
  67. package/dist/component/organism/EChart/chart/ChartHeader.js +105 -0
  68. package/dist/component/organism/EChart/chart/ChartHeader.js.map +1 -0
  69. package/dist/component/organism/EChart/chart/ChartSeries.d.ts +50 -0
  70. package/dist/component/organism/EChart/chart/ChartSeries.js +23 -0
  71. package/dist/component/organism/EChart/chart/ChartSeries.js.map +1 -0
  72. package/dist/component/organism/EChart/chart/ChartTexts.d.ts +12 -0
  73. package/dist/component/organism/EChart/chart/ChartTexts.js +21 -0
  74. package/dist/component/organism/EChart/chart/ChartTexts.js.map +1 -0
  75. package/dist/component/organism/EChart/chart/ChartType.d.ts +50 -0
  76. package/dist/component/organism/EChart/chart/ChartType.js +1 -0
  77. package/dist/component/organism/EChart/chart/ChartTypeId.d.ts +2 -0
  78. package/dist/component/organism/EChart/chart/ChartTypeId.js +1 -0
  79. package/dist/component/organism/EChart/chart/ChartTypes.d.ts +15 -0
  80. package/dist/component/organism/EChart/chart/ChartTypes.js +24 -0
  81. package/dist/component/organism/EChart/chart/ChartTypes.js.map +1 -0
  82. package/dist/component/organism/EChart/chart/DonutChart.d.ts +32 -0
  83. package/dist/component/organism/EChart/chart/DonutChart.js +111 -0
  84. package/dist/component/organism/EChart/chart/DonutChart.js.map +1 -0
  85. package/dist/component/organism/EChart/chart/LineChart.d.ts +11 -0
  86. package/dist/component/organism/EChart/chart/LineChart.js +20 -0
  87. package/dist/component/organism/EChart/chart/LineChart.js.map +1 -0
  88. package/dist/component/organism/EChart/chart/StackedBarChart.d.ts +15 -0
  89. package/dist/component/organism/EChart/chart/StackedBarChart.js +30 -0
  90. package/dist/component/organism/EChart/chart/StackedBarChart.js.map +1 -0
  91. package/dist/component/organism/EChart/chart/UnitPanels.d.ts +63 -0
  92. package/dist/component/organism/EChart/chart/UnitPanels.js +127 -0
  93. package/dist/component/organism/EChart/chart/UnitPanels.js.map +1 -0
  94. package/dist/component/organism/EChart/echartDefaults.d.ts +32 -0
  95. package/dist/component/organism/EChart/echartDefaults.js +47 -0
  96. package/dist/component/organism/EChart/echartDefaults.js.map +1 -0
  97. package/dist/component/organism/EChart/useEChart.d.ts +35 -0
  98. package/dist/component/organism/EChart/useEChart.js +112 -0
  99. package/dist/component/organism/EChart/useEChart.js.map +1 -0
  100. package/dist/component/organism/Navbar/NavItem.d.ts +16 -0
  101. package/dist/component/organism/Navbar/NavItem.js +1 -0
  102. package/dist/component/organism/Navbar/Navbar.d.ts +20 -0
  103. package/dist/component/organism/Navbar/Navbar.js +64 -0
  104. package/dist/component/organism/Navbar/Navbar.js.map +1 -0
  105. package/dist/component/organism/Navbar/Navbar.module.js +19 -0
  106. package/dist/component/organism/Navbar/Navbar.module.js.map +1 -0
  107. package/dist/component/organism/PageHeader/PageHeader.d.ts +14 -0
  108. package/dist/component/organism/PageHeader/PageHeader.js +55 -0
  109. package/dist/component/organism/PageHeader/PageHeader.js.map +1 -0
  110. package/dist/component/organism/StatsGrid/StatsGrid.d.ts +12 -0
  111. package/dist/component/organism/StatsGrid/StatsGrid.js +46 -0
  112. package/dist/component/organism/StatsGrid/StatsGrid.js.map +1 -0
  113. package/dist/component/organism/StatsGrid/StatsGrid.module.js +17 -0
  114. package/dist/component/organism/StatsGrid/StatsGrid.module.js.map +1 -0
  115. package/dist/component/organism/Table/RowActions.d.ts +23 -0
  116. package/dist/component/organism/Table/RowActions.js +121 -0
  117. package/dist/component/organism/Table/RowActions.js.map +1 -0
  118. package/dist/component/organism/Table/Table.d.ts +51 -0
  119. package/dist/component/organism/Table/Table.js +110 -0
  120. package/dist/component/organism/Table/Table.js.map +1 -0
  121. package/dist/component/organism/ViewTable/ColumnComparator.d.ts +11 -0
  122. package/dist/component/organism/ViewTable/ColumnComparator.js +25 -0
  123. package/dist/component/organism/ViewTable/ColumnComparator.js.map +1 -0
  124. package/dist/component/organism/ViewTable/ViewTable.d.ts +53 -0
  125. package/dist/component/organism/ViewTable/ViewTable.js +115 -0
  126. package/dist/component/organism/ViewTable/ViewTable.js.map +1 -0
  127. package/dist/component/organism/ViewTable/useRowKey.d.ts +8 -0
  128. package/dist/component/organism/ViewTable/useRowKey.js +24 -0
  129. package/dist/component/organism/ViewTable/useRowKey.js.map +1 -0
  130. package/dist/component/template/CreateFormPage/CreateFormPage.d.ts +19 -0
  131. package/dist/component/template/CreateFormPage/CreateFormPage.js +41 -0
  132. package/dist/component/template/CreateFormPage/CreateFormPage.js.map +1 -0
  133. package/dist/component/template/EditFormPage/EditFormPage.d.ts +19 -0
  134. package/dist/component/template/EditFormPage/EditFormPage.js +42 -0
  135. package/dist/component/template/EditFormPage/EditFormPage.js.map +1 -0
  136. package/dist/component/template/FormPage/FormPage.d.ts +25 -0
  137. package/dist/component/template/FormPage/FormPage.js +130 -0
  138. package/dist/component/template/FormPage/FormPage.js.map +1 -0
  139. package/dist/component/template/FormPage/FormType.d.ts +6 -0
  140. package/dist/component/template/FormPage/FormType.js +12 -0
  141. package/dist/component/template/FormPage/FormType.js.map +1 -0
  142. package/dist/component/template/Layout/Layout.d.ts +21 -0
  143. package/dist/component/template/Layout/Layout.js +121 -0
  144. package/dist/component/template/Layout/Layout.js.map +1 -0
  145. package/dist/component/template/Layout/Layout.module.js +19 -0
  146. package/dist/component/template/Layout/Layout.module.js.map +1 -0
  147. package/dist/component/template/ListPage/ListPage.d.ts +32 -0
  148. package/dist/component/template/ListPage/ListPage.js +47 -0
  149. package/dist/component/template/ListPage/ListPage.js.map +1 -0
  150. package/dist/component/template/PrintPage/PrintPage.d.ts +25 -0
  151. package/dist/component/template/PrintPage/PrintPage.js +115 -0
  152. package/dist/component/template/PrintPage/PrintPage.js.map +1 -0
  153. package/dist/component/template/ViewPage/ViewPage.d.ts +11 -0
  154. package/dist/component/template/ViewPage/ViewPage.js +49 -0
  155. package/dist/component/template/ViewPage/ViewPage.js.map +1 -0
  156. package/dist/data/ListDataSource.d.ts +12 -0
  157. package/dist/data/ListDataSource.js +1 -0
  158. package/dist/data/SaveDataSource.d.ts +16 -0
  159. package/dist/data/SaveDataSource.js +1 -0
  160. package/dist/export/ExportCellText.d.ts +18 -0
  161. package/dist/export/ExportCellText.js +60 -0
  162. package/dist/export/ExportCellText.js.map +1 -0
  163. package/dist/export/ExportDocument.d.ts +127 -0
  164. package/dist/export/ExportDocument.js +59 -0
  165. package/dist/export/ExportDocument.js.map +1 -0
  166. package/dist/export/ExportDownload.d.ts +9 -0
  167. package/dist/export/ExportDownload.js +19 -0
  168. package/dist/export/ExportDownload.js.map +1 -0
  169. package/dist/export/ExportFileName.d.ts +11 -0
  170. package/dist/export/ExportFileName.js +24 -0
  171. package/dist/export/ExportFileName.js.map +1 -0
  172. package/dist/export/ExportFormat.d.ts +30 -0
  173. package/dist/export/ExportFormat.js +1 -0
  174. package/dist/export/ExportFormats.d.ts +12 -0
  175. package/dist/export/ExportFormats.js +16 -0
  176. package/dist/export/ExportFormats.js.map +1 -0
  177. package/dist/export/ExportTexts.d.ts +14 -0
  178. package/dist/export/ExportTexts.js +23 -0
  179. package/dist/export/ExportTexts.js.map +1 -0
  180. package/dist/export/csv/CsvFormat.d.ts +41 -0
  181. package/dist/export/csv/CsvFormat.js +91 -0
  182. package/dist/export/csv/CsvFormat.js.map +1 -0
  183. package/dist/export/xlsx/XlsxFormat.d.ts +35 -0
  184. package/dist/export/xlsx/XlsxFormat.js +66 -0
  185. package/dist/export/xlsx/XlsxFormat.js.map +1 -0
  186. package/dist/export/xlsx/XlsxNumberFormat.d.ts +8 -0
  187. package/dist/export/xlsx/XlsxNumberFormat.js +15 -0
  188. package/dist/export/xlsx/XlsxNumberFormat.js.map +1 -0
  189. package/dist/export/xlsx/XlsxSheetName.d.ts +12 -0
  190. package/dist/export/xlsx/XlsxSheetName.js +62 -0
  191. package/dist/export/xlsx/XlsxSheetName.js.map +1 -0
  192. package/dist/export/xlsx/XlsxSheetWriter.d.ts +67 -0
  193. package/dist/export/xlsx/XlsxSheetWriter.js +215 -0
  194. package/dist/export/xlsx/XlsxSheetWriter.js.map +1 -0
  195. package/dist/export/xlsx/XlsxStyle.d.ts +51 -0
  196. package/dist/export/xlsx/XlsxStyle.js +87 -0
  197. package/dist/export/xlsx/XlsxStyle.js.map +1 -0
  198. package/dist/hook/useIsMobile.d.ts +5 -0
  199. package/dist/hook/useIsMobile.js +16 -0
  200. package/dist/hook/useIsMobile.js.map +1 -0
  201. package/dist/hook/useKeyedService.d.ts +22 -0
  202. package/dist/hook/useKeyedService.js +38 -0
  203. package/dist/hook/useKeyedService.js.map +1 -0
  204. package/dist/hook/useLightColorSchemeOnPrint.d.ts +9 -0
  205. package/dist/hook/useLightColorSchemeOnPrint.js +36 -0
  206. package/dist/hook/useLightColorSchemeOnPrint.js.map +1 -0
  207. package/dist/hook/useService.d.ts +27 -0
  208. package/dist/hook/useService.js +23 -0
  209. package/dist/hook/useService.js.map +1 -0
  210. package/dist/http/ApiError.d.ts +13 -0
  211. package/dist/http/ApiError.js +22 -0
  212. package/dist/http/ApiError.js.map +1 -0
  213. package/dist/http/AxiosHttpClient.d.ts +21 -0
  214. package/dist/http/AxiosHttpClient.js +67 -0
  215. package/dist/http/AxiosHttpClient.js.map +1 -0
  216. package/dist/http/AxiosHttpClientConfig.d.ts +37 -0
  217. package/dist/http/AxiosHttpClientConfig.js +19 -0
  218. package/dist/http/AxiosHttpClientConfig.js.map +1 -0
  219. package/dist/i18n/KitLocale.d.ts +4 -0
  220. package/dist/i18n/KitLocale.js +7 -0
  221. package/dist/i18n/KitLocale.js.map +1 -0
  222. package/dist/i18n/KitMessages.d.ts +146 -0
  223. package/dist/i18n/KitMessages.js +1 -0
  224. package/dist/i18n/messages/enUS.d.ts +3 -0
  225. package/dist/i18n/messages/enUS.js +112 -0
  226. package/dist/i18n/messages/enUS.js.map +1 -0
  227. package/dist/i18n/messages/ptBR.d.ts +3 -0
  228. package/dist/i18n/messages/ptBR.js +97 -0
  229. package/dist/i18n/messages/ptBR.js.map +1 -0
  230. package/dist/i18n/resolveMessages.d.ts +13 -0
  231. package/dist/i18n/resolveMessages.js +29 -0
  232. package/dist/i18n/resolveMessages.js.map +1 -0
  233. package/dist/model/Identifiable.d.ts +7 -0
  234. package/dist/model/Identifiable.js +1 -0
  235. package/dist/provider/KitConfig.d.ts +26 -0
  236. package/dist/provider/KitConfig.js +1 -0
  237. package/dist/provider/KitContext.d.ts +9 -0
  238. package/dist/provider/KitContext.js +27 -0
  239. package/dist/provider/KitContext.js.map +1 -0
  240. package/dist/provider/KitProvider.d.ts +7 -0
  241. package/dist/provider/KitProvider.js +31 -0
  242. package/dist/provider/KitProvider.js.map +1 -0
  243. package/dist/provider/useKit.d.ts +15 -0
  244. package/dist/provider/useKit.js +28 -0
  245. package/dist/provider/useKit.js.map +1 -0
  246. package/dist/router/FormRouteSegments.d.ts +16 -0
  247. package/dist/router/FormRouteSegments.js +19 -0
  248. package/dist/router/FormRouteSegments.js.map +1 -0
  249. package/dist/router/RouterAdapter.d.ts +24 -0
  250. package/dist/router/RouterAdapter.js +1 -0
  251. package/dist/router/anchorRouter.d.ts +7 -0
  252. package/dist/router/anchorRouter.js +23 -0
  253. package/dist/router/anchorRouter.js.map +1 -0
  254. package/dist/styles/print.css +93 -0
  255. package/dist/styles.css +188 -0
  256. package/dist/util/ArrayUtil.d.ts +39 -0
  257. package/dist/util/ArrayUtil.js +48 -0
  258. package/dist/util/ArrayUtil.js.map +1 -0
  259. package/dist/util/ColorUtil.d.ts +7 -0
  260. package/dist/util/ColorUtil.js +16 -0
  261. package/dist/util/ColorUtil.js.map +1 -0
  262. package/dist/util/CompareUtil.d.ts +19 -0
  263. package/dist/util/CompareUtil.js +51 -0
  264. package/dist/util/CompareUtil.js.map +1 -0
  265. package/dist/util/DateUtil.d.ts +38 -0
  266. package/dist/util/DateUtil.js +55 -0
  267. package/dist/util/DateUtil.js.map +1 -0
  268. package/dist/util/DownloadUtil.d.ts +6 -0
  269. package/dist/util/DownloadUtil.js +25 -0
  270. package/dist/util/DownloadUtil.js.map +1 -0
  271. package/dist/util/EnumUtil.d.ts +19 -0
  272. package/dist/util/EnumUtil.js +32 -0
  273. package/dist/util/EnumUtil.js.map +1 -0
  274. package/dist/util/FormUtil.d.ts +8 -0
  275. package/dist/util/FormUtil.js +14 -0
  276. package/dist/util/FormUtil.js.map +1 -0
  277. package/dist/util/HtmlUtil.d.ts +8 -0
  278. package/dist/util/HtmlUtil.js +23 -0
  279. package/dist/util/HtmlUtil.js.map +1 -0
  280. package/dist/util/Notifications.d.ts +30 -0
  281. package/dist/util/Notifications.js +59 -0
  282. package/dist/util/Notifications.js.map +1 -0
  283. package/dist/util/NumberUtil.d.ts +19 -0
  284. package/dist/util/NumberUtil.js +33 -0
  285. package/dist/util/NumberUtil.js.map +1 -0
  286. package/dist/util/ObjectUtil.d.ts +22 -0
  287. package/dist/util/ObjectUtil.js +34 -0
  288. package/dist/util/ObjectUtil.js.map +1 -0
  289. package/dist/util/SearchParamsUtil.d.ts +23 -0
  290. package/dist/util/SearchParamsUtil.js +29 -0
  291. package/dist/util/SearchParamsUtil.js.map +1 -0
  292. package/dist/util/TransformData.d.ts +14 -0
  293. package/dist/util/TransformData.js +31 -0
  294. package/dist/util/TransformData.js.map +1 -0
  295. package/dist/util/ValidationUtil.d.ts +9 -0
  296. package/dist/util/ValidationUtil.js +16 -0
  297. package/dist/util/ValidationUtil.js.map +1 -0
  298. package/dist/util/parseActionsPageParams.d.ts +14 -0
  299. package/dist/util/parseActionsPageParams.js +29 -0
  300. package/dist/util/parseActionsPageParams.js.map +1 -0
  301. package/package.json +158 -5
@@ -0,0 +1,112 @@
1
+ "use client";
2
+ import dayjs from "dayjs";
3
+ // src/i18n/messages/enUS.ts
4
+ /** American English texts, the default locale. */
5
+ var enUS = {
6
+ common: {
7
+ back: "Back",
8
+ save: "Save",
9
+ cancel: "Cancel",
10
+ confirm: "Confirm",
11
+ add: "Add",
12
+ home: "Home",
13
+ success: "Success",
14
+ warning: "Warning",
15
+ error: "Error",
16
+ loadError: "Error loading data",
17
+ dateFormat: "MM/DD/YYYY"
18
+ },
19
+ form: {
20
+ action: {
21
+ create: "Create",
22
+ edit: "Update",
23
+ view: "View",
24
+ custom: "Customize"
25
+ },
26
+ saveSuccess: (action) => `Record ${pastTense(action)} successfully!`,
27
+ saveError: (action) => `Error trying to ${action.toLowerCase()} the record`,
28
+ createSuccess: "Record created successfully",
29
+ createError: "There was an error creating the record!",
30
+ updateSuccess: "Record updated successfully",
31
+ updateError: "There was an error updating the record",
32
+ confirmTitle: "Confirm your action"
33
+ },
34
+ table: {
35
+ actions: "Actions",
36
+ view: "View",
37
+ edit: "Edit",
38
+ delete: "Delete",
39
+ deleteConfirm: "You are about to delete this record. Are you sure you want to continue?",
40
+ deleteSuccess: "Record deleted successfully!",
41
+ noRecords: "There are no records to display.",
42
+ recordsPerPage: "Records per page",
43
+ pagination: ({ from, to, totalRecords }) => `Showing ${from} to ${to} of ${totalRecords} records`,
44
+ listTitle: (pluralName) => `${pluralName} list`
45
+ },
46
+ rowEdit: {
47
+ edit: "Edit values (Enter)",
48
+ confirm: "Confirm editing (Enter)",
49
+ cancel: "Cancel editing (Esc)"
50
+ },
51
+ select: {
52
+ placeholder: (label) => `Select the ${label}`,
53
+ nothingFound: (label) => `${label} not found`
54
+ },
55
+ layout: {
56
+ userMenu: "Open user options",
57
+ userMenuTitle: "User Options",
58
+ enableDarkTheme: "Enable dark theme",
59
+ enableLightTheme: "Enable light theme",
60
+ collapseNavigation: "Collapse navigation menu",
61
+ expandNavigation: "Expand navigation menu"
62
+ },
63
+ print: {
64
+ pdfTipTitle: "To save as PDF",
65
+ pdfTip: "In the print dialog, choose \"Save as PDF\" as the destination and uncheck \"Headers and footers\", so the PDF has only the ones of the report.",
66
+ printButton: "Print or save as PDF"
67
+ },
68
+ stats: { comparedToLastMonth: "Compared to last month" },
69
+ export: {
70
+ button: "Export",
71
+ failed: (formatLabel) => `Could not export to ${formatLabel}.`,
72
+ generatedAt: (date) => `Generated on ${dayjs(date).format("MM/DD/YYYY [at] h:mm A")}`,
73
+ footer: (systemName) => `Data generated by ${systemName}`,
74
+ excelPageNumber: "Page &P of &N",
75
+ invalidCell: "Error",
76
+ defaultFileName: "data",
77
+ defaultSheetName: (position) => `Sheet ${position}`
78
+ },
79
+ chart: {
80
+ types: {
81
+ bar: "Columns",
82
+ line: "Line",
83
+ "stacked-bar": "Stacked columns",
84
+ donut: "Donut (one year)"
85
+ },
86
+ saveAsImage: "Save as image",
87
+ total: (formattedTotal) => `Total: ${formattedTotal}`
88
+ },
89
+ http: {
90
+ unknownError: "Unknown error",
91
+ noResponse: "No response received",
92
+ requestFailed: "Request failed"
93
+ }
94
+ };
95
+ /** Past tense of the form action verbs (e.g. "Create" → "created"), used in the success message. */
96
+ var PAST_TENSE = {
97
+ create: "created",
98
+ update: "updated",
99
+ view: "viewed"
100
+ };
101
+ /**
102
+ * Returns the past tense of a form action verb.
103
+ * @param action verb, as in `form.action`
104
+ * @return the past tense, in lower case; for an unknown verb, the verb itself followed by "d"
105
+ */
106
+ function pastTense(action) {
107
+ const verb = action.toLowerCase();
108
+ return PAST_TENSE[verb] ?? `${verb}d`;
109
+ }
110
+ export { enUS };
111
+
112
+ //# sourceMappingURL=enUS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enUS.js","names":[],"sources":["../../../src/i18n/messages/enUS.ts"],"sourcesContent":["import dayjs from 'dayjs';\n\nimport { KitMessages } from '../KitMessages';\n\n/** American English texts, the default locale. */\nexport const enUS: KitMessages = {\n common: {\n back: 'Back',\n save: 'Save',\n cancel: 'Cancel',\n confirm: 'Confirm',\n add: 'Add',\n home: 'Home',\n success: 'Success',\n warning: 'Warning',\n error: 'Error',\n loadError: 'Error loading data',\n dateFormat: 'MM/DD/YYYY'\n },\n form: {\n action: { create: 'Create', edit: 'Update', view: 'View', custom: 'Customize' },\n saveSuccess: action => `Record ${pastTense(action)} successfully!`,\n saveError: action => `Error trying to ${action.toLowerCase()} the record`,\n createSuccess: 'Record created successfully',\n createError: 'There was an error creating the record!',\n updateSuccess: 'Record updated successfully',\n updateError: 'There was an error updating the record',\n confirmTitle: 'Confirm your action'\n },\n table: {\n actions: 'Actions',\n view: 'View',\n edit: 'Edit',\n delete: 'Delete',\n deleteConfirm: 'You are about to delete this record. Are you sure you want to continue?',\n deleteSuccess: 'Record deleted successfully!',\n noRecords: 'There are no records to display.',\n recordsPerPage: 'Records per page',\n pagination: ({ from, to, totalRecords }) => `Showing ${from} to ${to} of ${totalRecords} records`,\n listTitle: pluralName => `${pluralName} list`\n },\n rowEdit: {\n edit: 'Edit values (Enter)',\n confirm: 'Confirm editing (Enter)',\n cancel: 'Cancel editing (Esc)'\n },\n select: {\n placeholder: label => `Select the ${label}`,\n nothingFound: label => `${label} not found`\n },\n layout: {\n userMenu: 'Open user options',\n userMenuTitle: 'User Options',\n enableDarkTheme: 'Enable dark theme',\n enableLightTheme: 'Enable light theme',\n collapseNavigation: 'Collapse navigation menu',\n expandNavigation: 'Expand navigation menu'\n },\n print: {\n pdfTipTitle: 'To save as PDF',\n pdfTip:\n 'In the print dialog, choose \"Save as PDF\" as the destination and uncheck \"Headers and footers\", so ' +\n 'the PDF has only the ones of the report.',\n printButton: 'Print or save as PDF'\n },\n stats: {\n comparedToLastMonth: 'Compared to last month'\n },\n export: {\n button: 'Export',\n failed: formatLabel => `Could not export to ${formatLabel}.`,\n generatedAt: date => `Generated on ${dayjs(date).format('MM/DD/YYYY [at] h:mm A')}`,\n footer: systemName => `Data generated by ${systemName}`,\n excelPageNumber: 'Page &P of &N',\n invalidCell: 'Error',\n defaultFileName: 'data',\n defaultSheetName: position => `Sheet ${position}`\n },\n chart: {\n types: { bar: 'Columns', line: 'Line', 'stacked-bar': 'Stacked columns', donut: 'Donut (one year)' },\n saveAsImage: 'Save as image',\n total: formattedTotal => `Total: ${formattedTotal}`\n },\n http: {\n unknownError: 'Unknown error',\n noResponse: 'No response received',\n requestFailed: 'Request failed'\n }\n};\n\n/** Past tense of the form action verbs (e.g. \"Create\" → \"created\"), used in the success message. */\nconst PAST_TENSE: Record<string, string> = { create: 'created', update: 'updated', view: 'viewed' };\n\n/**\n * Returns the past tense of a form action verb.\n * @param action verb, as in `form.action`\n * @return the past tense, in lower case; for an unknown verb, the verb itself followed by \"d\"\n */\nfunction pastTense(action: string): string {\n const verb = action.toLowerCase();\n\n return PAST_TENSE[verb] ?? `${verb}d`;\n}\n"],"mappings":";;;;AAKA,IAAa,OAAoB;CAC7B,QAAQ;EACJ,MAAM;EACN,MAAM;EACN,QAAQ;EACR,SAAS;EACT,KAAK;EACL,MAAM;EACN,SAAS;EACT,SAAS;EACT,OAAO;EACP,WAAW;EACX,YAAY;CAChB;CACA,MAAM;EACF,QAAQ;GAAE,QAAQ;GAAU,MAAM;GAAU,MAAM;GAAQ,QAAQ;EAAY;EAC9E,cAAa,WAAU,UAAU,UAAU,MAAM,EAAE;EACnD,YAAW,WAAU,mBAAmB,OAAO,YAAY,EAAE;EAC7D,eAAe;EACf,aAAa;EACb,eAAe;EACf,aAAa;EACb,cAAc;CAClB;CACA,OAAO;EACH,SAAS;EACT,MAAM;EACN,MAAM;EACN,QAAQ;EACR,eAAe;EACf,eAAe;EACf,WAAW;EACX,gBAAgB;EAChB,aAAa,EAAE,MAAM,IAAI,mBAAmB,WAAW,KAAK,MAAM,GAAG,MAAM,aAAa;EACxF,YAAW,eAAc,GAAG,WAAW;CAC3C;CACA,SAAS;EACL,MAAM;EACN,SAAS;EACT,QAAQ;CACZ;CACA,QAAQ;EACJ,cAAa,UAAS,cAAc;EACpC,eAAc,UAAS,GAAG,MAAM;CACpC;CACA,QAAQ;EACJ,UAAU;EACV,eAAe;EACf,iBAAiB;EACjB,kBAAkB;EAClB,oBAAoB;EACpB,kBAAkB;CACtB;CACA,OAAO;EACH,aAAa;EACb,QACI;EAEJ,aAAa;CACjB;CACA,OAAO,EACH,qBAAqB,yBACzB;CACA,QAAQ;EACJ,QAAQ;EACR,SAAQ,gBAAe,uBAAuB,YAAY;EAC1D,cAAa,SAAQ,gBAAgB,MAAM,IAAI,CAAC,CAAC,OAAO,wBAAwB;EAChF,SAAQ,eAAc,qBAAqB;EAC3C,iBAAiB;EACjB,aAAa;EACb,iBAAiB;EACjB,mBAAkB,aAAY,SAAS;CAC3C;CACA,OAAO;EACH,OAAO;GAAE,KAAK;GAAW,MAAM;GAAQ,eAAe;GAAmB,OAAO;EAAmB;EACnG,aAAa;EACb,QAAO,mBAAkB,UAAU;CACvC;CACA,MAAM;EACF,cAAc;EACd,YAAY;EACZ,eAAe;CACnB;AACJ;;AAGA,IAAM,aAAqC;CAAE,QAAQ;CAAW,QAAQ;CAAW,MAAM;AAAS;;;;;;AAOlG,SAAS,UAAU,QAAwB;CACvC,MAAM,OAAO,OAAO,YAAY;CAEhC,OAAO,WAAW,SAAS,GAAG,KAAK;AACvC"}
@@ -0,0 +1,3 @@
1
+ import { KitMessages } from '../KitMessages';
2
+ /** Brazilian Portuguese texts. */
3
+ export declare const ptBR: KitMessages;
@@ -0,0 +1,97 @@
1
+ "use client";
2
+ import dayjs from "dayjs";
3
+ // src/i18n/messages/ptBR.ts
4
+ /** Brazilian Portuguese texts. */
5
+ var ptBR = {
6
+ common: {
7
+ back: "Voltar",
8
+ save: "Salvar",
9
+ cancel: "Cancelar",
10
+ confirm: "Confirmar",
11
+ add: "Adicionar",
12
+ home: "Início",
13
+ success: "Sucesso",
14
+ warning: "Atenção",
15
+ error: "Erro",
16
+ loadError: "Erro ao carregar dados",
17
+ dateFormat: "DD/MM/YYYY"
18
+ },
19
+ form: {
20
+ action: {
21
+ create: "Criar",
22
+ edit: "Atualizar",
23
+ view: "Visualizar",
24
+ custom: "Personalizar"
25
+ },
26
+ saveSuccess: (action) => `Sucesso ao ${action.toLowerCase()} cadastro!`,
27
+ saveError: (action) => `Erro ao ${action.toLowerCase()} cadastro`,
28
+ createSuccess: "Registro cadastrado com sucesso",
29
+ createError: "Houve um erro ao realizar o cadastro!",
30
+ updateSuccess: "Cadastro atualizado com sucesso",
31
+ updateError: "Houve um erro ao atualizar o cadastro",
32
+ confirmTitle: "Confirme sua ação"
33
+ },
34
+ table: {
35
+ actions: "Ações",
36
+ view: "Visualizar",
37
+ edit: "Editar",
38
+ delete: "Deletar",
39
+ deleteConfirm: "Você está prestes a excluir este cadastro. Tem certeza de que deseja continuar?",
40
+ deleteSuccess: "Cadastro excluído com sucesso!",
41
+ noRecords: "Não há registros disponíveis para exibição.",
42
+ recordsPerPage: "Registros por página",
43
+ pagination: ({ from, to, totalRecords }) => `Exibindo ${from} a ${to} de ${totalRecords} registros`,
44
+ listTitle: (pluralName) => `Lista de ${pluralName}`
45
+ },
46
+ rowEdit: {
47
+ edit: "Editar valores (Enter)",
48
+ confirm: "Confirmar edição (Enter)",
49
+ cancel: "Cancelar edição (Esc)"
50
+ },
51
+ select: {
52
+ placeholder: (label) => `Selecione o(a) ${label}`,
53
+ nothingFound: (label) => `${label} não encontrado(a)`
54
+ },
55
+ layout: {
56
+ userMenu: "Acessar opções do usuário",
57
+ userMenuTitle: "Opções do Usuário",
58
+ enableDarkTheme: "Ativar tema escuro",
59
+ enableLightTheme: "Ativar tema claro",
60
+ collapseNavigation: "Recolher menu de navegação",
61
+ expandNavigation: "Expandir menu de navegação"
62
+ },
63
+ print: {
64
+ pdfTipTitle: "Para salvar em PDF",
65
+ pdfTip: "Na janela de impressão, escolha \"Salvar como PDF\" como destino e desmarque \"Cabeçalhos e rodapés\", para o PDF ter só os do relatório.",
66
+ printButton: "Imprimir ou salvar como PDF"
67
+ },
68
+ stats: { comparedToLastMonth: "Comparado ao último mês" },
69
+ export: {
70
+ button: "Exportar",
71
+ failed: (formatLabel) => `Não foi possível exportar em ${formatLabel}.`,
72
+ generatedAt: (date) => `Gerado em ${dayjs(date).format("DD/MM/YYYY [às] HH:mm")}`,
73
+ footer: (systemName) => `Dados gerados pelo ${systemName}`,
74
+ excelPageNumber: "Página &P de &N",
75
+ invalidCell: "Erro",
76
+ defaultFileName: "dados",
77
+ defaultSheetName: (position) => `Aba ${position}`
78
+ },
79
+ chart: {
80
+ types: {
81
+ bar: "Colunas",
82
+ line: "Linha",
83
+ "stacked-bar": "Colunas empilhadas",
84
+ donut: "Rosca (um ano)"
85
+ },
86
+ saveAsImage: "Exportar imagem",
87
+ total: (formattedTotal) => `Total: ${formattedTotal}`
88
+ },
89
+ http: {
90
+ unknownError: "Erro desconhecido",
91
+ noResponse: "Nenhuma resposta recebida",
92
+ requestFailed: "Requisição falhou"
93
+ }
94
+ };
95
+ export { ptBR };
96
+
97
+ //# sourceMappingURL=ptBR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ptBR.js","names":[],"sources":["../../../src/i18n/messages/ptBR.ts"],"sourcesContent":["import dayjs from 'dayjs';\n\nimport { KitMessages } from '../KitMessages';\n\n/** Brazilian Portuguese texts. */\nexport const ptBR: KitMessages = {\n common: {\n back: 'Voltar',\n save: 'Salvar',\n cancel: 'Cancelar',\n confirm: 'Confirmar',\n add: 'Adicionar',\n home: 'Início',\n success: 'Sucesso',\n warning: 'Atenção',\n error: 'Erro',\n loadError: 'Erro ao carregar dados',\n dateFormat: 'DD/MM/YYYY'\n },\n form: {\n action: { create: 'Criar', edit: 'Atualizar', view: 'Visualizar', custom: 'Personalizar' },\n saveSuccess: action => `Sucesso ao ${action.toLowerCase()} cadastro!`,\n saveError: action => `Erro ao ${action.toLowerCase()} cadastro`,\n createSuccess: 'Registro cadastrado com sucesso',\n createError: 'Houve um erro ao realizar o cadastro!',\n updateSuccess: 'Cadastro atualizado com sucesso',\n updateError: 'Houve um erro ao atualizar o cadastro',\n confirmTitle: 'Confirme sua ação'\n },\n table: {\n actions: 'Ações',\n view: 'Visualizar',\n edit: 'Editar',\n delete: 'Deletar',\n deleteConfirm: 'Você está prestes a excluir este cadastro. Tem certeza de que deseja continuar?',\n deleteSuccess: 'Cadastro excluído com sucesso!',\n noRecords: 'Não há registros disponíveis para exibição.',\n recordsPerPage: 'Registros por página',\n pagination: ({ from, to, totalRecords }) => `Exibindo ${from} a ${to} de ${totalRecords} registros`,\n listTitle: pluralName => `Lista de ${pluralName}`\n },\n rowEdit: {\n edit: 'Editar valores (Enter)',\n confirm: 'Confirmar edição (Enter)',\n cancel: 'Cancelar edição (Esc)'\n },\n select: {\n placeholder: label => `Selecione o(a) ${label}`,\n nothingFound: label => `${label} não encontrado(a)`\n },\n layout: {\n userMenu: 'Acessar opções do usuário',\n userMenuTitle: 'Opções do Usuário',\n enableDarkTheme: 'Ativar tema escuro',\n enableLightTheme: 'Ativar tema claro',\n collapseNavigation: 'Recolher menu de navegação',\n expandNavigation: 'Expandir menu de navegação'\n },\n print: {\n pdfTipTitle: 'Para salvar em PDF',\n pdfTip:\n 'Na janela de impressão, escolha \"Salvar como PDF\" como destino e desmarque \"Cabeçalhos e rodapés\", ' +\n 'para o PDF ter só os do relatório.',\n printButton: 'Imprimir ou salvar como PDF'\n },\n stats: {\n comparedToLastMonth: 'Comparado ao último mês'\n },\n export: {\n button: 'Exportar',\n failed: formatLabel => `Não foi possível exportar em ${formatLabel}.`,\n generatedAt: date => `Gerado em ${dayjs(date).format('DD/MM/YYYY [às] HH:mm')}`,\n footer: systemName => `Dados gerados pelo ${systemName}`,\n excelPageNumber: 'Página &P de &N',\n invalidCell: 'Erro',\n defaultFileName: 'dados',\n defaultSheetName: position => `Aba ${position}`\n },\n chart: {\n types: { bar: 'Colunas', line: 'Linha', 'stacked-bar': 'Colunas empilhadas', donut: 'Rosca (um ano)' },\n saveAsImage: 'Exportar imagem',\n total: formattedTotal => `Total: ${formattedTotal}`\n },\n http: {\n unknownError: 'Erro desconhecido',\n noResponse: 'Nenhuma resposta recebida',\n requestFailed: 'Requisição falhou'\n }\n};\n"],"mappings":";;;;AAKA,IAAa,OAAoB;CAC7B,QAAQ;EACJ,MAAM;EACN,MAAM;EACN,QAAQ;EACR,SAAS;EACT,KAAK;EACL,MAAM;EACN,SAAS;EACT,SAAS;EACT,OAAO;EACP,WAAW;EACX,YAAY;CAChB;CACA,MAAM;EACF,QAAQ;GAAE,QAAQ;GAAS,MAAM;GAAa,MAAM;GAAc,QAAQ;EAAe;EACzF,cAAa,WAAU,cAAc,OAAO,YAAY,EAAE;EAC1D,YAAW,WAAU,WAAW,OAAO,YAAY,EAAE;EACrD,eAAe;EACf,aAAa;EACb,eAAe;EACf,aAAa;EACb,cAAc;CAClB;CACA,OAAO;EACH,SAAS;EACT,MAAM;EACN,MAAM;EACN,QAAQ;EACR,eAAe;EACf,eAAe;EACf,WAAW;EACX,gBAAgB;EAChB,aAAa,EAAE,MAAM,IAAI,mBAAmB,YAAY,KAAK,KAAK,GAAG,MAAM,aAAa;EACxF,YAAW,eAAc,YAAY;CACzC;CACA,SAAS;EACL,MAAM;EACN,SAAS;EACT,QAAQ;CACZ;CACA,QAAQ;EACJ,cAAa,UAAS,kBAAkB;EACxC,eAAc,UAAS,GAAG,MAAM;CACpC;CACA,QAAQ;EACJ,UAAU;EACV,eAAe;EACf,iBAAiB;EACjB,kBAAkB;EAClB,oBAAoB;EACpB,kBAAkB;CACtB;CACA,OAAO;EACH,aAAa;EACb,QACI;EAEJ,aAAa;CACjB;CACA,OAAO,EACH,qBAAqB,0BACzB;CACA,QAAQ;EACJ,QAAQ;EACR,SAAQ,gBAAe,gCAAgC,YAAY;EACnE,cAAa,SAAQ,aAAa,MAAM,IAAI,CAAC,CAAC,OAAO,uBAAuB;EAC5E,SAAQ,eAAc,sBAAsB;EAC5C,iBAAiB;EACjB,aAAa;EACb,iBAAiB;EACjB,mBAAkB,aAAY,OAAO;CACzC;CACA,OAAO;EACH,OAAO;GAAE,KAAK;GAAW,MAAM;GAAS,eAAe;GAAsB,OAAO;EAAiB;EACrG,aAAa;EACb,QAAO,mBAAkB,UAAU;CACvC;CACA,MAAM;EACF,cAAc;EACd,YAAY;EACZ,eAAe;CACnB;AACJ"}
@@ -0,0 +1,13 @@
1
+ import { KitLocale } from './KitLocale';
2
+ import { KitMessages, KitMessagesOverride } from './KitMessages';
3
+ /** Built-in message catalog of each locale. */
4
+ export declare const KIT_MESSAGES: Readonly<Record<KitLocale, KitMessages>>;
5
+ /** Texts of the {@link DEFAULT_LOCALE}, used as defaults by the code outside React. */
6
+ export declare const DEFAULT_MESSAGES: KitMessages;
7
+ /**
8
+ * Returns the texts of a locale, with the texts the app overrides.
9
+ * @param locale locale of the texts; defaults to {@link DEFAULT_LOCALE}
10
+ * @param override texts that replace the ones of the locale, by section
11
+ * @return the texts, with every section complete
12
+ */
13
+ export declare function resolveMessages(locale?: KitLocale, override?: KitMessagesOverride): KitMessages;
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { DEFAULT_LOCALE } from "./KitLocale.js";
3
+ import { enUS } from "./messages/enUS.js";
4
+ import { ptBR } from "./messages/ptBR.js";
5
+ // src/i18n/resolveMessages.ts
6
+ /** Built-in message catalog of each locale. */
7
+ var KIT_MESSAGES = {
8
+ "pt-BR": ptBR,
9
+ "en-US": enUS
10
+ };
11
+ /** Texts of the {@link DEFAULT_LOCALE}, used as defaults by the code outside React. */
12
+ var DEFAULT_MESSAGES = KIT_MESSAGES[DEFAULT_LOCALE];
13
+ /**
14
+ * Returns the texts of a locale, with the texts the app overrides.
15
+ * @param locale locale of the texts; defaults to {@link DEFAULT_LOCALE}
16
+ * @param override texts that replace the ones of the locale, by section
17
+ * @return the texts, with every section complete
18
+ */
19
+ function resolveMessages(locale = DEFAULT_LOCALE, override = {}) {
20
+ const base = KIT_MESSAGES[locale];
21
+ const sections = Object.keys(base);
22
+ return Object.fromEntries(sections.map((section) => [section, {
23
+ ...base[section],
24
+ ...override[section]
25
+ }]));
26
+ }
27
+ export { DEFAULT_MESSAGES, KIT_MESSAGES, resolveMessages };
28
+
29
+ //# sourceMappingURL=resolveMessages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveMessages.js","names":[],"sources":["../../src/i18n/resolveMessages.ts"],"sourcesContent":["import { DEFAULT_LOCALE, KitLocale } from './KitLocale';\nimport { KitMessages, KitMessagesOverride } from './KitMessages';\nimport { enUS } from './messages/enUS';\nimport { ptBR } from './messages/ptBR';\n\n/** Built-in message catalog of each locale. */\nexport const KIT_MESSAGES: Readonly<Record<KitLocale, KitMessages>> = { 'pt-BR': ptBR, 'en-US': enUS };\n\n/** Texts of the {@link DEFAULT_LOCALE}, used as defaults by the code outside React. */\nexport const DEFAULT_MESSAGES: KitMessages = KIT_MESSAGES[DEFAULT_LOCALE];\n\n/**\n * Returns the texts of a locale, with the texts the app overrides.\n * @param locale locale of the texts; defaults to {@link DEFAULT_LOCALE}\n * @param override texts that replace the ones of the locale, by section\n * @return the texts, with every section complete\n */\nexport function resolveMessages(locale: KitLocale = DEFAULT_LOCALE, override: KitMessagesOverride = {}): KitMessages {\n const base = KIT_MESSAGES[locale];\n const sections = Object.keys(base) as (keyof KitMessages)[];\n\n return Object.fromEntries(\n sections.map(section => [section, { ...base[section], ...override[section] }])\n ) as KitMessages;\n}\n"],"mappings":";;;;;;AAMA,IAAa,eAAyD;CAAE,SAAS;CAAM,SAAS;AAAK;;AAGrG,IAAa,mBAAgC,aAAa;;;;;;;AAQ1D,SAAgB,gBAAgB,SAAoB,gBAAgB,WAAgC,CAAC,GAAgB;CACjH,MAAM,OAAO,aAAa;CAC1B,MAAM,WAAW,OAAO,KAAK,IAAI;CAEjC,OAAO,OAAO,YACV,SAAS,KAAI,YAAW,CAAC,SAAS;EAAE,GAAG,KAAK;EAAU,GAAG,SAAS;CAAS,CAAC,CAAC,CACjF;AACJ"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Record that may have an id, the minimum requirement of the components that show or edit records (tables, tabs and
3
+ * forms). A record without an id was not saved yet.
4
+ */
5
+ export interface Identifiable {
6
+ id?: number | string | null;
7
+ }
@@ -0,0 +1 @@
1
+ "use client";
@@ -0,0 +1,26 @@
1
+ import { KitLocale } from '../i18n/KitLocale';
2
+ import { KitMessages, KitMessagesOverride } from '../i18n/KitMessages';
3
+ import { FormRouteSegments } from '../router/FormRouteSegments';
4
+ import { RouterAdapter } from '../router/RouterAdapter';
5
+ /** Options an app gives to the `KitProvider`. All of them are optional. */
6
+ export type KitOptions = {
7
+ /** Router of the app; without it, links reload the page (see `anchorRouter`). */
8
+ router?: RouterAdapter;
9
+ /** Name of the app, shown in the browser tab title by the page templates (e.g. "Regions - My System"). */
10
+ appName?: string;
11
+ /** Locale of the texts and of the number and date formats. Default: `en-US`. */
12
+ locale?: KitLocale;
13
+ /** Texts that replace the ones of the locale (e.g. translations from the i18n library of the app). */
14
+ messages?: KitMessagesOverride;
15
+ /** URL segments of the CRUD form pages (create, edit and view). */
16
+ formRouteSegments?: FormRouteSegments;
17
+ };
18
+ /** Configuration the components read from the `KitProvider`: the {@link KitOptions} with the defaults applied. */
19
+ export type KitConfig = {
20
+ router: RouterAdapter;
21
+ appName?: string;
22
+ locale: KitLocale;
23
+ /** Texts of the locale, with the ones the app overrides. */
24
+ messages: KitMessages;
25
+ formRouteSegments: FormRouteSegments;
26
+ };
@@ -0,0 +1 @@
1
+ "use client";
@@ -0,0 +1,9 @@
1
+ import { KitConfig, KitOptions } from './KitConfig';
2
+ /**
3
+ * Applies the defaults to the options of an app.
4
+ * @param options options given to the `KitProvider`
5
+ * @return the complete configuration
6
+ */
7
+ export declare function kitConfig(options?: KitOptions): KitConfig;
8
+ /** Context with the {@link KitConfig} of the app, read by the library components. Outside a provider, the defaults apply. */
9
+ export declare const KitContext: import("react").Context<KitConfig>;
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ import "../i18n/KitLocale.js";
3
+ import { resolveMessages } from "../i18n/resolveMessages.js";
4
+ import { anchorRouter } from "../router/anchorRouter.js";
5
+ import { DEFAULT_FORM_ROUTE_SEGMENTS } from "../router/FormRouteSegments.js";
6
+ import { createContext } from "react";
7
+ // src/provider/KitContext.ts
8
+ /**
9
+ * Applies the defaults to the options of an app.
10
+ * @param options options given to the `KitProvider`
11
+ * @return the complete configuration
12
+ */
13
+ function kitConfig(options = {}) {
14
+ const locale = options.locale ?? "en-US";
15
+ return {
16
+ router: options.router ?? anchorRouter,
17
+ appName: options.appName,
18
+ locale,
19
+ messages: resolveMessages(locale, options.messages),
20
+ formRouteSegments: options.formRouteSegments ?? DEFAULT_FORM_ROUTE_SEGMENTS
21
+ };
22
+ }
23
+ /** Context with the {@link KitConfig} of the app, read by the library components. Outside a provider, the defaults apply. */
24
+ var KitContext = createContext(kitConfig());
25
+ export { KitContext, kitConfig };
26
+
27
+ //# sourceMappingURL=KitContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KitContext.js","names":[],"sources":["../../src/provider/KitContext.ts"],"sourcesContent":["import { createContext } from 'react';\n\nimport { DEFAULT_LOCALE } from '../i18n/KitLocale';\nimport { resolveMessages } from '../i18n/resolveMessages';\nimport { anchorRouter } from '../router/anchorRouter';\nimport { DEFAULT_FORM_ROUTE_SEGMENTS } from '../router/FormRouteSegments';\nimport { KitConfig, KitOptions } from './KitConfig';\n\n/**\n * Applies the defaults to the options of an app.\n * @param options options given to the `KitProvider`\n * @return the complete configuration\n */\nexport function kitConfig(options: KitOptions = {}): KitConfig {\n const locale = options.locale ?? DEFAULT_LOCALE;\n\n return {\n router: options.router ?? anchorRouter,\n appName: options.appName,\n locale,\n messages: resolveMessages(locale, options.messages),\n formRouteSegments: options.formRouteSegments ?? DEFAULT_FORM_ROUTE_SEGMENTS\n };\n}\n\n/** Context with the {@link KitConfig} of the app, read by the library components. Outside a provider, the defaults apply. */\nexport const KitContext = createContext<KitConfig>(kitConfig());\n"],"mappings":";;;;;;;;;;;;AAaA,SAAgB,UAAU,UAAsB,CAAC,GAAc;CAC3D,MAAM,SAAS,QAAQ,UAAA;CAEvB,OAAO;EACH,QAAQ,QAAQ,UAAU;EAC1B,SAAS,QAAQ;EACjB;EACA,UAAU,gBAAgB,QAAQ,QAAQ,QAAQ;EAClD,mBAAmB,QAAQ,qBAAqB;CACpD;AACJ;;AAGA,IAAa,aAAa,cAAyB,UAAU,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { PropsWithChildren, ReactElement } from 'react';
2
+ import { KitOptions } from './KitConfig';
3
+ /**
4
+ * Gives the library components the configuration of the app: router, name, locale and texts. It must wrap the app,
5
+ * inside the `MantineProvider`. Options not given use the defaults (see {@link kitConfig}).
6
+ */
7
+ export declare function KitProvider({ children, router, appName, locale, messages, formRouteSegments }: PropsWithChildren<KitOptions>): ReactElement;
@@ -0,0 +1,31 @@
1
+ "use client";
2
+ import { KitContext, kitConfig } from "./KitContext.js";
3
+ import { useMemo } from "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ // src/provider/KitProvider.tsx
6
+ /**
7
+ * Gives the library components the configuration of the app: router, name, locale and texts. It must wrap the app,
8
+ * inside the `MantineProvider`. Options not given use the defaults (see {@link kitConfig}).
9
+ */
10
+ function KitProvider({ children, router, appName, locale, messages, formRouteSegments }) {
11
+ const config = useMemo(() => kitConfig({
12
+ router,
13
+ appName,
14
+ locale,
15
+ messages,
16
+ formRouteSegments
17
+ }), [
18
+ router,
19
+ appName,
20
+ locale,
21
+ messages,
22
+ formRouteSegments
23
+ ]);
24
+ return /* @__PURE__ */ jsx(KitContext.Provider, {
25
+ value: config,
26
+ children
27
+ });
28
+ }
29
+ export { KitProvider };
30
+
31
+ //# sourceMappingURL=KitProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KitProvider.js","names":[],"sources":["../../src/provider/KitProvider.tsx"],"sourcesContent":["import { PropsWithChildren, ReactElement, useMemo } from 'react';\n\nimport { KitOptions } from './KitConfig';\nimport { kitConfig, KitContext } from './KitContext';\n\n/**\n * Gives the library components the configuration of the app: router, name, locale and texts. It must wrap the app,\n * inside the `MantineProvider`. Options not given use the defaults (see {@link kitConfig}).\n */\nexport function KitProvider({\n children,\n router,\n appName,\n locale,\n messages,\n formRouteSegments\n}: PropsWithChildren<KitOptions>): ReactElement {\n const config = useMemo(\n () => kitConfig({ router, appName, locale, messages, formRouteSegments }),\n [router, appName, locale, messages, formRouteSegments]\n );\n\n return <KitContext.Provider value={config}>{children}</KitContext.Provider>;\n}\n"],"mappings":";;;;;;;;;AASA,SAAgB,YAAY,EACxB,UACA,QACA,SACA,QACA,UACA,qBAC4C;CAC5C,MAAM,SAAS,cACL,UAAU;EAAE;EAAQ;EAAS;EAAQ;EAAU;CAAkB,CAAC,GACxE;EAAC;EAAQ;EAAS;EAAQ;EAAU;CAAiB,CACzD;CAEA,OAAO,oBAAC,WAAW,UAAZ;EAAqB,OAAO;EAAS;CAA8B,CAAA;AAC9E"}
@@ -0,0 +1,15 @@
1
+ import { KitMessages } from '../i18n/KitMessages';
2
+ import { RouterAdapter } from '../router/RouterAdapter';
3
+ import { KitConfig } from './KitConfig';
4
+ /** @return the configuration of the app, given to the `KitProvider` */
5
+ export declare function useKitConfig(): KitConfig;
6
+ /** @return the router of the app, given to the `KitProvider` */
7
+ export declare function useKitRouter(): RouterAdapter;
8
+ /** @return the texts of the locale chosen in the `KitProvider` */
9
+ export declare function useKitMessages(): KitMessages;
10
+ /**
11
+ * Builds the browser tab title of a page: the page title followed by the app name, if any.
12
+ * @param pageTitle title of the page
13
+ * @return the title, such as "Regions - My System"
14
+ */
15
+ export declare function useDocumentTitle(pageTitle: string): string;
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { KitContext } from "./KitContext.js";
3
+ import { useContext } from "react";
4
+ // src/provider/useKit.ts
5
+ /** @return the configuration of the app, given to the `KitProvider` */
6
+ function useKitConfig() {
7
+ return useContext(KitContext);
8
+ }
9
+ /** @return the router of the app, given to the `KitProvider` */
10
+ function useKitRouter() {
11
+ return useContext(KitContext).router;
12
+ }
13
+ /** @return the texts of the locale chosen in the `KitProvider` */
14
+ function useKitMessages() {
15
+ return useContext(KitContext).messages;
16
+ }
17
+ /**
18
+ * Builds the browser tab title of a page: the page title followed by the app name, if any.
19
+ * @param pageTitle title of the page
20
+ * @return the title, such as "Regions - My System"
21
+ */
22
+ function useDocumentTitle(pageTitle) {
23
+ const { appName } = useKitConfig();
24
+ return appName ? `${pageTitle} - ${appName}` : pageTitle;
25
+ }
26
+ export { useDocumentTitle, useKitConfig, useKitMessages, useKitRouter };
27
+
28
+ //# sourceMappingURL=useKit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useKit.js","names":[],"sources":["../../src/provider/useKit.ts"],"sourcesContent":["import { useContext } from 'react';\n\nimport { KitMessages } from '../i18n/KitMessages';\nimport { RouterAdapter } from '../router/RouterAdapter';\nimport { KitConfig } from './KitConfig';\nimport { KitContext } from './KitContext';\n\n/** @return the configuration of the app, given to the `KitProvider` */\nexport function useKitConfig(): KitConfig {\n return useContext(KitContext);\n}\n\n/** @return the router of the app, given to the `KitProvider` */\nexport function useKitRouter(): RouterAdapter {\n return useContext(KitContext).router;\n}\n\n/** @return the texts of the locale chosen in the `KitProvider` */\nexport function useKitMessages(): KitMessages {\n return useContext(KitContext).messages;\n}\n\n/**\n * Builds the browser tab title of a page: the page title followed by the app name, if any.\n * @param pageTitle title of the page\n * @return the title, such as \"Regions - My System\"\n */\nexport function useDocumentTitle(pageTitle: string): string {\n const { appName } = useKitConfig();\n\n return appName ? `${pageTitle} - ${appName}` : pageTitle;\n}\n"],"mappings":";;;;;AAQA,SAAgB,eAA0B;CACtC,OAAO,WAAW,UAAU;AAChC;;AAGA,SAAgB,eAA8B;CAC1C,OAAO,WAAW,UAAU,CAAC,CAAC;AAClC;;AAGA,SAAgB,iBAA8B;CAC1C,OAAO,WAAW,UAAU,CAAC,CAAC;AAClC;;;;;;AAOA,SAAgB,iBAAiB,WAA2B;CACxD,MAAM,EAAE,YAAY,aAAa;CAEjC,OAAO,UAAU,GAAG,UAAU,KAAK,YAAY;AACnD"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * URL segments of the CRUD form pages, after the base path of a feature (e.g. `/region/edit/5`). They are not
3
+ * translated with the locale, since a URL should not change with the user's language: the app chooses them once, in
4
+ * the `formRouteSegments` option of the `KitProvider`, from the presets below or with its own words.
5
+ */
6
+ export type FormRouteSegments = {
7
+ create: string;
8
+ edit: string;
9
+ view: string;
10
+ };
11
+ /** English segments: `create`, `edit/:id` and `view/:id`. */
12
+ export declare const ENGLISH_FORM_ROUTE_SEGMENTS: FormRouteSegments;
13
+ /** Portuguese segments: `criar`, `editar/:id` and `visualizar/:id`. */
14
+ export declare const PORTUGUESE_FORM_ROUTE_SEGMENTS: FormRouteSegments;
15
+ /** Segments used when the app chooses none: {@link ENGLISH_FORM_ROUTE_SEGMENTS}. */
16
+ export declare const DEFAULT_FORM_ROUTE_SEGMENTS: FormRouteSegments;
@@ -0,0 +1,19 @@
1
+ "use client";
2
+ // src/router/FormRouteSegments.ts
3
+ /** English segments: `create`, `edit/:id` and `view/:id`. */
4
+ var ENGLISH_FORM_ROUTE_SEGMENTS = {
5
+ create: "create",
6
+ edit: "edit",
7
+ view: "view"
8
+ };
9
+ /** Portuguese segments: `criar`, `editar/:id` and `visualizar/:id`. */
10
+ var PORTUGUESE_FORM_ROUTE_SEGMENTS = {
11
+ create: "criar",
12
+ edit: "editar",
13
+ view: "visualizar"
14
+ };
15
+ /** Segments used when the app chooses none: {@link ENGLISH_FORM_ROUTE_SEGMENTS}. */
16
+ var DEFAULT_FORM_ROUTE_SEGMENTS = ENGLISH_FORM_ROUTE_SEGMENTS;
17
+ export { DEFAULT_FORM_ROUTE_SEGMENTS, ENGLISH_FORM_ROUTE_SEGMENTS, PORTUGUESE_FORM_ROUTE_SEGMENTS };
18
+
19
+ //# sourceMappingURL=FormRouteSegments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormRouteSegments.js","names":[],"sources":["../../src/router/FormRouteSegments.ts"],"sourcesContent":["/**\n * URL segments of the CRUD form pages, after the base path of a feature (e.g. `/region/edit/5`). They are not\n * translated with the locale, since a URL should not change with the user's language: the app chooses them once, in\n * the `formRouteSegments` option of the `KitProvider`, from the presets below or with its own words.\n */\nexport type FormRouteSegments = {\n create: string;\n edit: string;\n view: string;\n};\n\n/** English segments: `create`, `edit/:id` and `view/:id`. */\nexport const ENGLISH_FORM_ROUTE_SEGMENTS: FormRouteSegments = { create: 'create', edit: 'edit', view: 'view' };\n\n/** Portuguese segments: `criar`, `editar/:id` and `visualizar/:id`. */\nexport const PORTUGUESE_FORM_ROUTE_SEGMENTS: FormRouteSegments = {\n create: 'criar',\n edit: 'editar',\n view: 'visualizar'\n};\n\n/** Segments used when the app chooses none: {@link ENGLISH_FORM_ROUTE_SEGMENTS}. */\nexport const DEFAULT_FORM_ROUTE_SEGMENTS: FormRouteSegments = ENGLISH_FORM_ROUTE_SEGMENTS;\n"],"mappings":";;;AAYA,IAAa,8BAAiD;CAAE,QAAQ;CAAU,MAAM;CAAQ,MAAM;AAAO;;AAG7G,IAAa,iCAAoD;CAC7D,QAAQ;CACR,MAAM;CACN,MAAM;AACV;;AAGA,IAAa,8BAAiD"}
@@ -0,0 +1,24 @@
1
+ import { CSSProperties, ForwardRefExoticComponent, MouseEventHandler, ReactNode, RefAttributes } from 'react';
2
+ /** Props the library components pass to the link component of the router. */
3
+ export interface RouterLinkProps {
4
+ href: string;
5
+ children?: ReactNode;
6
+ className?: string;
7
+ style?: CSSProperties;
8
+ onClick?: MouseEventHandler<HTMLAnchorElement>;
9
+ }
10
+ /**
11
+ * Bridge between the library and the router of the app (Next.js, React Router or another one). The components import
12
+ * no router: they navigate and build links only through this contract, given to the `KitProvider`.
13
+ */
14
+ export interface RouterAdapter {
15
+ /**
16
+ * Link component of the router. It receives the destination in `href` (the adapter converts it, e.g. to the `to`
17
+ * of React Router) and forwards the `ref` to the `<a>`, which Mantine uses to place tooltips.
18
+ */
19
+ Link: ForwardRefExoticComponent<RouterLinkProps & RefAttributes<HTMLAnchorElement>>;
20
+ /** Hook that returns the path of the current page (e.g. `/region`), without the query string. */
21
+ usePathname: () => string;
22
+ /** Hook that returns the function that navigates to a URL. */
23
+ useNavigate: () => (url: string) => void;
24
+ }
@@ -0,0 +1 @@
1
+ "use client";
@@ -0,0 +1,7 @@
1
+ import { RouterAdapter } from './RouterAdapter';
2
+ /**
3
+ * Default router, used when the app gives none to the `KitProvider`: plain links (`<a>`) and navigation through
4
+ * `window.location`. It works in any app, but reloads the page on every navigation; apps with a router (Next.js,
5
+ * React Router) should give their own adapter.
6
+ */
7
+ export declare const anchorRouter: RouterAdapter;
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { forwardRef } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ // src/router/anchorRouter.tsx
5
+ /** Plain HTML link: reloads the page when navigating. */
6
+ var AnchorLink = forwardRef((props, ref) => /* @__PURE__ */ jsx("a", {
7
+ ref,
8
+ ...props
9
+ }));
10
+ AnchorLink.displayName = "AnchorLink";
11
+ /**
12
+ * Default router, used when the app gives none to the `KitProvider`: plain links (`<a>`) and navigation through
13
+ * `window.location`. It works in any app, but reloads the page on every navigation; apps with a router (Next.js,
14
+ * React Router) should give their own adapter.
15
+ */
16
+ var anchorRouter = {
17
+ Link: AnchorLink,
18
+ usePathname: () => typeof window === "undefined" ? "/" : window.location.pathname,
19
+ useNavigate: () => (url) => window.location.assign(url)
20
+ };
21
+ export { anchorRouter };
22
+
23
+ //# sourceMappingURL=anchorRouter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anchorRouter.js","names":[],"sources":["../../src/router/anchorRouter.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nimport { RouterAdapter, RouterLinkProps } from './RouterAdapter';\n\n/** Plain HTML link: reloads the page when navigating. */\nconst AnchorLink = forwardRef<HTMLAnchorElement, RouterLinkProps>((props, ref) => <a ref={ref} {...props} />);\nAnchorLink.displayName = 'AnchorLink';\n\n/**\n * Default router, used when the app gives none to the `KitProvider`: plain links (`<a>`) and navigation through\n * `window.location`. It works in any app, but reloads the page on every navigation; apps with a router (Next.js,\n * React Router) should give their own adapter.\n */\nexport const anchorRouter: RouterAdapter = {\n Link: AnchorLink,\n usePathname: () => (typeof window === 'undefined' ? '/' : window.location.pathname),\n useNavigate: () => (url: string) => window.location.assign(url)\n};\n"],"mappings":";;;;;AAKA,IAAM,aAAa,YAAgD,OAAO,QAAQ,oBAAC,KAAD;CAAQ;CAAK,GAAI;AAAQ,CAAA,CAAC;AAC5G,WAAW,cAAc;;;;;;AAOzB,IAAa,eAA8B;CACvC,MAAM;CACN,mBAAoB,OAAO,WAAW,cAAc,MAAM,OAAO,SAAS;CAC1E,oBAAoB,QAAgB,OAAO,SAAS,OAAO,GAAG;AAClE"}