@ogc-maps/storybook-components 0.7.0 → 0.8.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.
@@ -26,7 +26,7 @@ function x({
26
26
  children: /* @__PURE__ */ a(t, { size: 20, className: "mapui:text-gray-700" })
27
27
  }
28
28
  ),
29
- !m && /* @__PURE__ */ e("div", { className: "mapui:absolute mapui:top-0 mapui:right-full mapui:mr-2 mapui:z-10 mapui:bg-white mapui:rounded-lg mapui:shadow-lg mapui:overflow-hidden", children: [
29
+ !m && /* @__PURE__ */ e("div", { className: "mapui:absolute mapui:top-0 mapui:right-full mapui:mr-2 mapui:z-10 mapui:bg-white mapui:rounded-lg mapui:shadow-lg", children: [
30
30
  /* @__PURE__ */ e("div", { className: "mapui:flex mapui:items-center mapui:justify-between mapui:p-2 mapui:border-b mapui:border-gray-200", children: [
31
31
  /* @__PURE__ */ e("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
32
32
  /* @__PURE__ */ a(t, { size: 18, className: "mapui:text-gray-700" }),
@@ -1,5 +1,5 @@
1
1
  import { jsxs as p, jsx as a } from "react/jsx-runtime";
2
- import { useState as f } from "react";
2
+ import { useState as b } from "react";
3
3
  import { BsArrowsAngleContract as N, BsArrowsAngleExpand as y } from "react-icons/bs";
4
4
  const w = {
5
5
  fill: "fill-opacity",
@@ -7,56 +7,56 @@ const w = {
7
7
  circle: "circle-opacity",
8
8
  symbol: "icon-opacity"
9
9
  };
10
- function v(i) {
10
+ function v(m) {
11
11
  var n, l;
12
- const m = (n = i.styles) == null ? void 0 : n[0];
13
- if (!m) return 1;
14
- const e = w[m.type];
12
+ const t = (n = m.styles) == null ? void 0 : n[0];
13
+ if (!t) return 1;
14
+ const e = w[t.type];
15
15
  if (!e) return 1;
16
- const u = (l = m.paint) == null ? void 0 : l[e];
16
+ const u = (l = t.paint) == null ? void 0 : l[e];
17
17
  return typeof u == "number" ? u : 1;
18
18
  }
19
- function g({ color: i, shape: m }) {
20
- const e = m ?? "square";
19
+ function x({ color: m, shape: t }) {
20
+ const e = t ?? "square";
21
21
  return e === "circle" ? /* @__PURE__ */ a(
22
22
  "span",
23
23
  {
24
24
  className: "mapui:inline-block mapui:h-3 mapui:w-3 mapui:rounded-full mapui:shrink-0",
25
- style: { backgroundColor: i }
25
+ style: { backgroundColor: m }
26
26
  }
27
27
  ) : e === "line" ? /* @__PURE__ */ a(
28
28
  "span",
29
29
  {
30
30
  className: "mapui:inline-block mapui:h-0.5 mapui:w-4 mapui:rounded-full mapui:shrink-0",
31
- style: { backgroundColor: i }
31
+ style: { backgroundColor: m }
32
32
  }
33
33
  ) : /* @__PURE__ */ a(
34
34
  "span",
35
35
  {
36
36
  className: "mapui:inline-block mapui:h-3 mapui:w-3 mapui:rounded-sm mapui:shrink-0",
37
- style: { backgroundColor: i }
37
+ style: { backgroundColor: m }
38
38
  }
39
39
  );
40
40
  }
41
- function k(i) {
42
- return `linear-gradient(to right, ${i.map((m, e) => `${m.color} ${e / i.length * 100}% ${(e + 1) / i.length * 100}%`).join(", ")})`;
41
+ function k(m) {
42
+ return `linear-gradient(to right, ${m.map((t, e) => `${t.color} ${e / m.length * 100}% ${(e + 1) / m.length * 100}%`).join(", ")})`;
43
43
  }
44
- function $(i) {
45
- return `linear-gradient(to right, ${i.map((m) => m.color).join(", ")})`;
44
+ function $(m) {
45
+ return `linear-gradient(to right, ${m.map((t) => t.color).join(", ")})`;
46
46
  }
47
- function C({ legend: i, label: m }) {
48
- const { entries: e } = i;
47
+ function C({ legend: m, label: t }) {
48
+ const { entries: e } = m;
49
49
  return e.length === 1 ? /* @__PURE__ */ p("div", { className: "mapui:flex mapui:items-center mapui:gap-2 mapui:min-w-0", children: [
50
- /* @__PURE__ */ a(g, { color: e[0].color, shape: e[0].shape }),
51
- /* @__PURE__ */ a("span", { className: "mapui:text-gray-700 mapui:truncate", children: e[0].label || m })
50
+ /* @__PURE__ */ a(x, { color: e[0].color, shape: e[0].shape }),
51
+ /* @__PURE__ */ a("span", { className: "mapui:text-gray-700 mapui:truncate", children: e[0].label || t })
52
52
  ] }) : /* @__PURE__ */ p("div", { children: [
53
- /* @__PURE__ */ a("div", { className: "mapui:mb-1 mapui:text-xs mapui:font-medium mapui:text-gray-600", children: m }),
53
+ /* @__PURE__ */ a("div", { className: "mapui:mb-1 mapui:text-xs mapui:font-medium mapui:text-gray-600", children: t }),
54
54
  /* @__PURE__ */ a("ul", { className: "mapui:m-0 mapui:list-none mapui:space-y-1 mapui:p-0 mapui:pl-1", children: e.map((u, n) => /* @__PURE__ */ p(
55
55
  "li",
56
56
  {
57
57
  className: "mapui:flex mapui:items-center mapui:gap-2 mapui:min-w-0",
58
58
  children: [
59
- /* @__PURE__ */ a(g, { color: u.color, shape: u.shape }),
59
+ /* @__PURE__ */ a(x, { color: u.color, shape: u.shape }),
60
60
  /* @__PURE__ */ a("span", { className: "mapui:text-gray-700 mapui:truncate", children: u.label })
61
61
  ]
62
62
  },
@@ -65,13 +65,13 @@ function C({ legend: i, label: m }) {
65
65
  ] });
66
66
  }
67
67
  function L({
68
- legend: i,
69
- label: m,
68
+ legend: m,
69
+ label: t,
70
70
  expanded: e,
71
71
  onToggle: u
72
72
  }) {
73
- var s, d;
74
- const { entries: n, showLabelsCollapsed: l } = i;
73
+ var s, h;
74
+ const { entries: n, showLabelsCollapsed: l } = m;
75
75
  return /* @__PURE__ */ p("div", { children: [
76
76
  /* @__PURE__ */ p(
77
77
  "button",
@@ -82,7 +82,7 @@ function L({
82
82
  "aria-expanded": e,
83
83
  children: [
84
84
  /* @__PURE__ */ a("span", { className: "mapui:text-xs mapui:text-gray-400", children: e ? "▾" : "▸" }),
85
- /* @__PURE__ */ a("span", { className: "mapui:truncate", children: m })
85
+ /* @__PURE__ */ a("span", { className: "mapui:truncate", children: t })
86
86
  ]
87
87
  }
88
88
  ),
@@ -91,34 +91,34 @@ function L({
91
91
  "div",
92
92
  {
93
93
  className: "mapui:h-3 mapui:min-w-12 mapui:max-w-32 mapui:rounded-sm",
94
- style: { background: k(n) }
94
+ style: { background: k(n.filter((r, o, g) => g.findIndex((i) => i.color === r.color) === o)) }
95
95
  }
96
96
  ),
97
97
  l && !e && /* @__PURE__ */ p("div", { className: "mapui:mt-1 mapui:flex mapui:justify-between mapui:text-[10px] mapui:text-gray-500 mapui:max-w-32", children: [
98
98
  /* @__PURE__ */ a("span", { className: "mapui:truncate", children: (s = n[0]) == null ? void 0 : s.label }),
99
- n.length > 1 && /* @__PURE__ */ a("span", { className: "mapui:truncate", children: (d = n[n.length - 1]) == null ? void 0 : d.label })
99
+ n.length > 1 && /* @__PURE__ */ a("span", { className: "mapui:truncate", children: (h = n[n.length - 1]) == null ? void 0 : h.label })
100
100
  ] })
101
101
  ] }),
102
- e && /* @__PURE__ */ a("ul", { className: "mapui:m-0 mapui:mt-1 mapui:ml-4 mapui:list-none mapui:space-y-1 mapui:p-0 mapui:max-h-48 mapui:overflow-y-auto", children: n.map((c, h) => /* @__PURE__ */ p(
102
+ e && /* @__PURE__ */ a("ul", { className: "mapui:m-0 mapui:mt-1 mapui:ml-4 mapui:list-none mapui:space-y-1 mapui:p-0 mapui:max-h-48 mapui:overflow-y-auto", children: n.map((r, o) => /* @__PURE__ */ p(
103
103
  "li",
104
104
  {
105
105
  className: "mapui:flex mapui:items-center mapui:gap-2 mapui:min-w-0",
106
106
  children: [
107
- /* @__PURE__ */ a(g, { color: c.color, shape: c.shape }),
108
- /* @__PURE__ */ a("span", { className: "mapui:text-gray-700 mapui:truncate mapui:text-xs", children: c.label })
107
+ /* @__PURE__ */ a(x, { color: r.color, shape: r.shape }),
108
+ /* @__PURE__ */ a("span", { className: "mapui:text-gray-700 mapui:truncate mapui:text-xs", children: r.label })
109
109
  ]
110
110
  },
111
- `${c.label}-${h}`
111
+ `${r.label}-${o}`
112
112
  )) })
113
113
  ] });
114
114
  }
115
115
  function E({
116
- legend: i,
117
- label: m,
116
+ legend: m,
117
+ label: t,
118
118
  expanded: e,
119
119
  onToggle: u
120
120
  }) {
121
- const { entries: n, gradientProperty: l } = i;
121
+ const { entries: n, gradientProperty: l } = m;
122
122
  return /* @__PURE__ */ p("div", { children: [
123
123
  /* @__PURE__ */ p(
124
124
  "button",
@@ -129,7 +129,7 @@ function E({
129
129
  "aria-expanded": e,
130
130
  children: [
131
131
  /* @__PURE__ */ a("span", { className: "mapui:text-xs mapui:text-gray-400", children: e ? "▾" : "▸" }),
132
- /* @__PURE__ */ a("span", { className: "mapui:truncate", children: m })
132
+ /* @__PURE__ */ a("span", { className: "mapui:truncate", children: t })
133
133
  ]
134
134
  }
135
135
  ),
@@ -150,8 +150,8 @@ function E({
150
150
  ] });
151
151
  }
152
152
  function j({
153
- layerId: i,
154
- opacity: m,
153
+ layerId: m,
154
+ opacity: t,
155
155
  onChange: e
156
156
  }) {
157
157
  return /* @__PURE__ */ p("div", { className: "mapui:flex mapui:items-center mapui:gap-1.5 mapui:mt-0.5 mapui:ml-1", children: [
@@ -162,27 +162,27 @@ function j({
162
162
  min: 0,
163
163
  max: 1,
164
164
  step: 0.01,
165
- value: m,
166
- onChange: (u) => e(i, parseFloat(u.target.value)),
165
+ value: t,
166
+ onChange: (u) => e(m, parseFloat(u.target.value)),
167
167
  className: "range-sm mapui:w-14"
168
168
  }
169
169
  ),
170
170
  /* @__PURE__ */ p("span", { className: "mapui:text-[9px] mapui:text-gray-400 mapui:w-6 mapui:text-right mapui:tabular-nums", children: [
171
- Math.round(m * 100),
171
+ Math.round(t * 100),
172
172
  "%"
173
173
  ] })
174
174
  ] });
175
175
  }
176
- function G({ layers: i, visibleLayerIds: m, onOpacityChange: e, className: u }) {
177
- const [n, l] = f(/* @__PURE__ */ new Set()), [s, d] = f(!1), c = i.filter((t) => m.includes(t.id));
178
- function h(t) {
179
- l((o) => {
180
- const r = new Set(o);
181
- return r.has(t) ? r.delete(t) : r.add(t), r;
176
+ function G({ layers: m, visibleLayerIds: t, onOpacityChange: e, className: u }) {
177
+ const [n, l] = b(/* @__PURE__ */ new Set()), [s, h] = b(!1), r = m.filter((i) => t.includes(i.id));
178
+ function o(i) {
179
+ l((d) => {
180
+ const c = new Set(d);
181
+ return c.has(i) ? c.delete(i) : c.add(i), c;
182
182
  });
183
183
  }
184
- const x = c.filter((t) => t.legend !== void 0);
185
- return x.length === 0 ? null : /* @__PURE__ */ p(
184
+ const g = r.filter((i) => i.legend !== void 0);
185
+ return g.length === 0 ? null : /* @__PURE__ */ p(
186
186
  "div",
187
187
  {
188
188
  className: `mapui:rounded-lg mapui:bg-white mapui:p-3 mapui:shadow-md mapui:text-sm${u ? ` ${u}` : ""}`,
@@ -194,41 +194,41 @@ function G({ layers: i, visibleLayerIds: m, onOpacityChange: e, className: u })
194
194
  {
195
195
  type: "button",
196
196
  className: "mapui:bg-transparent mapui:border-none mapui:p-0 mapui:cursor-pointer mapui:text-gray-400 hover:mapui:text-gray-600 mapui:text-sm",
197
- onClick: () => d((t) => !t),
197
+ onClick: () => h((i) => !i),
198
198
  "aria-label": s ? "Collapse legend" : "Expand legend",
199
199
  children: s ? /* @__PURE__ */ a(N, {}) : /* @__PURE__ */ a(y, {})
200
200
  }
201
201
  )
202
202
  ] }),
203
- /* @__PURE__ */ a("ul", { className: `mapui:m-0 mapui:list-none mapui:p-0 ${s ? "mapui:space-y-1.5" : "mapui:space-y-2"}`, children: x.map((t) => {
204
- const o = t.legend, r = o.displayMode ?? "simple", b = s || n.has(t.id);
203
+ /* @__PURE__ */ a("ul", { className: `mapui:m-0 mapui:list-none mapui:p-0 ${s ? "mapui:space-y-1.5" : "mapui:space-y-2"}`, children: g.map((i) => {
204
+ const d = i.legend, c = d.displayMode ?? "simple", f = s || n.has(i.id);
205
205
  return /* @__PURE__ */ p("li", { children: [
206
- r === "categorical" ? /* @__PURE__ */ a(
206
+ c === "categorical" ? /* @__PURE__ */ a(
207
207
  L,
208
208
  {
209
- legend: o,
210
- label: t.label,
211
- expanded: b,
212
- onToggle: () => h(t.id)
209
+ legend: d,
210
+ label: i.label,
211
+ expanded: f,
212
+ onToggle: () => o(i.id)
213
213
  }
214
- ) : r === "gradient" ? /* @__PURE__ */ a(
214
+ ) : c === "gradient" ? /* @__PURE__ */ a(
215
215
  E,
216
216
  {
217
- legend: o,
218
- label: t.label,
219
- expanded: b,
220
- onToggle: () => h(t.id)
217
+ legend: d,
218
+ label: i.label,
219
+ expanded: f,
220
+ onToggle: () => o(i.id)
221
221
  }
222
- ) : /* @__PURE__ */ a(C, { legend: o, label: t.label }),
222
+ ) : /* @__PURE__ */ a(C, { legend: d, label: i.label }),
223
223
  s && e && /* @__PURE__ */ a(
224
224
  j,
225
225
  {
226
- layerId: t.id,
227
- opacity: v(t),
226
+ layerId: i.id,
227
+ opacity: v(i),
228
228
  onChange: e
229
229
  }
230
230
  )
231
- ] }, t.id);
231
+ ] }, i.id);
232
232
  }) })
233
233
  ]
234
234
  }
@@ -80,7 +80,7 @@ function R({
80
80
  id: l
81
81
  }) {
82
82
  const y = D(), f = l ?? y, c = `${f}-start`, p = `${f}-end`, o = "mapui:flex-1 mapui:rounded mapui:border mapui:border-gray-300 mapui:px-2 mapui:py-1 mapui:text-sm mapui:outline-none focus:mapui:border-blue-500 focus:mapui:ring-1 focus:mapui:ring-blue-500";
83
- return /* @__PURE__ */ h("div", { className: `mapui:flex mapui:flex-col mapui:gap-1 ${N}`.trim(), children: [
83
+ return /* @__PURE__ */ h("div", { className: `mapui:flex mapui:flex-col mapui:gap-1.5 ${N}`.trim(), children: [
84
84
  /* @__PURE__ */ h("div", { className: "mapui:flex mapui:items-center mapui:gap-2", children: [
85
85
  /* @__PURE__ */ m("label", { htmlFor: c, className: "mapui:text-xs mapui:text-gray-400 mapui:w-8", children: "From" }),
86
86
  /* @__PURE__ */ m(
@@ -152,7 +152,7 @@ function P({ field: e, value: t, onChange: u, className: d = "", id: N }) {
152
152
  const x = t && typeof t == "object" && "min" in t ? t.min : void 0;
153
153
  u(a === "" ? x === void 0 ? void 0 : { min: x, max: e.max ?? 0 } : { min: x ?? e.min ?? 0, max: Number(a) });
154
154
  }, r = t && typeof t == "object" && "value" in t ? String(t.value) : "", v = t && typeof t == "object" && "min" in t ? String(t.min) : "", b = t && typeof t == "object" && "max" in t ? String(t.max) : "";
155
- return /* @__PURE__ */ h("div", { className: `mapui:flex mapui:flex-col mapui:gap-1 ${d}`.trim(), children: [
155
+ return /* @__PURE__ */ h("div", { className: `mapui:flex mapui:flex-col mapui:gap-1.5 ${d}`.trim(), children: [
156
156
  /* @__PURE__ */ m(
157
157
  "select",
158
158
  {
@@ -264,9 +264,9 @@ function _({
264
264
  !f && /* @__PURE__ */ m("h3", { className: "mapui:m-0 mapui:mb-2 mapui:text-sm mapui:font-semibold mapui:text-gray-700", children: "Search & Filter" }),
265
265
  c.map((p) => {
266
266
  const o = t[p.id] ?? {}, g = Object.values(o).some(q);
267
- return /* @__PURE__ */ h("div", { className: "mapui:flex mapui:flex-col mapui:gap-2 mapui:border-b mapui:border-gray-100 mapui:pb-2 last:mapui:border-0", children: [
267
+ return /* @__PURE__ */ h("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: [
268
268
  /* @__PURE__ */ h("div", { className: "mapui:flex mapui:items-center mapui:justify-between", children: [
269
- /* @__PURE__ */ m("span", { className: "mapui:text-xs mapui:font-medium mapui:text-gray-600", children: p.label }),
269
+ /* @__PURE__ */ m("span", { className: "mapui:text-sm mapui:font-medium mapui:text-gray-600", children: p.label }),
270
270
  g && /* @__PURE__ */ m(
271
271
  "button",
272
272
  {
@@ -279,7 +279,7 @@ function _({
279
279
  ] }),
280
280
  p.search.fields.map((i) => {
281
281
  const r = o[i.property], v = `${p.id}:${i.property}`, b = `search-${p.id}-${i.property}`;
282
- return /* @__PURE__ */ h("div", { className: "mapui:flex mapui:flex-col mapui:gap-0.5", children: [
282
+ return /* @__PURE__ */ h("div", { className: "mapui:flex mapui:flex-col mapui:gap-1", children: [
283
283
  /* @__PURE__ */ m("label", { htmlFor: b, className: "mapui:text-xs mapui:text-gray-500", children: i.label }),
284
284
  i.type === "text" && i.autocomplete ? /* @__PURE__ */ m(
285
285
  V,
@@ -1,4 +1,4 @@
1
- import { C as r } from "../../CollapsibleControl-VFUTWb_5.js";
1
+ import { C as r } from "../../CollapsibleControl-CGRNPpCw.js";
2
2
  export {
3
3
  r as CollapsibleControl
4
4
  };
@@ -1,4 +1,4 @@
1
- import { L as r } from "../../Legend-DNjVLgsd.js";
1
+ import { L as r } from "../../Legend-BiRyrZL1.js";
2
2
  export {
3
3
  r as Legend
4
4
  };
@@ -2,7 +2,7 @@ import { LegendConfig, StyleConfig } from '../../types';
2
2
  export interface LegendEditorProps {
3
3
  value: LegendConfig | undefined;
4
4
  onChange: (legend: LegendConfig | undefined) => void;
5
- style?: StyleConfig;
5
+ styles?: StyleConfig[];
6
6
  }
7
- export declare function LegendEditor({ value, onChange, style }: LegendEditorProps): import("react/jsx-runtime").JSX.Element;
7
+ export declare function LegendEditor({ value, onChange, styles }: LegendEditorProps): import("react/jsx-runtime").JSX.Element;
8
8
  //# sourceMappingURL=LegendEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LegendEditor.d.ts","sourceRoot":"","sources":["../../../src/components/LegendEditor/LegendEditor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAe,WAAW,EAAE,MAAM,aAAa,CAAC;AAW1E,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,YAAY,GAAG,SAAS,CAAC;IAChC,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,KAAK,IAAI,CAAC;IACrD,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAeD,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,iBAAiB,2CA8NzE"}
1
+ {"version":3,"file":"LegendEditor.d.ts","sourceRoot":"","sources":["../../../src/components/LegendEditor/LegendEditor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAe,WAAW,EAAE,MAAM,aAAa,CAAC;AAW1E,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,YAAY,GAAG,SAAS,CAAC;IAChC,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,KAAK,IAAI,CAAC;IACrD,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;CACxB;AAeD,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,iBAAiB,2CAuO1E"}
@@ -1,4 +1,4 @@
1
- import { S as r } from "../../SearchPanel-DCY01Wa-.js";
1
+ import { S as r } from "../../SearchPanel-DtLXMoVs.js";
2
2
  export {
3
3
  r as SearchPanel
4
4
  };