@hybridcore/ui 1.4.18 → 1.4.20

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.
@@ -3,7 +3,7 @@ import "@mui/material";
3
3
  import "./styled.js";
4
4
  import "@mui/icons-material";
5
5
  import "../../../../hooks/useToggle.js";
6
- import { C as l } from "../../../../index-V39OBeR0.js";
6
+ import { C as l } from "../../../../index-BGS3q6sP.js";
7
7
  import "react";
8
8
  import "lodash";
9
9
  import "dayjs";
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "lodash";
3
3
  import "dayjs";
4
- import { V as g } from "../../../../index-V39OBeR0.js";
4
+ import { V as g } from "../../../../index-BGS3q6sP.js";
5
5
  import "@mui/material";
6
6
  import "@mui/icons-material";
7
7
  import "../../../geometry-picker/index.js";
@@ -1,6 +1,6 @@
1
1
  import { jsx as t, Fragment as h } from "react/jsx-runtime";
2
2
  import p from "react";
3
- import { V as x } from "../../../../index-V39OBeR0.js";
3
+ import { V as x } from "../../../../index-BGS3q6sP.js";
4
4
  import _ from "lodash";
5
5
  import { Box as d } from "@mui/material";
6
6
  function V({
@@ -1,61 +1,61 @@
1
- import { jsx as a, jsxs as h, Fragment as $ } from "react/jsx-runtime";
1
+ import { jsx as n, jsxs as h, Fragment as Z } from "react/jsx-runtime";
2
2
  import m from "react";
3
- import Q from "lodash";
4
- import { useForm as X, Controller as s } from "react-hook-form";
5
- import { getNestedChildrenFromMap as z } from "../../utils/ontology.js";
6
- import { i as Z, d as ee } from "../../utils-Bq0ye5vf.js";
7
- import { ConditionalWrapper as te } from "../conditional-wrapper/index.js";
8
- import { Container as ae } from "../container/index.js";
9
- import { TextField as v, FormGroup as ne, FormControl as ie, InputLabel as le, Select as re, MenuItem as de, FormControlLabel as W, Checkbox as M, Box as p, Button as g } from "@mui/material";
10
- import { TreeSelect as oe } from "../tree-select/index.js";
11
- import se from "./components/policy-list/index.js";
12
- import me from "./components/variables/index.js";
13
- import { DisseminationList as ce } from "../data-security-selectors/dissemination-list/index.js";
14
- import { SecurityLevel as ue } from "../data-security-selectors/security-level/index.js";
15
- const fe = {
3
+ import ee from "lodash";
4
+ import { useForm as te, Controller as s } from "react-hook-form";
5
+ import { getNestedChildrenFromMap as ne } from "../../utils/ontology.js";
6
+ import { i as ae, d as ie } from "../../utils-Bq0ye5vf.js";
7
+ import { ConditionalWrapper as le } from "../conditional-wrapper/index.js";
8
+ import { Container as re } from "../container/index.js";
9
+ import { TextField as v, FormGroup as de, FormControl as oe, InputLabel as se, Select as me, MenuItem as ce, FormControlLabel as K, Checkbox as U, Box as p, Button as g } from "@mui/material";
10
+ import { TreeSelect as ue } from "../tree-select/index.js";
11
+ import fe from "./components/policy-list/index.js";
12
+ import he from "./components/variables/index.js";
13
+ import { DisseminationList as ve } from "../data-security-selectors/dissemination-list/index.js";
14
+ import { SecurityLevel as be } from "../data-security-selectors/security-level/index.js";
15
+ const ye = {
16
16
  alg: "A256GCM",
17
17
  ext: !0,
18
18
  k: "_El6rHQxC5E7NdO5DiMDITjF7f65wrlaJmFVagVE9Ic",
19
19
  key_ops: ["encrypt", "decrypt"],
20
20
  kty: "oct"
21
- }, he = [
21
+ }, ge = [
22
22
  "IMAGE",
23
23
  "VIDEO",
24
24
  "TEXT",
25
25
  "BINARY",
26
26
  "OTHER"
27
27
  ];
28
- function ve(e, N) {
29
- var L, V, S, E, F, k, R, O, w, B, _, A, D, P;
28
+ function Te(e, j) {
29
+ var L, V, S, E, F, k, O, R, w, B, _, A, D, P, W, M, N, G;
30
30
  const {
31
31
  register: C,
32
- handleSubmit: G,
32
+ handleSubmit: q,
33
33
  control: o,
34
- formState: { errors: K },
34
+ formState: { errors: H },
35
35
  getValues: I,
36
36
  setValue: b,
37
- reset: U
38
- } = X({
37
+ reset: Y
38
+ } = te({
39
39
  defaultValues: e.defaultValues
40
- }), [j, q] = m.useState([]), [y, x] = m.useState(), [be, H] = m.useState(0), Y = m.useMemo(() => {
40
+ }), [J, $] = m.useState([]), [y, x] = m.useState(), [pe, Q] = m.useState(0), X = m.useMemo(() => {
41
41
  const t = [];
42
- return e.mappedTemplates.forEach((n) => {
43
- n.creatable || t.push(String(n.id));
42
+ return e.mappedTemplates.forEach((a) => {
43
+ a.creatable || t.push(String(a.id));
44
44
  }), t;
45
45
  }, [e.mappedTemplates]);
46
46
  m.useEffect(() => {
47
47
  (async () => {
48
- const t = { ...e.defaultValues }, n = e.mappedTemplates.get(t.templateId);
49
- if (n) {
50
- const r = n.properties.filter(
48
+ const t = { ...e.defaultValues }, a = e.mappedTemplates.get(t.templateId);
49
+ if (a) {
50
+ const r = a.properties.filter(
51
51
  (i) => i.privacyPreservationMethod === "ENCRYPTION"
52
52
  );
53
53
  if (r.length > 0)
54
54
  for (let i = 0; i < r.length; i++) {
55
- const l = r[i], d = Q.get(t, `variables.${l.propertyId}`);
55
+ const l = r[i], d = ee.get(t, `variables.${l.propertyId}`);
56
56
  if (d && e.keyAuth) {
57
- const c = await Z(fe), u = await ee(c, d);
58
- u.data && (b(`variables.${l.propertyId}`, u.data), H((f) => f + 1));
57
+ const c = await ae(ye), u = await ie(c, d);
58
+ u.data && (b(`variables.${l.propertyId}`, u.data), Q((f) => f + 1));
59
59
  }
60
60
  }
61
61
  }
@@ -64,25 +64,25 @@ function ve(e, N) {
64
64
  const T = () => {
65
65
  const t = I("templateId");
66
66
  y && x(void 0);
67
- const n = z(e.mappedTemplates);
68
- q(n);
67
+ const a = ne(e.mappedTemplates);
68
+ $(a);
69
69
  for (const r of e.mappedTemplates.values())
70
70
  if (r.id === t) {
71
71
  x(r);
72
72
  break;
73
73
  }
74
74
  };
75
- m.useImperativeHandle(N, () => ({
75
+ m.useImperativeHandle(j, () => ({
76
76
  resetForm() {
77
- U({
77
+ Y({
78
78
  title: "",
79
79
  description: "",
80
80
  templateId: 0,
81
81
  variables: {}
82
82
  }), T();
83
83
  },
84
- setFormValue(t, n) {
85
- b(t, n);
84
+ setFormValue(t, a) {
85
+ b(t, a);
86
86
  },
87
87
  getFormValue(t) {
88
88
  return I(t);
@@ -91,18 +91,18 @@ function ve(e, N) {
91
91
  }), [e.mappedTemplates]), m.useEffect(() => {
92
92
  e.onSelectedTemplateChange && e.onSelectedTemplateChange(y);
93
93
  }, [y]);
94
- const J = () => {
94
+ const z = () => {
95
95
  if (e.onCancel) {
96
96
  e.onCancel();
97
97
  return;
98
98
  }
99
99
  };
100
- return /* @__PURE__ */ a(
101
- te,
100
+ return /* @__PURE__ */ n(
101
+ le,
102
102
  {
103
103
  condition: e.variant === void 0 || e.variant === "inline",
104
- wrapper: (t) => /* @__PURE__ */ a(
105
- ae,
104
+ wrapper: (t) => /* @__PURE__ */ n(
105
+ re,
106
106
  {
107
107
  disableHeader: !0,
108
108
  sx: { position: "relative", overflow: "visible" },
@@ -112,10 +112,10 @@ function ve(e, N) {
112
112
  children: /* @__PURE__ */ h(
113
113
  "form",
114
114
  {
115
- onSubmit: G(e.onSubmit),
115
+ onSubmit: q(e.onSubmit),
116
116
  style: { display: "flex", flexDirection: "column" },
117
117
  children: [
118
- /* @__PURE__ */ a(
118
+ !((V = (L = e.fieldOptions) == null ? void 0 : L.title) != null && V.hidden) && /* @__PURE__ */ n(
119
119
  v,
120
120
  {
121
121
  label: "Title *",
@@ -123,13 +123,13 @@ function ve(e, N) {
123
123
  fullWidth: !0,
124
124
  sx: { mb: 2 },
125
125
  ...C("title", { required: !0 }),
126
- ...K.title && {
126
+ ...H.title && {
127
127
  helperText: "This field is required!",
128
128
  error: !0
129
129
  }
130
130
  }
131
131
  ),
132
- /* @__PURE__ */ a(
132
+ !((E = (S = e.fieldOptions) == null ? void 0 : S.description) != null && E.hidden) && /* @__PURE__ */ n(
133
133
  v,
134
134
  {
135
135
  label: "Description",
@@ -137,20 +137,20 @@ function ve(e, N) {
137
137
  fullWidth: !0,
138
138
  multiline: !0,
139
139
  sx: { mb: 2 },
140
- minRows: (V = (L = e.fieldOptions) == null ? void 0 : L.description) == null ? void 0 : V.minRows,
140
+ minRows: (k = (F = e.fieldOptions) == null ? void 0 : F.description) == null ? void 0 : k.minRows,
141
141
  ...C("description")
142
142
  }
143
143
  ),
144
- !((E = (S = e.fieldOptions) == null ? void 0 : S.templateId) != null && E.hidden) && /* @__PURE__ */ a(ne, { sx: { mb: 2 }, children: /* @__PURE__ */ a(
144
+ !((R = (O = e.fieldOptions) == null ? void 0 : O.templateId) != null && R.hidden) && /* @__PURE__ */ n(de, { sx: { mb: 2 }, children: /* @__PURE__ */ n(
145
145
  s,
146
146
  {
147
147
  name: "templateId",
148
148
  control: o,
149
- render: ({ field: { value: t, onChange: n } }) => {
149
+ render: ({ field: { value: t, onChange: a } }) => {
150
150
  var r, i;
151
151
  if ((i = (r = e.fieldOptions) == null ? void 0 : r.templateId) != null && i.disabled) {
152
152
  const l = t ? e.mappedTemplates.get(t) : void 0;
153
- return /* @__PURE__ */ a(
153
+ return /* @__PURE__ */ n(
154
154
  v,
155
155
  {
156
156
  label: "Template",
@@ -162,13 +162,13 @@ function ve(e, N) {
162
162
  }
163
163
  );
164
164
  }
165
- return /* @__PURE__ */ a(
166
- oe,
165
+ return /* @__PURE__ */ n(
166
+ ue,
167
167
  {
168
168
  label: "Template",
169
- data: j,
169
+ data: J,
170
170
  selected: t === 0 ? "" : [String(t)],
171
- disabled: Y,
171
+ disabled: X,
172
172
  variant: e.inputVariant,
173
173
  onChange: (l, d) => {
174
174
  const c = {
@@ -176,28 +176,28 @@ function ve(e, N) {
176
176
  value: d ? Number(l) : 0
177
177
  }
178
178
  };
179
- n(c), T();
179
+ a(c), T();
180
180
  }
181
181
  }
182
182
  );
183
183
  }
184
184
  }
185
185
  ) }),
186
- "aliasList" in e.defaultValues && !((k = (F = e.fieldOptions) == null ? void 0 : F.aliasList) != null && k.hidden) && /* @__PURE__ */ a(
186
+ "aliasList" in e.defaultValues && !((B = (w = e.fieldOptions) == null ? void 0 : w.aliasList) != null && B.hidden) && /* @__PURE__ */ n(
187
187
  s,
188
188
  {
189
189
  name: "aliasList",
190
190
  control: o,
191
- render: ({ field: { value: t, onChange: n, ...r } }) => {
191
+ render: ({ field: { value: t, onChange: a, ...r } }) => {
192
192
  const i = (l) => {
193
193
  const u = {
194
194
  target: {
195
195
  value: l.target.value.split(",").map((f) => f.trimStart())
196
196
  }
197
197
  };
198
- n(u);
198
+ a(u);
199
199
  };
200
- return /* @__PURE__ */ a(
200
+ return /* @__PURE__ */ n(
201
201
  v,
202
202
  {
203
203
  label: "Alias List",
@@ -213,46 +213,46 @@ function ve(e, N) {
213
213
  }
214
214
  }
215
215
  ),
216
- "appliedPolicies" in e.defaultValues && !((O = (R = e.fieldOptions) == null ? void 0 : R.appliedPolicies) != null && O.hidden) && /* @__PURE__ */ a(
216
+ "appliedPolicies" in e.defaultValues && !((A = (_ = e.fieldOptions) == null ? void 0 : _.appliedPolicies) != null && A.hidden) && /* @__PURE__ */ n(
217
217
  s,
218
218
  {
219
219
  name: "appliedPolicies",
220
220
  control: o,
221
- render: ({ field: { value: t, onChange: n } }) => /* @__PURE__ */ a(
222
- se,
221
+ render: ({ field: { value: t, onChange: a } }) => /* @__PURE__ */ n(
222
+ fe,
223
223
  {
224
224
  policyList: e.policyList,
225
225
  value: t || void 0,
226
- onChange: n
226
+ onChange: a
227
227
  }
228
228
  )
229
229
  }
230
230
  ),
231
- /* @__PURE__ */ a(
231
+ /* @__PURE__ */ n(
232
232
  s,
233
233
  {
234
234
  name: "variables",
235
235
  control: o,
236
- render: ({ field: { value: t, onChange: n } }) => /* @__PURE__ */ a(
237
- me,
236
+ render: ({ field: { value: t, onChange: a } }) => /* @__PURE__ */ n(
237
+ he,
238
238
  {
239
239
  template: y,
240
240
  value: t,
241
241
  mapboxAccessToken: e.mapboxAccessToken,
242
242
  variant: e.inputVariant,
243
243
  fieldOptions: e.fieldOptions,
244
- onChange: n
244
+ onChange: a
245
245
  }
246
246
  )
247
247
  }
248
248
  ),
249
- "fileInBase64" in e.defaultValues && !((B = (w = e.fieldOptions) == null ? void 0 : w.fileInBase64) != null && B.hidden) && /* @__PURE__ */ h($, { children: [
250
- /* @__PURE__ */ a(
249
+ "fileInBase64" in e.defaultValues && !((P = (D = e.fieldOptions) == null ? void 0 : D.fileInBase64) != null && P.hidden) && /* @__PURE__ */ h(Z, { children: [
250
+ /* @__PURE__ */ n(
251
251
  s,
252
252
  {
253
253
  name: "fileInBase64",
254
254
  control: o,
255
- render: ({ field: { onChange: t, ...n } }) => {
255
+ render: ({ field: { onChange: t, ...a } }) => {
256
256
  const r = (i) => {
257
257
  if (i.target.files) {
258
258
  const l = new FileReader();
@@ -264,7 +264,7 @@ function ve(e, N) {
264
264
  b("originalFileName", d.name), b("contentType", d.type), l.readAsDataURL(d);
265
265
  }
266
266
  };
267
- return /* @__PURE__ */ a(
267
+ return /* @__PURE__ */ n(
268
268
  v,
269
269
  {
270
270
  type: "file",
@@ -275,26 +275,26 @@ function ve(e, N) {
275
275
  helperText: "Select a file to upload",
276
276
  InputLabelProps: { shrink: !0 },
277
277
  onChange: r,
278
- ...n
278
+ ...a
279
279
  }
280
280
  );
281
281
  }
282
282
  }
283
283
  ),
284
- /* @__PURE__ */ a(
284
+ /* @__PURE__ */ n(
285
285
  s,
286
286
  {
287
287
  name: "type",
288
288
  control: o,
289
- render: ({ field: { value: t, onChange: n } }) => {
289
+ render: ({ field: { value: t, onChange: a } }) => {
290
290
  const r = (i) => {
291
291
  const {
292
292
  target: { value: l }
293
293
  } = i;
294
- n(l);
294
+ a(l);
295
295
  };
296
296
  return /* @__PURE__ */ h(
297
- ie,
297
+ oe,
298
298
  {
299
299
  fullWidth: !0,
300
300
  sx: {
@@ -302,13 +302,13 @@ function ve(e, N) {
302
302
  },
303
303
  variant: e.inputVariant,
304
304
  children: [
305
- /* @__PURE__ */ a(le, { children: "Type" }),
306
- /* @__PURE__ */ a(
307
- re,
305
+ /* @__PURE__ */ n(se, { children: "Type" }),
306
+ /* @__PURE__ */ n(
307
+ me,
308
308
  {
309
309
  value: t ? [t] : "",
310
310
  onChange: r,
311
- children: he.map((i) => /* @__PURE__ */ a(de, { value: i, children: i }, i))
311
+ children: ge.map((i) => /* @__PURE__ */ n(ce, { value: i, children: i }, i))
312
312
  }
313
313
  )
314
314
  ]
@@ -317,30 +317,30 @@ function ve(e, N) {
317
317
  }
318
318
  }
319
319
  ),
320
- /* @__PURE__ */ a(
321
- W,
320
+ /* @__PURE__ */ n(
321
+ K,
322
322
  {
323
- control: /* @__PURE__ */ a(
323
+ control: /* @__PURE__ */ n(
324
324
  s,
325
325
  {
326
326
  name: "redacted",
327
327
  control: o,
328
- render: ({ field: { value: t, ...n } }) => /* @__PURE__ */ a(M, { checked: !!t, ...n })
328
+ render: ({ field: { value: t, ...a } }) => /* @__PURE__ */ n(U, { checked: !!t, ...a })
329
329
  }
330
330
  ),
331
331
  label: "Redacted",
332
332
  sx: { mb: 2 }
333
333
  }
334
334
  ),
335
- /* @__PURE__ */ a(
336
- W,
335
+ /* @__PURE__ */ n(
336
+ K,
337
337
  {
338
- control: /* @__PURE__ */ a(
338
+ control: /* @__PURE__ */ n(
339
339
  s,
340
340
  {
341
341
  name: "contentEncrypted",
342
342
  control: o,
343
- render: ({ field: { value: t, ...n } }) => /* @__PURE__ */ a(M, { checked: !!t, ...n })
343
+ render: ({ field: { value: t, ...a } }) => /* @__PURE__ */ n(U, { checked: !!t, ...a })
344
344
  }
345
345
  ),
346
346
  label: "Content Encrypted",
@@ -348,7 +348,7 @@ function ve(e, N) {
348
348
  }
349
349
  )
350
350
  ] }),
351
- !((A = (_ = e.fieldOptions) == null ? void 0 : _.disseminationList) != null && A.hidden) && /* @__PURE__ */ a(
351
+ !((M = (W = e.fieldOptions) == null ? void 0 : W.disseminationList) != null && M.hidden) && /* @__PURE__ */ n(
352
352
  s,
353
353
  {
354
354
  name: "disseminationList",
@@ -356,12 +356,12 @@ function ve(e, N) {
356
356
  required: !0
357
357
  },
358
358
  control: o,
359
- render: ({ field: { value: t, onChange: n }, fieldState: r }) => {
359
+ render: ({ field: { value: t, onChange: a }, fieldState: r }) => {
360
360
  const i = t || [], l = (d) => {
361
- n(d);
361
+ a(d);
362
362
  };
363
- return /* @__PURE__ */ a(
364
- ce,
363
+ return /* @__PURE__ */ n(
364
+ ve,
365
365
  {
366
366
  selectedIds: i,
367
367
  memberedGroups: e.memberedGroups,
@@ -373,7 +373,7 @@ function ve(e, N) {
373
373
  }
374
374
  }
375
375
  ),
376
- !((P = (D = e.fieldOptions) == null ? void 0 : D.securityLevelId) != null && P.hidden) && /* @__PURE__ */ a(p, { mt: 2, children: /* @__PURE__ */ a(
376
+ !((G = (N = e.fieldOptions) == null ? void 0 : N.securityLevelId) != null && G.hidden) && /* @__PURE__ */ n(p, { mt: 2, children: /* @__PURE__ */ n(
377
377
  s,
378
378
  {
379
379
  name: "securityLevelId",
@@ -381,13 +381,13 @@ function ve(e, N) {
381
381
  required: !0
382
382
  },
383
383
  control: o,
384
- render: ({ field: { value: t, onChange: n }, fieldState: r }) => {
384
+ render: ({ field: { value: t, onChange: a }, fieldState: r }) => {
385
385
  var l, d;
386
386
  const i = (c) => {
387
- n(c);
387
+ a(c);
388
388
  };
389
- return /* @__PURE__ */ a(
390
- ue,
389
+ return /* @__PURE__ */ n(
390
+ be,
391
391
  {
392
392
  value: t || 0,
393
393
  ontologyId: e.ontologyId,
@@ -405,19 +405,19 @@ function ve(e, N) {
405
405
  }
406
406
  ) }),
407
407
  /* @__PURE__ */ h(p, { display: "flex", justifyContent: "space-between", mt: 3, children: [
408
- /* @__PURE__ */ a(
408
+ /* @__PURE__ */ n(
409
409
  g,
410
410
  {
411
411
  color: "primary",
412
412
  variant: "text",
413
413
  disabled: e.loading,
414
414
  sx: { textTransform: "none" },
415
- onClick: J,
415
+ onClick: z,
416
416
  children: "Cancel"
417
417
  }
418
418
  ),
419
419
  /* @__PURE__ */ h(p, { children: [
420
- e.onRemove !== void 0 && /* @__PURE__ */ a(
420
+ e.onRemove !== void 0 && /* @__PURE__ */ n(
421
421
  g,
422
422
  {
423
423
  type: "button",
@@ -429,7 +429,7 @@ function ve(e, N) {
429
429
  children: e.removeLoading ? "Deleting..." : "Delete"
430
430
  }
431
431
  ),
432
- e.saveButtons ? e.saveButtons.map((t, n) => /* @__PURE__ */ a(
432
+ e.saveButtons ? e.saveButtons.map((t, a) => /* @__PURE__ */ n(
433
433
  g,
434
434
  {
435
435
  type: "submit",
@@ -441,8 +441,8 @@ function ve(e, N) {
441
441
  onClick: t.onClick,
442
442
  children: t.label
443
443
  },
444
- n
445
- )) : /* @__PURE__ */ a(
444
+ a
445
+ )) : /* @__PURE__ */ n(
446
446
  g,
447
447
  {
448
448
  type: "submit",
@@ -461,7 +461,7 @@ function ve(e, N) {
461
461
  }
462
462
  );
463
463
  }
464
- const Oe = m.forwardRef(ve);
464
+ const Ae = m.forwardRef(Te);
465
465
  export {
466
- Oe as InstanceForm
466
+ Ae as InstanceForm
467
467
  };
@@ -5,7 +5,7 @@ import { DataGrid as fe } from "@mui/x-data-grid";
5
5
  import { useState as H, useEffect as ue } from "react";
6
6
  import h from "lodash";
7
7
  import { e as ye } from "../../ol-CHaVTXvL.js";
8
- import { V as he } from "../../index-V39OBeR0.js";
8
+ import { V as he } from "../../index-BGS3q6sP.js";
9
9
  import { RangeSelector as me } from "../range-selector/index.js";
10
10
  const $e = ({
11
11
  open: F,
@@ -1,8 +1,8 @@
1
1
  import { jsxs as h, Fragment as D, jsx as n } from "react/jsx-runtime";
2
2
  import I from "lodash";
3
- import N from "dayjs";
4
- import { FormControl as W, FormLabel as j, FormGroup as Y, FormControlLabel as $, Checkbox as v, Typography as P, Button as L, Chip as O, Dialog as _, DialogTitle as E, DialogContent as G, DialogActions as M, InputAdornment as H, Tooltip as K } from "@mui/material";
5
- import { Container as R, Values as U, MiniButton as q } from "./components/instance-form/components/composite-list/styled.js";
3
+ import B from "dayjs";
4
+ import { FormControl as N, FormLabel as W, FormGroup as j, FormControlLabel as Y, Checkbox as $, Typography as P, Button as L, Chip as v, Dialog as O, DialogTitle as _, DialogContent as E, DialogActions as G, InputAdornment as M, Tooltip as H } from "@mui/material";
5
+ import { Container as K, Values as R, MiniButton as U } from "./components/instance-form/components/composite-list/styled.js";
6
6
  import { KeyboardArrowUp as J, KeyboardArrowDown as Q, Add as X, LockOutlined as Z } from "@mui/icons-material";
7
7
  import z from "./hooks/useToggle.js";
8
8
  import { GeometryPicker as ee } from "./components/geometry-picker/index.js";
@@ -15,47 +15,47 @@ import { C as ae } from "./Checkbox-qy3cjvnb.js";
15
15
  import { F as oe, I as ie } from "./InputLabel-CWkW8NtU.js";
16
16
  import { S as de } from "./Select-ClaBvSqf.js";
17
17
  import { M as me } from "./MenuItem-D-INSvZa.js";
18
- import { useState as B } from "react";
18
+ import { useState as q } from "react";
19
19
  function ce({
20
20
  property: i,
21
21
  mapboxAccessToken: e,
22
22
  value: l,
23
- variant: r = "outlined",
23
+ variant: s = "outlined",
24
24
  size: m = "medium",
25
25
  onChange: d
26
26
  }) {
27
27
  var g, V, t;
28
- const f = z(!1), [c, p] = B(), [C, w] = B(!1), x = 10, A = (a) => {
29
- p(I.get(a, i.propertyId));
28
+ const f = z(!1), [c, x] = q(), [C, w] = q(!1), k = 10, A = (a) => {
29
+ x(I.get(a, i.propertyId));
30
30
  }, y = () => {
31
- d([...l || [], c]), p(""), f.action.close();
31
+ d([...l || [], c]), x(""), f.action.close();
32
32
  }, F = (a) => () => {
33
33
  if (l) {
34
34
  const o = [...l];
35
35
  o.splice(a, 1), d(o);
36
36
  }
37
- }, k = (a) => {
38
- const { value: o, checked: s } = a.target;
37
+ }, p = (a) => {
38
+ const { value: o, checked: r } = a.target;
39
39
  let u = I.isArray(l) ? l : [];
40
- s ? u.push(o) : u = u.filter((b) => b !== o), d(u);
40
+ r ? u.push(o) : u = u.filter((b) => b !== o), d(u);
41
41
  };
42
42
  if (((V = (g = i.dataTypeInfo) == null ? void 0 : g.innerType) == null ? void 0 : V.type) === "enum") {
43
43
  const { enumValues: a } = i.dataTypeInfo.innerType;
44
44
  return /* @__PURE__ */ h(D, { children: [
45
- /* @__PURE__ */ h(W, { fullWidth: !0, component: "fieldset", variant: r, children: [
46
- /* @__PURE__ */ n(j, { component: "legend", sx: { mb: 1 }, children: i.name }),
47
- /* @__PURE__ */ n(Y, { children: a && a.length > 0 ? a.slice(0, C ? 9999 : x).map((o, s) => /* @__PURE__ */ n(
48
- $,
45
+ /* @__PURE__ */ h(N, { fullWidth: !0, component: "fieldset", variant: s, children: [
46
+ /* @__PURE__ */ n(W, { component: "legend", sx: { mb: 1 }, children: i.name }),
47
+ /* @__PURE__ */ n(j, { children: a && a.length > 0 ? a.slice(0, C ? 9999 : k).map((o, r) => /* @__PURE__ */ n(
48
+ Y,
49
49
  {
50
50
  label: o,
51
51
  control: /* @__PURE__ */ n(
52
- v,
52
+ $,
53
53
  {
54
54
  name: i.propertyId,
55
55
  value: o,
56
56
  size: "small",
57
57
  checked: I.isArray(l) ? l.includes(o) : !1,
58
- onChange: k
58
+ onChange: p
59
59
  }
60
60
  ),
61
61
  componentsProps: {
@@ -64,10 +64,10 @@ function ce({
64
64
  }
65
65
  }
66
66
  },
67
- s
67
+ r
68
68
  )) : /* @__PURE__ */ n(P, { variant: "caption", mb: 1, children: "No enum values!" }) })
69
69
  ] }),
70
- I.isArray(a) && a.length > x && /* @__PURE__ */ h(
70
+ I.isArray(a) && a.length > k && /* @__PURE__ */ h(
71
71
  L,
72
72
  {
73
73
  size: "small",
@@ -83,14 +83,14 @@ function ce({
83
83
  ] });
84
84
  }
85
85
  return /* @__PURE__ */ h(D, { children: [
86
- /* @__PURE__ */ h(R, { variant: r, children: [
86
+ /* @__PURE__ */ h(K, { variant: s, children: [
87
87
  /* @__PURE__ */ n(P, { children: i.name }),
88
- /* @__PURE__ */ n(U, { children: I.isArray(l) && l.map((a, o) => {
89
- var s, u;
88
+ /* @__PURE__ */ n(R, { children: I.isArray(l) && l.map((a, o) => {
89
+ var r, u;
90
90
  return /* @__PURE__ */ n(
91
- O,
91
+ v,
92
92
  {
93
- label: ((u = (s = i.dataTypeInfo) == null ? void 0 : s.innerType) == null ? void 0 : u.type) === "date" ? N(a).format("DD/MM/YYYY HH:mm:ss") : a,
93
+ label: ((u = (r = i.dataTypeInfo) == null ? void 0 : r.innerType) == null ? void 0 : u.type) === "date" ? B(a).format("DD/MM/YYYY HH:mm:ss") : a,
94
94
  size: m,
95
95
  onDelete: F(o)
96
96
  },
@@ -98,7 +98,7 @@ function ce({
98
98
  );
99
99
  }) }),
100
100
  /* @__PURE__ */ n(
101
- q,
101
+ U,
102
102
  {
103
103
  startIcon: /* @__PURE__ */ n(X, {}),
104
104
  variant: "text",
@@ -108,16 +108,16 @@ function ce({
108
108
  )
109
109
  ] }),
110
110
  /* @__PURE__ */ h(
111
- _,
111
+ O,
112
112
  {
113
113
  open: f.state.isOpen,
114
114
  onClose: f.action.close,
115
115
  maxWidth: "sm",
116
116
  fullWidth: !0,
117
117
  children: [
118
- /* @__PURE__ */ n(E, { children: "Add List Value" }),
119
- /* @__PURE__ */ n(G, { children: (t = i.dataTypeInfo) != null && t.innerType ? /* @__PURE__ */ n(
120
- se,
118
+ /* @__PURE__ */ n(_, { children: "Add List Value" }),
119
+ /* @__PURE__ */ n(E, { children: (t = i.dataTypeInfo) != null && t.innerType ? /* @__PURE__ */ n(
120
+ re,
121
121
  {
122
122
  mapboxAccessToken: e,
123
123
  property: {
@@ -129,7 +129,7 @@ function ce({
129
129
  onChange: A
130
130
  }
131
131
  ) : null }),
132
- /* @__PURE__ */ h(M, { children: [
132
+ /* @__PURE__ */ h(G, { children: [
133
133
  /* @__PURE__ */ n(
134
134
  L,
135
135
  {
@@ -146,34 +146,34 @@ function ce({
146
146
  )
147
147
  ] });
148
148
  }
149
- function se({
149
+ function re({
150
150
  mapboxAccessToken: i,
151
151
  property: e,
152
152
  value: l,
153
- variant: r = "standard",
153
+ variant: s = "standard",
154
154
  size: m = "medium",
155
155
  disableMargin: d = !1,
156
156
  defaultExtent: f,
157
157
  // keyAuth,
158
158
  onChange: c
159
159
  }) {
160
- var k, g, V;
161
- const p = (t) => {
162
- const o = t.target.value.split(",").map((s) => s.trimStart());
160
+ var p, g, V;
161
+ const x = (t) => {
162
+ const o = t.target.value.split(",").map((r) => r.trimStart());
163
163
  c({
164
164
  [e.propertyId]: o
165
165
  });
166
166
  }, C = (t) => {
167
- const { name: a, type: o, checked: s, value: u } = t.target;
167
+ const { name: a, type: o, checked: r, value: u } = t.target;
168
168
  let b = u;
169
169
  e.type === "double" && (b = b.replace(",", "."), b = b.replace(/[^\d.-]+/g, "")), c({
170
- [a]: o === "checkbox" ? s : b
170
+ [a]: o === "checkbox" ? r : b
171
171
  });
172
172
  }, w = (t) => {
173
173
  c({
174
174
  [e.propertyId]: t
175
175
  });
176
- }, x = (t) => {
176
+ }, k = (t) => {
177
177
  c({
178
178
  [e.propertyId]: t.target.value
179
179
  });
@@ -204,10 +204,11 @@ function se({
204
204
  {
205
205
  label: e.name,
206
206
  name: e.propertyId,
207
+ required: e.required,
207
208
  value: l ?? e.defaultValue ?? "",
208
209
  defaultValue: l,
209
210
  onChange: C,
210
- variant: r,
211
+ variant: s,
211
212
  type: "text",
212
213
  multiline: e.type === "text",
213
214
  disabled: !e.editable,
@@ -216,19 +217,19 @@ function se({
216
217
  InputProps: {
217
218
  size: m,
218
219
  ...e.privacyPreservationMethod === "ENCRYPTION" ? {
219
- endAdornment: /* @__PURE__ */ n(H, { position: "end", children: /* @__PURE__ */ n(K, { title: "Encrypted Field", children: /* @__PURE__ */ n(Z, {}) }) })
220
+ endAdornment: /* @__PURE__ */ n(M, { position: "end", children: /* @__PURE__ */ n(H, { title: "Encrypted Field", children: /* @__PURE__ */ n(Z, {}) }) })
220
221
  } : {}
221
222
  }
222
223
  }
223
224
  );
224
225
  if (e.type === "date") {
225
- const t = l !== void 0 ? N(l).format() : l;
226
+ const t = l !== void 0 ? B(l).format() : l;
226
227
  return /* @__PURE__ */ n(T, { mb: d ? 0 : 2, children: /* @__PURE__ */ n(
227
228
  le,
228
229
  {
229
230
  label: e.name,
230
231
  value: t,
231
- variant: r,
232
+ variant: s,
232
233
  size: m,
233
234
  name: e.propertyId,
234
235
  onChange: w
@@ -243,9 +244,10 @@ function se({
243
244
  label: e.name,
244
245
  name: e.propertyId,
245
246
  value: t,
246
- onChange: p,
247
- variant: r,
247
+ onChange: x,
248
+ variant: s,
248
249
  disabled: !e.editable,
250
+ required: e.required,
249
251
  fullWidth: !0,
250
252
  helperText: m === "small" ? null : "Add list values with the comma (,) separated string",
251
253
  sx: { mb: d ? 0 : 2 },
@@ -274,13 +276,14 @@ function se({
274
276
  ) });
275
277
  if (e.type === "enum") {
276
278
  let t = [];
277
- return (k = e.dataTypeInfo) != null && k.enumValues && (t = e.dataTypeInfo.enumValues), (V = (g = e.dataTypeInfo) == null ? void 0 : g.innerType) != null && V.enumValues && (t = e.dataTypeInfo.innerType.enumValues), /* @__PURE__ */ h(
279
+ return (p = e.dataTypeInfo) != null && p.enumValues && (t = e.dataTypeInfo.enumValues), (V = (g = e.dataTypeInfo) == null ? void 0 : g.innerType) != null && V.enumValues && (t = e.dataTypeInfo.innerType.enumValues), /* @__PURE__ */ h(
278
280
  oe,
279
281
  {
280
282
  fullWidth: !0,
281
- variant: r,
283
+ variant: s,
282
284
  sx: { mb: d ? 0 : 2 },
283
285
  size: m,
286
+ required: e.required,
284
287
  children: [
285
288
  /* @__PURE__ */ n(ie, { id: `${e.propertyId}-label`, children: e.name }),
286
289
  /* @__PURE__ */ n(
@@ -291,7 +294,7 @@ function se({
291
294
  labelId: `${e.propertyId}-label`,
292
295
  id: e.propertyId,
293
296
  value: l ?? "",
294
- onChange: x,
297
+ onChange: k,
295
298
  children: t.map((a, o) => /* @__PURE__ */ n(me, { value: a, children: a }, o))
296
299
  }
297
300
  )
@@ -306,7 +309,7 @@ function se({
306
309
  label: e.name,
307
310
  value: l ?? e.defaultValue ?? "",
308
311
  defaultExtent: f,
309
- variant: r,
312
+ variant: s,
310
313
  onChange: A(e.propertyId)
311
314
  }
312
315
  ) }) : e.type === "phone-number" ? /* @__PURE__ */ n(T, { sx: { mb: d ? 0 : 2, width: "100%" }, children: /* @__PURE__ */ n(
@@ -322,7 +325,7 @@ function se({
322
325
  {
323
326
  property: e,
324
327
  value: l ?? e.defaultValue ?? "",
325
- variant: r,
328
+ variant: s,
326
329
  size: m,
327
330
  mapboxAccessToken: i,
328
331
  onChange: F(e.propertyId)
@@ -331,5 +334,5 @@ function se({
331
334
  }
332
335
  export {
333
336
  ce as C,
334
- se as V
337
+ re as V
335
338
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hybridcore/ui",
3
3
  "description": "Hybrid Core UI Library",
4
- "version": "1.4.18",
4
+ "version": "1.4.20",
5
5
  "author": "Hybrid Core",
6
6
  "license": "ISC",
7
7
  "type": "module",