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.cjs +503 -242
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.mjs +345 -89
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -1
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React13 = require('react');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
var clsx = require('clsx');
|
|
6
6
|
var tailwindMerge = require('tailwind-merge');
|
|
7
7
|
var LabelPrimitive = require('@radix-ui/react-label');
|
|
8
8
|
var classVarianceAuthority = require('class-variance-authority');
|
|
9
|
-
var
|
|
9
|
+
var react = require('@tiptap/react');
|
|
10
|
+
var StarterKit = require('@tiptap/starter-kit');
|
|
11
|
+
var Placeholder = require('@tiptap/extension-placeholder');
|
|
12
|
+
var Underline = require('@tiptap/extension-underline');
|
|
10
13
|
var lucideReact = require('lucide-react');
|
|
11
|
-
var CheckboxPrimitive = require('@radix-ui/react-checkbox');
|
|
12
14
|
var reactSlot = require('@radix-ui/react-slot');
|
|
15
|
+
var SeparatorPrimitive = require('@radix-ui/react-separator');
|
|
16
|
+
var SelectPrimitive = require('@radix-ui/react-select');
|
|
17
|
+
var CheckboxPrimitive = require('@radix-ui/react-checkbox');
|
|
13
18
|
var dateFns = require('date-fns');
|
|
14
19
|
var reactDayPicker = require('react-day-picker');
|
|
15
20
|
var PopoverPrimitive = require('@radix-ui/react-popover');
|
|
@@ -39,8 +44,12 @@ function _interopNamespace(e) {
|
|
|
39
44
|
return Object.freeze(n);
|
|
40
45
|
}
|
|
41
46
|
|
|
42
|
-
var
|
|
47
|
+
var React13__namespace = /*#__PURE__*/_interopNamespace(React13);
|
|
43
48
|
var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
|
|
49
|
+
var StarterKit__default = /*#__PURE__*/_interopDefault(StarterKit);
|
|
50
|
+
var Placeholder__default = /*#__PURE__*/_interopDefault(Placeholder);
|
|
51
|
+
var Underline__default = /*#__PURE__*/_interopDefault(Underline);
|
|
52
|
+
var SeparatorPrimitive__namespace = /*#__PURE__*/_interopNamespace(SeparatorPrimitive);
|
|
44
53
|
var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
|
|
45
54
|
var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
|
|
46
55
|
var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
|
|
@@ -685,20 +694,20 @@ var FormStore = class {
|
|
|
685
694
|
this.listeners.forEach((l) => l(this.state));
|
|
686
695
|
}
|
|
687
696
|
};
|
|
688
|
-
var FormContext =
|
|
697
|
+
var FormContext = React13.createContext(null);
|
|
689
698
|
var emptyFrequentItems = {
|
|
690
699
|
medications: [],
|
|
691
700
|
investigations: [],
|
|
692
701
|
procedures: []
|
|
693
702
|
};
|
|
694
|
-
var FrequentItemsContext =
|
|
695
|
-
var FieldHandlersContext =
|
|
703
|
+
var FrequentItemsContext = React13.createContext(emptyFrequentItems);
|
|
704
|
+
var FieldHandlersContext = React13.createContext({});
|
|
696
705
|
function useFieldHandlers(fieldId) {
|
|
697
|
-
const map =
|
|
706
|
+
const map = React13.useContext(FieldHandlersContext);
|
|
698
707
|
return map[fieldId] ?? { onSearch: async () => [], recentlyUsed: [] };
|
|
699
708
|
}
|
|
700
709
|
function useFrequentItems() {
|
|
701
|
-
return
|
|
710
|
+
return React13.useContext(FrequentItemsContext);
|
|
702
711
|
}
|
|
703
712
|
var FormProvider = ({
|
|
704
713
|
schema,
|
|
@@ -707,23 +716,23 @@ var FormProvider = ({
|
|
|
707
716
|
frequentItems,
|
|
708
717
|
children
|
|
709
718
|
}) => {
|
|
710
|
-
const storeRef =
|
|
719
|
+
const storeRef = React13.useRef(null);
|
|
711
720
|
if (!storeRef.current) {
|
|
712
721
|
storeRef.current = new FormStore(schema, config);
|
|
713
722
|
}
|
|
714
|
-
|
|
723
|
+
React13.useEffect(() => {
|
|
715
724
|
if (storeRef.current && config) {
|
|
716
725
|
storeRef.current.updateConfig(config);
|
|
717
726
|
}
|
|
718
727
|
});
|
|
719
|
-
|
|
728
|
+
React13.useEffect(() => {
|
|
720
729
|
storeRef.current?.load();
|
|
721
730
|
}, []);
|
|
722
731
|
const frequentItemsValue = frequentItems ?? emptyFrequentItems;
|
|
723
732
|
return /* @__PURE__ */ jsxRuntime.jsx(FormContext.Provider, { value: storeRef.current, children: /* @__PURE__ */ jsxRuntime.jsx(FieldHandlersContext.Provider, { value: fieldHandlers ?? {}, children: /* @__PURE__ */ jsxRuntime.jsx(FrequentItemsContext.Provider, { value: frequentItemsValue, children }) }) });
|
|
724
733
|
};
|
|
725
734
|
function useFormStore() {
|
|
726
|
-
const context =
|
|
735
|
+
const context = React13.useContext(FormContext);
|
|
727
736
|
if (!context) {
|
|
728
737
|
throw new Error("useFormStore must be used within a FormProvider");
|
|
729
738
|
}
|
|
@@ -731,8 +740,8 @@ function useFormStore() {
|
|
|
731
740
|
}
|
|
732
741
|
function useForm() {
|
|
733
742
|
const store = useFormStore();
|
|
734
|
-
const [state, setState] =
|
|
735
|
-
|
|
743
|
+
const [state, setState] = React13.useState(store.getState());
|
|
744
|
+
React13.useEffect(() => {
|
|
736
745
|
const unsubscribe = store.subscribe((newState) => {
|
|
737
746
|
setState({ ...newState });
|
|
738
747
|
});
|
|
@@ -754,8 +763,8 @@ function useForm() {
|
|
|
754
763
|
}
|
|
755
764
|
function useField(fieldId) {
|
|
756
765
|
const store = useFormStore();
|
|
757
|
-
const [fieldState, setFieldState] =
|
|
758
|
-
|
|
766
|
+
const [fieldState, setFieldState] = React13.useState(store.getFieldState(fieldId));
|
|
767
|
+
React13.useEffect(() => {
|
|
759
768
|
const unsubscribe = store.subscribe(() => {
|
|
760
769
|
const newState = store.getFieldState(fieldId);
|
|
761
770
|
setFieldState((prev) => {
|
|
@@ -780,7 +789,7 @@ function useField(fieldId) {
|
|
|
780
789
|
function cn(...inputs) {
|
|
781
790
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
782
791
|
}
|
|
783
|
-
var Input =
|
|
792
|
+
var Input = React13__namespace.forwardRef(
|
|
784
793
|
({ className, type, ...props }, ref) => {
|
|
785
794
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
786
795
|
"input",
|
|
@@ -800,7 +809,7 @@ Input.displayName = "Input";
|
|
|
800
809
|
var labelVariants = classVarianceAuthority.cva(
|
|
801
810
|
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
802
811
|
);
|
|
803
|
-
var Label =
|
|
812
|
+
var Label = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
804
813
|
LabelPrimitive__namespace.Root,
|
|
805
814
|
{
|
|
806
815
|
ref,
|
|
@@ -809,7 +818,7 @@ var Label = React11__namespace.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
809
818
|
}
|
|
810
819
|
));
|
|
811
820
|
Label.displayName = LabelPrimitive__namespace.Root.displayName;
|
|
812
|
-
var Textarea =
|
|
821
|
+
var Textarea = React13__namespace.forwardRef(
|
|
813
822
|
({ className, height, style, ...props }, ref) => {
|
|
814
823
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
815
824
|
"textarea",
|
|
@@ -855,8 +864,8 @@ var TextWidget = ({ fieldId }) => {
|
|
|
855
864
|
const { state } = useForm();
|
|
856
865
|
const showError = !!error && (touched || state.submitAttempted);
|
|
857
866
|
if (!fieldDef) return null;
|
|
858
|
-
const Component = fieldDef.type === "textarea"
|
|
859
|
-
const isTextarea = fieldDef.type === "textarea"
|
|
867
|
+
const Component = fieldDef.type === "textarea" ? Textarea : Input;
|
|
868
|
+
const isTextarea = fieldDef.type === "textarea";
|
|
860
869
|
const height = isTextarea && "height" in fieldDef ? fieldDef.height : void 0;
|
|
861
870
|
const theme = getThemeConfig(
|
|
862
871
|
isTextarea ? "textarea" : "text",
|
|
@@ -888,9 +897,298 @@ var TextWidget = ({ fieldId }) => {
|
|
|
888
897
|
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
889
898
|
] });
|
|
890
899
|
};
|
|
900
|
+
var buttonVariants = classVarianceAuthority.cva(
|
|
901
|
+
"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",
|
|
902
|
+
{
|
|
903
|
+
variants: {
|
|
904
|
+
variant: {
|
|
905
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
906
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
907
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
908
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
909
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
910
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
911
|
+
},
|
|
912
|
+
size: {
|
|
913
|
+
default: "h-10 px-4 py-2",
|
|
914
|
+
sm: "h-9 rounded-md px-3",
|
|
915
|
+
lg: "h-11 rounded-md px-8",
|
|
916
|
+
icon: "h-10 w-10"
|
|
917
|
+
}
|
|
918
|
+
},
|
|
919
|
+
defaultVariants: {
|
|
920
|
+
variant: "default",
|
|
921
|
+
size: "default"
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
);
|
|
925
|
+
var Button = React13__namespace.forwardRef(
|
|
926
|
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
927
|
+
const Comp = asChild ? reactSlot.Slot : "button";
|
|
928
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
929
|
+
Comp,
|
|
930
|
+
{
|
|
931
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
932
|
+
ref,
|
|
933
|
+
...props
|
|
934
|
+
}
|
|
935
|
+
);
|
|
936
|
+
}
|
|
937
|
+
);
|
|
938
|
+
Button.displayName = "Button";
|
|
939
|
+
var Separator = React13__namespace.forwardRef(
|
|
940
|
+
({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
941
|
+
SeparatorPrimitive__namespace.Root,
|
|
942
|
+
{
|
|
943
|
+
ref,
|
|
944
|
+
decorative,
|
|
945
|
+
orientation,
|
|
946
|
+
className: cn(
|
|
947
|
+
"shrink-0 bg-border",
|
|
948
|
+
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
949
|
+
className
|
|
950
|
+
),
|
|
951
|
+
...props
|
|
952
|
+
}
|
|
953
|
+
)
|
|
954
|
+
);
|
|
955
|
+
Separator.displayName = SeparatorPrimitive__namespace.Root.displayName;
|
|
956
|
+
function isEmptyHtml(html) {
|
|
957
|
+
const t = html.trim();
|
|
958
|
+
return t === "" || t === "<p></p>" || t === "<p><br></p>" || t === '<p><br class="ProseMirror-trailingBreak"></p>';
|
|
959
|
+
}
|
|
960
|
+
function RichTextToolbar({
|
|
961
|
+
editor,
|
|
962
|
+
disabled
|
|
963
|
+
}) {
|
|
964
|
+
const [, rerender] = React13.useReducer((n) => n + 1, 0);
|
|
965
|
+
React13.useEffect(() => {
|
|
966
|
+
if (!editor) return;
|
|
967
|
+
const handler = () => rerender();
|
|
968
|
+
editor.on("selectionUpdate", handler);
|
|
969
|
+
editor.on("transaction", handler);
|
|
970
|
+
return () => {
|
|
971
|
+
editor.off("selectionUpdate", handler);
|
|
972
|
+
editor.off("transaction", handler);
|
|
973
|
+
};
|
|
974
|
+
}, [editor]);
|
|
975
|
+
if (!editor) {
|
|
976
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1 border-b border-input bg-muted/30 px-2 py-1.5 min-h-[42px]" });
|
|
977
|
+
}
|
|
978
|
+
const fmtBtn = (active, onClick, icon, title) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
979
|
+
Button,
|
|
980
|
+
{
|
|
981
|
+
type: "button",
|
|
982
|
+
variant: active ? "secondary" : "outline",
|
|
983
|
+
size: "icon",
|
|
984
|
+
className: "h-8 w-8 shrink-0",
|
|
985
|
+
disabled,
|
|
986
|
+
title,
|
|
987
|
+
onClick: () => {
|
|
988
|
+
if (!disabled) onClick();
|
|
989
|
+
},
|
|
990
|
+
children: icon
|
|
991
|
+
}
|
|
992
|
+
);
|
|
993
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
994
|
+
"div",
|
|
995
|
+
{
|
|
996
|
+
className: "flex flex-wrap items-center gap-1 border-b border-input bg-muted/30 px-2 py-1.5",
|
|
997
|
+
role: "toolbar",
|
|
998
|
+
"aria-label": "Rich text formatting",
|
|
999
|
+
children: [
|
|
1000
|
+
fmtBtn(
|
|
1001
|
+
editor.isActive("bold"),
|
|
1002
|
+
() => editor.chain().focus().toggleBold().run(),
|
|
1003
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bold, { className: "h-4 w-4" }),
|
|
1004
|
+
"Bold"
|
|
1005
|
+
),
|
|
1006
|
+
fmtBtn(
|
|
1007
|
+
editor.isActive("italic"),
|
|
1008
|
+
() => editor.chain().focus().toggleItalic().run(),
|
|
1009
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Italic, { className: "h-4 w-4" }),
|
|
1010
|
+
"Italic"
|
|
1011
|
+
),
|
|
1012
|
+
fmtBtn(
|
|
1013
|
+
editor.isActive("underline"),
|
|
1014
|
+
() => editor.chain().focus().toggleUnderline().run(),
|
|
1015
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Underline, { className: "h-4 w-4" }),
|
|
1016
|
+
"Underline"
|
|
1017
|
+
),
|
|
1018
|
+
fmtBtn(
|
|
1019
|
+
editor.isActive("strike"),
|
|
1020
|
+
() => editor.chain().focus().toggleStrike().run(),
|
|
1021
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Strikethrough, { className: "h-4 w-4" }),
|
|
1022
|
+
"Strikethrough"
|
|
1023
|
+
),
|
|
1024
|
+
/* @__PURE__ */ jsxRuntime.jsx(Separator, { orientation: "vertical", className: "mx-0.5 h-6" }),
|
|
1025
|
+
fmtBtn(
|
|
1026
|
+
editor.isActive("bulletList"),
|
|
1027
|
+
() => editor.chain().focus().toggleBulletList().run(),
|
|
1028
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.List, { className: "h-4 w-4" }),
|
|
1029
|
+
"Bullet list"
|
|
1030
|
+
),
|
|
1031
|
+
fmtBtn(
|
|
1032
|
+
editor.isActive("orderedList"),
|
|
1033
|
+
() => editor.chain().focus().toggleOrderedList().run(),
|
|
1034
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ListOrdered, { className: "h-4 w-4" }),
|
|
1035
|
+
"Numbered list"
|
|
1036
|
+
),
|
|
1037
|
+
/* @__PURE__ */ jsxRuntime.jsx(Separator, { orientation: "vertical", className: "mx-0.5 h-6" }),
|
|
1038
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1039
|
+
Button,
|
|
1040
|
+
{
|
|
1041
|
+
type: "button",
|
|
1042
|
+
variant: "outline",
|
|
1043
|
+
size: "icon",
|
|
1044
|
+
className: "h-8 w-8 shrink-0",
|
|
1045
|
+
disabled: disabled || !editor.can().undo(),
|
|
1046
|
+
title: "Undo",
|
|
1047
|
+
onClick: () => editor.chain().focus().undo().run(),
|
|
1048
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Undo, { className: "h-4 w-4" })
|
|
1049
|
+
}
|
|
1050
|
+
),
|
|
1051
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1052
|
+
Button,
|
|
1053
|
+
{
|
|
1054
|
+
type: "button",
|
|
1055
|
+
variant: "outline",
|
|
1056
|
+
size: "icon",
|
|
1057
|
+
className: "h-8 w-8 shrink-0",
|
|
1058
|
+
disabled: disabled || !editor.can().redo(),
|
|
1059
|
+
title: "Redo",
|
|
1060
|
+
onClick: () => editor.chain().focus().redo().run(),
|
|
1061
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Redo, { className: "h-4 w-4" })
|
|
1062
|
+
}
|
|
1063
|
+
)
|
|
1064
|
+
]
|
|
1065
|
+
}
|
|
1066
|
+
);
|
|
1067
|
+
}
|
|
1068
|
+
var RichTextWidget = ({ fieldId }) => {
|
|
1069
|
+
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
1070
|
+
const { state } = useForm();
|
|
1071
|
+
const showError = !!error && (touched || state.submitAttempted);
|
|
1072
|
+
const def = fieldDef;
|
|
1073
|
+
const placeholder = def?.placeholder ?? "Start typing\u2026";
|
|
1074
|
+
const minHeight = def?.minHeight ?? 160;
|
|
1075
|
+
const extensions = React13.useMemo(
|
|
1076
|
+
() => [
|
|
1077
|
+
StarterKit__default.default.configure({
|
|
1078
|
+
// Disable headings entirely so the UI/content can't introduce H2/H3.
|
|
1079
|
+
heading: false,
|
|
1080
|
+
bulletList: {
|
|
1081
|
+
HTMLAttributes: {
|
|
1082
|
+
class: "list-disc pl-6 my-2"
|
|
1083
|
+
}
|
|
1084
|
+
},
|
|
1085
|
+
orderedList: {
|
|
1086
|
+
HTMLAttributes: {
|
|
1087
|
+
class: "list-decimal pl-6 my-2"
|
|
1088
|
+
}
|
|
1089
|
+
},
|
|
1090
|
+
listItem: {
|
|
1091
|
+
HTMLAttributes: {
|
|
1092
|
+
class: "my-1"
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
}),
|
|
1096
|
+
Underline__default.default,
|
|
1097
|
+
Placeholder__default.default.configure({
|
|
1098
|
+
placeholder
|
|
1099
|
+
})
|
|
1100
|
+
],
|
|
1101
|
+
[placeholder]
|
|
1102
|
+
);
|
|
1103
|
+
const stringValue = typeof value === "string" ? value : "";
|
|
1104
|
+
const editor = react.useEditor(
|
|
1105
|
+
{
|
|
1106
|
+
extensions,
|
|
1107
|
+
content: stringValue || "",
|
|
1108
|
+
editable: !disabled,
|
|
1109
|
+
immediatelyRender: false,
|
|
1110
|
+
onUpdate: ({ editor: ed }) => {
|
|
1111
|
+
const html = ed.getHTML();
|
|
1112
|
+
setValue(isEmptyHtml(html) ? "" : html);
|
|
1113
|
+
},
|
|
1114
|
+
onBlur: () => setTouched(),
|
|
1115
|
+
editorProps: {
|
|
1116
|
+
attributes: {
|
|
1117
|
+
id: fieldId,
|
|
1118
|
+
class: "focus:outline-none",
|
|
1119
|
+
style: `min-height: ${minHeight}px`
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
},
|
|
1123
|
+
[extensions, fieldId]
|
|
1124
|
+
);
|
|
1125
|
+
React13.useEffect(() => {
|
|
1126
|
+
if (!editor || editor.isDestroyed) return;
|
|
1127
|
+
editor.setEditable(!disabled);
|
|
1128
|
+
}, [editor, disabled]);
|
|
1129
|
+
React13.useEffect(() => {
|
|
1130
|
+
if (!editor || editor.isDestroyed) return;
|
|
1131
|
+
const el = editor.view.dom;
|
|
1132
|
+
el.style.minHeight = `${minHeight}px`;
|
|
1133
|
+
}, [editor, minHeight]);
|
|
1134
|
+
React13.useEffect(() => {
|
|
1135
|
+
if (!editor || editor.isDestroyed) return;
|
|
1136
|
+
const fromForm = stringValue;
|
|
1137
|
+
const fromEditor = editor.getHTML();
|
|
1138
|
+
if (isEmptyHtml(fromForm) && isEmptyHtml(fromEditor)) return;
|
|
1139
|
+
if (fromForm && fromForm !== fromEditor) {
|
|
1140
|
+
editor.commands.setContent(fromForm, { emitUpdate: false });
|
|
1141
|
+
}
|
|
1142
|
+
if (!fromForm && !isEmptyHtml(fromEditor)) {
|
|
1143
|
+
editor.commands.setContent("", { emitUpdate: false });
|
|
1144
|
+
}
|
|
1145
|
+
}, [stringValue, editor]);
|
|
1146
|
+
if (!fieldDef) return null;
|
|
1147
|
+
const labelContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1148
|
+
fieldDef.label,
|
|
1149
|
+
" ",
|
|
1150
|
+
fieldDef.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500", children: "*" })
|
|
1151
|
+
] });
|
|
1152
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
1153
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, children: labelContent }),
|
|
1154
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1155
|
+
"div",
|
|
1156
|
+
{
|
|
1157
|
+
className: cn(
|
|
1158
|
+
"rounded-md border border-input bg-background text-sm ring-offset-background overflow-hidden",
|
|
1159
|
+
showError && "border-red-500",
|
|
1160
|
+
disabled && "opacity-60"
|
|
1161
|
+
),
|
|
1162
|
+
children: [
|
|
1163
|
+
/* @__PURE__ */ jsxRuntime.jsx(RichTextToolbar, { editor, disabled }),
|
|
1164
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1165
|
+
"div",
|
|
1166
|
+
{
|
|
1167
|
+
className: cn(
|
|
1168
|
+
"px-3 py-2",
|
|
1169
|
+
"[&_.ProseMirror]:outline-none",
|
|
1170
|
+
"[&_.ProseMirror_ul]:list-disc [&_.ProseMirror_ul]:pl-6 [&_.ProseMirror_ul]:my-2",
|
|
1171
|
+
"[&_.ProseMirror_ol]:list-decimal [&_.ProseMirror_ol]:pl-6 [&_.ProseMirror_ol]:my-2",
|
|
1172
|
+
"[&_.ProseMirror_li]:list-item",
|
|
1173
|
+
"[&_.ProseMirror_blockquote]:border-l-4 [&_.ProseMirror_blockquote]:border-muted-foreground/40 [&_.ProseMirror_blockquote]:pl-3 [&_.ProseMirror_blockquote]:italic [&_.ProseMirror_blockquote]:my-2",
|
|
1174
|
+
"[&_.ProseMirror_p.is-editor-empty:first-child::before]:text-muted-foreground",
|
|
1175
|
+
"[&_.ProseMirror_p.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]",
|
|
1176
|
+
"[&_.ProseMirror_p.is-editor-empty:first-child::before]:float-left",
|
|
1177
|
+
"[&_.ProseMirror_p.is-editor-empty:first-child::before]:pointer-events-none",
|
|
1178
|
+
"[&_.ProseMirror_p.is-editor-empty:first-child::before]:h-0"
|
|
1179
|
+
),
|
|
1180
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react.EditorContent, { editor })
|
|
1181
|
+
}
|
|
1182
|
+
)
|
|
1183
|
+
]
|
|
1184
|
+
}
|
|
1185
|
+
),
|
|
1186
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
1187
|
+
] });
|
|
1188
|
+
};
|
|
891
1189
|
var Select = SelectPrimitive__namespace.Root;
|
|
892
1190
|
var SelectValue = SelectPrimitive__namespace.Value;
|
|
893
|
-
var SelectTrigger =
|
|
1191
|
+
var SelectTrigger = React13__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
894
1192
|
SelectPrimitive__namespace.Trigger,
|
|
895
1193
|
{
|
|
896
1194
|
ref,
|
|
@@ -906,7 +1204,7 @@ var SelectTrigger = React11__namespace.forwardRef(({ className, children, ...pro
|
|
|
906
1204
|
}
|
|
907
1205
|
));
|
|
908
1206
|
SelectTrigger.displayName = SelectPrimitive__namespace.Trigger.displayName;
|
|
909
|
-
var SelectScrollUpButton =
|
|
1207
|
+
var SelectScrollUpButton = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
910
1208
|
SelectPrimitive__namespace.ScrollUpButton,
|
|
911
1209
|
{
|
|
912
1210
|
ref,
|
|
@@ -919,7 +1217,7 @@ var SelectScrollUpButton = React11__namespace.forwardRef(({ className, ...props
|
|
|
919
1217
|
}
|
|
920
1218
|
));
|
|
921
1219
|
SelectScrollUpButton.displayName = SelectPrimitive__namespace.ScrollUpButton.displayName;
|
|
922
|
-
var SelectScrollDownButton =
|
|
1220
|
+
var SelectScrollDownButton = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
923
1221
|
SelectPrimitive__namespace.ScrollDownButton,
|
|
924
1222
|
{
|
|
925
1223
|
ref,
|
|
@@ -932,7 +1230,7 @@ var SelectScrollDownButton = React11__namespace.forwardRef(({ className, ...prop
|
|
|
932
1230
|
}
|
|
933
1231
|
));
|
|
934
1232
|
SelectScrollDownButton.displayName = SelectPrimitive__namespace.ScrollDownButton.displayName;
|
|
935
|
-
var SelectContent =
|
|
1233
|
+
var SelectContent = React13__namespace.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
936
1234
|
SelectPrimitive__namespace.Content,
|
|
937
1235
|
{
|
|
938
1236
|
ref,
|
|
@@ -960,7 +1258,7 @@ var SelectContent = React11__namespace.forwardRef(({ className, children, positi
|
|
|
960
1258
|
}
|
|
961
1259
|
) }));
|
|
962
1260
|
SelectContent.displayName = SelectPrimitive__namespace.Content.displayName;
|
|
963
|
-
var SelectLabel =
|
|
1261
|
+
var SelectLabel = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
964
1262
|
SelectPrimitive__namespace.Label,
|
|
965
1263
|
{
|
|
966
1264
|
ref,
|
|
@@ -969,7 +1267,7 @@ var SelectLabel = React11__namespace.forwardRef(({ className, ...props }, ref) =
|
|
|
969
1267
|
}
|
|
970
1268
|
));
|
|
971
1269
|
SelectLabel.displayName = SelectPrimitive__namespace.Label.displayName;
|
|
972
|
-
var SelectItem =
|
|
1270
|
+
var SelectItem = React13__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
973
1271
|
SelectPrimitive__namespace.Item,
|
|
974
1272
|
{
|
|
975
1273
|
ref,
|
|
@@ -985,7 +1283,7 @@ var SelectItem = React11__namespace.forwardRef(({ className, children, ...props
|
|
|
985
1283
|
}
|
|
986
1284
|
));
|
|
987
1285
|
SelectItem.displayName = SelectPrimitive__namespace.Item.displayName;
|
|
988
|
-
var SelectSeparator =
|
|
1286
|
+
var SelectSeparator = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
989
1287
|
SelectPrimitive__namespace.Separator,
|
|
990
1288
|
{
|
|
991
1289
|
ref,
|
|
@@ -1032,11 +1330,11 @@ async function fetchOptions(source, params) {
|
|
|
1032
1330
|
}
|
|
1033
1331
|
var SelectWidget = ({ fieldId }) => {
|
|
1034
1332
|
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
1035
|
-
const [options, setOptions] =
|
|
1036
|
-
const [loading, setLoading] =
|
|
1333
|
+
const [options, setOptions] = React13.useState([]);
|
|
1334
|
+
const [loading, setLoading] = React13.useState(false);
|
|
1037
1335
|
const { state } = useForm();
|
|
1038
1336
|
const showError = !!error && (touched || state.submitAttempted);
|
|
1039
|
-
|
|
1337
|
+
React13.useEffect(() => {
|
|
1040
1338
|
if (!fieldDef) return;
|
|
1041
1339
|
const def = fieldDef;
|
|
1042
1340
|
if (def.options) {
|
|
@@ -1074,7 +1372,7 @@ var SelectWidget = ({ fieldId }) => {
|
|
|
1074
1372
|
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
1075
1373
|
] });
|
|
1076
1374
|
};
|
|
1077
|
-
var Checkbox =
|
|
1375
|
+
var Checkbox = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1078
1376
|
CheckboxPrimitive__namespace.Root,
|
|
1079
1377
|
{
|
|
1080
1378
|
ref,
|
|
@@ -1095,12 +1393,12 @@ var Checkbox = React11__namespace.forwardRef(({ className, ...props }, ref) => /
|
|
|
1095
1393
|
Checkbox.displayName = CheckboxPrimitive__namespace.Root.displayName;
|
|
1096
1394
|
var MultiSelectWidget = ({ fieldId }) => {
|
|
1097
1395
|
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
1098
|
-
const [options, setOptions] =
|
|
1099
|
-
const [loading, setLoading] =
|
|
1396
|
+
const [options, setOptions] = React13.useState([]);
|
|
1397
|
+
const [loading, setLoading] = React13.useState(false);
|
|
1100
1398
|
const { state } = useForm();
|
|
1101
1399
|
const showError = !!error && (touched || state.submitAttempted);
|
|
1102
1400
|
const currentValues = Array.isArray(value) ? value : [];
|
|
1103
|
-
|
|
1401
|
+
React13.useEffect(() => {
|
|
1104
1402
|
if (!fieldDef) return;
|
|
1105
1403
|
const def = fieldDef;
|
|
1106
1404
|
if (def.options) {
|
|
@@ -1148,46 +1446,7 @@ var MultiSelectWidget = ({ fieldId }) => {
|
|
|
1148
1446
|
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
1149
1447
|
] });
|
|
1150
1448
|
};
|
|
1151
|
-
var
|
|
1152
|
-
"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",
|
|
1153
|
-
{
|
|
1154
|
-
variants: {
|
|
1155
|
-
variant: {
|
|
1156
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
1157
|
-
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
1158
|
-
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
1159
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
1160
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
1161
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
1162
|
-
},
|
|
1163
|
-
size: {
|
|
1164
|
-
default: "h-10 px-4 py-2",
|
|
1165
|
-
sm: "h-9 rounded-md px-3",
|
|
1166
|
-
lg: "h-11 rounded-md px-8",
|
|
1167
|
-
icon: "h-10 w-10"
|
|
1168
|
-
}
|
|
1169
|
-
},
|
|
1170
|
-
defaultVariants: {
|
|
1171
|
-
variant: "default",
|
|
1172
|
-
size: "default"
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
);
|
|
1176
|
-
var Button = React11__namespace.forwardRef(
|
|
1177
|
-
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
1178
|
-
const Comp = asChild ? reactSlot.Slot : "button";
|
|
1179
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1180
|
-
Comp,
|
|
1181
|
-
{
|
|
1182
|
-
className: cn(buttonVariants({ variant, size, className })),
|
|
1183
|
-
ref,
|
|
1184
|
-
...props
|
|
1185
|
-
}
|
|
1186
|
-
);
|
|
1187
|
-
}
|
|
1188
|
-
);
|
|
1189
|
-
Button.displayName = "Button";
|
|
1190
|
-
var Table = React11__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1449
|
+
var Table = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1191
1450
|
"table",
|
|
1192
1451
|
{
|
|
1193
1452
|
ref,
|
|
@@ -1196,9 +1455,9 @@ var Table = React11__namespace.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
1196
1455
|
}
|
|
1197
1456
|
) }));
|
|
1198
1457
|
Table.displayName = "Table";
|
|
1199
|
-
var TableHeader =
|
|
1458
|
+
var TableHeader = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
|
|
1200
1459
|
TableHeader.displayName = "TableHeader";
|
|
1201
|
-
var TableBody =
|
|
1460
|
+
var TableBody = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1202
1461
|
"tbody",
|
|
1203
1462
|
{
|
|
1204
1463
|
ref,
|
|
@@ -1207,7 +1466,7 @@ var TableBody = React11__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
1207
1466
|
}
|
|
1208
1467
|
));
|
|
1209
1468
|
TableBody.displayName = "TableBody";
|
|
1210
|
-
var TableFooter =
|
|
1469
|
+
var TableFooter = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1211
1470
|
"tfoot",
|
|
1212
1471
|
{
|
|
1213
1472
|
ref,
|
|
@@ -1219,7 +1478,7 @@ var TableFooter = React11__namespace.forwardRef(({ className, ...props }, ref) =
|
|
|
1219
1478
|
}
|
|
1220
1479
|
));
|
|
1221
1480
|
TableFooter.displayName = "TableFooter";
|
|
1222
|
-
var TableRow =
|
|
1481
|
+
var TableRow = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1223
1482
|
"tr",
|
|
1224
1483
|
{
|
|
1225
1484
|
ref,
|
|
@@ -1231,7 +1490,7 @@ var TableRow = React11__namespace.forwardRef(({ className, ...props }, ref) => /
|
|
|
1231
1490
|
}
|
|
1232
1491
|
));
|
|
1233
1492
|
TableRow.displayName = "TableRow";
|
|
1234
|
-
var TableHead =
|
|
1493
|
+
var TableHead = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1235
1494
|
"th",
|
|
1236
1495
|
{
|
|
1237
1496
|
ref,
|
|
@@ -1243,7 +1502,7 @@ var TableHead = React11__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
1243
1502
|
}
|
|
1244
1503
|
));
|
|
1245
1504
|
TableHead.displayName = "TableHead";
|
|
1246
|
-
var TableCell =
|
|
1505
|
+
var TableCell = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1247
1506
|
"td",
|
|
1248
1507
|
{
|
|
1249
1508
|
ref,
|
|
@@ -1252,7 +1511,7 @@ var TableCell = React11__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
1252
1511
|
}
|
|
1253
1512
|
));
|
|
1254
1513
|
TableCell.displayName = "TableCell";
|
|
1255
|
-
var TableCaption =
|
|
1514
|
+
var TableCaption = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1256
1515
|
"caption",
|
|
1257
1516
|
{
|
|
1258
1517
|
ref,
|
|
@@ -1268,7 +1527,7 @@ var RepeatableWidget = ({
|
|
|
1268
1527
|
if (!fieldDef || fieldDef.type !== "repeatable") return null;
|
|
1269
1528
|
const def = fieldDef;
|
|
1270
1529
|
const rows = Array.isArray(value) ? value : [];
|
|
1271
|
-
const [hasInteracted, setHasInteracted] =
|
|
1530
|
+
const [hasInteracted, setHasInteracted] = React13__namespace.default.useState(false);
|
|
1272
1531
|
const showError = !!error && (touched || hasInteracted);
|
|
1273
1532
|
const addRow = () => {
|
|
1274
1533
|
setValue([...rows, {}]);
|
|
@@ -1437,7 +1696,7 @@ function Calendar({
|
|
|
1437
1696
|
Calendar.displayName = "Calendar";
|
|
1438
1697
|
var Popover = PopoverPrimitive__namespace.Root;
|
|
1439
1698
|
var PopoverTrigger = PopoverPrimitive__namespace.Trigger;
|
|
1440
|
-
var PopoverContent =
|
|
1699
|
+
var PopoverContent = React13__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1441
1700
|
PopoverPrimitive__namespace.Content,
|
|
1442
1701
|
{
|
|
1443
1702
|
ref,
|
|
@@ -1516,14 +1775,14 @@ function DateTimePicker({
|
|
|
1516
1775
|
className,
|
|
1517
1776
|
placeholder = "Pick date & time"
|
|
1518
1777
|
}) {
|
|
1519
|
-
const [internalDate, setInternalDate] =
|
|
1520
|
-
const [timeString, setTimeString] =
|
|
1778
|
+
const [internalDate, setInternalDate] = React13__namespace.useState(dateTime);
|
|
1779
|
+
const [timeString, setTimeString] = React13__namespace.useState(() => {
|
|
1521
1780
|
if (!dateTime) return "";
|
|
1522
1781
|
const hours = dateTime.getHours().toString().padStart(2, "0");
|
|
1523
1782
|
const minutes = dateTime.getMinutes().toString().padStart(2, "0");
|
|
1524
1783
|
return `${hours}:${minutes}`;
|
|
1525
1784
|
});
|
|
1526
|
-
|
|
1785
|
+
React13__namespace.useEffect(() => {
|
|
1527
1786
|
setInternalDate(dateTime);
|
|
1528
1787
|
if (!dateTime) {
|
|
1529
1788
|
setTimeString("");
|
|
@@ -1652,9 +1911,9 @@ var ImageUploadWidget = ({ fieldId }) => {
|
|
|
1652
1911
|
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
1653
1912
|
const store = useFormStore();
|
|
1654
1913
|
const { state } = useForm();
|
|
1655
|
-
const [isUploading, setIsUploading] =
|
|
1656
|
-
const [preview, setPreview] =
|
|
1657
|
-
const fileInputRef =
|
|
1914
|
+
const [isUploading, setIsUploading] = React13.useState(false);
|
|
1915
|
+
const [preview, setPreview] = React13.useState(null);
|
|
1916
|
+
const fileInputRef = React13.useRef(null);
|
|
1658
1917
|
const showError = !!error && (touched || state.submitAttempted);
|
|
1659
1918
|
if (!fieldDef) return null;
|
|
1660
1919
|
const uploadHandler = store.getUploadHandler();
|
|
@@ -1667,7 +1926,7 @@ var ImageUploadWidget = ({ fieldId }) => {
|
|
|
1667
1926
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "border-2 border-red-300 rounded-lg p-4 bg-red-50", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-red-600", children: "Upload handler not configured. Please provide an onUpload function in FormProvider config." }) })
|
|
1668
1927
|
] });
|
|
1669
1928
|
}
|
|
1670
|
-
|
|
1929
|
+
React13__namespace.default.useEffect(() => {
|
|
1671
1930
|
if (value && typeof value === "string") {
|
|
1672
1931
|
setPreview(value);
|
|
1673
1932
|
} else {
|
|
@@ -1792,18 +2051,18 @@ var SignatureUploadWidget = ({ fieldId }) => {
|
|
|
1792
2051
|
const { fieldDef, setValue, setTouched, error, disabled, touched, value } = useField(fieldId);
|
|
1793
2052
|
const store = useFormStore();
|
|
1794
2053
|
const { state } = useForm();
|
|
1795
|
-
const canvasRef =
|
|
1796
|
-
const pathRef =
|
|
1797
|
-
const lastPointRef =
|
|
1798
|
-
const lastTimeRef =
|
|
1799
|
-
const lastWidthRef =
|
|
1800
|
-
const [isDrawing, setIsDrawing] =
|
|
1801
|
-
const [hasDrawing, setHasDrawing] =
|
|
1802
|
-
const [isUploading, setIsUploading] =
|
|
1803
|
-
const [isConfirmed, setIsConfirmed] =
|
|
1804
|
-
const [uploadError, setUploadError] =
|
|
1805
|
-
const confirmSignatureRef =
|
|
1806
|
-
|
|
2054
|
+
const canvasRef = React13.useRef(null);
|
|
2055
|
+
const pathRef = React13.useRef("");
|
|
2056
|
+
const lastPointRef = React13.useRef(null);
|
|
2057
|
+
const lastTimeRef = React13.useRef(null);
|
|
2058
|
+
const lastWidthRef = React13.useRef(2);
|
|
2059
|
+
const [isDrawing, setIsDrawing] = React13.useState(false);
|
|
2060
|
+
const [hasDrawing, setHasDrawing] = React13.useState(false);
|
|
2061
|
+
const [isUploading, setIsUploading] = React13.useState(false);
|
|
2062
|
+
const [isConfirmed, setIsConfirmed] = React13.useState(false);
|
|
2063
|
+
const [uploadError, setUploadError] = React13.useState(null);
|
|
2064
|
+
const confirmSignatureRef = React13.useRef(null);
|
|
2065
|
+
React13.useEffect(() => {
|
|
1807
2066
|
if (hasDrawing && !isConfirmed) {
|
|
1808
2067
|
store.registerPreSubmitHandler(fieldId, async () => {
|
|
1809
2068
|
if (confirmSignatureRef.current) {
|
|
@@ -1818,9 +2077,9 @@ var SignatureUploadWidget = ({ fieldId }) => {
|
|
|
1818
2077
|
};
|
|
1819
2078
|
}, [hasDrawing, isConfirmed, fieldId, store]);
|
|
1820
2079
|
const showError = !!error && (touched || state.submitAttempted);
|
|
1821
|
-
const displayUrl =
|
|
2080
|
+
const displayUrl = React13.useMemo(() => extractDisplayUrl(value), [value]);
|
|
1822
2081
|
const showPreview = displayUrl !== null;
|
|
1823
|
-
|
|
2082
|
+
React13.useEffect(() => {
|
|
1824
2083
|
if (showPreview) return;
|
|
1825
2084
|
const canvas = canvasRef.current;
|
|
1826
2085
|
if (!canvas) return;
|
|
@@ -2060,7 +2319,7 @@ var EditableTableWidget = ({
|
|
|
2060
2319
|
const addColumnLabel = def?.addColumnLabel ?? "Add Column";
|
|
2061
2320
|
const newColumnNameHint = def?.newColumnNameHint ?? "New Column Name";
|
|
2062
2321
|
const newColumnNameInputType = def?.newColumnNameInputType ?? "text";
|
|
2063
|
-
const tableData =
|
|
2322
|
+
const tableData = React13.useMemo(() => {
|
|
2064
2323
|
if (value && typeof value === "object" && "columns" in value && "rows" in value) {
|
|
2065
2324
|
return value;
|
|
2066
2325
|
}
|
|
@@ -2075,12 +2334,12 @@ var EditableTableWidget = ({
|
|
|
2075
2334
|
rows: []
|
|
2076
2335
|
};
|
|
2077
2336
|
}, [value, fieldDef]);
|
|
2078
|
-
const dataRef =
|
|
2079
|
-
|
|
2337
|
+
const dataRef = React13.useRef(tableData);
|
|
2338
|
+
React13.useEffect(() => {
|
|
2080
2339
|
dataRef.current = tableData;
|
|
2081
2340
|
}, [tableData]);
|
|
2082
|
-
const [newColumnName, setNewColumnName] =
|
|
2083
|
-
const [newColumnDate, setNewColumnDate] =
|
|
2341
|
+
const [newColumnName, setNewColumnName] = React13.useState("");
|
|
2342
|
+
const [newColumnDate, setNewColumnDate] = React13.useState(void 0);
|
|
2084
2343
|
const updateData = (newData) => {
|
|
2085
2344
|
setValue(newData);
|
|
2086
2345
|
};
|
|
@@ -2148,7 +2407,7 @@ var EditableTableWidget = ({
|
|
|
2148
2407
|
newRows[rowIndex] = { ...newRows[rowIndex], [colId]: val };
|
|
2149
2408
|
updateData({ ...currentData, rows: newRows });
|
|
2150
2409
|
};
|
|
2151
|
-
const columns =
|
|
2410
|
+
const columns = React13.useMemo(() => {
|
|
2152
2411
|
const currentCols = tableData.columns;
|
|
2153
2412
|
const dataCols = currentCols.map((col) => {
|
|
2154
2413
|
const showColumnDelete = !disabled && canDeleteColumn && col.allowDelete !== false;
|
|
@@ -2306,7 +2565,7 @@ var EditableTableWidget = ({
|
|
|
2306
2565
|
] })
|
|
2307
2566
|
] });
|
|
2308
2567
|
};
|
|
2309
|
-
var RadioGroup =
|
|
2568
|
+
var RadioGroup = React13__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
2310
2569
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2311
2570
|
RadioGroupPrimitive__namespace.Root,
|
|
2312
2571
|
{
|
|
@@ -2317,7 +2576,7 @@ var RadioGroup = React11__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
2317
2576
|
);
|
|
2318
2577
|
});
|
|
2319
2578
|
RadioGroup.displayName = RadioGroupPrimitive__namespace.Root.displayName;
|
|
2320
|
-
var RadioGroupItem =
|
|
2579
|
+
var RadioGroupItem = React13__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
2321
2580
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2322
2581
|
RadioGroupPrimitive__namespace.Item,
|
|
2323
2582
|
{
|
|
@@ -2334,11 +2593,11 @@ var RadioGroupItem = React11__namespace.forwardRef(({ className, ...props }, ref
|
|
|
2334
2593
|
RadioGroupItem.displayName = RadioGroupPrimitive__namespace.Item.displayName;
|
|
2335
2594
|
var RadioWidget = ({ fieldId }) => {
|
|
2336
2595
|
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
2337
|
-
const [options, setOptions] =
|
|
2338
|
-
const [loading, setLoading] =
|
|
2596
|
+
const [options, setOptions] = React13.useState([]);
|
|
2597
|
+
const [loading, setLoading] = React13.useState(false);
|
|
2339
2598
|
const { state } = useForm();
|
|
2340
2599
|
const showError = !!error && (touched || state.submitAttempted);
|
|
2341
|
-
|
|
2600
|
+
React13.useEffect(() => {
|
|
2342
2601
|
if (!fieldDef) return;
|
|
2343
2602
|
const def = fieldDef;
|
|
2344
2603
|
if (def.options?.length) {
|
|
@@ -2397,12 +2656,12 @@ function isOptionSelected(selected, optValue) {
|
|
|
2397
2656
|
}
|
|
2398
2657
|
var CheckboxWidget = ({ fieldId }) => {
|
|
2399
2658
|
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
2400
|
-
const [options, setOptions] =
|
|
2401
|
-
const [loading, setLoading] =
|
|
2659
|
+
const [options, setOptions] = React13.useState([]);
|
|
2660
|
+
const [loading, setLoading] = React13.useState(false);
|
|
2402
2661
|
const { state } = useForm();
|
|
2403
2662
|
const showError = !!error && (touched || state.submitAttempted);
|
|
2404
2663
|
const selectedValues = Array.isArray(value) ? value : [];
|
|
2405
|
-
|
|
2664
|
+
React13.useEffect(() => {
|
|
2406
2665
|
if (!fieldDef) return;
|
|
2407
2666
|
const def = fieldDef;
|
|
2408
2667
|
if (def.options?.length) {
|
|
@@ -2457,14 +2716,14 @@ var CheckboxWidget = ({ fieldId }) => {
|
|
|
2457
2716
|
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
2458
2717
|
] });
|
|
2459
2718
|
};
|
|
2460
|
-
var AISuggestionsContext =
|
|
2719
|
+
var AISuggestionsContext = React13.createContext({});
|
|
2461
2720
|
function useAISuggestions() {
|
|
2462
|
-
return
|
|
2721
|
+
return React13.useContext(AISuggestionsContext);
|
|
2463
2722
|
}
|
|
2464
2723
|
var AISuggestionsProvider = AISuggestionsContext.Provider;
|
|
2465
2724
|
var Dialog = DialogPrimitive__namespace.Root;
|
|
2466
2725
|
var DialogPortal = DialogPrimitive__namespace.Portal;
|
|
2467
|
-
var DialogOverlay =
|
|
2726
|
+
var DialogOverlay = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2468
2727
|
DialogPrimitive__namespace.Overlay,
|
|
2469
2728
|
{
|
|
2470
2729
|
ref,
|
|
@@ -2476,7 +2735,7 @@ var DialogOverlay = React11__namespace.forwardRef(({ className, ...props }, ref)
|
|
|
2476
2735
|
}
|
|
2477
2736
|
));
|
|
2478
2737
|
DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
|
|
2479
|
-
var DialogContent =
|
|
2738
|
+
var DialogContent = React13__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
|
|
2480
2739
|
/* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
|
|
2481
2740
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2482
2741
|
DialogPrimitive__namespace.Content,
|
|
@@ -2512,7 +2771,7 @@ var DialogHeader = ({
|
|
|
2512
2771
|
}
|
|
2513
2772
|
);
|
|
2514
2773
|
DialogHeader.displayName = "DialogHeader";
|
|
2515
|
-
var DialogTitle =
|
|
2774
|
+
var DialogTitle = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2516
2775
|
DialogPrimitive__namespace.Title,
|
|
2517
2776
|
{
|
|
2518
2777
|
ref,
|
|
@@ -2524,7 +2783,7 @@ var DialogTitle = React11__namespace.forwardRef(({ className, ...props }, ref) =
|
|
|
2524
2783
|
}
|
|
2525
2784
|
));
|
|
2526
2785
|
DialogTitle.displayName = DialogPrimitive__namespace.Title.displayName;
|
|
2527
|
-
var DialogDescription =
|
|
2786
|
+
var DialogDescription = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2528
2787
|
DialogPrimitive__namespace.Description,
|
|
2529
2788
|
{
|
|
2530
2789
|
ref,
|
|
@@ -2668,7 +2927,7 @@ function MedicationCard({
|
|
|
2668
2927
|
onUpdate,
|
|
2669
2928
|
onRemove
|
|
2670
2929
|
}) {
|
|
2671
|
-
const [notesOpen, setNotesOpen] =
|
|
2930
|
+
const [notesOpen, setNotesOpen] = React13.useState(false);
|
|
2672
2931
|
function set(key, val) {
|
|
2673
2932
|
onUpdate({ ...med, [key]: val });
|
|
2674
2933
|
}
|
|
@@ -2832,19 +3091,19 @@ var AddMedicationField = ({
|
|
|
2832
3091
|
frequentItems = [],
|
|
2833
3092
|
suggestedMedications = []
|
|
2834
3093
|
}) => {
|
|
2835
|
-
const [open, setOpen] =
|
|
2836
|
-
const [query, setQuery] =
|
|
2837
|
-
const [results, setResults] =
|
|
2838
|
-
const [loading, setLoading] =
|
|
2839
|
-
const [addingResultId, setAddingResultId] =
|
|
2840
|
-
const debounceRef =
|
|
2841
|
-
const customIdRef =
|
|
2842
|
-
const valueRef =
|
|
2843
|
-
const searchInputRef =
|
|
3094
|
+
const [open, setOpen] = React13.useState(false);
|
|
3095
|
+
const [query, setQuery] = React13.useState("");
|
|
3096
|
+
const [results, setResults] = React13.useState([]);
|
|
3097
|
+
const [loading, setLoading] = React13.useState(false);
|
|
3098
|
+
const [addingResultId, setAddingResultId] = React13.useState(null);
|
|
3099
|
+
const debounceRef = React13.useRef(null);
|
|
3100
|
+
const customIdRef = React13.useRef(-1);
|
|
3101
|
+
const valueRef = React13.useRef([]);
|
|
3102
|
+
const searchInputRef = React13.useRef(null);
|
|
2844
3103
|
const safeValue = Array.isArray(value) ? value : [];
|
|
2845
3104
|
valueRef.current = safeValue;
|
|
2846
3105
|
const addedIds = new Set(safeValue.map((m) => String(m.id)));
|
|
2847
|
-
|
|
3106
|
+
React13.useEffect(() => {
|
|
2848
3107
|
if (!open) {
|
|
2849
3108
|
setQuery("");
|
|
2850
3109
|
setResults([]);
|
|
@@ -3072,18 +3331,18 @@ var AddInvestigationField = ({
|
|
|
3072
3331
|
recentlyUsed = [],
|
|
3073
3332
|
frequentItems = []
|
|
3074
3333
|
}) => {
|
|
3075
|
-
const [open, setOpen] =
|
|
3076
|
-
const [query, setQuery] =
|
|
3077
|
-
const [results, setResults] =
|
|
3078
|
-
const [loading, setLoading] =
|
|
3079
|
-
const [addingId, setAddingId] =
|
|
3080
|
-
const [addingFrequentId, setAddingFrequentId] =
|
|
3081
|
-
const debounceRef =
|
|
3082
|
-
const valueRef =
|
|
3083
|
-
const searchInputRef =
|
|
3334
|
+
const [open, setOpen] = React13.useState(false);
|
|
3335
|
+
const [query, setQuery] = React13.useState("");
|
|
3336
|
+
const [results, setResults] = React13.useState([]);
|
|
3337
|
+
const [loading, setLoading] = React13.useState(false);
|
|
3338
|
+
const [addingId, setAddingId] = React13.useState(null);
|
|
3339
|
+
const [addingFrequentId, setAddingFrequentId] = React13.useState(null);
|
|
3340
|
+
const debounceRef = React13.useRef(null);
|
|
3341
|
+
const valueRef = React13.useRef([]);
|
|
3342
|
+
const searchInputRef = React13.useRef(null);
|
|
3084
3343
|
valueRef.current = value;
|
|
3085
3344
|
const addedIds = new Set(value.map((inv) => inv.id));
|
|
3086
|
-
|
|
3345
|
+
React13.useEffect(() => {
|
|
3087
3346
|
if (!open) {
|
|
3088
3347
|
setQuery("");
|
|
3089
3348
|
setResults([]);
|
|
@@ -3305,18 +3564,18 @@ var AddProcedureField = ({
|
|
|
3305
3564
|
recentlyUsed = [],
|
|
3306
3565
|
frequentItems = []
|
|
3307
3566
|
}) => {
|
|
3308
|
-
const [open, setOpen] =
|
|
3309
|
-
const [query, setQuery] =
|
|
3310
|
-
const [results, setResults] =
|
|
3311
|
-
const [loading, setLoading] =
|
|
3312
|
-
const [addingId, setAddingId] =
|
|
3313
|
-
const [addingFrequentId, setAddingFrequentId] =
|
|
3314
|
-
const debounceRef =
|
|
3315
|
-
const valueRef =
|
|
3316
|
-
const searchInputRef =
|
|
3567
|
+
const [open, setOpen] = React13.useState(false);
|
|
3568
|
+
const [query, setQuery] = React13.useState("");
|
|
3569
|
+
const [results, setResults] = React13.useState([]);
|
|
3570
|
+
const [loading, setLoading] = React13.useState(false);
|
|
3571
|
+
const [addingId, setAddingId] = React13.useState(null);
|
|
3572
|
+
const [addingFrequentId, setAddingFrequentId] = React13.useState(null);
|
|
3573
|
+
const debounceRef = React13.useRef(null);
|
|
3574
|
+
const valueRef = React13.useRef([]);
|
|
3575
|
+
const searchInputRef = React13.useRef(null);
|
|
3317
3576
|
valueRef.current = value;
|
|
3318
3577
|
const addedIds = new Set(value.map((proc) => proc.id));
|
|
3319
|
-
|
|
3578
|
+
React13.useEffect(() => {
|
|
3320
3579
|
if (!open) {
|
|
3321
3580
|
setQuery("");
|
|
3322
3581
|
setResults([]);
|
|
@@ -3534,7 +3793,7 @@ function getStatusBasedClass(status) {
|
|
|
3534
3793
|
}
|
|
3535
3794
|
}
|
|
3536
3795
|
function DiagnosisCard({ item, defaultOpen = false }) {
|
|
3537
|
-
const [open, setOpen] =
|
|
3796
|
+
const [open, setOpen] = React13.useState(defaultOpen);
|
|
3538
3797
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border border-gray-200 rounded-lg bg-[#F2F2F2] mb-2 last:mb-0 overflow-hidden", children: [
|
|
3539
3798
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3540
3799
|
"button",
|
|
@@ -3619,7 +3878,7 @@ var DifferentialDiagnosisWidget = ({ fieldId }) => {
|
|
|
3619
3878
|
const items = Array.isArray(value) ? value : [];
|
|
3620
3879
|
return /* @__PURE__ */ jsxRuntime.jsx(DifferentialDiagnosis, { differentialDiagnosis: items });
|
|
3621
3880
|
};
|
|
3622
|
-
var Spinner2 =
|
|
3881
|
+
var Spinner2 = React13__namespace.forwardRef(
|
|
3623
3882
|
({ className, size = "md", ...props }, ref) => {
|
|
3624
3883
|
const sizeClasses = {
|
|
3625
3884
|
sm: "h-4 w-4 border-2",
|
|
@@ -3764,10 +4023,10 @@ var Vitals = ({
|
|
|
3764
4023
|
var VitalsWidget = ({ fieldId }) => {
|
|
3765
4024
|
const { value, setValue, fieldDef } = useField(fieldId);
|
|
3766
4025
|
const handlers = useFieldHandlers(fieldId);
|
|
3767
|
-
const [loading, setLoading] =
|
|
3768
|
-
const [error, setError] =
|
|
4026
|
+
const [loading, setLoading] = React13.useState(false);
|
|
4027
|
+
const [error, setError] = React13.useState(null);
|
|
3769
4028
|
console.log("[VitalsWidget] fieldId:", fieldId, "| onFetch present:", !!handlers.onFetch, "| value:", value);
|
|
3770
|
-
const fetchVitals =
|
|
4029
|
+
const fetchVitals = React13.useCallback(async () => {
|
|
3771
4030
|
if (!handlers.onFetch) return;
|
|
3772
4031
|
setLoading(true);
|
|
3773
4032
|
setError(null);
|
|
@@ -3781,7 +4040,7 @@ var VitalsWidget = ({ fieldId }) => {
|
|
|
3781
4040
|
setLoading(false);
|
|
3782
4041
|
}
|
|
3783
4042
|
}, [handlers, setValue]);
|
|
3784
|
-
|
|
4043
|
+
React13.useEffect(() => {
|
|
3785
4044
|
fetchVitals();
|
|
3786
4045
|
}, []);
|
|
3787
4046
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3850,15 +4109,15 @@ function normalizeValue(value) {
|
|
|
3850
4109
|
var ReferralWidget = ({ fieldId }) => {
|
|
3851
4110
|
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
3852
4111
|
const handlers = useFieldHandlers(fieldId);
|
|
3853
|
-
const [options, setOptions] =
|
|
3854
|
-
const [loading, setLoading] =
|
|
4112
|
+
const [options, setOptions] = React13.useState([]);
|
|
4113
|
+
const [loading, setLoading] = React13.useState(false);
|
|
3855
4114
|
const { state } = useForm();
|
|
3856
4115
|
const showError = !!error && (touched || state.submitAttempted);
|
|
3857
4116
|
const selectedItems = normalizeValue(value);
|
|
3858
4117
|
const availableOptions = options.filter(
|
|
3859
4118
|
(opt) => !selectedItems.some((item) => item.specialization === opt.value)
|
|
3860
4119
|
);
|
|
3861
|
-
const loadOptions =
|
|
4120
|
+
const loadOptions = React13.useCallback(async () => {
|
|
3862
4121
|
if (handlers.onFetchOptions) {
|
|
3863
4122
|
setLoading(true);
|
|
3864
4123
|
try {
|
|
@@ -3879,11 +4138,11 @@ var ReferralWidget = ({ fieldId }) => {
|
|
|
3879
4138
|
setOptions([]);
|
|
3880
4139
|
}
|
|
3881
4140
|
}, [fieldDef, handlers]);
|
|
3882
|
-
|
|
4141
|
+
React13.useEffect(() => {
|
|
3883
4142
|
if (!fieldDef) return;
|
|
3884
4143
|
loadOptions();
|
|
3885
4144
|
}, [fieldDef, loadOptions]);
|
|
3886
|
-
const handleAdd =
|
|
4145
|
+
const handleAdd = React13.useCallback(
|
|
3887
4146
|
(specialization) => {
|
|
3888
4147
|
const next = [...selectedItems, { specialization, is_urgent: false }];
|
|
3889
4148
|
setValue(next);
|
|
@@ -3891,7 +4150,7 @@ var ReferralWidget = ({ fieldId }) => {
|
|
|
3891
4150
|
},
|
|
3892
4151
|
[selectedItems, setValue, setTouched]
|
|
3893
4152
|
);
|
|
3894
|
-
const handleRemove =
|
|
4153
|
+
const handleRemove = React13.useCallback(
|
|
3895
4154
|
(specialization) => {
|
|
3896
4155
|
const next = selectedItems.filter((item) => item.specialization !== specialization);
|
|
3897
4156
|
setValue(next);
|
|
@@ -3899,7 +4158,7 @@ var ReferralWidget = ({ fieldId }) => {
|
|
|
3899
4158
|
},
|
|
3900
4159
|
[selectedItems, setValue, setTouched]
|
|
3901
4160
|
);
|
|
3902
|
-
const handleToggleUrgent =
|
|
4161
|
+
const handleToggleUrgent = React13.useCallback(
|
|
3903
4162
|
(specialization) => {
|
|
3904
4163
|
const next = selectedItems.map(
|
|
3905
4164
|
(item) => item.specialization === specialization ? { ...item, is_urgent: !item.is_urgent } : item
|
|
@@ -3975,7 +4234,7 @@ var ReferralWidget = ({ fieldId }) => {
|
|
|
3975
4234
|
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
3976
4235
|
] });
|
|
3977
4236
|
};
|
|
3978
|
-
var Card =
|
|
4237
|
+
var Card = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3979
4238
|
"div",
|
|
3980
4239
|
{
|
|
3981
4240
|
ref,
|
|
@@ -3987,7 +4246,7 @@ var Card = React11__namespace.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
3987
4246
|
}
|
|
3988
4247
|
));
|
|
3989
4248
|
Card.displayName = "Card";
|
|
3990
|
-
var CardHeader =
|
|
4249
|
+
var CardHeader = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3991
4250
|
"div",
|
|
3992
4251
|
{
|
|
3993
4252
|
ref,
|
|
@@ -3996,7 +4255,7 @@ var CardHeader = React11__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
3996
4255
|
}
|
|
3997
4256
|
));
|
|
3998
4257
|
CardHeader.displayName = "CardHeader";
|
|
3999
|
-
var CardTitle =
|
|
4258
|
+
var CardTitle = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4000
4259
|
"h3",
|
|
4001
4260
|
{
|
|
4002
4261
|
ref,
|
|
@@ -4008,7 +4267,7 @@ var CardTitle = React11__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
4008
4267
|
}
|
|
4009
4268
|
));
|
|
4010
4269
|
CardTitle.displayName = "CardTitle";
|
|
4011
|
-
var CardDescription =
|
|
4270
|
+
var CardDescription = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4012
4271
|
"p",
|
|
4013
4272
|
{
|
|
4014
4273
|
ref,
|
|
@@ -4017,9 +4276,9 @@ var CardDescription = React11__namespace.forwardRef(({ className, ...props }, re
|
|
|
4017
4276
|
}
|
|
4018
4277
|
));
|
|
4019
4278
|
CardDescription.displayName = "CardDescription";
|
|
4020
|
-
var CardContent =
|
|
4279
|
+
var CardContent = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
|
|
4021
4280
|
CardContent.displayName = "CardContent";
|
|
4022
|
-
var CardFooter =
|
|
4281
|
+
var CardFooter = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4023
4282
|
"div",
|
|
4024
4283
|
{
|
|
4025
4284
|
ref,
|
|
@@ -4105,11 +4364,11 @@ function parseLocalDate(dateString) {
|
|
|
4105
4364
|
var FollowupWidget = ({ fieldId }) => {
|
|
4106
4365
|
const { fieldDef, value, setValue, setTouched, error, disabled, visible } = useField(fieldId);
|
|
4107
4366
|
const followup = normalizeFollowup(value);
|
|
4108
|
-
const [calendarOpen, setCalendarOpen] =
|
|
4367
|
+
const [calendarOpen, setCalendarOpen] = React13.useState(false);
|
|
4109
4368
|
const currentFollowupType = followup ? followup.followupType : "no followup";
|
|
4110
4369
|
const hasFollowup = followup !== false;
|
|
4111
|
-
const [displayMode, setDisplayMode] =
|
|
4112
|
-
const [displayUnit, setDisplayUnit] =
|
|
4370
|
+
const [displayMode, setDisplayMode] = React13.useState("duration");
|
|
4371
|
+
const [displayUnit, setDisplayUnit] = React13.useState("days");
|
|
4113
4372
|
const daysNum = hasFollowup ? parseInt(followup.value, 10) || 7 : 7;
|
|
4114
4373
|
const currentDate = hasFollowup ? daysToDate(daysNum) : null;
|
|
4115
4374
|
const followupMode = displayMode;
|
|
@@ -4117,7 +4376,7 @@ var FollowupWidget = ({ fieldId }) => {
|
|
|
4117
4376
|
displayUnit === "weeks" ? Math.round(daysNum / 7) || 1 : Math.round(daysNum / 30) || 1
|
|
4118
4377
|
) : "7";
|
|
4119
4378
|
const currentUnit = displayUnit;
|
|
4120
|
-
const handleFollowupTypeChange =
|
|
4379
|
+
const handleFollowupTypeChange = React13.useCallback(
|
|
4121
4380
|
(newType) => {
|
|
4122
4381
|
setTouched();
|
|
4123
4382
|
if (newType === "no followup") {
|
|
@@ -4133,11 +4392,11 @@ var FollowupWidget = ({ fieldId }) => {
|
|
|
4133
4392
|
},
|
|
4134
4393
|
[followup, hasFollowup, setValue, setTouched]
|
|
4135
4394
|
);
|
|
4136
|
-
const handleModeChange =
|
|
4395
|
+
const handleModeChange = React13.useCallback((newMode) => {
|
|
4137
4396
|
setDisplayMode(newMode);
|
|
4138
4397
|
if (newMode === "date") setCalendarOpen(false);
|
|
4139
4398
|
}, []);
|
|
4140
|
-
const handleValueChange =
|
|
4399
|
+
const handleValueChange = React13.useCallback(
|
|
4141
4400
|
(newValue) => {
|
|
4142
4401
|
setTouched();
|
|
4143
4402
|
const num = parseInt(newValue, 10);
|
|
@@ -4152,10 +4411,10 @@ var FollowupWidget = ({ fieldId }) => {
|
|
|
4152
4411
|
},
|
|
4153
4412
|
[displayUnit, setValue, setTouched]
|
|
4154
4413
|
);
|
|
4155
|
-
const handleUnitChange =
|
|
4414
|
+
const handleUnitChange = React13.useCallback((newUnit) => {
|
|
4156
4415
|
setDisplayUnit(newUnit);
|
|
4157
4416
|
}, []);
|
|
4158
|
-
const handleDateSelect =
|
|
4417
|
+
const handleDateSelect = React13.useCallback(
|
|
4159
4418
|
(selected) => {
|
|
4160
4419
|
setTouched();
|
|
4161
4420
|
setCalendarOpen(false);
|
|
@@ -4288,13 +4547,13 @@ function useSmartKeywords(text, onSearch, debounceDelay = 1e3) {
|
|
|
4288
4547
|
hasOnSearch: typeof onSearch === "function",
|
|
4289
4548
|
debounceDelay
|
|
4290
4549
|
});
|
|
4291
|
-
const [extractedNouns, setExtractedNouns] =
|
|
4292
|
-
const [matchedConditions, setMatchedConditions] =
|
|
4293
|
-
const [isProcessing, setIsProcessing] =
|
|
4294
|
-
const [error, setError] =
|
|
4295
|
-
const timerRef =
|
|
4296
|
-
const abortRef =
|
|
4297
|
-
const processText =
|
|
4550
|
+
const [extractedNouns, setExtractedNouns] = React13.useState([]);
|
|
4551
|
+
const [matchedConditions, setMatchedConditions] = React13.useState([]);
|
|
4552
|
+
const [isProcessing, setIsProcessing] = React13.useState(false);
|
|
4553
|
+
const [error, setError] = React13.useState(null);
|
|
4554
|
+
const timerRef = React13.useRef(null);
|
|
4555
|
+
const abortRef = React13.useRef(0);
|
|
4556
|
+
const processText = React13.useCallback(
|
|
4298
4557
|
async (input, runId) => {
|
|
4299
4558
|
if (!input || input.trim().length === 0) {
|
|
4300
4559
|
console.log("[useSmartKeywords] skip empty input", {
|
|
@@ -4378,7 +4637,7 @@ function useSmartKeywords(text, onSearch, debounceDelay = 1e3) {
|
|
|
4378
4637
|
},
|
|
4379
4638
|
[onSearch]
|
|
4380
4639
|
);
|
|
4381
|
-
|
|
4640
|
+
React13.useEffect(() => {
|
|
4382
4641
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
4383
4642
|
const runId = ++abortRef.current;
|
|
4384
4643
|
console.log("[useSmartKeywords] schedule debounce", {
|
|
@@ -4415,7 +4674,7 @@ var SmartTextareaWidget = ({ fieldId }) => {
|
|
|
4415
4674
|
const structured = value;
|
|
4416
4675
|
const textValue = structured?.text ?? "";
|
|
4417
4676
|
const showError = !!error && (touched || state.submitAttempted);
|
|
4418
|
-
const onSearch =
|
|
4677
|
+
const onSearch = React13.useCallback(
|
|
4419
4678
|
(query) => handler.onSearch(query),
|
|
4420
4679
|
[handler]
|
|
4421
4680
|
);
|
|
@@ -4425,7 +4684,7 @@ var SmartTextareaWidget = ({ fieldId }) => {
|
|
|
4425
4684
|
def?.debounceDelay ?? 1e3
|
|
4426
4685
|
);
|
|
4427
4686
|
const currentKeywords = structured?.extractedKeywords ?? [];
|
|
4428
|
-
const nextKeywords =
|
|
4687
|
+
const nextKeywords = React13.useMemo(() => {
|
|
4429
4688
|
if (matchedConditions.length === 0 && currentKeywords.length === 0) return currentKeywords;
|
|
4430
4689
|
if (matchedConditions.length === currentKeywords.length && matchedConditions.every(
|
|
4431
4690
|
(m, i) => m.matchedCondition.id === currentKeywords[i]?.matchedCondition.id && m.extractedKeyword === currentKeywords[i]?.extractedKeyword
|
|
@@ -4434,19 +4693,19 @@ var SmartTextareaWidget = ({ fieldId }) => {
|
|
|
4434
4693
|
}
|
|
4435
4694
|
return matchedConditions;
|
|
4436
4695
|
}, [matchedConditions, currentKeywords]);
|
|
4437
|
-
const writeValue =
|
|
4696
|
+
const writeValue = React13.useCallback(
|
|
4438
4697
|
(text, keywords) => {
|
|
4439
4698
|
const next = { text, extractedKeywords: keywords };
|
|
4440
4699
|
setValue(next);
|
|
4441
4700
|
},
|
|
4442
4701
|
[setValue]
|
|
4443
4702
|
);
|
|
4444
|
-
|
|
4703
|
+
React13__namespace.default.useEffect(() => {
|
|
4445
4704
|
if (nextKeywords !== currentKeywords) {
|
|
4446
4705
|
writeValue(textValue, nextKeywords);
|
|
4447
4706
|
}
|
|
4448
4707
|
}, [nextKeywords]);
|
|
4449
|
-
const handleTextChange =
|
|
4708
|
+
const handleTextChange = React13.useCallback(
|
|
4450
4709
|
(e) => {
|
|
4451
4710
|
writeValue(e.target.value, currentKeywords);
|
|
4452
4711
|
},
|
|
@@ -4688,10 +4947,10 @@ function stripGpalSuffix(label) {
|
|
|
4688
4947
|
return label.replace(/\s*\(G-P-A-L\)\s*$/i, "").trim();
|
|
4689
4948
|
}
|
|
4690
4949
|
function useDebouncedCommit(commit, delayMs) {
|
|
4691
|
-
const timeoutRef =
|
|
4692
|
-
const latestCommit =
|
|
4950
|
+
const timeoutRef = React13.useRef(null);
|
|
4951
|
+
const latestCommit = React13.useRef(commit);
|
|
4693
4952
|
latestCommit.current = commit;
|
|
4694
|
-
|
|
4953
|
+
React13.useEffect(() => {
|
|
4695
4954
|
return () => {
|
|
4696
4955
|
if (timeoutRef.current != null) window.clearTimeout(timeoutRef.current);
|
|
4697
4956
|
};
|
|
@@ -4703,18 +4962,18 @@ function useDebouncedCommit(commit, delayMs) {
|
|
|
4703
4962
|
}
|
|
4704
4963
|
var ObstetricHistoryWidget = ({ fieldId }) => {
|
|
4705
4964
|
const { fieldDef, value, setValue, disabled } = useField(fieldId);
|
|
4706
|
-
const [{ draft, isNewEntry }, setDraftState] =
|
|
4707
|
-
const [lmpError, setLmpError] =
|
|
4708
|
-
const [primaryEddError, setPrimaryEddError] =
|
|
4709
|
-
const [activeGpalKey, setActiveGpalKey] =
|
|
4965
|
+
const [{ draft, isNewEntry }, setDraftState] = React13.useState(() => normalizeToDraft(value));
|
|
4966
|
+
const [lmpError, setLmpError] = React13.useState(null);
|
|
4967
|
+
const [primaryEddError, setPrimaryEddError] = React13.useState(null);
|
|
4968
|
+
const [activeGpalKey, setActiveGpalKey] = React13.useState(null);
|
|
4710
4969
|
const refs = {
|
|
4711
|
-
G:
|
|
4712
|
-
P:
|
|
4713
|
-
A:
|
|
4714
|
-
L:
|
|
4970
|
+
G: React13.useRef(null),
|
|
4971
|
+
P: React13.useRef(null),
|
|
4972
|
+
A: React13.useRef(null),
|
|
4973
|
+
L: React13.useRef(null)
|
|
4715
4974
|
};
|
|
4716
|
-
const today =
|
|
4717
|
-
|
|
4975
|
+
const today = React13.useMemo(() => todayIso(), []);
|
|
4976
|
+
React13.useEffect(() => {
|
|
4718
4977
|
const next = normalizeToDraft(value);
|
|
4719
4978
|
const currStr = JSON.stringify(buildStored(draft, today));
|
|
4720
4979
|
const nextStr = JSON.stringify(buildStored(next.draft, today));
|
|
@@ -4725,7 +4984,7 @@ var ObstetricHistoryWidget = ({ fieldId }) => {
|
|
|
4725
4984
|
setValue(JSON.stringify(stored));
|
|
4726
4985
|
};
|
|
4727
4986
|
const commitDebounced = useDebouncedCommit(commitImmediate, 500);
|
|
4728
|
-
const storedComputed =
|
|
4987
|
+
const storedComputed = React13.useMemo(() => buildStored(draft, today), [draft, today]);
|
|
4729
4988
|
const rightPanelEnabled = draft.is_pregnant && (!!storedComputed.lmp || !!storedComputed.edd?.usg);
|
|
4730
4989
|
const headerLabel = fieldDef?.label ? stripGpalSuffix(fieldDef.label) : "Obstetric History";
|
|
4731
4990
|
const setDraft = (updater, persist) => {
|
|
@@ -5174,7 +5433,7 @@ var numberInputClass = "w-full border border-[#D0D0D0] rounded-md bg-white px-2
|
|
|
5174
5433
|
var textInputClass = "w-full border border-[#D0D0D0] rounded-md bg-white px-2 py-1 text-xs focus-visible:outline-none focus-visible:ring-0";
|
|
5175
5434
|
var OphthalmologyWidget = ({ fieldId }) => {
|
|
5176
5435
|
const { fieldDef, value, setValue, disabled } = useField(fieldId);
|
|
5177
|
-
const safe =
|
|
5436
|
+
const safe = React13.useMemo(() => ensureValue(value), [value]);
|
|
5178
5437
|
const label = fieldDef?.label || "";
|
|
5179
5438
|
const update = (updater) => {
|
|
5180
5439
|
if (disabled) return;
|
|
@@ -6351,7 +6610,7 @@ var headerCellClass = "border border-slate-200 px-2 py-1 text-center font-semibo
|
|
|
6351
6610
|
var cellClass = "border border-slate-200 px-2 py-1 align-top";
|
|
6352
6611
|
var OphthalDiagnosisWidget = ({ fieldId }) => {
|
|
6353
6612
|
const { fieldDef, value, setValue, disabled } = useField(fieldId);
|
|
6354
|
-
const safe =
|
|
6613
|
+
const safe = React13.useMemo(() => ensureValue2(value), [value]);
|
|
6355
6614
|
const label = fieldDef?.label || "";
|
|
6356
6615
|
const updateEyeField = (eye, fieldLabel, next) => {
|
|
6357
6616
|
if (disabled) return;
|
|
@@ -6401,7 +6660,7 @@ var OphthalDiagnosisWidget = ({ fieldId }) => {
|
|
|
6401
6660
|
] })
|
|
6402
6661
|
] });
|
|
6403
6662
|
};
|
|
6404
|
-
var Slider =
|
|
6663
|
+
var Slider = React13__namespace.forwardRef(({ className, trackClassName, thumbClassName, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6405
6664
|
SliderPrimitive__namespace.Root,
|
|
6406
6665
|
{
|
|
6407
6666
|
ref,
|
|
@@ -6495,7 +6754,7 @@ var OrthopedicExamWidget = ({ fieldId }) => {
|
|
|
6495
6754
|
const { fieldDef, value, setValue, setTouched, error, touched, disabled } = useField(fieldId);
|
|
6496
6755
|
const { state } = useForm();
|
|
6497
6756
|
const showError = !!error && (touched || state.submitAttempted);
|
|
6498
|
-
const safeValue =
|
|
6757
|
+
const safeValue = React13.useMemo(() => {
|
|
6499
6758
|
if (!value || typeof value !== "object") return defaultValue();
|
|
6500
6759
|
const v = value;
|
|
6501
6760
|
const concerns = Array.isArray(v.concerns) ? v.concerns : [];
|
|
@@ -6517,10 +6776,10 @@ var OrthopedicExamWidget = ({ fieldId }) => {
|
|
|
6517
6776
|
}
|
|
6518
6777
|
};
|
|
6519
6778
|
}, [value]);
|
|
6520
|
-
const [panelOpen, setPanelOpen] =
|
|
6521
|
-
const draggingRef =
|
|
6522
|
-
const prevConcernsLengthRef =
|
|
6523
|
-
const reminderSections =
|
|
6779
|
+
const [panelOpen, setPanelOpen] = React13.useState(false);
|
|
6780
|
+
const draggingRef = React13.useRef(null);
|
|
6781
|
+
const prevConcernsLengthRef = React13.useRef(safeValue.concerns.length);
|
|
6782
|
+
const reminderSections = React13.useMemo(() => {
|
|
6524
6783
|
return safeValue.concerns.map((id) => ({
|
|
6525
6784
|
id,
|
|
6526
6785
|
label: CONCERNS.find((c) => c.id === id)?.label ?? id,
|
|
@@ -6528,7 +6787,7 @@ var OrthopedicExamWidget = ({ fieldId }) => {
|
|
|
6528
6787
|
})).filter((s) => s.points.length > 0);
|
|
6529
6788
|
}, [safeValue.concerns]);
|
|
6530
6789
|
const hasReminders = reminderSections.length > 0;
|
|
6531
|
-
|
|
6790
|
+
React13.useEffect(() => {
|
|
6532
6791
|
const prevLen = prevConcernsLengthRef.current;
|
|
6533
6792
|
const currLen = safeValue.concerns.length;
|
|
6534
6793
|
prevConcernsLengthRef.current = currLen;
|
|
@@ -6543,7 +6802,7 @@ var OrthopedicExamWidget = ({ fieldId }) => {
|
|
|
6543
6802
|
setPanelOpen(true);
|
|
6544
6803
|
}
|
|
6545
6804
|
}, [safeValue, setValue]);
|
|
6546
|
-
|
|
6805
|
+
React13.useEffect(() => {
|
|
6547
6806
|
const onMove = (e) => {
|
|
6548
6807
|
if (!draggingRef.current) return;
|
|
6549
6808
|
const { startX, startY, startTop, startRight } = draggingRef.current;
|
|
@@ -6794,8 +7053,9 @@ var FieldRenderer = ({ fieldId }) => {
|
|
|
6794
7053
|
case "number":
|
|
6795
7054
|
return /* @__PURE__ */ jsxRuntime.jsx(TextWidget, { fieldId });
|
|
6796
7055
|
case "textarea":
|
|
6797
|
-
case "richtext":
|
|
6798
7056
|
return /* @__PURE__ */ jsxRuntime.jsx(TextWidget, { fieldId });
|
|
7057
|
+
case "richtext":
|
|
7058
|
+
return /* @__PURE__ */ jsxRuntime.jsx(RichTextWidget, { fieldId });
|
|
6799
7059
|
case "date":
|
|
6800
7060
|
return /* @__PURE__ */ jsxRuntime.jsx(DateWidget, { fieldId });
|
|
6801
7061
|
case "datetime":
|
|
@@ -6860,7 +7120,7 @@ var FieldRenderer = ({ fieldId }) => {
|
|
|
6860
7120
|
}
|
|
6861
7121
|
};
|
|
6862
7122
|
var Section = ({ title, children }) => {
|
|
6863
|
-
const [expanded, setExpanded] =
|
|
7123
|
+
const [expanded, setExpanded] = React13.useState(true);
|
|
6864
7124
|
const handleToggle = () => setExpanded((prev) => !prev);
|
|
6865
7125
|
const contentClassName = cn(
|
|
6866
7126
|
"overflow-hidden transition-[height] duration-200 ease-in-out",
|
|
@@ -6913,7 +7173,7 @@ var DynamicForm = () => {
|
|
|
6913
7173
|
children: child.children.map((fieldId) => /* @__PURE__ */ jsxRuntime.jsx(FieldRenderer, { fieldId }, fieldId))
|
|
6914
7174
|
},
|
|
6915
7175
|
child.id
|
|
6916
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
7176
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(React13__namespace.default.Fragment, {}, child.id ?? index)
|
|
6917
7177
|
) }, node.id);
|
|
6918
7178
|
}
|
|
6919
7179
|
if (node.type === "column_layout") {
|
|
@@ -7001,13 +7261,13 @@ var SmartForm = ({
|
|
|
7001
7261
|
}) => {
|
|
7002
7262
|
const store = useFormStore();
|
|
7003
7263
|
const schema = store.getSchema();
|
|
7004
|
-
const prevAiResultRef =
|
|
7005
|
-
const aiSuggestions =
|
|
7264
|
+
const prevAiResultRef = React13.useRef(void 0);
|
|
7265
|
+
const aiSuggestions = React13.useMemo(() => {
|
|
7006
7266
|
if (aiAnalysisResult == null) return { medications: [] };
|
|
7007
7267
|
const medications = normalizeAIMedications(aiAnalysisResult.medications);
|
|
7008
7268
|
return { medications };
|
|
7009
7269
|
}, [aiAnalysisResult]);
|
|
7010
|
-
|
|
7270
|
+
React13.useEffect(() => {
|
|
7011
7271
|
if (aiAnalysisResult == null || Object.keys(aiAnalysisResult).length === 0) return;
|
|
7012
7272
|
const prev = prevAiResultRef.current;
|
|
7013
7273
|
if (prev != null && prev === aiAnalysisResult && shallowEqualKeys(prev, aiAnalysisResult)) return;
|
|
@@ -7080,9 +7340,9 @@ var ReadOnlyText = ({ fieldDef, value }) => {
|
|
|
7080
7340
|
] });
|
|
7081
7341
|
};
|
|
7082
7342
|
var ReadOnlySelect = ({ fieldDef, value }) => {
|
|
7083
|
-
const [options, setOptions] =
|
|
7084
|
-
const [loading, setLoading] =
|
|
7085
|
-
|
|
7343
|
+
const [options, setOptions] = React13.useState([]);
|
|
7344
|
+
const [loading, setLoading] = React13.useState(false);
|
|
7345
|
+
React13.useEffect(() => {
|
|
7086
7346
|
if (fieldDef.options) {
|
|
7087
7347
|
setOptions(fieldDef.options);
|
|
7088
7348
|
} else if (fieldDef.dataSource) {
|
|
@@ -7104,9 +7364,9 @@ var ReadOnlySelect = ({ fieldDef, value }) => {
|
|
|
7104
7364
|
] });
|
|
7105
7365
|
};
|
|
7106
7366
|
var ReadOnlyMultiSelect = ({ fieldDef, value }) => {
|
|
7107
|
-
const [options, setOptions] =
|
|
7108
|
-
const [loading, setLoading] =
|
|
7109
|
-
|
|
7367
|
+
const [options, setOptions] = React13.useState([]);
|
|
7368
|
+
const [loading, setLoading] = React13.useState(false);
|
|
7369
|
+
React13.useEffect(() => {
|
|
7110
7370
|
if (fieldDef.options) {
|
|
7111
7371
|
setOptions(fieldDef.options);
|
|
7112
7372
|
} else if (fieldDef.dataSource) {
|
|
@@ -7255,13 +7515,13 @@ var ReadOnlyTable = ({
|
|
|
7255
7515
|
fieldDef,
|
|
7256
7516
|
value
|
|
7257
7517
|
}) => {
|
|
7258
|
-
const tableData =
|
|
7518
|
+
const tableData = React13.useMemo(() => {
|
|
7259
7519
|
if (value && typeof value === "object" && "columns" in value && "rows" in value && Array.isArray(value.columns) && Array.isArray(value.rows)) {
|
|
7260
7520
|
return value;
|
|
7261
7521
|
}
|
|
7262
7522
|
return { columns: [], rows: [] };
|
|
7263
7523
|
}, [value]);
|
|
7264
|
-
const columns =
|
|
7524
|
+
const columns = React13.useMemo(() => {
|
|
7265
7525
|
return tableData.columns.map((col) => ({
|
|
7266
7526
|
accessorKey: col.id,
|
|
7267
7527
|
header: col.label,
|
|
@@ -7316,9 +7576,9 @@ var ReadOnlyDateTime = ({ fieldDef, value }) => {
|
|
|
7316
7576
|
] });
|
|
7317
7577
|
};
|
|
7318
7578
|
var ReadOnlyRadio = ({ fieldDef, value }) => {
|
|
7319
|
-
const [options, setOptions] =
|
|
7320
|
-
const [loading, setLoading] =
|
|
7321
|
-
|
|
7579
|
+
const [options, setOptions] = React13.useState([]);
|
|
7580
|
+
const [loading, setLoading] = React13.useState(false);
|
|
7581
|
+
React13.useEffect(() => {
|
|
7322
7582
|
if (fieldDef.options?.length) {
|
|
7323
7583
|
setOptions(fieldDef.options);
|
|
7324
7584
|
} else if (fieldDef.dataSource) {
|
|
@@ -7343,9 +7603,9 @@ function isOptionSelected2(selected, optValue) {
|
|
|
7343
7603
|
);
|
|
7344
7604
|
}
|
|
7345
7605
|
var ReadOnlyCheckbox = ({ fieldDef, value }) => {
|
|
7346
|
-
const [options, setOptions] =
|
|
7347
|
-
const [loading, setLoading] =
|
|
7348
|
-
|
|
7606
|
+
const [options, setOptions] = React13.useState([]);
|
|
7607
|
+
const [loading, setLoading] = React13.useState(false);
|
|
7608
|
+
React13.useEffect(() => {
|
|
7349
7609
|
if (fieldDef.options?.length) {
|
|
7350
7610
|
setOptions(fieldDef.options);
|
|
7351
7611
|
} else if (fieldDef.dataSource) {
|
|
@@ -7497,7 +7757,7 @@ var ReadOnlyForm = ({ schema, submission }) => {
|
|
|
7497
7757
|
child.id
|
|
7498
7758
|
);
|
|
7499
7759
|
}
|
|
7500
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7760
|
+
return /* @__PURE__ */ jsxRuntime.jsx(React13__namespace.default.Fragment, {}, child.id ?? index);
|
|
7501
7761
|
};
|
|
7502
7762
|
const hasContent = node.children.some(
|
|
7503
7763
|
(child) => typeof child === "string" ? fieldMap.has(child) : child.type === "column_layout" && child.children?.some((id) => fieldMap.has(id))
|
|
@@ -7639,6 +7899,7 @@ exports.ReadOnlyForm = ReadOnlyForm;
|
|
|
7639
7899
|
exports.ReadOnlyImageUpload = ReadOnlyImageUpload;
|
|
7640
7900
|
exports.ReadOnlySignature = ReadOnlySignature;
|
|
7641
7901
|
exports.ReadOnlyTable = ReadOnlyTable;
|
|
7902
|
+
exports.RichTextWidget = RichTextWidget;
|
|
7642
7903
|
exports.SignatureUploadWidget = SignatureUploadWidget;
|
|
7643
7904
|
exports.SmartForm = SmartForm;
|
|
7644
7905
|
exports.SmartTextareaWidget = SmartTextareaWidget;
|