panelui-native 0.22.6 → 0.28.1

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 (258) hide show
  1. package/README.md +1 -0
  2. package/lib/module/components/accordion/index.js +8 -8
  3. package/lib/module/components/accordion/index.js.map +1 -1
  4. package/lib/module/components/alert/index.js +2 -2
  5. package/lib/module/components/alert/index.js.map +1 -1
  6. package/lib/module/components/area-chart/index.js +958 -0
  7. package/lib/module/components/area-chart/index.js.map +1 -0
  8. package/lib/module/components/attachment/index.js +2 -1
  9. package/lib/module/components/attachment/index.js.map +1 -1
  10. package/lib/module/components/avatar/index.js +4 -4
  11. package/lib/module/components/avatar/index.js.map +1 -1
  12. package/lib/module/components/badge/index.js +4 -4
  13. package/lib/module/components/badge/index.js.map +1 -1
  14. package/lib/module/components/bar-chart/index.js +994 -0
  15. package/lib/module/components/bar-chart/index.js.map +1 -0
  16. package/lib/module/components/bottom-sheet/index.js +213 -24
  17. package/lib/module/components/bottom-sheet/index.js.map +1 -1
  18. package/lib/module/components/breadcrumb/index.js +275 -0
  19. package/lib/module/components/breadcrumb/index.js.map +1 -0
  20. package/lib/module/components/button/index.js +11 -6
  21. package/lib/module/components/button/index.js.map +1 -1
  22. package/lib/module/components/calendar/index.js +557 -0
  23. package/lib/module/components/calendar/index.js.map +1 -0
  24. package/lib/module/components/carousel/index.js +680 -0
  25. package/lib/module/components/carousel/index.js.map +1 -0
  26. package/lib/module/components/chip/index.js +6 -6
  27. package/lib/module/components/chip/index.js.map +1 -1
  28. package/lib/module/components/date-picker/index.js +158 -0
  29. package/lib/module/components/date-picker/index.js.map +1 -0
  30. package/lib/module/components/dialog/index.js +7 -2
  31. package/lib/module/components/dialog/index.js.map +1 -1
  32. package/lib/module/components/direction/index.js +15 -20
  33. package/lib/module/components/direction/index.js.map +1 -1
  34. package/lib/module/components/empty-state/index.js +2 -2
  35. package/lib/module/components/empty-state/index.js.map +1 -1
  36. package/lib/module/components/field/index.js +5 -5
  37. package/lib/module/components/field/index.js.map +1 -1
  38. package/lib/module/components/flow/index.js +3 -3
  39. package/lib/module/components/flow/index.js.map +1 -1
  40. package/lib/module/components/frame/index.js +22 -5
  41. package/lib/module/components/frame/index.js.map +1 -1
  42. package/lib/module/components/heatmap-chart/index.js +28 -8
  43. package/lib/module/components/heatmap-chart/index.js.map +1 -1
  44. package/lib/module/components/input-group/index.js +5 -4
  45. package/lib/module/components/input-group/index.js.map +1 -1
  46. package/lib/module/components/item/index.js +9 -9
  47. package/lib/module/components/item/index.js.map +1 -1
  48. package/lib/module/components/label/index.js +4 -4
  49. package/lib/module/components/label/index.js.map +1 -1
  50. package/lib/module/components/line-chart/index.js +165 -184
  51. package/lib/module/components/line-chart/index.js.map +1 -1
  52. package/lib/module/components/loader/index.js +758 -0
  53. package/lib/module/components/loader/index.js.map +1 -0
  54. package/lib/module/components/map/basemap.js +265 -0
  55. package/lib/module/components/map/basemap.js.map +1 -0
  56. package/lib/module/components/map/index.js +850 -0
  57. package/lib/module/components/map/index.js.map +1 -0
  58. package/lib/module/components/map/maplibre.js +87 -0
  59. package/lib/module/components/map/maplibre.js.map +1 -0
  60. package/lib/module/components/marker/index.js +3 -3
  61. package/lib/module/components/marker/index.js.map +1 -1
  62. package/lib/module/components/message/index.js +15 -14
  63. package/lib/module/components/message/index.js.map +1 -1
  64. package/lib/module/components/message-scroller/index.js +5 -4
  65. package/lib/module/components/message-scroller/index.js.map +1 -1
  66. package/lib/module/components/otp-input/index.js +2 -2
  67. package/lib/module/components/popover/index.js +39 -7
  68. package/lib/module/components/popover/index.js.map +1 -1
  69. package/lib/module/components/progress/index.js +8 -2
  70. package/lib/module/components/progress/index.js.map +1 -1
  71. package/lib/module/components/radio-group/index.js +2 -2
  72. package/lib/module/components/radio-group/index.js.map +1 -1
  73. package/lib/module/components/ring-chart/index.js +423 -0
  74. package/lib/module/components/ring-chart/index.js.map +1 -0
  75. package/lib/module/components/section-rail/index.js +6 -6
  76. package/lib/module/components/section-rail/index.js.map +1 -1
  77. package/lib/module/components/select/index.js +10 -4
  78. package/lib/module/components/select/index.js.map +1 -1
  79. package/lib/module/components/separator/index.js +76 -22
  80. package/lib/module/components/separator/index.js.map +1 -1
  81. package/lib/module/components/shimmer/index.js +10 -1
  82. package/lib/module/components/shimmer/index.js.map +1 -1
  83. package/lib/module/components/slider/index.js +19 -5
  84. package/lib/module/components/slider/index.js.map +1 -1
  85. package/lib/module/components/steps/index.js +5 -5
  86. package/lib/module/components/steps/index.js.map +1 -1
  87. package/lib/module/components/switch/index.js +6 -1
  88. package/lib/module/components/switch/index.js.map +1 -1
  89. package/lib/module/components/tabs/index.js +7 -7
  90. package/lib/module/components/tabs/index.js.map +1 -1
  91. package/lib/module/components/timeline/index.js +4 -4
  92. package/lib/module/components/timeline/index.js.map +1 -1
  93. package/lib/module/components/toast/index.js +2 -2
  94. package/lib/module/components/toast/index.js.map +1 -1
  95. package/lib/module/components/toggle-button/index.js +5 -5
  96. package/lib/module/components/toggle-button/index.js.map +1 -1
  97. package/lib/module/components/tooltip/index.js +492 -0
  98. package/lib/module/components/tooltip/index.js.map +1 -0
  99. package/lib/module/components/typography/index.js +7 -2
  100. package/lib/module/components/typography/index.js.map +1 -1
  101. package/lib/module/hooks/index.js +1 -0
  102. package/lib/module/hooks/index.js.map +1 -1
  103. package/lib/module/hooks/use-back-handler.js +37 -0
  104. package/lib/module/hooks/use-back-handler.js.map +1 -0
  105. package/lib/module/hooks/use-direction.js +43 -0
  106. package/lib/module/hooks/use-direction.js.map +1 -0
  107. package/lib/module/icons/index.js +180 -2
  108. package/lib/module/icons/index.js.map +1 -1
  109. package/lib/module/index.js +12 -2
  110. package/lib/module/index.js.map +1 -1
  111. package/lib/module/primitives/keyboard-avoider.js +2 -1
  112. package/lib/module/primitives/keyboard-avoider.js.map +1 -1
  113. package/lib/module/primitives/text.js +55 -11
  114. package/lib/module/primitives/text.js.map +1 -1
  115. package/lib/module/utils/chart.js +279 -0
  116. package/lib/module/utils/chart.js.map +1 -0
  117. package/lib/module/utils/date.js +386 -0
  118. package/lib/module/utils/date.js.map +1 -0
  119. package/lib/typescript/src/components/accordion/index.d.ts.map +1 -1
  120. package/lib/typescript/src/components/alert/index.d.ts.map +1 -1
  121. package/lib/typescript/src/components/area-chart/index.d.ts +237 -0
  122. package/lib/typescript/src/components/area-chart/index.d.ts.map +1 -0
  123. package/lib/typescript/src/components/attachment/index.d.ts.map +1 -1
  124. package/lib/typescript/src/components/bar-chart/index.d.ts +270 -0
  125. package/lib/typescript/src/components/bar-chart/index.d.ts.map +1 -0
  126. package/lib/typescript/src/components/bottom-sheet/index.d.ts +75 -4
  127. package/lib/typescript/src/components/bottom-sheet/index.d.ts.map +1 -1
  128. package/lib/typescript/src/components/breadcrumb/index.d.ts +100 -0
  129. package/lib/typescript/src/components/breadcrumb/index.d.ts.map +1 -0
  130. package/lib/typescript/src/components/button/index.d.ts.map +1 -1
  131. package/lib/typescript/src/components/calendar/index.d.ts +108 -0
  132. package/lib/typescript/src/components/calendar/index.d.ts.map +1 -0
  133. package/lib/typescript/src/components/carousel/index.d.ts +179 -0
  134. package/lib/typescript/src/components/carousel/index.d.ts.map +1 -0
  135. package/lib/typescript/src/components/chip/index.d.ts.map +1 -1
  136. package/lib/typescript/src/components/date-picker/index.d.ts +91 -0
  137. package/lib/typescript/src/components/date-picker/index.d.ts.map +1 -0
  138. package/lib/typescript/src/components/dialog/index.d.ts.map +1 -1
  139. package/lib/typescript/src/components/direction/index.d.ts +11 -10
  140. package/lib/typescript/src/components/direction/index.d.ts.map +1 -1
  141. package/lib/typescript/src/components/empty-state/index.d.ts.map +1 -1
  142. package/lib/typescript/src/components/field/index.d.ts.map +1 -1
  143. package/lib/typescript/src/components/frame/index.d.ts +17 -0
  144. package/lib/typescript/src/components/frame/index.d.ts.map +1 -1
  145. package/lib/typescript/src/components/heatmap-chart/index.d.ts +22 -3
  146. package/lib/typescript/src/components/heatmap-chart/index.d.ts.map +1 -1
  147. package/lib/typescript/src/components/input-group/index.d.ts.map +1 -1
  148. package/lib/typescript/src/components/item/index.d.ts.map +1 -1
  149. package/lib/typescript/src/components/label/index.d.ts.map +1 -1
  150. package/lib/typescript/src/components/line-chart/index.d.ts +42 -2
  151. package/lib/typescript/src/components/line-chart/index.d.ts.map +1 -1
  152. package/lib/typescript/src/components/loader/index.d.ts +38 -0
  153. package/lib/typescript/src/components/loader/index.d.ts.map +1 -0
  154. package/lib/typescript/src/components/map/basemap.d.ts +76 -0
  155. package/lib/typescript/src/components/map/basemap.d.ts.map +1 -0
  156. package/lib/typescript/src/components/map/index.d.ts +367 -0
  157. package/lib/typescript/src/components/map/index.d.ts.map +1 -0
  158. package/lib/typescript/src/components/map/maplibre.d.ts +193 -0
  159. package/lib/typescript/src/components/map/maplibre.d.ts.map +1 -0
  160. package/lib/typescript/src/components/marker/index.d.ts.map +1 -1
  161. package/lib/typescript/src/components/message/index.d.ts.map +1 -1
  162. package/lib/typescript/src/components/message-scroller/index.d.ts.map +1 -1
  163. package/lib/typescript/src/components/popover/index.d.ts.map +1 -1
  164. package/lib/typescript/src/components/progress/index.d.ts.map +1 -1
  165. package/lib/typescript/src/components/ring-chart/index.d.ts +156 -0
  166. package/lib/typescript/src/components/ring-chart/index.d.ts.map +1 -0
  167. package/lib/typescript/src/components/select/index.d.ts.map +1 -1
  168. package/lib/typescript/src/components/separator/index.d.ts +36 -1
  169. package/lib/typescript/src/components/separator/index.d.ts.map +1 -1
  170. package/lib/typescript/src/components/shimmer/index.d.ts.map +1 -1
  171. package/lib/typescript/src/components/slider/index.d.ts.map +1 -1
  172. package/lib/typescript/src/components/steps/index.d.ts.map +1 -1
  173. package/lib/typescript/src/components/switch/index.d.ts.map +1 -1
  174. package/lib/typescript/src/components/tabs/index.d.ts.map +1 -1
  175. package/lib/typescript/src/components/timeline/index.d.ts.map +1 -1
  176. package/lib/typescript/src/components/toast/index.d.ts.map +1 -1
  177. package/lib/typescript/src/components/toggle-button/index.d.ts.map +1 -1
  178. package/lib/typescript/src/components/tooltip/index.d.ts +125 -0
  179. package/lib/typescript/src/components/tooltip/index.d.ts.map +1 -0
  180. package/lib/typescript/src/components/typography/index.d.ts +6 -0
  181. package/lib/typescript/src/components/typography/index.d.ts.map +1 -1
  182. package/lib/typescript/src/hooks/index.d.ts +1 -0
  183. package/lib/typescript/src/hooks/index.d.ts.map +1 -1
  184. package/lib/typescript/src/hooks/use-back-handler.d.ts +19 -0
  185. package/lib/typescript/src/hooks/use-back-handler.d.ts.map +1 -0
  186. package/lib/typescript/src/hooks/use-direction.d.ts +20 -0
  187. package/lib/typescript/src/hooks/use-direction.d.ts.map +1 -0
  188. package/lib/typescript/src/icons/index.d.ts +8 -0
  189. package/lib/typescript/src/icons/index.d.ts.map +1 -1
  190. package/lib/typescript/src/index.d.ts +14 -4
  191. package/lib/typescript/src/index.d.ts.map +1 -1
  192. package/lib/typescript/src/primitives/keyboard-avoider.d.ts.map +1 -1
  193. package/lib/typescript/src/primitives/text.d.ts +20 -0
  194. package/lib/typescript/src/primitives/text.d.ts.map +1 -1
  195. package/lib/typescript/src/utils/chart.d.ts +96 -0
  196. package/lib/typescript/src/utils/chart.d.ts.map +1 -0
  197. package/lib/typescript/src/utils/date.d.ts +116 -0
  198. package/lib/typescript/src/utils/date.d.ts.map +1 -0
  199. package/package.json +9 -1
  200. package/src/components/accordion/index.tsx +8 -12
  201. package/src/components/alert/index.tsx +2 -2
  202. package/src/components/area-chart/index.tsx +1147 -0
  203. package/src/components/attachment/index.tsx +2 -2
  204. package/src/components/avatar/index.tsx +4 -4
  205. package/src/components/badge/index.tsx +6 -6
  206. package/src/components/bar-chart/index.tsx +1208 -0
  207. package/src/components/bottom-sheet/index.tsx +282 -21
  208. package/src/components/breadcrumb/index.tsx +363 -0
  209. package/src/components/button/index.tsx +12 -8
  210. package/src/components/calendar/index.tsx +703 -0
  211. package/src/components/carousel/index.tsx +788 -0
  212. package/src/components/chip/index.tsx +6 -8
  213. package/src/components/date-picker/index.tsx +237 -0
  214. package/src/components/dialog/index.tsx +7 -2
  215. package/src/components/direction/index.tsx +22 -22
  216. package/src/components/empty-state/index.tsx +2 -2
  217. package/src/components/field/index.tsx +3 -5
  218. package/src/components/flow/index.tsx +3 -3
  219. package/src/components/frame/index.tsx +22 -7
  220. package/src/components/heatmap-chart/index.tsx +58 -11
  221. package/src/components/input-group/index.tsx +5 -4
  222. package/src/components/item/index.tsx +9 -9
  223. package/src/components/label/index.tsx +2 -2
  224. package/src/components/line-chart/index.tsx +194 -223
  225. package/src/components/loader/index.tsx +812 -0
  226. package/src/components/map/basemap.ts +304 -0
  227. package/src/components/map/index.tsx +1116 -0
  228. package/src/components/map/maplibre.ts +201 -0
  229. package/src/components/marker/index.tsx +3 -3
  230. package/src/components/message/index.tsx +15 -14
  231. package/src/components/message-scroller/index.tsx +5 -4
  232. package/src/components/otp-input/index.tsx +2 -2
  233. package/src/components/popover/index.tsx +43 -7
  234. package/src/components/progress/index.tsx +10 -2
  235. package/src/components/radio-group/index.tsx +2 -2
  236. package/src/components/ring-chart/index.tsx +543 -0
  237. package/src/components/section-rail/index.tsx +6 -6
  238. package/src/components/select/index.tsx +10 -4
  239. package/src/components/separator/index.tsx +77 -19
  240. package/src/components/shimmer/index.tsx +10 -1
  241. package/src/components/slider/index.tsx +20 -5
  242. package/src/components/steps/index.tsx +5 -5
  243. package/src/components/switch/index.tsx +6 -1
  244. package/src/components/tabs/index.tsx +7 -9
  245. package/src/components/timeline/index.tsx +4 -4
  246. package/src/components/toast/index.tsx +2 -2
  247. package/src/components/toggle-button/index.tsx +5 -7
  248. package/src/components/tooltip/index.tsx +610 -0
  249. package/src/components/typography/index.tsx +7 -2
  250. package/src/hooks/index.ts +1 -0
  251. package/src/hooks/use-back-handler.ts +37 -0
  252. package/src/hooks/use-direction.ts +45 -0
  253. package/src/icons/index.tsx +111 -0
  254. package/src/index.ts +129 -0
  255. package/src/primitives/keyboard-avoider.tsx +2 -1
  256. package/src/primitives/text.tsx +53 -8
  257. package/src/utils/chart.ts +355 -0
  258. package/src/utils/date.ts +446 -0
@@ -0,0 +1,201 @@
1
+ /**
2
+ * The bridge to MapLibre.
3
+ *
4
+ * A map is the one component here that cannot be drawn in JavaScript. It needs
5
+ * a renderer with the tiles, the projection and the GPU work already solved,
6
+ * and that renderer is native code — which means `Map` is the only component
7
+ * in the library with a dependency you have to build for.
8
+ *
9
+ * Two things follow, and both are handled here rather than spread through the
10
+ * component:
11
+ *
12
+ * The package is resolved lazily and once. A project that never renders a map
13
+ * installs nothing, and the failure when it is missing is a readable fallback
14
+ * rather than a red screen — which matters because the most common way to hit
15
+ * it is running in a client that cannot load native modules at all.
16
+ *
17
+ * The types are declared here rather than imported from the package. They are
18
+ * structural and cover only what is used. Importing them would put the package
19
+ * in the library's published type surface, so anyone installing PanelUI would
20
+ * have to install a map renderer to typecheck their project, whether or not
21
+ * they ever draw a map.
22
+ *
23
+ * The cost of that choice is that nothing checks these declarations against the
24
+ * renderer, and React Native drops props it does not recognise without a word —
25
+ * so a renamed prop is silently ignored rather than caught. They track the
26
+ * renderer's **v11** API. When the peer range widens, re-read the props used
27
+ * below against the package rather than assuming they survived.
28
+ */
29
+ import type { ComponentType, ReactElement, ReactNode, Ref } from 'react';
30
+
31
+ /** `[longitude, latitude]` — the order the style spec uses, not the spoken one. */
32
+ export type LngLat = [number, number];
33
+
34
+ /** `[west, south, east, north]`. */
35
+ export type LngLatBounds = [number, number, number, number];
36
+
37
+ /**
38
+ * A MapLibre style document. Left loose on purpose: the spec is large, it is
39
+ * versioned separately from this library, and the parts of it callers pass
40
+ * through are exactly the parts a narrower type would get in the way of.
41
+ */
42
+ export type StyleSpecification = Record<string, unknown>;
43
+
44
+ /** Where the map is looking. */
45
+ export interface ViewState {
46
+ center: LngLat;
47
+ zoom: number;
48
+ bearing: number;
49
+ pitch: number;
50
+ bounds: LngLatBounds;
51
+ }
52
+
53
+ export interface MapRef {
54
+ getCenter(): Promise<LngLat>;
55
+ getZoom(): Promise<number>;
56
+ getBearing(): Promise<number>;
57
+ getPitch(): Promise<number>;
58
+ getBounds(): Promise<LngLatBounds>;
59
+ getViewState(): Promise<ViewState>;
60
+ }
61
+
62
+ /** Pixel insets held off the edges of the viewport. */
63
+ export interface ViewPadding {
64
+ top?: number;
65
+ right?: number;
66
+ bottom?: number;
67
+ left?: number;
68
+ }
69
+
70
+ /** Zoom, tilt and rotation — everything about the camera except where it sits. */
71
+ export interface CameraOptions {
72
+ zoom?: number;
73
+ bearing?: number;
74
+ pitch?: number;
75
+ padding?: ViewPadding;
76
+ }
77
+
78
+ /** How the camera gets there. */
79
+ export interface CameraAnimationOptions {
80
+ duration?: number;
81
+ easing?: 'linear' | 'ease' | 'fly';
82
+ }
83
+
84
+ /**
85
+ * Where the camera starts. Either a centre or a box, never both — the renderer
86
+ * types them as a union for the same reason: a camera framing a box has no
87
+ * separate centre to honour.
88
+ */
89
+ export type InitialViewState =
90
+ | (CameraOptions & { center?: never; bounds?: never })
91
+ | (CameraOptions & { center: LngLat; bounds?: never })
92
+ | (CameraOptions & { bounds: LngLatBounds; center?: never });
93
+
94
+ export interface CameraRef {
95
+ jumpTo(options: { center: LngLat } & CameraOptions): void;
96
+ easeTo(options: { center?: LngLat } & CameraOptions & CameraAnimationOptions): void;
97
+ flyTo(options: { center?: LngLat } & CameraOptions & CameraAnimationOptions): void;
98
+ fitBounds(
99
+ bounds: LngLatBounds,
100
+ options?: CameraOptions & CameraAnimationOptions
101
+ ): void;
102
+ }
103
+
104
+ /** A native event as it arrives — the payload is under `nativeEvent`. */
105
+ export interface NativeEvent<T> {
106
+ nativeEvent: T;
107
+ }
108
+
109
+ interface MapLibreModule {
110
+ Map: ComponentType<{
111
+ ref?: Ref<MapRef>;
112
+ mapStyle: string | StyleSpecification;
113
+ style?: unknown;
114
+ logo?: boolean;
115
+ compass?: boolean;
116
+ attribution?: boolean;
117
+ scaleBar?: boolean;
118
+ dragPan?: boolean;
119
+ touchZoom?: boolean;
120
+ touchRotate?: boolean;
121
+ touchPitch?: boolean;
122
+ onPress?: (event: NativeEvent<{ coordinates: LngLat }>) => void;
123
+ onDidFinishLoadingMap?: () => void;
124
+ onRegionDidChange?: (event: NativeEvent<ViewState>) => void;
125
+ children?: ReactNode;
126
+ }>;
127
+ Camera: ComponentType<{
128
+ ref?: Ref<CameraRef>;
129
+ /**
130
+ * The camera's opening position. Applied once, on the first frame — every
131
+ * move after this one goes through the ref, so a re-render never yanks the
132
+ * map back out from under a gesture.
133
+ */
134
+ initialViewState?: InitialViewState;
135
+ center?: LngLat;
136
+ bounds?: LngLatBounds;
137
+ zoom?: number;
138
+ bearing?: number;
139
+ pitch?: number;
140
+ minZoom?: number;
141
+ maxZoom?: number;
142
+ maxBounds?: LngLatBounds;
143
+ padding?: ViewPadding;
144
+ }>;
145
+ Marker: ComponentType<{
146
+ id?: string;
147
+ lngLat: LngLat;
148
+ anchor?: string;
149
+ children: ReactElement;
150
+ }>;
151
+ Callout: ComponentType<{ title?: string; children?: ReactNode; style?: unknown }>;
152
+ GeoJSONSource: ComponentType<{
153
+ id?: string;
154
+ data: unknown;
155
+ cluster?: boolean;
156
+ clusterRadius?: number;
157
+ clusterMaxZoom?: number;
158
+ lineMetrics?: boolean;
159
+ onPress?: (event: NativeEvent<{ features: unknown[] }>) => void;
160
+ children?: ReactNode;
161
+ }>;
162
+ Layer: ComponentType<Record<string, unknown>>;
163
+ UserLocation: ComponentType<{
164
+ animated?: boolean;
165
+ accuracy?: boolean;
166
+ heading?: boolean;
167
+ minDisplacement?: number;
168
+ onPress?: () => void;
169
+ children?: ReactNode;
170
+ }>;
171
+ }
172
+
173
+ /**
174
+ * The renderer, or null when it is not installed. Resolved once at module
175
+ * load — the require is cheap, and caching it keeps a try/catch out of render.
176
+ */
177
+ const maplibre: MapLibreModule | null = (() => {
178
+ try {
179
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
180
+ return require('@maplibre/maplibre-react-native') as MapLibreModule;
181
+ } catch {
182
+ return null;
183
+ }
184
+ })();
185
+
186
+ /**
187
+ * True when a map can actually be drawn.
188
+ *
189
+ * False in any client that cannot load native modules, and in any project that
190
+ * has not installed the renderer. Worth checking before routing somewhere whose
191
+ * whole content is a map.
192
+ */
193
+ export const hasMapLibre = maplibre !== null;
194
+
195
+ /**
196
+ * The renderer's components, or null.
197
+ *
198
+ * Returned as one object rather than as separate exports so a caller destructures
199
+ * once after a single null check, instead of narrowing each component in turn.
200
+ */
201
+ export const MapLibre = maplibre;
@@ -25,7 +25,7 @@ import { tv, type VariantProps } from 'tailwind-variants';
25
25
  import { useCSSVariable } from 'uniwind';
26
26
  import { IconColorProvider } from '../../icons';
27
27
  import { AnimatedPressable, type AnimatedPressableProps } from '../../primitives/animated-pressable';
28
- import { Text, type TextProps } from '../../primitives/text';
28
+ import { Text, type TextProps, textChildren } from '../../primitives/text';
29
29
  import { cn } from '../../utils/cn';
30
30
  import { Separator } from '../separator';
31
31
  import { Shimmer } from '../shimmer';
@@ -90,7 +90,7 @@ const MarkerRoot = forwardRef<View, MarkerProps>(
90
90
  variant === 'separator' ? (
91
91
  <>
92
92
  <Separator className="flex-1" />
93
- {children}
93
+ {textChildren(children)}
94
94
  <Separator className="flex-1" />
95
95
  </>
96
96
  ) : (
@@ -149,7 +149,7 @@ const MarkerIcon = forwardRef<View, MarkerIconProps>(
149
149
  {...props}
150
150
  >
151
151
  <IconColorProvider color={typeof muted === 'string' ? muted : undefined}>
152
- {children}
152
+ {textChildren(children)}
153
153
  </IconColorProvider>
154
154
  </View>
155
155
  );
@@ -34,7 +34,7 @@ import { tv, type VariantProps } from 'tailwind-variants';
34
34
  import { useCSSVariable } from 'uniwind';
35
35
  import { IconColorProvider } from '../../icons';
36
36
  import { AnimatedPressable } from '../../primitives/animated-pressable';
37
- import { Text, type TextProps } from '../../primitives/text';
37
+ import { Text, type TextProps, textChildren } from '../../primitives/text';
38
38
  import { cn } from '../../utils/cn';
39
39
 
40
40
  const messageVariants = tv({
@@ -54,19 +54,20 @@ const messageVariants = tv({
54
54
  root: 'flex-row justify-start',
55
55
  content: 'items-start',
56
56
  // A squared corner on the side the message comes from points the
57
- // bubble back at its sender.
58
- bubble: 'rounded-bl-md bg-muted',
57
+ // bubble back at its sender. Logical, so "the side it comes from"
58
+ // stays true when the script runs the other way.
59
+ bubble: 'rounded-es-md bg-muted',
59
60
  bubbleContent: 'text-foreground',
60
- header: 'text-left',
61
- footer: 'text-left',
61
+ header: 'text-start',
62
+ footer: 'text-start',
62
63
  },
63
64
  end: {
64
65
  root: 'flex-row-reverse justify-start',
65
66
  content: 'items-end',
66
- bubble: 'rounded-br-md bg-primary',
67
+ bubble: 'rounded-ee-md bg-primary',
67
68
  bubbleContent: 'text-primary-foreground',
68
- header: 'text-right',
69
- footer: 'text-right',
69
+ header: 'text-end',
70
+ footer: 'text-end',
70
71
  },
71
72
  },
72
73
  },
@@ -136,11 +137,11 @@ const MessageRoot = forwardRef<View, MessageProps>(
136
137
  className={root({ className })}
137
138
  {...props}
138
139
  >
139
- {children}
140
+ {textChildren(children)}
140
141
  </AnimatedPressable>
141
142
  ) : (
142
143
  <View ref={ref} className={root({ className })} {...props}>
143
- {children}
144
+ {textChildren(children)}
144
145
  </View>
145
146
  );
146
147
 
@@ -206,7 +207,7 @@ const MessageAvatar = forwardRef<View, MessageAvatarProps>(
206
207
 
207
208
  return (
208
209
  <View ref={ref} className={avatar({ className })} {...props}>
209
- {stacked ? <View className="opacity-0">{children}</View> : children}
210
+ {stacked ? <View className="opacity-0">{textChildren(children)}</View> : children}
210
211
  </View>
211
212
  );
212
213
  }
@@ -226,7 +227,7 @@ const MessageContent = forwardRef<View, MessageContentProps>(
226
227
 
227
228
  return (
228
229
  <View ref={ref} className={content({ className })} {...props}>
229
- {children}
230
+ {textChildren(children)}
230
231
  </View>
231
232
  );
232
233
  }
@@ -274,7 +275,7 @@ const MessageBubble = forwardRef<View, MessageBubbleProps>(
274
275
  return (
275
276
  <View ref={ref} className={bubble({ className })} {...props}>
276
277
  <IconColorProvider color={typeof foreground === 'string' ? foreground : undefined}>
277
- {children}
278
+ {textChildren(children)}
278
279
  </IconColorProvider>
279
280
  </View>
280
281
  );
@@ -333,7 +334,7 @@ const MessageActions = forwardRef<View, MessageActionsProps>(
333
334
  )}
334
335
  {...props}
335
336
  >
336
- {children}
337
+ {textChildren(children)}
337
338
  </View>
338
339
  );
339
340
  }
@@ -56,6 +56,7 @@ import { useCSSVariable } from 'uniwind';
56
56
  import { ChevronDownIcon } from '../../icons';
57
57
  import { AnimatedPressable } from '../../primitives/animated-pressable';
58
58
  import { cn } from '../../utils/cn';
59
+ import { textChildren } from '../../primitives/text';
59
60
 
60
61
  /** Within this many pixels of the bottom still counts as being at the bottom. */
61
62
  const END_THRESHOLD = 24;
@@ -233,7 +234,7 @@ function MessageScrollerRoot({
233
234
  return (
234
235
  <MessageScrollerContext.Provider value={context}>
235
236
  <View className={cn('relative overflow-hidden', className)} {...props}>
236
- {children}
237
+ {textChildren(children)}
237
238
  </View>
238
239
  </MessageScrollerContext.Provider>
239
240
  );
@@ -404,7 +405,7 @@ function MessageScrollerViewport({
404
405
  onMomentumScrollEnd={settleAnchor}
405
406
  onContentSizeChange={onContentSizeChange}
406
407
  >
407
- {children}
408
+ {textChildren(children)}
408
409
  </Animated.ScrollView>
409
410
  );
410
411
  }
@@ -445,7 +446,7 @@ function MessageScrollerContent({
445
446
  className={cn('gap-3 p-4 pb-16', className)}
446
447
  {...props}
447
448
  >
448
- {children}
449
+ {textChildren(children)}
449
450
  </View>
450
451
  );
451
452
  }
@@ -487,7 +488,7 @@ function MessageScrollerItem({
487
488
 
488
489
  return (
489
490
  <View className={className} {...props} onLayout={onLayout}>
490
- {children}
491
+ {textChildren(children)}
491
492
  </View>
492
493
  );
493
494
  }
@@ -323,7 +323,7 @@ export const OtpInput = forwardRef<TextInput, OtpInputProps>(
323
323
  placeholder={placeholder}
324
324
  invalid={invalid}
325
325
  className={slots.cell({
326
- className: `${i > 0 ? 'ml-2' : ''} ${cellClassName ?? ''}`,
326
+ className: `${i > 0 ? 'ms-2' : ''} ${cellClassName ?? ''}`,
327
327
  })}
328
328
  charClassName={slots.char()}
329
329
  caretClassName={slots.caret()}
@@ -331,7 +331,7 @@ export const OtpInput = forwardRef<TextInput, OtpInputProps>(
331
331
  {groupEvery > 0 &&
332
332
  (i + 1) % groupEvery === 0 &&
333
333
  i < length - 1 ? (
334
- <View className={`${slots.separator()} ml-2`} />
334
+ <View className={`${slots.separator()} ms-2`} />
335
335
  ) : null}
336
336
  </View>
337
337
  ))}
@@ -60,8 +60,9 @@ import Animated, {
60
60
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
61
61
  import { Portal } from '../../primitives/portal';
62
62
  import { Scrim } from '../../primitives/scrim';
63
+ import { useBackHandler } from '../../hooks/use-back-handler';
63
64
  import { BottomSheet } from '../bottom-sheet';
64
- import { Text, type TextProps } from '../../primitives/text';
65
+ import { Text, type TextProps, textChildren } from '../../primitives/text';
65
66
  import { cn } from '../../utils/cn';
66
67
 
67
68
  /** Gap between the trigger and the panel. */
@@ -255,6 +256,13 @@ function PopoverContent({
255
256
  }: PopoverContentProps) {
256
257
  const context = usePopover('Popover.Content');
257
258
  const { open, setOpen, trigger, setPlacement, setArrowOffset, presentation } = context;
259
+
260
+ // The anchored panel owns the Android back button while it is up. The sheet
261
+ // presentation is left alone — BottomSheet installs its own handler.
262
+ useBackHandler(open && dismissible && presentation !== 'bottom-sheet', () =>
263
+ setOpen(false)
264
+ );
265
+
258
266
  const { width: screenWidth, height: screenHeight } = useWindowDimensions();
259
267
  const insets = useSafeAreaInsets();
260
268
  const [size, setSize] = useState<{ width: number; height: number } | null>(null);
@@ -349,14 +357,42 @@ function PopoverContent({
349
357
  ],
350
358
  }));
351
359
 
352
- // The sheet presentation hands off entirely to BottomSheet — it owns its own
353
- // portal, backdrop and dismiss gesture, so there is nothing to anchor here.
354
- // The context is re-provided inside so Popover.Close keeps closing it.
360
+ /*
361
+ * The sheet presentation hands off entirely to BottomSheet — it owns its own
362
+ * portal, backdrop and dismiss gesture, so there is nothing to anchor here.
363
+ * The context is re-provided inside so Popover.Close keeps closing it.
364
+ *
365
+ * `width` still means something, though. A sheet is the full width of the
366
+ * screen and lays its children out in a column, so a panel sized to its
367
+ * content takes the cross-axis *start* and ends up flush against one edge —
368
+ * the right-hand one under RTL, directly below the close button. Centring it
369
+ * is what makes `width="content-fit"` mean the same thing in both
370
+ * presentations.
371
+ *
372
+ * The className goes on an inner view rather than on the sheet: passed to
373
+ * the surface it is merged into the sheet's own padding classes and replaces
374
+ * them, so a panel asking for `p-3` silently strips the sheet's `px-5 pt-2`.
375
+ */
355
376
  if (presentation === 'bottom-sheet') {
356
377
  return (
357
378
  <BottomSheet open={open} onOpenChange={setOpen}>
358
- <BottomSheet.Content dismissible={dismissible} className={className}>
359
- <PopoverContext.Provider value={context}>{children}</PopoverContext.Provider>
379
+ <BottomSheet.Content dismissible={dismissible}>
380
+ <PopoverContext.Provider value={context}>
381
+ <View
382
+ className={cn(width === 'content-fit' && 'self-center', className)}
383
+ style={[
384
+ width === 'full' || width === 'trigger' ? { width: '100%' } : null,
385
+ typeof width === 'number' ? { width } : null,
386
+ minWidth === undefined ? null : { minWidth },
387
+ // Clear of the close button, which floats over the top-end
388
+ // corner of the sheet rather than sitting in the flow.
389
+ { paddingTop: 8 },
390
+ style,
391
+ ]}
392
+ >
393
+ {textChildren(children)}
394
+ </View>
395
+ </PopoverContext.Provider>
360
396
  </BottomSheet.Content>
361
397
  </BottomSheet>
362
398
  );
@@ -410,7 +446,7 @@ function PopoverContent({
410
446
  )}
411
447
  {...props}
412
448
  >
413
- {children}
449
+ {textChildren(children)}
414
450
  </Animated.View>
415
451
  </Animated.View>
416
452
  </View>
@@ -11,6 +11,7 @@ import Animated, {
11
11
  withTiming,
12
12
  } from 'react-native-reanimated';
13
13
  import { tv, type VariantProps } from 'tailwind-variants';
14
+ import { useDirectionSign } from '../../hooks/use-direction';
14
15
  import { Text } from '../../primitives/text';
15
16
  import { cn } from '../../utils/cn';
16
17
 
@@ -135,6 +136,9 @@ export const Progress = forwardRef<View, ProgressProps>(
135
136
  ) => {
136
137
  const slots = progressVariants({ color, size });
137
138
  const trackWidth = useSharedValue(0);
139
+ // Yoga mirrors the track; the bar sliding along it is a transform, so it
140
+ // has to be turned around itself.
141
+ const sign = useDirectionSign();
138
142
  const progress = useSharedValue(clamp(value) / 100);
139
143
  const slide = useSharedValue(0);
140
144
 
@@ -167,10 +171,14 @@ export const Progress = forwardRef<View, ProgressProps>(
167
171
  width: barWidth,
168
172
  transform: [
169
173
  {
174
+ // The loop travels the way the text does. Yoga mirrors the track
175
+ // but not the transform sliding along it.
170
176
  translateX: interpolate(
171
177
  slide.value,
172
178
  [0, 1],
173
- [-barWidth, trackWidth.value]
179
+ sign === 1
180
+ ? [-barWidth, trackWidth.value]
181
+ : [trackWidth.value, -barWidth]
174
182
  ),
175
183
  },
176
184
  ],
@@ -213,7 +221,7 @@ export const Progress = forwardRef<View, ProgressProps>(
213
221
  <View />
214
222
  )}
215
223
  {showValue ? (
216
- <Text size="sm" muted className={cn(label == null && 'ml-auto')}>
224
+ <Text size="sm" muted className={cn(label == null && 'ms-auto')}>
217
225
  {formatValue(clamp(value), valueLabel, formatOptions)}
218
226
  </Text>
219
227
  ) : null}
@@ -35,7 +35,7 @@ import Animated, {
35
35
  } from 'react-native-reanimated';
36
36
  import { tv, type VariantProps } from 'tailwind-variants';
37
37
  import { cn } from '../../utils/cn';
38
- import { Text } from '../../primitives/text';
38
+ import { Text, textChildren } from '../../primitives/text';
39
39
 
40
40
  type RadioVariant = 'dot' | 'card';
41
41
  type RadioOrientation = 'vertical' | 'horizontal';
@@ -152,7 +152,7 @@ const RadioGroupRoot = forwardRef<View, RadioGroupProps>(
152
152
  )}
153
153
  {...props}
154
154
  >
155
- {children}
155
+ {textChildren(children)}
156
156
  </View>
157
157
  </RadioGroupContext.Provider>
158
158
  );