@ogc-maps/storybook-components 0.2.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.
- package/dist/BasemapSwitcher-BW7lyZ2Y.js +43 -0
- package/dist/CollapsibleControl-Dz11KBrL.js +53 -0
- package/dist/CoordinateDisplay-PxPmVjpm.js +47 -0
- package/dist/LayerPanel-K00X2QUj.js +83 -0
- package/dist/Legend-D4cc1JzQ.js +94 -0
- package/dist/SearchPanel-CFVQV6JJ.js +135 -0
- package/dist/components/BasemapSwitcher/index.d.ts +2 -0
- package/dist/components/BasemapSwitcher/index.js +4 -0
- package/dist/components/CollapsibleControl/index.d.ts +2 -0
- package/dist/components/CollapsibleControl/index.js +4 -0
- package/dist/components/CoordinateDisplay/index.d.ts +2 -0
- package/dist/components/CoordinateDisplay/index.js +6 -0
- package/dist/components/LayerPanel/index.d.ts +2 -0
- package/dist/components/LayerPanel/index.js +4 -0
- package/dist/components/Legend/index.d.ts +2 -0
- package/dist/components/Legend/index.js +4 -0
- package/dist/components/SearchPanel/index.d.ts +2 -0
- package/dist/components/SearchPanel/index.js +4 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +12 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +47 -0
- package/dist/ogcApi-BuXSs9i0.js +48 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.js +2821 -0
- package/dist/src/components/BasemapSwitcher/BasemapSwitcher.d.ts +9 -0
- package/dist/src/components/BasemapSwitcher/BasemapSwitcher.d.ts.map +1 -0
- package/dist/src/components/BasemapSwitcher/index.d.ts +3 -0
- package/dist/src/components/BasemapSwitcher/index.d.ts.map +1 -0
- package/dist/src/components/CollapsibleControl/CollapsibleControl.d.ts +31 -0
- package/dist/src/components/CollapsibleControl/CollapsibleControl.d.ts.map +1 -0
- package/dist/src/components/CollapsibleControl/index.d.ts +3 -0
- package/dist/src/components/CollapsibleControl/index.d.ts.map +1 -0
- package/dist/src/components/CoordinateDisplay/CoordinateDisplay.d.ts +26 -0
- package/dist/src/components/CoordinateDisplay/CoordinateDisplay.d.ts.map +1 -0
- package/dist/src/components/CoordinateDisplay/index.d.ts +2 -0
- package/dist/src/components/CoordinateDisplay/index.d.ts.map +1 -0
- package/dist/src/components/LayerPanel/LayerPanel.d.ts +10 -0
- package/dist/src/components/LayerPanel/LayerPanel.d.ts.map +1 -0
- package/dist/src/components/LayerPanel/index.d.ts +3 -0
- package/dist/src/components/LayerPanel/index.d.ts.map +1 -0
- package/dist/src/components/Legend/Legend.d.ts +8 -0
- package/dist/src/components/Legend/Legend.d.ts.map +1 -0
- package/dist/src/components/Legend/index.d.ts +3 -0
- package/dist/src/components/Legend/index.d.ts.map +1 -0
- package/dist/src/components/SearchPanel/SearchPanel.d.ts +11 -0
- package/dist/src/components/SearchPanel/SearchPanel.d.ts.map +1 -0
- package/dist/src/components/SearchPanel/index.d.ts +3 -0
- package/dist/src/components/SearchPanel/index.d.ts.map +1 -0
- package/dist/src/components/index.d.ts +13 -0
- package/dist/src/components/index.d.ts.map +1 -0
- package/dist/src/hooks/index.d.ts +7 -0
- package/dist/src/hooks/index.d.ts.map +1 -0
- package/dist/src/hooks/useOgcCollections.d.ts +13 -0
- package/dist/src/hooks/useOgcCollections.d.ts.map +1 -0
- package/dist/src/hooks/useOgcFeatures.d.ts +17 -0
- package/dist/src/hooks/useOgcFeatures.d.ts.map +1 -0
- package/dist/src/main.d.ts +6 -0
- package/dist/src/main.d.ts.map +1 -0
- package/dist/src/schemas/config.d.ts +1510 -0
- package/dist/src/schemas/config.d.ts.map +1 -0
- package/dist/src/schemas/index.d.ts +2 -0
- package/dist/src/schemas/index.d.ts.map +1 -0
- package/dist/src/types/index.d.ts +23 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/index.d.ts.map +1 -0
- package/dist/src/utils/ogcApi.d.ts +100 -0
- package/dist/src/utils/ogcApi.d.ts.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +21 -0
- package/dist/useOgcFeatures-CmJxErv4.js +44 -0
- package/package.json +86 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as a, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
function l({
|
|
3
|
+
basemaps: u,
|
|
4
|
+
activeBasemapId: r,
|
|
5
|
+
onSelect: m,
|
|
6
|
+
className: p
|
|
7
|
+
}) {
|
|
8
|
+
return /* @__PURE__ */ a(
|
|
9
|
+
"div",
|
|
10
|
+
{
|
|
11
|
+
className: `mapui:flex mapui:gap-2 mapui:flex-wrap ${p ?? ""}`,
|
|
12
|
+
role: "group",
|
|
13
|
+
"aria-label": "Basemap selection",
|
|
14
|
+
children: u.map((i) => {
|
|
15
|
+
const e = i.id === r;
|
|
16
|
+
return /* @__PURE__ */ t(
|
|
17
|
+
"button",
|
|
18
|
+
{
|
|
19
|
+
type: "button",
|
|
20
|
+
onClick: () => m(i.id),
|
|
21
|
+
"aria-pressed": e,
|
|
22
|
+
className: `mapui:flex mapui:flex-col mapui:items-center mapui:gap-1 mapui:rounded-md mapui:border-2 mapui:px-3 mapui:py-2 mapui:text-sm mapui:font-medium mapui:cursor-pointer mapui:transition-colors ${e ? "mapui:border-blue-500 mapui:bg-blue-50 mapui:text-blue-700" : "mapui:border-gray-200 mapui:bg-white mapui:text-gray-700 hover:mapui:border-gray-300 hover:mapui:bg-gray-50"}`,
|
|
23
|
+
children: [
|
|
24
|
+
i.thumbnail && /* @__PURE__ */ a(
|
|
25
|
+
"img",
|
|
26
|
+
{
|
|
27
|
+
src: i.thumbnail,
|
|
28
|
+
alt: "",
|
|
29
|
+
className: "mapui:h-12 mapui:w-16 mapui:rounded mapui:object-cover"
|
|
30
|
+
}
|
|
31
|
+
),
|
|
32
|
+
/* @__PURE__ */ a("span", { children: i.label })
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
i.id
|
|
36
|
+
);
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
l as B
|
|
43
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsxs as e, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useState as h } from "react";
|
|
3
|
+
import { LuX as f } from "react-icons/lu";
|
|
4
|
+
function x({
|
|
5
|
+
icon: t,
|
|
6
|
+
label: i,
|
|
7
|
+
defaultCollapsed: l = !0,
|
|
8
|
+
collapsed: p,
|
|
9
|
+
onToggle: u,
|
|
10
|
+
children: o,
|
|
11
|
+
className: n = ""
|
|
12
|
+
}) {
|
|
13
|
+
const [c, d] = h(l), m = p !== void 0 ? p : c, s = () => {
|
|
14
|
+
const r = !m;
|
|
15
|
+
u ? u(r) : d(r);
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ e("div", { className: `mapui:relative mapui:w-10 mapui:h-10 ${n}`, children: [
|
|
18
|
+
/* @__PURE__ */ a(
|
|
19
|
+
"button",
|
|
20
|
+
{
|
|
21
|
+
type: "button",
|
|
22
|
+
onClick: s,
|
|
23
|
+
title: i,
|
|
24
|
+
"aria-label": i,
|
|
25
|
+
className: `mapui:flex mapui:items-center mapui:justify-center mapui:w-10 mapui:h-10 mapui:bg-white mapui:rounded mapui:shadow-md hover:mapui:bg-gray-50 mapui:transition-colors ${m ? "" : "mapui:opacity-0 mapui:pointer-events-none"}`,
|
|
26
|
+
children: /* @__PURE__ */ a(t, { size: 20, className: "mapui:text-gray-700" })
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
!m && /* @__PURE__ */ e("div", { className: "mapui:absolute mapui:top-0 mapui:right-full mapui:mr-2 mapui:z-10 mapui:bg-white mapui:rounded-lg mapui:shadow-lg mapui:overflow-hidden", children: [
|
|
30
|
+
/* @__PURE__ */ e("div", { className: "mapui:flex mapui:items-center mapui:justify-between mapui:p-2 mapui:border-b mapui:border-gray-200", children: [
|
|
31
|
+
/* @__PURE__ */ e("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
|
|
32
|
+
/* @__PURE__ */ a(t, { size: 18, className: "mapui:text-gray-700" }),
|
|
33
|
+
/* @__PURE__ */ a("span", { className: "mapui:text-sm mapui:font-medium mapui:text-gray-700", children: i })
|
|
34
|
+
] }),
|
|
35
|
+
/* @__PURE__ */ a(
|
|
36
|
+
"button",
|
|
37
|
+
{
|
|
38
|
+
type: "button",
|
|
39
|
+
onClick: s,
|
|
40
|
+
title: `Collapse ${i}`,
|
|
41
|
+
"aria-label": `Collapse ${i}`,
|
|
42
|
+
className: "mapui:flex mapui:items-center mapui:justify-center mapui:w-6 mapui:h-6 mapui:rounded hover:mapui:bg-gray-100 mapui:transition-colors",
|
|
43
|
+
children: /* @__PURE__ */ a(f, { size: 16, className: "mapui:text-gray-600" })
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
] }),
|
|
47
|
+
/* @__PURE__ */ a("div", { children: o })
|
|
48
|
+
] })
|
|
49
|
+
] });
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
x as C
|
|
53
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsxs as f, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
function h(t, e) {
|
|
3
|
+
return `${t.toFixed(6)}, ${e.toFixed(6)}`;
|
|
4
|
+
}
|
|
5
|
+
function $(t, e) {
|
|
6
|
+
const a = (i, n, m) => {
|
|
7
|
+
const r = i >= 0 ? n : m, s = Math.abs(i), c = Math.floor(s), l = (s - c) * 60, p = Math.floor(l), x = ((l - p) * 60).toFixed(1);
|
|
8
|
+
return `${c}°${p}'${x}"${r}`;
|
|
9
|
+
}, o = a(t, "N", "S"), u = a(e, "E", "W");
|
|
10
|
+
return `${o} ${u}`;
|
|
11
|
+
}
|
|
12
|
+
function C({
|
|
13
|
+
latitude: t,
|
|
14
|
+
longitude: e,
|
|
15
|
+
activeFormat: a,
|
|
16
|
+
formats: o,
|
|
17
|
+
onFormatChange: u,
|
|
18
|
+
className: i = ""
|
|
19
|
+
}) {
|
|
20
|
+
const n = o.find((r) => r.id === a), m = () => {
|
|
21
|
+
const s = (o.findIndex((c) => c.id === a) + 1) % o.length;
|
|
22
|
+
u(o[s].id);
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ f(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
className: `mapui:bg-black/60 mapui:text-white mapui:text-xs mapui:px-3 mapui:py-1 mapui:flex mapui:items-center mapui:gap-2 mapui:rounded ${i}`,
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ d(
|
|
30
|
+
"button",
|
|
31
|
+
{
|
|
32
|
+
onClick: m,
|
|
33
|
+
className: "mapui:text-blue-300 hover:mapui:text-blue-200 mapui:cursor-pointer mapui:border-none mapui:bg-transparent mapui:p-0",
|
|
34
|
+
title: "Click to cycle coordinate format",
|
|
35
|
+
children: (n == null ? void 0 : n.label) ?? "Unknown"
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
/* @__PURE__ */ d("span", { className: "mapui:font-mono", children: t !== null && e !== null && n ? n.format(t, e) : "—" })
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
C,
|
|
45
|
+
h as a,
|
|
46
|
+
$ as f
|
|
47
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsxs as o, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g, useCallback as u } from "react";
|
|
3
|
+
function w({
|
|
4
|
+
layers: l,
|
|
5
|
+
activeLayerIds: f,
|
|
6
|
+
onToggleVisibility: v,
|
|
7
|
+
onReorder: i,
|
|
8
|
+
className: x = ""
|
|
9
|
+
}) {
|
|
10
|
+
const [n, r] = g(null), [h, m] = g(null), D = u(
|
|
11
|
+
(a, e) => {
|
|
12
|
+
r(e), a.dataTransfer.effectAllowed = "move", a.dataTransfer.setData("text/plain", e);
|
|
13
|
+
},
|
|
14
|
+
[]
|
|
15
|
+
), b = u(
|
|
16
|
+
(a, e) => {
|
|
17
|
+
a.preventDefault(), a.dataTransfer.dropEffect = "move", m(e);
|
|
18
|
+
},
|
|
19
|
+
[]
|
|
20
|
+
), N = u(() => {
|
|
21
|
+
m(null);
|
|
22
|
+
}, []), O = u(
|
|
23
|
+
(a, e) => {
|
|
24
|
+
if (a.preventDefault(), m(null), r(null), !i || !n || n === e) return;
|
|
25
|
+
const p = l.map((L) => L.id), c = p.indexOf(n), t = p.indexOf(e);
|
|
26
|
+
if (c === -1 || t === -1) return;
|
|
27
|
+
const d = [...p];
|
|
28
|
+
d.splice(c, 1), d.splice(t, 0, n), i(d);
|
|
29
|
+
},
|
|
30
|
+
[n, l, i]
|
|
31
|
+
), I = u(() => {
|
|
32
|
+
r(null), m(null);
|
|
33
|
+
}, []);
|
|
34
|
+
return /* @__PURE__ */ o("div", { className: `mapui:flex mapui:flex-col mapui:gap-1 ${x}`.trim(), children: [
|
|
35
|
+
/* @__PURE__ */ s("h3", { className: "mapui:m-0 mapui:mb-2 mapui:text-sm mapui:font-semibold mapui:text-gray-700", children: "Layers" }),
|
|
36
|
+
/* @__PURE__ */ s("ul", { className: "mapui:m-0 mapui:list-none mapui:p-0", children: l.map((a) => {
|
|
37
|
+
const e = f.includes(a.id), p = n === a.id, c = h === a.id;
|
|
38
|
+
return /* @__PURE__ */ o(
|
|
39
|
+
"li",
|
|
40
|
+
{
|
|
41
|
+
draggable: !!i,
|
|
42
|
+
onDragStart: i ? (t) => D(t, a.id) : void 0,
|
|
43
|
+
onDragOver: i ? (t) => b(t, a.id) : void 0,
|
|
44
|
+
onDragLeave: i ? N : void 0,
|
|
45
|
+
onDrop: i ? (t) => O(t, a.id) : void 0,
|
|
46
|
+
onDragEnd: i ? I : void 0,
|
|
47
|
+
className: [
|
|
48
|
+
"mapui:flex mapui:items-center mapui:gap-2 mapui:rounded mapui:px-2 mapui:py-1.5",
|
|
49
|
+
"mapui:select-none mapui:transition-colors",
|
|
50
|
+
c ? "mapui:bg-blue-100" : "mapui:bg-transparent hover:mapui:bg-gray-100",
|
|
51
|
+
p ? "mapui:opacity-50" : "mapui:opacity-100"
|
|
52
|
+
].join(" "),
|
|
53
|
+
children: [
|
|
54
|
+
i && /* @__PURE__ */ s(
|
|
55
|
+
"span",
|
|
56
|
+
{
|
|
57
|
+
className: "mapui:cursor-grab mapui:text-gray-400 active:mapui:cursor-grabbing",
|
|
58
|
+
"aria-hidden": "true",
|
|
59
|
+
children: "⠿"
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
/* @__PURE__ */ o("label", { className: "mapui:flex mapui:flex-1 mapui:cursor-pointer mapui:items-center mapui:gap-2", children: [
|
|
63
|
+
/* @__PURE__ */ s(
|
|
64
|
+
"input",
|
|
65
|
+
{
|
|
66
|
+
type: "checkbox",
|
|
67
|
+
checked: e,
|
|
68
|
+
onChange: () => v(a.id),
|
|
69
|
+
className: "mapui:h-4 mapui:w-4 mapui:cursor-pointer mapui:accent-blue-600"
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
/* @__PURE__ */ s("span", { className: "mapui:text-sm mapui:text-gray-800", children: a.label })
|
|
73
|
+
] })
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
a.id
|
|
77
|
+
);
|
|
78
|
+
}) })
|
|
79
|
+
] });
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
w as L
|
|
83
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { jsxs as m, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
function t(i) {
|
|
3
|
+
switch (i.type) {
|
|
4
|
+
case "fill":
|
|
5
|
+
return i.paint["fill-color"];
|
|
6
|
+
case "line":
|
|
7
|
+
return i.paint["line-color"];
|
|
8
|
+
case "circle":
|
|
9
|
+
return i.paint["circle-color"];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function o(i) {
|
|
13
|
+
switch (i.type) {
|
|
14
|
+
case "fill":
|
|
15
|
+
return "square";
|
|
16
|
+
case "line":
|
|
17
|
+
return "line";
|
|
18
|
+
case "circle":
|
|
19
|
+
return "circle";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function d(i) {
|
|
23
|
+
return i.style ? [
|
|
24
|
+
{
|
|
25
|
+
label: i.label,
|
|
26
|
+
color: t(i.style),
|
|
27
|
+
shape: o(i.style)
|
|
28
|
+
}
|
|
29
|
+
] : null;
|
|
30
|
+
}
|
|
31
|
+
function s({ color: i, shape: p }) {
|
|
32
|
+
const n = p ?? "square";
|
|
33
|
+
return n === "circle" ? /* @__PURE__ */ e(
|
|
34
|
+
"span",
|
|
35
|
+
{
|
|
36
|
+
className: "mapui:inline-block mapui:h-3 mapui:w-3 mapui:rounded-full mapui:shrink-0",
|
|
37
|
+
style: { backgroundColor: i }
|
|
38
|
+
}
|
|
39
|
+
) : n === "line" ? /* @__PURE__ */ e(
|
|
40
|
+
"span",
|
|
41
|
+
{
|
|
42
|
+
className: "mapui:inline-block mapui:h-0.5 mapui:w-4 mapui:rounded-full mapui:shrink-0",
|
|
43
|
+
style: { backgroundColor: i }
|
|
44
|
+
}
|
|
45
|
+
) : /* @__PURE__ */ e(
|
|
46
|
+
"span",
|
|
47
|
+
{
|
|
48
|
+
className: "mapui:inline-block mapui:h-3 mapui:w-3 mapui:rounded-sm mapui:shrink-0",
|
|
49
|
+
style: { backgroundColor: i }
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
function g({ layers: i, visibleLayerIds: p, className: n }) {
|
|
54
|
+
const r = i.filter((a) => p.includes(a.id)).map((a) => {
|
|
55
|
+
var u;
|
|
56
|
+
const l = ((u = a.legend) == null ? void 0 : u.entries) ?? d(a);
|
|
57
|
+
return l ? { layer: a, entries: l } : null;
|
|
58
|
+
}).filter(Boolean);
|
|
59
|
+
return r.length === 0 ? null : /* @__PURE__ */ m(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
className: `mapui:rounded-lg mapui:bg-white mapui:p-3 mapui:shadow-md mapui:text-sm${n ? ` ${n}` : ""}`,
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ e("h3", { className: "mapui:m-0 mapui:mb-2 mapui:text-xs mapui:font-semibold mapui:uppercase mapui:tracking-wide mapui:text-gray-500", children: "Legend" }),
|
|
65
|
+
/* @__PURE__ */ e("ul", { className: "mapui:m-0 mapui:list-none mapui:space-y-2 mapui:p-0", children: r.map(({ layer: a, entries: l }) => /* @__PURE__ */ e("li", { children: l.length === 1 ? /* @__PURE__ */ m("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
|
|
66
|
+
/* @__PURE__ */ e(
|
|
67
|
+
s,
|
|
68
|
+
{
|
|
69
|
+
color: l[0].color,
|
|
70
|
+
shape: l[0].shape
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ e("span", { className: "mapui:text-gray-700", children: l[0].label })
|
|
74
|
+
] }) : /* @__PURE__ */ m("div", { children: [
|
|
75
|
+
/* @__PURE__ */ e("div", { className: "mapui:mb-1 mapui:text-xs mapui:font-medium mapui:text-gray-600", children: a.label }),
|
|
76
|
+
/* @__PURE__ */ e("ul", { className: "mapui:m-0 mapui:list-none mapui:space-y-1 mapui:p-0 mapui:pl-1", children: l.map((u, c) => /* @__PURE__ */ m(
|
|
77
|
+
"li",
|
|
78
|
+
{
|
|
79
|
+
className: "mapui:flex mapui:items-center mapui:gap-2",
|
|
80
|
+
children: [
|
|
81
|
+
/* @__PURE__ */ e(s, { color: u.color, shape: u.shape }),
|
|
82
|
+
/* @__PURE__ */ e("span", { className: "mapui:text-gray-700", children: u.label })
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
`${u.label}-${c}`
|
|
86
|
+
)) })
|
|
87
|
+
] }) }, a.id)) })
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
export {
|
|
93
|
+
g as L
|
|
94
|
+
};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { jsxs as n, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as x, useState as C, useEffect as Q, useCallback as l } from "react";
|
|
3
|
+
import { b as $ } from "./ogcApi-BuXSs9i0.js";
|
|
4
|
+
function E({
|
|
5
|
+
layers: c,
|
|
6
|
+
sources: d = [],
|
|
7
|
+
activeFilters: g,
|
|
8
|
+
onFilterChange: s,
|
|
9
|
+
onClearFilters: y,
|
|
10
|
+
className: b = ""
|
|
11
|
+
}) {
|
|
12
|
+
const o = x(
|
|
13
|
+
() => c.filter((e) => {
|
|
14
|
+
var i;
|
|
15
|
+
return (i = e.search) == null ? void 0 : i.fields.length;
|
|
16
|
+
}),
|
|
17
|
+
[c]
|
|
18
|
+
), [f, v] = C({}), N = x(
|
|
19
|
+
() => o.map((e) => e.id).join(","),
|
|
20
|
+
[o]
|
|
21
|
+
);
|
|
22
|
+
Q(() => {
|
|
23
|
+
o.forEach(async (e) => {
|
|
24
|
+
var a;
|
|
25
|
+
const i = d.find((p) => p.id === e.sourceId);
|
|
26
|
+
if (!i) return;
|
|
27
|
+
if ((a = e.search) == null ? void 0 : a.fields.some(
|
|
28
|
+
(p) => p.type === "select" && (!p.options || p.options.length === 0)
|
|
29
|
+
))
|
|
30
|
+
try {
|
|
31
|
+
const p = await $(i.url, e.collection);
|
|
32
|
+
v((m) => ({
|
|
33
|
+
...m,
|
|
34
|
+
[e.id]: p.properties
|
|
35
|
+
}));
|
|
36
|
+
} catch (p) {
|
|
37
|
+
console.error(`Failed to fetch queryables for layer ${e.id}`, p);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}, [N, o, d]);
|
|
41
|
+
const h = l(
|
|
42
|
+
(e, i, t) => {
|
|
43
|
+
s(e, i, t || void 0);
|
|
44
|
+
},
|
|
45
|
+
[s]
|
|
46
|
+
), S = l(
|
|
47
|
+
(e, i, t) => {
|
|
48
|
+
s(e, i, t === "" ? void 0 : Number(t));
|
|
49
|
+
},
|
|
50
|
+
[s]
|
|
51
|
+
), j = l(
|
|
52
|
+
(e, i, t) => {
|
|
53
|
+
s(e, i, t || void 0);
|
|
54
|
+
},
|
|
55
|
+
[s]
|
|
56
|
+
);
|
|
57
|
+
return o.length === 0 ? /* @__PURE__ */ n("div", { className: `mapui:flex mapui:flex-col mapui:gap-1 ${b}`.trim(), children: [
|
|
58
|
+
/* @__PURE__ */ r("h3", { className: "mapui:m-0 mapui:mb-2 mapui:text-sm mapui:font-semibold mapui:text-gray-700", children: "Search & Filter" }),
|
|
59
|
+
/* @__PURE__ */ r("p", { className: "mapui:m-0 mapui:text-xs mapui:text-gray-500", children: "No searchable layers configured." })
|
|
60
|
+
] }) : /* @__PURE__ */ n("div", { className: `mapui:flex mapui:flex-col mapui:gap-3 ${b}`.trim(), children: [
|
|
61
|
+
/* @__PURE__ */ r("h3", { className: "mapui:m-0 mapui:mb-2 mapui:text-sm mapui:font-semibold mapui:text-gray-700", children: "Search & Filter" }),
|
|
62
|
+
o.map((e) => {
|
|
63
|
+
const i = g[e.id] ?? {}, t = Object.values(i).some((a) => a !== void 0);
|
|
64
|
+
return /* @__PURE__ */ n("div", { className: "mapui:flex mapui:flex-col mapui:gap-2 mapui:border-b mapui:border-gray-100 mapui:pb-2 last:mapui:border-0", children: [
|
|
65
|
+
/* @__PURE__ */ n("div", { className: "mapui:flex mapui:items-center mapui:justify-between", children: [
|
|
66
|
+
/* @__PURE__ */ r("span", { className: "mapui:text-xs mapui:font-medium mapui:text-gray-600", children: e.label }),
|
|
67
|
+
t && /* @__PURE__ */ r(
|
|
68
|
+
"button",
|
|
69
|
+
{
|
|
70
|
+
type: "button",
|
|
71
|
+
onClick: () => y(e.id),
|
|
72
|
+
className: "mapui:cursor-pointer mapui:border-none mapui:bg-transparent mapui:p-0 mapui:text-xs mapui:text-blue-600 hover:mapui:text-blue-800",
|
|
73
|
+
children: "Clear"
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
] }),
|
|
77
|
+
e.search.fields.map((a) => {
|
|
78
|
+
const p = i[a.property];
|
|
79
|
+
let m = a.options;
|
|
80
|
+
if (a.type === "select" && (!m || m.length === 0)) {
|
|
81
|
+
const u = f[e.id];
|
|
82
|
+
u && u[a.property] && (m = u[a.property].enum);
|
|
83
|
+
}
|
|
84
|
+
return /* @__PURE__ */ n("div", { className: "mapui:flex mapui:flex-col mapui:gap-0.5", children: [
|
|
85
|
+
/* @__PURE__ */ r("label", { className: "mapui:text-xs mapui:text-gray-500", children: a.label }),
|
|
86
|
+
a.type === "text" && /* @__PURE__ */ r(
|
|
87
|
+
"input",
|
|
88
|
+
{
|
|
89
|
+
type: "text",
|
|
90
|
+
value: p ?? "",
|
|
91
|
+
placeholder: a.placeholder ?? "",
|
|
92
|
+
onChange: (u) => h(e.id, a.property, u.target.value),
|
|
93
|
+
className: "mapui:rounded mapui:border mapui:border-gray-300 mapui:px-2 mapui:py-1 mapui:text-sm mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500"
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
a.type === "number" && /* @__PURE__ */ r(
|
|
97
|
+
"input",
|
|
98
|
+
{
|
|
99
|
+
type: "number",
|
|
100
|
+
value: p ?? "",
|
|
101
|
+
placeholder: a.placeholder ?? "",
|
|
102
|
+
onChange: (u) => S(e.id, a.property, u.target.value),
|
|
103
|
+
className: "mapui:rounded mapui:border mapui:border-gray-300 mapui:px-2 mapui:py-1 mapui:text-sm mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500"
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
a.type === "datetime" && /* @__PURE__ */ r(
|
|
107
|
+
"input",
|
|
108
|
+
{
|
|
109
|
+
type: "datetime-local",
|
|
110
|
+
value: p ?? "",
|
|
111
|
+
onChange: (u) => h(e.id, a.property, u.target.value),
|
|
112
|
+
className: "mapui:rounded mapui:border mapui:border-gray-300 mapui:px-2 mapui:py-1 mapui:text-sm mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500"
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
a.type === "select" && /* @__PURE__ */ n(
|
|
116
|
+
"select",
|
|
117
|
+
{
|
|
118
|
+
value: p ?? "",
|
|
119
|
+
onChange: (u) => j(e.id, a.property, u.target.value),
|
|
120
|
+
className: "mapui:rounded mapui:border mapui:border-gray-300 mapui:px-2 mapui:py-1 mapui:text-sm mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500",
|
|
121
|
+
children: [
|
|
122
|
+
/* @__PURE__ */ r("option", { value: "", children: a.placeholder ?? "Select..." }),
|
|
123
|
+
m == null ? void 0 : m.map((u) => /* @__PURE__ */ r("option", { value: u, children: u }, u))
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
] }, a.property);
|
|
128
|
+
})
|
|
129
|
+
] }, e.id);
|
|
130
|
+
})
|
|
131
|
+
] });
|
|
132
|
+
}
|
|
133
|
+
export {
|
|
134
|
+
E as S
|
|
135
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { u as t, a } from "../useOgcFeatures-CmJxErv4.js";
|
|
2
|
+
import { f as l, a as o, b as c, g as f, c as g, d as i } from "../ogcApi-BuXSs9i0.js";
|
|
3
|
+
export {
|
|
4
|
+
l as fetchCollections,
|
|
5
|
+
o as fetchFeatures,
|
|
6
|
+
c as fetchQueryables,
|
|
7
|
+
f as getFilteredVectorTileUrl,
|
|
8
|
+
g as getTileJsonUrl,
|
|
9
|
+
i as getVectorTileUrl,
|
|
10
|
+
t as useOgcCollections,
|
|
11
|
+
a as useOgcFeatures
|
|
12
|
+
};
|
package/dist/main.d.ts
ADDED
package/dist/main.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { B as o } from "./BasemapSwitcher-BW7lyZ2Y.js";
|
|
2
|
+
import { C as t } from "./CollapsibleControl-Dz11KBrL.js";
|
|
3
|
+
import { C as i, f as l, a as m } from "./CoordinateDisplay-PxPmVjpm.js";
|
|
4
|
+
import { L as S } from "./LayerPanel-K00X2QUj.js";
|
|
5
|
+
import { L as n } from "./Legend-D4cc1JzQ.js";
|
|
6
|
+
import { S as g } from "./SearchPanel-CFVQV6JJ.js";
|
|
7
|
+
import { u as p, a as d } from "./useOgcFeatures-CmJxErv4.js";
|
|
8
|
+
import { f as y, a as L, b as u, g as F, c as P, d as M } from "./ogcApi-BuXSs9i0.js";
|
|
9
|
+
import { BasemapConfigSchema as V, CirclePaintSchema as b, CircleStyleSchema as B, FillPaintSchema as D, FillStyleSchema as O, FilterConfigSchema as T, LayerConfigSchema as w, LegendConfigSchema as v, LegendEntrySchema as A, LinePaintSchema as E, LineStyleSchema as I, MapConfigSchema as J, OgcApiSourceSchema as Q, SearchConfigSchema as j, SearchFieldSchema as k, StyleConfigSchema as q, UIConfigSchema as z, ViewConfigSchema as G, safeValidateMapConfig as H, validateMapConfig as K } from "./schemas/index.js";
|
|
10
|
+
export {
|
|
11
|
+
V as BasemapConfigSchema,
|
|
12
|
+
o as BasemapSwitcher,
|
|
13
|
+
b as CirclePaintSchema,
|
|
14
|
+
B as CircleStyleSchema,
|
|
15
|
+
t as CollapsibleControl,
|
|
16
|
+
i as CoordinateDisplay,
|
|
17
|
+
D as FillPaintSchema,
|
|
18
|
+
O as FillStyleSchema,
|
|
19
|
+
T as FilterConfigSchema,
|
|
20
|
+
w as LayerConfigSchema,
|
|
21
|
+
S as LayerPanel,
|
|
22
|
+
n as Legend,
|
|
23
|
+
v as LegendConfigSchema,
|
|
24
|
+
A as LegendEntrySchema,
|
|
25
|
+
E as LinePaintSchema,
|
|
26
|
+
I as LineStyleSchema,
|
|
27
|
+
J as MapConfigSchema,
|
|
28
|
+
Q as OgcApiSourceSchema,
|
|
29
|
+
j as SearchConfigSchema,
|
|
30
|
+
k as SearchFieldSchema,
|
|
31
|
+
g as SearchPanel,
|
|
32
|
+
q as StyleConfigSchema,
|
|
33
|
+
z as UIConfigSchema,
|
|
34
|
+
G as ViewConfigSchema,
|
|
35
|
+
y as fetchCollections,
|
|
36
|
+
L as fetchFeatures,
|
|
37
|
+
u as fetchQueryables,
|
|
38
|
+
l as formatDMS,
|
|
39
|
+
m as formatDecimal,
|
|
40
|
+
F as getFilteredVectorTileUrl,
|
|
41
|
+
P as getTileJsonUrl,
|
|
42
|
+
M as getVectorTileUrl,
|
|
43
|
+
H as safeValidateMapConfig,
|
|
44
|
+
p as useOgcCollections,
|
|
45
|
+
d as useOgcFeatures,
|
|
46
|
+
K as validateMapConfig
|
|
47
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
function c(t) {
|
|
2
|
+
return t.endsWith("/") ? t.slice(0, -1) : t;
|
|
3
|
+
}
|
|
4
|
+
async function f(t) {
|
|
5
|
+
const n = await fetch(t);
|
|
6
|
+
if (!n.ok)
|
|
7
|
+
throw new Error(`OGC API request failed: ${n.status} ${n.statusText} (${t})`);
|
|
8
|
+
return n.json();
|
|
9
|
+
}
|
|
10
|
+
async function u(t) {
|
|
11
|
+
const n = `${c(t)}/collections?f=json`;
|
|
12
|
+
return (await f(n)).collections;
|
|
13
|
+
}
|
|
14
|
+
async function b(t, n, e = {}) {
|
|
15
|
+
var r;
|
|
16
|
+
const o = c(t), s = new URLSearchParams({ f: "geojson" });
|
|
17
|
+
if (e.limit != null && s.set("limit", String(e.limit)), e.offset != null && s.set("offset", String(e.offset)), e.bbox && s.set("bbox", e.bbox.join(",")), (r = e.properties) != null && r.length && s.set("properties", e.properties.join(",")), e.datetime && s.set("datetime", e.datetime), e.filter)
|
|
18
|
+
for (const [i, l] of Object.entries(e.filter))
|
|
19
|
+
s.set(i, String(l));
|
|
20
|
+
const a = `${o}/collections/${encodeURIComponent(n)}/items?${s}`;
|
|
21
|
+
return f(a);
|
|
22
|
+
}
|
|
23
|
+
async function d(t, n) {
|
|
24
|
+
const o = `${c(t)}/collections/${encodeURIComponent(n)}/queryables?f=json`;
|
|
25
|
+
return f(o);
|
|
26
|
+
}
|
|
27
|
+
function $(t, n, e = "WebMercatorQuad") {
|
|
28
|
+
return `${c(t)}/collections/${encodeURIComponent(n)}/tiles/${encodeURIComponent(e)}/tilejson.json`;
|
|
29
|
+
}
|
|
30
|
+
function m(t, n, e = "WebMercatorQuad") {
|
|
31
|
+
return `${c(t)}/collections/${encodeURIComponent(n)}/tiles/${encodeURIComponent(e)}/{z}/{x}/{y}`;
|
|
32
|
+
}
|
|
33
|
+
function U(t, n, e, o = "WebMercatorQuad") {
|
|
34
|
+
const a = `${c(t)}/collections/${encodeURIComponent(n)}/tiles/${encodeURIComponent(o)}/{z}/{x}/{y}`;
|
|
35
|
+
if (!e || Object.keys(e).length === 0) return a;
|
|
36
|
+
const r = new URLSearchParams();
|
|
37
|
+
for (const [i, l] of Object.entries(e))
|
|
38
|
+
r.set(i, String(l));
|
|
39
|
+
return `${a}?${r}`;
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
b as a,
|
|
43
|
+
d as b,
|
|
44
|
+
$ as c,
|
|
45
|
+
m as d,
|
|
46
|
+
u as f,
|
|
47
|
+
U as g
|
|
48
|
+
};
|