@inploi/plugin-job-search 8.5.5 → 8.6.0

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 (37) hide show
  1. package/README.md +56 -0
  2. package/cdn/index.js +69 -43
  3. package/cdn/maplibre-gl.js +62 -0
  4. package/cdn/style.css +1 -1
  5. package/dist/components/map.attribution.test.d.ts +1 -0
  6. package/dist/components/map.imports.test.d.ts +1 -0
  7. package/dist/components/map.mapbox.d.ts +11 -0
  8. package/dist/components/map.maplibre.d.ts +12 -0
  9. package/dist/components/map.types.d.ts +45 -0
  10. package/dist/index.cjs +2 -2
  11. package/dist/index.js +178 -174
  12. package/dist/job-search.api.d.ts +0 -2
  13. package/dist/job-search.d.ts +6 -2
  14. package/dist/lib/countries.d.ts +1 -5
  15. package/dist/lib/i18n.d.ts +21 -0
  16. package/dist/lib/map-attribution.d.ts +8 -0
  17. package/dist/lib/map-style.d.ts +6 -0
  18. package/dist/lib/map-style.test.d.ts +1 -0
  19. package/dist/lib/maplibre-cdn.d.ts +10 -0
  20. package/dist/lib/maplibre-cdn.test.d.ts +1 -0
  21. package/dist/map-2bc8a36b.js +254 -0
  22. package/dist/map-95c39b6f.cjs +2 -0
  23. package/dist/map-attribution-18e2dacf.cjs +26 -0
  24. package/dist/map-attribution-bc77dbf2.js +115 -0
  25. package/dist/{utils-984ac273.js → map-style-383e388c.js} +1486 -1543
  26. package/dist/map-style-9418e566.cjs +60 -0
  27. package/dist/{mapbox-gl-828213a2.cjs → mapbox-gl-588b9a28.cjs} +1 -1
  28. package/dist/{mapbox-gl-7594ce3a.js → mapbox-gl-8f9e2939.js} +1 -1
  29. package/dist/style/tokens.d.ts +1 -1
  30. package/dist/style.css +1 -1
  31. package/dist/utils.cjs +1 -1
  32. package/dist/utils.d.ts +2 -0
  33. package/dist/utils.js +11 -7
  34. package/package.json +5 -4
  35. package/dist/map-07c91c84.cjs +0 -1
  36. package/dist/map-31754467.js +0 -162
  37. package/dist/utils-47fd9aa4.cjs +0 -60
@@ -1,162 +0,0 @@
1
- import { u as q, A as f, d as x, a as z, y as w, b as a } from "./utils-984ac273.js";
2
- import "@inploi/sdk";
3
- const T = ({ config: t, mapData: h, onBoundsChange: _, autoFit: j }) => {
4
- const { t: y } = q(), C = f(null), c = f(null), m = f(!1), b = f(!0), [u, S] = x(null), [E, N] = x(), [R, I] = x(null), k = z(R, 250), M = f(null), { queryState: B, data: F } = h;
5
- if (w(() => {
6
- const e = C.current;
7
- if (!e)
8
- return;
9
- let l = !1, g = !1, i = !1;
10
- S(null), b.current = !0;
11
- const d = () => {
12
- const { width: r, height: o } = e.getBoundingClientRect();
13
- return !l && g && r > 0 && o > 0;
14
- }, s = async () => {
15
- if (!(i || c.current || !d())) {
16
- i = !0;
17
- try {
18
- const { default: r } = await import("./mapbox-gl-7594ce3a.js").then((v) => v.m);
19
- if (i = !1, !d())
20
- return;
21
- r.accessToken = t == null ? void 0 : t.accessToken;
22
- const o = new r.Map({
23
- container: e,
24
- style: (t == null ? void 0 : t.style) ?? "mapbox://styles/mapbox/light-v10",
25
- center: (t == null ? void 0 : t.defaultCenter) ?? [-0.13, 51.51],
26
- zoom: 3,
27
- attributionControl: !1,
28
- cooperativeGestures: !0
29
- });
30
- c.current = o, o.addControl(new r.NavigationControl()), o.addControl(new r.AttributionControl({ compact: !0 })), o.on("load", () => {
31
- l || S({ map: o, gl: r });
32
- }), o.on("move", (v) => {
33
- v.originalEvent && I(o.getBounds());
34
- }), n.disconnect(), p.disconnect();
35
- } catch (r) {
36
- l || N(r);
37
- }
38
- }
39
- }, n = new IntersectionObserver(
40
- (r) => {
41
- g = r.some((o) => o.isIntersecting), s();
42
- },
43
- { rootMargin: "200px" }
44
- ), p = new ResizeObserver(() => void s());
45
- return n.observe(e), p.observe(e), () => {
46
- var r;
47
- l = !0, n.disconnect(), p.disconnect(), (r = c.current) == null || r.remove(), c.current = null, m.current = !1;
48
- };
49
- }, [t]), w(() => {
50
- const e = k;
51
- if (!e)
52
- return;
53
- const l = [
54
- e.getSouthWest().lat.toFixed(2),
55
- e.getSouthWest().lng.toFixed(2),
56
- e.getNorthEast().lat.toFixed(2),
57
- e.getNorthEast().lng.toFixed(2)
58
- ].join(",");
59
- l !== M.current && (M.current = l, _({
60
- type: "bounds",
61
- sw: { lat: e.getSouthWest().lat, lng: e.getSouthWest().lng },
62
- ne: { lat: e.getNorthEast().lat, lng: e.getNorthEast().lng }
63
- }));
64
- }, [k, _]), w(() => {
65
- if (B !== "loaded" || !u || u.map !== c.current)
66
- return;
67
- const { map: e, gl: l } = u;
68
- (() => {
69
- const i = F.results.filter((s) => s.raw.coordinates).map((s) => ({
70
- type: "Feature",
71
- properties: { id: s.id },
72
- geometry: {
73
- type: "Point",
74
- coordinates: [s.raw.coordinates.lng, s.raw.coordinates.lat]
75
- }
76
- })), d = { type: "FeatureCollection", features: i };
77
- if (e.getSource("jobs") ? e.getSource("jobs").setData(d) : e.addSource("jobs", {
78
- type: "geojson",
79
- data: d,
80
- cluster: !0,
81
- clusterRadius: 40,
82
- clusterMaxZoom: 20
83
- }), m.current || (e.addLayer({
84
- id: "clusters",
85
- type: "circle",
86
- source: "jobs",
87
- filter: ["has", "point_count"],
88
- paint: {
89
- "circle-color": (t == null ? void 0 : t.pinColor) ?? "#0066ff",
90
- "circle-radius": ["step", ["get", "point_count"], 14, 10, 18, 50, 24]
91
- }
92
- }), e.addLayer({
93
- id: "cluster-count",
94
- type: "symbol",
95
- source: "jobs",
96
- filter: ["has", "point_count"],
97
- layout: {
98
- "text-field": "{point_count_abbreviated}",
99
- "text-font": ["DIN Offc Pro Medium", "Arial Unicode MS Bold"],
100
- "text-size": 12
101
- },
102
- paint: { "text-color": "#ffffff" }
103
- }), e.addLayer({
104
- id: "unclustered-point",
105
- type: "circle",
106
- source: "jobs",
107
- filter: ["!", ["has", "point_count"]],
108
- paint: {
109
- "circle-color": (t == null ? void 0 : t.pinColor) ?? "#0066ff",
110
- "circle-radius": 6,
111
- "circle-stroke-width": 1,
112
- "circle-stroke-color": "#ffffff"
113
- }
114
- }), e.on("mouseenter", "clusters", () => e.getCanvas().style.cursor = "pointer"), e.on("mouseleave", "clusters", () => e.getCanvas().style.cursor = ""), e.on("click", "clusters", (s) => {
115
- const n = e.queryRenderedFeatures(s.point, { layers: ["clusters"] });
116
- if (!n.length)
117
- return;
118
- const p = n[0].properties.cluster_id;
119
- e.getSource("jobs").getClusterExpansionZoom(p, (r, o) => {
120
- e.easeTo({ center: n[0].geometry.coordinates, zoom: o });
121
- });
122
- }), m.current = !0), (b.current || j) && i.length) {
123
- const s = new l.LngLatBounds();
124
- i.forEach((n) => {
125
- n.geometry.type === "Point" && s.extend(n.geometry.coordinates);
126
- }), e.fitBounds(s, { padding: 50, duration: 500 }), b.current = !1;
127
- }
128
- })();
129
- }, [t, B, F, j, u]), E)
130
- throw E;
131
- const L = (() => {
132
- switch (h.queryState) {
133
- case "loading":
134
- case "revalidating":
135
- return /* @__PURE__ */ a("span", { class: "animate-pulse", children: y("loading_jobs") });
136
- case "error":
137
- return /* @__PURE__ */ a("span", { class: "flex flex-col", style: "color: #e42d16;", children: y("map_jobs_error") });
138
- case "loaded":
139
- return h.data.pagination.has_more ? /* @__PURE__ */ a("span", { class: "flex flex-col", children: [
140
- /* @__PURE__ */ a("span", { class: "font-weight-job-heading", children: y("map_has_more_title") }),
141
- /* @__PURE__ */ a("span", { class: "text-style-job-card-info opacity-80", children: y("map_has_more_description") })
142
- ] }) : null;
143
- default:
144
- return null;
145
- }
146
- })();
147
- return /* @__PURE__ */ a("div", { class: "relative h-full w-full overflow-hidden", children: [
148
- /* @__PURE__ */ a("div", { ref: C, id: "ijs-map", class: "h-full w-full" }),
149
- !u && /* @__PURE__ */ a("div", { "aria-hidden": "true", class: "animate-skeleton bg-neutral-6 pointer-events-none absolute inset-0" }),
150
- L && /* @__PURE__ */ a("div", { class: "pointer-events-none absolute left-12 right-12 top-2 flex items-center justify-center", children: /* @__PURE__ */ a(
151
- "div",
152
- {
153
- class: "animate-selected-tag bg-app text-interactive-neutral-text border-section-weak-stroke text-style-job-card border-px rounded-input font-family-tag font-weight-tag pointer-events-none px-3 py-2 text-center shadow-sm",
154
- children: L
155
- },
156
- h.queryState
157
- ) })
158
- ] });
159
- };
160
- export {
161
- T as Map
162
- };