@multiplatform.one/frappe-ui 7.23.2 → 7.24.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 (577) hide show
  1. package/dist/cjs/FrappeCalendar.cjs +1 -1
  2. package/dist/cjs/FrappeCalendar.native.js +1 -1
  3. package/dist/cjs/FrappeCalendar.native.js.map +1 -1
  4. package/dist/cjs/FrappeDashboard.cjs +1 -1
  5. package/dist/cjs/FrappeDashboard.native.js +1 -1
  6. package/dist/cjs/FrappeDashboard.native.js.map +1 -1
  7. package/dist/cjs/FrappeImageView.cjs +1 -1
  8. package/dist/cjs/FrappeImageView.native.js +1 -1
  9. package/dist/cjs/FrappeImageView.native.js.map +1 -1
  10. package/dist/cjs/FrappeInsights.cjs +380 -0
  11. package/dist/cjs/FrappeInsights.native.js +447 -0
  12. package/dist/cjs/FrappeInsights.native.js.map +1 -0
  13. package/dist/cjs/FrappeLikedBy.cjs +5 -2
  14. package/dist/cjs/FrappeLikedBy.native.js +5 -2
  15. package/dist/cjs/FrappeLikedBy.native.js.map +1 -1
  16. package/dist/cjs/FrappeListView.cjs +392 -38
  17. package/dist/cjs/FrappeListView.native.js +454 -41
  18. package/dist/cjs/FrappeListView.native.js.map +1 -1
  19. package/dist/cjs/FrappeRecordView.cjs +199 -0
  20. package/dist/cjs/FrappeRecordView.native.js +218 -0
  21. package/dist/cjs/FrappeRecordView.native.js.map +1 -0
  22. package/dist/cjs/FrappeReportBuilder.cjs +2 -2
  23. package/dist/cjs/FrappeReportBuilder.native.js +2 -2
  24. package/dist/cjs/FrappeReportBuilder.native.js.map +1 -1
  25. package/dist/cjs/FrappeTreeView.cjs +1 -1
  26. package/dist/cjs/FrappeTreeView.native.js +1 -1
  27. package/dist/cjs/desk/awesomebar.cjs +1 -1
  28. package/dist/cjs/desk/awesomebar.native.js +3 -3
  29. package/dist/cjs/desk/awesomebar.native.js.map +1 -1
  30. package/dist/cjs/fields/Heading/index.cjs +18 -11
  31. package/dist/cjs/fields/Heading/index.native.js +21 -12
  32. package/dist/cjs/fields/Heading/index.native.js.map +1 -1
  33. package/dist/cjs/frappeNavigation.cjs +12 -2
  34. package/dist/cjs/frappeNavigation.native.js +13 -2
  35. package/dist/cjs/frappeNavigation.native.js.map +1 -1
  36. package/dist/cjs/index.cjs +34 -0
  37. package/dist/cjs/index.native.js +34 -0
  38. package/dist/cjs/index.native.js.map +1 -1
  39. package/dist/cjs/insights/InsightsFacetTags.cjs +147 -0
  40. package/dist/cjs/insights/InsightsFacetTags.native.js +165 -0
  41. package/dist/cjs/insights/InsightsFacetTags.native.js.map +1 -0
  42. package/dist/cjs/insights/InsightsKpiBand.cjs +124 -0
  43. package/dist/cjs/insights/InsightsKpiBand.native.js +133 -0
  44. package/dist/cjs/insights/InsightsKpiBand.native.js.map +1 -0
  45. package/dist/cjs/insights/InsightsLeaders.cjs +150 -0
  46. package/dist/cjs/insights/InsightsLeaders.native.js +178 -0
  47. package/dist/cjs/insights/InsightsLeaders.native.js.map +1 -0
  48. package/dist/cjs/insights/InsightsRecords.cjs +105 -0
  49. package/dist/cjs/insights/InsightsRecords.native.js +109 -0
  50. package/dist/cjs/insights/InsightsRecords.native.js.map +1 -0
  51. package/dist/cjs/insights/InsightsTable.cjs +157 -0
  52. package/dist/cjs/insights/InsightsTable.native.js +194 -0
  53. package/dist/cjs/insights/InsightsTable.native.js.map +1 -0
  54. package/dist/cjs/insights/insightsData.cjs +114 -0
  55. package/dist/cjs/insights/insightsData.native.js +220 -0
  56. package/dist/cjs/insights/insightsData.native.js.map +1 -0
  57. package/dist/cjs/insights/insightsRecord.cjs +35 -0
  58. package/dist/cjs/insights/insightsRecord.native.js +38 -0
  59. package/dist/cjs/insights/insightsRecord.native.js.map +1 -0
  60. package/dist/cjs/list/FacetBadge.cjs +62 -0
  61. package/dist/cjs/list/FacetBadge.native.js +66 -0
  62. package/dist/cjs/list/FacetBadge.native.js.map +1 -0
  63. package/dist/cjs/list/FacetRail.cjs +199 -0
  64. package/dist/cjs/list/FacetRail.native.js +223 -0
  65. package/dist/cjs/list/FacetRail.native.js.map +1 -0
  66. package/dist/cjs/list/ImageWell.cjs +111 -0
  67. package/dist/cjs/list/ImageWell.native.js +126 -0
  68. package/dist/cjs/list/ImageWell.native.js.map +1 -0
  69. package/dist/cjs/list/ListControls.cjs +226 -0
  70. package/dist/cjs/list/ListControls.native.js +252 -0
  71. package/dist/cjs/list/ListControls.native.js.map +1 -0
  72. package/dist/cjs/list/ListToastHost.cjs +54 -0
  73. package/dist/cjs/list/ListToastHost.native.js +59 -0
  74. package/dist/cjs/list/ListToastHost.native.js.map +1 -0
  75. package/dist/cjs/list/RangeFilter.cjs +122 -0
  76. package/dist/cjs/list/RangeFilter.native.js +135 -0
  77. package/dist/cjs/list/RangeFilter.native.js.map +1 -0
  78. package/dist/cjs/list/RecordCard.cjs +233 -0
  79. package/dist/cjs/list/RecordCard.native.js +173 -0
  80. package/dist/cjs/list/RecordCard.native.js.map +1 -0
  81. package/dist/cjs/list/ShufflePanel.cjs +112 -0
  82. package/dist/cjs/list/ShufflePanel.native.js +139 -0
  83. package/dist/cjs/list/ShufflePanel.native.js.map +1 -0
  84. package/dist/cjs/list/facetReading.cjs +71 -0
  85. package/dist/cjs/list/facetReading.native.js +163 -0
  86. package/dist/cjs/list/facetReading.native.js.map +1 -0
  87. package/dist/cjs/list/favorites.cjs +79 -0
  88. package/dist/cjs/list/favorites.native.js +91 -0
  89. package/dist/cjs/list/favorites.native.js.map +1 -0
  90. package/dist/cjs/list/listState.cjs +100 -0
  91. package/dist/cjs/list/listState.native.js +234 -0
  92. package/dist/cjs/list/listState.native.js.map +1 -0
  93. package/dist/cjs/list/recordLook.cjs +35 -0
  94. package/dist/cjs/list/recordLook.native.js +39 -0
  95. package/dist/cjs/list/recordLook.native.js.map +1 -0
  96. package/dist/cjs/list/useListControls.cjs +189 -0
  97. package/dist/cjs/list/useListControls.native.js +272 -0
  98. package/dist/cjs/list/useListControls.native.js.map +1 -0
  99. package/dist/cjs/record/RecordBars.cjs +200 -0
  100. package/dist/cjs/record/RecordBars.native.js +225 -0
  101. package/dist/cjs/record/RecordBars.native.js.map +1 -0
  102. package/dist/cjs/record/RecordGallery.cjs +67 -0
  103. package/dist/cjs/record/RecordGallery.native.js +75 -0
  104. package/dist/cjs/record/RecordGallery.native.js.map +1 -0
  105. package/dist/cjs/record/RecordHero.cjs +239 -0
  106. package/dist/cjs/record/RecordHero.native.js +250 -0
  107. package/dist/cjs/record/RecordHero.native.js.map +1 -0
  108. package/dist/cjs/record/RecordPage.cjs +330 -0
  109. package/dist/cjs/record/RecordPage.native.js +364 -0
  110. package/dist/cjs/record/RecordPage.native.js.map +1 -0
  111. package/dist/cjs/record/RecordPager.cjs +125 -0
  112. package/dist/cjs/record/RecordPager.native.js +130 -0
  113. package/dist/cjs/record/RecordPager.native.js.map +1 -0
  114. package/dist/cjs/record/RecordRows.cjs +126 -0
  115. package/dist/cjs/record/RecordRows.native.js +140 -0
  116. package/dist/cjs/record/RecordRows.native.js.map +1 -0
  117. package/dist/cjs/record/recordData.cjs +122 -0
  118. package/dist/cjs/record/recordData.native.js +189 -0
  119. package/dist/cjs/record/recordData.native.js.map +1 -0
  120. package/dist/cjs/record/recordSections.cjs +30 -0
  121. package/dist/cjs/record/recordSections.native.js +33 -0
  122. package/dist/cjs/record/recordSections.native.js.map +1 -0
  123. package/dist/esm/FrappeCalendar.mjs +1 -1
  124. package/dist/esm/FrappeCalendar.mjs.map +1 -1
  125. package/dist/esm/FrappeCalendar.native.js +1 -1
  126. package/dist/esm/FrappeCalendar.native.js.map +1 -1
  127. package/dist/esm/FrappeDashboard.mjs +1 -1
  128. package/dist/esm/FrappeDashboard.mjs.map +1 -1
  129. package/dist/esm/FrappeDashboard.native.js +1 -1
  130. package/dist/esm/FrappeDashboard.native.js.map +1 -1
  131. package/dist/esm/FrappeImageView.mjs +1 -1
  132. package/dist/esm/FrappeImageView.mjs.map +1 -1
  133. package/dist/esm/FrappeImageView.native.js +1 -1
  134. package/dist/esm/FrappeImageView.native.js.map +1 -1
  135. package/dist/esm/FrappeInsights.mjs +355 -0
  136. package/dist/esm/FrappeInsights.mjs.map +1 -0
  137. package/dist/esm/FrappeInsights.native.js +419 -0
  138. package/dist/esm/FrappeInsights.native.js.map +1 -0
  139. package/dist/esm/FrappeLikedBy.mjs +6 -3
  140. package/dist/esm/FrappeLikedBy.mjs.map +1 -1
  141. package/dist/esm/FrappeLikedBy.native.js +6 -3
  142. package/dist/esm/FrappeLikedBy.native.js.map +1 -1
  143. package/dist/esm/FrappeListView.mjs +396 -42
  144. package/dist/esm/FrappeListView.mjs.map +1 -1
  145. package/dist/esm/FrappeListView.native.js +458 -45
  146. package/dist/esm/FrappeListView.native.js.map +1 -1
  147. package/dist/esm/FrappeRecordView.mjs +174 -0
  148. package/dist/esm/FrappeRecordView.mjs.map +1 -0
  149. package/dist/esm/FrappeRecordView.native.js +190 -0
  150. package/dist/esm/FrappeRecordView.native.js.map +1 -0
  151. package/dist/esm/FrappeReportBuilder.mjs +2 -2
  152. package/dist/esm/FrappeReportBuilder.mjs.map +1 -1
  153. package/dist/esm/FrappeReportBuilder.native.js +2 -2
  154. package/dist/esm/FrappeReportBuilder.native.js.map +1 -1
  155. package/dist/esm/FrappeTreeView.mjs +1 -1
  156. package/dist/esm/FrappeTreeView.mjs.map +1 -1
  157. package/dist/esm/FrappeTreeView.native.js +1 -1
  158. package/dist/esm/desk/awesomebar.mjs +1 -1
  159. package/dist/esm/desk/awesomebar.mjs.map +1 -1
  160. package/dist/esm/desk/awesomebar.native.js +3 -3
  161. package/dist/esm/desk/awesomebar.native.js.map +1 -1
  162. package/dist/esm/fields/Heading/index.mjs +19 -12
  163. package/dist/esm/fields/Heading/index.mjs.map +1 -1
  164. package/dist/esm/fields/Heading/index.native.js +22 -13
  165. package/dist/esm/fields/Heading/index.native.js.map +1 -1
  166. package/dist/esm/frappeNavigation.mjs +11 -2
  167. package/dist/esm/frappeNavigation.mjs.map +1 -1
  168. package/dist/esm/frappeNavigation.native.js +12 -2
  169. package/dist/esm/frappeNavigation.native.js.map +1 -1
  170. package/dist/esm/index.mjs +14 -2
  171. package/dist/esm/index.mjs.map +1 -1
  172. package/dist/esm/index.native.js +14 -2
  173. package/dist/esm/index.native.js.map +1 -1
  174. package/dist/esm/insights/InsightsFacetTags.mjs +122 -0
  175. package/dist/esm/insights/InsightsFacetTags.mjs.map +1 -0
  176. package/dist/esm/insights/InsightsFacetTags.native.js +137 -0
  177. package/dist/esm/insights/InsightsFacetTags.native.js.map +1 -0
  178. package/dist/esm/insights/InsightsKpiBand.mjs +99 -0
  179. package/dist/esm/insights/InsightsKpiBand.mjs.map +1 -0
  180. package/dist/esm/insights/InsightsKpiBand.native.js +105 -0
  181. package/dist/esm/insights/InsightsKpiBand.native.js.map +1 -0
  182. package/dist/esm/insights/InsightsLeaders.mjs +125 -0
  183. package/dist/esm/insights/InsightsLeaders.mjs.map +1 -0
  184. package/dist/esm/insights/InsightsLeaders.native.js +150 -0
  185. package/dist/esm/insights/InsightsLeaders.native.js.map +1 -0
  186. package/dist/esm/insights/InsightsRecords.mjs +80 -0
  187. package/dist/esm/insights/InsightsRecords.mjs.map +1 -0
  188. package/dist/esm/insights/InsightsRecords.native.js +81 -0
  189. package/dist/esm/insights/InsightsRecords.native.js.map +1 -0
  190. package/dist/esm/insights/InsightsTable.mjs +132 -0
  191. package/dist/esm/insights/InsightsTable.mjs.map +1 -0
  192. package/dist/esm/insights/InsightsTable.native.js +166 -0
  193. package/dist/esm/insights/InsightsTable.native.js.map +1 -0
  194. package/dist/esm/insights/insightsData.mjs +82 -0
  195. package/dist/esm/insights/insightsData.mjs.map +1 -0
  196. package/dist/esm/insights/insightsData.native.js +185 -0
  197. package/dist/esm/insights/insightsData.native.js.map +1 -0
  198. package/dist/esm/insights/insightsRecord.mjs +9 -0
  199. package/dist/esm/insights/insightsRecord.mjs.map +1 -0
  200. package/dist/esm/insights/insightsRecord.native.js +9 -0
  201. package/dist/esm/insights/insightsRecord.native.js.map +1 -0
  202. package/dist/esm/list/FacetBadge.mjs +37 -0
  203. package/dist/esm/list/FacetBadge.mjs.map +1 -0
  204. package/dist/esm/list/FacetBadge.native.js +38 -0
  205. package/dist/esm/list/FacetBadge.native.js.map +1 -0
  206. package/dist/esm/list/FacetRail.mjs +174 -0
  207. package/dist/esm/list/FacetRail.mjs.map +1 -0
  208. package/dist/esm/list/FacetRail.native.js +195 -0
  209. package/dist/esm/list/FacetRail.native.js.map +1 -0
  210. package/dist/esm/list/ImageWell.mjs +86 -0
  211. package/dist/esm/list/ImageWell.mjs.map +1 -0
  212. package/dist/esm/list/ImageWell.native.js +98 -0
  213. package/dist/esm/list/ImageWell.native.js.map +1 -0
  214. package/dist/esm/list/ListControls.mjs +201 -0
  215. package/dist/esm/list/ListControls.mjs.map +1 -0
  216. package/dist/esm/list/ListControls.native.js +224 -0
  217. package/dist/esm/list/ListControls.native.js.map +1 -0
  218. package/dist/esm/list/ListToastHost.mjs +18 -0
  219. package/dist/esm/list/ListToastHost.mjs.map +1 -0
  220. package/dist/esm/list/ListToastHost.native.js +20 -0
  221. package/dist/esm/list/ListToastHost.native.js.map +1 -0
  222. package/dist/esm/list/RangeFilter.mjs +85 -0
  223. package/dist/esm/list/RangeFilter.mjs.map +1 -0
  224. package/dist/esm/list/RangeFilter.native.js +95 -0
  225. package/dist/esm/list/RangeFilter.native.js.map +1 -0
  226. package/dist/esm/list/RecordCard.mjs +208 -0
  227. package/dist/esm/list/RecordCard.mjs.map +1 -0
  228. package/dist/esm/list/RecordCard.native.js +145 -0
  229. package/dist/esm/list/RecordCard.native.js.map +1 -0
  230. package/dist/esm/list/ShufflePanel.mjs +87 -0
  231. package/dist/esm/list/ShufflePanel.mjs.map +1 -0
  232. package/dist/esm/list/ShufflePanel.native.js +111 -0
  233. package/dist/esm/list/ShufflePanel.native.js.map +1 -0
  234. package/dist/esm/list/facetReading.mjs +45 -0
  235. package/dist/esm/list/facetReading.mjs.map +1 -0
  236. package/dist/esm/list/facetReading.native.js +134 -0
  237. package/dist/esm/list/facetReading.native.js.map +1 -0
  238. package/dist/esm/list/favorites.mjs +50 -0
  239. package/dist/esm/list/favorites.mjs.map +1 -0
  240. package/dist/esm/list/favorites.native.js +59 -0
  241. package/dist/esm/list/favorites.native.js.map +1 -0
  242. package/dist/esm/list/listState.mjs +71 -0
  243. package/dist/esm/list/listState.mjs.map +1 -0
  244. package/dist/esm/list/listState.native.js +202 -0
  245. package/dist/esm/list/listState.native.js.map +1 -0
  246. package/dist/esm/list/recordLook.mjs +10 -0
  247. package/dist/esm/list/recordLook.mjs.map +1 -0
  248. package/dist/esm/list/recordLook.native.js +11 -0
  249. package/dist/esm/list/recordLook.native.js.map +1 -0
  250. package/dist/esm/list/useListControls.mjs +164 -0
  251. package/dist/esm/list/useListControls.mjs.map +1 -0
  252. package/dist/esm/list/useListControls.native.js +244 -0
  253. package/dist/esm/list/useListControls.native.js.map +1 -0
  254. package/dist/esm/record/RecordBars.mjs +175 -0
  255. package/dist/esm/record/RecordBars.mjs.map +1 -0
  256. package/dist/esm/record/RecordBars.native.js +197 -0
  257. package/dist/esm/record/RecordBars.native.js.map +1 -0
  258. package/dist/esm/record/RecordGallery.mjs +42 -0
  259. package/dist/esm/record/RecordGallery.mjs.map +1 -0
  260. package/dist/esm/record/RecordGallery.native.js +47 -0
  261. package/dist/esm/record/RecordGallery.native.js.map +1 -0
  262. package/dist/esm/record/RecordHero.mjs +205 -0
  263. package/dist/esm/record/RecordHero.mjs.map +1 -0
  264. package/dist/esm/record/RecordHero.native.js +213 -0
  265. package/dist/esm/record/RecordHero.native.js.map +1 -0
  266. package/dist/esm/record/RecordPage.mjs +305 -0
  267. package/dist/esm/record/RecordPage.mjs.map +1 -0
  268. package/dist/esm/record/RecordPage.native.js +336 -0
  269. package/dist/esm/record/RecordPage.native.js.map +1 -0
  270. package/dist/esm/record/RecordPager.mjs +100 -0
  271. package/dist/esm/record/RecordPager.mjs.map +1 -0
  272. package/dist/esm/record/RecordPager.native.js +102 -0
  273. package/dist/esm/record/RecordPager.native.js.map +1 -0
  274. package/dist/esm/record/RecordRows.mjs +101 -0
  275. package/dist/esm/record/RecordRows.mjs.map +1 -0
  276. package/dist/esm/record/RecordRows.native.js +112 -0
  277. package/dist/esm/record/RecordRows.native.js.map +1 -0
  278. package/dist/esm/record/recordData.mjs +92 -0
  279. package/dist/esm/record/recordData.mjs.map +1 -0
  280. package/dist/esm/record/recordData.native.js +156 -0
  281. package/dist/esm/record/recordData.native.js.map +1 -0
  282. package/dist/esm/record/recordSections.mjs +5 -0
  283. package/dist/esm/record/recordSections.mjs.map +1 -0
  284. package/dist/esm/record/recordSections.native.js +5 -0
  285. package/dist/esm/record/recordSections.native.js.map +1 -0
  286. package/dist/jsx/FrappeCalendar.mjs +1 -1
  287. package/dist/jsx/FrappeCalendar.mjs.map +1 -1
  288. package/dist/jsx/FrappeCalendar.native.js +1 -1
  289. package/dist/jsx/FrappeCalendar.native.js.map +1 -1
  290. package/dist/jsx/FrappeDashboard.mjs +1 -1
  291. package/dist/jsx/FrappeDashboard.mjs.map +1 -1
  292. package/dist/jsx/FrappeDashboard.native.js +1 -1
  293. package/dist/jsx/FrappeDashboard.native.js.map +1 -1
  294. package/dist/jsx/FrappeImageView.mjs +1 -1
  295. package/dist/jsx/FrappeImageView.mjs.map +1 -1
  296. package/dist/jsx/FrappeImageView.native.js +1 -1
  297. package/dist/jsx/FrappeImageView.native.js.map +1 -1
  298. package/dist/jsx/FrappeInsights.mjs +355 -0
  299. package/dist/jsx/FrappeInsights.mjs.map +1 -0
  300. package/dist/jsx/FrappeInsights.native.js +447 -0
  301. package/dist/jsx/FrappeInsights.native.js.map +1 -0
  302. package/dist/jsx/FrappeLikedBy.mjs +6 -3
  303. package/dist/jsx/FrappeLikedBy.mjs.map +1 -1
  304. package/dist/jsx/FrappeLikedBy.native.js +5 -2
  305. package/dist/jsx/FrappeLikedBy.native.js.map +1 -1
  306. package/dist/jsx/FrappeListView.mjs +396 -42
  307. package/dist/jsx/FrappeListView.mjs.map +1 -1
  308. package/dist/jsx/FrappeListView.native.js +454 -41
  309. package/dist/jsx/FrappeListView.native.js.map +1 -1
  310. package/dist/jsx/FrappeRecordView.mjs +174 -0
  311. package/dist/jsx/FrappeRecordView.mjs.map +1 -0
  312. package/dist/jsx/FrappeRecordView.native.js +218 -0
  313. package/dist/jsx/FrappeRecordView.native.js.map +1 -0
  314. package/dist/jsx/FrappeReportBuilder.mjs +2 -2
  315. package/dist/jsx/FrappeReportBuilder.mjs.map +1 -1
  316. package/dist/jsx/FrappeReportBuilder.native.js +2 -2
  317. package/dist/jsx/FrappeReportBuilder.native.js.map +1 -1
  318. package/dist/jsx/FrappeTreeView.mjs +1 -1
  319. package/dist/jsx/FrappeTreeView.mjs.map +1 -1
  320. package/dist/jsx/FrappeTreeView.native.js +1 -1
  321. package/dist/jsx/desk/awesomebar.mjs +1 -1
  322. package/dist/jsx/desk/awesomebar.mjs.map +1 -1
  323. package/dist/jsx/desk/awesomebar.native.js +3 -3
  324. package/dist/jsx/desk/awesomebar.native.js.map +1 -1
  325. package/dist/jsx/fields/Heading/index.mjs +19 -12
  326. package/dist/jsx/fields/Heading/index.mjs.map +1 -1
  327. package/dist/jsx/fields/Heading/index.native.js +21 -12
  328. package/dist/jsx/fields/Heading/index.native.js.map +1 -1
  329. package/dist/jsx/frappeNavigation.mjs +11 -2
  330. package/dist/jsx/frappeNavigation.mjs.map +1 -1
  331. package/dist/jsx/frappeNavigation.native.js +13 -2
  332. package/dist/jsx/frappeNavigation.native.js.map +1 -1
  333. package/dist/jsx/index.js +14 -2
  334. package/dist/jsx/index.js.map +1 -1
  335. package/dist/jsx/index.mjs +14 -2
  336. package/dist/jsx/index.mjs.map +1 -1
  337. package/dist/jsx/index.native.js +34 -0
  338. package/dist/jsx/index.native.js.map +1 -1
  339. package/dist/jsx/insights/InsightsFacetTags.mjs +122 -0
  340. package/dist/jsx/insights/InsightsFacetTags.mjs.map +1 -0
  341. package/dist/jsx/insights/InsightsFacetTags.native.js +165 -0
  342. package/dist/jsx/insights/InsightsFacetTags.native.js.map +1 -0
  343. package/dist/jsx/insights/InsightsKpiBand.mjs +99 -0
  344. package/dist/jsx/insights/InsightsKpiBand.mjs.map +1 -0
  345. package/dist/jsx/insights/InsightsKpiBand.native.js +133 -0
  346. package/dist/jsx/insights/InsightsKpiBand.native.js.map +1 -0
  347. package/dist/jsx/insights/InsightsLeaders.mjs +125 -0
  348. package/dist/jsx/insights/InsightsLeaders.mjs.map +1 -0
  349. package/dist/jsx/insights/InsightsLeaders.native.js +178 -0
  350. package/dist/jsx/insights/InsightsLeaders.native.js.map +1 -0
  351. package/dist/jsx/insights/InsightsRecords.mjs +80 -0
  352. package/dist/jsx/insights/InsightsRecords.mjs.map +1 -0
  353. package/dist/jsx/insights/InsightsRecords.native.js +109 -0
  354. package/dist/jsx/insights/InsightsRecords.native.js.map +1 -0
  355. package/dist/jsx/insights/InsightsTable.mjs +132 -0
  356. package/dist/jsx/insights/InsightsTable.mjs.map +1 -0
  357. package/dist/jsx/insights/InsightsTable.native.js +194 -0
  358. package/dist/jsx/insights/InsightsTable.native.js.map +1 -0
  359. package/dist/jsx/insights/insightsData.mjs +82 -0
  360. package/dist/jsx/insights/insightsData.mjs.map +1 -0
  361. package/dist/jsx/insights/insightsData.native.js +220 -0
  362. package/dist/jsx/insights/insightsData.native.js.map +1 -0
  363. package/dist/jsx/insights/insightsRecord.mjs +9 -0
  364. package/dist/jsx/insights/insightsRecord.mjs.map +1 -0
  365. package/dist/jsx/insights/insightsRecord.native.js +38 -0
  366. package/dist/jsx/insights/insightsRecord.native.js.map +1 -0
  367. package/dist/jsx/list/FacetBadge.mjs +37 -0
  368. package/dist/jsx/list/FacetBadge.mjs.map +1 -0
  369. package/dist/jsx/list/FacetBadge.native.js +66 -0
  370. package/dist/jsx/list/FacetBadge.native.js.map +1 -0
  371. package/dist/jsx/list/FacetRail.mjs +174 -0
  372. package/dist/jsx/list/FacetRail.mjs.map +1 -0
  373. package/dist/jsx/list/FacetRail.native.js +223 -0
  374. package/dist/jsx/list/FacetRail.native.js.map +1 -0
  375. package/dist/jsx/list/ImageWell.mjs +86 -0
  376. package/dist/jsx/list/ImageWell.mjs.map +1 -0
  377. package/dist/jsx/list/ImageWell.native.js +126 -0
  378. package/dist/jsx/list/ImageWell.native.js.map +1 -0
  379. package/dist/jsx/list/ListControls.mjs +201 -0
  380. package/dist/jsx/list/ListControls.mjs.map +1 -0
  381. package/dist/jsx/list/ListControls.native.js +252 -0
  382. package/dist/jsx/list/ListControls.native.js.map +1 -0
  383. package/dist/jsx/list/ListToastHost.mjs +18 -0
  384. package/dist/jsx/list/ListToastHost.mjs.map +1 -0
  385. package/dist/jsx/list/ListToastHost.native.js +59 -0
  386. package/dist/jsx/list/ListToastHost.native.js.map +1 -0
  387. package/dist/jsx/list/RangeFilter.mjs +85 -0
  388. package/dist/jsx/list/RangeFilter.mjs.map +1 -0
  389. package/dist/jsx/list/RangeFilter.native.js +135 -0
  390. package/dist/jsx/list/RangeFilter.native.js.map +1 -0
  391. package/dist/jsx/list/RecordCard.mjs +208 -0
  392. package/dist/jsx/list/RecordCard.mjs.map +1 -0
  393. package/dist/jsx/list/RecordCard.native.js +173 -0
  394. package/dist/jsx/list/RecordCard.native.js.map +1 -0
  395. package/dist/jsx/list/ShufflePanel.mjs +87 -0
  396. package/dist/jsx/list/ShufflePanel.mjs.map +1 -0
  397. package/dist/jsx/list/ShufflePanel.native.js +139 -0
  398. package/dist/jsx/list/ShufflePanel.native.js.map +1 -0
  399. package/dist/jsx/list/facetReading.mjs +45 -0
  400. package/dist/jsx/list/facetReading.mjs.map +1 -0
  401. package/dist/jsx/list/facetReading.native.js +163 -0
  402. package/dist/jsx/list/facetReading.native.js.map +1 -0
  403. package/dist/jsx/list/favorites.mjs +50 -0
  404. package/dist/jsx/list/favorites.mjs.map +1 -0
  405. package/dist/jsx/list/favorites.native.js +91 -0
  406. package/dist/jsx/list/favorites.native.js.map +1 -0
  407. package/dist/jsx/list/listState.mjs +71 -0
  408. package/dist/jsx/list/listState.mjs.map +1 -0
  409. package/dist/jsx/list/listState.native.js +234 -0
  410. package/dist/jsx/list/listState.native.js.map +1 -0
  411. package/dist/jsx/list/recordLook.mjs +10 -0
  412. package/dist/jsx/list/recordLook.mjs.map +1 -0
  413. package/dist/jsx/list/recordLook.native.js +39 -0
  414. package/dist/jsx/list/recordLook.native.js.map +1 -0
  415. package/dist/jsx/list/useListControls.mjs +164 -0
  416. package/dist/jsx/list/useListControls.mjs.map +1 -0
  417. package/dist/jsx/list/useListControls.native.js +272 -0
  418. package/dist/jsx/list/useListControls.native.js.map +1 -0
  419. package/dist/jsx/record/RecordBars.mjs +175 -0
  420. package/dist/jsx/record/RecordBars.mjs.map +1 -0
  421. package/dist/jsx/record/RecordBars.native.js +225 -0
  422. package/dist/jsx/record/RecordBars.native.js.map +1 -0
  423. package/dist/jsx/record/RecordGallery.mjs +42 -0
  424. package/dist/jsx/record/RecordGallery.mjs.map +1 -0
  425. package/dist/jsx/record/RecordGallery.native.js +75 -0
  426. package/dist/jsx/record/RecordGallery.native.js.map +1 -0
  427. package/dist/jsx/record/RecordHero.mjs +205 -0
  428. package/dist/jsx/record/RecordHero.mjs.map +1 -0
  429. package/dist/jsx/record/RecordHero.native.js +250 -0
  430. package/dist/jsx/record/RecordHero.native.js.map +1 -0
  431. package/dist/jsx/record/RecordPage.mjs +305 -0
  432. package/dist/jsx/record/RecordPage.mjs.map +1 -0
  433. package/dist/jsx/record/RecordPage.native.js +364 -0
  434. package/dist/jsx/record/RecordPage.native.js.map +1 -0
  435. package/dist/jsx/record/RecordPager.mjs +100 -0
  436. package/dist/jsx/record/RecordPager.mjs.map +1 -0
  437. package/dist/jsx/record/RecordPager.native.js +130 -0
  438. package/dist/jsx/record/RecordPager.native.js.map +1 -0
  439. package/dist/jsx/record/RecordRows.mjs +101 -0
  440. package/dist/jsx/record/RecordRows.mjs.map +1 -0
  441. package/dist/jsx/record/RecordRows.native.js +140 -0
  442. package/dist/jsx/record/RecordRows.native.js.map +1 -0
  443. package/dist/jsx/record/recordData.mjs +92 -0
  444. package/dist/jsx/record/recordData.mjs.map +1 -0
  445. package/dist/jsx/record/recordData.native.js +189 -0
  446. package/dist/jsx/record/recordData.native.js.map +1 -0
  447. package/dist/jsx/record/recordSections.mjs +5 -0
  448. package/dist/jsx/record/recordSections.mjs.map +1 -0
  449. package/dist/jsx/record/recordSections.native.js +33 -0
  450. package/dist/jsx/record/recordSections.native.js.map +1 -0
  451. package/package.json +16 -16
  452. package/src/FrappeCalendar.tsx +2 -2
  453. package/src/FrappeDashboard.tsx +2 -2
  454. package/src/FrappeImageView.tsx +2 -1
  455. package/src/FrappeInsights.spec.tsx +171 -0
  456. package/src/FrappeInsights.tsx +422 -0
  457. package/src/FrappeLikedBy.tsx +7 -5
  458. package/src/FrappeListView.card.spec.tsx +157 -0
  459. package/src/FrappeListView.controls.spec.tsx +225 -0
  460. package/src/FrappeListView.seed.spec.tsx +30 -0
  461. package/src/FrappeListView.tsx +575 -44
  462. package/src/FrappeRecordView.spec.tsx +276 -0
  463. package/src/FrappeRecordView.tsx +231 -0
  464. package/src/FrappeReportBuilder.tsx +4 -5
  465. package/src/FrappeTreeView.tsx +1 -1
  466. package/src/desk/awesomebar.auth.spec.tsx +77 -0
  467. package/src/desk/awesomebar.tsx +1 -1
  468. package/src/fields/Heading/index.tsx +33 -15
  469. package/src/frappeNavigation.loader.spec.tsx +45 -0
  470. package/src/frappeNavigation.tsx +32 -1
  471. package/src/index.ts +53 -1
  472. package/src/insights/InsightsFacetTags.tsx +131 -0
  473. package/src/insights/InsightsKpiBand.tsx +114 -0
  474. package/src/insights/InsightsLeaders.tsx +146 -0
  475. package/src/insights/InsightsRecords.tsx +71 -0
  476. package/src/insights/InsightsTable.tsx +169 -0
  477. package/src/insights/insightsData.spec.ts +143 -0
  478. package/src/insights/insightsData.ts +122 -0
  479. package/src/insights/insightsRecord.ts +36 -0
  480. package/src/list/FacetBadge.tsx +41 -0
  481. package/src/list/FacetRail.tsx +235 -0
  482. package/src/list/ImageWell.tsx +110 -0
  483. package/src/list/ListControls.tsx +208 -0
  484. package/src/list/ListToastHost.tsx +27 -0
  485. package/src/list/RangeFilter.tsx +83 -0
  486. package/src/list/RecordCard.native.tsx +126 -0
  487. package/src/list/RecordCard.tsx +260 -0
  488. package/src/list/ShufflePanel.tsx +107 -0
  489. package/src/list/facetReading.ts +79 -0
  490. package/src/list/favorites.spec.ts +80 -0
  491. package/src/list/favorites.ts +79 -0
  492. package/src/list/listState.spec.ts +156 -0
  493. package/src/list/listState.ts +184 -0
  494. package/src/list/recordLook.ts +37 -0
  495. package/src/list/useListControls.tsx +223 -0
  496. package/src/record/RecordBars.tsx +187 -0
  497. package/src/record/RecordGallery.tsx +47 -0
  498. package/src/record/RecordHero.tsx +186 -0
  499. package/src/record/RecordPage.tsx +358 -0
  500. package/src/record/RecordPager.tsx +97 -0
  501. package/src/record/RecordRows.tsx +90 -0
  502. package/src/record/recordData.spec.ts +148 -0
  503. package/src/record/recordData.ts +124 -0
  504. package/src/record/recordSections.ts +62 -0
  505. package/src/schemaForm/SchemaForm.stories.tsx +2 -2
  506. package/types/FrappeImageView.d.ts.map +1 -1
  507. package/types/FrappeInsights.d.ts +55 -0
  508. package/types/FrappeInsights.d.ts.map +1 -0
  509. package/types/FrappeLikedBy.d.ts.map +1 -1
  510. package/types/FrappeListView.d.ts +82 -2
  511. package/types/FrappeListView.d.ts.map +1 -1
  512. package/types/FrappeRecordView.d.ts +69 -0
  513. package/types/FrappeRecordView.d.ts.map +1 -0
  514. package/types/FrappeReportBuilder.d.ts.map +1 -1
  515. package/types/fields/Heading/index.d.ts.map +1 -1
  516. package/types/frappeNavigation.d.ts +21 -0
  517. package/types/frappeNavigation.d.ts.map +1 -1
  518. package/types/index.d.ts +14 -2
  519. package/types/index.d.ts.map +1 -1
  520. package/types/insights/InsightsFacetTags.d.ts +11 -0
  521. package/types/insights/InsightsFacetTags.d.ts.map +1 -0
  522. package/types/insights/InsightsKpiBand.d.ts +22 -0
  523. package/types/insights/InsightsKpiBand.d.ts.map +1 -0
  524. package/types/insights/InsightsLeaders.d.ts +16 -0
  525. package/types/insights/InsightsLeaders.d.ts.map +1 -0
  526. package/types/insights/InsightsRecords.d.ts +19 -0
  527. package/types/insights/InsightsRecords.d.ts.map +1 -0
  528. package/types/insights/InsightsTable.d.ts +17 -0
  529. package/types/insights/InsightsTable.d.ts.map +1 -0
  530. package/types/insights/insightsData.d.ts +45 -0
  531. package/types/insights/insightsData.d.ts.map +1 -0
  532. package/types/insights/insightsRecord.d.ts +29 -0
  533. package/types/insights/insightsRecord.d.ts.map +1 -0
  534. package/types/list/FacetBadge.d.ts +13 -0
  535. package/types/list/FacetBadge.d.ts.map +1 -0
  536. package/types/list/FacetRail.d.ts +26 -0
  537. package/types/list/FacetRail.d.ts.map +1 -0
  538. package/types/list/ImageWell.d.ts +24 -0
  539. package/types/list/ImageWell.d.ts.map +1 -0
  540. package/types/list/ListControls.d.ts +30 -0
  541. package/types/list/ListControls.d.ts.map +1 -0
  542. package/types/list/ListToastHost.d.ts +7 -0
  543. package/types/list/ListToastHost.d.ts.map +1 -0
  544. package/types/list/RangeFilter.d.ts +14 -0
  545. package/types/list/RangeFilter.d.ts.map +1 -0
  546. package/types/list/RecordCard.d.ts +38 -0
  547. package/types/list/RecordCard.d.ts.map +1 -0
  548. package/types/list/RecordCard.native.d.ts +9 -0
  549. package/types/list/RecordCard.native.d.ts.map +1 -0
  550. package/types/list/ShufflePanel.d.ts +24 -0
  551. package/types/list/ShufflePanel.d.ts.map +1 -0
  552. package/types/list/facetReading.d.ts +33 -0
  553. package/types/list/facetReading.d.ts.map +1 -0
  554. package/types/list/favorites.d.ts +26 -0
  555. package/types/list/favorites.d.ts.map +1 -0
  556. package/types/list/listState.d.ts +94 -0
  557. package/types/list/listState.d.ts.map +1 -0
  558. package/types/list/recordLook.d.ts +25 -0
  559. package/types/list/recordLook.d.ts.map +1 -0
  560. package/types/list/useListControls.d.ts +48 -0
  561. package/types/list/useListControls.d.ts.map +1 -0
  562. package/types/record/RecordBars.d.ts +11 -0
  563. package/types/record/RecordBars.d.ts.map +1 -0
  564. package/types/record/RecordGallery.d.ts +17 -0
  565. package/types/record/RecordGallery.d.ts.map +1 -0
  566. package/types/record/RecordHero.d.ts +42 -0
  567. package/types/record/RecordHero.d.ts.map +1 -0
  568. package/types/record/RecordPage.d.ts +54 -0
  569. package/types/record/RecordPage.d.ts.map +1 -0
  570. package/types/record/RecordPager.d.ts +13 -0
  571. package/types/record/RecordPager.d.ts.map +1 -0
  572. package/types/record/RecordRows.d.ts +13 -0
  573. package/types/record/RecordRows.d.ts.map +1 -0
  574. package/types/record/recordData.d.ts +46 -0
  575. package/types/record/recordData.d.ts.map +1 -0
  576. package/types/record/recordSections.d.ts +67 -0
  577. package/types/record/recordSections.d.ts.map +1 -0
@@ -0,0 +1,71 @@
1
+ import { Text, XStack, YStack } from "@multiplatform.one/components";
2
+ import { useResolvedKnobs } from "@multiplatform.one/theme";
3
+ import { ImageWell } from "../list/ImageWell";
4
+ import type { InsightsRecordView } from "./insightsRecord";
5
+
6
+ export interface InsightsRecordTile<TDoc> {
7
+ id: string;
8
+ label: string;
9
+ doc: TDoc;
10
+ value: string;
11
+ }
12
+
13
+ export interface InsightsRecordsProps<TDoc> {
14
+ tiles: readonly InsightsRecordTile<TDoc>[];
15
+ record: InsightsRecordView<TDoc>;
16
+ testID?: string;
17
+ }
18
+
19
+ /**
20
+ * Record holders as quiet fact tiles: the holder's tinted image well, its
21
+ * title and code, and the value. Nested chrome steps with the compact
22
+ * nestedControl, not the page's 44px floor (LC-73).
23
+ */
24
+ export function InsightsRecords<TDoc>({ tiles, record, testID }: InsightsRecordsProps<TDoc>) {
25
+ const { knobProps } = useResolvedKnobs({ compact: true });
26
+ const { knobProps: pageKnobs } = useResolvedKnobs();
27
+ const wellPx = knobProps.nestedControl.px * 2;
28
+ return (
29
+ <XStack {...pageKnobs.gap} flexWrap="wrap" testID={testID}>
30
+ {tiles.map((tile) => {
31
+ const title = record.title(tile.doc);
32
+ const code = record.code(tile.doc);
33
+ const tints = record.tints(tile.doc);
34
+ return (
35
+ <XStack
36
+ key={tile.id}
37
+ {...knobProps.cardSurface}
38
+ backgroundColor="$color2"
39
+ flexGrow={1}
40
+ flexBasis={220}
41
+ alignItems="center"
42
+ minWidth={0}
43
+ {...knobProps.gap}
44
+ >
45
+ <YStack width={wellPx} flexShrink={0} data-nested-px={knobProps.nestedControl.px}>
46
+ <ImageWell sources={record.images(tile.doc)} alt={title} tints={tints} inset={0.04} />
47
+ </YStack>
48
+ <YStack gap="$1" flexShrink={1} minWidth={0}>
49
+ <Text {...knobProps.label} color="$color10">
50
+ {tile.label}
51
+ </Text>
52
+ <XStack gap="$1.5" alignItems="baseline" flexWrap="wrap" minWidth={0}>
53
+ <Text fontWeight="700" numberOfLines={1} flexShrink={1}>
54
+ {title}
55
+ </Text>
56
+ {code ? (
57
+ <Text {...knobProps.label} color="$color10" fontWeight="600">
58
+ {code}
59
+ </Text>
60
+ ) : null}
61
+ </XStack>
62
+ <Text fontSize="$6" fontWeight="700">
63
+ {tile.value}
64
+ </Text>
65
+ </YStack>
66
+ </XStack>
67
+ );
68
+ })}
69
+ </XStack>
70
+ );
71
+ }
@@ -0,0 +1,169 @@
1
+ import { Avatar, Text, XStack, YStack } from "@multiplatform.one/components";
2
+ import { DataTable, type DataTableColumn, type DataTableData } from "@multiplatform.one/table";
3
+ import { useResolvedKnobs } from "@multiplatform.one/theme";
4
+ import { useMemo } from "react";
5
+ import { useTranslation } from "react-i18next";
6
+ import { FacetBadge } from "../list/FacetBadge";
7
+ import {
8
+ formatMetric,
9
+ metricValue,
10
+ type FrappeInsightsMetric,
11
+ type InsightsRecordView,
12
+ } from "./insightsRecord";
13
+
14
+ interface TableRow<TDoc> extends DataTableData {
15
+ doc: TDoc;
16
+ code: string;
17
+ title: string;
18
+ values: string[];
19
+ [metric: string]: unknown;
20
+ }
21
+
22
+ export interface InsightsTableProps<TDoc> {
23
+ rows: readonly TDoc[];
24
+ metrics: readonly FrappeInsightsMetric[];
25
+ record: InsightsRecordView<TDoc>;
26
+ /** Header of the facet column; without it, no facet column. */
27
+ facetLabel?: string;
28
+ pageSize?: number;
29
+ label: string;
30
+ testID?: string;
31
+ }
32
+
33
+ /**
34
+ * Every record in the catalog DataTable: sortable metric columns, a pager,
35
+ * and the stacked card layout below `$sm`. A row opens its record.
36
+ */
37
+ export function InsightsTable<TDoc>({
38
+ rows,
39
+ metrics,
40
+ record,
41
+ facetLabel,
42
+ pageSize = 5,
43
+ label,
44
+ testID,
45
+ }: InsightsTableProps<TDoc>) {
46
+ const { t } = useTranslation();
47
+ const { knobProps } = useResolvedKnobs({ compact: true });
48
+ const nestedPx = knobProps.nestedControl.px;
49
+ const hasCode = rows.some((doc) => Boolean(record.code(doc)));
50
+
51
+ const data = useMemo<TableRow<TDoc>[]>(
52
+ () =>
53
+ rows.map((doc) => ({
54
+ doc,
55
+ code: record.code(doc) ?? "",
56
+ title: record.title(doc),
57
+ values: record.values(doc),
58
+ ...Object.fromEntries(
59
+ metrics.map((metric) => [metric.field, metricValue(doc, metric.field)]),
60
+ ),
61
+ })),
62
+ [rows, metrics, record],
63
+ );
64
+
65
+ const columns = useMemo<DataTableColumn<TableRow<TDoc>>[]>(
66
+ () => [
67
+ ...(hasCode
68
+ ? [
69
+ {
70
+ id: "code",
71
+ accessorKey: "code",
72
+ header: t("No."),
73
+ size: 72,
74
+ cell: ({ row }: { row: { original: TableRow<TDoc> } }) => (
75
+ <Text {...knobProps.label} color="$color10" fontWeight="600">
76
+ {row.original.code}
77
+ </Text>
78
+ ),
79
+ } satisfies DataTableColumn<TableRow<TDoc>>,
80
+ ]
81
+ : []),
82
+ {
83
+ id: "record",
84
+ accessorKey: "title",
85
+ header: t("Record"),
86
+ cell: ({ row }) => (
87
+ <XStack gap="$2" alignItems="center" minWidth={0}>
88
+ <Avatar
89
+ src={record.images(row.original.doc)[0] || undefined}
90
+ name={row.original.title}
91
+ fallbackBackgroundColor="$color4"
92
+ size={nestedPx}
93
+ data-nested-px={nestedPx}
94
+ />
95
+ <YStack flexShrink={1} minWidth={0}>
96
+ <Text fontWeight="600" numberOfLines={1}>
97
+ {row.original.title}
98
+ </Text>
99
+ </YStack>
100
+ </XStack>
101
+ ),
102
+ },
103
+ ...(facetLabel
104
+ ? [
105
+ {
106
+ id: "facet",
107
+ header: facetLabel,
108
+ accessorFn: (row: TableRow<TDoc>) => row.values.join(", "),
109
+ enableSorting: false,
110
+ sortable: false,
111
+ cell: ({ row }: { row: { original: TableRow<TDoc> } }) => (
112
+ <XStack gap="$1.5" flexWrap="wrap">
113
+ {row.original.values.length > 0 ? (
114
+ row.original.values.map((value) => (
115
+ <FacetBadge
116
+ key={value}
117
+ label={record.valueLabel(value)}
118
+ tint={record.valueTint(value)}
119
+ compact
120
+ />
121
+ ))
122
+ ) : (
123
+ <Text {...knobProps.label} color="$color10">
124
+ —
125
+ </Text>
126
+ )}
127
+ </XStack>
128
+ ),
129
+ } satisfies DataTableColumn<TableRow<TDoc>>,
130
+ ]
131
+ : []),
132
+ ...metrics.map(
133
+ (metric, index) =>
134
+ ({
135
+ id: metric.field,
136
+ accessorKey: metric.field,
137
+ header: metric.label,
138
+ align: "right",
139
+ cell: ({ row }: { row: { original: TableRow<TDoc> } }) => (
140
+ <Text fontWeight={index === 0 ? "700" : undefined}>
141
+ {formatMetric(metric, row.original[metric.field] as number)}
142
+ </Text>
143
+ ),
144
+ }) satisfies DataTableColumn<TableRow<TDoc>>,
145
+ ),
146
+ ],
147
+ [t, hasCode, facetLabel, metrics, record, nestedPx, knobProps.label],
148
+ );
149
+
150
+ return (
151
+ <YStack testID={testID}>
152
+ <DataTable
153
+ data={data}
154
+ columns={columns}
155
+ enableFiltering={false}
156
+ enableGlobalSearch={false}
157
+ enableSorting
158
+ enablePagination
159
+ pageSizeOptions={[pageSize, pageSize * 2, pageSize * 5]}
160
+ initialState={{ pagination: { pageIndex: 0, pageSize } }}
161
+ readOnly
162
+ columnLayout="auto"
163
+ onRowPress={(row) => record.open(row.doc)}
164
+ rowLabel={(row) => row.title}
165
+ aria-label={label}
166
+ />
167
+ </YStack>
168
+ );
169
+ }
@@ -0,0 +1,143 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import {
3
+ average,
4
+ bucketWidth,
5
+ facetDistribution,
6
+ foldDistribution,
7
+ histogram,
8
+ multiValued,
9
+ orderRows,
10
+ topBy,
11
+ } from "./insightsData";
12
+
13
+ const rows = [
14
+ { name: "bulbasaur", xp: 64, height: 7 },
15
+ { name: "charmander", xp: 62, height: 6 },
16
+ { name: "charizard", xp: 240, height: 17 },
17
+ { name: "pikachu", xp: 112, height: 4 },
18
+ { name: "mew", xp: null, height: 4 },
19
+ ];
20
+
21
+ const types = new Map<string, string[]>([
22
+ ["bulbasaur", ["grass", "poison"]],
23
+ ["charmander", ["fire"]],
24
+ ["charizard", ["fire", "flying"]],
25
+ ["pikachu", ["electric"]],
26
+ ["missingno", ["normal"]],
27
+ ]);
28
+
29
+ describe("facetDistribution", () => {
30
+ it("counts the listed records per value, most common first, ties A to Z", () => {
31
+ expect(facetDistribution(types, rows)).toEqual([
32
+ { value: "fire", count: 2 },
33
+ { value: "electric", count: 1 },
34
+ { value: "flying", count: 1 },
35
+ { value: "grass", count: 1 },
36
+ { value: "poison", count: 1 },
37
+ ]);
38
+ });
39
+
40
+ it("ignores values of records outside the rows", () => {
41
+ expect(facetDistribution(types, rows).some((entry) => entry.value === "normal")).toBe(false);
42
+ });
43
+ });
44
+
45
+ describe("foldDistribution", () => {
46
+ const entries = facetDistribution(types, rows);
47
+
48
+ it("keeps a distribution that fits", () => {
49
+ expect(foldDistribution(entries, 5)).toEqual(entries);
50
+ });
51
+
52
+ it("folds the tail into one other entry holding its sum", () => {
53
+ expect(foldDistribution(entries, 3)).toEqual([
54
+ { value: "fire", count: 2 },
55
+ { value: "electric", count: 1 },
56
+ { value: "", count: 3, other: true },
57
+ ]);
58
+ });
59
+ });
60
+
61
+ describe("multiValued", () => {
62
+ it("counts the listed records carrying more than one value", () => {
63
+ expect(multiValued(types, rows)).toBe(2);
64
+ });
65
+ });
66
+
67
+ describe("average", () => {
68
+ it("means a field over every row, a missing value as 0", () => {
69
+ expect(average(rows, "xp")).toBeCloseTo((64 + 62 + 240 + 112) / 5);
70
+ });
71
+
72
+ it("is 0 for no rows", () => {
73
+ expect(average([], "xp")).toBe(0);
74
+ });
75
+ });
76
+
77
+ describe("topBy", () => {
78
+ it("ranks by a field, largest first, ties in the rows' order", () => {
79
+ expect(topBy(rows, "height", 3).map((row) => row.name)).toEqual([
80
+ "charizard",
81
+ "bulbasaur",
82
+ "charmander",
83
+ ]);
84
+ expect(
85
+ topBy(rows, "height", 5)
86
+ .slice(3)
87
+ .map((row) => row.name),
88
+ ).toEqual(["pikachu", "mew"]);
89
+ });
90
+
91
+ it("never mutates its input", () => {
92
+ const before = rows.map((row) => row.name);
93
+ topBy(rows, "xp", 2);
94
+ expect(rows.map((row) => row.name)).toEqual(before);
95
+ });
96
+ });
97
+
98
+ describe("histogram", () => {
99
+ it("buckets a field from 0 and keeps the empty buckets between", () => {
100
+ expect(histogram(rows, "xp", 60)).toEqual([
101
+ { label: "0–59", value: 1 },
102
+ { label: "60–119", value: 3 },
103
+ { label: "120–179", value: 0 },
104
+ { label: "180–239", value: 0 },
105
+ { label: "240–299", value: 1 },
106
+ ]);
107
+ });
108
+
109
+ it("is empty for no rows", () => {
110
+ expect(histogram([], "xp", 60)).toEqual([]);
111
+ });
112
+
113
+ it("picks a round width for about six buckets when none is given", () => {
114
+ expect(bucketWidth(240)).toBe(50);
115
+ expect(bucketWidth(17)).toBe(5);
116
+ expect(bucketWidth(0)).toBe(1);
117
+ expect(histogram(rows, "height").map((bucket) => bucket.label)).toEqual([
118
+ "0–4",
119
+ "5–9",
120
+ "10–14",
121
+ "15–19",
122
+ ]);
123
+ });
124
+ });
125
+
126
+ describe("orderRows", () => {
127
+ it("orders by each key in turn, a missing value first ascending", () => {
128
+ expect(
129
+ orderRows(rows, [
130
+ { field: "height", order: "desc" },
131
+ { field: "name", order: "asc" },
132
+ ]).map((row) => row.name),
133
+ ).toEqual(["charizard", "bulbasaur", "charmander", "mew", "pikachu"]);
134
+ expect(orderRows(rows, [{ field: "xp", order: "asc" }])[0].name).toBe("mew");
135
+ });
136
+
137
+ it("keeps the rows as they are without an order, and never mutates them", () => {
138
+ expect(orderRows(rows, undefined)).toEqual(rows);
139
+ const before = rows.map((row) => row.name);
140
+ orderRows(rows, [{ field: "xp", order: "desc" }]);
141
+ expect(rows.map((row) => row.name)).toEqual(before);
142
+ });
143
+ });
@@ -0,0 +1,122 @@
1
+ /**
2
+ * The aggregates an insights page draws from the rows one list reads and the
3
+ * values its facet reading found: no React, no IO.
4
+ */
5
+
6
+ type Row = { name?: string } & Record<string, unknown>;
7
+
8
+ export interface InsightsCount {
9
+ value: string;
10
+ count: number;
11
+ /** The folded tail of a distribution. */
12
+ other?: boolean;
13
+ }
14
+
15
+ export interface InsightsBucket {
16
+ /** The bucket's range, "60–119". */
17
+ label: string;
18
+ value: number;
19
+ }
20
+
21
+ function numberOf(row: Row, field: string): number {
22
+ const value = Number(row[field]);
23
+ return Number.isFinite(value) ? value : 0;
24
+ }
25
+
26
+ /** Records per facet value among `rows`, most common first, ties A to Z. */
27
+ export function facetDistribution(
28
+ values: ReadonlyMap<string, readonly string[]>,
29
+ rows: readonly Row[],
30
+ ): InsightsCount[] {
31
+ const counts = new Map<string, number>();
32
+ for (const row of rows) {
33
+ for (const value of values.get(row.name ?? "") ?? []) {
34
+ counts.set(value, (counts.get(value) ?? 0) + 1);
35
+ }
36
+ }
37
+ return [...counts]
38
+ .map(([value, count]) => ({ value, count }))
39
+ .sort((a, b) => b.count - a.count || a.value.localeCompare(b.value));
40
+ }
41
+
42
+ /** At most `max` entries: the tail folds into one `other` entry holding its sum. */
43
+ export function foldDistribution(entries: readonly InsightsCount[], max: number): InsightsCount[] {
44
+ if (entries.length <= max) return [...entries];
45
+ const kept = entries.slice(0, Math.max(0, max - 1));
46
+ const tail = entries.slice(kept.length).reduce((sum, entry) => sum + entry.count, 0);
47
+ return [...kept, { value: "", count: tail, other: true }];
48
+ }
49
+
50
+ /** Records among `rows` carrying more than one facet value. */
51
+ export function multiValued(
52
+ values: ReadonlyMap<string, readonly string[]>,
53
+ rows: readonly Row[],
54
+ ): number {
55
+ return rows.filter((row) => (values.get(row.name ?? "") ?? []).length > 1).length;
56
+ }
57
+
58
+ export function average(rows: readonly Row[], field: string): number {
59
+ if (rows.length === 0) return 0;
60
+ return rows.reduce((sum, row) => sum + numberOf(row, field), 0) / rows.length;
61
+ }
62
+
63
+ function compareValues(a: unknown, b: unknown): number {
64
+ if (a === b) return 0;
65
+ if (a === null || a === undefined) return -1;
66
+ if (b === null || b === undefined) return 1;
67
+ if (typeof a === "number" && typeof b === "number") return a - b;
68
+ return String(a).localeCompare(String(b));
69
+ }
70
+
71
+ /**
72
+ * The rows in an order-by's order, key by key: a collection does not promise
73
+ * it (a fixture corpus answers in insertion order), and ranks break their
74
+ * ties in this order.
75
+ */
76
+ export function orderRows<TRow extends Row>(
77
+ rows: readonly TRow[],
78
+ orderBy: ReadonlyArray<{ field: string; order: string }> | undefined,
79
+ ): TRow[] {
80
+ if (!orderBy?.length) return [...rows];
81
+ return [...rows].sort((a, b) => {
82
+ for (const { field, order } of orderBy) {
83
+ const compared = compareValues(a[field], b[field]);
84
+ if (compared !== 0) return order === "desc" ? -compared : compared;
85
+ }
86
+ return 0;
87
+ });
88
+ }
89
+
90
+ /** The `n` rows with the largest `field`; ties keep the rows' order. */
91
+ export function topBy<TRow extends Row>(rows: readonly TRow[], field: string, n: number): TRow[] {
92
+ return [...rows].sort((a, b) => numberOf(b, field) - numberOf(a, field)).slice(0, Math.max(0, n));
93
+ }
94
+
95
+ /** A round bucket width (1, 2 or 5 times a power of ten) for about six buckets up to `max`. */
96
+ export function bucketWidth(max: number): number {
97
+ const raw = max / 6;
98
+ if (!(raw > 1)) return 1;
99
+ const magnitude = 10 ** Math.floor(Math.log10(raw));
100
+ return [1, 2, 5, 10].map((step) => step * magnitude).find((width) => width >= raw) ?? raw;
101
+ }
102
+
103
+ /**
104
+ * Counts of `field` in `width`-wide buckets from 0, empty buckets between
105
+ * occupied ones kept so a bar chart's axis reads as a scale.
106
+ */
107
+ export function histogram(rows: readonly Row[], field: string, width?: number): InsightsBucket[] {
108
+ if (rows.length === 0) return [];
109
+ const values = rows.map((row) => Math.max(0, numberOf(row, field)));
110
+ const size = width && width > 0 ? width : bucketWidth(Math.max(...values));
111
+ const counts = new Map<number, number>();
112
+ let last = 0;
113
+ for (const value of values) {
114
+ const bucket = Math.floor(value / size);
115
+ counts.set(bucket, (counts.get(bucket) ?? 0) + 1);
116
+ last = Math.max(last, bucket);
117
+ }
118
+ return Array.from({ length: last + 1 }, (_, bucket) => ({
119
+ label: `${bucket * size}–${(bucket + 1) * size - 1}`,
120
+ value: counts.get(bucket) ?? 0,
121
+ }));
122
+ }
@@ -0,0 +1,36 @@
1
+ /** A record as the insights sections draw it, resolved once by FrappeInsights. */
2
+ export interface InsightsRecordView<TDoc> {
3
+ title: (doc: TDoc) => string;
4
+ code: (doc: TDoc) => string | undefined;
5
+ images: (doc: TDoc) => string[];
6
+ /** The facet values' tints, first value first. */
7
+ tints: (doc: TDoc) => (string | undefined)[];
8
+ /** The record's facet values. */
9
+ values: (doc: TDoc) => string[];
10
+ valueLabel: (value: string) => string;
11
+ valueTint: (value: string) => string | undefined;
12
+ open: (doc: TDoc) => void;
13
+ }
14
+
15
+ export interface FrappeInsightsMetric {
16
+ /** A numeric field of the doctype. */
17
+ field: string;
18
+ label: string;
19
+ /** A value as shown (units, precision); defaults to the number. */
20
+ format?: (value: number) => string;
21
+ /** Names the metric's record-holder tile ("Tallest"); without it, no tile. */
22
+ record?: string;
23
+ /** Histogram bucket width; defaults to a round width for about six buckets. */
24
+ bucket?: number;
25
+ /** A record page fills a bar under the value to this ceiling. */
26
+ max?: number;
27
+ }
28
+
29
+ export function metricValue(doc: unknown, field: string): number {
30
+ const value = Number((doc as Record<string, unknown>)[field]);
31
+ return Number.isFinite(value) ? value : 0;
32
+ }
33
+
34
+ export function formatMetric(metric: FrappeInsightsMetric, value: number): string {
35
+ return metric.format ? metric.format(value) : String(value);
36
+ }
@@ -0,0 +1,41 @@
1
+ import { Text, XStack } from "@multiplatform.one/components";
2
+ import { hairlineWidth, useResolvedKnobs } from "@multiplatform.one/theme";
3
+
4
+ export interface FacetBadgeProps {
5
+ label: string;
6
+ /** Theme hue (`"grass"`) painting the badge from its ramp. */
7
+ tint?: string;
8
+ /** A step smaller, for image wells and table cells. */
9
+ compact?: boolean;
10
+ }
11
+
12
+ /**
13
+ * One facet value as a static badge: nested density (LC-73), the tint's
14
+ * step-4 fill, step-7 border and step-12 text (DF-04, AA in both schemes).
15
+ */
16
+ export function FacetBadge({ label, tint = "gray", compact = false }: FacetBadgeProps) {
17
+ const { knobProps } = useResolvedKnobs({ compact: true });
18
+ return (
19
+ <XStack
20
+ {...knobProps.borderRadius}
21
+ paddingHorizontal={compact ? "$1.5" : "$2"}
22
+ paddingVertical={compact ? "$0.5" : "$1"}
23
+ backgroundColor={`$${tint}4` as never}
24
+ borderColor={`$${tint}7` as never}
25
+ borderWidth={hairlineWidth}
26
+ alignItems="center"
27
+ >
28
+ <Text
29
+ {...knobProps.label}
30
+ {...knobProps.body}
31
+ textTransform="capitalize"
32
+ fontWeight="700"
33
+ color={`$${tint}12` as never}
34
+ {...(compact ? { fontSize: "$1" as const } : null)}
35
+ letterSpacing={0.3}
36
+ >
37
+ {label}
38
+ </Text>
39
+ </XStack>
40
+ );
41
+ }