dgz-ui-shared 1.2.38 → 1.2.40

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,82 +1,82 @@
1
1
  import { FormField as N, FormLabel as v, FormItem as g, FormControl as p, Checkbox as D, Input as $, FormMessage as k, HtmlEditor as R, MaskInput as E, RadioGroupItem as H, Select as j, SelectTrigger as z, SelectValue as A, SelectContent as V, SelectItem as G, Switch as L, Textarea as O } from "dgz-ui/form";
2
2
  export * from "dgz-ui/form";
3
- import { jsx as e, jsxs as t } from "react/jsx-runtime";
3
+ import { jsx as e, jsxs as c } from "react/jsx-runtime";
4
4
  import { useId as P } from "react";
5
5
  import { DATE as _, Calendar as q, TimePicker as F } from "dgz-ui/calendar";
6
6
  import { Popover as B, PopoverTrigger as J, PopoverContent as K } from "dgz-ui/popover";
7
7
  import { cn as u, dayjs as S } from "dgz-ui/utils";
8
- import { g as y } from "../../chunks/MyInput-ByJ5vTAN.es.js";
8
+ import { g as b } from "../../chunks/MyInput-ByJ5vTAN.es.js";
9
9
  import { M as ke } from "../../chunks/MyInput-ByJ5vTAN.es.js";
10
10
  import { Calendar1 as Q } from "lucide-react";
11
11
  import { D as U } from "../../chunks/DateRangePicker-DeoV3xqL.es.js";
12
12
  import { M as Ce } from "../../chunks/MySelect-CRXtMlbf.es.js";
13
- const le = ({
13
+ const se = ({
14
14
  control: a,
15
15
  name: r,
16
- label: c,
16
+ label: t,
17
17
  rules: i,
18
- ...l
18
+ ...s
19
19
  }) => {
20
- const n = P();
20
+ const l = P();
21
21
  return r && a && /* @__PURE__ */ e(
22
22
  N,
23
23
  {
24
24
  control: a,
25
25
  name: r,
26
26
  rules: i,
27
- render: ({ field: s }) => /* @__PURE__ */ e(v, { className: "block", htmlFor: l.id || n, children: /* @__PURE__ */ t(g, { className: "flex flex-row items-start gap-3", children: [
27
+ render: ({ field: n }) => /* @__PURE__ */ e(v, { className: "block", htmlFor: s.id || l, children: /* @__PURE__ */ c(g, { className: "flex flex-row items-start gap-3", children: [
28
28
  /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e(
29
29
  D,
30
30
  {
31
- id: l.id || n,
32
- checked: s.value,
33
- onCheckedChange: s.onChange,
34
- ...l
31
+ id: s.id || l,
32
+ checked: n.value,
33
+ onCheckedChange: n.onChange,
34
+ ...s
35
35
  }
36
36
  ) }),
37
- /* @__PURE__ */ e("div", { className: "space-y-1 leading-none", children: c && /* @__PURE__ */ e("div", { children: c }) })
37
+ t && /* @__PURE__ */ e("div", { className: "mt-0.5", children: t })
38
38
  ] }) })
39
39
  }
40
40
  ) || null;
41
- }, ne = ({
41
+ }, le = ({
42
42
  control: a,
43
43
  name: r,
44
- label: c,
44
+ label: t,
45
45
  required: i,
46
- rules: l,
47
- format: n = _,
48
- floatingError: s,
46
+ rules: s,
47
+ format: l = _,
48
+ floatingError: n,
49
49
  placeholder: d,
50
- disabled: h,
51
- register: m,
50
+ disabled: m,
51
+ register: h,
52
52
  className: x,
53
- showTime: b,
54
- inputProps: f,
53
+ showTime: f,
54
+ inputProps: y,
55
55
  ...M
56
56
  }) => r && a && /* @__PURE__ */ e(
57
57
  N,
58
58
  {
59
59
  control: a,
60
60
  name: r,
61
- rules: l,
62
- render: ({ field: o, formState: C }) => /* @__PURE__ */ t(g, { children: [
63
- c && /* @__PURE__ */ t(v, { className: "block", children: [
64
- c,
61
+ rules: s,
62
+ render: ({ field: o, formState: C }) => /* @__PURE__ */ c(g, { children: [
63
+ t && /* @__PURE__ */ c(v, { className: "block", children: [
64
+ t,
65
65
  " ",
66
66
  i && /* @__PURE__ */ e("span", { className: "text-red-600", children: "*" })
67
67
  ] }),
68
- /* @__PURE__ */ t(B, { children: [
69
- /* @__PURE__ */ e(J, { asChild: !0, children: /* @__PURE__ */ t("div", { className: "relative", children: [
68
+ /* @__PURE__ */ c(B, { children: [
69
+ /* @__PURE__ */ e(J, { asChild: !0, children: /* @__PURE__ */ c("div", { className: "relative", children: [
70
70
  /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e(
71
71
  $,
72
72
  {
73
- ...f,
74
- variant: y(C.errors, `${r}.message`) ? "failure" : "default",
75
- disabled: h,
73
+ ...y,
74
+ variant: b(C.errors, `${r}.message`) ? "failure" : "default",
75
+ disabled: m,
76
76
  ...o,
77
77
  readOnly: !0,
78
78
  placeholder: d || "Pick a date",
79
- value: o.value ? S(o.value).format(n) : void 0,
79
+ value: o.value ? S(o.value).format(l) : void 0,
80
80
  className: u("m-0 text-start", x)
81
81
  }
82
82
  ) }),
@@ -85,18 +85,18 @@ const le = ({
85
85
  {
86
86
  className: u(
87
87
  "text-secondary absolute top-2.5 right-2 size-5",
88
- h && "pointer-events-none opacity-50"
88
+ m && "pointer-events-none opacity-50"
89
89
  )
90
90
  }
91
91
  ),
92
92
  /* @__PURE__ */ e(
93
93
  k,
94
94
  {
95
- className: u(s && "absolute -bottom-5")
95
+ className: u(n && "absolute -bottom-5")
96
96
  }
97
97
  )
98
98
  ] }) }),
99
- !h && /* @__PURE__ */ t(K, { className: "w-auto p-0", align: "start", children: [
99
+ !m && /* @__PURE__ */ c(K, { className: "w-auto p-0", align: "start", children: [
100
100
  /* @__PURE__ */ e(
101
101
  q,
102
102
  {
@@ -106,7 +106,7 @@ const le = ({
106
106
  onSelect: o.onChange
107
107
  }
108
108
  ),
109
- b && /* @__PURE__ */ e("div", { className: "px-4 pb-3", children: /* @__PURE__ */ e(
109
+ f && /* @__PURE__ */ e("div", { className: "px-4 pb-3", children: /* @__PURE__ */ e(
110
110
  F,
111
111
  {
112
112
  value: S(o.value).format("HH:mm"),
@@ -122,42 +122,42 @@ const le = ({
122
122
  ] })
123
123
  ] })
124
124
  }
125
- ) || null, se = ({
125
+ ) || null, ne = ({
126
126
  control: a,
127
127
  name: r,
128
- label: c,
128
+ label: t,
129
129
  required: i,
130
- rules: l,
131
- placeholder: n,
132
- floatingError: s,
130
+ rules: s,
131
+ placeholder: l,
132
+ floatingError: n,
133
133
  ...d
134
134
  }) => r && a && /* @__PURE__ */ e(
135
135
  N,
136
136
  {
137
137
  control: a,
138
138
  name: r,
139
- rules: l,
140
- render: ({ field: h, formState: m }) => /* @__PURE__ */ t(g, { children: [
141
- c && /* @__PURE__ */ t(v, { className: "block", children: [
142
- c,
139
+ rules: s,
140
+ render: ({ field: m, formState: h }) => /* @__PURE__ */ c(g, { children: [
141
+ t && /* @__PURE__ */ c(v, { className: "block", children: [
142
+ t,
143
143
  " ",
144
144
  i && /* @__PURE__ */ e("span", { className: "text-red-600", children: "*" })
145
145
  ] }),
146
- /* @__PURE__ */ t("div", { children: [
146
+ /* @__PURE__ */ c("div", { children: [
147
147
  /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e(
148
148
  U,
149
149
  {
150
150
  ...d,
151
- error: `${y(m.errors, r, "")}`,
152
- selected: h.value,
153
- onRangeSelected: h.onChange,
154
- placeholder: n
151
+ error: `${b(h.errors, r, "")}`,
152
+ selected: m.value,
153
+ onRangeSelected: m.onChange,
154
+ placeholder: l
155
155
  }
156
156
  ) }),
157
157
  /* @__PURE__ */ e(
158
158
  k,
159
159
  {
160
- className: u(s && "absolute -bottom-5")
160
+ className: u(n && "absolute -bottom-5")
161
161
  }
162
162
  )
163
163
  ] })
@@ -166,29 +166,29 @@ const le = ({
166
166
  ) || null, ie = ({
167
167
  control: a,
168
168
  name: r,
169
- label: c,
169
+ label: t,
170
170
  rules: i,
171
- required: l,
172
- floatingError: n,
173
- ...s
171
+ required: s,
172
+ floatingError: l,
173
+ ...n
174
174
  }) => r && a && /* @__PURE__ */ e(
175
175
  N,
176
176
  {
177
177
  control: a,
178
178
  name: r,
179
179
  rules: i,
180
- render: ({ field: d }) => /* @__PURE__ */ t(g, { children: [
181
- c && /* @__PURE__ */ t(v, { className: "block", children: [
182
- c,
180
+ render: ({ field: d }) => /* @__PURE__ */ c(g, { children: [
181
+ t && /* @__PURE__ */ c(v, { className: "block", children: [
182
+ t,
183
183
  " ",
184
- l && /* @__PURE__ */ e("span", { className: "text-red-600", children: "*" })
184
+ s && /* @__PURE__ */ e("span", { className: "text-red-600", children: "*" })
185
185
  ] }),
186
- /* @__PURE__ */ t("div", { children: [
187
- /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e(R, { ...d, ...s }) }),
186
+ /* @__PURE__ */ c("div", { children: [
187
+ /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e(R, { ...d, ...n }) }),
188
188
  /* @__PURE__ */ e(
189
189
  k,
190
190
  {
191
- className: u(n && "absolute -bottom-5")
191
+ className: u(l && "absolute -bottom-5")
192
192
  }
193
193
  )
194
194
  ] })
@@ -197,24 +197,24 @@ const le = ({
197
197
  ) || null, de = ({
198
198
  control: a,
199
199
  name: r,
200
- label: c,
200
+ label: t,
201
201
  rules: i,
202
- required: l,
203
- floatingError: n,
204
- ...s
202
+ required: s,
203
+ floatingError: l,
204
+ ...n
205
205
  }) => r && a && /* @__PURE__ */ e(
206
206
  N,
207
207
  {
208
208
  control: a,
209
209
  name: r,
210
210
  rules: i,
211
- render: ({ field: d, formState: h }) => /* @__PURE__ */ t(g, { children: [
212
- c && /* @__PURE__ */ t(v, { className: "block", children: [
213
- c,
211
+ render: ({ field: d, formState: m }) => /* @__PURE__ */ c(g, { children: [
212
+ t && /* @__PURE__ */ c(v, { className: "block", children: [
213
+ t,
214
214
  " ",
215
- l && /* @__PURE__ */ e("span", { className: "text-red-600", children: "*" })
215
+ s && /* @__PURE__ */ e("span", { className: "text-red-600", children: "*" })
216
216
  ] }),
217
- /* @__PURE__ */ t("div", { children: [
217
+ /* @__PURE__ */ c("div", { children: [
218
218
  /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e(
219
219
  E,
220
220
  {
@@ -223,15 +223,15 @@ const le = ({
223
223
  placeholderChar: "_",
224
224
  unmask: !0,
225
225
  ...d,
226
- ...s,
227
- variant: y(h.errors, `${r}.message`) ? "failure" : "default",
228
- onAccept: (m) => d.onChange(m)
226
+ ...n,
227
+ variant: b(m.errors, `${r}.message`) ? "failure" : "default",
228
+ onAccept: (h) => d.onChange(h)
229
229
  }
230
230
  ) }),
231
231
  /* @__PURE__ */ e(
232
232
  k,
233
233
  {
234
- className: u(n && "absolute -bottom-5")
234
+ className: u(l && "absolute -bottom-5")
235
235
  }
236
236
  )
237
237
  ] })
@@ -240,81 +240,81 @@ const le = ({
240
240
  ) || null, oe = ({
241
241
  control: a,
242
242
  name: r,
243
- label: c,
243
+ label: t,
244
244
  rules: i,
245
- value: l,
246
- ...n
245
+ value: s,
246
+ ...l
247
247
  }) => {
248
- const s = P();
248
+ const n = P();
249
249
  return r && a && /* @__PURE__ */ e(
250
250
  N,
251
251
  {
252
252
  control: a,
253
253
  name: r,
254
254
  rules: i,
255
- render: ({ field: d }) => /* @__PURE__ */ e(v, { className: "block", htmlFor: n.id || s, children: /* @__PURE__ */ t(g, { className: "flex flex-row items-start gap-3", children: [
255
+ render: ({ field: d }) => /* @__PURE__ */ e(v, { className: "block", htmlFor: l.id || n, children: /* @__PURE__ */ c(g, { className: "flex flex-row items-start gap-3", children: [
256
256
  /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e(
257
257
  H,
258
258
  {
259
- id: n.id || s,
260
- value: l,
261
- checked: d.value === l,
259
+ id: l.id || n,
260
+ value: s,
261
+ checked: d.value === s,
262
262
  onClick: () => {
263
- d.value !== l && d.onChange(l);
263
+ d.value !== s && d.onChange(s);
264
264
  },
265
- ...n
265
+ ...l
266
266
  }
267
267
  ) }),
268
- /* @__PURE__ */ e("div", { className: "space-y-1 leading-none", children: c && /* @__PURE__ */ e("div", { children: c }) })
268
+ t && /* @__PURE__ */ e("div", { className: "mt-0.5", children: t })
269
269
  ] }) })
270
270
  }
271
271
  ) || null;
272
- }, he = ({
272
+ }, me = ({
273
273
  control: a,
274
274
  name: r,
275
- label: c,
275
+ label: t,
276
276
  required: i,
277
- className: l,
278
- rules: n,
279
- options: s = [],
277
+ className: s,
278
+ rules: l,
279
+ options: n = [],
280
280
  placeholder: d = "Select an option",
281
- disabled: h,
282
- onChange: m
281
+ disabled: m,
282
+ onChange: h
283
283
  }) => r && a && /* @__PURE__ */ e(
284
284
  N,
285
285
  {
286
286
  control: a,
287
287
  name: r,
288
- rules: n,
289
- render: ({ field: x, formState: b }) => {
290
- const f = !!y(b.errors, `${r}`), M = (o) => {
288
+ rules: l,
289
+ render: ({ field: x, formState: f }) => {
290
+ const y = !!b(f.errors, `${r}`), M = (o) => {
291
291
  const C = Number(o) ? Number(o) : o;
292
- C && x.value !== C && (x.onChange(C), m == null || m(C));
292
+ C && x.value !== C && (x.onChange(C), h == null || h(C));
293
293
  };
294
- return /* @__PURE__ */ t(g, { children: [
295
- c && /* @__PURE__ */ t(v, { children: [
296
- c,
294
+ return /* @__PURE__ */ c(g, { children: [
295
+ t && /* @__PURE__ */ c(v, { children: [
296
+ t,
297
297
  " ",
298
298
  i && /* @__PURE__ */ e("span", { className: "text-red-600", children: "*" })
299
299
  ] }),
300
- /* @__PURE__ */ t("div", { children: [
301
- /* @__PURE__ */ e(p, { children: /* @__PURE__ */ t(
300
+ /* @__PURE__ */ c("div", { children: [
301
+ /* @__PURE__ */ e(p, { children: /* @__PURE__ */ c(
302
302
  j,
303
303
  {
304
304
  value: `${x.value || ""}`,
305
305
  onValueChange: M,
306
- disabled: h,
306
+ disabled: m,
307
307
  children: [
308
308
  /* @__PURE__ */ e(
309
309
  z,
310
310
  {
311
311
  ref: x.ref,
312
- variant: f ? "failure" : "default",
313
- className: u(l),
312
+ variant: y ? "failure" : "default",
313
+ className: u(s),
314
314
  children: /* @__PURE__ */ e(A, { placeholder: d })
315
315
  }
316
316
  ),
317
- /* @__PURE__ */ e(V, { children: s.map((o) => /* @__PURE__ */ e(
317
+ /* @__PURE__ */ e(V, { children: n.map((o) => /* @__PURE__ */ e(
318
318
  G,
319
319
  {
320
320
  value: String(o.value),
@@ -330,70 +330,70 @@ const le = ({
330
330
  ] });
331
331
  }
332
332
  }
333
- ), me = ({
333
+ ), he = ({
334
334
  control: a,
335
335
  name: r,
336
- label: c,
336
+ label: t,
337
337
  rules: i,
338
- ...l
338
+ ...s
339
339
  }) => {
340
- const n = P();
340
+ const l = P();
341
341
  return r && a && /* @__PURE__ */ e(
342
342
  N,
343
343
  {
344
344
  control: a,
345
345
  name: r,
346
346
  rules: i,
347
- render: ({ field: s }) => /* @__PURE__ */ e(v, { className: "block", htmlFor: l.id || n, children: /* @__PURE__ */ t(g, { className: "flex flex-row items-start gap-3", children: [
347
+ render: ({ field: n }) => /* @__PURE__ */ e(v, { className: "block", htmlFor: s.id || l, children: /* @__PURE__ */ c(g, { className: "flex flex-row items-start gap-3", children: [
348
348
  /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e(
349
349
  L,
350
350
  {
351
- id: l.id || n,
351
+ id: s.id || l,
352
352
  className: "m-0",
353
- checked: s.value,
354
- onCheckedChange: s.onChange,
355
- ...l
353
+ checked: n.value,
354
+ onCheckedChange: n.onChange,
355
+ ...s
356
356
  }
357
357
  ) }),
358
- /* @__PURE__ */ e("div", { className: "space-y-1 leading-none", children: c && /* @__PURE__ */ e("div", { children: c }) })
358
+ t && /* @__PURE__ */ e("div", { className: "mt-0.5", children: t })
359
359
  ] }) })
360
360
  }
361
361
  ) || null;
362
362
  }, ue = ({
363
363
  control: a,
364
364
  name: r,
365
- label: c,
365
+ label: t,
366
366
  required: i,
367
- rules: l,
368
- className: n,
369
- floatingError: s,
367
+ rules: s,
368
+ className: l,
369
+ floatingError: n,
370
370
  ...d
371
371
  }) => r && a && /* @__PURE__ */ e(
372
372
  N,
373
373
  {
374
374
  control: a,
375
375
  name: r,
376
- rules: l,
377
- render: ({ field: h, formState: m }) => /* @__PURE__ */ t(g, { children: [
378
- c && /* @__PURE__ */ t(v, { className: "block", children: [
379
- c,
376
+ rules: s,
377
+ render: ({ field: m, formState: h }) => /* @__PURE__ */ c(g, { children: [
378
+ t && /* @__PURE__ */ c(v, { className: "block", children: [
379
+ t,
380
380
  " ",
381
381
  i && /* @__PURE__ */ e("span", { className: "text-red-600", children: "*" })
382
382
  ] }),
383
- /* @__PURE__ */ t("div", { children: [
383
+ /* @__PURE__ */ c("div", { children: [
384
384
  /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e(
385
385
  O,
386
386
  {
387
- variant: y(m.errors, `${r}.message`) ? "failure" : "default",
387
+ variant: b(h.errors, `${r}.message`) ? "failure" : "default",
388
388
  ...d,
389
- ...h,
390
- className: u(n)
389
+ ...m,
390
+ className: u(l)
391
391
  }
392
392
  ) }),
393
393
  /* @__PURE__ */ e(
394
394
  k,
395
395
  {
396
- className: u(s && "absolute -bottom-5")
396
+ className: u(n && "absolute -bottom-5")
397
397
  }
398
398
  )
399
399
  ] })
@@ -402,31 +402,31 @@ const le = ({
402
402
  ) || null, Ne = ({
403
403
  control: a,
404
404
  name: r,
405
- label: c,
405
+ label: t,
406
406
  required: i,
407
- className: l,
408
- rules: n,
409
- floatingError: s,
407
+ className: s,
408
+ rules: l,
409
+ floatingError: n,
410
410
  ...d
411
411
  }) => r && a ? /* @__PURE__ */ e(
412
412
  N,
413
413
  {
414
414
  control: a,
415
415
  name: r,
416
- rules: n,
417
- render: ({ field: h }) => /* @__PURE__ */ t(g, { children: [
418
- c && /* @__PURE__ */ t(v, { className: "block", children: [
419
- c,
416
+ rules: l,
417
+ render: ({ field: m }) => /* @__PURE__ */ c(g, { children: [
418
+ t && /* @__PURE__ */ c(v, { className: "block", children: [
419
+ t,
420
420
  " ",
421
421
  i && /* @__PURE__ */ e("span", { className: "text-red-600", children: "*" })
422
422
  ] }),
423
423
  " ",
424
- /* @__PURE__ */ t("div", { children: [
425
- /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e(F, { ...h, ...d }) }),
424
+ /* @__PURE__ */ c("div", { children: [
425
+ /* @__PURE__ */ e(p, { children: /* @__PURE__ */ e(F, { ...m, ...d }) }),
426
426
  /* @__PURE__ */ e(
427
427
  k,
428
428
  {
429
- className: u(s && "absolute -bottom-5")
429
+ className: u(n && "absolute -bottom-5")
430
430
  }
431
431
  )
432
432
  ] })
@@ -434,16 +434,16 @@ const le = ({
434
434
  }
435
435
  ) : /* @__PURE__ */ e(F, { className: "mt-2", ...d });
436
436
  export {
437
- le as MyCheckbox,
438
- ne as MyDatePicker,
439
- se as MyDateRangePicker,
437
+ se as MyCheckbox,
438
+ le as MyDatePicker,
439
+ ne as MyDateRangePicker,
440
440
  ie as MyHtmlEditor,
441
441
  ke as MyInput,
442
442
  de as MyMaskInput,
443
443
  oe as MyRadio,
444
444
  Ce as MySelect,
445
- he as MyShadcnSelect,
446
- me as MySwitch,
445
+ me as MyShadcnSelect,
446
+ he as MySwitch,
447
447
  ue as MyTextarea,
448
448
  Ne as MyTimePicker
449
449
  };