formanitor 0.0.22 → 0.0.23

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.mjs CHANGED
@@ -1,14 +1,19 @@
1
- import * as React11 from 'react';
2
- import React11__default, { createContext, useContext, useRef, useEffect, useState, useMemo, useCallback } from 'react';
1
+ import * as React13 from 'react';
2
+ import React13__default, { createContext, useContext, useRef, useEffect, useState, useMemo, useCallback, useReducer } from 'react';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { clsx } from 'clsx';
5
5
  import { twMerge } from 'tailwind-merge';
6
6
  import * as LabelPrimitive from '@radix-ui/react-label';
7
7
  import { cva } from 'class-variance-authority';
8
+ import { useEditor, EditorContent } from '@tiptap/react';
9
+ import StarterKit from '@tiptap/starter-kit';
10
+ import Placeholder from '@tiptap/extension-placeholder';
11
+ import Underline from '@tiptap/extension-underline';
12
+ import { ChevronDown, ChevronUp, Check, Circle, X, Image, Upload, Trash2, Plus, Loader2, PenTool, Undo, Redo, ChevronRight, Calendar as Calendar$1, ChevronLeft, RefreshCw, Clock, Bold, Italic, Underline as Underline$1, Strikethrough, List, ListOrdered } from 'lucide-react';
13
+ import { Slot } from '@radix-ui/react-slot';
14
+ import * as SeparatorPrimitive from '@radix-ui/react-separator';
8
15
  import * as SelectPrimitive from '@radix-ui/react-select';
9
- import { ChevronDown, ChevronUp, Check, Circle, X, Image, Upload, Trash2, Plus, Loader2, PenTool, ChevronRight, Calendar as Calendar$1, ChevronLeft, RefreshCw, Clock } from 'lucide-react';
10
16
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
11
- import { Slot } from '@radix-ui/react-slot';
12
17
  import { format, addDays, addWeeks, addMonths, differenceInCalendarDays, parseISO } from 'date-fns';
13
18
  import { DayPicker } from 'react-day-picker';
14
19
  import * as PopoverPrimitive from '@radix-ui/react-popover';
@@ -749,7 +754,7 @@ function useField(fieldId) {
749
754
  function cn(...inputs) {
750
755
  return twMerge(clsx(inputs));
751
756
  }
752
- var Input = React11.forwardRef(
757
+ var Input = React13.forwardRef(
753
758
  ({ className, type, ...props }, ref) => {
754
759
  return /* @__PURE__ */ jsx(
755
760
  "input",
@@ -769,7 +774,7 @@ Input.displayName = "Input";
769
774
  var labelVariants = cva(
770
775
  "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
771
776
  );
772
- var Label = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
777
+ var Label = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
773
778
  LabelPrimitive.Root,
774
779
  {
775
780
  ref,
@@ -778,7 +783,7 @@ var Label = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
778
783
  }
779
784
  ));
780
785
  Label.displayName = LabelPrimitive.Root.displayName;
781
- var Textarea = React11.forwardRef(
786
+ var Textarea = React13.forwardRef(
782
787
  ({ className, height, style, ...props }, ref) => {
783
788
  return /* @__PURE__ */ jsx(
784
789
  "textarea",
@@ -824,8 +829,8 @@ var TextWidget = ({ fieldId }) => {
824
829
  const { state } = useForm();
825
830
  const showError = !!error && (touched || state.submitAttempted);
826
831
  if (!fieldDef) return null;
827
- const Component = fieldDef.type === "textarea" || fieldDef.type === "richtext" ? Textarea : Input;
828
- const isTextarea = fieldDef.type === "textarea" || fieldDef.type === "richtext";
832
+ const Component = fieldDef.type === "textarea" ? Textarea : Input;
833
+ const isTextarea = fieldDef.type === "textarea";
829
834
  const height = isTextarea && "height" in fieldDef ? fieldDef.height : void 0;
830
835
  const theme = getThemeConfig(
831
836
  isTextarea ? "textarea" : "text",
@@ -857,9 +862,298 @@ var TextWidget = ({ fieldId }) => {
857
862
  showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
858
863
  ] });
859
864
  };
865
+ var buttonVariants = cva(
866
+ "inline-flex items-center justify-center whitespace-nowrap 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",
867
+ {
868
+ variants: {
869
+ variant: {
870
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
871
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
872
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
873
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
874
+ ghost: "hover:bg-accent hover:text-accent-foreground",
875
+ link: "text-primary underline-offset-4 hover:underline"
876
+ },
877
+ size: {
878
+ default: "h-10 px-4 py-2",
879
+ sm: "h-9 rounded-md px-3",
880
+ lg: "h-11 rounded-md px-8",
881
+ icon: "h-10 w-10"
882
+ }
883
+ },
884
+ defaultVariants: {
885
+ variant: "default",
886
+ size: "default"
887
+ }
888
+ }
889
+ );
890
+ var Button = React13.forwardRef(
891
+ ({ className, variant, size, asChild = false, ...props }, ref) => {
892
+ const Comp = asChild ? Slot : "button";
893
+ return /* @__PURE__ */ jsx(
894
+ Comp,
895
+ {
896
+ className: cn(buttonVariants({ variant, size, className })),
897
+ ref,
898
+ ...props
899
+ }
900
+ );
901
+ }
902
+ );
903
+ Button.displayName = "Button";
904
+ var Separator = React13.forwardRef(
905
+ ({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsx(
906
+ SeparatorPrimitive.Root,
907
+ {
908
+ ref,
909
+ decorative,
910
+ orientation,
911
+ className: cn(
912
+ "shrink-0 bg-border",
913
+ orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
914
+ className
915
+ ),
916
+ ...props
917
+ }
918
+ )
919
+ );
920
+ Separator.displayName = SeparatorPrimitive.Root.displayName;
921
+ function isEmptyHtml(html) {
922
+ const t = html.trim();
923
+ return t === "" || t === "<p></p>" || t === "<p><br></p>" || t === '<p><br class="ProseMirror-trailingBreak"></p>';
924
+ }
925
+ function RichTextToolbar({
926
+ editor,
927
+ disabled
928
+ }) {
929
+ const [, rerender] = useReducer((n) => n + 1, 0);
930
+ useEffect(() => {
931
+ if (!editor) return;
932
+ const handler = () => rerender();
933
+ editor.on("selectionUpdate", handler);
934
+ editor.on("transaction", handler);
935
+ return () => {
936
+ editor.off("selectionUpdate", handler);
937
+ editor.off("transaction", handler);
938
+ };
939
+ }, [editor]);
940
+ if (!editor) {
941
+ return /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 border-b border-input bg-muted/30 px-2 py-1.5 min-h-[42px]" });
942
+ }
943
+ const fmtBtn = (active, onClick, icon, title) => /* @__PURE__ */ jsx(
944
+ Button,
945
+ {
946
+ type: "button",
947
+ variant: active ? "secondary" : "outline",
948
+ size: "icon",
949
+ className: "h-8 w-8 shrink-0",
950
+ disabled,
951
+ title,
952
+ onClick: () => {
953
+ if (!disabled) onClick();
954
+ },
955
+ children: icon
956
+ }
957
+ );
958
+ return /* @__PURE__ */ jsxs(
959
+ "div",
960
+ {
961
+ className: "flex flex-wrap items-center gap-1 border-b border-input bg-muted/30 px-2 py-1.5",
962
+ role: "toolbar",
963
+ "aria-label": "Rich text formatting",
964
+ children: [
965
+ fmtBtn(
966
+ editor.isActive("bold"),
967
+ () => editor.chain().focus().toggleBold().run(),
968
+ /* @__PURE__ */ jsx(Bold, { className: "h-4 w-4" }),
969
+ "Bold"
970
+ ),
971
+ fmtBtn(
972
+ editor.isActive("italic"),
973
+ () => editor.chain().focus().toggleItalic().run(),
974
+ /* @__PURE__ */ jsx(Italic, { className: "h-4 w-4" }),
975
+ "Italic"
976
+ ),
977
+ fmtBtn(
978
+ editor.isActive("underline"),
979
+ () => editor.chain().focus().toggleUnderline().run(),
980
+ /* @__PURE__ */ jsx(Underline$1, { className: "h-4 w-4" }),
981
+ "Underline"
982
+ ),
983
+ fmtBtn(
984
+ editor.isActive("strike"),
985
+ () => editor.chain().focus().toggleStrike().run(),
986
+ /* @__PURE__ */ jsx(Strikethrough, { className: "h-4 w-4" }),
987
+ "Strikethrough"
988
+ ),
989
+ /* @__PURE__ */ jsx(Separator, { orientation: "vertical", className: "mx-0.5 h-6" }),
990
+ fmtBtn(
991
+ editor.isActive("bulletList"),
992
+ () => editor.chain().focus().toggleBulletList().run(),
993
+ /* @__PURE__ */ jsx(List, { className: "h-4 w-4" }),
994
+ "Bullet list"
995
+ ),
996
+ fmtBtn(
997
+ editor.isActive("orderedList"),
998
+ () => editor.chain().focus().toggleOrderedList().run(),
999
+ /* @__PURE__ */ jsx(ListOrdered, { className: "h-4 w-4" }),
1000
+ "Numbered list"
1001
+ ),
1002
+ /* @__PURE__ */ jsx(Separator, { orientation: "vertical", className: "mx-0.5 h-6" }),
1003
+ /* @__PURE__ */ jsx(
1004
+ Button,
1005
+ {
1006
+ type: "button",
1007
+ variant: "outline",
1008
+ size: "icon",
1009
+ className: "h-8 w-8 shrink-0",
1010
+ disabled: disabled || !editor.can().undo(),
1011
+ title: "Undo",
1012
+ onClick: () => editor.chain().focus().undo().run(),
1013
+ children: /* @__PURE__ */ jsx(Undo, { className: "h-4 w-4" })
1014
+ }
1015
+ ),
1016
+ /* @__PURE__ */ jsx(
1017
+ Button,
1018
+ {
1019
+ type: "button",
1020
+ variant: "outline",
1021
+ size: "icon",
1022
+ className: "h-8 w-8 shrink-0",
1023
+ disabled: disabled || !editor.can().redo(),
1024
+ title: "Redo",
1025
+ onClick: () => editor.chain().focus().redo().run(),
1026
+ children: /* @__PURE__ */ jsx(Redo, { className: "h-4 w-4" })
1027
+ }
1028
+ )
1029
+ ]
1030
+ }
1031
+ );
1032
+ }
1033
+ var RichTextWidget = ({ fieldId }) => {
1034
+ const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
1035
+ const { state } = useForm();
1036
+ const showError = !!error && (touched || state.submitAttempted);
1037
+ const def = fieldDef;
1038
+ const placeholder = def?.placeholder ?? "Start typing\u2026";
1039
+ const minHeight = def?.minHeight ?? 160;
1040
+ const extensions = useMemo(
1041
+ () => [
1042
+ StarterKit.configure({
1043
+ // Disable headings entirely so the UI/content can't introduce H2/H3.
1044
+ heading: false,
1045
+ bulletList: {
1046
+ HTMLAttributes: {
1047
+ class: "list-disc pl-6 my-2"
1048
+ }
1049
+ },
1050
+ orderedList: {
1051
+ HTMLAttributes: {
1052
+ class: "list-decimal pl-6 my-2"
1053
+ }
1054
+ },
1055
+ listItem: {
1056
+ HTMLAttributes: {
1057
+ class: "my-1"
1058
+ }
1059
+ }
1060
+ }),
1061
+ Underline,
1062
+ Placeholder.configure({
1063
+ placeholder
1064
+ })
1065
+ ],
1066
+ [placeholder]
1067
+ );
1068
+ const stringValue = typeof value === "string" ? value : "";
1069
+ const editor = useEditor(
1070
+ {
1071
+ extensions,
1072
+ content: stringValue || "",
1073
+ editable: !disabled,
1074
+ immediatelyRender: false,
1075
+ onUpdate: ({ editor: ed }) => {
1076
+ const html = ed.getHTML();
1077
+ setValue(isEmptyHtml(html) ? "" : html);
1078
+ },
1079
+ onBlur: () => setTouched(),
1080
+ editorProps: {
1081
+ attributes: {
1082
+ id: fieldId,
1083
+ class: "focus:outline-none",
1084
+ style: `min-height: ${minHeight}px`
1085
+ }
1086
+ }
1087
+ },
1088
+ [extensions, fieldId]
1089
+ );
1090
+ useEffect(() => {
1091
+ if (!editor || editor.isDestroyed) return;
1092
+ editor.setEditable(!disabled);
1093
+ }, [editor, disabled]);
1094
+ useEffect(() => {
1095
+ if (!editor || editor.isDestroyed) return;
1096
+ const el = editor.view.dom;
1097
+ el.style.minHeight = `${minHeight}px`;
1098
+ }, [editor, minHeight]);
1099
+ useEffect(() => {
1100
+ if (!editor || editor.isDestroyed) return;
1101
+ const fromForm = stringValue;
1102
+ const fromEditor = editor.getHTML();
1103
+ if (isEmptyHtml(fromForm) && isEmptyHtml(fromEditor)) return;
1104
+ if (fromForm && fromForm !== fromEditor) {
1105
+ editor.commands.setContent(fromForm, { emitUpdate: false });
1106
+ }
1107
+ if (!fromForm && !isEmptyHtml(fromEditor)) {
1108
+ editor.commands.setContent("", { emitUpdate: false });
1109
+ }
1110
+ }, [stringValue, editor]);
1111
+ if (!fieldDef) return null;
1112
+ const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
1113
+ fieldDef.label,
1114
+ " ",
1115
+ fieldDef.required && /* @__PURE__ */ jsx("span", { className: "text-red-500", children: "*" })
1116
+ ] });
1117
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
1118
+ /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, children: labelContent }),
1119
+ /* @__PURE__ */ jsxs(
1120
+ "div",
1121
+ {
1122
+ className: cn(
1123
+ "rounded-md border border-input bg-background text-sm ring-offset-background overflow-hidden",
1124
+ showError && "border-red-500",
1125
+ disabled && "opacity-60"
1126
+ ),
1127
+ children: [
1128
+ /* @__PURE__ */ jsx(RichTextToolbar, { editor, disabled }),
1129
+ /* @__PURE__ */ jsx(
1130
+ "div",
1131
+ {
1132
+ className: cn(
1133
+ "px-3 py-2",
1134
+ "[&_.ProseMirror]:outline-none",
1135
+ "[&_.ProseMirror_ul]:list-disc [&_.ProseMirror_ul]:pl-6 [&_.ProseMirror_ul]:my-2",
1136
+ "[&_.ProseMirror_ol]:list-decimal [&_.ProseMirror_ol]:pl-6 [&_.ProseMirror_ol]:my-2",
1137
+ "[&_.ProseMirror_li]:list-item",
1138
+ "[&_.ProseMirror_blockquote]:border-l-4 [&_.ProseMirror_blockquote]:border-muted-foreground/40 [&_.ProseMirror_blockquote]:pl-3 [&_.ProseMirror_blockquote]:italic [&_.ProseMirror_blockquote]:my-2",
1139
+ "[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground",
1140
+ "[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]",
1141
+ "[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left",
1142
+ "[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none",
1143
+ "[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0"
1144
+ ),
1145
+ children: /* @__PURE__ */ jsx(EditorContent, { editor })
1146
+ }
1147
+ )
1148
+ ]
1149
+ }
1150
+ ),
1151
+ showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
1152
+ ] });
1153
+ };
860
1154
  var Select = SelectPrimitive.Root;
861
1155
  var SelectValue = SelectPrimitive.Value;
862
- var SelectTrigger = React11.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
1156
+ var SelectTrigger = React13.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
863
1157
  SelectPrimitive.Trigger,
864
1158
  {
865
1159
  ref,
@@ -875,7 +1169,7 @@ var SelectTrigger = React11.forwardRef(({ className, children, ...props }, ref)
875
1169
  }
876
1170
  ));
877
1171
  SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
878
- var SelectScrollUpButton = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1172
+ var SelectScrollUpButton = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
879
1173
  SelectPrimitive.ScrollUpButton,
880
1174
  {
881
1175
  ref,
@@ -888,7 +1182,7 @@ var SelectScrollUpButton = React11.forwardRef(({ className, ...props }, ref) =>
888
1182
  }
889
1183
  ));
890
1184
  SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
891
- var SelectScrollDownButton = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1185
+ var SelectScrollDownButton = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
892
1186
  SelectPrimitive.ScrollDownButton,
893
1187
  {
894
1188
  ref,
@@ -901,7 +1195,7 @@ var SelectScrollDownButton = React11.forwardRef(({ className, ...props }, ref) =
901
1195
  }
902
1196
  ));
903
1197
  SelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;
904
- var SelectContent = React11.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
1198
+ var SelectContent = React13.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsx(SelectPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
905
1199
  SelectPrimitive.Content,
906
1200
  {
907
1201
  ref,
@@ -929,7 +1223,7 @@ var SelectContent = React11.forwardRef(({ className, children, position = "poppe
929
1223
  }
930
1224
  ) }));
931
1225
  SelectContent.displayName = SelectPrimitive.Content.displayName;
932
- var SelectLabel = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1226
+ var SelectLabel = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
933
1227
  SelectPrimitive.Label,
934
1228
  {
935
1229
  ref,
@@ -938,7 +1232,7 @@ var SelectLabel = React11.forwardRef(({ className, ...props }, ref) => /* @__PUR
938
1232
  }
939
1233
  ));
940
1234
  SelectLabel.displayName = SelectPrimitive.Label.displayName;
941
- var SelectItem = React11.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
1235
+ var SelectItem = React13.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
942
1236
  SelectPrimitive.Item,
943
1237
  {
944
1238
  ref,
@@ -954,7 +1248,7 @@ var SelectItem = React11.forwardRef(({ className, children, ...props }, ref) =>
954
1248
  }
955
1249
  ));
956
1250
  SelectItem.displayName = SelectPrimitive.Item.displayName;
957
- var SelectSeparator = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1251
+ var SelectSeparator = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
958
1252
  SelectPrimitive.Separator,
959
1253
  {
960
1254
  ref,
@@ -1043,7 +1337,7 @@ var SelectWidget = ({ fieldId }) => {
1043
1337
  showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
1044
1338
  ] });
1045
1339
  };
1046
- var Checkbox = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1340
+ var Checkbox = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1047
1341
  CheckboxPrimitive.Root,
1048
1342
  {
1049
1343
  ref,
@@ -1117,46 +1411,7 @@ var MultiSelectWidget = ({ fieldId }) => {
1117
1411
  showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
1118
1412
  ] });
1119
1413
  };
1120
- var buttonVariants = cva(
1121
- "inline-flex items-center justify-center whitespace-nowrap 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",
1122
- {
1123
- variants: {
1124
- variant: {
1125
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
1126
- destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
1127
- outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
1128
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
1129
- ghost: "hover:bg-accent hover:text-accent-foreground",
1130
- link: "text-primary underline-offset-4 hover:underline"
1131
- },
1132
- size: {
1133
- default: "h-10 px-4 py-2",
1134
- sm: "h-9 rounded-md px-3",
1135
- lg: "h-11 rounded-md px-8",
1136
- icon: "h-10 w-10"
1137
- }
1138
- },
1139
- defaultVariants: {
1140
- variant: "default",
1141
- size: "default"
1142
- }
1143
- }
1144
- );
1145
- var Button = React11.forwardRef(
1146
- ({ className, variant, size, asChild = false, ...props }, ref) => {
1147
- const Comp = asChild ? Slot : "button";
1148
- return /* @__PURE__ */ jsx(
1149
- Comp,
1150
- {
1151
- className: cn(buttonVariants({ variant, size, className })),
1152
- ref,
1153
- ...props
1154
- }
1155
- );
1156
- }
1157
- );
1158
- Button.displayName = "Button";
1159
- var Table = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
1414
+ var Table = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
1160
1415
  "table",
1161
1416
  {
1162
1417
  ref,
@@ -1165,9 +1420,9 @@ var Table = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
1165
1420
  }
1166
1421
  ) }));
1167
1422
  Table.displayName = "Table";
1168
- var TableHeader = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
1423
+ var TableHeader = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
1169
1424
  TableHeader.displayName = "TableHeader";
1170
- var TableBody = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1425
+ var TableBody = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1171
1426
  "tbody",
1172
1427
  {
1173
1428
  ref,
@@ -1176,7 +1431,7 @@ var TableBody = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE_
1176
1431
  }
1177
1432
  ));
1178
1433
  TableBody.displayName = "TableBody";
1179
- var TableFooter = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1434
+ var TableFooter = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1180
1435
  "tfoot",
1181
1436
  {
1182
1437
  ref,
@@ -1188,7 +1443,7 @@ var TableFooter = React11.forwardRef(({ className, ...props }, ref) => /* @__PUR
1188
1443
  }
1189
1444
  ));
1190
1445
  TableFooter.displayName = "TableFooter";
1191
- var TableRow = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1446
+ var TableRow = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1192
1447
  "tr",
1193
1448
  {
1194
1449
  ref,
@@ -1200,7 +1455,7 @@ var TableRow = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__
1200
1455
  }
1201
1456
  ));
1202
1457
  TableRow.displayName = "TableRow";
1203
- var TableHead = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1458
+ var TableHead = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1204
1459
  "th",
1205
1460
  {
1206
1461
  ref,
@@ -1212,7 +1467,7 @@ var TableHead = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE_
1212
1467
  }
1213
1468
  ));
1214
1469
  TableHead.displayName = "TableHead";
1215
- var TableCell = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1470
+ var TableCell = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1216
1471
  "td",
1217
1472
  {
1218
1473
  ref,
@@ -1221,7 +1476,7 @@ var TableCell = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE_
1221
1476
  }
1222
1477
  ));
1223
1478
  TableCell.displayName = "TableCell";
1224
- var TableCaption = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1479
+ var TableCaption = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
1225
1480
  "caption",
1226
1481
  {
1227
1482
  ref,
@@ -1237,7 +1492,7 @@ var RepeatableWidget = ({
1237
1492
  if (!fieldDef || fieldDef.type !== "repeatable") return null;
1238
1493
  const def = fieldDef;
1239
1494
  const rows = Array.isArray(value) ? value : [];
1240
- const [hasInteracted, setHasInteracted] = React11__default.useState(false);
1495
+ const [hasInteracted, setHasInteracted] = React13__default.useState(false);
1241
1496
  const showError = !!error && (touched || hasInteracted);
1242
1497
  const addRow = () => {
1243
1498
  setValue([...rows, {}]);
@@ -1406,7 +1661,7 @@ function Calendar({
1406
1661
  Calendar.displayName = "Calendar";
1407
1662
  var Popover = PopoverPrimitive.Root;
1408
1663
  var PopoverTrigger = PopoverPrimitive.Trigger;
1409
- var PopoverContent = React11.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
1664
+ var PopoverContent = React13.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(
1410
1665
  PopoverPrimitive.Content,
1411
1666
  {
1412
1667
  ref,
@@ -1485,14 +1740,14 @@ function DateTimePicker({
1485
1740
  className,
1486
1741
  placeholder = "Pick date & time"
1487
1742
  }) {
1488
- const [internalDate, setInternalDate] = React11.useState(dateTime);
1489
- const [timeString, setTimeString] = React11.useState(() => {
1743
+ const [internalDate, setInternalDate] = React13.useState(dateTime);
1744
+ const [timeString, setTimeString] = React13.useState(() => {
1490
1745
  if (!dateTime) return "";
1491
1746
  const hours = dateTime.getHours().toString().padStart(2, "0");
1492
1747
  const minutes = dateTime.getMinutes().toString().padStart(2, "0");
1493
1748
  return `${hours}:${minutes}`;
1494
1749
  });
1495
- React11.useEffect(() => {
1750
+ React13.useEffect(() => {
1496
1751
  setInternalDate(dateTime);
1497
1752
  if (!dateTime) {
1498
1753
  setTimeString("");
@@ -1636,7 +1891,7 @@ var ImageUploadWidget = ({ fieldId }) => {
1636
1891
  /* @__PURE__ */ jsx("div", { className: "border-2 border-red-300 rounded-lg p-4 bg-red-50", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-red-600", children: "Upload handler not configured. Please provide an onUpload function in FormProvider config." }) })
1637
1892
  ] });
1638
1893
  }
1639
- React11__default.useEffect(() => {
1894
+ React13__default.useEffect(() => {
1640
1895
  if (value && typeof value === "string") {
1641
1896
  setPreview(value);
1642
1897
  } else {
@@ -2275,7 +2530,7 @@ var EditableTableWidget = ({
2275
2530
  ] })
2276
2531
  ] });
2277
2532
  };
2278
- var RadioGroup = React11.forwardRef(({ className, ...props }, ref) => {
2533
+ var RadioGroup = React13.forwardRef(({ className, ...props }, ref) => {
2279
2534
  return /* @__PURE__ */ jsx(
2280
2535
  RadioGroupPrimitive.Root,
2281
2536
  {
@@ -2286,7 +2541,7 @@ var RadioGroup = React11.forwardRef(({ className, ...props }, ref) => {
2286
2541
  );
2287
2542
  });
2288
2543
  RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
2289
- var RadioGroupItem = React11.forwardRef(({ className, ...props }, ref) => {
2544
+ var RadioGroupItem = React13.forwardRef(({ className, ...props }, ref) => {
2290
2545
  return /* @__PURE__ */ jsx(
2291
2546
  RadioGroupPrimitive.Item,
2292
2547
  {
@@ -2433,7 +2688,7 @@ function useAISuggestions() {
2433
2688
  var AISuggestionsProvider = AISuggestionsContext.Provider;
2434
2689
  var Dialog = DialogPrimitive.Root;
2435
2690
  var DialogPortal = DialogPrimitive.Portal;
2436
- var DialogOverlay = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2691
+ var DialogOverlay = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2437
2692
  DialogPrimitive.Overlay,
2438
2693
  {
2439
2694
  ref,
@@ -2445,7 +2700,7 @@ var DialogOverlay = React11.forwardRef(({ className, ...props }, ref) => /* @__P
2445
2700
  }
2446
2701
  ));
2447
2702
  DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
2448
- var DialogContent = React11.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
2703
+ var DialogContent = React13.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
2449
2704
  /* @__PURE__ */ jsx(DialogOverlay, {}),
2450
2705
  /* @__PURE__ */ jsxs(
2451
2706
  DialogPrimitive.Content,
@@ -2481,7 +2736,7 @@ var DialogHeader = ({
2481
2736
  }
2482
2737
  );
2483
2738
  DialogHeader.displayName = "DialogHeader";
2484
- var DialogTitle = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2739
+ var DialogTitle = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2485
2740
  DialogPrimitive.Title,
2486
2741
  {
2487
2742
  ref,
@@ -2493,7 +2748,7 @@ var DialogTitle = React11.forwardRef(({ className, ...props }, ref) => /* @__PUR
2493
2748
  }
2494
2749
  ));
2495
2750
  DialogTitle.displayName = DialogPrimitive.Title.displayName;
2496
- var DialogDescription = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2751
+ var DialogDescription = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2497
2752
  DialogPrimitive.Description,
2498
2753
  {
2499
2754
  ref,
@@ -3588,7 +3843,7 @@ var DifferentialDiagnosisWidget = ({ fieldId }) => {
3588
3843
  const items = Array.isArray(value) ? value : [];
3589
3844
  return /* @__PURE__ */ jsx(DifferentialDiagnosis, { differentialDiagnosis: items });
3590
3845
  };
3591
- var Spinner2 = React11.forwardRef(
3846
+ var Spinner2 = React13.forwardRef(
3592
3847
  ({ className, size = "md", ...props }, ref) => {
3593
3848
  const sizeClasses = {
3594
3849
  sm: "h-4 w-4 border-2",
@@ -3944,7 +4199,7 @@ var ReferralWidget = ({ fieldId }) => {
3944
4199
  showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
3945
4200
  ] });
3946
4201
  };
3947
- var Card = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4202
+ var Card = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3948
4203
  "div",
3949
4204
  {
3950
4205
  ref,
@@ -3956,7 +4211,7 @@ var Card = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
3956
4211
  }
3957
4212
  ));
3958
4213
  Card.displayName = "Card";
3959
- var CardHeader = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4214
+ var CardHeader = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3960
4215
  "div",
3961
4216
  {
3962
4217
  ref,
@@ -3965,7 +4220,7 @@ var CardHeader = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE
3965
4220
  }
3966
4221
  ));
3967
4222
  CardHeader.displayName = "CardHeader";
3968
- var CardTitle = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4223
+ var CardTitle = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3969
4224
  "h3",
3970
4225
  {
3971
4226
  ref,
@@ -3977,7 +4232,7 @@ var CardTitle = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE_
3977
4232
  }
3978
4233
  ));
3979
4234
  CardTitle.displayName = "CardTitle";
3980
- var CardDescription = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4235
+ var CardDescription = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3981
4236
  "p",
3982
4237
  {
3983
4238
  ref,
@@ -3986,9 +4241,9 @@ var CardDescription = React11.forwardRef(({ className, ...props }, ref) => /* @_
3986
4241
  }
3987
4242
  ));
3988
4243
  CardDescription.displayName = "CardDescription";
3989
- var CardContent = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
4244
+ var CardContent = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
3990
4245
  CardContent.displayName = "CardContent";
3991
- var CardFooter = React11.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
4246
+ var CardFooter = React13.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3992
4247
  "div",
3993
4248
  {
3994
4249
  ref,
@@ -4410,7 +4665,7 @@ var SmartTextareaWidget = ({ fieldId }) => {
4410
4665
  },
4411
4666
  [setValue]
4412
4667
  );
4413
- React11__default.useEffect(() => {
4668
+ React13__default.useEffect(() => {
4414
4669
  if (nextKeywords !== currentKeywords) {
4415
4670
  writeValue(textValue, nextKeywords);
4416
4671
  }
@@ -6370,7 +6625,7 @@ var OphthalDiagnosisWidget = ({ fieldId }) => {
6370
6625
  ] })
6371
6626
  ] });
6372
6627
  };
6373
- var Slider = React11.forwardRef(({ className, trackClassName, thumbClassName, ...props }, ref) => /* @__PURE__ */ jsxs(
6628
+ var Slider = React13.forwardRef(({ className, trackClassName, thumbClassName, ...props }, ref) => /* @__PURE__ */ jsxs(
6374
6629
  SliderPrimitive.Root,
6375
6630
  {
6376
6631
  ref,
@@ -6763,8 +7018,9 @@ var FieldRenderer = ({ fieldId }) => {
6763
7018
  case "number":
6764
7019
  return /* @__PURE__ */ jsx(TextWidget, { fieldId });
6765
7020
  case "textarea":
6766
- case "richtext":
6767
7021
  return /* @__PURE__ */ jsx(TextWidget, { fieldId });
7022
+ case "richtext":
7023
+ return /* @__PURE__ */ jsx(RichTextWidget, { fieldId });
6768
7024
  case "date":
6769
7025
  return /* @__PURE__ */ jsx(DateWidget, { fieldId });
6770
7026
  case "datetime":
@@ -6882,7 +7138,7 @@ var DynamicForm = () => {
6882
7138
  children: child.children.map((fieldId) => /* @__PURE__ */ jsx(FieldRenderer, { fieldId }, fieldId))
6883
7139
  },
6884
7140
  child.id
6885
- ) : /* @__PURE__ */ jsx(React11__default.Fragment, {}, child.id ?? index)
7141
+ ) : /* @__PURE__ */ jsx(React13__default.Fragment, {}, child.id ?? index)
6886
7142
  ) }, node.id);
6887
7143
  }
6888
7144
  if (node.type === "column_layout") {
@@ -7466,7 +7722,7 @@ var ReadOnlyForm = ({ schema, submission }) => {
7466
7722
  child.id
7467
7723
  );
7468
7724
  }
7469
- return /* @__PURE__ */ jsx(React11__default.Fragment, {}, child.id ?? index);
7725
+ return /* @__PURE__ */ jsx(React13__default.Fragment, {}, child.id ?? index);
7470
7726
  };
7471
7727
  const hasContent = node.children.some(
7472
7728
  (child) => typeof child === "string" ? fieldMap.has(child) : child.type === "column_layout" && child.children?.some((id) => fieldMap.has(id))
@@ -7594,6 +7850,6 @@ function createUploadHandler(options) {
7594
7850
  };
7595
7851
  }
7596
7852
 
7597
- export { AddInvestigationField, AddMedicationField, DifferentialDiagnosis, DynamicForm, EMAIL_REGEX, FieldRenderer, FormControls, FormProvider, FormStore, ImageUploadWidget, ReadOnlyForm, ReadOnlyImageUpload, ReadOnlySignature, ReadOnlyTable, SignatureUploadWidget, SmartForm, SmartTextareaWidget, createUploadHandler, evaluateRules, useField, useFieldHandlers, useForm, useFormStore, useFrequentItems, useSmartKeywords, validateField, validateForm };
7853
+ export { AddInvestigationField, AddMedicationField, DifferentialDiagnosis, DynamicForm, EMAIL_REGEX, FieldRenderer, FormControls, FormProvider, FormStore, ImageUploadWidget, ReadOnlyForm, ReadOnlyImageUpload, ReadOnlySignature, ReadOnlyTable, RichTextWidget, SignatureUploadWidget, SmartForm, SmartTextareaWidget, createUploadHandler, evaluateRules, useField, useFieldHandlers, useForm, useFormStore, useFrequentItems, useSmartKeywords, validateField, validateForm };
7598
7854
  //# sourceMappingURL=index.mjs.map
7599
7855
  //# sourceMappingURL=index.mjs.map