formanitor 0.0.28 → 0.0.30
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 +362 -223
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.mjs +202 -63
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React15 = require('react');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var lucideReact = require('lucide-react');
|
|
5
6
|
var clsx = require('clsx');
|
|
6
7
|
var tailwindMerge = require('tailwind-merge');
|
|
7
8
|
var LabelPrimitive = require('@radix-ui/react-label');
|
|
@@ -10,7 +11,6 @@ var react = require('@tiptap/react');
|
|
|
10
11
|
var StarterKit = require('@tiptap/starter-kit');
|
|
11
12
|
var Placeholder = require('@tiptap/extension-placeholder');
|
|
12
13
|
var Underline = require('@tiptap/extension-underline');
|
|
13
|
-
var lucideReact = require('lucide-react');
|
|
14
14
|
var reactSlot = require('@radix-ui/react-slot');
|
|
15
15
|
var SeparatorPrimitive = require('@radix-ui/react-separator');
|
|
16
16
|
var SelectPrimitive = require('@radix-ui/react-select');
|
|
@@ -44,7 +44,7 @@ function _interopNamespace(e) {
|
|
|
44
44
|
return Object.freeze(n);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
var
|
|
47
|
+
var React15__namespace = /*#__PURE__*/_interopNamespace(React15);
|
|
48
48
|
var LabelPrimitive__namespace = /*#__PURE__*/_interopNamespace(LabelPrimitive);
|
|
49
49
|
var StarterKit__default = /*#__PURE__*/_interopDefault(StarterKit);
|
|
50
50
|
var Placeholder__default = /*#__PURE__*/_interopDefault(Placeholder);
|
|
@@ -286,6 +286,9 @@ var FormStore = class {
|
|
|
286
286
|
getFieldDef(fieldId) {
|
|
287
287
|
return this.fieldMap[fieldId];
|
|
288
288
|
}
|
|
289
|
+
getVoice() {
|
|
290
|
+
return this.config.voice;
|
|
291
|
+
}
|
|
289
292
|
hasPersistence() {
|
|
290
293
|
return this.persistence !== NO_OP_PROVIDER;
|
|
291
294
|
}
|
|
@@ -638,6 +641,7 @@ var FormStore = class {
|
|
|
638
641
|
if (next.onUpload !== void 0) this.config.onUpload = next.onUpload;
|
|
639
642
|
if (next.onEvent !== void 0) this.config.onEvent = next.onEvent;
|
|
640
643
|
if (next.onDraftChange !== void 0) this.config.onDraftChange = next.onDraftChange;
|
|
644
|
+
if (next.voice !== void 0) this.config.voice = next.voice;
|
|
641
645
|
if (next.role !== void 0 && next.role !== this.config.role) {
|
|
642
646
|
this.config.role = next.role;
|
|
643
647
|
needsReeval = true;
|
|
@@ -699,20 +703,35 @@ var FormStore = class {
|
|
|
699
703
|
this.listeners.forEach((l) => l(this.state));
|
|
700
704
|
}
|
|
701
705
|
};
|
|
702
|
-
var
|
|
706
|
+
var VoiceContext = React15.createContext({
|
|
707
|
+
activeFieldId: null,
|
|
708
|
+
setActiveFieldId: () => {
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
function useVoiceContext() {
|
|
712
|
+
return React15.useContext(VoiceContext);
|
|
713
|
+
}
|
|
714
|
+
function VoiceContextProvider({ children }) {
|
|
715
|
+
const [activeFieldId, setActiveFieldIdState] = React15.useState(null);
|
|
716
|
+
const setActiveFieldId = React15.useCallback((id) => {
|
|
717
|
+
setActiveFieldIdState(id);
|
|
718
|
+
}, []);
|
|
719
|
+
return /* @__PURE__ */ jsxRuntime.jsx(VoiceContext.Provider, { value: { activeFieldId, setActiveFieldId }, children });
|
|
720
|
+
}
|
|
721
|
+
var FormContext = React15.createContext(null);
|
|
703
722
|
var emptyFrequentItems = {
|
|
704
723
|
medications: [],
|
|
705
724
|
investigations: [],
|
|
706
725
|
procedures: []
|
|
707
726
|
};
|
|
708
|
-
var FrequentItemsContext =
|
|
709
|
-
var FieldHandlersContext =
|
|
727
|
+
var FrequentItemsContext = React15.createContext(emptyFrequentItems);
|
|
728
|
+
var FieldHandlersContext = React15.createContext({});
|
|
710
729
|
function useFieldHandlers(fieldId) {
|
|
711
|
-
const map =
|
|
730
|
+
const map = React15.useContext(FieldHandlersContext);
|
|
712
731
|
return map[fieldId] ?? { onSearch: async () => [], recentlyUsed: [] };
|
|
713
732
|
}
|
|
714
733
|
function useFrequentItems() {
|
|
715
|
-
return
|
|
734
|
+
return React15.useContext(FrequentItemsContext);
|
|
716
735
|
}
|
|
717
736
|
var FormProvider = ({
|
|
718
737
|
schema,
|
|
@@ -721,23 +740,23 @@ var FormProvider = ({
|
|
|
721
740
|
frequentItems,
|
|
722
741
|
children
|
|
723
742
|
}) => {
|
|
724
|
-
const storeRef =
|
|
743
|
+
const storeRef = React15.useRef(null);
|
|
725
744
|
if (!storeRef.current) {
|
|
726
745
|
storeRef.current = new FormStore(schema, config);
|
|
727
746
|
}
|
|
728
|
-
|
|
747
|
+
React15.useEffect(() => {
|
|
729
748
|
if (storeRef.current && config) {
|
|
730
749
|
storeRef.current.updateConfig(config);
|
|
731
750
|
}
|
|
732
751
|
});
|
|
733
|
-
|
|
752
|
+
React15.useEffect(() => {
|
|
734
753
|
storeRef.current?.load();
|
|
735
754
|
}, []);
|
|
736
755
|
const frequentItemsValue = frequentItems ?? emptyFrequentItems;
|
|
737
|
-
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 }) }) });
|
|
756
|
+
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: /* @__PURE__ */ jsxRuntime.jsx(VoiceContextProvider, { children }) }) }) });
|
|
738
757
|
};
|
|
739
758
|
function useFormStore() {
|
|
740
|
-
const context =
|
|
759
|
+
const context = React15.useContext(FormContext);
|
|
741
760
|
if (!context) {
|
|
742
761
|
throw new Error("useFormStore must be used within a FormProvider");
|
|
743
762
|
}
|
|
@@ -745,8 +764,8 @@ function useFormStore() {
|
|
|
745
764
|
}
|
|
746
765
|
function useForm() {
|
|
747
766
|
const store = useFormStore();
|
|
748
|
-
const [state, setState] =
|
|
749
|
-
|
|
767
|
+
const [state, setState] = React15.useState(store.getState());
|
|
768
|
+
React15.useEffect(() => {
|
|
750
769
|
const unsubscribe = store.subscribe((newState) => {
|
|
751
770
|
setState({ ...newState });
|
|
752
771
|
});
|
|
@@ -768,8 +787,8 @@ function useForm() {
|
|
|
768
787
|
}
|
|
769
788
|
function useField(fieldId) {
|
|
770
789
|
const store = useFormStore();
|
|
771
|
-
const [fieldState, setFieldState] =
|
|
772
|
-
|
|
790
|
+
const [fieldState, setFieldState] = React15.useState(store.getFieldState(fieldId));
|
|
791
|
+
React15.useEffect(() => {
|
|
773
792
|
const unsubscribe = store.subscribe(() => {
|
|
774
793
|
const newState = store.getFieldState(fieldId);
|
|
775
794
|
setFieldState((prev) => {
|
|
@@ -791,10 +810,76 @@ function useField(fieldId) {
|
|
|
791
810
|
setTouched
|
|
792
811
|
};
|
|
793
812
|
}
|
|
813
|
+
function RecordingWave() {
|
|
814
|
+
const bars = [
|
|
815
|
+
{ dur: "0.6s", values: "3;10;3", yValues: "4.5;0;4.5", delay: "0s" },
|
|
816
|
+
{ dur: "0.6s", values: "8;3;8", yValues: "2;4.5;2", delay: "0.1s" },
|
|
817
|
+
{ dur: "0.6s", values: "5;11;5", yValues: "3.5;0.5;3.5", delay: "0.05s" },
|
|
818
|
+
{ dur: "0.6s", values: "10;4;10", yValues: "1;4;1", delay: "0.15s" }
|
|
819
|
+
];
|
|
820
|
+
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "12", viewBox: "0 0 18 12", "aria-hidden": true, children: bars.map((b, i) => /* @__PURE__ */ jsxRuntime.jsxs("rect", { x: i * 4 + 1, width: "2.5", rx: "1.25", fill: "currentColor", y: "0", height: "12", children: [
|
|
821
|
+
/* @__PURE__ */ jsxRuntime.jsx("animate", { attributeName: "height", values: b.values, dur: b.dur, begin: b.delay, repeatCount: "indefinite" }),
|
|
822
|
+
/* @__PURE__ */ jsxRuntime.jsx("animate", { attributeName: "y", values: b.yValues, dur: b.dur, begin: b.delay, repeatCount: "indefinite" })
|
|
823
|
+
] }, i)) });
|
|
824
|
+
}
|
|
825
|
+
function VoiceMicButton({ fieldId, onTranscriptReady }) {
|
|
826
|
+
const store = useFormStore();
|
|
827
|
+
const { activeFieldId, setActiveFieldId } = useVoiceContext();
|
|
828
|
+
const [status, setStatus] = React15.useState("idle");
|
|
829
|
+
const voice = store.getVoice();
|
|
830
|
+
const isActive = activeFieldId === fieldId;
|
|
831
|
+
const isRecording = status === "recording" && isActive;
|
|
832
|
+
const isTranscribing = status === "transcribing" && isActive;
|
|
833
|
+
const isBlocked = activeFieldId !== null && !isActive;
|
|
834
|
+
const handleClick = React15.useCallback(async () => {
|
|
835
|
+
if (!voice || isBlocked || isTranscribing) return;
|
|
836
|
+
if (isRecording) {
|
|
837
|
+
setStatus("transcribing");
|
|
838
|
+
try {
|
|
839
|
+
const transcript = await voice.stopRecording();
|
|
840
|
+
if (transcript) onTranscriptReady(transcript);
|
|
841
|
+
} catch {
|
|
842
|
+
} finally {
|
|
843
|
+
setStatus("idle");
|
|
844
|
+
setActiveFieldId(null);
|
|
845
|
+
}
|
|
846
|
+
} else {
|
|
847
|
+
setActiveFieldId(fieldId);
|
|
848
|
+
setStatus("recording");
|
|
849
|
+
try {
|
|
850
|
+
await voice.startRecording();
|
|
851
|
+
} catch {
|
|
852
|
+
setStatus("idle");
|
|
853
|
+
setActiveFieldId(null);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
}, [voice, isBlocked, isTranscribing, isRecording, fieldId, onTranscriptReady, setActiveFieldId]);
|
|
857
|
+
const title = isTranscribing ? "Processing\u2026" : isRecording ? "Stop recording" : "Dictate this field";
|
|
858
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
859
|
+
"button",
|
|
860
|
+
{
|
|
861
|
+
type: "button",
|
|
862
|
+
onClick: handleClick,
|
|
863
|
+
disabled: isBlocked || isTranscribing,
|
|
864
|
+
title,
|
|
865
|
+
className: [
|
|
866
|
+
"flex items-center gap-1 rounded px-1 py-0.5",
|
|
867
|
+
"text-[11px] font-medium transition-opacity",
|
|
868
|
+
isBlocked ? "pointer-events-none opacity-30" : "",
|
|
869
|
+
isTranscribing ? "cursor-wait opacity-50" : "",
|
|
870
|
+
!isBlocked && !isTranscribing ? "hover:opacity-70" : ""
|
|
871
|
+
].filter(Boolean).join(" "),
|
|
872
|
+
children: isTranscribing ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "h-3.5 w-3.5 animate-spin text-slate-400" }) : isRecording ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
873
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-rose-400", children: /* @__PURE__ */ jsxRuntime.jsx(RecordingWave, {}) }),
|
|
874
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-rose-400", children: "Stop" })
|
|
875
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Mic, { className: "h-4 w-4 text-slate-400" })
|
|
876
|
+
}
|
|
877
|
+
);
|
|
878
|
+
}
|
|
794
879
|
function cn(...inputs) {
|
|
795
880
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
796
881
|
}
|
|
797
|
-
var Input =
|
|
882
|
+
var Input = React15__namespace.forwardRef(
|
|
798
883
|
({ className, type, ...props }, ref) => {
|
|
799
884
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
800
885
|
"input",
|
|
@@ -814,7 +899,7 @@ Input.displayName = "Input";
|
|
|
814
899
|
var labelVariants = classVarianceAuthority.cva(
|
|
815
900
|
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
|
|
816
901
|
);
|
|
817
|
-
var Label =
|
|
902
|
+
var Label = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
818
903
|
LabelPrimitive__namespace.Root,
|
|
819
904
|
{
|
|
820
905
|
ref,
|
|
@@ -823,7 +908,7 @@ var Label = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
823
908
|
}
|
|
824
909
|
));
|
|
825
910
|
Label.displayName = LabelPrimitive__namespace.Root.displayName;
|
|
826
|
-
var Textarea =
|
|
911
|
+
var Textarea = React15__namespace.forwardRef(
|
|
827
912
|
({ className, height, style, ...props }, ref) => {
|
|
828
913
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
829
914
|
"textarea",
|
|
@@ -867,6 +952,8 @@ function getThemeConfig(fieldType, themeName) {
|
|
|
867
952
|
var TextWidget = ({ fieldId }) => {
|
|
868
953
|
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
869
954
|
const { state } = useForm();
|
|
955
|
+
const store = useFormStore();
|
|
956
|
+
const hasVoice = !!(fieldDef?.voice && store.getVoice());
|
|
870
957
|
const showError = !!error && (touched || state.submitAttempted);
|
|
871
958
|
if (!fieldDef) return null;
|
|
872
959
|
const Component = fieldDef.type === "textarea" ? Textarea : Input;
|
|
@@ -884,8 +971,12 @@ var TextWidget = ({ fieldId }) => {
|
|
|
884
971
|
" ",
|
|
885
972
|
fieldDef.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500", children: "*" })
|
|
886
973
|
] });
|
|
974
|
+
const labelEl = theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, className: labelClass, children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, children: labelContent });
|
|
887
975
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: wrapperClass, children: [
|
|
888
|
-
|
|
976
|
+
hasVoice ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
977
|
+
labelEl,
|
|
978
|
+
/* @__PURE__ */ jsxRuntime.jsx(VoiceMicButton, { fieldId, onTranscriptReady: setValue })
|
|
979
|
+
] }) : labelEl,
|
|
889
980
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
890
981
|
Component,
|
|
891
982
|
{
|
|
@@ -927,7 +1018,7 @@ var buttonVariants = classVarianceAuthority.cva(
|
|
|
927
1018
|
}
|
|
928
1019
|
}
|
|
929
1020
|
);
|
|
930
|
-
var Button =
|
|
1021
|
+
var Button = React15__namespace.forwardRef(
|
|
931
1022
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
932
1023
|
const Comp = asChild ? reactSlot.Slot : "button";
|
|
933
1024
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -941,7 +1032,7 @@ var Button = React13__namespace.forwardRef(
|
|
|
941
1032
|
}
|
|
942
1033
|
);
|
|
943
1034
|
Button.displayName = "Button";
|
|
944
|
-
var Separator =
|
|
1035
|
+
var Separator = React15__namespace.forwardRef(
|
|
945
1036
|
({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
946
1037
|
SeparatorPrimitive__namespace.Root,
|
|
947
1038
|
{
|
|
@@ -966,8 +1057,8 @@ function RichTextToolbar({
|
|
|
966
1057
|
editor,
|
|
967
1058
|
disabled
|
|
968
1059
|
}) {
|
|
969
|
-
const [, rerender] =
|
|
970
|
-
|
|
1060
|
+
const [, rerender] = React15.useReducer((n) => n + 1, 0);
|
|
1061
|
+
React15.useEffect(() => {
|
|
971
1062
|
if (!editor) return;
|
|
972
1063
|
const handler = () => rerender();
|
|
973
1064
|
editor.on("selectionUpdate", handler);
|
|
@@ -1073,11 +1164,13 @@ function RichTextToolbar({
|
|
|
1073
1164
|
var RichTextWidget = ({ fieldId }) => {
|
|
1074
1165
|
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
1075
1166
|
const { state } = useForm();
|
|
1167
|
+
const store = useFormStore();
|
|
1168
|
+
const hasVoice = !!(fieldDef?.voice && store.getVoice());
|
|
1076
1169
|
const showError = !!error && (touched || state.submitAttempted);
|
|
1077
1170
|
const def = fieldDef;
|
|
1078
1171
|
const placeholder = def?.placeholder ?? "Start typing\u2026";
|
|
1079
1172
|
const minHeight = def?.minHeight ?? 160;
|
|
1080
|
-
const extensions =
|
|
1173
|
+
const extensions = React15.useMemo(
|
|
1081
1174
|
() => [
|
|
1082
1175
|
StarterKit__default.default.configure({
|
|
1083
1176
|
// Disable headings entirely so the UI/content can't introduce H2/H3.
|
|
@@ -1127,16 +1220,16 @@ var RichTextWidget = ({ fieldId }) => {
|
|
|
1127
1220
|
},
|
|
1128
1221
|
[extensions, fieldId]
|
|
1129
1222
|
);
|
|
1130
|
-
|
|
1223
|
+
React15.useEffect(() => {
|
|
1131
1224
|
if (!editor || editor.isDestroyed) return;
|
|
1132
1225
|
editor.setEditable(!disabled);
|
|
1133
1226
|
}, [editor, disabled]);
|
|
1134
|
-
|
|
1227
|
+
React15.useEffect(() => {
|
|
1135
1228
|
if (!editor || editor.isDestroyed) return;
|
|
1136
1229
|
const el = editor.view.dom;
|
|
1137
1230
|
el.style.minHeight = `${minHeight}px`;
|
|
1138
1231
|
}, [editor, minHeight]);
|
|
1139
|
-
|
|
1232
|
+
React15.useEffect(() => {
|
|
1140
1233
|
if (!editor || editor.isDestroyed) return;
|
|
1141
1234
|
const fromForm = stringValue;
|
|
1142
1235
|
const fromEditor = editor.getHTML();
|
|
@@ -1154,8 +1247,12 @@ var RichTextWidget = ({ fieldId }) => {
|
|
|
1154
1247
|
" ",
|
|
1155
1248
|
fieldDef.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-red-500", children: "*" })
|
|
1156
1249
|
] });
|
|
1250
|
+
const labelEl = /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, children: labelContent });
|
|
1157
1251
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
1158
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1252
|
+
hasVoice ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
1253
|
+
labelEl,
|
|
1254
|
+
/* @__PURE__ */ jsxRuntime.jsx(VoiceMicButton, { fieldId, onTranscriptReady: setValue })
|
|
1255
|
+
] }) : labelEl,
|
|
1159
1256
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1160
1257
|
"div",
|
|
1161
1258
|
{
|
|
@@ -1193,7 +1290,7 @@ var RichTextWidget = ({ fieldId }) => {
|
|
|
1193
1290
|
};
|
|
1194
1291
|
var Select = SelectPrimitive__namespace.Root;
|
|
1195
1292
|
var SelectValue = SelectPrimitive__namespace.Value;
|
|
1196
|
-
var SelectTrigger =
|
|
1293
|
+
var SelectTrigger = React15__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1197
1294
|
SelectPrimitive__namespace.Trigger,
|
|
1198
1295
|
{
|
|
1199
1296
|
ref,
|
|
@@ -1209,7 +1306,7 @@ var SelectTrigger = React13__namespace.forwardRef(({ className, children, ...pro
|
|
|
1209
1306
|
}
|
|
1210
1307
|
));
|
|
1211
1308
|
SelectTrigger.displayName = SelectPrimitive__namespace.Trigger.displayName;
|
|
1212
|
-
var SelectScrollUpButton =
|
|
1309
|
+
var SelectScrollUpButton = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1213
1310
|
SelectPrimitive__namespace.ScrollUpButton,
|
|
1214
1311
|
{
|
|
1215
1312
|
ref,
|
|
@@ -1222,7 +1319,7 @@ var SelectScrollUpButton = React13__namespace.forwardRef(({ className, ...props
|
|
|
1222
1319
|
}
|
|
1223
1320
|
));
|
|
1224
1321
|
SelectScrollUpButton.displayName = SelectPrimitive__namespace.ScrollUpButton.displayName;
|
|
1225
|
-
var SelectScrollDownButton =
|
|
1322
|
+
var SelectScrollDownButton = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1226
1323
|
SelectPrimitive__namespace.ScrollDownButton,
|
|
1227
1324
|
{
|
|
1228
1325
|
ref,
|
|
@@ -1235,7 +1332,7 @@ var SelectScrollDownButton = React13__namespace.forwardRef(({ className, ...prop
|
|
|
1235
1332
|
}
|
|
1236
1333
|
));
|
|
1237
1334
|
SelectScrollDownButton.displayName = SelectPrimitive__namespace.ScrollDownButton.displayName;
|
|
1238
|
-
var SelectContent =
|
|
1335
|
+
var SelectContent = React15__namespace.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1239
1336
|
SelectPrimitive__namespace.Content,
|
|
1240
1337
|
{
|
|
1241
1338
|
ref,
|
|
@@ -1263,7 +1360,7 @@ var SelectContent = React13__namespace.forwardRef(({ className, children, positi
|
|
|
1263
1360
|
}
|
|
1264
1361
|
) }));
|
|
1265
1362
|
SelectContent.displayName = SelectPrimitive__namespace.Content.displayName;
|
|
1266
|
-
var SelectLabel =
|
|
1363
|
+
var SelectLabel = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1267
1364
|
SelectPrimitive__namespace.Label,
|
|
1268
1365
|
{
|
|
1269
1366
|
ref,
|
|
@@ -1272,7 +1369,7 @@ var SelectLabel = React13__namespace.forwardRef(({ className, ...props }, ref) =
|
|
|
1272
1369
|
}
|
|
1273
1370
|
));
|
|
1274
1371
|
SelectLabel.displayName = SelectPrimitive__namespace.Label.displayName;
|
|
1275
|
-
var SelectItem =
|
|
1372
|
+
var SelectItem = React15__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1276
1373
|
SelectPrimitive__namespace.Item,
|
|
1277
1374
|
{
|
|
1278
1375
|
ref,
|
|
@@ -1288,7 +1385,7 @@ var SelectItem = React13__namespace.forwardRef(({ className, children, ...props
|
|
|
1288
1385
|
}
|
|
1289
1386
|
));
|
|
1290
1387
|
SelectItem.displayName = SelectPrimitive__namespace.Item.displayName;
|
|
1291
|
-
var SelectSeparator =
|
|
1388
|
+
var SelectSeparator = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1292
1389
|
SelectPrimitive__namespace.Separator,
|
|
1293
1390
|
{
|
|
1294
1391
|
ref,
|
|
@@ -1335,11 +1432,11 @@ async function fetchOptions(source, params) {
|
|
|
1335
1432
|
}
|
|
1336
1433
|
var SelectWidget = ({ fieldId }) => {
|
|
1337
1434
|
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
1338
|
-
const [options, setOptions] =
|
|
1339
|
-
const [loading, setLoading] =
|
|
1435
|
+
const [options, setOptions] = React15.useState([]);
|
|
1436
|
+
const [loading, setLoading] = React15.useState(false);
|
|
1340
1437
|
const { state } = useForm();
|
|
1341
1438
|
const showError = !!error && (touched || state.submitAttempted);
|
|
1342
|
-
|
|
1439
|
+
React15.useEffect(() => {
|
|
1343
1440
|
if (!fieldDef) return;
|
|
1344
1441
|
const def = fieldDef;
|
|
1345
1442
|
if (def.options) {
|
|
@@ -1377,7 +1474,7 @@ var SelectWidget = ({ fieldId }) => {
|
|
|
1377
1474
|
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
1378
1475
|
] });
|
|
1379
1476
|
};
|
|
1380
|
-
var Checkbox =
|
|
1477
|
+
var Checkbox = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1381
1478
|
CheckboxPrimitive__namespace.Root,
|
|
1382
1479
|
{
|
|
1383
1480
|
ref,
|
|
@@ -1398,12 +1495,12 @@ var Checkbox = React13__namespace.forwardRef(({ className, ...props }, ref) => /
|
|
|
1398
1495
|
Checkbox.displayName = CheckboxPrimitive__namespace.Root.displayName;
|
|
1399
1496
|
var MultiSelectWidget = ({ fieldId }) => {
|
|
1400
1497
|
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
1401
|
-
const [options, setOptions] =
|
|
1402
|
-
const [loading, setLoading] =
|
|
1498
|
+
const [options, setOptions] = React15.useState([]);
|
|
1499
|
+
const [loading, setLoading] = React15.useState(false);
|
|
1403
1500
|
const { state } = useForm();
|
|
1404
1501
|
const showError = !!error && (touched || state.submitAttempted);
|
|
1405
1502
|
const currentValues = Array.isArray(value) ? value : [];
|
|
1406
|
-
|
|
1503
|
+
React15.useEffect(() => {
|
|
1407
1504
|
if (!fieldDef) return;
|
|
1408
1505
|
const def = fieldDef;
|
|
1409
1506
|
if (def.options) {
|
|
@@ -1451,7 +1548,7 @@ var MultiSelectWidget = ({ fieldId }) => {
|
|
|
1451
1548
|
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
1452
1549
|
] });
|
|
1453
1550
|
};
|
|
1454
|
-
var Table =
|
|
1551
|
+
var Table = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1455
1552
|
"table",
|
|
1456
1553
|
{
|
|
1457
1554
|
ref,
|
|
@@ -1460,9 +1557,9 @@ var Table = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
1460
1557
|
}
|
|
1461
1558
|
) }));
|
|
1462
1559
|
Table.displayName = "Table";
|
|
1463
|
-
var TableHeader =
|
|
1560
|
+
var TableHeader = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
|
|
1464
1561
|
TableHeader.displayName = "TableHeader";
|
|
1465
|
-
var TableBody =
|
|
1562
|
+
var TableBody = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1466
1563
|
"tbody",
|
|
1467
1564
|
{
|
|
1468
1565
|
ref,
|
|
@@ -1471,7 +1568,7 @@ var TableBody = React13__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
1471
1568
|
}
|
|
1472
1569
|
));
|
|
1473
1570
|
TableBody.displayName = "TableBody";
|
|
1474
|
-
var TableFooter =
|
|
1571
|
+
var TableFooter = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1475
1572
|
"tfoot",
|
|
1476
1573
|
{
|
|
1477
1574
|
ref,
|
|
@@ -1483,7 +1580,7 @@ var TableFooter = React13__namespace.forwardRef(({ className, ...props }, ref) =
|
|
|
1483
1580
|
}
|
|
1484
1581
|
));
|
|
1485
1582
|
TableFooter.displayName = "TableFooter";
|
|
1486
|
-
var TableRow =
|
|
1583
|
+
var TableRow = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1487
1584
|
"tr",
|
|
1488
1585
|
{
|
|
1489
1586
|
ref,
|
|
@@ -1495,7 +1592,7 @@ var TableRow = React13__namespace.forwardRef(({ className, ...props }, ref) => /
|
|
|
1495
1592
|
}
|
|
1496
1593
|
));
|
|
1497
1594
|
TableRow.displayName = "TableRow";
|
|
1498
|
-
var TableHead =
|
|
1595
|
+
var TableHead = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1499
1596
|
"th",
|
|
1500
1597
|
{
|
|
1501
1598
|
ref,
|
|
@@ -1507,7 +1604,7 @@ var TableHead = React13__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
1507
1604
|
}
|
|
1508
1605
|
));
|
|
1509
1606
|
TableHead.displayName = "TableHead";
|
|
1510
|
-
var TableCell =
|
|
1607
|
+
var TableCell = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1511
1608
|
"td",
|
|
1512
1609
|
{
|
|
1513
1610
|
ref,
|
|
@@ -1516,7 +1613,7 @@ var TableCell = React13__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
1516
1613
|
}
|
|
1517
1614
|
));
|
|
1518
1615
|
TableCell.displayName = "TableCell";
|
|
1519
|
-
var TableCaption =
|
|
1616
|
+
var TableCaption = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1520
1617
|
"caption",
|
|
1521
1618
|
{
|
|
1522
1619
|
ref,
|
|
@@ -1532,7 +1629,7 @@ var RepeatableWidget = ({
|
|
|
1532
1629
|
if (!fieldDef || fieldDef.type !== "repeatable") return null;
|
|
1533
1630
|
const def = fieldDef;
|
|
1534
1631
|
const rows = Array.isArray(value) ? value : [];
|
|
1535
|
-
const [hasInteracted, setHasInteracted] =
|
|
1632
|
+
const [hasInteracted, setHasInteracted] = React15__namespace.default.useState(false);
|
|
1536
1633
|
const showError = !!error && (touched || hasInteracted);
|
|
1537
1634
|
const addRow = () => {
|
|
1538
1635
|
setValue([...rows, {}]);
|
|
@@ -1618,29 +1715,66 @@ var RepeatableWidget = ({
|
|
|
1618
1715
|
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
1619
1716
|
] });
|
|
1620
1717
|
};
|
|
1718
|
+
function CalendarDropdown(props) {
|
|
1719
|
+
const { options, value, onChange } = props;
|
|
1720
|
+
const handleValueChange = (newValue) => {
|
|
1721
|
+
if (!onChange) return;
|
|
1722
|
+
const syntheticEvent = {
|
|
1723
|
+
target: { value: newValue }
|
|
1724
|
+
};
|
|
1725
|
+
onChange(syntheticEvent);
|
|
1726
|
+
};
|
|
1727
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Select, { value: value?.toString(), onValueChange: handleValueChange, children: [
|
|
1728
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger, { className: "h-7 px-2 text-sm", "aria-label": props["aria-label"], children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, {}) }),
|
|
1729
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: options?.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1730
|
+
SelectItem,
|
|
1731
|
+
{
|
|
1732
|
+
value: option.value.toString(),
|
|
1733
|
+
disabled: option.disabled,
|
|
1734
|
+
children: option.label
|
|
1735
|
+
},
|
|
1736
|
+
option.value.toString()
|
|
1737
|
+
)) })
|
|
1738
|
+
] });
|
|
1739
|
+
}
|
|
1621
1740
|
function Calendar({
|
|
1622
1741
|
className,
|
|
1623
1742
|
classNames,
|
|
1624
1743
|
showOutsideDays = true,
|
|
1625
1744
|
...props
|
|
1626
1745
|
}) {
|
|
1746
|
+
const captionLayout = props.captionLayout ?? "dropdown";
|
|
1747
|
+
const isDropdownCaption = captionLayout === "dropdown" || captionLayout === "dropdown-months" || captionLayout === "dropdown-years";
|
|
1748
|
+
const startMonth = props.startMonth ?? (isDropdownCaption ? new Date(1900, 0) : void 0);
|
|
1749
|
+
const endMonth = props.endMonth ?? (isDropdownCaption ? new Date(2100, 11) : void 0);
|
|
1627
1750
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1628
1751
|
reactDayPicker.DayPicker,
|
|
1629
1752
|
{
|
|
1630
1753
|
showOutsideDays,
|
|
1754
|
+
captionLayout,
|
|
1755
|
+
hideNavigation: props.hideNavigation ?? isDropdownCaption,
|
|
1756
|
+
navLayout: props.navLayout ?? (isDropdownCaption ? "around" : void 0),
|
|
1757
|
+
startMonth,
|
|
1758
|
+
endMonth,
|
|
1631
1759
|
className: cn("p-3 relative", className),
|
|
1632
1760
|
classNames: {
|
|
1633
1761
|
months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
|
|
1634
1762
|
month: "space-y-4",
|
|
1635
1763
|
caption: "flex justify-center pt-1 relative items-center",
|
|
1636
|
-
caption_label:
|
|
1764
|
+
caption_label: cn(
|
|
1765
|
+
"text-sm font-medium",
|
|
1766
|
+
isDropdownCaption && "sr-only"
|
|
1767
|
+
),
|
|
1768
|
+
dropdowns: "flex items-center gap-2",
|
|
1769
|
+
months_dropdown: "h-7 rounded-md border border-input bg-background px-2 text-sm",
|
|
1770
|
+
years_dropdown: "h-7 rounded-md border border-input bg-background px-2 text-sm",
|
|
1637
1771
|
nav: "space-x-1 flex items-center",
|
|
1638
1772
|
nav_button: cn(
|
|
1639
1773
|
buttonVariants({ variant: "outline" }),
|
|
1640
1774
|
"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
|
|
1641
1775
|
),
|
|
1642
|
-
nav_button_previous: "absolute left-1",
|
|
1643
|
-
nav_button_next: "absolute right-1",
|
|
1776
|
+
nav_button_previous: isDropdownCaption ? "" : "absolute left-1",
|
|
1777
|
+
nav_button_next: isDropdownCaption ? "" : "absolute right-1",
|
|
1644
1778
|
table: "w-full border-collapse space-y-1",
|
|
1645
1779
|
head_row: "flex",
|
|
1646
1780
|
head_cell: "text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",
|
|
@@ -1661,12 +1795,12 @@ function Calendar({
|
|
|
1661
1795
|
button_previous: cn(
|
|
1662
1796
|
buttonVariants({ variant: "outline" }),
|
|
1663
1797
|
"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100",
|
|
1664
|
-
"absolute left-1 top-3"
|
|
1798
|
+
isDropdownCaption ? "" : "absolute left-1 top-3"
|
|
1665
1799
|
),
|
|
1666
1800
|
button_next: cn(
|
|
1667
1801
|
buttonVariants({ variant: "outline" }),
|
|
1668
1802
|
"h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100",
|
|
1669
|
-
"absolute right-1 top-3"
|
|
1803
|
+
isDropdownCaption ? "" : "absolute right-1 top-3"
|
|
1670
1804
|
),
|
|
1671
1805
|
month_grid: "w-full border-collapse space-y-1",
|
|
1672
1806
|
weekdays: "flex",
|
|
@@ -1686,9 +1820,11 @@ function Calendar({
|
|
|
1686
1820
|
...classNames
|
|
1687
1821
|
},
|
|
1688
1822
|
components: {
|
|
1689
|
-
IconLeft: (
|
|
1690
|
-
IconRight: (
|
|
1691
|
-
// @ts-
|
|
1823
|
+
IconLeft: () => /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronLeft, { className: "h-4 w-4" }),
|
|
1824
|
+
IconRight: () => /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronRight, { className: "h-4 w-4" }),
|
|
1825
|
+
// @ts-expect-error react-day-picker v9 component typing differences
|
|
1826
|
+
Dropdown: CalendarDropdown,
|
|
1827
|
+
// @ts-expect-error react-day-picker v9 component typing differences
|
|
1692
1828
|
Chevron: ({ orientation }) => {
|
|
1693
1829
|
const Icon2 = orientation === "left" ? lucideReact.ChevronLeft : lucideReact.ChevronRight;
|
|
1694
1830
|
return /* @__PURE__ */ jsxRuntime.jsx(Icon2, { className: "h-4 w-4" });
|
|
@@ -1701,7 +1837,7 @@ function Calendar({
|
|
|
1701
1837
|
Calendar.displayName = "Calendar";
|
|
1702
1838
|
var Popover = PopoverPrimitive__namespace.Root;
|
|
1703
1839
|
var PopoverTrigger = PopoverPrimitive__namespace.Trigger;
|
|
1704
|
-
var PopoverContent =
|
|
1840
|
+
var PopoverContent = React15__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1705
1841
|
PopoverPrimitive__namespace.Content,
|
|
1706
1842
|
{
|
|
1707
1843
|
ref,
|
|
@@ -1780,14 +1916,14 @@ function DateTimePicker({
|
|
|
1780
1916
|
className,
|
|
1781
1917
|
placeholder = "Pick date & time"
|
|
1782
1918
|
}) {
|
|
1783
|
-
const [internalDate, setInternalDate] =
|
|
1784
|
-
const [timeString, setTimeString] =
|
|
1919
|
+
const [internalDate, setInternalDate] = React15__namespace.useState(dateTime);
|
|
1920
|
+
const [timeString, setTimeString] = React15__namespace.useState(() => {
|
|
1785
1921
|
if (!dateTime) return "";
|
|
1786
1922
|
const hours = dateTime.getHours().toString().padStart(2, "0");
|
|
1787
1923
|
const minutes = dateTime.getMinutes().toString().padStart(2, "0");
|
|
1788
1924
|
return `${hours}:${minutes}`;
|
|
1789
1925
|
});
|
|
1790
|
-
|
|
1926
|
+
React15__namespace.useEffect(() => {
|
|
1791
1927
|
setInternalDate(dateTime);
|
|
1792
1928
|
if (!dateTime) {
|
|
1793
1929
|
setTimeString("");
|
|
@@ -1916,9 +2052,9 @@ var ImageUploadWidget = ({ fieldId }) => {
|
|
|
1916
2052
|
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
1917
2053
|
const store = useFormStore();
|
|
1918
2054
|
const { state } = useForm();
|
|
1919
|
-
const [isUploading, setIsUploading] =
|
|
1920
|
-
const [preview, setPreview] =
|
|
1921
|
-
const fileInputRef =
|
|
2055
|
+
const [isUploading, setIsUploading] = React15.useState(false);
|
|
2056
|
+
const [preview, setPreview] = React15.useState(null);
|
|
2057
|
+
const fileInputRef = React15.useRef(null);
|
|
1922
2058
|
const showError = !!error && (touched || state.submitAttempted);
|
|
1923
2059
|
if (!fieldDef) return null;
|
|
1924
2060
|
const uploadHandler = store.getUploadHandler();
|
|
@@ -1931,7 +2067,7 @@ var ImageUploadWidget = ({ fieldId }) => {
|
|
|
1931
2067
|
/* @__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." }) })
|
|
1932
2068
|
] });
|
|
1933
2069
|
}
|
|
1934
|
-
|
|
2070
|
+
React15__namespace.default.useEffect(() => {
|
|
1935
2071
|
if (value && typeof value === "string") {
|
|
1936
2072
|
setPreview(value);
|
|
1937
2073
|
} else {
|
|
@@ -2056,18 +2192,18 @@ var SignatureUploadWidget = ({ fieldId }) => {
|
|
|
2056
2192
|
const { fieldDef, setValue, setTouched, error, disabled, touched, value } = useField(fieldId);
|
|
2057
2193
|
const store = useFormStore();
|
|
2058
2194
|
const { state } = useForm();
|
|
2059
|
-
const canvasRef =
|
|
2060
|
-
const pathRef =
|
|
2061
|
-
const lastPointRef =
|
|
2062
|
-
const lastTimeRef =
|
|
2063
|
-
const lastWidthRef =
|
|
2064
|
-
const [isDrawing, setIsDrawing] =
|
|
2065
|
-
const [hasDrawing, setHasDrawing] =
|
|
2066
|
-
const [isUploading, setIsUploading] =
|
|
2067
|
-
const [isConfirmed, setIsConfirmed] =
|
|
2068
|
-
const [uploadError, setUploadError] =
|
|
2069
|
-
const confirmSignatureRef =
|
|
2070
|
-
|
|
2195
|
+
const canvasRef = React15.useRef(null);
|
|
2196
|
+
const pathRef = React15.useRef("");
|
|
2197
|
+
const lastPointRef = React15.useRef(null);
|
|
2198
|
+
const lastTimeRef = React15.useRef(null);
|
|
2199
|
+
const lastWidthRef = React15.useRef(2);
|
|
2200
|
+
const [isDrawing, setIsDrawing] = React15.useState(false);
|
|
2201
|
+
const [hasDrawing, setHasDrawing] = React15.useState(false);
|
|
2202
|
+
const [isUploading, setIsUploading] = React15.useState(false);
|
|
2203
|
+
const [isConfirmed, setIsConfirmed] = React15.useState(false);
|
|
2204
|
+
const [uploadError, setUploadError] = React15.useState(null);
|
|
2205
|
+
const confirmSignatureRef = React15.useRef(null);
|
|
2206
|
+
React15.useEffect(() => {
|
|
2071
2207
|
if (hasDrawing && !isConfirmed) {
|
|
2072
2208
|
store.registerPreSubmitHandler(fieldId, async () => {
|
|
2073
2209
|
if (confirmSignatureRef.current) {
|
|
@@ -2082,9 +2218,9 @@ var SignatureUploadWidget = ({ fieldId }) => {
|
|
|
2082
2218
|
};
|
|
2083
2219
|
}, [hasDrawing, isConfirmed, fieldId, store]);
|
|
2084
2220
|
const showError = !!error && (touched || state.submitAttempted);
|
|
2085
|
-
const displayUrl =
|
|
2221
|
+
const displayUrl = React15.useMemo(() => extractDisplayUrl(value), [value]);
|
|
2086
2222
|
const showPreview = displayUrl !== null;
|
|
2087
|
-
|
|
2223
|
+
React15.useEffect(() => {
|
|
2088
2224
|
if (showPreview) return;
|
|
2089
2225
|
const canvas = canvasRef.current;
|
|
2090
2226
|
if (!canvas) return;
|
|
@@ -2324,7 +2460,7 @@ var EditableTableWidget = ({
|
|
|
2324
2460
|
const addColumnLabel = def?.addColumnLabel ?? "Add Column";
|
|
2325
2461
|
const newColumnNameHint = def?.newColumnNameHint ?? "New Column Name";
|
|
2326
2462
|
const newColumnNameInputType = def?.newColumnNameInputType ?? "text";
|
|
2327
|
-
const tableData =
|
|
2463
|
+
const tableData = React15.useMemo(() => {
|
|
2328
2464
|
if (value && typeof value === "object" && "columns" in value && "rows" in value) {
|
|
2329
2465
|
return value;
|
|
2330
2466
|
}
|
|
@@ -2339,12 +2475,12 @@ var EditableTableWidget = ({
|
|
|
2339
2475
|
rows: []
|
|
2340
2476
|
};
|
|
2341
2477
|
}, [value, fieldDef]);
|
|
2342
|
-
const dataRef =
|
|
2343
|
-
|
|
2478
|
+
const dataRef = React15.useRef(tableData);
|
|
2479
|
+
React15.useEffect(() => {
|
|
2344
2480
|
dataRef.current = tableData;
|
|
2345
2481
|
}, [tableData]);
|
|
2346
|
-
const [newColumnName, setNewColumnName] =
|
|
2347
|
-
const [newColumnDate, setNewColumnDate] =
|
|
2482
|
+
const [newColumnName, setNewColumnName] = React15.useState("");
|
|
2483
|
+
const [newColumnDate, setNewColumnDate] = React15.useState(void 0);
|
|
2348
2484
|
const updateData = (newData) => {
|
|
2349
2485
|
setValue(newData);
|
|
2350
2486
|
};
|
|
@@ -2412,7 +2548,7 @@ var EditableTableWidget = ({
|
|
|
2412
2548
|
newRows[rowIndex] = { ...newRows[rowIndex], [colId]: val };
|
|
2413
2549
|
updateData({ ...currentData, rows: newRows });
|
|
2414
2550
|
};
|
|
2415
|
-
const columns =
|
|
2551
|
+
const columns = React15.useMemo(() => {
|
|
2416
2552
|
const currentCols = tableData.columns;
|
|
2417
2553
|
const dataCols = currentCols.map((col) => {
|
|
2418
2554
|
const showColumnDelete = !disabled && canDeleteColumn && col.allowDelete !== false;
|
|
@@ -2570,7 +2706,7 @@ var EditableTableWidget = ({
|
|
|
2570
2706
|
] })
|
|
2571
2707
|
] });
|
|
2572
2708
|
};
|
|
2573
|
-
var RadioGroup =
|
|
2709
|
+
var RadioGroup = React15__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
2574
2710
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2575
2711
|
RadioGroupPrimitive__namespace.Root,
|
|
2576
2712
|
{
|
|
@@ -2581,7 +2717,7 @@ var RadioGroup = React13__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
2581
2717
|
);
|
|
2582
2718
|
});
|
|
2583
2719
|
RadioGroup.displayName = RadioGroupPrimitive__namespace.Root.displayName;
|
|
2584
|
-
var RadioGroupItem =
|
|
2720
|
+
var RadioGroupItem = React15__namespace.forwardRef(({ className, ...props }, ref) => {
|
|
2585
2721
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2586
2722
|
RadioGroupPrimitive__namespace.Item,
|
|
2587
2723
|
{
|
|
@@ -2598,11 +2734,11 @@ var RadioGroupItem = React13__namespace.forwardRef(({ className, ...props }, ref
|
|
|
2598
2734
|
RadioGroupItem.displayName = RadioGroupPrimitive__namespace.Item.displayName;
|
|
2599
2735
|
var RadioWidget = ({ fieldId }) => {
|
|
2600
2736
|
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
2601
|
-
const [options, setOptions] =
|
|
2602
|
-
const [loading, setLoading] =
|
|
2737
|
+
const [options, setOptions] = React15.useState([]);
|
|
2738
|
+
const [loading, setLoading] = React15.useState(false);
|
|
2603
2739
|
const { state } = useForm();
|
|
2604
2740
|
const showError = !!error && (touched || state.submitAttempted);
|
|
2605
|
-
|
|
2741
|
+
React15.useEffect(() => {
|
|
2606
2742
|
if (!fieldDef) return;
|
|
2607
2743
|
const def = fieldDef;
|
|
2608
2744
|
if (def.options?.length) {
|
|
@@ -2661,12 +2797,12 @@ function isOptionSelected(selected, optValue) {
|
|
|
2661
2797
|
}
|
|
2662
2798
|
var CheckboxWidget = ({ fieldId }) => {
|
|
2663
2799
|
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
2664
|
-
const [options, setOptions] =
|
|
2665
|
-
const [loading, setLoading] =
|
|
2800
|
+
const [options, setOptions] = React15.useState([]);
|
|
2801
|
+
const [loading, setLoading] = React15.useState(false);
|
|
2666
2802
|
const { state } = useForm();
|
|
2667
2803
|
const showError = !!error && (touched || state.submitAttempted);
|
|
2668
2804
|
const selectedValues = Array.isArray(value) ? value : [];
|
|
2669
|
-
|
|
2805
|
+
React15.useEffect(() => {
|
|
2670
2806
|
if (!fieldDef) return;
|
|
2671
2807
|
const def = fieldDef;
|
|
2672
2808
|
if (def.options?.length) {
|
|
@@ -2721,14 +2857,14 @@ var CheckboxWidget = ({ fieldId }) => {
|
|
|
2721
2857
|
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
2722
2858
|
] });
|
|
2723
2859
|
};
|
|
2724
|
-
var AISuggestionsContext =
|
|
2860
|
+
var AISuggestionsContext = React15.createContext({});
|
|
2725
2861
|
function useAISuggestions() {
|
|
2726
|
-
return
|
|
2862
|
+
return React15.useContext(AISuggestionsContext);
|
|
2727
2863
|
}
|
|
2728
2864
|
var AISuggestionsProvider = AISuggestionsContext.Provider;
|
|
2729
2865
|
var Dialog = DialogPrimitive__namespace.Root;
|
|
2730
2866
|
var DialogPortal = DialogPrimitive__namespace.Portal;
|
|
2731
|
-
var DialogOverlay =
|
|
2867
|
+
var DialogOverlay = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2732
2868
|
DialogPrimitive__namespace.Overlay,
|
|
2733
2869
|
{
|
|
2734
2870
|
ref,
|
|
@@ -2740,7 +2876,7 @@ var DialogOverlay = React13__namespace.forwardRef(({ className, ...props }, ref)
|
|
|
2740
2876
|
}
|
|
2741
2877
|
));
|
|
2742
2878
|
DialogOverlay.displayName = DialogPrimitive__namespace.Overlay.displayName;
|
|
2743
|
-
var DialogContent =
|
|
2879
|
+
var DialogContent = React15__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(DialogPortal, { children: [
|
|
2744
2880
|
/* @__PURE__ */ jsxRuntime.jsx(DialogOverlay, {}),
|
|
2745
2881
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2746
2882
|
DialogPrimitive__namespace.Content,
|
|
@@ -2776,7 +2912,7 @@ var DialogHeader = ({
|
|
|
2776
2912
|
}
|
|
2777
2913
|
);
|
|
2778
2914
|
DialogHeader.displayName = "DialogHeader";
|
|
2779
|
-
var DialogTitle =
|
|
2915
|
+
var DialogTitle = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2780
2916
|
DialogPrimitive__namespace.Title,
|
|
2781
2917
|
{
|
|
2782
2918
|
ref,
|
|
@@ -2788,7 +2924,7 @@ var DialogTitle = React13__namespace.forwardRef(({ className, ...props }, ref) =
|
|
|
2788
2924
|
}
|
|
2789
2925
|
));
|
|
2790
2926
|
DialogTitle.displayName = DialogPrimitive__namespace.Title.displayName;
|
|
2791
|
-
var DialogDescription =
|
|
2927
|
+
var DialogDescription = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
2792
2928
|
DialogPrimitive__namespace.Description,
|
|
2793
2929
|
{
|
|
2794
2930
|
ref,
|
|
@@ -2955,7 +3091,7 @@ function MedicationCard({
|
|
|
2955
3091
|
onUpdate,
|
|
2956
3092
|
onRemove
|
|
2957
3093
|
}) {
|
|
2958
|
-
const [notesOpen, setNotesOpen] =
|
|
3094
|
+
const [notesOpen, setNotesOpen] = React15.useState(false);
|
|
2959
3095
|
function set(key, val) {
|
|
2960
3096
|
onUpdate({ ...med, [key]: val });
|
|
2961
3097
|
}
|
|
@@ -3116,19 +3252,19 @@ var AddMedicationField = ({
|
|
|
3116
3252
|
frequentItems = [],
|
|
3117
3253
|
suggestedMedications = []
|
|
3118
3254
|
}) => {
|
|
3119
|
-
const [open, setOpen] =
|
|
3120
|
-
const [query, setQuery] =
|
|
3121
|
-
const [results, setResults] =
|
|
3122
|
-
const [loading, setLoading] =
|
|
3123
|
-
const [addingResultId, setAddingResultId] =
|
|
3124
|
-
const debounceRef =
|
|
3125
|
-
const customIdRef =
|
|
3126
|
-
const valueRef =
|
|
3127
|
-
const searchInputRef =
|
|
3255
|
+
const [open, setOpen] = React15.useState(false);
|
|
3256
|
+
const [query, setQuery] = React15.useState("");
|
|
3257
|
+
const [results, setResults] = React15.useState([]);
|
|
3258
|
+
const [loading, setLoading] = React15.useState(false);
|
|
3259
|
+
const [addingResultId, setAddingResultId] = React15.useState(null);
|
|
3260
|
+
const debounceRef = React15.useRef(null);
|
|
3261
|
+
const customIdRef = React15.useRef(-1);
|
|
3262
|
+
const valueRef = React15.useRef([]);
|
|
3263
|
+
const searchInputRef = React15.useRef(null);
|
|
3128
3264
|
const safeValue = Array.isArray(value) ? value : [];
|
|
3129
3265
|
valueRef.current = safeValue;
|
|
3130
3266
|
const addedIds = new Set(safeValue.map((m) => String(m.id)));
|
|
3131
|
-
|
|
3267
|
+
React15.useEffect(() => {
|
|
3132
3268
|
if (!open) {
|
|
3133
3269
|
setQuery("");
|
|
3134
3270
|
setResults([]);
|
|
@@ -3356,19 +3492,19 @@ var AddInvestigationField = ({
|
|
|
3356
3492
|
recentlyUsed = [],
|
|
3357
3493
|
frequentItems = []
|
|
3358
3494
|
}) => {
|
|
3359
|
-
const [open, setOpen] =
|
|
3360
|
-
const [query, setQuery] =
|
|
3361
|
-
const [results, setResults] =
|
|
3362
|
-
const [loading, setLoading] =
|
|
3363
|
-
const [addingId, setAddingId] =
|
|
3364
|
-
const [addingFrequentId, setAddingFrequentId] =
|
|
3365
|
-
const debounceRef =
|
|
3366
|
-
const valueRef =
|
|
3367
|
-
const searchInputRef =
|
|
3495
|
+
const [open, setOpen] = React15.useState(false);
|
|
3496
|
+
const [query, setQuery] = React15.useState("");
|
|
3497
|
+
const [results, setResults] = React15.useState([]);
|
|
3498
|
+
const [loading, setLoading] = React15.useState(false);
|
|
3499
|
+
const [addingId, setAddingId] = React15.useState(null);
|
|
3500
|
+
const [addingFrequentId, setAddingFrequentId] = React15.useState(null);
|
|
3501
|
+
const debounceRef = React15.useRef(null);
|
|
3502
|
+
const valueRef = React15.useRef([]);
|
|
3503
|
+
const searchInputRef = React15.useRef(null);
|
|
3368
3504
|
const safeValue = Array.isArray(value) ? value : [];
|
|
3369
3505
|
valueRef.current = safeValue;
|
|
3370
3506
|
const addedIds = new Set(safeValue.map((inv) => inv.id));
|
|
3371
|
-
|
|
3507
|
+
React15.useEffect(() => {
|
|
3372
3508
|
if (!open) {
|
|
3373
3509
|
setQuery("");
|
|
3374
3510
|
setResults([]);
|
|
@@ -3594,21 +3730,21 @@ var AddProcedureField = ({
|
|
|
3594
3730
|
recentlyUsed = [],
|
|
3595
3731
|
frequentItems = []
|
|
3596
3732
|
}) => {
|
|
3597
|
-
const [open, setOpen] =
|
|
3598
|
-
const [query, setQuery] =
|
|
3599
|
-
const [results, setResults] =
|
|
3600
|
-
const [loading, setLoading] =
|
|
3601
|
-
const [addingId, setAddingId] =
|
|
3602
|
-
const [addingFrequentId, setAddingFrequentId] =
|
|
3603
|
-
const debounceRef =
|
|
3604
|
-
const valueRef =
|
|
3605
|
-
const searchInputRef =
|
|
3733
|
+
const [open, setOpen] = React15.useState(false);
|
|
3734
|
+
const [query, setQuery] = React15.useState("");
|
|
3735
|
+
const [results, setResults] = React15.useState([]);
|
|
3736
|
+
const [loading, setLoading] = React15.useState(false);
|
|
3737
|
+
const [addingId, setAddingId] = React15.useState(null);
|
|
3738
|
+
const [addingFrequentId, setAddingFrequentId] = React15.useState(null);
|
|
3739
|
+
const debounceRef = React15.useRef(null);
|
|
3740
|
+
const valueRef = React15.useRef([]);
|
|
3741
|
+
const searchInputRef = React15.useRef(null);
|
|
3606
3742
|
const safeValue = Array.isArray(value) ? value : [];
|
|
3607
3743
|
valueRef.current = safeValue;
|
|
3608
3744
|
const addedIds = new Set(
|
|
3609
3745
|
safeValue.filter((proc) => !proc.is_custom).map((proc) => proc.id)
|
|
3610
3746
|
);
|
|
3611
|
-
|
|
3747
|
+
React15.useEffect(() => {
|
|
3612
3748
|
if (!open) {
|
|
3613
3749
|
setQuery("");
|
|
3614
3750
|
setResults([]);
|
|
@@ -3851,7 +3987,7 @@ function getStatusBasedClass(status) {
|
|
|
3851
3987
|
}
|
|
3852
3988
|
}
|
|
3853
3989
|
function DiagnosisCard({ item, defaultOpen = false }) {
|
|
3854
|
-
const [open, setOpen] =
|
|
3990
|
+
const [open, setOpen] = React15.useState(defaultOpen);
|
|
3855
3991
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border border-gray-200 rounded-lg bg-[#F2F2F2] mb-2 last:mb-0 overflow-hidden", children: [
|
|
3856
3992
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3857
3993
|
"button",
|
|
@@ -3936,7 +4072,7 @@ var DifferentialDiagnosisWidget = ({ fieldId }) => {
|
|
|
3936
4072
|
const items = Array.isArray(value) ? value : [];
|
|
3937
4073
|
return /* @__PURE__ */ jsxRuntime.jsx(DifferentialDiagnosis, { differentialDiagnosis: items });
|
|
3938
4074
|
};
|
|
3939
|
-
var Spinner2 =
|
|
4075
|
+
var Spinner2 = React15__namespace.forwardRef(
|
|
3940
4076
|
({ className, size = "md", ...props }, ref) => {
|
|
3941
4077
|
const sizeClasses = {
|
|
3942
4078
|
sm: "h-4 w-4 border-2",
|
|
@@ -4081,10 +4217,10 @@ var Vitals = ({
|
|
|
4081
4217
|
var VitalsWidget = ({ fieldId }) => {
|
|
4082
4218
|
const { value, setValue, fieldDef } = useField(fieldId);
|
|
4083
4219
|
const handlers = useFieldHandlers(fieldId);
|
|
4084
|
-
const [loading, setLoading] =
|
|
4085
|
-
const [error, setError] =
|
|
4220
|
+
const [loading, setLoading] = React15.useState(false);
|
|
4221
|
+
const [error, setError] = React15.useState(null);
|
|
4086
4222
|
console.log("[VitalsWidget] fieldId:", fieldId, "| onFetch present:", !!handlers.onFetch, "| value:", value);
|
|
4087
|
-
const fetchVitals =
|
|
4223
|
+
const fetchVitals = React15.useCallback(async () => {
|
|
4088
4224
|
if (!handlers.onFetch) return;
|
|
4089
4225
|
setLoading(true);
|
|
4090
4226
|
setError(null);
|
|
@@ -4098,7 +4234,7 @@ var VitalsWidget = ({ fieldId }) => {
|
|
|
4098
4234
|
setLoading(false);
|
|
4099
4235
|
}
|
|
4100
4236
|
}, [handlers, setValue]);
|
|
4101
|
-
|
|
4237
|
+
React15.useEffect(() => {
|
|
4102
4238
|
fetchVitals();
|
|
4103
4239
|
}, []);
|
|
4104
4240
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4167,15 +4303,15 @@ function normalizeValue(value) {
|
|
|
4167
4303
|
var ReferralWidget = ({ fieldId }) => {
|
|
4168
4304
|
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
4169
4305
|
const handlers = useFieldHandlers(fieldId);
|
|
4170
|
-
const [options, setOptions] =
|
|
4171
|
-
const [loading, setLoading] =
|
|
4306
|
+
const [options, setOptions] = React15.useState([]);
|
|
4307
|
+
const [loading, setLoading] = React15.useState(false);
|
|
4172
4308
|
const { state } = useForm();
|
|
4173
4309
|
const showError = !!error && (touched || state.submitAttempted);
|
|
4174
4310
|
const selectedItems = normalizeValue(value);
|
|
4175
4311
|
const availableOptions = options.filter(
|
|
4176
4312
|
(opt) => !selectedItems.some((item) => item.specialization === opt.value)
|
|
4177
4313
|
);
|
|
4178
|
-
const loadOptions =
|
|
4314
|
+
const loadOptions = React15.useCallback(async () => {
|
|
4179
4315
|
if (handlers.onFetchOptions) {
|
|
4180
4316
|
setLoading(true);
|
|
4181
4317
|
try {
|
|
@@ -4196,11 +4332,11 @@ var ReferralWidget = ({ fieldId }) => {
|
|
|
4196
4332
|
setOptions([]);
|
|
4197
4333
|
}
|
|
4198
4334
|
}, [fieldDef, handlers]);
|
|
4199
|
-
|
|
4335
|
+
React15.useEffect(() => {
|
|
4200
4336
|
if (!fieldDef) return;
|
|
4201
4337
|
loadOptions();
|
|
4202
4338
|
}, [fieldDef, loadOptions]);
|
|
4203
|
-
const handleAdd =
|
|
4339
|
+
const handleAdd = React15.useCallback(
|
|
4204
4340
|
(specialization) => {
|
|
4205
4341
|
const next = [...selectedItems, { specialization, is_urgent: false }];
|
|
4206
4342
|
setValue(next);
|
|
@@ -4208,7 +4344,7 @@ var ReferralWidget = ({ fieldId }) => {
|
|
|
4208
4344
|
},
|
|
4209
4345
|
[selectedItems, setValue, setTouched]
|
|
4210
4346
|
);
|
|
4211
|
-
const handleRemove =
|
|
4347
|
+
const handleRemove = React15.useCallback(
|
|
4212
4348
|
(specialization) => {
|
|
4213
4349
|
const next = selectedItems.filter((item) => item.specialization !== specialization);
|
|
4214
4350
|
setValue(next);
|
|
@@ -4216,7 +4352,7 @@ var ReferralWidget = ({ fieldId }) => {
|
|
|
4216
4352
|
},
|
|
4217
4353
|
[selectedItems, setValue, setTouched]
|
|
4218
4354
|
);
|
|
4219
|
-
const handleToggleUrgent =
|
|
4355
|
+
const handleToggleUrgent = React15.useCallback(
|
|
4220
4356
|
(specialization) => {
|
|
4221
4357
|
const next = selectedItems.map(
|
|
4222
4358
|
(item) => item.specialization === specialization ? { ...item, is_urgent: !item.is_urgent } : item
|
|
@@ -4292,7 +4428,7 @@ var ReferralWidget = ({ fieldId }) => {
|
|
|
4292
4428
|
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
4293
4429
|
] });
|
|
4294
4430
|
};
|
|
4295
|
-
var Card =
|
|
4431
|
+
var Card = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4296
4432
|
"div",
|
|
4297
4433
|
{
|
|
4298
4434
|
ref,
|
|
@@ -4304,7 +4440,7 @@ var Card = React13__namespace.forwardRef(({ className, ...props }, ref) => /* @_
|
|
|
4304
4440
|
}
|
|
4305
4441
|
));
|
|
4306
4442
|
Card.displayName = "Card";
|
|
4307
|
-
var CardHeader =
|
|
4443
|
+
var CardHeader = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4308
4444
|
"div",
|
|
4309
4445
|
{
|
|
4310
4446
|
ref,
|
|
@@ -4313,7 +4449,7 @@ var CardHeader = React13__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
4313
4449
|
}
|
|
4314
4450
|
));
|
|
4315
4451
|
CardHeader.displayName = "CardHeader";
|
|
4316
|
-
var CardTitle =
|
|
4452
|
+
var CardTitle = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4317
4453
|
"h3",
|
|
4318
4454
|
{
|
|
4319
4455
|
ref,
|
|
@@ -4325,7 +4461,7 @@ var CardTitle = React13__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
4325
4461
|
}
|
|
4326
4462
|
));
|
|
4327
4463
|
CardTitle.displayName = "CardTitle";
|
|
4328
|
-
var CardDescription =
|
|
4464
|
+
var CardDescription = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4329
4465
|
"p",
|
|
4330
4466
|
{
|
|
4331
4467
|
ref,
|
|
@@ -4334,9 +4470,9 @@ var CardDescription = React13__namespace.forwardRef(({ className, ...props }, re
|
|
|
4334
4470
|
}
|
|
4335
4471
|
));
|
|
4336
4472
|
CardDescription.displayName = "CardDescription";
|
|
4337
|
-
var CardContent =
|
|
4473
|
+
var CardContent = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
|
|
4338
4474
|
CardContent.displayName = "CardContent";
|
|
4339
|
-
var CardFooter =
|
|
4475
|
+
var CardFooter = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4340
4476
|
"div",
|
|
4341
4477
|
{
|
|
4342
4478
|
ref,
|
|
@@ -4422,11 +4558,11 @@ function parseLocalDate(dateString) {
|
|
|
4422
4558
|
var FollowupWidget = ({ fieldId }) => {
|
|
4423
4559
|
const { fieldDef, value, setValue, setTouched, error, disabled, visible } = useField(fieldId);
|
|
4424
4560
|
const followup = normalizeFollowup(value);
|
|
4425
|
-
const [calendarOpen, setCalendarOpen] =
|
|
4561
|
+
const [calendarOpen, setCalendarOpen] = React15.useState(false);
|
|
4426
4562
|
const currentFollowupType = followup ? followup.followupType : "no followup";
|
|
4427
4563
|
const hasFollowup = followup !== false;
|
|
4428
|
-
const [displayMode, setDisplayMode] =
|
|
4429
|
-
const [displayUnit, setDisplayUnit] =
|
|
4564
|
+
const [displayMode, setDisplayMode] = React15.useState("duration");
|
|
4565
|
+
const [displayUnit, setDisplayUnit] = React15.useState("days");
|
|
4430
4566
|
const daysNum = hasFollowup ? parseInt(followup.value, 10) || 7 : 7;
|
|
4431
4567
|
const currentDate = hasFollowup ? daysToDate(daysNum) : null;
|
|
4432
4568
|
const followupMode = displayMode;
|
|
@@ -4434,7 +4570,7 @@ var FollowupWidget = ({ fieldId }) => {
|
|
|
4434
4570
|
displayUnit === "weeks" ? Math.round(daysNum / 7) || 1 : Math.round(daysNum / 30) || 1
|
|
4435
4571
|
) : "7";
|
|
4436
4572
|
const currentUnit = displayUnit;
|
|
4437
|
-
const handleFollowupTypeChange =
|
|
4573
|
+
const handleFollowupTypeChange = React15.useCallback(
|
|
4438
4574
|
(newType) => {
|
|
4439
4575
|
setTouched();
|
|
4440
4576
|
if (newType === "no followup") {
|
|
@@ -4450,11 +4586,11 @@ var FollowupWidget = ({ fieldId }) => {
|
|
|
4450
4586
|
},
|
|
4451
4587
|
[followup, hasFollowup, setValue, setTouched]
|
|
4452
4588
|
);
|
|
4453
|
-
const handleModeChange =
|
|
4589
|
+
const handleModeChange = React15.useCallback((newMode) => {
|
|
4454
4590
|
setDisplayMode(newMode);
|
|
4455
4591
|
if (newMode === "date") setCalendarOpen(false);
|
|
4456
4592
|
}, []);
|
|
4457
|
-
const handleValueChange =
|
|
4593
|
+
const handleValueChange = React15.useCallback(
|
|
4458
4594
|
(newValue) => {
|
|
4459
4595
|
setTouched();
|
|
4460
4596
|
const num = parseInt(newValue, 10);
|
|
@@ -4469,10 +4605,10 @@ var FollowupWidget = ({ fieldId }) => {
|
|
|
4469
4605
|
},
|
|
4470
4606
|
[displayUnit, setValue, setTouched]
|
|
4471
4607
|
);
|
|
4472
|
-
const handleUnitChange =
|
|
4608
|
+
const handleUnitChange = React15.useCallback((newUnit) => {
|
|
4473
4609
|
setDisplayUnit(newUnit);
|
|
4474
4610
|
}, []);
|
|
4475
|
-
const handleDateSelect =
|
|
4611
|
+
const handleDateSelect = React15.useCallback(
|
|
4476
4612
|
(selected) => {
|
|
4477
4613
|
setTouched();
|
|
4478
4614
|
setCalendarOpen(false);
|
|
@@ -4605,13 +4741,13 @@ function useSmartKeywords(text, onSearch, debounceDelay = 1e3) {
|
|
|
4605
4741
|
hasOnSearch: typeof onSearch === "function",
|
|
4606
4742
|
debounceDelay
|
|
4607
4743
|
});
|
|
4608
|
-
const [extractedNouns, setExtractedNouns] =
|
|
4609
|
-
const [matchedConditions, setMatchedConditions] =
|
|
4610
|
-
const [isProcessing, setIsProcessing] =
|
|
4611
|
-
const [error, setError] =
|
|
4612
|
-
const timerRef =
|
|
4613
|
-
const abortRef =
|
|
4614
|
-
const processText =
|
|
4744
|
+
const [extractedNouns, setExtractedNouns] = React15.useState([]);
|
|
4745
|
+
const [matchedConditions, setMatchedConditions] = React15.useState([]);
|
|
4746
|
+
const [isProcessing, setIsProcessing] = React15.useState(false);
|
|
4747
|
+
const [error, setError] = React15.useState(null);
|
|
4748
|
+
const timerRef = React15.useRef(null);
|
|
4749
|
+
const abortRef = React15.useRef(0);
|
|
4750
|
+
const processText = React15.useCallback(
|
|
4615
4751
|
async (input, runId) => {
|
|
4616
4752
|
if (!input || input.trim().length === 0) {
|
|
4617
4753
|
console.log("[useSmartKeywords] skip empty input", {
|
|
@@ -4695,7 +4831,7 @@ function useSmartKeywords(text, onSearch, debounceDelay = 1e3) {
|
|
|
4695
4831
|
},
|
|
4696
4832
|
[onSearch]
|
|
4697
4833
|
);
|
|
4698
|
-
|
|
4834
|
+
React15.useEffect(() => {
|
|
4699
4835
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
4700
4836
|
const runId = ++abortRef.current;
|
|
4701
4837
|
console.log("[useSmartKeywords] schedule debounce", {
|
|
@@ -4732,7 +4868,7 @@ var SmartTextareaWidget = ({ fieldId }) => {
|
|
|
4732
4868
|
const structured = value;
|
|
4733
4869
|
const textValue = structured?.text ?? "";
|
|
4734
4870
|
const showError = !!error && (touched || state.submitAttempted);
|
|
4735
|
-
const onSearch =
|
|
4871
|
+
const onSearch = React15.useCallback(
|
|
4736
4872
|
(query) => handler.onSearch(query),
|
|
4737
4873
|
[handler]
|
|
4738
4874
|
);
|
|
@@ -4742,7 +4878,7 @@ var SmartTextareaWidget = ({ fieldId }) => {
|
|
|
4742
4878
|
def?.debounceDelay ?? 1e3
|
|
4743
4879
|
);
|
|
4744
4880
|
const currentKeywords = structured?.extractedKeywords ?? [];
|
|
4745
|
-
const nextKeywords =
|
|
4881
|
+
const nextKeywords = React15.useMemo(() => {
|
|
4746
4882
|
if (matchedConditions.length === 0 && currentKeywords.length === 0) return currentKeywords;
|
|
4747
4883
|
if (matchedConditions.length === currentKeywords.length && matchedConditions.every(
|
|
4748
4884
|
(m, i) => m.matchedCondition.id === currentKeywords[i]?.matchedCondition.id && m.extractedKeyword === currentKeywords[i]?.extractedKeyword
|
|
@@ -4751,19 +4887,19 @@ var SmartTextareaWidget = ({ fieldId }) => {
|
|
|
4751
4887
|
}
|
|
4752
4888
|
return matchedConditions;
|
|
4753
4889
|
}, [matchedConditions, currentKeywords]);
|
|
4754
|
-
const writeValue =
|
|
4890
|
+
const writeValue = React15.useCallback(
|
|
4755
4891
|
(text, keywords) => {
|
|
4756
4892
|
const next = { text, extractedKeywords: keywords };
|
|
4757
4893
|
setValue(next);
|
|
4758
4894
|
},
|
|
4759
4895
|
[setValue]
|
|
4760
4896
|
);
|
|
4761
|
-
|
|
4897
|
+
React15__namespace.default.useEffect(() => {
|
|
4762
4898
|
if (nextKeywords !== currentKeywords) {
|
|
4763
4899
|
writeValue(textValue, nextKeywords);
|
|
4764
4900
|
}
|
|
4765
4901
|
}, [nextKeywords]);
|
|
4766
|
-
const handleTextChange =
|
|
4902
|
+
const handleTextChange = React15.useCallback(
|
|
4767
4903
|
(e) => {
|
|
4768
4904
|
writeValue(e.target.value, currentKeywords);
|
|
4769
4905
|
},
|
|
@@ -4834,9 +4970,9 @@ var DiagnosisTextareaWidget = ({ fieldId }) => {
|
|
|
4834
4970
|
const { state } = useForm();
|
|
4835
4971
|
const handler = useFieldHandlers(fieldId);
|
|
4836
4972
|
const def = fieldDef;
|
|
4837
|
-
const [gradeGroups, setGradeGroups] =
|
|
4838
|
-
const [isLoadingGrades, setIsLoadingGrades] =
|
|
4839
|
-
const normalized =
|
|
4973
|
+
const [gradeGroups, setGradeGroups] = React15__namespace.default.useState([]);
|
|
4974
|
+
const [isLoadingGrades, setIsLoadingGrades] = React15__namespace.default.useState(false);
|
|
4975
|
+
const normalized = React15__namespace.default.useMemo(() => {
|
|
4840
4976
|
const raw = value;
|
|
4841
4977
|
if (typeof raw === "string") {
|
|
4842
4978
|
return { text: raw, selectedGradesByCondition: {} };
|
|
@@ -4868,7 +5004,7 @@ var DiagnosisTextareaWidget = ({ fieldId }) => {
|
|
|
4868
5004
|
}, [value]);
|
|
4869
5005
|
const textValue = normalized.text;
|
|
4870
5006
|
const showError = !!error && (touched || state.submitAttempted);
|
|
4871
|
-
|
|
5007
|
+
React15__namespace.default.useEffect(() => {
|
|
4872
5008
|
const query = textValue.trim();
|
|
4873
5009
|
const fetchGrades = handler.onFetchDiagnosisGrades;
|
|
4874
5010
|
const debounceMs = def?.debounceDelay ?? 1e3;
|
|
@@ -5173,10 +5309,10 @@ function stripGpalSuffix(label) {
|
|
|
5173
5309
|
return label.replace(/\s*\(G-P-A-L\)\s*$/i, "").trim();
|
|
5174
5310
|
}
|
|
5175
5311
|
function useDebouncedCommit(commit, delayMs) {
|
|
5176
|
-
const timeoutRef =
|
|
5177
|
-
const latestCommit =
|
|
5312
|
+
const timeoutRef = React15.useRef(null);
|
|
5313
|
+
const latestCommit = React15.useRef(commit);
|
|
5178
5314
|
latestCommit.current = commit;
|
|
5179
|
-
|
|
5315
|
+
React15.useEffect(() => {
|
|
5180
5316
|
return () => {
|
|
5181
5317
|
if (timeoutRef.current != null) window.clearTimeout(timeoutRef.current);
|
|
5182
5318
|
};
|
|
@@ -5188,18 +5324,18 @@ function useDebouncedCommit(commit, delayMs) {
|
|
|
5188
5324
|
}
|
|
5189
5325
|
var ObstetricHistoryWidget = ({ fieldId }) => {
|
|
5190
5326
|
const { fieldDef, value, setValue, disabled } = useField(fieldId);
|
|
5191
|
-
const [{ draft, isNewEntry }, setDraftState] =
|
|
5192
|
-
const [lmpError, setLmpError] =
|
|
5193
|
-
const [primaryEddError, setPrimaryEddError] =
|
|
5194
|
-
const [activeGpalKey, setActiveGpalKey] =
|
|
5327
|
+
const [{ draft, isNewEntry }, setDraftState] = React15.useState(() => normalizeToDraft(value));
|
|
5328
|
+
const [lmpError, setLmpError] = React15.useState(null);
|
|
5329
|
+
const [primaryEddError, setPrimaryEddError] = React15.useState(null);
|
|
5330
|
+
const [activeGpalKey, setActiveGpalKey] = React15.useState(null);
|
|
5195
5331
|
const refs = {
|
|
5196
|
-
G:
|
|
5197
|
-
P:
|
|
5198
|
-
A:
|
|
5199
|
-
L:
|
|
5332
|
+
G: React15.useRef(null),
|
|
5333
|
+
P: React15.useRef(null),
|
|
5334
|
+
A: React15.useRef(null),
|
|
5335
|
+
L: React15.useRef(null)
|
|
5200
5336
|
};
|
|
5201
|
-
const today =
|
|
5202
|
-
|
|
5337
|
+
const today = React15.useMemo(() => todayIso(), []);
|
|
5338
|
+
React15.useEffect(() => {
|
|
5203
5339
|
const next = normalizeToDraft(value);
|
|
5204
5340
|
const currStr = JSON.stringify(buildStored(draft, today));
|
|
5205
5341
|
const nextStr = JSON.stringify(buildStored(next.draft, today));
|
|
@@ -5210,7 +5346,7 @@ var ObstetricHistoryWidget = ({ fieldId }) => {
|
|
|
5210
5346
|
setValue(JSON.stringify(stored));
|
|
5211
5347
|
};
|
|
5212
5348
|
const commitDebounced = useDebouncedCommit(commitImmediate, 500);
|
|
5213
|
-
const storedComputed =
|
|
5349
|
+
const storedComputed = React15.useMemo(() => buildStored(draft, today), [draft, today]);
|
|
5214
5350
|
const rightPanelEnabled = draft.is_pregnant && (!!storedComputed.lmp || !!storedComputed.edd?.usg);
|
|
5215
5351
|
const headerLabel = fieldDef?.label ? stripGpalSuffix(fieldDef.label) : "Obstetric History";
|
|
5216
5352
|
const setDraft = (updater, persist) => {
|
|
@@ -5659,7 +5795,7 @@ var numberInputClass = "w-full border border-[#D0D0D0] rounded-md bg-white px-2
|
|
|
5659
5795
|
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";
|
|
5660
5796
|
var OphthalmologyWidget = ({ fieldId }) => {
|
|
5661
5797
|
const { fieldDef, value, setValue, disabled } = useField(fieldId);
|
|
5662
|
-
const safe =
|
|
5798
|
+
const safe = React15.useMemo(() => ensureValue(value), [value]);
|
|
5663
5799
|
const label = fieldDef?.label || "";
|
|
5664
5800
|
const update = (updater) => {
|
|
5665
5801
|
if (disabled) return;
|
|
@@ -6836,7 +6972,7 @@ var headerCellClass = "border border-slate-200 px-2 py-1 text-center font-semibo
|
|
|
6836
6972
|
var cellClass = "border border-slate-200 px-2 py-1 align-top";
|
|
6837
6973
|
var OphthalDiagnosisWidget = ({ fieldId }) => {
|
|
6838
6974
|
const { fieldDef, value, setValue, disabled } = useField(fieldId);
|
|
6839
|
-
const safe =
|
|
6975
|
+
const safe = React15.useMemo(() => ensureValue2(value), [value]);
|
|
6840
6976
|
const label = fieldDef?.label || "";
|
|
6841
6977
|
const updateEyeField = (eye, fieldLabel, next) => {
|
|
6842
6978
|
if (disabled) return;
|
|
@@ -6886,7 +7022,7 @@ var OphthalDiagnosisWidget = ({ fieldId }) => {
|
|
|
6886
7022
|
] })
|
|
6887
7023
|
] });
|
|
6888
7024
|
};
|
|
6889
|
-
var Slider =
|
|
7025
|
+
var Slider = React15__namespace.forwardRef(({ className, trackClassName, thumbClassName, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6890
7026
|
SliderPrimitive__namespace.Root,
|
|
6891
7027
|
{
|
|
6892
7028
|
ref,
|
|
@@ -6980,7 +7116,7 @@ var OrthopedicExamWidget = ({ fieldId }) => {
|
|
|
6980
7116
|
const { fieldDef, value, setValue, setTouched, error, touched, disabled } = useField(fieldId);
|
|
6981
7117
|
const { state } = useForm();
|
|
6982
7118
|
const showError = !!error && (touched || state.submitAttempted);
|
|
6983
|
-
const safeValue =
|
|
7119
|
+
const safeValue = React15.useMemo(() => {
|
|
6984
7120
|
if (!value || typeof value !== "object") return defaultValue();
|
|
6985
7121
|
const v = value;
|
|
6986
7122
|
const concerns = Array.isArray(v.concerns) ? v.concerns : [];
|
|
@@ -7002,10 +7138,10 @@ var OrthopedicExamWidget = ({ fieldId }) => {
|
|
|
7002
7138
|
}
|
|
7003
7139
|
};
|
|
7004
7140
|
}, [value]);
|
|
7005
|
-
const [panelOpen, setPanelOpen] =
|
|
7006
|
-
const draggingRef =
|
|
7007
|
-
const prevConcernsLengthRef =
|
|
7008
|
-
const reminderSections =
|
|
7141
|
+
const [panelOpen, setPanelOpen] = React15.useState(false);
|
|
7142
|
+
const draggingRef = React15.useRef(null);
|
|
7143
|
+
const prevConcernsLengthRef = React15.useRef(safeValue.concerns.length);
|
|
7144
|
+
const reminderSections = React15.useMemo(() => {
|
|
7009
7145
|
return safeValue.concerns.map((id) => ({
|
|
7010
7146
|
id,
|
|
7011
7147
|
label: CONCERNS.find((c) => c.id === id)?.label ?? id,
|
|
@@ -7013,7 +7149,7 @@ var OrthopedicExamWidget = ({ fieldId }) => {
|
|
|
7013
7149
|
})).filter((s) => s.points.length > 0);
|
|
7014
7150
|
}, [safeValue.concerns]);
|
|
7015
7151
|
const hasReminders = reminderSections.length > 0;
|
|
7016
|
-
|
|
7152
|
+
React15.useEffect(() => {
|
|
7017
7153
|
const prevLen = prevConcernsLengthRef.current;
|
|
7018
7154
|
const currLen = safeValue.concerns.length;
|
|
7019
7155
|
prevConcernsLengthRef.current = currLen;
|
|
@@ -7028,7 +7164,7 @@ var OrthopedicExamWidget = ({ fieldId }) => {
|
|
|
7028
7164
|
setPanelOpen(true);
|
|
7029
7165
|
}
|
|
7030
7166
|
}, [safeValue, setValue]);
|
|
7031
|
-
|
|
7167
|
+
React15.useEffect(() => {
|
|
7032
7168
|
const onMove = (e) => {
|
|
7033
7169
|
if (!draggingRef.current) return;
|
|
7034
7170
|
const { startX, startY, startTop, startRight } = draggingRef.current;
|
|
@@ -7274,6 +7410,9 @@ var FieldRenderer = ({ fieldId }) => {
|
|
|
7274
7410
|
if (!visible || !fieldDef) {
|
|
7275
7411
|
return null;
|
|
7276
7412
|
}
|
|
7413
|
+
return renderWidget(fieldId, fieldDef);
|
|
7414
|
+
};
|
|
7415
|
+
function renderWidget(fieldId, fieldDef) {
|
|
7277
7416
|
switch (fieldDef.type) {
|
|
7278
7417
|
case "text":
|
|
7279
7418
|
case "number":
|
|
@@ -7346,9 +7485,9 @@ var FieldRenderer = ({ fieldId }) => {
|
|
|
7346
7485
|
fieldDef.type
|
|
7347
7486
|
] });
|
|
7348
7487
|
}
|
|
7349
|
-
}
|
|
7488
|
+
}
|
|
7350
7489
|
var Section = ({ title, children }) => {
|
|
7351
|
-
const [expanded, setExpanded] =
|
|
7490
|
+
const [expanded, setExpanded] = React15.useState(true);
|
|
7352
7491
|
const handleToggle = () => setExpanded((prev) => !prev);
|
|
7353
7492
|
const contentClassName = cn(
|
|
7354
7493
|
"overflow-hidden transition-[height] duration-200 ease-in-out",
|
|
@@ -7401,7 +7540,7 @@ var DynamicForm = () => {
|
|
|
7401
7540
|
children: child.children.map((fieldId) => /* @__PURE__ */ jsxRuntime.jsx(FieldRenderer, { fieldId }, fieldId))
|
|
7402
7541
|
},
|
|
7403
7542
|
child.id
|
|
7404
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
7543
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(React15__namespace.default.Fragment, {}, child.id ?? index)
|
|
7405
7544
|
) }, node.id);
|
|
7406
7545
|
}
|
|
7407
7546
|
if (node.type === "column_layout") {
|
|
@@ -7489,13 +7628,13 @@ var SmartForm = ({
|
|
|
7489
7628
|
}) => {
|
|
7490
7629
|
const store = useFormStore();
|
|
7491
7630
|
const schema = store.getSchema();
|
|
7492
|
-
const prevAiResultRef =
|
|
7493
|
-
const aiSuggestions =
|
|
7631
|
+
const prevAiResultRef = React15.useRef(void 0);
|
|
7632
|
+
const aiSuggestions = React15.useMemo(() => {
|
|
7494
7633
|
if (aiAnalysisResult == null) return { medications: [] };
|
|
7495
7634
|
const medications = normalizeAIMedications(aiAnalysisResult.medications);
|
|
7496
7635
|
return { medications };
|
|
7497
7636
|
}, [aiAnalysisResult]);
|
|
7498
|
-
|
|
7637
|
+
React15.useEffect(() => {
|
|
7499
7638
|
if (aiAnalysisResult == null || Object.keys(aiAnalysisResult).length === 0) return;
|
|
7500
7639
|
const prev = prevAiResultRef.current;
|
|
7501
7640
|
if (prev != null && prev === aiAnalysisResult && shallowEqualKeys(prev, aiAnalysisResult)) return;
|
|
@@ -7568,9 +7707,9 @@ var ReadOnlyText = ({ fieldDef, value }) => {
|
|
|
7568
7707
|
] });
|
|
7569
7708
|
};
|
|
7570
7709
|
var ReadOnlySelect = ({ fieldDef, value }) => {
|
|
7571
|
-
const [options, setOptions] =
|
|
7572
|
-
const [loading, setLoading] =
|
|
7573
|
-
|
|
7710
|
+
const [options, setOptions] = React15.useState([]);
|
|
7711
|
+
const [loading, setLoading] = React15.useState(false);
|
|
7712
|
+
React15.useEffect(() => {
|
|
7574
7713
|
if (fieldDef.options) {
|
|
7575
7714
|
setOptions(fieldDef.options);
|
|
7576
7715
|
} else if (fieldDef.dataSource) {
|
|
@@ -7592,9 +7731,9 @@ var ReadOnlySelect = ({ fieldDef, value }) => {
|
|
|
7592
7731
|
] });
|
|
7593
7732
|
};
|
|
7594
7733
|
var ReadOnlyMultiSelect = ({ fieldDef, value }) => {
|
|
7595
|
-
const [options, setOptions] =
|
|
7596
|
-
const [loading, setLoading] =
|
|
7597
|
-
|
|
7734
|
+
const [options, setOptions] = React15.useState([]);
|
|
7735
|
+
const [loading, setLoading] = React15.useState(false);
|
|
7736
|
+
React15.useEffect(() => {
|
|
7598
7737
|
if (fieldDef.options) {
|
|
7599
7738
|
setOptions(fieldDef.options);
|
|
7600
7739
|
} else if (fieldDef.dataSource) {
|
|
@@ -7743,13 +7882,13 @@ var ReadOnlyTable = ({
|
|
|
7743
7882
|
fieldDef,
|
|
7744
7883
|
value
|
|
7745
7884
|
}) => {
|
|
7746
|
-
const tableData =
|
|
7885
|
+
const tableData = React15.useMemo(() => {
|
|
7747
7886
|
if (value && typeof value === "object" && "columns" in value && "rows" in value && Array.isArray(value.columns) && Array.isArray(value.rows)) {
|
|
7748
7887
|
return value;
|
|
7749
7888
|
}
|
|
7750
7889
|
return { columns: [], rows: [] };
|
|
7751
7890
|
}, [value]);
|
|
7752
|
-
const columns =
|
|
7891
|
+
const columns = React15.useMemo(() => {
|
|
7753
7892
|
return tableData.columns.map((col) => ({
|
|
7754
7893
|
accessorKey: col.id,
|
|
7755
7894
|
header: col.label,
|
|
@@ -7804,9 +7943,9 @@ var ReadOnlyDateTime = ({ fieldDef, value }) => {
|
|
|
7804
7943
|
] });
|
|
7805
7944
|
};
|
|
7806
7945
|
var ReadOnlyRadio = ({ fieldDef, value }) => {
|
|
7807
|
-
const [options, setOptions] =
|
|
7808
|
-
const [loading, setLoading] =
|
|
7809
|
-
|
|
7946
|
+
const [options, setOptions] = React15.useState([]);
|
|
7947
|
+
const [loading, setLoading] = React15.useState(false);
|
|
7948
|
+
React15.useEffect(() => {
|
|
7810
7949
|
if (fieldDef.options?.length) {
|
|
7811
7950
|
setOptions(fieldDef.options);
|
|
7812
7951
|
} else if (fieldDef.dataSource) {
|
|
@@ -7831,9 +7970,9 @@ function isOptionSelected2(selected, optValue) {
|
|
|
7831
7970
|
);
|
|
7832
7971
|
}
|
|
7833
7972
|
var ReadOnlyCheckbox = ({ fieldDef, value }) => {
|
|
7834
|
-
const [options, setOptions] =
|
|
7835
|
-
const [loading, setLoading] =
|
|
7836
|
-
|
|
7973
|
+
const [options, setOptions] = React15.useState([]);
|
|
7974
|
+
const [loading, setLoading] = React15.useState(false);
|
|
7975
|
+
React15.useEffect(() => {
|
|
7837
7976
|
if (fieldDef.options?.length) {
|
|
7838
7977
|
setOptions(fieldDef.options);
|
|
7839
7978
|
} else if (fieldDef.dataSource) {
|
|
@@ -7985,7 +8124,7 @@ var ReadOnlyForm = ({ schema, submission }) => {
|
|
|
7985
8124
|
child.id
|
|
7986
8125
|
);
|
|
7987
8126
|
}
|
|
7988
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8127
|
+
return /* @__PURE__ */ jsxRuntime.jsx(React15__namespace.default.Fragment, {}, child.id ?? index);
|
|
7989
8128
|
};
|
|
7990
8129
|
const hasContent = node.children.some(
|
|
7991
8130
|
(child) => typeof child === "string" ? fieldMap.has(child) : child.type === "column_layout" && child.children?.some((id) => fieldMap.has(id))
|