@blocklet/labels 1.4.12 → 1.4.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,132 +1,136 @@
1
- import { createContext as V, useRef as N, useState as I, useCallback as B, useEffect as P, useMemo as z, useContext as W } from "react";
2
- import E from "@mui/icons-material/ExpandMore";
3
- import m from "@mui/material/Box";
4
- import { styled as j } from "@mui/material/styles";
5
- import { Tree as Z } from "react-arborist";
6
- import { Icon as $ } from "@iconify/react";
7
- import { jsx as t, jsxs as y, Fragment as T } from "react/jsx-runtime";
8
- import G from "lodash/omit";
9
- import U, { components as q } from "react-select";
10
- import Y from "@mui/material/Typography";
11
- import A from "@mui/material/Button";
12
- import O from "@mui/material/IconButton";
13
- import X from "@mui/icons-material/DeleteOutlineOutlined";
14
- import _ from "@mui/icons-material/EditOutlined";
15
- import ee from "@mui/icons-material/Add";
16
- import te from "react-use/lib/useSetState";
17
- import L from "@mui/material/TextField";
18
- import ne from "@mui/base/ClickAwayListener";
19
- import { GithubPicker as re } from "react-color";
20
- import F from "@arcblock/ux/lib/Dialog";
21
- import oe from "@mui/material/Alert";
22
- import ie from "@mui/icons-material/Edit";
23
- import le from "@mui/icons-material/LabelOutlined";
24
- import se from "@mui/material/ClickAwayListener";
25
- import ae from "@mui/material/Chip";
26
- const de = (e) => /* @__PURE__ */ t("svg", {
1
+ import { createContext as V, useRef as D, useState as S, useCallback as O, useEffect as E, useMemo as z, useContext as q } from "react";
2
+ import j from "@mui/icons-material/ExpandMore";
3
+ import p from "@mui/material/Box";
4
+ import { styled as F } from "@mui/material/styles";
5
+ import { Tree as U } from "react-arborist";
6
+ import { Icon as X } from "@iconify/react";
7
+ import { jsx as e, jsxs as C, Fragment as P } from "react/jsx-runtime";
8
+ import _ from "lodash/omit";
9
+ import ee, { components as H } from "react-select";
10
+ import te from "@mui/material/Typography";
11
+ import T from "@mui/material/Button";
12
+ import N from "@mui/material/IconButton";
13
+ import ne from "@mui/icons-material/DeleteOutlineOutlined";
14
+ import re from "@mui/icons-material/EditOutlined";
15
+ import oe from "@mui/icons-material/Add";
16
+ import le from "react-use/lib/useSetState";
17
+ import M from "@mui/material/TextField";
18
+ import ie from "@mui/base/ClickAwayListener";
19
+ import { GithubPicker as se } from "react-color";
20
+ import J from "@arcblock/ux/lib/Dialog";
21
+ import { TextField as R, InputAdornment as ae, IconButton as ce, Box as B } from "@mui/material";
22
+ import de from "@mui/icons-material/Translate";
23
+ import ue from "@mui/material/Popover";
24
+ import { useLocaleContext as $ } from "@arcblock/ux/lib/Locale/context";
25
+ import he from "@mui/material/Alert";
26
+ import pe from "@mui/icons-material/Edit";
27
+ import me from "@mui/icons-material/LabelOutlined";
28
+ import fe from "@mui/material/ClickAwayListener";
29
+ import ge from "@mui/material/Chip";
30
+ const xe = (t) => /* @__PURE__ */ e("svg", {
27
31
  viewBox: "0 0 24 24",
28
32
  width: "1.2em",
29
33
  height: "1.2em",
30
- ...e,
31
- children: /* @__PURE__ */ t("path", {
34
+ ...t,
35
+ children: /* @__PURE__ */ e("path", {
32
36
  fill: "currentColor",
33
37
  d: "M5 19q-.825 0-1.413-.587Q3 17.825 3 17V7q0-.825.587-1.412Q4.175 5 5 5h10q.5 0 .938.225q.437.225.712.625l3.525 5q.375.525.375 1.15q0 .625-.375 1.15l-3.525 5q-.275.4-.712.625Q15.5 19 15 19Z"
34
38
  })
35
- }), ce = (e) => /* @__PURE__ */ t("svg", {
39
+ }), ye = (t) => /* @__PURE__ */ e("svg", {
36
40
  viewBox: "0 0 24 24",
37
41
  width: "1.2em",
38
42
  height: "1.2em",
39
- ...e,
40
- children: /* @__PURE__ */ t("path", {
43
+ ...t,
44
+ children: /* @__PURE__ */ e("path", {
41
45
  fill: "currentColor",
42
46
  d: "m10 16.4l-4-4L7.4 11l2.6 2.6L16.6 7L18 8.4Z"
43
47
  })
44
- }), R = V({});
45
- function ue({
46
- selectable: e = !1,
48
+ }), K = V({});
49
+ function Ce({
50
+ selectable: t = !1,
47
51
  selected: n = [],
48
- onSelect: i,
52
+ onSelect: c,
49
53
  renderItem: l,
50
54
  children: o
51
55
  }) {
52
- const r = (h) => n.indexOf(h) !== -1, s = (h) => {
53
- Array.from(new Set(n).add(h)), i == null || i(h);
54
- }, a = z(
56
+ const r = (h) => n.indexOf(h) !== -1, i = (h) => {
57
+ Array.from(new Set(n).add(h)), c == null || c(h);
58
+ }, d = z(
55
59
  () => ({
56
- selectable: e,
60
+ selectable: t,
57
61
  selected: n,
58
62
  isSelected: r,
59
- select: s,
63
+ select: i,
60
64
  renderItem: l
61
65
  }),
62
66
  [n]
63
67
  );
64
- return /* @__PURE__ */ t(R.Provider, {
65
- value: a,
68
+ return /* @__PURE__ */ e(K.Provider, {
69
+ value: d,
66
70
  children: o
67
71
  });
68
72
  }
69
- const he = (e) => {
73
+ const ve = (t) => {
70
74
  var n;
71
- return e.isLeaf || !((n = e.data.children) != null && n.length);
75
+ return t.isLeaf || !((n = t.data.children) != null && n.length);
72
76
  };
73
- function pe({
74
- node: e
77
+ function be({
78
+ node: t
75
79
  }) {
76
- return he(e) ? /* @__PURE__ */ t("span", {}) : e.isOpen ? /* @__PURE__ */ t(E, {
80
+ return ve(t) ? /* @__PURE__ */ e("span", {}) : t.isOpen ? /* @__PURE__ */ e(j, {
77
81
  style: {
78
82
  fontSize: 20
79
83
  }
80
- }) : /* @__PURE__ */ t(E, {
84
+ }) : /* @__PURE__ */ e(j, {
81
85
  style: {
82
86
  fontSize: 20,
83
87
  transform: "rotate(-90deg)"
84
88
  }
85
89
  });
86
90
  }
87
- function me({
88
- node: e,
91
+ function Ie({
92
+ node: t,
89
93
  style: n,
90
- dragHandle: i
94
+ dragHandle: c
91
95
  }) {
92
96
  const {
93
97
  selectable: l,
94
98
  select: o,
95
99
  isSelected: r,
96
- renderItem: s
97
- } = W(R), {
98
- data: a
99
- } = e, h = a.icon ? /* @__PURE__ */ t($, {
100
- icon: a.icon,
100
+ renderItem: i
101
+ } = q(K), {
102
+ data: d
103
+ } = t, h = d.icon ? /* @__PURE__ */ e(X, {
104
+ icon: d.icon,
101
105
  style: {
102
106
  fontSize: 18
103
107
  }
104
- }) : /* @__PURE__ */ t(de, {
108
+ }) : /* @__PURE__ */ e(xe, {
105
109
  style: {
106
110
  fontSize: 18,
107
- color: a.color || "#ddd"
111
+ color: d.color || "#ddd"
108
112
  }
109
- }), u = (p) => {
110
- p.stopPropagation(), e.isInternal && e.toggle();
111
- }, g = (p) => {
112
- p.stopPropagation(), l && o(e.id);
113
- }, f = /* @__PURE__ */ y(T, {
114
- children: [/* @__PURE__ */ y(m, {
113
+ }), g = (s) => {
114
+ s.stopPropagation(), t.isInternal && t.toggle();
115
+ }, f = (s) => {
116
+ s.stopPropagation(), l && o(t.id);
117
+ }, x = /* @__PURE__ */ C(P, {
118
+ children: [/* @__PURE__ */ C(p, {
115
119
  sx: {
116
120
  display: "flex",
117
121
  alignItems: "center",
118
122
  flex: 1
119
123
  },
120
- children: [/* @__PURE__ */ t(m, {
124
+ children: [/* @__PURE__ */ e(p, {
121
125
  sx: {
122
126
  display: "flex",
123
127
  cursor: "pointer"
124
128
  },
125
- onClick: u,
126
- children: /* @__PURE__ */ t(pe, {
127
- node: e
129
+ onClick: g,
130
+ children: /* @__PURE__ */ e(be, {
131
+ node: t
128
132
  })
129
- }), /* @__PURE__ */ t(m, {
133
+ }), /* @__PURE__ */ e(p, {
130
134
  sx: {
131
135
  display: "flex",
132
136
  alignItems: "center",
@@ -134,16 +138,16 @@ function me({
134
138
  height: 22
135
139
  },
136
140
  children: h
137
- }), /* @__PURE__ */ t(m, {
141
+ }), /* @__PURE__ */ e(p, {
138
142
  component: "span",
139
143
  sx: {
140
144
  color: "grey.700"
141
145
  },
142
- children: e.data.name
146
+ children: t.data.name
143
147
  })]
144
- }), l && r(e.id) && /* @__PURE__ */ t(ce, {})]
148
+ }), l && r(t.id) && /* @__PURE__ */ e(ye, {})]
145
149
  });
146
- return /* @__PURE__ */ y(m, {
150
+ return /* @__PURE__ */ C(p, {
147
151
  className: "label-tree-item",
148
152
  style: n,
149
153
  sx: {
@@ -151,12 +155,12 @@ function me({
151
155
  alignItems: "center",
152
156
  justifyContent: "space-between"
153
157
  },
154
- ref: i,
155
- onClick: g,
156
- children: [!s && f, !!s && s(f, e.data)]
158
+ ref: c,
159
+ onClick: f,
160
+ children: [!i && x, !!i && i(x, t.data)]
157
161
  });
158
162
  }
159
- const fe = j(m)`
163
+ const we = F(p)`
160
164
  > div,
161
165
  > div > div,
162
166
  > div > div > div {
@@ -170,98 +174,108 @@ const fe = j(m)`
170
174
  width: 100%;
171
175
  }
172
176
  `;
173
- function D({
174
- data: e,
177
+ function W({
178
+ data: t,
175
179
  selectable: n,
176
- selected: i = [],
180
+ selected: c = [],
177
181
  onSelect: l,
178
182
  rowHeight: o = 28,
179
183
  renderItem: r,
180
- sx: s,
181
- ...a
184
+ sx: i,
185
+ ...d
182
186
  }) {
183
- const h = N(), u = [...Array.isArray(s) ? s : [s]], [g, f] = I(0), p = B(() => {
184
- var S, d;
185
- f((((d = (S = h.current) == null ? void 0 : S.visibleNodes) == null ? void 0 : d.length) || 0) * o);
187
+ const h = D(), g = [...Array.isArray(i) ? i : [i]], [f, x] = S(0), s = O(() => {
188
+ var b, a;
189
+ x((((a = (b = h.current) == null ? void 0 : b.visibleNodes) == null ? void 0 : a.length) || 0) * o);
186
190
  }, [o]);
187
- return P(() => {
188
- p();
189
- }, [e, p]), /* @__PURE__ */ t(ue, {
191
+ return E(() => {
192
+ s();
193
+ }, [t, s]), /* @__PURE__ */ e(Ce, {
190
194
  selectable: n,
191
- selected: i,
195
+ selected: c,
192
196
  onSelect: l,
193
197
  renderItem: r,
194
- children: /* @__PURE__ */ t(fe, {
195
- ...a,
196
- sx: u,
197
- children: /* @__PURE__ */ t(Z, {
198
- data: e,
198
+ children: /* @__PURE__ */ e(we, {
199
+ ...d,
200
+ sx: g,
201
+ children: /* @__PURE__ */ e(U, {
202
+ data: t,
199
203
  rowHeight: o,
200
- height: g,
204
+ height: f,
201
205
  indent: 32,
202
206
  ref: h,
203
207
  onToggle: () => {
204
- setTimeout(p);
208
+ setTimeout(s);
205
209
  },
206
- children: me
210
+ children: Ie
207
211
  })
208
212
  })
209
213
  });
210
214
  }
211
- const M = (e) => e.reduce((n, i) => {
215
+ const L = (t) => t.reduce((n, c) => {
212
216
  var l;
213
- return n.push(i), (l = i.children) != null && l.length && n.push(...M(i.children)), n;
214
- }, []), H = (e) => e.map((n) => {
215
- var i;
216
- return (i = n.children) != null && i.length && (n.children = H(n.children)), n;
217
- }), ge = (e) => {
218
- const n = e.reduce((o, r) => (o[r.id] = o[r.id] || {}, r.parentId && (o[r.id].parent = r.parentId, o[r.parentId] = o[r.parentId] || {}, o[r.parentId].children = o[r.parentId].children || [], o[r.parentId].children.push(r.id)), o), {}), i = e.map(({ parentId: o, ...r }) => ({ ...r, children: [] })), l = i.reduce((o, r) => ({ ...o, [r.id]: r }), {});
219
- return i.forEach((o) => {
217
+ return n.push(c), (l = c.children) != null && l.length && n.push(...L(c.children)), n;
218
+ }, []), Q = (t) => t.map((n) => {
219
+ var c;
220
+ return (c = n.children) != null && c.length && (n.children = Q(n.children)), n;
221
+ }), Se = (t, n = null) => {
222
+ try {
223
+ return JSON.parse(t);
224
+ } catch {
225
+ return n;
226
+ }
227
+ }, ze = (t) => {
228
+ const n = t.reduce((o, r) => (o[r.id] = o[r.id] || {}, r.parentId && (o[r.id].parent = r.parentId, o[r.parentId] = o[r.parentId] || {}, o[r.parentId].children = o[r.parentId].children || [], o[r.parentId].children.push(r.id)), o), {}), c = t.map(({ parentId: o, translation: r, ...i }) => ({
229
+ ...i,
230
+ translation: Se(r),
231
+ children: []
232
+ })), l = c.reduce((o, r) => ({ ...o, [r.id]: r }), {});
233
+ return c.forEach((o) => {
220
234
  const r = n[o.id];
221
- r.parent && l[r.parent] && (o.parent = l[r.parent]), r.children && (o.children = r.children.map((s) => l[s]));
222
- }), i.filter((o) => !o.parent);
223
- }, xe = (e) => {
235
+ r.parent && l[r.parent] && (o.parent = l[r.parent]), r.children && (o.children = r.children.map((i) => l[i]));
236
+ }), c.filter((o) => !o.parent);
237
+ }, ke = (t) => {
224
238
  const {
225
239
  options: n,
226
- getValue: i,
240
+ getValue: c,
227
241
  selectProps: l,
228
242
  selectOption: o
229
- } = e, r = i(), s = (a) => {
230
- const h = n.find((u) => u.data.id === a);
243
+ } = t, r = c(), i = (d) => {
244
+ const h = n.find((g) => g.data.id === d);
231
245
  h && o(h);
232
246
  };
233
- return /* @__PURE__ */ y(T, {
234
- children: [/* @__PURE__ */ t(q.MenuList, {
235
- ...G(e, ["addon"]),
236
- children: /* @__PURE__ */ t(m, {
247
+ return /* @__PURE__ */ C(P, {
248
+ children: [/* @__PURE__ */ e(H.MenuList, {
249
+ ..._(t, ["addon"]),
250
+ children: /* @__PURE__ */ e(p, {
237
251
  sx: {
238
252
  px: 2,
239
253
  py: 1
240
254
  },
241
- children: /* @__PURE__ */ t(D, {
255
+ children: /* @__PURE__ */ e(W, {
242
256
  data: l.data,
243
257
  selectable: !0,
244
- onSelect: s,
245
- selected: r.map((a) => a.data.id)
258
+ onSelect: i,
259
+ selected: r.map((d) => d.data.id)
246
260
  })
247
261
  })
248
- }), e.addon]
262
+ }), t.addon]
249
263
  });
250
- }, ye = ({
251
- children: e,
264
+ }, Te = ({
265
+ children: t,
252
266
  ...n
253
267
  }) => {
254
- const [i, l] = e, o = Array.isArray(i) ? i.length : 0;
255
- return /* @__PURE__ */ y(q.ValueContainer, {
268
+ const [c, l] = t, o = Array.isArray(c) ? c.length : 0;
269
+ return /* @__PURE__ */ C(H.ValueContainer, {
256
270
  ...n,
257
- children: [/* @__PURE__ */ t(m, {
271
+ children: [/* @__PURE__ */ e(p, {
258
272
  component: "span",
259
273
  sx: {
260
274
  fontSize: 13,
261
275
  fontWeight: "bold"
262
276
  },
263
277
  children: o ? "Labels" : "Filter by labels"
264
- }), !!o && /* @__PURE__ */ t(m, {
278
+ }), !!o && /* @__PURE__ */ e(p, {
265
279
  sx: {
266
280
  display: "inline-flex",
267
281
  justifyContent: "center",
@@ -276,86 +290,86 @@ const M = (e) => e.reduce((n, i) => {
276
290
  children: o
277
291
  }), l]
278
292
  });
279
- }, Ce = {
280
- control: (e) => ({
281
- ...e,
293
+ }, Ae = {
294
+ control: (t) => ({
295
+ ...t,
282
296
  minHeight: 31
283
297
  }),
284
- valueContainer: (e) => ({
285
- ...e,
298
+ valueContainer: (t) => ({
299
+ ...t,
286
300
  display: "flex"
287
301
  }),
288
- dropdownIndicator: (e) => ({
289
- ...e,
302
+ dropdownIndicator: (t) => ({
303
+ ...t,
290
304
  padding: "0 4px"
291
305
  }),
292
- clearIndicator: (e) => ({
293
- ...e,
306
+ clearIndicator: (t) => ({
307
+ ...t,
294
308
  padding: "4px"
295
309
  })
296
310
  };
297
- function ve({
298
- data: e,
311
+ function Oe({
312
+ data: t,
299
313
  value: n = [],
300
- editable: i = !1,
314
+ editable: c = !1,
301
315
  addon: l,
302
316
  onChange: o,
303
317
  compact: r,
304
- ...s
318
+ ...i
305
319
  }) {
306
- const a = N(null), h = z(() => M(e).map((d) => ({
307
- data: d,
308
- label: d.name,
309
- value: d.id
310
- })), [e]), u = h.reduce((d, b) => ({
311
- ...d,
312
- [b.data.id]: b
313
- }), {}), g = Array.isArray(n) ? n : [n], f = g.map((d) => u[d]), p = N({
314
- prev: g.map((d) => u[d].data)
315
- }), v = (d, b) => {
316
- p.current.current = d.map((k) => k.data), ["clear", "remove-value"].includes(b.action) && a.current && setTimeout(() => {
320
+ const d = D(null), h = z(() => L(t).map((a) => ({
321
+ data: a,
322
+ label: a.name,
323
+ value: a.id
324
+ })), [t]), g = h.reduce((a, w) => ({
325
+ ...a,
326
+ [w.data.id]: w
327
+ }), {}), f = Array.isArray(n) ? n : [n], x = f.map((a) => g[a]), s = D({
328
+ prev: f.map((a) => g[a].data)
329
+ }), m = (a, w) => {
330
+ s.current.current = a.map((k) => k.data), ["clear", "remove-value"].includes(w.action) && d.current && setTimeout(() => {
317
331
  var k;
318
- return (k = a == null ? void 0 : a.current) == null ? void 0 : k.blur();
332
+ return (k = d == null ? void 0 : d.current) == null ? void 0 : k.blur();
319
333
  }, 1);
320
- }, S = () => {
321
- p.current.current && JSON.stringify(p.current.prev.map((b) => b.id)) !== JSON.stringify(p.current.current.map((b) => b.id)) && (o(p.current.current), p.current.prev = p.current.current);
334
+ }, b = () => {
335
+ s.current.current && JSON.stringify(s.current.prev.map((w) => w.id)) !== JSON.stringify(s.current.current.map((w) => w.id)) && (o(s.current.current), s.current.prev = s.current.current);
322
336
  };
323
- return /* @__PURE__ */ t(m, {
324
- ...s,
325
- children: /* @__PURE__ */ t(U, {
326
- ref: a,
327
- defaultValue: f,
337
+ return /* @__PURE__ */ e(p, {
338
+ ...i,
339
+ children: /* @__PURE__ */ e(ee, {
340
+ ref: d,
341
+ defaultValue: x,
328
342
  options: h,
329
- onChange: v,
343
+ onChange: m,
330
344
  components: {
331
- MenuList: (d) => /* @__PURE__ */ t(xe, {
332
- ...d,
345
+ MenuList: (a) => /* @__PURE__ */ e(ke, {
346
+ ...a,
333
347
  addon: l
334
348
  }),
335
349
  ...r && {
336
- ValueContainer: ye
350
+ ValueContainer: Te
337
351
  }
338
352
  },
339
353
  placeholder: "Select labels",
340
354
  styles: {
341
- ...r && Ce,
342
- menu: (d) => ({
343
- ...d,
344
- ...i && {
355
+ ...r && Ae,
356
+ menu: (a) => ({
357
+ ...a,
358
+ ...c && {
345
359
  paddingBottom: "36px"
346
360
  },
347
361
  zIndex: 99
348
362
  }),
349
- menuList: (d) => ({
350
- ...d,
363
+ menuList: (a) => ({
364
+ ...a,
351
365
  overflowY: "auto",
352
366
  maxHeight: "264px"
353
367
  })
354
368
  },
355
- theme: (d) => ({
356
- ...d,
369
+ theme: (a) => ({
370
+ ...a,
357
371
  colors: {
358
- ...d.colors,
372
+ ...a.colors,
359
373
  primary25: "#ddd",
360
374
  primary50: "#ddd",
361
375
  primary: "#ddd"
@@ -364,92 +378,186 @@ function ve({
364
378
  isSearchable: !1,
365
379
  isMulti: !0,
366
380
  closeMenuOnSelect: !1,
367
- onMenuClose: S,
368
- data: e
381
+ onMenuClose: b,
382
+ data: t
369
383
  })
370
384
  });
371
385
  }
372
- function be({
373
- open: e,
386
+ function Pe({
387
+ I18NProps: t,
388
+ ...n
389
+ }) {
390
+ const {
391
+ languages: c
392
+ } = $(), {
393
+ translation: l,
394
+ onChange: o
395
+ } = t, [r, i] = S(null), d = (f) => {
396
+ const x = f.currentTarget.closest(".MuiInputBase-root");
397
+ x && i(x);
398
+ }, h = () => {
399
+ i(null);
400
+ }, g = c.filter((f) => f.code !== "en");
401
+ return /* @__PURE__ */ e(R, {
402
+ ...n,
403
+ InputProps: {
404
+ endAdornment: /* @__PURE__ */ C(ae, {
405
+ position: "end",
406
+ children: [/* @__PURE__ */ e(ce, {
407
+ edge: "end",
408
+ onClick: d,
409
+ children: /* @__PURE__ */ e(de, {})
410
+ }), /* @__PURE__ */ e(ue, {
411
+ open: !!r,
412
+ anchorEl: r,
413
+ onClose: h,
414
+ transformOrigin: {
415
+ vertical: "top",
416
+ horizontal: "right"
417
+ },
418
+ anchorOrigin: {
419
+ vertical: "bottom",
420
+ horizontal: "right"
421
+ },
422
+ PaperProps: {
423
+ sx: {
424
+ width: r == null ? void 0 : r.clientWidth,
425
+ maxHeight: 200,
426
+ overflowY: "auto",
427
+ bgcolor: "grey.50"
428
+ }
429
+ },
430
+ elevation: 1,
431
+ sx: {
432
+ mt: 2
433
+ },
434
+ children: /* @__PURE__ */ e(B, {
435
+ sx: {
436
+ p: 2
437
+ },
438
+ children: g.map(({
439
+ code: f,
440
+ name: x
441
+ }) => /* @__PURE__ */ C(B, {
442
+ sx: {
443
+ display: "flex",
444
+ alignItems: "center",
445
+ justifyContent: "space-between",
446
+ "& + &": {
447
+ mt: 1
448
+ }
449
+ },
450
+ children: [/* @__PURE__ */ e(B, {
451
+ sx: {
452
+ flex: "0 0 120px"
453
+ },
454
+ children: x
455
+ }), /* @__PURE__ */ e(B, {
456
+ sx: {
457
+ flex: 1
458
+ },
459
+ children: /* @__PURE__ */ e(R, {
460
+ value: l[f] || "",
461
+ size: "small",
462
+ sx: {
463
+ width: 1
464
+ },
465
+ onChange: (s) => o({
466
+ ...l,
467
+ [f]: s.target.value
468
+ })
469
+ })
470
+ })]
471
+ }, f))
472
+ })
473
+ })]
474
+ })
475
+ }
476
+ });
477
+ }
478
+ function Be({
479
+ open: t,
374
480
  initialLabel: n,
375
- onSubmit: i,
481
+ onSubmit: c,
376
482
  onClose: l,
377
483
  ...o
378
484
  }) {
379
- const r = !(n != null && n.id), [s, a] = te({
485
+ const r = !(n != null && n.id), [i, d] = le({
380
486
  name: (n == null ? void 0 : n.name) || "",
381
487
  color: (n == null ? void 0 : n.color) || "#ddd",
382
- slug: (n == null ? void 0 : n.id) || ""
383
- }), h = (d) => /^#([0-9A-F]{3}){1,2}$/i.test(d), u = z(() => r ? s.name && s.color && s.slug && h(s.color) : s.name && s.color && h(s.color), [s, r]), [g, f] = I(!1), p = () => {
384
- i({
488
+ slug: (n == null ? void 0 : n.id) || "",
489
+ translation: (n == null ? void 0 : n.translation) || {}
490
+ }), h = (a) => /^#([0-9A-F]{3}){1,2}$/i.test(a), g = z(() => r ? i.name && i.color && i.slug && h(i.color) : i.name && i.color && h(i.color), [i, r]), [f, x] = S(!1), s = () => {
491
+ c({
385
492
  ...n,
386
- name: s.name,
387
- color: s.color,
388
- id: s.slug
493
+ name: i.name,
494
+ color: i.color,
495
+ id: i.slug,
496
+ translation: i.translation
389
497
  });
390
- }, v = (d) => {
391
- a({
392
- color: d.hex
393
- }), setTimeout(() => f(!1));
394
- }, S = (d) => {
395
- a({
396
- color: d.target.value
498
+ }, m = (a) => {
499
+ d({
500
+ color: a.hex
501
+ }), setTimeout(() => x(!1));
502
+ }, b = (a) => {
503
+ d({
504
+ color: a.target.value
397
505
  });
398
506
  };
399
- return /* @__PURE__ */ t(F, {
400
- open: e,
507
+ return /* @__PURE__ */ e(J, {
508
+ open: t,
401
509
  showCloseButton: !0,
402
510
  maxWidth: "lg",
403
511
  title: r ? "Create label" : "Edit label",
404
- actions: /* @__PURE__ */ y(T, {
405
- children: [/* @__PURE__ */ t(A, {
512
+ actions: /* @__PURE__ */ C(P, {
513
+ children: [/* @__PURE__ */ e(T, {
406
514
  color: "inherit",
407
515
  variant: "contained",
408
516
  size: "small",
409
517
  onClick: l,
410
518
  children: "Cancel"
411
- }), /* @__PURE__ */ t(A, {
519
+ }), /* @__PURE__ */ e(T, {
412
520
  color: "primary",
413
521
  variant: "contained",
414
522
  size: "small",
415
- onClick: p,
416
- disabled: !u,
523
+ onClick: s,
524
+ disabled: !g,
417
525
  children: r ? "Create" : "Save Changes"
418
526
  })]
419
527
  }),
420
528
  onClose: l,
421
529
  ...o,
422
- children: /* @__PURE__ */ y(m, {
530
+ children: /* @__PURE__ */ C(p, {
423
531
  width: 600,
424
532
  minHeight: 280,
425
- children: [/* @__PURE__ */ t(m, {
426
- sx: {
427
- position: "relative",
428
- zIndex: 9999
429
- },
430
- children: /* @__PURE__ */ t(L, {
431
- label: "Name",
432
- value: s.name,
433
- placeholder: "New label",
434
- size: "small",
435
- fullWidth: !0,
436
- onChange: (d) => a({
437
- name: d.target.value
533
+ children: [/* @__PURE__ */ e(Pe, {
534
+ label: "Name",
535
+ value: i.name,
536
+ placeholder: "New label",
537
+ size: "small",
538
+ fullWidth: !0,
539
+ onChange: (a) => d({
540
+ name: a.target.value
541
+ }),
542
+ I18NProps: {
543
+ translation: i.translation,
544
+ onChange: (a) => d({
545
+ translation: a
438
546
  })
439
- })
440
- }), /* @__PURE__ */ t(L, {
547
+ }
548
+ }), /* @__PURE__ */ e(M, {
441
549
  label: "Slug",
442
- value: s.slug,
550
+ value: i.slug,
443
551
  size: "small",
444
552
  fullWidth: !0,
445
553
  disabled: !r,
446
- onChange: (d) => a({
447
- slug: d.target.value
554
+ onChange: (a) => d({
555
+ slug: a.target.value
448
556
  }),
449
557
  sx: {
450
558
  mt: 2
451
559
  }
452
- }), (n == null ? void 0 : n.parent) && /* @__PURE__ */ t(L, {
560
+ }), (n == null ? void 0 : n.parent) && /* @__PURE__ */ e(M, {
453
561
  label: "Parent",
454
562
  value: n.parent.name,
455
563
  size: "small",
@@ -458,32 +566,32 @@ function be({
458
566
  sx: {
459
567
  mt: 2
460
568
  }
461
- }), /* @__PURE__ */ t(ne, {
462
- onClickAway: () => f(!1),
463
- children: /* @__PURE__ */ y(m, {
569
+ }), /* @__PURE__ */ e(ie, {
570
+ onClickAway: () => x(!1),
571
+ children: /* @__PURE__ */ C(p, {
464
572
  sx: {
465
573
  position: "relative",
466
574
  mt: 2
467
575
  },
468
- children: [/* @__PURE__ */ y(m, {
576
+ children: [/* @__PURE__ */ C(p, {
469
577
  sx: {
470
578
  display: "flex",
471
579
  alignItems: "center",
472
580
  gap: 1
473
581
  },
474
- children: [/* @__PURE__ */ t(m, {
582
+ children: [/* @__PURE__ */ e(p, {
475
583
  sx: {
476
584
  width: 30,
477
585
  height: 30,
478
- bgcolor: s.color,
586
+ bgcolor: i.color,
479
587
  borderRadius: 1
480
588
  },
481
- onClick: () => f(!0)
482
- }), /* @__PURE__ */ t(L, {
589
+ onClick: () => x(!0)
590
+ }), /* @__PURE__ */ e(M, {
483
591
  label: "",
484
- value: s.color,
592
+ value: i.color,
485
593
  size: "small",
486
- onChange: S,
594
+ onChange: b,
487
595
  inputProps: {
488
596
  maxLength: 7
489
597
  },
@@ -494,15 +602,15 @@ function be({
494
602
  }
495
603
  }
496
604
  })]
497
- }), g && /* @__PURE__ */ t(m, {
605
+ }), f && /* @__PURE__ */ e(p, {
498
606
  sx: {
499
607
  position: "absolute",
500
608
  top: 48,
501
609
  zIndex: 1
502
610
  },
503
- children: /* @__PURE__ */ t(re, {
504
- color: s.color,
505
- onChangeComplete: v
611
+ children: /* @__PURE__ */ e(se, {
612
+ color: i.color,
613
+ onChangeComplete: m
506
614
  })
507
615
  })]
508
616
  })
@@ -510,51 +618,51 @@ function be({
510
618
  })
511
619
  });
512
620
  }
513
- function we({
514
- open: e,
621
+ function Ne({
622
+ open: t,
515
623
  label: n,
516
- onSubmit: i,
624
+ onSubmit: c,
517
625
  onClose: l,
518
626
  ...o
519
627
  }) {
520
- return /* @__PURE__ */ t(F, {
521
- open: e,
628
+ return /* @__PURE__ */ e(J, {
629
+ open: t,
522
630
  showCloseButton: !0,
523
631
  maxWidth: "md",
524
632
  title: "Delete",
525
- actions: /* @__PURE__ */ y(T, {
526
- children: [/* @__PURE__ */ t(A, {
633
+ actions: /* @__PURE__ */ C(P, {
634
+ children: [/* @__PURE__ */ e(T, {
527
635
  color: "inherit",
528
636
  variant: "contained",
529
637
  size: "small",
530
638
  onClick: l,
531
639
  children: "Cancel"
532
- }), /* @__PURE__ */ t(A, {
640
+ }), /* @__PURE__ */ e(T, {
533
641
  color: "primary",
534
642
  variant: "contained",
535
643
  size: "small",
536
- onClick: i,
644
+ onClick: c,
537
645
  children: "Delete"
538
646
  })]
539
647
  }),
540
648
  onClose: l,
541
649
  ...o,
542
- children: /* @__PURE__ */ y(m, {
650
+ children: /* @__PURE__ */ C(p, {
543
651
  width: 600,
544
652
  minHeight: 280,
545
- children: [/* @__PURE__ */ t(oe, {
653
+ children: [/* @__PURE__ */ e(he, {
546
654
  severity: "info",
547
655
  sx: {
548
656
  mb: 2
549
657
  },
550
658
  children: "Are you sure you want to delete these labels ?"
551
- }), /* @__PURE__ */ t(D, {
659
+ }), /* @__PURE__ */ e(W, {
552
660
  data: [n]
553
661
  })]
554
662
  })
555
663
  });
556
664
  }
557
- const Se = j(D)`
665
+ const Le = F(W)`
558
666
  .label-tree-item {
559
667
  &:before {
560
668
  content: '';
@@ -575,93 +683,150 @@ const Se = j(D)`
575
683
  padding: 0 16px;
576
684
  }
577
685
  `;
578
- function Ge({
579
- data: e,
686
+ function Me({
687
+ locale: t,
688
+ value: n
689
+ }) {
690
+ return /* @__PURE__ */ C(p, {
691
+ sx: {
692
+ display: "flex",
693
+ alignItems: "center",
694
+ flex: "0 0 auto",
695
+ px: 1,
696
+ py: 0.25,
697
+ fontSize: 12,
698
+ bgcolor: "grey.300",
699
+ borderRadius: 2
700
+ },
701
+ children: [/* @__PURE__ */ e(p, {
702
+ sx: {
703
+ pr: 0.5,
704
+ borderRight: 1,
705
+ borderColor: "grey.400"
706
+ },
707
+ children: t
708
+ }), /* @__PURE__ */ e(p, {
709
+ sx: {
710
+ pl: 0.5
711
+ },
712
+ children: n
713
+ })]
714
+ });
715
+ }
716
+ function dt({
717
+ data: t,
580
718
  api: n,
581
- ...i
719
+ ...c
582
720
  }) {
583
- const [l, o] = I(null), [r, s] = I(null), [a, h] = I(H(e)), u = z(() => M(a), [a]), g = z(() => {
584
- const c = (x, w) => x.map((C) => (w && (C.parent = w), C.children && (C.children = c(C.children, C)), C));
585
- return c(a);
586
- }, [a]), f = (c) => {
587
- var x, w;
588
- c.parent ? (c.parent.children = (w = (x = c.parent) == null ? void 0 : x.children) == null ? void 0 : w.map((C) => C.id === c.id ? {
589
- ...c
590
- } : C), f(c.parent)) : h(a.map((C) => C.id === c.id ? {
591
- ...c
592
- } : C));
593
- }, p = (c) => {
594
- c.parent ? (c.parent.children = c.parent.children || [], c.parent.children.push(c), h([...a])) : h([...a, c]);
595
- }, v = (c) => {
596
- var x;
597
- c.parent ? c.parent.children = (x = c.parent.children) == null ? void 0 : x.filter((w) => w.id !== c.id) : h(a.filter((w) => w.id !== c.id));
598
- }, S = (c) => {
721
+ const [l, o] = S(null), [r, i] = S(null), [d, h] = S(Q(t)), g = z(() => L(d), [d]), f = z(() => {
722
+ const u = (y, I) => y.map((v) => (I && (v.parent = I), v.children && (v.children = u(v.children, v)), v));
723
+ return u(d);
724
+ }, [d]), x = (u) => {
725
+ var y, I;
726
+ u.parent ? (u.parent.children = (I = (y = u.parent) == null ? void 0 : y.children) == null ? void 0 : I.map((v) => v.id === u.id ? {
727
+ ...u
728
+ } : v), x(u.parent)) : h(d.map((v) => v.id === u.id ? {
729
+ ...u
730
+ } : v));
731
+ }, s = (u) => {
732
+ u.parent ? (u.parent.children = u.parent.children || [], u.parent.children.push(u), h([...d])) : h([...d, u]);
733
+ }, m = (u) => {
734
+ var y;
735
+ u.parent ? u.parent.children = (y = u.parent.children) == null ? void 0 : y.filter((I) => I.id !== u.id) : h(d.filter((I) => I.id !== u.id));
736
+ }, b = (u) => {
599
737
  if (l)
600
738
  return;
601
739
  o({
602
740
  id: "",
603
741
  name: "New label",
604
- parent: c,
742
+ parent: u,
605
743
  color: "#dddddd"
606
744
  });
607
- }, d = (c) => {
608
- l || o(c);
609
- }, b = async (c) => {
745
+ }, a = (u) => {
746
+ l || o(u);
747
+ }, w = async (u) => {
610
748
  if (!l)
611
749
  return;
612
750
  const {
613
- parent: x,
614
- children: w,
615
- ...C
616
- } = c;
751
+ parent: y,
752
+ children: I,
753
+ translation: v,
754
+ ...A
755
+ } = u;
617
756
  l.id ? (await n.updateLabel({
618
- ...C,
619
- parentId: x == null ? void 0 : x.id
620
- }), f(c)) : (await n.createLabel({
621
- ...C,
622
- parentId: x == null ? void 0 : x.id
623
- }), p(c)), o(null);
757
+ ...A,
758
+ translation: JSON.stringify(v),
759
+ parentId: y == null ? void 0 : y.id
760
+ }), x(u)) : (await n.createLabel({
761
+ ...A,
762
+ translation: JSON.stringify(v),
763
+ parentId: y == null ? void 0 : y.id
764
+ }), s(u)), o(null);
624
765
  }, k = async () => {
625
- !r || (await n.deleteLabel(r.id), v(r), s(null));
626
- }, J = (c, x) => /* @__PURE__ */ y(T, {
627
- children: [c, /* @__PURE__ */ y(m, {
766
+ !r || (await n.deleteLabel(r.id), m(r), i(null));
767
+ }, G = (u, y) => /* @__PURE__ */ C(P, {
768
+ children: [/* @__PURE__ */ C(p, {
769
+ sx: {
770
+ display: "flex",
771
+ alignItems: "center",
772
+ flexWrap: "wrap"
773
+ },
774
+ children: [/* @__PURE__ */ e(p, {
775
+ children: u
776
+ }), y.translation && /* @__PURE__ */ e(p, {
777
+ sx: {
778
+ display: "flex",
779
+ alignItems: "center",
780
+ gap: 0.5,
781
+ ml: 2
782
+ },
783
+ children: Object.keys(y.translation).map((I) => {
784
+ var A;
785
+ const v = (A = y.translation) == null ? void 0 : A[I];
786
+ return v ? /* @__PURE__ */ e(Me, {
787
+ locale: I,
788
+ value: v
789
+ }, I) : null;
790
+ })
791
+ })]
792
+ }), /* @__PURE__ */ C(p, {
628
793
  sx: {
629
794
  display: "flex",
630
795
  gap: 1,
631
796
  flex: "0 0 auto"
632
797
  },
633
- children: [/* @__PURE__ */ t(O, {
798
+ children: [/* @__PURE__ */ e(N, {
634
799
  color: "inherit",
635
800
  size: "small",
636
801
  sx: {
637
802
  color: "grey.500"
638
803
  },
639
- onClick: () => S(x),
640
- children: /* @__PURE__ */ t(ee, {
804
+ onClick: () => b(y),
805
+ children: /* @__PURE__ */ e(oe, {
641
806
  sx: {
642
807
  fontSize: 20
643
808
  }
644
809
  })
645
- }), /* @__PURE__ */ t(O, {
810
+ }), /* @__PURE__ */ e(N, {
646
811
  color: "inherit",
647
812
  size: "small",
648
813
  sx: {
649
814
  color: "grey.500"
650
815
  },
651
- onClick: () => d(x),
652
- children: /* @__PURE__ */ t(_, {
816
+ onClick: () => a(y),
817
+ children: /* @__PURE__ */ e(re, {
653
818
  sx: {
654
819
  fontSize: 18
655
820
  }
656
821
  })
657
- }), /* @__PURE__ */ t(O, {
822
+ }), /* @__PURE__ */ e(N, {
658
823
  color: "inherit",
659
824
  size: "small",
660
825
  sx: {
661
826
  color: "grey.500"
662
827
  },
663
- onClick: () => s(x),
664
- children: /* @__PURE__ */ t(X, {
828
+ onClick: () => i(y),
829
+ children: /* @__PURE__ */ e(ne, {
665
830
  sx: {
666
831
  fontSize: 20
667
832
  }
@@ -669,29 +834,29 @@ function Ge({
669
834
  })]
670
835
  })]
671
836
  });
672
- return /* @__PURE__ */ y(m, {
673
- ...i,
674
- children: [/* @__PURE__ */ y(m, {
837
+ return /* @__PURE__ */ C(p, {
838
+ ...c,
839
+ children: [/* @__PURE__ */ C(p, {
675
840
  sx: {
676
841
  display: "flex",
677
842
  alignItems: "center",
678
843
  justifyContent: "space-between"
679
844
  },
680
- children: [/* @__PURE__ */ t(Y, {
845
+ children: [/* @__PURE__ */ e(te, {
681
846
  component: "h2",
682
847
  variant: "h6",
683
848
  children: "Manage labels"
684
- }), /* @__PURE__ */ t(A, {
849
+ }), /* @__PURE__ */ e(T, {
685
850
  color: "primary",
686
851
  variant: "contained",
687
852
  size: "small",
688
853
  sx: {
689
854
  textTransform: "none"
690
855
  },
691
- onClick: () => S(),
856
+ onClick: () => b(),
692
857
  children: "New label"
693
858
  })]
694
- }), /* @__PURE__ */ y(m, {
859
+ }), /* @__PURE__ */ C(p, {
695
860
  sx: {
696
861
  mt: 2,
697
862
  border: 1,
@@ -699,174 +864,183 @@ function Ge({
699
864
  borderRadius: 1,
700
865
  overflow: "hidden"
701
866
  },
702
- children: [/* @__PURE__ */ y(m, {
867
+ children: [/* @__PURE__ */ C(p, {
703
868
  sx: {
704
869
  p: 2,
705
870
  fontSize: 14,
706
871
  fontWeight: "bold",
707
872
  bgcolor: "grey.200"
708
873
  },
709
- children: [u.length, " labels"]
710
- }), /* @__PURE__ */ t(m, {
874
+ children: [g.length, " labels"]
875
+ }), /* @__PURE__ */ e(p, {
711
876
  sx: {
712
877
  pt: 0.5
713
878
  },
714
- children: /* @__PURE__ */ t(Se, {
715
- data: g,
879
+ children: /* @__PURE__ */ e(Le, {
880
+ data: f,
716
881
  selected: [],
717
- renderItem: J,
882
+ renderItem: G,
718
883
  rowHeight: 64
719
884
  })
720
885
  })]
721
- }), /* @__PURE__ */ t(be, {
886
+ }), /* @__PURE__ */ e(Be, {
722
887
  open: !!l,
723
888
  onClose: () => o(null),
724
889
  initialLabel: l,
725
- onSubmit: b
726
- }, l == null ? void 0 : l.id), /* @__PURE__ */ t(we, {
890
+ onSubmit: w
891
+ }, l == null ? void 0 : l.id), /* @__PURE__ */ e(Ne, {
727
892
  open: !!r,
728
- onClose: () => s(null),
893
+ onClose: () => i(null),
729
894
  label: r,
730
895
  onSubmit: k
731
896
  }, r == null ? void 0 : r.id)]
732
897
  });
733
898
  }
734
- const K = V({}), Q = () => W(K), Ue = () => {
899
+ const Y = V({}), Z = () => q(Y), ut = () => {
735
900
  const {
736
- updateLabels: e
737
- } = Q();
738
- P(() => () => {
739
- e();
901
+ updateLabels: t
902
+ } = Z();
903
+ E(() => () => {
904
+ t();
740
905
  }, []);
741
906
  };
742
- function Ye({
743
- fetchLabels: e,
907
+ function ht({
908
+ fetchLabels: t,
744
909
  children: n
745
910
  }) {
746
- const [i, l] = I({
911
+ const {
912
+ locale: c
913
+ } = $(), [l, o] = S({
747
914
  loading: !0,
748
915
  labels: [],
749
916
  updateCounter: 1
750
917
  });
751
- P(() => {
918
+ E(() => {
752
919
  (async () => {
753
920
  try {
754
- l((f) => ({
755
- ...f,
921
+ o((b) => ({
922
+ ...b,
756
923
  loading: !0
757
924
  }));
758
- const g = await e();
759
- l((f) => ({
760
- ...f,
925
+ const m = await t();
926
+ o((b) => ({
927
+ ...b,
761
928
  loading: !1,
762
- labels: ge(g)
929
+ labels: ze(m)
763
930
  }));
764
- } catch (g) {
765
- console.error(g), l((f) => ({
766
- ...f,
931
+ } catch (m) {
932
+ console.error(m), o((b) => ({
933
+ ...b,
767
934
  loading: !1,
768
935
  labels: []
769
936
  }));
770
937
  }
771
938
  })();
772
- }, [i.updateCounter]);
773
- const o = z(() => {
774
- var g;
775
- return (g = i.labels) != null && g.length ? M(i.labels).reduce((f, p) => ({
776
- ...f,
777
- [p.id]: p
939
+ }, [l.updateCounter]);
940
+ const r = z(() => {
941
+ var m;
942
+ return (m = l.labels) != null && m.length ? L(l.labels).reduce((b, a) => ({
943
+ ...b,
944
+ [a.id]: a
778
945
  }), {}) : {};
779
- }, [i.labels]), r = B((u) => u.map((g) => o[g]), [o]), s = B((u) => (u == null ? void 0 : u.split(",")) || [], []), a = B((u = []) => {
780
- if (!!(u != null && u.length))
781
- return u.join(",");
782
- }, []), h = z(() => ({
783
- loading: i.loading,
784
- labels: i.labels || [],
785
- updateLabels: () => l((u) => ({
786
- ...u,
787
- updateCounter: ++i.updateCounter
946
+ }, [l.labels]), i = O((s) => {
947
+ var m;
948
+ return {
949
+ ...s,
950
+ name: ((m = s.translation) == null ? void 0 : m[c]) || s.name
951
+ };
952
+ }, [c]), d = O((s) => s.map((m) => r[m]).map(i), [r, i]), h = O((s) => (s == null ? void 0 : s.split(",")) || [], []), g = O((s = []) => {
953
+ if (!!(s != null && s.length))
954
+ return s.join(",");
955
+ }, []), f = z(() => l.labels.map(i), [l.labels, i]), x = z(() => ({
956
+ loading: l.loading,
957
+ labels: l.labels || [],
958
+ updateLabels: () => o((s) => ({
959
+ ...s,
960
+ updateCounter: ++l.updateCounter
788
961
  })),
789
- getLabelsById: r,
790
- parseLabelIds: s,
791
- stringifyLabelIds: a
792
- }), [i, r, s, a]);
793
- return /* @__PURE__ */ t(K.Provider, {
794
- value: h,
962
+ getLabelsById: d,
963
+ parseLabelIds: h,
964
+ stringifyLabelIds: g,
965
+ localizedLabels: f
966
+ }), [l, d, h, g, f]);
967
+ return /* @__PURE__ */ e(Y.Provider, {
968
+ value: x,
795
969
  children: n
796
970
  });
797
971
  }
798
- function Xe({
799
- labels: e,
972
+ function pt({
973
+ labels: t,
800
974
  editable: n,
801
- onChange: i,
975
+ onChange: c,
802
976
  sx: l
803
977
  }) {
804
- const o = !(e != null && e.length), {
978
+ const o = !(t != null && t.length), {
805
979
  labels: r,
806
- loading: s,
807
- getLabelsById: a
808
- } = Q(), [h, u] = I(!1);
809
- if (s || !n && o)
980
+ loading: i,
981
+ getLabelsById: d
982
+ } = Z(), [h, g] = S(!1);
983
+ if (i || !n && o)
810
984
  return null;
811
- const g = (v) => {
812
- i == null || i(v), setTimeout(() => {
813
- u(!1);
985
+ const f = (m) => {
986
+ c == null || c(m), setTimeout(() => {
987
+ g(!1);
814
988
  }, 300);
815
989
  };
816
990
  if (h)
817
- return /* @__PURE__ */ t(se, {
818
- onClickAway: () => h && u(!1),
819
- children: /* @__PURE__ */ t("div", {
820
- children: /* @__PURE__ */ t(ve, {
991
+ return /* @__PURE__ */ e(fe, {
992
+ onClickAway: () => h && g(!1),
993
+ children: /* @__PURE__ */ e("div", {
994
+ children: /* @__PURE__ */ e(Oe, {
821
995
  data: r,
822
- value: e || [],
823
- onChange: g
996
+ value: t || [],
997
+ onChange: f
824
998
  })
825
999
  })
826
1000
  });
827
- const f = a(e || []), p = [{
1001
+ const x = d(t || []), s = [{
828
1002
  display: "flex",
829
1003
  gap: 1,
830
1004
  alignItems: "center",
831
1005
  flexWrap: "wrap"
832
1006
  }, ...Array.isArray(l) ? l : [l]];
833
- return /* @__PURE__ */ y(m, {
834
- sx: p,
835
- children: [f.map((v) => v ? /* @__PURE__ */ t(ae, {
836
- label: v.name,
1007
+ return /* @__PURE__ */ C(p, {
1008
+ sx: s,
1009
+ children: [x.map((m) => m ? /* @__PURE__ */ e(ge, {
1010
+ label: m.name,
837
1011
  variant: "filled",
838
1012
  size: "small",
839
1013
  sx: {
840
1014
  borderRadius: 1
841
1015
  }
842
- }, v.id) : null), n && !o && /* @__PURE__ */ t(O, {
1016
+ }, m.id) : null), n && !o && /* @__PURE__ */ e(N, {
843
1017
  color: "inherit",
844
1018
  size: "small",
845
- onClick: () => u(!0),
1019
+ onClick: () => g(!0),
846
1020
  sx: {
847
1021
  color: "grey.400"
848
1022
  },
849
- children: /* @__PURE__ */ t(ie, {
1023
+ children: /* @__PURE__ */ e(pe, {
850
1024
  sx: {
851
1025
  fontSize: 20
852
1026
  }
853
1027
  })
854
- }), n && o && /* @__PURE__ */ t(A, {
1028
+ }), n && o && /* @__PURE__ */ e(T, {
855
1029
  color: "inherit",
856
1030
  variant: "outlined",
857
- startIcon: /* @__PURE__ */ t(le, {}),
858
- onClick: () => u(!0),
1031
+ startIcon: /* @__PURE__ */ e(me, {}),
1032
+ onClick: () => g(!0),
859
1033
  children: "Edit labels"
860
1034
  })]
861
1035
  });
862
1036
  }
863
1037
  export {
864
- Ge as LabelManager,
865
- ve as LabelPicker,
866
- D as LabelTree,
867
- Xe as Labels,
868
- Ye as LabelsProvider,
869
- ge as transformLabels,
870
- Q as useLabelsContext,
871
- Ue as useLabelsUpdateOnDestroy
1038
+ dt as LabelManager,
1039
+ Oe as LabelPicker,
1040
+ W as LabelTree,
1041
+ pt as Labels,
1042
+ ht as LabelsProvider,
1043
+ ze as transformLabels,
1044
+ Z as useLabelsContext,
1045
+ ut as useLabelsUpdateOnDestroy
872
1046
  };