@kiva/kv-components 8.13.2 → 8.13.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/dist/vue/KvSimpleMap.css +1 -1
- package/dist/vue/KvSimpleMap.js +1 -1
- package/dist/vue/KvSimpleMap2.js +36 -36
- package/package.json +2 -2
package/dist/vue/KvSimpleMap.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.kv-simple-map__pan-layer[data-v-
|
|
1
|
+
.kv-simple-map__pan-layer[data-v-0abc47d3]{transform-origin:0 0}.kv-simple-map__control-btn[data-v-0abc47d3]{display:flex;height:2rem;width:2rem;cursor:pointer;align-items:center;justify-content:center;border-radius:.25rem;border-width:.0625rem;--tw-border-opacity: 1;border-color:rgba(var(--border-tertiary),var(--tw-border-opacity, 1));--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));--tw-shadow: 0 1px 4px 0 rgb(0 0 0 / .08);--tw-shadow-colored: 0 1px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.kv-simple-map__control-btn[data-v-0abc47d3]:disabled{cursor:default;opacity:.3}.kv-simple-map__control-btn[data-v-0abc47d3]:hover:not(:disabled){--tw-bg-opacity: 1;background-color:rgba(var(--bg-secondary),var(--tw-bg-opacity, 1))}.kv-simple-map__play-btn[data-v-0abc47d3]{border-radius:500rem}.kv-simple-map__default-popup[data-v-0abc47d3]{white-space:nowrap;border-radius:.5rem;--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1));padding:.5rem 1.5rem;text-align:center;--tw-shadow: 0 1px 4px 0 rgb(0 0 0 / .08);--tw-shadow-colored: 0 1px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);min-width:80px}.kv-simple-map__popup[data-v-0abc47d3]{height:0;width:0}.kv-simple-map__popup-content[data-v-0abc47d3]{position:absolute;white-space:nowrap}.kv-simple-map__popup--top>.kv-simple-map__popup-content[data-v-0abc47d3]{bottom:var(--kv-simple-map-popup-offset, 4px);left:0;transform:translate(-50%)}.kv-simple-map__popup--bottom>.kv-simple-map__popup-content[data-v-0abc47d3]{top:var(--kv-simple-map-popup-offset, 4px);left:0;transform:translate(-50%)}.kv-simple-map__popup--bottom-right>.kv-simple-map__popup-content[data-v-0abc47d3]{top:var(--kv-simple-map-popup-offset, 4px);left:var(--kv-simple-map-popup-offset, 4px)}.kv-simple-map-popup-enter-active[data-v-0abc47d3],.kv-simple-map-popup-leave-active[data-v-0abc47d3]{transition:opacity .18s ease-out}.kv-simple-map-popup-enter-from[data-v-0abc47d3],.kv-simple-map-popup-leave-to[data-v-0abc47d3]{opacity:0}.kv-simple-map-popup-enter-to[data-v-0abc47d3],.kv-simple-map-popup-leave-from[data-v-0abc47d3]{opacity:1}
|
package/dist/vue/KvSimpleMap.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./KvSimpleMap2.js";
|
|
2
2
|
import "./KvSimpleMap.css";
|
|
3
3
|
import p from "../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const r = /* @__PURE__ */ p(o, [["__scopeId", "data-v-
|
|
4
|
+
const r = /* @__PURE__ */ p(o, [["__scopeId", "data-v-0abc47d3"]]);
|
|
5
5
|
export {
|
|
6
6
|
r as default
|
|
7
7
|
};
|
package/dist/vue/KvSimpleMap2.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as Ue, useSlots as Ye, computed as a, ref as x, watch as Y, onMounted as Xe, onBeforeUnmount as Ge, openBlock as h, createElementBlock as b, normalizeStyle as $, createElementVNode as M, Fragment as qe, renderList as Ke, unref as C, createVNode as L, createCommentVNode as T, Transition as je, withCtx as Je, normalizeClass as Qe, renderSlot as et, toDisplayString as
|
|
1
|
+
import { defineComponent as Ue, useSlots as Ye, computed as a, ref as x, watch as Y, onMounted as Xe, onBeforeUnmount as Ge, openBlock as h, createElementBlock as b, normalizeStyle as $, createElementVNode as M, Fragment as qe, renderList as Ke, unref as C, createVNode as L, createCommentVNode as T, Transition as je, withCtx as Je, normalizeClass as Qe, renderSlot as et, toDisplayString as ie } from "vue";
|
|
2
2
|
import { mdiPlus as tt, mdiMinus as ot, mdiPlay as nt } from "@mdi/js";
|
|
3
3
|
import N from "@kiva/kv-tokens";
|
|
4
4
|
import lt from "../data/simpleMapPaths.js";
|
|
5
5
|
import at from "../data/simpleMapCountryPaths.js";
|
|
6
6
|
import O from "../data/simpleMapCentroids.js";
|
|
7
|
-
import { ALL_COUNTRIES_ISO_MAP as
|
|
7
|
+
import { ALL_COUNTRIES_ISO_MAP as re } from "../data/allCountriesISOMap.js";
|
|
8
8
|
import { useMapTourCycle as ut } from "../utils/useMapTourCycle.js";
|
|
9
9
|
import X from "./KvMaterialIcon.js";
|
|
10
10
|
const it = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"], st = {
|
|
@@ -187,13 +187,13 @@ const it = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"],
|
|
|
187
187
|
fadeDuration: { type: Number, default: 500 }
|
|
188
188
|
},
|
|
189
189
|
setup(k) {
|
|
190
|
-
const n = k,
|
|
191
|
-
function
|
|
190
|
+
const n = k, se = Ye(), G = a(() => !!se.popup), E = x(null), r = x(0), w = x(0);
|
|
191
|
+
function ce() {
|
|
192
192
|
return n.height != null ? `${n.height}px` : r.value ? `${r.value / n.aspectRatio}px` : `${100 / n.aspectRatio}%`;
|
|
193
193
|
}
|
|
194
|
-
const
|
|
194
|
+
const pe = a(() => ({
|
|
195
195
|
width: n.width != null ? `${n.width}px` : "100%",
|
|
196
|
-
height:
|
|
196
|
+
height: ce(),
|
|
197
197
|
paddingBottom: n.height != null ? void 0 : `${100 / n.aspectRatio}%`
|
|
198
198
|
}));
|
|
199
199
|
let S = null;
|
|
@@ -203,7 +203,7 @@ const it = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"],
|
|
|
203
203
|
const t = e.getBoundingClientRect();
|
|
204
204
|
r.value = t.width, w.value = t.height;
|
|
205
205
|
}
|
|
206
|
-
const
|
|
206
|
+
const me = a(() => n.countries), fe = a(() => n.loop), A = x(!1), ve = a(() => n.autoplay && !A.value), de = a(() => ({
|
|
207
207
|
initialDelay: n.initialDelay,
|
|
208
208
|
panDuration: n.panDuration,
|
|
209
209
|
holdPerStep: n.holdPerStep,
|
|
@@ -212,11 +212,11 @@ const it = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"],
|
|
|
212
212
|
fadeDuration: n.fadeDuration
|
|
213
213
|
})), {
|
|
214
214
|
panIdx: K,
|
|
215
|
-
highlighted:
|
|
215
|
+
highlighted: ye,
|
|
216
216
|
showPopupIdx: j,
|
|
217
217
|
isRunning: m,
|
|
218
|
-
start:
|
|
219
|
-
} = ut(
|
|
218
|
+
start: xe
|
|
219
|
+
} = ut(me, ve, fe, de.value), f = a(() => r.value ? r.value / R : 1), J = a(() => {
|
|
220
220
|
const e = f.value, t = D * e;
|
|
221
221
|
return {
|
|
222
222
|
x: 0,
|
|
@@ -224,19 +224,19 @@ const it = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"],
|
|
|
224
224
|
scale: e
|
|
225
225
|
};
|
|
226
226
|
});
|
|
227
|
-
function
|
|
227
|
+
function he(e) {
|
|
228
228
|
return e.cx != null && e.cy != null ? { cx: e.cx, cy: e.cy } : O[e.id] ?? null;
|
|
229
229
|
}
|
|
230
|
-
const
|
|
230
|
+
const be = a(() => {
|
|
231
231
|
const l = Math.max(0, Math.min(1, (r.value - 320) / 880));
|
|
232
232
|
return n.zoomFactor * (1.4 - l * (1.4 - 1));
|
|
233
|
-
}),
|
|
233
|
+
}), we = a(() => {
|
|
234
234
|
if (K.value < 0) return null;
|
|
235
235
|
const e = n.countries[K.value];
|
|
236
236
|
if (!e) return null;
|
|
237
|
-
const t =
|
|
237
|
+
const t = he(e);
|
|
238
238
|
if (!t) return null;
|
|
239
|
-
const o = f.value *
|
|
239
|
+
const o = f.value * be.value;
|
|
240
240
|
let l = o;
|
|
241
241
|
const u = O[e.id];
|
|
242
242
|
if (u) {
|
|
@@ -252,7 +252,7 @@ const it = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"],
|
|
|
252
252
|
y: w.value / 2 - t.cy * i,
|
|
253
253
|
scale: i
|
|
254
254
|
};
|
|
255
|
-
}), c = x({ x: 0, y: 0, scale: 1 }), B = x(!1), Q = x(!1), Z = x(!1),
|
|
255
|
+
}), c = x({ x: 0, y: 0, scale: 1 }), B = x(!1), Q = x(!1), Z = x(!1), ee = a(() => {
|
|
256
256
|
if (!n.fitToCountries || !n.countries.length || !r.value || !w.value) return null;
|
|
257
257
|
let e = 1 / 0, t = 1 / 0, o = -1 / 0, l = -1 / 0;
|
|
258
258
|
if (n.countries.forEach((p) => {
|
|
@@ -262,8 +262,8 @@ const it = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"],
|
|
|
262
262
|
}
|
|
263
263
|
const y = O[p.id];
|
|
264
264
|
if (!y) return;
|
|
265
|
-
const
|
|
266
|
-
|
|
265
|
+
const ae = 2 * y.cx - y.xMax, ue = 2 * y.cy - y.yMax;
|
|
266
|
+
ae < e && (e = ae), ue < t && (t = ue), y.xMax > o && (o = y.xMax), y.yMax > l && (l = y.yMax);
|
|
267
267
|
}), !Number.isFinite(e)) return null;
|
|
268
268
|
const u = Math.max(0, n.fitPadding), s = Math.max(1, o - e) * (1 + u * 2), i = Math.max(1, l - t) * (1 + u * 2), d = Math.min(r.value / s, w.value / i), V = f.value * n.minZoom, I = f.value * n.maxZoom, U = Math.max(V, Math.min(I, d)), We = (e + o) / 2, Ve = (t + l) / 2;
|
|
269
269
|
return {
|
|
@@ -271,7 +271,7 @@ const it = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"],
|
|
|
271
271
|
y: w.value / 2 - Ve * U,
|
|
272
272
|
scale: U
|
|
273
273
|
};
|
|
274
|
-
}), ge = a(() =>
|
|
274
|
+
}), ge = a(() => ee.value ?? J.value), F = a(() => m.value ? we.value ?? ee.value ?? J.value : c.value);
|
|
275
275
|
Y(ge, (e) => {
|
|
276
276
|
m.value || Z.value || (c.value = e);
|
|
277
277
|
}, { immediate: !0 }), Y(() => n.countries, () => {
|
|
@@ -294,12 +294,12 @@ const it = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"],
|
|
|
294
294
|
return n.countries.forEach((t) => e.set(t.id, t)), e;
|
|
295
295
|
});
|
|
296
296
|
function _e(e) {
|
|
297
|
-
return H.value.has(e) || !!
|
|
297
|
+
return H.value.has(e) || !!re[e];
|
|
298
298
|
}
|
|
299
299
|
function z(e) {
|
|
300
300
|
return _e(e);
|
|
301
301
|
}
|
|
302
|
-
const P = N.colors["eco-green"], Ce = [P[1], P[2], P[3], P[4]],
|
|
302
|
+
const P = N.colors["eco-green"], Ce = [P[1], P[2], P[3], P[4]], te = a(() => n.highlightColor ?? P.DEFAULT), ke = a(() => n.baseColor ?? N.colors.gray[200]), Se = N.colors.gray[300];
|
|
303
303
|
function Pe(e) {
|
|
304
304
|
if (e == null || e < n.loanCountTiers[0]) return null;
|
|
305
305
|
for (let t = n.loanCountTiers.length - 1; t >= 0; t -= 1)
|
|
@@ -314,7 +314,7 @@ const it = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"],
|
|
|
314
314
|
}
|
|
315
315
|
function Te(e) {
|
|
316
316
|
const t = H.value.get(e), o = t ? Pe(t.loanCount) : null, l = _.value === e && z(e);
|
|
317
|
-
return
|
|
317
|
+
return ye.value.has(e) ? te.value : l ? o ? te.value : Se : o ?? ke.value;
|
|
318
318
|
}
|
|
319
319
|
function Ne(e) {
|
|
320
320
|
m.value || z(e) && (_.value = e);
|
|
@@ -344,7 +344,7 @@ const it = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"],
|
|
|
344
344
|
yMin: 2 * u - i
|
|
345
345
|
};
|
|
346
346
|
}
|
|
347
|
-
function
|
|
347
|
+
function oe(e) {
|
|
348
348
|
const t = De(e, !0);
|
|
349
349
|
if (!t) return null;
|
|
350
350
|
const o = F.value, l = { "--kv-simple-map-popup-offset": `${n.popupOffset}px` };
|
|
@@ -367,20 +367,20 @@ const it = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"],
|
|
|
367
367
|
}
|
|
368
368
|
};
|
|
369
369
|
}
|
|
370
|
-
function
|
|
370
|
+
function ne(e) {
|
|
371
371
|
return !!e.name || e.loanCount != null;
|
|
372
372
|
}
|
|
373
373
|
const v = a(() => {
|
|
374
374
|
if (m.value && j.value >= 0) {
|
|
375
375
|
const e = n.countries[j.value];
|
|
376
|
-
if (!e || !G.value && !
|
|
377
|
-
const t =
|
|
376
|
+
if (!e || !G.value && !ne(e)) return null;
|
|
377
|
+
const t = oe(e);
|
|
378
378
|
return t ? { country: e, ...t } : null;
|
|
379
379
|
}
|
|
380
380
|
if (!m.value && _.value) {
|
|
381
|
-
const e = _.value, t = H.value.get(e) ?? { id: e, name:
|
|
382
|
-
if (!G.value && !
|
|
383
|
-
const o =
|
|
381
|
+
const e = _.value, t = H.value.get(e) ?? { id: e, name: re[e] };
|
|
382
|
+
if (!G.value && !ne(t)) return null;
|
|
383
|
+
const o = oe(t);
|
|
384
384
|
return o ? { country: t, ...o } : null;
|
|
385
385
|
}
|
|
386
386
|
return null;
|
|
@@ -409,10 +409,10 @@ const it = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"],
|
|
|
409
409
|
}
|
|
410
410
|
const Ze = a(() => n.autoplay && !m.value);
|
|
411
411
|
function Ie() {
|
|
412
|
-
A.value = !1,
|
|
412
|
+
A.value = !1, xe();
|
|
413
413
|
}
|
|
414
414
|
const Le = a(() => !n.allowDragging || m.value ? "default" : B.value ? "grabbing" : "grab"), Oe = a(() => c.value.scale < f.value * n.maxZoom - 1e-3), Fe = a(() => c.value.scale > f.value * n.minZoom + 1e-3);
|
|
415
|
-
function
|
|
415
|
+
function le(e) {
|
|
416
416
|
const t = c.value, o = f.value * n.minZoom, l = f.value * n.maxZoom, u = Math.min(l, Math.max(o, t.scale + e * f.value));
|
|
417
417
|
if (Math.abs(u - t.scale) < 1e-6) return;
|
|
418
418
|
Z.value = !0;
|
|
@@ -424,10 +424,10 @@ const it = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"],
|
|
|
424
424
|
};
|
|
425
425
|
}
|
|
426
426
|
function He() {
|
|
427
|
-
|
|
427
|
+
le(n.zoomStep);
|
|
428
428
|
}
|
|
429
429
|
function ze() {
|
|
430
|
-
|
|
430
|
+
le(-n.zoomStep);
|
|
431
431
|
}
|
|
432
432
|
return Xe(() => {
|
|
433
433
|
q(), typeof ResizeObserver < "u" && E.value && (S = new ResizeObserver(q), S.observe(E.value)), requestAnimationFrame(() => {
|
|
@@ -441,7 +441,7 @@ const it = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"],
|
|
|
441
441
|
ref_key: "rootRef",
|
|
442
442
|
ref: E,
|
|
443
443
|
class: "kv-simple-map tw-relative tw-block tw-overflow-hidden",
|
|
444
|
-
style: $(
|
|
444
|
+
style: $(pe.value)
|
|
445
445
|
}, [
|
|
446
446
|
M("div", {
|
|
447
447
|
class: "kv-simple-map__clip tw-absolute tw-inset-0 tw-overflow-hidden",
|
|
@@ -526,8 +526,8 @@ const it = ["viewBox"], rt = ["d", "fill", "onPointerenter", "onPointerleave"],
|
|
|
526
526
|
country: v.value.country
|
|
527
527
|
}, () => [
|
|
528
528
|
M("div", vt, [
|
|
529
|
-
v.value.country.name ? (h(), b("div", dt,
|
|
530
|
-
v.value.country.loanCount != null ? (h(), b("div", yt,
|
|
529
|
+
v.value.country.name ? (h(), b("div", dt, ie(v.value.country.name), 1)) : T("", !0),
|
|
530
|
+
v.value.country.loanCount != null ? (h(), b("div", yt, ie(Ee(v.value.country.loanCount)), 1)) : T("", !0)
|
|
531
531
|
])
|
|
532
532
|
], !0)
|
|
533
533
|
])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kiva/kv-components",
|
|
3
|
-
"version": "8.13.
|
|
3
|
+
"version": "8.13.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -125,5 +125,5 @@
|
|
|
125
125
|
"embla-carousel-fade",
|
|
126
126
|
"popper.js"
|
|
127
127
|
],
|
|
128
|
-
"gitHead": "
|
|
128
|
+
"gitHead": "351df7e5ef5fcaff1a4f99394321c549da15a435"
|
|
129
129
|
}
|