@ogc-maps/storybook-components 0.4.0 → 0.5.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/{ExportButton-D2xn4G74.js → ExportButton-CLsWoW4m.js} +17 -17
- package/dist/{LayerPanel-K00X2QUj.js → LayerPanel-BHpb8dbm.js} +17 -16
- package/dist/SearchPanel-DCY01Wa-.js +363 -0
- package/dist/components/ExportButton/index.js +1 -1
- package/dist/components/LayerPanel/LayerPanel.d.ts +2 -1
- package/dist/components/LayerPanel/LayerPanel.d.ts.map +1 -1
- package/dist/components/LayerPanel/index.js +1 -1
- package/dist/components/SearchPanel/AutocompleteInput.d.ts +12 -0
- package/dist/components/SearchPanel/AutocompleteInput.d.ts.map +1 -0
- package/dist/components/SearchPanel/DateRangeInput.d.ts +11 -0
- package/dist/components/SearchPanel/DateRangeInput.d.ts.map +1 -0
- package/dist/components/SearchPanel/NumberInput.d.ts +11 -0
- package/dist/components/SearchPanel/NumberInput.d.ts.map +1 -0
- package/dist/components/SearchPanel/SearchPanel.d.ts +8 -4
- package/dist/components/SearchPanel/SearchPanel.d.ts.map +1 -1
- package/dist/components/SearchPanel/index.js +1 -1
- package/dist/cql2-BaKDic7B.js +288 -0
- package/dist/hooks/index.d.ts +3 -2
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +31 -11
- package/dist/hooks/useCsvExport.d.ts +2 -1
- package/dist/hooks/useCsvExport.d.ts.map +1 -1
- package/dist/index-BLgVA46J.js +2854 -0
- package/dist/main.js +72 -48
- package/dist/schemas/config.d.ts +836 -64
- package/dist/schemas/config.d.ts.map +1 -1
- package/dist/schemas/index.js +21 -2822
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +17 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +20 -16
- package/dist/utils/__tests__/cql2.test.d.ts +2 -0
- package/dist/utils/__tests__/cql2.test.d.ts.map +1 -0
- package/dist/utils/cql2.d.ts +75 -0
- package/dist/utils/cql2.d.ts.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/ogcApi.d.ts +24 -7
- package/dist/utils/ogcApi.d.ts.map +1 -1
- package/package.json +4 -2
- package/dist/SearchPanel-CFVQV6JJ.js +0 -135
- package/dist/ogcApi-BuXSs9i0.js +0 -48
- package/dist/useCsvExport-wr7hy0P-.js +0 -101
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as p, jsxs as
|
|
1
|
+
import { jsx as p, jsxs as g } from "react/jsx-runtime";
|
|
2
2
|
import { useState as m, useRef as y, useEffect as E } from "react";
|
|
3
3
|
function H({
|
|
4
|
-
layers:
|
|
4
|
+
layers: e,
|
|
5
5
|
onExport: s,
|
|
6
6
|
loading: o = !1,
|
|
7
|
-
disabled:
|
|
7
|
+
disabled: f = !1,
|
|
8
8
|
className: l = ""
|
|
9
9
|
}) {
|
|
10
10
|
const [n, u] = m(!1), [h, x] = m(!1), [w, v] = m(void 0), t = y(null);
|
|
@@ -16,31 +16,31 @@ function H({
|
|
|
16
16
|
const b = 12;
|
|
17
17
|
v(d ? r.top - b : window.innerHeight - r.bottom - b);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function i(r) {
|
|
20
20
|
t.current && !t.current.contains(r.target) && u(!1);
|
|
21
21
|
}
|
|
22
|
-
return document.addEventListener("click",
|
|
22
|
+
return document.addEventListener("click", i), () => document.removeEventListener("click", i);
|
|
23
23
|
}, [n]);
|
|
24
|
-
const a =
|
|
24
|
+
const a = f || o || e.length === 0, c = [
|
|
25
25
|
"mapui:inline-flex mapui:items-center mapui:gap-1.5 mapui:rounded mapui:border mapui:border-gray-300",
|
|
26
26
|
"mapui:bg-white mapui:px-3 mapui:py-1.5 mapui:text-sm mapui:text-gray-700 mapui:transition-colors",
|
|
27
27
|
a ? "mapui:cursor-not-allowed mapui:opacity-50" : "mapui:cursor-pointer hover:mapui:bg-gray-50 hover:mapui:border-gray-400"
|
|
28
28
|
].join(" ");
|
|
29
|
-
return
|
|
29
|
+
return e.length === 1 ? /* @__PURE__ */ p(
|
|
30
30
|
"button",
|
|
31
31
|
{
|
|
32
32
|
className: `${c} ${l}`.trim(),
|
|
33
33
|
disabled: a,
|
|
34
|
-
onClick: () => !a && s(
|
|
35
|
-
children: o ? "Exporting..." : `Export ${
|
|
34
|
+
onClick: () => !a && s(e[0]),
|
|
35
|
+
children: o ? "Exporting..." : `Export ${e[0].label}`
|
|
36
36
|
}
|
|
37
|
-
) : /* @__PURE__ */
|
|
38
|
-
/* @__PURE__ */
|
|
37
|
+
) : /* @__PURE__ */ g("div", { ref: t, className: `mapui:relative mapui:inline-block ${l}`.trim(), children: [
|
|
38
|
+
/* @__PURE__ */ g(
|
|
39
39
|
"button",
|
|
40
40
|
{
|
|
41
41
|
className: c,
|
|
42
42
|
disabled: a,
|
|
43
|
-
onClick: () => !a && u((
|
|
43
|
+
onClick: () => !a && u((i) => !i),
|
|
44
44
|
"aria-haspopup": "listbox",
|
|
45
45
|
"aria-expanded": n,
|
|
46
46
|
children: [
|
|
@@ -53,20 +53,20 @@ function H({
|
|
|
53
53
|
"ul",
|
|
54
54
|
{
|
|
55
55
|
role: "listbox",
|
|
56
|
-
className: `mapui:absolute mapui:
|
|
56
|
+
className: `mapui:absolute mapui:right-0 mapui:z-10 mapui:min-w-[160px] mapui:overflow-y-auto mapui:rounded mapui:border mapui:border-gray-200 mapui:bg-white mapui:py-1 mapui:shadow-lg ${h ? "mapui:bottom-full mapui:mb-1" : "mapui:top-full mapui:mt-1"}`,
|
|
57
57
|
style: { maxHeight: w },
|
|
58
|
-
children:
|
|
58
|
+
children: e.map((i) => /* @__PURE__ */ p(
|
|
59
59
|
"li",
|
|
60
60
|
{
|
|
61
61
|
role: "option",
|
|
62
62
|
"aria-selected": !1,
|
|
63
63
|
className: "mapui:cursor-pointer mapui:px-3 mapui:py-1.5 mapui:text-sm mapui:text-gray-700 hover:mapui:bg-gray-100",
|
|
64
64
|
onClick: () => {
|
|
65
|
-
s(
|
|
65
|
+
s(i), u(!1);
|
|
66
66
|
},
|
|
67
|
-
children:
|
|
67
|
+
children: i.label
|
|
68
68
|
},
|
|
69
|
-
|
|
69
|
+
i.id
|
|
70
70
|
))
|
|
71
71
|
}
|
|
72
72
|
)
|
|
@@ -1,49 +1,50 @@
|
|
|
1
1
|
import { jsxs as o, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import { useState as g, useCallback as u } from "react";
|
|
3
|
-
function
|
|
3
|
+
function E({
|
|
4
4
|
layers: l,
|
|
5
5
|
activeLayerIds: f,
|
|
6
6
|
onToggleVisibility: v,
|
|
7
7
|
onReorder: i,
|
|
8
|
-
className: x = ""
|
|
8
|
+
className: x = "",
|
|
9
|
+
hideTitle: h
|
|
9
10
|
}) {
|
|
10
|
-
const [n, r] = g(null), [
|
|
11
|
+
const [n, r] = g(null), [D, m] = g(null), b = u(
|
|
11
12
|
(a, e) => {
|
|
12
13
|
r(e), a.dataTransfer.effectAllowed = "move", a.dataTransfer.setData("text/plain", e);
|
|
13
14
|
},
|
|
14
15
|
[]
|
|
15
|
-
),
|
|
16
|
+
), N = u(
|
|
16
17
|
(a, e) => {
|
|
17
18
|
a.preventDefault(), a.dataTransfer.dropEffect = "move", m(e);
|
|
18
19
|
},
|
|
19
20
|
[]
|
|
20
|
-
),
|
|
21
|
+
), O = u(() => {
|
|
21
22
|
m(null);
|
|
22
|
-
}, []),
|
|
23
|
+
}, []), I = u(
|
|
23
24
|
(a, e) => {
|
|
24
25
|
if (a.preventDefault(), m(null), r(null), !i || !n || n === e) return;
|
|
25
|
-
const p = l.map((
|
|
26
|
+
const p = l.map((j) => j.id), c = p.indexOf(n), t = p.indexOf(e);
|
|
26
27
|
if (c === -1 || t === -1) return;
|
|
27
28
|
const d = [...p];
|
|
28
29
|
d.splice(c, 1), d.splice(t, 0, n), i(d);
|
|
29
30
|
},
|
|
30
31
|
[n, l, i]
|
|
31
|
-
),
|
|
32
|
+
), L = u(() => {
|
|
32
33
|
r(null), m(null);
|
|
33
34
|
}, []);
|
|
34
35
|
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
|
+
!h && /* @__PURE__ */ s("h3", { className: "mapui:m-0 mapui:mb-2 mapui:text-sm mapui:font-semibold mapui:text-gray-700", children: "Layers" }),
|
|
36
37
|
/* @__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 =
|
|
38
|
+
const e = f.includes(a.id), p = n === a.id, c = D === a.id;
|
|
38
39
|
return /* @__PURE__ */ o(
|
|
39
40
|
"li",
|
|
40
41
|
{
|
|
41
42
|
draggable: !!i,
|
|
42
|
-
onDragStart: i ? (t) =>
|
|
43
|
-
onDragOver: i ? (t) =>
|
|
44
|
-
onDragLeave: i ?
|
|
45
|
-
onDrop: i ? (t) =>
|
|
46
|
-
onDragEnd: i ?
|
|
43
|
+
onDragStart: i ? (t) => b(t, a.id) : void 0,
|
|
44
|
+
onDragOver: i ? (t) => N(t, a.id) : void 0,
|
|
45
|
+
onDragLeave: i ? O : void 0,
|
|
46
|
+
onDrop: i ? (t) => I(t, a.id) : void 0,
|
|
47
|
+
onDragEnd: i ? L : void 0,
|
|
47
48
|
className: [
|
|
48
49
|
"mapui:flex mapui:items-center mapui:gap-2 mapui:rounded mapui:px-2 mapui:py-1.5",
|
|
49
50
|
"mapui:select-none mapui:transition-colors",
|
|
@@ -79,5 +80,5 @@ function w({
|
|
|
79
80
|
] });
|
|
80
81
|
}
|
|
81
82
|
export {
|
|
82
|
-
|
|
83
|
+
E as L
|
|
83
84
|
};
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
import { jsxs as h, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { useState as j, useRef as L, useId as D, useMemo as S, useCallback as A, useEffect as I } from "react";
|
|
3
|
+
function V({
|
|
4
|
+
value: e,
|
|
5
|
+
onChange: t,
|
|
6
|
+
suggestions: u,
|
|
7
|
+
onQueryChange: d,
|
|
8
|
+
placeholder: N = "",
|
|
9
|
+
className: l = "",
|
|
10
|
+
id: y
|
|
11
|
+
}) {
|
|
12
|
+
const [f, c] = j(!1), [p, o] = j(-1), g = L(null), i = D(), r = p >= 0 ? `${i}-option-${p}` : void 0, v = S(
|
|
13
|
+
() => u.filter((n) => n.toLowerCase().includes(e.toLowerCase())),
|
|
14
|
+
[u, e]
|
|
15
|
+
), b = f && v.length > 0, a = A(
|
|
16
|
+
(n) => {
|
|
17
|
+
t(n), d == null || d(n), c(!1), o(-1);
|
|
18
|
+
},
|
|
19
|
+
[t, d]
|
|
20
|
+
), x = (n) => {
|
|
21
|
+
const s = n.target.value;
|
|
22
|
+
t(s), d == null || d(s), c(!0), o(-1);
|
|
23
|
+
}, w = (n) => {
|
|
24
|
+
b && (n.key === "ArrowDown" ? (n.preventDefault(), o((s) => Math.min(s + 1, v.length - 1))) : n.key === "ArrowUp" ? (n.preventDefault(), o((s) => Math.max(s - 1, 0))) : n.key === "Enter" && p >= 0 ? (n.preventDefault(), a(v[p])) : n.key === "Escape" && (c(!1), o(-1)));
|
|
25
|
+
};
|
|
26
|
+
return I(() => {
|
|
27
|
+
const n = (s) => {
|
|
28
|
+
g.current && !g.current.contains(s.target) && (c(!1), o(-1));
|
|
29
|
+
};
|
|
30
|
+
return document.addEventListener("mousedown", n), () => document.removeEventListener("mousedown", n);
|
|
31
|
+
}, []), /* @__PURE__ */ h("div", { ref: g, className: `mapui:relative ${l}`.trim(), children: [
|
|
32
|
+
/* @__PURE__ */ m(
|
|
33
|
+
"input",
|
|
34
|
+
{
|
|
35
|
+
id: y,
|
|
36
|
+
type: "text",
|
|
37
|
+
value: e,
|
|
38
|
+
placeholder: N,
|
|
39
|
+
role: "combobox",
|
|
40
|
+
"aria-expanded": b,
|
|
41
|
+
"aria-autocomplete": "list",
|
|
42
|
+
"aria-controls": i,
|
|
43
|
+
"aria-activedescendant": r,
|
|
44
|
+
onChange: x,
|
|
45
|
+
onFocus: () => c(!0),
|
|
46
|
+
onKeyDown: w,
|
|
47
|
+
className: "mapui:w-full 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"
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
b && /* @__PURE__ */ m(
|
|
51
|
+
"ul",
|
|
52
|
+
{
|
|
53
|
+
id: i,
|
|
54
|
+
role: "listbox",
|
|
55
|
+
className: "mapui:absolute mapui:z-10 mapui:mt-1 mapui:w-full mapui:rounded mapui:border mapui:border-gray-200 mapui:bg-white mapui:shadow-lg mapui:max-h-48 mapui:overflow-y-auto mapui:p-0 mapui:m-0 mapui:list-none",
|
|
56
|
+
children: v.map((n, s) => /* @__PURE__ */ m(
|
|
57
|
+
"li",
|
|
58
|
+
{
|
|
59
|
+
id: `${i}-option-${s}`,
|
|
60
|
+
role: "option",
|
|
61
|
+
"aria-selected": s === p,
|
|
62
|
+
onMouseDown: (E) => {
|
|
63
|
+
E.preventDefault(), a(n);
|
|
64
|
+
},
|
|
65
|
+
className: `mapui:cursor-pointer mapui:px-2 mapui:py-1 mapui:text-sm ${s === p ? "mapui:bg-blue-100" : "hover:mapui:bg-gray-50"}`,
|
|
66
|
+
children: n
|
|
67
|
+
},
|
|
68
|
+
`${s}-${n}`
|
|
69
|
+
))
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] });
|
|
73
|
+
}
|
|
74
|
+
function R({
|
|
75
|
+
startValue: e,
|
|
76
|
+
endValue: t,
|
|
77
|
+
onStartChange: u,
|
|
78
|
+
onEndChange: d,
|
|
79
|
+
className: N = "",
|
|
80
|
+
id: l
|
|
81
|
+
}) {
|
|
82
|
+
const y = D(), f = l ?? y, c = `${f}-start`, p = `${f}-end`, o = "mapui:flex-1 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";
|
|
83
|
+
return /* @__PURE__ */ h("div", { className: `mapui:flex mapui:flex-col mapui:gap-1 ${N}`.trim(), children: [
|
|
84
|
+
/* @__PURE__ */ h("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
|
|
85
|
+
/* @__PURE__ */ m("label", { htmlFor: c, className: "mapui:text-xs mapui:text-gray-400 mapui:w-8", children: "From" }),
|
|
86
|
+
/* @__PURE__ */ m(
|
|
87
|
+
"input",
|
|
88
|
+
{
|
|
89
|
+
id: c,
|
|
90
|
+
type: "datetime-local",
|
|
91
|
+
value: e,
|
|
92
|
+
onChange: (g) => u(g.target.value),
|
|
93
|
+
"aria-label": "Start date",
|
|
94
|
+
className: o
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
] }),
|
|
98
|
+
/* @__PURE__ */ h("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
|
|
99
|
+
/* @__PURE__ */ m("label", { htmlFor: p, className: "mapui:text-xs mapui:text-gray-400 mapui:w-8", children: "To" }),
|
|
100
|
+
/* @__PURE__ */ m(
|
|
101
|
+
"input",
|
|
102
|
+
{
|
|
103
|
+
id: p,
|
|
104
|
+
type: "datetime-local",
|
|
105
|
+
value: t,
|
|
106
|
+
onChange: (g) => d(g.target.value),
|
|
107
|
+
"aria-label": "End date",
|
|
108
|
+
className: o
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
] })
|
|
112
|
+
] });
|
|
113
|
+
}
|
|
114
|
+
const k = {
|
|
115
|
+
eq: "=",
|
|
116
|
+
gt: ">",
|
|
117
|
+
lt: "<",
|
|
118
|
+
gte: ">=",
|
|
119
|
+
lte: "<=",
|
|
120
|
+
between: "between"
|
|
121
|
+
}, M = ["eq", "gt", "lt", "gte", "lte", "between"];
|
|
122
|
+
function O(e, t) {
|
|
123
|
+
if (e && typeof e == "object") {
|
|
124
|
+
if ("operator" in e) return e.operator;
|
|
125
|
+
if ("min" in e) return "between";
|
|
126
|
+
}
|
|
127
|
+
return t;
|
|
128
|
+
}
|
|
129
|
+
const $ = "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", K = "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 mapui:bg-white";
|
|
130
|
+
function P({ field: e, value: t, onChange: u, className: d = "", id: N }) {
|
|
131
|
+
const [l, y] = j(
|
|
132
|
+
() => O(t, e.operator)
|
|
133
|
+
);
|
|
134
|
+
I(() => {
|
|
135
|
+
y(O(t, e.operator));
|
|
136
|
+
}, [t, e.operator]);
|
|
137
|
+
const f = l === "between", c = e.inputMode === "slider" ? M.filter((a) => a !== "between") : M, p = (a) => {
|
|
138
|
+
if (y(a), a === "between")
|
|
139
|
+
u(void 0);
|
|
140
|
+
else if (f)
|
|
141
|
+
u(void 0);
|
|
142
|
+
else if (t && typeof t == "object" && "value" in t) {
|
|
143
|
+
const x = t.value;
|
|
144
|
+
u({ value: x, operator: a });
|
|
145
|
+
}
|
|
146
|
+
}, o = (a) => {
|
|
147
|
+
u(a === "" ? void 0 : { value: Number(a), operator: l });
|
|
148
|
+
}, g = (a) => {
|
|
149
|
+
const x = t && typeof t == "object" && "max" in t ? t.max : void 0;
|
|
150
|
+
u(a === "" ? x === void 0 ? void 0 : { min: e.min ?? 0, max: x } : { min: Number(a), max: x ?? e.max ?? 0 });
|
|
151
|
+
}, i = (a) => {
|
|
152
|
+
const x = t && typeof t == "object" && "min" in t ? t.min : void 0;
|
|
153
|
+
u(a === "" ? x === void 0 ? void 0 : { min: x, max: e.max ?? 0 } : { min: x ?? e.min ?? 0, max: Number(a) });
|
|
154
|
+
}, r = t && typeof t == "object" && "value" in t ? String(t.value) : "", v = t && typeof t == "object" && "min" in t ? String(t.min) : "", b = t && typeof t == "object" && "max" in t ? String(t.max) : "";
|
|
155
|
+
return /* @__PURE__ */ h("div", { className: `mapui:flex mapui:flex-col mapui:gap-1 ${d}`.trim(), children: [
|
|
156
|
+
/* @__PURE__ */ m(
|
|
157
|
+
"select",
|
|
158
|
+
{
|
|
159
|
+
value: l,
|
|
160
|
+
onChange: (a) => p(a.target.value),
|
|
161
|
+
"aria-label": `${e.label} operator`,
|
|
162
|
+
className: K,
|
|
163
|
+
children: c.map((a) => /* @__PURE__ */ m("option", { value: a, children: k[a] }, a))
|
|
164
|
+
}
|
|
165
|
+
),
|
|
166
|
+
f ? (
|
|
167
|
+
/* Between: min + max inputs */
|
|
168
|
+
/* @__PURE__ */ h("div", { className: "mapui:flex mapui:gap-2", children: [
|
|
169
|
+
/* @__PURE__ */ m(
|
|
170
|
+
"input",
|
|
171
|
+
{
|
|
172
|
+
type: "number",
|
|
173
|
+
value: v,
|
|
174
|
+
placeholder: e.min !== void 0 ? String(e.min) : "Min",
|
|
175
|
+
min: e.min,
|
|
176
|
+
max: e.max,
|
|
177
|
+
step: e.step,
|
|
178
|
+
onChange: (a) => g(a.target.value),
|
|
179
|
+
"aria-label": `${e.label} minimum`,
|
|
180
|
+
className: `${$} mapui:w-1/2`
|
|
181
|
+
}
|
|
182
|
+
),
|
|
183
|
+
/* @__PURE__ */ m(
|
|
184
|
+
"input",
|
|
185
|
+
{
|
|
186
|
+
type: "number",
|
|
187
|
+
value: b,
|
|
188
|
+
placeholder: e.max !== void 0 ? String(e.max) : "Max",
|
|
189
|
+
min: e.min,
|
|
190
|
+
max: e.max,
|
|
191
|
+
step: e.step,
|
|
192
|
+
onChange: (a) => i(a.target.value),
|
|
193
|
+
"aria-label": `${e.label} maximum`,
|
|
194
|
+
className: `${$} mapui:w-1/2`
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
] })
|
|
198
|
+
) : e.inputMode === "slider" ? (
|
|
199
|
+
/* Slider */
|
|
200
|
+
/* @__PURE__ */ h("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
|
|
201
|
+
/* @__PURE__ */ m(
|
|
202
|
+
"input",
|
|
203
|
+
{
|
|
204
|
+
type: "range",
|
|
205
|
+
value: r !== "" ? r : e.min ?? 0,
|
|
206
|
+
min: e.min ?? 0,
|
|
207
|
+
max: e.max ?? 100,
|
|
208
|
+
step: e.step ?? 1,
|
|
209
|
+
onChange: (a) => o(a.target.value),
|
|
210
|
+
"aria-label": e.label,
|
|
211
|
+
className: "mapui:flex-1"
|
|
212
|
+
}
|
|
213
|
+
),
|
|
214
|
+
/* @__PURE__ */ m("span", { className: "mapui:text-xs mapui:text-gray-600 mapui:min-w-12 mapui:whitespace-nowrap mapui:text-right", children: r !== "" ? r : e.min ?? 0 })
|
|
215
|
+
] })
|
|
216
|
+
) : (
|
|
217
|
+
/* Number input */
|
|
218
|
+
/* @__PURE__ */ m(
|
|
219
|
+
"input",
|
|
220
|
+
{
|
|
221
|
+
id: N,
|
|
222
|
+
type: "number",
|
|
223
|
+
value: r,
|
|
224
|
+
placeholder: e.placeholder ?? "",
|
|
225
|
+
min: e.min,
|
|
226
|
+
max: e.max,
|
|
227
|
+
step: e.step,
|
|
228
|
+
onChange: (a) => o(a.target.value),
|
|
229
|
+
className: $
|
|
230
|
+
}
|
|
231
|
+
)
|
|
232
|
+
)
|
|
233
|
+
] });
|
|
234
|
+
}
|
|
235
|
+
function q(e) {
|
|
236
|
+
return e === void 0 || e === "" || e === null ? !1 : typeof e == "object" && "start" in e && "end" in e ? e.start !== "" || e.end !== "" : !0;
|
|
237
|
+
}
|
|
238
|
+
function _({
|
|
239
|
+
layers: e,
|
|
240
|
+
activeFilters: t,
|
|
241
|
+
onFilterChange: u,
|
|
242
|
+
onClearFilters: d,
|
|
243
|
+
autocompleteSuggestions: N = {},
|
|
244
|
+
onFetchSuggestions: l,
|
|
245
|
+
className: y = "",
|
|
246
|
+
hideTitle: f
|
|
247
|
+
}) {
|
|
248
|
+
const c = S(
|
|
249
|
+
() => e.filter((p) => {
|
|
250
|
+
var o;
|
|
251
|
+
return (o = p.search) == null ? void 0 : o.fields.length;
|
|
252
|
+
}),
|
|
253
|
+
[e]
|
|
254
|
+
);
|
|
255
|
+
return I(() => {
|
|
256
|
+
if (l)
|
|
257
|
+
for (const p of c)
|
|
258
|
+
for (const o of p.search.fields)
|
|
259
|
+
o.type === "select" && o.prefetch && l(p.id, o.property, "", { prefetch: !0 });
|
|
260
|
+
}, [c, l]), c.length === 0 ? /* @__PURE__ */ h("div", { className: `mapui:flex mapui:flex-col mapui:gap-1 ${y}`.trim(), children: [
|
|
261
|
+
!f && /* @__PURE__ */ m("h3", { className: "mapui:m-0 mapui:mb-2 mapui:text-sm mapui:font-semibold mapui:text-gray-700", children: "Search & Filter" }),
|
|
262
|
+
/* @__PURE__ */ m("p", { className: "mapui:m-0 mapui:text-xs mapui:text-gray-500", children: "No searchable layers configured." })
|
|
263
|
+
] }) : /* @__PURE__ */ h("div", { className: `mapui:flex mapui:flex-col mapui:gap-3 ${y}`.trim(), children: [
|
|
264
|
+
!f && /* @__PURE__ */ m("h3", { className: "mapui:m-0 mapui:mb-2 mapui:text-sm mapui:font-semibold mapui:text-gray-700", children: "Search & Filter" }),
|
|
265
|
+
c.map((p) => {
|
|
266
|
+
const o = t[p.id] ?? {}, g = Object.values(o).some(q);
|
|
267
|
+
return /* @__PURE__ */ h("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: [
|
|
268
|
+
/* @__PURE__ */ h("div", { className: "mapui:flex mapui:items-center mapui:justify-between", children: [
|
|
269
|
+
/* @__PURE__ */ m("span", { className: "mapui:text-xs mapui:font-medium mapui:text-gray-600", children: p.label }),
|
|
270
|
+
g && /* @__PURE__ */ m(
|
|
271
|
+
"button",
|
|
272
|
+
{
|
|
273
|
+
type: "button",
|
|
274
|
+
onClick: () => d(p.id),
|
|
275
|
+
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",
|
|
276
|
+
children: "Clear"
|
|
277
|
+
}
|
|
278
|
+
)
|
|
279
|
+
] }),
|
|
280
|
+
p.search.fields.map((i) => {
|
|
281
|
+
const r = o[i.property], v = `${p.id}:${i.property}`, b = `search-${p.id}-${i.property}`;
|
|
282
|
+
return /* @__PURE__ */ h("div", { className: "mapui:flex mapui:flex-col mapui:gap-0.5", children: [
|
|
283
|
+
/* @__PURE__ */ m("label", { htmlFor: b, className: "mapui:text-xs mapui:text-gray-500", children: i.label }),
|
|
284
|
+
i.type === "text" && i.autocomplete ? /* @__PURE__ */ m(
|
|
285
|
+
V,
|
|
286
|
+
{
|
|
287
|
+
id: b,
|
|
288
|
+
value: r ?? "",
|
|
289
|
+
onChange: (a) => u(p.id, i.property, a || void 0),
|
|
290
|
+
suggestions: [.../* @__PURE__ */ new Set([
|
|
291
|
+
...N[v] ?? [],
|
|
292
|
+
...i.options ?? []
|
|
293
|
+
])],
|
|
294
|
+
onQueryChange: (a) => l == null ? void 0 : l(p.id, i.property, a, { prefetch: i.prefetch }),
|
|
295
|
+
placeholder: i.placeholder ?? ""
|
|
296
|
+
}
|
|
297
|
+
) : i.type === "text" ? /* @__PURE__ */ m(
|
|
298
|
+
"input",
|
|
299
|
+
{
|
|
300
|
+
id: b,
|
|
301
|
+
type: "text",
|
|
302
|
+
value: r ?? "",
|
|
303
|
+
placeholder: i.placeholder ?? "",
|
|
304
|
+
onChange: (a) => u(p.id, i.property, a.target.value || void 0),
|
|
305
|
+
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"
|
|
306
|
+
}
|
|
307
|
+
) : i.type === "datetime" && i.range ? /* @__PURE__ */ m(
|
|
308
|
+
R,
|
|
309
|
+
{
|
|
310
|
+
id: b,
|
|
311
|
+
startValue: r && typeof r == "object" && "start" in r ? r.start : "",
|
|
312
|
+
endValue: r && typeof r == "object" && "end" in r ? r.end : "",
|
|
313
|
+
onStartChange: (a) => u(p.id, i.property, {
|
|
314
|
+
start: a,
|
|
315
|
+
end: r && typeof r == "object" && "end" in r ? r.end : ""
|
|
316
|
+
}),
|
|
317
|
+
onEndChange: (a) => u(p.id, i.property, {
|
|
318
|
+
start: r && typeof r == "object" && "start" in r ? r.start : "",
|
|
319
|
+
end: a
|
|
320
|
+
})
|
|
321
|
+
}
|
|
322
|
+
) : i.type === "datetime" ? /* @__PURE__ */ m(
|
|
323
|
+
"input",
|
|
324
|
+
{
|
|
325
|
+
id: b,
|
|
326
|
+
type: "datetime-local",
|
|
327
|
+
value: r ?? "",
|
|
328
|
+
onChange: (a) => u(p.id, i.property, a.target.value || void 0),
|
|
329
|
+
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"
|
|
330
|
+
}
|
|
331
|
+
) : i.type === "number" ? /* @__PURE__ */ m(
|
|
332
|
+
P,
|
|
333
|
+
{
|
|
334
|
+
id: b,
|
|
335
|
+
field: i,
|
|
336
|
+
value: r,
|
|
337
|
+
onChange: (a) => u(p.id, i.property, a)
|
|
338
|
+
}
|
|
339
|
+
) : i.type === "select" ? (() => {
|
|
340
|
+
const a = i, x = N[v] ?? [], w = a.options ?? [], n = [.../* @__PURE__ */ new Set([...x, ...w])];
|
|
341
|
+
return /* @__PURE__ */ h(
|
|
342
|
+
"select",
|
|
343
|
+
{
|
|
344
|
+
id: b,
|
|
345
|
+
value: r ?? "",
|
|
346
|
+
onChange: (s) => u(p.id, i.property, s.target.value || void 0),
|
|
347
|
+
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",
|
|
348
|
+
children: [
|
|
349
|
+
/* @__PURE__ */ m("option", { value: "", children: i.placeholder ?? "Select..." }),
|
|
350
|
+
n.map((s) => /* @__PURE__ */ m("option", { value: s, children: s }, s))
|
|
351
|
+
]
|
|
352
|
+
}
|
|
353
|
+
);
|
|
354
|
+
})() : null
|
|
355
|
+
] }, i.property);
|
|
356
|
+
})
|
|
357
|
+
] }, p.id);
|
|
358
|
+
})
|
|
359
|
+
] });
|
|
360
|
+
}
|
|
361
|
+
export {
|
|
362
|
+
_ as S
|
|
363
|
+
};
|
|
@@ -5,6 +5,7 @@ export interface LayerPanelProps {
|
|
|
5
5
|
onToggleVisibility: (layerId: string) => void;
|
|
6
6
|
onReorder?: (layerIds: string[]) => void;
|
|
7
7
|
className?: string;
|
|
8
|
+
hideTitle?: boolean;
|
|
8
9
|
}
|
|
9
|
-
export declare function LayerPanel({ layers, activeLayerIds, onToggleVisibility, onReorder, className, }: LayerPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function LayerPanel({ layers, activeLayerIds, onToggleVisibility, onReorder, className, hideTitle, }: LayerPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
//# sourceMappingURL=LayerPanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LayerPanel.d.ts","sourceRoot":"","sources":["../../../src/components/LayerPanel/LayerPanel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,kBAAkB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"LayerPanel.d.ts","sourceRoot":"","sources":["../../../src/components/LayerPanel/LayerPanel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,kBAAkB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,UAAU,CAAC,EACzB,MAAM,EACN,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,SAAc,EACd,SAAS,GACV,EAAE,eAAe,2CA0GjB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface AutocompleteInputProps {
|
|
2
|
+
value: string;
|
|
3
|
+
onChange: (value: string) => void;
|
|
4
|
+
suggestions: string[];
|
|
5
|
+
onQueryChange?: (query: string) => void;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function AutocompleteInput({ value, onChange, suggestions, onQueryChange, placeholder, className, id, }: AutocompleteInputProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=AutocompleteInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AutocompleteInput.d.ts","sourceRoot":"","sources":["../../../src/components/SearchPanel/AutocompleteInput.tsx"],"names":[],"mappings":"AAEA,UAAU,sBAAsB;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,QAAQ,EACR,WAAW,EACX,aAAa,EACb,WAAgB,EAChB,SAAc,EACd,EAAE,GACH,EAAE,sBAAsB,2CA0GxB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface DateRangeInputProps {
|
|
2
|
+
startValue: string;
|
|
3
|
+
endValue: string;
|
|
4
|
+
onStartChange: (value: string) => void;
|
|
5
|
+
onEndChange: (value: string) => void;
|
|
6
|
+
className?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function DateRangeInput({ startValue, endValue, onStartChange, onEndChange, className, id, }: DateRangeInputProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=DateRangeInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateRangeInput.d.ts","sourceRoot":"","sources":["../../../src/components/SearchPanel/DateRangeInput.tsx"],"names":[],"mappings":"AAEA,UAAU,mBAAmB;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,wBAAgB,cAAc,CAAC,EAC7B,UAAU,EACV,QAAQ,EACR,aAAa,EACb,WAAW,EACX,SAAc,EACd,EAAE,GACH,EAAE,mBAAmB,2CAmCrB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NumberSearchField, SearchFilterValue } from '../../types';
|
|
2
|
+
interface NumberInputProps {
|
|
3
|
+
field: NumberSearchField;
|
|
4
|
+
value: SearchFilterValue;
|
|
5
|
+
onChange: (value: SearchFilterValue) => void;
|
|
6
|
+
className?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function NumberInput({ field, value, onChange, className, id }: NumberInputProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=NumberInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumberInput.d.ts","sourceRoot":"","sources":["../../../src/components/SearchPanel/NumberInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAExE,UAAU,gBAAgB;IACxB,KAAK,EAAE,iBAAiB,CAAC;IACzB,KAAK,EAAE,iBAAiB,CAAC;IACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AA2BD,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAc,EAAE,EAAE,EAAE,EAAE,gBAAgB,2CAgK3F"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { LayerConfig, SearchFilterValues,
|
|
1
|
+
import { LayerConfig, SearchFilterValues, SearchFilterValue } from '../../types';
|
|
2
2
|
export interface SearchPanelProps {
|
|
3
3
|
layers: LayerConfig[];
|
|
4
|
-
sources?: OgcApiSource[];
|
|
5
4
|
activeFilters: Record<string, SearchFilterValues>;
|
|
6
|
-
onFilterChange: (layerId: string, property: string, value:
|
|
5
|
+
onFilterChange: (layerId: string, property: string, value: SearchFilterValue) => void;
|
|
7
6
|
onClearFilters: (layerId: string) => void;
|
|
7
|
+
autocompleteSuggestions?: Record<string, string[]>;
|
|
8
|
+
onFetchSuggestions?: (layerId: string, property: string, query: string, options?: {
|
|
9
|
+
prefetch?: boolean;
|
|
10
|
+
}) => void;
|
|
8
11
|
className?: string;
|
|
12
|
+
hideTitle?: boolean;
|
|
9
13
|
}
|
|
10
|
-
export declare function SearchPanel({ layers,
|
|
14
|
+
export declare function SearchPanel({ layers, activeFilters, onFilterChange, onClearFilters, autocompleteSuggestions, onFetchSuggestions, className, hideTitle, }: SearchPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
11
15
|
//# sourceMappingURL=SearchPanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchPanel.d.ts","sourceRoot":"","sources":["../../../src/components/SearchPanel/SearchPanel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"SearchPanel.d.ts","sourceRoot":"","sources":["../../../src/components/SearchPanel/SearchPanel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,iBAAiB,EAA2F,MAAM,aAAa,CAAC;AAK/K,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAClD,cAAc,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACtF,cAAc,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,uBAAuB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACnD,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IAClH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAcD,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,aAAa,EACb,cAAc,EACd,cAAc,EACd,uBAA4B,EAC5B,kBAAkB,EAClB,SAAc,EACd,SAAS,GACV,EAAE,gBAAgB,2CA4KlB"}
|