@hybridcore/ui 1.5.49 → 1.5.50

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.
@@ -5,7 +5,7 @@ import { DataGrid as fe } from "@mui/x-data-grid";
5
5
  import { useState as G, useEffect as ue } from "react";
6
6
  import h from "lodash";
7
7
  import { d as ye } from "../../ol-lGwSyEIV.js";
8
- import { V as he } from "../../index-OtGK6phq.js";
8
+ import { V as he } from "../../index-KcxlW4QD.js";
9
9
  import { RangeSelector as me } from "../range-selector/index.js";
10
10
  const $e = ({
11
11
  open: F,
@@ -0,0 +1,487 @@
1
+ import { jsx as n, jsxs as h, Fragment as _ } from "react/jsx-runtime";
2
+ import { KeyboardArrowUp as R, KeyboardArrowDown as U, Add as J, LockOutlined as Q } from "@mui/icons-material";
3
+ import { Box as W, Typography as s, FormControl as X, FormLabel as Z, FormGroup as z, FormControlLabel as y, Checkbox as P, Button as Y, Chip as p, Dialog as O, DialogTitle as ee, DialogContent as ne, DialogActions as ae, InputAdornment as de, Tooltip as le } from "@mui/material";
4
+ import H from "dayjs";
5
+ import x from "lodash";
6
+ import { useState as E } from "react";
7
+ import te from "./hooks/useToggle.js";
8
+ import { ConditionalWrapper as o } from "./components/conditional-wrapper/index.js";
9
+ import { DateTimePicker as ce } from "./components/date-time-picker/index.js";
10
+ import { GeometryPicker as ie } from "./components/geometry-picker/index.js";
11
+ import { PhoneInput as re } from "./components/phone-input/index.js";
12
+ import S from "./components/instance-form/components/TopLabelWrapper.js";
13
+ import { B as m } from "./Box-SSMZuKnS.js";
14
+ import { T as G } from "./TextField-CdKnj6de.js";
15
+ import { F as me } from "./FormControlLabel-BNT5EI0b.js";
16
+ import { C as he } from "./Checkbox-B0P8LhCl.js";
17
+ import { F as ue, I as oe } from "./InputLabel-ClDXuWBr.js";
18
+ import { S as se } from "./Select-DuyWoyoF.js";
19
+ import { M as Ie } from "./MenuItem-Lcjh1XlV.js";
20
+ import { Container as fe, Values as ge, MiniButton as we } from "./components/instance-form/components/composite-list/styled.js";
21
+ function Ce({
22
+ property: u,
23
+ mapboxAccessToken: e,
24
+ value: l,
25
+ variant: w = "outlined",
26
+ labelPosition: t = "default",
27
+ size: I = "medium",
28
+ onChange: T
29
+ }) {
30
+ var b, k, A;
31
+ const a = te(!1), [f, v] = E(), [V, q] = E(!1), F = 10, B = (c) => {
32
+ v(x.get(c, u.propertyId));
33
+ }, N = () => {
34
+ T([...l || [], f]), v(""), a.action.close();
35
+ }, $ = (c) => () => {
36
+ if (l) {
37
+ const i = [...l];
38
+ i.splice(c, 1), T(i);
39
+ }
40
+ }, M = (c) => {
41
+ const { value: i, checked: C } = c.target;
42
+ let g = x.isArray(l) ? l : [];
43
+ C ? g.push(i) : g = g.filter((d) => d !== i), T(g);
44
+ };
45
+ if (((k = (b = u.dataTypeInfo) == null ? void 0 : b.innerType) == null ? void 0 : k.type) === "enum") {
46
+ const { enumValues: c } = u.dataTypeInfo.innerType;
47
+ return /* @__PURE__ */ n(
48
+ o,
49
+ {
50
+ condition: t === "left",
51
+ wrapper: (i) => /* @__PURE__ */ h(W, { display: "flex", alignItems: "center", children: [
52
+ /* @__PURE__ */ n(s, { width: "32%", children: u.name }),
53
+ /* @__PURE__ */ n(W, { width: "68%", children: i })
54
+ ] }),
55
+ children: /* @__PURE__ */ h(_, { children: [
56
+ /* @__PURE__ */ h(X, { fullWidth: !0, component: "fieldset", variant: w, children: [
57
+ t === "default" && /* @__PURE__ */ n(Z, { component: "legend", sx: { mb: 1 }, children: u.name }),
58
+ /* @__PURE__ */ n(z, { children: c && c.length > 0 ? c.slice(0, V ? 9999 : F).map((i, C) => /* @__PURE__ */ n(
59
+ y,
60
+ {
61
+ label: i,
62
+ control: /* @__PURE__ */ n(
63
+ P,
64
+ {
65
+ name: u.propertyId,
66
+ value: i,
67
+ size: "small",
68
+ checked: x.isArray(l) ? l.includes(i) : !1,
69
+ onChange: M
70
+ }
71
+ ),
72
+ componentsProps: {
73
+ typography: {
74
+ variant: "body2"
75
+ }
76
+ }
77
+ },
78
+ C
79
+ )) : /* @__PURE__ */ n(s, { variant: "caption", mb: 1, children: "No enum values!" }) })
80
+ ] }),
81
+ x.isArray(c) && c.length > F && /* @__PURE__ */ h(
82
+ Y,
83
+ {
84
+ size: "small",
85
+ sx: { p: 0, textTransform: "none" },
86
+ endIcon: V ? /* @__PURE__ */ n(R, {}) : /* @__PURE__ */ n(U, {}),
87
+ onClick: () => q((i) => !i),
88
+ children: [
89
+ "Show ",
90
+ V ? "Less" : "More"
91
+ ]
92
+ }
93
+ )
94
+ ] })
95
+ }
96
+ );
97
+ }
98
+ return /* @__PURE__ */ h(_, { children: [
99
+ /* @__PURE__ */ n(
100
+ o,
101
+ {
102
+ condition: t === "left",
103
+ wrapper: (c) => /* @__PURE__ */ h(W, { display: "flex", alignItems: "center", children: [
104
+ /* @__PURE__ */ n(s, { width: "32%", children: u.name }),
105
+ /* @__PURE__ */ n(W, { width: "68%", children: c })
106
+ ] }),
107
+ children: /* @__PURE__ */ h(fe, { variant: w, children: [
108
+ t === "default" && /* @__PURE__ */ n(s, { children: u.name }),
109
+ /* @__PURE__ */ n(ge, { children: x.isArray(l) && l.map((c, i) => {
110
+ var C, g;
111
+ return /* @__PURE__ */ n(
112
+ p,
113
+ {
114
+ label: ((g = (C = u.dataTypeInfo) == null ? void 0 : C.innerType) == null ? void 0 : g.type) === "date" ? H(c).format("DD/MM/YYYY HH:mm:ss") : c,
115
+ size: I,
116
+ onDelete: $(i)
117
+ },
118
+ i
119
+ );
120
+ }) }),
121
+ /* @__PURE__ */ n(
122
+ we,
123
+ {
124
+ startIcon: /* @__PURE__ */ n(J, {}),
125
+ variant: "text",
126
+ onClick: a.action.open,
127
+ children: "Add"
128
+ }
129
+ )
130
+ ] })
131
+ }
132
+ ),
133
+ /* @__PURE__ */ h(
134
+ O,
135
+ {
136
+ open: a.state.isOpen,
137
+ onClose: a.action.close,
138
+ maxWidth: "sm",
139
+ fullWidth: !0,
140
+ children: [
141
+ /* @__PURE__ */ n(ee, { children: "Add List Value" }),
142
+ /* @__PURE__ */ n(ne, { children: (A = u.dataTypeInfo) != null && A.innerType ? /* @__PURE__ */ n(
143
+ xe,
144
+ {
145
+ mapboxAccessToken: e,
146
+ property: {
147
+ ...u,
148
+ name: "Value",
149
+ type: u.dataTypeInfo.innerType.type
150
+ },
151
+ value: f,
152
+ onChange: B
153
+ }
154
+ ) : null }),
155
+ /* @__PURE__ */ h(ae, { children: [
156
+ /* @__PURE__ */ n(
157
+ Y,
158
+ {
159
+ variant: "contained",
160
+ color: "inherit",
161
+ onClick: a.action.close,
162
+ children: "Cancel"
163
+ }
164
+ ),
165
+ /* @__PURE__ */ n(Y, { variant: "contained", color: "primary", onClick: N, children: "Ok" })
166
+ ] })
167
+ ]
168
+ }
169
+ )
170
+ ] });
171
+ }
172
+ function xe({
173
+ mapboxAccessToken: u,
174
+ property: e,
175
+ value: l,
176
+ variant: w = "standard",
177
+ labelPosition: t = "default",
178
+ size: I = "medium",
179
+ defaultExtent: T,
180
+ fieldOptions: a,
181
+ // keyAuth,
182
+ onChange: f
183
+ }) {
184
+ var M, b, k, A, c, i, C, g;
185
+ const v = (d) => {
186
+ const D = d.target.value.split(",").map((j) => j.trimStart());
187
+ f({
188
+ [e.propertyId]: D
189
+ });
190
+ }, V = (d) => {
191
+ const { name: r, type: D, checked: j, value: K } = d.target;
192
+ let L = K;
193
+ e.type === "double" && (L = L.replace(",", "."), L = L.replace(/[^\d.-]+/g, "")), f({
194
+ [r]: D === "checkbox" ? j : L
195
+ });
196
+ }, q = (d) => {
197
+ f({
198
+ [e.propertyId]: d
199
+ });
200
+ }, F = (d) => {
201
+ f({
202
+ [e.propertyId]: d.target.value
203
+ });
204
+ }, B = (d) => (r) => {
205
+ f({
206
+ [d]: r
207
+ });
208
+ }, N = (d) => (r) => {
209
+ f({
210
+ [d]: r
211
+ });
212
+ }, $ = (d) => (r) => {
213
+ f({
214
+ [d]: r
215
+ });
216
+ };
217
+ if (a && a[e.propertyId] && a[e.propertyId].component)
218
+ return a[e.propertyId].component;
219
+ if ([
220
+ "string",
221
+ "integer",
222
+ "double",
223
+ "text",
224
+ "long",
225
+ "byte",
226
+ "bank-account"
227
+ ].includes(e.type))
228
+ return /* @__PURE__ */ n(
229
+ o,
230
+ {
231
+ condition: t === "left",
232
+ wrapper: (d) => /* @__PURE__ */ h(m, { display: "flex", alignItems: "center", children: [
233
+ /* @__PURE__ */ n(s, { width: "32%", children: e.name }),
234
+ /* @__PURE__ */ n(m, { width: "68%", children: d })
235
+ ] }),
236
+ children: /* @__PURE__ */ n(
237
+ o,
238
+ {
239
+ condition: t === "top",
240
+ wrapper: S(
241
+ e.name,
242
+ (M = a == null ? void 0 : a[e == null ? void 0 : e.propertyId]) == null ? void 0 : M.description
243
+ ),
244
+ children: /* @__PURE__ */ n(
245
+ G,
246
+ {
247
+ label: t === "default" ? e.name : void 0,
248
+ placeholder: ((b = a == null ? void 0 : a[e.propertyId]) == null ? void 0 : b.placeholder) ?? "",
249
+ name: e.propertyId,
250
+ required: e.required,
251
+ value: l ?? e.defaultValue ?? "",
252
+ defaultValue: l,
253
+ onChange: V,
254
+ variant: w,
255
+ type: "text",
256
+ multiline: e.type === "text",
257
+ disabled: !e.editable,
258
+ fullWidth: !0,
259
+ InputProps: {
260
+ size: I,
261
+ ...a && a[e.propertyId] && {
262
+ tabIndex: a[e.propertyId].order
263
+ },
264
+ ...e.privacyPreservationMethod === "ENCRYPTION" ? {
265
+ endAdornment: /* @__PURE__ */ n(de, { position: "end", children: /* @__PURE__ */ n(le, { title: "Encrypted Field", children: /* @__PURE__ */ n(Q, {}) }) })
266
+ } : {}
267
+ }
268
+ }
269
+ )
270
+ }
271
+ )
272
+ }
273
+ );
274
+ if (e.type === "date") {
275
+ const d = l !== void 0 ? H(l).format() : l;
276
+ return /* @__PURE__ */ n(
277
+ o,
278
+ {
279
+ condition: t === "left",
280
+ wrapper: (r) => /* @__PURE__ */ h(m, { display: "flex", alignItems: "center", children: [
281
+ /* @__PURE__ */ n(s, { width: "32%", children: e.name }),
282
+ /* @__PURE__ */ n(m, { width: "68%", children: r })
283
+ ] }),
284
+ children: /* @__PURE__ */ n(
285
+ o,
286
+ {
287
+ condition: t === "top",
288
+ wrapper: S(
289
+ e.name,
290
+ (k = a == null ? void 0 : a[e == null ? void 0 : e.propertyId]) == null ? void 0 : k.description
291
+ ),
292
+ children: /* @__PURE__ */ n(
293
+ ce,
294
+ {
295
+ label: t === "default" ? e.name : void 0,
296
+ value: d,
297
+ variant: w,
298
+ size: I,
299
+ name: e.propertyId,
300
+ onChange: q,
301
+ ...a && a[e.propertyId] && {
302
+ minDate: a[e.propertyId].minDate
303
+ }
304
+ }
305
+ )
306
+ }
307
+ )
308
+ }
309
+ );
310
+ }
311
+ if (e.type === "list") {
312
+ let d = "";
313
+ return e.defaultValue && (d = x.isArray(e.defaultValue) ? l.join(", ") : e.defaultValue), l && (d = x.isArray(l) ? l.join(",") : l), /* @__PURE__ */ n(
314
+ o,
315
+ {
316
+ condition: t === "left",
317
+ wrapper: (r) => /* @__PURE__ */ h(m, { display: "flex", alignItems: "center", children: [
318
+ /* @__PURE__ */ n(s, { width: "32%", children: e.name }),
319
+ /* @__PURE__ */ n(m, { width: "68%", children: r })
320
+ ] }),
321
+ children: /* @__PURE__ */ n(
322
+ o,
323
+ {
324
+ condition: t === "top",
325
+ wrapper: S(
326
+ e.name,
327
+ (A = a == null ? void 0 : a[e == null ? void 0 : e.propertyId]) == null ? void 0 : A.description
328
+ ),
329
+ children: /* @__PURE__ */ n(
330
+ G,
331
+ {
332
+ label: t === "default" ? e.name : void 0,
333
+ name: e.propertyId,
334
+ value: d,
335
+ onChange: v,
336
+ variant: w,
337
+ disabled: !e.editable,
338
+ required: e.required,
339
+ fullWidth: !0,
340
+ helperText: I === "small" ? null : "Add list values with the comma (,) separated string",
341
+ InputProps: {
342
+ size: I,
343
+ placeholder: I === "small" ? "Add list values with the comma (,) separated string" : "",
344
+ ...a && a[e.propertyId] && {
345
+ tabIndex: a[e.propertyId].order
346
+ }
347
+ }
348
+ }
349
+ )
350
+ }
351
+ )
352
+ }
353
+ );
354
+ }
355
+ if (e.type === "boolean")
356
+ return /* @__PURE__ */ n(
357
+ o,
358
+ {
359
+ condition: t === "left",
360
+ wrapper: (d) => /* @__PURE__ */ h(m, { display: "flex", alignItems: "center", children: [
361
+ /* @__PURE__ */ n(s, { width: "32%", children: e.name }),
362
+ /* @__PURE__ */ n(m, { width: "68%", children: d })
363
+ ] }),
364
+ children: /* @__PURE__ */ n(
365
+ me,
366
+ {
367
+ control: /* @__PURE__ */ n(
368
+ he,
369
+ {
370
+ name: e.propertyId,
371
+ checked: !!(l ?? e.defaultValue ?? !1),
372
+ onChange: V,
373
+ size: I
374
+ }
375
+ ),
376
+ label: t === "default" ? e.name : void 0
377
+ }
378
+ )
379
+ }
380
+ );
381
+ if (e.type === "enum") {
382
+ let d = [];
383
+ return (c = e.dataTypeInfo) != null && c.enumValues && (d = e.dataTypeInfo.enumValues), (C = (i = e.dataTypeInfo) == null ? void 0 : i.innerType) != null && C.enumValues && (d = e.dataTypeInfo.innerType.enumValues), /* @__PURE__ */ n(
384
+ o,
385
+ {
386
+ condition: t === "left",
387
+ wrapper: (r) => /* @__PURE__ */ h(m, { display: "flex", alignItems: "center", children: [
388
+ /* @__PURE__ */ n(s, { width: "32%", children: e.name }),
389
+ /* @__PURE__ */ n(m, { width: "68%", children: r })
390
+ ] }),
391
+ children: /* @__PURE__ */ n(
392
+ o,
393
+ {
394
+ condition: t === "top",
395
+ wrapper: S(
396
+ e.name,
397
+ (g = a == null ? void 0 : a[e == null ? void 0 : e.propertyId]) == null ? void 0 : g.description
398
+ ),
399
+ children: /* @__PURE__ */ h(
400
+ ue,
401
+ {
402
+ fullWidth: !0,
403
+ variant: w,
404
+ size: I,
405
+ required: e.required,
406
+ children: [
407
+ t === "default" && /* @__PURE__ */ n(oe, { id: `${e.propertyId}-label`, children: e.name }),
408
+ /* @__PURE__ */ n(
409
+ se,
410
+ {
411
+ label: t === "default" ? e.name : void 0,
412
+ name: e.name,
413
+ labelId: `${e.propertyId}-label`,
414
+ id: e.propertyId,
415
+ value: l ?? "",
416
+ onChange: F,
417
+ inputProps: {
418
+ ...a && a[e.propertyId] && {
419
+ tabIndex: a[e.propertyId].order
420
+ }
421
+ },
422
+ children: d.map((r, D) => /* @__PURE__ */ n(Ie, { value: r, children: r }, D))
423
+ }
424
+ )
425
+ ]
426
+ }
427
+ )
428
+ }
429
+ )
430
+ }
431
+ );
432
+ }
433
+ return e.type === "geometry" ? /* @__PURE__ */ n(
434
+ o,
435
+ {
436
+ condition: t === "left",
437
+ wrapper: (d) => /* @__PURE__ */ h(m, { display: "flex", alignItems: "center", children: [
438
+ /* @__PURE__ */ n(s, { width: "32%", children: e.name }),
439
+ /* @__PURE__ */ n(m, { width: "68%", children: d })
440
+ ] }),
441
+ children: /* @__PURE__ */ n(m, { sx: { width: "100%" }, children: /* @__PURE__ */ n(
442
+ ie,
443
+ {
444
+ mapboxAccessToken: u,
445
+ label: t === "default" ? e.name : void 0,
446
+ value: l ?? e.defaultValue ?? "",
447
+ defaultExtent: T,
448
+ variant: w,
449
+ onChange: B(e.propertyId)
450
+ }
451
+ ) })
452
+ }
453
+ ) : e.type === "phone-number" ? /* @__PURE__ */ n(
454
+ o,
455
+ {
456
+ condition: t === "left",
457
+ wrapper: (d) => /* @__PURE__ */ h(m, { display: "flex", alignItems: "center", children: [
458
+ /* @__PURE__ */ n(s, { width: "32%", children: e.name }),
459
+ /* @__PURE__ */ n(m, { width: "68%", children: d })
460
+ ] }),
461
+ children: /* @__PURE__ */ n(m, { sx: { width: "100%" }, children: /* @__PURE__ */ n(
462
+ re,
463
+ {
464
+ label: t === "default" ? e.name : void 0,
465
+ placeholder: "Enter phone number",
466
+ value: l ?? e.defaultValue ?? "",
467
+ onChange: N(e.propertyId)
468
+ }
469
+ ) })
470
+ }
471
+ ) : e.type === "composite-list" ? /* @__PURE__ */ n(m, { sx: { width: "100%" }, children: /* @__PURE__ */ n(
472
+ Ce,
473
+ {
474
+ property: e,
475
+ value: l ?? e.defaultValue ?? "",
476
+ variant: w,
477
+ labelPosition: t,
478
+ size: I,
479
+ mapboxAccessToken: u,
480
+ onChange: $(e.propertyId)
481
+ }
482
+ ) }) : /* @__PURE__ */ n(_, {});
483
+ }
484
+ export {
485
+ Ce as C,
486
+ xe as V
487
+ };
package/dist/main.d.ts CHANGED
@@ -205,7 +205,7 @@ declare interface DisseminationListProps {
205
205
  *
206
206
  */
207
207
  variant?: "standard" | "outlined" | "filled";
208
- labelPosition?: "default" | "left";
208
+ labelPosition?: "default" | "left" | "top";
209
209
  /**
210
210
  *
211
211
  */
@@ -244,6 +244,8 @@ declare interface FieldOptions {
244
244
  disabled?: boolean;
245
245
  minDate?: Dayjs;
246
246
  helperText?: React.ReactNode;
247
+ placeholder?: string;
248
+ description?: string;
247
249
  component?: React.ReactNode;
248
250
  maxChar?: number;
249
251
  [key: string]: string | number | object | boolean;
@@ -314,7 +316,7 @@ K extends
314
316
  */
315
317
  variant?: "inline" | "dialog";
316
318
  inputVariant?: "standard" | "outlined" | "filled";
317
- labelPosition?: "default" | "left";
319
+ labelPosition?: "default" | "left" | "top";
318
320
  /**
319
321
  *
320
322
  */
@@ -842,7 +844,7 @@ declare interface SecurityLevelProps {
842
844
  *
843
845
  */
844
846
  variant?: "standard" | "outlined" | "filled";
845
- labelPosition?: "default" | "left";
847
+ labelPosition?: "default" | "left" | "top";
846
848
  /**
847
849
  *
848
850
  */
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.5.49",
4
+ "version": "1.5.50",
5
5
  "author": "Hybrid Core",
6
6
  "license": "ISC",
7
7
  "type": "module",