@ogc-maps/storybook-components 0.4.1 → 0.5.1

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 (128) hide show
  1. package/dist/{FeatureDetailPanel-DpcaTS9I.js → FeatureDetailPanel-CkFpdEKW.js} +8 -7
  2. package/dist/{FeatureTooltip-CM0ZTudi.js → FeatureTooltip-Db1LgLQV.js} +9 -7
  3. package/dist/{LayerPanel-BHpb8dbm.js → LayerPanel-SCdJ8948.js} +21 -21
  4. package/dist/{Legend-D4cc1JzQ.js → Legend-BMrkY-rw.js} +4 -4
  5. package/dist/PropertyList-BGXHLVBM.js +33 -0
  6. package/dist/SearchPanel-DCY01Wa-.js +363 -0
  7. package/dist/components/BasemapEditor/BasemapEditor.d.ts +7 -0
  8. package/dist/components/BasemapEditor/BasemapEditor.d.ts.map +1 -0
  9. package/dist/components/BasemapEditor/BasemapList.d.ts +7 -0
  10. package/dist/components/BasemapEditor/BasemapList.d.ts.map +1 -0
  11. package/dist/components/BasemapEditor/index.d.ts +5 -0
  12. package/dist/components/BasemapEditor/index.d.ts.map +1 -0
  13. package/dist/components/CollectionBrowser/CollectionBrowser.d.ts +8 -0
  14. package/dist/components/CollectionBrowser/CollectionBrowser.d.ts.map +1 -0
  15. package/dist/components/CollectionBrowser/index.d.ts +3 -0
  16. package/dist/components/CollectionBrowser/index.d.ts.map +1 -0
  17. package/dist/components/ConfigPreview/ConfigPreview.d.ts +5 -0
  18. package/dist/components/ConfigPreview/ConfigPreview.d.ts.map +1 -0
  19. package/dist/components/ConfigPreview/index.d.ts +3 -0
  20. package/dist/components/ConfigPreview/index.d.ts.map +1 -0
  21. package/dist/components/FeatureDetailPanel/FeatureDetailPanel.d.ts +2 -1
  22. package/dist/components/FeatureDetailPanel/FeatureDetailPanel.d.ts.map +1 -1
  23. package/dist/components/FeatureDetailPanel/index.js +1 -1
  24. package/dist/components/FeatureTooltip/FeatureTooltip.d.ts +2 -1
  25. package/dist/components/FeatureTooltip/FeatureTooltip.d.ts.map +1 -1
  26. package/dist/components/FeatureTooltip/index.js +1 -1
  27. package/dist/components/LayerEditor/LayerEditor.d.ts +8 -0
  28. package/dist/components/LayerEditor/LayerEditor.d.ts.map +1 -0
  29. package/dist/components/LayerEditor/LayerList.d.ts +8 -0
  30. package/dist/components/LayerEditor/LayerList.d.ts.map +1 -0
  31. package/dist/components/LayerEditor/index.d.ts +5 -0
  32. package/dist/components/LayerEditor/index.d.ts.map +1 -0
  33. package/dist/components/LayerPanel/index.js +1 -1
  34. package/dist/components/Legend/index.js +1 -1
  35. package/dist/components/LegendEditor/LegendEditor.d.ts +7 -0
  36. package/dist/components/LegendEditor/LegendEditor.d.ts.map +1 -0
  37. package/dist/components/LegendEditor/LegendEntryEditor.d.ts +7 -0
  38. package/dist/components/LegendEditor/LegendEntryEditor.d.ts.map +1 -0
  39. package/dist/components/LegendEditor/index.d.ts +5 -0
  40. package/dist/components/LegendEditor/index.d.ts.map +1 -0
  41. package/dist/components/PropertyDisplayEditor/PropertyDisplayEditor.d.ts +15 -0
  42. package/dist/components/PropertyDisplayEditor/PropertyDisplayEditor.d.ts.map +1 -0
  43. package/dist/components/PropertyDisplayEditor/__tests__/PropertyDisplayEditor.test.d.ts +2 -0
  44. package/dist/components/PropertyDisplayEditor/__tests__/PropertyDisplayEditor.test.d.ts.map +1 -0
  45. package/dist/components/PropertyDisplayEditor/index.d.ts +3 -0
  46. package/dist/components/PropertyDisplayEditor/index.d.ts.map +1 -0
  47. package/dist/components/SearchFieldEditor/SearchFieldEditor.d.ts +8 -0
  48. package/dist/components/SearchFieldEditor/SearchFieldEditor.d.ts.map +1 -0
  49. package/dist/components/SearchFieldEditor/SearchFieldList.d.ts +8 -0
  50. package/dist/components/SearchFieldEditor/SearchFieldList.d.ts.map +1 -0
  51. package/dist/components/SearchFieldEditor/index.d.ts +5 -0
  52. package/dist/components/SearchFieldEditor/index.d.ts.map +1 -0
  53. package/dist/components/SearchPanel/AutocompleteInput.d.ts +12 -0
  54. package/dist/components/SearchPanel/AutocompleteInput.d.ts.map +1 -0
  55. package/dist/components/SearchPanel/DateRangeInput.d.ts +11 -0
  56. package/dist/components/SearchPanel/DateRangeInput.d.ts.map +1 -0
  57. package/dist/components/SearchPanel/NumberInput.d.ts +11 -0
  58. package/dist/components/SearchPanel/NumberInput.d.ts.map +1 -0
  59. package/dist/components/SearchPanel/SearchPanel.d.ts +7 -3
  60. package/dist/components/SearchPanel/SearchPanel.d.ts.map +1 -1
  61. package/dist/components/SearchPanel/index.js +1 -1
  62. package/dist/components/SourceEditor/SourceEditor.d.ts +10 -0
  63. package/dist/components/SourceEditor/SourceEditor.d.ts.map +1 -0
  64. package/dist/components/SourceEditor/SourceList.d.ts +7 -0
  65. package/dist/components/SourceEditor/SourceList.d.ts.map +1 -0
  66. package/dist/components/SourceEditor/index.d.ts +5 -0
  67. package/dist/components/SourceEditor/index.d.ts.map +1 -0
  68. package/dist/components/StyleEditor/StyleEditor.d.ts +11 -0
  69. package/dist/components/StyleEditor/StyleEditor.d.ts.map +1 -0
  70. package/dist/components/StyleEditor/index.d.ts +3 -0
  71. package/dist/components/StyleEditor/index.d.ts.map +1 -0
  72. package/dist/components/UIConfigEditor/UIConfigEditor.d.ts +7 -0
  73. package/dist/components/UIConfigEditor/UIConfigEditor.d.ts.map +1 -0
  74. package/dist/components/UIConfigEditor/index.d.ts +3 -0
  75. package/dist/components/UIConfigEditor/index.d.ts.map +1 -0
  76. package/dist/components/ViewEditor/ViewEditor.d.ts +7 -0
  77. package/dist/components/ViewEditor/ViewEditor.d.ts.map +1 -0
  78. package/dist/components/ViewEditor/index.d.ts +3 -0
  79. package/dist/components/ViewEditor/index.d.ts.map +1 -0
  80. package/dist/components/_shared/PropertyList.d.ts +2 -1
  81. package/dist/components/_shared/PropertyList.d.ts.map +1 -1
  82. package/dist/components/admin/ColorPicker.d.ts +7 -0
  83. package/dist/components/admin/ColorPicker.d.ts.map +1 -0
  84. package/dist/components/admin/ConfirmDialog.d.ts +9 -0
  85. package/dist/components/admin/ConfirmDialog.d.ts.map +1 -0
  86. package/dist/components/admin/FormField.d.ts +10 -0
  87. package/dist/components/admin/FormField.d.ts.map +1 -0
  88. package/dist/components/admin/index.d.ts +7 -0
  89. package/dist/components/admin/index.d.ts.map +1 -0
  90. package/dist/components/index.d.ts +24 -0
  91. package/dist/components/index.d.ts.map +1 -1
  92. package/dist/cql2-Dhe6Ny6v.js +352 -0
  93. package/dist/hooks/index.d.ts +6 -2
  94. package/dist/hooks/index.d.ts.map +1 -1
  95. package/dist/hooks/index.js +38 -10
  96. package/dist/hooks/useCsvExport.d.ts +2 -1
  97. package/dist/hooks/useCsvExport.d.ts.map +1 -1
  98. package/dist/hooks/useOgcCollectionDetail.d.ts +14 -0
  99. package/dist/hooks/useOgcCollectionDetail.d.ts.map +1 -0
  100. package/dist/hooks/useOgcQueryables.d.ts +14 -0
  101. package/dist/hooks/useOgcQueryables.d.ts.map +1 -0
  102. package/dist/index-Bw9lUiuL.js +2860 -0
  103. package/dist/main.js +2090 -54
  104. package/dist/schemas/config.d.ts +917 -69
  105. package/dist/schemas/config.d.ts.map +1 -1
  106. package/dist/schemas/index.js +21 -2822
  107. package/dist/style.css +1 -1
  108. package/dist/types/index.d.ts +30 -3
  109. package/dist/types/index.d.ts.map +1 -1
  110. package/dist/types/index.js +22 -16
  111. package/dist/utils/__tests__/cql2.test.d.ts +2 -0
  112. package/dist/utils/__tests__/cql2.test.d.ts.map +1 -0
  113. package/dist/utils/__tests__/propertyDisplay.test.d.ts +2 -0
  114. package/dist/utils/__tests__/propertyDisplay.test.d.ts.map +1 -0
  115. package/dist/utils/cql2.d.ts +75 -0
  116. package/dist/utils/cql2.d.ts.map +1 -0
  117. package/dist/utils/index.d.ts +3 -0
  118. package/dist/utils/index.d.ts.map +1 -1
  119. package/dist/utils/ogcApi.d.ts +61 -0
  120. package/dist/utils/ogcApi.d.ts.map +1 -1
  121. package/dist/utils/propertyDisplay.d.ts +6 -0
  122. package/dist/utils/propertyDisplay.d.ts.map +1 -0
  123. package/dist/utils/queryableHelpers.d.ts +35 -0
  124. package/dist/utils/queryableHelpers.d.ts.map +1 -0
  125. package/package.json +4 -2
  126. package/dist/PropertyList-BH_DTkcU.js +0 -32
  127. package/dist/SearchPanel-B5GPX1gF.js +0 -106
  128. package/dist/useCsvExport-C4WAm7kG.js +0 -146
@@ -1,106 +0,0 @@
1
- import { jsxs as t, jsx as i } from "react/jsx-runtime";
2
- import { useMemo as f, useCallback as l } from "react";
3
- function C({
4
- layers: n,
5
- activeFilters: h,
6
- onFilterChange: r,
7
- onClearFilters: g,
8
- className: c = "",
9
- hideTitle: d
10
- }) {
11
- const b = f(
12
- () => n.filter((e) => {
13
- var u;
14
- return (u = e.search) == null ? void 0 : u.fields.length;
15
- }),
16
- [n]
17
- ), x = l(
18
- (e, u, m) => {
19
- r(e, u, m || void 0);
20
- },
21
- [r]
22
- ), y = l(
23
- (e, u, m) => {
24
- r(e, u, m === "" ? void 0 : Number(m));
25
- },
26
- [r]
27
- ), v = l(
28
- (e, u, m) => {
29
- r(e, u, m || void 0);
30
- },
31
- [r]
32
- );
33
- return b.length === 0 ? /* @__PURE__ */ t("div", { className: `mapui:flex mapui:flex-col mapui:gap-1 ${c}`.trim(), children: [
34
- !d && /* @__PURE__ */ i("h3", { className: "mapui:m-0 mapui:mb-2 mapui:text-sm mapui:font-semibold mapui:text-gray-700", children: "Search & Filter" }),
35
- /* @__PURE__ */ i("p", { className: "mapui:m-0 mapui:text-xs mapui:text-gray-500", children: "No searchable layers configured." })
36
- ] }) : /* @__PURE__ */ t("div", { className: `mapui:flex mapui:flex-col mapui:gap-3 ${c}`.trim(), children: [
37
- !d && /* @__PURE__ */ i("h3", { className: "mapui:m-0 mapui:mb-2 mapui:text-sm mapui:font-semibold mapui:text-gray-700", children: "Search & Filter" }),
38
- b.map((e) => {
39
- const u = h[e.id] ?? {}, m = Object.values(u).some((a) => a !== void 0);
40
- return /* @__PURE__ */ t("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: [
41
- /* @__PURE__ */ t("div", { className: "mapui:flex mapui:items-center mapui:justify-between", children: [
42
- /* @__PURE__ */ i("span", { className: "mapui:text-xs mapui:font-medium mapui:text-gray-600", children: e.label }),
43
- m && /* @__PURE__ */ i(
44
- "button",
45
- {
46
- type: "button",
47
- onClick: () => g(e.id),
48
- 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",
49
- children: "Clear"
50
- }
51
- )
52
- ] }),
53
- e.search.fields.map((a) => {
54
- const o = u[a.property], s = a.options;
55
- return /* @__PURE__ */ t("div", { className: "mapui:flex mapui:flex-col mapui:gap-0.5", children: [
56
- /* @__PURE__ */ i("label", { className: "mapui:text-xs mapui:text-gray-500", children: a.label }),
57
- a.type === "text" && /* @__PURE__ */ i(
58
- "input",
59
- {
60
- type: "text",
61
- value: o ?? "",
62
- placeholder: a.placeholder ?? "",
63
- onChange: (p) => x(e.id, a.property, p.target.value),
64
- 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"
65
- }
66
- ),
67
- a.type === "number" && /* @__PURE__ */ i(
68
- "input",
69
- {
70
- type: "number",
71
- value: o ?? "",
72
- placeholder: a.placeholder ?? "",
73
- onChange: (p) => y(e.id, a.property, p.target.value),
74
- 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"
75
- }
76
- ),
77
- a.type === "datetime" && /* @__PURE__ */ i(
78
- "input",
79
- {
80
- type: "datetime-local",
81
- value: o ?? "",
82
- onChange: (p) => x(e.id, a.property, p.target.value),
83
- 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"
84
- }
85
- ),
86
- a.type === "select" && /* @__PURE__ */ t(
87
- "select",
88
- {
89
- value: o ?? "",
90
- onChange: (p) => v(e.id, a.property, p.target.value),
91
- 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",
92
- children: [
93
- /* @__PURE__ */ i("option", { value: "", children: a.placeholder ?? "Select..." }),
94
- s == null ? void 0 : s.map((p) => /* @__PURE__ */ i("option", { value: p, children: p }, p))
95
- ]
96
- }
97
- )
98
- ] }, a.property);
99
- })
100
- ] }, e.id);
101
- })
102
- ] });
103
- }
104
- export {
105
- C as S
106
- };
@@ -1,146 +0,0 @@
1
- import { useState as d, useEffect as j, useCallback as w } from "react";
2
- function b(e) {
3
- return e.endsWith("/") ? e.slice(0, -1) : e;
4
- }
5
- async function C(e) {
6
- const n = await fetch(e);
7
- if (!n.ok)
8
- throw new Error(`OGC API request failed: ${n.status} ${n.statusText} (${e})`);
9
- return n.json();
10
- }
11
- async function R(e) {
12
- const n = `${b(e)}/collections?f=json`;
13
- return (await C(n)).collections;
14
- }
15
- async function S(e, n, t = {}) {
16
- var c;
17
- const r = b(e), s = new URLSearchParams({ f: "geojson" });
18
- if (t.limit != null && s.set("limit", String(t.limit)), t.offset != null && s.set("offset", String(t.offset)), t.bbox && s.set("bbox", t.bbox.join(",")), (c = t.properties) != null && c.length && s.set("properties", t.properties.join(",")), t.datetime && s.set("datetime", t.datetime), t.filter)
19
- for (const [a, o] of Object.entries(t.filter))
20
- s.set(a, String(o));
21
- const i = `${r}/collections/${encodeURIComponent(n)}/items?${s}`;
22
- return C(i);
23
- }
24
- async function k(e, n) {
25
- const r = `${b(e)}/collections/${encodeURIComponent(n)}/queryables?f=schemajson`;
26
- return C(r);
27
- }
28
- function v(e, n, t = "WebMercatorQuad") {
29
- return `${b(e)}/collections/${encodeURIComponent(n)}/tiles/${encodeURIComponent(t)}/tilejson.json`;
30
- }
31
- function L(e, n, t = "WebMercatorQuad") {
32
- return `${b(e)}/collections/${encodeURIComponent(n)}/tiles/${encodeURIComponent(t)}/{z}/{x}/{y}`;
33
- }
34
- function I(e, n, t, r = "WebMercatorQuad") {
35
- const i = `${b(e)}/collections/${encodeURIComponent(n)}/tiles/${encodeURIComponent(r)}/{z}/{x}/{y}`;
36
- if (!t || Object.keys(t).length === 0) return i;
37
- const c = new URLSearchParams();
38
- for (const [a, o] of Object.entries(t))
39
- c.set(a, String(o));
40
- return `${i}?${c}`;
41
- }
42
- function J(e) {
43
- const [n, t] = d([]), [r, s] = d(!1), [i, c] = d(null);
44
- return j(() => {
45
- if (!e) return;
46
- let a = !1;
47
- return s(!0), c(null), R(e).then((o) => {
48
- a || t(o);
49
- }).catch((o) => {
50
- a || c(o instanceof Error ? o : new Error(String(o)));
51
- }).finally(() => {
52
- a || s(!1);
53
- }), () => {
54
- a = !0;
55
- };
56
- }, [e]), { collections: n, loading: r, error: i };
57
- }
58
- function T(e, n, t = {}) {
59
- const [r, s] = d([]), [i, c] = d(!1), [a, o] = d(null), [g, f] = d(!1), p = JSON.stringify(t);
60
- return j(() => {
61
- if (!e || !n) return;
62
- let h = !1;
63
- c(!0), o(null);
64
- const u = JSON.parse(p);
65
- return S(e, n, u).then((l) => {
66
- if (!h) {
67
- s(l.features);
68
- const y = u.limit ?? 10, m = u.offset ?? 0;
69
- l.numberMatched != null ? f(m + l.features.length < l.numberMatched) : f(l.features.length >= y);
70
- }
71
- }).catch((l) => {
72
- h || (o(l instanceof Error ? l : new Error(String(l))), s([]), f(!1));
73
- }).finally(() => {
74
- h || c(!1);
75
- }), () => {
76
- h = !0;
77
- };
78
- }, [e, n, p]), { features: r, loading: i, error: a, hasMore: g };
79
- }
80
- function $(e, n) {
81
- return e.includes('"') || e.includes(n) || e.includes(`
82
- `) ? `"${e.replace(/"/g, '""')}"` : e;
83
- }
84
- function E(e, n) {
85
- const t = (e.properties ?? {})[n];
86
- return t == null ? "" : typeof t == "object" ? JSON.stringify(t) : String(t);
87
- }
88
- function U(e, n = {}) {
89
- const { fields: t, includeGeometry: r = !1, delimiter: s = "," } = n;
90
- if (e.length === 0) return "";
91
- const i = t ?? [...new Set(e.flatMap((o) => Object.keys(o.properties ?? {})))], c = r ? [...i, "geometry"] : i, a = e.map((o) => {
92
- const g = i.map(
93
- (f) => $(E(o, f), s)
94
- );
95
- return r && g.push($(JSON.stringify(o.geometry), s)), g.join(s);
96
- });
97
- return [c.map((o) => $(o, s)).join(s), ...a].join(`
98
- `);
99
- }
100
- function M(e, n) {
101
- const t = new Blob([e], { type: "text/csv;charset=utf-8;" }), r = URL.createObjectURL(t), s = document.createElement("a");
102
- s.href = r, s.download = n, s.style.display = "none", document.body.appendChild(s), s.click(), document.body.removeChild(s), URL.revokeObjectURL(r);
103
- }
104
- function z({
105
- baseUrl: e,
106
- limit: n = 1e3,
107
- csvOptions: t
108
- }) {
109
- const [r, s] = d(!1), [i, c] = d(null);
110
- return { exportCsv: w(
111
- async (o, g = `${o}.csv`) => {
112
- s(!0), c(null);
113
- const f = [], p = Math.min(n, 1e3);
114
- let h = 0;
115
- try {
116
- for (; f.length < n; ) {
117
- const l = n - f.length, y = Math.min(p, l), m = await S(e, o, {
118
- limit: y,
119
- offset: h
120
- });
121
- if (f.push(...m.features), h += m.features.length, m.features.length < y || m.numberMatched != null && h >= m.numberMatched) break;
122
- }
123
- const u = U(f, t);
124
- M(u, g);
125
- } catch (u) {
126
- c(u instanceof Error ? u : new Error(String(u)));
127
- } finally {
128
- s(!1);
129
- }
130
- },
131
- [e, n, t]
132
- ), loading: r, error: i };
133
- }
134
- export {
135
- S as a,
136
- k as b,
137
- v as c,
138
- L as d,
139
- J as e,
140
- R as f,
141
- I as g,
142
- T as h,
143
- M as i,
144
- U as j,
145
- z as u
146
- };