@mehdashti/forms 0.2.1 → 0.3.1
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.d.ts +634 -0
- package/dist/index.js +788 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { useForm, Controller, useFieldArray } from 'react-hook-form';
|
|
2
2
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
3
3
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
import * as React2 from 'react';
|
|
5
|
+
import { z } from 'zod';
|
|
4
6
|
export { z } from 'zod';
|
|
5
7
|
|
|
6
8
|
// src/use-smart-form.ts
|
|
@@ -188,6 +190,471 @@ function FormCheckbox({
|
|
|
188
190
|
}
|
|
189
191
|
);
|
|
190
192
|
}
|
|
193
|
+
function FormTextarea({
|
|
194
|
+
name,
|
|
195
|
+
label,
|
|
196
|
+
placeholder,
|
|
197
|
+
required = false,
|
|
198
|
+
helpText,
|
|
199
|
+
disabled = false,
|
|
200
|
+
className,
|
|
201
|
+
control,
|
|
202
|
+
rows = 4,
|
|
203
|
+
maxLength,
|
|
204
|
+
showCharacterCount = false,
|
|
205
|
+
resize = "vertical"
|
|
206
|
+
}) {
|
|
207
|
+
const resizeClass = {
|
|
208
|
+
none: "resize-none",
|
|
209
|
+
vertical: "resize-y",
|
|
210
|
+
horizontal: "resize-x",
|
|
211
|
+
both: "resize"
|
|
212
|
+
}[resize];
|
|
213
|
+
return /* @__PURE__ */ jsx(
|
|
214
|
+
Controller,
|
|
215
|
+
{
|
|
216
|
+
name,
|
|
217
|
+
control,
|
|
218
|
+
render: ({ field, fieldState: { error } }) => {
|
|
219
|
+
const currentLength = field.value?.length || 0;
|
|
220
|
+
const showCount = showCharacterCount || maxLength;
|
|
221
|
+
return /* @__PURE__ */ jsxs("div", { className: `space-y-2 ${className || ""}`, children: [
|
|
222
|
+
/* @__PURE__ */ jsxs(
|
|
223
|
+
"label",
|
|
224
|
+
{
|
|
225
|
+
htmlFor: String(name),
|
|
226
|
+
className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
227
|
+
children: [
|
|
228
|
+
label,
|
|
229
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
),
|
|
233
|
+
/* @__PURE__ */ jsx(
|
|
234
|
+
"textarea",
|
|
235
|
+
{
|
|
236
|
+
id: String(name),
|
|
237
|
+
placeholder,
|
|
238
|
+
disabled,
|
|
239
|
+
rows,
|
|
240
|
+
maxLength,
|
|
241
|
+
className: `flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 ${resizeClass} ${error ? "border-destructive" : ""}`,
|
|
242
|
+
"aria-invalid": !!error,
|
|
243
|
+
...field,
|
|
244
|
+
value: field.value || ""
|
|
245
|
+
}
|
|
246
|
+
),
|
|
247
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
248
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
|
|
249
|
+
error && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: error.message }),
|
|
250
|
+
helpText && !error && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: helpText })
|
|
251
|
+
] }),
|
|
252
|
+
showCount && /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
253
|
+
currentLength,
|
|
254
|
+
maxLength && ` / ${maxLength}`
|
|
255
|
+
] })
|
|
256
|
+
] })
|
|
257
|
+
] });
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
function FormFileUpload({
|
|
263
|
+
name,
|
|
264
|
+
label,
|
|
265
|
+
required = false,
|
|
266
|
+
helpText,
|
|
267
|
+
disabled = false,
|
|
268
|
+
className,
|
|
269
|
+
control,
|
|
270
|
+
accept,
|
|
271
|
+
multiple = false,
|
|
272
|
+
maxSize,
|
|
273
|
+
showPreview = true,
|
|
274
|
+
onFileChange
|
|
275
|
+
}) {
|
|
276
|
+
const [previews, setPreviews] = React2.useState([]);
|
|
277
|
+
const handleFileChange = (files, onChange) => {
|
|
278
|
+
if (!files || files.length === 0) {
|
|
279
|
+
setPreviews([]);
|
|
280
|
+
onChange(null);
|
|
281
|
+
onFileChange?.(null);
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
if (maxSize) {
|
|
285
|
+
const invalidFiles = Array.from(files).filter((file) => file.size > maxSize);
|
|
286
|
+
if (invalidFiles.length > 0) {
|
|
287
|
+
alert(`Some files exceed the maximum size of ${formatFileSize2(maxSize)}`);
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (showPreview && accept?.includes("image")) {
|
|
292
|
+
const fileArray = Array.from(files);
|
|
293
|
+
const newPreviews = [];
|
|
294
|
+
fileArray.forEach((file) => {
|
|
295
|
+
const reader = new FileReader();
|
|
296
|
+
reader.onloadend = () => {
|
|
297
|
+
newPreviews.push(reader.result);
|
|
298
|
+
if (newPreviews.length === fileArray.length) {
|
|
299
|
+
setPreviews(newPreviews);
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
reader.readAsDataURL(file);
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
onChange(multiple ? files : files[0]);
|
|
306
|
+
onFileChange?.(files);
|
|
307
|
+
};
|
|
308
|
+
const formatFileSize2 = (bytes) => {
|
|
309
|
+
if (bytes === 0) return "0 Bytes";
|
|
310
|
+
const k = 1024;
|
|
311
|
+
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
312
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
313
|
+
return Math.round(bytes / Math.pow(k, i) * 100) / 100 + " " + sizes[i];
|
|
314
|
+
};
|
|
315
|
+
return /* @__PURE__ */ jsx(
|
|
316
|
+
Controller,
|
|
317
|
+
{
|
|
318
|
+
name,
|
|
319
|
+
control,
|
|
320
|
+
render: ({ field: { onChange, value, ...field }, fieldState: { error } }) => /* @__PURE__ */ jsxs("div", { className: `space-y-2 ${className || ""}`, children: [
|
|
321
|
+
/* @__PURE__ */ jsxs(
|
|
322
|
+
"label",
|
|
323
|
+
{
|
|
324
|
+
htmlFor: String(name),
|
|
325
|
+
className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
326
|
+
children: [
|
|
327
|
+
label,
|
|
328
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
329
|
+
]
|
|
330
|
+
}
|
|
331
|
+
),
|
|
332
|
+
/* @__PURE__ */ jsx(
|
|
333
|
+
"div",
|
|
334
|
+
{
|
|
335
|
+
className: `flex items-center justify-center w-full ${error ? "border-destructive" : ""}`,
|
|
336
|
+
children: /* @__PURE__ */ jsxs(
|
|
337
|
+
"label",
|
|
338
|
+
{
|
|
339
|
+
htmlFor: String(name),
|
|
340
|
+
className: "flex flex-col items-center justify-center w-full h-32 border-2 border-dashed rounded-lg cursor-pointer bg-background hover:bg-muted/50 transition-colors",
|
|
341
|
+
children: [
|
|
342
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center pt-5 pb-6", children: [
|
|
343
|
+
/* @__PURE__ */ jsx(
|
|
344
|
+
"svg",
|
|
345
|
+
{
|
|
346
|
+
className: "w-8 h-8 mb-4 text-muted-foreground",
|
|
347
|
+
"aria-hidden": "true",
|
|
348
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
349
|
+
fill: "none",
|
|
350
|
+
viewBox: "0 0 20 16",
|
|
351
|
+
children: /* @__PURE__ */ jsx(
|
|
352
|
+
"path",
|
|
353
|
+
{
|
|
354
|
+
stroke: "currentColor",
|
|
355
|
+
strokeLinecap: "round",
|
|
356
|
+
strokeLinejoin: "round",
|
|
357
|
+
strokeWidth: "2",
|
|
358
|
+
d: "M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"
|
|
359
|
+
}
|
|
360
|
+
)
|
|
361
|
+
}
|
|
362
|
+
),
|
|
363
|
+
/* @__PURE__ */ jsxs("p", { className: "mb-2 text-sm text-muted-foreground", children: [
|
|
364
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Click to upload" }),
|
|
365
|
+
" or drag and drop"
|
|
366
|
+
] }),
|
|
367
|
+
accept && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: accept.split(",").join(", ") }),
|
|
368
|
+
maxSize && /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
369
|
+
"Max size: ",
|
|
370
|
+
formatFileSize2(maxSize)
|
|
371
|
+
] })
|
|
372
|
+
] }),
|
|
373
|
+
/* @__PURE__ */ jsx(
|
|
374
|
+
"input",
|
|
375
|
+
{
|
|
376
|
+
id: String(name),
|
|
377
|
+
type: "file",
|
|
378
|
+
accept,
|
|
379
|
+
multiple,
|
|
380
|
+
disabled,
|
|
381
|
+
className: "hidden",
|
|
382
|
+
onChange: (e) => handleFileChange(e.target.files, onChange),
|
|
383
|
+
...field
|
|
384
|
+
}
|
|
385
|
+
)
|
|
386
|
+
]
|
|
387
|
+
}
|
|
388
|
+
)
|
|
389
|
+
}
|
|
390
|
+
),
|
|
391
|
+
showPreview && previews.length > 0 && /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4 mt-4", children: previews.map((preview, index) => /* @__PURE__ */ jsxs("div", { className: "relative group", children: [
|
|
392
|
+
/* @__PURE__ */ jsx(
|
|
393
|
+
"img",
|
|
394
|
+
{
|
|
395
|
+
src: preview,
|
|
396
|
+
alt: `Preview ${index + 1}`,
|
|
397
|
+
className: "w-full h-24 object-cover rounded-md border"
|
|
398
|
+
}
|
|
399
|
+
),
|
|
400
|
+
/* @__PURE__ */ jsx(
|
|
401
|
+
"button",
|
|
402
|
+
{
|
|
403
|
+
type: "button",
|
|
404
|
+
onClick: () => {
|
|
405
|
+
const newPreviews = previews.filter((_, i) => i !== index);
|
|
406
|
+
setPreviews(newPreviews);
|
|
407
|
+
if (newPreviews.length === 0) {
|
|
408
|
+
onChange(null);
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
className: "absolute top-1 right-1 bg-destructive text-destructive-foreground rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
412
|
+
children: /* @__PURE__ */ jsx(
|
|
413
|
+
"svg",
|
|
414
|
+
{
|
|
415
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
416
|
+
className: "h-4 w-4",
|
|
417
|
+
viewBox: "0 0 20 20",
|
|
418
|
+
fill: "currentColor",
|
|
419
|
+
children: /* @__PURE__ */ jsx(
|
|
420
|
+
"path",
|
|
421
|
+
{
|
|
422
|
+
fillRule: "evenodd",
|
|
423
|
+
d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
|
|
424
|
+
clipRule: "evenodd"
|
|
425
|
+
}
|
|
426
|
+
)
|
|
427
|
+
}
|
|
428
|
+
)
|
|
429
|
+
}
|
|
430
|
+
)
|
|
431
|
+
] }, index)) }),
|
|
432
|
+
value && !showPreview && /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: multiple && value.length > 0 ? `${value.length} file(s) selected` : value?.name }),
|
|
433
|
+
error && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: error.message }),
|
|
434
|
+
helpText && !error && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: helpText })
|
|
435
|
+
] })
|
|
436
|
+
}
|
|
437
|
+
);
|
|
438
|
+
}
|
|
439
|
+
function FormDatePicker({
|
|
440
|
+
name,
|
|
441
|
+
label,
|
|
442
|
+
placeholder,
|
|
443
|
+
required = false,
|
|
444
|
+
helpText,
|
|
445
|
+
disabled = false,
|
|
446
|
+
className,
|
|
447
|
+
control,
|
|
448
|
+
min,
|
|
449
|
+
max,
|
|
450
|
+
mode = "single"
|
|
451
|
+
}) {
|
|
452
|
+
if (mode === "range") {
|
|
453
|
+
return /* @__PURE__ */ jsx(
|
|
454
|
+
FormDateRangePicker,
|
|
455
|
+
{
|
|
456
|
+
name,
|
|
457
|
+
label,
|
|
458
|
+
required,
|
|
459
|
+
helpText,
|
|
460
|
+
disabled,
|
|
461
|
+
className,
|
|
462
|
+
control,
|
|
463
|
+
min,
|
|
464
|
+
max
|
|
465
|
+
}
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
return /* @__PURE__ */ jsx(
|
|
469
|
+
Controller,
|
|
470
|
+
{
|
|
471
|
+
name,
|
|
472
|
+
control,
|
|
473
|
+
render: ({ field, fieldState: { error } }) => /* @__PURE__ */ jsxs("div", { className: `space-y-2 ${className || ""}`, children: [
|
|
474
|
+
/* @__PURE__ */ jsxs(
|
|
475
|
+
"label",
|
|
476
|
+
{
|
|
477
|
+
htmlFor: String(name),
|
|
478
|
+
className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
479
|
+
children: [
|
|
480
|
+
label,
|
|
481
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
482
|
+
]
|
|
483
|
+
}
|
|
484
|
+
),
|
|
485
|
+
/* @__PURE__ */ jsx(
|
|
486
|
+
"input",
|
|
487
|
+
{
|
|
488
|
+
id: String(name),
|
|
489
|
+
type: "date",
|
|
490
|
+
placeholder,
|
|
491
|
+
disabled,
|
|
492
|
+
min,
|
|
493
|
+
max,
|
|
494
|
+
className: `flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 ${error ? "border-destructive" : ""}`,
|
|
495
|
+
"aria-invalid": !!error,
|
|
496
|
+
...field,
|
|
497
|
+
value: field.value || ""
|
|
498
|
+
}
|
|
499
|
+
),
|
|
500
|
+
error && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: error.message }),
|
|
501
|
+
helpText && !error && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: helpText })
|
|
502
|
+
] })
|
|
503
|
+
}
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
|
+
function FormDateRangePicker({
|
|
507
|
+
name,
|
|
508
|
+
label,
|
|
509
|
+
required = false,
|
|
510
|
+
helpText,
|
|
511
|
+
disabled = false,
|
|
512
|
+
className,
|
|
513
|
+
control,
|
|
514
|
+
min,
|
|
515
|
+
max
|
|
516
|
+
}) {
|
|
517
|
+
return /* @__PURE__ */ jsx(
|
|
518
|
+
Controller,
|
|
519
|
+
{
|
|
520
|
+
name,
|
|
521
|
+
control,
|
|
522
|
+
render: ({ field, fieldState: { error } }) => {
|
|
523
|
+
const range = field.value || {};
|
|
524
|
+
const handleFromChange = (value) => {
|
|
525
|
+
field.onChange({ ...range, from: value });
|
|
526
|
+
};
|
|
527
|
+
const handleToChange = (value) => {
|
|
528
|
+
field.onChange({ ...range, to: value });
|
|
529
|
+
};
|
|
530
|
+
return /* @__PURE__ */ jsxs("div", { className: `space-y-2 ${className || ""}`, children: [
|
|
531
|
+
/* @__PURE__ */ jsxs("label", { className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", children: [
|
|
532
|
+
label,
|
|
533
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-1", children: "*" })
|
|
534
|
+
] }),
|
|
535
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2", children: [
|
|
536
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
537
|
+
/* @__PURE__ */ jsx("label", { htmlFor: `${String(name)}-from`, className: "text-xs text-muted-foreground", children: "From" }),
|
|
538
|
+
/* @__PURE__ */ jsx(
|
|
539
|
+
"input",
|
|
540
|
+
{
|
|
541
|
+
id: `${String(name)}-from`,
|
|
542
|
+
type: "date",
|
|
543
|
+
disabled,
|
|
544
|
+
min,
|
|
545
|
+
max: range.to || max,
|
|
546
|
+
value: range.from || "",
|
|
547
|
+
onChange: (e) => handleFromChange(e.target.value),
|
|
548
|
+
className: `flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 ${error ? "border-destructive" : ""}`
|
|
549
|
+
}
|
|
550
|
+
)
|
|
551
|
+
] }),
|
|
552
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
553
|
+
/* @__PURE__ */ jsx("label", { htmlFor: `${String(name)}-to`, className: "text-xs text-muted-foreground", children: "To" }),
|
|
554
|
+
/* @__PURE__ */ jsx(
|
|
555
|
+
"input",
|
|
556
|
+
{
|
|
557
|
+
id: `${String(name)}-to`,
|
|
558
|
+
type: "date",
|
|
559
|
+
disabled,
|
|
560
|
+
min: range.from || min,
|
|
561
|
+
max,
|
|
562
|
+
value: range.to || "",
|
|
563
|
+
onChange: (e) => handleToChange(e.target.value),
|
|
564
|
+
className: `flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 ${error ? "border-destructive" : ""}`
|
|
565
|
+
}
|
|
566
|
+
)
|
|
567
|
+
] })
|
|
568
|
+
] }),
|
|
569
|
+
error && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: error.message }),
|
|
570
|
+
helpText && !error && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: helpText })
|
|
571
|
+
] });
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
function FormMultiSelect({
|
|
577
|
+
name,
|
|
578
|
+
label,
|
|
579
|
+
options,
|
|
580
|
+
required = false,
|
|
581
|
+
helpText,
|
|
582
|
+
disabled = false,
|
|
583
|
+
className,
|
|
584
|
+
control,
|
|
585
|
+
layout = "vertical",
|
|
586
|
+
maxSelection
|
|
587
|
+
}) {
|
|
588
|
+
const layoutClasses = {
|
|
589
|
+
vertical: "flex flex-col space-y-2",
|
|
590
|
+
horizontal: "flex flex-wrap gap-4",
|
|
591
|
+
grid: "grid grid-cols-2 sm:grid-cols-3 gap-2"
|
|
592
|
+
};
|
|
593
|
+
return /* @__PURE__ */ jsx(
|
|
594
|
+
Controller,
|
|
595
|
+
{
|
|
596
|
+
name,
|
|
597
|
+
control,
|
|
598
|
+
render: ({ field, fieldState: { error } }) => {
|
|
599
|
+
const selectedValues = field.value || [];
|
|
600
|
+
const handleToggle = (optionValue) => {
|
|
601
|
+
const newValues = selectedValues.includes(optionValue) ? selectedValues.filter((v) => v !== optionValue) : maxSelection && selectedValues.length >= maxSelection ? selectedValues : [...selectedValues, optionValue];
|
|
602
|
+
field.onChange(newValues);
|
|
603
|
+
};
|
|
604
|
+
const isSelected = (optionValue) => selectedValues.includes(optionValue);
|
|
605
|
+
const isMaxReached = maxSelection !== void 0 && selectedValues.length >= maxSelection;
|
|
606
|
+
return /* @__PURE__ */ jsxs("div", { className: `space-y-3 ${className || ""}`, children: [
|
|
607
|
+
/* @__PURE__ */ jsxs("label", { className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70", children: [
|
|
608
|
+
label,
|
|
609
|
+
required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-1", children: "*" }),
|
|
610
|
+
maxSelection && /* @__PURE__ */ jsxs("span", { className: "ml-2 text-xs text-muted-foreground", children: [
|
|
611
|
+
"(",
|
|
612
|
+
selectedValues.length,
|
|
613
|
+
"/",
|
|
614
|
+
maxSelection,
|
|
615
|
+
")"
|
|
616
|
+
] })
|
|
617
|
+
] }),
|
|
618
|
+
/* @__PURE__ */ jsx("div", { className: layoutClasses[layout], children: options.map((option) => {
|
|
619
|
+
const id = `${String(name)}-${option.value}`;
|
|
620
|
+
const isOptionDisabled = disabled || option.disabled || isMaxReached && !isSelected(option.value);
|
|
621
|
+
return /* @__PURE__ */ jsxs(
|
|
622
|
+
"label",
|
|
623
|
+
{
|
|
624
|
+
htmlFor: id,
|
|
625
|
+
className: `flex items-center space-x-2 cursor-pointer ${isOptionDisabled ? "opacity-50 cursor-not-allowed" : ""}`,
|
|
626
|
+
children: [
|
|
627
|
+
/* @__PURE__ */ jsx(
|
|
628
|
+
"input",
|
|
629
|
+
{
|
|
630
|
+
id,
|
|
631
|
+
type: "checkbox",
|
|
632
|
+
checked: isSelected(option.value),
|
|
633
|
+
disabled: isOptionDisabled,
|
|
634
|
+
onChange: () => handleToggle(option.value),
|
|
635
|
+
className: "h-4 w-4 rounded border-gray-300 text-primary focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
|
|
636
|
+
}
|
|
637
|
+
),
|
|
638
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: option.label })
|
|
639
|
+
]
|
|
640
|
+
},
|
|
641
|
+
String(option.value)
|
|
642
|
+
);
|
|
643
|
+
}) }),
|
|
644
|
+
maxSelection && isMaxReached && /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
645
|
+
"Maximum ",
|
|
646
|
+
maxSelection,
|
|
647
|
+
" ",
|
|
648
|
+
maxSelection === 1 ? "item" : "items",
|
|
649
|
+
" can be selected"
|
|
650
|
+
] }),
|
|
651
|
+
error && /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: error.message }),
|
|
652
|
+
helpText && !error && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: helpText })
|
|
653
|
+
] });
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
);
|
|
657
|
+
}
|
|
191
658
|
var spacingClasses = {
|
|
192
659
|
sm: "gap-3",
|
|
193
660
|
md: "gap-4",
|
|
@@ -292,6 +759,157 @@ function FormGridItem({
|
|
|
292
759
|
return /* @__PURE__ */ jsx("div", { className: `${colSpanClasses[colSpan]} ${className}`, ...props, children });
|
|
293
760
|
}
|
|
294
761
|
FormGridItem.displayName = "FormGridItem";
|
|
762
|
+
function FormWizard({
|
|
763
|
+
steps,
|
|
764
|
+
onComplete,
|
|
765
|
+
onCancel,
|
|
766
|
+
className,
|
|
767
|
+
showStepNumbers = true
|
|
768
|
+
}) {
|
|
769
|
+
const [currentStep, setCurrentStep] = React2.useState(0);
|
|
770
|
+
const [isValidating, setIsValidating] = React2.useState(false);
|
|
771
|
+
const [isCompleting, setIsCompleting] = React2.useState(false);
|
|
772
|
+
const isFirstStep = currentStep === 0;
|
|
773
|
+
const isLastStep = currentStep === steps.length - 1;
|
|
774
|
+
const handleNext = async () => {
|
|
775
|
+
const step = steps[currentStep];
|
|
776
|
+
if (step.onValidate) {
|
|
777
|
+
setIsValidating(true);
|
|
778
|
+
try {
|
|
779
|
+
const isValid = await step.onValidate();
|
|
780
|
+
if (!isValid) {
|
|
781
|
+
setIsValidating(false);
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
} catch (error) {
|
|
785
|
+
console.error("Validation error:", error);
|
|
786
|
+
setIsValidating(false);
|
|
787
|
+
return;
|
|
788
|
+
}
|
|
789
|
+
setIsValidating(false);
|
|
790
|
+
}
|
|
791
|
+
if (isLastStep) {
|
|
792
|
+
setIsCompleting(true);
|
|
793
|
+
try {
|
|
794
|
+
await onComplete();
|
|
795
|
+
} finally {
|
|
796
|
+
setIsCompleting(false);
|
|
797
|
+
}
|
|
798
|
+
} else {
|
|
799
|
+
setCurrentStep((prev) => prev + 1);
|
|
800
|
+
}
|
|
801
|
+
};
|
|
802
|
+
const handleBack = () => {
|
|
803
|
+
if (!isFirstStep) {
|
|
804
|
+
setCurrentStep((prev) => prev - 1);
|
|
805
|
+
}
|
|
806
|
+
};
|
|
807
|
+
const handleStepClick = (stepIndex) => {
|
|
808
|
+
if (stepIndex < currentStep) {
|
|
809
|
+
setCurrentStep(stepIndex);
|
|
810
|
+
}
|
|
811
|
+
};
|
|
812
|
+
return /* @__PURE__ */ jsxs("div", { className: `space-y-8 ${className || ""}`, children: [
|
|
813
|
+
/* @__PURE__ */ jsx("nav", { "aria-label": "Progress", children: /* @__PURE__ */ jsx("ol", { className: "flex items-center justify-between", children: steps.map((step, index) => {
|
|
814
|
+
const isActive = index === currentStep;
|
|
815
|
+
const isCompleted = index < currentStep;
|
|
816
|
+
const isClickable = index < currentStep;
|
|
817
|
+
return /* @__PURE__ */ jsxs(
|
|
818
|
+
"li",
|
|
819
|
+
{
|
|
820
|
+
className: `flex items-center ${index !== steps.length - 1 ? "flex-1" : ""}`,
|
|
821
|
+
children: [
|
|
822
|
+
/* @__PURE__ */ jsxs(
|
|
823
|
+
"button",
|
|
824
|
+
{
|
|
825
|
+
type: "button",
|
|
826
|
+
onClick: () => isClickable && handleStepClick(index),
|
|
827
|
+
disabled: !isClickable,
|
|
828
|
+
className: `flex items-center space-x-3 ${isClickable ? "cursor-pointer" : "cursor-default"}`,
|
|
829
|
+
children: [
|
|
830
|
+
/* @__PURE__ */ jsx(
|
|
831
|
+
"div",
|
|
832
|
+
{
|
|
833
|
+
className: `flex h-10 w-10 items-center justify-center rounded-full border-2 transition-colors ${isActive ? "border-primary bg-primary text-primary-foreground" : isCompleted ? "border-primary bg-primary text-primary-foreground" : "border-muted-foreground text-muted-foreground"}`,
|
|
834
|
+
children: isCompleted ? /* @__PURE__ */ jsx(
|
|
835
|
+
"svg",
|
|
836
|
+
{
|
|
837
|
+
className: "h-5 w-5",
|
|
838
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
839
|
+
viewBox: "0 0 20 20",
|
|
840
|
+
fill: "currentColor",
|
|
841
|
+
children: /* @__PURE__ */ jsx(
|
|
842
|
+
"path",
|
|
843
|
+
{
|
|
844
|
+
fillRule: "evenodd",
|
|
845
|
+
d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",
|
|
846
|
+
clipRule: "evenodd"
|
|
847
|
+
}
|
|
848
|
+
)
|
|
849
|
+
}
|
|
850
|
+
) : showStepNumbers ? /* @__PURE__ */ jsx("span", { children: index + 1 }) : null
|
|
851
|
+
}
|
|
852
|
+
),
|
|
853
|
+
/* @__PURE__ */ jsxs("div", { className: "hidden sm:block text-left", children: [
|
|
854
|
+
/* @__PURE__ */ jsx(
|
|
855
|
+
"p",
|
|
856
|
+
{
|
|
857
|
+
className: `text-sm font-medium ${isActive ? "text-foreground" : "text-muted-foreground"}`,
|
|
858
|
+
children: step.title
|
|
859
|
+
}
|
|
860
|
+
),
|
|
861
|
+
step.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: step.description })
|
|
862
|
+
] })
|
|
863
|
+
]
|
|
864
|
+
}
|
|
865
|
+
),
|
|
866
|
+
index !== steps.length - 1 && /* @__PURE__ */ jsx(
|
|
867
|
+
"div",
|
|
868
|
+
{
|
|
869
|
+
className: `mx-2 h-0.5 flex-1 transition-colors ${isCompleted ? "bg-primary" : "bg-muted"}`
|
|
870
|
+
}
|
|
871
|
+
)
|
|
872
|
+
]
|
|
873
|
+
},
|
|
874
|
+
index
|
|
875
|
+
);
|
|
876
|
+
}) }) }),
|
|
877
|
+
/* @__PURE__ */ jsx("div", { className: "mt-8", children: steps[currentStep].content }),
|
|
878
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-between pt-6 border-t", children: [
|
|
879
|
+
/* @__PURE__ */ jsx("div", { children: onCancel && /* @__PURE__ */ jsx(
|
|
880
|
+
"button",
|
|
881
|
+
{
|
|
882
|
+
type: "button",
|
|
883
|
+
onClick: onCancel,
|
|
884
|
+
className: "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 px-4 py-2",
|
|
885
|
+
children: "Cancel"
|
|
886
|
+
}
|
|
887
|
+
) }),
|
|
888
|
+
/* @__PURE__ */ jsxs("div", { className: "flex space-x-2", children: [
|
|
889
|
+
!isFirstStep && /* @__PURE__ */ jsx(
|
|
890
|
+
"button",
|
|
891
|
+
{
|
|
892
|
+
type: "button",
|
|
893
|
+
onClick: handleBack,
|
|
894
|
+
disabled: isValidating || isCompleting,
|
|
895
|
+
className: "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 px-4 py-2",
|
|
896
|
+
children: "Back"
|
|
897
|
+
}
|
|
898
|
+
),
|
|
899
|
+
/* @__PURE__ */ jsx(
|
|
900
|
+
"button",
|
|
901
|
+
{
|
|
902
|
+
type: "button",
|
|
903
|
+
onClick: handleNext,
|
|
904
|
+
disabled: isValidating || isCompleting,
|
|
905
|
+
className: "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 bg-primary text-primary-foreground hover:bg-primary/90 h-10 px-4 py-2",
|
|
906
|
+
children: isValidating || isCompleting ? "Loading..." : isLastStep ? "Complete" : "Next"
|
|
907
|
+
}
|
|
908
|
+
)
|
|
909
|
+
] })
|
|
910
|
+
] })
|
|
911
|
+
] });
|
|
912
|
+
}
|
|
295
913
|
function useSmartFieldArray({
|
|
296
914
|
name,
|
|
297
915
|
control,
|
|
@@ -310,7 +928,176 @@ function useSmartFieldArray({
|
|
|
310
928
|
append
|
|
311
929
|
};
|
|
312
930
|
}
|
|
931
|
+
var emailSchema = z.string().min(1, "Email is required").email("Invalid email address");
|
|
932
|
+
var passwordSchema = z.string().min(8, "Password must be at least 8 characters").regex(/[A-Z]/, "Password must contain at least one uppercase letter").regex(/[a-z]/, "Password must contain at least one lowercase letter").regex(/[0-9]/, "Password must contain at least one number");
|
|
933
|
+
var strongPasswordSchema = z.string().min(12, "Password must be at least 12 characters").regex(/[A-Z]/, "Password must contain at least one uppercase letter").regex(/[a-z]/, "Password must contain at least one lowercase letter").regex(/[0-9]/, "Password must contain at least one number").regex(/[^A-Za-z0-9]/, "Password must contain at least one special character");
|
|
934
|
+
var phoneSchema = z.string().min(1, "Phone number is required").regex(/^\+?[1-9]\d{1,14}$/, "Invalid phone number format");
|
|
935
|
+
var urlSchema = z.string().min(1, "URL is required").url("Invalid URL format");
|
|
936
|
+
var usernameSchema = z.string().min(3, "Username must be at least 3 characters").max(20, "Username must be at most 20 characters").regex(/^[a-zA-Z0-9_]+$/, "Username can only contain letters, numbers, and underscores");
|
|
937
|
+
var slugSchema = z.string().min(1, "Slug is required").regex(/^[a-z0-9-]+$/, "Slug can only contain lowercase letters, numbers, and hyphens");
|
|
938
|
+
var positiveNumberSchema = z.number().positive("Must be a positive number");
|
|
939
|
+
var positiveIntegerSchema = z.number().int("Must be an integer").positive("Must be a positive number");
|
|
940
|
+
var priceSchema = z.number().nonnegative("Price cannot be negative").multipleOf(0.01, "Price can have at most 2 decimal places");
|
|
941
|
+
var percentageSchema = z.number().min(0, "Percentage must be at least 0").max(100, "Percentage cannot exceed 100");
|
|
942
|
+
var dateStringSchema = z.string().min(1, "Date is required").regex(/^\d{4}-\d{2}-\d{2}$/, "Date must be in YYYY-MM-DD format");
|
|
943
|
+
var futureDateSchema = z.string().refine((date) => new Date(date) > /* @__PURE__ */ new Date(), {
|
|
944
|
+
message: "Date must be in the future"
|
|
945
|
+
});
|
|
946
|
+
var pastDateSchema = z.string().refine((date) => new Date(date) < /* @__PURE__ */ new Date(), {
|
|
947
|
+
message: "Date must be in the past"
|
|
948
|
+
});
|
|
949
|
+
var createFileSizeSchema = (maxSizeInBytes, message) => z.instanceof(File).refine((file) => file.size <= maxSizeInBytes, {
|
|
950
|
+
message: message || `File size must be less than ${formatFileSize(maxSizeInBytes)}`
|
|
951
|
+
});
|
|
952
|
+
var createFileTypeSchema = (allowedTypes, message) => z.instanceof(File).refine((file) => allowedTypes.includes(file.type), {
|
|
953
|
+
message: message || `File type must be one of: ${allowedTypes.join(", ")}`
|
|
954
|
+
});
|
|
955
|
+
var imageFileSchema = z.instanceof(File).refine((file) => file.size <= 5 * 1024 * 1024, {
|
|
956
|
+
message: "Image must be less than 5MB"
|
|
957
|
+
}).refine(
|
|
958
|
+
(file) => ["image/jpeg", "image/jpg", "image/png", "image/webp", "image/gif"].includes(file.type),
|
|
959
|
+
{
|
|
960
|
+
message: "File must be an image (JPEG, PNG, WebP, or GIF)"
|
|
961
|
+
}
|
|
962
|
+
);
|
|
963
|
+
var createConfirmPasswordSchema = (passwordField) => z.object({
|
|
964
|
+
[passwordField]: z.string(),
|
|
965
|
+
confirmPassword: z.string()
|
|
966
|
+
}).refine((data) => data[passwordField] === data.confirmPassword, {
|
|
967
|
+
message: "Passwords do not match",
|
|
968
|
+
path: ["confirmPassword"]
|
|
969
|
+
});
|
|
970
|
+
var optionalEmailSchema = z.union([
|
|
971
|
+
z.string().length(0),
|
|
972
|
+
emailSchema
|
|
973
|
+
]);
|
|
974
|
+
var optionalUrlSchema = z.union([
|
|
975
|
+
z.string().length(0),
|
|
976
|
+
urlSchema
|
|
977
|
+
]);
|
|
978
|
+
function formatFileSize(bytes) {
|
|
979
|
+
if (bytes === 0) return "0 Bytes";
|
|
980
|
+
const k = 1024;
|
|
981
|
+
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
982
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
983
|
+
return Math.round(bytes / Math.pow(k, i) * 100) / 100 + " " + sizes[i];
|
|
984
|
+
}
|
|
985
|
+
function getErrorMessage(errors, fieldName) {
|
|
986
|
+
const fieldError = errors[fieldName];
|
|
987
|
+
if (!fieldError) return void 0;
|
|
988
|
+
if (typeof fieldError.message === "string") return fieldError.message;
|
|
989
|
+
return "Invalid value";
|
|
990
|
+
}
|
|
991
|
+
function hasError(errors, fieldName) {
|
|
992
|
+
return !!errors[fieldName];
|
|
993
|
+
}
|
|
994
|
+
function getAllErrors(errors) {
|
|
995
|
+
const messages = [];
|
|
996
|
+
Object.keys(errors).forEach((key) => {
|
|
997
|
+
const error = errors[key];
|
|
998
|
+
if (error && typeof error.message === "string") {
|
|
999
|
+
messages.push(error.message);
|
|
1000
|
+
}
|
|
1001
|
+
});
|
|
1002
|
+
return messages;
|
|
1003
|
+
}
|
|
1004
|
+
function conditionalSchema(_dependentField, _condition, schema) {
|
|
1005
|
+
return z.any().superRefine((value, ctx) => {
|
|
1006
|
+
const parent = ctx.path[ctx.path.length - 2];
|
|
1007
|
+
if (!parent) return;
|
|
1008
|
+
return schema.parse(value);
|
|
1009
|
+
});
|
|
1010
|
+
}
|
|
1011
|
+
function lengthMessage(field, min, max) {
|
|
1012
|
+
if (min && max) {
|
|
1013
|
+
return `${field} must be between ${min} and ${max} characters`;
|
|
1014
|
+
}
|
|
1015
|
+
if (min) {
|
|
1016
|
+
return `${field} must be at least ${min} characters`;
|
|
1017
|
+
}
|
|
1018
|
+
if (max) {
|
|
1019
|
+
return `${field} must be at most ${max} characters`;
|
|
1020
|
+
}
|
|
1021
|
+
return `Invalid ${field.toLowerCase()}`;
|
|
1022
|
+
}
|
|
1023
|
+
function requiredMessage(field) {
|
|
1024
|
+
return `${field} is required`;
|
|
1025
|
+
}
|
|
1026
|
+
function invalidFormatMessage(field) {
|
|
1027
|
+
return `Invalid ${field.toLowerCase()} format`;
|
|
1028
|
+
}
|
|
1029
|
+
function validateCreditCard(cardNumber) {
|
|
1030
|
+
const sanitized = cardNumber.replace(/\s/g, "");
|
|
1031
|
+
if (!/^\d+$/.test(sanitized)) return false;
|
|
1032
|
+
let sum = 0;
|
|
1033
|
+
let isEven = false;
|
|
1034
|
+
for (let i = sanitized.length - 1; i >= 0; i--) {
|
|
1035
|
+
let digit = parseInt(sanitized[i], 10);
|
|
1036
|
+
if (isEven) {
|
|
1037
|
+
digit *= 2;
|
|
1038
|
+
if (digit > 9) {
|
|
1039
|
+
digit -= 9;
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
sum += digit;
|
|
1043
|
+
isEven = !isEven;
|
|
1044
|
+
}
|
|
1045
|
+
return sum % 10 === 0;
|
|
1046
|
+
}
|
|
1047
|
+
function validateIBAN(iban) {
|
|
1048
|
+
const sanitized = iban.replace(/\s/g, "").toUpperCase();
|
|
1049
|
+
if (!/^[A-Z]{2}\d{2}[A-Z0-9]+$/.test(sanitized)) return false;
|
|
1050
|
+
if (sanitized.length < 15 || sanitized.length > 34) return false;
|
|
1051
|
+
const rearranged = sanitized.slice(4) + sanitized.slice(0, 4);
|
|
1052
|
+
const numeric = rearranged.replace(
|
|
1053
|
+
/[A-Z]/g,
|
|
1054
|
+
(char) => String(char.charCodeAt(0) - 55)
|
|
1055
|
+
);
|
|
1056
|
+
let remainder = numeric;
|
|
1057
|
+
while (remainder.length > 2) {
|
|
1058
|
+
const block = remainder.slice(0, 9);
|
|
1059
|
+
remainder = parseInt(block, 10) % 97 + remainder.slice(block.length);
|
|
1060
|
+
}
|
|
1061
|
+
return parseInt(remainder, 10) % 97 === 1;
|
|
1062
|
+
}
|
|
1063
|
+
function validatePasswordStrength(password) {
|
|
1064
|
+
const requirements = [];
|
|
1065
|
+
if (password.length < 12) {
|
|
1066
|
+
requirements.push("At least 12 characters");
|
|
1067
|
+
}
|
|
1068
|
+
if (!/[A-Z]/.test(password)) {
|
|
1069
|
+
requirements.push("One uppercase letter");
|
|
1070
|
+
}
|
|
1071
|
+
if (!/[a-z]/.test(password)) {
|
|
1072
|
+
requirements.push("One lowercase letter");
|
|
1073
|
+
}
|
|
1074
|
+
if (!/[0-9]/.test(password)) {
|
|
1075
|
+
requirements.push("One number");
|
|
1076
|
+
}
|
|
1077
|
+
if (!/[^A-Za-z0-9]/.test(password)) {
|
|
1078
|
+
requirements.push("One special character");
|
|
1079
|
+
}
|
|
1080
|
+
return {
|
|
1081
|
+
isStrong: requirements.length === 0,
|
|
1082
|
+
missingRequirements: requirements
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1085
|
+
function sanitizeString(input) {
|
|
1086
|
+
return input.replace(/<[^>]*>/g, "").replace(/\s+/g, " ").trim();
|
|
1087
|
+
}
|
|
1088
|
+
function validateFileExtension(filename, allowedExtensions) {
|
|
1089
|
+
const extension = filename.split(".").pop()?.toLowerCase();
|
|
1090
|
+
return extension ? allowedExtensions.includes(extension) : false;
|
|
1091
|
+
}
|
|
1092
|
+
function formatValidationError(error) {
|
|
1093
|
+
const formatted = {};
|
|
1094
|
+
error.errors.forEach((err) => {
|
|
1095
|
+
const path = err.path.join(".");
|
|
1096
|
+
formatted[path] = err.message;
|
|
1097
|
+
});
|
|
1098
|
+
return formatted;
|
|
1099
|
+
}
|
|
313
1100
|
|
|
314
|
-
export { FormCheckbox, FormField, FormGrid, FormGridItem, FormLayout, FormSection, FormSelect, useSmartFieldArray, useSmartForm };
|
|
1101
|
+
export { FormCheckbox, FormDatePicker, FormField, FormFileUpload, FormGrid, FormGridItem, FormLayout, FormMultiSelect, FormSection, FormSelect, FormTextarea, FormWizard, conditionalSchema, createConfirmPasswordSchema, createFileSizeSchema, createFileTypeSchema, dateStringSchema, emailSchema, formatValidationError, futureDateSchema, getAllErrors, getErrorMessage, hasError, imageFileSchema, invalidFormatMessage, lengthMessage, optionalEmailSchema, optionalUrlSchema, passwordSchema, pastDateSchema, percentageSchema, phoneSchema, positiveIntegerSchema, positiveNumberSchema, priceSchema, requiredMessage, sanitizeString, slugSchema, strongPasswordSchema, urlSchema, useSmartFieldArray, useSmartForm, usernameSchema, validateCreditCard, validateFileExtension, validateIBAN, validatePasswordStrength };
|
|
315
1102
|
//# sourceMappingURL=index.js.map
|
|
316
1103
|
//# sourceMappingURL=index.js.map
|