@12-apps/ui 6.22.0 → 6.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 (347) hide show
  1. package/NATIVE.md +2 -1
  2. package/components-catalog.md +7 -0
  3. package/dist/_internal/components/data-display/AsyncStateContainer/AsyncStateContainer.js +3 -3
  4. package/dist/_internal/components/data-display/Avatar/Avatar.js +4 -4
  5. package/dist/_internal/components/data-display/Avatar/Avatar.view.js +2 -2
  6. package/dist/_internal/components/data-display/Badge/Badge.js +2 -2
  7. package/dist/_internal/components/data-display/CardKit/use-remove-confirm.js +1 -1
  8. package/dist/_internal/components/data-display/CardKit/use-row-confirm.js +1 -1
  9. package/dist/_internal/components/data-display/Carousel/Carousel.js +2 -2
  10. package/dist/_internal/components/data-display/Chart/Chart.js +4 -4
  11. package/dist/_internal/components/data-display/Chart/SpecChart.js +7 -7
  12. package/dist/_internal/components/data-display/Chart/chart-context.js +2 -2
  13. package/dist/_internal/components/data-display/Chart/chart-renderers.js +3 -3
  14. package/dist/_internal/components/data-display/Chart/chart-spec.js +2 -2
  15. package/dist/_internal/components/data-display/DataGrid/DataGrid.js +2 -2
  16. package/dist/_internal/components/data-display/DataViews/DataViewsGrid.js +41 -41
  17. package/dist/_internal/components/data-display/DataViews/DataViewsTableBase.js +47 -47
  18. package/dist/_internal/components/data-display/DataViews/ManageViewsDialog.js +1 -1
  19. package/dist/_internal/components/data-display/DataViews/base-list-card-geometry.js +4 -4
  20. package/dist/_internal/components/data-display/DataViews/base-list-card-slots.js +3 -3
  21. package/dist/_internal/components/data-display/DataViews/base-list-card.js +6 -6
  22. package/dist/_internal/components/data-display/DataViews/data-views-category-pill.js +5 -5
  23. package/dist/_internal/components/data-display/DataViews/data-views-display-panel.js +3 -3
  24. package/dist/_internal/components/data-display/DataViews/data-views-filter-panel.js +10 -10
  25. package/dist/_internal/components/data-display/DataViews/data-views-grid-bodies.js +6 -6
  26. package/dist/_internal/components/data-display/DataViews/data-views-grid-parts.js +36 -36
  27. package/dist/_internal/components/data-display/DataViews/data-views-inline-bar.js +11 -11
  28. package/dist/_internal/components/data-display/DataViews/data-views-more-fields.js +3 -3
  29. package/dist/_internal/components/data-display/DataViews/data-views-more-filters.js +4 -4
  30. package/dist/_internal/components/data-display/DataViews/data-views-pagination.js +3 -3
  31. package/dist/_internal/components/data-display/DataViews/data-views-range-pill.js +2 -2
  32. package/dist/_internal/components/data-display/DataViews/data-views-scope-tabs.js +2 -2
  33. package/dist/_internal/components/data-display/DataViews/data-views-shell-toolbar.js +6 -6
  34. package/dist/_internal/components/data-display/DataViews/data-views-table-parts.js +1 -1
  35. package/dist/_internal/components/data-display/DataViews/data-views-toolbar.js +5 -5
  36. package/dist/_internal/components/data-display/DataViews/list-card-rails.js +2 -2
  37. package/dist/_internal/components/data-display/DataViews/use-data-views-state.js +4 -4
  38. package/dist/_internal/components/data-display/FleetMap/FleetBody.js +32 -0
  39. package/dist/_internal/components/data-display/FleetMap/FleetCanvas.js +23 -0
  40. package/dist/_internal/components/data-display/FleetMap/FleetCanvas.js.map +1 -0
  41. package/dist/_internal/components/data-display/FleetMap/FleetMap.base.js +1 -0
  42. package/dist/_internal/components/data-display/FleetMap/FleetMap.base.js.map +1 -0
  43. package/dist/_internal/components/data-display/FleetMap/FleetMap.fixtures.js +57 -0
  44. package/dist/_internal/components/data-display/FleetMap/FleetMap.fixtures.js.map +1 -0
  45. package/dist/_internal/components/data-display/FleetMap/FleetMap.helpers.js +14 -0
  46. package/dist/_internal/components/data-display/FleetMap/FleetMap.helpers.js.map +1 -0
  47. package/dist/_internal/components/data-display/FleetMap/FleetMap.hooks.js +9 -0
  48. package/dist/_internal/components/data-display/FleetMap/FleetMap.hooks.js.map +1 -0
  49. package/dist/_internal/components/data-display/FleetMap/FleetMap.js +47 -0
  50. package/dist/_internal/components/data-display/FleetMap/FleetMap.js.map +1 -0
  51. package/dist/_internal/components/data-display/FleetMap/FleetMap.metrics.js +20 -0
  52. package/dist/_internal/components/data-display/FleetMap/FleetMap.metrics.js.map +1 -0
  53. package/dist/_internal/components/data-display/FleetMap/FleetMap.types.js +1 -0
  54. package/dist/_internal/components/data-display/FleetMap/FleetMap.types.js.map +1 -0
  55. package/dist/_internal/components/data-display/FleetMap/FleetRoster.js +15 -0
  56. package/dist/_internal/components/data-display/FleetMap/FleetRoster.js.map +1 -0
  57. package/dist/_internal/components/data-display/HoverCard/HoverCard.js +2 -2
  58. package/dist/_internal/components/data-display/Lightbox/Lightbox.js +2 -2
  59. package/dist/_internal/components/data-display/MapPreview/MapLayers.js +2 -2
  60. package/dist/_internal/components/data-display/MapPreview/MapPreview.js +6 -6
  61. package/dist/_internal/components/data-display/Sheet/Sheet.hooks.js +2 -2
  62. package/dist/_internal/components/data-display/Sheet/Sheet.js +3 -3
  63. package/dist/_internal/components/data-display/Table/Table.js +3 -3
  64. package/dist/_internal/components/data-display/index.js +90 -69
  65. package/dist/_internal/components/feedback/Modal/Modal.js +2 -2
  66. package/dist/_internal/components/feedback/StackedModal/StackedModal.js +2 -2
  67. package/dist/_internal/components/feedback/index.js +14 -14
  68. package/dist/_internal/components/form/AddressAutocomplete/AddressAutocomplete.hooks.js +3 -3
  69. package/dist/_internal/components/form/AddressAutocomplete/AddressAutocomplete.js +5 -5
  70. package/dist/_internal/components/form/AddressAutocomplete/AddressAutocompleteField.js +2 -2
  71. package/dist/_internal/components/form/CategorySelect/CategoryPanel.js +2 -2
  72. package/dist/_internal/components/form/CategorySelect/CategorySelect.js +4 -4
  73. package/dist/_internal/components/form/Command/Command.js +2 -2
  74. package/dist/_internal/components/form/DateRangePicker/DateRangePicker.js +3 -3
  75. package/dist/_internal/components/form/PhoneInput/PhoneInput.hooks.js +2 -2
  76. package/dist/_internal/components/form/PhoneInput/PhoneInput.js +3 -3
  77. package/dist/_internal/components/form/index.js +30 -30
  78. package/dist/_internal/components/form/total-form/Fields/CategoryField.js +5 -5
  79. package/dist/_internal/components/form/total-form/Fields/index.js +9 -9
  80. package/dist/_internal/components/index.js +160 -140
  81. package/dist/_internal/components/layout/SettingsLayout/SettingsLayout.js +2 -2
  82. package/dist/_internal/components/layout/index.js +20 -20
  83. package/dist/_internal/components/navigation/AppHeader/AppHeader.details.js +4 -4
  84. package/dist/_internal/components/navigation/Pagination/Pagination.js +2 -2
  85. package/dist/_internal/components/navigation/index.js +12 -12
  86. package/dist/_internal/components/utility/index.js +4 -4
  87. package/dist/_internal/platform/aria.js.map +1 -1
  88. package/dist/_internal/pt-BR.data-display.js +2 -2
  89. package/dist/_internal/user-avatar/user-avatar.js +5 -5
  90. package/dist/charts.js +10 -10
  91. package/dist/{chunk-WGRS4PGY.js → chunk-2C47DEVU.js} +4 -4
  92. package/dist/chunk-2RQINU5T.js +41 -0
  93. package/dist/chunk-2RQINU5T.js.map +1 -0
  94. package/dist/{chunk-WMALDOF5.js → chunk-4G3FGCWX.js} +4 -4
  95. package/dist/{chunk-ZOUWHGV3.js → chunk-4MGFUPQT.js} +4 -4
  96. package/dist/{chunk-QFJRB27Q.js → chunk-6LGWJFQK.js} +2 -2
  97. package/dist/{chunk-XSF6AXEU.js → chunk-6RZDDUSM.js} +2 -2
  98. package/dist/{chunk-VIK3HAUQ.js → chunk-73NJCGQG.js} +2 -2
  99. package/dist/{chunk-UU3QAKG6.js → chunk-B7DKSBAE.js} +14 -14
  100. package/dist/{chunk-3FLVIVOK.js → chunk-BHIGHSXA.js} +2 -2
  101. package/dist/{chunk-HKV4MQ2W.js → chunk-BLBOYCOV.js} +5 -5
  102. package/dist/chunk-BTQZ3EX3.js +45 -0
  103. package/dist/chunk-BTQZ3EX3.js.map +1 -0
  104. package/dist/{chunk-PFV6RL4Q.js → chunk-C6KTQF4F.js} +3 -3
  105. package/dist/chunk-CDCTLPMD.js +1 -0
  106. package/dist/chunk-CDCTLPMD.js.map +1 -0
  107. package/dist/{chunk-LYSSO6WC.js → chunk-CZPU5TW3.js} +4 -4
  108. package/dist/{chunk-PMS3H3OO.js → chunk-DF2FFYZ7.js} +4 -4
  109. package/dist/{chunk-QZBUGUOY.js → chunk-DFLTUI7W.js} +4 -4
  110. package/dist/{chunk-WLQTHPMX.js → chunk-EJQW2IYW.js} +2 -2
  111. package/dist/{chunk-VQAM2XZV.js → chunk-EMUBMZMA.js} +2 -2
  112. package/dist/{chunk-XFUNJYFT.js → chunk-EPNUVSNK.js} +7 -7
  113. package/dist/{chunk-MSUSZLRE.js → chunk-EWT3WMVY.js} +5 -5
  114. package/dist/{chunk-Q75SJ35X.js → chunk-GMTM6EN7.js} +3 -3
  115. package/dist/{chunk-R6SBP5M5.js → chunk-GOWBYHYW.js} +4 -4
  116. package/dist/{chunk-6NZTYZP5.js → chunk-GVA5CYKP.js} +2 -2
  117. package/dist/chunk-HMV4QMXS.js +219 -0
  118. package/dist/chunk-HMV4QMXS.js.map +1 -0
  119. package/dist/{chunk-VR5HDUBK.js → chunk-HP2ODXNA.js} +2 -2
  120. package/dist/{chunk-2MMEIN4T.js → chunk-I3E2QHTH.js} +4 -4
  121. package/dist/{chunk-UVGRRI7N.js → chunk-IPVYEPXO.js} +4 -4
  122. package/dist/{chunk-5ZTUP65G.js → chunk-JM64OEU6.js} +5 -5
  123. package/dist/{chunk-7BYFC2MR.js → chunk-JUHUKZGU.js} +7 -7
  124. package/dist/chunk-JZXWCEH5.js +116 -0
  125. package/dist/chunk-JZXWCEH5.js.map +1 -0
  126. package/dist/{chunk-DVUPIVI2.js → chunk-KT6HWAEN.js} +4 -4
  127. package/dist/{chunk-TLMLEC4F.js → chunk-KW7H5O3K.js} +6 -6
  128. package/dist/{chunk-VLHGBFR6.js → chunk-MZQTHSLN.js} +3 -3
  129. package/dist/{chunk-4SQFO4GW.js → chunk-NA7MIEG6.js} +7 -7
  130. package/dist/{chunk-QWDEOITU.js → chunk-O4VCZTK4.js} +2 -2
  131. package/dist/{chunk-LS4FMSHY.js → chunk-OAYX4XN7.js} +4 -4
  132. package/dist/{chunk-Y5UCOBQN.js → chunk-OGGHD64H.js} +4 -4
  133. package/dist/{chunk-7TZ6OC5T.js → chunk-OH3YGJT5.js} +2 -2
  134. package/dist/{chunk-REMK55JI.js → chunk-OLZTGVBT.js} +4 -4
  135. package/dist/{chunk-VNNG46TS.js → chunk-ORSLFKKZ.js} +6 -6
  136. package/dist/{chunk-ZIYMBR7K.js → chunk-OTH7H3IP.js} +2 -2
  137. package/dist/{chunk-5NKUYCZD.js → chunk-PN5CQKA2.js} +4 -4
  138. package/dist/{chunk-J4W4TQPC.js → chunk-QJRDDVZ2.js} +5 -5
  139. package/dist/{chunk-VNDOQEJ7.js → chunk-QRX5BYUQ.js} +4 -4
  140. package/dist/{chunk-XT7HMNBW.js → chunk-R6SNYC3D.js} +5 -5
  141. package/dist/{chunk-W2UTDN4T.js → chunk-RBGOGTT2.js} +4 -4
  142. package/dist/chunk-RP5FK3SO.js +79 -0
  143. package/dist/chunk-RP5FK3SO.js.map +1 -0
  144. package/dist/{chunk-X5MPHXG5.js → chunk-RPWEXIAW.js} +6 -6
  145. package/dist/chunk-RQWZYD6H.js +1 -0
  146. package/dist/chunk-RQWZYD6H.js.map +1 -0
  147. package/dist/{chunk-EXJBPKGW.js → chunk-SHDIZSN5.js} +5 -5
  148. package/dist/{chunk-23FCBIUN.js → chunk-TNVO2DTB.js} +8 -8
  149. package/dist/{chunk-AGSBIUPV.js → chunk-TPLKJHNN.js} +4 -4
  150. package/dist/{chunk-YQ6TNHAC.js → chunk-TTLI6PF7.js} +5 -5
  151. package/dist/{chunk-U2AC4AQX.js → chunk-TU5EIKJA.js} +4 -4
  152. package/dist/{chunk-KTK4A3IF.js → chunk-TX5V42AY.js} +11 -11
  153. package/dist/{chunk-BGYLL467.js → chunk-TXHJX2NG.js} +4 -4
  154. package/dist/{chunk-FL54G7PV.js → chunk-WIT3Y7JT.js} +2 -2
  155. package/dist/{chunk-W7Y6RA6W.js → chunk-WR5JFDQ5.js} +4 -4
  156. package/dist/chunk-XPMGFAJ3.js +36 -0
  157. package/dist/chunk-XPMGFAJ3.js.map +1 -0
  158. package/dist/{chunk-2UYR2OOE.js → chunk-YRUCIKPO.js} +4 -4
  159. package/dist/{chunk-AEGXHZQT.js → chunk-YW5T6KZ5.js} +7 -7
  160. package/dist/{chunk-QKIJ6YXZ.js → chunk-ZA4U5GDU.js} +4 -4
  161. package/dist/chunk-ZCPSND5Y.js +64 -0
  162. package/dist/chunk-ZCPSND5Y.js.map +1 -0
  163. package/dist/{chunk-ZKR5B6YJ.js → chunk-ZRPGVHTR.js} +2 -2
  164. package/dist/{chunk-OXQP3N6X.js → chunk-ZTZ6S5Q6.js} +4 -4
  165. package/dist/data-display/AsyncStateContainer.js +3 -3
  166. package/dist/data-display/Avatar.js +4 -4
  167. package/dist/data-display/Badge.js +2 -2
  168. package/dist/data-display/CardKit.js +11 -11
  169. package/dist/data-display/Carousel.js +2 -2
  170. package/dist/data-display/Chart.js +10 -10
  171. package/dist/data-display/DataGrid.js +2 -2
  172. package/dist/data-display/DataViews.js +68 -68
  173. package/dist/data-display/FleetMap.js +55 -0
  174. package/dist/data-display/FleetMap.js.map +1 -0
  175. package/dist/data-display/HoverCard.js +2 -2
  176. package/dist/data-display/Lightbox.js +2 -2
  177. package/dist/data-display/MapPreview.js +6 -6
  178. package/dist/data-display/Sheet.js +3 -3
  179. package/dist/data-display/Table.js +3 -3
  180. package/dist/feedback/ConfirmAction.js +3 -3
  181. package/dist/feedback/Modal.js +2 -2
  182. package/dist/feedback/StackedModal.js +2 -2
  183. package/dist/form/AddressAutocomplete.js +5 -5
  184. package/dist/form/CategorySelect.js +4 -4
  185. package/dist/form/Command.js +2 -2
  186. package/dist/form/DateRangePicker.js +5 -5
  187. package/dist/form/PhoneInput.js +3 -3
  188. package/dist/form/total-form.js +9 -9
  189. package/dist/layout/SettingsLayout.js +2 -2
  190. package/dist/locales.js +4 -4
  191. package/dist/native/chunks/{chunk-T6BJPP3E.js → chunk-DN73KYIZ.js} +1 -1
  192. package/dist/native/chunks/chunk-DN73KYIZ.js.map +1 -0
  193. package/dist/native/chunks/chunk-GW7TQ7HO.js +215 -0
  194. package/dist/native/chunks/chunk-GW7TQ7HO.js.map +1 -0
  195. package/dist/native/chunks/chunk-MJVSQXOD.js +9 -0
  196. package/dist/native/chunks/chunk-MJVSQXOD.js.map +1 -0
  197. package/dist/native/chunks/chunk-ZAQ3AZJM.js +292 -0
  198. package/dist/native/chunks/chunk-ZAQ3AZJM.js.map +1 -0
  199. package/dist/native/data-display/Alert.js +4 -4
  200. package/dist/native/data-display/Avatar.js +3 -3
  201. package/dist/native/data-display/Badge.js +4 -4
  202. package/dist/native/data-display/Chip.js +3 -5
  203. package/dist/native/data-display/Chip.js.map +1 -1
  204. package/dist/native/data-display/EmptyState.js +9 -286
  205. package/dist/native/data-display/EmptyState.js.map +1 -1
  206. package/dist/native/data-display/ErrorState.js +6 -6
  207. package/dist/native/data-display/FleetMap.js +498 -0
  208. package/dist/native/data-display/FleetMap.js.map +1 -0
  209. package/dist/native/data-display/LoadingState.js +3 -3
  210. package/dist/native/feedback/Dialog.js +3 -3
  211. package/dist/native/form/Checkbox.js +1 -1
  212. package/dist/native/form/Input.js +1 -1
  213. package/dist/native/form/Select.js +1 -1
  214. package/dist/native/form/Switch.js +1 -1
  215. package/dist/native/layout/Card.js +3 -3
  216. package/dist/native/layout/Skeleton.js +6 -209
  217. package/dist/native/layout/Skeleton.js.map +1 -1
  218. package/dist/navigation/AppHeader.js +6 -6
  219. package/dist/navigation/Pagination.js +2 -2
  220. package/dist/pt-BR.js +4 -4
  221. package/dist/types/components/data-display/FleetMap/FleetBody.d.ts +22 -0
  222. package/dist/types/components/data-display/FleetMap/FleetBody.d.ts.map +1 -0
  223. package/dist/types/components/data-display/FleetMap/FleetCanvas.d.ts +50 -0
  224. package/dist/types/components/data-display/FleetMap/FleetCanvas.d.ts.map +1 -0
  225. package/dist/types/components/data-display/FleetMap/FleetMap.base.d.ts +141 -0
  226. package/dist/types/components/data-display/FleetMap/FleetMap.base.d.ts.map +1 -0
  227. package/dist/types/components/data-display/FleetMap/FleetMap.d.ts +32 -0
  228. package/dist/types/components/data-display/FleetMap/FleetMap.d.ts.map +1 -0
  229. package/dist/types/components/data-display/FleetMap/FleetMap.fixtures.d.ts +23 -0
  230. package/dist/types/components/data-display/FleetMap/FleetMap.fixtures.d.ts.map +1 -0
  231. package/dist/types/components/data-display/FleetMap/FleetMap.helpers.d.ts +45 -0
  232. package/dist/types/components/data-display/FleetMap/FleetMap.helpers.d.ts.map +1 -0
  233. package/dist/types/components/data-display/FleetMap/FleetMap.hooks.d.ts +71 -0
  234. package/dist/types/components/data-display/FleetMap/FleetMap.hooks.d.ts.map +1 -0
  235. package/dist/types/components/data-display/FleetMap/FleetMap.metrics.d.ts +76 -0
  236. package/dist/types/components/data-display/FleetMap/FleetMap.metrics.d.ts.map +1 -0
  237. package/dist/types/components/data-display/FleetMap/FleetMap.types.d.ts +45 -0
  238. package/dist/types/components/data-display/FleetMap/FleetMap.types.d.ts.map +1 -0
  239. package/dist/types/components/data-display/FleetMap/FleetRoster.d.ts +15 -0
  240. package/dist/types/components/data-display/FleetMap/FleetRoster.d.ts.map +1 -0
  241. package/dist/types/components/data-display/FleetMap/index.d.ts +5 -0
  242. package/dist/types/components/data-display/FleetMap/index.d.ts.map +1 -0
  243. package/dist/types/components/data-display/index.d.ts +1 -0
  244. package/dist/types/components/data-display/index.d.ts.map +1 -1
  245. package/dist/types/platform/aria.d.ts +13 -0
  246. package/dist/types/platform/aria.d.ts.map +1 -1
  247. package/dist/types-native/components/data-display/FleetMap/FleetMap.base.d.ts +141 -0
  248. package/dist/types-native/components/data-display/FleetMap/FleetMap.base.d.ts.map +1 -0
  249. package/dist/types-native/components/data-display/FleetMap/FleetMap.helpers.d.ts +45 -0
  250. package/dist/types-native/components/data-display/FleetMap/FleetMap.helpers.d.ts.map +1 -0
  251. package/dist/types-native/components/data-display/FleetMap/FleetMap.hooks.d.ts +71 -0
  252. package/dist/types-native/components/data-display/FleetMap/FleetMap.hooks.d.ts.map +1 -0
  253. package/dist/types-native/components/data-display/FleetMap/FleetMap.metrics.d.ts +76 -0
  254. package/dist/types-native/components/data-display/FleetMap/FleetMap.metrics.d.ts.map +1 -0
  255. package/dist/types-native/components/data-display/FleetMap/FleetMap.native.d.ts +30 -0
  256. package/dist/types-native/components/data-display/FleetMap/FleetMap.native.d.ts.map +1 -0
  257. package/dist/types-native/components/data-display/FleetMap/FleetMap.types.native.d.ts +36 -0
  258. package/dist/types-native/components/data-display/FleetMap/FleetMap.types.native.d.ts.map +1 -0
  259. package/dist/types-native/components/data-display/FleetMap/FleetRoster.native.d.ts +17 -0
  260. package/dist/types-native/components/data-display/FleetMap/FleetRoster.native.d.ts.map +1 -0
  261. package/dist/types-native/components/data-display/FleetMap/index.native.d.ts +4 -0
  262. package/dist/types-native/components/data-display/FleetMap/index.native.d.ts.map +1 -0
  263. package/dist/types-native/platform/aria.d.ts +13 -0
  264. package/dist/types-native/platform/aria.d.ts.map +1 -1
  265. package/dist/user-avatar.js +5 -5
  266. package/package.json +9 -1
  267. package/src/components/data-display/FleetMap/FleetBody.tsx +96 -0
  268. package/src/components/data-display/FleetMap/FleetCanvas.tsx +80 -0
  269. package/src/components/data-display/FleetMap/FleetMap.base.ts +144 -0
  270. package/src/components/data-display/FleetMap/FleetMap.fixtures.ts +70 -0
  271. package/src/components/data-display/FleetMap/FleetMap.helpers.ts +85 -0
  272. package/src/components/data-display/FleetMap/FleetMap.hooks.ts +183 -0
  273. package/src/components/data-display/FleetMap/FleetMap.md +189 -0
  274. package/src/components/data-display/FleetMap/FleetMap.metrics.ts +81 -0
  275. package/src/components/data-display/FleetMap/FleetMap.native.tsx +185 -0
  276. package/src/components/data-display/FleetMap/FleetMap.tsx +163 -0
  277. package/src/components/data-display/FleetMap/FleetMap.types.native.ts +44 -0
  278. package/src/components/data-display/FleetMap/FleetMap.types.ts +53 -0
  279. package/src/components/data-display/FleetMap/FleetRoster.native.tsx +382 -0
  280. package/src/components/data-display/FleetMap/FleetRoster.tsx +327 -0
  281. package/src/components/data-display/FleetMap/NATIVE-NOTES.md +14 -0
  282. package/src/components/data-display/FleetMap/index.native.ts +10 -0
  283. package/src/components/data-display/FleetMap/index.ts +9 -0
  284. package/src/components/data-display/FleetMap/tests.md +84 -0
  285. package/src/components/data-display/FleetMap/track.md +50 -0
  286. package/src/components/data-display/index.ts +1 -0
  287. package/src/components/feedback/ConfirmAction/ConfirmAction.md +10 -4
  288. package/src/platform/aria.ts +13 -0
  289. package/dist/chunk-X3HL5C6H.js +0 -1
  290. package/dist/native/chunks/chunk-T6BJPP3E.js.map +0 -1
  291. /package/dist/{chunk-X3HL5C6H.js.map → _internal/components/data-display/FleetMap/FleetBody.js.map} +0 -0
  292. /package/dist/{chunk-WGRS4PGY.js.map → chunk-2C47DEVU.js.map} +0 -0
  293. /package/dist/{chunk-WMALDOF5.js.map → chunk-4G3FGCWX.js.map} +0 -0
  294. /package/dist/{chunk-ZOUWHGV3.js.map → chunk-4MGFUPQT.js.map} +0 -0
  295. /package/dist/{chunk-QFJRB27Q.js.map → chunk-6LGWJFQK.js.map} +0 -0
  296. /package/dist/{chunk-XSF6AXEU.js.map → chunk-6RZDDUSM.js.map} +0 -0
  297. /package/dist/{chunk-VIK3HAUQ.js.map → chunk-73NJCGQG.js.map} +0 -0
  298. /package/dist/{chunk-UU3QAKG6.js.map → chunk-B7DKSBAE.js.map} +0 -0
  299. /package/dist/{chunk-3FLVIVOK.js.map → chunk-BHIGHSXA.js.map} +0 -0
  300. /package/dist/{chunk-HKV4MQ2W.js.map → chunk-BLBOYCOV.js.map} +0 -0
  301. /package/dist/{chunk-PFV6RL4Q.js.map → chunk-C6KTQF4F.js.map} +0 -0
  302. /package/dist/{chunk-LYSSO6WC.js.map → chunk-CZPU5TW3.js.map} +0 -0
  303. /package/dist/{chunk-PMS3H3OO.js.map → chunk-DF2FFYZ7.js.map} +0 -0
  304. /package/dist/{chunk-QZBUGUOY.js.map → chunk-DFLTUI7W.js.map} +0 -0
  305. /package/dist/{chunk-WLQTHPMX.js.map → chunk-EJQW2IYW.js.map} +0 -0
  306. /package/dist/{chunk-VQAM2XZV.js.map → chunk-EMUBMZMA.js.map} +0 -0
  307. /package/dist/{chunk-XFUNJYFT.js.map → chunk-EPNUVSNK.js.map} +0 -0
  308. /package/dist/{chunk-MSUSZLRE.js.map → chunk-EWT3WMVY.js.map} +0 -0
  309. /package/dist/{chunk-Q75SJ35X.js.map → chunk-GMTM6EN7.js.map} +0 -0
  310. /package/dist/{chunk-R6SBP5M5.js.map → chunk-GOWBYHYW.js.map} +0 -0
  311. /package/dist/{chunk-6NZTYZP5.js.map → chunk-GVA5CYKP.js.map} +0 -0
  312. /package/dist/{chunk-VR5HDUBK.js.map → chunk-HP2ODXNA.js.map} +0 -0
  313. /package/dist/{chunk-2MMEIN4T.js.map → chunk-I3E2QHTH.js.map} +0 -0
  314. /package/dist/{chunk-UVGRRI7N.js.map → chunk-IPVYEPXO.js.map} +0 -0
  315. /package/dist/{chunk-5ZTUP65G.js.map → chunk-JM64OEU6.js.map} +0 -0
  316. /package/dist/{chunk-7BYFC2MR.js.map → chunk-JUHUKZGU.js.map} +0 -0
  317. /package/dist/{chunk-DVUPIVI2.js.map → chunk-KT6HWAEN.js.map} +0 -0
  318. /package/dist/{chunk-TLMLEC4F.js.map → chunk-KW7H5O3K.js.map} +0 -0
  319. /package/dist/{chunk-VLHGBFR6.js.map → chunk-MZQTHSLN.js.map} +0 -0
  320. /package/dist/{chunk-4SQFO4GW.js.map → chunk-NA7MIEG6.js.map} +0 -0
  321. /package/dist/{chunk-QWDEOITU.js.map → chunk-O4VCZTK4.js.map} +0 -0
  322. /package/dist/{chunk-LS4FMSHY.js.map → chunk-OAYX4XN7.js.map} +0 -0
  323. /package/dist/{chunk-Y5UCOBQN.js.map → chunk-OGGHD64H.js.map} +0 -0
  324. /package/dist/{chunk-7TZ6OC5T.js.map → chunk-OH3YGJT5.js.map} +0 -0
  325. /package/dist/{chunk-REMK55JI.js.map → chunk-OLZTGVBT.js.map} +0 -0
  326. /package/dist/{chunk-VNNG46TS.js.map → chunk-ORSLFKKZ.js.map} +0 -0
  327. /package/dist/{chunk-ZIYMBR7K.js.map → chunk-OTH7H3IP.js.map} +0 -0
  328. /package/dist/{chunk-5NKUYCZD.js.map → chunk-PN5CQKA2.js.map} +0 -0
  329. /package/dist/{chunk-J4W4TQPC.js.map → chunk-QJRDDVZ2.js.map} +0 -0
  330. /package/dist/{chunk-VNDOQEJ7.js.map → chunk-QRX5BYUQ.js.map} +0 -0
  331. /package/dist/{chunk-XT7HMNBW.js.map → chunk-R6SNYC3D.js.map} +0 -0
  332. /package/dist/{chunk-W2UTDN4T.js.map → chunk-RBGOGTT2.js.map} +0 -0
  333. /package/dist/{chunk-X5MPHXG5.js.map → chunk-RPWEXIAW.js.map} +0 -0
  334. /package/dist/{chunk-EXJBPKGW.js.map → chunk-SHDIZSN5.js.map} +0 -0
  335. /package/dist/{chunk-23FCBIUN.js.map → chunk-TNVO2DTB.js.map} +0 -0
  336. /package/dist/{chunk-AGSBIUPV.js.map → chunk-TPLKJHNN.js.map} +0 -0
  337. /package/dist/{chunk-YQ6TNHAC.js.map → chunk-TTLI6PF7.js.map} +0 -0
  338. /package/dist/{chunk-U2AC4AQX.js.map → chunk-TU5EIKJA.js.map} +0 -0
  339. /package/dist/{chunk-KTK4A3IF.js.map → chunk-TX5V42AY.js.map} +0 -0
  340. /package/dist/{chunk-BGYLL467.js.map → chunk-TXHJX2NG.js.map} +0 -0
  341. /package/dist/{chunk-FL54G7PV.js.map → chunk-WIT3Y7JT.js.map} +0 -0
  342. /package/dist/{chunk-W7Y6RA6W.js.map → chunk-WR5JFDQ5.js.map} +0 -0
  343. /package/dist/{chunk-2UYR2OOE.js.map → chunk-YRUCIKPO.js.map} +0 -0
  344. /package/dist/{chunk-AEGXHZQT.js.map → chunk-YW5T6KZ5.js.map} +0 -0
  345. /package/dist/{chunk-QKIJ6YXZ.js.map → chunk-ZA4U5GDU.js.map} +0 -0
  346. /package/dist/{chunk-ZKR5B6YJ.js.map → chunk-ZRPGVHTR.js.map} +0 -0
  347. /package/dist/{chunk-OXQP3N6X.js.map → chunk-ZTZ6S5Q6.js.map} +0 -0
@@ -0,0 +1,85 @@
1
+ import type { FleetFreshness, FleetUnit } from './FleetMap.base';
2
+
3
+ /**
4
+ * How current a fix is, on the two thresholds the caller supplied.
5
+ *
6
+ * Inclusive at both boundaries in the direction that reads better on a screen:
7
+ * a unit exactly at the lagging threshold is already lagging. A boundary has to
8
+ * fall somewhere, and the conservative side is the one that does not tell a
9
+ * dispatcher somebody is live when they are on the edge of not being.
10
+ */
11
+ export function freshnessOf(
12
+ staleSeconds: number,
13
+ laggingAfterSeconds: number,
14
+ staleAfterSeconds: number,
15
+ ): FleetFreshness {
16
+ if (staleSeconds >= staleAfterSeconds) return 'stale';
17
+ if (staleSeconds >= laggingAfterSeconds) return 'lagging';
18
+ return 'live';
19
+ }
20
+
21
+ /** A latitude/longitude pair, as the map wants its centre. */
22
+ export interface LatLng {
23
+ lat: number;
24
+ lng: number;
25
+ }
26
+
27
+ /**
28
+ * Where the map should point.
29
+ *
30
+ * The selected unit when there is one — a dispatcher who clicked a name is
31
+ * asking to look at them. Otherwise the fleet's own centroid, which keeps
32
+ * everybody in frame without the caller having to compute a bounding box.
33
+ *
34
+ * `null` for an empty fleet rather than a coordinate: (0, 0) is a real place in
35
+ * the Atlantic, and a map that quietly sails there is worse than one that says
36
+ * it has nothing to show.
37
+ */
38
+ export function mapCentre(
39
+ units: readonly FleetUnit[],
40
+ selectedId?: string | null,
41
+ ): LatLng | null {
42
+ if (units.length === 0) return null;
43
+ const selected = selectedId ? units.find((unit) => unit.id === selectedId) : undefined;
44
+ if (selected) return { lat: selected.latitude, lng: selected.longitude };
45
+ const sum = units.reduce(
46
+ (acc, unit) => ({ lat: acc.lat + unit.latitude, lng: acc.lng + unit.longitude }),
47
+ { lat: 0, lng: 0 },
48
+ );
49
+ return { lat: sum.lat / units.length, lng: sum.lng / units.length };
50
+ }
51
+
52
+ /**
53
+ * The roster's order: freshest first, then alphabetically.
54
+ *
55
+ * Not the caller's order, deliberately. The one question this panel answers is
56
+ * *who is moving right now*, and a list sorted by anything else buries the
57
+ * answer under whoever happens to sort first. Ties break on the label so the
58
+ * list does not reshuffle between polls when two units share a staleness.
59
+ */
60
+ export function rosterOrder(units: readonly FleetUnit[]): FleetUnit[] {
61
+ return [...units].sort(
62
+ (a, b) => a.staleSeconds - b.staleSeconds || a.label.localeCompare(b.label),
63
+ );
64
+ }
65
+
66
+ /**
67
+ * Move the selection by one row, wrapping at both ends.
68
+ *
69
+ * Wrapping rather than stopping: this is a short list a dispatcher arrows
70
+ * through repeatedly, and a selection that sticks at the last row makes the
71
+ * keyboard path feel broken next to the mouse one.
72
+ */
73
+ export function nextSelection(
74
+ units: readonly FleetUnit[],
75
+ currentId: string | null | undefined,
76
+ step: 1 | -1,
77
+ ): string | null {
78
+ if (units.length === 0) return null;
79
+ const index = units.findIndex((unit) => unit.id === currentId);
80
+ // Nothing selected: Down opens at the top and Up opens at the bottom, which
81
+ // is what every listbox in the house does.
82
+ if (index === -1) return (step === 1 ? units[0] : units[units.length - 1])?.id ?? null;
83
+ const next = (index + step + units.length) % units.length;
84
+ return units[next]?.id ?? null;
85
+ }
@@ -0,0 +1,183 @@
1
+ import React from 'react';
2
+
3
+ import { mapCentre, nextSelection, rosterOrder, type LatLng } from './FleetMap.helpers';
4
+ import type { FleetUnit } from './FleetMap.base';
5
+
6
+ /**
7
+ * The half of a key event this hook reads, spelled structurally.
8
+ *
9
+ * NOT `React.KeyboardEvent<HTMLDivElement>`: the native type program is checked
10
+ * without the DOM lib (`tsconfig.native.json`), so a DOM type here would put
11
+ * the whole hook out of reach of the React Native renderer that shares it. A
12
+ * DOM event satisfies this shape, and a handler taking the wider type is
13
+ * assignable wherever the narrower one is expected — so the web passes its own
14
+ * `onKeyDown` unchanged.
15
+ */
16
+ export interface FleetKeyEvent {
17
+ key: string;
18
+ altKey?: boolean;
19
+ ctrlKey?: boolean;
20
+ metaKey?: boolean;
21
+ shiftKey?: boolean;
22
+ preventDefault: () => void;
23
+ }
24
+
25
+ /**
26
+ * Everything the board derives from its props, in one hook.
27
+ *
28
+ * Split out of the component so the component is layout and nothing else.
29
+ *
30
+ * The memos are honest about what they buy, which is less than it looks. `units`
31
+ * arrives as a fresh array on every poll, so `ordered` and `markers` are
32
+ * recomputed on every poll whatever these do — a new array is a new identity.
33
+ * What they buy is stability across the renders a poll does NOT cause: a parent
34
+ * re-render, a selection change (which re-runs `centre` but not `ordered`), a
35
+ * theme flip. Sorting a fleet is cheap either way; this is tidiness, not a
36
+ * measured win, and it should not be read as one.
37
+ *
38
+ * `centre` is the exception, and there it is load-bearing rather than tidy —
39
+ * see {@link useFleetMap}.
40
+ *
41
+ * ## Selection works with, without, or half-way through a handler
42
+ *
43
+ * `selectedId` and `onSelect` are both optional, so all four combinations
44
+ * arrive. Left purely controlled, the two useful ones broke: with neither prop
45
+ * the roster was a listbox that answered nothing, and arrowing it called
46
+ * `preventDefault` before a no-op `select`, so the keys did not move a
47
+ * selection AND did not scroll the page either.
48
+ *
49
+ * So the hook keeps its own selection and defers to `selectedId` only when the
50
+ * caller passes one — the ordinary controlled/uncontrolled split, the same one
51
+ * an `<input>` makes. `onSelect` still fires either way, so a consumer can
52
+ * observe the selection without owning it.
53
+ */
54
+
55
+ /** One pin, in the shape `MapPreview` takes. */
56
+ export interface FleetMarker {
57
+ position: LatLng;
58
+ title: string;
59
+ onClick: () => void;
60
+ }
61
+
62
+ export interface FleetMapState {
63
+ /** The units, freshest first — see {@link rosterOrder}. */
64
+ ordered: FleetUnit[];
65
+ /**
66
+ * The selection in force — the caller's when they own it, this hook's when
67
+ * they do not. Everything downstream reads THIS and never the raw prop.
68
+ */
69
+ active: string | null;
70
+ /** Where the map points, or `null` when there is nothing to show. */
71
+ centre: LatLng | null;
72
+ select: (id: string) => void;
73
+ markers: FleetMarker[];
74
+ onKeyDown: (event: FleetKeyEvent) => void;
75
+ }
76
+
77
+ /** Which way an arrow moves the selection, or `0` when it is not ours. */
78
+ function stepFor(event: FleetKeyEvent): 1 | -1 | 0 {
79
+ // A modified arrow is the PAGE's shortcut, not the roster's: Cmd+Down is
80
+ // "scroll to the end of the document" on macOS, and Shift+Arrow extends a
81
+ // selection. Capturing them would take a browser gesture away.
82
+ if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return 0;
83
+ if (event.key === 'ArrowDown') return 1;
84
+ if (event.key === 'ArrowUp') return -1;
85
+ return 0;
86
+ }
87
+
88
+ /**
89
+ * Who owns the selection, decided ONCE on the first render.
90
+ *
91
+ * Exactly as React decides it for an `<input>`, and for the same reason.
92
+ * `selectedId` is typed `string | null | undefined`, so `useState<string>()` —
93
+ * the natural shape for a caller — hands us `undefined` on the first render and
94
+ * again on every reset. Re-deriving the mode from the prop each time would make
95
+ * the component change its own semantics mid-life: it starts uncontrolled,
96
+ * silently becomes controlled the moment the caller's `onSelect` writes a value
97
+ * back, and then silently un-becomes it when they clear — resurrecting whatever
98
+ * was selected before the hand-off.
99
+ *
100
+ * Latched, `undefined` is unambiguous within each mode: to a controlled board it
101
+ * is "nobody is selected", so clearing the caller's state clears the roster; to
102
+ * an uncontrolled one it is simply the prop staying absent. A caller who wants
103
+ * control passes `string | null` from the first render.
104
+ */
105
+ function useSelection(
106
+ selectedId: string | null | undefined,
107
+ onSelect: ((id: string) => void) | undefined,
108
+ ): { active: string | null; select: (id: string) => void; controlled: boolean } {
109
+ const controlledRef = React.useRef(selectedId !== undefined);
110
+ const controlled = controlledRef.current;
111
+ const [own, setOwn] = React.useState<string | null>(null);
112
+
113
+ const select = React.useCallback(
114
+ (id: string) => {
115
+ if (!controlled) setOwn(id);
116
+ onSelect?.(id);
117
+ },
118
+ [controlled, onSelect],
119
+ );
120
+
121
+ return { active: controlled ? (selectedId ?? null) : own, select, controlled };
122
+ }
123
+
124
+ export function useFleetMap(
125
+ units: readonly FleetUnit[],
126
+ selectedId: string | null | undefined,
127
+ onSelect: ((id: string) => void) | undefined,
128
+ ): FleetMapState {
129
+ const ordered = React.useMemo(() => rosterOrder(units), [units]);
130
+ const { active, select, controlled } = useSelection(selectedId, onSelect);
131
+
132
+ // Memoised on the COORDINATES and not the object, because `mapCentre` builds
133
+ // a fresh literal every call and `MapPreview` re-centres from an effect keyed
134
+ // on `center`'s identity. A poll that changes nothing would otherwise hand it
135
+ // a new object, and the map would jump back to the centroid — throwing away a
136
+ // pan the dispatcher had just made, on a timer, for as long as they watch it.
137
+ //
138
+ // ROUNDED, because keying on the raw numbers was not enough. `mapCentre`
139
+ // sums over `ordered`, and floating-point addition is not associative — so
140
+ // re-sorting the SAME coordinates can change the centroid's last bit.
141
+ // `rosterOrder` sorts on `staleSeconds`, which moves on every poll, so rank
142
+ // swaps are the ordinary case for a fleet that is standing still: measured
143
+ // over 20k random three-rider fleets, a single adjacent swap changed the
144
+ // centroid 17% of the time. Six decimals is ~11cm, far finer than a map
145
+ // centre resolves and far coarser than the noise.
146
+ const raw = mapCentre(ordered, active);
147
+ const lat = raw === null ? null : Math.round(raw.lat * 1e6) / 1e6;
148
+ const lng = raw === null ? null : Math.round(raw.lng * 1e6) / 1e6;
149
+ const centre = React.useMemo(
150
+ () => (lat === null || lng === null ? null : { lat, lng }),
151
+ [lat, lng],
152
+ );
153
+
154
+ const onKeyDown = React.useCallback(
155
+ (event: FleetKeyEvent) => {
156
+ const step = stepFor(event);
157
+ if (step === 0) return;
158
+ // Nothing can move a CONTROLLED selection without a handler, so the keys
159
+ // belong to the page. Swallowing them there left a keyboard user unable to
160
+ // move the selection and unable to scroll past the roster.
161
+ if (controlled && !onSelect) return;
162
+ const next = nextSelection(ordered, active, step);
163
+ // `preventDefault` only once a move is certain, so the page still scrolls
164
+ // with the arrow keys when the list is empty and there is nothing to move.
165
+ if (next === null) return;
166
+ event.preventDefault();
167
+ select(next);
168
+ },
169
+ [ordered, active, select, controlled, onSelect],
170
+ );
171
+
172
+ const markers = React.useMemo(
173
+ () =>
174
+ ordered.map((unit) => ({
175
+ position: { lat: unit.latitude, lng: unit.longitude },
176
+ title: unit.label,
177
+ onClick: () => select(unit.id),
178
+ })),
179
+ [ordered, select],
180
+ );
181
+
182
+ return { ordered, active, centre, select, markers, onKeyDown };
183
+ }
@@ -0,0 +1,189 @@
1
+ # FleetMap
2
+
3
+ Where a set of tracked units is **right now**: a map beside the roster that
4
+ reads it.
5
+
6
+ Product-free by construction. It draws labelled dots with a freshness state, and
7
+ every word — the heading, the three freshness names, how a duration and a
8
+ distance are written — arrives through `copy`. Couriers on motorbikes, service
9
+ vans and field engineers are all the same picture.
10
+
11
+ ## Use cases
12
+
13
+ - A dispatcher watching a delivery fleet during a shift.
14
+ - A field-service board showing which engineers are moving and which have gone
15
+ quiet.
16
+ - Any "where is everybody" panel where the answer is a small set of named people
17
+ with a last-known position and a staleness.
18
+
19
+ ## Three decisions that shape the API
20
+
21
+ ### The roster is the accessible representation, not a sidebar
22
+
23
+ A map is a picture, and a screen reader cannot read one. So the list carries the
24
+ information: everything a sighted user takes from a pin — who, how recently,
25
+ what they are carrying — is on the row, and the row's freshness is spelled out
26
+ in words rather than carried by the dot's colour.
27
+
28
+ The map is a **named landmark** (`role="region"` with a label) rather than an
29
+ `aria-hidden` one. Its controls are focusable, and `aria-hidden` over a
30
+ focusable subtree is the `aria-hidden-focus` violation: a keyboard user tabs
31
+ into a region a screen reader insists is not there. The landmark role is what
32
+ puts it in the rotor, so a reader can skip past it in one gesture.
33
+
34
+ When there is no centre to point at — a fleet that is still loading and has
35
+ reported nothing — the map renders **nothing** rather than falling back to
36
+ `0, 0`, which is a real place in the Gulf of Guinea.
37
+
38
+ ### Nothing here formats
39
+
40
+ `copy.lastSeen` and `copy.accuracy` are **functions**, not strings. A duration
41
+ and a distance are locale rules, and the same line `StatCard` holds for its
42
+ `value` applies: a component that wrote `"2 min ago"` would have made English
43
+ the only language it could ever render, and a `lastSeenTemplate` string would
44
+ have fixed the shape as well as the words.
45
+
46
+ ### An empty fleet is an empty STATE, never an empty map
47
+
48
+ A map with no pins is indistinguishable from a map that failed to load, and
49
+ telling those two apart is the entire question a dispatcher is asking.
50
+
51
+ ## Props
52
+
53
+ | prop | type | default | what it does |
54
+ |---|---|---|---|
55
+ | `units` | `readonly FleetUnit[]` | — | everyone currently reporting; empty renders the empty state |
56
+ | `copy` | `FleetMapCopy` | — | every word, plus the two formatters |
57
+ | `selectedId` | `string \| null` | — | pass it to CONTROL the selection; omit it and the component keeps its own |
58
+ | `onSelect` | `(id: string) => void` | — | a click on a row or a pin, and each arrow-key move |
59
+ | `laggingAfterSeconds` | `number` | `90` | when a unit stops reading as `live` |
60
+ | `staleAfterSeconds` | `number` | `300` | when it stops reading as `lagging` |
61
+ | `height` | `string` | `'420px'` | the map's height, any CSS length |
62
+ | `loading` | `boolean` | `false` | skeletons only before the first units land; `aria-busy` either way |
63
+ | `className` | `string` | — | on the panel root |
64
+ | `dataTestId` | `string` | `'fleet-map'` | every child TEST id derives from it; DOM ids are generated |
65
+
66
+ ### `FleetUnit`
67
+
68
+ ```ts
69
+ {
70
+ id: string;
71
+ label: string; // the name on the pin and the row
72
+ latitude: number;
73
+ longitude: number;
74
+ accuracyM?: number | null; // metres; a row with none renders none
75
+ staleSeconds: number; // since the fix was ACCEPTED, on the SERVER's clock
76
+ badge?: string; // pre-formatted, e.g. "2 deliveries"
77
+ }
78
+ ```
79
+
80
+ `staleSeconds` is measured against the **server's** clock, and the caller
81
+ computes it. The distinction is not pedantry: a device whose own clock is an
82
+ hour slow would otherwise report itself as an hour absent while reporting
83
+ perfectly.
84
+
85
+ ## Why the thresholds have no domain default
86
+
87
+ They are props because the answer belongs entirely to the fleet's own ping
88
+ cadence. A phone reporting every twenty seconds is late at ninety; a tracker
89
+ reporting every five minutes is not. The defaults are sized for the first case
90
+ and are a starting point, not a rule — a component that picked one would be
91
+ picking it for every consumer.
92
+
93
+ ## Usage
94
+
95
+ ```tsx
96
+ <FleetMap
97
+ units={couriers}
98
+ copy={{
99
+ title: 'Motoboys na rua',
100
+ emptyTitle: 'Ninguém reportando',
101
+ emptyDescription: 'Um motoboy aparece aqui quando o celular envia a primeira posição.',
102
+ rosterLabel: 'Motoboys, mais recentes primeiro',
103
+ mapLabel: 'Mapa de onde os motoboys estão',
104
+ freshness: { live: 'Ao vivo', lagging: 'Atrasado', stale: 'Sem sinal' },
105
+ lastSeen: (s) => (s < 60 ? `há ${s}s` : `há ${Math.floor(s / 60)} min`),
106
+ accuracy: (m) => `±${Math.round(m)} m`,
107
+ map: PT_BR_MAP_PREVIEW_COPY,
108
+ }}
109
+ selectedId={selected}
110
+ onSelect={setSelected}
111
+ />
112
+ ```
113
+
114
+ ## Accessibility
115
+
116
+ - The panel is a `region` labelled by its heading.
117
+ - The roster is a `listbox` with `option` rows, **one tab stop**, arrow keys
118
+ moving the selection and wrapping at both ends, and
119
+ `aria-activedescendant` naming the selected row.
120
+ - Freshness is stated in words on every row; the coloured dot is `aria-hidden`
121
+ so the state is not read twice, and colour is never the only carrier.
122
+ - The map region is a named landmark rather than hidden — see above.
123
+ - The active option is kept in view as the selection moves, so a keyboard user
124
+ is not walking it below the fold unseen. The ROSTER's own container is
125
+ scrolled, never the page: `scrollIntoView` walks every scrollable ancestor
126
+ including the document, which would drag a dispatcher back to this panel on
127
+ every poll.
128
+ - `aria-activedescendant` is emitted only when the selected id names a row that
129
+ is actually rendered: a controlled selection can outlive the unit it names.
130
+ - The active option's scroll effect also watches its POSITION, because the
131
+ roster re-sorts on every poll and a still-selected row can move under it.
132
+ - While `loading`, the MAP AND ROSTER are marked `aria-busy` and the heading
133
+ stays, so the layout does not reflow when the data lands. The panel root is
134
+ deliberately not the busy element: `aria-busy` tells assistive tech to hold
135
+ back changes inside it, and the announcement region is a SIBLING of the busy
136
+ half rather than a descendant of it.
137
+ - `aria-busy` is a state and utters nothing, so set `copy.loading` if the reload
138
+ should be ANNOUNCED — that string goes into a visually hidden `role="status"`.
139
+ Left unset, the reload is silent. The region is mounted as soon as
140
+ `copy.loading` is given and only its TEXT changes, because a screen reader
141
+ watches an existing region rather than announcing one that arrives already
142
+ populated. That covers a board that starts idle and reloads; a board MOUNTED
143
+ already loading is silent, as any live region is at mount.
144
+ - Skeletons replace the roster only while there are no units yet. A poll that
145
+ refreshes a populated list keeps the listbox mounted, because unmounting it
146
+ throws away the focus inside it.
147
+ - The map is a named landmark, so a reader can jump past it — but it is not
148
+ silent. `MapPreview` carries its own `aria-live="polite"` and announces its
149
+ centre coordinates, in English, on every re-centre. That string is the one
150
+ piece of user-facing text here that does not come through `copy`; fixing it
151
+ means changing `MapPreview`, which every consumer shares.
152
+
153
+ ## Best practices
154
+
155
+ - Sort nothing before passing `units`. The component orders freshest first and
156
+ breaks ties on the label, so a poll does not reshuffle the list.
157
+ - Keep `selectedId` in the consumer's state when something ELSE needs to know
158
+ the selection — a detail panel beside the board, a URL, a second map. That is
159
+ what controlling it buys; a click on the map and a click on the row are the
160
+ same event either way.
161
+ - Otherwise pass neither `selectedId` nor `onSelect` and let the component hold
162
+ it. Passing `selectedId` alone with no `onSelect` is a selection nothing can
163
+ move, and the arrow keys then belong to the page rather than the roster.
164
+ - Pre-format `badge`. It is rendered, never parsed.
165
+
166
+ ## Known limits
167
+
168
+ - **The React Native build has no MAP.** This subpath now carries a
169
+ `react-native` export condition, and what it renders there is the roster: the
170
+ heading, the rows with their freshness, the empty state, the skeletons and the
171
+ reload announcement. `MapPreview` — ~2,200 lines that project, tile and
172
+ decorate their own surface — is still unported, so the native copy interface
173
+ has neither `map` nor `mapLabel` and a native board draws no canvas. That is a
174
+ smaller loss than it sounds for this component in particular, because the
175
+ roster is already its accessible representation rather than a sidebar: every
176
+ fact a pin carries is on a row. `NATIVE-NOTES.md` holds the full list of
177
+ rendering gaps, and `pnpm native:ledger` counts them.
178
+ - **On a device the roster is touch-only.** The arrow keys, the single tab stop
179
+ and `aria-activedescendant` all reach the list through react-native-web, so a
180
+ browser still walks it exactly as the web build does; React Native delivers no
181
+ key events to a `View`, so on a phone the selection is made by touch and every
182
+ row is its own tab stop.
183
+ - **The map's own `aria-label` is English**, and comes from `MapPreview` rather
184
+ than from `copy`. Everything `FleetMap` itself renders is injected; that one
185
+ sentence is not, and a pt-BR consumer's screen reader will read it in English
186
+ until `MapPreview` takes a copy port.
187
+ - **Pin separation does not scale with zoom.** `MapPreview` places markers at a
188
+ fixed pixels-per-degree, so units a few hundred metres apart draw within a
189
+ pixel or two of each other. The roster distinguishes them; the map does not.
@@ -0,0 +1,81 @@
1
+ /**
2
+ * THE NUMBERS BOTH `FleetMap` RENDERERS DRAW WITH.
3
+ *
4
+ * `FleetRoster.tsx` / `FleetMap.tsx` (web, MUI `sx`) and `FleetRoster.native.tsx`
5
+ * / `FleetMap.native.tsx` (React Native) read this one table. The web hands the
6
+ * spacing UNITS to `theme.spacing()` and the radius MULTIPLES to `sx`; native
7
+ * multiplies the units by the theme's own spacing step and the multiples by
8
+ * `shape.borderRadius`.
9
+ *
10
+ * Nothing here imports a renderer, a theme or a colour: a freshness dot's
11
+ * COLOUR is the theme's (`success.main`, `warning.main`, `text.disabled`), and
12
+ * the two sides reach the same palette through different doors.
13
+ *
14
+ * ## Why the radii are MULTIPLES and never pixels
15
+ *
16
+ * MUI's `sx` reads a bare number for `borderRadius` as a multiple of
17
+ * `theme.shape.borderRadius`, so a value that already had the theme's radius
18
+ * divided out of it is applied twice. Measured: `theme.shape.borderRadius / 4`
19
+ * drew 4px on the default theme — which is why it looked right — and 36px on a
20
+ * host that sets its own radius to 12. In a package whose whole premise is
21
+ * being re-themed, only the multiple is portable, and it is the multiple that
22
+ * both renderers store here.
23
+ */
24
+
25
+ /** `theme.spacing(n)` for the panel's own stack. */
26
+ export const FLEET_PANEL = {
27
+ /** Between the heading, the status region and the body. */
28
+ gapUnits: 1.5,
29
+ } as const;
30
+
31
+ /** The roster list box. */
32
+ export const FLEET_ROSTER = {
33
+ /** Between rows. */
34
+ gapUnits: 0.5,
35
+ /** `:focus-visible` ring on the web; a device has no focus ring to draw. */
36
+ focusRingWidth: 2,
37
+ focusRingOffset: 2,
38
+ } as const;
39
+
40
+ /** One roster row. */
41
+ export const FLEET_ROW = {
42
+ /** Between the dot, the text block and the badge. */
43
+ gapUnits: 1.5,
44
+ /** `theme.spacing(y, x)`. */
45
+ paddingYUnits: 1,
46
+ paddingXUnits: 1.5,
47
+ /** A MULTIPLE of `theme.shape.borderRadius` — see the note above. */
48
+ radiusMultiple: 1,
49
+ } as const;
50
+
51
+ /**
52
+ * The freshness dot.
53
+ *
54
+ * A perfect circle, so the radius is half the box on both sides rather than
55
+ * the web's `50%`: React Native resolves a percentage radius against the box
56
+ * it is given, and a square box makes the two spellings agree.
57
+ */
58
+ export const FLEET_DOT = {
59
+ size: 10,
60
+ } as const;
61
+
62
+ /** What stands in for the roster before any unit has landed. */
63
+ export const FLEET_SKELETON = {
64
+ /** Three bars, the height of a row with its padding. */
65
+ rows: 3,
66
+ height: 44,
67
+ /** A MULTIPLE, for the same reason the row's is. */
68
+ radiusMultiple: 1,
69
+ gapUnits: 1,
70
+ } as const;
71
+
72
+ /**
73
+ * How long a fix stays `live`, and then `lagging`, when the caller says nothing.
74
+ *
75
+ * Ninety seconds and five minutes: sized for a phone reporting every twenty
76
+ * seconds, which is the densest cadence a battery tolerates all day. They are
77
+ * DEFAULTS and not a rule — a fleet on five-minute trackers passes its own, and
78
+ * the props exist so it can.
79
+ */
80
+ export const FLEET_DEFAULT_LAGGING_AFTER_SECONDS = 90;
81
+ export const FLEET_DEFAULT_STALE_AFTER_SECONDS = 300;