@12-apps/ui 6.98.1 → 6.100.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 (169) hide show
  1. package/dist/_internal/components/data-display/Alert/Alert.content.js +2 -2
  2. package/dist/_internal/components/data-display/Alert/Alert.js +3 -3
  3. package/dist/_internal/components/data-display/CardKit/card-actions-context.js +4 -4
  4. package/dist/_internal/components/data-display/CardKit/use-remove-confirm.js +5 -5
  5. package/dist/_internal/components/data-display/Carousel/Carousel.js +2 -2
  6. package/dist/_internal/components/data-display/Chart/SpecChart.js +3 -3
  7. package/dist/_internal/components/data-display/DataGrid/DataGrid.js +1 -1
  8. package/dist/_internal/components/data-display/DataViews/DataViewsGrid.js +17 -17
  9. package/dist/_internal/components/data-display/DataViews/DataViewsTableBase.js +22 -22
  10. package/dist/_internal/components/data-display/DataViews/base-list-card-geometry.js +1 -1
  11. package/dist/_internal/components/data-display/DataViews/base-list-card-layout.js +1 -1
  12. package/dist/_internal/components/data-display/DataViews/base-list-card-slots.js +1 -1
  13. package/dist/_internal/components/data-display/DataViews/base-list-card.js +4 -4
  14. package/dist/_internal/components/data-display/DataViews/data-views-grid-bodies.js +2 -2
  15. package/dist/_internal/components/data-display/DataViews/data-views-grid-parts.js +14 -14
  16. package/dist/_internal/components/data-display/DataViews/data-views-inline-bar.js +6 -6
  17. package/dist/_internal/components/data-display/DataViews/data-views-more-fields.js +2 -2
  18. package/dist/_internal/components/data-display/DataViews/data-views-more-filters.js +3 -3
  19. package/dist/_internal/components/data-display/DataViews/data-views-table-parts.js +4 -4
  20. package/dist/_internal/components/data-display/DataViews/list-card-rails.js +1 -1
  21. package/dist/_internal/components/data-display/DataViews/use-data-views-state.js +2 -2
  22. package/dist/_internal/components/data-display/DayRuler/DayRuler.footer.js +2 -2
  23. package/dist/_internal/components/data-display/DayRuler/DayRuler.js +7 -7
  24. package/dist/_internal/components/data-display/DayRuler/DayRuler.keyboard.js +2 -2
  25. package/dist/_internal/components/data-display/DayRuler/DayRuler.parts.js +3 -3
  26. package/dist/_internal/components/data-display/DayRuler/useRulerDrag.js +2 -2
  27. package/dist/_internal/components/data-display/FleetMap/FleetBody.js +6 -6
  28. package/dist/_internal/components/data-display/FleetMap/FleetCanvas.js +5 -5
  29. package/dist/_internal/components/data-display/FleetMap/FleetMap.js +7 -7
  30. package/dist/_internal/components/data-display/HoverCard/HoverCard.js +2 -2
  31. package/dist/_internal/components/data-display/Lightbox/Lightbox.js +3 -3
  32. package/dist/_internal/components/data-display/MapPreview/MapLayers.js +2 -2
  33. package/dist/_internal/components/data-display/MapPreview/MapPreview.js +4 -4
  34. package/dist/_internal/components/data-display/Progress/Progress.js +2 -2
  35. package/dist/_internal/components/data-display/RegionMap/RegionMap.fixtures.js +1 -1
  36. package/dist/_internal/components/data-display/RegionMap/RegionMap.helpers.js +3 -1
  37. package/dist/_internal/components/data-display/RegionMap/RegionMap.hooks.js +3 -3
  38. package/dist/_internal/components/data-display/RegionMap/RegionMap.js +6 -5
  39. package/dist/_internal/components/data-display/RegionMap/RegionMap.view.js +2 -2
  40. package/dist/_internal/components/data-display/RegionMap/RegionMapDrawing.js +3 -2
  41. package/dist/_internal/components/data-display/RegionMap/RegionMapPin.js +26 -0
  42. package/dist/_internal/components/data-display/index.js +51 -45
  43. package/dist/_internal/components/feedback/NotificationStatusNotice/NotificationStatusNotice.js +4 -4
  44. package/dist/_internal/components/feedback/SequenceResolver/SequenceResolver.frame.js +4 -4
  45. package/dist/_internal/components/feedback/SequenceResolver/SequenceResolver.header.js +3 -3
  46. package/dist/_internal/components/feedback/SequenceResolver/SequenceResolver.js +10 -10
  47. package/dist/_internal/components/feedback/SequenceResolver/SequenceResolver.overview.js +5 -5
  48. package/dist/_internal/components/feedback/SequenceResolver/SequenceResolver.parts.js +4 -4
  49. package/dist/_internal/components/feedback/index.js +11 -11
  50. package/dist/_internal/components/index.js +57 -51
  51. package/dist/charts.js +11 -11
  52. package/dist/{chunk-WYNGH2WL.js → chunk-255WTBZ5.js} +8 -8
  53. package/dist/{chunk-CGLMWS7K.js → chunk-37MJZLQU.js} +2 -2
  54. package/dist/{chunk-PNAKRHRT.js → chunk-3I7KE2N6.js} +2 -2
  55. package/dist/{chunk-L4FWEI2P.js → chunk-3V3Z4EML.js} +5 -5
  56. package/dist/{chunk-6RYSSNOO.js → chunk-54DOLCJ3.js} +2 -2
  57. package/dist/{chunk-74IH3ZGD.js → chunk-643YFWNK.js} +2 -2
  58. package/dist/{chunk-FRQGZIYU.js → chunk-6WAP7BJS.js} +2 -2
  59. package/dist/chunk-7XVT4RME.js +293 -0
  60. package/dist/chunk-7XVT4RME.js.map +1 -0
  61. package/dist/{chunk-JO6D7YGN.js → chunk-CWRQGA2T.js} +2 -2
  62. package/dist/{chunk-ZW7Q3IRL.js → chunk-FYJL432J.js} +4 -4
  63. package/dist/{chunk-G6TKWNF2.js → chunk-GZITNT7O.js} +11 -11
  64. package/dist/{chunk-RFMQBIE6.js → chunk-HBHBRRSW.js} +4 -4
  65. package/dist/{chunk-U4Z6GZDW.js → chunk-HN36UVOE.js} +4 -4
  66. package/dist/{chunk-WK577LQL.js → chunk-J2IQ6FJ5.js} +4 -4
  67. package/dist/{chunk-HCTHY66U.js → chunk-KAGXV3ID.js} +4 -4
  68. package/dist/{chunk-FWAY2SAI.js → chunk-KAZWBDIH.js} +2 -2
  69. package/dist/{chunk-DKPELKGL.js → chunk-KV7LTOWC.js} +5 -5
  70. package/dist/{chunk-UC7DLGMP.js → chunk-KVP5A3YK.js} +2 -2
  71. package/dist/{chunk-3CXRHRGE.js → chunk-LCKUEYU2.js} +7 -3
  72. package/dist/chunk-LCKUEYU2.js.map +1 -0
  73. package/dist/{chunk-EGBQR5GH.js → chunk-LOLYBFYY.js} +5 -5
  74. package/dist/{chunk-SOXO2VN3.js → chunk-MEMVZW64.js} +3 -3
  75. package/dist/{chunk-COOSJKZL.js → chunk-MNJZPJ5S.js} +2 -1
  76. package/dist/chunk-MNJZPJ5S.js.map +1 -0
  77. package/dist/{chunk-G2NVBCF7.js → chunk-NWUMGE6T.js} +3 -3
  78. package/dist/{chunk-RKAX37F4.js → chunk-Q5SCBQLY.js} +7 -7
  79. package/dist/{chunk-3R5MCSYO.js → chunk-QLKUWDMQ.js} +4 -4
  80. package/dist/{chunk-MPVH2GM5.js → chunk-RAQD5QCM.js} +4 -4
  81. package/dist/{chunk-KXDLLS62.js → chunk-REHGWN5M.js} +4 -4
  82. package/dist/{chunk-3N2HWNKT.js → chunk-UIJLDAV7.js} +2 -2
  83. package/dist/{chunk-GDWU7WF4.js → chunk-UN5WU2OX.js} +4 -4
  84. package/dist/{chunk-A27J4CIZ.js → chunk-UTIYB6VE.js} +11 -11
  85. package/dist/{chunk-5V7IZBRY.js → chunk-VRSW7PIO.js} +5 -5
  86. package/dist/{chunk-AESKKFA5.js → chunk-WDEVKND3.js} +3 -3
  87. package/dist/chunk-WGKLBVDZ.js +1 -0
  88. package/dist/chunk-WGKLBVDZ.js.map +1 -0
  89. package/dist/{chunk-67GTAPK6.js → chunk-XFOKLWJZ.js} +2 -2
  90. package/dist/{chunk-OV5NM4FY.js → chunk-XQAFSC66.js} +2 -2
  91. package/dist/{chunk-6FGP7RMV.js → chunk-XR474YYX.js} +2 -2
  92. package/dist/{chunk-E4MJA52O.js → chunk-YHFLI2FD.js} +16 -18
  93. package/dist/chunk-YHFLI2FD.js.map +1 -0
  94. package/dist/{chunk-4N4M237A.js → chunk-YQ5GQ32T.js} +2 -2
  95. package/dist/{chunk-YLZXIR6B.js → chunk-Z5V5E3JW.js} +4 -4
  96. package/dist/data-display/Alert.js +3 -3
  97. package/dist/data-display/CardKit.js +5 -5
  98. package/dist/data-display/Carousel.js +2 -2
  99. package/dist/data-display/Chart.js +11 -11
  100. package/dist/data-display/DataGrid.js +1 -1
  101. package/dist/data-display/DataViews.js +29 -29
  102. package/dist/data-display/DayRuler.js +7 -7
  103. package/dist/data-display/FleetMap.js +7 -7
  104. package/dist/data-display/HoverCard.js +2 -2
  105. package/dist/data-display/Lightbox.js +3 -3
  106. package/dist/data-display/MapPreview.js +4 -4
  107. package/dist/data-display/Progress.js +2 -2
  108. package/dist/data-display/RegionMap.js +14 -8
  109. package/dist/feedback/NotificationStatusNotice.js +4 -4
  110. package/dist/feedback/SequenceResolver.js +10 -10
  111. package/dist/types/components/data-display/RegionMap/RegionMap.d.ts +1 -1
  112. package/dist/types/components/data-display/RegionMap/RegionMap.d.ts.map +1 -1
  113. package/dist/types/components/data-display/RegionMap/RegionMap.helpers.d.ts +9 -0
  114. package/dist/types/components/data-display/RegionMap/RegionMap.helpers.d.ts.map +1 -1
  115. package/dist/types/components/data-display/RegionMap/RegionMap.types.d.ts +45 -1
  116. package/dist/types/components/data-display/RegionMap/RegionMap.types.d.ts.map +1 -1
  117. package/dist/types/components/data-display/RegionMap/RegionMapDrawing.d.ts +4 -1
  118. package/dist/types/components/data-display/RegionMap/RegionMapDrawing.d.ts.map +1 -1
  119. package/dist/types/components/data-display/RegionMap/RegionMapPin.d.ts +102 -0
  120. package/dist/types/components/data-display/RegionMap/RegionMapPin.d.ts.map +1 -0
  121. package/dist/types/components/data-display/RegionMap/index.d.ts +2 -1
  122. package/dist/types/components/data-display/RegionMap/index.d.ts.map +1 -1
  123. package/package.json +1 -1
  124. package/src/components/data-display/RegionMap/RegionMap.helpers.ts +1 -1
  125. package/src/components/data-display/RegionMap/RegionMap.md +19 -2
  126. package/src/components/data-display/RegionMap/RegionMap.tsx +4 -0
  127. package/src/components/data-display/RegionMap/RegionMap.types.ts +49 -1
  128. package/src/components/data-display/RegionMap/RegionMapDrawing.tsx +11 -13
  129. package/src/components/data-display/RegionMap/RegionMapPin.tsx +388 -0
  130. package/src/components/data-display/RegionMap/index.ts +5 -0
  131. package/dist/chunk-3CXRHRGE.js.map +0 -1
  132. package/dist/chunk-COOSJKZL.js.map +0 -1
  133. package/dist/chunk-DY2I6LMX.js +0 -1
  134. package/dist/chunk-E4MJA52O.js.map +0 -1
  135. /package/dist/{chunk-DY2I6LMX.js.map → _internal/components/data-display/RegionMap/RegionMapPin.js.map} +0 -0
  136. /package/dist/{chunk-WYNGH2WL.js.map → chunk-255WTBZ5.js.map} +0 -0
  137. /package/dist/{chunk-CGLMWS7K.js.map → chunk-37MJZLQU.js.map} +0 -0
  138. /package/dist/{chunk-PNAKRHRT.js.map → chunk-3I7KE2N6.js.map} +0 -0
  139. /package/dist/{chunk-L4FWEI2P.js.map → chunk-3V3Z4EML.js.map} +0 -0
  140. /package/dist/{chunk-6RYSSNOO.js.map → chunk-54DOLCJ3.js.map} +0 -0
  141. /package/dist/{chunk-74IH3ZGD.js.map → chunk-643YFWNK.js.map} +0 -0
  142. /package/dist/{chunk-FRQGZIYU.js.map → chunk-6WAP7BJS.js.map} +0 -0
  143. /package/dist/{chunk-JO6D7YGN.js.map → chunk-CWRQGA2T.js.map} +0 -0
  144. /package/dist/{chunk-ZW7Q3IRL.js.map → chunk-FYJL432J.js.map} +0 -0
  145. /package/dist/{chunk-G6TKWNF2.js.map → chunk-GZITNT7O.js.map} +0 -0
  146. /package/dist/{chunk-RFMQBIE6.js.map → chunk-HBHBRRSW.js.map} +0 -0
  147. /package/dist/{chunk-U4Z6GZDW.js.map → chunk-HN36UVOE.js.map} +0 -0
  148. /package/dist/{chunk-WK577LQL.js.map → chunk-J2IQ6FJ5.js.map} +0 -0
  149. /package/dist/{chunk-HCTHY66U.js.map → chunk-KAGXV3ID.js.map} +0 -0
  150. /package/dist/{chunk-FWAY2SAI.js.map → chunk-KAZWBDIH.js.map} +0 -0
  151. /package/dist/{chunk-DKPELKGL.js.map → chunk-KV7LTOWC.js.map} +0 -0
  152. /package/dist/{chunk-UC7DLGMP.js.map → chunk-KVP5A3YK.js.map} +0 -0
  153. /package/dist/{chunk-EGBQR5GH.js.map → chunk-LOLYBFYY.js.map} +0 -0
  154. /package/dist/{chunk-SOXO2VN3.js.map → chunk-MEMVZW64.js.map} +0 -0
  155. /package/dist/{chunk-G2NVBCF7.js.map → chunk-NWUMGE6T.js.map} +0 -0
  156. /package/dist/{chunk-RKAX37F4.js.map → chunk-Q5SCBQLY.js.map} +0 -0
  157. /package/dist/{chunk-3R5MCSYO.js.map → chunk-QLKUWDMQ.js.map} +0 -0
  158. /package/dist/{chunk-MPVH2GM5.js.map → chunk-RAQD5QCM.js.map} +0 -0
  159. /package/dist/{chunk-KXDLLS62.js.map → chunk-REHGWN5M.js.map} +0 -0
  160. /package/dist/{chunk-3N2HWNKT.js.map → chunk-UIJLDAV7.js.map} +0 -0
  161. /package/dist/{chunk-GDWU7WF4.js.map → chunk-UN5WU2OX.js.map} +0 -0
  162. /package/dist/{chunk-A27J4CIZ.js.map → chunk-UTIYB6VE.js.map} +0 -0
  163. /package/dist/{chunk-5V7IZBRY.js.map → chunk-VRSW7PIO.js.map} +0 -0
  164. /package/dist/{chunk-AESKKFA5.js.map → chunk-WDEVKND3.js.map} +0 -0
  165. /package/dist/{chunk-67GTAPK6.js.map → chunk-XFOKLWJZ.js.map} +0 -0
  166. /package/dist/{chunk-OV5NM4FY.js.map → chunk-XQAFSC66.js.map} +0 -0
  167. /package/dist/{chunk-6FGP7RMV.js.map → chunk-XR474YYX.js.map} +0 -0
  168. /package/dist/{chunk-4N4M237A.js.map → chunk-YQ5GQ32T.js.map} +0 -0
  169. /package/dist/{chunk-YLZXIR6B.js.map → chunk-Z5V5E3JW.js.map} +0 -0
@@ -0,0 +1,102 @@
1
+ import { type Theme } from '@mui/material/styles/index.js';
2
+ import React from 'react';
3
+ import { type PlaneBox, type PlanePoint, type Projection } from './RegionMap.helpers';
4
+ import type { RegionMapModel } from './RegionMap.hooks';
5
+ import type { RegionMapCenter, RegionMapCopy, RegionMapDot, RegionMapGhost, RegionMapPin } from './RegionMap.types';
6
+ /**
7
+ * The movable centre of a `RegionMap` (`pin`, `ghost`, `dots`): a pin the
8
+ * viewer drags with a mouse or one finger, or focuses and nudges with the
9
+ * arrow keys, while the VIEW stays where `center` put it — so the areas never
10
+ * slide under a dragging finger. The circles follow the pin; a dashed ring
11
+ * and dot stay at `ghost`; `dots` are small points (filled or hollow).
12
+ *
13
+ * The pin is HTML over the drawing, at its point by percent like the labels,
14
+ * carrying `data-region-pin` so a host that zooms the drawing's layers can
15
+ * move it with them. Its moves are reported, never applied: the host passes
16
+ * the new point back.
17
+ */
18
+ /** The movable centre and what is drawn with it, as the drawing receives it. */
19
+ export interface Moving {
20
+ center: RegionMapCenter;
21
+ pin?: RegionMapPin;
22
+ ghost?: RegionMapGhost;
23
+ dots?: readonly RegionMapDot[];
24
+ copy: RegionMapCopy;
25
+ }
26
+ type DrawnModel = Pick<RegionMapModel, 'projection' | 'radii'> & {
27
+ view: PlaneBox;
28
+ };
29
+ /**
30
+ * What the movable centre draws inside the SVG: the circles around the pin
31
+ * (else `fallback`, the centre's own circles), the ghost, and the dots.
32
+ */
33
+ export declare function PinShapes({ model, moving, testId, theme, fallback }: {
34
+ model: DrawnModel;
35
+ moving: Moving | undefined;
36
+ testId: string;
37
+ theme: Theme;
38
+ fallback: React.ReactNode;
39
+ }): React.JSX.Element;
40
+ /** What the movable centre draws over the SVG, in HTML: the pin and the scale bar. */
41
+ export declare function PinOverlay({ model, moving, svgRef, testId, theme, }: {
42
+ model: DrawnModel;
43
+ moving: Moving | undefined;
44
+ svgRef: React.RefObject<SVGSVGElement | null>;
45
+ testId: string;
46
+ theme: Theme;
47
+ }): React.JSX.Element | null;
48
+ /** The flat projection's inverse around `center` — it is linear. */
49
+ export declare function latLngAt(center: RegionMapCenter, point: PlanePoint): RegionMapCenter;
50
+ interface PinLayerProps {
51
+ pin: RegionMapPin;
52
+ center: RegionMapCenter;
53
+ projection: Projection;
54
+ view: PlaneBox;
55
+ /** The drawing's SVG, whose on-screen box maps a pointer to the plane (zoomed or not). */
56
+ svgRef: React.RefObject<SVGSVGElement | null>;
57
+ testId: string;
58
+ theme: Theme;
59
+ }
60
+ /** The draggable pin, as HTML over the drawing. */
61
+ export declare function PinMarker({ pin, center, projection, view, svgRef, testId, theme }: PinLayerProps): React.JSX.Element;
62
+ /** The circles around the pin: solid in the primary colour, faintly filled. */
63
+ export declare function PinCircles({ at, radii, theme }: {
64
+ at: PlanePoint;
65
+ radii: readonly number[];
66
+ theme: Theme;
67
+ }): React.JSX.Element;
68
+ /** Where the circles stood: a dashed ring and dot at `ghost`, and a dashed line from it to the pin. */
69
+ export declare function GhostShapes({ ghost, pinAt, projection, view, testId, theme, }: {
70
+ ghost: RegionMapGhost;
71
+ pinAt: PlanePoint;
72
+ projection: Projection;
73
+ view: PlaneBox;
74
+ testId: string;
75
+ theme: Theme;
76
+ }): React.JSX.Element;
77
+ /** The dots: filled with the ink, or hollow (paper with an ink ring). */
78
+ export declare function Dots({ dots, projection, view, testId, theme }: {
79
+ dots: readonly RegionMapDot[];
80
+ projection: Projection;
81
+ view: PlaneBox;
82
+ testId: string;
83
+ theme: Theme;
84
+ }): React.JSX.Element;
85
+ /** The longest nice length that fits in a quarter of the drawing's width. */
86
+ export declare function scaleMetres(view: PlaneBox): number;
87
+ /**
88
+ * A scale bar, bottom-left, when the host gives `copy.scale`. It reads what is
89
+ * on screen: a host that zooms the drawing's layers (a CSS scale on the SVG)
90
+ * shows fewer metres per pixel, so after every render the bar compares the
91
+ * SVG's drawn width with its laid-out width — both off the SVG itself — and
92
+ * spans the drawing's own width, so its share of it is a share of the view.
93
+ */
94
+ export declare function ScaleBar({ view, copy, svgRef, testId, theme, }: {
95
+ view: PlaneBox;
96
+ copy: RegionMapCopy;
97
+ svgRef: React.RefObject<SVGSVGElement | null>;
98
+ testId: string;
99
+ theme: Theme;
100
+ }): React.JSX.Element | null;
101
+ export {};
102
+ //# sourceMappingURL=RegionMapPin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RegionMapPin.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/RegionMap/RegionMapPin.tsx"],"names":[],"mappings":"AACA,OAAO,EAAS,KAAK,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAA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KAAK,EAAE,KAAK,CAAC;CACd,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAWpB;AAED,yEAAyE;AACzE,wBAAgB,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;IAAE,IAAI,EAAE,SAAS,YAAY,EAAE,CAAC;IAAC,UAAU,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAsB1L;AAKD,6EAA6E;AAC7E,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAGlD;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,MAAM,EACN,KAAK,GACN,EAAE;IACD,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;CACd,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,GAAG,IAAI,CA+B3B"}
@@ -1,6 +1,7 @@
1
1
  export { RegionMap } from './RegionMap';
2
2
  export { decodePolyline, hitRegion, projectionAt } from './RegionMap.helpers';
3
+ export { latLngAt, scaleMetres } from './RegionMapPin';
3
4
  export { boundsOfRings, regionMapView } from './RegionMap.view';
4
5
  export type { AreaGeometry, PlaneBox, PlanePoint, PlaneRegion, Projection } from './RegionMap.helpers';
5
- export type { RegionMapBounds, RegionMapCircle, RegionMapCopy, RegionMapLayer, RegionMapListMode, RegionMapListSort, RegionMapPoint, RegionMapProps, RegionMapReach, RegionMapRegion, RegionMapRing, } from './RegionMap.types';
6
+ export type { RegionMapBounds, RegionMapCircle, RegionMapCenter, RegionMapCopy, RegionMapDot, RegionMapGhost, RegionMapLayer, RegionMapListMode, RegionMapListSort, RegionMapPin, RegionMapPoint, RegionMapProps, RegionMapReach, RegionMapRegion, RegionMapRing, } from './RegionMap.types';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/RegionMap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAChE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACvG,YAAY,EACV,eAAe,EACf,eAAe,EACf,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,EACf,aAAa,GACd,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/RegionMap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAChE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACvG,YAAY,EACV,eAAe,EACf,eAAe,EACf,eAAe,EACf,aAAa,EACb,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,EACf,aAAa,GACd,MAAM,mBAAmB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@12-apps/ui",
3
- "version": "6.98.1",
3
+ "version": "6.100.0",
4
4
  "license": "MIT",
5
5
  "packageManager": "pnpm@10.34.5",
6
6
  "type": "module",
@@ -9,7 +9,7 @@ import type { RegionMapPoint, RegionMapRegion, RegionMapRing } from './RegionMap
9
9
  */
10
10
 
11
11
  /** Metres per degree of latitude on the mean sphere. */
12
- const METRES_PER_DEGREE = 111_195;
12
+ export const METRES_PER_DEGREE = 111_195;
13
13
 
14
14
  /** A projected point, metres east (`x`) and south (`y`) of the centre. */
15
15
  export interface PlanePoint {
@@ -102,7 +102,10 @@ drawing means copying its view math and losing its frame. So:
102
102
  |---|---|---|---|
103
103
  | `regions` | `readonly RegionMapRegion[]` | — | the areas; drawn when any part is in view |
104
104
  | `center` | `{ latitude, longitude } \| null` | — | centre, dot and circles; `null` centres on the areas, no dot |
105
- | `circles` | `readonly { radiusMetres }[]` | `[]` | dashed circles; the view fits the largest |
105
+ | `circles` | `readonly { radiusMetres }[]` | `[]` | dashed circles; the view fits the largest (solid, around the pin, when there is a `pin`) |
106
+ | `pin` | `{ at, label, ariaLabel, onMove?, onDrop, stepMetres?, disabled? }` | — | the centre as a pin the viewer drags or nudges with the arrow keys; the view stays on `center` |
107
+ | `ghost` | `{ at, radiusMetres }` | — | a dashed ring and dot where the circles stood, a dashed line to the pin |
108
+ | `dots` | `readonly { id, at, filled }[]` | — | small points, filled or hollow, not tappable |
106
109
  | `reach` | `{ radiusMetres } \| { bounds: { south, west, north, east } }` | — | an extent the view must also fit (margin on top) |
107
110
  | `overlay` | `(layer: { view, projection }) => ReactNode` | — | a host layer inside the SVG, under the circles, tap-transparent |
108
111
  | `onToggle` | `(id: string) => void` | — | a tap or a list press; omit for read-only |
@@ -132,7 +135,21 @@ drawing means copying its view math and losing its frame. So:
132
135
 
133
136
  `mapLabel`, `legendExcluded`, `legendCircle(radiusMetres)`, `legendCenter`,
134
137
  `listLabel`, `showList(count)` (the count of LISTED areas), `hideList`, and
135
- `rowState: { excluded, outside }` — a row's state in words, for a screen reader.
138
+ `rowState: { excluded, outside }` — a row's state in words, for a screen reader;
139
+ optional `scale(metres)` — a scale bar's length ("1 km"), shown only when given.
140
+
141
+ ### The movable centre (`pin`)
142
+
143
+ A store's point placed 200 m off by a geocoder is corrected by dragging it
144
+ where the circles are measured from. So the pin moves and the VIEW does not:
145
+ the areas never slide under a dragging finger. The pin is HTML over the
146
+ drawing (a 44×48 button, `touch-action: none`), carrying `data-region-pin` so
147
+ a host that zooms the drawing's layers can move it with them. A drag is
148
+ captured, clamped inside the view, and kept from the host's own listeners on
149
+ the drawing; each arrow key moves it `stepMetres` (50). Moves are reported
150
+ (`onMove`, `onDrop`), never applied: the host passes the new `at` back.
151
+ `latLngAt(center, planePoint)` is the projection's inverse for a host that
152
+ needs it.
136
153
 
137
154
  ## Helpers
138
155
 
@@ -39,6 +39,9 @@ export function RegionMap({
39
39
  regions,
40
40
  center,
41
41
  circles,
42
+ pin,
43
+ ghost,
44
+ dots,
42
45
  reach,
43
46
  overlay,
44
47
  onToggle,
@@ -62,6 +65,7 @@ export function RegionMap({
62
65
  model={{ ...model, view }}
63
66
  overlay={overlay}
64
67
  showCenter={center !== null}
68
+ moving={center === null ? undefined : { center, pin, ghost, dots, copy }}
65
69
  highlightedIds={highlightedIds}
66
70
  maxHeight={maxHeight}
67
71
  label={copy.mapLabel}
@@ -49,6 +49,46 @@ export interface RegionMapRegion {
49
49
  detail?: string;
50
50
  }
51
51
 
52
+ /** A latitude/longitude pair, by name. */
53
+ export interface RegionMapCenter {
54
+ latitude: number;
55
+ longitude: number;
56
+ }
57
+
58
+ /**
59
+ * The centre as a pin the viewer moves (a store's door). The VIEW stays on
60
+ * `center`; the pin, and the circles with it, are drawn at `at`. Moves are
61
+ * reported, never applied: the host passes the new `at` back.
62
+ */
63
+ export interface RegionMapPin {
64
+ at: RegionMapCenter;
65
+ /** Printed beside the pin, e.g. "Store". */
66
+ label: string;
67
+ /** The pin's accessible name, e.g. "Store pin. Drag it, or use the arrow keys, to move it". */
68
+ ariaLabel: string;
69
+ /** Every point while a pointer drags it. */
70
+ onMove?: (at: RegionMapCenter) => void;
71
+ /** Where it came to rest: the pointer let go, or an arrow key moved it. */
72
+ onDrop: (at: RegionMapCenter) => void;
73
+ /** Metres one arrow key moves it. Default 50. */
74
+ stepMetres?: number;
75
+ /** Held in place (a save in flight). */
76
+ disabled?: boolean;
77
+ }
78
+
79
+ /** Where the pin's outermost circle stood: a dashed ring of `radiusMetres` and a dashed dot at `at`. */
80
+ export interface RegionMapGhost {
81
+ at: RegionMapCenter;
82
+ radiusMetres: number;
83
+ }
84
+
85
+ /** A small point on the map (an address), filled or hollow. Not tappable. */
86
+ export interface RegionMapDot {
87
+ id: string;
88
+ at: RegionMapCenter;
89
+ filled: boolean;
90
+ }
91
+
52
92
  /** A circle drawn around the centre, e.g. a delivery ring. */
53
93
  export interface RegionMapCircle {
54
94
  radiusMetres: number;
@@ -99,6 +139,8 @@ export interface RegionMapCopy {
99
139
  * `outside` one (faded). Neither is shown; the row's look carries it.
100
140
  */
101
141
  rowState: { excluded: string; outside: string };
142
+ /** A scale bar's length, e.g. "1 km". Omit for no scale bar. */
143
+ scale?: (metres: number) => string;
102
144
  }
103
145
 
104
146
  /** The order of the list: as given (e.g. nearest first), or by name. */
@@ -120,8 +162,14 @@ export interface RegionMapProps {
120
162
  * `null` with no regions renders NOTHING rather than a map of `0, 0`.
121
163
  */
122
164
  center: { latitude: number; longitude: number } | null;
123
- /** Circles around the centre; the view fits the largest. */
165
+ /** Circles around the centre (around `pin.at` when there is a pin); the view fits the largest. */
124
166
  circles?: readonly RegionMapCircle[];
167
+ /** The centre as a draggable pin; it replaces the centre's dot, and the circles follow it. */
168
+ pin?: RegionMapPin;
169
+ /** A dashed ring and dot where the circles stood (drawn with a `pin`). */
170
+ ghost?: RegionMapGhost;
171
+ /** Small points, filled or hollow, over the areas and under the pin. */
172
+ dots?: readonly RegionMapDot[];
125
173
  /**
126
174
  * An extent the view must ALSO fit, before its margin — something the host
127
175
  * draws past the largest circle. With circles the view stays centred on the
@@ -9,12 +9,16 @@ import { labelPosition, type AreaGeometry, type DrawnRegion, type PlaneBox } fro
9
9
  import type { RegionMapModel } from './RegionMap.hooks';
10
10
  import { labelOrder, placeLabels } from './RegionMap.labels';
11
11
  import type { RegionMapLayer } from './RegionMap.types';
12
+ import type { Moving } from './RegionMapPin';
13
+ import { PinOverlay, PinShapes } from './RegionMapPin';
12
14
 
13
15
  export interface RegionMapDrawingProps {
14
16
  model: RegionMapModel & { view: PlaneBox };
15
17
  /** The host's layer, drawn inside the SVG under the circles (`RegionMapProps.overlay`). */
16
18
  overlay?: (layer: RegionMapLayer) => React.ReactNode;
17
19
  showCenter: boolean;
20
+ /** The movable centre and what is drawn with it (`RegionMapProps.pin`, `ghost`, `dots`). */
21
+ moving?: Moving;
18
22
  highlightedIds: readonly string[];
19
23
  maxHeight: string | undefined;
20
24
  label: string;
@@ -33,17 +37,8 @@ export interface RegionMapDrawingProps {
33
37
  * The base areas are a memoised layer: a toggle changes `excluded`, not the
34
38
  * geometry, so only the hatch, highlight and label layers re-render.
35
39
  */
36
- export function RegionMapDrawing({
37
- model,
38
- overlay,
39
- showCenter,
40
- highlightedIds,
41
- maxHeight,
42
- label,
43
- tappable,
44
- testId,
45
- theme,
46
- }: RegionMapDrawingProps): React.JSX.Element {
40
+ export function RegionMapDrawing(props: RegionMapDrawingProps): React.JSX.Element {
41
+ const { model, overlay, showCenter, moving, highlightedIds, maxHeight, label, tappable, testId, theme } = props;
47
42
  const hatchId = `${React.useId().replace(/:/g, '')}-hatch`;
48
43
  const { view, drawn } = model;
49
44
  const wanted = new Set(highlightedIds);
@@ -52,6 +47,7 @@ export function RegionMapDrawing({
52
47
  // claim their place in, so a collision hides the less important one.
53
48
  const labelled = labelOrder(drawn.filter((d) => d.excluded || wanted.has(d.id)), wanted);
54
49
  const boxRef = React.useRef<HTMLDivElement>(null);
50
+ const svgRef = React.useRef<SVGSVGElement>(null);
55
51
  useLabelPlacement(boxRef, labelled.map((d) => d.id).join('|'), remPx(theme, 4));
56
52
  const base = drawn.map((d) => ({ id: d.id, name: d.name, geometry: d.geometry, outside: d.outside === true }));
57
53
  return (
@@ -72,6 +68,7 @@ export function RegionMapDrawing({
72
68
  ref={boxRef}
73
69
  >
74
70
  <svg
71
+ ref={svgRef}
75
72
  viewBox={`${view.minX} ${view.minY} ${view.spanX} ${view.spanY}`}
76
73
  role="img"
77
74
  aria-label={label}
@@ -89,9 +86,9 @@ export function RegionMapDrawing({
89
86
  {overlay({ view, projection: model.projection })}
90
87
  </g>
91
88
  )}
92
- <Circles radii={model.radii} theme={theme} />
89
+ <PinShapes model={model} moving={moving} testId={testId} theme={theme} fallback={<Circles radii={model.radii} theme={theme} />} />
93
90
  <Highlights areas={highlighted} testId={testId} theme={theme} />
94
- {showCenter && (
91
+ {showCenter && !moving?.pin && (
95
92
  <circle
96
93
  cx={0}
97
94
  cy={0}
@@ -108,6 +105,7 @@ export function RegionMapDrawing({
108
105
  {labelled.map((d) => (
109
106
  <AreaLabel key={`l-${d.id}`} area={d} view={view} testId={testId} theme={theme} />
110
107
  ))}
108
+ <PinOverlay model={model} moving={moving} svgRef={svgRef} testId={testId} theme={theme} />
111
109
  </Box>
112
110
  );
113
111
  }