@12-apps/ui 6.22.0 → 6.23.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 (251) hide show
  1. package/NATIVE.md +1 -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 +2 -2
  5. package/dist/_internal/components/data-display/CardKit/use-remove-confirm.js +1 -1
  6. package/dist/_internal/components/data-display/CardKit/use-row-confirm.js +1 -1
  7. package/dist/_internal/components/data-display/Carousel/Carousel.js +2 -2
  8. package/dist/_internal/components/data-display/Chart/Chart.js +4 -4
  9. package/dist/_internal/components/data-display/Chart/SpecChart.js +5 -5
  10. package/dist/_internal/components/data-display/Chart/chart-context.js +2 -2
  11. package/dist/_internal/components/data-display/Chart/chart-renderers.js +3 -3
  12. package/dist/_internal/components/data-display/Chip/Chip.js +3 -3
  13. package/dist/_internal/components/data-display/Chip/Chip.styles.js +2 -2
  14. package/dist/_internal/components/data-display/DataGrid/DataGrid.js +1 -1
  15. package/dist/_internal/components/data-display/DataViews/DataViewsGrid.js +26 -26
  16. package/dist/_internal/components/data-display/DataViews/DataViewsTableBase.js +30 -30
  17. package/dist/_internal/components/data-display/DataViews/ManageViewsDialog.js +1 -1
  18. package/dist/_internal/components/data-display/DataViews/data-views-category-pill.js +5 -5
  19. package/dist/_internal/components/data-display/DataViews/data-views-filter-panel.js +10 -10
  20. package/dist/_internal/components/data-display/DataViews/data-views-grid-bodies.js +1 -1
  21. package/dist/_internal/components/data-display/DataViews/data-views-grid-parts.js +22 -22
  22. package/dist/_internal/components/data-display/DataViews/data-views-inline-bar.js +10 -10
  23. package/dist/_internal/components/data-display/DataViews/data-views-more-fields.js +3 -3
  24. package/dist/_internal/components/data-display/DataViews/data-views-more-filters.js +4 -4
  25. package/dist/_internal/components/data-display/DataViews/data-views-pagination.js +3 -3
  26. package/dist/_internal/components/data-display/DataViews/data-views-range-pill.js +2 -2
  27. package/dist/_internal/components/data-display/DataViews/data-views-table-parts.js +3 -3
  28. package/dist/_internal/components/data-display/DataViews/use-data-views-state.js +3 -3
  29. package/dist/_internal/components/data-display/FleetMap/FleetBody.js +31 -0
  30. package/dist/_internal/components/data-display/FleetMap/FleetCanvas.js +23 -0
  31. package/dist/_internal/components/data-display/FleetMap/FleetCanvas.js.map +1 -0
  32. package/dist/_internal/components/data-display/FleetMap/FleetMap.fixtures.js +57 -0
  33. package/dist/_internal/components/data-display/FleetMap/FleetMap.fixtures.js.map +1 -0
  34. package/dist/_internal/components/data-display/FleetMap/FleetMap.helpers.js +14 -0
  35. package/dist/_internal/components/data-display/FleetMap/FleetMap.helpers.js.map +1 -0
  36. package/dist/_internal/components/data-display/FleetMap/FleetMap.hooks.js +9 -0
  37. package/dist/_internal/components/data-display/FleetMap/FleetMap.hooks.js.map +1 -0
  38. package/dist/_internal/components/data-display/FleetMap/FleetMap.js +46 -0
  39. package/dist/_internal/components/data-display/FleetMap/FleetMap.js.map +1 -0
  40. package/dist/_internal/components/data-display/FleetMap/FleetMap.types.js +1 -0
  41. package/dist/_internal/components/data-display/FleetMap/FleetMap.types.js.map +1 -0
  42. package/dist/_internal/components/data-display/FleetMap/FleetRoster.js +14 -0
  43. package/dist/_internal/components/data-display/FleetMap/FleetRoster.js.map +1 -0
  44. package/dist/_internal/components/data-display/HoverCard/HoverCard.js +2 -2
  45. package/dist/_internal/components/data-display/Lightbox/Lightbox.js +2 -2
  46. package/dist/_internal/components/data-display/MapPreview/MapLayers.js +2 -2
  47. package/dist/_internal/components/data-display/MapPreview/MapPreview.js +6 -6
  48. package/dist/_internal/components/data-display/Sheet/Sheet.hooks.js +2 -2
  49. package/dist/_internal/components/data-display/Sheet/Sheet.js +3 -3
  50. package/dist/_internal/components/data-display/Table/Table.js +3 -3
  51. package/dist/_internal/components/data-display/index.js +82 -62
  52. package/dist/_internal/components/feedback/Modal/Modal.js +2 -2
  53. package/dist/_internal/components/feedback/StackedModal/StackedModal.js +2 -2
  54. package/dist/_internal/components/feedback/index.js +14 -14
  55. package/dist/_internal/components/form/AddressAutocomplete/AddressAutocomplete.hooks.js +3 -3
  56. package/dist/_internal/components/form/AddressAutocomplete/AddressAutocomplete.js +5 -5
  57. package/dist/_internal/components/form/AddressAutocomplete/AddressAutocompleteField.js +2 -2
  58. package/dist/_internal/components/form/CategorySelect/CategoryPanel.js +2 -2
  59. package/dist/_internal/components/form/CategorySelect/CategorySelect.js +4 -4
  60. package/dist/_internal/components/form/Command/Command.js +2 -2
  61. package/dist/_internal/components/form/DateRangePicker/DateRangePicker.js +3 -3
  62. package/dist/_internal/components/form/PhoneInput/PhoneInput.hooks.js +2 -2
  63. package/dist/_internal/components/form/PhoneInput/PhoneInput.js +3 -3
  64. package/dist/_internal/components/form/index.js +30 -30
  65. package/dist/_internal/components/form/total-form/Fields/CategoryField.js +5 -5
  66. package/dist/_internal/components/form/total-form/Fields/index.js +9 -9
  67. package/dist/_internal/components/index.js +152 -133
  68. package/dist/_internal/components/layout/SettingsLayout/SettingsLayout.js +2 -2
  69. package/dist/_internal/components/layout/index.js +20 -20
  70. package/dist/_internal/components/navigation/AppHeader/AppHeader.details.js +4 -4
  71. package/dist/_internal/components/navigation/Pagination/Pagination.js +2 -2
  72. package/dist/_internal/components/navigation/index.js +12 -12
  73. package/dist/_internal/components/utility/index.js +4 -4
  74. package/dist/_internal/pt-BR.data-display.js +2 -2
  75. package/dist/_internal/user-avatar/user-avatar.js +3 -3
  76. package/dist/charts.js +5 -5
  77. package/dist/chunk-2RQINU5T.js +41 -0
  78. package/dist/chunk-2RQINU5T.js.map +1 -0
  79. package/dist/{chunk-VLHGBFR6.js → chunk-2UGJIKVA.js} +2 -2
  80. package/dist/{chunk-WMALDOF5.js → chunk-4G3FGCWX.js} +4 -4
  81. package/dist/{chunk-ZKR5B6YJ.js → chunk-4LRFGB3K.js} +2 -2
  82. package/dist/{chunk-ZOUWHGV3.js → chunk-4MGFUPQT.js} +4 -4
  83. package/dist/{chunk-VQAM2XZV.js → chunk-4XZXLB4I.js} +3 -3
  84. package/dist/chunk-5V4UPOWK.js +36 -0
  85. package/dist/chunk-5V4UPOWK.js.map +1 -0
  86. package/dist/{chunk-VIK3HAUQ.js → chunk-73NJCGQG.js} +2 -2
  87. package/dist/{chunk-PFV6RL4Q.js → chunk-ACFGEZ4Q.js} +3 -3
  88. package/dist/{chunk-U2YJCNRU.js → chunk-AJGYHDA5.js} +4 -4
  89. package/dist/{chunk-HKV4MQ2W.js → chunk-BLBOYCOV.js} +5 -5
  90. package/dist/{chunk-QZBUGUOY.js → chunk-BZTFPSWT.js} +4 -4
  91. package/dist/{chunk-7TZ6OC5T.js → chunk-CBTY36TU.js} +2 -2
  92. package/dist/chunk-CDCTLPMD.js +1 -0
  93. package/dist/chunk-CDCTLPMD.js.map +1 -0
  94. package/dist/chunk-CF3FAAPC.js +79 -0
  95. package/dist/chunk-CF3FAAPC.js.map +1 -0
  96. package/dist/{chunk-PMS3H3OO.js → chunk-DF2FFYZ7.js} +4 -4
  97. package/dist/{chunk-FPWB5ILF.js → chunk-DRHIIUDO.js} +5 -5
  98. package/dist/{chunk-WLQTHPMX.js → chunk-EJQW2IYW.js} +2 -2
  99. package/dist/{chunk-XFUNJYFT.js → chunk-EPNUVSNK.js} +7 -7
  100. package/dist/{chunk-MSUSZLRE.js → chunk-EWT3WMVY.js} +5 -5
  101. package/dist/chunk-F7VBGS4C.js +64 -0
  102. package/dist/chunk-F7VBGS4C.js.map +1 -0
  103. package/dist/{chunk-Q75SJ35X.js → chunk-GMTM6EN7.js} +3 -3
  104. package/dist/{chunk-6NZTYZP5.js → chunk-GVA5CYKP.js} +2 -2
  105. package/dist/{chunk-VR5HDUBK.js → chunk-HP2ODXNA.js} +2 -2
  106. package/dist/{chunk-7BYFC2MR.js → chunk-I7HYGIEJ.js} +6 -6
  107. package/dist/{chunk-UVGRRI7N.js → chunk-IPVYEPXO.js} +4 -4
  108. package/dist/{chunk-5ZTUP65G.js → chunk-JM64OEU6.js} +5 -5
  109. package/dist/{chunk-QFJRB27Q.js → chunk-KHWCX4LI.js} +2 -2
  110. package/dist/{chunk-TLMLEC4F.js → chunk-KW7H5O3K.js} +6 -6
  111. package/dist/{chunk-UU3QAKG6.js → chunk-L4U23SBX.js} +4 -4
  112. package/dist/chunk-MQNKRIGC.js +205 -0
  113. package/dist/chunk-MQNKRIGC.js.map +1 -0
  114. package/dist/{chunk-QWDEOITU.js → chunk-MYGNIFZC.js} +2 -2
  115. package/dist/{chunk-2MMEIN4T.js → chunk-N2TUX4A5.js} +4 -4
  116. package/dist/{chunk-KTK4A3IF.js → chunk-OIKQO73C.js} +7 -7
  117. package/dist/{chunk-REMK55JI.js → chunk-OLZTGVBT.js} +4 -4
  118. package/dist/{chunk-ZIYMBR7K.js → chunk-OTH7H3IP.js} +2 -2
  119. package/dist/{chunk-J4W4TQPC.js → chunk-QJRDDVZ2.js} +5 -5
  120. package/dist/{chunk-VNDOQEJ7.js → chunk-QRX5BYUQ.js} +4 -4
  121. package/dist/{chunk-XT7HMNBW.js → chunk-R6SNYC3D.js} +5 -5
  122. package/dist/{chunk-W2UTDN4T.js → chunk-RBGOGTT2.js} +4 -4
  123. package/dist/chunk-RQWZYD6H.js +1 -0
  124. package/dist/chunk-RQWZYD6H.js.map +1 -0
  125. package/dist/{chunk-EXJBPKGW.js → chunk-SHDIZSN5.js} +5 -5
  126. package/dist/{chunk-23FCBIUN.js → chunk-TNVO2DTB.js} +8 -8
  127. package/dist/{chunk-AGSBIUPV.js → chunk-TPLKJHNN.js} +4 -4
  128. package/dist/{chunk-U2AC4AQX.js → chunk-TU5EIKJA.js} +4 -4
  129. package/dist/chunk-TWQYDKCA.js +113 -0
  130. package/dist/chunk-TWQYDKCA.js.map +1 -0
  131. package/dist/{chunk-BGYLL467.js → chunk-TXHJX2NG.js} +4 -4
  132. package/dist/{chunk-E46PG577.js → chunk-URXT5TOY.js} +4 -4
  133. package/dist/{chunk-5NKUYCZD.js → chunk-VON4BFK4.js} +4 -4
  134. package/dist/{chunk-FL54G7PV.js → chunk-WIT3Y7JT.js} +2 -2
  135. package/dist/{chunk-DVUPIVI2.js → chunk-WQA4LIIK.js} +2 -2
  136. package/dist/{chunk-2UYR2OOE.js → chunk-YRUCIKPO.js} +4 -4
  137. package/dist/{chunk-QKIJ6YXZ.js → chunk-ZA4U5GDU.js} +4 -4
  138. package/dist/{chunk-OXQP3N6X.js → chunk-ZTZ6S5Q6.js} +4 -4
  139. package/dist/data-display/AsyncStateContainer.js +3 -3
  140. package/dist/data-display/Avatar.js +2 -2
  141. package/dist/data-display/CardKit.js +8 -8
  142. package/dist/data-display/Carousel.js +2 -2
  143. package/dist/data-display/Chart.js +5 -5
  144. package/dist/data-display/Chip.js +3 -3
  145. package/dist/data-display/DataGrid.js +1 -1
  146. package/dist/data-display/DataViews.js +33 -33
  147. package/dist/data-display/FleetMap.js +54 -0
  148. package/dist/data-display/FleetMap.js.map +1 -0
  149. package/dist/data-display/HoverCard.js +2 -2
  150. package/dist/data-display/Lightbox.js +2 -2
  151. package/dist/data-display/MapPreview.js +6 -6
  152. package/dist/data-display/Sheet.js +3 -3
  153. package/dist/data-display/Table.js +3 -3
  154. package/dist/feedback/ConfirmAction.js +3 -3
  155. package/dist/feedback/Modal.js +2 -2
  156. package/dist/feedback/StackedModal.js +2 -2
  157. package/dist/form/AddressAutocomplete.js +5 -5
  158. package/dist/form/CategorySelect.js +4 -4
  159. package/dist/form/Command.js +2 -2
  160. package/dist/form/DateRangePicker.js +5 -5
  161. package/dist/form/PhoneInput.js +3 -3
  162. package/dist/form/total-form.js +9 -9
  163. package/dist/layout/SettingsLayout.js +2 -2
  164. package/dist/locales.js +4 -4
  165. package/dist/navigation/AppHeader.js +6 -6
  166. package/dist/navigation/Pagination.js +2 -2
  167. package/dist/pt-BR.js +4 -4
  168. package/dist/types/components/data-display/FleetMap/FleetBody.d.ts +22 -0
  169. package/dist/types/components/data-display/FleetMap/FleetBody.d.ts.map +1 -0
  170. package/dist/types/components/data-display/FleetMap/FleetCanvas.d.ts +50 -0
  171. package/dist/types/components/data-display/FleetMap/FleetCanvas.d.ts.map +1 -0
  172. package/dist/types/components/data-display/FleetMap/FleetMap.d.ts +32 -0
  173. package/dist/types/components/data-display/FleetMap/FleetMap.d.ts.map +1 -0
  174. package/dist/types/components/data-display/FleetMap/FleetMap.fixtures.d.ts +23 -0
  175. package/dist/types/components/data-display/FleetMap/FleetMap.fixtures.d.ts.map +1 -0
  176. package/dist/types/components/data-display/FleetMap/FleetMap.helpers.d.ts +45 -0
  177. package/dist/types/components/data-display/FleetMap/FleetMap.helpers.d.ts.map +1 -0
  178. package/dist/types/components/data-display/FleetMap/FleetMap.hooks.d.ts +54 -0
  179. package/dist/types/components/data-display/FleetMap/FleetMap.hooks.d.ts.map +1 -0
  180. package/dist/types/components/data-display/FleetMap/FleetMap.types.d.ts +145 -0
  181. package/dist/types/components/data-display/FleetMap/FleetMap.types.d.ts.map +1 -0
  182. package/dist/types/components/data-display/FleetMap/FleetRoster.d.ts +15 -0
  183. package/dist/types/components/data-display/FleetMap/FleetRoster.d.ts.map +1 -0
  184. package/dist/types/components/data-display/FleetMap/index.d.ts +5 -0
  185. package/dist/types/components/data-display/FleetMap/index.d.ts.map +1 -0
  186. package/dist/types/components/data-display/index.d.ts +1 -0
  187. package/dist/types/components/data-display/index.d.ts.map +1 -1
  188. package/dist/user-avatar.js +3 -3
  189. package/package.json +5 -1
  190. package/src/components/data-display/FleetMap/FleetBody.tsx +96 -0
  191. package/src/components/data-display/FleetMap/FleetCanvas.tsx +80 -0
  192. package/src/components/data-display/FleetMap/FleetMap.fixtures.ts +70 -0
  193. package/src/components/data-display/FleetMap/FleetMap.helpers.ts +85 -0
  194. package/src/components/data-display/FleetMap/FleetMap.hooks.ts +164 -0
  195. package/src/components/data-display/FleetMap/FleetMap.md +182 -0
  196. package/src/components/data-display/FleetMap/FleetMap.tsx +169 -0
  197. package/src/components/data-display/FleetMap/FleetMap.types.ts +148 -0
  198. package/src/components/data-display/FleetMap/FleetRoster.tsx +321 -0
  199. package/src/components/data-display/FleetMap/index.ts +9 -0
  200. package/src/components/data-display/FleetMap/tests.md +79 -0
  201. package/src/components/data-display/FleetMap/track.md +50 -0
  202. package/src/components/data-display/index.ts +1 -0
  203. package/src/components/feedback/ConfirmAction/ConfirmAction.md +10 -4
  204. package/dist/chunk-X3HL5C6H.js +0 -1
  205. /package/dist/{chunk-X3HL5C6H.js.map → _internal/components/data-display/FleetMap/FleetBody.js.map} +0 -0
  206. /package/dist/{chunk-VLHGBFR6.js.map → chunk-2UGJIKVA.js.map} +0 -0
  207. /package/dist/{chunk-WMALDOF5.js.map → chunk-4G3FGCWX.js.map} +0 -0
  208. /package/dist/{chunk-ZKR5B6YJ.js.map → chunk-4LRFGB3K.js.map} +0 -0
  209. /package/dist/{chunk-ZOUWHGV3.js.map → chunk-4MGFUPQT.js.map} +0 -0
  210. /package/dist/{chunk-VQAM2XZV.js.map → chunk-4XZXLB4I.js.map} +0 -0
  211. /package/dist/{chunk-VIK3HAUQ.js.map → chunk-73NJCGQG.js.map} +0 -0
  212. /package/dist/{chunk-PFV6RL4Q.js.map → chunk-ACFGEZ4Q.js.map} +0 -0
  213. /package/dist/{chunk-U2YJCNRU.js.map → chunk-AJGYHDA5.js.map} +0 -0
  214. /package/dist/{chunk-HKV4MQ2W.js.map → chunk-BLBOYCOV.js.map} +0 -0
  215. /package/dist/{chunk-QZBUGUOY.js.map → chunk-BZTFPSWT.js.map} +0 -0
  216. /package/dist/{chunk-7TZ6OC5T.js.map → chunk-CBTY36TU.js.map} +0 -0
  217. /package/dist/{chunk-PMS3H3OO.js.map → chunk-DF2FFYZ7.js.map} +0 -0
  218. /package/dist/{chunk-FPWB5ILF.js.map → chunk-DRHIIUDO.js.map} +0 -0
  219. /package/dist/{chunk-WLQTHPMX.js.map → chunk-EJQW2IYW.js.map} +0 -0
  220. /package/dist/{chunk-XFUNJYFT.js.map → chunk-EPNUVSNK.js.map} +0 -0
  221. /package/dist/{chunk-MSUSZLRE.js.map → chunk-EWT3WMVY.js.map} +0 -0
  222. /package/dist/{chunk-Q75SJ35X.js.map → chunk-GMTM6EN7.js.map} +0 -0
  223. /package/dist/{chunk-6NZTYZP5.js.map → chunk-GVA5CYKP.js.map} +0 -0
  224. /package/dist/{chunk-VR5HDUBK.js.map → chunk-HP2ODXNA.js.map} +0 -0
  225. /package/dist/{chunk-7BYFC2MR.js.map → chunk-I7HYGIEJ.js.map} +0 -0
  226. /package/dist/{chunk-UVGRRI7N.js.map → chunk-IPVYEPXO.js.map} +0 -0
  227. /package/dist/{chunk-5ZTUP65G.js.map → chunk-JM64OEU6.js.map} +0 -0
  228. /package/dist/{chunk-QFJRB27Q.js.map → chunk-KHWCX4LI.js.map} +0 -0
  229. /package/dist/{chunk-TLMLEC4F.js.map → chunk-KW7H5O3K.js.map} +0 -0
  230. /package/dist/{chunk-UU3QAKG6.js.map → chunk-L4U23SBX.js.map} +0 -0
  231. /package/dist/{chunk-QWDEOITU.js.map → chunk-MYGNIFZC.js.map} +0 -0
  232. /package/dist/{chunk-2MMEIN4T.js.map → chunk-N2TUX4A5.js.map} +0 -0
  233. /package/dist/{chunk-KTK4A3IF.js.map → chunk-OIKQO73C.js.map} +0 -0
  234. /package/dist/{chunk-REMK55JI.js.map → chunk-OLZTGVBT.js.map} +0 -0
  235. /package/dist/{chunk-ZIYMBR7K.js.map → chunk-OTH7H3IP.js.map} +0 -0
  236. /package/dist/{chunk-J4W4TQPC.js.map → chunk-QJRDDVZ2.js.map} +0 -0
  237. /package/dist/{chunk-VNDOQEJ7.js.map → chunk-QRX5BYUQ.js.map} +0 -0
  238. /package/dist/{chunk-XT7HMNBW.js.map → chunk-R6SNYC3D.js.map} +0 -0
  239. /package/dist/{chunk-W2UTDN4T.js.map → chunk-RBGOGTT2.js.map} +0 -0
  240. /package/dist/{chunk-EXJBPKGW.js.map → chunk-SHDIZSN5.js.map} +0 -0
  241. /package/dist/{chunk-23FCBIUN.js.map → chunk-TNVO2DTB.js.map} +0 -0
  242. /package/dist/{chunk-AGSBIUPV.js.map → chunk-TPLKJHNN.js.map} +0 -0
  243. /package/dist/{chunk-U2AC4AQX.js.map → chunk-TU5EIKJA.js.map} +0 -0
  244. /package/dist/{chunk-BGYLL467.js.map → chunk-TXHJX2NG.js.map} +0 -0
  245. /package/dist/{chunk-E46PG577.js.map → chunk-URXT5TOY.js.map} +0 -0
  246. /package/dist/{chunk-5NKUYCZD.js.map → chunk-VON4BFK4.js.map} +0 -0
  247. /package/dist/{chunk-FL54G7PV.js.map → chunk-WIT3Y7JT.js.map} +0 -0
  248. /package/dist/{chunk-DVUPIVI2.js.map → chunk-WQA4LIIK.js.map} +0 -0
  249. /package/dist/{chunk-2UYR2OOE.js.map → chunk-YRUCIKPO.js.map} +0 -0
  250. /package/dist/{chunk-QKIJ6YXZ.js.map → chunk-ZA4U5GDU.js.map} +0 -0
  251. /package/dist/{chunk-OXQP3N6X.js.map → chunk-ZTZ6S5Q6.js.map} +0 -0
@@ -0,0 +1,80 @@
1
+ import Box from '@mui/material/Box/index.js';
2
+ import React from 'react';
3
+
4
+ import { MapPreview } from '../MapPreview/MapPreview';
5
+
6
+ import type { FleetMarker } from './FleetMap.hooks';
7
+ import type { LatLng } from './FleetMap.helpers';
8
+ import type { FleetMapCopy } from './FleetMap.types';
9
+
10
+ export interface FleetCanvasProps {
11
+ copy: FleetMapCopy;
12
+ /** Where to point. `null` renders NOTHING — see the component's note. */
13
+ centre: LatLng | null;
14
+ markers: FleetMarker[];
15
+ height: string;
16
+ testId: string;
17
+ }
18
+
19
+ /**
20
+ * The map half — a NAMED LANDMARK, not an `aria-hidden` one.
21
+ *
22
+ * Its controls are focusable, and `aria-hidden` over a focusable subtree is the
23
+ * `aria-hidden-focus` violation: a keyboard user tabs into something a screen
24
+ * reader insists is not there. `role="region"` with a name is what puts it in a
25
+ * screen reader's landmark rotor, so it can be jumped PAST in one gesture;
26
+ * `role="group"` is not a landmark and would not.
27
+ *
28
+ * ## Skipping it does not silence it, and that is not ours to fix here
29
+ *
30
+ * `MapPreview` puts `aria-live="polite"` on its own root, with an English
31
+ * `aria-label` naming the centre coordinates and zoom. So re-centring the map —
32
+ * which every selection change does — announces something like "Map preview
33
+ * centered at -23.5505, -46.6333 with zoom level 15", in English, however
34
+ * thoroughly a reader has skipped the landmark. Two things follow, and neither
35
+ * is solved by anything this file can do:
36
+ *
37
+ * * a live region announces from wherever the reader is, so the landmark's
38
+ * skippability does not suppress it;
39
+ * * that string is the one piece of user-facing text in this component that
40
+ * does NOT come through `copy`.
41
+ *
42
+ * Fixing it means changing `MapPreview`, which every other consumer shares, so
43
+ * it is stated here rather than quietly claimed away.
44
+ *
45
+ * ## No centre, no map
46
+ *
47
+ * `mapCentre` answers `null` rather than a coordinate for an empty fleet, and
48
+ * that refusal has to survive the whole way down. `MapPreview` has no default
49
+ * centre — it resolves `center || coordinates || { lat: 0, lng: 0 }` — so
50
+ * forwarding `undefined` sails the map to the Gulf of Guinea and prints
51
+ * `Lat: 0.000000` under a default pin. That is exactly the render the helper
52
+ * exists to prevent, and it is reachable: a board that is `loading` with
53
+ * nothing yet reported skips the empty state by design and lands here.
54
+ */
55
+ export function FleetCanvas({
56
+ copy,
57
+ centre,
58
+ markers,
59
+ height,
60
+ testId,
61
+ }: FleetCanvasProps): React.JSX.Element | null {
62
+ if (!centre) return null;
63
+ return (
64
+ <Box
65
+ role="region"
66
+ aria-label={copy.mapLabel}
67
+ data-testid={`${testId}-canvas`}
68
+ sx={{ flexGrow: 1, minWidth: 0 }}
69
+ >
70
+ <MapPreview
71
+ copy={copy.map}
72
+ center={centre}
73
+ markers={markers}
74
+ height={height}
75
+ interactive
76
+ showControls
77
+ />
78
+ </Box>
79
+ );
80
+ }
@@ -0,0 +1,70 @@
1
+ import { EN_US_MAP_PREVIEW_COPY } from '../../../en-US.data-display';
2
+
3
+ import type { FleetMapCopy, FleetUnit } from './FleetMap.types';
4
+
5
+ /**
6
+ * The copy and the fleet every story and test story shares.
7
+ *
8
+ * A module rather than a per-story literal, so a change to the shape breaks in
9
+ * ONE place rather than in fourteen — and so the test stories assert against
10
+ * the same words the visual ones render.
11
+ */
12
+
13
+ /** English, because stories are developer-facing. A consumer passes its own. */
14
+ export const FLEET_COPY: FleetMapCopy = {
15
+ title: 'Couriers on the road',
16
+ emptyTitle: 'Nobody is reporting',
17
+ emptyDescription: 'A courier appears here once their phone sends its first position.',
18
+ rosterLabel: 'Couriers, freshest first',
19
+ mapLabel: 'Map of where the couriers are',
20
+ freshness: { live: 'Live', lagging: 'Lagging', stale: 'Stale' },
21
+ lastSeen: (seconds) =>
22
+ seconds < 60 ? `${seconds}s ago` : `${Math.floor(seconds / 60)} min ago`,
23
+ // A NON-BREAKING space between the number and its unit. The meta line is
24
+ // the narrowest text in the component and it wraps at spaces, so a plain
25
+ // space orphans the `m` onto a line of its own — measured at 900px and
26
+ // 1920px, where the roster column is at its tightest relative to the map.
27
+ // Consumers writing their own `accuracy` want the same character.
28
+ accuracy: (metres) => `±${Math.round(metres)}\u00A0m`,
29
+ map: EN_US_MAP_PREVIEW_COPY,
30
+ };
31
+
32
+ /**
33
+ * Three riders around São Paulo, one in each freshness state.
34
+ *
35
+ * Deliberately NOT in staleness order, and the labels deliberately do not agree
36
+ * with it either. `rosterOrder` sorts on staleness and breaks ties on the
37
+ * label, so a fixture whose two orders coincide lets the roster's ordering
38
+ * assertion pass against a LABEL-only sort as readily as the real one — a test
39
+ * reporting coverage it does not have. Here the three orders are all different:
40
+ * declared is [ale, ana, bruno], alphabetical is the same, and the correct
41
+ * answer is [ana, bruno, ale].
42
+ */
43
+ export const FLEET: FleetUnit[] = [
44
+ {
45
+ id: 'ale',
46
+ label: 'Alessandra Nunes',
47
+ latitude: -23.5405,
48
+ longitude: -46.6133,
49
+ accuracyM: null,
50
+ staleSeconds: 640,
51
+ },
52
+ {
53
+ id: 'ana',
54
+ label: 'Ana Ribeiro',
55
+ latitude: -23.5505,
56
+ longitude: -46.6333,
57
+ accuracyM: 12,
58
+ staleSeconds: 8,
59
+ badge: '2 deliveries',
60
+ },
61
+ {
62
+ id: 'bruno',
63
+ label: 'Bruno Alves',
64
+ latitude: -23.5605,
65
+ longitude: -46.6533,
66
+ accuracyM: 180,
67
+ staleSeconds: 140,
68
+ badge: '1 delivery',
69
+ },
70
+ ];
@@ -0,0 +1,85 @@
1
+ import type { FleetFreshness, FleetUnit } from './FleetMap.types';
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,164 @@
1
+ import React from 'react';
2
+
3
+ import { mapCentre, nextSelection, rosterOrder, type LatLng } from './FleetMap.helpers';
4
+ import type { FleetUnit } from './FleetMap.types';
5
+
6
+ /**
7
+ * Everything the board derives from its props, in one hook.
8
+ *
9
+ * Split out of the component so the component is layout and nothing else.
10
+ *
11
+ * The memos are honest about what they buy, which is less than it looks. `units`
12
+ * arrives as a fresh array on every poll, so `ordered` and `markers` are
13
+ * recomputed on every poll whatever these do — a new array is a new identity.
14
+ * What they buy is stability across the renders a poll does NOT cause: a parent
15
+ * re-render, a selection change (which re-runs `centre` but not `ordered`), a
16
+ * theme flip. Sorting a fleet is cheap either way; this is tidiness, not a
17
+ * measured win, and it should not be read as one.
18
+ *
19
+ * `centre` is the exception, and there it is load-bearing rather than tidy —
20
+ * see {@link useFleetMap}.
21
+ *
22
+ * ## Selection works with, without, or half-way through a handler
23
+ *
24
+ * `selectedId` and `onSelect` are both optional, so all four combinations
25
+ * arrive. Left purely controlled, the two useful ones broke: with neither prop
26
+ * the roster was a listbox that answered nothing, and arrowing it called
27
+ * `preventDefault` before a no-op `select`, so the keys did not move a
28
+ * selection AND did not scroll the page either.
29
+ *
30
+ * So the hook keeps its own selection and defers to `selectedId` only when the
31
+ * caller passes one — the ordinary controlled/uncontrolled split, the same one
32
+ * an `<input>` makes. `onSelect` still fires either way, so a consumer can
33
+ * observe the selection without owning it.
34
+ */
35
+
36
+ /** One pin, in the shape `MapPreview` takes. */
37
+ export interface FleetMarker {
38
+ position: LatLng;
39
+ title: string;
40
+ onClick: () => void;
41
+ }
42
+
43
+ export interface FleetMapState {
44
+ /** The units, freshest first — see {@link rosterOrder}. */
45
+ ordered: FleetUnit[];
46
+ /**
47
+ * The selection in force — the caller's when they own it, this hook's when
48
+ * they do not. Everything downstream reads THIS and never the raw prop.
49
+ */
50
+ active: string | null;
51
+ /** Where the map points, or `null` when there is nothing to show. */
52
+ centre: LatLng | null;
53
+ select: (id: string) => void;
54
+ markers: FleetMarker[];
55
+ onKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void;
56
+ }
57
+
58
+ /** Which way an arrow moves the selection, or `0` when it is not ours. */
59
+ function stepFor(event: React.KeyboardEvent<HTMLDivElement>): 1 | -1 | 0 {
60
+ // A modified arrow is the PAGE's shortcut, not the roster's: Cmd+Down is
61
+ // "scroll to the end of the document" on macOS, and Shift+Arrow extends a
62
+ // selection. Capturing them would take a browser gesture away.
63
+ if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return 0;
64
+ if (event.key === 'ArrowDown') return 1;
65
+ if (event.key === 'ArrowUp') return -1;
66
+ return 0;
67
+ }
68
+
69
+ /**
70
+ * Who owns the selection, decided ONCE on the first render.
71
+ *
72
+ * Exactly as React decides it for an `<input>`, and for the same reason.
73
+ * `selectedId` is typed `string | null | undefined`, so `useState<string>()` —
74
+ * the natural shape for a caller — hands us `undefined` on the first render and
75
+ * again on every reset. Re-deriving the mode from the prop each time would make
76
+ * the component change its own semantics mid-life: it starts uncontrolled,
77
+ * silently becomes controlled the moment the caller's `onSelect` writes a value
78
+ * back, and then silently un-becomes it when they clear — resurrecting whatever
79
+ * was selected before the hand-off.
80
+ *
81
+ * Latched, `undefined` is unambiguous within each mode: to a controlled board it
82
+ * is "nobody is selected", so clearing the caller's state clears the roster; to
83
+ * an uncontrolled one it is simply the prop staying absent. A caller who wants
84
+ * control passes `string | null` from the first render.
85
+ */
86
+ function useSelection(
87
+ selectedId: string | null | undefined,
88
+ onSelect: ((id: string) => void) | undefined,
89
+ ): { active: string | null; select: (id: string) => void; controlled: boolean } {
90
+ const controlledRef = React.useRef(selectedId !== undefined);
91
+ const controlled = controlledRef.current;
92
+ const [own, setOwn] = React.useState<string | null>(null);
93
+
94
+ const select = React.useCallback(
95
+ (id: string) => {
96
+ if (!controlled) setOwn(id);
97
+ onSelect?.(id);
98
+ },
99
+ [controlled, onSelect],
100
+ );
101
+
102
+ return { active: controlled ? (selectedId ?? null) : own, select, controlled };
103
+ }
104
+
105
+ export function useFleetMap(
106
+ units: readonly FleetUnit[],
107
+ selectedId: string | null | undefined,
108
+ onSelect: ((id: string) => void) | undefined,
109
+ ): FleetMapState {
110
+ const ordered = React.useMemo(() => rosterOrder(units), [units]);
111
+ const { active, select, controlled } = useSelection(selectedId, onSelect);
112
+
113
+ // Memoised on the COORDINATES and not the object, because `mapCentre` builds
114
+ // a fresh literal every call and `MapPreview` re-centres from an effect keyed
115
+ // on `center`'s identity. A poll that changes nothing would otherwise hand it
116
+ // a new object, and the map would jump back to the centroid — throwing away a
117
+ // pan the dispatcher had just made, on a timer, for as long as they watch it.
118
+ //
119
+ // ROUNDED, because keying on the raw numbers was not enough. `mapCentre`
120
+ // sums over `ordered`, and floating-point addition is not associative — so
121
+ // re-sorting the SAME coordinates can change the centroid's last bit.
122
+ // `rosterOrder` sorts on `staleSeconds`, which moves on every poll, so rank
123
+ // swaps are the ordinary case for a fleet that is standing still: measured
124
+ // over 20k random three-rider fleets, a single adjacent swap changed the
125
+ // centroid 17% of the time. Six decimals is ~11cm, far finer than a map
126
+ // centre resolves and far coarser than the noise.
127
+ const raw = mapCentre(ordered, active);
128
+ const lat = raw === null ? null : Math.round(raw.lat * 1e6) / 1e6;
129
+ const lng = raw === null ? null : Math.round(raw.lng * 1e6) / 1e6;
130
+ const centre = React.useMemo(
131
+ () => (lat === null || lng === null ? null : { lat, lng }),
132
+ [lat, lng],
133
+ );
134
+
135
+ const onKeyDown = React.useCallback(
136
+ (event: React.KeyboardEvent<HTMLDivElement>) => {
137
+ const step = stepFor(event);
138
+ if (step === 0) return;
139
+ // Nothing can move a CONTROLLED selection without a handler, so the keys
140
+ // belong to the page. Swallowing them there left a keyboard user unable to
141
+ // move the selection and unable to scroll past the roster.
142
+ if (controlled && !onSelect) return;
143
+ const next = nextSelection(ordered, active, step);
144
+ // `preventDefault` only once a move is certain, so the page still scrolls
145
+ // with the arrow keys when the list is empty and there is nothing to move.
146
+ if (next === null) return;
147
+ event.preventDefault();
148
+ select(next);
149
+ },
150
+ [ordered, active, select, controlled, onSelect],
151
+ );
152
+
153
+ const markers = React.useMemo(
154
+ () =>
155
+ ordered.map((unit) => ({
156
+ position: { lat: unit.latitude, lng: unit.longitude },
157
+ title: unit.label,
158
+ onClick: () => select(unit.id),
159
+ })),
160
+ [ordered, select],
161
+ );
162
+
163
+ return { ordered, active, centre, select, markers, onKeyDown };
164
+ }
@@ -0,0 +1,182 @@
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
+ - **Not ported to React Native.** `@12-apps/ui` ships a native build for 26 of
169
+ its 141 subpaths; this is not one, and neither is the `MapPreview` it wraps.
170
+ Being unported is the ordinary state — 115 subpaths are, at the time of
171
+ writing — and it fails LOUDLY under Metro: an unported subpath resolves to the
172
+ web file and errors on `@mui/material` at import rather than rendering a blank
173
+ view. It is also the right call for this
174
+ component: a fleet board is a dispatcher's screen, and the tracked unit's own
175
+ device reports a position rather than drawing the fleet.
176
+ - **The map's own `aria-label` is English**, and comes from `MapPreview` rather
177
+ than from `copy`. Everything `FleetMap` itself renders is injected; that one
178
+ sentence is not, and a pt-BR consumer's screen reader will read it in English
179
+ until `MapPreview` takes a copy port.
180
+ - **Pin separation does not scale with zoom.** `MapPreview` places markers at a
181
+ fixed pixels-per-degree, so units a few hundred metres apart draw within a
182
+ pixel or two of each other. The roster distinguishes them; the map does not.