@ogc-maps/storybook-components 0.15.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.
Files changed (165) hide show
  1. package/LICENSE +661 -0
  2. package/dist/{BasemapSwitcher-BW7lyZ2Y.js → BasemapSwitcher-DuqVusX0.js} +9 -9
  3. package/dist/CollapsibleControl-BTIkiTmU.js +60 -0
  4. package/dist/CoordinateDisplay-BblQ34mS.js +154 -0
  5. package/dist/{ExportButton-Ck1dESnc.js → ExportButton-C8hCCsav.js} +7 -7
  6. package/dist/{FeatureDetailPanel-CkFpdEKW.js → FeatureDetailPanel-DgCHiNi9.js} +16 -16
  7. package/dist/FeatureTooltip-DHjMZC0u.js +49 -0
  8. package/dist/{LayerPanel-C6H74vhO.js → LayerPanel-BkDbZ66Z.js} +28 -28
  9. package/dist/Legend-CvBd-v0n.js +285 -0
  10. package/dist/PropertyList-0EonV_BQ.js +33 -0
  11. package/dist/SearchPanel-DIb7aYVs.js +725 -0
  12. package/dist/components/BasemapSwitcher/index.js +1 -1
  13. package/dist/components/CollapsibleControl/CollapsibleControl.d.ts +4 -1
  14. package/dist/components/CollapsibleControl/CollapsibleControl.d.ts.map +1 -1
  15. package/dist/components/CollapsibleControl/index.js +1 -1
  16. package/dist/components/CompassControl/CompassControl.d.ts +19 -0
  17. package/dist/components/CompassControl/CompassControl.d.ts.map +1 -0
  18. package/dist/components/CompassControl/index.d.ts +3 -0
  19. package/dist/components/CompassControl/index.d.ts.map +1 -0
  20. package/dist/components/CoordinateDisplay/CoordinateDisplay.d.ts +35 -4
  21. package/dist/components/CoordinateDisplay/CoordinateDisplay.d.ts.map +1 -1
  22. package/dist/components/CoordinateDisplay/CoordinateDisplay.test.d.ts +2 -0
  23. package/dist/components/CoordinateDisplay/CoordinateDisplay.test.d.ts.map +1 -0
  24. package/dist/components/CoordinateDisplay/index.d.ts +1 -1
  25. package/dist/components/CoordinateDisplay/index.d.ts.map +1 -1
  26. package/dist/components/CoordinateDisplay/index.js +5 -3
  27. package/dist/components/Cql2FilterEditor/Cql2FilterEditor.d.ts.map +1 -1
  28. package/dist/components/Cql2FilterEditor/FilterRuleGroupEditor.d.ts.map +1 -1
  29. package/dist/components/Cql2FilterEditor/ParameterizableField.d.ts +30 -0
  30. package/dist/components/Cql2FilterEditor/ParameterizableField.d.ts.map +1 -0
  31. package/dist/components/Cql2FilterEditor/styles.d.ts +2 -2
  32. package/dist/components/Cql2FilterEditor/styles.d.ts.map +1 -1
  33. package/dist/components/ExportButton/index.js +1 -1
  34. package/dist/components/ExportModal/ExportModal.d.ts +20 -1
  35. package/dist/components/ExportModal/ExportModal.d.ts.map +1 -1
  36. package/dist/components/ExportModal/index.d.ts +1 -1
  37. package/dist/components/ExportModal/index.d.ts.map +1 -1
  38. package/dist/components/FeatureDetailPanel/index.js +1 -1
  39. package/dist/components/FeatureTooltip/index.js +1 -1
  40. package/dist/components/GlobalSearchBar/GlobalSearchBar.d.ts +25 -0
  41. package/dist/components/GlobalSearchBar/GlobalSearchBar.d.ts.map +1 -0
  42. package/dist/components/GlobalSearchBar/GlobalSearchBar.test.d.ts +2 -0
  43. package/dist/components/GlobalSearchBar/GlobalSearchBar.test.d.ts.map +1 -0
  44. package/dist/components/GlobalSearchBar/index.d.ts +3 -0
  45. package/dist/components/GlobalSearchBar/index.d.ts.map +1 -0
  46. package/dist/components/GlobalSearchConfigEditor/GlobalSearchConfigEditor.d.ts +22 -0
  47. package/dist/components/GlobalSearchConfigEditor/GlobalSearchConfigEditor.d.ts.map +1 -0
  48. package/dist/components/GlobalSearchConfigEditor/GlobalSearchConfigEditor.test.d.ts +2 -0
  49. package/dist/components/GlobalSearchConfigEditor/GlobalSearchConfigEditor.test.d.ts.map +1 -0
  50. package/dist/components/GlobalSearchConfigEditor/index.d.ts +3 -0
  51. package/dist/components/GlobalSearchConfigEditor/index.d.ts.map +1 -0
  52. package/dist/components/ImageryEditor/ImageryEditor.d.ts +0 -1
  53. package/dist/components/ImageryEditor/ImageryEditor.d.ts.map +1 -1
  54. package/dist/components/ImageryEditor/index.d.ts +2 -1
  55. package/dist/components/ImageryEditor/index.d.ts.map +1 -1
  56. package/dist/components/ImageryPanel/ImageryPanel.d.ts.map +1 -1
  57. package/dist/components/InfoControl/InfoControl.d.ts +12 -0
  58. package/dist/components/InfoControl/InfoControl.d.ts.map +1 -0
  59. package/dist/components/InfoControl/InfoModal.d.ts +16 -0
  60. package/dist/components/InfoControl/InfoModal.d.ts.map +1 -0
  61. package/dist/components/InfoControl/index.d.ts +5 -0
  62. package/dist/components/InfoControl/index.d.ts.map +1 -0
  63. package/dist/components/LayerEditor/LayerEditor.d.ts +6 -1
  64. package/dist/components/LayerEditor/LayerEditor.d.ts.map +1 -1
  65. package/dist/components/LayerEditor/LayerList.d.ts +8 -1
  66. package/dist/components/LayerEditor/LayerList.d.ts.map +1 -1
  67. package/dist/components/LayerEditor/index.d.ts +1 -1
  68. package/dist/components/LayerEditor/index.d.ts.map +1 -1
  69. package/dist/components/LayerPanel/index.js +1 -1
  70. package/dist/components/Legend/Legend.d.ts +7 -1
  71. package/dist/components/Legend/Legend.d.ts.map +1 -1
  72. package/dist/components/Legend/index.js +1 -1
  73. package/dist/components/PropertyFilterPanel/PropertyFilterPanel.d.ts +21 -0
  74. package/dist/components/PropertyFilterPanel/PropertyFilterPanel.d.ts.map +1 -0
  75. package/dist/components/PropertyFilterPanel/index.d.ts +3 -0
  76. package/dist/components/PropertyFilterPanel/index.d.ts.map +1 -0
  77. package/dist/components/QueryPanel/QueryPanel.d.ts.map +1 -1
  78. package/dist/components/ResultsDrawer/ResultsDrawer.d.ts +12 -1
  79. package/dist/components/ResultsDrawer/ResultsDrawer.d.ts.map +1 -1
  80. package/dist/components/ResultsDrawer/index.d.ts +1 -1
  81. package/dist/components/ResultsDrawer/index.d.ts.map +1 -1
  82. package/dist/components/ResultsDrawer/tableUtils.d.ts +11 -0
  83. package/dist/components/ResultsDrawer/tableUtils.d.ts.map +1 -0
  84. package/dist/components/ScaleBarControl/ScaleBarControl.d.ts +32 -0
  85. package/dist/components/ScaleBarControl/ScaleBarControl.d.ts.map +1 -0
  86. package/dist/components/ScaleBarControl/index.d.ts +2 -0
  87. package/dist/components/ScaleBarControl/index.d.ts.map +1 -0
  88. package/dist/components/SearchPanel/SearchPanel.d.ts +15 -2
  89. package/dist/components/SearchPanel/SearchPanel.d.ts.map +1 -1
  90. package/dist/components/SearchPanel/index.js +1 -1
  91. package/dist/components/SideMenuPanel/SideMenuPanel.d.ts +51 -0
  92. package/dist/components/SideMenuPanel/SideMenuPanel.d.ts.map +1 -0
  93. package/dist/components/SideMenuPanel/index.d.ts +3 -0
  94. package/dist/components/SideMenuPanel/index.d.ts.map +1 -0
  95. package/dist/components/SourceEditor/SourceEditor.d.ts +3 -1
  96. package/dist/components/SourceEditor/SourceEditor.d.ts.map +1 -1
  97. package/dist/components/SourceEditor/SourceList.d.ts +6 -1
  98. package/dist/components/SourceEditor/SourceList.d.ts.map +1 -1
  99. package/dist/components/SourceEditor/index.d.ts +1 -1
  100. package/dist/components/SourceEditor/index.d.ts.map +1 -1
  101. package/dist/components/StyleEditor/DataDrivenColorEditor.d.ts +6 -1
  102. package/dist/components/StyleEditor/DataDrivenColorEditor.d.ts.map +1 -1
  103. package/dist/components/StyleEditor/PropertyField.d.ts +4 -1
  104. package/dist/components/StyleEditor/PropertyField.d.ts.map +1 -1
  105. package/dist/components/StyleEditor/PropertyGroup.d.ts +4 -1
  106. package/dist/components/StyleEditor/PropertyGroup.d.ts.map +1 -1
  107. package/dist/components/StyleEditor/StyleEditor.d.ts +5 -1
  108. package/dist/components/StyleEditor/StyleEditor.d.ts.map +1 -1
  109. package/dist/components/UIConfigEditor/UIConfigEditor.d.ts +13 -2
  110. package/dist/components/UIConfigEditor/UIConfigEditor.d.ts.map +1 -1
  111. package/dist/components/UserMenu/UserMenu.d.ts +15 -0
  112. package/dist/components/UserMenu/UserMenu.d.ts.map +1 -0
  113. package/dist/components/UserMenu/index.d.ts +3 -0
  114. package/dist/components/UserMenu/index.d.ts.map +1 -0
  115. package/dist/components/ViewEditor/ViewEditor.d.ts.map +1 -1
  116. package/dist/components/index.d.ts +22 -5
  117. package/dist/components/index.d.ts.map +1 -1
  118. package/dist/components/shared/controlIcons.d.ts +10 -0
  119. package/dist/components/shared/controlIcons.d.ts.map +1 -0
  120. package/dist/{geo-BXaVaxak.js → geo-DUdRIR7u.js} +1288 -1219
  121. package/dist/hooks/index.js +2 -2
  122. package/dist/hooks/useExport.d.ts +6 -0
  123. package/dist/hooks/useExport.d.ts.map +1 -1
  124. package/dist/id-C2J6iu8_.js +11 -0
  125. package/dist/{index-CzYEPGO9.js → index-BtQnyWPg.js} +1318 -1171
  126. package/dist/main.js +13448 -2959
  127. package/dist/schemas/config.d.ts +341 -2
  128. package/dist/schemas/config.d.ts.map +1 -1
  129. package/dist/schemas/index.d.ts +1 -1
  130. package/dist/schemas/index.d.ts.map +1 -1
  131. package/dist/schemas/index.js +35 -24
  132. package/dist/style.css +1 -1
  133. package/dist/types/index.d.ts +10 -2
  134. package/dist/types/index.d.ts.map +1 -1
  135. package/dist/types/index.js +56 -44
  136. package/dist/useSelection-BFHYsPvU.js +224 -0
  137. package/dist/utils/colorPalettes.d.ts +4 -2
  138. package/dist/utils/colorPalettes.d.ts.map +1 -1
  139. package/dist/utils/colorThemes.d.ts +12 -0
  140. package/dist/utils/colorThemes.d.ts.map +1 -0
  141. package/dist/utils/cql2.d.ts.map +1 -1
  142. package/dist/utils/exportConverters.d.ts.map +1 -1
  143. package/dist/utils/geo.d.ts +53 -0
  144. package/dist/utils/geo.d.ts.map +1 -1
  145. package/dist/utils/id.d.ts +2 -0
  146. package/dist/utils/id.d.ts.map +1 -0
  147. package/dist/utils/index.d.ts +4 -0
  148. package/dist/utils/index.d.ts.map +1 -1
  149. package/dist/utils/index.js +352 -150
  150. package/dist/utils/ogcApi.d.ts +10 -5
  151. package/dist/utils/ogcApi.d.ts.map +1 -1
  152. package/dist/utils/propertyFilters.d.ts +35 -0
  153. package/dist/utils/propertyFilters.d.ts.map +1 -0
  154. package/dist/utils/queryParameters.d.ts +1 -0
  155. package/dist/utils/queryParameters.d.ts.map +1 -1
  156. package/dist/utils/slugify.d.ts +2 -0
  157. package/dist/utils/slugify.d.ts.map +1 -0
  158. package/package.json +13 -7
  159. package/dist/CollapsibleControl-qo9daiD8.js +0 -53
  160. package/dist/CoordinateDisplay-PxPmVjpm.js +0 -47
  161. package/dist/FeatureTooltip-DxzN-jnp.js +0 -49
  162. package/dist/Legend-BLWBzD7Y.js +0 -275
  163. package/dist/PropertyList-BGXHLVBM.js +0 -33
  164. package/dist/SearchPanel-4Y12jfuP.js +0 -401
  165. package/dist/useSelection-B1RnQZlj.js +0 -206
@@ -1,401 +0,0 @@
1
- import { jsxs as x, jsx as m } from "react/jsx-runtime";
2
- import { useState as I, useRef as A, useId as S, useMemo as E, useCallback as R, useEffect as D } from "react";
3
- function V({
4
- value: e,
5
- onChange: p,
6
- suggestions: u,
7
- onQueryChange: b,
8
- placeholder: f = "",
9
- className: o = "",
10
- id: g
11
- }) {
12
- const [y, h] = I(!1), [l, i] = I(-1), c = A(null), v = S(), a = l >= 0 ? `${v}-option-${l}` : void 0, n = E(
13
- () => u.filter((s) => s.toLowerCase().includes(e.toLowerCase())),
14
- [u, e]
15
- ), N = y && n.length > 0, t = R(
16
- (s) => {
17
- p(s), b == null || b(s), h(!1), i(-1);
18
- },
19
- [p, b]
20
- ), r = (s) => {
21
- const d = s.target.value;
22
- p(d), b == null || b(d), h(!0), i(-1);
23
- }, $ = (s) => {
24
- N && (s.key === "ArrowDown" ? (s.preventDefault(), i((d) => Math.min(d + 1, n.length - 1))) : s.key === "ArrowUp" ? (s.preventDefault(), i((d) => Math.max(d - 1, 0))) : s.key === "Enter" && l >= 0 ? (s.preventDefault(), t(n[l])) : s.key === "Escape" && (h(!1), i(-1)));
25
- };
26
- return D(() => {
27
- const s = (d) => {
28
- c.current && !c.current.contains(d.target) && (h(!1), i(-1));
29
- };
30
- return document.addEventListener("mousedown", s), () => document.removeEventListener("mousedown", s);
31
- }, []), /* @__PURE__ */ x("div", { ref: c, className: `mapui:relative ${o}`.trim(), children: [
32
- /* @__PURE__ */ m(
33
- "input",
34
- {
35
- id: g,
36
- type: "text",
37
- value: e,
38
- placeholder: f,
39
- role: "combobox",
40
- "aria-expanded": N,
41
- "aria-autocomplete": "list",
42
- "aria-controls": v,
43
- "aria-activedescendant": a,
44
- onChange: r,
45
- onFocus: () => h(!0),
46
- onKeyDown: $,
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
- N && /* @__PURE__ */ m(
51
- "ul",
52
- {
53
- id: v,
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: n.map((s, d) => /* @__PURE__ */ m(
57
- "li",
58
- {
59
- id: `${v}-option-${d}`,
60
- role: "option",
61
- "aria-selected": d === l,
62
- onMouseDown: (w) => {
63
- w.preventDefault(), t(s);
64
- },
65
- className: `mapui:cursor-pointer mapui:px-2 mapui:py-1 mapui:text-sm ${d === l ? "mapui:bg-blue-100" : "hover:mapui:bg-gray-50"}`,
66
- children: s
67
- },
68
- `${d}-${s}`
69
- ))
70
- }
71
- )
72
- ] });
73
- }
74
- function k({
75
- startValue: e,
76
- endValue: p,
77
- onStartChange: u,
78
- onEndChange: b,
79
- className: f = "",
80
- id: o
81
- }) {
82
- const g = S(), y = o ?? g, h = `${y}-start`, l = `${y}-end`, i = "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__ */ x("div", { className: `mapui:flex mapui:flex-col mapui:gap-1.5 ${f}`.trim(), children: [
84
- /* @__PURE__ */ x("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
85
- /* @__PURE__ */ m("label", { htmlFor: h, className: "mapui:text-xs mapui:text-gray-400 mapui:w-8", children: "From" }),
86
- /* @__PURE__ */ m(
87
- "input",
88
- {
89
- id: h,
90
- type: "datetime-local",
91
- value: e,
92
- onChange: (c) => u(c.target.value),
93
- "aria-label": "Start date",
94
- className: i
95
- }
96
- )
97
- ] }),
98
- /* @__PURE__ */ x("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
99
- /* @__PURE__ */ m("label", { htmlFor: l, className: "mapui:text-xs mapui:text-gray-400 mapui:w-8", children: "To" }),
100
- /* @__PURE__ */ m(
101
- "input",
102
- {
103
- id: l,
104
- type: "datetime-local",
105
- value: p,
106
- onChange: (c) => b(c.target.value),
107
- "aria-label": "End date",
108
- className: i
109
- }
110
- )
111
- ] })
112
- ] });
113
- }
114
- const q = {
115
- eq: "=",
116
- gt: ">",
117
- lt: "<",
118
- gte: ">=",
119
- lte: "<=",
120
- between: "between"
121
- }, z = {
122
- eq: "equal to",
123
- gt: "greater than",
124
- lt: "less than",
125
- gte: "greater than or equal to",
126
- lte: "less than or equal to",
127
- between: "between"
128
- }, L = ["eq", "gt", "lt", "gte", "lte", "between"];
129
- function M(e, p) {
130
- if (e && typeof e == "object") {
131
- if ("operator" in e) return e.operator;
132
- if ("min" in e) return "between";
133
- }
134
- return p;
135
- }
136
- const j = "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", B = "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";
137
- function _({ field: e, value: p, onChange: u, className: b = "", id: f }) {
138
- const [o, g] = I(
139
- () => M(p, e.operator)
140
- );
141
- D(() => {
142
- g(M(p, e.operator));
143
- }, [p, e.operator]);
144
- const y = o === "between", h = e.inputMode === "slider" ? L.filter((t) => t !== "between") : L, l = (t) => {
145
- if (g(t), t === "between")
146
- u(void 0);
147
- else if (y)
148
- u(void 0);
149
- else if (p && typeof p == "object" && "value" in p) {
150
- const r = p.value;
151
- u({ value: r, operator: t });
152
- }
153
- }, i = (t) => {
154
- u(t === "" ? void 0 : { value: Number(t), operator: o });
155
- }, c = (t) => {
156
- const r = p && typeof p == "object" && "max" in p ? p.max : void 0;
157
- u(t === "" ? r === void 0 ? void 0 : { min: e.min ?? 0, max: r } : { min: Number(t), max: r ?? e.max ?? 0 });
158
- }, v = (t) => {
159
- const r = p && typeof p == "object" && "min" in p ? p.min : void 0;
160
- u(t === "" ? r === void 0 ? void 0 : { min: r, max: e.max ?? 0 } : { min: r ?? e.min ?? 0, max: Number(t) });
161
- }, a = p && typeof p == "object" && "value" in p ? String(p.value) : "", n = p && typeof p == "object" && "min" in p ? String(p.min) : "", N = p && typeof p == "object" && "max" in p ? String(p.max) : "";
162
- return /* @__PURE__ */ x("div", { className: `mapui:flex mapui:flex-col mapui:gap-1.5 ${b}`.trim(), children: [
163
- /* @__PURE__ */ m(
164
- "select",
165
- {
166
- value: o,
167
- onChange: (t) => l(t.target.value),
168
- "aria-label": `${e.label} operator`,
169
- className: B,
170
- children: h.map((t) => /* @__PURE__ */ m("option", { value: t, children: (e.operatorLabelStyle === "word" ? z : q)[t] }, t))
171
- }
172
- ),
173
- y ? (
174
- /* Between: min + max inputs */
175
- /* @__PURE__ */ x("div", { className: "mapui:flex mapui:gap-2", children: [
176
- /* @__PURE__ */ m(
177
- "input",
178
- {
179
- type: "number",
180
- value: n,
181
- placeholder: e.min !== void 0 ? String(e.min) : "Min",
182
- min: e.min,
183
- max: e.max,
184
- step: e.step,
185
- onChange: (t) => c(t.target.value),
186
- "aria-label": `${e.label} minimum`,
187
- className: `${j} mapui:w-1/2`
188
- }
189
- ),
190
- /* @__PURE__ */ m(
191
- "input",
192
- {
193
- type: "number",
194
- value: N,
195
- placeholder: e.max !== void 0 ? String(e.max) : "Max",
196
- min: e.min,
197
- max: e.max,
198
- step: e.step,
199
- onChange: (t) => v(t.target.value),
200
- "aria-label": `${e.label} maximum`,
201
- className: `${j} mapui:w-1/2`
202
- }
203
- )
204
- ] })
205
- ) : e.inputMode === "slider" ? (
206
- /* Slider */
207
- e.showRange ? /* @__PURE__ */ x("div", { className: "mapui:flex mapui:flex-col mapui:gap-0.5", children: [
208
- /* @__PURE__ */ x("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
209
- /* @__PURE__ */ m("span", { className: "mapui:text-xs mapui:text-gray-400 mapui:whitespace-nowrap", children: e.min ?? 0 }),
210
- /* @__PURE__ */ m(
211
- "input",
212
- {
213
- type: "range",
214
- value: a !== "" ? a : e.min ?? 0,
215
- min: e.min ?? 0,
216
- max: e.max ?? 100,
217
- step: e.step ?? 1,
218
- onChange: (t) => i(t.target.value),
219
- "aria-label": e.label,
220
- className: "mapui:flex-1"
221
- }
222
- ),
223
- /* @__PURE__ */ m("span", { className: "mapui:text-xs mapui:text-gray-400 mapui:whitespace-nowrap", children: e.max ?? 100 })
224
- ] }),
225
- /* @__PURE__ */ m("span", { className: "mapui:text-xs mapui:text-gray-600 mapui:text-center", children: a !== "" ? a : e.min ?? 0 })
226
- ] }) : /* @__PURE__ */ x("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
227
- /* @__PURE__ */ m(
228
- "input",
229
- {
230
- type: "range",
231
- value: a !== "" ? a : e.min ?? 0,
232
- min: e.min ?? 0,
233
- max: e.max ?? 100,
234
- step: e.step ?? 1,
235
- onChange: (t) => i(t.target.value),
236
- "aria-label": e.label,
237
- className: "mapui:flex-1"
238
- }
239
- ),
240
- /* @__PURE__ */ m("span", { className: "mapui:text-xs mapui:text-gray-600 mapui:min-w-12 mapui:whitespace-nowrap mapui:text-right", children: a !== "" ? a : e.min ?? 0 })
241
- ] })
242
- ) : (
243
- /* Number input */
244
- /* @__PURE__ */ m(
245
- "input",
246
- {
247
- id: f,
248
- type: "number",
249
- value: a,
250
- placeholder: e.placeholder ?? "",
251
- min: e.min,
252
- max: e.max,
253
- step: e.step,
254
- onChange: (t) => i(t.target.value),
255
- className: j
256
- }
257
- )
258
- )
259
- ] });
260
- }
261
- function K(e) {
262
- return e === void 0 || e === "" || e === null ? !1 : typeof e == "object" && "start" in e && "end" in e ? e.start !== "" || e.end !== "" : !0;
263
- }
264
- function H({
265
- layers: e,
266
- activeFilters: p,
267
- onFilterChange: u,
268
- onClearFilters: b,
269
- autocompleteSuggestions: f = {},
270
- onZoomToFeature: o,
271
- onFetchSuggestions: g,
272
- className: y = "",
273
- hideTitle: h
274
- }) {
275
- const l = E(
276
- () => e.filter((i) => {
277
- var c;
278
- return (c = i.search) == null ? void 0 : c.fields.length;
279
- }),
280
- [e]
281
- );
282
- return D(() => {
283
- if (g)
284
- for (const i of l)
285
- for (const c of i.search.fields)
286
- c.type === "select" && c.prefetch && g(i.id, c.property, "", { prefetch: !0 });
287
- }, [l, g]), l.length === 0 ? /* @__PURE__ */ x("div", { className: `mapui:flex mapui:flex-col mapui:gap-1 ${y}`.trim(), children: [
288
- !h && /* @__PURE__ */ m("h3", { className: "mapui:m-0 mapui:mb-2 mapui:text-sm mapui:font-semibold mapui:text-gray-700", children: "Search & Filter" }),
289
- /* @__PURE__ */ m("p", { className: "mapui:m-0 mapui:text-xs mapui:text-gray-500", children: "No searchable layers configured." })
290
- ] }) : /* @__PURE__ */ x("div", { className: `mapui:flex mapui:flex-col mapui:gap-3 ${y}`.trim(), children: [
291
- !h && /* @__PURE__ */ m("h3", { className: "mapui:m-0 mapui:mb-2 mapui:text-sm mapui:font-semibold mapui:text-gray-700", children: "Search & Filter" }),
292
- l.map((i) => {
293
- const c = p[i.id] ?? {}, v = Object.values(c).some(K);
294
- return /* @__PURE__ */ x("div", { className: "mapui:flex mapui:flex-col mapui:gap-3 mapui:border-b mapui:border-gray-100 mapui:pb-3 last:mapui:border-0", children: [
295
- /* @__PURE__ */ x("div", { className: "mapui:flex mapui:items-center mapui:justify-between", children: [
296
- /* @__PURE__ */ m("span", { className: "mapui:text-sm mapui:font-medium mapui:text-gray-600", children: i.label }),
297
- v && /* @__PURE__ */ m(
298
- "button",
299
- {
300
- type: "button",
301
- onClick: () => b(i.id),
302
- 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",
303
- children: "Clear"
304
- }
305
- )
306
- ] }),
307
- i.search.fields.map((a) => {
308
- const n = c[a.property], N = `${i.id}:${a.property}`, t = `search-${i.id}-${a.property}`;
309
- return /* @__PURE__ */ x("div", { className: "mapui:flex mapui:flex-col mapui:gap-1", children: [
310
- /* @__PURE__ */ m("label", { htmlFor: t, className: "mapui:text-xs mapui:text-gray-500", children: a.label }),
311
- a.type === "text" && a.autocomplete ? /* @__PURE__ */ m(
312
- V,
313
- {
314
- id: t,
315
- value: n ?? "",
316
- onChange: (r) => {
317
- u(i.id, a.property, r || void 0), r && a.zoomTo && (o == null || o(i.id, a.property, r));
318
- },
319
- suggestions: [.../* @__PURE__ */ new Set([
320
- ...f[N] ?? [],
321
- ...a.options ?? []
322
- ])],
323
- onQueryChange: (r) => g == null ? void 0 : g(i.id, a.property, r, { prefetch: a.prefetch }),
324
- placeholder: a.placeholder ?? ""
325
- }
326
- ) : a.type === "text" ? /* @__PURE__ */ m(
327
- "input",
328
- {
329
- id: t,
330
- type: "text",
331
- value: n ?? "",
332
- placeholder: a.placeholder ?? "",
333
- onChange: (r) => u(i.id, a.property, r.target.value || void 0),
334
- onBlur: (r) => {
335
- r.target.value && a.zoomTo && (o == null || o(i.id, a.property, r.target.value));
336
- },
337
- onKeyDown: (r) => {
338
- r.key === "Enter" && r.target.value && a.zoomTo && (o == null || o(i.id, a.property, r.target.value));
339
- },
340
- 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"
341
- }
342
- ) : a.type === "datetime" && a.range ? /* @__PURE__ */ m(
343
- k,
344
- {
345
- id: t,
346
- startValue: n && typeof n == "object" && "start" in n ? n.start : "",
347
- endValue: n && typeof n == "object" && "end" in n ? n.end : "",
348
- onStartChange: (r) => u(i.id, a.property, {
349
- start: r,
350
- end: n && typeof n == "object" && "end" in n ? n.end : ""
351
- }),
352
- onEndChange: (r) => u(i.id, a.property, {
353
- start: n && typeof n == "object" && "start" in n ? n.start : "",
354
- end: r
355
- })
356
- }
357
- ) : a.type === "datetime" ? /* @__PURE__ */ m(
358
- "input",
359
- {
360
- id: t,
361
- type: "datetime-local",
362
- value: n ?? "",
363
- onChange: (r) => u(i.id, a.property, r.target.value || void 0),
364
- 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"
365
- }
366
- ) : a.type === "number" ? /* @__PURE__ */ m(
367
- _,
368
- {
369
- id: t,
370
- field: a,
371
- value: n,
372
- onChange: (r) => u(i.id, a.property, r)
373
- }
374
- ) : a.type === "select" ? (() => {
375
- const r = a, $ = f[N] ?? [], s = r.options ?? [], d = [.../* @__PURE__ */ new Set([...$, ...s])];
376
- return /* @__PURE__ */ x(
377
- "select",
378
- {
379
- id: t,
380
- value: n ?? "",
381
- onChange: (w) => {
382
- const O = w.target.value || void 0;
383
- u(i.id, a.property, O), O && a.zoomTo && (o == null || o(i.id, a.property, O));
384
- },
385
- 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",
386
- children: [
387
- /* @__PURE__ */ m("option", { value: "", children: a.placeholder ?? "Select..." }),
388
- d.map((w) => /* @__PURE__ */ m("option", { value: w, children: w }, w))
389
- ]
390
- }
391
- );
392
- })() : null
393
- ] }, a.property);
394
- })
395
- ] }, i.id);
396
- })
397
- ] });
398
- }
399
- export {
400
- H as S
401
- };
@@ -1,206 +0,0 @@
1
- import { useState as r, useEffect as b, useCallback as E, useMemo as F } from "react";
2
- import { o as O, v as z, t as x, m as P, a4 as A, j as Q, n as q, a5 as J, a6 as N, a7 as T, a8 as j, a9 as L } from "./geo-BXaVaxak.js";
3
- function X(e, t) {
4
- const [o, u] = r([]), [c, a] = r(!1), [i, g] = r(null), s = t ? `${t.type}:${t.name}:${t.value}` : "";
5
- return b(() => {
6
- if (!e) return;
7
- let n = !1;
8
- return a(!0), g(null), O(e, t).then((h) => {
9
- n || u(h);
10
- }).catch((h) => {
11
- n || g(h instanceof Error ? h : new Error(String(h)));
12
- }).finally(() => {
13
- n || a(!1);
14
- }), () => {
15
- n = !0;
16
- };
17
- }, [e, s]), { collections: o, loading: c, error: i };
18
- }
19
- function _(e, t) {
20
- const [o, u] = r(null), [c, a] = r(!1), [i, g] = r(null);
21
- return b(() => {
22
- if (!e || !t) return;
23
- let s = !1;
24
- return a(!0), g(null), z(e, t).then((n) => {
25
- s || u(n);
26
- }).catch((n) => {
27
- s || g(n instanceof Error ? n : new Error(String(n)));
28
- }).finally(() => {
29
- s || a(!1);
30
- }), () => {
31
- s = !0;
32
- };
33
- }, [e, t]), { queryables: o, loading: c, error: i };
34
- }
35
- function R(e, t, o = {}, u) {
36
- const [c, a] = r([]), [i, g] = r(!1), [s, n] = r(null), [h, y] = r(!1), l = JSON.stringify(o), p = u ? `${u.type}:${u.name}:${u.value}` : "";
37
- return b(() => {
38
- if (!e || !t) return;
39
- let d = !1;
40
- g(!0), n(null);
41
- const M = JSON.parse(l);
42
- return x(e, t, M, u).then((f) => {
43
- if (!d) {
44
- a(f.features);
45
- const m = M.limit ?? 10, C = M.offset ?? 0;
46
- f.numberMatched != null ? y(C + f.features.length < f.numberMatched) : y(f.features.length >= m);
47
- }
48
- }).catch((f) => {
49
- d || (n(f instanceof Error ? f : new Error(String(f))), a([]), y(!1));
50
- }).finally(() => {
51
- d || g(!1);
52
- }), () => {
53
- d = !0;
54
- };
55
- }, [e, t, l, p]), { features: c, loading: i, error: s, hasMore: h };
56
- }
57
- function V({
58
- baseUrl: e,
59
- limit: t = 1e3,
60
- csvOptions: o
61
- }) {
62
- const [u, c] = r(!1), [a, i] = r(null);
63
- return { exportCsv: E(
64
- async (s, n = `${s}.csv`, h) => {
65
- c(!0), i(null);
66
- const y = [], l = Math.min(t, 1e3);
67
- let p = 0;
68
- try {
69
- for (; y.length < t; ) {
70
- const M = t - y.length, f = Math.min(l, M), m = await x(e, s, {
71
- limit: f,
72
- offset: p,
73
- cql2Filter: h
74
- });
75
- if (y.push(...m.features), p += m.features.length, m.features.length < f || m.numberMatched != null && p >= m.numberMatched) break;
76
- }
77
- const d = P(y, o);
78
- A(d, n);
79
- } catch (d) {
80
- i(d instanceof Error ? d : new Error(String(d)));
81
- } finally {
82
- c(!1);
83
- }
84
- },
85
- [e, t, o]
86
- ), loading: u, error: a };
87
- }
88
- function W({
89
- baseUrl: e = "",
90
- limit: t = 1e5,
91
- converters: o
92
- }) {
93
- const [u, c] = r(!1), [a, i] = r(null), [g, s] = r(null);
94
- return { runExport: E(
95
- async (h, y, l, p, d) => {
96
- const M = d ?? e, f = o[y];
97
- if (!f) {
98
- s(new Error(`Unknown export format: ${y}`));
99
- return;
100
- }
101
- c(!0), i("Fetching features..."), s(null);
102
- const m = [], C = Math.min(t, 1e3);
103
- let $ = 0;
104
- try {
105
- for (; m.length < t; ) {
106
- const K = t - m.length, D = Math.min(C, K), v = await x(M, h, {
107
- limit: D,
108
- offset: $,
109
- cql2Filter: p
110
- });
111
- m.push(...v.features), $ += v.features.length;
112
- const w = v.numberMatched;
113
- if (w != null ? i(`Fetching features... (${m.length} of ${w})`) : i(`Fetching features... (${m.length})`), v.features.length < D || w != null && $ >= w) break;
114
- }
115
- i("Converting...");
116
- const S = await f(m, h);
117
- Q(S.blob, l);
118
- } catch (S) {
119
- s(S instanceof Error ? S : new Error(String(S)));
120
- } finally {
121
- c(!1), i(null);
122
- }
123
- },
124
- [e, t, o]
125
- ), loading: u, progress: a, error: g };
126
- }
127
- function Y(e, t) {
128
- const [o, u] = r(null), [c, a] = r(!1), [i, g] = r(null);
129
- return b(() => {
130
- if (!e || !t) return;
131
- let s = !1;
132
- return a(!0), g(null), q(e, t).then((n) => {
133
- s || u(n);
134
- }).catch((n) => {
135
- s || g(n instanceof Error ? n : new Error(String(n)));
136
- }).finally(() => {
137
- s || a(!1);
138
- }), () => {
139
- s = !0;
140
- };
141
- }, [e, t]), { collection: o, loading: c, error: i };
142
- }
143
- function Z() {
144
- const [e, t] = r(null), [o, u] = r([]), [c, a] = r("km"), i = F(
145
- () => e ? J(e, o, c) : null,
146
- [e, o, c]
147
- ), g = F(
148
- () => e ? N(e, o) : null,
149
- [e, o]
150
- ), s = F(
151
- () => e ? T(o) : null,
152
- [e, o]
153
- ), n = E((l) => {
154
- t(l), u([]), l && a(j(l));
155
- }, []), h = E((l) => {
156
- u((p) => [...p, l]);
157
- }, []), y = E(() => {
158
- u([]);
159
- }, []);
160
- return { mode: e, points: o, unit: c, measurement: i, geometryData: g, pointsData: s, setMode: n, setUnit: a, addPoint: h, clear: y };
161
- }
162
- const k = 1e3;
163
- function I() {
164
- const [e, t] = r(null), [o, u] = r(null), [c, a] = r([]), i = F(() => c.length === 0 ? null : {
165
- type: "FeatureCollection",
166
- features: c.map((l) => ({
167
- type: "Feature",
168
- properties: l.properties,
169
- geometry: l.geometry
170
- }))
171
- }, [c]), g = E((l) => {
172
- t(l);
173
- }, []), s = E((l) => {
174
- u(l), a([]);
175
- }, []), n = E((l) => {
176
- a((p) => {
177
- const d = new Set(p.map(L)), M = l.filter((m) => !d.has(L(m))), f = [...p, ...M];
178
- return f.length > k ? f.slice(0, k) : f;
179
- });
180
- }, []), h = E((l) => {
181
- a((p) => p.filter((d) => L(d) !== l));
182
- }, []), y = E(() => {
183
- a([]);
184
- }, []);
185
- return {
186
- mode: e,
187
- activeLayerId: o,
188
- features: c,
189
- highlightData: i,
190
- setMode: g,
191
- setActiveLayerId: s,
192
- addFeatures: n,
193
- removeFeature: h,
194
- clearFeatures: y
195
- };
196
- }
197
- export {
198
- W as a,
199
- Z as b,
200
- Y as c,
201
- X as d,
202
- R as e,
203
- _ as f,
204
- I as g,
205
- V as u
206
- };