@sybilion/uilib 1.2.23 → 1.2.26

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 (80) hide show
  1. package/dist/esm/components/ui/AppHeader/AppHeader.styl.js +1 -1
  2. package/dist/esm/components/ui/Card/Card.styl.js +1 -1
  3. package/dist/esm/components/ui/Chat/ChatSheet/ChatSelector.js +1 -1
  4. package/dist/esm/components/ui/Chat/ChatSheet/ChatSelector.styl.js +1 -1
  5. package/dist/esm/components/ui/DropdownMenu/DropdownMenu.js +4 -4
  6. package/dist/esm/components/ui/NavUserHeader/NavUserHeader.js +5 -2
  7. package/dist/esm/components/ui/WorkspaceAppSwitcher/WorkspaceAppSwitcher.js +1 -1
  8. package/dist/esm/components/ui/WorkspaceAppSwitcher/WorkspaceAppSwitcher.styl.js +2 -2
  9. package/dist/esm/components/widgets/DriverMap/DriverIcon/DriverIcon.constants.json.js +6 -0
  10. package/dist/esm/components/widgets/DriverMap/DriverIcon/DriverIcon.js +21 -0
  11. package/dist/esm/components/widgets/DriverMap/DriverIcon/DriverIcon.styl.js +7 -0
  12. package/dist/esm/components/widgets/DriverMap/DriverMap.helpers.js +107 -0
  13. package/dist/esm/components/widgets/DriverMap/DriverMap.js +129 -0
  14. package/dist/esm/components/widgets/DriverMap/DriverMap.styl.js +7 -0
  15. package/dist/esm/components/widgets/DriverMap/LoadingSpinner/LoadingSpinner.js +8 -0
  16. package/dist/esm/components/widgets/DriverMap/LoadingSpinner/LoadingSpinner.styl.js +7 -0
  17. package/dist/esm/components/widgets/DriverMap/MapBackground/MapBackground.js +10 -0
  18. package/dist/esm/components/widgets/DriverMap/MapBackground/MapBackground.styl.js +7 -0
  19. package/dist/esm/components/widgets/DriverMap/MapBackground/map.svg.js +3 -0
  20. package/dist/esm/components/widgets/DriverMap/driverCategoryIcon.js +194 -0
  21. package/dist/esm/components/widgets/DriverMap/driverMapGeography.js +345 -0
  22. package/dist/esm/components/widgets/DriverMap/driverMapSelection.js +17 -0
  23. package/dist/esm/hooks/index.js +1 -0
  24. package/dist/esm/hooks/useEvent.js +0 -2
  25. package/dist/esm/index.js +6 -0
  26. package/dist/esm/types/src/components/ui/DropdownMenu/DropdownMenu.d.ts +2 -2
  27. package/dist/esm/types/src/components/widgets/DriverMap/DriverIcon/DriverIcon.d.ts +17 -0
  28. package/dist/esm/types/src/components/widgets/DriverMap/DriverMap.d.ts +8 -0
  29. package/dist/esm/types/src/components/widgets/DriverMap/DriverMap.helpers.d.ts +21 -0
  30. package/dist/esm/types/src/components/widgets/DriverMap/LoadingSpinner/LoadingSpinner.d.ts +1 -0
  31. package/dist/esm/types/src/components/widgets/DriverMap/MapBackground/MapBackground.d.ts +1 -0
  32. package/dist/esm/types/src/components/widgets/DriverMap/driverCategoryIcon.d.ts +1 -0
  33. package/dist/esm/types/src/components/widgets/DriverMap/driverMapGeography.d.ts +80 -0
  34. package/dist/esm/types/src/components/widgets/DriverMap/driverMapSelection.d.ts +3 -0
  35. package/dist/esm/types/src/components/widgets/DriverMap/index.d.ts +8 -0
  36. package/dist/esm/types/src/docs/pages/DriverMapPage.d.ts +1 -0
  37. package/dist/esm/types/src/docs/registry.d.ts +1 -1
  38. package/dist/esm/types/src/hooks/index.d.ts +1 -0
  39. package/dist/esm/types/src/index.d.ts +1 -0
  40. package/dist/esm/types/src/sybilion-auth/SybilionAuthProvider.d.ts +1 -1
  41. package/package.json +4 -4
  42. package/src/components/ui/AppHeader/AppHeader.styl +4 -0
  43. package/src/components/ui/Card/Card.styl +1 -0
  44. package/src/components/ui/Chat/ChatSheet/ChatSelector.styl +3 -1
  45. package/src/components/ui/Chat/ChatSheet/ChatSelector.tsx +1 -1
  46. package/src/components/ui/DropdownMenu/DropdownMenu.tsx +4 -0
  47. package/src/components/ui/NavUserHeader/NavUserHeader.tsx +9 -3
  48. package/src/components/ui/WorkspaceAppSwitcher/WorkspaceAppSwitcher.styl +12 -0
  49. package/src/components/ui/WorkspaceAppSwitcher/WorkspaceAppSwitcher.styl.d.ts +1 -0
  50. package/src/components/ui/WorkspaceAppSwitcher/WorkspaceAppSwitcher.tsx +1 -1
  51. package/src/components/widgets/DriverMap/DriverIcon/DriverIcon.constants.json +3 -0
  52. package/src/components/widgets/DriverMap/DriverIcon/DriverIcon.styl +125 -0
  53. package/src/components/widgets/DriverMap/DriverIcon/DriverIcon.styl.d.ts +22 -0
  54. package/src/components/widgets/DriverMap/DriverIcon/DriverIcon.tsx +81 -0
  55. package/src/components/widgets/DriverMap/DriverMap.helpers.ts +164 -0
  56. package/src/components/widgets/DriverMap/DriverMap.styl +45 -0
  57. package/src/components/widgets/DriverMap/DriverMap.styl.d.ts +11 -0
  58. package/src/components/widgets/DriverMap/DriverMap.tsx +214 -0
  59. package/src/components/widgets/DriverMap/LoadingSpinner/LoadingSpinner.styl +24 -0
  60. package/src/components/widgets/DriverMap/LoadingSpinner/LoadingSpinner.styl.d.ts +9 -0
  61. package/src/components/widgets/DriverMap/LoadingSpinner/LoadingSpinner.tsx +11 -0
  62. package/src/components/widgets/DriverMap/MapBackground/MapBackground.styl +13 -0
  63. package/src/components/widgets/DriverMap/MapBackground/MapBackground.styl.d.ts +7 -0
  64. package/src/components/widgets/DriverMap/MapBackground/MapBackground.tsx +18 -0
  65. package/src/components/widgets/DriverMap/MapBackground/map.svg +4337 -0
  66. package/src/components/widgets/DriverMap/MapBackground/mapAspect.mixin.styl +3 -0
  67. package/src/components/widgets/DriverMap/MapBackground/mapAspect.mixin.styl.d.ts +2 -0
  68. package/src/components/widgets/DriverMap/driverCategoryIcon.tsx +279 -0
  69. package/src/components/widgets/DriverMap/driverMapGeography.ts +478 -0
  70. package/src/components/widgets/DriverMap/driverMapSelection.ts +23 -0
  71. package/src/components/widgets/DriverMap/index.ts +18 -0
  72. package/src/docs/config/webpack.config.js +25 -9
  73. package/src/docs/pages/DriverMapPage.tsx +114 -0
  74. package/src/docs/pages/StandaloneAppLayoutPage/StandaloneAppLayoutPage.tsx +5 -7
  75. package/src/docs/pages/TooltipPage.tsx +14 -10
  76. package/src/docs/registry.ts +6 -5
  77. package/src/hooks/index.ts +1 -0
  78. package/src/hooks/useEvent.ts +0 -2
  79. package/src/index.ts +1 -0
  80. package/src/sybilion-auth/SybilionAuthProvider.tsx +1 -1
@@ -0,0 +1,194 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { ChartBarIcon, HouseIcon, HardHatIcon, ThermometerIcon, TruckIcon, LightningIcon, IdentificationCardIcon, UsersIcon, FactoryIcon, CurrencyDollarIcon, DatabaseIcon, GlobeIcon, FlaskIcon, ForkKnifeIcon, WalletIcon, ShoppingCartIcon, HeartIcon, TreeIcon, TShirtIcon, WrenchIcon, ChartLineIcon } from '@phosphor-icons/react';
3
+
4
+ // Icon mapping based on category
5
+ const getCategoryIcon = (category) => {
6
+ if (!category) {
7
+ return jsx(ChartBarIcon, { className: "h-full w-full" });
8
+ }
9
+ const categoryLower = category.toLowerCase();
10
+ // Housing & Real Estate
11
+ if (categoryLower.includes('housing') ||
12
+ categoryLower.includes('real estate') ||
13
+ categoryLower.includes('residential') ||
14
+ categoryLower.includes('property'))
15
+ return jsx(HouseIcon, { className: "h-full w-full" });
16
+ // Construction & Infrastructure
17
+ if (categoryLower.includes('construction') ||
18
+ categoryLower.includes('infrastructure') ||
19
+ categoryLower.includes('building') ||
20
+ categoryLower.includes('development') ||
21
+ categoryLower.includes('engineering') ||
22
+ categoryLower.includes('contracting'))
23
+ return jsx(HardHatIcon, { className: "h-full w-full" });
24
+ // Climate & Environment
25
+ if (categoryLower.includes('climate') ||
26
+ categoryLower.includes('weather') ||
27
+ categoryLower.includes('environment') ||
28
+ categoryLower.includes('temperature') ||
29
+ categoryLower.includes('global warming') ||
30
+ categoryLower.includes('pollution') ||
31
+ categoryLower.includes('sustainability') ||
32
+ categoryLower.includes('green'))
33
+ return jsx(ThermometerIcon, { className: "h-full w-full" });
34
+ // Supply Chain & Trade
35
+ if (categoryLower.includes('supply') ||
36
+ categoryLower.includes('trade') ||
37
+ categoryLower.includes('logistics') ||
38
+ categoryLower.includes('transport'))
39
+ return jsx(TruckIcon, { className: "h-full w-full" });
40
+ // Energy & Power
41
+ if (categoryLower.includes('energy') ||
42
+ categoryLower.includes('power') ||
43
+ categoryLower.includes('electricity'))
44
+ return jsx(LightningIcon, { className: "h-full w-full" });
45
+ // Labor Market & Employment
46
+ if (categoryLower.includes('labour') ||
47
+ categoryLower.includes('employment') ||
48
+ categoryLower.includes('jobs') ||
49
+ categoryLower.includes('hiring') ||
50
+ categoryLower.includes('unemployment') ||
51
+ categoryLower.includes('wages') ||
52
+ categoryLower.includes('salary') ||
53
+ categoryLower.includes('job market') ||
54
+ categoryLower.includes('workforce'))
55
+ return jsx(IdentificationCardIcon, { className: "h-full w-full" });
56
+ // Workforce & Human Resources
57
+ if (categoryLower.includes('workforce') ||
58
+ categoryLower.includes('hr') ||
59
+ categoryLower.includes('human resources') ||
60
+ categoryLower.includes('personnel') ||
61
+ categoryLower.includes('staffing') ||
62
+ categoryLower.includes('talent') ||
63
+ categoryLower.includes('recruitment'))
64
+ return jsx(UsersIcon, { className: "h-full w-full" });
65
+ // Manufacturing & Production
66
+ if (categoryLower.includes('volume') ||
67
+ categoryLower.includes('production') ||
68
+ categoryLower.includes('manufacturing') ||
69
+ categoryLower.includes('industry'))
70
+ return jsx(FactoryIcon, { className: "h-full w-full" });
71
+ // Finance & Economics
72
+ if (categoryLower.includes('price') ||
73
+ categoryLower.includes('inflation') ||
74
+ categoryLower.includes('finance') ||
75
+ categoryLower.includes('economy') ||
76
+ categoryLower.includes('gdp'))
77
+ return jsx(CurrencyDollarIcon, { className: "h-full w-full" });
78
+ // Data & Analytics
79
+ if (categoryLower.includes('data') ||
80
+ categoryLower.includes('analytics') ||
81
+ categoryLower.includes('statistics'))
82
+ return jsx(DatabaseIcon, { className: "h-full w-full" });
83
+ // Global & International
84
+ if (categoryLower.includes('global') ||
85
+ categoryLower.includes('international') ||
86
+ categoryLower.includes('world'))
87
+ return jsx(GlobeIcon, { className: "h-full w-full" });
88
+ // Chemicals & Pharmaceuticals
89
+ if (categoryLower.includes('chemical') ||
90
+ categoryLower.includes('pharmaceutical') ||
91
+ categoryLower.includes('medicine') ||
92
+ categoryLower.includes('drug') ||
93
+ categoryLower.includes('compound'))
94
+ return jsx(FlaskIcon, { className: "h-full w-full" });
95
+ // Food & Agriculture
96
+ if (categoryLower.includes('food') ||
97
+ categoryLower.includes('processed') ||
98
+ categoryLower.includes('agriculture') ||
99
+ categoryLower.includes('farming') ||
100
+ categoryLower.includes('crop') ||
101
+ categoryLower.includes('grain') ||
102
+ categoryLower.includes('dairy') ||
103
+ categoryLower.includes('meat'))
104
+ return jsx(ForkKnifeIcon, { className: "h-full w-full" });
105
+ // Income & Wealth
106
+ if (categoryLower.includes('income') ||
107
+ categoryLower.includes('wealth') ||
108
+ categoryLower.includes('salary') ||
109
+ categoryLower.includes('wage') ||
110
+ categoryLower.includes('earnings') ||
111
+ categoryLower.includes('revenue'))
112
+ return jsx(WalletIcon, { className: "h-full w-full" });
113
+ // Consumption & Retail
114
+ if (categoryLower.includes('consumption') ||
115
+ categoryLower.includes('retail') ||
116
+ categoryLower.includes('shopping') ||
117
+ categoryLower.includes('spending') ||
118
+ categoryLower.includes('purchases') ||
119
+ categoryLower.includes('demand'))
120
+ return jsx(ShoppingCartIcon, { className: "h-full w-full" });
121
+ // Living Conditions & Quality of Life
122
+ if (categoryLower.includes('living') ||
123
+ categoryLower.includes('quality') ||
124
+ categoryLower.includes('wellbeing') ||
125
+ categoryLower.includes('health') ||
126
+ categoryLower.includes('social') ||
127
+ categoryLower.includes('welfare') ||
128
+ categoryLower.includes('happiness'))
129
+ return jsx(HeartIcon, { className: "h-full w-full" });
130
+ // Minerals & Mining
131
+ if (categoryLower.includes('mineral') ||
132
+ categoryLower.includes('mining') ||
133
+ categoryLower.includes('ore') ||
134
+ categoryLower.includes('metal') ||
135
+ categoryLower.includes('coal') ||
136
+ categoryLower.includes('gold') ||
137
+ categoryLower.includes('copper') ||
138
+ categoryLower.includes('iron') ||
139
+ categoryLower.includes('aluminum') ||
140
+ categoryLower.includes('lithium'))
141
+ return jsx(TreeIcon, { className: "h-full w-full" });
142
+ // Textiles & Fibers
143
+ if (categoryLower.includes('textile') ||
144
+ categoryLower.includes('fiber') ||
145
+ categoryLower.includes('fabric') ||
146
+ categoryLower.includes('cloth') ||
147
+ categoryLower.includes('cotton') ||
148
+ categoryLower.includes('wool') ||
149
+ categoryLower.includes('silk') ||
150
+ categoryLower.includes('synthetic') ||
151
+ categoryLower.includes('garment') ||
152
+ categoryLower.includes('apparel'))
153
+ return jsx(TShirtIcon, { className: "h-full w-full" });
154
+ // Crafts & Artisan
155
+ if (categoryLower.includes('craft') ||
156
+ categoryLower.includes('artisan') ||
157
+ categoryLower.includes('handmade') ||
158
+ categoryLower.includes('artistic') ||
159
+ categoryLower.includes('creative') ||
160
+ categoryLower.includes('design') ||
161
+ categoryLower.includes('pottery') ||
162
+ categoryLower.includes('woodwork') ||
163
+ categoryLower.includes('jewelry'))
164
+ return jsx(WrenchIcon, { className: "h-full w-full" });
165
+ // Population & Demographics
166
+ if (categoryLower.includes('population') ||
167
+ categoryLower.includes('demographic') ||
168
+ categoryLower.includes('census') ||
169
+ categoryLower.includes('birth') ||
170
+ categoryLower.includes('death') ||
171
+ categoryLower.includes('migration') ||
172
+ categoryLower.includes('immigration') ||
173
+ categoryLower.includes('age') ||
174
+ categoryLower.includes('gender') ||
175
+ categoryLower.includes('ethnicity'))
176
+ return jsx(UsersIcon, { className: "h-full w-full" });
177
+ // Market Indices & Trading
178
+ if (categoryLower.includes('market') ||
179
+ categoryLower.includes('index') ||
180
+ categoryLower.includes('indices') ||
181
+ categoryLower.includes('trading') ||
182
+ categoryLower.includes('stock') ||
183
+ categoryLower.includes('equity') ||
184
+ categoryLower.includes('s&p') ||
185
+ categoryLower.includes('nasdaq') ||
186
+ categoryLower.includes('dow') ||
187
+ categoryLower.includes('ftse') ||
188
+ categoryLower.includes('candlestick'))
189
+ return jsx(ChartLineIcon, { className: "h-full w-full" });
190
+ // Default fallback
191
+ return jsx(ChartBarIcon, { className: "h-full w-full" });
192
+ };
193
+
194
+ export { getCategoryIcon };
@@ -0,0 +1,345 @@
1
+ // SVG dimensions and coordinate system
2
+ const SVG_WIDTH = 552;
3
+ const SVG_HEIGHT = 267;
4
+ // Map regions to precise geographic coordinates (latitude, longitude)
5
+ const geographicCoordinates = {
6
+ 'United States of America': {
7
+ latitude: 39.8283,
8
+ longitude: -98.5795,
9
+ continent: 'North America',
10
+ },
11
+ Canada: {
12
+ latitude: 56.1304,
13
+ longitude: -106.3468,
14
+ continent: 'North America',
15
+ },
16
+ Mexico: {
17
+ latitude: 23.6345,
18
+ longitude: -102.5528,
19
+ continent: 'North America',
20
+ },
21
+ Brazil: {
22
+ latitude: -14.235,
23
+ longitude: -51.9253,
24
+ continent: 'South America',
25
+ },
26
+ Argentina: {
27
+ latitude: -38.4161,
28
+ longitude: -63.6167,
29
+ continent: 'South America',
30
+ },
31
+ Chile: { latitude: -35.6751, longitude: -71.543, continent: 'South America' },
32
+ 'United Kingdom of Great Britain and Northern Ireland': {
33
+ latitude: 55.3781,
34
+ longitude: -3.436,
35
+ continent: 'Europe',
36
+ },
37
+ Germany: { latitude: 51.1657, longitude: 10.4515, continent: 'Europe' },
38
+ France: { latitude: 46.2276, longitude: 2.2137, continent: 'Europe' },
39
+ Italy: { latitude: 41.8719, longitude: 12.5674, continent: 'Europe' },
40
+ Spain: { latitude: 40.4637, longitude: -3.7492, continent: 'Europe' },
41
+ Poland: { latitude: 51.9194, longitude: 19.1451, continent: 'Europe' },
42
+ Russia: { latitude: 61.524, longitude: 105.3188, continent: 'Asia' },
43
+ China: { latitude: 35.8617, longitude: 104.1954, continent: 'Asia' },
44
+ Japan: { latitude: 36.2048, longitude: 138.2529, continent: 'Asia' },
45
+ India: { latitude: 20.5937, longitude: 78.9629, continent: 'Asia' },
46
+ 'South Korea': { latitude: 35.9078, longitude: 127.7669, continent: 'Asia' },
47
+ Singapore: { latitude: 1.3521, longitude: 103.8198, continent: 'Asia' },
48
+ Indonesia: { latitude: -0.7893, longitude: 113.9213, continent: 'Asia' },
49
+ Australia: { latitude: -25.2744, longitude: 133.7751, continent: 'Oceania' },
50
+ 'New Zealand': {
51
+ latitude: -40.9006,
52
+ longitude: 174.886,
53
+ continent: 'Oceania',
54
+ },
55
+ 'South Africa': {
56
+ latitude: -30.5595,
57
+ longitude: 22.9375,
58
+ continent: 'Africa',
59
+ },
60
+ Nigeria: { latitude: 9.082, longitude: 8.6753, continent: 'Africa' },
61
+ Egypt: { latitude: 26.0975, longitude: 30.0444, continent: 'Africa' },
62
+ Kenya: { latitude: -0.0236, longitude: 37.9062, continent: 'Africa' },
63
+ Morocco: { latitude: 31.6295, longitude: -7.9811, continent: 'Africa' },
64
+ 'Saudi Arabia': { latitude: 23.8859, longitude: 45.0792, continent: 'Asia' },
65
+ Iran: { latitude: 32.4279, longitude: 53.688, continent: 'Asia' },
66
+ Pakistan: { latitude: 30.3753, longitude: 69.3451, continent: 'Asia' },
67
+ Thailand: { latitude: 15.87, longitude: 100.9925, continent: 'Asia' },
68
+ Vietnam: { latitude: 14.0583, longitude: 108.2772, continent: 'Asia' },
69
+ Malaysia: { latitude: 4.2105, longitude: 101.9758, continent: 'Asia' },
70
+ Philippines: { latitude: 12.8797, longitude: 121.774, continent: 'Asia' },
71
+ World: { latitude: 0, longitude: 0, continent: 'Global' },
72
+ Americas: { latitude: 15.7835, longitude: -90.2308, continent: 'Americas' },
73
+ Europe: { latitude: 54.526, longitude: 15.2551, continent: 'Europe' },
74
+ Armenia: { latitude: 40.0691, longitude: 45.0382, continent: 'Asia' },
75
+ Cyprus: { latitude: 35.1264, longitude: 33.4299, continent: 'Europe' },
76
+ Portugal: { latitude: 39.3999, longitude: -8.2245, continent: 'Europe' },
77
+ Denmark: { latitude: 56.2639, longitude: 9.5018, continent: 'Europe' },
78
+ Sweden: { latitude: 60.1282, longitude: 18.6435, continent: 'Europe' },
79
+ Turkey: { latitude: 38.9637, longitude: 35.2433, continent: 'Asia' },
80
+ Finland: { latitude: 61.9241, longitude: 25.7482, continent: 'Europe' },
81
+ Lithuania: { latitude: 55.1694, longitude: 23.8813, continent: 'Europe' },
82
+ Myanmar: { latitude: 21.9162, longitude: 95.956, continent: 'Asia' },
83
+ Slovakia: { latitude: 48.669, longitude: 19.699, continent: 'Europe' },
84
+ Slovenia: { latitude: 46.1512, longitude: 14.9955, continent: 'Europe' },
85
+ Ukraine: { latitude: 48.3794, longitude: 31.1656, continent: 'Europe' },
86
+ Belgium: { latitude: 50.5039, longitude: 4.4699, continent: 'Europe' },
87
+ Asia: { latitude: 34.0479, longitude: 100.6197, continent: 'Asia' },
88
+ Africa: { latitude: -8.7832, longitude: 34.5085, continent: 'Africa' },
89
+ Oceania: { latitude: -25.2744, longitude: 133.7751, continent: 'Oceania' },
90
+ };
91
+ // Convert geographic coordinates to SVG coordinates
92
+ function geographicToSVG(lat, lng) {
93
+ // This SVG appears to use a custom projection optimized for the specific map design
94
+ // We'll use a modified equirectangular projection with adjustments for the SVG layout
95
+ const mapWidth = SVG_WIDTH;
96
+ const mapHeight = SVG_HEIGHT;
97
+ // Convert longitude to x coordinate (0-360 degrees to 0-552 pixels)
98
+ // Adjust longitude range to better fit the SVG (approximately -180 to 180)
99
+ let x = ((lng + 180) / 360) * mapWidth;
100
+ // Convert latitude to y coordinate (90 to -90 degrees to 0-267 pixels)
101
+ // The SVG appears to have some vertical offset, so we adjust the range
102
+ let y = ((90 - lat) / 180) * mapHeight;
103
+ // Apply adjustments based on the actual SVG layout
104
+ // These values are tuned to better match the visual layout of the map.svg
105
+ const longitudeOffset = 0.02; // Reduced shift to better align with continents
106
+ const latitudeOffset = 0.05; // Reduced shift to better align with continents
107
+ x = x + longitudeOffset * mapWidth;
108
+ y = y + latitudeOffset * mapHeight;
109
+ // Apply additional corrections for specific regions to improve accuracy
110
+ // These are fine-tuned adjustments based on the actual SVG layout
111
+ // North America adjustments
112
+ if (lng >= -170 && lng <= -50 && lat >= 25 && lat <= 70) {
113
+ x = x - 20; // Much larger west shift to get off coast and center properly
114
+ y = y + 8; // Shift south to position USA correctly
115
+ }
116
+ // United States specific adjustments
117
+ if (lng >= -125 && lng <= -65 && lat >= 25 && lat <= 50) {
118
+ x = x - 30; // Much larger west shift for USA (move significantly to the left to center)
119
+ y = y + 2; // Additional south shift for USA
120
+ }
121
+ // Europe adjustments
122
+ if (lng >= -10 && lng <= 40 && lat >= 35 && lat <= 70) {
123
+ x = x - 8; // Shift west to center in Europe
124
+ y = y - 2; // Shift north to position correctly in Europe
125
+ }
126
+ // Southern Europe adjustments (Italy, Spain, Portugal, Greece)
127
+ if (lng >= -10 && lng <= 25 && lat >= 35 && lat <= 47) {
128
+ x = x - 6; // Additional west shift for Southern Europe
129
+ y = y + 2; // Shift south for Southern Europe
130
+ }
131
+ // Eastern Europe adjustments
132
+ if (lng >= 10 && lng <= 30 && lat >= 45 && lat <= 60) {
133
+ x = x - 5; // Additional west shift for Eastern Europe
134
+ y = y + 2; // Shift south for Eastern Europe
135
+ }
136
+ // Northern Europe adjustments
137
+ if (lng >= 5 && lng <= 20 && lat >= 55 && lat <= 70) {
138
+ x = x - 10; // Increased west shift for Northern Europe
139
+ y = y - 6; // Reduced north shift for Northern Europe (was too high)
140
+ }
141
+ // Nordic countries adjustments (Finland, Norway, Iceland)
142
+ if (lng >= 15 && lng <= 35 && lat >= 60 && lat <= 75) {
143
+ x = x - 8; // Additional west shift for Nordic countries
144
+ y = y - 5; // Reduced north shift for Nordic countries (move from North Pole)
145
+ }
146
+ // Baltic countries adjustments (Lithuania, Latvia, Estonia)
147
+ if (lng >= 20 && lng <= 30 && lat >= 53 && lat <= 60) {
148
+ x = x - 2; // Reduced west shift for Baltic countries
149
+ y = y + 5; // Shift south for Baltic countries (move from North Sea to Baltic)
150
+ }
151
+ // Spain specific adjustments
152
+ if (lng >= -10 && lng <= 5 && lat >= 35 && lat <= 45) {
153
+ x = x - 15; // Increased west shift for Spain
154
+ y = y + 5; // Shift south for Spain
155
+ }
156
+ // Poland specific adjustments
157
+ if (lng >= 14 && lng <= 24 && lat >= 49 && lat <= 55) {
158
+ x = x - 10; // Shift west significantly for Poland
159
+ y = y + 3; // Shift south for Poland
160
+ }
161
+ // Cyprus specific adjustments
162
+ if (lng >= 32 && lng <= 35 && lat >= 34 && lat <= 36) {
163
+ x = x - 8; // Shift west for Cyprus
164
+ y = y - 5; // Shift north significantly for Cyprus
165
+ }
166
+ // Portugal specific adjustments
167
+ if (lng >= -10 && lng <= -6 && lat >= 36 && lat <= 42) {
168
+ x = x - 12; // Shift west significantly for Portugal
169
+ y = y - 8; // Shift north significantly for Portugal
170
+ }
171
+ // Denmark specific adjustments
172
+ if (lng >= 8 && lng <= 15 && lat >= 54 && lat <= 58) {
173
+ x = x - 8; // Shift west for Denmark
174
+ y = y - 3; // Reduced north shift for Denmark (was too high in the sea)
175
+ }
176
+ // Sweden specific adjustments
177
+ if (lng >= 11 && lng <= 24 && lat >= 55 && lat <= 69) {
178
+ x = x - 10; // Shift west significantly for Sweden
179
+ y = y + 5; // Shift south significantly for Sweden (move from North Pole to Nordic region)
180
+ }
181
+ // Turkey specific adjustments
182
+ if (lng >= 26 && lng <= 45 && lat >= 36 && lat <= 42) {
183
+ x = x - 15; // Shift west significantly for Turkey
184
+ y = y - 8; // Shift north for Turkey
185
+ }
186
+ // Finland specific adjustments
187
+ if (lng >= 20 && lng <= 31 && lat >= 60 && lat <= 70) {
188
+ x = x - 12; // Shift west significantly for Finland
189
+ y = y + 3; // Shift south for Finland (move from North Pole to Nordic region)
190
+ }
191
+ // Lithuania specific adjustments
192
+ if (lng >= 20 && lng <= 27 && lat >= 53 && lat <= 57) {
193
+ x = x - 5; // Reduced west shift for Lithuania (move from North Sea to Baltic)
194
+ y = y + 8; // Shift south significantly for Lithuania (move from North Sea to Baltic)
195
+ }
196
+ // Myanmar specific adjustments
197
+ if (lng >= 92 && lng <= 101 && lat >= 9 && lat <= 29) {
198
+ x = x - 5; // Shift west for Myanmar
199
+ y = y + 8; // Shift south significantly for Myanmar (move from Africa to Southeast Asia)
200
+ }
201
+ // Slovakia specific adjustments
202
+ if (lng >= 16 && lng <= 23 && lat >= 47 && lat <= 50) {
203
+ x = x - 8; // Shift west for Slovakia
204
+ y = y - 5; // Shift north for Slovakia
205
+ }
206
+ // United Kingdom specific adjustments
207
+ if (lng >= -8 && lng <= 2 && lat >= 50 && lat <= 61) {
208
+ x = x - 5; // Shift west for UK
209
+ y = y - 15; // Increased north shift for UK (move from Africa to Europe)
210
+ }
211
+ // Slovenia specific adjustments
212
+ if (lng >= 13 && lng <= 17 && lat >= 45 && lat <= 47) {
213
+ x = x - 8; // Shift west for Slovenia
214
+ y = y - 10; // Shift north significantly for Slovenia (move from Africa to Europe)
215
+ }
216
+ // Belgium specific adjustments
217
+ if (lng >= 2 && lng <= 7 && lat >= 49 && lat <= 52) {
218
+ x = x - 6; // Shift west for Belgium
219
+ y = y - 8; // Shift north significantly for Belgium (move from Africa to Europe)
220
+ }
221
+ // Italy specific adjustments
222
+ if (lng >= 6 && lng <= 19 && lat >= 35 && lat <= 47) {
223
+ x = x - 12; // Shift west significantly for Italy (was too far right)
224
+ y = y - 3; // Shift north slightly for Italy
225
+ }
226
+ // Asia adjustments
227
+ if (lng >= 70 && lng <= 180 && lat >= 10 && lat <= 60) {
228
+ x = x - 2; // Shift west to position on continent
229
+ y = y + 2; // Shift south slightly
230
+ }
231
+ // Southeast Asia adjustments (Myanmar, Thailand, Vietnam, etc.)
232
+ if (lng >= 90 && lng <= 120 && lat >= 5 && lat <= 25) {
233
+ x = x - 3; // Shift west for Southeast Asia
234
+ y = y + 5; // Shift south for Southeast Asia
235
+ }
236
+ // Western Asia adjustments
237
+ if (lng >= 25 && lng <= 50 && lat >= 30 && lat <= 50) {
238
+ x = x - 8; // Additional west shift for Western Asia
239
+ y = y - 3; // Shift north for Western Asia
240
+ }
241
+ // Caucasus region adjustments (Armenia, Georgia, Azerbaijan)
242
+ if (lng >= 40 && lng <= 50 && lat >= 38 && lat <= 42) {
243
+ x = x - 8; // Shift west significantly to position correctly
244
+ y = y - 2; // Shift north slightly
245
+ }
246
+ // Africa adjustments
247
+ if (lng >= -20 && lng <= 55 && lat >= -35 && lat <= 35) {
248
+ x = x - 2; // Shift west to position on continent
249
+ y = y + 3; // Shift south to position correctly
250
+ }
251
+ // Australia adjustments
252
+ if (lng >= 110 && lng <= 180 && lat >= -45 && lat <= -10) {
253
+ x = x - 8; // Shift west significantly
254
+ y = y + 5; // Shift south significantly
255
+ }
256
+ // South America adjustments
257
+ if (lng >= -85 && lng <= -30 && lat >= -60 && lat <= 15) {
258
+ x = x - 5; // Increased west shift
259
+ y = y + 1; // Shift south slightly
260
+ }
261
+ // Ensure coordinates are within bounds
262
+ x = Math.max(0, Math.min(mapWidth, x));
263
+ y = Math.max(0, Math.min(mapHeight, y));
264
+ return { x, y };
265
+ }
266
+ // Convert SVG coordinates to percentage for positioning
267
+ function svgToPercentage(svgX, svgY) {
268
+ return {
269
+ x: (svgX / SVG_WIDTH) * 100,
270
+ y: (svgY / SVG_HEIGHT) * 100,
271
+ };
272
+ }
273
+ // Get continent from region name
274
+ function getContinentFromRegion(region) {
275
+ const geo = geographicCoordinates[region];
276
+ return geo ? geo.continent : null;
277
+ }
278
+ // Get precise coordinates for a region
279
+ function getPreciseCoordinates(region) {
280
+ const geo = geographicCoordinates[region];
281
+ if (!geo) {
282
+ // Fallback to center of map for unknown regions
283
+ return { x: 50, y: 50, continent: 'Unknown' };
284
+ }
285
+ const svgCoords = geographicToSVG(geo.latitude, geo.longitude);
286
+ const percentageCoords = svgToPercentage(svgCoords.x, svgCoords.y);
287
+ return {
288
+ x: Math.min(95, Math.max(5, percentageCoords.x)),
289
+ y: Math.min(95, Math.max(5, percentageCoords.y)),
290
+ continent: geo.continent,
291
+ };
292
+ }
293
+ // Enhanced positioning function that considers map boundaries and responsive design
294
+ function getResponsiveCoordinates(region, existingDrivers = [], mapContainerWidth = 552, mapContainerHeight = 267) {
295
+ const baseCoords = getPreciseCoordinates(region);
296
+ // Adjust coordinates based on container size if different from default SVG size
297
+ const widthRatio = mapContainerWidth / SVG_WIDTH;
298
+ const heightRatio = mapContainerHeight / SVG_HEIGHT;
299
+ // Scale coordinates if container size is different
300
+ let adjustedX = baseCoords.x;
301
+ let adjustedY = baseCoords.y;
302
+ if (widthRatio !== 1 || heightRatio !== 1) {
303
+ // Convert back to SVG coordinates, scale, then convert back to percentage
304
+ const svgX = (baseCoords.x / 100) * SVG_WIDTH;
305
+ const svgY = (baseCoords.y / 100) * SVG_HEIGHT;
306
+ const scaledX = svgX * widthRatio;
307
+ const scaledY = svgY * heightRatio;
308
+ adjustedX = (scaledX / mapContainerWidth) * 100;
309
+ adjustedY = (scaledY / mapContainerHeight) * 100;
310
+ }
311
+ // Check for overlapping drivers and adjust position
312
+ const minDistance = 3; // Minimum distance between drivers (in percentage)
313
+ const existingDriversAtRegion = existingDrivers.filter(d => Math.abs(d.coordinates.x - adjustedX) < minDistance &&
314
+ Math.abs(d.coordinates.y - adjustedY) < minDistance);
315
+ if (existingDriversAtRegion.length > 0) {
316
+ // Apply intelligent offset based on number of existing drivers
317
+ const numDrivers = existingDriversAtRegion.length + 1;
318
+ if (numDrivers === 2) {
319
+ adjustedX = Math.min(95, Math.max(5, adjustedX + 4));
320
+ }
321
+ else if (numDrivers === 3) {
322
+ const angle = (numDrivers - 1) * 120 * (Math.PI / 180);
323
+ const radius = 4;
324
+ adjustedX = Math.min(95, Math.max(5, adjustedX + Math.cos(angle) * radius));
325
+ adjustedY = Math.min(95, Math.max(5, adjustedY + Math.sin(angle) * radius));
326
+ }
327
+ else {
328
+ // Grid pattern for more drivers
329
+ const gridSize = Math.ceil(Math.sqrt(numDrivers));
330
+ const gridIndex = numDrivers - 1;
331
+ const row = Math.floor(gridIndex / gridSize);
332
+ const col = gridIndex % gridSize;
333
+ const spacing = 3;
334
+ adjustedX = Math.min(95, Math.max(5, adjustedX + (col - Math.floor(gridSize / 2)) * spacing));
335
+ adjustedY = Math.min(95, Math.max(5, adjustedY + (row - Math.floor(gridSize / 2)) * spacing));
336
+ }
337
+ }
338
+ return {
339
+ x: Math.min(95, Math.max(5, adjustedX)),
340
+ y: Math.min(95, Math.max(5, adjustedY)),
341
+ continent: baseCoords.continent,
342
+ };
343
+ }
344
+
345
+ export { geographicCoordinates, geographicToSVG, getContinentFromRegion, getPreciseCoordinates, getResponsiveCoordinates, svgToPercentage };
@@ -0,0 +1,17 @@
1
+ const getDriverImportance = (driver) => driver.rawImportance?.overall?.mean || driver.importance;
2
+ const getHighestImportanceDriver = (drivers) => {
3
+ if (drivers.length === 0)
4
+ return null;
5
+ let highestImportance = 0;
6
+ let highestIndex = 0;
7
+ for (const [index, driver] of drivers.entries()) {
8
+ const importance = getDriverImportance(driver);
9
+ if (importance > 0 && importance > highestImportance) {
10
+ highestImportance = importance;
11
+ highestIndex = index;
12
+ }
13
+ }
14
+ return highestIndex;
15
+ };
16
+
17
+ export { getDriverImportance, getHighestImportanceDriver };
@@ -1 +1,2 @@
1
1
  export { useIsMobile } from './useIsMobile.js';
2
+ export { default as useEvent } from './useEvent.js';
@@ -3,10 +3,8 @@ import { useRef, useState, useEffect } from 'react';
3
3
  function useEvent({ elem, event, callback, isActive = true, isCapture = false, }) {
4
4
  const callbackRef = useRef(callback);
5
5
  callbackRef.current = callback;
6
- // Track when elem.current changes to force effect re-run
7
6
  const [elemKey, setElemKey] = useState(0);
8
7
  const prevElemRef = useRef(null);
9
- // Watch for elem.current changes and update state to trigger main effect re-run
10
8
  useEffect(() => {
11
9
  const currentElem = Array.isArray(elem)
12
10
  ? elem.find(ref => ref?.current)?.current || null
package/dist/esm/index.js CHANGED
@@ -89,6 +89,12 @@ export { WORKSPACE_APP_ICONS, isWorkspaceAppIconKey } from './components/ui/Work
89
89
  export { findWorkspaceAppByPathname, workspaceAppSlugPath } from './components/ui/WorkspaceAppSwitcher/workspaceAppPaths.js';
90
90
  export { SidebarDatasetsItemsGrouped } from './components/widgets/SidebarDatasetsItemsGrouped/SidebarDatasetsItemsGrouped.js';
91
91
  export { groupSidebarDatasets } from './components/widgets/SidebarDatasetsItemsGrouped/groupSidebarDatasets.js';
92
+ export { DriverMap } from './components/widgets/DriverMap/DriverMap.js';
93
+ export { getCategoryIcon } from './components/widgets/DriverMap/driverCategoryIcon.js';
94
+ export { getDriverImportance, getHighestImportanceDriver } from './components/widgets/DriverMap/driverMapSelection.js';
95
+ export { geographicCoordinates, geographicToSVG, getContinentFromRegion, getPreciseCoordinates, getResponsiveCoordinates, svgToPercentage } from './components/widgets/DriverMap/driverMapGeography.js';
96
+ export { MapBackground } from './components/widgets/DriverMap/MapBackground/MapBackground.js';
97
+ export { LoadingSpinner } from './components/widgets/DriverMap/LoadingSpinner/LoadingSpinner.js';
92
98
  export { SybilionAppHeader } from './components/widgets/SybilionAppHeader/SybilionAppHeader.js';
93
99
  export { SybilionAuthLayout } from './components/widgets/SybilionAuthLayout/SybilionAuthLayout.js';
94
100
  export { SybilionAuthHeadline } from './components/widgets/SybilionAuthLayout/SybilionAuthHeadline.js';
@@ -2,7 +2,7 @@ import type { DropdownMenuCheckboxItemProps, DropdownMenuContentProps, DropdownM
2
2
  declare function DropdownMenu({ ...props }: DropdownMenuProps): import("react/jsx-runtime").JSX.Element;
3
3
  declare function DropdownMenuPortal({ ...props }: DropdownMenuPortalProps): import("react/jsx-runtime").JSX.Element;
4
4
  declare function DropdownMenuTrigger({ ...props }: DropdownMenuTriggerProps): import("react/jsx-runtime").JSX.Element;
5
- declare function DropdownMenuContent({ className, sideOffset, elevation, ...props }: DropdownMenuContentProps): import("react/jsx-runtime").JSX.Element;
5
+ declare function DropdownMenuContent({ className, sideOffset, collisionPadding, elevation, ...props }: DropdownMenuContentProps): import("react/jsx-runtime").JSX.Element;
6
6
  declare function DropdownMenuGroup({ ...props }: DropdownMenuGroupProps): import("react/jsx-runtime").JSX.Element;
7
7
  declare function DropdownMenuItem({ className, inset, variant, ...props }: DropdownMenuItemProps): import("react/jsx-runtime").JSX.Element;
8
8
  declare function DropdownMenuCheckboxItem({ className, children, checked, ...props }: DropdownMenuCheckboxItemProps): import("react/jsx-runtime").JSX.Element;
@@ -13,5 +13,5 @@ declare function DropdownMenuSeparator({ className, ...props }: DropdownMenuSepa
13
13
  declare function DropdownMenuShortcut({ className, ...props }: DropdownMenuShortcutProps): import("react/jsx-runtime").JSX.Element;
14
14
  declare function DropdownMenuSub({ ...props }: DropdownMenuSubProps): import("react/jsx-runtime").JSX.Element;
15
15
  declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: DropdownMenuSubTriggerProps): import("react/jsx-runtime").JSX.Element;
16
- declare function DropdownMenuSubContent({ className, ...props }: DropdownMenuSubContentProps): import("react/jsx-runtime").JSX.Element;
16
+ declare function DropdownMenuSubContent({ className, collisionPadding, ...props }: DropdownMenuSubContentProps): import("react/jsx-runtime").JSX.Element;
17
17
  export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };
@@ -0,0 +1,17 @@
1
+ import type { DriverData } from '../driverMapGeography';
2
+ export declare const BADGE_SIZES: {
3
+ readonly s: "s";
4
+ readonly m: "m";
5
+ readonly l: "l";
6
+ };
7
+ export type BadgeSize = (typeof BADGE_SIZES)[keyof typeof BADGE_SIZES];
8
+ interface DriverIconProps {
9
+ driver: DriverData;
10
+ size: BadgeSize;
11
+ isSelected: boolean;
12
+ onClick: () => void;
13
+ isVisible: boolean;
14
+ isLoading?: boolean;
15
+ }
16
+ export declare function DriverIcon({ driver, size, isSelected, onClick, isVisible, isLoading, }: DriverIconProps): import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { DriverData } from './driverMapGeography';
2
+ export interface DriverMapProps {
3
+ drivers: DriverData[];
4
+ isLoading: boolean;
5
+ setSelectedDriver: (driver: DriverData) => void;
6
+ selectedDriver: DriverData | null;
7
+ }
8
+ export declare function DriverMap({ drivers, isLoading, setSelectedDriver, selectedDriver, }: DriverMapProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { type BadgeSize } from './DriverIcon/DriverIcon';
2
+ import { type DriverData } from './driverMapGeography';
3
+ export declare const calculateBadgeSizes: (drivers: DriverData[]) => Record<string, BadgeSize>;
4
+ export declare const hasValidCoords: (coords: {
5
+ x: number;
6
+ y: number;
7
+ } | null | undefined) => boolean;
8
+ export declare const findMostSpecificRegion: (driver: DriverData) => {
9
+ name: string | null;
10
+ coordinates: {
11
+ x: number;
12
+ y: number;
13
+ } | null;
14
+ };
15
+ export declare const getDriverCoordinates: (driver: DriverData, specificRegion: {
16
+ name: string | null;
17
+ coordinates: {
18
+ x: number;
19
+ y: number;
20
+ } | null;
21
+ }, existingDrivers?: DriverData[]) => DriverData["coordinates"];
@@ -0,0 +1 @@
1
+ export declare function LoadingSpinner(): import("react/jsx-runtime").JSX.Element;