svgmap 2.18.1 → 2.18.3
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/assets/countries.js +247 -0
- package/assets/create-map-paths.html +1029 -0
- package/assets/localize.html +35 -0
- package/assets/map-optimized.svg +986 -0
- package/dist/index.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/svg-map.umd.js +3 -1
- package/dist/svg-map.umd.js.map +1 -1
- package/dist/svg-map.umd.min.js +1 -1
- package/dist/svgMap.js +3 -1
- package/dist/svgMap.js.map +1 -1
- package/dist/svgMap.min.js +1 -1
- package/package.json +4 -2
- package/src/js/core/svg-map.js +2350 -0
- package/src/js/index.js +4 -0
- package/src/scss/map.scss +257 -0
- package/src/scss/svg-map.scss +2 -0
- package/src/scss/tooltip.scss +128 -0
- package/src/scss/variables.scss +31 -0
package/src/js/index.js
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
@use 'variables' as *;
|
|
2
|
+
|
|
3
|
+
.svgMap-wrapper,
|
|
4
|
+
.svgMap-container {
|
|
5
|
+
position: relative;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.svgMap-block-zoom-notice {
|
|
9
|
+
position: absolute;
|
|
10
|
+
z-index: 2;
|
|
11
|
+
top: 100%;
|
|
12
|
+
left: 0;
|
|
13
|
+
right: 0;
|
|
14
|
+
bottom: 0;
|
|
15
|
+
background: $blockZoomNoticeBackgroundColor;
|
|
16
|
+
pointer-events: none;
|
|
17
|
+
opacity: 0;
|
|
18
|
+
color: $blockZoomNoticeColor;
|
|
19
|
+
transition: opacity 250ms;
|
|
20
|
+
|
|
21
|
+
.svgMap-block-zoom-notice-active & {
|
|
22
|
+
pointer-events: all;
|
|
23
|
+
top: 0;
|
|
24
|
+
opacity: 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
> div {
|
|
28
|
+
position: absolute;
|
|
29
|
+
top: 50%;
|
|
30
|
+
left: 0;
|
|
31
|
+
right: 0;
|
|
32
|
+
text-align: center;
|
|
33
|
+
padding: 0 32px;
|
|
34
|
+
transform: translateY(-50%);
|
|
35
|
+
font-size: 28px;
|
|
36
|
+
|
|
37
|
+
@media (max-width: 900px) {
|
|
38
|
+
font-size: 22px;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.svgMap-map-wrapper {
|
|
44
|
+
position: relative;
|
|
45
|
+
width: 100%;
|
|
46
|
+
padding-top: 50%;
|
|
47
|
+
overflow: hidden;
|
|
48
|
+
background: $oceanColor;
|
|
49
|
+
color: $textColor;
|
|
50
|
+
|
|
51
|
+
* {
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
:focus:not(:focus-visible) {
|
|
56
|
+
outline: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.svgMap-map-image {
|
|
60
|
+
display: block;
|
|
61
|
+
position: absolute;
|
|
62
|
+
top: 0;
|
|
63
|
+
left: 0;
|
|
64
|
+
width: 100%;
|
|
65
|
+
height: 100%;
|
|
66
|
+
margin: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Controls
|
|
70
|
+
|
|
71
|
+
.svgMap-map-controls-wrapper {
|
|
72
|
+
position: absolute;
|
|
73
|
+
z-index: 1;
|
|
74
|
+
display: flex;
|
|
75
|
+
overflow: hidden;
|
|
76
|
+
border-radius: 2px;
|
|
77
|
+
box-shadow: $mapControlsBoxShadow;
|
|
78
|
+
|
|
79
|
+
&.svgMap-controls-position-bottomLeft {
|
|
80
|
+
bottom: 10px;
|
|
81
|
+
left: 10px;
|
|
82
|
+
}
|
|
83
|
+
&.svgMap-controls-position-bottomRight {
|
|
84
|
+
bottom: 10px;
|
|
85
|
+
right: 10px;
|
|
86
|
+
}
|
|
87
|
+
&.svgMap-controls-position-topLeft {
|
|
88
|
+
top: 10px;
|
|
89
|
+
left: 10px;
|
|
90
|
+
}
|
|
91
|
+
&.svgMap-controls-position-topRight {
|
|
92
|
+
top: 10px;
|
|
93
|
+
right: 10px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&.svgMap-disabled {
|
|
97
|
+
display: none;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.svgMap-map-controls-zoom,
|
|
102
|
+
.svgMap-map-controls-move {
|
|
103
|
+
display: flex;
|
|
104
|
+
margin-right: 5px;
|
|
105
|
+
overflow: hidden;
|
|
106
|
+
background: $mapControlsBackgroundColor;
|
|
107
|
+
|
|
108
|
+
&:last-child {
|
|
109
|
+
margin-right: 0;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.svgMap-control-button {
|
|
114
|
+
background-color: $mapControlsBackgroundColor;
|
|
115
|
+
border: none;
|
|
116
|
+
border-radius: 0;
|
|
117
|
+
color: $mapControlsColor;
|
|
118
|
+
font: inherit;
|
|
119
|
+
line-height: inherit;
|
|
120
|
+
margin: 0;
|
|
121
|
+
padding: 0;
|
|
122
|
+
overflow: visible;
|
|
123
|
+
text-transform: none;
|
|
124
|
+
-webkit-appearance: none;
|
|
125
|
+
-moz-appearance: none;
|
|
126
|
+
appearance: none;
|
|
127
|
+
cursor: pointer;
|
|
128
|
+
width: 32px;
|
|
129
|
+
height: 32px;
|
|
130
|
+
position: relative;
|
|
131
|
+
|
|
132
|
+
&.svgMap-zoom-button {
|
|
133
|
+
&::before,
|
|
134
|
+
&::after {
|
|
135
|
+
content: "";
|
|
136
|
+
position: absolute;
|
|
137
|
+
top: 50%;
|
|
138
|
+
left: 50%;
|
|
139
|
+
transform: translate(-50%, -50%);
|
|
140
|
+
background: $mapControlsIconColor;
|
|
141
|
+
transition: background-color 250ms;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&::before {
|
|
145
|
+
width: 11px;
|
|
146
|
+
height: 3px;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
@media (hover: hover) {
|
|
150
|
+
&:hover {
|
|
151
|
+
&::before,
|
|
152
|
+
&::after {
|
|
153
|
+
background: $mapControlsIconColorActive;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
&:active {
|
|
159
|
+
&::before,
|
|
160
|
+
&::after {
|
|
161
|
+
background: $mapControlsIconColorActive;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
&.svgMap-zoom-reset-button {
|
|
166
|
+
&::before {
|
|
167
|
+
width: 11px;
|
|
168
|
+
height: 11px;
|
|
169
|
+
background: none;
|
|
170
|
+
border: 2px solid $mapControlsIconColor;
|
|
171
|
+
transition: border-color 250ms;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@media (hover: hover) {
|
|
175
|
+
&:hover {
|
|
176
|
+
&::before {
|
|
177
|
+
background: none;
|
|
178
|
+
border-color: $mapControlsIconColorActive;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
&:active {
|
|
184
|
+
&::before {
|
|
185
|
+
background: none;
|
|
186
|
+
border-color: $mapControlsIconColorActive;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
&.svgMap-disabled {
|
|
192
|
+
&::before,
|
|
193
|
+
&::after {
|
|
194
|
+
background: $mapControlsDisabledColor;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
&.svgMap-zoom-reset-button {
|
|
199
|
+
&.svgMap-disabled {
|
|
200
|
+
cursor: default;
|
|
201
|
+
|
|
202
|
+
&::before {
|
|
203
|
+
border: 2px solid $mapControlsDisabledColor;
|
|
204
|
+
background: none;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
&.svgMap-zoom-in-button {
|
|
211
|
+
&::after {
|
|
212
|
+
width: 3px;
|
|
213
|
+
height: 11px;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Contient controls
|
|
219
|
+
.svgMap-map-continent-controls-wrapper {
|
|
220
|
+
position: absolute;
|
|
221
|
+
top: 10px;
|
|
222
|
+
right: 10px;
|
|
223
|
+
z-index: 1;
|
|
224
|
+
display: flex;
|
|
225
|
+
border-radius: 2px;
|
|
226
|
+
box-shadow: $continentControlsBoxShadow;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Countries
|
|
230
|
+
|
|
231
|
+
.svgMap-country {
|
|
232
|
+
fill: var(--svg-map-country-fill, #E2E2E2);
|
|
233
|
+
stroke: $countryStrokeColor;
|
|
234
|
+
stroke-width: 1;
|
|
235
|
+
stroke-linejoin: round;
|
|
236
|
+
vector-effect: non-scaling-stroke;
|
|
237
|
+
transition:
|
|
238
|
+
fill 250ms,
|
|
239
|
+
stroke 250ms;
|
|
240
|
+
|
|
241
|
+
&[data-link] {
|
|
242
|
+
cursor: pointer;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
@media (hover: hover) {
|
|
246
|
+
&:hover {
|
|
247
|
+
stroke: $mapActiveStrokeColor;
|
|
248
|
+
stroke-width: $mapActiveStrokeWidth;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
&.svgMap-active {
|
|
253
|
+
stroke: $mapActiveStrokeColor;
|
|
254
|
+
stroke-width: $mapActiveStrokeWidth;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
@use 'variables' as *;
|
|
2
|
+
|
|
3
|
+
.svgMap-tooltip {
|
|
4
|
+
box-shadow: 0 0 3px $mapTooltipBoxShadowColor;
|
|
5
|
+
position: absolute;
|
|
6
|
+
z-index: 2;
|
|
7
|
+
border-radius: 2px;
|
|
8
|
+
background: $mapTooltipBackgroundColor;
|
|
9
|
+
transform: translate(-50%, -100%);
|
|
10
|
+
border-bottom: 1px solid $mapTooltipColor;
|
|
11
|
+
display: none;
|
|
12
|
+
pointer-events: none;
|
|
13
|
+
min-width: 60px;
|
|
14
|
+
|
|
15
|
+
&.svgMap-tooltip-flipped {
|
|
16
|
+
transform: translate(-50%, 0);
|
|
17
|
+
border-bottom: 0;
|
|
18
|
+
border-top: 1px solid $mapTooltipColor;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&.svgMap-active {
|
|
22
|
+
display: block;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.svgMap-tooltip-content-container {
|
|
26
|
+
position: relative;
|
|
27
|
+
padding: 10px 20px;
|
|
28
|
+
|
|
29
|
+
.svgMap-tooltip-flag-container {
|
|
30
|
+
text-align: center;
|
|
31
|
+
margin: 2px 0 5px;
|
|
32
|
+
|
|
33
|
+
&.svgMap-tooltip-flag-container-emoji {
|
|
34
|
+
font-size: 50px;
|
|
35
|
+
line-height: 0;
|
|
36
|
+
padding: 25px 0 15px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.svgMap-tooltip-flag {
|
|
40
|
+
display: block;
|
|
41
|
+
margin: auto;
|
|
42
|
+
width: auto;
|
|
43
|
+
height: 32px;
|
|
44
|
+
padding: 2px;
|
|
45
|
+
background: $mapTooltipFlagBackgroundColor;
|
|
46
|
+
border-radius: 2px;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.svgMap-tooltip-title {
|
|
52
|
+
white-space: nowrap;
|
|
53
|
+
font-size: 18px;
|
|
54
|
+
line-height: 28px;
|
|
55
|
+
padding: 0 0 8px;
|
|
56
|
+
text-align: center;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.svgMap-tooltip-content {
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
text-align: center;
|
|
62
|
+
font-size: 14px;
|
|
63
|
+
color: $textColorLight;
|
|
64
|
+
margin: -5px 0 0;
|
|
65
|
+
|
|
66
|
+
table {
|
|
67
|
+
padding: 0;
|
|
68
|
+
border-spacing: 0px;
|
|
69
|
+
margin: auto;
|
|
70
|
+
|
|
71
|
+
td {
|
|
72
|
+
padding: 2px 0;
|
|
73
|
+
text-align: left;
|
|
74
|
+
|
|
75
|
+
span {
|
|
76
|
+
color: $textColor;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&:first-child {
|
|
80
|
+
padding-right: 10px;
|
|
81
|
+
text-align: right;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
sup {
|
|
85
|
+
vertical-align: baseline;
|
|
86
|
+
position: relative;
|
|
87
|
+
top: -5px;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.svgMap-tooltip-no-data {
|
|
93
|
+
padding: 2px 0;
|
|
94
|
+
color: $textColorLight;
|
|
95
|
+
font-style: italic;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.svgMap-tooltip-pointer {
|
|
100
|
+
position: absolute;
|
|
101
|
+
top: 100%;
|
|
102
|
+
left: 50%;
|
|
103
|
+
transform: translateX(-50%);
|
|
104
|
+
overflow: hidden;
|
|
105
|
+
height: 10px;
|
|
106
|
+
width: 30px;
|
|
107
|
+
|
|
108
|
+
&::after {
|
|
109
|
+
content: '';
|
|
110
|
+
width: 20px;
|
|
111
|
+
height: 20px;
|
|
112
|
+
background: $mapTooltipBackgroundColor;
|
|
113
|
+
border: 1px solid $mapTooltipColor;
|
|
114
|
+
position: absolute;
|
|
115
|
+
bottom: 6px;
|
|
116
|
+
left: 50%;
|
|
117
|
+
transform: translateX(-50%) rotate(45deg);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
&.svgMap-tooltip-flipped {
|
|
122
|
+
.svgMap-tooltip-pointer {
|
|
123
|
+
bottom: auto;
|
|
124
|
+
top: -10px;
|
|
125
|
+
transform: translateX(-50%) scaleY(-1);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// General
|
|
2
|
+
$textColor: #111 !default;
|
|
3
|
+
$textColorLight: #777 !default;
|
|
4
|
+
|
|
5
|
+
// Map
|
|
6
|
+
$colorNoData: #E2E2E2 !default;
|
|
7
|
+
$oceanColor: #d9ecff !default;
|
|
8
|
+
$mapActiveStrokeColor: #333 !default;
|
|
9
|
+
$mapActiveStrokeWidth: 1.5 !default;
|
|
10
|
+
$blockZoomNoticeColor: #fff !default;
|
|
11
|
+
$blockZoomNoticeBackgroundColor: rgba(0, 0, 0, 0.8) !default;
|
|
12
|
+
|
|
13
|
+
// Map Controls
|
|
14
|
+
$mapControlsColor: #fff !default;
|
|
15
|
+
$mapControlsBackgroundColor: #fff !default;
|
|
16
|
+
$mapControlsIconColor: #ccc !default;
|
|
17
|
+
$mapControlsIconColorActive: #000 !default;
|
|
18
|
+
$mapControlsDisabledColor: #eee !default;
|
|
19
|
+
$mapControlsBoxShadow: 0 0 0 2px rgba(0, 0, 0, 0.1) !default;
|
|
20
|
+
|
|
21
|
+
// Map Tooltip
|
|
22
|
+
$mapTooltipColor: #111 !default;
|
|
23
|
+
$mapTooltipBackgroundColor: #fff !default;
|
|
24
|
+
$mapTooltipFlagBackgroundColor: rgba(0, 0, 0, 0.15) !default;
|
|
25
|
+
$mapTooltipBoxShadowColor: rgba(0, 0, 0, 0.2) !default;
|
|
26
|
+
|
|
27
|
+
// Continent Controls
|
|
28
|
+
$continentControlsBoxShadow: 0 0 0 2px rgba(0, 0, 0, 0.1) !default;
|
|
29
|
+
|
|
30
|
+
// Country
|
|
31
|
+
$countryStrokeColor: #fff !default;
|