@fayz-ai/plugin-forms 0.14.8 → 0.15.0

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.
Files changed (86) hide show
  1. package/dist/{FormBuilder-EI7ILXQW.js → FormBuilder-Q2Q42HAT.js} +44 -35
  2. package/dist/FormBuilder-Q2Q42HAT.js.map +1 -0
  3. package/dist/{chunk-ANOY2YYX.js → chunk-JRR7A5HN.js} +59 -42
  4. package/dist/chunk-JRR7A5HN.js.map +1 -0
  5. package/dist/components/BuilderCanvas.d.ts +1 -1
  6. package/dist/components/BuilderCanvas.d.ts.map +1 -1
  7. package/dist/components/BuilderField.d.ts +1 -1
  8. package/dist/components/BuilderField.d.ts.map +1 -1
  9. package/dist/components/DocumentFormDialog.d.ts +6 -5
  10. package/dist/components/DocumentFormDialog.d.ts.map +1 -1
  11. package/dist/components/DocumentList.d.ts +5 -5
  12. package/dist/components/DocumentList.d.ts.map +1 -1
  13. package/dist/components/DocumentPreview.d.ts +3 -3
  14. package/dist/components/DocumentPreview.d.ts.map +1 -1
  15. package/dist/components/FieldConfigDialog.d.ts +1 -1
  16. package/dist/components/FieldConfigDialog.d.ts.map +1 -1
  17. package/dist/components/FieldPalette.d.ts +1 -1
  18. package/dist/components/FieldPalette.d.ts.map +1 -1
  19. package/dist/components/FormBuilder.d.ts +4 -4
  20. package/dist/components/FormBuilder.d.ts.map +1 -1
  21. package/dist/components/FormFillDialog.d.ts +9 -32
  22. package/dist/components/FormFillDialog.d.ts.map +1 -1
  23. package/dist/components/FormRenderer.d.ts +1 -1
  24. package/dist/components/FormRenderer.d.ts.map +1 -1
  25. package/dist/components/FormViewer.d.ts +3 -3
  26. package/dist/components/FormViewer.d.ts.map +1 -1
  27. package/dist/components/PersonAnswerAlerts.d.ts +2 -2
  28. package/dist/components/PersonAnswerAlerts.d.ts.map +1 -1
  29. package/dist/components/PersonDocumentsWidget.d.ts +4 -4
  30. package/dist/components/PersonDocumentsWidget.d.ts.map +1 -1
  31. package/dist/components/PersonFormsAlert.d.ts +7 -41
  32. package/dist/components/PersonFormsAlert.d.ts.map +1 -1
  33. package/dist/components/TemplateSelector.d.ts +3 -3
  34. package/dist/components/TemplateSelector.d.ts.map +1 -1
  35. package/dist/components/fields/FieldTypeSettings.d.ts +1 -1
  36. package/dist/components/fields/FieldTypeSettings.d.ts.map +1 -1
  37. package/dist/components/fields/StencilCamera.d.ts.map +1 -1
  38. package/dist/components/fields/fields.d.ts +3 -7
  39. package/dist/components/fields/fields.d.ts.map +1 -1
  40. package/dist/components/fields/media.d.ts +1 -1
  41. package/dist/components/fields/media.d.ts.map +1 -1
  42. package/dist/components/formsZoneWidgets.d.ts +5 -0
  43. package/dist/components/formsZoneWidgets.d.ts.map +1 -0
  44. package/dist/config.d.ts +2 -2
  45. package/dist/config.d.ts.map +1 -1
  46. package/dist/context.d.ts +4 -4
  47. package/dist/context.d.ts.map +1 -1
  48. package/dist/index.d.ts +3 -2
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +382 -1099
  51. package/dist/index.js.map +1 -1
  52. package/dist/lib/attendance-contracts.d.ts.map +1 -1
  53. package/dist/lib/categories.d.ts +2 -2
  54. package/dist/lib/categories.d.ts.map +1 -1
  55. package/dist/lib/contract-render.d.ts.map +1 -1
  56. package/dist/lib/person-fields.d.ts +1 -1
  57. package/dist/lib/person-fields.d.ts.map +1 -1
  58. package/dist/lib/print.d.ts +2 -1
  59. package/dist/lib/print.d.ts.map +1 -1
  60. package/dist/settings/v1-settings.d.ts +2 -0
  61. package/dist/settings/v1-settings.d.ts.map +1 -0
  62. package/dist/views/CustomFormsSettingsTab.d.ts +4 -4
  63. package/dist/views/CustomFormsSettingsTab.d.ts.map +1 -1
  64. package/dist/views/TemplateListView.d.ts +3 -3
  65. package/dist/views/TemplateListView.d.ts.map +1 -1
  66. package/package.json +5 -4
  67. package/dist/FormBuilder-EI7ILXQW.js.map +0 -1
  68. package/dist/chunk-ANOY2YYX.js.map +0 -1
  69. package/dist/data/index.d.ts +0 -4
  70. package/dist/data/index.d.ts.map +0 -1
  71. package/dist/data/mock.d.ts +0 -3
  72. package/dist/data/mock.d.ts.map +0 -1
  73. package/dist/data/supabase.d.ts +0 -3
  74. package/dist/data/supabase.d.ts.map +0 -1
  75. package/dist/data/tables.d.ts +0 -7
  76. package/dist/data/tables.d.ts.map +0 -1
  77. package/dist/data/types.d.ts +0 -57
  78. package/dist/data/types.d.ts.map +0 -1
  79. package/dist/lib/person-requirements.d.ts +0 -32
  80. package/dist/lib/person-requirements.d.ts.map +0 -1
  81. package/dist/lib/tenant.d.ts +0 -3
  82. package/dist/lib/tenant.d.ts.map +0 -1
  83. package/dist/store.d.ts +0 -40
  84. package/dist/store.d.ts.map +0 -1
  85. package/dist/types.d.ts +0 -248
  86. package/dist/types.d.ts.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import React3, { createContext, useCallback, useContext } from 'react';
2
- import { Badge, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Input, Button, PickerList } from '@fayz-ai/ui';
3
- import { describeError, useTranslation } from '@fayz-ai/core';
2
+ import { Checkbox, Badge, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Input, Textarea, Button, PickerList } from '@fayz-ai/ui';
3
+ import { describeError, useTranslation, formatCurrency } from '@fayz-ai/core';
4
4
  import { X, SwitchCamera, RotateCcw, Check, ImageUp, Camera, SkipForward, ShoppingBag, Plus, Trash2, Receipt, Package, ImagePlus, Video, ScanFace, AlertTriangle, Minus } from 'lucide-react';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
6
  import { createPortal } from 'react-dom';
@@ -246,7 +246,7 @@ function MediaImage({ value, alt, className, style }) {
246
246
  if (!url) return /* @__PURE__ */ jsx("div", { className: `animate-pulse bg-muted ${className ?? ""}`, style, "aria-busy": "true" });
247
247
  return /* @__PURE__ */ jsx("img", { src: url, alt, className, style });
248
248
  }
249
- var brl = (n) => n.toLocaleString("pt-BR", { style: "currency", currency: "BRL" });
249
+ var brl = (n) => formatCurrency(n);
250
250
  var stencilOf = (f) => f.config?.stencil ?? {};
251
251
  var galleryOf = (f) => f.config?.gallery ?? {};
252
252
  var alertOf = (f) => {
@@ -275,8 +275,10 @@ function AnswerAlertNote({ alert }) {
275
275
  }
276
276
  function YesNoButtons({ id, value, onChange, disabled }) {
277
277
  return /* @__PURE__ */ jsx("div", { role: "radiogroup", className: "inline-flex rounded-lg border bg-muted/40 p-0.5", children: ["sim", "nao"].map((opt) => /* @__PURE__ */ jsx(
278
- "button",
278
+ Button,
279
279
  {
280
+ variant: "bare",
281
+ size: "bare",
280
282
  id: `${id}-${opt}`,
281
283
  type: "button",
282
284
  role: "radio",
@@ -349,11 +351,13 @@ function StencilPhotoField({ field, value, onChange, onOpenCamera, uploading })
349
351
  ] });
350
352
  }
351
353
  return /* @__PURE__ */ jsxs(
352
- "button",
354
+ Button,
353
355
  {
356
+ variant: "bare",
357
+ size: "bare",
354
358
  type: "button",
355
359
  onClick: onOpenCamera,
356
- className: "flex w-full max-w-[320px] flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed border-input bg-muted/20 p-3 text-muted-foreground transition-colors hover:border-primary hover:bg-muted/40 hover:text-primary",
360
+ className: "font-normal whitespace-normal flex w-full max-w-[320px] flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed border-input bg-muted/20 p-3 text-muted-foreground transition-colors hover:border-primary hover:bg-muted/40 hover:text-primary",
357
361
  style: { aspectRatio: String(ratio) },
358
362
  children: [
359
363
  overlay ? /* @__PURE__ */ jsx("img", { src: overlay, alt: "", className: "max-h-[70%] max-w-[70%] object-contain opacity-70" }) : /* @__PURE__ */ jsx(ScanFace, { className: "h-8 w-8" }),
@@ -367,12 +371,14 @@ function GalleryThumb({ item, onRemove }) {
367
371
  return /* @__PURE__ */ jsxs("div", { className: "group relative aspect-square overflow-hidden rounded-lg border bg-muted", children: [
368
372
  !url ? /* @__PURE__ */ jsx("div", { className: "h-full w-full animate-pulse bg-muted" }) : item.type === "video" ? /* @__PURE__ */ jsx("video", { src: url, className: "h-full w-full object-cover", controls: true, preload: "metadata" }) : /* @__PURE__ */ jsx("a", { href: url, target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ jsx("img", { src: url, alt: item.name ?? "", className: "h-full w-full object-cover" }) }),
369
373
  onRemove && /* @__PURE__ */ jsx(
370
- "button",
374
+ Button,
371
375
  {
376
+ variant: "bare",
377
+ size: "bare",
372
378
  type: "button",
373
379
  onClick: onRemove,
374
380
  "aria-label": "Remover",
375
- className: "absolute right-1 top-1 flex h-6 w-6 items-center justify-center rounded-full bg-background/90 text-muted-foreground shadow hover:text-destructive",
381
+ className: "font-normal absolute right-1 top-1 flex h-6 w-6 items-center justify-center rounded-full bg-background/90 text-muted-foreground shadow hover:text-destructive",
376
382
  children: /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" })
377
383
  }
378
384
  )
@@ -481,24 +487,28 @@ function GalleryField({ field, value, onChange }) {
481
487
  function Stepper({ value, onChange }) {
482
488
  return /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center rounded-lg border", children: [
483
489
  /* @__PURE__ */ jsx(
484
- "button",
490
+ Button,
485
491
  {
492
+ variant: "bare",
493
+ size: "bare",
486
494
  type: "button",
487
495
  "aria-label": "Diminuir",
488
496
  disabled: value <= 1,
489
497
  onClick: () => onChange(value - 1),
490
- className: "flex h-7 w-7 items-center justify-center text-muted-foreground hover:text-foreground disabled:opacity-30",
498
+ className: "font-normal flex h-7 w-7 items-center justify-center text-muted-foreground hover:text-foreground disabled:opacity-30",
491
499
  children: /* @__PURE__ */ jsx(Minus, { className: "h-3 w-3" })
492
500
  }
493
501
  ),
494
502
  /* @__PURE__ */ jsx("span", { className: "w-7 text-center text-sm tabular-nums", children: value }),
495
503
  /* @__PURE__ */ jsx(
496
- "button",
504
+ Button,
497
505
  {
506
+ variant: "bare",
507
+ size: "bare",
498
508
  type: "button",
499
509
  "aria-label": "Aumentar",
500
510
  onClick: () => onChange(value + 1),
501
- className: "flex h-7 w-7 items-center justify-center text-muted-foreground hover:text-foreground",
511
+ className: "font-normal flex h-7 w-7 items-center justify-center text-muted-foreground hover:text-foreground",
502
512
  children: /* @__PURE__ */ jsx(Plus, { className: "h-3 w-3" })
503
513
  }
504
514
  )
@@ -572,11 +582,13 @@ function RecommendationField({ value, onChange, shortcuts = [] }) {
572
582
  /* @__PURE__ */ jsx("span", { className: "text-[11px] font-normal opacity-80", children: "\xB7 toque para indicar o que vai executar" })
573
583
  ] }),
574
584
  /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", children: freeShortcuts.map((s) => /* @__PURE__ */ jsxs(
575
- "button",
585
+ Button,
576
586
  {
587
+ variant: "bare",
588
+ size: "bare",
577
589
  type: "button",
578
590
  onClick: () => onChange([...items, { serviceId: s.serviceId, name: s.name, unitPrice: s.unitPrice, quantity: 1 }]),
579
- className: "inline-flex items-center gap-1.5 rounded-full border bg-background px-2.5 py-1 text-xs hover:bg-muted",
591
+ className: "font-normal inline-flex items-center gap-1.5 rounded-full border bg-background px-2.5 py-1 text-xs hover:bg-muted",
580
592
  children: [
581
593
  /* @__PURE__ */ jsx(Plus, { className: "h-3 w-3" }),
582
594
  /* @__PURE__ */ jsx("span", { className: "font-medium", children: s.name }),
@@ -602,12 +614,14 @@ function RecommendationField({ value, onChange, shortcuts = [] }) {
602
614
  ] }),
603
615
  /* @__PURE__ */ jsx(Stepper, { value: it.quantity, onChange: (q) => onChange(items.map((x, i) => i === idx ? { ...x, quantity: q } : x)) }),
604
616
  /* @__PURE__ */ jsx(
605
- "button",
617
+ Button,
606
618
  {
619
+ variant: "bare",
620
+ size: "bare",
607
621
  type: "button",
608
622
  "aria-label": `Remover ${it.name}`,
609
623
  onClick: () => onChange(items.filter((_, i) => i !== idx)),
610
- className: "flex h-6 w-6 items-center justify-center text-muted-foreground hover:text-destructive",
624
+ className: "font-normal flex h-6 w-6 items-center justify-center text-muted-foreground hover:text-destructive",
611
625
  children: /* @__PURE__ */ jsx(Trash2, { className: "h-3.5 w-3.5" })
612
626
  }
613
627
  )
@@ -620,12 +634,14 @@ function RecommendationField({ value, onChange, shortcuts = [] }) {
620
634
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b px-3 py-2", children: [
621
635
  /* @__PURE__ */ jsx("p", { className: "text-xs font-semibold", children: picking === "package" ? "Indicar pacote" : "Adicionar servi\xE7os" }),
622
636
  /* @__PURE__ */ jsx(
623
- "button",
637
+ Button,
624
638
  {
639
+ variant: "bare",
640
+ size: "bare",
625
641
  type: "button",
626
642
  onClick: () => setPicking(null),
627
643
  "aria-label": "Fechar lista",
628
- className: "text-muted-foreground hover:text-foreground",
644
+ className: "font-normal text-muted-foreground hover:text-foreground",
629
645
  children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
630
646
  }
631
647
  )
@@ -879,23 +895,27 @@ function StencilCamera({
879
895
  /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-[2147483647] flex select-none flex-col bg-black text-white", role: "dialog", "aria-label": title, children: [
880
896
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between p-3", children: [
881
897
  /* @__PURE__ */ jsx(
882
- "button",
898
+ Button,
883
899
  {
900
+ variant: "bare",
901
+ size: "bare",
884
902
  type: "button",
885
903
  onClick: onClose,
886
904
  "aria-label": "Fechar",
887
- className: "flex h-10 w-10 items-center justify-center rounded-full bg-white/10 hover:bg-white/20",
905
+ className: "font-normal flex h-10 w-10 items-center justify-center rounded-full bg-white/10 hover:bg-white/20",
888
906
  children: /* @__PURE__ */ jsx(X, { className: "h-5 w-5" })
889
907
  }
890
908
  ),
891
909
  /* @__PURE__ */ jsx("div", { className: "truncate px-2 text-sm font-medium", children: title }),
892
910
  !preview && !noCamera ? /* @__PURE__ */ jsx(
893
- "button",
911
+ Button,
894
912
  {
913
+ variant: "bare",
914
+ size: "bare",
895
915
  type: "button",
896
916
  onClick: () => setFacing((f) => f === "user" ? "environment" : "user"),
897
917
  "aria-label": "Trocar c\xE2mera",
898
- className: "flex h-10 w-10 items-center justify-center rounded-full bg-white/10 hover:bg-white/20",
918
+ className: "font-normal flex h-10 w-10 items-center justify-center rounded-full bg-white/10 hover:bg-white/20",
899
919
  children: /* @__PURE__ */ jsx(SwitchCamera, { className: "h-5 w-5" })
900
920
  }
901
921
  ) : /* @__PURE__ */ jsx("div", { className: "w-10" })
@@ -955,34 +975,40 @@ function StencilCamera({
955
975
  " Escolher foto"
956
976
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
957
977
  /* @__PURE__ */ jsx(
958
- "button",
978
+ Button,
959
979
  {
980
+ variant: "bare",
981
+ size: "bare",
960
982
  type: "button",
961
983
  disabled: starting,
962
984
  onClick: capture,
963
985
  "aria-label": "Capturar",
964
- className: "flex h-16 w-16 items-center justify-center rounded-full border-4 border-white/40 bg-white transition-transform active:scale-95 disabled:opacity-60",
986
+ className: "font-normal flex h-16 w-16 items-center justify-center rounded-full border-4 border-white/40 bg-white transition-transform active:scale-95 disabled:opacity-60",
965
987
  children: /* @__PURE__ */ jsx(Camera, { className: "h-6 w-6 text-black" })
966
988
  }
967
989
  ),
968
990
  /* @__PURE__ */ jsx(
969
- "button",
991
+ Button,
970
992
  {
993
+ variant: "bare",
994
+ size: "bare",
971
995
  type: "button",
972
996
  onClick: () => fileRef.current?.click(),
973
997
  "aria-label": "Escolher do arquivo",
974
- className: "absolute left-6 flex h-12 w-12 items-center justify-center rounded-full bg-white/10 hover:bg-white/20",
998
+ className: "font-normal absolute left-6 flex h-12 w-12 items-center justify-center rounded-full bg-white/10 hover:bg-white/20",
975
999
  children: /* @__PURE__ */ jsx(ImageUp, { className: "h-5 w-5" })
976
1000
  }
977
1001
  )
978
1002
  ] }),
979
1003
  !preview && onSkip && /* @__PURE__ */ jsx(
980
- "button",
1004
+ Button,
981
1005
  {
1006
+ variant: "bare",
1007
+ size: "bare",
982
1008
  type: "button",
983
1009
  onClick: onSkip,
984
1010
  "aria-label": "Pular esta foto",
985
- className: "absolute right-6 flex h-12 w-12 items-center justify-center rounded-full bg-white/10 hover:bg-white/20",
1011
+ className: "font-normal absolute right-6 flex h-12 w-12 items-center justify-center rounded-full bg-white/10 hover:bg-white/20",
986
1012
  children: /* @__PURE__ */ jsx(SkipForward, { className: "h-5 w-5" })
987
1013
  }
988
1014
  )
@@ -1137,12 +1163,12 @@ function FieldRenderer({
1137
1163
  field.required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-0.5", children: "*" })
1138
1164
  ] }),
1139
1165
  /* @__PURE__ */ jsx(
1140
- "textarea",
1166
+ Textarea,
1141
1167
  {
1142
1168
  value: value ?? "",
1143
1169
  onChange: (e) => onChange(e.target.value),
1144
1170
  placeholder: htmlToPlainText2(field.placeholder),
1145
- className: "flex w-full rounded-input 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 min-h-[100px]",
1171
+ className: "min-h-[100px] bg-background shadow-none",
1146
1172
  readOnly
1147
1173
  }
1148
1174
  )
@@ -1226,16 +1252,7 @@ function FieldRenderer({
1226
1252
  }
1227
1253
  case "checkbox":
1228
1254
  return /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 cursor-pointer py-1", children: [
1229
- /* @__PURE__ */ jsx(
1230
- "input",
1231
- {
1232
- type: "checkbox",
1233
- checked: !!value,
1234
- onChange: (e) => onChange(e.target.checked),
1235
- disabled: readOnly,
1236
- className: "rounded border-input"
1237
- }
1238
- ),
1255
+ /* @__PURE__ */ jsx(Checkbox, { checked: !!value, onChange, disabled: readOnly }),
1239
1256
  /* @__PURE__ */ jsxs("span", { className: "text-sm font-medium", children: [
1240
1257
  field.label,
1241
1258
  field.required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-0.5", children: "*" })
@@ -1657,5 +1674,5 @@ function prefillFromPerson(schema, person, existing = {}) {
1657
1674
  }
1658
1675
 
1659
1676
  export { CustomFormsProvider, FORM_BUILDER_INSTRUCTIONS, FormRenderer, MediaImage, PERSON_FIELD_OPTIONS, alertOf, answerAlerts, buildPrintHtml, createOrUpdateFormTool, htmlToPlainText2 as htmlToPlainText, isFieldEmpty, isMedia, prefillFromPerson, printDocument, sanitizeHtml, useMediaUpload, yesNoAnswer };
1660
- //# sourceMappingURL=chunk-ANOY2YYX.js.map
1661
- //# sourceMappingURL=chunk-ANOY2YYX.js.map
1677
+ //# sourceMappingURL=chunk-JRR7A5HN.js.map
1678
+ //# sourceMappingURL=chunk-JRR7A5HN.js.map