@sincpro/web-ui 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (376) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +184 -2
  3. package/dist/components/activity/Activity.d.ts +69 -0
  4. package/dist/components/activity/Activity.js +279 -0
  5. package/dist/components/activity/Messages.d.ts +66 -0
  6. package/dist/components/activity/Messages.js +46 -0
  7. package/dist/components/activity/Timeline.d.ts +21 -0
  8. package/dist/components/activity/Timeline.js +30 -0
  9. package/dist/components/activity/index.d.ts +3 -0
  10. package/dist/components/activity/index.js +4 -0
  11. package/dist/components/assist/AssistMark.d.ts +64 -0
  12. package/dist/components/assist/AssistMark.js +108 -0
  13. package/dist/components/assist/AssistPending.d.ts +24 -0
  14. package/dist/components/assist/AssistPending.js +26 -0
  15. package/dist/components/assist/AssistSuggestion.d.ts +42 -0
  16. package/dist/components/assist/AssistSuggestion.js +55 -0
  17. package/dist/components/assist/ChangeReview.d.ts +56 -0
  18. package/dist/components/assist/ChangeReview.js +121 -0
  19. package/dist/components/assist/assist.d.ts +77 -0
  20. package/dist/components/assist/assist.js +87 -0
  21. package/dist/components/assist/index.d.ts +5 -0
  22. package/dist/components/assist/index.js +7 -0
  23. package/dist/components/form/Form.d.ts +52 -0
  24. package/dist/components/form/Form.js +49 -0
  25. package/dist/components/form/Sheet.d.ts +47 -0
  26. package/dist/components/form/Sheet.js +90 -0
  27. package/dist/components/form/index.d.ts +2 -0
  28. package/dist/components/form/index.js +4 -0
  29. package/dist/components/frame/Chart.d.ts +13 -0
  30. package/dist/components/frame/Chart.js +24 -0
  31. package/dist/components/frame/FrameView.d.ts +33 -0
  32. package/dist/components/frame/FrameView.js +125 -0
  33. package/dist/components/frame/index.d.ts +3 -0
  34. package/dist/components/frame/index.js +3 -0
  35. package/dist/components/frame/model.d.ts +43 -0
  36. package/dist/components/frame/model.js +101 -0
  37. package/dist/components/index.d.ts +10 -0
  38. package/dist/components/index.js +11 -0
  39. package/dist/components/lines/LineItems.d.ts +111 -0
  40. package/dist/components/lines/LineItems.js +317 -0
  41. package/dist/components/lines/index.d.ts +1 -0
  42. package/dist/components/lines/index.js +2 -0
  43. package/dist/components/lines/lines.d.ts +23 -0
  44. package/dist/components/lines/lines.js +26 -0
  45. package/dist/components/listing/ColumnsMenu.d.ts +20 -0
  46. package/dist/components/listing/ColumnsMenu.js +46 -0
  47. package/dist/components/listing/GroupingLevels.d.ts +35 -0
  48. package/dist/components/listing/GroupingLevels.js +45 -0
  49. package/dist/components/listing/Listing.d.ts +27 -0
  50. package/dist/components/listing/Listing.js +86 -0
  51. package/dist/components/listing/ListingBar.d.ts +112 -0
  52. package/dist/components/listing/ListingBar.js +144 -0
  53. package/dist/components/listing/Pagination.d.ts +36 -0
  54. package/dist/components/listing/Pagination.js +69 -0
  55. package/dist/components/listing/RecordCard.d.ts +33 -0
  56. package/dist/components/listing/RecordCard.js +22 -0
  57. package/dist/components/listing/RecordLink.d.ts +7 -0
  58. package/dist/components/listing/RecordLink.js +22 -0
  59. package/dist/components/listing/Row.d.ts +110 -0
  60. package/dist/components/listing/Row.js +123 -0
  61. package/dist/components/listing/SortMenu.d.ts +62 -0
  62. package/dist/components/listing/SortMenu.js +105 -0
  63. package/dist/components/listing/ViewSwitcher.d.ts +24 -0
  64. package/dist/components/listing/ViewSwitcher.js +16 -0
  65. package/dist/components/listing/columns.d.ts +47 -0
  66. package/dist/components/listing/columns.js +72 -0
  67. package/dist/components/listing/grouping.d.ts +35 -0
  68. package/dist/components/listing/grouping.js +47 -0
  69. package/dist/components/listing/index.d.ts +17 -0
  70. package/dist/components/listing/index.js +20 -0
  71. package/dist/components/listing/modelColumns.d.ts +50 -0
  72. package/dist/components/listing/modelColumns.js +103 -0
  73. package/dist/components/listing/pages.d.ts +78 -0
  74. package/dist/components/listing/pages.js +135 -0
  75. package/dist/components/listing/selection.d.ts +21 -0
  76. package/dist/components/listing/selection.js +43 -0
  77. package/dist/components/listing/set.d.ts +48 -0
  78. package/dist/components/listing/set.js +24 -0
  79. package/dist/components/listing/tree.d.ts +28 -0
  80. package/dist/components/listing/tree.js +23 -0
  81. package/dist/components/navigation/CommandPalette.d.ts +40 -0
  82. package/dist/components/navigation/CommandPalette.js +114 -0
  83. package/dist/components/navigation/NavigationTree.d.ts +31 -0
  84. package/dist/components/navigation/NavigationTree.js +79 -0
  85. package/dist/components/navigation/commands.d.ts +30 -0
  86. package/dist/components/navigation/commands.js +30 -0
  87. package/dist/components/navigation/index.d.ts +3 -0
  88. package/dist/components/navigation/index.js +4 -0
  89. package/dist/components/record/Breadcrumb.d.ts +42 -0
  90. package/dist/components/record/Breadcrumb.js +98 -0
  91. package/dist/components/record/DirtyActions.d.ts +26 -0
  92. package/dist/components/record/DirtyActions.js +22 -0
  93. package/dist/components/record/Pager.d.ts +18 -0
  94. package/dist/components/record/Pager.js +33 -0
  95. package/dist/components/record/RecordHeader.d.ts +75 -0
  96. package/dist/components/record/RecordHeader.js +104 -0
  97. package/dist/components/record/RecordNotices.d.ts +37 -0
  98. package/dist/components/record/RecordNotices.js +75 -0
  99. package/dist/components/record/RecordSkeleton.d.ts +3 -0
  100. package/dist/components/record/RecordSkeleton.js +21 -0
  101. package/dist/components/record/SmartButtons.d.ts +35 -0
  102. package/dist/components/record/SmartButtons.js +38 -0
  103. package/dist/components/record/StatusBar.d.ts +51 -0
  104. package/dist/components/record/StatusBar.js +168 -0
  105. package/dist/components/record/ThumbBar.d.ts +36 -0
  106. package/dist/components/record/ThumbBar.js +86 -0
  107. package/dist/components/record/index.d.ts +6 -0
  108. package/dist/components/record/index.js +8 -0
  109. package/dist/components/search/CriteriaBuilder.d.ts +58 -0
  110. package/dist/components/search/CriteriaBuilder.js +278 -0
  111. package/dist/components/search/CriteriaChips.d.ts +22 -0
  112. package/dist/components/search/CriteriaChips.js +64 -0
  113. package/dist/components/search/FilterBuilder.d.ts +142 -0
  114. package/dist/components/search/FilterBuilder.js +421 -0
  115. package/dist/components/search/JoinWord.d.ts +8 -0
  116. package/dist/components/search/JoinWord.js +47 -0
  117. package/dist/components/search/JsonEditor.d.ts +19 -0
  118. package/dist/components/search/JsonEditor.js +78 -0
  119. package/dist/components/search/SearchBar.d.ts +78 -0
  120. package/dist/components/search/SearchBar.js +387 -0
  121. package/dist/components/search/criteria.d.ts +116 -0
  122. package/dist/components/search/criteria.js +159 -0
  123. package/dist/components/search/datePeriods.d.ts +122 -0
  124. package/dist/components/search/datePeriods.js +134 -0
  125. package/dist/components/search/dateRanges.d.ts +54 -0
  126. package/dist/components/search/dateRanges.js +89 -0
  127. package/dist/components/search/index.d.ts +9 -0
  128. package/dist/components/search/index.js +20 -0
  129. package/dist/components/search/model.d.ts +54 -0
  130. package/dist/components/search/model.js +37 -0
  131. package/dist/components/search/query.d.ts +166 -0
  132. package/dist/components/search/query.js +436 -0
  133. package/dist/components/shell/AppFrame.d.ts +14 -0
  134. package/dist/components/shell/AppFrame.js +80 -0
  135. package/dist/components/shell/TopBar.d.ts +73 -0
  136. package/dist/components/shell/TopBar.js +54 -0
  137. package/dist/components/shell/headerSlot.d.ts +17 -0
  138. package/dist/components/shell/headerSlot.js +21 -0
  139. package/dist/components/shell/index.d.ts +2 -0
  140. package/dist/components/shell/index.js +3 -0
  141. package/dist/foundations/aria.d.ts +14 -0
  142. package/dist/foundations/aria.js +18 -0
  143. package/dist/foundations/calendar.d.ts +28 -0
  144. package/dist/foundations/calendar.js +183 -0
  145. package/dist/foundations/copy.d.ts +703 -0
  146. package/dist/foundations/copy.es.d.ts +2 -0
  147. package/dist/foundations/copy.es.js +430 -0
  148. package/dist/foundations/copy.js +520 -0
  149. package/dist/foundations/density.d.ts +16 -0
  150. package/dist/foundations/density.js +21 -0
  151. package/dist/foundations/grouping.d.ts +281 -0
  152. package/dist/foundations/grouping.js +0 -0
  153. package/dist/foundations/index.d.ts +14 -0
  154. package/dist/foundations/index.js +30 -0
  155. package/dist/foundations/layout.d.ts +9 -0
  156. package/dist/foundations/layout.js +9 -0
  157. package/dist/foundations/pivot.d.ts +222 -0
  158. package/dist/foundations/pivot.js +198 -0
  159. package/dist/foundations/pivotSheet.d.ts +61 -0
  160. package/dist/foundations/pivotSheet.js +0 -0
  161. package/dist/foundations/slots.d.ts +67 -0
  162. package/dist/foundations/slots.js +63 -0
  163. package/dist/foundations/sticky.d.ts +53 -0
  164. package/dist/foundations/sticky.js +150 -0
  165. package/dist/foundations/surface.d.ts +9 -0
  166. package/dist/foundations/surface.js +26 -0
  167. package/dist/foundations/theme.d.ts +42 -0
  168. package/dist/foundations/theme.js +88 -0
  169. package/dist/foundations/types.d.ts +23 -0
  170. package/dist/foundations/types.js +50 -0
  171. package/dist/foundations/variants.d.ts +19 -0
  172. package/dist/foundations/variants.js +48 -0
  173. package/dist/foundations/xlsx.d.ts +86 -0
  174. package/dist/foundations/xlsx.js +0 -0
  175. package/dist/index.d.ts +19 -0
  176. package/dist/index.js +19 -0
  177. package/dist/primitives/block/Block.d.ts +66 -0
  178. package/dist/primitives/block/Block.js +34 -0
  179. package/dist/primitives/block/Line.d.ts +18 -0
  180. package/dist/primitives/block/Line.js +45 -0
  181. package/dist/primitives/block/SectionGrid.d.ts +30 -0
  182. package/dist/primitives/block/SectionGrid.js +29 -0
  183. package/dist/primitives/block/Steps.d.ts +76 -0
  184. package/dist/primitives/block/Steps.js +43 -0
  185. package/dist/primitives/block/index.d.ts +4 -0
  186. package/dist/primitives/block/index.js +7 -0
  187. package/dist/primitives/button/Button.d.ts +137 -0
  188. package/dist/primitives/button/Button.js +234 -0
  189. package/dist/primitives/button/index.d.ts +1 -0
  190. package/dist/primitives/button/index.js +2 -0
  191. package/dist/primitives/cell/CellStack.d.ts +47 -0
  192. package/dist/primitives/cell/CellStack.js +33 -0
  193. package/dist/primitives/cell/index.d.ts +1 -0
  194. package/dist/primitives/cell/index.js +3 -0
  195. package/dist/primitives/choice/ComboBox.d.ts +19 -0
  196. package/dist/primitives/choice/ComboBox.js +52 -0
  197. package/dist/primitives/choice/RadioGroup.d.ts +18 -0
  198. package/dist/primitives/choice/RadioGroup.js +50 -0
  199. package/dist/primitives/choice/SearchField.d.ts +33 -0
  200. package/dist/primitives/choice/SearchField.js +46 -0
  201. package/dist/primitives/choice/SegmentedControl.d.ts +16 -0
  202. package/dist/primitives/choice/SegmentedControl.js +69 -0
  203. package/dist/primitives/choice/Slider.d.ts +16 -0
  204. package/dist/primitives/choice/Slider.js +46 -0
  205. package/dist/primitives/choice/Switch.d.ts +14 -0
  206. package/dist/primitives/choice/Switch.js +65 -0
  207. package/dist/primitives/choice/ThemeSwitcher.d.ts +10 -0
  208. package/dist/primitives/choice/ThemeSwitcher.js +25 -0
  209. package/dist/primitives/choice/index.d.ts +8 -0
  210. package/dist/primitives/choice/index.js +11 -0
  211. package/dist/primitives/choice/options.d.ts +28 -0
  212. package/dist/primitives/choice/options.js +6 -0
  213. package/dist/primitives/date/Calendar.d.ts +31 -0
  214. package/dist/primitives/date/Calendar.js +134 -0
  215. package/dist/primitives/date/DatePicker.d.ts +42 -0
  216. package/dist/primitives/date/DatePicker.js +103 -0
  217. package/dist/primitives/date/DateTime.d.ts +35 -0
  218. package/dist/primitives/date/DateTime.js +100 -0
  219. package/dist/primitives/date/index.d.ts +3 -0
  220. package/dist/primitives/date/index.js +6 -0
  221. package/dist/primitives/dialog/Dialog.d.ts +118 -0
  222. package/dist/primitives/dialog/Dialog.js +121 -0
  223. package/dist/primitives/dialog/Drill.d.ts +90 -0
  224. package/dist/primitives/dialog/Drill.js +172 -0
  225. package/dist/primitives/dialog/index.d.ts +2 -0
  226. package/dist/primitives/dialog/index.js +4 -0
  227. package/dist/primitives/disclosure/Disclosure.d.ts +36 -0
  228. package/dist/primitives/disclosure/Disclosure.js +52 -0
  229. package/dist/primitives/disclosure/index.d.ts +1 -0
  230. package/dist/primitives/disclosure/index.js +2 -0
  231. package/dist/primitives/field/Checks.d.ts +57 -0
  232. package/dist/primitives/field/Checks.js +72 -0
  233. package/dist/primitives/field/DropZone.d.ts +42 -0
  234. package/dist/primitives/field/DropZone.js +52 -0
  235. package/dist/primitives/field/Field.d.ts +178 -0
  236. package/dist/primitives/field/Field.js +251 -0
  237. package/dist/primitives/field/Suggest.d.ts +48 -0
  238. package/dist/primitives/field/Suggest.js +43 -0
  239. package/dist/primitives/field/aria.d.ts +61 -0
  240. package/dist/primitives/field/aria.js +70 -0
  241. package/dist/primitives/field/context.d.ts +30 -0
  242. package/dist/primitives/field/context.js +13 -0
  243. package/dist/primitives/field/copy.d.ts +16 -0
  244. package/dist/primitives/field/copy.js +69 -0
  245. package/dist/primitives/field/index.d.ts +9 -0
  246. package/dist/primitives/field/index.js +15 -0
  247. package/dist/primitives/field/layout.d.ts +24 -0
  248. package/dist/primitives/field/layout.js +10 -0
  249. package/dist/primitives/field/mode.d.ts +9 -0
  250. package/dist/primitives/field/mode.js +13 -0
  251. package/dist/primitives/field/note.d.ts +55 -0
  252. package/dist/primitives/field/note.js +117 -0
  253. package/dist/primitives/hint/Hint.d.ts +31 -0
  254. package/dist/primitives/hint/Hint.js +42 -0
  255. package/dist/primitives/hint/index.d.ts +1 -0
  256. package/dist/primitives/hint/index.js +1 -0
  257. package/dist/primitives/index.d.ts +20 -0
  258. package/dist/primitives/index.js +21 -0
  259. package/dist/primitives/menu/Menu.d.ts +128 -0
  260. package/dist/primitives/menu/Menu.js +89 -0
  261. package/dist/primitives/menu/index.d.ts +1 -0
  262. package/dist/primitives/menu/index.js +2 -0
  263. package/dist/primitives/notice/Callout.d.ts +49 -0
  264. package/dist/primitives/notice/Callout.js +28 -0
  265. package/dist/primitives/notice/Flag.d.ts +13 -0
  266. package/dist/primitives/notice/Flag.js +31 -0
  267. package/dist/primitives/notice/Notice.d.ts +45 -0
  268. package/dist/primitives/notice/Notice.js +61 -0
  269. package/dist/primitives/notice/Toast.d.ts +55 -0
  270. package/dist/primitives/notice/Toast.js +142 -0
  271. package/dist/primitives/notice/index.d.ts +4 -0
  272. package/dist/primitives/notice/index.js +6 -0
  273. package/dist/primitives/overlay/Popover.d.ts +6 -0
  274. package/dist/primitives/overlay/Popover.js +27 -0
  275. package/dist/primitives/overlay/PopoverTrigger.d.ts +55 -0
  276. package/dist/primitives/overlay/PopoverTrigger.js +38 -0
  277. package/dist/primitives/overlay/Preview.d.ts +19 -0
  278. package/dist/primitives/overlay/Preview.js +60 -0
  279. package/dist/primitives/overlay/Tooltip.d.ts +38 -0
  280. package/dist/primitives/overlay/Tooltip.js +74 -0
  281. package/dist/primitives/overlay/index.d.ts +4 -0
  282. package/dist/primitives/overlay/index.js +7 -0
  283. package/dist/primitives/picker/Picker.d.ts +89 -0
  284. package/dist/primitives/picker/Picker.js +204 -0
  285. package/dist/primitives/picker/index.d.ts +1 -0
  286. package/dist/primitives/picker/index.js +2 -0
  287. package/dist/primitives/surface/Peek.d.ts +60 -0
  288. package/dist/primitives/surface/Peek.js +71 -0
  289. package/dist/primitives/surface/index.d.ts +1 -0
  290. package/dist/primitives/surface/index.js +2 -0
  291. package/dist/primitives/table/CellCopy.d.ts +20 -0
  292. package/dist/primitives/table/CellCopy.js +23 -0
  293. package/dist/primitives/table/CellEditor.d.ts +14 -0
  294. package/dist/primitives/table/CellEditor.js +83 -0
  295. package/dist/primitives/table/DataTable.d.ts +189 -0
  296. package/dist/primitives/table/DataTable.js +330 -0
  297. package/dist/primitives/table/EditableTable.d.ts +191 -0
  298. package/dist/primitives/table/EditableTable.js +617 -0
  299. package/dist/primitives/table/PivotTable.d.ts +14 -0
  300. package/dist/primitives/table/PivotTable.js +0 -0
  301. package/dist/primitives/table/ReportTable.d.ts +38 -0
  302. package/dist/primitives/table/ReportTable.js +106 -0
  303. package/dist/primitives/table/RowActions.d.ts +16 -0
  304. package/dist/primitives/table/RowActions.js +28 -0
  305. package/dist/primitives/table/SheetTable.d.ts +73 -0
  306. package/dist/primitives/table/SheetTable.js +230 -0
  307. package/dist/primitives/table/Table.d.ts +106 -0
  308. package/dist/primitives/table/Table.js +116 -0
  309. package/dist/primitives/table/index.d.ts +7 -0
  310. package/dist/primitives/table/index.js +9 -0
  311. package/dist/primitives/tabs/Tabs.d.ts +91 -0
  312. package/dist/primitives/tabs/Tabs.js +56 -0
  313. package/dist/primitives/tabs/index.d.ts +1 -0
  314. package/dist/primitives/tabs/index.js +1 -0
  315. package/dist/primitives/tag/Tag.d.ts +36 -0
  316. package/dist/primitives/tag/Tag.js +68 -0
  317. package/dist/primitives/tag/Tags.d.ts +57 -0
  318. package/dist/primitives/tag/Tags.js +104 -0
  319. package/dist/primitives/tag/TagsField.d.ts +35 -0
  320. package/dist/primitives/tag/TagsField.js +186 -0
  321. package/dist/primitives/tag/choices.d.ts +38 -0
  322. package/dist/primitives/tag/choices.js +26 -0
  323. package/dist/primitives/tag/index.d.ts +4 -0
  324. package/dist/primitives/tag/index.js +8 -0
  325. package/dist/primitives/toolbar/Toolbar.d.ts +13 -0
  326. package/dist/primitives/toolbar/Toolbar.js +36 -0
  327. package/dist/primitives/toolbar/index.d.ts +1 -0
  328. package/dist/primitives/toolbar/index.js +2 -0
  329. package/dist/primitives/tree/Tree.d.ts +56 -0
  330. package/dist/primitives/tree/Tree.js +74 -0
  331. package/dist/primitives/tree/index.d.ts +1 -0
  332. package/dist/primitives/tree/index.js +3 -0
  333. package/dist/primitives/value/Copyable.d.ts +48 -0
  334. package/dist/primitives/value/Copyable.js +71 -0
  335. package/dist/primitives/value/Fecha.d.ts +12 -0
  336. package/dist/primitives/value/Fecha.js +89 -0
  337. package/dist/primitives/value/Meter.d.ts +29 -0
  338. package/dist/primitives/value/Meter.js +46 -0
  339. package/dist/primitives/value/Metric.d.ts +42 -0
  340. package/dist/primitives/value/Metric.js +38 -0
  341. package/dist/primitives/value/Person.d.ts +90 -0
  342. package/dist/primitives/value/Person.js +208 -0
  343. package/dist/primitives/value/ProgressBar.d.ts +31 -0
  344. package/dist/primitives/value/ProgressBar.js +53 -0
  345. package/dist/primitives/value/Relation.d.ts +74 -0
  346. package/dist/primitives/value/Relation.js +74 -0
  347. package/dist/primitives/value/Totals.d.ts +121 -0
  348. package/dist/primitives/value/Totals.js +54 -0
  349. package/dist/primitives/value/Value.d.ts +40 -0
  350. package/dist/primitives/value/Value.js +80 -0
  351. package/dist/primitives/value/index.d.ts +9 -0
  352. package/dist/primitives/value/index.js +10 -0
  353. package/dist/tokens.css +1062 -0
  354. package/dist/views/index.d.ts +2 -0
  355. package/dist/views/index.js +3 -0
  356. package/dist/views/list/List.d.ts +119 -0
  357. package/dist/views/list/List.js +101 -0
  358. package/dist/views/list/ListView.d.ts +6 -0
  359. package/dist/views/list/ListView.js +295 -0
  360. package/dist/views/list/columns.d.ts +18 -0
  361. package/dist/views/list/columns.js +27 -0
  362. package/dist/views/list/derive.d.ts +87 -0
  363. package/dist/views/list/derive.js +207 -0
  364. package/dist/views/list/index.d.ts +2 -0
  365. package/dist/views/list/index.js +4 -0
  366. package/dist/views/list/presentations.d.ts +39 -0
  367. package/dist/views/list/presentations.js +105 -0
  368. package/dist/views/list/types.d.ts +284 -0
  369. package/dist/views/list/types.js +1 -0
  370. package/dist/views/list/useNarrowList.d.ts +17 -0
  371. package/dist/views/list/useNarrowList.js +32 -0
  372. package/dist/views/record/Record.d.ts +145 -0
  373. package/dist/views/record/Record.js +211 -0
  374. package/dist/views/record/index.d.ts +1 -0
  375. package/dist/views/record/index.js +2 -0
  376. package/package.json +113 -4
@@ -0,0 +1,74 @@
1
+ import type { Tone } from "../../foundations/types.js";
2
+ import { type FormMode } from "../field/mode.js";
3
+ import type { LucideIcon } from "lucide-react";
4
+ import { type ReactNode } from "react";
5
+ /** What the floating summary of the related record says. */
6
+ export type RelationSummary = {
7
+ /** The title of the card. The relation's name when absent. */
8
+ title?: string;
9
+ /** The state of the related record — «al día», «con deuda». */
10
+ tag?: {
11
+ label: string;
12
+ tone?: Tone;
13
+ };
14
+ /** Two to four facts that answer the usual question about it: the debt, the credit
15
+ * limit, the city, the phone. More is a record, not a summary. */
16
+ facts?: readonly {
17
+ label: string;
18
+ value: ReactNode;
19
+ }[];
20
+ };
21
+ type RelationMedia = {
22
+ src?: string;
23
+ alt?: string;
24
+ icon?: LucideIcon;
25
+ };
26
+ export type RelationCardProps = {
27
+ name: string;
28
+ secondary?: ReactNode;
29
+ media?: RelationMedia;
30
+ summary?: RelationSummary;
31
+ /** «Abrir»: go to the related record. */
32
+ onOpen?: () => void;
33
+ /** The record's address, when it has one: «Abrir» becomes a real link. */
34
+ href?: string;
35
+ };
36
+ /**
37
+ * The summary of a related record: picture, title, its tag, a handful of facts and «Abrir».
38
+ *
39
+ * Context: it answers the question a person has about the customer of an invoice without
40
+ * leaving the invoice — «does it owe us?», «what is its NIT?» — and, when the answer is
41
+ * «I need more», one press takes them to the record. It is what floats from a
42
+ * `RelationValue`, and it is exported on its own for a side panel.
43
+ */
44
+ export declare function RelationCard({ name, secondary, media, summary, onOpen, href, }: RelationCardProps): import("react").JSX.Element;
45
+ export type RelationValueProps = {
46
+ /** The related record's name. Empty, `null` or absent = no record: said, in muted. */
47
+ name?: string | null;
48
+ /** What tells it apart: a NIT, a code, a city. Small and quiet, under the name. */
49
+ secondary?: ReactNode;
50
+ /** Its picture or icon, on the left. */
51
+ media?: RelationMedia;
52
+ /** Go to the related record. The name becomes a link. */
53
+ onOpen?: () => void;
54
+ /** The related record's address: the name becomes a real `<a>` (middle-click, copy). */
55
+ href?: string;
56
+ /** Present = an info button next to the name opens the `RelationCard`. */
57
+ summary?: RelationSummary;
58
+ /** Floats the summary from the NAME on hover, focus or long press, instead of from the
59
+ * info button. `true` = the `RelationCard` (with `summary` when given); a node = that
60
+ * content instead — the product of a line, a consumer's own card. Needs the name to be a
61
+ * link (`href` or `onOpen`); without one the content opens from the info button. */
62
+ preview?: boolean | ReactNode;
63
+ /** The control that EDITS this relation — a `Picker` — drawn instead in edit mode. */
64
+ editor?: ReactNode;
65
+ /** Forces the mode; by default the form's. Only matters with `editor`. */
66
+ mode?: FormMode;
67
+ };
68
+ /**
69
+ * A many2one as a value: the related record's name as a link, with its secondary line and
70
+ * picture, and its summary one press away. Works in a table cell, a list row, a `Record.Facts`
71
+ * value and a form field (read mode; pass the `Picker` as `editor` for edit mode).
72
+ */
73
+ export declare function RelationValue({ name, secondary, media, onOpen, href, summary, preview, editor, mode, }: RelationValueProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
74
+ export {};
@@ -0,0 +1,74 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { fillCopy, useUiCopy } from "../../foundations/copy.js";
4
+ import { cn, focusRing } from "../../foundations/variants.js";
5
+ import { Button, ButtonLink, IconButton } from "../button/Button.js";
6
+ import { CellStack, Thumb } from "../cell/CellStack.js";
7
+ import { FieldIdsContext } from "../field/context.js";
8
+ import { useFormMode } from "../field/mode.js";
9
+ import { PopoverTrigger } from "../overlay/PopoverTrigger.js";
10
+ import { Preview } from "../overlay/Preview.js";
11
+ import { Tag } from "../tag/Tag.js";
12
+ import { ArrowRight, Info } from "lucide-react";
13
+ import { useContext } from "react";
14
+ import { Link } from "react-aria-components";
15
+ /**
16
+ * The summary of a related record: picture, title, its tag, a handful of facts and «Abrir».
17
+ *
18
+ * Context: it answers the question a person has about the customer of an invoice without
19
+ * leaving the invoice — «does it owe us?», «what is its NIT?» — and, when the answer is
20
+ * «I need more», one press takes them to the record. It is what floats from a
21
+ * `RelationValue`, and it is exported on its own for a side panel.
22
+ */
23
+ export function RelationCard({ name, secondary, media, summary = {}, onOpen, href, }) {
24
+ const copy = useUiCopy();
25
+ const title = summary.title ?? name;
26
+ return (
27
+ /* React events bubble through the popover's portal to the React parents of the link —
28
+ a table row that opens on click among them. A click inside the card stays here. */
29
+ _jsxs("div", { className: "flex w-72 max-w-full flex-col gap-3", onClick: (e) => e.stopPropagation(), children: [_jsxs("div", { className: "flex min-w-0 items-start gap-3", children: [media === undefined ? null : (_jsx(Thumb, { size: "lg", ...(media.src === undefined ? {} : { src: media.src }), ...(media.alt === undefined ? {} : { alt: media.alt }), ...(media.icon === undefined ? {} : { icon: media.icon }) })), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [_jsx("span", { className: "text-lead leading-tight font-semibold text-ink", children: title }), secondary === undefined ? null : (_jsx("span", { className: "truncate text-micro tabular-nums text-muted", children: secondary })), summary.tag === undefined ? null : (_jsx("span", { className: "flex", children: _jsx(Tag, { tone: summary.tag.tone ?? "neutral", children: summary.tag.label }) }))] })] }), summary.facts === undefined || summary.facts.length === 0 ? null : (_jsx("dl", { className: "grid grid-cols-2 gap-x-4 gap-y-2 border-t border-line pt-3", children: summary.facts.map((fact) => (_jsxs("div", { className: "flex min-w-0 flex-col", children: [_jsx("dt", { className: "truncate text-micro text-muted", children: fact.label }), _jsx("dd", { className: "truncate text-meta tabular-nums text-ink", children: fact.value })] }, fact.label))) })), href !== undefined ? (_jsx("div", { className: "flex justify-end border-t border-line pt-2", children: _jsx(ButtonLink, { href: href, role: "ghost", size: "sm", icon: ArrowRight, ...(onOpen === undefined ? {} : { onClick: onOpen }), children: copy.relation.open }) })) : onOpen !== undefined ? (_jsx("div", { className: "flex justify-end border-t border-line pt-2", children: _jsx(Button, { role: "ghost", size: "sm", icon: ArrowRight, onClick: onOpen, children: copy.relation.open }) })) : null] }));
30
+ }
31
+ /**
32
+ * A many2one as a value: the related record's name as a link, with its secondary line and
33
+ * picture, and its summary one press away. Works in a table cell, a list row, a `Record.Facts`
34
+ * value and a form field (read mode; pass the `Picker` as `editor` for edit mode).
35
+ */
36
+ export function RelationValue({ name, secondary, media, onOpen, href, summary, preview, editor, mode, }) {
37
+ const copy = useUiCopy();
38
+ const formMode = useFormMode(mode);
39
+ /* Inside a `Field` the value takes the control's height, so a form that goes from
40
+ editing to reading does not move (the same rule as `ReadValue`). */
41
+ const inField = useContext(FieldIdsContext) !== null;
42
+ if (editor !== undefined && formMode === "edit")
43
+ return _jsx(_Fragment, { children: editor });
44
+ const frame = (child) => inField ? (_jsx("span", { className: "flex min-h-(--size-control-md) min-w-0 items-center", children: child })) : (child);
45
+ if (name === undefined || name === null || name === "") {
46
+ return frame(_jsx("span", { className: "text-meta text-muted italic", children: copy.relation.none }));
47
+ }
48
+ const goes = href !== undefined || onOpen !== undefined;
49
+ const summaryLabel = fillCopy(copy.relationCard.summary, { name });
50
+ const card = (open) => (_jsx(RelationCard, { name: name, ...(summary === undefined ? {} : { summary }), ...(secondary === undefined ? {} : { secondary }), ...(media === undefined ? {} : { media }), ...(href === undefined ? {} : { href }), ...(open === undefined ? {} : { onOpen: open }) }));
51
+ /* What floats from the name: the card, or the consumer's own content. */
52
+ const previewed = preview === undefined || preview === null || preview === false
53
+ ? undefined
54
+ : preview === true
55
+ ? card(onOpen)
56
+ : preview;
57
+ const link = goes ? (_jsx(Link, { ...(href === undefined ? {} : { href }), ...(onOpen === undefined ? {} : { onPress: onOpen }), className: ({ isFocusVisible }) => cn("cursor-pointer rounded-mark text-primary no-underline underline-offset-2 hover:underline", focusRing({ isFocusVisible })), children: name })) : undefined;
58
+ const primary = link === undefined ? (name) : previewed === undefined ? (link) : (_jsx(Preview, { trigger: link, label: summaryLabel, children: previewed }));
59
+ /* The `i`: the summary when there is no preview on the name; the preview's content when
60
+ there is no link for it to ride on. */
61
+ const info = previewed !== undefined
62
+ ? goes
63
+ ? undefined
64
+ : () => previewed
65
+ : summary === undefined
66
+ ? undefined
67
+ : (close) => card(onOpen === undefined
68
+ ? undefined
69
+ : () => {
70
+ close();
71
+ onOpen();
72
+ });
73
+ return frame(_jsxs("span", { className: "inline-flex max-w-full min-w-0 items-center gap-1", children: [_jsx(CellStack, { primary: primary, ...(secondary === undefined ? {} : { secondary }), ...(media === undefined ? {} : { media }) }), info === undefined ? null : (_jsx(PopoverTrigger, { label: summaryLabel, trigger: _jsx(IconButton, { icon: Info, label: summaryLabel, size: "sm" }), children: info }))] }));
74
+ }
@@ -0,0 +1,121 @@
1
+ import { type ReactNode } from "react";
2
+ /**
3
+ * The money summary of a document — subtotal, taxes, discounts and the TOTAL — under its
4
+ * lines, aligned to the right. And, once the document starts being settled, what was already
5
+ * taken off it, what is still owed, and what could still be taken off.
6
+ *
7
+ * Context: written as two more rows of the lines table, «IVA» and «Total» were the same size
8
+ * and weight as a product line, and the one number the document exists for had to be found.
9
+ * Every invoice people have ever read puts the summary apart, on the right, with the total
10
+ * last and largest: following that convention is reading the document the way it is already
11
+ * read (Jakob's law).
12
+ *
13
+ * Labels left and figures right of a narrow column, both in tabular figures, so the amounts
14
+ * line up digit by digit. The `total` row closes the breakdown: a rule above it.
15
+ *
16
+ * ── Deductions, balance and credits: one block, not three ────────────
17
+ *
18
+ * A posted invoice is read as one sum: the total, minus each payment, gives what is owed. Drawn
19
+ * as a second component under this one, the payments would be a second column of figures that
20
+ * the screen has to line up with the first by hand — which a template cannot do without
21
+ * styling — and the decision below, WHICH figure leads, needs to see the three at once. So it
22
+ * is this block, extended, and a block with only `rows` draws exactly what it drew before.
23
+ *
24
+ * It still does not know what an invoice is. It speaks of `deductions` (a payment, a credit
25
+ * note, a retention: anything already applied against the total), a `balance` (what remains
26
+ * after them), `settled` (the word for «nothing remains»: «Pagada», «Conciliado») and
27
+ * `credits` (what could still be applied). The domain formats the money and owns the actions;
28
+ * this only lays them out and names them.
29
+ *
30
+ * ── The figure that leads moves with the state ───────────────────────
31
+ *
32
+ * There is ONE figure at the title size, and which one it is depends on where the document is:
33
+ *
34
+ * nothing applied yet (a draft, a posted invoice) the total
35
+ * something applied, something owed the balance — the total steps down
36
+ * settled the total, with the `settled` mark
37
+ *
38
+ * Once a payment is in, the question the person brings is «how much is left?», and a total
39
+ * at the title size next to a balance at the body size answers the wrong question first.
40
+ * That is the default; `lead` says it explicitly when the screen knows better.
41
+ *
42
+ * ── A deduction is HEARD as one: «Pagado el 12/10/2026, menos Bs. 1.000,00» ──
43
+ *
44
+ * The amount arrives formatted and WITHOUT a sign; the block writes the minus. The visible
45
+ * «−» is hidden from assistive technology — screen readers skip it or say «dash» — and a
46
+ * visually hidden «menos» (`copy.totals.less`) is read in its place, so the label and the
47
+ * figure are one sentence and not two loose numbers.
48
+ *
49
+ * ── The detail of a deduction: an `i`, asked for ─────────────────────
50
+ *
51
+ * Where it came from (journal, reference, method), going to it, and unlinking it open from an
52
+ * `i` before the label — `PopoverTrigger`, the same `i` a `RelationValue` uses for its
53
+ * summary. Not a `Preview` on hover: the card holds an action that changes the document
54
+ * («Desvincular»), and that is asked for with a press, which the mouse, the keyboard and the
55
+ * finger all have. The `i` sits BEFORE the label so the label and its amount stay together
56
+ * in the reading order.
57
+ *
58
+ * ── None of these actions is the primary ─────────────────────────────
59
+ *
60
+ * The screen's one primary is somewhere else («Registrar pago», «Confirmar»). Unlinking is
61
+ * `secondary` and not `danger`: it does not destroy — the payment comes back as a credit and
62
+ * is applied again with one press, which is the undo. «Aplicar» and «Abrir» are `ghost`.
63
+ */
64
+ export type TotalsRow = {
65
+ label: ReactNode;
66
+ value: ReactNode;
67
+ /** A note under the label — «incluido en el precio», «sobre Bs. 3.601,80». */
68
+ detail?: ReactNode;
69
+ /** The row that closes the breakdown. Usually one, and last. */
70
+ total?: boolean;
71
+ };
72
+ /** A fact of a deduction's detail: «Diario · Banco BNB», «Referencia · TRF-88213». */
73
+ export type TotalsFact = {
74
+ label: string;
75
+ value: ReactNode;
76
+ };
77
+ /** Something already applied against the total: a payment, a credit note, a retention. */
78
+ export type TotalsDeduction = {
79
+ /** What it is, as one phrase — «Pagado el 12/10/2026». A string: it also names the `i`
80
+ * and the floating detail. */
81
+ label: string;
82
+ /** The amount taken off, formatted and WITHOUT a sign: the block writes the minus. */
83
+ value: ReactNode;
84
+ /** A quiet note under the label — «Transferencia · Banco BNB». */
85
+ detail?: ReactNode;
86
+ /** What the `i` shows: two to five facts — journal, reference, method. */
87
+ facts?: readonly TotalsFact[];
88
+ /** Go to the applied record. The detail shows «Abrir». */
89
+ onOpen?: () => void;
90
+ /** Undo the application — «Desvincular». Present = allowed; absent = not offered. */
91
+ onRemove?: () => void;
92
+ };
93
+ /** Something that COULD be applied and is not yet: an unused credit of the same party. */
94
+ export type TotalsCredit = {
95
+ /** What it is — «NC/2026/0012». A string: it also names its «Aplicar». */
96
+ label: string;
97
+ /** The amount available, formatted. */
98
+ value: ReactNode;
99
+ /** A quiet note — «del 02/10/2026», «anticipo». */
100
+ detail?: ReactNode;
101
+ onApply: () => void;
102
+ };
103
+ export type TotalsProps = {
104
+ /** The breakdown and its `total`: subtotal, each tax group, discounts, TOTAL. */
105
+ rows: readonly TotalsRow[];
106
+ /** What was already applied against the total, one row each, after it. */
107
+ deductions?: readonly TotalsDeduction[];
108
+ /** What remains once the deductions are taken off — «Importe adeudado». */
109
+ balance?: Omit<TotalsRow, "total">;
110
+ /** Nothing remains: the word for it, drawn as a mark next to the leading figure —
111
+ * «Pagada». */
112
+ settled?: string;
113
+ /** Which figure leads, at the title size. By default the balance when something was
114
+ * deducted and the document is not settled; otherwise the total. */
115
+ lead?: "total" | "balance";
116
+ /** What could still be applied, apart and under the sum: it is not part of it. */
117
+ credits?: readonly TotalsCredit[];
118
+ /** The title of the credits. `copy.totals.credits` by default. */
119
+ creditsLabel?: string;
120
+ };
121
+ export declare function Totals({ rows, deductions, balance, settled, lead, credits, creditsLabel, }: TotalsProps): import("react").JSX.Element;
@@ -0,0 +1,54 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { fillCopy, useUiCopy } from "../../foundations/copy.js";
4
+ import { Button, IconButton } from "../button/Button.js";
5
+ import { PopoverTrigger } from "../overlay/PopoverTrigger.js";
6
+ import { Tag } from "../tag/Tag.js";
7
+ import { ArrowRight, Info, Plus, Unlink } from "lucide-react";
8
+ import { useId } from "react";
9
+ /** The figure the block exists for: a rule above it and the figure at the title size. The
10
+ * `data-lead` marks it for the tests and for whoever reads the DOM. */
11
+ function LeadRow({ row, mark }) {
12
+ return (_jsxs("div", { "data-lead": "", className: "mt-1 flex flex-wrap items-baseline justify-between gap-x-4 border-t border-line-strong pt-2.5", children: [_jsxs("dt", { className: "flex min-w-0 flex-col", children: [_jsxs("span", { className: "flex flex-wrap items-center gap-2 text-body font-semibold text-ink", children: [row.label, mark === undefined ? null : _jsx(Tag, { tone: "good", children: mark })] }), row.detail === undefined ? null : (_jsx("span", { className: "text-micro text-muted", children: row.detail }))] }), _jsx("dd", { className: "ml-auto text-title font-semibold whitespace-nowrap tabular-nums text-ink", children: row.value })] }));
13
+ }
14
+ /** A figure that closes a part of the sum without leading it: the total once the balance
15
+ * leads, or the balance while the total does. Ruled, in the body size. */
16
+ function ClosingRow({ row }) {
17
+ return (_jsxs("div", { className: "mt-1 flex flex-wrap items-baseline justify-between gap-x-4 border-t border-line pt-2", children: [_jsxs("dt", { className: "flex min-w-0 flex-col", children: [_jsx("span", { className: "text-body font-semibold text-ink", children: row.label }), row.detail === undefined ? null : (_jsx("span", { className: "text-micro text-muted", children: row.detail }))] }), _jsx("dd", { className: "ml-auto text-body font-semibold whitespace-nowrap tabular-nums text-ink", children: row.value })] }));
18
+ }
19
+ function PlainRow({ row }) {
20
+ return (_jsxs("div", { className: "flex items-baseline justify-between gap-4", children: [_jsxs("dt", { className: "flex min-w-0 flex-col text-meta text-muted", children: [row.label, row.detail === undefined ? null : (_jsx("span", { className: "text-micro text-muted", children: row.detail }))] }), _jsx("dd", { className: "text-meta whitespace-nowrap tabular-nums text-ink", children: row.value })] }));
21
+ }
22
+ /** What floats from a deduction's `i`: its facts and, when allowed, «Desvincular» and
23
+ * «Abrir». Both close the card first — the row may be gone once the action runs. */
24
+ function DeductionDetail({ item, close }) {
25
+ const copy = useUiCopy();
26
+ const facts = item.facts ?? [];
27
+ const run = (action) => () => {
28
+ close();
29
+ action();
30
+ };
31
+ return (_jsxs("div", { className: "flex w-64 max-w-full flex-col gap-3", children: [facts.length === 0 ? null : (_jsx("dl", { className: "grid grid-cols-2 gap-x-4 gap-y-2", children: facts.map((fact) => (_jsxs("div", { className: "flex min-w-0 flex-col", children: [_jsx("dt", { className: "truncate text-micro text-muted", children: fact.label }), _jsx("dd", { className: "text-meta tabular-nums break-words text-ink", children: fact.value })] }, fact.label))) })), item.onRemove === undefined && item.onOpen === undefined ? null : (_jsxs("div", { className: "flex flex-wrap justify-end gap-2 border-t border-line pt-2", children: [item.onRemove === undefined ? null : (_jsx(Button, { role: "secondary", size: "sm", icon: Unlink, onClick: run(item.onRemove), children: copy.totals.unlink })), item.onOpen === undefined ? null : (_jsx(Button, { role: "ghost", size: "sm", icon: ArrowRight, onClick: run(item.onOpen), children: copy.totals.open }))] }))] }));
32
+ }
33
+ function DeductionRow({ item }) {
34
+ const copy = useUiCopy();
35
+ const asks = (item.facts !== undefined && item.facts.length > 0) ||
36
+ item.onRemove !== undefined ||
37
+ item.onOpen !== undefined;
38
+ return (_jsxs("div", { className: "flex items-baseline justify-between gap-4", children: [_jsxs("dt", { className: "flex min-w-0 items-baseline gap-1 text-meta text-muted", children: [asks ? (_jsx(PopoverTrigger, { title: item.label, placement: "bottom end", trigger: _jsx(IconButton, { icon: Info, label: fillCopy(copy.totals.details, { label: item.label }) }), children: (close) => _jsx(DeductionDetail, { item: item, close: close }) })) : null, _jsxs("span", { className: "flex min-w-0 flex-col", children: [item.label, item.detail === undefined ? null : (_jsx("span", { className: "text-micro text-muted", children: item.detail }))] })] }), _jsxs("dd", { className: "text-meta whitespace-nowrap tabular-nums text-ink", children: [_jsx("span", { "aria-hidden": true, children: "− " }), _jsxs("span", { className: "sr-only", children: [copy.totals.less, " "] }), item.value] })] }));
39
+ }
40
+ function Credits({ items, label }) {
41
+ const copy = useUiCopy();
42
+ const id = useId();
43
+ return (_jsxs("div", { className: "flex flex-col gap-1.5 border-t border-line pt-3", children: [_jsx("p", { id: id, className: "text-micro font-semibold text-muted", children: label }), _jsx("ul", { "aria-labelledby": id, className: "flex flex-col gap-1", children: items.map((credit, i) => (_jsxs("li", { className: "flex flex-wrap items-center justify-between gap-x-3 gap-y-1", children: [_jsxs("span", { className: "flex min-w-0 flex-col", children: [_jsx("span", { className: "text-meta text-ink", children: credit.label }), credit.detail === undefined ? null : (_jsx("span", { className: "text-micro text-muted", children: credit.detail }))] }), _jsxs("span", { className: "ml-auto flex shrink-0 items-center gap-2", children: [_jsx("span", { className: "text-meta whitespace-nowrap tabular-nums text-ink", children: credit.value }), _jsx(Button, { role: "ghost", size: "sm", icon: Plus, "aria-label": fillCopy(copy.totals.applyCredit, { label: credit.label }), onClick: credit.onApply, children: copy.totals.apply })] })] }, i))) })] }));
44
+ }
45
+ export function Totals({ rows, deductions = [], balance, settled, lead, credits = [], creditsLabel, }) {
46
+ const copy = useUiCopy();
47
+ const leads = lead ??
48
+ (balance !== undefined && deductions.length > 0 && settled === undefined
49
+ ? "balance"
50
+ : "total");
51
+ /* With nothing to lead it, the balance cannot lead: the total keeps the title size. */
52
+ const balanceLeads = leads === "balance" && balance !== undefined;
53
+ return (_jsxs("div", { className: "ml-auto flex w-full max-w-(--container-search) flex-col gap-3", children: [_jsxs("dl", { className: "flex flex-col gap-1.5", children: [rows.map((row, i) => row.total === true ? (balanceLeads ? (_jsx(ClosingRow, { row: row }, i)) : (_jsx(LeadRow, { row: row, ...(settled === undefined ? {} : { mark: settled }) }, i))) : (_jsx(PlainRow, { row: row }, i))), deductions.map((item, i) => (_jsx(DeductionRow, { item: item }, i))), balance === undefined ? null : balanceLeads ? (_jsx(LeadRow, { row: balance, ...(settled === undefined ? {} : { mark: settled }) })) : (_jsx(ClosingRow, { row: balance }))] }), credits.length === 0 ? null : (_jsx(Credits, { items: credits, label: creditsLabel ?? copy.totals.credits }))] }));
54
+ }
@@ -0,0 +1,40 @@
1
+ import type { ReactNode } from "react";
2
+ export declare const formatCount: (value: number, locale?: string) => string;
3
+ export declare const formatNumber: (value: number, locale?: string) => string;
4
+ export declare const formatDistance: (value: number, locale?: string) => string;
5
+ /** A label with its number, for the glance at the top of a view. */
6
+ export declare function KeyValue({ label, value }: {
7
+ label: string;
8
+ value: ReactNode;
9
+ }): import("react").JSX.Element;
10
+ /**
11
+ * A number with its unit: right aligned, with tabular figures.
12
+ *
13
+ * Context: this is the detail a table's look depends on. Tabular figures give every digit
14
+ * the same width, so `32.561` lines up across rows exactly as it did in monospace — without
15
+ * making a business report look like a terminal. The unit stays in the same face so the
16
+ * digits keep their column.
17
+ */
18
+ export declare function Numeric({ value, unit, format, }: {
19
+ value: number;
20
+ unit?: string;
21
+ format?: "integer" | "decimal" | "distance";
22
+ }): import("react").JSX.Element;
23
+ /**
24
+ * The content of a data cell, with what the system decides and the view does not.
25
+ *
26
+ * Context: `""` is a TRULY EMPTY cell and not a missing datum — they are two
27
+ * different things and the engine tells them apart, so the interface does too. A
28
+ * missing one is passed as `null` and drawn with its mark; an empty string is a
29
+ * value somebody typed, and it gets one too.
30
+ *
31
+ * It used to live in the application, where it couldn't serve the other five
32
+ * tables.
33
+ */
34
+ export declare function Cell({ value,
35
+ /** From how many characters it gets truncated. A 64 character identifier
36
+ * breaks the width of the whole table for a column nobody reads in full. */
37
+ max, }: {
38
+ value: string | number | null | undefined;
39
+ max?: number;
40
+ }): import("react").JSX.Element;
@@ -0,0 +1,80 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { currentCopyLocale, useUiCopy } from "../../foundations/copy.js";
4
+ /**
5
+ * Context: the mono/sans rule decides everything in here. The label goes in
6
+ * PROPORTIONAL —«orígenes», «mediana» are words, not data— and the value in
7
+ * tabular monospace, which is what makes four of these in a row keep their
8
+ * digits in a column.
9
+ *
10
+ * Formats follow the session locale, not a baked-in Spanish `Intl`.
11
+ */
12
+ function integerFormat(locale) {
13
+ return new Intl.NumberFormat(locale, { maximumFractionDigits: 0 });
14
+ }
15
+ function decimalFormat(locale) {
16
+ return new Intl.NumberFormat(locale, { maximumFractionDigits: 2 });
17
+ }
18
+ /** Four decimals and not two for distances — they live near zero
19
+ * (`0.0696`, `0.0149`) and with two they turn into `0.07` and `0.01`, which is
20
+ * losing exactly the part that tells one column from another. */
21
+ function distanceFormat(locale) {
22
+ return new Intl.NumberFormat(locale, {
23
+ minimumFractionDigits: 4,
24
+ maximumFractionDigits: 4,
25
+ });
26
+ }
27
+ export const formatCount = (value, locale = currentCopyLocale()) => integerFormat(locale).format(value);
28
+ export const formatNumber = (value, locale = currentCopyLocale()) => decimalFormat(locale).format(value);
29
+ export const formatDistance = (value, locale = currentCopyLocale()) => distanceFormat(locale).format(value);
30
+ /** A label with its number, for the glance at the top of a view. */
31
+ export function KeyValue({ label, value }) {
32
+ return (_jsxs("div", { className: "min-w-0", children: [_jsx("dt", { className: "text-micro text-muted", children: label }), _jsx("dd", { className: "mt-0.5 truncate text-lead tabular-nums text-ink", children: value })] }));
33
+ }
34
+ /**
35
+ * A number with its unit: right aligned, with tabular figures.
36
+ *
37
+ * Context: this is the detail a table's look depends on. Tabular figures give every digit
38
+ * the same width, so `32.561` lines up across rows exactly as it did in monospace — without
39
+ * making a business report look like a terminal. The unit stays in the same face so the
40
+ * digits keep their column.
41
+ */
42
+ export function Numeric({ value, unit, format = "integer", }) {
43
+ const text = format === "distance"
44
+ ? formatDistance(value)
45
+ : format === "decimal"
46
+ ? formatNumber(value)
47
+ : formatCount(value);
48
+ return (_jsxs("span", { className: "block text-right text-body tabular-nums whitespace-nowrap text-ink", children: [_jsx("span", { className: "tabular-nums", children: text }), unit === undefined ? null : _jsx("span", { className: "ml-1 text-muted", children: unit })] }));
49
+ }
50
+ /**
51
+ * The content of a data cell, with what the system decides and the view does not.
52
+ *
53
+ * Context: `""` is a TRULY EMPTY cell and not a missing datum — they are two
54
+ * different things and the engine tells them apart, so the interface does too. A
55
+ * missing one is passed as `null` and drawn with its mark; an empty string is a
56
+ * value somebody typed, and it gets one too.
57
+ *
58
+ * It used to live in the application, where it couldn't serve the other five
59
+ * tables.
60
+ */
61
+ export function Cell({ value,
62
+ /** From how many characters it gets truncated. A 64 character identifier
63
+ * breaks the width of the whole table for a column nobody reads in full. */
64
+ max = 48, }) {
65
+ const copy = useUiCopy();
66
+ if (value === null || value === undefined) {
67
+ return (_jsx("span", { className: "text-muted italic", title: copy.cell.missing, children: copy.cell.missing }));
68
+ }
69
+ if (typeof value === "number")
70
+ return _jsx(Numeric, { value: value, format: "decimal" });
71
+ if (value === "") {
72
+ return (_jsx("span", { className: "text-line-strong", title: copy.cell.empty, children: "\u00B7" }));
73
+ }
74
+ if (value.length <= max)
75
+ return _jsx(_Fragment, { children: value });
76
+ /* It is truncated with the whole value in the `title`: whoever needs the full
77
+ id has it a hover away, and whoever is reading the column next to it doesn't
78
+ pay for its width. */
79
+ return (_jsxs("span", { title: value, className: "truncate", children: [value.slice(0, max), "\u2026"] }));
80
+ }
@@ -0,0 +1,9 @@
1
+ export { Copyable, type CopyableProps, CopyButton, } from "./Copyable.js";
2
+ export { DateValue, formatDateTime, formatRelative, } from "./Fecha.js";
3
+ export { Meter, type MeterLevel, meterLevel, type MeterProps, type MeterThresholds, } from "./Meter.js";
4
+ export { Metric, type MetricProps, Metrics } from "./Metric.js";
5
+ export { Avatar, type AvatarSize, ContactCard, type ContactCardProps, type PersonContact, UserChip, type UserChipProps, UserStack, } from "./Person.js";
6
+ export { ProgressBar, type ProgressBarProps, } from "./ProgressBar.js";
7
+ export { RelationCard, type RelationCardProps, type RelationSummary, RelationValue, type RelationValueProps, } from "./Relation.js";
8
+ export { Totals, type TotalsCredit, type TotalsDeduction, type TotalsFact, type TotalsProps, type TotalsRow, } from "./Totals.js";
9
+ export { Cell, formatCount, formatDistance, formatNumber, KeyValue, Numeric, } from "./Value.js";
@@ -0,0 +1,10 @@
1
+ /* Show a number or a datum so that it reads as such and not as text. */
2
+ export { Copyable, CopyButton, } from "./Copyable.js";
3
+ export { DateValue, formatDateTime, formatRelative, } from "./Fecha.js";
4
+ export { Meter, meterLevel, } from "./Meter.js";
5
+ export { Metric, Metrics } from "./Metric.js";
6
+ export { Avatar, ContactCard, UserChip, UserStack, } from "./Person.js";
7
+ export { ProgressBar, } from "./ProgressBar.js";
8
+ export { RelationCard, RelationValue, } from "./Relation.js";
9
+ export { Totals, } from "./Totals.js";
10
+ export { Cell, formatCount, formatDistance, formatNumber, KeyValue, Numeric, } from "./Value.js";