@ifto/mantine-kit 0.0.0-stage → 0.1.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 (298) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +471 -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 +108 -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 +123 -0
  126. package/dist/component/organism/ViewTable/ViewTable.js.map +1 -0
  127. package/dist/component/template/CreateFormPage/CreateFormPage.d.ts +19 -0
  128. package/dist/component/template/CreateFormPage/CreateFormPage.js +41 -0
  129. package/dist/component/template/CreateFormPage/CreateFormPage.js.map +1 -0
  130. package/dist/component/template/EditFormPage/EditFormPage.d.ts +19 -0
  131. package/dist/component/template/EditFormPage/EditFormPage.js +42 -0
  132. package/dist/component/template/EditFormPage/EditFormPage.js.map +1 -0
  133. package/dist/component/template/FormPage/FormPage.d.ts +25 -0
  134. package/dist/component/template/FormPage/FormPage.js +130 -0
  135. package/dist/component/template/FormPage/FormPage.js.map +1 -0
  136. package/dist/component/template/FormPage/FormType.d.ts +6 -0
  137. package/dist/component/template/FormPage/FormType.js +12 -0
  138. package/dist/component/template/FormPage/FormType.js.map +1 -0
  139. package/dist/component/template/Layout/Layout.d.ts +21 -0
  140. package/dist/component/template/Layout/Layout.js +121 -0
  141. package/dist/component/template/Layout/Layout.js.map +1 -0
  142. package/dist/component/template/Layout/Layout.module.js +19 -0
  143. package/dist/component/template/Layout/Layout.module.js.map +1 -0
  144. package/dist/component/template/ListPage/ListPage.d.ts +32 -0
  145. package/dist/component/template/ListPage/ListPage.js +47 -0
  146. package/dist/component/template/ListPage/ListPage.js.map +1 -0
  147. package/dist/component/template/PrintPage/PrintPage.d.ts +25 -0
  148. package/dist/component/template/PrintPage/PrintPage.js +115 -0
  149. package/dist/component/template/PrintPage/PrintPage.js.map +1 -0
  150. package/dist/component/template/ViewPage/ViewPage.d.ts +11 -0
  151. package/dist/component/template/ViewPage/ViewPage.js +49 -0
  152. package/dist/component/template/ViewPage/ViewPage.js.map +1 -0
  153. package/dist/data/ListDataSource.d.ts +12 -0
  154. package/dist/data/ListDataSource.js +1 -0
  155. package/dist/data/SaveDataSource.d.ts +16 -0
  156. package/dist/data/SaveDataSource.js +1 -0
  157. package/dist/export/ExportCellText.d.ts +18 -0
  158. package/dist/export/ExportCellText.js +60 -0
  159. package/dist/export/ExportCellText.js.map +1 -0
  160. package/dist/export/ExportDocument.d.ts +127 -0
  161. package/dist/export/ExportDocument.js +59 -0
  162. package/dist/export/ExportDocument.js.map +1 -0
  163. package/dist/export/ExportDownload.d.ts +9 -0
  164. package/dist/export/ExportDownload.js +19 -0
  165. package/dist/export/ExportDownload.js.map +1 -0
  166. package/dist/export/ExportFileName.d.ts +11 -0
  167. package/dist/export/ExportFileName.js +24 -0
  168. package/dist/export/ExportFileName.js.map +1 -0
  169. package/dist/export/ExportFormat.d.ts +30 -0
  170. package/dist/export/ExportFormat.js +1 -0
  171. package/dist/export/ExportFormats.d.ts +12 -0
  172. package/dist/export/ExportFormats.js +16 -0
  173. package/dist/export/ExportFormats.js.map +1 -0
  174. package/dist/export/ExportTexts.d.ts +14 -0
  175. package/dist/export/ExportTexts.js +23 -0
  176. package/dist/export/ExportTexts.js.map +1 -0
  177. package/dist/export/csv/CsvFormat.d.ts +41 -0
  178. package/dist/export/csv/CsvFormat.js +91 -0
  179. package/dist/export/csv/CsvFormat.js.map +1 -0
  180. package/dist/export/xlsx/XlsxFormat.d.ts +35 -0
  181. package/dist/export/xlsx/XlsxFormat.js +66 -0
  182. package/dist/export/xlsx/XlsxFormat.js.map +1 -0
  183. package/dist/export/xlsx/XlsxNumberFormat.d.ts +8 -0
  184. package/dist/export/xlsx/XlsxNumberFormat.js +15 -0
  185. package/dist/export/xlsx/XlsxNumberFormat.js.map +1 -0
  186. package/dist/export/xlsx/XlsxSheetName.d.ts +12 -0
  187. package/dist/export/xlsx/XlsxSheetName.js +62 -0
  188. package/dist/export/xlsx/XlsxSheetName.js.map +1 -0
  189. package/dist/export/xlsx/XlsxSheetWriter.d.ts +67 -0
  190. package/dist/export/xlsx/XlsxSheetWriter.js +215 -0
  191. package/dist/export/xlsx/XlsxSheetWriter.js.map +1 -0
  192. package/dist/export/xlsx/XlsxStyle.d.ts +51 -0
  193. package/dist/export/xlsx/XlsxStyle.js +87 -0
  194. package/dist/export/xlsx/XlsxStyle.js.map +1 -0
  195. package/dist/hook/useIsMobile.d.ts +5 -0
  196. package/dist/hook/useIsMobile.js +16 -0
  197. package/dist/hook/useIsMobile.js.map +1 -0
  198. package/dist/hook/useKeyedService.d.ts +22 -0
  199. package/dist/hook/useKeyedService.js +38 -0
  200. package/dist/hook/useKeyedService.js.map +1 -0
  201. package/dist/hook/useLightColorSchemeOnPrint.d.ts +9 -0
  202. package/dist/hook/useLightColorSchemeOnPrint.js +36 -0
  203. package/dist/hook/useLightColorSchemeOnPrint.js.map +1 -0
  204. package/dist/hook/useService.d.ts +12 -0
  205. package/dist/hook/useService.js +29 -0
  206. package/dist/hook/useService.js.map +1 -0
  207. package/dist/http/ApiError.d.ts +13 -0
  208. package/dist/http/ApiError.js +22 -0
  209. package/dist/http/ApiError.js.map +1 -0
  210. package/dist/http/AxiosHttpClient.d.ts +21 -0
  211. package/dist/http/AxiosHttpClient.js +67 -0
  212. package/dist/http/AxiosHttpClient.js.map +1 -0
  213. package/dist/http/AxiosHttpClientConfig.d.ts +37 -0
  214. package/dist/http/AxiosHttpClientConfig.js +19 -0
  215. package/dist/http/AxiosHttpClientConfig.js.map +1 -0
  216. package/dist/i18n/KitLocale.d.ts +4 -0
  217. package/dist/i18n/KitLocale.js +7 -0
  218. package/dist/i18n/KitLocale.js.map +1 -0
  219. package/dist/i18n/KitMessages.d.ts +146 -0
  220. package/dist/i18n/KitMessages.js +1 -0
  221. package/dist/i18n/messages/enUS.d.ts +3 -0
  222. package/dist/i18n/messages/enUS.js +112 -0
  223. package/dist/i18n/messages/enUS.js.map +1 -0
  224. package/dist/i18n/messages/ptBR.d.ts +3 -0
  225. package/dist/i18n/messages/ptBR.js +97 -0
  226. package/dist/i18n/messages/ptBR.js.map +1 -0
  227. package/dist/i18n/resolveMessages.d.ts +13 -0
  228. package/dist/i18n/resolveMessages.js +29 -0
  229. package/dist/i18n/resolveMessages.js.map +1 -0
  230. package/dist/model/Identifiable.d.ts +7 -0
  231. package/dist/model/Identifiable.js +1 -0
  232. package/dist/provider/KitConfig.d.ts +26 -0
  233. package/dist/provider/KitConfig.js +1 -0
  234. package/dist/provider/KitContext.d.ts +9 -0
  235. package/dist/provider/KitContext.js +27 -0
  236. package/dist/provider/KitContext.js.map +1 -0
  237. package/dist/provider/KitProvider.d.ts +7 -0
  238. package/dist/provider/KitProvider.js +31 -0
  239. package/dist/provider/KitProvider.js.map +1 -0
  240. package/dist/provider/useKit.d.ts +15 -0
  241. package/dist/provider/useKit.js +28 -0
  242. package/dist/provider/useKit.js.map +1 -0
  243. package/dist/router/FormRouteSegments.d.ts +16 -0
  244. package/dist/router/FormRouteSegments.js +19 -0
  245. package/dist/router/FormRouteSegments.js.map +1 -0
  246. package/dist/router/RouterAdapter.d.ts +24 -0
  247. package/dist/router/RouterAdapter.js +1 -0
  248. package/dist/router/anchorRouter.d.ts +7 -0
  249. package/dist/router/anchorRouter.js +23 -0
  250. package/dist/router/anchorRouter.js.map +1 -0
  251. package/dist/styles/print.css +93 -0
  252. package/dist/styles.css +188 -0
  253. package/dist/util/ArrayUtil.d.ts +39 -0
  254. package/dist/util/ArrayUtil.js +48 -0
  255. package/dist/util/ArrayUtil.js.map +1 -0
  256. package/dist/util/ColorUtil.d.ts +7 -0
  257. package/dist/util/ColorUtil.js +16 -0
  258. package/dist/util/ColorUtil.js.map +1 -0
  259. package/dist/util/CompareUtil.d.ts +19 -0
  260. package/dist/util/CompareUtil.js +51 -0
  261. package/dist/util/CompareUtil.js.map +1 -0
  262. package/dist/util/DateUtil.d.ts +37 -0
  263. package/dist/util/DateUtil.js +53 -0
  264. package/dist/util/DateUtil.js.map +1 -0
  265. package/dist/util/DownloadUtil.d.ts +6 -0
  266. package/dist/util/DownloadUtil.js +25 -0
  267. package/dist/util/DownloadUtil.js.map +1 -0
  268. package/dist/util/EnumUtil.d.ts +19 -0
  269. package/dist/util/EnumUtil.js +32 -0
  270. package/dist/util/EnumUtil.js.map +1 -0
  271. package/dist/util/FormUtil.d.ts +8 -0
  272. package/dist/util/FormUtil.js +14 -0
  273. package/dist/util/FormUtil.js.map +1 -0
  274. package/dist/util/HtmlUtil.d.ts +8 -0
  275. package/dist/util/HtmlUtil.js +23 -0
  276. package/dist/util/HtmlUtil.js.map +1 -0
  277. package/dist/util/Notifications.d.ts +30 -0
  278. package/dist/util/Notifications.js +59 -0
  279. package/dist/util/Notifications.js.map +1 -0
  280. package/dist/util/NumberUtil.d.ts +19 -0
  281. package/dist/util/NumberUtil.js +33 -0
  282. package/dist/util/NumberUtil.js.map +1 -0
  283. package/dist/util/ObjectUtil.d.ts +22 -0
  284. package/dist/util/ObjectUtil.js +34 -0
  285. package/dist/util/ObjectUtil.js.map +1 -0
  286. package/dist/util/SearchParamsUtil.d.ts +23 -0
  287. package/dist/util/SearchParamsUtil.js +29 -0
  288. package/dist/util/SearchParamsUtil.js.map +1 -0
  289. package/dist/util/TransformData.d.ts +14 -0
  290. package/dist/util/TransformData.js +31 -0
  291. package/dist/util/TransformData.js.map +1 -0
  292. package/dist/util/ValidationUtil.d.ts +9 -0
  293. package/dist/util/ValidationUtil.js +16 -0
  294. package/dist/util/ValidationUtil.js.map +1 -0
  295. package/dist/util/parseActionsPageParams.d.ts +14 -0
  296. package/dist/util/parseActionsPageParams.js +29 -0
  297. package/dist/util/parseActionsPageParams.js.map +1 -0
  298. package/package.json +149 -5
@@ -0,0 +1,6 @@
1
+ type Props = {
2
+ onClick: () => void;
3
+ };
4
+ /** Button that starts editing a table row in place. */
5
+ declare const EditValueButton: ({ onClick }: Props) => import("react/jsx-runtime").JSX.Element;
6
+ export default EditValueButton;
@@ -0,0 +1,24 @@
1
+ "use client";
2
+ import { useKitMessages } from "../../../provider/useKit.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { ActionIcon, Tooltip } from "@mantine/core";
5
+ import { IconEdit } from "@tabler/icons-react";
6
+ // src/component/atom/EditValueButton/EditValueButton.tsx
7
+ /** Button that starts editing a table row in place. */
8
+ var EditValueButton = ({ onClick }) => {
9
+ const label = useKitMessages().rowEdit.edit;
10
+ return /* @__PURE__ */ jsx(Tooltip, {
11
+ label,
12
+ children: /* @__PURE__ */ jsx(ActionIcon, {
13
+ size: "sm",
14
+ variant: "subtle",
15
+ color: "blue",
16
+ onClick,
17
+ "aria-label": label,
18
+ children: /* @__PURE__ */ jsx(IconEdit, { size: 16 })
19
+ })
20
+ });
21
+ };
22
+ export { EditValueButton as default };
23
+
24
+ //# sourceMappingURL=EditValueButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditValueButton.js","names":[],"sources":["../../../../src/component/atom/EditValueButton/EditValueButton.tsx"],"sourcesContent":["import { ActionIcon, Tooltip } from '@mantine/core';\nimport { IconEdit } from '@tabler/icons-react';\n\nimport { useKitMessages } from '../../../provider/useKit';\n\ntype Props = {\n onClick: () => void;\n};\n\n/** Button that starts editing a table row in place. */\nconst EditValueButton = ({ onClick }: Props) => {\n const label = useKitMessages().rowEdit.edit;\n\n return (\n <Tooltip label={label}>\n <ActionIcon size=\"sm\" variant=\"subtle\" color=\"blue\" onClick={onClick} aria-label={label}>\n <IconEdit size={16} />\n </ActionIcon>\n </Tooltip>\n );\n};\n\nexport default EditValueButton;\n"],"mappings":";;;;;;;AAUA,IAAM,mBAAmB,EAAE,cAAqB;CAC5C,MAAM,QAAQ,eAAe,CAAC,CAAC,QAAQ;CAEvC,OACI,oBAAC,SAAD;EAAgB;EACZ,UAAA,oBAAC,YAAD;GAAY,MAAK;GAAK,SAAQ;GAAS,OAAM;GAAgB;GAAS,cAAY;GAC9E,UAAA,oBAAC,UAAD,EAAU,MAAM,GAAK,CAAA;EACb,CAAA;CACP,CAAA;AAEjB"}
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from 'react';
2
+ import { AlertProps } from '@mantine/core';
3
+ type Props = {
4
+ message: ReactNode;
5
+ } & AlertProps;
6
+ /** Red alert that shows an error message (e.g. when the data of a component cannot be loaded). */
7
+ declare const ErrorAlert: ({ message, ...others }: Props) => import("react/jsx-runtime").JSX.Element;
8
+ export default ErrorAlert;
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { Alert } from "@mantine/core";
4
+ import { IconBug } from "@tabler/icons-react";
5
+ // src/component/atom/ErrorAlert/ErrorAlert.tsx
6
+ /** Red alert that shows an error message (e.g. when the data of a component cannot be loaded). */
7
+ var ErrorAlert = ({ message, ...others }) => {
8
+ const icon = /* @__PURE__ */ jsx(IconBug, { size: 18 });
9
+ const { title } = others;
10
+ return /* @__PURE__ */ jsx(Alert, {
11
+ variant: "light",
12
+ color: "red",
13
+ title,
14
+ icon,
15
+ ...others,
16
+ children: message || ""
17
+ });
18
+ };
19
+ export { ErrorAlert as default };
20
+
21
+ //# sourceMappingURL=ErrorAlert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorAlert.js","names":[],"sources":["../../../../src/component/atom/ErrorAlert/ErrorAlert.tsx"],"sourcesContent":["import { ReactNode } from 'react';\n\nimport { Alert, AlertProps } from '@mantine/core';\nimport { IconBug } from '@tabler/icons-react';\n\ntype Props = { message: ReactNode } & AlertProps;\n\n/** Red alert that shows an error message (e.g. when the data of a component cannot be loaded). */\nconst ErrorAlert = ({ message, ...others }: Props) => {\n const icon = <IconBug size={18} />;\n const { title } = others;\n\n return (\n <Alert variant=\"light\" color=\"red\" title={title} icon={icon} {...others}>\n {message || ''}\n </Alert>\n );\n};\n\nexport default ErrorAlert;\n"],"mappings":";;;;;;AAQA,IAAM,cAAc,EAAE,SAAS,GAAG,aAAoB;CAClD,MAAM,OAAO,oBAAC,SAAD,EAAS,MAAM,GAAK,CAAA;CACjC,MAAM,EAAE,UAAU;CAElB,OACI,oBAAC,OAAD;EAAO,SAAQ;EAAQ,OAAM;EAAa;EAAa;EAAM,GAAI;EAC5D,UAAA,WAAW;CACT,CAAA;AAEf"}
@@ -0,0 +1,20 @@
1
+ import { ReactNode } from 'react';
2
+ import { BoxProps, PaperProps } from '@mantine/core';
3
+ type SurfaceProps = {
4
+ children: ReactNode;
5
+ } & BoxProps & PaperProps;
6
+ /** Polymorphic container (e.g. `component={Paper}`) used as the base of cards and page headers. */
7
+ declare const Surface: (<C = "div">(props: import("@mantine/core").PolymorphicComponentProps<C, SurfaceProps>) => React.ReactElement) & Omit<import("react").FunctionComponent<({
8
+ children: ReactNode;
9
+ } & BoxProps & PaperProps & {
10
+ component: React.ElementType;
11
+ renderRoot?: (props: Record<string, any>) => any;
12
+ }) | ({
13
+ children: ReactNode;
14
+ } & BoxProps & PaperProps & {
15
+ component?: any;
16
+ } & Omit<any, "__size" | "__vars" | "attributes" | "bd" | "bdrs" | "bg" | "bga" | "bgp" | "bgr" | "bgsz" | "bottom" | "c" | "children" | "className" | "classNames" | "component" | "darkHidden" | "display" | "ff" | "flex" | "fs" | "fw" | "fz" | "h" | "hiddenFrom" | "inset" | "left" | "lh" | "lightHidden" | "lts" | "m" | "mah" | "maw" | "mb" | "me" | "mie" | "mih" | "mis" | "miw" | "ml" | "mod" | "mr" | "ms" | "mt" | "mx" | "my" | "opacity" | "p" | "pb" | "pe" | "pie" | "pis" | "pl" | "pos" | "pr" | "ps" | "pt" | "px" | "py" | "radius" | "right" | "shadow" | "style" | "styles" | "ta" | "td" | "top" | "tt" | "unstyled" | "variant" | "vars" | "visibleFrom" | "w" | "withBorder"> & {
17
+ ref?: any;
18
+ renderRoot?: (props: any) => any;
19
+ })>, never> & Record<string, never>;
20
+ export default Surface;
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { forwardRef } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { Box, createPolymorphicComponent } from "@mantine/core";
5
+ // src/component/atom/Surface/Surface.tsx
6
+ /** Polymorphic container (e.g. `component={Paper}`) used as the base of cards and page headers. */
7
+ var Surface = createPolymorphicComponent(forwardRef(({ children, ...others }, ref) => /* @__PURE__ */ jsx(Box, {
8
+ component: "div",
9
+ ...others,
10
+ ref,
11
+ children
12
+ })));
13
+ export { Surface as default };
14
+
15
+ //# sourceMappingURL=Surface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Surface.js","names":[],"sources":["../../../../src/component/atom/Surface/Surface.tsx"],"sourcesContent":["'use client';\n\nimport { forwardRef, ReactNode } from 'react';\n\nimport { Box, BoxProps, createPolymorphicComponent, PaperProps } from '@mantine/core';\n\ntype SurfaceProps = { children: ReactNode } & BoxProps & PaperProps;\n\n/** Polymorphic container (e.g. `component={Paper}`) used as the base of cards and page headers. */\nconst Surface = createPolymorphicComponent<'div', SurfaceProps>(\n forwardRef<HTMLDivElement, SurfaceProps>(({ children, ...others }, ref) => (\n <Box component=\"div\" {...others} ref={ref}>\n {children}\n </Box>\n ))\n);\n\nexport default Surface;\n"],"mappings":";;;;;;AASA,IAAM,UAAU,2BACZ,YAA0C,EAAE,UAAU,GAAG,UAAU,QAC/D,oBAAC,KAAD;CAAK,WAAU;CAAM,GAAI;CAAa;CACjC;AACA,CAAA,CACR,CACL"}
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ /** Item of the {@link Breadcrumb}. An `href` of `#` marks the current page, shown as text instead of a link. */
3
+ export interface BreadcrumbItem {
4
+ title: string;
5
+ href: string;
6
+ }
7
+ export interface BreadcrumbProps {
8
+ items: BreadcrumbItem[];
9
+ }
10
+ /** Navigation path to the current page, with a link for each previous page. */
11
+ declare const Breadcrumb: React.FC<BreadcrumbProps>;
12
+ export default Breadcrumb;
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import { useKitRouter } from "../../../provider/useKit.js";
3
+ import "react";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { useColorScheme } from "@mantine/hooks";
6
+ import { Anchor, Breadcrumbs, Text, rem, useMantineTheme } from "@mantine/core";
7
+ // src/component/molecule/Breadcrumb/Breadcrumb.tsx
8
+ /** Navigation path to the current page, with a link for each previous page. */
9
+ var Breadcrumb = ({ items }) => {
10
+ const { Link } = useKitRouter();
11
+ const theme = useMantineTheme();
12
+ const colorScheme = useColorScheme();
13
+ const BREADCRUMBS_PROPS = { style: { a: {
14
+ padding: rem(8),
15
+ borderRadius: theme.radius.sm,
16
+ fontWeight: 500,
17
+ color: colorScheme === "dark" ? theme.white : theme.black,
18
+ "&:hover": {
19
+ transition: "all ease 150ms",
20
+ backgroundColor: colorScheme === "dark" ? theme.colors.dark[5] : theme.colors.gray[2],
21
+ textDecoration: "none"
22
+ }
23
+ } } };
24
+ return /* @__PURE__ */ jsx(Breadcrumbs, {
25
+ ...BREADCRUMBS_PROPS,
26
+ children: items.map((item, index) => item.href === "#" ? /* @__PURE__ */ jsx(Text, {
27
+ c: "dimmed",
28
+ children: item.title
29
+ }, index) : /* @__PURE__ */ jsx(Anchor, {
30
+ component: Link,
31
+ href: item.href,
32
+ children: item.title
33
+ }, index))
34
+ });
35
+ };
36
+ export { Breadcrumb as default };
37
+
38
+ //# sourceMappingURL=Breadcrumb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Breadcrumb.js","names":[],"sources":["../../../../src/component/molecule/Breadcrumb/Breadcrumb.tsx"],"sourcesContent":["import React from 'react';\n\nimport { Anchor, Breadcrumbs, BreadcrumbsProps, rem, Text, useMantineTheme } from '@mantine/core';\nimport { useColorScheme } from '@mantine/hooks';\n\nimport { useKitRouter } from '../../../provider/useKit';\n\n/** Item of the {@link Breadcrumb}. An `href` of `#` marks the current page, shown as text instead of a link. */\nexport interface BreadcrumbItem {\n title: string;\n href: string;\n}\n\nexport interface BreadcrumbProps {\n items: BreadcrumbItem[];\n}\n\n/** Navigation path to the current page, with a link for each previous page. */\nconst Breadcrumb: React.FC<BreadcrumbProps> = ({ items }) => {\n const { Link } = useKitRouter();\n const theme = useMantineTheme();\n const colorScheme = useColorScheme();\n const BREADCRUMBS_PROPS: Omit<BreadcrumbsProps, 'children'> = {\n style: {\n a: {\n padding: rem(8),\n borderRadius: theme.radius.sm,\n fontWeight: 500,\n color: colorScheme === 'dark' ? theme.white : theme.black,\n\n '&:hover': {\n transition: 'all ease 150ms',\n backgroundColor: colorScheme === 'dark' ? theme.colors.dark[5] : theme.colors.gray[2],\n textDecoration: 'none'\n }\n }\n }\n };\n\n return (\n <Breadcrumbs {...BREADCRUMBS_PROPS}>\n {items.map((item, index) =>\n item.href === '#' ? (\n <Text c=\"dimmed\" key={index}>\n {item.title}\n </Text>\n ) : (\n <Anchor component={Link} href={item.href} key={index}>\n {item.title}\n </Anchor>\n )\n )}\n </Breadcrumbs>\n );\n};\n\nexport default Breadcrumb;\n"],"mappings":";;;;;;;;AAkBA,IAAM,cAAyC,EAAE,YAAY;CACzD,MAAM,EAAE,SAAS,aAAa;CAC9B,MAAM,QAAQ,gBAAgB;CAC9B,MAAM,cAAc,eAAe;CACnC,MAAM,oBAAwD,EAC1D,OAAO,EACH,GAAG;EACC,SAAS,IAAI,CAAC;EACd,cAAc,MAAM,OAAO;EAC3B,YAAY;EACZ,OAAO,gBAAgB,SAAS,MAAM,QAAQ,MAAM;EAEpD,WAAW;GACP,YAAY;GACZ,iBAAiB,gBAAgB,SAAS,MAAM,OAAO,KAAK,KAAK,MAAM,OAAO,KAAK;GACnF,gBAAgB;EACpB;CACJ,EACJ,EACJ;CAEA,OACI,oBAAC,aAAD;EAAa,GAAI;EACZ,UAAA,MAAM,KAAK,MAAM,UACd,KAAK,SAAS,MACV,oBAAC,MAAD;GAAM,GAAE;GACH,UAAA,KAAK;EACJ,GAFgB,KAEhB,IAEN,oBAAC,QAAD;GAAQ,WAAW;GAAM,MAAM,KAAK;GAC/B,UAAA,KAAK;EACF,GAFuC,KAEvC,CAEhB;CACS,CAAA;AAErB"}
@@ -0,0 +1,25 @@
1
+ import { ReactElement } from 'react';
2
+ import { ButtonProps } from '@mantine/core';
3
+ import type { ExportFormat } from '../../../export/ExportFormat';
4
+ type Props = Omit<ButtonProps, 'children' | 'leftSection' | 'loading'> & {
5
+ /**
6
+ * Exports the data in the chosen format. While the `Promise` is running, the button shows it is loading; if it
7
+ * fails, the error is shown in a notification.
8
+ */
9
+ onExport: (format: ExportFormat) => Promise<void>;
10
+ /**
11
+ * Formats offered in the menu, in their order: the built-in ones (e.g. `EXPORT_FORMATS` or just `XLSX_FORMAT`, from
12
+ * `export/ExportFormats`) or any other implementation of {@link ExportFormat}.
13
+ */
14
+ formats: readonly ExportFormat[];
15
+ /** Text of the button; absent for the one of the locale. */
16
+ label?: string;
17
+ /** Text shown below the name of a format in the menu (e.g. what is exported in it); absent for none. */
18
+ formatDescription?: (format: ExportFormat) => string | undefined;
19
+ };
20
+ /**
21
+ * "Export" button, with a menu of the given export formats. It knows neither what is exported nor how: whoever uses it
22
+ * chooses the formats and generates the file in {@link Props.onExport}.
23
+ */
24
+ declare function ExportMenuButton({ onExport, formats, label, formatDescription, ...buttonProps }: Props): ReactElement;
25
+ export default ExportMenuButton;
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ import { useKitMessages } from "../../../provider/useKit.js";
3
+ import { showErrorNotification } from "../../../util/Notifications.js";
4
+ import { useState } from "react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { Button, Menu, Text } from "@mantine/core";
7
+ import { IconDownload } from "@tabler/icons-react";
8
+ // src/component/molecule/ExportMenuButton/ExportMenuButton.tsx
9
+ /** Size of the button icon (px). */
10
+ var ICON_SIZE = 18;
11
+ /**
12
+ * "Export" button, with a menu of the given export formats. It knows neither what is exported nor how: whoever uses it
13
+ * chooses the formats and generates the file in {@link Props.onExport}.
14
+ */
15
+ function ExportMenuButton({ onExport, formats, label, formatDescription, ...buttonProps }) {
16
+ const messages = useKitMessages();
17
+ const [exporting, setExporting] = useState(false);
18
+ async function exportFormat(format) {
19
+ setExporting(true);
20
+ try {
21
+ await onExport(format);
22
+ } catch (error) {
23
+ showErrorNotification(error, messages.export.failed(format.label), messages.common.error);
24
+ } finally {
25
+ setExporting(false);
26
+ }
27
+ }
28
+ return /* @__PURE__ */ jsxs(Menu, {
29
+ position: "bottom-end",
30
+ withinPortal: true,
31
+ children: [/* @__PURE__ */ jsx(Menu.Target, { children: /* @__PURE__ */ jsx(Button, {
32
+ variant: "light",
33
+ leftSection: /* @__PURE__ */ jsx(IconDownload, { size: ICON_SIZE }),
34
+ loading: exporting,
35
+ ...buttonProps,
36
+ children: label ?? messages.export.button
37
+ }) }), /* @__PURE__ */ jsx(Menu.Dropdown, { children: formats.map((format) => /* @__PURE__ */ jsxs(Menu.Item, {
38
+ onClick: () => exportFormat(format),
39
+ children: [format.label, formatDescription?.(format) && /* @__PURE__ */ jsx(Text, {
40
+ size: "xs",
41
+ c: "dimmed",
42
+ children: formatDescription(format)
43
+ })]
44
+ }, format.id)) })]
45
+ });
46
+ }
47
+ export { ExportMenuButton as default };
48
+
49
+ //# sourceMappingURL=ExportMenuButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExportMenuButton.js","names":[],"sources":["../../../../src/component/molecule/ExportMenuButton/ExportMenuButton.tsx"],"sourcesContent":["'use client';\n\nimport { ReactElement, useState } from 'react';\n\nimport { Button, ButtonProps, Menu, Text } from '@mantine/core';\nimport { IconDownload } from '@tabler/icons-react';\n\nimport type { ExportFormat } from '../../../export/ExportFormat';\nimport { useKitMessages } from '../../../provider/useKit';\nimport { showErrorNotification } from '../../../util/Notifications';\n\n/** Size of the button icon (px). */\nconst ICON_SIZE = 18;\n\ntype Props = Omit<ButtonProps, 'children' | 'leftSection' | 'loading'> & {\n /**\n * Exports the data in the chosen format. While the `Promise` is running, the button shows it is loading; if it\n * fails, the error is shown in a notification.\n */\n onExport: (format: ExportFormat) => Promise<void>;\n\n /**\n * Formats offered in the menu, in their order: the built-in ones (e.g. `EXPORT_FORMATS` or just `XLSX_FORMAT`, from\n * `export/ExportFormats`) or any other implementation of {@link ExportFormat}.\n */\n formats: readonly ExportFormat[];\n\n /** Text of the button; absent for the one of the locale. */\n label?: string;\n\n /** Text shown below the name of a format in the menu (e.g. what is exported in it); absent for none. */\n formatDescription?: (format: ExportFormat) => string | undefined;\n};\n\n/**\n * \"Export\" button, with a menu of the given export formats. It knows neither what is exported nor how: whoever uses it\n * chooses the formats and generates the file in {@link Props.onExport}.\n */\nfunction ExportMenuButton({ onExport, formats, label, formatDescription, ...buttonProps }: Props): ReactElement {\n const messages = useKitMessages();\n const [exporting, setExporting] = useState(false);\n\n async function exportFormat(format: ExportFormat): Promise<void> {\n setExporting(true);\n try {\n await onExport(format);\n } catch (error) {\n showErrorNotification(error, messages.export.failed(format.label), messages.common.error);\n } finally {\n setExporting(false);\n }\n }\n\n return (\n <Menu position=\"bottom-end\" withinPortal>\n <Menu.Target>\n <Button\n variant=\"light\"\n leftSection={<IconDownload size={ICON_SIZE} />}\n loading={exporting}\n {...buttonProps}\n >\n {label ?? messages.export.button}\n </Button>\n </Menu.Target>\n\n <Menu.Dropdown>\n {formats.map(format => (\n <Menu.Item key={format.id} onClick={() => exportFormat(format)}>\n {format.label}\n {formatDescription?.(format) && (\n <Text size=\"xs\" c=\"dimmed\">\n {formatDescription(format)}\n </Text>\n )}\n </Menu.Item>\n ))}\n </Menu.Dropdown>\n </Menu>\n );\n}\n\nexport default ExportMenuButton;\n"],"mappings":";;;;;;;;;AAYA,IAAM,YAAY;;;;;AA0BlB,SAAS,iBAAiB,EAAE,UAAU,SAAS,OAAO,mBAAmB,GAAG,eAAoC;CAC5G,MAAM,WAAW,eAAe;CAChC,MAAM,CAAC,WAAW,gBAAgB,SAAS,KAAK;CAEhD,eAAe,aAAa,QAAqC;EAC7D,aAAa,IAAI;EACjB,IAAI;GACA,MAAM,SAAS,MAAM;EACzB,SAAS,OAAO;GACZ,sBAAsB,OAAO,SAAS,OAAO,OAAO,OAAO,KAAK,GAAG,SAAS,OAAO,KAAK;EAC5F,UAAU;GACN,aAAa,KAAK;EACtB;CACJ;CAEA,OACI,qBAAC,MAAD;EAAM,UAAS;EAAa,cAAA;EAA5B,UAAA,CACI,oBAAC,KAAK,QAAN,EAAA,UACI,oBAAC,QAAD;GACI,SAAQ;GACR,aAAa,oBAAC,cAAD,EAAc,MAAM,UAAY,CAAA;GAC7C,SAAS;GACT,GAAI;GAEH,UAAA,SAAS,SAAS,OAAO;EACtB,CAAA,EACC,CAAA,GAEb,oBAAC,KAAK,UAAN,EAAA,UACK,QAAQ,KAAI,WACT,qBAAC,KAAK,MAAN;GAA2B,eAAe,aAAa,MAAM;GAA7D,UAAA,CACK,OAAO,OACP,oBAAoB,MAAM,KACvB,oBAAC,MAAD;IAAM,MAAK;IAAK,GAAE;IACb,UAAA,kBAAkB,MAAM;GACvB,CAAA,CAEH;EAPK,GAAA,OAAO,EAOZ,CACd,EACU,CAAA,CACb;;AAEd"}
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from 'react';
2
+ type PaperCardProps = {
3
+ children: ReactNode;
4
+ };
5
+ /** Bordered card with padding and rounded corners, used to group the content of a page (e.g. a form or a table). */
6
+ declare const PaperCard: ({ children }: PaperCardProps) => import("react/jsx-runtime").JSX.Element;
7
+ export default PaperCard;
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { Paper } from "@mantine/core";
4
+ // src/component/molecule/PaperCard/PaperCard.tsx
5
+ var PAPER_PROPS = {
6
+ p: "md",
7
+ radius: "md",
8
+ withBorder: true
9
+ };
10
+ /** Bordered card with padding and rounded corners, used to group the content of a page (e.g. a form or a table). */
11
+ var PaperCard = ({ children }) => /* @__PURE__ */ jsx(Paper, {
12
+ ...PAPER_PROPS,
13
+ children
14
+ });
15
+ export { PaperCard as default };
16
+
17
+ //# sourceMappingURL=PaperCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PaperCard.js","names":[],"sources":["../../../../src/component/molecule/PaperCard/PaperCard.tsx"],"sourcesContent":["'use client';\n\nimport { ReactNode } from 'react';\n\nimport { Paper, PaperProps } from '@mantine/core';\n\ntype PaperCardProps = { children: ReactNode };\n\nconst PAPER_PROPS: PaperProps = {\n p: 'md',\n radius: 'md',\n withBorder: true\n};\n\n/** Bordered card with padding and rounded corners, used to group the content of a page (e.g. a form or a table). */\nconst PaperCard = ({ children }: PaperCardProps) => <Paper {...PAPER_PROPS}>{children}</Paper>;\n\nexport default PaperCard;\n"],"mappings":";;;;AAQA,IAAM,cAA0B;CAC5B,GAAG;CACH,QAAQ;CACR,YAAY;AAChB;;AAGA,IAAM,aAAa,EAAE,eAA+B,oBAAC,OAAD;CAAO,GAAI;CAAc;AAAgB,CAAA"}
@@ -0,0 +1,14 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+ type Props = {
3
+ /** Title of the section. When printing, it is not left alone at the end of a page. */
4
+ title: string;
5
+ /** Whether the section starts on a new page, when printing. */
6
+ newPage?: boolean;
7
+ children: ReactNode;
8
+ };
9
+ /**
10
+ * Section of a report ({@link PrintPage}), with a title. When printing, it may start on a new page (e.g. one topic
11
+ * per page), and the title is not separated from the content.
12
+ */
13
+ declare function PrintSection({ title, newPage, children }: Props): ReactElement;
14
+ export default PrintSection;
@@ -0,0 +1,29 @@
1
+ "use client";
2
+ import { useId } from "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { Box, Title } from "@mantine/core";
5
+ // src/component/molecule/PrintSection/PrintSection.tsx
6
+ /**
7
+ * Section of a report ({@link PrintPage}), with a title. When printing, it may start on a new page (e.g. one topic
8
+ * per page), and the title is not separated from the content.
9
+ */
10
+ function PrintSection({ title, newPage = false, children }) {
11
+ const titleId = useId();
12
+ return /* @__PURE__ */ jsxs(Box, {
13
+ component: "section",
14
+ mb: "xl",
15
+ "aria-labelledby": titleId,
16
+ "data-print-new-page": newPage || void 0,
17
+ children: [/* @__PURE__ */ jsx(Title, {
18
+ id: titleId,
19
+ order: 2,
20
+ size: "h3",
21
+ mb: "sm",
22
+ "data-print-keep-with-next": true,
23
+ children: title
24
+ }), children]
25
+ });
26
+ }
27
+ export { PrintSection as default };
28
+
29
+ //# sourceMappingURL=PrintSection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrintSection.js","names":[],"sources":["../../../../src/component/molecule/PrintSection/PrintSection.tsx"],"sourcesContent":["import { ReactElement, ReactNode, useId } from 'react';\n\nimport { Box, Title } from '@mantine/core';\n\ntype Props = {\n /** Title of the section. When printing, it is not left alone at the end of a page. */\n title: string;\n\n /** Whether the section starts on a new page, when printing. */\n newPage?: boolean;\n\n children: ReactNode;\n};\n\n/**\n * Section of a report ({@link PrintPage}), with a title. When printing, it may start on a new page (e.g. one topic\n * per page), and the title is not separated from the content.\n */\nfunction PrintSection({ title, newPage = false, children }: Props): ReactElement {\n // Links the section to its title, so screen readers announce the section by name.\n const titleId = useId();\n\n return (\n <Box component=\"section\" mb=\"xl\" aria-labelledby={titleId} data-print-new-page={newPage || undefined}>\n <Title id={titleId} order={2} size=\"h3\" mb=\"sm\" data-print-keep-with-next>\n {title}\n </Title>\n {children}\n </Box>\n );\n}\n\nexport default PrintSection;\n"],"mappings":";;;;;;;;;AAkBA,SAAS,aAAa,EAAE,OAAO,UAAU,OAAO,YAAiC;CAE7E,MAAM,UAAU,MAAM;CAEtB,OACI,qBAAC,KAAD;EAAK,WAAU;EAAU,IAAG;EAAK,mBAAiB;EAAS,uBAAqB,WAAW,KAAA;EAA3F,UAAA,CACI,oBAAC,OAAD;GAAO,IAAI;GAAS,OAAO;GAAG,MAAK;GAAK,IAAG;GAAK,6BAAA;GAC3C,UAAA;EACE,CAAA,GACN,QACA;;AAEb"}
@@ -0,0 +1,32 @@
1
+ import { ReactElement } from 'react';
2
+ import { type Primitive, type SelectProps } from '@mantine/core';
3
+ /**
4
+ * Props of the {@link SelectField}.
5
+ * @template T type of each item of the {@link data} array
6
+ * @template V type of the field value (such as the type of the id of the items). Mantine 9 accepts primitive values
7
+ * (number, string, boolean), so the form keeps the value with its real type, without converting it to string.
8
+ */
9
+ interface SelectFieldProps<T, V extends Primitive> extends Omit<SelectProps<V>, 'data'> {
10
+ /** Items offered in the select. */
11
+ data: T[];
12
+ /**
13
+ * Returns the value of an item, which identifies it uniquely (such as the id). Items without an id (`null` or
14
+ * `undefined`, such as a record not saved yet) are not shown.
15
+ */
16
+ getId: (item: T) => V | null | undefined;
17
+ /** Returns the text shown for an item. */
18
+ getDescription: (item: T) => string;
19
+ /** Text shown when no option matches the search; absent for the one of the locale, built from the label. */
20
+ nothingFoundMessage?: string;
21
+ /**
22
+ * Whether the user can type to filter the options. Default: `true`, since most fields have long lists. Use `false`
23
+ * in fields with few options.
24
+ */
25
+ searchable?: boolean;
26
+ }
27
+ /**
28
+ * Select built from an array of any objects, with a placeholder and a "not found" text built from the label (e.g.
29
+ * "Select the Region"), in the language of the locale.
30
+ */
31
+ export declare function SelectField<T, V extends Primitive = string>({ data, getId, getDescription, nothingFoundMessage, searchable, ...rest }: SelectFieldProps<T, V>): ReactElement;
32
+ export {};
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import { useKitMessages } from "../../../provider/useKit.js";
3
+ import { withPlaceholderFromLabel } from "../../../util/TransformData.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ import { Select } from "@mantine/core";
6
+ // src/component/molecule/SelectField/SelectField.tsx
7
+ /**
8
+ * Converts an item of the data of the {@link SelectField} into an option of the select.
9
+ * @param item item to convert
10
+ * @param getId function that returns the value (id) of the item
11
+ * @param getDescription function that returns the text shown for the item
12
+ * @return an array with the option of the item, or an empty array if the item has no id
13
+ */
14
+ function toOption(item, getId, getDescription) {
15
+ const value = getId(item);
16
+ return value === null || value === void 0 ? [] : [{
17
+ value,
18
+ label: getDescription(item)
19
+ }];
20
+ }
21
+ /**
22
+ * Select built from an array of any objects, with a placeholder and a "not found" text built from the label (e.g.
23
+ * "Select the Region"), in the language of the locale.
24
+ */
25
+ function SelectField({ data, getId, getDescription, nothingFoundMessage, searchable = true, ...rest }) {
26
+ const messages = useKitMessages().select;
27
+ const transformedData = data.flatMap((item) => toOption(item, getId, getDescription));
28
+ const modifiedRest = withPlaceholderFromLabel(messages.placeholder, rest);
29
+ return /* @__PURE__ */ jsx(Select, {
30
+ data: transformedData,
31
+ nothingFoundMessage: nothingFoundMessage || messages.nothingFound(String(modifiedRest.label)),
32
+ searchable,
33
+ ...modifiedRest
34
+ });
35
+ }
36
+ export { SelectField };
37
+
38
+ //# sourceMappingURL=SelectField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectField.js","names":[],"sources":["../../../../src/component/molecule/SelectField/SelectField.tsx"],"sourcesContent":["import { ReactElement } from 'react';\n\nimport { type ComboboxItem, type Primitive, Select, type SelectProps } from '@mantine/core';\n\nimport { useKitMessages } from '../../../provider/useKit';\nimport { withPlaceholderFromLabel } from '../../../util/TransformData';\n\n/**\n * Props of the {@link SelectField}.\n * @template T type of each item of the {@link data} array\n * @template V type of the field value (such as the type of the id of the items). Mantine 9 accepts primitive values\n * (number, string, boolean), so the form keeps the value with its real type, without converting it to string.\n */\ninterface SelectFieldProps<T, V extends Primitive> extends Omit<SelectProps<V>, 'data'> {\n /** Items offered in the select. */\n data: T[];\n\n /**\n * Returns the value of an item, which identifies it uniquely (such as the id). Items without an id (`null` or\n * `undefined`, such as a record not saved yet) are not shown.\n */\n getId: (item: T) => V | null | undefined;\n\n /** Returns the text shown for an item. */\n getDescription: (item: T) => string;\n\n /** Text shown when no option matches the search; absent for the one of the locale, built from the label. */\n nothingFoundMessage?: string;\n\n /**\n * Whether the user can type to filter the options. Default: `true`, since most fields have long lists. Use `false`\n * in fields with few options.\n */\n searchable?: boolean;\n}\n\n/**\n * Converts an item of the data of the {@link SelectField} into an option of the select.\n * @param item item to convert\n * @param getId function that returns the value (id) of the item\n * @param getDescription function that returns the text shown for the item\n * @return an array with the option of the item, or an empty array if the item has no id\n */\nfunction toOption<T, V extends Primitive>(\n item: T,\n getId: (item: T) => V | null | undefined,\n getDescription: (item: T) => string\n): ComboboxItem<V>[] {\n const value = getId(item);\n return value === null || value === undefined ? [] : [{ value, label: getDescription(item) }];\n}\n\n/**\n * Select built from an array of any objects, with a placeholder and a \"not found\" text built from the label (e.g.\n * \"Select the Region\"), in the language of the locale.\n */\nexport function SelectField<T, V extends Primitive = string>({\n data,\n getId,\n getDescription,\n nothingFoundMessage,\n searchable = true,\n ...rest\n}: SelectFieldProps<T, V>): ReactElement {\n const messages = useKitMessages().select;\n const transformedData = data.flatMap(item => toOption(item, getId, getDescription));\n const modifiedRest = withPlaceholderFromLabel(messages.placeholder, rest);\n\n return (\n <Select<V>\n data={transformedData}\n nothingFoundMessage={nothingFoundMessage || messages.nothingFound(String(modifiedRest.label))}\n searchable={searchable}\n {...modifiedRest}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA2CA,SAAS,SACL,MACA,OACA,gBACiB;CACjB,MAAM,QAAQ,MAAM,IAAI;CACxB,OAAO,UAAU,QAAQ,UAAU,KAAA,IAAY,CAAC,IAAI,CAAC;EAAE;EAAO,OAAO,eAAe,IAAI;CAAE,CAAC;AAC/F;;;;;AAMA,SAAgB,YAA6C,EACzD,MACA,OACA,gBACA,qBACA,aAAa,MACb,GAAG,QACkC;CACrC,MAAM,WAAW,eAAe,CAAC,CAAC;CAClC,MAAM,kBAAkB,KAAK,SAAQ,SAAQ,SAAS,MAAM,OAAO,cAAc,CAAC;CAClF,MAAM,eAAe,yBAAyB,SAAS,aAAa,IAAI;CAExE,OACI,oBAAC,QAAD;EACI,MAAM;EACN,qBAAqB,uBAAuB,SAAS,aAAa,OAAO,aAAa,KAAK,CAAC;EAChF;EACZ,GAAI;CACP,CAAA;AAET"}
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ // src/component/molecule/StatsCard/Stats.module.css
3
+ var value = "mk-Stats-module-value-EAntx";
4
+ var diff = "mk-Stats-module-diff-r3gSM";
5
+ var icon = "mk-Stats-module-icon-YG6b9";
6
+ var title = "mk-Stats-module-title-MzSDP";
7
+ var Stats_module_default = {
8
+ value,
9
+ diff,
10
+ icon,
11
+ title
12
+ };
13
+ export { Stats_module_default as default, diff, icon, title, value };
14
+
15
+ //# sourceMappingURL=Stats.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Stats.module.js","names":[],"sources":["../../../../src/component/molecule/StatsCard/Stats.module.css"],"sourcesContent":[".value {\n font-size: rem(24px);\n font-weight: 500;\n line-height: 1;\n}\n\n.diff {\n line-height: 1;\n display: flex;\n align-items: center;\n}\n\n.icon {\n @mixin dark {\n color: var(--mantine-color-dark-3);\n }\n\n @mixin light {\n color: var(--mantine-color-gray-4);\n }\n}\n\n.title {\n font-weight: 500;\n text-transform: uppercase;\n}\n"],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import { PaperProps } from '@mantine/core';
2
+ /** Value of a {@link StatsCard}. */
3
+ export type StatsCardData = {
4
+ title: string;
5
+ value: string;
6
+ /** Percentage change from the previous period (e.g. `12` for +12%). */
7
+ diff: number;
8
+ /** Period shown in a badge (e.g. "Monthly"). */
9
+ period?: string;
10
+ /** What the change is compared to (e.g. "Compared to last year"); absent for the text of the locale (last month). */
11
+ comparison?: string;
12
+ };
13
+ type StatsCardProps = {
14
+ data: StatsCardData;
15
+ } & PaperProps;
16
+ /** Card with a key value, its change from the previous period (up or down arrow) and the period. */
17
+ declare const StatsCard: ({ data, ...others }: StatsCardProps) => import("react/jsx-runtime").JSX.Element;
18
+ export default StatsCard;
@@ -0,0 +1,60 @@
1
+ "use client";
2
+ import { useKitMessages } from "../../../provider/useKit.js";
3
+ import Stats_module_default from "./Stats.module.js";
4
+ import Surface from "../../atom/Surface/Surface.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { Badge, Group, Paper, Text } from "@mantine/core";
7
+ import { IconArrowDownRight, IconArrowUpRight } from "@tabler/icons-react";
8
+ // src/component/molecule/StatsCard/StatsCard.tsx
9
+ /** Card with a key value, its change from the previous period (up or down arrow) and the period. */
10
+ var StatsCard = ({ data, ...others }) => {
11
+ const { title, value, period, diff, comparison } = data;
12
+ const DiffIcon = diff > 0 ? IconArrowUpRight : IconArrowDownRight;
13
+ const messages = useKitMessages().stats;
14
+ return /* @__PURE__ */ jsxs(Surface, {
15
+ component: Paper,
16
+ ...others,
17
+ children: [
18
+ /* @__PURE__ */ jsxs(Group, {
19
+ justify: "space-between",
20
+ children: [/* @__PURE__ */ jsx(Text, {
21
+ size: "xs",
22
+ c: "dimmed",
23
+ className: Stats_module_default.title,
24
+ children: title
25
+ }), period && /* @__PURE__ */ jsx(Badge, {
26
+ variant: "filled",
27
+ radius: "sm",
28
+ children: period
29
+ })]
30
+ }),
31
+ /* @__PURE__ */ jsxs(Group, {
32
+ align: "flex-end",
33
+ gap: "xs",
34
+ mt: 25,
35
+ children: [/* @__PURE__ */ jsx(Text, {
36
+ className: Stats_module_default.value,
37
+ children: value
38
+ }), /* @__PURE__ */ jsxs(Text, {
39
+ c: diff > 0 ? "teal" : "red",
40
+ fz: "sm",
41
+ fw: 500,
42
+ className: Stats_module_default.diff,
43
+ children: [/* @__PURE__ */ jsxs("span", { children: [diff, "%"] }), /* @__PURE__ */ jsx(DiffIcon, {
44
+ size: "1rem",
45
+ stroke: 1.5
46
+ })]
47
+ })]
48
+ }),
49
+ /* @__PURE__ */ jsx(Text, {
50
+ fz: "xs",
51
+ c: "dimmed",
52
+ mt: 7,
53
+ children: comparison ?? messages.comparedToLastMonth
54
+ })
55
+ ]
56
+ });
57
+ };
58
+ export { StatsCard as default };
59
+
60
+ //# sourceMappingURL=StatsCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StatsCard.js","names":["classes"],"sources":["../../../../src/component/molecule/StatsCard/StatsCard.tsx"],"sourcesContent":["import { Badge, Group, Paper, PaperProps, Text } from '@mantine/core';\nimport { IconArrowDownRight, IconArrowUpRight } from '@tabler/icons-react';\n\nimport { useKitMessages } from '../../../provider/useKit';\nimport classes from './Stats.module.css';\nimport Surface from '../../atom/Surface/Surface';\n\n/** Value of a {@link StatsCard}. */\nexport type StatsCardData = {\n title: string;\n value: string;\n\n /** Percentage change from the previous period (e.g. `12` for +12%). */\n diff: number;\n\n /** Period shown in a badge (e.g. \"Monthly\"). */\n period?: string;\n\n /** What the change is compared to (e.g. \"Compared to last year\"); absent for the text of the locale (last month). */\n comparison?: string;\n};\n\ntype StatsCardProps = { data: StatsCardData } & PaperProps;\n\n/** Card with a key value, its change from the previous period (up or down arrow) and the period. */\nconst StatsCard = ({ data, ...others }: StatsCardProps) => {\n const { title, value, period, diff, comparison } = data;\n const DiffIcon = diff > 0 ? IconArrowUpRight : IconArrowDownRight;\n const messages = useKitMessages().stats;\n\n return (\n <Surface component={Paper} {...others}>\n <Group justify=\"space-between\">\n <Text size=\"xs\" c=\"dimmed\" className={classes.title}>\n {title}\n </Text>\n {period && (\n <Badge variant=\"filled\" radius=\"sm\">\n {period}\n </Badge>\n )}\n </Group>\n\n <Group align=\"flex-end\" gap=\"xs\" mt={25}>\n <Text className={classes.value}>{value}</Text>\n <Text c={diff > 0 ? 'teal' : 'red'} fz=\"sm\" fw={500} className={classes.diff}>\n <span>{diff}%</span>\n <DiffIcon size=\"1rem\" stroke={1.5} />\n </Text>\n </Group>\n\n <Text fz=\"xs\" c=\"dimmed\" mt={7}>\n {comparison ?? messages.comparedToLastMonth}\n </Text>\n </Surface>\n );\n};\n\nexport default StatsCard;\n"],"mappings":";;;;;;;;;AAyBA,IAAM,aAAa,EAAE,MAAM,GAAG,aAA6B;CACvD,MAAM,EAAE,OAAO,OAAO,QAAQ,MAAM,eAAe;CACnD,MAAM,WAAW,OAAO,IAAI,mBAAmB;CAC/C,MAAM,WAAW,eAAe,CAAC,CAAC;CAElC,OACI,qBAAC,SAAD;EAAS,WAAW;EAAO,GAAI;EAA/B,UAAA;GACI,qBAAC,OAAD;IAAO,SAAQ;IAAf,UAAA,CACI,oBAAC,MAAD;KAAM,MAAK;KAAK,GAAE;KAAS,WAAWA,qBAAQ;KACzC,UAAA;IACC,CAAA,GACL,UACG,oBAAC,OAAD;KAAO,SAAQ;KAAS,QAAO;KAC1B,UAAA;IACE,CAAA,CAER;;GAEP,qBAAC,OAAD;IAAO,OAAM;IAAW,KAAI;IAAK,IAAI;IAArC,UAAA,CACI,oBAAC,MAAD;KAAM,WAAWA,qBAAQ;KAAQ,UAAA;IAAY,CAAA,GAC7C,qBAAC,MAAD;KAAM,GAAG,OAAO,IAAI,SAAS;KAAO,IAAG;KAAK,IAAI;KAAK,WAAWA,qBAAQ;KAAxE,UAAA,CACI,qBAAC,QAAD,EAAA,UAAA,CAAO,MAAK,GAAO,EAAA,CAAA,GACnB,oBAAC,UAAD;MAAU,MAAK;MAAO,QAAQ;KAAM,CAAA,CAClC;IACH,CAAA,CAAA;;GAEP,oBAAC,MAAD;IAAM,IAAG;IAAK,GAAE;IAAS,IAAI;IACxB,UAAA,cAAc,SAAS;GACtB,CAAA;EACD;;AAEjB"}
@@ -0,0 +1,26 @@
1
+ import React, { ReactElement } from 'react';
2
+ import type { UseFormReturnType } from '@mantine/form';
3
+ /** Props of the submit button. */
4
+ interface SubmitProps {
5
+ title: string;
6
+ successMsg?: string;
7
+ errorMsg: string;
8
+ disabled?: boolean;
9
+ /** Question shown in a confirmation dialog before submitting; absent to submit right away. */
10
+ confirmationMessage?: string;
11
+ }
12
+ interface FormProps<D extends object> {
13
+ title: string;
14
+ /** Page opened after the data is saved and by the back button; absent for no back button nor navigation. */
15
+ backRoute?: string;
16
+ /** Sends the form data (e.g. to the API). */
17
+ fetchMethod: (data: D) => Promise<unknown>;
18
+ form: UseFormReturnType<D>;
19
+ submit: SubmitProps;
20
+ }
21
+ /**
22
+ * Form in a card, with the back and submit buttons. On submit, calls `fetchMethod` (optionally after a confirmation),
23
+ * shows a notification and goes back to `backRoute`, if given.
24
+ */
25
+ declare function DataForm<D extends object>(props: React.PropsWithChildren<FormProps<D>>): ReactElement;
26
+ export default DataForm;