@hybridcore/ui 1.5.33 → 1.5.34

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