@ogc-maps/storybook-components 0.14.0 → 0.16.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/LICENSE +661 -0
- package/dist/{BasemapSwitcher-BW7lyZ2Y.js → BasemapSwitcher-DuqVusX0.js} +9 -9
- package/dist/CollapsibleControl-BTIkiTmU.js +60 -0
- package/dist/CoordinateDisplay-BblQ34mS.js +154 -0
- package/dist/{ExportButton-Ck1dESnc.js → ExportButton-C8hCCsav.js} +7 -7
- package/dist/{FeatureDetailPanel-CkFpdEKW.js → FeatureDetailPanel-DgCHiNi9.js} +16 -16
- package/dist/FeatureTooltip-DHjMZC0u.js +49 -0
- package/dist/{LayerPanel-SCdJ8948.js → LayerPanel-BkDbZ66Z.js} +23 -23
- package/dist/Legend-CvBd-v0n.js +285 -0
- package/dist/PropertyList-0EonV_BQ.js +33 -0
- package/dist/SearchPanel-DIb7aYVs.js +725 -0
- package/dist/components/BasemapSwitcher/index.js +1 -1
- package/dist/components/CollapsibleControl/CollapsibleControl.d.ts +4 -1
- package/dist/components/CollapsibleControl/CollapsibleControl.d.ts.map +1 -1
- package/dist/components/CollapsibleControl/index.js +1 -1
- package/dist/components/CompassControl/CompassControl.d.ts +19 -0
- package/dist/components/CompassControl/CompassControl.d.ts.map +1 -0
- package/dist/components/CompassControl/index.d.ts +3 -0
- package/dist/components/CompassControl/index.d.ts.map +1 -0
- package/dist/components/CoordinateDisplay/CoordinateDisplay.d.ts +35 -4
- package/dist/components/CoordinateDisplay/CoordinateDisplay.d.ts.map +1 -1
- package/dist/components/CoordinateDisplay/CoordinateDisplay.test.d.ts +2 -0
- package/dist/components/CoordinateDisplay/CoordinateDisplay.test.d.ts.map +1 -0
- package/dist/components/CoordinateDisplay/index.d.ts +1 -1
- package/dist/components/CoordinateDisplay/index.d.ts.map +1 -1
- package/dist/components/CoordinateDisplay/index.js +5 -3
- package/dist/components/Cql2FilterEditor/Cql2FilterEditor.d.ts +9 -0
- package/dist/components/Cql2FilterEditor/Cql2FilterEditor.d.ts.map +1 -0
- package/dist/components/Cql2FilterEditor/Cql2Preview.d.ts +6 -0
- package/dist/components/Cql2FilterEditor/Cql2Preview.d.ts.map +1 -0
- package/dist/components/Cql2FilterEditor/FilterRuleEditor.d.ts +9 -0
- package/dist/components/Cql2FilterEditor/FilterRuleEditor.d.ts.map +1 -0
- package/dist/components/Cql2FilterEditor/FilterRuleGroupEditor.d.ts +10 -0
- package/dist/components/Cql2FilterEditor/FilterRuleGroupEditor.d.ts.map +1 -0
- package/dist/components/Cql2FilterEditor/FilterValueInput.d.ts +12 -0
- package/dist/components/Cql2FilterEditor/FilterValueInput.d.ts.map +1 -0
- package/dist/components/Cql2FilterEditor/ParameterizableField.d.ts +30 -0
- package/dist/components/Cql2FilterEditor/ParameterizableField.d.ts.map +1 -0
- package/dist/components/Cql2FilterEditor/index.d.ts +2 -0
- package/dist/components/Cql2FilterEditor/index.d.ts.map +1 -0
- package/dist/components/Cql2FilterEditor/operatorOptions.d.ts +9 -0
- package/dist/components/Cql2FilterEditor/operatorOptions.d.ts.map +1 -0
- package/dist/components/Cql2FilterEditor/styles.d.ts +3 -0
- package/dist/components/Cql2FilterEditor/styles.d.ts.map +1 -0
- package/dist/components/ExportButton/index.js +1 -1
- package/dist/components/ExportModal/ExportModal.d.ts +20 -1
- package/dist/components/ExportModal/ExportModal.d.ts.map +1 -1
- package/dist/components/ExportModal/index.d.ts +1 -1
- package/dist/components/ExportModal/index.d.ts.map +1 -1
- package/dist/components/FeatureDetailPanel/index.js +1 -1
- package/dist/components/FeatureTooltip/index.js +1 -1
- package/dist/components/GlobalSearchBar/GlobalSearchBar.d.ts +25 -0
- package/dist/components/GlobalSearchBar/GlobalSearchBar.d.ts.map +1 -0
- package/dist/components/GlobalSearchBar/GlobalSearchBar.test.d.ts +2 -0
- package/dist/components/GlobalSearchBar/GlobalSearchBar.test.d.ts.map +1 -0
- package/dist/components/GlobalSearchBar/index.d.ts +3 -0
- package/dist/components/GlobalSearchBar/index.d.ts.map +1 -0
- package/dist/components/GlobalSearchConfigEditor/GlobalSearchConfigEditor.d.ts +22 -0
- package/dist/components/GlobalSearchConfigEditor/GlobalSearchConfigEditor.d.ts.map +1 -0
- package/dist/components/GlobalSearchConfigEditor/GlobalSearchConfigEditor.test.d.ts +2 -0
- package/dist/components/GlobalSearchConfigEditor/GlobalSearchConfigEditor.test.d.ts.map +1 -0
- package/dist/components/GlobalSearchConfigEditor/index.d.ts +3 -0
- package/dist/components/GlobalSearchConfigEditor/index.d.ts.map +1 -0
- package/dist/components/ImageryEditor/ImageryEditor.d.ts +0 -1
- package/dist/components/ImageryEditor/ImageryEditor.d.ts.map +1 -1
- package/dist/components/ImageryEditor/index.d.ts +2 -1
- package/dist/components/ImageryEditor/index.d.ts.map +1 -1
- package/dist/components/ImageryPanel/ImageryPanel.d.ts.map +1 -1
- package/dist/components/InfoControl/InfoControl.d.ts +12 -0
- package/dist/components/InfoControl/InfoControl.d.ts.map +1 -0
- package/dist/components/InfoControl/InfoModal.d.ts +16 -0
- package/dist/components/InfoControl/InfoModal.d.ts.map +1 -0
- package/dist/components/InfoControl/index.d.ts +5 -0
- package/dist/components/InfoControl/index.d.ts.map +1 -0
- package/dist/components/LayerEditor/LayerEditor.d.ts +6 -1
- package/dist/components/LayerEditor/LayerEditor.d.ts.map +1 -1
- package/dist/components/LayerEditor/LayerList.d.ts +8 -1
- package/dist/components/LayerEditor/LayerList.d.ts.map +1 -1
- package/dist/components/LayerEditor/index.d.ts +1 -1
- package/dist/components/LayerEditor/index.d.ts.map +1 -1
- package/dist/components/LayerPanel/index.js +1 -1
- package/dist/components/Legend/Legend.d.ts +7 -1
- package/dist/components/Legend/Legend.d.ts.map +1 -1
- package/dist/components/Legend/index.js +1 -1
- package/dist/components/PropertyFilterPanel/PropertyFilterPanel.d.ts +21 -0
- package/dist/components/PropertyFilterPanel/PropertyFilterPanel.d.ts.map +1 -0
- package/dist/components/PropertyFilterPanel/index.d.ts +3 -0
- package/dist/components/PropertyFilterPanel/index.d.ts.map +1 -0
- package/dist/components/QueryPanel/QueryPanel.d.ts +14 -0
- package/dist/components/QueryPanel/QueryPanel.d.ts.map +1 -0
- package/dist/components/QueryPanel/index.d.ts +3 -0
- package/dist/components/QueryPanel/index.d.ts.map +1 -0
- package/dist/components/ResultsDrawer/ResultsDrawer.d.ts +29 -4
- package/dist/components/ResultsDrawer/ResultsDrawer.d.ts.map +1 -1
- package/dist/components/ResultsDrawer/index.d.ts +1 -1
- package/dist/components/ResultsDrawer/index.d.ts.map +1 -1
- package/dist/components/ResultsDrawer/tableUtils.d.ts +11 -0
- package/dist/components/ResultsDrawer/tableUtils.d.ts.map +1 -0
- package/dist/components/ScaleBarControl/ScaleBarControl.d.ts +32 -0
- package/dist/components/ScaleBarControl/ScaleBarControl.d.ts.map +1 -0
- package/dist/components/ScaleBarControl/index.d.ts +2 -0
- package/dist/components/ScaleBarControl/index.d.ts.map +1 -0
- package/dist/components/SearchPanel/SearchPanel.d.ts +15 -2
- package/dist/components/SearchPanel/SearchPanel.d.ts.map +1 -1
- package/dist/components/SearchPanel/index.js +1 -1
- package/dist/components/SelectionPanel/SelectionPanel.d.ts +3 -1
- package/dist/components/SelectionPanel/SelectionPanel.d.ts.map +1 -1
- package/dist/components/SideMenuPanel/SideMenuPanel.d.ts +51 -0
- package/dist/components/SideMenuPanel/SideMenuPanel.d.ts.map +1 -0
- package/dist/components/SideMenuPanel/index.d.ts +3 -0
- package/dist/components/SideMenuPanel/index.d.ts.map +1 -0
- package/dist/components/SourceEditor/SourceEditor.d.ts +3 -1
- package/dist/components/SourceEditor/SourceEditor.d.ts.map +1 -1
- package/dist/components/SourceEditor/SourceList.d.ts +6 -1
- package/dist/components/SourceEditor/SourceList.d.ts.map +1 -1
- package/dist/components/SourceEditor/index.d.ts +1 -1
- package/dist/components/SourceEditor/index.d.ts.map +1 -1
- package/dist/components/StyleEditor/DataDrivenColorEditor.d.ts +8 -3
- package/dist/components/StyleEditor/DataDrivenColorEditor.d.ts.map +1 -1
- package/dist/components/StyleEditor/PropertyField.d.ts +6 -3
- package/dist/components/StyleEditor/PropertyField.d.ts.map +1 -1
- package/dist/components/StyleEditor/PropertyGroup.d.ts +6 -3
- package/dist/components/StyleEditor/PropertyGroup.d.ts.map +1 -1
- package/dist/components/StyleEditor/StyleEditor.d.ts +7 -3
- package/dist/components/StyleEditor/StyleEditor.d.ts.map +1 -1
- package/dist/components/UIConfigEditor/UIConfigEditor.d.ts +13 -2
- package/dist/components/UIConfigEditor/UIConfigEditor.d.ts.map +1 -1
- package/dist/components/UserMenu/UserMenu.d.ts +15 -0
- package/dist/components/UserMenu/UserMenu.d.ts.map +1 -0
- package/dist/components/UserMenu/index.d.ts +3 -0
- package/dist/components/UserMenu/index.d.ts.map +1 -0
- package/dist/components/ViewEditor/ViewEditor.d.ts.map +1 -1
- package/dist/components/index.d.ts +26 -5
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/shared/controlIcons.d.ts +10 -0
- package/dist/components/shared/controlIcons.d.ts.map +1 -0
- package/dist/geo-DUdRIR7u.js +9776 -0
- package/dist/hooks/index.d.ts +5 -3
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +68 -59
- package/dist/hooks/useExport.d.ts +7 -7
- package/dist/hooks/useExport.d.ts.map +1 -1
- package/dist/id-C2J6iu8_.js +11 -0
- package/dist/index-BtQnyWPg.js +3718 -0
- package/dist/main.js +13801 -2600
- package/dist/schemas/config.d.ts +2127 -5011
- package/dist/schemas/config.d.ts.map +1 -1
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +35 -24
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +47 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +56 -33
- package/dist/useSelection-BFHYsPvU.js +224 -0
- package/dist/utils/colorPalettes.d.ts +4 -2
- package/dist/utils/colorPalettes.d.ts.map +1 -1
- package/dist/utils/colorThemes.d.ts +12 -0
- package/dist/utils/colorThemes.d.ts.map +1 -0
- package/dist/utils/cql2.d.ts +34 -5
- package/dist/utils/cql2.d.ts.map +1 -1
- package/dist/utils/exportConverters.d.ts +16 -0
- package/dist/utils/exportConverters.d.ts.map +1 -0
- package/dist/utils/geo.d.ts +59 -0
- package/dist/utils/geo.d.ts.map +1 -1
- package/dist/utils/id.d.ts +2 -0
- package/dist/utils/id.d.ts.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +477 -0
- package/dist/utils/ogcApi.d.ts +31 -6
- package/dist/utils/ogcApi.d.ts.map +1 -1
- package/dist/utils/propertyFilters.d.ts +35 -0
- package/dist/utils/propertyFilters.d.ts.map +1 -0
- package/dist/utils/queryParameters.d.ts +23 -0
- package/dist/utils/queryParameters.d.ts.map +1 -0
- package/dist/utils/queryableHelpers.d.ts +4 -0
- package/dist/utils/queryableHelpers.d.ts.map +1 -1
- package/dist/utils/slugify.d.ts +2 -0
- package/dist/utils/slugify.d.ts.map +1 -0
- package/package.json +31 -14
- package/dist/CollapsibleControl-qo9daiD8.js +0 -53
- package/dist/CoordinateDisplay-PxPmVjpm.js +0 -47
- package/dist/FeatureTooltip-DxzN-jnp.js +0 -49
- package/dist/Legend-BLWBzD7Y.js +0 -275
- package/dist/PropertyList-BGXHLVBM.js +0 -33
- package/dist/SearchPanel-4Y12jfuP.js +0 -401
- package/dist/components/PropertyDisplayEditor/__tests__/PropertyDisplayEditor.test.d.ts +0 -2
- package/dist/components/PropertyDisplayEditor/__tests__/PropertyDisplayEditor.test.d.ts.map +0 -1
- package/dist/geo-PA_KiJwy.js +0 -1169
- package/dist/index-Cz_PEKV1.js +0 -3035
- package/dist/schemas/__tests__/config.test.d.ts +0 -2
- package/dist/schemas/__tests__/config.test.d.ts.map +0 -1
- package/dist/utils/__tests__/cql2.test.d.ts +0 -2
- package/dist/utils/__tests__/cql2.test.d.ts.map +0 -1
- package/dist/utils/__tests__/expressionColors.test.d.ts +0 -2
- package/dist/utils/__tests__/expressionColors.test.d.ts.map +0 -1
- package/dist/utils/__tests__/propertyDisplay.test.d.ts +0 -2
- package/dist/utils/__tests__/propertyDisplay.test.d.ts.map +0 -1
- package/dist/utils/__tests__/queryableHelpers.test.d.ts +0 -2
- package/dist/utils/__tests__/queryableHelpers.test.d.ts.map +0 -1
- package/dist/utils/__tests__/wkt.test.d.ts +0 -2
- package/dist/utils/__tests__/wkt.test.d.ts.map +0 -1
|
@@ -0,0 +1,725 @@
|
|
|
1
|
+
import { jsxs as o, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as k, useRef as W, useId as z, useMemo as E, useCallback as J, useEffect as B } from "react";
|
|
3
|
+
import { g as X } from "./id-C2J6iu8_.js";
|
|
4
|
+
function U({
|
|
5
|
+
value: e,
|
|
6
|
+
onChange: i,
|
|
7
|
+
suggestions: a,
|
|
8
|
+
onQueryChange: s,
|
|
9
|
+
placeholder: v = "",
|
|
10
|
+
className: n = "",
|
|
11
|
+
id: y
|
|
12
|
+
}) {
|
|
13
|
+
const [$, N] = k(!1), [l, p] = k(-1), m = W(null), f = z(), g = l >= 0 ? `${f}-option-${l}` : void 0, d = E(
|
|
14
|
+
() => a.filter((b) => b.toLowerCase().includes(e.toLowerCase())),
|
|
15
|
+
[a, e]
|
|
16
|
+
), j = $ && d.length > 0, u = J(
|
|
17
|
+
(b) => {
|
|
18
|
+
i(b), s == null || s(b), N(!1), p(-1);
|
|
19
|
+
},
|
|
20
|
+
[i, s]
|
|
21
|
+
), S = (b) => {
|
|
22
|
+
const w = b.target.value;
|
|
23
|
+
i(w), s == null || s(w), N(!0), p(-1);
|
|
24
|
+
}, D = (b) => {
|
|
25
|
+
j && (b.key === "ArrowDown" ? (b.preventDefault(), p((w) => Math.min(w + 1, d.length - 1))) : b.key === "ArrowUp" ? (b.preventDefault(), p((w) => Math.max(w - 1, 0))) : b.key === "Enter" && l >= 0 ? (b.preventDefault(), u(d[l])) : b.key === "Escape" && (N(!1), p(-1)));
|
|
26
|
+
};
|
|
27
|
+
return B(() => {
|
|
28
|
+
const b = (w) => {
|
|
29
|
+
m.current && !m.current.contains(w.target) && (N(!1), p(-1));
|
|
30
|
+
};
|
|
31
|
+
return document.addEventListener("mousedown", b), () => document.removeEventListener("mousedown", b);
|
|
32
|
+
}, []), /* @__PURE__ */ o("div", { ref: m, className: `mapui:relative ${n}`.trim(), children: [
|
|
33
|
+
/* @__PURE__ */ t(
|
|
34
|
+
"input",
|
|
35
|
+
{
|
|
36
|
+
id: y,
|
|
37
|
+
type: "text",
|
|
38
|
+
value: e,
|
|
39
|
+
placeholder: v,
|
|
40
|
+
role: "combobox",
|
|
41
|
+
"aria-expanded": j,
|
|
42
|
+
"aria-autocomplete": "list",
|
|
43
|
+
"aria-controls": f,
|
|
44
|
+
"aria-activedescendant": g,
|
|
45
|
+
onChange: S,
|
|
46
|
+
onFocus: () => N(!0),
|
|
47
|
+
onKeyDown: D,
|
|
48
|
+
className: "mapui:w-full mapui:rounded mapui:border mapui:border-slate-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"
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
j && /* @__PURE__ */ t(
|
|
52
|
+
"ul",
|
|
53
|
+
{
|
|
54
|
+
id: f,
|
|
55
|
+
role: "listbox",
|
|
56
|
+
className: "mapui:absolute mapui:z-10 mapui:mt-1 mapui:w-full mapui:rounded mapui:border mapui:border-slate-200 mapui:bg-white mapui:shadow-lg mapui:max-h-48 mapui:overflow-y-auto mapui:p-0 mapui:m-0 mapui:list-none",
|
|
57
|
+
children: d.map((b, w) => /* @__PURE__ */ t(
|
|
58
|
+
"li",
|
|
59
|
+
{
|
|
60
|
+
id: `${f}-option-${w}`,
|
|
61
|
+
role: "option",
|
|
62
|
+
"aria-selected": w === l,
|
|
63
|
+
onMouseDown: (A) => {
|
|
64
|
+
A.preventDefault(), u(b);
|
|
65
|
+
},
|
|
66
|
+
className: `mapui:cursor-pointer mapui:px-2 mapui:py-1 mapui:text-sm ${w === l ? "mapui:bg-blue-100" : "hover:mapui:bg-slate-50"}`,
|
|
67
|
+
children: b
|
|
68
|
+
},
|
|
69
|
+
`${w}-${b}`
|
|
70
|
+
))
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
] });
|
|
74
|
+
}
|
|
75
|
+
function Q({
|
|
76
|
+
startValue: e,
|
|
77
|
+
endValue: i,
|
|
78
|
+
onStartChange: a,
|
|
79
|
+
onEndChange: s,
|
|
80
|
+
className: v = "",
|
|
81
|
+
id: n
|
|
82
|
+
}) {
|
|
83
|
+
const y = z(), $ = n ?? y, N = `${$}-start`, l = `${$}-end`, p = "mapui:flex-1 mapui:rounded mapui:border mapui:border-slate-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";
|
|
84
|
+
return /* @__PURE__ */ o("div", { className: `mapui:flex mapui:flex-col mapui:gap-1.5 ${v}`.trim(), children: [
|
|
85
|
+
/* @__PURE__ */ o("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
|
|
86
|
+
/* @__PURE__ */ t("label", { htmlFor: N, className: "mapui:text-xs mapui:text-slate-400 mapui:w-8", children: "From" }),
|
|
87
|
+
/* @__PURE__ */ t(
|
|
88
|
+
"input",
|
|
89
|
+
{
|
|
90
|
+
id: N,
|
|
91
|
+
type: "datetime-local",
|
|
92
|
+
value: e,
|
|
93
|
+
onChange: (m) => a(m.target.value),
|
|
94
|
+
"aria-label": "Start date",
|
|
95
|
+
className: p
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
] }),
|
|
99
|
+
/* @__PURE__ */ o("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
|
|
100
|
+
/* @__PURE__ */ t("label", { htmlFor: l, className: "mapui:text-xs mapui:text-slate-400 mapui:w-8", children: "To" }),
|
|
101
|
+
/* @__PURE__ */ t(
|
|
102
|
+
"input",
|
|
103
|
+
{
|
|
104
|
+
id: l,
|
|
105
|
+
type: "datetime-local",
|
|
106
|
+
value: i,
|
|
107
|
+
onChange: (m) => s(m.target.value),
|
|
108
|
+
"aria-label": "End date",
|
|
109
|
+
className: p
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
] })
|
|
113
|
+
] });
|
|
114
|
+
}
|
|
115
|
+
const F = {
|
|
116
|
+
eq: "=",
|
|
117
|
+
gt: ">",
|
|
118
|
+
lt: "<",
|
|
119
|
+
gte: ">=",
|
|
120
|
+
lte: "<=",
|
|
121
|
+
between: "between"
|
|
122
|
+
}, Z = {
|
|
123
|
+
eq: "equal to",
|
|
124
|
+
gt: "greater than",
|
|
125
|
+
lt: "less than",
|
|
126
|
+
gte: "greater than or equal to",
|
|
127
|
+
lte: "less than or equal to",
|
|
128
|
+
between: "between"
|
|
129
|
+
}, q = ["eq", "gt", "lt", "gte", "lte", "between"];
|
|
130
|
+
function P(e, i) {
|
|
131
|
+
if (e && typeof e == "object") {
|
|
132
|
+
if ("operator" in e) return e.operator;
|
|
133
|
+
if ("min" in e) return "between";
|
|
134
|
+
}
|
|
135
|
+
return i;
|
|
136
|
+
}
|
|
137
|
+
const R = "mapui:rounded mapui:border mapui:border-slate-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", ee = "mapui:rounded mapui:border mapui:border-slate-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";
|
|
138
|
+
function ae({ field: e, value: i, onChange: a, className: s = "", id: v }) {
|
|
139
|
+
const [n, y] = k(
|
|
140
|
+
() => P(i, e.operator)
|
|
141
|
+
);
|
|
142
|
+
B(() => {
|
|
143
|
+
y(P(i, e.operator));
|
|
144
|
+
}, [i, e.operator]);
|
|
145
|
+
const $ = n === "between", N = e.inputMode === "slider" ? q.filter((u) => u !== "between") : q, l = (u) => {
|
|
146
|
+
if (y(u), u === "between")
|
|
147
|
+
a(void 0);
|
|
148
|
+
else if ($)
|
|
149
|
+
a(void 0);
|
|
150
|
+
else if (i && typeof i == "object" && "value" in i) {
|
|
151
|
+
const S = i.value;
|
|
152
|
+
a({ value: S, operator: u });
|
|
153
|
+
}
|
|
154
|
+
}, p = (u) => {
|
|
155
|
+
a(u === "" ? void 0 : { value: Number(u), operator: n });
|
|
156
|
+
}, m = (u) => {
|
|
157
|
+
const S = i && typeof i == "object" && "max" in i ? i.max : void 0;
|
|
158
|
+
a(u === "" ? S === void 0 ? void 0 : { min: e.min ?? 0, max: S } : { min: Number(u), max: S ?? e.max ?? 0 });
|
|
159
|
+
}, f = (u) => {
|
|
160
|
+
const S = i && typeof i == "object" && "min" in i ? i.min : void 0;
|
|
161
|
+
a(u === "" ? S === void 0 ? void 0 : { min: S, max: e.max ?? 0 } : { min: S ?? e.min ?? 0, max: Number(u) });
|
|
162
|
+
}, g = i && typeof i == "object" && "value" in i ? String(i.value) : "", d = i && typeof i == "object" && "min" in i ? String(i.min) : "", j = i && typeof i == "object" && "max" in i ? String(i.max) : "";
|
|
163
|
+
return /* @__PURE__ */ o("div", { className: `mapui:flex mapui:flex-col mapui:gap-1.5 ${s}`.trim(), children: [
|
|
164
|
+
/* @__PURE__ */ t(
|
|
165
|
+
"select",
|
|
166
|
+
{
|
|
167
|
+
value: n,
|
|
168
|
+
onChange: (u) => l(u.target.value),
|
|
169
|
+
"aria-label": `${e.label} operator`,
|
|
170
|
+
className: ee,
|
|
171
|
+
children: N.map((u) => /* @__PURE__ */ t("option", { value: u, children: (e.operatorLabelStyle === "word" ? Z : F)[u] }, u))
|
|
172
|
+
}
|
|
173
|
+
),
|
|
174
|
+
$ ? (
|
|
175
|
+
/* Between: min + max inputs */
|
|
176
|
+
/* @__PURE__ */ o("div", { className: "mapui:flex mapui:gap-2", children: [
|
|
177
|
+
/* @__PURE__ */ t(
|
|
178
|
+
"input",
|
|
179
|
+
{
|
|
180
|
+
type: "number",
|
|
181
|
+
value: d,
|
|
182
|
+
placeholder: e.min !== void 0 ? String(e.min) : "Min",
|
|
183
|
+
min: e.min,
|
|
184
|
+
max: e.max,
|
|
185
|
+
step: e.step,
|
|
186
|
+
onChange: (u) => m(u.target.value),
|
|
187
|
+
"aria-label": `${e.label} minimum`,
|
|
188
|
+
className: `${R} mapui:w-1/2`
|
|
189
|
+
}
|
|
190
|
+
),
|
|
191
|
+
/* @__PURE__ */ t(
|
|
192
|
+
"input",
|
|
193
|
+
{
|
|
194
|
+
type: "number",
|
|
195
|
+
value: j,
|
|
196
|
+
placeholder: e.max !== void 0 ? String(e.max) : "Max",
|
|
197
|
+
min: e.min,
|
|
198
|
+
max: e.max,
|
|
199
|
+
step: e.step,
|
|
200
|
+
onChange: (u) => f(u.target.value),
|
|
201
|
+
"aria-label": `${e.label} maximum`,
|
|
202
|
+
className: `${R} mapui:w-1/2`
|
|
203
|
+
}
|
|
204
|
+
)
|
|
205
|
+
] })
|
|
206
|
+
) : e.inputMode === "slider" ? (
|
|
207
|
+
/* Slider */
|
|
208
|
+
e.showRange ? /* @__PURE__ */ o("div", { className: "mapui:flex mapui:flex-col mapui:gap-0.5", children: [
|
|
209
|
+
/* @__PURE__ */ o("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
|
|
210
|
+
/* @__PURE__ */ t("span", { className: "mapui:text-xs mapui:text-slate-400 mapui:whitespace-nowrap", children: e.min ?? 0 }),
|
|
211
|
+
/* @__PURE__ */ t(
|
|
212
|
+
"input",
|
|
213
|
+
{
|
|
214
|
+
type: "range",
|
|
215
|
+
value: g !== "" ? g : e.min ?? 0,
|
|
216
|
+
min: e.min ?? 0,
|
|
217
|
+
max: e.max ?? 100,
|
|
218
|
+
step: e.step ?? 1,
|
|
219
|
+
onChange: (u) => p(u.target.value),
|
|
220
|
+
"aria-label": e.label,
|
|
221
|
+
className: "mapui:flex-1"
|
|
222
|
+
}
|
|
223
|
+
),
|
|
224
|
+
/* @__PURE__ */ t("span", { className: "mapui:text-xs mapui:text-slate-400 mapui:whitespace-nowrap", children: e.max ?? 100 })
|
|
225
|
+
] }),
|
|
226
|
+
/* @__PURE__ */ t("span", { className: "mapui:text-xs mapui:text-slate-600 mapui:text-center", children: g !== "" ? g : e.min ?? 0 })
|
|
227
|
+
] }) : /* @__PURE__ */ o("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
|
|
228
|
+
/* @__PURE__ */ t(
|
|
229
|
+
"input",
|
|
230
|
+
{
|
|
231
|
+
type: "range",
|
|
232
|
+
value: g !== "" ? g : e.min ?? 0,
|
|
233
|
+
min: e.min ?? 0,
|
|
234
|
+
max: e.max ?? 100,
|
|
235
|
+
step: e.step ?? 1,
|
|
236
|
+
onChange: (u) => p(u.target.value),
|
|
237
|
+
"aria-label": e.label,
|
|
238
|
+
className: "mapui:flex-1"
|
|
239
|
+
}
|
|
240
|
+
),
|
|
241
|
+
/* @__PURE__ */ t("span", { className: "mapui:text-xs mapui:text-slate-600 mapui:min-w-12 mapui:whitespace-nowrap mapui:text-right", children: g !== "" ? g : e.min ?? 0 })
|
|
242
|
+
] })
|
|
243
|
+
) : (
|
|
244
|
+
/* Number input */
|
|
245
|
+
/* @__PURE__ */ t(
|
|
246
|
+
"input",
|
|
247
|
+
{
|
|
248
|
+
id: v,
|
|
249
|
+
type: "number",
|
|
250
|
+
value: g,
|
|
251
|
+
placeholder: e.placeholder ?? "",
|
|
252
|
+
min: e.min,
|
|
253
|
+
max: e.max,
|
|
254
|
+
step: e.step,
|
|
255
|
+
onChange: (u) => p(u.target.value),
|
|
256
|
+
className: R
|
|
257
|
+
}
|
|
258
|
+
)
|
|
259
|
+
)
|
|
260
|
+
] });
|
|
261
|
+
}
|
|
262
|
+
const te = /* @__PURE__ */ new Set(["number", "integer"]), ie = /* @__PURE__ */ new Set(["string"]), ue = /* @__PURE__ */ new Set(["date-time", "date"]);
|
|
263
|
+
function pe(e) {
|
|
264
|
+
return e != null && e.type ? te.has(e.type) ? "number" : ie.has(e.type) && e.format && ue.has(e.format) ? "datetime" : "string" : "string";
|
|
265
|
+
}
|
|
266
|
+
function me(e) {
|
|
267
|
+
switch (e) {
|
|
268
|
+
case "number":
|
|
269
|
+
return { value: 0, operator: "eq" };
|
|
270
|
+
case "datetime":
|
|
271
|
+
return { start: "", end: "" };
|
|
272
|
+
default:
|
|
273
|
+
return "";
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
function re(e) {
|
|
277
|
+
return {
|
|
278
|
+
id: X(),
|
|
279
|
+
layerId: e,
|
|
280
|
+
property: "",
|
|
281
|
+
propertyType: "string",
|
|
282
|
+
value: ""
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
const K = "mapui:rounded mapui:border mapui:border-slate-300 mapui:bg-white mapui:px-2 mapui:py-1 mapui:text-xs mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500", M = "mapui:rounded mapui:border mapui:border-slate-300 mapui:bg-white mapui:px-2 mapui:py-1 mapui:text-xs mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500", le = [
|
|
286
|
+
{ value: "eq", label: "=" },
|
|
287
|
+
{ value: "gt", label: ">" },
|
|
288
|
+
{ value: "lt", label: "<" },
|
|
289
|
+
{ value: "gte", label: ">=" },
|
|
290
|
+
{ value: "lte", label: "<=" },
|
|
291
|
+
{ value: "between", label: "between" }
|
|
292
|
+
];
|
|
293
|
+
function ne({
|
|
294
|
+
filter: e,
|
|
295
|
+
onUpdate: i
|
|
296
|
+
}) {
|
|
297
|
+
const a = typeof e.value == "string" ? e.value : "";
|
|
298
|
+
return /* @__PURE__ */ t(
|
|
299
|
+
"input",
|
|
300
|
+
{
|
|
301
|
+
"aria-label": "Value",
|
|
302
|
+
type: "text",
|
|
303
|
+
value: a,
|
|
304
|
+
placeholder: "Value",
|
|
305
|
+
onChange: (s) => i(e.id, { value: s.target.value }),
|
|
306
|
+
className: `mapui:flex-1 ${M}`
|
|
307
|
+
}
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
function se({
|
|
311
|
+
filter: e,
|
|
312
|
+
onUpdate: i
|
|
313
|
+
}) {
|
|
314
|
+
const a = e.value, s = typeof a == "object" && "min" in a, v = s ? "between" : typeof a == "object" && "operator" in a ? a.operator : "eq", n = typeof a == "object" && "value" in a ? String(a.value) : "", y = typeof a == "object" && "min" in a ? String(a.min) : "", $ = typeof a == "object" && "max" in a ? String(a.max) : "", N = (l) => {
|
|
315
|
+
if (l === "between")
|
|
316
|
+
i(e.id, { value: { min: 0, max: 0 } });
|
|
317
|
+
else if (s)
|
|
318
|
+
i(e.id, { value: { value: 0, operator: l } });
|
|
319
|
+
else {
|
|
320
|
+
const p = typeof a == "object" && "value" in a ? a.value : 0;
|
|
321
|
+
i(e.id, { value: { value: p, operator: l } });
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
return /* @__PURE__ */ o("div", { className: "mapui:flex mapui:flex-1 mapui:items-center mapui:gap-1", children: [
|
|
325
|
+
/* @__PURE__ */ t(
|
|
326
|
+
"select",
|
|
327
|
+
{
|
|
328
|
+
"aria-label": "Operator",
|
|
329
|
+
value: v,
|
|
330
|
+
onChange: (l) => N(l.target.value),
|
|
331
|
+
className: K,
|
|
332
|
+
children: le.map((l) => /* @__PURE__ */ t("option", { value: l.value, children: l.label }, l.value))
|
|
333
|
+
}
|
|
334
|
+
),
|
|
335
|
+
s ? /* @__PURE__ */ o("div", { className: "mapui:flex mapui:flex-1 mapui:gap-1", children: [
|
|
336
|
+
/* @__PURE__ */ t(
|
|
337
|
+
"input",
|
|
338
|
+
{
|
|
339
|
+
"aria-label": "Minimum",
|
|
340
|
+
type: "number",
|
|
341
|
+
value: y,
|
|
342
|
+
placeholder: "Min",
|
|
343
|
+
onChange: (l) => {
|
|
344
|
+
const p = typeof a == "object" && "max" in a ? a.max : 0;
|
|
345
|
+
i(e.id, { value: { min: l.target.value === "" ? 0 : Number(l.target.value), max: p } });
|
|
346
|
+
},
|
|
347
|
+
className: `mapui:flex-1 mapui:min-w-0 ${M}`
|
|
348
|
+
}
|
|
349
|
+
),
|
|
350
|
+
/* @__PURE__ */ t(
|
|
351
|
+
"input",
|
|
352
|
+
{
|
|
353
|
+
"aria-label": "Maximum",
|
|
354
|
+
type: "number",
|
|
355
|
+
value: $,
|
|
356
|
+
placeholder: "Max",
|
|
357
|
+
onChange: (l) => {
|
|
358
|
+
const p = typeof a == "object" && "min" in a ? a.min : 0;
|
|
359
|
+
i(e.id, { value: { min: p, max: l.target.value === "" ? 0 : Number(l.target.value) } });
|
|
360
|
+
},
|
|
361
|
+
className: `mapui:flex-1 mapui:min-w-0 ${M}`
|
|
362
|
+
}
|
|
363
|
+
)
|
|
364
|
+
] }) : /* @__PURE__ */ t(
|
|
365
|
+
"input",
|
|
366
|
+
{
|
|
367
|
+
"aria-label": "Value",
|
|
368
|
+
type: "number",
|
|
369
|
+
value: n,
|
|
370
|
+
placeholder: "Value",
|
|
371
|
+
onChange: (l) => {
|
|
372
|
+
l.target.value === "" ? i(e.id, { value: { value: 0, operator: v } }) : i(e.id, { value: { value: Number(l.target.value), operator: v } });
|
|
373
|
+
},
|
|
374
|
+
className: `mapui:flex-1 mapui:min-w-0 ${M}`
|
|
375
|
+
}
|
|
376
|
+
)
|
|
377
|
+
] });
|
|
378
|
+
}
|
|
379
|
+
function oe({
|
|
380
|
+
filter: e,
|
|
381
|
+
onUpdate: i
|
|
382
|
+
}) {
|
|
383
|
+
const a = e.value, s = typeof a == "object" && "start" in a ? a.start : "", v = typeof a == "object" && "end" in a ? a.end : "";
|
|
384
|
+
return /* @__PURE__ */ o("div", { className: "mapui:flex mapui:flex-1 mapui:flex-col mapui:gap-1", children: [
|
|
385
|
+
/* @__PURE__ */ o("div", { className: "mapui:flex mapui:items-center mapui:gap-1", children: [
|
|
386
|
+
/* @__PURE__ */ t("span", { className: "mapui:text-xs mapui:text-slate-400 mapui:w-8 mapui:shrink-0", children: "From" }),
|
|
387
|
+
/* @__PURE__ */ t(
|
|
388
|
+
"input",
|
|
389
|
+
{
|
|
390
|
+
"aria-label": "Start date",
|
|
391
|
+
type: "datetime-local",
|
|
392
|
+
value: s,
|
|
393
|
+
onChange: (n) => i(e.id, { value: { start: n.target.value, end: v } }),
|
|
394
|
+
className: `mapui:flex-1 mapui:min-w-0 ${M}`
|
|
395
|
+
}
|
|
396
|
+
)
|
|
397
|
+
] }),
|
|
398
|
+
/* @__PURE__ */ o("div", { className: "mapui:flex mapui:items-center mapui:gap-1", children: [
|
|
399
|
+
/* @__PURE__ */ t("span", { className: "mapui:text-xs mapui:text-slate-400 mapui:w-8 mapui:shrink-0", children: "To" }),
|
|
400
|
+
/* @__PURE__ */ t(
|
|
401
|
+
"input",
|
|
402
|
+
{
|
|
403
|
+
"aria-label": "End date",
|
|
404
|
+
type: "datetime-local",
|
|
405
|
+
value: v,
|
|
406
|
+
onChange: (n) => i(e.id, { value: { start: s, end: n.target.value } }),
|
|
407
|
+
className: `mapui:flex-1 mapui:min-w-0 ${M}`
|
|
408
|
+
}
|
|
409
|
+
)
|
|
410
|
+
] })
|
|
411
|
+
] });
|
|
412
|
+
}
|
|
413
|
+
function ce({
|
|
414
|
+
layers: e,
|
|
415
|
+
availableProperties: i,
|
|
416
|
+
filters: a,
|
|
417
|
+
onFiltersChange: s,
|
|
418
|
+
maxFiltersPerLayer: v = 20
|
|
419
|
+
}) {
|
|
420
|
+
if (e.length === 0)
|
|
421
|
+
return /* @__PURE__ */ t("p", { className: "mapui:m-0 mapui:text-xs mapui:text-slate-500", children: "No layers available." });
|
|
422
|
+
const n = (p, m) => {
|
|
423
|
+
s(a.map((f) => f.id === p ? { ...f, ...m } : f));
|
|
424
|
+
}, y = (p) => {
|
|
425
|
+
s(a.filter((m) => m.id !== p));
|
|
426
|
+
}, $ = (p) => {
|
|
427
|
+
s([...a, re(p)]);
|
|
428
|
+
}, N = (p) => {
|
|
429
|
+
s(a.filter((m) => m.layerId !== p));
|
|
430
|
+
}, l = (p, m, f) => {
|
|
431
|
+
const g = f.find((u) => u.name === m), d = pe(g), j = d !== p.propertyType;
|
|
432
|
+
s(
|
|
433
|
+
a.map(
|
|
434
|
+
(u) => u.id === p.id ? {
|
|
435
|
+
...u,
|
|
436
|
+
property: m,
|
|
437
|
+
propertyType: d,
|
|
438
|
+
value: j ? me(d) : u.value
|
|
439
|
+
} : u
|
|
440
|
+
)
|
|
441
|
+
);
|
|
442
|
+
};
|
|
443
|
+
return /* @__PURE__ */ o("div", { className: "mapui:flex mapui:flex-col mapui:gap-4", children: [
|
|
444
|
+
/* @__PURE__ */ o("div", { children: [
|
|
445
|
+
/* @__PURE__ */ t("h4", { className: "mapui:m-0 mapui:mb-1 mapui:text-sm mapui:font-semibold mapui:text-slate-700", children: "All Filters" }),
|
|
446
|
+
/* @__PURE__ */ t("p", { className: "mapui:m-0 mapui:text-xs mapui:text-slate-500", children: "Pick a layer property and enter a value. Combined with search filters via AND." })
|
|
447
|
+
] }),
|
|
448
|
+
e.map((p) => {
|
|
449
|
+
const m = a.filter((d) => d.layerId === p.id), f = (i == null ? void 0 : i[p.id]) ?? [], g = m.length >= v;
|
|
450
|
+
return /* @__PURE__ */ o(
|
|
451
|
+
"div",
|
|
452
|
+
{
|
|
453
|
+
className: "mapui:flex mapui:flex-col mapui:gap-2 mapui:rounded mapui:border mapui:border-slate-200 mapui:bg-slate-50 mapui:p-3",
|
|
454
|
+
children: [
|
|
455
|
+
/* @__PURE__ */ o("div", { className: "mapui:flex mapui:items-center mapui:justify-between", children: [
|
|
456
|
+
/* @__PURE__ */ t("span", { className: "mapui:text-sm mapui:font-medium mapui:text-slate-700", children: p.label }),
|
|
457
|
+
m.length > 0 && /* @__PURE__ */ t(
|
|
458
|
+
"button",
|
|
459
|
+
{
|
|
460
|
+
type: "button",
|
|
461
|
+
onClick: () => N(p.id),
|
|
462
|
+
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",
|
|
463
|
+
children: "Clear"
|
|
464
|
+
}
|
|
465
|
+
)
|
|
466
|
+
] }),
|
|
467
|
+
m.length === 0 ? /* @__PURE__ */ t("p", { className: "mapui:m-0 mapui:text-xs mapui:text-slate-500", children: "No filters added for this layer." }) : /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-2", children: m.map((d) => {
|
|
468
|
+
const j = `propfilter-${d.id}-property`;
|
|
469
|
+
return /* @__PURE__ */ o(
|
|
470
|
+
"div",
|
|
471
|
+
{
|
|
472
|
+
className: "mapui:flex mapui:items-start mapui:gap-2",
|
|
473
|
+
children: [
|
|
474
|
+
/* @__PURE__ */ o(
|
|
475
|
+
"select",
|
|
476
|
+
{
|
|
477
|
+
id: j,
|
|
478
|
+
"aria-label": "Property",
|
|
479
|
+
value: d.property,
|
|
480
|
+
onChange: (u) => l(d, u.target.value, f),
|
|
481
|
+
className: `mapui:flex-1 ${K}`,
|
|
482
|
+
children: [
|
|
483
|
+
/* @__PURE__ */ t("option", { value: "", children: f.length === 0 ? "No properties available" : "Select property..." }),
|
|
484
|
+
f.map((u) => /* @__PURE__ */ t("option", { value: u.name, children: u.title ?? u.name }, u.name))
|
|
485
|
+
]
|
|
486
|
+
}
|
|
487
|
+
),
|
|
488
|
+
d.propertyType === "number" ? /* @__PURE__ */ t(se, { filter: d, onUpdate: n }) : d.propertyType === "datetime" ? /* @__PURE__ */ t(oe, { filter: d, onUpdate: n }) : /* @__PURE__ */ t(ne, { filter: d, onUpdate: n }),
|
|
489
|
+
/* @__PURE__ */ t(
|
|
490
|
+
"button",
|
|
491
|
+
{
|
|
492
|
+
type: "button",
|
|
493
|
+
onClick: () => y(d.id),
|
|
494
|
+
"aria-label": "Remove filter",
|
|
495
|
+
title: "Remove filter",
|
|
496
|
+
className: "mapui:cursor-pointer mapui:border-none mapui:bg-transparent mapui:px-1 mapui:text-sm mapui:text-slate-500 hover:mapui:text-red-600",
|
|
497
|
+
children: "×"
|
|
498
|
+
}
|
|
499
|
+
)
|
|
500
|
+
]
|
|
501
|
+
},
|
|
502
|
+
d.id
|
|
503
|
+
);
|
|
504
|
+
}) }),
|
|
505
|
+
g ? /* @__PURE__ */ o("p", { className: "mapui:m-0 mapui:text-xs mapui:text-slate-500", children: [
|
|
506
|
+
"Up to ",
|
|
507
|
+
v,
|
|
508
|
+
" filters per layer."
|
|
509
|
+
] }) : /* @__PURE__ */ t(
|
|
510
|
+
"button",
|
|
511
|
+
{
|
|
512
|
+
type: "button",
|
|
513
|
+
onClick: () => $(p.id),
|
|
514
|
+
className: "mapui:cursor-pointer mapui:self-start mapui:rounded mapui:border mapui:border-dashed mapui:border-slate-300 mapui:bg-white mapui:px-2 mapui:py-0.5 mapui:text-xs mapui:text-slate-600 hover:mapui:border-blue-400 hover:mapui:text-blue-600",
|
|
515
|
+
children: "+ Add filter"
|
|
516
|
+
}
|
|
517
|
+
)
|
|
518
|
+
]
|
|
519
|
+
},
|
|
520
|
+
p.id
|
|
521
|
+
);
|
|
522
|
+
})
|
|
523
|
+
] });
|
|
524
|
+
}
|
|
525
|
+
function de(e) {
|
|
526
|
+
return e === void 0 || e === "" || e === null ? !1 : typeof e == "object" && "start" in e && "end" in e ? e.start !== "" || e.end !== "" : !0;
|
|
527
|
+
}
|
|
528
|
+
function ve({
|
|
529
|
+
layers: e,
|
|
530
|
+
activeFilters: i,
|
|
531
|
+
onFilterChange: a,
|
|
532
|
+
onClearFilters: s,
|
|
533
|
+
autocompleteSuggestions: v = {},
|
|
534
|
+
onZoomToFeature: n,
|
|
535
|
+
onFetchSuggestions: y,
|
|
536
|
+
className: $ = "",
|
|
537
|
+
hideTitle: N,
|
|
538
|
+
expandable: l = !1,
|
|
539
|
+
expanded: p = !1,
|
|
540
|
+
onExpandedChange: m,
|
|
541
|
+
availableProperties: f,
|
|
542
|
+
propertyFilters: g,
|
|
543
|
+
onPropertyFiltersChange: d
|
|
544
|
+
}) {
|
|
545
|
+
const j = E(
|
|
546
|
+
() => e.filter((c) => {
|
|
547
|
+
var V;
|
|
548
|
+
return (V = c.search) == null ? void 0 : V.fields.length;
|
|
549
|
+
}),
|
|
550
|
+
[e]
|
|
551
|
+
);
|
|
552
|
+
B(() => {
|
|
553
|
+
if (y)
|
|
554
|
+
for (const c of j)
|
|
555
|
+
for (const V of c.search.fields)
|
|
556
|
+
V.type === "select" && V.prefetch && y(c.id, V.property, "", { prefetch: !0 });
|
|
557
|
+
}, [j, y]);
|
|
558
|
+
const u = l && !p, S = l && p, D = p && g !== void 0 && d !== void 0, b = !N || S ? /* @__PURE__ */ o("div", { className: "mapui:flex mapui:items-center mapui:justify-between mapui:mb-2", children: [
|
|
559
|
+
N ? /* @__PURE__ */ t("span", {}) : /* @__PURE__ */ t("h3", { className: "mapui:m-0 mapui:text-sm mapui:font-semibold mapui:text-slate-700", children: "Search & Filter" }),
|
|
560
|
+
S && /* @__PURE__ */ t(
|
|
561
|
+
"button",
|
|
562
|
+
{
|
|
563
|
+
type: "button",
|
|
564
|
+
onClick: () => m == null ? void 0 : m(!1),
|
|
565
|
+
title: "Close",
|
|
566
|
+
className: "mapui:cursor-pointer mapui:rounded mapui:border-none mapui:bg-transparent mapui:p-2 mapui:min-w-[44px] mapui:min-h-[44px] mapui:flex mapui:items-center mapui:justify-center mapui:text-slate-500 hover:mapui:text-slate-800",
|
|
567
|
+
"aria-label": "Close expanded search",
|
|
568
|
+
children: /* @__PURE__ */ t("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 20 20", fill: "currentColor", className: "mapui:h-4 mapui:w-4", children: /* @__PURE__ */ t("path", { d: "M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z" }) })
|
|
569
|
+
}
|
|
570
|
+
)
|
|
571
|
+
] }) : null, w = u ? /* @__PURE__ */ t(
|
|
572
|
+
"button",
|
|
573
|
+
{
|
|
574
|
+
type: "button",
|
|
575
|
+
onClick: () => m == null ? void 0 : m(!0),
|
|
576
|
+
title: "Expand to full search builder",
|
|
577
|
+
"aria-label": "Expand to full search builder",
|
|
578
|
+
className: "mapui:mt-1 mapui:w-full mapui:cursor-pointer mapui:border-0 mapui:border-t mapui:border-solid mapui:border-slate-200 mapui:bg-transparent mapui:pt-2 mapui:text-center mapui:text-xs mapui:text-slate-600 hover:mapui:text-blue-600",
|
|
579
|
+
children: "Expand"
|
|
580
|
+
}
|
|
581
|
+
) : null;
|
|
582
|
+
if (j.length === 0) {
|
|
583
|
+
const c = /* @__PURE__ */ o("div", { className: `mapui:flex mapui:flex-col mapui:gap-1 ${$}`.trim(), children: [
|
|
584
|
+
b,
|
|
585
|
+
/* @__PURE__ */ t("p", { className: "mapui:m-0 mapui:text-xs mapui:text-slate-500", children: "No searchable layers configured." }),
|
|
586
|
+
w
|
|
587
|
+
] });
|
|
588
|
+
return p ? /* @__PURE__ */ t(C, { onClose: () => m == null ? void 0 : m(!1), children: c }) : c;
|
|
589
|
+
}
|
|
590
|
+
const A = /* @__PURE__ */ o("div", { className: `mapui:flex mapui:flex-col mapui:gap-3 ${p ? "" : $}`.trim(), children: [
|
|
591
|
+
b,
|
|
592
|
+
j.map((c) => {
|
|
593
|
+
const V = i[c.id] ?? {}, T = Object.values(V).some(de);
|
|
594
|
+
return /* @__PURE__ */ o("div", { className: "mapui:flex mapui:flex-col mapui:gap-3 mapui:border-b mapui:border-slate-100 mapui:pb-3 last:mapui:border-0", children: [
|
|
595
|
+
/* @__PURE__ */ o("div", { className: "mapui:flex mapui:items-center mapui:justify-between", children: [
|
|
596
|
+
/* @__PURE__ */ t("span", { className: "mapui:text-sm mapui:font-medium mapui:text-slate-600", children: c.label }),
|
|
597
|
+
T && /* @__PURE__ */ t(
|
|
598
|
+
"button",
|
|
599
|
+
{
|
|
600
|
+
type: "button",
|
|
601
|
+
onClick: () => s(c.id),
|
|
602
|
+
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",
|
|
603
|
+
children: "Clear"
|
|
604
|
+
}
|
|
605
|
+
)
|
|
606
|
+
] }),
|
|
607
|
+
c.search.fields.map((r) => {
|
|
608
|
+
const h = V[r.property], _ = `${c.id}:${r.property}`, I = `search-${c.id}-${r.property}`;
|
|
609
|
+
return /* @__PURE__ */ o("div", { className: "mapui:flex mapui:flex-col mapui:gap-1", children: [
|
|
610
|
+
/* @__PURE__ */ t("label", { htmlFor: I, className: "mapui:text-xs mapui:text-slate-500", children: r.label }),
|
|
611
|
+
r.type === "text" && r.autocomplete ? /* @__PURE__ */ t(
|
|
612
|
+
U,
|
|
613
|
+
{
|
|
614
|
+
id: I,
|
|
615
|
+
value: h ?? "",
|
|
616
|
+
onChange: (x) => {
|
|
617
|
+
a(c.id, r.property, x || void 0), x && r.zoomTo && (n == null || n(c.id, r.property, x));
|
|
618
|
+
},
|
|
619
|
+
suggestions: [.../* @__PURE__ */ new Set([
|
|
620
|
+
...v[_] ?? [],
|
|
621
|
+
...r.options ?? []
|
|
622
|
+
])],
|
|
623
|
+
onQueryChange: (x) => y == null ? void 0 : y(c.id, r.property, x, { prefetch: r.prefetch }),
|
|
624
|
+
placeholder: r.placeholder ?? ""
|
|
625
|
+
}
|
|
626
|
+
) : r.type === "text" ? /* @__PURE__ */ t(
|
|
627
|
+
"input",
|
|
628
|
+
{
|
|
629
|
+
id: I,
|
|
630
|
+
type: "text",
|
|
631
|
+
value: h ?? "",
|
|
632
|
+
placeholder: r.placeholder ?? "",
|
|
633
|
+
onChange: (x) => a(c.id, r.property, x.target.value || void 0),
|
|
634
|
+
onBlur: (x) => {
|
|
635
|
+
x.target.value && r.zoomTo && (n == null || n(c.id, r.property, x.target.value));
|
|
636
|
+
},
|
|
637
|
+
onKeyDown: (x) => {
|
|
638
|
+
x.key === "Enter" && x.target.value && r.zoomTo && (n == null || n(c.id, r.property, x.target.value));
|
|
639
|
+
},
|
|
640
|
+
className: "mapui:rounded mapui:border mapui:border-slate-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"
|
|
641
|
+
}
|
|
642
|
+
) : r.type === "datetime" && r.range ? /* @__PURE__ */ t(
|
|
643
|
+
Q,
|
|
644
|
+
{
|
|
645
|
+
id: I,
|
|
646
|
+
startValue: h && typeof h == "object" && "start" in h ? h.start : "",
|
|
647
|
+
endValue: h && typeof h == "object" && "end" in h ? h.end : "",
|
|
648
|
+
onStartChange: (x) => a(c.id, r.property, {
|
|
649
|
+
start: x,
|
|
650
|
+
end: h && typeof h == "object" && "end" in h ? h.end : ""
|
|
651
|
+
}),
|
|
652
|
+
onEndChange: (x) => a(c.id, r.property, {
|
|
653
|
+
start: h && typeof h == "object" && "start" in h ? h.start : "",
|
|
654
|
+
end: x
|
|
655
|
+
})
|
|
656
|
+
}
|
|
657
|
+
) : r.type === "datetime" ? /* @__PURE__ */ t(
|
|
658
|
+
"input",
|
|
659
|
+
{
|
|
660
|
+
id: I,
|
|
661
|
+
type: "datetime-local",
|
|
662
|
+
value: h ?? "",
|
|
663
|
+
onChange: (x) => a(c.id, r.property, x.target.value || void 0),
|
|
664
|
+
className: "mapui:rounded mapui:border mapui:border-slate-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"
|
|
665
|
+
}
|
|
666
|
+
) : r.type === "number" ? /* @__PURE__ */ t(
|
|
667
|
+
ae,
|
|
668
|
+
{
|
|
669
|
+
id: I,
|
|
670
|
+
field: r,
|
|
671
|
+
value: h,
|
|
672
|
+
onChange: (x) => a(c.id, r.property, x)
|
|
673
|
+
}
|
|
674
|
+
) : r.type === "select" ? (() => {
|
|
675
|
+
const x = r, Y = v[_] ?? [], G = x.options ?? [], H = [.../* @__PURE__ */ new Set([...Y, ...G])];
|
|
676
|
+
return /* @__PURE__ */ o(
|
|
677
|
+
"select",
|
|
678
|
+
{
|
|
679
|
+
id: I,
|
|
680
|
+
value: h ?? "",
|
|
681
|
+
onChange: (O) => {
|
|
682
|
+
const L = O.target.value || void 0;
|
|
683
|
+
a(c.id, r.property, L), L && r.zoomTo && (n == null || n(c.id, r.property, L));
|
|
684
|
+
},
|
|
685
|
+
className: "mapui:rounded mapui:border mapui:border-slate-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",
|
|
686
|
+
children: [
|
|
687
|
+
/* @__PURE__ */ t("option", { value: "", children: r.placeholder ?? "Select..." }),
|
|
688
|
+
H.map((O) => /* @__PURE__ */ t("option", { value: O, children: O }, O))
|
|
689
|
+
]
|
|
690
|
+
}
|
|
691
|
+
);
|
|
692
|
+
})() : null
|
|
693
|
+
] }, r.property);
|
|
694
|
+
})
|
|
695
|
+
] }, c.id);
|
|
696
|
+
}),
|
|
697
|
+
D && /* @__PURE__ */ t("div", { className: "mapui:mt-2 mapui:border-t mapui:border-slate-200 mapui:pt-3", children: /* @__PURE__ */ t(
|
|
698
|
+
ce,
|
|
699
|
+
{
|
|
700
|
+
layers: e,
|
|
701
|
+
availableProperties: f,
|
|
702
|
+
filters: g,
|
|
703
|
+
onFiltersChange: d
|
|
704
|
+
}
|
|
705
|
+
) }),
|
|
706
|
+
w
|
|
707
|
+
] });
|
|
708
|
+
return p ? /* @__PURE__ */ t(C, { onClose: () => m == null ? void 0 : m(!1), children: A }) : A;
|
|
709
|
+
}
|
|
710
|
+
function C({ onClose: e, children: i }) {
|
|
711
|
+
return /* @__PURE__ */ t(
|
|
712
|
+
"div",
|
|
713
|
+
{
|
|
714
|
+
className: "mapui:fixed mapui:inset-0 mapui:z-50 mapui:flex mapui:items-center mapui:justify-center mapui:bg-black/40 mapui:p-4",
|
|
715
|
+
onClick: (a) => {
|
|
716
|
+
a.target === a.currentTarget && e();
|
|
717
|
+
},
|
|
718
|
+
children: /* @__PURE__ */ t("div", { className: "mapui:relative mapui:flex mapui:max-h-[90vh] mapui:w-full mapui:max-w-2xl mapui:flex-col mapui:overflow-y-auto mapui:rounded-lg mapui:bg-white mapui:p-4 mapui:shadow-xl", children: i })
|
|
719
|
+
}
|
|
720
|
+
);
|
|
721
|
+
}
|
|
722
|
+
export {
|
|
723
|
+
ce as P,
|
|
724
|
+
ve as S
|
|
725
|
+
};
|