datastake-daf 0.6.294 β 0.6.296
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/dist/components/index.js +49 -479
- package/dist/utils/index.js +9 -0
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobe.jsx +40 -108
- package/src/@daf/core/components/Dashboard/Globe/SimpleGlobe.stories.js +0 -32
- package/src/@daf/core/components/Dashboard/Steps/Steps.stories.js +76 -2
- package/src/@daf/core/components/Dashboard/Steps/index.jsx +8 -5
- package/src/@daf/core/components/Dashboard/Steps/style.js +7 -0
- package/src/@daf/core/components/EditForm/storyConfig.js +1 -1
- package/src/@daf/core/components/EditForm/storyConfig2.js +12945 -114
- package/src/constants/locales/en/translation.js +3 -0
- package/src/constants/locales/fr/translation.js +3 -0
- package/src/constants/locales/sp/translation.js +3 -0
- package/src/index.js +0 -2
- package/dist/style/datastake/mapbox-gl.css +0 -330
- package/src/@daf/core/components/Dashboard/Globe/CSSInJSGlobe.jsx +0 -415
- package/src/@daf/core/components/Dashboard/Globe/IsolatedGlobe.jsx +0 -345
- package/src/@daf/core/components/Dashboard/Globe/NoConflictGlobe.jsx +0 -488
- package/src/styles/datastake/mapbox-gl.css +0 -330
|
@@ -1,415 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react';
|
|
2
|
-
import mapboxgl from 'mapbox-gl';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* CSSInJSGlobe - Mapbox component using CSS-in-JS for complete isolation
|
|
6
|
-
* No external CSS dependencies, all styles injected via JavaScript
|
|
7
|
-
*/
|
|
8
|
-
const CSSInJSGlobe = ({
|
|
9
|
-
projects = [],
|
|
10
|
-
mapConfig = {},
|
|
11
|
-
onProjectClick = () => {},
|
|
12
|
-
type = "default",
|
|
13
|
-
color = "#00809E"
|
|
14
|
-
}) => {
|
|
15
|
-
const mapContainer = useRef(null);
|
|
16
|
-
const map = useRef(null);
|
|
17
|
-
const boundsRef = useRef(null);
|
|
18
|
-
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
if (map.current) return;
|
|
21
|
-
|
|
22
|
-
console.log('πΊοΈ [CSS-IN-JS GLOBE] Creating map with CSS-in-JS...');
|
|
23
|
-
|
|
24
|
-
// Set Mapbox access token
|
|
25
|
-
mapboxgl.accessToken = 'pk.eyJ1IjoicmVkaXM5OTkiLCJhIjoiY2x4YWV5MzA5MmtuZzJpcXM5Y201Z2E2YiJ9.m5bwPg-Tj4Akesl1yQUa3w';
|
|
26
|
-
|
|
27
|
-
// Create map
|
|
28
|
-
map.current = new mapboxgl.Map({
|
|
29
|
-
container: mapContainer.current,
|
|
30
|
-
style: 'mapbox://styles/mapbox/satellite-v9',
|
|
31
|
-
center: [0, 0],
|
|
32
|
-
zoom: mapConfig.maxZoom || 3,
|
|
33
|
-
projection: 'globe',
|
|
34
|
-
attributionControl: false
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
// Add markers when map loads
|
|
38
|
-
map.current.on('load', () => {
|
|
39
|
-
console.log('πΊοΈ [CSS-IN-JS GLOBE] Map loaded, adding markers...');
|
|
40
|
-
|
|
41
|
-
// Inject isolated CSS via JavaScript
|
|
42
|
-
const styleId = 'css-in-js-globe-styles';
|
|
43
|
-
let existingStyle = document.getElementById(styleId);
|
|
44
|
-
if (!existingStyle) {
|
|
45
|
-
const style = document.createElement('style');
|
|
46
|
-
style.id = styleId;
|
|
47
|
-
style.textContent = `
|
|
48
|
-
/* CSS-in-JS Globe Styles - Completely Isolated */
|
|
49
|
-
.css-in-js-globe-container {
|
|
50
|
-
position: relative !important;
|
|
51
|
-
width: 100% !important;
|
|
52
|
-
height: 100% !important;
|
|
53
|
-
overflow: hidden !important;
|
|
54
|
-
font: 12px/20px Helvetica Neue, Arial, Helvetica, sans-serif !important;
|
|
55
|
-
-webkit-tap-highlight-color: rgb(0 0 0/0) !important;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.css-in-js-globe-container .mapboxgl-canvas-container {
|
|
59
|
-
position: relative !important;
|
|
60
|
-
left: 0 !important;
|
|
61
|
-
top: 0 !important;
|
|
62
|
-
transform: none !important;
|
|
63
|
-
width: 100% !important;
|
|
64
|
-
height: 100% !important;
|
|
65
|
-
overflow: hidden !important;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.css-in-js-globe-container .mapboxgl-canvas-container canvas {
|
|
69
|
-
position: absolute !important;
|
|
70
|
-
left: 0 !important;
|
|
71
|
-
top: 0 !important;
|
|
72
|
-
transform: none !important;
|
|
73
|
-
width: 100% !important;
|
|
74
|
-
height: 100% !important;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/* Override ALL Leaflet CSS that might interfere */
|
|
78
|
-
.css-in-js-globe-container .mapboxgl-marker {
|
|
79
|
-
position: absolute !important;
|
|
80
|
-
left: auto !important;
|
|
81
|
-
top: auto !important;
|
|
82
|
-
transform: none !important;
|
|
83
|
-
pointer-events: auto !important;
|
|
84
|
-
z-index: 1000 !important;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.css-in-js-globe-container .mapboxgl-marker .css-in-js-marker {
|
|
88
|
-
position: relative !important;
|
|
89
|
-
left: auto !important;
|
|
90
|
-
top: auto !important;
|
|
91
|
-
transform: none !important;
|
|
92
|
-
pointer-events: auto !important;
|
|
93
|
-
cursor: pointer !important;
|
|
94
|
-
display: flex !important;
|
|
95
|
-
align-items: center !important;
|
|
96
|
-
justify-content: center !important;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.css-in-js-globe-container .mapboxgl-marker-pane {
|
|
100
|
-
position: absolute !important;
|
|
101
|
-
left: 0 !important;
|
|
102
|
-
top: 0 !important;
|
|
103
|
-
transform: none !important;
|
|
104
|
-
z-index: 600 !important;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.css-in-js-globe-container .mapboxgl-tile-container {
|
|
108
|
-
position: absolute !important;
|
|
109
|
-
left: 0 !important;
|
|
110
|
-
top: 0 !important;
|
|
111
|
-
transform: none !important;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.css-in-js-globe-container .mapboxgl-zoom-animated {
|
|
115
|
-
transform-origin: 0 0 !important;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.css-in-js-globe-container .mapboxgl-marker.leaflet-interactive {
|
|
119
|
-
cursor: pointer !important;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
.css-in-js-globe-container .mapboxgl-popup {
|
|
123
|
-
position: absolute !important;
|
|
124
|
-
left: auto !important;
|
|
125
|
-
top: auto !important;
|
|
126
|
-
transform: none !important;
|
|
127
|
-
z-index: 700 !important;
|
|
128
|
-
text-align: center !important;
|
|
129
|
-
margin-bottom: 20px !important;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.css-in-js-globe-container .mapboxgl-popup-content-wrapper {
|
|
133
|
-
padding: 1px !important;
|
|
134
|
-
text-align: left !important;
|
|
135
|
-
border-radius: 12px !important;
|
|
136
|
-
background: white !important;
|
|
137
|
-
color: #333 !important;
|
|
138
|
-
box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4) !important;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.css-in-js-globe-container .mapboxgl-popup-content {
|
|
142
|
-
margin: 13px 24px 13px 20px !important;
|
|
143
|
-
line-height: 1.3 !important;
|
|
144
|
-
font-size: 13px !important;
|
|
145
|
-
min-height: 1px !important;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.css-in-js-globe-container .mapboxgl-popup-content p {
|
|
149
|
-
margin: 17px 0 !important;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
.css-in-js-globe-container .mapboxgl-popup-tip-container {
|
|
153
|
-
width: 40px !important;
|
|
154
|
-
height: 20px !important;
|
|
155
|
-
position: absolute !important;
|
|
156
|
-
left: 50% !important;
|
|
157
|
-
margin-top: -1px !important;
|
|
158
|
-
margin-left: -20px !important;
|
|
159
|
-
overflow: hidden !important;
|
|
160
|
-
pointer-events: none !important;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
.css-in-js-globe-container .mapboxgl-popup-tip {
|
|
164
|
-
width: 17px !important;
|
|
165
|
-
height: 17px !important;
|
|
166
|
-
padding: 1px !important;
|
|
167
|
-
margin: -10px auto 0 !important;
|
|
168
|
-
pointer-events: auto !important;
|
|
169
|
-
transform: rotate(45deg) !important;
|
|
170
|
-
background: white !important;
|
|
171
|
-
box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4) !important;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.css-in-js-globe-container .mapboxgl-popup-close-button {
|
|
175
|
-
position: absolute !important;
|
|
176
|
-
top: 0 !important;
|
|
177
|
-
right: 0 !important;
|
|
178
|
-
border: none !important;
|
|
179
|
-
text-align: center !important;
|
|
180
|
-
width: 24px !important;
|
|
181
|
-
height: 24px !important;
|
|
182
|
-
font: 16px/24px Tahoma, Verdana, sans-serif !important;
|
|
183
|
-
color: #757575 !important;
|
|
184
|
-
text-decoration: none !important;
|
|
185
|
-
background: transparent !important;
|
|
186
|
-
cursor: pointer !important;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.css-in-js-globe-container .mapboxgl-popup-close-button:hover {
|
|
190
|
-
color: #585858 !important;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/* Hide Mapbox attribution completely */
|
|
194
|
-
.css-in-js-globe-container .mapboxgl-ctrl-attribution {
|
|
195
|
-
display: none !important;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.css-in-js-globe-container .mapboxgl-ctrl-logo {
|
|
199
|
-
display: none !important;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/* Override any Leaflet pane positioning */
|
|
203
|
-
.css-in-js-globe-container .mapboxgl-overlay-pane {
|
|
204
|
-
position: absolute !important;
|
|
205
|
-
left: 0 !important;
|
|
206
|
-
top: 0 !important;
|
|
207
|
-
transform: none !important;
|
|
208
|
-
z-index: 400 !important;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
.css-in-js-globe-container .mapboxgl-shadow-pane {
|
|
212
|
-
position: absolute !important;
|
|
213
|
-
left: 0 !important;
|
|
214
|
-
top: 0 !important;
|
|
215
|
-
transform: none !important;
|
|
216
|
-
z-index: 500 !important;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.css-in-js-globe-container .mapboxgl-tooltip-pane {
|
|
220
|
-
position: absolute !important;
|
|
221
|
-
left: 0 !important;
|
|
222
|
-
top: 0 !important;
|
|
223
|
-
transform: none !important;
|
|
224
|
-
z-index: 650 !important;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
.css-in-js-globe-container .mapboxgl-popup-pane {
|
|
228
|
-
position: absolute !important;
|
|
229
|
-
left: 0 !important;
|
|
230
|
-
top: 0 !important;
|
|
231
|
-
transform: none !important;
|
|
232
|
-
z-index: 700 !important;
|
|
233
|
-
}
|
|
234
|
-
`;
|
|
235
|
-
document.head.appendChild(style);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// Calculate bounds to fit all markers
|
|
239
|
-
const bounds = new mapboxgl.LngLatBounds();
|
|
240
|
-
let hasValidCoordinates = false;
|
|
241
|
-
|
|
242
|
-
projects.forEach((project, index) => {
|
|
243
|
-
console.log(`π [CSS-IN-JS GLOBE] Adding marker ${index}:`, project);
|
|
244
|
-
|
|
245
|
-
// Create marker element
|
|
246
|
-
const el = document.createElement('div');
|
|
247
|
-
el.className = 'css-in-js-marker';
|
|
248
|
-
el.style.cursor = 'pointer';
|
|
249
|
-
el.style.boxShadow = '0px 3.45px 3.45px 0px #00000029';
|
|
250
|
-
el.style.display = 'flex';
|
|
251
|
-
el.style.alignItems = 'center';
|
|
252
|
-
el.style.justifyContent = 'center';
|
|
253
|
-
el.style.position = 'relative';
|
|
254
|
-
el.style.left = 'auto';
|
|
255
|
-
el.style.top = 'auto';
|
|
256
|
-
el.style.transform = 'none';
|
|
257
|
-
el.style.zIndex = '1000';
|
|
258
|
-
|
|
259
|
-
if (type === "location") {
|
|
260
|
-
// Location marker - SVG map pin style
|
|
261
|
-
el.style.width = '28px';
|
|
262
|
-
el.style.height = '33px';
|
|
263
|
-
el.innerHTML = `
|
|
264
|
-
<svg
|
|
265
|
-
width="28"
|
|
266
|
-
height="33"
|
|
267
|
-
viewBox="0 0 28 33"
|
|
268
|
-
fill="none"
|
|
269
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
270
|
-
>
|
|
271
|
-
<path
|
|
272
|
-
d="M5.14346 4.87419C10.0688 -0.15896 18.0528 -0.162058 22.9757 4.86861C27.6563 9.65161 27.8841 17.2616 23.6622 22.3255H23.6608C23.427 22.6141 23.1808 22.894 22.9211 23.1623L14.0671 32.2101L5.44057 23.3948L5.13868 23.096C0.215857 18.0655 0.218422 9.90737 5.14346 4.87419Z"
|
|
273
|
-
fill="${color}"
|
|
274
|
-
stroke="white"
|
|
275
|
-
/>
|
|
276
|
-
</svg>
|
|
277
|
-
`;
|
|
278
|
-
} else {
|
|
279
|
-
// Default circular marker style
|
|
280
|
-
el.style.width = '30px';
|
|
281
|
-
el.style.height = '30px';
|
|
282
|
-
el.style.backgroundColor = color;
|
|
283
|
-
el.style.borderRadius = '50%';
|
|
284
|
-
el.style.border = '2px solid white';
|
|
285
|
-
el.style.color = 'white';
|
|
286
|
-
el.style.fontWeight = 'bold';
|
|
287
|
-
el.style.fontSize = '14px';
|
|
288
|
-
el.style.textAlign = 'center';
|
|
289
|
-
el.style.lineHeight = '1';
|
|
290
|
-
el.innerHTML = `<span style="display: block; line-height: 1;">${project.percentageCompletion || 0}</span>`;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
// Create popup content
|
|
294
|
-
const popupContent = `
|
|
295
|
-
<div style="padding: 12px; min-width: 200px;">
|
|
296
|
-
<h3 style="margin: 0 0 8px 0; font-size: 16px; color: #333;">${project.name}</h3>
|
|
297
|
-
<p style="margin: 0 0 4px 0; font-size: 12px; color: #666;">
|
|
298
|
-
<strong>Country:</strong> ${project.country || 'N/A'}
|
|
299
|
-
</p>
|
|
300
|
-
<p style="margin: 0 0 4px 0; font-size: 12px; color: #666;">
|
|
301
|
-
<strong>Sector:</strong> ${project.sectoralScope || 'Project'}
|
|
302
|
-
</p>
|
|
303
|
-
<p style="margin: 0 0 4px 0; font-size: 12px; color: #666;">
|
|
304
|
-
<strong>Completion:</strong> ${project.percentageCompletion || 0}%
|
|
305
|
-
</p>
|
|
306
|
-
<p style="margin: 4px 0 0 0; font-size: 12px; color: #666;">
|
|
307
|
-
<strong>Coordinates:</strong> ${Number(project.latitude).toFixed(4)}, ${Number(project.longitude).toFixed(4)}
|
|
308
|
-
</p>
|
|
309
|
-
</div>
|
|
310
|
-
`;
|
|
311
|
-
|
|
312
|
-
// Create popup
|
|
313
|
-
const popup = new mapboxgl.Popup({
|
|
314
|
-
offset: 25,
|
|
315
|
-
closeButton: true,
|
|
316
|
-
closeOnClick: false
|
|
317
|
-
}).setHTML(popupContent);
|
|
318
|
-
|
|
319
|
-
// Ensure coordinates are valid numbers
|
|
320
|
-
const lng = Number(project.longitude);
|
|
321
|
-
const lat = Number(project.latitude);
|
|
322
|
-
|
|
323
|
-
console.log(`π [CSS-IN-JS GLOBE] Marker ${index} coordinates:`, {
|
|
324
|
-
original: { longitude: project.longitude, latitude: project.latitude },
|
|
325
|
-
processed: { lng, lat },
|
|
326
|
-
project: project.name
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
// Validate coordinates
|
|
330
|
-
if (isNaN(lng) || isNaN(lat) || lng < -180 || lng > 180 || lat < -90 || lat > 90) {
|
|
331
|
-
console.error(`β [CSS-IN-JS GLOBE] Invalid coordinates for project ${index}:`, {
|
|
332
|
-
lng, lat,
|
|
333
|
-
original: { longitude: project.longitude, latitude: project.latitude },
|
|
334
|
-
project: project.name
|
|
335
|
-
});
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// Add coordinates to bounds
|
|
340
|
-
bounds.extend([lng, lat]);
|
|
341
|
-
hasValidCoordinates = true;
|
|
342
|
-
|
|
343
|
-
// Create marker with explicit positioning
|
|
344
|
-
const marker = new mapboxgl.Marker({
|
|
345
|
-
element: el,
|
|
346
|
-
anchor: 'center'
|
|
347
|
-
})
|
|
348
|
-
.setLngLat([lng, lat])
|
|
349
|
-
.setPopup(popup)
|
|
350
|
-
.addTo(map.current);
|
|
351
|
-
|
|
352
|
-
// Add click handler
|
|
353
|
-
el.addEventListener('click', () => {
|
|
354
|
-
console.log('π [CSS-IN-JS GLOBE] Marker clicked:', project);
|
|
355
|
-
onProjectClick(project);
|
|
356
|
-
});
|
|
357
|
-
|
|
358
|
-
// Verify marker position after a short delay
|
|
359
|
-
setTimeout(() => {
|
|
360
|
-
const markerLngLat = marker.getLngLat();
|
|
361
|
-
console.log(`π [CSS-IN-JS GLOBE] Marker ${index} position verification:`, {
|
|
362
|
-
expected: [lng, lat],
|
|
363
|
-
actual: [markerLngLat.lng, markerLngLat.lat],
|
|
364
|
-
project: project.name,
|
|
365
|
-
match: Math.abs(markerLngLat.lng - lng) < 0.0001 && Math.abs(markerLngLat.lat - lat) < 0.0001
|
|
366
|
-
});
|
|
367
|
-
}, 100);
|
|
368
|
-
|
|
369
|
-
console.log(`β
[CSS-IN-JS GLOBE] Marker ${index} added at:`, [lng, lat]);
|
|
370
|
-
});
|
|
371
|
-
|
|
372
|
-
// Fit map to show all markers if we have valid coordinates
|
|
373
|
-
if (hasValidCoordinates && !bounds.isEmpty()) {
|
|
374
|
-
console.log('πΊοΈ [CSS-IN-JS GLOBE] Fitting map to bounds:', bounds);
|
|
375
|
-
map.current.fitBounds(bounds, {
|
|
376
|
-
padding: { top: 20, bottom: 20, left: 20, right: 20 },
|
|
377
|
-
maxZoom: 6,
|
|
378
|
-
duration: 1000
|
|
379
|
-
});
|
|
380
|
-
boundsRef.current = bounds;
|
|
381
|
-
} else {
|
|
382
|
-
boundsRef.current = null;
|
|
383
|
-
}
|
|
384
|
-
});
|
|
385
|
-
|
|
386
|
-
return () => {
|
|
387
|
-
if (map.current) {
|
|
388
|
-
map.current.remove();
|
|
389
|
-
map.current = null;
|
|
390
|
-
}
|
|
391
|
-
};
|
|
392
|
-
}, [projects, onProjectClick, mapConfig]);
|
|
393
|
-
|
|
394
|
-
return (
|
|
395
|
-
<div
|
|
396
|
-
className="css-in-js-globe-container"
|
|
397
|
-
style={{
|
|
398
|
-
width: '100%',
|
|
399
|
-
height: '100%',
|
|
400
|
-
position: 'relative'
|
|
401
|
-
}}
|
|
402
|
-
>
|
|
403
|
-
<div
|
|
404
|
-
ref={mapContainer}
|
|
405
|
-
style={{
|
|
406
|
-
width: '100%',
|
|
407
|
-
height: '100%',
|
|
408
|
-
position: 'relative'
|
|
409
|
-
}}
|
|
410
|
-
/>
|
|
411
|
-
</div>
|
|
412
|
-
);
|
|
413
|
-
};
|
|
414
|
-
|
|
415
|
-
export default CSSInJSGlobe;
|