@yarrow-uz/yarrow-map-web-sdk 1.0.41 → 1.0.43

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.
package/README.md CHANGED
@@ -6,12 +6,13 @@ This document provides a comprehensive guide to using the Yarrow Map Web SDK for
6
6
 
7
7
  - [Getting Started](#getting-started)
8
8
  - [Installation](#installation)
9
- - [React Usage](#react-usage)
10
9
  - [Initialization](#initialization)
11
10
  - [Configuration Options](#configuration-options)
11
+ - [React Usage](#react-usage)
12
12
  - [Basic Map Manipulation](#basic-map-manipulation)
13
13
  - [Changing the Map Style](#changing-the-map-style)
14
14
  - [Changing the Map Theme](#changing-the-map-theme)
15
+ - [Changing Brand Badge Position](#changing-brand-badge-position)
15
16
  - [Moving the Map View](#moving-the-map-view)
16
17
  - [Changing Background Color](#changing-background-color)
17
18
  - [Handling Events](#handling-events)
@@ -52,53 +53,6 @@ First, add the Yarrow Map Web SDK to your project using your preferred package m
52
53
  npm install @yarrow-uz/yarrow-map-web-sdk
53
54
  ```
54
55
 
55
- ### React Usage
56
-
57
- React APIs are exported from the `@yarrow-uz/yarrow-map-web-sdk/react` subpath.
58
-
59
- ```tsx
60
- import { YarrowMapView } from '@yarrow-uz/yarrow-map-web-sdk/react';
61
-
62
- export const MapScreen = () => {
63
- return (
64
- <YarrowMapView
65
- config={{
66
- center: [69.2401, 41.2995],
67
- zoom: 12,
68
- brandBadgePosition: 'bottom-left',
69
- }}
70
- style={{ width: '100%', height: '600px' }}
71
- />
72
- );
73
- };
74
- ```
75
-
76
- You can also use the hook for custom composition:
77
-
78
- ```tsx
79
- import { useYarrowMap } from '@yarrow-uz/yarrow-map-web-sdk/react';
80
-
81
- export const MapScreen = () => {
82
- const { containerRef, isReady, error } = useYarrowMap({
83
- config: {
84
- center: [69.2401, 41.2995],
85
- zoom: 12,
86
- brandBadgePosition: 'bottom-right',
87
- },
88
- });
89
-
90
- return (
91
- <div>
92
- <div ref={containerRef} style={{ width: '100%', height: '600px' }} />
93
- {isReady && <p>Map ready</p>}
94
- {error && <p>Failed to initialize map</p>}
95
- </div>
96
- );
97
- };
98
- ```
99
-
100
- **SSR note:** The React integration initializes the map only on the client side.
101
-
102
56
  ### Initialization
103
57
 
104
58
  To get started, you need to create an instance of `YarrowMap`. This requires a configuration object that specifies the container element, center coordinates, and zoom level.
@@ -140,7 +94,7 @@ const mapConfig = new YarrowMapConfig({
140
94
  theme, // 'light' | 'dark' (default: 'light')
141
95
  cache, // { enabled?: boolean, lifespanDays?: number }
142
96
  brandBadgePosition, // 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
143
- controls // { enabled?: boolean, position?: 'left'|'right', zoom?: boolean, compass?: boolean }
97
+ controls // { enabled?: boolean, position?: 'left'|'left-top'|'left-bottom'|'right'|'right-top'|'right-bottom', zoom?: boolean, compass?: boolean }
144
98
  });
145
99
  ```
146
100
 
@@ -163,7 +117,7 @@ const mapConfig = new YarrowMapConfig({
163
117
  brandBadgePosition: 'top-right',
164
118
  controls: {
165
119
  enabled: true, // Yarrow controls are OFF by default
166
- position: 'right', // Optional side of the map
120
+ position: 'right-bottom', // Optional placement: left/left-top/left-bottom/right/right-top/right-bottom
167
121
  zoom: true, // Optional
168
122
  compass: true // Optional
169
123
  },
@@ -175,6 +129,55 @@ yarrowMap.init().then(() => {
175
129
  });
176
130
  ```
177
131
 
132
+ When controls and the brand badge are placed in the same corner (for example `right-bottom` with `brandBadgePosition: 'bottom-right'`), the SDK automatically adds spacing so they do not overlap.
133
+
134
+ ### React Usage
135
+
136
+ React APIs are exported from the `@yarrow-uz/yarrow-map-web-sdk/react` subpath.
137
+
138
+ ```tsx
139
+ import { YarrowMapView } from '@yarrow-uz/yarrow-map-web-sdk/react';
140
+
141
+ export const MapScreen = () => {
142
+ return (
143
+ <YarrowMapView
144
+ config={{
145
+ center: [69.2401, 41.2995],
146
+ zoom: 12,
147
+ brandBadgePosition: 'bottom-left',
148
+ }}
149
+ style={{ width: '100%', height: '600px' }}
150
+ />
151
+ );
152
+ };
153
+ ```
154
+
155
+ You can also use the hook for custom composition:
156
+
157
+ ```tsx
158
+ import { useYarrowMap } from '@yarrow-uz/yarrow-map-web-sdk/react';
159
+
160
+ export const MapScreen = () => {
161
+ const { containerRef, isReady, error } = useYarrowMap({
162
+ config: {
163
+ center: [69.2401, 41.2995],
164
+ zoom: 12,
165
+ brandBadgePosition: 'bottom-right',
166
+ },
167
+ });
168
+
169
+ return (
170
+ <div>
171
+ <div ref={containerRef} style={{ width: '100%', height: '600px' }} />
172
+ {isReady && <p>Map ready</p>}
173
+ {error && <p>Failed to initialize map</p>}
174
+ </div>
175
+ );
176
+ };
177
+ ```
178
+
179
+ **SSR note:** The React integration initializes the map only on the client side.
180
+
178
181
  ## Basic Map Manipulation
179
182
 
180
183
  ### Changing the Map Style
@@ -228,6 +231,17 @@ await yarrowMap.changeTheme('light');
228
231
  - Preserves custom icons and markers
229
232
  - Seamless theme transition
230
233
 
234
+ ### Changing Brand Badge Position
235
+
236
+ You can set the initial badge position in config or change it dynamically after map initialization.
237
+
238
+ ```javascript
239
+ // Move badge to the top-right corner
240
+ yarrowMap.changeBrandBadgePosition('top-right');
241
+
242
+ // Other values: 'top-left' | 'bottom-left' | 'bottom-right'
243
+ ```
244
+
231
245
  ### Moving the Map View
232
246
 
233
247
  You can programmatically move the map to a new location or fit it to a specific geographic area.
@@ -928,7 +942,13 @@ constructor(
928
942
  brandBadgePosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
929
943
  controls?: {
930
944
  enabled?: boolean; // default: false
931
- position?: 'left' | 'right';
945
+ position?:
946
+ | 'left'
947
+ | 'left-top'
948
+ | 'left-bottom'
949
+ | 'right'
950
+ | 'right-top'
951
+ | 'right-bottom';
932
952
  zoom?: boolean; // default: true
933
953
  compass?: boolean; // default: true
934
954
  };
@@ -943,6 +963,7 @@ constructor(
943
963
  | `init()` | None | `Promise<void>` | Initialize the map with styles and icons |
944
964
  | `changeStyles(styleType?)` | `styleType?: 'satellite' \| 'hybrid'` | `Promise<any>` | Change map style |
945
965
  | `changeTheme(theme)` | `theme: 'light' \| 'dark'` | `Promise<any>` | Switch between light and dark themes |
966
+ | `changeBrandBadgePosition(position)` | `position: 'top-left' \| 'top-right' \| 'bottom-left' \| 'bottom-right'` | `BrandBadgePosition` | Change brand badge corner position at runtime |
946
967
  | `zoomTo(lat, lng, zoom)` | `lat: number, lng: number, zoom: number` | `void` | Fly to specific coordinates |
947
968
  | `fitBounds(data)` | `data: GeoJSON` | `void` | Fit map to show all features |
948
969
  | `getBoundingBox(data)` | `data: GeoJSON` | `BoundingBox` | Calculate bounding box of features |
@@ -1006,7 +1027,7 @@ interface SearchOptions {
1006
1027
 
1007
1028
  ## Version Information
1008
1029
 
1009
- - **Current Version**: 1.0.41
1030
+ - **Current Version**: 1.0.43
1010
1031
  - **Dependencies**: maplibre-gl ^5.5.0, axios ^1.7.9
1011
1032
  - **Repository**: https://git.yarrow.uz/yarrow-sdk/frontend/yarrow-map-web-sdk
1012
1033
  - **Changelog**: `CHANGELOG.md`