@stackcraftmx/calcita 0.47.0 → 0.51.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 (488) hide show
  1. package/README.md +173 -12
  2. package/cli/calcita.js +15 -0
  3. package/cli/checkTexts.js +209 -0
  4. package/cli/packageVersions.js +6 -1
  5. package/cli/projectFiles.js +4 -2
  6. package/cli/templates/project/README.md.tpl +21 -1
  7. package/cli/templates/project/eslint.config.js.tpl +27 -0
  8. package/cli/templates/project/src/app/appTexts.js.tpl +2 -1
  9. package/cli/templates/project/src/core/publicPaths.js.tpl +10 -2
  10. package/cli/templates/project/vite.config.js.tpl +8 -1
  11. package/dist/DataTable/AuditTrailDialog.js +3 -2
  12. package/dist/DataTable/AuditTrailDialog.js.map +1 -1
  13. package/dist/DataTable/ColumnFilters/HeaderFilterPopover.js +3 -2
  14. package/dist/DataTable/ColumnFilters/HeaderFilterPopover.js.map +1 -1
  15. package/dist/DataTable/ColumnFilters/MultiSelectColumnFilter.js +3 -2
  16. package/dist/DataTable/ColumnFilters/MultiSelectColumnFilter.js.map +1 -1
  17. package/dist/DataTable/ColumnFilters/SortableFilterHeader.js +3 -2
  18. package/dist/DataTable/ColumnFilters/SortableFilterHeader.js.map +1 -1
  19. package/dist/DataTable/EmptyState.js +3 -2
  20. package/dist/DataTable/EmptyState.js.map +1 -1
  21. package/dist/DataTable/FilterChips.js +3 -2
  22. package/dist/DataTable/FilterChips.js.map +1 -1
  23. package/dist/DataTable/GoToPage.js +3 -2
  24. package/dist/DataTable/GoToPage.js.map +1 -1
  25. package/dist/DataTable/ServerTable.js +95 -28
  26. package/dist/DataTable/ServerTable.js.map +1 -1
  27. package/dist/DataTable/ServerTableFilterDrawer.js +8 -3
  28. package/dist/DataTable/ServerTableFilterDrawer.js.map +1 -1
  29. package/dist/DataTable/StackedCell.js +60 -0
  30. package/dist/DataTable/StackedCell.js.map +1 -0
  31. package/dist/DataTable/TableCardsView.js +88 -0
  32. package/dist/DataTable/TableCardsView.js.map +1 -0
  33. package/dist/DataTable/columnWidths.js +30 -0
  34. package/dist/DataTable/columnWidths.js.map +1 -0
  35. package/dist/DataTable/columns.js +47 -1
  36. package/dist/DataTable/columns.js.map +1 -1
  37. package/dist/DataTable/fixedColumns.js +24 -0
  38. package/dist/DataTable/fixedColumns.js.map +1 -0
  39. package/dist/DataTable/useTableView.js +29 -0
  40. package/dist/DataTable/useTableView.js.map +1 -0
  41. package/dist/access/PermissionMatrix.js +3 -2
  42. package/dist/access/PermissionMatrix.js.map +1 -1
  43. package/dist/account/AccountProvider.js +1 -1
  44. package/dist/account/AccountSecuritySection.js +3 -2
  45. package/dist/account/AccountSecuritySection.js.map +1 -1
  46. package/dist/account/DemoTotpCodeButton.js +3 -2
  47. package/dist/account/DemoTotpCodeButton.js.map +1 -1
  48. package/dist/account/ProfileScreen.js +3 -2
  49. package/dist/account/ProfileScreen.js.map +1 -1
  50. package/dist/account/SignInScreen.js +3 -2
  51. package/dist/account/SignInScreen.js.map +1 -1
  52. package/dist/appShell/AccountMenu.js +3 -2
  53. package/dist/appShell/AccountMenu.js.map +1 -1
  54. package/dist/appShell/AppLayout.js +3 -2
  55. package/dist/appShell/AppLayout.js.map +1 -1
  56. package/dist/appShell/AppearanceSettings.js +3 -2
  57. package/dist/appShell/AppearanceSettings.js.map +1 -1
  58. package/dist/appShell/AuthLayout.js +3 -2
  59. package/dist/appShell/AuthLayout.js.map +1 -1
  60. package/dist/appShell/BarActionButton.js +11 -4
  61. package/dist/appShell/BarActionButton.js.map +1 -1
  62. package/dist/appShell/BarActions.js +3 -2
  63. package/dist/appShell/BarActions.js.map +1 -1
  64. package/dist/appShell/BarCapsule.js +3 -2
  65. package/dist/appShell/BarCapsule.js.map +1 -1
  66. package/dist/appShell/BarSearch.js +3 -2
  67. package/dist/appShell/BarSearch.js.map +1 -1
  68. package/dist/appShell/HeaderTools.js +3 -2
  69. package/dist/appShell/HeaderTools.js.map +1 -1
  70. package/dist/appShell/MobileTabBar.js +3 -2
  71. package/dist/appShell/MobileTabBar.js.map +1 -1
  72. package/dist/appShell/SettingsMenu.js +3 -2
  73. package/dist/appShell/SettingsMenu.js.map +1 -1
  74. package/dist/appShell/SideMenu.js +3 -2
  75. package/dist/appShell/SideMenu.js.map +1 -1
  76. package/dist/appShell/SideMenuEntry.js +3 -2
  77. package/dist/appShell/SideMenuEntry.js.map +1 -1
  78. package/dist/appShell/SubmenuActionsMenu.js +3 -2
  79. package/dist/appShell/SubmenuActionsMenu.js.map +1 -1
  80. package/dist/appShell/TabBarEditor.js +3 -2
  81. package/dist/appShell/TabBarEditor.js.map +1 -1
  82. package/dist/appShell/TopMenu.js +3 -2
  83. package/dist/appShell/TopMenu.js.map +1 -1
  84. package/dist/appShell/Wordmark.js +3 -2
  85. package/dist/appShell/Wordmark.js.map +1 -1
  86. package/dist/auth/PasswordChecklist.js +3 -2
  87. package/dist/auth/PasswordChecklist.js.map +1 -1
  88. package/dist/calendar/EventCalendar.js +3 -2
  89. package/dist/calendar/EventCalendar.js.map +1 -1
  90. package/dist/calendar/EventDetails.js +3 -2
  91. package/dist/calendar/EventDetails.js.map +1 -1
  92. package/dist/datePickers/DateInput.js +28 -22
  93. package/dist/datePickers/DateInput.js.map +1 -1
  94. package/dist/datePickers/DateTimeInput.js +33 -27
  95. package/dist/datePickers/DateTimeInput.js.map +1 -1
  96. package/dist/datePickers/MonthInput.js +27 -21
  97. package/dist/datePickers/MonthInput.js.map +1 -1
  98. package/dist/datePickers/TimeInput.js +26 -20
  99. package/dist/datePickers/TimeInput.js.map +1 -1
  100. package/dist/datePickers/usePickerField.js +5 -4
  101. package/dist/datePickers/usePickerField.js.map +1 -1
  102. package/dist/downloads/DownloadManager.js +3 -2
  103. package/dist/downloads/DownloadManager.js.map +1 -1
  104. package/dist/feedback/ConfirmDialog.js +3 -2
  105. package/dist/feedback/ConfirmDialog.js.map +1 -1
  106. package/dist/feedback/ModalWaiting.js +3 -2
  107. package/dist/feedback/ModalWaiting.js.map +1 -1
  108. package/dist/feedback/NewBuildNotice.js +3 -2
  109. package/dist/feedback/NewBuildNotice.js.map +1 -1
  110. package/dist/filepond/FileDropzone.js +3 -2
  111. package/dist/filepond/FileDropzone.js.map +1 -1
  112. package/dist/forms/FormProblemAlert.js +3 -2
  113. package/dist/forms/FormProblemAlert.js.map +1 -1
  114. package/dist/forms/SubmitButton.js +7 -2
  115. package/dist/forms/SubmitButton.js.map +1 -1
  116. package/dist/forms/auth/SignInForm.js +3 -2
  117. package/dist/forms/auth/SignInForm.js.map +1 -1
  118. package/dist/forms/fieldRules.js +30 -0
  119. package/dist/forms/fieldRules.js.map +1 -0
  120. package/dist/forms/security/SecondStepForm.js +3 -2
  121. package/dist/forms/security/SecondStepForm.js.map +1 -1
  122. package/dist/forms/security/TwoStepVerificationCard.js +3 -2
  123. package/dist/forms/security/TwoStepVerificationCard.js.map +1 -1
  124. package/dist/forms/useValidationText.js +18 -0
  125. package/dist/forms/useValidationText.js.map +1 -0
  126. package/dist/forms/validation.js +35 -31
  127. package/dist/forms/validation.js.map +1 -1
  128. package/dist/forms/validationMessages.js +64 -7
  129. package/dist/forms/validationMessages.js.map +1 -1
  130. package/dist/forms.js +3 -0
  131. package/dist/forms.js.map +1 -1
  132. package/dist/hookForm/FormProblemAlert.js +3 -2
  133. package/dist/hookForm/FormProblemAlert.js.map +1 -1
  134. package/dist/hookForm/SubmitButton.js +7 -2
  135. package/dist/hookForm/SubmitButton.js.map +1 -1
  136. package/dist/inbox/InboxLayout.js +3 -2
  137. package/dist/inbox/InboxLayout.js.map +1 -1
  138. package/dist/inbox/MessageList.js +3 -2
  139. package/dist/inbox/MessageList.js.map +1 -1
  140. package/dist/inbox/MessageView.js +3 -2
  141. package/dist/inbox/MessageView.js.map +1 -1
  142. package/dist/index.js +186 -163
  143. package/dist/index.js.map +1 -1
  144. package/dist/inputs/CatalogInput.js +32 -25
  145. package/dist/inputs/CatalogInput.js.map +1 -1
  146. package/dist/inputs/CheckboxGroupInput.js +8 -5
  147. package/dist/inputs/CheckboxGroupInput.js.map +1 -1
  148. package/dist/inputs/ColorInput.js +7 -4
  149. package/dist/inputs/ColorInput.js.map +1 -1
  150. package/dist/inputs/FieldFrame.js +10 -4
  151. package/dist/inputs/FieldFrame.js.map +1 -1
  152. package/dist/inputs/FormSection.js +1 -1
  153. package/dist/inputs/MaskedInput.js +1 -0
  154. package/dist/inputs/MaskedInput.js.map +1 -1
  155. package/dist/inputs/NumberInput.js +29 -24
  156. package/dist/inputs/NumberInput.js.map +1 -1
  157. package/dist/inputs/RepeatingFields.js +8 -5
  158. package/dist/inputs/RepeatingFields.js.map +1 -1
  159. package/dist/inputs/SelectInput.js +8 -5
  160. package/dist/inputs/SelectInput.js.map +1 -1
  161. package/dist/inputs/TextInput.js +5 -3
  162. package/dist/inputs/TextInput.js.map +1 -1
  163. package/dist/inputs/TransferListInput.js +8 -5
  164. package/dist/inputs/TransferListInput.js.map +1 -1
  165. package/dist/inputs/WizardLayout.js +3 -2
  166. package/dist/inputs/WizardLayout.js.map +1 -1
  167. package/dist/kanban/KanbanBoard.js +3 -2
  168. package/dist/kanban/KanbanBoard.js.map +1 -1
  169. package/dist/legal/CookieNotice.js +3 -2
  170. package/dist/legal/CookieNotice.js.map +1 -1
  171. package/dist/legal/TermsAcceptanceDialog.js +3 -2
  172. package/dist/legal/TermsAcceptanceDialog.js.map +1 -1
  173. package/dist/locales/en.js +24 -0
  174. package/dist/locales/en.js.map +1 -1
  175. package/dist/locales/es.js +24 -0
  176. package/dist/locales/es.js.map +1 -1
  177. package/dist/maps/MapView.js +3 -2
  178. package/dist/maps/MapView.js.map +1 -1
  179. package/dist/mexico/CfdiSummary.js +3 -2
  180. package/dist/mexico/CfdiSummary.js.map +1 -1
  181. package/dist/mexico/EfirmaFields.js +3 -2
  182. package/dist/mexico/EfirmaFields.js.map +1 -1
  183. package/dist/mexico/mexicoIdentifiers.js +5 -0
  184. package/dist/mexico/mexicoIdentifiers.js.map +1 -1
  185. package/dist/mexico/mexicoRules.js +9 -4
  186. package/dist/mexico/mexicoRules.js.map +1 -1
  187. package/dist/mexico.js +4 -2
  188. package/dist/pwa/InstallAppSetting.js +3 -2
  189. package/dist/pwa/InstallAppSetting.js.map +1 -1
  190. package/dist/pwa/InstallInstructionsDialog.js +3 -2
  191. package/dist/pwa/InstallInstructionsDialog.js.map +1 -1
  192. package/dist/pwa/InstallPromptBanner.js +3 -2
  193. package/dist/pwa/InstallPromptBanner.js.map +1 -1
  194. package/dist/react-hook-form.js +3 -0
  195. package/dist/react-hook-form.js.map +1 -1
  196. package/dist/richText/RichTextEditor.js +7 -4
  197. package/dist/richText/RichTextEditor.js.map +1 -1
  198. package/dist/richText/RichTextView.js +3 -2
  199. package/dist/richText/RichTextView.js.map +1 -1
  200. package/dist/security/ActivityLog.js +3 -2
  201. package/dist/security/ActivityLog.js.map +1 -1
  202. package/dist/security/RecoveryCodesDialog.js +3 -2
  203. package/dist/security/RecoveryCodesDialog.js.map +1 -1
  204. package/dist/security/SessionsCard.js +3 -2
  205. package/dist/security/SessionsCard.js.map +1 -1
  206. package/dist/table.js +21 -2
  207. package/dist/table.js.map +1 -1
  208. package/dist/theme/themePieces.js +70 -4
  209. package/dist/theme/themePieces.js.map +1 -1
  210. package/dist/toolkit/ToolkitProvider.js +8 -1
  211. package/dist/toolkit/ToolkitProvider.js.map +1 -1
  212. package/dist/toolkit/browserNavigation.js +19 -4
  213. package/dist/toolkit/browserNavigation.js.map +1 -1
  214. package/dist/toolkit/combineTexts.js +32 -0
  215. package/dist/toolkit/combineTexts.js.map +1 -0
  216. package/dist/toolkit/hashNavigation.js +17 -3
  217. package/dist/toolkit/hashNavigation.js.map +1 -1
  218. package/dist/toolkit/navigationPaths.js +15 -0
  219. package/dist/toolkit/navigationPaths.js.map +1 -1
  220. package/dist/toolkit/pathIndex.js +66 -0
  221. package/dist/toolkit/pathIndex.js.map +1 -0
  222. package/dist/toolkit/toolkitSettings.js +19 -1
  223. package/dist/toolkit/toolkitSettings.js.map +1 -1
  224. package/dist/types/DataTable/AuditTrailDialog.d.ts +6 -17
  225. package/dist/types/DataTable/ColumnFilters/HeaderFilterPopover.d.ts +6 -5
  226. package/dist/types/DataTable/ColumnFilters/MultiSelectColumnFilter.d.ts +6 -9
  227. package/dist/types/DataTable/ColumnFilters/SortableFilterHeader.d.ts +6 -14
  228. package/dist/types/DataTable/EmptyState.d.ts +6 -9
  229. package/dist/types/DataTable/FilterChips.d.ts +6 -11
  230. package/dist/types/DataTable/GoToPage.d.ts +6 -9
  231. package/dist/types/DataTable/ServerTable.d.ts +16 -80
  232. package/dist/types/DataTable/ServerTableFilterDrawer.d.ts +6 -13
  233. package/dist/types/DataTable/StackedCell.d.ts +12 -0
  234. package/dist/types/DataTable/TableCardsView.d.ts +27 -0
  235. package/dist/types/DataTable/columnWidths.d.ts +21 -0
  236. package/dist/types/DataTable/columns.d.ts +111 -0
  237. package/dist/types/DataTable/fixedColumns.d.ts +29 -0
  238. package/dist/types/DataTable/index.d.ts +6 -1
  239. package/dist/types/DataTable/useTableView.d.ts +22 -0
  240. package/dist/types/access/PermissionMatrix.d.ts +6 -10
  241. package/dist/types/account/AccountSecuritySection.d.ts +6 -7
  242. package/dist/types/account/DemoTotpCodeButton.d.ts +6 -5
  243. package/dist/types/account/ProfileScreen.d.ts +6 -18
  244. package/dist/types/account/SignInScreen.d.ts +6 -13
  245. package/dist/types/appShell/AccountMenu.d.ts +6 -11
  246. package/dist/types/appShell/AppLayout.d.ts +3 -40
  247. package/dist/types/appShell/AppearanceSettings.d.ts +6 -12
  248. package/dist/types/appShell/AuthLayout.d.ts +3 -11
  249. package/dist/types/appShell/BarActionButton.d.ts +6 -10
  250. package/dist/types/appShell/BarActions.d.ts +6 -15
  251. package/dist/types/appShell/BarCapsule.d.ts +6 -9
  252. package/dist/types/appShell/BarSearch.d.ts +6 -15
  253. package/dist/types/appShell/HeaderTools.d.ts +6 -16
  254. package/dist/types/appShell/MobileTabBar.d.ts +6 -13
  255. package/dist/types/appShell/SettingsMenu.d.ts +6 -10
  256. package/dist/types/appShell/SideMenu.d.ts +6 -20
  257. package/dist/types/appShell/SideMenuEntry.d.ts +6 -11
  258. package/dist/types/appShell/SubmenuActionsMenu.d.ts +6 -12
  259. package/dist/types/appShell/TabBarEditor.d.ts +6 -9
  260. package/dist/types/appShell/TopMenu.d.ts +6 -5
  261. package/dist/types/appShell/Wordmark.d.ts +6 -7
  262. package/dist/types/auth/PasswordChecklist.d.ts +6 -9
  263. package/dist/types/calendar/EventCalendar.d.ts +6 -23
  264. package/dist/types/calendar/EventDetails.d.ts +6 -10
  265. package/dist/types/datePickers/DateInput.d.ts +7 -22
  266. package/dist/types/datePickers/DateTimeInput.d.ts +7 -27
  267. package/dist/types/datePickers/MonthInput.d.ts +7 -21
  268. package/dist/types/datePickers/TimeInput.d.ts +7 -21
  269. package/dist/types/datePickers/usePickerField.d.ts +5 -1
  270. package/dist/types/downloads/DownloadManager.d.ts +6 -6
  271. package/dist/types/feedback/ConfirmDialog.d.ts +6 -18
  272. package/dist/types/feedback/ModalWaiting.d.ts +6 -9
  273. package/dist/types/feedback/NewBuildNotice.d.ts +6 -10
  274. package/dist/types/filepond/FileDropzone.d.ts +6 -29
  275. package/dist/types/forms/FormProblemAlert.d.ts +6 -5
  276. package/dist/types/forms/SubmitButton.d.ts +6 -6
  277. package/dist/types/forms/auth/SignInForm.d.ts +6 -11
  278. package/dist/types/forms/fieldRules.d.ts +44 -0
  279. package/dist/types/forms/index.d.ts +1 -0
  280. package/dist/types/forms/security/SecondStepForm.d.ts +6 -14
  281. package/dist/types/forms/security/TwoStepVerificationCard.d.ts +6 -21
  282. package/dist/types/forms/useValidationText.d.ts +12 -0
  283. package/dist/types/forms/validation.d.ts +117 -174
  284. package/dist/types/forms/validationMessages.d.ts +54 -6
  285. package/dist/types/forms.d.ts +1 -1
  286. package/dist/types/hookForm/FormProblemAlert.d.ts +6 -5
  287. package/dist/types/hookForm/SubmitButton.d.ts +6 -13
  288. package/dist/types/inbox/InboxLayout.d.ts +6 -17
  289. package/dist/types/inbox/MessageList.d.ts +6 -18
  290. package/dist/types/inbox/MessageView.d.ts +6 -14
  291. package/dist/types/index.d.ts +8 -1
  292. package/dist/types/inputs/CatalogInput.d.ts +7 -24
  293. package/dist/types/inputs/CheckboxGroupInput.d.ts +7 -18
  294. package/dist/types/inputs/ColorInput.d.ts +7 -16
  295. package/dist/types/inputs/FieldFrame.d.ts +6 -10
  296. package/dist/types/inputs/MaskedInput.d.ts +3 -0
  297. package/dist/types/inputs/NumberInput.d.ts +7 -20
  298. package/dist/types/inputs/RepeatingFields.d.ts +7 -28
  299. package/dist/types/inputs/SelectInput.d.ts +7 -20
  300. package/dist/types/inputs/TextInput.d.ts +3 -0
  301. package/dist/types/inputs/TransferListInput.d.ts +7 -20
  302. package/dist/types/inputs/WizardLayout.d.ts +6 -19
  303. package/dist/types/kanban/KanbanBoard.d.ts +6 -25
  304. package/dist/types/legal/CookieNotice.d.ts +6 -16
  305. package/dist/types/legal/TermsAcceptanceDialog.d.ts +6 -18
  306. package/dist/types/locales/en.d.ts +24 -0
  307. package/dist/types/locales/es.d.ts +24 -0
  308. package/dist/types/maps/MapView.d.ts +6 -17
  309. package/dist/types/mexico/CfdiSummary.d.ts +6 -11
  310. package/dist/types/mexico/EfirmaFields.d.ts +6 -16
  311. package/dist/types/mexico/mexicoIdentifiers.d.ts +7 -0
  312. package/dist/types/mexico/mexicoRules.d.ts +19 -3
  313. package/dist/types/mexico.d.ts +2 -2
  314. package/dist/types/pwa/InstallAppSetting.d.ts +6 -6
  315. package/dist/types/pwa/InstallInstructionsDialog.d.ts +6 -9
  316. package/dist/types/pwa/InstallPromptBanner.d.ts +6 -11
  317. package/dist/types/react-hook-form.d.ts +1 -0
  318. package/dist/types/richText/RichTextEditor.d.ts +7 -22
  319. package/dist/types/richText/RichTextView.d.ts +6 -9
  320. package/dist/types/security/ActivityLog.d.ts +6 -9
  321. package/dist/types/security/RecoveryCodesDialog.d.ts +6 -11
  322. package/dist/types/security/SessionsCard.d.ts +6 -11
  323. package/dist/types/table.d.ts +3 -1
  324. package/dist/types/theme/themePieces.d.ts +55 -3
  325. package/dist/types/toolkit/ToolkitProvider.d.ts +13 -1
  326. package/dist/types/toolkit/browserNavigation.d.ts +7 -3
  327. package/dist/types/toolkit/combineTexts.d.ts +6 -0
  328. package/dist/types/toolkit/hashNavigation.d.ts +4 -2
  329. package/dist/types/toolkit/navigationPaths.d.ts +35 -0
  330. package/dist/types/toolkit/pathIndex.d.ts +27 -0
  331. package/dist/types/toolkit/toolkitSettings.d.ts +7 -4
  332. package/dist/types/ui/actions/ActionsMenu.d.ts +9 -11
  333. package/dist/types/ui/actions/CopyButton.d.ts +6 -12
  334. package/dist/types/ui/actions/DownloadMenu.d.ts +6 -29
  335. package/dist/types/ui/actions/SecretField.d.ts +6 -11
  336. package/dist/types/ui/actions/SelectionActions.d.ts +6 -13
  337. package/dist/types/ui/cards/RecordCard.d.ts +6 -31
  338. package/dist/types/ui/cards/RecordCardSkeleton.d.ts +6 -11
  339. package/dist/types/ui/countdown/Countdown.d.ts +6 -15
  340. package/dist/types/ui/documents/PdfViewerDialog.d.ts +6 -13
  341. package/dist/types/ui/filters/DateRangeFilter.d.ts +6 -10
  342. package/dist/types/ui/filters/FilterDrawer.d.ts +6 -17
  343. package/dist/types/ui/filters/PeriodRangeSelector.d.ts +6 -13
  344. package/dist/types/ui/filters/QuickFilters.d.ts +6 -12
  345. package/dist/types/ui/help/HelpButton.d.ts +6 -10
  346. package/dist/types/ui/help/HelpCarouselDialog.d.ts +6 -14
  347. package/dist/types/ui/labels/MarkedText.d.ts +10 -0
  348. package/dist/types/ui/labels/Tag.d.ts +6 -12
  349. package/dist/types/ui/labels/markedTextPieces.d.ts +22 -0
  350. package/dist/types/ui/layout/CollapsibleSection.d.ts +6 -12
  351. package/dist/types/ui/layout/ContentDialog.d.ts +6 -10
  352. package/dist/types/ui/layout/DefinitionList.d.ts +6 -9
  353. package/dist/types/ui/layout/DetailHeader.d.ts +6 -10
  354. package/dist/types/ui/layout/ErrorPage.d.ts +6 -17
  355. package/dist/types/ui/layout/FullPageLoader.d.ts +6 -6
  356. package/dist/types/ui/layout/GlassPanel.d.ts +6 -8
  357. package/dist/types/ui/layout/PageHeader.d.ts +6 -10
  358. package/dist/types/ui/layout/PageHeading.d.ts +6 -11
  359. package/dist/types/ui/layout/ProfileHeader.d.ts +6 -11
  360. package/dist/types/ui/layout/ScrollableRow.d.ts +6 -13
  361. package/dist/types/ui/layout/SectionCard.d.ts +6 -8
  362. package/dist/types/ui/metrics/BarList.d.ts +6 -12
  363. package/dist/types/ui/metrics/CalendarHeatmap.d.ts +6 -19
  364. package/dist/types/ui/metrics/ChartTooltip.d.ts +6 -6
  365. package/dist/types/ui/metrics/ColumnChart.d.ts +6 -25
  366. package/dist/types/ui/metrics/LineChart.d.ts +6 -20
  367. package/dist/types/ui/metrics/MetricCard.d.ts +6 -17
  368. package/dist/types/ui/metrics/TableToggle.d.ts +6 -6
  369. package/dist/types/ui/metrics/chartParts.d.ts +15 -30
  370. package/dist/types/ui/navigation/BackButton.d.ts +6 -9
  371. package/dist/types/ui/navigation/ColorSchemeToggle.d.ts +6 -9
  372. package/dist/types/ui/navigation/FontSizeToggle.d.ts +6 -8
  373. package/dist/types/ui/navigation/LanguageToggle.d.ts +6 -8
  374. package/dist/types/ui/navigation/PageBreadcrumbs.d.ts +6 -7
  375. package/dist/types/ui/navigation/RouteTabs.d.ts +7 -12
  376. package/dist/types/ui/timeline/GroupedTimeline.d.ts +6 -23
  377. package/dist/types/upload/AttachmentsInput.d.ts +11 -1
  378. package/dist/types/upload/FileDropzone.d.ts +6 -21
  379. package/dist/types/upload/FileInput.d.ts +7 -24
  380. package/dist/types/upload/FileUploadInput.d.ts +7 -31
  381. package/dist/types/upload/ImageInput.d.ts +7 -25
  382. package/dist/types/upload/TemplateDownloadButton.d.ts +6 -18
  383. package/dist/ui/actions/ActionsMenu.js +14 -5
  384. package/dist/ui/actions/ActionsMenu.js.map +1 -1
  385. package/dist/ui/actions/CopyButton.js +8 -3
  386. package/dist/ui/actions/CopyButton.js.map +1 -1
  387. package/dist/ui/actions/DownloadMenu.js +3 -2
  388. package/dist/ui/actions/DownloadMenu.js.map +1 -1
  389. package/dist/ui/actions/SecretField.js +8 -3
  390. package/dist/ui/actions/SecretField.js.map +1 -1
  391. package/dist/ui/actions/SelectionActions.js +3 -2
  392. package/dist/ui/actions/SelectionActions.js.map +1 -1
  393. package/dist/ui/cards/RecordCard.js +4 -3
  394. package/dist/ui/cards/RecordCard.js.map +1 -1
  395. package/dist/ui/cards/RecordCardSkeleton.js +8 -3
  396. package/dist/ui/cards/RecordCardSkeleton.js.map +1 -1
  397. package/dist/ui/countdown/Countdown.js +3 -2
  398. package/dist/ui/countdown/Countdown.js.map +1 -1
  399. package/dist/ui/documents/PdfViewerDialog.js +3 -2
  400. package/dist/ui/documents/PdfViewerDialog.js.map +1 -1
  401. package/dist/ui/filters/DateRangeFilter.js +3 -2
  402. package/dist/ui/filters/DateRangeFilter.js.map +1 -1
  403. package/dist/ui/filters/FilterDrawer.js +3 -2
  404. package/dist/ui/filters/FilterDrawer.js.map +1 -1
  405. package/dist/ui/filters/PeriodRangeSelector.js +3 -2
  406. package/dist/ui/filters/PeriodRangeSelector.js.map +1 -1
  407. package/dist/ui/filters/QuickFilters.js +3 -2
  408. package/dist/ui/filters/QuickFilters.js.map +1 -1
  409. package/dist/ui/help/HelpButton.js +8 -3
  410. package/dist/ui/help/HelpButton.js.map +1 -1
  411. package/dist/ui/help/HelpCarouselDialog.js +3 -2
  412. package/dist/ui/help/HelpCarouselDialog.js.map +1 -1
  413. package/dist/ui/labels/MarkedText.js +31 -0
  414. package/dist/ui/labels/MarkedText.js.map +1 -0
  415. package/dist/ui/labels/Tag.js +3 -2
  416. package/dist/ui/labels/Tag.js.map +1 -1
  417. package/dist/ui/labels/markedTextPieces.js +64 -0
  418. package/dist/ui/labels/markedTextPieces.js.map +1 -0
  419. package/dist/ui/layout/CollapsibleSection.js +3 -2
  420. package/dist/ui/layout/CollapsibleSection.js.map +1 -1
  421. package/dist/ui/layout/ContentDialog.js +3 -2
  422. package/dist/ui/layout/ContentDialog.js.map +1 -1
  423. package/dist/ui/layout/DefinitionList.js +3 -2
  424. package/dist/ui/layout/DefinitionList.js.map +1 -1
  425. package/dist/ui/layout/DetailHeader.js +3 -2
  426. package/dist/ui/layout/DetailHeader.js.map +1 -1
  427. package/dist/ui/layout/ErrorPage.js +3 -2
  428. package/dist/ui/layout/ErrorPage.js.map +1 -1
  429. package/dist/ui/layout/FullPageLoader.js +3 -2
  430. package/dist/ui/layout/FullPageLoader.js.map +1 -1
  431. package/dist/ui/layout/GlassPanel.js +3 -2
  432. package/dist/ui/layout/GlassPanel.js.map +1 -1
  433. package/dist/ui/layout/PageHeader.js +3 -2
  434. package/dist/ui/layout/PageHeader.js.map +1 -1
  435. package/dist/ui/layout/PageHeading.js +3 -2
  436. package/dist/ui/layout/PageHeading.js.map +1 -1
  437. package/dist/ui/layout/ProfileHeader.js +3 -2
  438. package/dist/ui/layout/ProfileHeader.js.map +1 -1
  439. package/dist/ui/layout/ScrollableRow.js +3 -2
  440. package/dist/ui/layout/ScrollableRow.js.map +1 -1
  441. package/dist/ui/layout/SectionCard.js +3 -2
  442. package/dist/ui/layout/SectionCard.js.map +1 -1
  443. package/dist/ui/metrics/BarList.js +3 -2
  444. package/dist/ui/metrics/BarList.js.map +1 -1
  445. package/dist/ui/metrics/CalendarHeatmap.js +3 -2
  446. package/dist/ui/metrics/CalendarHeatmap.js.map +1 -1
  447. package/dist/ui/metrics/ChartTooltip.js +3 -2
  448. package/dist/ui/metrics/ChartTooltip.js.map +1 -1
  449. package/dist/ui/metrics/ColumnChart.js +3 -2
  450. package/dist/ui/metrics/ColumnChart.js.map +1 -1
  451. package/dist/ui/metrics/LineChart.js +3 -2
  452. package/dist/ui/metrics/LineChart.js.map +1 -1
  453. package/dist/ui/metrics/MetricCard.js +3 -2
  454. package/dist/ui/metrics/MetricCard.js.map +1 -1
  455. package/dist/ui/metrics/TableToggle.js +3 -2
  456. package/dist/ui/metrics/TableToggle.js.map +1 -1
  457. package/dist/ui/metrics/chartParts.js +7 -4
  458. package/dist/ui/metrics/chartParts.js.map +1 -1
  459. package/dist/ui/navigation/BackButton.js +7 -2
  460. package/dist/ui/navigation/BackButton.js.map +1 -1
  461. package/dist/ui/navigation/ColorSchemeToggle.js +3 -2
  462. package/dist/ui/navigation/ColorSchemeToggle.js.map +1 -1
  463. package/dist/ui/navigation/FontSizeToggle.js +3 -2
  464. package/dist/ui/navigation/FontSizeToggle.js.map +1 -1
  465. package/dist/ui/navigation/LanguageToggle.js +3 -2
  466. package/dist/ui/navigation/LanguageToggle.js.map +1 -1
  467. package/dist/ui/navigation/PageBreadcrumbs.js +3 -2
  468. package/dist/ui/navigation/PageBreadcrumbs.js.map +1 -1
  469. package/dist/ui/navigation/RouteTabs.js +8 -4
  470. package/dist/ui/navigation/RouteTabs.js.map +1 -1
  471. package/dist/ui/timeline/GroupedTimeline.js +3 -2
  472. package/dist/ui/timeline/GroupedTimeline.js.map +1 -1
  473. package/dist/upload/AttachmentsInput.js +9 -6
  474. package/dist/upload/AttachmentsInput.js.map +1 -1
  475. package/dist/upload/FileChip.js +2 -1
  476. package/dist/upload/FileChip.js.map +1 -1
  477. package/dist/upload/FileDropzone.js +5 -4
  478. package/dist/upload/FileDropzone.js.map +1 -1
  479. package/dist/upload/FileInput.js +9 -6
  480. package/dist/upload/FileInput.js.map +1 -1
  481. package/dist/upload/FileUploadInput.js +9 -6
  482. package/dist/upload/FileUploadInput.js.map +1 -1
  483. package/dist/upload/ImageInput.js +8 -5
  484. package/dist/upload/ImageInput.js.map +1 -1
  485. package/dist/upload/TemplateDownloadButton.js +3 -2
  486. package/dist/upload/TemplateDownloadButton.js.map +1 -1
  487. package/package.json +1 -1
  488. package/cli/templates/project/src/app/combineTexts.js.tpl +0 -31
@@ -1 +1 @@
1
- {"version":3,"file":"ScrollableRow.js","sources":["../../../src/ui/layout/ScrollableRow.jsx"],"sourcesContent":["// Tira horizontal que se desliza, no que se envuelve (chips de filtros y accesos rápidos).\n//\n// Con muchos filtros puestos los chips se envolvían en varios renglones y empujaban la tabla fuera de la pantalla,\n// justo cuando más falta hace ver el resultado. Encapsula lo que hace falta para que la tira se sienta nativa:\n// - overflow-x sin barra visible en los tres motores;\n// - arrastre con el mouse en escritorio (el deslizamiento táctil ya es gratis);\n// - la rueda vertical se convierte en desplazamiento horizontal;\n// - el borde por el que sigue habiendo contenido se DESVANECE: sin barra ni desvanecido, una tira cortada a la mitad\n// se lee como un chip mal pintado.\n// Todo eso se activa SOLO cuando de verdad hay desbordamiento.\n//\n// OJO: el umbral de 5 px separa el arrastre del clic; mover más cancela el clic que venía detrás, para no borrar un\n// filtro cuando lo que se quería era desplazar la tira.\n//\n// Se cambia desde el tema del proyecto, como las piezas de MUI: components.CalcitaScrollableRow con defaultProps y\n// styleOverrides.root (el sx de la pantalla sigue ganando a todo).\n//\n// Genérico del paquete: function (regla de la casa).\nimport {Children, useEffect, useRef, useState} from 'react';\nimport Box from '@mui/material/Box';\nimport {piecePart, usePieceProps} from '@/theme/themePieces.js';\n\n// el nombre de la pieza en el tema y su parte (theme.components.CalcitaScrollableRow)\nconst THEME_NAME = 'CalcitaScrollableRow';\nconst RowRoot = piecePart(THEME_NAME, 'Root', Box);\n\n/** El mixin sin arrastre, para cuando no se puede envolver el elemento. */\nexport const scrollableRow = {\n display: 'flex',\n flexWrap: 'nowrap',\n overflowX: 'auto',\n overflowY: 'hidden',\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n '&::-webkit-scrollbar': {display: 'none'},\n};\n\nconst DRAG_THRESHOLD_PIXELS = 5;\n\n/**\n * @param {object} props\n * @param {import('react').ReactNode} props.children\n * @param {number} [props.gap]\n * @param {number} [props.py]\n * @param {object} [props.sx]\n * @param {boolean} [props.enableDragScroll]\n * @param {boolean} [props.enableWheelToX]\n * @param {boolean} [props.fadeEdges]\n * @param {import('react').Ref<HTMLElement>} [props.ref]\n */\nexport default function ScrollableRow(props) {\n // lo que el proyecto puso en su tema (components.CalcitaScrollableRow.defaultProps) y encima lo que llega aquí\n const {\n children, gap = 1, py = 0.5, sx, enableDragScroll = true, enableWheelToX = true, fadeEdges = true, ref, ...boxProps\n } = usePieceProps(props, THEME_NAME);\n const rowElement = useRef(null);\n // por dónde sigue habiendo contenido: decide de qué lado va el desvanecido\n const [edges, setEdges] = useState({overflow: false, start: false, end: false});\n\n const assignRef = (node) => {\n rowElement.current = node;\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref && typeof ref === 'object') {\n ref.current = node;\n }\n };\n\n // el número de hijos es la señal estable para revisar de nuevo (el padre agrega y quita chips)\n const childrenCount = Children.count(children);\n useEffect(() => {\n const element = rowElement.current;\n if (!element) {\n return undefined;\n }\n // el +1 evita el falso positivo por subpíxel\n const measureEdges = () => setEdges({\n overflow: element.scrollWidth > element.clientWidth + 1,\n start: element.scrollLeft > 1,\n end: element.scrollLeft + element.clientWidth < element.scrollWidth - 1,\n });\n measureEdges();\n\n const resizeObserver = new ResizeObserver(measureEdges);\n resizeObserver.observe(element);\n element.addEventListener('scroll', measureEdges, {passive: true});\n return () => {\n resizeObserver.disconnect();\n element.removeEventListener('scroll', measureEdges);\n };\n }, [childrenCount]);\n\n useEffect(() => {\n const element = rowElement.current;\n if (!element) {\n return undefined;\n }\n\n let isDragging = false;\n let hasMoved = false;\n let startX = 0;\n let scrollStart = 0;\n\n const isOverflowing = () => element.scrollWidth > element.clientWidth + 1;\n\n const handleMouseDown = (event) => {\n if (event.button !== 0 || !isOverflowing()) {\n return;\n }\n // arrastrar dentro de un campo de texto es seleccionar texto, no desplazar la tira\n if (['INPUT', 'TEXTAREA'].includes(event.target?.tagName)) {\n return;\n }\n isDragging = true;\n hasMoved = false;\n startX = event.pageX;\n scrollStart = element.scrollLeft;\n };\n\n const handleMouseMove = (event) => {\n if (!isDragging) {\n return;\n }\n const distance = event.pageX - startX;\n if (!hasMoved && Math.abs(distance) > DRAG_THRESHOLD_PIXELS) {\n hasMoved = true;\n element.style.cursor = 'grabbing';\n }\n if (hasMoved) {\n event.preventDefault();\n element.scrollLeft = scrollStart - distance;\n }\n };\n\n const stopDragging = () => {\n isDragging = false;\n element.style.cursor = '';\n };\n\n const handleClickCapture = (event) => {\n if (!hasMoved) {\n return;\n }\n // se arrastró: el clic que viene detrás NO es un clic\n event.preventDefault();\n event.stopPropagation();\n hasMoved = false;\n };\n\n const handleWheel = (event) => {\n if (isOverflowing() && Math.abs(event.deltaY) > Math.abs(event.deltaX)) {\n event.preventDefault();\n element.scrollLeft += event.deltaY;\n }\n };\n\n if (enableDragScroll) {\n element.addEventListener('mousedown', handleMouseDown);\n element.addEventListener('mousemove', handleMouseMove);\n element.addEventListener('mouseup', stopDragging);\n element.addEventListener('mouseleave', stopDragging);\n element.addEventListener('click', handleClickCapture, true);\n }\n if (enableWheelToX) {\n element.addEventListener('wheel', handleWheel, {passive: false});\n }\n\n return () => {\n element.removeEventListener('mousedown', handleMouseDown);\n element.removeEventListener('mousemove', handleMouseMove);\n element.removeEventListener('mouseup', stopDragging);\n element.removeEventListener('mouseleave', stopDragging);\n element.removeEventListener('click', handleClickCapture, true);\n element.removeEventListener('wheel', handleWheel);\n };\n }, [enableDragScroll, enableWheelToX]);\n\n const isDragEnabled = enableDragScroll && edges.overflow;\n\n // máscara y no degradado encima: funciona sin saber de qué color es el fondo\n const fadeMask = fadeEdges && edges.overflow\n ? `linear-gradient(to right, ${[\n edges.start ? 'transparent 0, black 24px' : 'black 0',\n edges.end ? 'black calc(100% - 24px), transparent 100%' : 'black 100%',\n ].join(', ')})`\n : undefined;\n\n return (\n <RowRoot ref={assignRef}\n ownSx={{\n ...scrollableRow,\n gap,\n py,\n cursor: isDragEnabled ? 'grab' : 'auto',\n userSelect: isDragEnabled ? 'none' : 'auto',\n ...(fadeMask && {maskImage: fadeMask, WebkitMaskImage: fad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rollableRow.js","sources":["../../../src/ui/layout/ScrollableRow.jsx"],"sourcesContent":["// Tira horizontal que se desliza, no que se envuelve (chips de filtros y accesos rápidos).\n//\n// Con muchos filtros puestos los chips se envolvían en varios renglones y empujaban la tabla fuera de la pantalla,\n// justo cuando más falta hace ver el resultado. Encapsula lo que hace falta para que la tira se sienta nativa:\n// - overflow-x sin barra visible en los tres motores;\n// - arrastre con el mouse en escritorio (el deslizamiento táctil ya es gratis);\n// - la rueda vertical se convierte en desplazamiento horizontal;\n// - el borde por el que sigue habiendo contenido se DESVANECE: sin barra ni desvanecido, una tira cortada a la mitad\n// se lee como un chip mal pintado.\n// Todo eso se activa SOLO cuando de verdad hay desbordamiento.\n//\n// OJO: el umbral de 5 px separa el arrastre del clic; mover más cancela el clic que venía detrás, para no borrar un\n// filtro cuando lo que se quería era desplazar la tira.\n//\n// Se cambia desde el tema del proyecto, como las piezas de MUI: components.CalcitaScrollableRow con defaultProps y\n// styleOverrides.root (el sx de la pantalla sigue ganando a todo).\n//\n// Genérico del paquete: function (regla de la casa).\nimport {Children, useEffect, useRef, useState} from 'react';\nimport Box from '@mui/material/Box';\nimport {piecePart, usePieceProps, withPieceSlots} from '@/theme/themePieces.js';\n\n// el nombre de la pieza en el tema y su parte (theme.components.CalcitaScrollableRow)\nconst THEME_NAME = 'CalcitaScrollableRow';\nconst RowRoot = piecePart(THEME_NAME, 'Root', Box);\n\n/** El mixin sin arrastre, para cuando no se puede envolver el elemento. */\nexport const scrollableRow = {\n display: 'flex',\n flexWrap: 'nowrap',\n overflowX: 'auto',\n overflowY: 'hidden',\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n '&::-webkit-scrollbar': {display: 'none'},\n};\n\nconst DRAG_THRESHOLD_PIXELS = 5;\n\n/**\n * @param {object} props\n * @param {import('react').ReactNode} props.children\n * @param {number} [props.gap]\n * @param {number} [props.py]\n * @param {object} [props.sx]\n * @param {boolean} [props.enableDragScroll]\n * @param {boolean} [props.enableWheelToX]\n * @param {boolean} [props.fadeEdges]\n * @param {import('react').Ref<HTMLElement>} [props.ref]\n */\nfunction ScrollableRowContent(props) {\n // lo que el proyecto puso en su tema (components.CalcitaScrollableRow.defaultProps) y encima lo que llega aquí\n const {\n children, gap = 1, py = 0.5, sx, enableDragScroll = true, enableWheelToX = true, fadeEdges = true, ref, ...boxProps\n } = usePieceProps(props, THEME_NAME);\n const rowElement = useRef(null);\n // por dónde sigue habiendo contenido: decide de qué lado va el desvanecido\n const [edges, setEdges] = useState({overflow: false, start: false, end: false});\n\n const assignRef = (node) => {\n rowElement.current = node;\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref && typeof ref === 'object') {\n ref.current = node;\n }\n };\n\n // el número de hijos es la señal estable para revisar de nuevo (el padre agrega y quita chips)\n const childrenCount = Children.count(children);\n useEffect(() => {\n const element = rowElement.current;\n if (!element) {\n return undefined;\n }\n // el +1 evita el falso positivo por subpíxel\n const measureEdges = () => setEdges({\n overflow: element.scrollWidth > element.clientWidth + 1,\n start: element.scrollLeft > 1,\n end: element.scrollLeft + element.clientWidth < element.scrollWidth - 1,\n });\n measureEdges();\n\n const resizeObserver = new ResizeObserver(measureEdges);\n resizeObserver.observe(element);\n element.addEventListener('scroll', measureEdges, {passive: true});\n return () => {\n resizeObserver.disconnect();\n element.removeEventListener('scroll', measureEdges);\n };\n }, [childrenCount]);\n\n useEffect(() => {\n const element = rowElement.current;\n if (!element) {\n return undefined;\n }\n\n let isDragging = false;\n let hasMoved = false;\n let startX = 0;\n let scrollStart = 0;\n\n const isOverflowing = () => element.scrollWidth > element.clientWidth + 1;\n\n const handleMouseDown = (event) => {\n if (event.button !== 0 || !isOverflowing()) {\n return;\n }\n // arrastrar dentro de un campo de texto es seleccionar texto, no desplazar la tira\n if (['INPUT', 'TEXTAREA'].includes(event.target?.tagName)) {\n return;\n }\n isDragging = true;\n hasMoved = false;\n startX = event.pageX;\n scrollStart = element.scrollLeft;\n };\n\n const handleMouseMove = (event) => {\n if (!isDragging) {\n return;\n }\n const distance = event.pageX - startX;\n if (!hasMoved && Math.abs(distance) > DRAG_THRESHOLD_PIXELS) {\n hasMoved = true;\n element.style.cursor = 'grabbing';\n }\n if (hasMoved) {\n event.preventDefault();\n element.scrollLeft = scrollStart - distance;\n }\n };\n\n const stopDragging = () => {\n isDragging = false;\n element.style.cursor = '';\n };\n\n const handleClickCapture = (event) => {\n if (!hasMoved) {\n return;\n }\n // se arrastró: el clic que viene detrás NO es un clic\n event.preventDefault();\n event.stopPropagation();\n hasMoved = false;\n };\n\n const handleWheel = (event) => {\n if (isOverflowing() && Math.abs(event.deltaY) > Math.abs(event.deltaX)) {\n event.preventDefault();\n element.scrollLeft += event.deltaY;\n }\n };\n\n if (enableDragScroll) {\n element.addEventListener('mousedown', handleMouseDown);\n element.addEventListener('mousemove', handleMouseMove);\n element.addEventListener('mouseup', stopDragging);\n element.addEventListener('mouseleave', stopDragging);\n element.addEventListener('click', handleClickCapture, true);\n }\n if (enableWheelToX) {\n element.addEventListener('wheel', handleWheel, {passive: false});\n }\n\n return () => {\n element.removeEventListener('mousedown', handleMouseDown);\n element.removeEventListener('mousemove', handleMouseMove);\n element.removeEventListener('mouseup', stopDragging);\n element.removeEventListener('mouseleave', stopDragging);\n element.removeEventListener('click', handleClickCapture, true);\n element.removeEventListener('wheel', handleWheel);\n };\n }, [enableDragScroll, enableWheelToX]);\n\n const isDragEnabled = enableDragScroll && edges.overflow;\n\n // máscara y no degradado encima: funciona sin saber de qué color es el fondo\n const fadeMask = fadeEdges && edges.overflow\n ? `linear-gradient(to right, ${[\n edges.start ? 'transparent 0, black 24px' : 'black 0',\n edges.end ? 'black calc(100% - 24px), transparent 100%' : 'black 100%',\n ].join(', ')})`\n : undefined;\n\n return (\n <RowRoot ref={assignRef}\n ownSx={{\n ...scrollableRow,\n gap,\n py,\n cursor: isDragEnabled ? 'grab' : 'auto',\n userSelect: isDragEnabled ? 'none' : 'auto',\n ...(fadeMask && {maskImage: fadeMask, WebkitMaskImage: fadeMask}),\n }}\n sx={sx}\n {...boxProps}>\n {children}\n </RowRoot>\n );\n}\n\n// lo que se exporta: la pieza con slots y slotProps para cambiar sus partes (themePieces.js)\nconst ScrollableRow = withPieceSlots(ScrollableRowContent, THEME_NAME);\nexport default ScrollableRow;\n"],"names":[],"mappings":";;;;;AAuBA,MAAM,aAAa;AACnB,MAAM,UAAU,UAAU,YAAY,QAAQ,GAAG;AAG1C,MAAM,gBAAgB;AAAA,EACzB,SAAS;AAAA,EACT,UAAU;AAAA,EACV,WAAW;AAAA,EACX,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,wBAAwB,EAAC,SAAS,OAAA;AACtC;AAEA,MAAM,wBAAwB;AAa9B,SAAS,qBAAqB,OAAO;AAEjC,QAAM;AAAA,IACF;AAAA,IAAU,MAAM;AAAA,IAAG,KAAK;AAAA,IAAK;AAAA,IAAI,mBAAmB;AAAA,IAAM,iBAAiB;AAAA,IAAM,YAAY;AAAA,IAAM;AAAA,IAAK,GAAG;AAAA,EAAA,IAC3G,cAAc,OAAO,UAAU;AACnC,QAAM,aAAa,OAAO,IAAI;AAE9B,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,EAAC,UAAU,OAAO,OAAO,OAAO,KAAK,MAAA,CAAM;AAE9E,QAAM,YAAY,CAAC,SAAS;AACxB,eAAW,UAAU;AACrB,QAAI,OAAO,QAAQ,YAAY;AAC3B,UAAI,IAAI;AAAA,IACZ,WAAW,OAAO,OAAO,QAAQ,UAAU;AACvC,UAAI,UAAU;AAAA,IAClB;AAAA,EACJ;AAGA,QAAM,gBAAgB,SAAS,MAAM,QAAQ;AAC7C,YAAU,MAAM;AACZ,UAAM,UAAU,WAAW;AAC3B,QAAI,CAAC,SAAS;AACV,aAAO;AAAA,IACX;AAEA,UAAM,eAAe,MAAM,SAAS;AAAA,MAChC,UAAU,QAAQ,cAAc,QAAQ,cAAc;AAAA,MACtD,OAAO,QAAQ,aAAa;AAAA,MAC5B,KAAK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AAAA,MAAQ;AAAA,MAEnE;AAAA,MACC,GAAG;AAAA,MACJ;AAAA,IAAA;AAAA,EAAA;AAGb;AAGA,MAAM,gBAAgB,eAAe,sBAAsB,UAAU;"}
@@ -3,13 +3,13 @@ import { jsxs, jsx } from "react/jsx-runtime";
3
3
  import Box from "@mui/material/Box";
4
4
  import Paper from "@mui/material/Paper";
5
5
  import Typography from "@mui/material/Typography";
6
- import { piecePart, usePieceProps } from "../../theme/themePieces.js";
6
+ import { piecePart, withPieceSlots, usePieceProps } from "../../theme/themePieces.js";
7
7
  import { warnUnknownProps } from "../../toolkit/unknownProps.js";
8
8
  const THEME_NAME = "CalcitaSectionCard";
9
9
  const SectionRoot = piecePart(THEME_NAME, "Root", Paper);
10
10
  const SectionHeader = piecePart(THEME_NAME, "Header", Box);
11
11
  const SectionTitle = piecePart(THEME_NAME, "Title", Typography);
12
- function SectionCard(props) {
12
+ function SectionCardContent(props) {
13
13
  const { title, action, children, ...unknownProps } = usePieceProps(props, THEME_NAME);
14
14
  warnUnknownProps(THEME_NAME, unknownProps);
15
15
  return /* @__PURE__ */ jsxs(SectionRoot, { component: "section", variant: "outlined", ownSx: { p: { xs: 2, md: 2.5 }, minWidth: 0 }, children: [
@@ -20,6 +20,7 @@ function SectionCard(props) {
20
20
  children
21
21
  ] });
22
22
  }
23
+ const SectionCard = withPieceSlots(SectionCardContent, THEME_NAME);
23
24
  export {
24
25
  SectionCard as default
25
26
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SectionCard.js","sources":["../../../src/ui/layout/SectionCard.jsx"],"sourcesContent":["// Tarjeta de una sección de una página de detalle: título en versalitas, una acción opcional a la derecha y el contenido.\n//\n// Por qué una tarjeta por sección y no una sola hoja larga con divisiones: en pantalla ancha las secciones se acomodan en\n// columnas (lo principal a la izquierda, los datos de apoyo a la derecha) y cada una se encuentra por su título.\n//\n// Se cambia desde el tema del proyecto, como las piezas de MUI: components.CalcitaSectionCard con defaultProps y\n// styleOverrides de sus partes: root, header, title.\n//\n// Genérico del paquete: function (regla de la casa). No sabe de negocio: el título y el contenido llegan ya traducidos.\nimport Box from '@mui/material/Box';\nimport Paper from '@mui/material/Paper';\nimport Typography from '@mui/material/Typography';\nimport {piecePart, usePieceProps} from '@/theme/themePieces.js';\nimport {warnUnknownProps} from '@/toolkit/unknownProps.js';\n\n// el nombre de la pieza en el tema y sus partes (theme.components.CalcitaSectionCard)\nconst THEME_NAME = 'CalcitaSectionCard';\nconst SectionRoot = piecePart(THEME_NAME, 'Root', Paper);\nconst SectionHeader = piecePart(THEME_NAME, 'Header', Box);\nconst SectionTitle = piecePart(THEME_NAME, 'Title', Typography);\n\n/**\n * @param {object} props\n * @param {string} props.title texto ya traducido\n * @param {import('react').ReactNode} [props.action] botón o liga a la derecha del título\n * @param {import('react').ReactNode} props.children\n */\nexport default function SectionCard(props) {\n // lo que el proyecto puso en su tema (components.CalcitaSectionCard.defaultProps) y encima lo que llega aquí\n const {title, action, children, ...unknownProps} = usePieceProps(props, THEME_NAME);\n warnUnknownProps(THEME_NAME, unknownProps);\n return (\n <SectionRoot component=\"section\" variant=\"outlined\" ownSx={{p: {xs: 2, md: 2.5}, minWidth: 0}}>\n <SectionHeader ownSx={{display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 1, mb: 1.5}}>\n <SectionTitle variant=\"overline\" color=\"text.secondary\" component=\"h2\" ownSx={{lineHeight: 1.6}}>{title}</SectionTitle>\n {action}\n </SectionHeader>\n {children}\n </SectionRoot>\n );\n}\n"],"names":[],"mappings":";;;;;;;AAgBA,MAAM,aAAa;AACnB,MAAM,cAAc,UAAU,YAAY,QAAQ,KAAK;AACvD,MAAM,gBAAgB,UAAU,YAAY,UAAU,GAAG;AACzD,MAAM,eAAe,UAAU,YAAY,SAAS,UAAU;AAQ9D,SAAwB,YAAY,OAAO;AAEvC,QAAM,EAAC,OAAO,QAAQ,UAAU,GAAG,iBAAgB,cAAc,OAAO,UAAU;AAClF,mBAAiB,YAAY,YAAY;AACzC,8BACK,aAAA,EAAY,WAAU,WAAU,SAAQ,YAAW,OAAO,EAAC,GAAG,EAAC,IAAI,GAAG,IAAI,OAAM,UAAU,KACvF,UAAA;AAAA,IAAA,qBAAC,eAAA,EAAc,OAAO,EAAC,SAAS,QAAQ,YAAY,UAAU,gBAAgB,iBAAiB,KAAK,GAAG,IAAI,OACvG,UAAA;AAAA,MAAA,oBAAC,cAAA,EAAa,SAAQ,YAAW,OAAM,kBAAiB,WAAU,MAAK,OAAO,EAAC,YAAY,IAAA,GAAO,UAAA,OAAM;AAAA,MACvG;AAAA,IAAA,GACL;AAAA,IACC;AAAA,EAAA,GACL;AAER;"}
1
+ {"version":3,"file":"SectionCard.js","sources":["../../../src/ui/layout/SectionCard.jsx"],"sourcesContent":["// Tarjeta de una sección de una página de detalle: título en versalitas, una acción opcional a la derecha y el contenido.\n//\n// Por qué una tarjeta por sección y no una sola hoja larga con divisiones: en pantalla ancha las secciones se acomodan en\n// columnas (lo principal a la izquierda, los datos de apoyo a la derecha) y cada una se encuentra por su título.\n//\n// Se cambia desde el tema del proyecto, como las piezas de MUI: components.CalcitaSectionCard con defaultProps y\n// styleOverrides de sus partes: root, header, title.\n//\n// Genérico del paquete: function (regla de la casa). No sabe de negocio: el título y el contenido llegan ya traducidos.\nimport Box from '@mui/material/Box';\nimport Paper from '@mui/material/Paper';\nimport Typography from '@mui/material/Typography';\nimport {piecePart, usePieceProps, withPieceSlots} from '@/theme/themePieces.js';\nimport {warnUnknownProps} from '@/toolkit/unknownProps.js';\n\n// el nombre de la pieza en el tema y sus partes (theme.components.CalcitaSectionCard)\nconst THEME_NAME = 'CalcitaSectionCard';\nconst SectionRoot = piecePart(THEME_NAME, 'Root', Paper);\nconst SectionHeader = piecePart(THEME_NAME, 'Header', Box);\nconst SectionTitle = piecePart(THEME_NAME, 'Title', Typography);\n\n/**\n * @param {object} props\n * @param {string} props.title texto ya traducido\n * @param {import('react').ReactNode} [props.action] botón o liga a la derecha del título\n * @param {import('react').ReactNode} props.children\n */\nfunction SectionCardContent(props) {\n // lo que el proyecto puso en su tema (components.CalcitaSectionCard.defaultProps) y encima lo que llega aquí\n const {title, action, children, ...unknownProps} = usePieceProps(props, THEME_NAME);\n warnUnknownProps(THEME_NAME, unknownProps);\n return (\n <SectionRoot component=\"section\" variant=\"outlined\" ownSx={{p: {xs: 2, md: 2.5}, minWidth: 0}}>\n <SectionHeader ownSx={{display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 1, mb: 1.5}}>\n <SectionTitle variant=\"overline\" color=\"text.secondary\" component=\"h2\" ownSx={{lineHeight: 1.6}}>{title}</SectionTitle>\n {action}\n </SectionHeader>\n {children}\n </SectionRoot>\n );\n}\n\n// lo que se exporta: la pieza con slots y slotProps para cambiar sus partes (themePieces.js)\nconst SectionCard = withPieceSlots(SectionCardContent, THEME_NAME);\nexport default SectionCard;\n"],"names":[],"mappings":";;;;;;;AAgBA,MAAM,aAAa;AACnB,MAAM,cAAc,UAAU,YAAY,QAAQ,KAAK;AACvD,MAAM,gBAAgB,UAAU,YAAY,UAAU,GAAG;AACzD,MAAM,eAAe,UAAU,YAAY,SAAS,UAAU;AAQ9D,SAAS,mBAAmB,OAAO;AAE/B,QAAM,EAAC,OAAO,QAAQ,UAAU,GAAG,iBAAgB,cAAc,OAAO,UAAU;AAClF,mBAAiB,YAAY,YAAY;AACzC,8BACK,aAAA,EAAY,WAAU,WAAU,SAAQ,YAAW,OAAO,EAAC,GAAG,EAAC,IAAI,GAAG,IAAI,OAAM,UAAU,KACvF,UAAA;AAAA,IAAA,qBAAC,eAAA,EAAc,OAAO,EAAC,SAAS,QAAQ,YAAY,UAAU,gBAAgB,iBAAiB,KAAK,GAAG,IAAI,OACvG,UAAA;AAAA,MAAA,oBAAC,cAAA,EAAa,SAAQ,YAAW,OAAM,kBAAiB,WAAU,MAAK,OAAO,EAAC,YAAY,IAAA,GAAO,UAAA,OAAM;AAAA,MACvG;AAAA,IAAA,GACL;AAAA,IACC;AAAA,EAAA,GACL;AAER;AAGA,MAAM,cAAc,eAAe,oBAAoB,UAAU;"}
@@ -13,7 +13,7 @@ import ChartTooltip from "./ChartTooltip.js";
13
13
  import TableToggle, { CHART_VIEW } from "./TableToggle.js";
14
14
  import { BAR_MIN_POINT_SIZE, barLabelValueOf } from "./barListLabels.js";
15
15
  import { useChartColors } from "./chartParts.js";
16
- import { piecePart, usePieceProps } from "../../theme/themePieces.js";
16
+ import { piecePart, withPieceSlots, usePieceProps } from "../../theme/themePieces.js";
17
17
  import { warnUnknownProps } from "../../toolkit/unknownProps.js";
18
18
  const THEME_NAME = "CalcitaBarList";
19
19
  const BarListRow = piecePart(THEME_NAME, "Row", TableRow);
@@ -25,7 +25,7 @@ function ValueLabel({ x, y, width, height, value, colors, formatNumber }) {
25
25
  value.detail && /* @__PURE__ */ jsx("tspan", { fill: colors.muted, fontSize: 12, children: ` ${value.detail}` })
26
26
  ] });
27
27
  }
28
- function BarList(props) {
28
+ function BarListContent(props) {
29
29
  const { items, onSelect, emptyLabel, tone = "primary", texts, defaultView = CHART_VIEW.chart, onViewChange, ...unknownProps } = usePieceProps(props, THEME_NAME);
30
30
  warnUnknownProps(THEME_NAME, unknownProps);
31
31
  const [asTable, setAsTable] = useState(defaultView === CHART_VIEW.table);
@@ -95,6 +95,7 @@ function BarList(props) {
95
95
  ] }) }) })
96
96
  ] });
97
97
  }
98
+ const BarList = withPieceSlots(BarListContent, THEME_NAME);
98
99
  export {
99
100
  BarList as default
100
101
  };
@@ -1 +1 @@
1
- {"version":3,"file":"BarList.js","sources":["../../../src/ui/metrics/BarList.jsx"],"sourcesContent":["// Barras horizontales de UNA serie con su nombre a la izquierda y su valor en la punta (ventas por producto,\n// cuentas por organización), dibujadas con Recharts.\n//\n// Horizontales porque los nombres son largos (\"Empresa / Área de ventas\"): se leen completos sin rotarlos. Una serie → un\n// color (el del tono, vía currentColor: los atributos SVG no leen var(...) pero sí currentColor); el valor va en tinta,\n// nunca del color de la barra; y cada barra puede llevar a la pantalla que la explica.\n//\n// OJO: el número y el detalle de la punta salen del renglón de la barra (barListLabels.js), nunca de items[index]: Recharts\n// descarta las barras de ancho 0 y renumera las etiquetas, y el detalle se corría al renglón de arriba.\n//\n// Se cambia desde el tema del proyecto, como las piezas de MUI: components.CalcitaBarList con defaultProps y\n// styleOverrides de sus partes: row, chart.\n//\n// Genérico del paquete: function (regla de la casa).\nimport {useState} from 'react';\nimport Box from '@mui/material/Box';\nimport Table from '@mui/material/Table';\nimport TableBody from '@mui/material/TableBody';\nimport TableCell from '@mui/material/TableCell';\nimport TableRow from '@mui/material/TableRow';\nimport Typography from '@mui/material/Typography';\nimport {Bar, BarChart, LabelList, ResponsiveContainer, Tooltip, XAxis, YAxis} from 'recharts';\n\nimport {useFormatters} from '@/toolkit/useFormatters.js';\nimport ChartTooltip from '@/ui/metrics/ChartTooltip.jsx';\nimport TableToggle, {CHART_VIEW} from '@/ui/metrics/TableToggle.jsx';\nimport {BAR_MIN_POINT_SIZE, barLabelValueOf} from '@/ui/metrics/barListLabels.js';\nimport {useChartColors} from '@/ui/metrics/chartParts.jsx';\nimport {piecePart, usePieceProps} from '@/theme/themePieces.js';\nimport {warnUnknownProps} from '@/toolkit/unknownProps.js';\n\n// el nombre de la pieza en el tema y sus partes (theme.components.CalcitaBarList)\nconst THEME_NAME = 'CalcitaBarList';\nconst BarListRow = piecePart(THEME_NAME, 'Row', TableRow);\nconst BarListChart = piecePart(THEME_NAME, 'Chart', Box);\n\nconst ROW_HEIGHT_PIXELS = 36;\n\n/**\n * El valor en la punta: el número fuerte y el detalle (\"de 8\") tenue; value es {value, detail} de barLabelValueOf. colors y\n * formatNumber: los de useChartColors y useFormatters (los da BarList: este pedazo lo pinta recharts por su cuenta).\n */\nfunction ValueLabel({x, y, width, height, value, colors, formatNumber}) {\n return (\n <text x={x + width + 8} y={y + height / 2} dominantBaseline=\"central\" fontSize={13}>\n <tspan fill={colors.text} fontWeight={600}>{formatNumber(value.value)}</tspan>\n {value.detail && <tspan fill={colors.muted} fontSize={12}>{` ${value.detail}`}</tspan>}\n </text>\n );\n}\n\n/**\n * @param {object} props\n * @param {Array<{key: string, label: string, value: number, detail?: string, tooltip?: string}>} props.items\n * @param {(item: any) => void} [props.onSelect] recibe el renglón de items que se picó\n * @param {string} props.emptyLabel ya traducido\n * @param {'primary'|'success'|'warning'|'error'|'info'} [props.tone]\n * @param {'chart'|'table'} [props.defaultView] cómo se ve al abrir (CHART_VIEW); por omisión dibujada\n * @param {(view: 'chart'|'table') => void} [props.onViewChange] la persona cambió a la tabla o a la gráfica\n * @param {object} [props.texts] los textos que cambian, con la forma de `common` en los textos del paquete\n */\nexport default function BarList(props) {\n // lo que el proyecto puso en su tema (components.CalcitaBarList.defaultProps) y encima lo que llega aquí\n const {items, onSelect, emptyLabel, tone = 'primary', texts, defaultView = CHART_VIEW.chart, onViewChange, ...unknownProps} = usePieceProps(props, THEME_NAME);\n warnUnknownProps(THEME_NAME, unknownProps);\n const [asTable, setAsTable] = useState(defaultView === CHART_VIEW.table);\n const toggleView = () => {\n setAsTable(!asTable);\n onViewChange?.(asTable ? CHART_VIEW.chart : CHART_VIEW.table);\n };\n const colors = useChartColors();\n const {formatNumber} = useFormatters();\n\n // guard clause: sin datos se dice, no se pinta un eje vacío\n if (!items.length) {\n return <Typography variant=\"body2\" color=\"text.secondary\">{emptyLabel}</Typography>;\n }\n\n // lo más largo de la etiqueta decide el ancho del eje: sin esto el nombre se corta o sobra medio contenedor\n // OJO: String(... ?? '') porque un renglón sin nombre (catálogo dado de baja) tumbaba toda la gráfica\n // OJO: 220 px de tope. Con 160 se cortaban etiquetas largas («Cuenta pendiente de activar») sin puntos suspensivos\n // ni forma de leerlas; el tooltip de la barra sigue mostrando el texto completo\n const labelWidth = Math.min(220, 16 + Math.max(...items.map((item) => String(item.label ?? '').length)) * 7);\n const longestValue = Math.max(...items.map((item) => `${formatNumber(item.value)} ${item.detail ?? ''}`.length));\n\n return (\n <Box>\n <TableToggle asTable={asTable} onToggle={toggleView} texts={texts} />\n {asTable ? (\n <Table size=\"small\">\n <TableBody>\n {items.map((item) => (\n <BarListRow key={item.key} hover={Boolean(onSelect)} onClick={onSelect ? () => onSelect(item) : undefined}\n ownSx={{cursor: onSelect ? 'pointer' : 'default'}}>\n <TableCell>{item.label}</TableCell>\n <TableCell align=\"right\">{formatNumber(item.value)} {item.detail}</TableCell>\n </BarListRow>\n ))}\n </TableBody>\n </Table>\n ) : (\n <BarListChart ownSx={{height: items.length * ROW_HEIGHT_PIXELS, color: `${tone}.main`}}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <BarChart data={items} layout=\"vertical\" margin={{top: 0, bottom: 0, left: 0, right: 16 + longestValue * 7}}>\n {/* OJO: con todo en 0 el dominio [0, 0] manda el 0 a la MITAD del eje (escala degenerada de d3) y la\n barra de 1 px con su «0 de 2» saldría a medio renglón; el tope mínimo de 1 lo deja en el origen */}\n <XAxis type=\"number\" hide domain={[0, (dataMax) => Math.max(dataMax, 1)]} />\n <YAxis type=\"category\" dataKey=\"label\" width={labelWidth} tickLine={false} axisLine={false}\n tick={{fill: colors.text, fontSize: 13}} />\n <Tooltip cursor={{fill: colors.hover}}\n content={<ChartTooltip render={(item) => item.tooltip ?? `${item.label}: ${formatNumber(item.value)}`} />} />\n <Bar dataKey=\"value\" fill=\"currentColor\" maxBarSize={16} radius={[0, 4, 4, 0]} isAnimationActive={false}\n minPointSize={BAR_MIN_POINT_SIZE} cursor={onSelect ? 'pointer' : 'default'}\n onClick={onSelect ? (entry) => onSelect(entry.payload) : undefined}>\n {/* OJO: SIN dataKey; con dataKey LabelList ignora valueAccessor y regresa el índice corrido */}\n <LabelList valueAccessor={barLabelValueOf} content={(labelProps) => <ValueLabel {...labelProps} colors={colors} formatNumber={formatNumber} />} />\n </Bar>\n </BarChart>\n </ResponsiveContainer>\n </BarListChart>\n )}\n </Box>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAgCA,MAAM,aAAa;AACnB,MAAM,aAAa,U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AAM,UAAU,GAAA;AAAA,QAAE;AAAA,MAAA;AAAA,MAC7C;AAAA,QAAC;AAAA,QAAA;AAAA,UAAQ,QAAQ,EAAC,MAAM,OAAO,MAAA;AAAA,UACtB,SAAS,oBAAC,cAAA,EAAa,QAAQ,CAAC,SAAS,KAAK,WAAW,GAAG,KAAK,KAAK,KAAK,aAAa,KAAK,KAAK,CAAC,GAAA,CAAI;AAAA,QAAA;AAAA,MAAA;AAAA,MAChH;AAAA,QAAC;AAAA,QAAA;AAAA,UAAI,SAAQ;AAAA,UAAQ,MAAK;AAAA,UAAe,YAAY;AAAA,UAAI,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC;AAAA,UAAG,mBAAmB;AAAA,UAC7F,cAAc;AAAA,UAAoB,QAAQ,WAAW,YAAY;AAAA,UACjE,SAAS,WAAW,CAAC,UAAU,SAAS,MAAM,OAAO,IAAI;AAAA,UAE1D,UAAA,oBAAC,WAAA,EAAU,eAAe,iBAAiB,SAAS,CAAC,eAAe,oBAAC,YAAA,EAAY,GAAG,YAAY,QAAgB,cAA4B,EAAA,CAAI;AAAA,QAAA;AAAA,MAAA;AAAA,IACpJ,EAAA,CACJ,GACJ,EAAA,CACJ;AAAA,EAAA,GAER;AAER;"}
1
+ {"version":3,"file":"BarList.js","sources":["../../../src/ui/metrics/BarList.jsx"],"sourcesContent":["// Barras horizontales de UNA serie con su nombre a la izquierda y su valor en la punta (ventas por producto,\n// cuentas por organización), dibujadas con Recharts.\n//\n// Horizontales porque los nombres son largos (\"Empresa / Área de ventas\"): se leen completos sin rotarlos. Una serie → un\n// color (el del tono, vía currentColor: los atributos SVG no leen var(...) pero sí currentColor); el valor va en tinta,\n// nunca del color de la barra; y cada barra puede llevar a la pantalla que la explica.\n//\n// OJO: el número y el detalle de la punta salen del renglón de la barra (barListLabels.js), nunca de items[index]: Recharts\n// descarta las barras de ancho 0 y renumera las etiquetas, y el detalle se corría al renglón de arriba.\n//\n// Se cambia desde el tema del proyecto, como las piezas de MUI: components.CalcitaBarList con defaultProps y\n// styleOverrides de sus partes: row, chart.\n//\n// Genérico del paquete: function (regla de la casa).\nimport {useState} from 'react';\nimport Box from '@mui/material/Box';\nimport Table from '@mui/material/Table';\nimport TableBody from '@mui/material/TableBody';\nimport TableCell from '@mui/material/TableCell';\nimport TableRow from '@mui/material/TableRow';\nimport Typography from '@mui/material/Typography';\nimport {Bar, BarChart, LabelList, ResponsiveContainer, Tooltip, XAxis, YAxis} from 'recharts';\n\nimport {useFormatters} from '@/toolkit/useFormatters.js';\nimport ChartTooltip from '@/ui/metrics/ChartTooltip.jsx';\nimport TableToggle, {CHART_VIEW} from '@/ui/metrics/TableToggle.jsx';\nimport {BAR_MIN_POINT_SIZE, barLabelValueOf} from '@/ui/metrics/barListLabels.js';\nimport {useChartColors} from '@/ui/metrics/chartParts.jsx';\nimport {piecePart, usePieceProps, withPieceSlots} from '@/theme/themePieces.js';\nimport {warnUnknownProps} from '@/toolkit/unknownProps.js';\n\n// el nombre de la pieza en el tema y sus partes (theme.components.CalcitaBarList)\nconst THEME_NAME = 'CalcitaBarList';\nconst BarListRow = piecePart(THEME_NAME, 'Row', TableRow);\nconst BarListChart = piecePart(THEME_NAME, 'Chart', Box);\n\nconst ROW_HEIGHT_PIXELS = 36;\n\n/**\n * El valor en la punta: el número fuerte y el detalle (\"de 8\") tenue; value es {value, detail} de barLabelValueOf. colors y\n * formatNumber: los de useChartColors y useFormatters (los da BarList: este pedazo lo pinta recharts por su cuenta).\n */\nfunction ValueLabel({x, y, width, height, value, colors, formatNumber}) {\n return (\n <text x={x + width + 8} y={y + height / 2} dominantBaseline=\"central\" fontSize={13}>\n <tspan fill={colors.text} fontWeight={600}>{formatNumber(value.value)}</tspan>\n {value.detail && <tspan fill={colors.muted} fontSize={12}>{` ${value.detail}`}</tspan>}\n </text>\n );\n}\n\n/**\n * @param {object} props\n * @param {Array<{key: string, label: string, value: number, detail?: string, tooltip?: string}>} props.items\n * @param {(item: any) => void} [props.onSelect] recibe el renglón de items que se picó\n * @param {string} props.emptyLabel ya traducido\n * @param {'primary'|'success'|'warning'|'error'|'info'} [props.tone]\n * @param {'chart'|'table'} [props.defaultView] cómo se ve al abrir (CHART_VIEW); por omisión dibujada\n * @param {(view: 'chart'|'table') => void} [props.onViewChange] la persona cambió a la tabla o a la gráfica\n * @param {object} [props.texts] los textos que cambian, con la forma de `common` en los textos del paquete\n */\nfunction BarListContent(props) {\n // lo que el proyecto puso en su tema (components.CalcitaBarList.defaultProps) y encima lo que llega aquí\n const {items, onSelect, emptyLabel, tone = 'primary', texts, defaultView = CHART_VIEW.chart, onViewChange, ...unknownProps} = usePieceProps(props, THEME_NAME);\n warnUnknownProps(THEME_NAME, unknownProps);\n const [asTable, setAsTable] = useState(defaultView === CHART_VIEW.table);\n const toggleView = () => {\n setAsTable(!asTable);\n onViewChange?.(asTable ? CHART_VIEW.chart : CHART_VIEW.table);\n };\n const colors = useChartColors();\n const {formatNumber} = useFormatters();\n\n // guard clause: sin datos se dice, no se pinta un eje vacío\n if (!items.length) {\n return <Typography variant=\"body2\" color=\"text.secondary\">{emptyLabel}</Typography>;\n }\n\n // lo más largo de la etiqueta decide el ancho del eje: sin esto el nombre se corta o sobra medio contenedor\n // OJO: String(... ?? '') porque un renglón sin nombre (catálogo dado de baja) tumbaba toda la gráfica\n // OJO: 220 px de tope. Con 160 se cortaban etiquetas largas («Cuenta pendiente de activar») sin puntos suspensivos\n // ni forma de leerlas; el tooltip de la barra sigue mostrando el texto completo\n const labelWidth = Math.min(220, 16 + Math.max(...items.map((item) => String(item.label ?? '').length)) * 7);\n const longestValue = Math.max(...items.map((item) => `${formatNumber(item.value)} ${item.detail ?? ''}`.length));\n\n return (\n <Box>\n <TableToggle asTable={asTable} onToggle={toggleView} texts={texts} />\n {asTable ? (\n <Table size=\"small\">\n <TableBody>\n {items.map((item) => (\n <BarListRow key={item.key} hover={Boolean(onSelect)} onClick={onSelect ? () => onSelect(item) : undefined}\n ownSx={{cursor: onSelect ? 'pointer' : 'default'}}>\n <TableCell>{item.label}</TableCell>\n <TableCell align=\"right\">{formatNumber(item.value)} {item.detail}</TableCell>\n </BarListRow>\n ))}\n </TableBody>\n </Table>\n ) : (\n <BarListChart ownSx={{height: items.length * ROW_HEIGHT_PIXELS, color: `${tone}.main`}}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <BarChart data={items} layout=\"vertical\" margin={{top: 0, bottom: 0, left: 0, right: 16 + longestValue * 7}}>\n {/* OJO: con todo en 0 el dominio [0, 0] manda el 0 a la MITAD del eje (escala degenerada de d3) y la\n barra de 1 px con su «0 de 2» saldría a medio renglón; el tope mínimo de 1 lo deja en el origen */}\n <XAxis type=\"number\" hide domain={[0, (dataMax) => Math.max(dataMax, 1)]} />\n <YAxis type=\"category\" dataKey=\"label\" width={labelWidth} tickLine={false} axisLine={false}\n tick={{fill: colors.text, fontSize: 13}} />\n <Tooltip cursor={{fill: colors.hover}}\n content={<ChartTooltip render={(item) => item.tooltip ?? `${item.label}: ${formatNumber(item.value)}`} />} />\n <Bar dataKey=\"value\" fill=\"currentColor\" maxBarSize={16} radius={[0, 4, 4, 0]} isAnimationActive={false}\n minPointSize={BAR_MIN_POINT_SIZE} cursor={onSelect ? 'pointer' : 'default'}\n onClick={onSelect ? (entry) => onSelect(entry.payload) : undefined}>\n {/* OJO: SIN dataKey; con dataKey LabelList ignora valueAccessor y regresa el índice corrido */}\n <LabelList valueAccessor={barLabelValueOf} content={(labelProps) => <ValueLabel {...labelProps} colors={colors} formatNumber={formatNumber} />} />\n </Bar>\n </BarChart>\n </ResponsiveContainer>\n </BarListChart>\n )}\n </Box>\n );\n}\n\n// lo que se exporta: la pieza con slots y slotProps para cambiar sus partes (themePieces.js)\nconst BarList = withPieceSlots(BarListContent, THEME_NAME);\nexport default BarList;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAgCA,MAAM,aAAa;AACnB,MAAM,aAAa,UAAU,YAAY,OAAO,QAAQ;AACxD,MAAM,eAAe,UAAU,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7C;AAAA,QAAC;AAAA,QAAA;AAAA,UAAQ,QAAQ,EAAC,MAAM,OAAO,MAAA;AAAA,UACtB,SAAS,oBAAC,cAAA,EAAa,QAAQ,CAAC,SAAS,KAAK,WAAW,GAAG,KAAK,KAAK,KAAK,aAAa,KAAK,KAAK,CAAC,GAAA,CAAI;AAAA,QAAA;AAAA,MAAA;AAAA,MAChH;AAAA,QAAC;AAAA,QAAA;AAAA,UAAI,SAAQ;AAAA,UAAQ,MAAK;AAAA,UAAe,YAAY;AAAA,UAAI,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC;AAAA,UAAG,mBAAmB;AAAA,UAC7F,cAAc;AAAA,UAAoB,QAAQ,WAAW,YAAY;AAAA,UACjE,SAAS,WAAW,CAAC,UAAU,SAAS,MAAM,OAAO,IAAI;AAAA,UAE1D,UAAA,oBAAC,WAAA,EAAU,eAAe,iBAAiB,SAAS,CAAC,eAAe,oBAAC,YAAA,EAAY,GAAG,YAAY,QAAgB,cAA4B,EAAA,CAAI;AAAA,QAAA;AAAA,MAAA;AAAA,IACpJ,EAAA,CACJ,GACJ,EAAA,CACJ;AAAA,EAAA,GAER;AAER;AAGA,MAAM,UAAU,eAAe,gBAAgB,UAAU;"}
@@ -15,7 +15,7 @@ import { useToolkitSettings } from "../../toolkit/toolkitContext.js";
15
15
  import { useFormatters } from "../../toolkit/useFormatters.js";
16
16
  import { calendarWeeksOf, calendarRangeOf, todayInZone, levelOf, HEATMAP_LEVELS } from "./heatmapScale.js";
17
17
  import TableToggle, { CHART_VIEW } from "./TableToggle.js";
18
- import { piecePart, usePieceProps } from "../../theme/themePieces.js";
18
+ import { piecePart, withPieceSlots, usePieceProps } from "../../theme/themePieces.js";
19
19
  import { warnUnknownProps } from "../../toolkit/unknownProps.js";
20
20
  const THEME_NAME = "CalcitaCalendarHeatmap";
21
21
  const HeatmapHeader = piecePart(THEME_NAME, "Header", Stack);
@@ -46,7 +46,7 @@ function levelFill(theme, tone, level) {
46
46
  }
47
47
  return `color-mix(in srgb, ${palette[tone].main} ${LEVEL_TONE_PERCENT[level]}%, transparent)`;
48
48
  }
49
- function CalendarHeatmap(props) {
49
+ function CalendarHeatmapContent(props) {
50
50
  const { startsOn, endsOn, days = NO_DAYS, ariaLabel, valueLabel, describeValue, summary, emptyLabel, tone = "primary", texts, defaultView = CHART_VIEW.chart, onViewChange, ...unknownProps } = usePieceProps(props, THEME_NAME);
51
51
  warnUnknownProps(THEME_NAME, unknownProps);
52
52
  const { t } = useToolkitTranslation("common", texts);
@@ -158,6 +158,7 @@ function CalendarHeatmap(props) {
158
158
  ] })
159
159
  ] });
160
160
  }
161
+ const CalendarHeatmap = withPieceSlots(CalendarHeatmapContent, THEME_NAME);
161
162
  export {
162
163
  CalendarHeatmap as default
163
164
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CalendarHeatmap.js","sources":["../../../src/ui/metrics/CalendarHeatmap.jsx"],"sourcesContent":["// Calendario de actividad: un cuadro por día, semanas en columnas (el de GitHub).\n//\n// Sirve para ver RITMO de un vistazo: qué días llegan cargas, si hubo semanas muertas, si la actividad crece. Las\n// reglas de visualización:\n// - es MAGNITUD, así que va un solo tono de claro a oscuro (el del tono que se pida), en cuatro niveles más \"sin\n// actividad\". Nunca un arcoíris. Se arma con color-mix sobre el color del tema (su variable CSS si el tema las usa),\n// sin hexadecimales: en modo oscuro los mismos niveles se ven sobre su propia superficie;\n// - los niveles se cortan por CUARTILES de los días con actividad (heatmapScale.js), no por valores fijos;\n// - leyenda \"Menos → Más\", tooltip por día con el número exacto (el color solo nunca dice cuánto) y VISTA DE TABLA\n// (para lector de pantalla, para quien no distingue el tono y para copiar los números).\n//\n// Sin librería a propósito: el Heatmap de MUI X Charts es de la edición Pro, que pide licencia.\n//\n// Textos por props y del paquete, y fechas con los formatos del paquete.\n//\n// Se cambia desde el tema del proyecto, como las piezas de MUI: components.CalcitaCalendarHeatmap con defaultProps y\n// styleOverrides de sus partes: header, toggle, tableArea, dateCell, valueCell, descriptionCell, gridArea, grid,\n// monthLabel, week, dayLabel, cell, legend, legendLess, legendCell, legendMore.\n//\n// Genérico del paquete: function (regla de la casa).\nimport {useMemo, useState} from 'react';\nimport {useToolkitTranslation} from '@/toolkit/useToolkitTranslation.js';\nimport Box from '@mui/material/Box';\nimport Stack from '@mui/material/Stack';\nimport Table from '@mui/material/Table';\nimport TableBody from '@mui/material/TableBody';\nimport TableCell from '@mui/material/TableCell';\nimport TableHead from '@mui/material/TableHead';\nimport TableRow from '@mui/material/TableRow';\nimport Tooltip from '@mui/material/Tooltip';\nimport Typography from '@mui/material/Typography';\n\nimport {useToolkitSettings} from '@/toolkit/toolkitContext.js';\nimport {useFormatters} from '@/toolkit/useFormatters.js';\nimport {HEATMAP_LEVELS, calendarRangeOf, calendarWeeksOf, levelOf, todayInZone} from '@/ui/metrics/heatmapScale.js';\nimport TableToggle, {CHART_VIEW} from '@/ui/metrics/TableToggle.jsx';\nimport {piecePart, usePieceProps} from '@/theme/themePieces.js';\nimport {warnUnknownProps} from '@/toolkit/unknownProps.js';\n\n// el nombre de la pieza en el tema y sus partes (theme.components.CalcitaCalendarHeatmap)\nconst THEME_NAME = 'CalcitaCalendarHeatmap';\nconst HeatmapHeader = piecePart(THEME_NAME, 'Header', Stack);\nconst HeatmapToggle = piecePart(THEME_NAME, 'Toggle', Box);\nconst HeatmapTableArea = piecePart(THEME_NAME, 'TableArea', Box);\nconst HeatmapDateCell = piecePart(THEME_NAME, 'DateCell', TableCell);\nconst HeatmapValueCell = piecePart(THEME_NAME, 'ValueCell', TableCell);\nconst HeatmapDescriptionCell = piecePart(THEME_NAME, 'DescriptionCell', TableCell);\nconst HeatmapGridArea = piecePart(THEME_NAME, 'GridArea', Box);\nconst HeatmapGrid = piecePart(THEME_NAME, 'Grid', Box);\nconst HeatmapMonthLabel = piecePart(THEME_NAME, 'MonthLabel', Typography);\nconst HeatmapWeek = piecePart(THEME_NAME, 'Week', Box);\nconst HeatmapDayLabel = piecePart(THEME_NAME, 'DayLabel', Typography);\nconst HeatmapCell = piecePart(THEME_NAME, 'Cell', Box);\nconst HeatmapLegend = piecePart(THEME_NAME, 'Legend', Stack);\nconst HeatmapLegendLess = piecePart(THEME_NAME, 'LegendLess', Typography);\nconst HeatmapLegendCell = piecePart(THEME_NAME, 'LegendCell', Box);\nconst HeatmapLegendMore = piecePart(THEME_NAME, 'LegendMore', Typography);\n\n// cuadros de 12 px en teléfono (el calendario se desliza) y de 16 px desde md, donde el panel ocupa todo el ancho\nconst CELL_PIXELS = {xs: 12, md: 16};\nconst GAP_PIXELS = 3;\n// solo lunes, miércoles y viernes llevan rótulo: los siete encimados no se leen a 12 px\nconst LABELED_WEEKDAYS = new Set([1, 3, 5]);\n// porcentaje del tono en cada nivel; el nivel 0 es el gris de \"hover\" del tema\nconst LEVEL_TONE_PERCENT = {1: 30, 2: 55, 3: 78, 4: 100};\n// sin días: el calendario vacío (una lista fija para que no se vuelvan a contar las semanas en cada render)\nconst NO_DAYS = Object.freeze([]);\n\n/**\n * Relleno de un nivel con los colores del tema.\n *\n * @param {object} theme tema de MUI (con o sin variables CSS)\n * @param {string} tone primary, info, success...\n * @param {number} level 0 a 4\n * @returns {string} color CSS\n */\nfunction levelFill(theme, tone, level) {\n // un tema con variables CSS las trae en theme.vars; el tema por omisión de MUI, solo en theme.palette\n const {palette} = theme.vars ?? theme;\n if (level === 0) {\n return palette.action.hover;\n }\n return `color-mix(in srgb, ${palette[tone].main} ${LEVEL_TONE_PERCENT[level]}%, transparent)`;\n}\n\n/**\n * @param {object} props\n * @param {string} [props.startsOn] primer día del rango (\"2025-09-16\"), fecha de calendario; sin él, un año antes de endsOn\n * @param {string} [props.endsOn] último día del rango (\"2026-09-15\"); sin él, hoy en la zona del proveedor\n * @param {Array<{date: string, value: number, detail?: string}>} [props.days] solo los días con actividad; el resto vale\n * 0\n * @param {string} props.ariaLabel qué muestra el calendario, ya traducido\n * @param {string} props.valueLabel encabezado de la columna de valor en la tabla (\"Registros leídos\")\n * @param {(value: number) => string} [props.describeValue] el valor en palabras para el tooltip (\"120 registros leídos\");\n * sin ella, solo el número\n * @param {import('react').ReactNode} [props.summary] renglón de resumen arriba del calendario\n * @param {string} [props.emptyLabel] qué decir si ningún día tiene actividad\n * @param {'primary'|'info'|'success'|'warning'|'error'} [props.tone]\n * @param {'chart'|'table'} [props.defaultView] cómo se ve al abrir (CHART_VIEW); por omisión dibujada\n * @param {(view: 'chart'|'table') => void} [props.onViewChange] la persona cambió a la tabla o a la gráfica\n * @param {object} [props.texts] los textos que cambian, con la forma de `common` en los textos del paquete\n */\nexport default function CalendarHeatmap(props) {\n // lo que el proyecto puso en su tema (components.CalcitaCalendarHeatmap.defaultProps) y encima lo que llega aquí\n const {startsOn, endsOn, days = NO_DAYS, ariaLabel, valueLabel, describeValue, summary, emptyLabel, tone = 'primary', texts, defaultView = CHART_VIEW.chart, onViewChange, ...unknownProps} = usePieceProps(props, THEME_NAME);\n warnUnknownProps(THEME_NAME, unknownProps);\n const {t} = useToolkitTranslation('common', texts);\n const {formatDate, formatMonthShortName, formatNumber, formatWeekdayShortName} = useFormatters();\n const [asTable, setAsTable] = useState(defaultView === CHART_VIEW.table);\n const toggleView = () => {\n setAsTable(!asTable);\n onViewChange?.(asTable ? CHART_VIEW.chart : CHART_VIEW.table);\n };\n\n const {timeZone} = useToolkitSettings();\n const {weeks, monthMarks, thresholds} = useMemo(\n () => calendarWeeksOf({...calendarRangeOf({startsOn, endsOn, today: todayInZone(timeZone)}), days}),\n [startsOn, endsOn, days, timeZone]);\n // el valor en palabras del globo de cada día; sin la del proyecto, el número solo\n const describe = describeValue ?? formatNumber;\n const activeDays = days.filter((day) => day.value > 0);\n\n return (\n <Box>\n <HeatmapHeader direction=\"row\" spacing={2} ownSx={{justifyContent: 'space-between', alignItems: 'center', mb: 1}}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {activeDays.length ? summary : emptyLabel}\n </Typography>\n <HeatmapToggle ownSx={{flexShrink: 0}}>\n <TableToggle asTable={asTable} onToggle={toggleView} texts={texts} />\n </HeatmapToggle>\n </HeatmapHeader>\n\n {asTable ? (\n <HeatmapTableArea ownSx={{maxHeight: 260, overflowY: 'auto'}}>\n <Table size=\"small\" aria-label={ariaLabel}>\n <TableHead>\n <TableRow>\n <TableCell>{t('charts.day')}</TableCell>\n <TableCell align=\"right\">{valueLabel}</TableCell>\n <TableCell />\n </TableRow>\n </TableHead>\n <TableBody>\n {[...activeDays].reverse().map((day) => (\n <TableRow key={day.date}>\n <HeatmapDateCell ownSx={{whiteSpace: 'nowrap'}}>{formatDate(day.date)}</HeatmapDateCell>\n <HeatmapValueCell align=\"right\" ownSx={{fontVariantNumeric: 'tabular-nums'}}>{formatNumber(day.value)}</HeatmapValueCell>\n <HeatmapDescriptionCell ownSx={{color: 'text.secondary'}}>{day.detail}</HeatmapDescriptionCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </HeatmapTableArea>\n ) : (\n // el calendario no se encoge: en pantallas angostas se desliza y arranca mostrando lo más reciente\n <HeatmapGridArea ownSx={{overflowX: 'auto', pb: 0.5}}\n ref={(node) => {\n if (node) {\n node.scrollLeft = node.scrollWidth;\n }\n }}>\n <HeatmapGrid role=\"img\" aria-label={ariaLabel}\n ownSx={{\n display: 'inline-grid',\n gridTemplateColumns: {\n xs: `auto repeat(${weeks.length}, ${CELL_PIXELS.xs}px)`,\n md: `auto repeat(${weeks.length}, ${CELL_PIXELS.md}px)`,\n },\n columnGap: `${GAP_PIXELS}px`,\n rowGap: `${GAP_PIXELS}px`,\n alignItems: 'center',\n }}>\n <Box />\n {monthMarks.map((month, column) => (\n <HeatmapMonthLabel key={`month-${column}`} variant=\"caption\" color=\"text.secondary\"\n ownSx={{fontSize: 10, lineHeight: 1, whiteSpace: 'nowrap', overflow: 'visible', width: CELL_PIXELS}}>\n {month ? formatMonthShortName(month) : ''}\n </HeatmapMonthLabel>\n ))}\n {[1, 2, 3, 4, 5, 6, 7].map((isoWeekday) => (\n <HeatmapWeek key={`weekday-${isoWeekday}`} ownSx={{display: 'contents'}}>\n <HeatmapDayLabel variant=\"caption\" color=\"text.secondary\"\n ownSx={{fontSize: 10, lineHeight: {xs: `${CELL_PIXELS.xs}px`, md: `${CELL_PIXELS.md}px`}, pr: 0.75}}>\n {LABELED_WEEKDAYS.has(isoWeekday) ? formatWeekdayShortName(isoWeekday) : ''}\n </HeatmapDayLabel>\n {weeks.map((week, column) => {\n const day = week[isoWeekday - 1];\n if (!day) {\n return <Box key={`outside-${column}-${isoWeekday}`} />;\n }\n const level = levelOf(day.value, thresholds);\n return (\n <Tooltip key={day.date} arrow disableInteractive\n title={`${formatDate(day.date)}: ${describe(day.value)}${day.detail ? ` · ${day.detail}` : ''}`}>\n <HeatmapCell ownSx={(theme) => ({width: CELL_PIXELS, height: CELL_PIXELS, borderRadius: '3px', bgcolor: levelFill(theme, tone, level)})} />\n </Tooltip>\n );\n })}\n </HeatmapWeek>\n ))}\n </HeatmapGrid>\n </HeatmapGridArea>\n )}\n\n {!asTable && (\n <HeatmapLegend direction=\"row\" spacing={0.5} ownSx={{alignItems: 'center', justifyContent: 'flex-end', mt: 1}} aria-hidden=\"true\">\n <HeatmapLegendLess variant=\"caption\" color=\"text.secondary\" ownSx={{mr: 0.5}}>{t('charts.less')}</HeatmapLegendLess>\n {HEATMAP_LEVELS.map((level) => (\n <HeatmapLegendCell key={level} ownSx={(theme) => ({width: CELL_PIXELS, height: CELL_PIXELS, borderRadius: '3px', bgcolor: levelFill(theme, tone, level)})} />\n ))}\n <HeatmapLegendMore variant=\"caption\" color=\"text.secondary\" ownSx={{ml: 0.5}}>{t('charts.more')}</HeatmapLegendMore>\n </HeatmapLegend>\n )}\n </Box>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAwCA,MAAM,aAAa;AACnB,MAAM,gBAAgB,UAAU,YAAY,UAAU,KAAK;AAC3D,MAAM,gBAAgB,UAAU,YAAY,UAAU,GAAG;AACzD,MAAM,mBAAmB,UAAU,YAAY,aAAa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a,QAAQ,aAAa,cAAc,OAAO,SAAS,UAAU,OAAO,MAAM,KAAK,KAAC,CAAI;AAAA,sBAAA;AAAA,sBAF/H,IAAI;AAAA,oBAAA;AAAA,kBAK1B,CAAC;AAAA,gBAAA,EAAA,GAjBa,WAAW,UAAU,EAkBvC,CACH;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACL;AAAA,MAAA;AAAA;AAAA,IAIP,CAAC,WACE,qBAAC,iBAAc,WAAU,OAAM,SAAS,KAAK,OAAO,EAAC,YAAY,UAAU,gBAAgB,YAAY,IAAI,KAAI,eAAY,QACvH,UAAA;AAAA,MAAA,oBAAC,mBAAA,EAAkB,SAAQ,WAAU,OAAM,kBAAiB,OAAO,EAAC,IAAI,IAAA,GAAO,UAAA,EAAE,aAAa,EAAA,CAAE;AAAA,MAC/F,eAAe,IAAI,CAAC,UACjB,oBAAC,qBAA8B,OAAO,CAAC,WAAW,EAAC,OAAO,aAAa,QAAQ,aAAa,cAAc,OAAO,SAAS,UAAU,OAAO,MAAM,KAAK,EAAA,GAAC,GAA/H,KAAmI,CAC9J;AAAA,MACD,oBAAC,mBAAA,EAAkB,SAAQ,WAAU,OAAM,kBAAiB,OAAO,EAAC,IAAI,IAAA,GAAO,UAAA,EAAE,aAAa,EAAA,CAAE;AAAA,IAAA,EAAA,CACpG;AAAA,EAAA,GAER;AAER;"}
1
+ {"version":3,"file":"CalendarHeatmap.js","sources":["../../../src/ui/metrics/CalendarHeatmap.jsx"],"sourcesContent":["// Calendario de actividad: un cuadro por día, semanas en columnas (el de GitHub).\n//\n// Sirve para ver RITMO de un vistazo: qué días llegan cargas, si hubo semanas muertas, si la actividad crece. Las\n// reglas de visualización:\n// - es MAGNITUD, así que va un solo tono de claro a oscuro (el del tono que se pida), en cuatro niveles más \"sin\n// actividad\". Nunca un arcoíris. Se arma con color-mix sobre el color del tema (su variable CSS si el tema las usa),\n// sin hexadecimales: en modo oscuro los mismos niveles se ven sobre su propia superficie;\n// - los niveles se cortan por CUARTILES de los días con actividad (heatmapScale.js), no por valores fijos;\n// - leyenda \"Menos → Más\", tooltip por día con el número exacto (el color solo nunca dice cuánto) y VISTA DE TABLA\n// (para lector de pantalla, para quien no distingue el tono y para copiar los números).\n//\n// Sin librería a propósito: el Heatmap de MUI X Charts es de la edición Pro, que pide licencia.\n//\n// Textos por props y del paquete, y fechas con los formatos del paquete.\n//\n// Se cambia desde el tema del proyecto, como las piezas de MUI: components.CalcitaCalendarHeatmap con defaultProps y\n// styleOverrides de sus partes: header, toggle, tableArea, dateCell, valueCell, descriptionCell, gridArea, grid,\n// monthLabel, week, dayLabel, cell, legend, legendLess, legendCell, legendMore.\n//\n// Genérico del paquete: function (regla de la casa).\nimport {useMemo, useState} from 'react';\nimport {useToolkitTranslation} from '@/toolkit/useToolkitTranslation.js';\nimport Box from '@mui/material/Box';\nimport Stack from '@mui/material/Stack';\nimport Table from '@mui/material/Table';\nimport TableBody from '@mui/material/TableBody';\nimport TableCell from '@mui/material/TableCell';\nimport TableHead from '@mui/material/TableHead';\nimport TableRow from '@mui/material/TableRow';\nimport Tooltip from '@mui/material/Tooltip';\nimport Typography from '@mui/material/Typography';\n\nimport {useToolkitSettings} from '@/toolkit/toolkitContext.js';\nimport {useFormatters} from '@/toolkit/useFormatters.js';\nimport {HEATMAP_LEVELS, calendarRangeOf, calendarWeeksOf, levelOf, todayInZone} from '@/ui/metrics/heatmapScale.js';\nimport TableToggle, {CHART_VIEW} from '@/ui/metrics/TableToggle.jsx';\nimport {piecePart, usePieceProps, withPieceSlots} from '@/theme/themePieces.js';\nimport {warnUnknownProps} from '@/toolkit/unknownProps.js';\n\n// el nombre de la pieza en el tema y sus partes (theme.components.CalcitaCalendarHeatmap)\nconst THEME_NAME = 'CalcitaCalendarHeatmap';\nconst HeatmapHeader = piecePart(THEME_NAME, 'Header', Stack);\nconst HeatmapToggle = piecePart(THEME_NAME, 'Toggle', Box);\nconst HeatmapTableArea = piecePart(THEME_NAME, 'TableArea', Box);\nconst HeatmapDateCell = piecePart(THEME_NAME, 'DateCell', TableCell);\nconst HeatmapValueCell = piecePart(THEME_NAME, 'ValueCell', TableCell);\nconst HeatmapDescriptionCell = piecePart(THEME_NAME, 'DescriptionCell', TableCell);\nconst HeatmapGridArea = piecePart(THEME_NAME, 'GridArea', Box);\nconst HeatmapGrid = piecePart(THEME_NAME, 'Grid', Box);\nconst HeatmapMonthLabel = piecePart(THEME_NAME, 'MonthLabel', Typography);\nconst HeatmapWeek = piecePart(THEME_NAME, 'Week', Box);\nconst HeatmapDayLabel = piecePart(THEME_NAME, 'DayLabel', Typography);\nconst HeatmapCell = piecePart(THEME_NAME, 'Cell', Box);\nconst HeatmapLegend = piecePart(THEME_NAME, 'Legend', Stack);\nconst HeatmapLegendLess = piecePart(THEME_NAME, 'LegendLess', Typography);\nconst HeatmapLegendCell = piecePart(THEME_NAME, 'LegendCell', Box);\nconst HeatmapLegendMore = piecePart(THEME_NAME, 'LegendMore', Typography);\n\n// cuadros de 12 px en teléfono (el calendario se desliza) y de 16 px desde md, donde el panel ocupa todo el ancho\nconst CELL_PIXELS = {xs: 12, md: 16};\nconst GAP_PIXELS = 3;\n// solo lunes, miércoles y viernes llevan rótulo: los siete encimados no se leen a 12 px\nconst LABELED_WEEKDAYS = new Set([1, 3, 5]);\n// porcentaje del tono en cada nivel; el nivel 0 es el gris de \"hover\" del tema\nconst LEVEL_TONE_PERCENT = {1: 30, 2: 55, 3: 78, 4: 100};\n// sin días: el calendario vacío (una lista fija para que no se vuelvan a contar las semanas en cada render)\nconst NO_DAYS = Object.freeze([]);\n\n/**\n * Relleno de un nivel con los colores del tema.\n *\n * @param {object} theme tema de MUI (con o sin variables CSS)\n * @param {string} tone primary, info, success...\n * @param {number} level 0 a 4\n * @returns {string} color CSS\n */\nfunction levelFill(theme, tone, level) {\n // un tema con variables CSS las trae en theme.vars; el tema por omisión de MUI, solo en theme.palette\n const {palette} = theme.vars ?? theme;\n if (level === 0) {\n return palette.action.hover;\n }\n return `color-mix(in srgb, ${palette[tone].main} ${LEVEL_TONE_PERCENT[level]}%, transparent)`;\n}\n\n/**\n * @param {object} props\n * @param {string} [props.startsOn] primer día del rango (\"2025-09-16\"), fecha de calendario; sin él, un año antes de endsOn\n * @param {string} [props.endsOn] último día del rango (\"2026-09-15\"); sin él, hoy en la zona del proveedor\n * @param {Array<{date: string, value: number, detail?: string}>} [props.days] solo los días con actividad; el resto vale\n * 0\n * @param {string} props.ariaLabel qué muestra el calendario, ya traducido\n * @param {string} props.valueLabel encabezado de la columna de valor en la tabla (\"Registros leídos\")\n * @param {(value: number) => string} [props.describeValue] el valor en palabras para el tooltip (\"120 registros leídos\");\n * sin ella, solo el número\n * @param {import('react').ReactNode} [props.summary] renglón de resumen arriba del calendario\n * @param {string} [props.emptyLabel] qué decir si ningún día tiene actividad\n * @param {'primary'|'info'|'success'|'warning'|'error'} [props.tone]\n * @param {'chart'|'table'} [props.defaultView] cómo se ve al abrir (CHART_VIEW); por omisión dibujada\n * @param {(view: 'chart'|'table') => void} [props.onViewChange] la persona cambió a la tabla o a la gráfica\n * @param {object} [props.texts] los textos que cambian, con la forma de `common` en los textos del paquete\n */\nfunction CalendarHeatmapContent(props) {\n // lo que el proyecto puso en su tema (components.CalcitaCalendarHeatmap.defaultProps) y encima lo que llega aquí\n const {startsOn, endsOn, days = NO_DAYS, ariaLabel, valueLabel, describeValue, summary, emptyLabel, tone = 'primary', texts, defaultView = CHART_VIEW.chart, onViewChange, ...unknownProps} = usePieceProps(props, THEME_NAME);\n warnUnknownProps(THEME_NAME, unknownProps);\n const {t} = useToolkitTranslation('common', texts);\n const {formatDate, formatMonthShortName, formatNumber, formatWeekdayShortName} = useFormatters();\n const [asTable, setAsTable] = useState(defaultView === CHART_VIEW.table);\n const toggleView = () => {\n setAsTable(!asTable);\n onViewChange?.(asTable ? CHART_VIEW.chart : CHART_VIEW.table);\n };\n\n const {timeZone} = useToolkitSettings();\n const {weeks, monthMarks, thresholds} = useMemo(\n () => calendarWeeksOf({...calendarRangeOf({startsOn, endsOn, today: todayInZone(timeZone)}), days}),\n [startsOn, endsOn, days, timeZone]);\n // el valor en palabras del globo de cada día; sin la del proyecto, el número solo\n const describe = describeValue ?? formatNumber;\n const activeDays = days.filter((day) => day.value > 0);\n\n return (\n <Box>\n <HeatmapHeader direction=\"row\" spacing={2} ownSx={{justifyContent: 'space-between', alignItems: 'center', mb: 1}}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {activeDays.length ? summary : emptyLabel}\n </Typography>\n <HeatmapToggle ownSx={{flexShrink: 0}}>\n <TableToggle asTable={asTable} onToggle={toggleView} texts={texts} />\n </HeatmapToggle>\n </HeatmapHeader>\n\n {asTable ? (\n <HeatmapTableArea ownSx={{maxHeight: 260, overflowY: 'auto'}}>\n <Table size=\"small\" aria-label={ariaLabel}>\n <TableHead>\n <TableRow>\n <TableCell>{t('charts.day')}</TableCell>\n <TableCell align=\"right\">{valueLabel}</TableCell>\n <TableCell />\n </TableRow>\n </TableHead>\n <TableBody>\n {[...activeDays].reverse().map((day) => (\n <TableRow key={day.date}>\n <HeatmapDateCell ownSx={{whiteSpace: 'nowrap'}}>{formatDate(day.date)}</HeatmapDateCell>\n <HeatmapValueCell align=\"right\" ownSx={{fontVariantNumeric: 'tabular-nums'}}>{formatNumber(day.value)}</HeatmapValueCell>\n <HeatmapDescriptionCell ownSx={{color: 'text.secondary'}}>{day.detail}</HeatmapDescriptionCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </HeatmapTableArea>\n ) : (\n // el calendario no se encoge: en pantallas angostas se desliza y arranca mostrando lo más reciente\n <HeatmapGridArea ownSx={{overflowX: 'auto', pb: 0.5}}\n ref={(node) => {\n if (node) {\n node.scrollLeft = node.scrollWidth;\n }\n }}>\n <HeatmapGrid role=\"img\" aria-label={ariaLabel}\n ownSx={{\n display: 'inline-grid',\n gridTemplateColumns: {\n xs: `auto repeat(${weeks.length}, ${CELL_PIXELS.xs}px)`,\n md: `auto repeat(${weeks.length}, ${CELL_PIXELS.md}px)`,\n },\n columnGap: `${GAP_PIXELS}px`,\n rowGap: `${GAP_PIXELS}px`,\n alignItems: 'center',\n }}>\n <Box />\n {monthMarks.map((month, column) => (\n <HeatmapMonthLabel key={`month-${column}`} variant=\"caption\" color=\"text.secondary\"\n ownSx={{fontSize: 10, lineHeight: 1, whiteSpace: 'nowrap', overflow: 'visible', width: CELL_PIXELS}}>\n {month ? formatMonthShortName(month) : ''}\n </HeatmapMonthLabel>\n ))}\n {[1, 2, 3, 4, 5, 6, 7].map((isoWeekday) => (\n <HeatmapWeek key={`weekday-${isoWeekday}`} ownSx={{display: 'contents'}}>\n <HeatmapDayLabel variant=\"caption\" color=\"text.secondary\"\n ownSx={{fontSize: 10, lineHeight: {xs: `${CELL_PIXELS.xs}px`, md: `${CELL_PIXELS.md}px`}, pr: 0.75}}>\n {LABELED_WEEKDAYS.has(isoWeekday) ? formatWeekdayShortName(isoWeekday) : ''}\n </HeatmapDayLabel>\n {weeks.map((week, column) => {\n const day = week[isoWeekday - 1];\n if (!day) {\n return <Box key={`outside-${column}-${isoWeekday}`} />;\n }\n const level = levelOf(day.value, thresholds);\n return (\n <Tooltip key={day.date} arrow disableInteractive\n title={`${formatDate(day.date)}: ${describe(day.value)}${day.detail ? ` · ${day.detail}` : ''}`}>\n <HeatmapCell ownSx={(theme) => ({width: CELL_PIXELS, height: CELL_PIXELS, borderRadius: '3px', bgcolor: levelFill(theme, tone, level)})} />\n </Tooltip>\n );\n })}\n </HeatmapWeek>\n ))}\n </HeatmapGrid>\n </HeatmapGridArea>\n )}\n\n {!asTable && (\n <HeatmapLegend direction=\"row\" spacing={0.5} ownSx={{alignItems: 'center', justifyContent: 'flex-end', mt: 1}} aria-hidden=\"true\">\n <HeatmapLegendLess variant=\"caption\" color=\"text.secondary\" ownSx={{mr: 0.5}}>{t('charts.less')}</HeatmapLegendLess>\n {HEATMAP_LEVELS.map((level) => (\n <HeatmapLegendCell key={level} ownSx={(theme) => ({width: CELL_PIXELS, height: CELL_PIXELS, borderRadius: '3px', bgcolor: levelFill(theme, tone, level)})} />\n ))}\n <HeatmapLegendMore variant=\"caption\" color=\"text.secondary\" ownSx={{ml: 0.5}}>{t('charts.more')}</HeatmapLegendMore>\n </HeatmapLegend>\n )}\n </Box>\n );\n}\n\n// lo que se exporta: la pieza con slots y slotProps para cambiar sus partes (themePieces.js)\nconst CalendarHeatmap = withPieceSlots(CalendarHeatmapContent, THEME_NAME);\nexport default CalendarHeatmap;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAwCA,MAAM,aAAa;AACnB,MAAM,gBAAgB,UAAU,YAAY,UAAU,KAAK;AAC3D,MAAM,gBAAgB,UAAU,YAAY,UAAU,GAAG;AACzD,MAAM,mBAAmB,UAAU,YAAY,aAAa,GAAG;AAC/D,MAAM,kBAAkB,UAAU,YAAY,YAAY,SAAS;AACnE,MAAM,mBAAmB,UAAU,YAAY,aAAa,SAAS;AACrE,MAAM,yBAAyB,UAAU,YAAY,mBAAmB,SAAS;AACjF,MAAM,kBAAkB,UAAU,YAAY,YAAY,GAAG;AAC7D,MAAM,cAAc,UAAU,YAAY,QAAQ,GAAG;AACrD,MAAM,oBAAoB,UAAU,YAAY,cAAc,UAAU;AACxE,MAAM,cAAc,UAAU,YAAY,QAAQ,GAAG;AACrD,MAAM,kBAAkB,UAAU,YAAY,YAAY,UAAU;AACpE,MAAM,cAAc,UAAU,YAAY,QAAQ,GAAG;AACrD,MAAM,gBAAgB,UAAU,YAAY,UAAU,KAAK;AAC3D,MAAM,oBAAoB,UAAU,YAAY,cAAc,UAAU;AACxE,MAAM,oBAAoB,UAAU,YAAY,cAAc,GAAG;AACjE,MAAM,oBAAoB,UAAU,YAAY,cAAc,UAAU;AAGxE,MAAM,cAAc,EAAC,IAAI,IAAI,IAAI,GAAA;AACjC,MAAM,aAAa;AAEnB,MAAM,mBAAmB,oBAAI,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC;AAE1C,MAAM,qBAAqB,E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AAO,EAAC,IAAI,IAAA,GAAO,UAAA,EAAE,aAAa,EAAA,CAAE;AAAA,IAAA,EAAA,CACpG;AAAA,EAAA,GAER;AAER;AAGA,MAAM,kBAAkB,eAAe,wBAAwB,UAAU;"}
@@ -3,17 +3,18 @@ import { jsx } from "react/jsx-runtime";
3
3
  import Paper from "@mui/material/Paper";
4
4
  import Typography from "@mui/material/Typography";
5
5
  import { isGlassTheme, glassStylesOf } from "../../theme/glassSurface.js";
6
- import { piecePart, usePieceProps } from "../../theme/themePieces.js";
6
+ import { piecePart, withPieceSlots, usePieceProps } from "../../theme/themePieces.js";
7
7
  const THEME_NAME = "CalcitaChartTooltip";
8
8
  const TooltipRoot = piecePart(THEME_NAME, "Root", Paper);
9
9
  const CHART_TOOLTIP_OPACITY = 0.92;
10
- function ChartTooltip(props) {
10
+ function ChartTooltipContent(props) {
11
11
  const { active, payload, render } = usePieceProps(props, THEME_NAME);
12
12
  if (!active || !payload?.length) {
13
13
  return null;
14
14
  }
15
15
  return /* @__PURE__ */ jsx(TooltipRoot, { elevation: 3, ownSx: [{ px: 1.5, py: 1, pointerEvents: "none" }, (theme) => isGlassTheme(theme) ? glassStylesOf(theme, { opacity: CHART_TOOLTIP_OPACITY }) : {}], children: /* @__PURE__ */ jsx(Typography, { variant: "body2", component: "div", children: render(payload[0].payload) }) });
16
16
  }
17
+ const ChartTooltip = withPieceSlots(ChartTooltipContent, THEME_NAME);
17
18
  export {
18
19
  ChartTooltip as default
19
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ChartTooltip.js","sources":["../../../src/ui/metrics/ChartTooltip.jsx"],"sourcesContent":["// El tooltip de las gráficas de Recharts con el look de la app. Se exporta para las gráficas propias del proyecto con\n// recharts (una de pastel, una de área): <Tooltip content={<ChartTooltip render={(row) => …} />} />.\n//\n// El de Recharts trae su propio estilo (fondo blanco, borde gris); este usa el Paper del tema y habla igual que los\n// tooltips del resto de la app (y se voltea solo cuando llegue el modo oscuro). Con el vidrio del tema\n// (createToolkitTheme({glass: true})) es de vidrio: flota sobre la gráfica.\n//\n// Se cambia desde el tema del proyecto, como las piezas de MUI: components.CalcitaChartTooltip con defaultProps y\n// styleOverrides de sus partes: root.\n//\n// Genérico del paquete: function (regla de la casa).\nimport Paper from '@mui/material/Paper';\nimport Typography from '@mui/material/Typography';\n\nimport {glassStylesOf, isGlassTheme} from '@/theme/glassSurface.js';\nimport {piecePart, usePieceProps} from '@/theme/themePieces.js';\n\n// el nombre de la pieza en el tema y sus partes (theme.components.CalcitaChartTooltip)\nconst THEME_NAME = 'CalcitaChartTooltip';\nconst TooltipRoot = piecePart(THEME_NAME, 'Root', Paper);\n\n// el vidrio del cuadrito, casi opaco (el material «grueso»): es para leer una cifra encima de la gráfica; con el vidrio de\n// los controles (60 %) se veía la barra de atrás a través del texto (lo reportaron)\nconst CHART_TOOLTIP_OPACITY = 0.92;\n\n/**\n * @param {{active?: boolean, payload?: Array<{payload: any}>, render: (item: any) => import('react').ReactNode}} props\n * active y payload los pone recharts; render recibe el renglón de data del punto o la columna\n */\nexport default function ChartTooltip(props) {\n // lo que el proyecto puso en su tema (components.CalcitaChartTooltip.defaultProps) y encima lo que llega aquí\n // OJO: sin aviso de opciones desconocidas (warnUnknownProps) a propósito: recharts le pasa al globo todas las suyas\n // (offset, wrapperStyle, coordinate…) y el aviso salía con unas veinte opciones que el globo no necesita\n const {active, payload, render} = usePieceProps(props, THEME_NAME);\n // guard clause: Recharts lo monta siempre; solo se pinta sobre una barra\n if (!active || !payload?.length) {\n return null;\n }\n return (\n <TooltipRoot elevation={3} ownSx={[{px: 1.5, py: 1, pointerEvents: 'none'}, (theme) => (isGlassTheme(theme) ? glassStylesOf(theme, {opacity: CHART_TOOLTIP_OPACITY}) : {})]}>\n {/* div: el globo puede llevar varios renglones (una serie por renglón) */}\n <Typography variant=\"body2\" component=\"div\">{render(payload[0].payload)}</Typography>\n </TooltipRoot>\n );\n}\n"],"names":[],"mappings":";;;;;;AAkBA,MAAM,aAAa;AACnB,MAAM,cAAc,UAAU,YAAY,QAAQ,KAAK;AAIvD,MAAM,wBAAwB;AAM9B,SAAwB,aAAa,OAAO;AAIxC,QAAM,EAAC,QAAQ,SAAS,WAAU,cAAc,OAAO,UAAU;AAEjE,MAAI,CAAC,UAAU,CAAC,SAAS,QAAQ;AAC7B,WAAO;AAAA,EACX;AACA,6BACK,aAAA,EAAY,WAAW,GAAG,OAAO,CAAC,EAAC,IAAI,KAAK,IAAI,GAAG,eAAe,UAAS,CAAC,UAAW,aAAa,KAAK,IAAI,cAAc,OAAO,EAAC,SAAS,sBAAA,CAAsB,IAAI,EAAG,GAEtK,UAAA,oBAAC,YAAA,EAAW,SAAQ,SAAQ,WAAU,OAAO,UAAA,OAAO,QAAQ,CAAC,EAAE,OAAO,GAAE,GAC5E;AAER;"}
1
+ {"version":3,"file":"ChartTooltip.js","sources":["../../../src/ui/metrics/ChartTooltip.jsx"],"sourcesContent":["// El tooltip de las gráficas de Recharts con el look de la app. Se exporta para las gráficas propias del proyecto con\n// recharts (una de pastel, una de área): <Tooltip content={<ChartTooltip render={(row) => …} />} />.\n//\n// El de Recharts trae su propio estilo (fondo blanco, borde gris); este usa el Paper del tema y habla igual que los\n// tooltips del resto de la app (y se voltea solo cuando llegue el modo oscuro). Con el vidrio del tema\n// (createToolkitTheme({glass: true})) es de vidrio: flota sobre la gráfica.\n//\n// Se cambia desde el tema del proyecto, como las piezas de MUI: components.CalcitaChartTooltip con defaultProps y\n// styleOverrides de sus partes: root.\n//\n// Genérico del paquete: function (regla de la casa).\nimport Paper from '@mui/material/Paper';\nimport Typography from '@mui/material/Typography';\n\nimport {glassStylesOf, isGlassTheme} from '@/theme/glassSurface.js';\nimport {piecePart, usePieceProps, withPieceSlots} from '@/theme/themePieces.js';\n\n// el nombre de la pieza en el tema y sus partes (theme.components.CalcitaChartTooltip)\nconst THEME_NAME = 'CalcitaChartTooltip';\nconst TooltipRoot = piecePart(THEME_NAME, 'Root', Paper);\n\n// el vidrio del cuadrito, casi opaco (el material «grueso»): es para leer una cifra encima de la gráfica; con el vidrio de\n// los controles (60 %) se veía la barra de atrás a través del texto (lo reportaron)\nconst CHART_TOOLTIP_OPACITY = 0.92;\n\n/**\n * @param {{active?: boolean, payload?: Array<{payload: any}>, render: (item: any) => import('react').ReactNode}} props\n * active y payload los pone recharts; render recibe el renglón de data del punto o la columna\n */\nfunction ChartTooltipContent(props) {\n // lo que el proyecto puso en su tema (components.CalcitaChartTooltip.defaultProps) y encima lo que llega aquí\n // OJO: sin aviso de opciones desconocidas (warnUnknownProps) a propósito: recharts le pasa al globo todas las suyas\n // (offset, wrapperStyle, coordinate…) y el aviso salía con unas veinte opciones que el globo no necesita\n const {active, payload, render} = usePieceProps(props, THEME_NAME);\n // guard clause: Recharts lo monta siempre; solo se pinta sobre una barra\n if (!active || !payload?.length) {\n return null;\n }\n return (\n <TooltipRoot elevation={3} ownSx={[{px: 1.5, py: 1, pointerEvents: 'none'}, (theme) => (isGlassTheme(theme) ? glassStylesOf(theme, {opacity: CHART_TOOLTIP_OPACITY}) : {})]}>\n {/* div: el globo puede llevar varios renglones (una serie por renglón) */}\n <Typography variant=\"body2\" component=\"div\">{render(payload[0].payload)}</Typography>\n </TooltipRoot>\n );\n}\n\n// lo que se exporta: la pieza con slots y slotProps para cambiar sus partes (themePieces.js)\nconst ChartTooltip = withPieceSlots(ChartTooltipContent, THEME_NAME);\nexport default ChartTooltip;\n"],"names":[],"mappings":";;;;;;AAkBA,MAAM,aAAa;AACnB,MAAM,cAAc,UAAU,YAAY,QAAQ,KAAK;AAIvD,MAAM,wBAAwB;AAM9B,SAAS,oBAAoB,OAAO;AAIhC,QAAM,EAAC,QAAQ,SAAS,WAAU,cAAc,OAAO,UAAU;AAEjE,MAAI,CAAC,UAAU,CAAC,SAAS,QAAQ;AAC7B,WAAO;AAAA,EACX;AACA,6BACK,aAAA,EAAY,WAAW,GAAG,OAAO,CAAC,EAAC,IAAI,KAAK,IAAI,GAAG,eAAe,UAAS,CAAC,UAAW,aAAa,KAAK,IAAI,cAAc,OAAO,EAAC,SAAS,sBAAA,CAAsB,IAAI,EAAG,GAEtK,UAAA,oBAAC,YAAA,EAAW,SAAQ,SAAQ,WAAU,OAAO,UAAA,OAAO,QAAQ,CAAC,EAAE,OAAO,GAAE,GAC5E;AAER;AAGA,MAAM,eAAe,eAAe,qBAAqB,UAAU;"}
@@ -9,12 +9,12 @@ import { useToolkitTranslation } from "../../toolkit/useToolkitTranslation.js";
9
9
  import ChartTooltip from "./ChartTooltip.js";
10
10
  import TableToggle, { CHART_VIEW } from "./TableToggle.js";
11
11
  import { useChartColors, resolvedSeriesOf, highestValueOf, ChartTable, valueAxisWidthOf, ChartLegend, ReferenceCaption } from "./chartParts.js";
12
- import { piecePart, usePieceProps } from "../../theme/themePieces.js";
12
+ import { piecePart, withPieceSlots, usePieceProps } from "../../theme/themePieces.js";
13
13
  import { warnUnknownProps } from "../../toolkit/unknownProps.js";
14
14
  const THEME_NAME = "CalcitaColumnChart";
15
15
  const ColumnChartPart = piecePart(THEME_NAME, "Chart", Box);
16
16
  const SINGLE_SERIES_KEY = "value";
17
- function ColumnChart(props) {
17
+ function ColumnChartContent(props) {
18
18
  const {
19
19
  data,
20
20
  periodLabel,
@@ -107,6 +107,7 @@ function ColumnChart(props) {
107
107
  /* @__PURE__ */ jsx(ReferenceCaption, { referenceLine })
108
108
  ] });
109
109
  }
110
+ const ColumnChart = withPieceSlots(ColumnChartContent, THEME_NAME);
110
111
  export {
111
112
  ColumnChart as default
112
113
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ColumnChart.js","sources":["../../../src/ui/metrics/ColumnChart.jsx"],"sourcesContent":["// Columnas a lo largo del tiempo (p. ej. registros leídos por mes), dibujadas con Recharts: una serie (data con `value`) o\n// varias agrupadas por periodo (`series`, cada una con su llave en data: ventas y devoluciones por mes).\n//\n// Recharts y no SVG a mano: ejes, escalas, rótulos que no se encimen y el tooltip ya los resolvió la librería. Lo que se\n// decide aquí son las reglas de visualización:\n// - una serie → un color (el del tono vía currentColor) y SIN leyenda: el título ya dice qué es; varias → cada una su color\n// y leyenda abajo (chartParts.jsx, lo que comparte con LineChart);\n// - columnas de 28 px como máximo, punta redondeada, base cuadrada;\n// - rejilla horizontal de 1 px, sólida y recesiva; el texto de los ejes en tinta secundaria;\n// - tooltip por columna y VISTA DE TABLA;\n// - una línea de referencia opcional (p. ej. la meta), punteada y en tinta secundaria: se lee sin competir con las\n// columnas, y el eje crece lo necesario para que siempre se vea. Su rótulo va debajo de la gráfica y no sobre la\n// línea, donde se encimaba con la columna del último mes; así también lo lee quien ve la tabla.\n//\n// El valor se escribe con formatValue (por omisión, número con separador de miles): con él una serie puede ir en\n// porcentaje. El eje mide lo que mide su número más largo, para que «2,500,000» no salga cortado.\n//\n// Se cambia desde el tema del proyecto, como las piezas de MUI: components.CalcitaColumnChart con defaultProps y\n// styleOverrides de sus partes: chart.\n//\n// Genérico del paquete: function (regla de la casa).\nimport {useState} from 'react';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport {Bar, BarChart, CartesianGrid, ReferenceLine, ResponsiveContainer, Tooltip, XAxis, YAxis} from 'recharts';\n\nimport {useFormatters} from '@/toolkit/useFormatters.js';\nimport {useToolkitTranslation} from '@/toolkit/useToolkitTranslation.js';\nimport ChartTooltip from '@/ui/metrics/ChartTooltip.jsx';\nimport TableToggle, {CHART_VIEW} from '@/ui/metrics/TableToggle.jsx';\nimport {\n ChartLegend, ChartTable, ReferenceCaption, highestValueOf, resolvedSeriesOf, useChartColors, valueAxisWidthOf,\n} from '@/ui/metrics/chartParts.jsx';\nimport {piecePart, usePieceProps} from '@/theme/themePieces.js';\nimport {warnUnknownProps} from '@/toolkit/unknownProps.js';\n\n// el nombre de la pieza en el tema y sus partes (theme.components.CalcitaColumnChart)\nconst THEME_NAME = 'CalcitaColumnChart';\nconst ColumnChartPart = piecePart(THEME_NAME, 'Chart', Box);\n\n// la llave del valor cuando la gráfica es de una sola serie\nconst SINGLE_SERIES_KEY = 'value';\n\n/**\n * @param {object} props\n * @param {Array<Record<string, any>>} props.data un renglón por periodo: {key, label, value, tooltip?} con una serie, o\n * {key, label, [llave de cada serie]: número} con varias\n * @param {string} props.periodLabel encabezado de la primera columna de la tabla («Mes»), ya traducido\n * @param {string} [props.valueLabel] cómo se llama lo que se cuenta, ya traducido (una serie)\n * @param {Array<{key: string, label: string, tone?: 'primary'|'secondary'|'success'|'warning'|'error'|'info'}>} [props.series]\n * varias series agrupadas: la llave de cada una en data, su nombre ya traducido y su color (por omisión, en orden)\n * @param {string} props.ariaLabel\n * @param {string} props.emptyLabel\n * @param {number} [props.height]\n * @param {'primary'|'success'|'warning'|'error'|'info'} [props.tone] el color de una sola serie\n * @param {(item: any, seriesKey: string) => void} [props.onSelect] recibe el renglón de data que se picó y la serie\n * @param {(value: number) => string} [props.formatValue] cómo se escribe un valor (en el eje, en la tabla y en el\n * tooltip)\n * @param {{value: number, label: string}} [props.referenceLine] línea de referencia con su rótulo ya traducido («Meta:\n * 10 %»)\n * @param {(row: any) => import('react').ReactNode} [props.renderTooltip] lo que dice el globo de un periodo; por omisión su\n * nombre y el valor de cada serie\n * @param {'chart'|'table'} [props.defaultView] cómo se ve al abrir (CHART_VIEW); por omisión dibujada\n * @param {(view: 'chart'|'table') => void} [props.onViewChange] la persona cambió a la tabla o a la gráfica\n * @param {object} [props.texts] los textos que cambian, con la forma de `common`: {charts: {viewAsTable, viewAsChart, legend}}\n */\nexport default function ColumnChart(props) {\n // lo que el proyecto puso en su tema (components.CalcitaColumnChart.defaultProps) y encima lo que llega aquí\n const {\n data, periodLabel, valueLabel, series, ariaLabel, emptyLabel, height = 220, tone = 'primary', onSelect, formatValue: formatValueProp,\n referenceLine, renderTooltip, texts, defaultView = CHART_VIEW.chart, onViewChange,\n ...unknownProps\n} = usePieceProps(props, THEME_NAME);\n warnUnknownProps(THEME_NAME, unknownProps);\n const {t} = useToolkitTranslation('common', texts);\n const {formatNumber} = useFormatters();\n const formatValue = formatValueProp ?? formatNumber;\n const [asTable, setAsTable] = useState(defaultView === CHART_VIEW.table);\n const toggleView = () => {\n setAsTable(!asTable);\n onViewChange?.(asTable ? CHART_VIEW.chart : CHART_VIEW.table);\n };\n const isSingleSeries = !series?.length;\n const colors = useChartColors();\n const drawnSeries = resolvedSeriesOf(isSingleSeries ? [{key: SINGLE_SERIES_KEY, label: valueLabel, tone}] : series, colors.palette);\n\n // guard clause: sin datos se dice, no se pinta un eje vacío\n if (!data.length) {\n return <Typography variant=\"body2\" color=\"text.secondary\">{emptyLabel}</Typography>;\n }\n\n // el valor más alto que se dibuja (el de las columnas o el de la línea de referencia) decide el ancho del eje\n const highestValue = highestValueOf(data, drawnSeries, referenceLine);\n const tooltipOf = renderTooltip ?? ((row) => (isSingleSeries\n ? row.tooltip ?? `${row.label}: ${formatValue(row.value)}`\n : (\n <>\n <strong>{row.label}</strong>\n {drawnSeries.map((item) => <Box key={item.key}>{item.label}: {formatValue(row[item.key])}</Box>)}\n </>\n )));\n\n return (\n <Box>\n <TableToggle asTable={asTable} onToggle={toggleView} texts={texts} />\n {asTable ? (\n <ChartTable data={data} series={drawnSeries} periodLabel={periodLabel} formatValue={formatValue} height={height} />\n ) : (\n <ColumnChartPart role=\"img\" aria-label={ariaLabel} ownSx={{height, color: `${tone}.main`}}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <BarChart data={data} margin={{top: 8, right: 8, bottom: 0, left: -8}} barCategoryGap={4}>\n <CartesianGrid vertical={false} stroke={colors.grid} />\n <XAxis dataKey=\"label\" tick={colors.axisText} tickLine={false} axisLine={{stroke: colors.grid}}\n interval=\"preserveStartEnd\" minTickGap={12} />\n <YAxis allowDecimals={false} tick={colors.axisText} tickLine={false} axisLine={false}\n width={valueAxisWidthOf(highestValue, formatValue)} tickFormatter={(value) => formatValue(value)} />\n <Tooltip cursor={{fill: colors.hover}} content={<ChartTooltip render={tooltipOf} />} />\n {referenceLine && (\n // extendDomain: si la referencia queda arriba de todas las columnas, el eje crece hasta ella\n <ReferenceLine y={referenceLine.value} ifOverflow=\"extendDomain\" stroke={colors.axis} strokeDasharray=\"4 4\" />\n )}\n {drawnSeries.map((item) => (\n // una serie: currentColor (el tono de la caja); varias: el color de cada una\n <Bar key={item.key} dataKey={item.key} fill={isSingleSeries ? 'currentColor' : item.color} maxBarSize={28}\n radius={[4, 4, 0, 0]} isAnimationActive={false} cursor={onSelect ? 'pointer' : 'default'}\n onClick={onSelect ? (entry) => onSelect(entry.payload, item.key) : undefined} />\n ))}\n </BarChart>\n </ResponsiveContainer>\n </ColumnChartPart>\n )}\n <ChartLegend series={drawnSeries} ariaLabel={t('charts.legend')} />\n <ReferenceCaption referenceLine={referenceLine} />\n </Box>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAqCA,MAAM,aAAa;AACnB,MAAM,kBAAkB,UAAU,YAAY,SAAS,GAAG;AAG1D,MAAM,oBAAoB;AAyB1B,SAAwB,YAAY,OAAO;AAEvC,QAAM;AAAA,IACN;AAAA,IAAM;AAAA,IAAa;AAAA,IAAY;AAAA,IAAQ;AAAA,IAAW;AAAA,IAAY,SAAS;AAAA,IAAK,OAAO;AAAA,IAAW;AAAA,IAAU,aAAa;AAAA,IACrH;AAAA,IAAe;AAAA,IAAe;AAAA,IAAO,cAAc,WAAW;AAAA,IAAO;AAAA,IACrE,GAAG;AAAA,EAAA,IACH,cAAc,OAAO,UAAU;AAC/B,mBAAiB,YAAY,YAAY;AACzC,QAAM,EAAC,EAAA,IAAK,sBAAsB,UAAU,KAAK;AACjD,QAAM,EAAC,aAAA,IAAgB,cAAA;AACvB,QAAM,cAAc,mBAAmB;AACvC,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,gBAAgB,WAAW,KAAK;AACvE,QAAM,aAAa,MAAM;AACrB,eAAW,CAAC,OAAO;AACnB,mBAAe,UAAU,WAAW,QAAQ,WAAW,KAAK;AAAA,EAChE;AACA,QAAM,iBAAiB,CAAC,QAAQ;AAChC,QAAM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as con Recharts: una serie (data con `value`) o\n// varias agrupadas por periodo (`series`, cada una con su llave en data: ventas y devoluciones por mes).\n//\n// Recharts y no SVG a mano: ejes, escalas, rótulos que no se encimen y el tooltip ya los resolvió la librería. Lo que se\n// decide aquí son las reglas de visualización:\n// - una serie → un color (el del tono vía currentColor) y SIN leyenda: el título ya dice qué es; varias → cada una su color\n// y leyenda abajo (chartParts.jsx, lo que comparte con LineChart);\n// - columnas de 28 px como máximo, punta redondeada, base cuadrada;\n// - rejilla horizontal de 1 px, sólida y recesiva; el texto de los ejes en tinta secundaria;\n// - tooltip por columna y VISTA DE TABLA;\n// - una línea de referencia opcional (p. ej. la meta), punteada y en tinta secundaria: se lee sin competir con las\n// columnas, y el eje crece lo necesario para que siempre se vea. Su rótulo va debajo de la gráfica y no sobre la\n// línea, donde se encimaba con la columna del último mes; así también lo lee quien ve la tabla.\n//\n// El valor se escribe con formatValue (por omisión, número con separador de miles): con él una serie puede ir en\n// porcentaje. El eje mide lo que mide su número más largo, para que «2,500,000» no salga cortado.\n//\n// Se cambia desde el tema del proyecto, como las piezas de MUI: components.CalcitaColumnChart con defaultProps y\n// styleOverrides de sus partes: chart.\n//\n// Genérico del paquete: function (regla de la casa).\nimport {useState} from 'react';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport {Bar, BarChart, CartesianGrid, ReferenceLine, ResponsiveContainer, Tooltip, XAxis, YAxis} from 'recharts';\n\nimport {useFormatters} from '@/toolkit/useFormatters.js';\nimport {useToolkitTranslation} from '@/toolkit/useToolkitTranslation.js';\nimport ChartTooltip from '@/ui/metrics/ChartTooltip.jsx';\nimport TableToggle, {CHART_VIEW} from '@/ui/metrics/TableToggle.jsx';\nimport {\n ChartLegend, ChartTable, ReferenceCaption, highestValueOf, resolvedSeriesOf, useChartColors, valueAxisWidthOf,\n} from '@/ui/metrics/chartParts.jsx';\nimport {piecePart, usePieceProps, withPieceSlots} from '@/theme/themePieces.js';\nimport {warnUnknownProps} from '@/toolkit/unknownProps.js';\n\n// el nombre de la pieza en el tema y sus partes (theme.components.CalcitaColumnChart)\nconst THEME_NAME = 'CalcitaColumnChart';\nconst ColumnChartPart = piecePart(THEME_NAME, 'Chart', Box);\n\n// la llave del valor cuando la gráfica es de una sola serie\nconst SINGLE_SERIES_KEY = 'value';\n\n/**\n * @param {object} props\n * @param {Array<Record<string, any>>} props.data un renglón por periodo: {key, label, value, tooltip?} con una serie, o\n * {key, label, [llave de cada serie]: número} con varias\n * @param {string} props.periodLabel encabezado de la primera columna de la tabla («Mes»), ya traducido\n * @param {string} [props.valueLabel] cómo se llama lo que se cuenta, ya traducido (una serie)\n * @param {Array<{key: string, label: string, tone?: 'primary'|'secondary'|'success'|'warning'|'error'|'info'}>} [props.series]\n * varias series agrupadas: la llave de cada una en data, su nombre ya traducido y su color (por omisión, en orden)\n * @param {string} props.ariaLabel\n * @param {string} props.emptyLabel\n * @param {number} [props.height]\n * @param {'primary'|'success'|'warning'|'error'|'info'} [props.tone] el color de una sola serie\n * @param {(item: any, seriesKey: string) => void} [props.onSelect] recibe el renglón de data que se picó y la serie\n * @param {(value: number) => string} [props.formatValue] cómo se escribe un valor (en el eje, en la tabla y en el\n * tooltip)\n * @param {{value: number, label: string}} [props.referenceLine] línea de referencia con su rótulo ya traducido («Meta:\n * 10 %»)\n * @param {(row: any) => import('react').ReactNode} [props.renderTooltip] lo que dice el globo de un periodo; por omisión su\n * nombre y el valor de cada serie\n * @param {'chart'|'table'} [props.defaultView] cómo se ve al abrir (CHART_VIEW); por omisión dibujada\n * @param {(view: 'chart'|'table') => void} [props.onViewChange] la persona cambió a la tabla o a la gráfica\n * @param {object} [props.texts] los textos que cambian, con la forma de `common`: {charts: {viewAsTable, viewAsChart, legend}}\n */\nfunction ColumnChartContent(props) {\n // lo que el proyecto puso en su tema (components.CalcitaColumnChart.defaultProps) y encima lo que llega aquí\n const {\n data, periodLabel, valueLabel, series, ariaLabel, emptyLabel, height = 220, tone = 'primary', onSelect, formatValue: formatValueProp,\n referenceLine, renderTooltip, texts, defaultView = CHART_VIEW.chart, onViewChange,\n ...unknownProps\n} = usePieceProps(props, THEME_NAME);\n warnUnknownProps(THEME_NAME, unknownProps);\n const {t} = useToolkitTranslation('common', texts);\n const {formatNumber} = useFormatters();\n const formatValue = formatValueProp ?? formatNumber;\n const [asTable, setAsTable] = useState(defaultView === CHART_VIEW.table);\n const toggleView = () => {\n setAsTable(!asTable);\n onViewChange?.(asTable ? CHART_VIEW.chart : CHART_VIEW.table);\n };\n const isSingleSeries = !series?.length;\n const colors = useChartColors();\n const drawnSeries = resolvedSeriesOf(isSingleSeries ? [{key: SINGLE_SERIES_KEY, label: valueLabel, tone}] : series, colors.palette);\n\n // guard clause: sin datos se dice, no se pinta un eje vacío\n if (!data.length) {\n return <Typography variant=\"body2\" color=\"text.secondary\">{emptyLabel}</Typography>;\n }\n\n // el valor más alto que se dibuja (el de las columnas o el de la línea de referencia) decide el ancho del eje\n const highestValue = highestValueOf(data, drawnSeries, referenceLine);\n const tooltipOf = renderTooltip ?? ((row) => (isSingleSeries\n ? row.tooltip ?? `${row.label}: ${formatValue(row.value)}`\n : (\n <>\n <strong>{row.label}</strong>\n {drawnSeries.map((item) => <Box key={item.key}>{item.label}: {formatValue(row[item.key])}</Box>)}\n </>\n )));\n\n return (\n <Box>\n <TableToggle asTable={asTable} onToggle={toggleView} texts={texts} />\n {asTable ? (\n <ChartTable data={data} series={drawnSeries} periodLabel={periodLabel} formatValue={formatValue} height={height} />\n ) : (\n <ColumnChartPart role=\"img\" aria-label={ariaLabel} ownSx={{height, color: `${tone}.main`}}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <BarChart data={data} margin={{top: 8, right: 8, bottom: 0, left: -8}} barCategoryGap={4}>\n <CartesianGrid vertical={false} stroke={colors.grid} />\n <XAxis dataKey=\"label\" tick={colors.axisText} tickLine={false} axisLine={{stroke: colors.grid}}\n interval=\"preserveStartEnd\" minTickGap={12} />\n <YAxis allowDecimals={false} tick={colors.axisText} tickLine={false} axisLine={false}\n width={valueAxisWidthOf(highestValue, formatValue)} tickFormatter={(value) => formatValue(value)} />\n <Tooltip cursor={{fill: colors.hover}} content={<ChartTooltip render={tooltipOf} />} />\n {referenceLine && (\n // extendDomain: si la referencia queda arriba de todas las columnas, el eje crece hasta ella\n <ReferenceLine y={referenceLine.value} ifOverflow=\"extendDomain\" stroke={colors.axis} strokeDasharray=\"4 4\" />\n )}\n {drawnSeries.map((item) => (\n // una serie: currentColor (el tono de la caja); varias: el color de cada una\n <Bar key={item.key} dataKey={item.key} fill={isSingleSeries ? 'currentColor' : item.color} maxBarSize={28}\n radius={[4, 4, 0, 0]} isAnimationActive={false} cursor={onSelect ? 'pointer' : 'default'}\n onClick={onSelect ? (entry) => onSelect(entry.payload, item.key) : undefined} />\n ))}\n </BarChart>\n </ResponsiveContainer>\n </ColumnChartPart>\n )}\n <ChartLegend series={drawnSeries} ariaLabel={t('charts.legend')} />\n <ReferenceCaption referenceLine={referenceLine} />\n </Box>\n );\n}\n\n// lo que se exporta: la pieza con slots y slotProps para cambiar sus partes (themePieces.js)\nconst ColumnChart = withPieceSlots(ColumnChartContent, THEME_NAME);\nexport default ColumnChart;\n"],"names":[],"mappings":";;;;;;;;;;;;;AAqCA,MAAM,aAAa;AACnB,MAAM,kBAAkB,UAAU,YAAY,SAAS,GAAG;AAG1D,MAAM,oBAAoB;AAyB1B,SAAS,mBAAmB,OAAO;AAE/B,QAAM;AAAA,IACN;AAAA,IAAM;AAAA,IAAa;AAAA,IAAY;AAAA,IAAQ;AAAA,IAAW;AAAA,IAAY,SAAS;AAAA,IAAK,OAAO;AAAA,IAAW;AAAA,IAAU,aAAa;AAAA,IACrH;AAAA,IAAe;AAAA,IAAe;AAAA,IAAO,cAAc,WAAW;AAAA,IAAO;AAAA,IACrE,GAAG;AAAA,EAAA,IACH,cAAc,OAAO,UAAU;AAC/B,mBAAiB,YAAY,YAAY;AACzC,QAAM,EAAC,EAAA,IAAK,sBAAsB,UAA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GlB;AAAA,IAAA,EAAA,CACL,GACJ,GACJ;AAAA,wBAEH,aAAA,EAAY,QAAQ,aAAa,WAAW,EAAE,eAAe,GAAG;AAAA,IACjE,oBAAC,oBAAiB,cAAA,CAA8B;AAAA,EAAA,GACpD;AAER;AAGA,MAAM,cAAc,eAAe,oBAAoB,UAAU;"}
@@ -9,14 +9,14 @@ import { useToolkitTranslation } from "../../toolkit/useToolkitTranslation.js";
9
9
  import ChartTooltip from "./ChartTooltip.js";
10
10
  import TableToggle, { CHART_VIEW } from "./TableToggle.js";
11
11
  import { useChartColors, resolvedSeriesOf, highestValueOf, ChartTable, valueAxisWidthOf, ChartLegend, ReferenceCaption } from "./chartParts.js";
12
- import { piecePart, usePieceProps } from "../../theme/themePieces.js";
12
+ import { piecePart, withPieceSlots, usePieceProps } from "../../theme/themePieces.js";
13
13
  import { warnUnknownProps } from "../../toolkit/unknownProps.js";
14
14
  const THEME_NAME = "CalcitaLineChart";
15
15
  const LineChartPart = piecePart(THEME_NAME, "Chart", Box);
16
16
  const LINE_WIDTH_PIXELS = 2;
17
17
  const DOT_RADIUS_PIXELS = 3;
18
18
  const ACTIVE_DOT_RADIUS_PIXELS = 5;
19
- function LineChart(props) {
19
+ function LineChartContent(props) {
20
20
  const {
21
21
  data,
22
22
  series,
@@ -118,6 +118,7 @@ function LineChart(props) {
118
118
  /* @__PURE__ */ jsx(ReferenceCaption, { referenceLine })
119
119
  ] });
120
120
  }
121
+ const LineChart = withPieceSlots(LineChartContent, THEME_NAME);
121
122
  export {
122
123
  LineChart as default
123
124
  };
@@ -1 +1 @@
1
- {"version":3,"file":"LineChart.js","sources":["../../../src/ui/metrics/LineChart.jsx"],"sourcesContent":["// Líneas a lo largo del tiempo, de una serie o de varias que se comparan (ventas contra devoluciones, este año contra el\n// pasado), dibujadas con Recharts. Lo que comparte con ColumnChart (ejes, tabla, leyenda, línea de referencia) vive en\n// chartParts.jsx.\n//\n// Las reglas de la guía de Apple (HIG «Charts» y «Charting data»):\n// - líneas para ver la tendencia; columnas (ColumnChart) para comparar periodos sueltos;\n// - cada serie con su color Y su trazo (continuo, rayado, punteado), con su punto en cada periodo: el color no va solo;\n// - una serie sin leyenda (el título ya dice qué es); varias, con leyenda abajo; toda gráfica con su vista de tabla;\n// - el globo de un periodo dice el valor de cada serie.\n//\n// <LineChart data={[{key: '2026-4', label: 'abr', sales: 120, returns: 8}, …]} periodLabel=\"Mes\"\n// series={[{key: 'sales', label: 'Ventas'}, {key: 'returns', label: 'Devoluciones', tone: 'error'}]}\n// ariaLabel=\"Ventas y devoluciones por mes\" emptyLabel=\"Sin datos\" />\n//\n// Se cambia desde el tema del proyecto, como las piezas de MUI: components.CalcitaLineChart con defaultProps y\n// styleOverrides de sus partes: chart.\n//\n// Genérico del paquete: function (regla de la casa).\nimport {useState} from 'react';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport {CartesianGrid, Line, LineChart as RechartsLineChart, ReferenceLine, ResponsiveContainer, Tooltip, XAxis, YAxis} from 'recharts';\n\nimport {useFormatters} from '@/toolkit/useFormatters.js';\nimport {useToolkitTranslation} from '@/toolkit/useToolkitTranslation.js';\nimport ChartTooltip from '@/ui/metrics/ChartTooltip.jsx';\nimport TableToggle, {CHART_VIEW} from '@/ui/metrics/TableToggle.jsx';\nimport {\n ChartLegend, ChartTable, ReferenceCaption, highestValueOf, resolvedSeriesOf, useChartColors, valueAxisWidthOf,\n} from '@/ui/metrics/chartParts.jsx';\nimport {piecePart, usePieceProps} from '@/theme/themePieces.js';\nimport {warnUnknownProps} from '@/toolkit/unknownProps.js';\n\n// el nombre de la pieza en el tema y sus partes (theme.components.CalcitaLineChart)\nconst THEME_NAME = 'CalcitaLineChart';\nconst LineChartPart = piecePart(THEME_NAME, 'Chart', Box);\n\n// el grueso de la línea y el tamaño de su punto (px): se ven en el teléfono sin tapar a la vecina\nconst LINE_WIDTH_PIXELS = 2;\nconst DOT_RADIUS_PIXELS = 3;\nconst ACTIVE_DOT_RADIUS_PIXELS = 5;\n\n/**\n * @param {object} props\n * @param {Array<Record<string, any>>} props.data un renglón por periodo: {key, label, [llave de cada serie]: número}\n * @param {Array<{key: string, label: string, tone?: 'primary'|'secondary'|'success'|'warning'|'error'|'info', dash?: string}>} props.series\n * la llave de cada serie en data, su nombre ya traducido, su color y su trazo (por omisión, en orden)\n * @param {string} props.periodLabel encabezado de la primera columna de la tabla («Mes»), ya traducido\n * @param {string} props.ariaLabel\n * @param {string} props.emptyLabel\n * @param {number} [props.height]\n * @param {(value: number) => string} [props.formatValue] cómo se escribe un valor (en el eje, en la tabla y en el globo)\n * @param {{value: number, label: string}} [props.referenceLine] línea de referencia (la meta) con su rótulo ya traducido\n * @param {(row: any) => void} [props.onSelect] recibe el renglón de data del periodo que se picó\n * @param {(row: any) => import('react').ReactNode} [props.renderTooltip] lo que dice el globo de un periodo; por omisión su\n * nombre y el valor de cada serie\n * @param {'chart'|'table'} [props.defaultView] cómo se ve al abrir (CHART_VIEW); por omisión dibujada\n * @param {(view: 'chart'|'table') => void} [props.onViewChange] la persona cambió a la tabla o a la gráfica\n * @param {object} [props.texts] los textos que cambian, con la forma de `common`: {charts: {viewAsTable, viewAsChart, legend}}\n */\nexport default function LineChart(props) {\n // lo que el proyecto puso en su tema (components.CalcitaLineChart.defaultProps) y encima lo que llega aquí\n const {\n data, series, periodLabel, ariaLabel, emptyLabel, height = 220, formatValue: formatValueProp, referenceLine, onSelect, renderTooltip, texts, defaultView = CHART_VIEW.chart, onViewChange,\n ...unknownProps\n} = usePieceProps(props, THEME_NAME);\n warnUnknownProps(THEME_NAME, unknownProps);\n const {t} = useToolkitTranslation('common', texts);\n const {formatNumber} = useFormatters();\n const formatValue = formatValueProp ?? formatNumber;\n const [asTable, setAsTable] = useState(defaultView === CHART_VIEW.table);\n const toggleView = () => {\n setAsTable(!asTable);\n onViewChange?.(asTable ? CHART_VIEW.chart : CHART_VIEW.table);\n };\n const colors = useChartColors();\n const drawnSeries = resolvedSeriesOf(series, colors.palette);\n\n // guard clause: sin datos se dice, no se pinta un eje vacío\n if (!data.length) {\n return <Typography variant=\"body2\" color=\"text.secondary\">{emptyLabel}</Typography>;\n }\n\n const highestValue = highestValueOf(data, drawnSeries, referenceLine);\n // el periodo que se picó: recharts da su posición en data (a veces como texto)\n const selectPeriodAt = (activeIndex) => {\n const row = data[Number(activeIndex)];\n if (row) {\n onSelect(row);\n }\n };\n const tooltipOf = renderTooltip ?? ((row) => (\n <>\n <strong>{row.label}</strong>\n {drawnSeries.map((item) => <Box key={item.key}>{item.label}: {formatValue(row[item.key])}</Box>)}\n </>\n ));\n\n return (\n <Box>\n <TableToggle asTable={asTable} onToggle={toggleView} texts={texts} />\n {asTable ? (\n <ChartTable data={data} series={drawnSeries} periodLabel={periodLabel} formatValue={formatValue} height={height} />\n ) : (\n <LineChartPart role=\"img\" aria-label={ariaLabel} ownSx={{height}}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n {/* OJO: recharts 3 avisa el clic con el índice del periodo (activeIndex), ya no con activePayload (el de\n la versión 2) */}\n <RechartsLineChart data={data} margin={{top: 8, right: 12, bottom: 0, left: -8}}\n onClick={onSelect ? (state) => selectPeriodAt(state?.activeIndex) : undefined}>\n <CartesianGrid vertical={false} stroke={colors.grid} />\n <XAxis dataKey=\"label\" tick={colors.axisText} tickLine={false} axisLine={{stroke: colors.grid}}\n interval=\"preserveStartEnd\" minTickGap={12} />\n <YAxis allowDecimals={false} tick={colors.axisText} tickLine={false} axisLine={false}\n width={valueAxisWidthOf(highestValue, formatValue)} tickFormatter={(value) => formatValue(value)} />\n <Tooltip cursor={{stroke: colors.grid}} content={<ChartTooltip render={tooltipOf} />} />\n {referenceLine && (\n <ReferenceLine y={referenceLine.value} ifOverflow=\"extendDomain\" stroke={colors.axis} strokeDasharray=\"4 4\" />\n )}\n {drawnSeries.map((item) => (\n <Line key={item.key} type=\"monotone\" dataKey={item.key} name={item.label} stroke={item.color}\n strokeWidth={LINE_WIDTH_PIXELS} strokeDasharray={item.dash} isAnimationActive={false}\n dot={{r: DOT_RADIUS_PIXELS, fill: item.color, strokeWidth: 0}}\n activeDot={{r: ACTIVE_DOT_RADIUS_PIXELS, cursor: onSelect ? 'pointer' : 'default'}} />\n ))}\n </RechartsLineChart>\n </ResponsiveContainer>\n </LineChartPart>\n )}\n <ChartLegend series={drawnSeries} showsDash ariaLabel={t('charts.legend')} />\n <ReferenceCaption referenceLine={referenceLine} />\n </Box>\n );\n}\n"],"names":["RechartsLineChart"],"mappings":";;;;;;;;;;;;;AAkCA,MAAM,aAAa;AACnB,MAAM,gBAAgB,UAAU,YAAY,SAAS,GAAG;AAGxD,MAAM,oBAAoB;AAC1B,MAAM,oBAAoB;AAC1B,MAAM,2BAA2B;AAoBjC,SAAwB,UAAU,OAAO;AAErC,QAAM;AAAA,IACN;AAAA,IAAM;AAAA,IAAQ;AAAA,IAAa;AAAA,IAAW;AAAA,IAAY,SAAS;AAAA,IAAK,aAAa;AAAA,IAAiB;AAAA,IAAe;AAAA,IAAU;AAAA,IAAe;AAAA,IAAO,cAAc,WAAW;AAAA,IAAO;AAAA,IAC7K,GAAG;AAAA,EAAA,IACH,cAAc,OAAO,UAAU;AAC/B,mBAAiB,YAAY,YAAY;AACzC,QAAM,EAAC,EAAA,IAAK,sBAAsB,UAAU,KAAK;AACjD,QAAM,EAAC,aAAA,IAAgB,cAAA;AACvB,QAAM,cAAc,mBAAmB;AACvC,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,gBAAgB,WAAW,KAAK;AACvE,QAAM,aAAa,MAAM;AACrB,eAAW,CAAC,OAAO;AACnB,mBAAe,UAAU,WAAW,QAAQ,WAAW,KAAK;AAAA,EAChE;AACA,QAAM,SAAS,eAAA;AACf,QAAM,cAAc,iBAAiB,QAAQ,OAAO,OAAO;AAG3D,MAAI,CAAC,KAAK,QAAQ;AACd,+BAAQ,YAAA,EAAW,SAAQ,SAAQ,OAAM,kBAAkB,UAAA,YAAW;AAAA,EAC1E;AAEA,QAAM,e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AA;AAAA,UAC/C;AAAA,YAAC;AAAA,YAAA;AAAA,cAAM,eAAe;AAAA,cAAO,MAAM,OAAO;AAAA,cAAU,UAAU;AAAA,cAAO,UAAU;AAAA,cACxE,OAAO,iBAAiB,cAAc,WAAW;AAAA,cAAG,eAAe,CAAC,UAAU,YAAY,KAAK;AAAA,YAAA;AAAA,UAAA;AAAA,UACtG,oBAAC,SAAA,EAAQ,QAAQ,EAAC,QAAQ,OAAO,KAAA,GAAO,SAAS,oBAAC,cAAA,EAAa,QAAQ,WAAW,EAAA,CAAI;AAAA,UACrF,iBACG,oBAAC,eAAA,EAAc,GAAG,cAAc,OAAO,YAAW,gBAAe,QAAQ,OAAO,MAAM,iBAAgB,MAAA,CAAM;AAAA,UAE/G,YAAY,IAAI,CAAC,SACd;AAAA,YAAC;AAAA,YAAA;AAAA,cAAoB,MAAK;AAAA,cAAW,SAAS,KAAK;AAAA,cAAK,MAAM,KAAK;AAAA,cAAO,QAAQ,KAAK;AAAA,cACjF,aAAa;AAAA,cAAmB,iBAAiB,KAAK;AAAA,cAAM,mBAAmB;AAAA,cAC/E,KAAK,EAAC,GAAG,mBAAmB,MAAM,KAAK,OAAO,aAAa,EAAA;AAAA,cAC3D,WAAW,EAAC,GAAG,0BAA0B,QAAQ,WAAW,YAAY,UAAA;AAAA,YAAS;AAAA,YAH5E,KAAK;AAAA,UAAA,CAInB;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA,GAET,EAAA,CACJ;AAAA,IAEJ,oBAAC,eAAY,QAAQ,aAAa,WAAS,MAAC,WAAW,EAAE,eAAe,GAAG;AAAA,IAC3E,oBAAC,oBAAiB,cAAA,CAA8B;AAAA,EAAA,GACpD;AAER;"}
1
+ {"version":3,"file":"LineChart.js","sources":["../../../src/ui/metrics/LineChart.jsx"],"sourcesContent":["// Líneas a lo largo del tiempo, de una serie o de varias que se comparan (ventas contra devoluciones, este año contra el\n// pasado), dibujadas con Recharts. Lo que comparte con ColumnChart (ejes, tabla, leyenda, línea de referencia) vive en\n// chartParts.jsx.\n//\n// Las reglas de la guía de Apple (HIG «Charts» y «Charting data»):\n// - líneas para ver la tendencia; columnas (ColumnChart) para comparar periodos sueltos;\n// - cada serie con su color Y su trazo (continuo, rayado, punteado), con su punto en cada periodo: el color no va solo;\n// - una serie sin leyenda (el título ya dice qué es); varias, con leyenda abajo; toda gráfica con su vista de tabla;\n// - el globo de un periodo dice el valor de cada serie.\n//\n// <LineChart data={[{key: '2026-4', label: 'abr', sales: 120, returns: 8}, …]} periodLabel=\"Mes\"\n// series={[{key: 'sales', label: 'Ventas'}, {key: 'returns', label: 'Devoluciones', tone: 'error'}]}\n// ariaLabel=\"Ventas y devoluciones por mes\" emptyLabel=\"Sin datos\" />\n//\n// Se cambia desde el tema del proyecto, como las piezas de MUI: components.CalcitaLineChart con defaultProps y\n// styleOverrides de sus partes: chart.\n//\n// Genérico del paquete: function (regla de la casa).\nimport {useState} from 'react';\nimport Box from '@mui/material/Box';\nimport Typography from '@mui/material/Typography';\nimport {CartesianGrid, Line, LineChart as RechartsLineChart, ReferenceLine, ResponsiveContainer, Tooltip, XAxis, YAxis} from 'recharts';\n\nimport {useFormatters} from '@/toolkit/useFormatters.js';\nimport {useToolkitTranslation} from '@/toolkit/useToolkitTranslation.js';\nimport ChartTooltip from '@/ui/metrics/ChartTooltip.jsx';\nimport TableToggle, {CHART_VIEW} from '@/ui/metrics/TableToggle.jsx';\nimport {\n ChartLegend, ChartTable, ReferenceCaption, highestValueOf, resolvedSeriesOf, useChartColors, valueAxisWidthOf,\n} from '@/ui/metrics/chartParts.jsx';\nimport {piecePart, usePieceProps, withPieceSlots} from '@/theme/themePieces.js';\nimport {warnUnknownProps} from '@/toolkit/unknownProps.js';\n\n// el nombre de la pieza en el tema y sus partes (theme.components.CalcitaLineChart)\nconst THEME_NAME = 'CalcitaLineChart';\nconst LineChartPart = piecePart(THEME_NAME, 'Chart', Box);\n\n// el grueso de la línea y el tamaño de su punto (px): se ven en el teléfono sin tapar a la vecina\nconst LINE_WIDTH_PIXELS = 2;\nconst DOT_RADIUS_PIXELS = 3;\nconst ACTIVE_DOT_RADIUS_PIXELS = 5;\n\n/**\n * @param {object} props\n * @param {Array<Record<string, any>>} props.data un renglón por periodo: {key, label, [llave de cada serie]: número}\n * @param {Array<{key: string, label: string, tone?: 'primary'|'secondary'|'success'|'warning'|'error'|'info', dash?: string}>} props.series\n * la llave de cada serie en data, su nombre ya traducido, su color y su trazo (por omisión, en orden)\n * @param {string} props.periodLabel encabezado de la primera columna de la tabla («Mes»), ya traducido\n * @param {string} props.ariaLabel\n * @param {string} props.emptyLabel\n * @param {number} [props.height]\n * @param {(value: number) => string} [props.formatValue] cómo se escribe un valor (en el eje, en la tabla y en el globo)\n * @param {{value: number, label: string}} [props.referenceLine] línea de referencia (la meta) con su rótulo ya traducido\n * @param {(row: any) => void} [props.onSelect] recibe el renglón de data del periodo que se picó\n * @param {(row: any) => import('react').ReactNode} [props.renderTooltip] lo que dice el globo de un periodo; por omisión su\n * nombre y el valor de cada serie\n * @param {'chart'|'table'} [props.defaultView] cómo se ve al abrir (CHART_VIEW); por omisión dibujada\n * @param {(view: 'chart'|'table') => void} [props.onViewChange] la persona cambió a la tabla o a la gráfica\n * @param {object} [props.texts] los textos que cambian, con la forma de `common`: {charts: {viewAsTable, viewAsChart, legend}}\n */\nfunction LineChartContent(props) {\n // lo que el proyecto puso en su tema (components.CalcitaLineChart.defaultProps) y encima lo que llega aquí\n const {\n data, series, periodLabel, ariaLabel, emptyLabel, height = 220, formatValue: formatValueProp, referenceLine, onSelect, renderTooltip, texts, defaultView = CHART_VIEW.chart, onViewChange,\n ...unknownProps\n} = usePieceProps(props, THEME_NAME);\n warnUnknownProps(THEME_NAME, unknownProps);\n const {t} = useToolkitTranslation('common', texts);\n const {formatNumber} = useFormatters();\n const formatValue = formatValueProp ?? formatNumber;\n const [asTable, setAsTable] = useState(defaultView === CHART_VIEW.table);\n const toggleView = () => {\n setAsTable(!asTable);\n onViewChange?.(asTable ? CHART_VIEW.chart : CHART_VIEW.table);\n };\n const colors = useChartColors();\n const drawnSeries = resolvedSeriesOf(series, colors.palette);\n\n // guard clause: sin datos se dice, no se pinta un eje vacío\n if (!data.length) {\n return <Typography variant=\"body2\" color=\"text.secondary\">{emptyLabel}</Typography>;\n }\n\n const highestValue = highestValueOf(data, drawnSeries, referenceLine);\n // el periodo que se picó: recharts da su posición en data (a veces como texto)\n const selectPeriodAt = (activeIndex) => {\n const row = data[Number(activeIndex)];\n if (row) {\n onSelect(row);\n }\n };\n const tooltipOf = renderTooltip ?? ((row) => (\n <>\n <strong>{row.label}</strong>\n {drawnSeries.map((item) => <Box key={item.key}>{item.label}: {formatValue(row[item.key])}</Box>)}\n </>\n ));\n\n return (\n <Box>\n <TableToggle asTable={asTable} onToggle={toggleView} texts={texts} />\n {asTable ? (\n <ChartTable data={data} series={drawnSeries} periodLabel={periodLabel} formatValue={formatValue} height={height} />\n ) : (\n <LineChartPart role=\"img\" aria-label={ariaLabel} ownSx={{height}}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n {/* OJO: recharts 3 avisa el clic con el índice del periodo (activeIndex), ya no con activePayload (el de\n la versión 2) */}\n <RechartsLineChart data={data} margin={{top: 8, right: 12, bottom: 0, left: -8}}\n onClick={onSelect ? (state) => selectPeriodAt(state?.activeIndex) : undefined}>\n <CartesianGrid vertical={false} stroke={colors.grid} />\n <XAxis dataKey=\"label\" tick={colors.axisText} tickLine={false} axisLine={{stroke: colors.grid}}\n interval=\"preserveStartEnd\" minTickGap={12} />\n <YAxis allowDecimals={false} tick={colors.axisText} tickLine={false} axisLine={false}\n width={valueAxisWidthOf(highestValue, formatValue)} tickFormatter={(value) => formatValue(value)} />\n <Tooltip cursor={{stroke: colors.grid}} content={<ChartTooltip render={tooltipOf} />} />\n {referenceLine && (\n <ReferenceLine y={referenceLine.value} ifOverflow=\"extendDomain\" stroke={colors.axis} strokeDasharray=\"4 4\" />\n )}\n {drawnSeries.map((item) => (\n <Line key={item.key} type=\"monotone\" dataKey={item.key} name={item.label} stroke={item.color}\n strokeWidth={LINE_WIDTH_PIXELS} strokeDasharray={item.dash} isAnimationActive={false}\n dot={{r: DOT_RADIUS_PIXELS, fill: item.color, strokeWidth: 0}}\n activeDot={{r: ACTIVE_DOT_RADIUS_PIXELS, cursor: onSelect ? 'pointer' : 'default'}} />\n ))}\n </RechartsLineChart>\n </ResponsiveContainer>\n </LineChartPart>\n )}\n <ChartLegend series={drawnSeries} showsDash ariaLabel={t('charts.legend')} />\n <ReferenceCaption referenceLine={referenceLine} />\n </Box>\n );\n}\n\n// lo que se exporta: la pieza con slots y slotProps para cambiar sus partes (themePieces.js)\nconst LineChart = withPieceSlots(LineChartContent, THEME_NAME);\nexport default LineChart;\n"],"names":["RechartsLineChart"],"mappings":";;;;;;;;;;;;;AAkCA,MAAM,aAAa;AACnB,MAAM,gBAAgB,UAAU,YAAY,SAAS,GAAG;AAGxD,MAAM,oBAAoB;AAC1B,MAAM,oBAAoB;AAC1B,MAAM,2BAA2B;AAoBjC,SAAS,iBAAiB,OAAO;AAE7B,QAAM;AAAA,IACN;AAAA,IAAM;AAAA,IAAQ;AAAA,IAAa;AAAA,IAAW;AAAA,IAAY,SAAS;AAAA,IAAK,aAAa;AAAA,IAAiB;AAAA,IAAe;AAAA,IAAU;AAAA,IAAe;AAAA,IAAO,cAAc,WAAW;AAAA,IAAO;AAAA,IAC7K,GAAG;AAAA,EAAA,IACH,cAAc,OAAO,UAAU;AAC/B,mBAAiB,YAAY,YAAY;AACzC,QAAM,EAAC,EAAA,IAAK,sBAAsB,UAAU,KAAK;AACjD,QAAM,EAAC,aAAA,IAAgB,cAAA;AACvB,QAAM,cAAc,mBAAmB;AACvC,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,gBAAgB,WAAW,KAAK;AACvE,QAAM,aAAa,MAAM;AACrB,eAAW,CAAC,OAAO;AACnB,mBAAe,UAAU,WAAW,QAAQ,WAAW,KAAK;AAAA,EAChE;AACA,Q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AAER;AAGA,MAAM,YAAY,eAAe,kBAAkB,UAAU;"}
@@ -11,7 +11,7 @@ import Stack from "@mui/material/Stack";
11
11
  import Typography from "@mui/material/Typography";
12
12
  import { alpha } from "@mui/material/styles";
13
13
  import ArrowDownwardIcon from "@mui/icons-material/ArrowDownward";
14
- import { piecePart, usePieceProps } from "../../theme/themePieces.js";
14
+ import { piecePart, withPieceSlots, usePieceProps } from "../../theme/themePieces.js";
15
15
  import { lightDarkStylesOf } from "../../theme/lightDarkStyles.js";
16
16
  import ArrowUpwardIcon from "@mui/icons-material/ArrowUpward";
17
17
  import RemoveIcon from "@mui/icons-material/Remove";
@@ -55,7 +55,7 @@ function TrendChip({ trend, texts }) {
55
55
  }
56
56
  );
57
57
  }
58
- function MetricCard(props) {
58
+ function MetricCardContent(props) {
59
59
  const {
60
60
  label,
61
61
  value,
@@ -111,6 +111,7 @@ function MetricCard(props) {
111
111
  ...isClickable ? {} : { p: 2.5 }
112
112
  }, children: isClickable ? /* @__PURE__ */ jsx(CardAction, { ...to ? { component: Link, to } : { onClick }, ownSx: { p: 2.5, height: "100%", alignItems: "flex-start", display: "block" }, children: content }) : content });
113
113
  }
114
+ const MetricCard = withPieceSlots(MetricCardContent, THEME_NAME);
114
115
  export {
115
116
  TREND_DIRECTION,
116
117
  MetricCard as default