formanitor 0.0.50 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +673 -349
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +116 -70
- package/dist/index.d.ts +116 -70
- package/dist/index.mjs +667 -350
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React15 from 'react';
|
|
2
2
|
import React15__default, { createContext, useContext, useRef, useEffect, useState, useMemo, useCallback, useReducer } from 'react';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
|
-
import { ChevronDown, ChevronUp, Check, Circle, X, Image, Upload, Trash2, Plus, Loader2, PenTool, Mic, Undo, Redo, ChevronRight, Calendar as Calendar$1, ChevronLeft, RefreshCw, Clock, Bold, Italic, Underline as Underline$1, Strikethrough, List, ListOrdered } from 'lucide-react';
|
|
5
4
|
import { clsx } from 'clsx';
|
|
6
5
|
import { twMerge } from 'tailwind-merge';
|
|
6
|
+
import { ChevronDown, ChevronUp, Check, Circle, X, Image, Upload, Trash2, Plus, Loader2, PenTool, Mic, Undo, Redo, ChevronRight, Calendar as Calendar$1, ChevronLeft, RefreshCw, Clock, Bold, Italic, Underline as Underline$1, Strikethrough, List, ListOrdered } from 'lucide-react';
|
|
7
7
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
8
8
|
import { cva } from 'class-variance-authority';
|
|
9
9
|
import { useEditor, EditorContent } from '@tiptap/react';
|
|
@@ -1891,6 +1891,9 @@ function useField(fieldId) {
|
|
|
1891
1891
|
setTouched
|
|
1892
1892
|
};
|
|
1893
1893
|
}
|
|
1894
|
+
function cn(...inputs) {
|
|
1895
|
+
return twMerge(clsx(inputs));
|
|
1896
|
+
}
|
|
1894
1897
|
function RecordingWave() {
|
|
1895
1898
|
const bars = [
|
|
1896
1899
|
{ dur: "0.6s", values: "3;10;3", yValues: "4.5;0;4.5", delay: "0s" },
|
|
@@ -1957,9 +1960,6 @@ function VoiceMicButton({ fieldId, onTranscriptReady }) {
|
|
|
1957
1960
|
}
|
|
1958
1961
|
);
|
|
1959
1962
|
}
|
|
1960
|
-
function cn(...inputs) {
|
|
1961
|
-
return twMerge(clsx(inputs));
|
|
1962
|
-
}
|
|
1963
1963
|
var Input = React15.forwardRef(
|
|
1964
1964
|
({ className, type, ...props }, ref) => {
|
|
1965
1965
|
return /* @__PURE__ */ jsx(
|
|
@@ -2030,6 +2030,41 @@ function getThemeConfig(fieldType, themeName) {
|
|
|
2030
2030
|
if (!registry) return void 0;
|
|
2031
2031
|
return registry[themeName];
|
|
2032
2032
|
}
|
|
2033
|
+
function isLabelVisible(fieldDef) {
|
|
2034
|
+
return fieldDef.style?.labelVisible !== false;
|
|
2035
|
+
}
|
|
2036
|
+
function FieldRequiredIndicator({
|
|
2037
|
+
fieldDef
|
|
2038
|
+
}) {
|
|
2039
|
+
if (!fieldDef.required) return null;
|
|
2040
|
+
if (fieldDef.style?.showRequiredAsterisk === false) return null;
|
|
2041
|
+
return /* @__PURE__ */ jsx(
|
|
2042
|
+
"span",
|
|
2043
|
+
{
|
|
2044
|
+
className: cn(
|
|
2045
|
+
"text-red-500",
|
|
2046
|
+
fieldDef.style?.classNames?.requiredIndicator
|
|
2047
|
+
),
|
|
2048
|
+
"aria-hidden": true,
|
|
2049
|
+
children: "*"
|
|
2050
|
+
}
|
|
2051
|
+
);
|
|
2052
|
+
}
|
|
2053
|
+
function fieldWrapperClass(fieldDef, ...defaults) {
|
|
2054
|
+
return cn(...defaults, fieldDef.style?.classNames?.wrapper);
|
|
2055
|
+
}
|
|
2056
|
+
function fieldLabelClass(fieldDef, ...defaults) {
|
|
2057
|
+
return cn(...defaults, fieldDef.style?.classNames?.label);
|
|
2058
|
+
}
|
|
2059
|
+
function fieldControlClass(fieldDef, ...defaults) {
|
|
2060
|
+
return cn(...defaults, fieldDef.style?.classNames?.control);
|
|
2061
|
+
}
|
|
2062
|
+
function fieldDescriptionClass(fieldDef, ...defaults) {
|
|
2063
|
+
return cn(...defaults, fieldDef.style?.classNames?.description);
|
|
2064
|
+
}
|
|
2065
|
+
function fieldErrorClass(fieldDef, ...defaults) {
|
|
2066
|
+
return cn(...defaults, fieldDef.style?.classNames?.error);
|
|
2067
|
+
}
|
|
2033
2068
|
var TextWidget = ({ fieldId }) => {
|
|
2034
2069
|
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
2035
2070
|
const { state } = useForm();
|
|
@@ -2047,34 +2082,50 @@ var TextWidget = ({ fieldId }) => {
|
|
|
2047
2082
|
const wrapperClass = theme?.wrapperClassName ?? "space-y-2";
|
|
2048
2083
|
const labelClass = theme?.labelClassName;
|
|
2049
2084
|
const inputClass = cn(theme?.inputClassName, showError && "border-red-500");
|
|
2085
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
2050
2086
|
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2051
2087
|
fieldDef.label,
|
|
2052
2088
|
" ",
|
|
2053
|
-
|
|
2089
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
2054
2090
|
] });
|
|
2055
|
-
const labelEl = theme ? /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, children: labelContent });
|
|
2091
|
+
const labelEl = showLabel ? theme ? /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef, labelClass), children: labelContent }) : /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: labelContent }) : null;
|
|
2056
2092
|
const placeholder = typeof fieldDef.placeholder === "string" && fieldDef.placeholder.trim() ? fieldDef.placeholder : void 0;
|
|
2057
|
-
return /* @__PURE__ */ jsxs(
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2093
|
+
return /* @__PURE__ */ jsxs(
|
|
2094
|
+
"div",
|
|
2095
|
+
{
|
|
2096
|
+
className: fieldWrapperClass(
|
|
2097
|
+
fieldDef,
|
|
2098
|
+
wrapperClass,
|
|
2099
|
+
isTextarea && "flex h-full min-h-0 flex-col"
|
|
2100
|
+
),
|
|
2101
|
+
children: [
|
|
2102
|
+
hasVoice ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
2103
|
+
labelEl,
|
|
2104
|
+
/* @__PURE__ */ jsx(VoiceMicButton, { fieldId, onTranscriptReady: setValue })
|
|
2105
|
+
] }) : labelEl,
|
|
2106
|
+
/* @__PURE__ */ jsx(
|
|
2107
|
+
Component,
|
|
2108
|
+
{
|
|
2109
|
+
id: fieldId,
|
|
2110
|
+
value: value || "",
|
|
2111
|
+
onChange: (e) => setValue(fieldDef.type === "number" ? Number(e.target.value) : e.target.value),
|
|
2112
|
+
onBlur: setTouched,
|
|
2113
|
+
disabled,
|
|
2114
|
+
type: fieldDef.type === "number" ? "number" : "text",
|
|
2115
|
+
className: fieldControlClass(
|
|
2116
|
+
fieldDef,
|
|
2117
|
+
inputClass,
|
|
2118
|
+
isTextarea && height == null && "min-h-[80px] flex-1"
|
|
2119
|
+
),
|
|
2120
|
+
placeholder,
|
|
2121
|
+
"aria-label": !showLabel ? fieldDef.label : void 0,
|
|
2122
|
+
...isTextarea && { height }
|
|
2123
|
+
}
|
|
2124
|
+
),
|
|
2125
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
2126
|
+
]
|
|
2127
|
+
}
|
|
2128
|
+
);
|
|
2078
2129
|
};
|
|
2079
2130
|
var buttonVariants = cva(
|
|
2080
2131
|
"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",
|
|
@@ -2338,24 +2389,28 @@ var RichTextWidget = ({ fieldId }) => {
|
|
|
2338
2389
|
}
|
|
2339
2390
|
}, [stringValue, editor]);
|
|
2340
2391
|
if (!fieldDef) return null;
|
|
2392
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
2341
2393
|
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2342
2394
|
fieldDef.label,
|
|
2343
2395
|
" ",
|
|
2344
|
-
|
|
2396
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
2345
2397
|
] });
|
|
2346
|
-
const labelEl = /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, children: labelContent });
|
|
2347
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
2398
|
+
const labelEl = /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: labelContent });
|
|
2399
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
2348
2400
|
hasVoice ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
2349
|
-
labelEl,
|
|
2401
|
+
showLabel ? labelEl : null,
|
|
2350
2402
|
/* @__PURE__ */ jsx(VoiceMicButton, { fieldId, onTranscriptReady: setValue })
|
|
2351
|
-
] }) : labelEl,
|
|
2403
|
+
] }) : showLabel ? labelEl : null,
|
|
2352
2404
|
/* @__PURE__ */ jsxs(
|
|
2353
2405
|
"div",
|
|
2354
2406
|
{
|
|
2355
|
-
className:
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2407
|
+
className: fieldControlClass(
|
|
2408
|
+
fieldDef,
|
|
2409
|
+
cn(
|
|
2410
|
+
"rounded-md border border-input bg-background text-sm ring-offset-background overflow-hidden",
|
|
2411
|
+
showError && "border-red-500",
|
|
2412
|
+
disabled && "opacity-60"
|
|
2413
|
+
)
|
|
2359
2414
|
),
|
|
2360
2415
|
children: [
|
|
2361
2416
|
/* @__PURE__ */ jsx(RichTextToolbar, { editor, disabled }),
|
|
@@ -2381,7 +2436,7 @@ var RichTextWidget = ({ fieldId }) => {
|
|
|
2381
2436
|
]
|
|
2382
2437
|
}
|
|
2383
2438
|
),
|
|
2384
|
-
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
2439
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
2385
2440
|
] });
|
|
2386
2441
|
};
|
|
2387
2442
|
var Select = SelectPrimitive.Root;
|
|
@@ -2547,12 +2602,13 @@ var SelectWidget = ({ fieldId }) => {
|
|
|
2547
2602
|
if (!fieldDef) return null;
|
|
2548
2603
|
const schemaPlaceholder = typeof fieldDef.placeholder === "string" && fieldDef.placeholder.trim() ? fieldDef.placeholder : void 0;
|
|
2549
2604
|
const selectPlaceholder = loading ? "Loading..." : schemaPlaceholder ?? "Select...";
|
|
2550
|
-
|
|
2551
|
-
|
|
2605
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
2606
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
2607
|
+
showLabel ? /* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
2552
2608
|
fieldDef.label,
|
|
2553
2609
|
" ",
|
|
2554
|
-
|
|
2555
|
-
] }),
|
|
2610
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
2611
|
+
] }) : null,
|
|
2556
2612
|
/* @__PURE__ */ jsxs(
|
|
2557
2613
|
Select,
|
|
2558
2614
|
{
|
|
@@ -2564,12 +2620,22 @@ var SelectWidget = ({ fieldId }) => {
|
|
|
2564
2620
|
setTouched();
|
|
2565
2621
|
},
|
|
2566
2622
|
children: [
|
|
2567
|
-
/* @__PURE__ */ jsx(
|
|
2623
|
+
/* @__PURE__ */ jsx(
|
|
2624
|
+
SelectTrigger,
|
|
2625
|
+
{
|
|
2626
|
+
id: fieldId,
|
|
2627
|
+
className: fieldControlClass(
|
|
2628
|
+
fieldDef,
|
|
2629
|
+
showError ? "border-red-500" : ""
|
|
2630
|
+
),
|
|
2631
|
+
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: selectPlaceholder })
|
|
2632
|
+
}
|
|
2633
|
+
),
|
|
2568
2634
|
/* @__PURE__ */ jsx(SelectContent, { children: options.map((opt) => /* @__PURE__ */ jsx(SelectItem, { value: String(opt.value), children: opt.label }, String(opt.value))) })
|
|
2569
2635
|
]
|
|
2570
2636
|
}
|
|
2571
2637
|
),
|
|
2572
|
-
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
2638
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
2573
2639
|
] });
|
|
2574
2640
|
};
|
|
2575
2641
|
var Checkbox = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
@@ -2616,34 +2682,44 @@ var MultiSelectWidget = ({ fieldId }) => {
|
|
|
2616
2682
|
setTouched();
|
|
2617
2683
|
};
|
|
2618
2684
|
if (!fieldDef) return null;
|
|
2619
|
-
|
|
2620
|
-
|
|
2685
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
2686
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
2687
|
+
showLabel ? /* @__PURE__ */ jsxs(Label, { className: fieldLabelClass(fieldDef), children: [
|
|
2621
2688
|
fieldDef.label,
|
|
2622
2689
|
" ",
|
|
2623
|
-
|
|
2624
|
-
] }),
|
|
2625
|
-
/* @__PURE__ */ jsxs(
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
{
|
|
2631
|
-
id: `${fieldId}-${opt.value}`,
|
|
2632
|
-
checked: currentValues.includes(opt.value),
|
|
2633
|
-
onCheckedChange: () => toggleValue(opt.value)
|
|
2634
|
-
}
|
|
2690
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
2691
|
+
] }) : null,
|
|
2692
|
+
/* @__PURE__ */ jsxs(
|
|
2693
|
+
"div",
|
|
2694
|
+
{
|
|
2695
|
+
className: fieldControlClass(
|
|
2696
|
+
fieldDef,
|
|
2697
|
+
`border rounded-md p-3 space-y-2 ${showError ? "border-red-500" : ""} ${disabled ? "opacity-50 pointer-events-none" : ""}`
|
|
2635
2698
|
),
|
|
2636
|
-
|
|
2637
|
-
"
|
|
2638
|
-
{
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2699
|
+
children: [
|
|
2700
|
+
loading && /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500", children: "Loading options..." }),
|
|
2701
|
+
!loading && options.map((opt) => /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
2702
|
+
/* @__PURE__ */ jsx(
|
|
2703
|
+
Checkbox,
|
|
2704
|
+
{
|
|
2705
|
+
id: `${fieldId}-${opt.value}`,
|
|
2706
|
+
checked: currentValues.includes(opt.value),
|
|
2707
|
+
onCheckedChange: () => toggleValue(opt.value)
|
|
2708
|
+
}
|
|
2709
|
+
),
|
|
2710
|
+
/* @__PURE__ */ jsx(
|
|
2711
|
+
"label",
|
|
2712
|
+
{
|
|
2713
|
+
htmlFor: `${fieldId}-${opt.value}`,
|
|
2714
|
+
className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
2715
|
+
children: opt.label
|
|
2716
|
+
}
|
|
2717
|
+
)
|
|
2718
|
+
] }, String(opt.value)))
|
|
2719
|
+
]
|
|
2720
|
+
}
|
|
2721
|
+
),
|
|
2722
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
2647
2723
|
] });
|
|
2648
2724
|
};
|
|
2649
2725
|
var Table = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
|
|
@@ -2982,22 +3058,26 @@ var DateWidget = ({ fieldId }) => {
|
|
|
2982
3058
|
const { state } = useForm();
|
|
2983
3059
|
const showError = !!error && (touched || state.submitAttempted);
|
|
2984
3060
|
if (!fieldDef) return null;
|
|
2985
|
-
|
|
2986
|
-
|
|
3061
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
3062
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
3063
|
+
showLabel ? /* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
2987
3064
|
fieldDef.label,
|
|
2988
3065
|
" ",
|
|
2989
|
-
|
|
2990
|
-
] }),
|
|
3066
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
3067
|
+
] }) : null,
|
|
2991
3068
|
/* @__PURE__ */ jsx("div", { onBlur: () => setTouched(), children: /* @__PURE__ */ jsx(
|
|
2992
3069
|
DatePicker,
|
|
2993
3070
|
{
|
|
2994
3071
|
date: value ? new Date(value) : void 0,
|
|
2995
3072
|
setDate: (date) => setValue(date ? date.toISOString() : void 0),
|
|
2996
3073
|
placeholder: fieldDef.placeholder,
|
|
2997
|
-
className:
|
|
3074
|
+
className: fieldControlClass(
|
|
3075
|
+
fieldDef,
|
|
3076
|
+
showError ? "border-red-500 w-full" : "w-full"
|
|
3077
|
+
)
|
|
2998
3078
|
}
|
|
2999
3079
|
) }),
|
|
3000
|
-
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
3080
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
3001
3081
|
] });
|
|
3002
3082
|
};
|
|
3003
3083
|
function parseTimeString(value) {
|
|
@@ -3114,6 +3194,7 @@ var DateTimeWidget = ({ fieldId }) => {
|
|
|
3114
3194
|
const showError = !!error && (touched || state.submitAttempted);
|
|
3115
3195
|
if (!fieldDef) return null;
|
|
3116
3196
|
const currentDate = value ? new Date(value) : void 0;
|
|
3197
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
3117
3198
|
const handleChange = (date) => {
|
|
3118
3199
|
if (!date) {
|
|
3119
3200
|
setValue(void 0);
|
|
@@ -3121,12 +3202,12 @@ var DateTimeWidget = ({ fieldId }) => {
|
|
|
3121
3202
|
}
|
|
3122
3203
|
setValue(date.toISOString());
|
|
3123
3204
|
};
|
|
3124
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
3125
|
-
/* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, children: [
|
|
3205
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
3206
|
+
showLabel ? /* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
3126
3207
|
fieldDef.label,
|
|
3127
3208
|
" ",
|
|
3128
|
-
|
|
3129
|
-
] }),
|
|
3209
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
3210
|
+
] }) : null,
|
|
3130
3211
|
/* @__PURE__ */ jsx(
|
|
3131
3212
|
"div",
|
|
3132
3213
|
{
|
|
@@ -3138,12 +3219,15 @@ var DateTimeWidget = ({ fieldId }) => {
|
|
|
3138
3219
|
dateTime: currentDate,
|
|
3139
3220
|
setDateTime: handleChange,
|
|
3140
3221
|
placeholder: fieldDef.placeholder,
|
|
3141
|
-
className:
|
|
3222
|
+
className: fieldControlClass(
|
|
3223
|
+
fieldDef,
|
|
3224
|
+
showError ? "border-red-500 w-full" : "w-full"
|
|
3225
|
+
)
|
|
3142
3226
|
}
|
|
3143
3227
|
)
|
|
3144
3228
|
}
|
|
3145
3229
|
),
|
|
3146
|
-
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
3230
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
3147
3231
|
] });
|
|
3148
3232
|
};
|
|
3149
3233
|
function extractImageDisplayUrl(value) {
|
|
@@ -3174,13 +3258,15 @@ var ImageUploadWidget = ({ fieldId }) => {
|
|
|
3174
3258
|
}
|
|
3175
3259
|
};
|
|
3176
3260
|
if (!fieldDef) return null;
|
|
3261
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
3177
3262
|
const uploadHandler = store.getUploadHandler();
|
|
3178
3263
|
if (!uploadHandler) {
|
|
3179
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
3180
|
-
/* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, children: [
|
|
3264
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
3265
|
+
showLabel ? /* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
3181
3266
|
fieldDef.label,
|
|
3182
|
-
|
|
3183
|
-
|
|
3267
|
+
" ",
|
|
3268
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
3269
|
+
] }) : null,
|
|
3184
3270
|
/* @__PURE__ */ jsx("div", { className: "border-2 border-red-300 rounded-lg p-4 bg-red-50", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-red-600", children: "Upload handler not configured. Please provide an onUpload function in FormProvider config." }) })
|
|
3185
3271
|
] });
|
|
3186
3272
|
}
|
|
@@ -3248,49 +3334,59 @@ var ImageUploadWidget = ({ fieldId }) => {
|
|
|
3248
3334
|
const handleUploadClick = () => {
|
|
3249
3335
|
fileInputRef.current?.click();
|
|
3250
3336
|
};
|
|
3251
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
3252
|
-
/* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, children: [
|
|
3337
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
3338
|
+
showLabel ? /* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
3253
3339
|
fieldDef.label,
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
children:
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3340
|
+
" ",
|
|
3341
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
3342
|
+
] }) : null,
|
|
3343
|
+
/* @__PURE__ */ jsx(
|
|
3344
|
+
"div",
|
|
3345
|
+
{
|
|
3346
|
+
className: fieldControlClass(
|
|
3347
|
+
fieldDef,
|
|
3348
|
+
"border-2 border-dashed border-gray-300 rounded-lg p-4"
|
|
3349
|
+
),
|
|
3350
|
+
children: preview ? /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
3351
|
+
/* @__PURE__ */ jsx(
|
|
3352
|
+
"img",
|
|
3353
|
+
{
|
|
3354
|
+
src: preview,
|
|
3355
|
+
alt: "Uploaded image",
|
|
3356
|
+
className: "max-w-full max-h-48 mx-auto rounded-lg"
|
|
3357
|
+
}
|
|
3358
|
+
),
|
|
3359
|
+
/* @__PURE__ */ jsx(
|
|
3360
|
+
Button,
|
|
3361
|
+
{
|
|
3362
|
+
type: "button",
|
|
3363
|
+
variant: "destructive",
|
|
3364
|
+
size: "sm",
|
|
3365
|
+
className: "absolute top-2 right-2",
|
|
3366
|
+
onClick: handleRemove,
|
|
3367
|
+
disabled: disabled || isUploading,
|
|
3368
|
+
children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
|
|
3369
|
+
}
|
|
3370
|
+
)
|
|
3371
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "text-center py-8", children: [
|
|
3372
|
+
/* @__PURE__ */ jsx(Image, { className: "h-12 w-12 mx-auto text-gray-400 mb-4" }),
|
|
3373
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600 mb-4", children: "Click to upload an image or drag and drop" }),
|
|
3374
|
+
/* @__PURE__ */ jsxs(
|
|
3375
|
+
Button,
|
|
3376
|
+
{
|
|
3377
|
+
type: "button",
|
|
3378
|
+
variant: "outline",
|
|
3379
|
+
onClick: handleUploadClick,
|
|
3380
|
+
disabled: disabled || isUploading,
|
|
3381
|
+
children: [
|
|
3382
|
+
/* @__PURE__ */ jsx(Upload, { className: "h-4 w-4 mr-2" }),
|
|
3383
|
+
isUploading ? "Uploading..." : "Choose Image"
|
|
3384
|
+
]
|
|
3385
|
+
}
|
|
3386
|
+
)
|
|
3387
|
+
] })
|
|
3388
|
+
}
|
|
3389
|
+
),
|
|
3294
3390
|
/* @__PURE__ */ jsx(
|
|
3295
3391
|
"input",
|
|
3296
3392
|
{
|
|
@@ -3302,8 +3398,8 @@ var ImageUploadWidget = ({ fieldId }) => {
|
|
|
3302
3398
|
disabled: disabled || isUploading
|
|
3303
3399
|
}
|
|
3304
3400
|
),
|
|
3305
|
-
fieldDef.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: fieldDef.description }),
|
|
3306
|
-
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
3401
|
+
fieldDef.description && /* @__PURE__ */ jsx("p", { className: fieldDescriptionClass(fieldDef, "text-xs text-gray-500"), children: fieldDef.description }),
|
|
3402
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
3307
3403
|
] });
|
|
3308
3404
|
};
|
|
3309
3405
|
function urlLooksLikePdf(url) {
|
|
@@ -3345,13 +3441,15 @@ var MediaUploadWidget = ({ fieldId }) => {
|
|
|
3345
3441
|
}
|
|
3346
3442
|
};
|
|
3347
3443
|
if (!fieldDef) return null;
|
|
3444
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
3348
3445
|
const uploadHandler = store.getUploadHandler();
|
|
3349
3446
|
if (!uploadHandler) {
|
|
3350
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
3351
|
-
/* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, children: [
|
|
3447
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
3448
|
+
showLabel ? /* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
3352
3449
|
fieldDef.label,
|
|
3353
|
-
|
|
3354
|
-
|
|
3450
|
+
" ",
|
|
3451
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
3452
|
+
] }) : null,
|
|
3355
3453
|
/* @__PURE__ */ jsx("div", { className: "border-2 border-red-300 rounded-lg p-4 bg-red-50", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-red-600", children: "Upload handler not configured. Please provide an onUpload function in FormProvider config." }) })
|
|
3356
3454
|
] });
|
|
3357
3455
|
}
|
|
@@ -3434,56 +3532,66 @@ var MediaUploadWidget = ({ fieldId }) => {
|
|
|
3434
3532
|
const handleUploadClick = () => {
|
|
3435
3533
|
fileInputRef.current?.click();
|
|
3436
3534
|
};
|
|
3437
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
3438
|
-
/* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, children: [
|
|
3535
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
3536
|
+
showLabel ? /* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
3439
3537
|
fieldDef.label,
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
children:
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3538
|
+
" ",
|
|
3539
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
3540
|
+
] }) : null,
|
|
3541
|
+
/* @__PURE__ */ jsx(
|
|
3542
|
+
"div",
|
|
3543
|
+
{
|
|
3544
|
+
className: fieldControlClass(
|
|
3545
|
+
fieldDef,
|
|
3546
|
+
"border-2 border-dashed border-gray-300 rounded-lg p-4"
|
|
3547
|
+
),
|
|
3548
|
+
children: preview ? /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
3549
|
+
previewIsPdf ? /* @__PURE__ */ jsx(
|
|
3550
|
+
"iframe",
|
|
3551
|
+
{
|
|
3552
|
+
src: preview,
|
|
3553
|
+
title: "Uploaded PDF",
|
|
3554
|
+
className: "w-full max-h-48 min-h-36 rounded-lg border border-gray-200 bg-white"
|
|
3555
|
+
}
|
|
3556
|
+
) : /* @__PURE__ */ jsx(
|
|
3557
|
+
"img",
|
|
3558
|
+
{
|
|
3559
|
+
src: preview,
|
|
3560
|
+
alt: "Uploaded image",
|
|
3561
|
+
className: "max-w-full max-h-48 mx-auto rounded-lg"
|
|
3562
|
+
}
|
|
3563
|
+
),
|
|
3564
|
+
/* @__PURE__ */ jsx(
|
|
3565
|
+
Button,
|
|
3566
|
+
{
|
|
3567
|
+
type: "button",
|
|
3568
|
+
variant: "destructive",
|
|
3569
|
+
size: "sm",
|
|
3570
|
+
className: "absolute top-2 right-2",
|
|
3571
|
+
onClick: handleRemove,
|
|
3572
|
+
disabled: disabled || isUploading,
|
|
3573
|
+
children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
|
|
3574
|
+
}
|
|
3575
|
+
)
|
|
3576
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "text-center py-8", children: [
|
|
3577
|
+
/* @__PURE__ */ jsx(Image, { className: "h-12 w-12 mx-auto text-gray-400 mb-4" }),
|
|
3578
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600 mb-4", children: "Click to upload an image or PDF, or drag and drop" }),
|
|
3579
|
+
/* @__PURE__ */ jsxs(
|
|
3580
|
+
Button,
|
|
3581
|
+
{
|
|
3582
|
+
type: "button",
|
|
3583
|
+
variant: "outline",
|
|
3584
|
+
onClick: handleUploadClick,
|
|
3585
|
+
disabled: disabled || isUploading,
|
|
3586
|
+
children: [
|
|
3587
|
+
/* @__PURE__ */ jsx(Upload, { className: "h-4 w-4 mr-2" }),
|
|
3588
|
+
isUploading ? "Uploading..." : "Choose Image"
|
|
3589
|
+
]
|
|
3590
|
+
}
|
|
3591
|
+
)
|
|
3592
|
+
] })
|
|
3593
|
+
}
|
|
3594
|
+
),
|
|
3487
3595
|
/* @__PURE__ */ jsx(
|
|
3488
3596
|
"input",
|
|
3489
3597
|
{
|
|
@@ -3495,8 +3603,8 @@ var MediaUploadWidget = ({ fieldId }) => {
|
|
|
3495
3603
|
disabled: disabled || isUploading
|
|
3496
3604
|
}
|
|
3497
3605
|
),
|
|
3498
|
-
fieldDef.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: fieldDef.description }),
|
|
3499
|
-
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
3606
|
+
fieldDef.description && /* @__PURE__ */ jsx("p", { className: fieldDescriptionClass(fieldDef, "text-xs text-gray-500"), children: fieldDef.description }),
|
|
3607
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
3500
3608
|
] });
|
|
3501
3609
|
};
|
|
3502
3610
|
var distance = (a, b) => Math.hypot(a.x - b.x, a.y - b.y);
|
|
@@ -3685,23 +3793,34 @@ var SignatureUploadWidget = ({ fieldId }) => {
|
|
|
3685
3793
|
};
|
|
3686
3794
|
confirmSignatureRef.current = confirmSignature;
|
|
3687
3795
|
const canClear = showPreview ? !disabled : hasDrawing || isConfirmed;
|
|
3688
|
-
|
|
3689
|
-
|
|
3796
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
3797
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
3798
|
+
showLabel ? /* @__PURE__ */ jsxs(Label, { className: fieldLabelClass(fieldDef), children: [
|
|
3690
3799
|
fieldDef.label,
|
|
3691
|
-
|
|
3692
|
-
|
|
3800
|
+
" ",
|
|
3801
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
3802
|
+
] }) : null,
|
|
3693
3803
|
showPreview ? (
|
|
3694
3804
|
/* ── Preview mode: existing signature from backend ── */
|
|
3695
3805
|
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
3696
|
-
/* @__PURE__ */ jsx(
|
|
3697
|
-
"
|
|
3806
|
+
/* @__PURE__ */ jsx(
|
|
3807
|
+
"div",
|
|
3698
3808
|
{
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3809
|
+
className: fieldControlClass(
|
|
3810
|
+
fieldDef,
|
|
3811
|
+
"border border-gray-200 rounded bg-white flex items-center justify-start p-2"
|
|
3812
|
+
),
|
|
3813
|
+
children: /* @__PURE__ */ jsx(
|
|
3814
|
+
"img",
|
|
3815
|
+
{
|
|
3816
|
+
src: displayUrl,
|
|
3817
|
+
alt: "Signature",
|
|
3818
|
+
className: "object-contain max-w-full",
|
|
3819
|
+
style: { width: 400, height: 200 }
|
|
3820
|
+
}
|
|
3821
|
+
)
|
|
3703
3822
|
}
|
|
3704
|
-
)
|
|
3823
|
+
),
|
|
3705
3824
|
/* @__PURE__ */ jsx(
|
|
3706
3825
|
Button,
|
|
3707
3826
|
{
|
|
@@ -3724,7 +3843,10 @@ var SignatureUploadWidget = ({ fieldId }) => {
|
|
|
3724
3843
|
"canvas",
|
|
3725
3844
|
{
|
|
3726
3845
|
ref: canvasRef,
|
|
3727
|
-
className:
|
|
3846
|
+
className: fieldControlClass(
|
|
3847
|
+
fieldDef,
|
|
3848
|
+
`border rounded touch-none ${isConfirmed ? "border-green-300 cursor-default" : "border-gray-200 cursor-crosshair"}`
|
|
3849
|
+
),
|
|
3728
3850
|
onMouseDown: startDrawing,
|
|
3729
3851
|
onMouseMove: draw,
|
|
3730
3852
|
onMouseUp: stopDrawing,
|
|
@@ -3769,7 +3891,7 @@ var SignatureUploadWidget = ({ fieldId }) => {
|
|
|
3769
3891
|
] })
|
|
3770
3892
|
] })
|
|
3771
3893
|
),
|
|
3772
|
-
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
3894
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
3773
3895
|
] });
|
|
3774
3896
|
};
|
|
3775
3897
|
function Upload3({
|
|
@@ -3782,7 +3904,8 @@ function Upload3({
|
|
|
3782
3904
|
formatsLabel,
|
|
3783
3905
|
placeholder = "Upload File",
|
|
3784
3906
|
beforeUploadContent,
|
|
3785
|
-
id: idProp
|
|
3907
|
+
id: idProp,
|
|
3908
|
+
listLayout = false
|
|
3786
3909
|
}) {
|
|
3787
3910
|
const inputRef = React15__default.useRef(null);
|
|
3788
3911
|
const generatedId = React15__default.useId();
|
|
@@ -3823,19 +3946,33 @@ function Upload3({
|
|
|
3823
3946
|
"label",
|
|
3824
3947
|
{
|
|
3825
3948
|
htmlFor: inputId,
|
|
3826
|
-
className: cn(
|
|
3827
|
-
|
|
3949
|
+
className: cn(
|
|
3950
|
+
"cursor-pointer w-full",
|
|
3951
|
+
disabled && "cursor-not-allowed"
|
|
3952
|
+
),
|
|
3953
|
+
children: /* @__PURE__ */ jsx("div", { children: count > 0 && !listLayout ? /* @__PURE__ */ jsxs("div", { className: "text-center text-sm font-semibold text-gray-700", children: [
|
|
3828
3954
|
count,
|
|
3829
3955
|
" file",
|
|
3830
3956
|
count === 1 ? "" : "s",
|
|
3831
3957
|
" selected"
|
|
3832
3958
|
] }) : beforeUploadContent ? beforeUploadContent : /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center", children: [
|
|
3833
|
-
/* @__PURE__ */
|
|
3834
|
-
|
|
3835
|
-
|
|
3959
|
+
/* @__PURE__ */ jsxs("div", { className: "text-sm text-black font-normal leading-[120%] tracking-[-0.28px] text-center", children: [
|
|
3960
|
+
"Upload your surgery prescription",
|
|
3961
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
3962
|
+
"and medical records"
|
|
3963
|
+
] }),
|
|
3964
|
+
/* @__PURE__ */ jsx(
|
|
3965
|
+
Upload,
|
|
3966
|
+
{
|
|
3967
|
+
size: 20,
|
|
3968
|
+
className: "rotate-180 text-[#727272] mt-4"
|
|
3969
|
+
}
|
|
3970
|
+
),
|
|
3971
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs mt-1 text-text-shades-2", children: placeholder }),
|
|
3972
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-2 text-10px leading-[140%] text-[#989898]", children: [
|
|
3836
3973
|
"Supported formats - ",
|
|
3837
3974
|
formatsText
|
|
3838
|
-
] })
|
|
3975
|
+
] })
|
|
3839
3976
|
] }) })
|
|
3840
3977
|
}
|
|
3841
3978
|
)
|
|
@@ -3862,6 +3999,26 @@ function matchesAccept(file, accept) {
|
|
|
3862
3999
|
return type === token;
|
|
3863
4000
|
});
|
|
3864
4001
|
}
|
|
4002
|
+
function basenameKey(key) {
|
|
4003
|
+
const parts = key.split("/");
|
|
4004
|
+
return parts[parts.length - 1] || key;
|
|
4005
|
+
}
|
|
4006
|
+
function fileRows(listLayout, localFiles, value) {
|
|
4007
|
+
if (!listLayout) return [];
|
|
4008
|
+
if (localFiles && localFiles.length > 0) {
|
|
4009
|
+
return Array.from(localFiles).map((f, i) => ({ label: f.name, index: i }));
|
|
4010
|
+
}
|
|
4011
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
4012
|
+
return value.map((k, i) => ({
|
|
4013
|
+
label: basenameKey(String(k)),
|
|
4014
|
+
index: i
|
|
4015
|
+
}));
|
|
4016
|
+
}
|
|
4017
|
+
if (value !== null && value !== void 0 && value !== "") {
|
|
4018
|
+
return [{ label: basenameKey(String(value)), index: 0 }];
|
|
4019
|
+
}
|
|
4020
|
+
return [];
|
|
4021
|
+
}
|
|
3865
4022
|
var FormFileUploadWidget = ({
|
|
3866
4023
|
fieldId
|
|
3867
4024
|
}) => {
|
|
@@ -3871,22 +4028,55 @@ var FormFileUploadWidget = ({
|
|
|
3871
4028
|
const [localFiles, setLocalFiles] = useState(null);
|
|
3872
4029
|
const [isUploading, setIsUploading] = useState(false);
|
|
3873
4030
|
const showError = !!error && (touched || state.submitAttempted);
|
|
4031
|
+
const listLayout = fieldDef?.type === "file_upload" && fieldDef.list === true;
|
|
4032
|
+
const rows = useMemo(
|
|
4033
|
+
() => fileRows(listLayout, localFiles, value),
|
|
4034
|
+
[listLayout, localFiles, value]
|
|
4035
|
+
);
|
|
3874
4036
|
if (!fieldDef || fieldDef.type !== "file_upload") return null;
|
|
3875
4037
|
const def = fieldDef;
|
|
3876
4038
|
const accept = def.accept ?? "*/*";
|
|
3877
4039
|
const maxSize = def.maxSize ?? 10 * 1024 * 1024;
|
|
3878
4040
|
const allowMultiple = def.multiple === true;
|
|
3879
4041
|
const uploadHandler = store.getUploadHandler();
|
|
4042
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
3880
4043
|
if (!uploadHandler) {
|
|
3881
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
3882
|
-
/* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, children: [
|
|
4044
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
4045
|
+
showLabel ? /* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
3883
4046
|
fieldDef.label,
|
|
3884
|
-
|
|
3885
|
-
|
|
4047
|
+
" ",
|
|
4048
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
4049
|
+
] }) : null,
|
|
3886
4050
|
/* @__PURE__ */ jsx("div", { className: "border-2 border-red-300 rounded-lg p-4 bg-red-50", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-red-600", children: "Upload handler not configured. Please provide an onUpload function in FormProvider config." }) })
|
|
3887
4051
|
] });
|
|
3888
4052
|
}
|
|
3889
4053
|
const hasStoredValue = value !== null && value !== void 0 && value !== "" && !(Array.isArray(value) && value.length === 0);
|
|
4054
|
+
const removeFileAt = (index) => {
|
|
4055
|
+
setTouched();
|
|
4056
|
+
if (disabled || isUploading) return;
|
|
4057
|
+
const hadLocal = localFiles != null && localFiles.length > 0;
|
|
4058
|
+
if (hadLocal) {
|
|
4059
|
+
const next = Array.from(localFiles).filter((_, i) => i !== index);
|
|
4060
|
+
if (next.length === 0) {
|
|
4061
|
+
setLocalFiles(null);
|
|
4062
|
+
setValue(null);
|
|
4063
|
+
return;
|
|
4064
|
+
}
|
|
4065
|
+
setLocalFiles(fileListFromArray(next));
|
|
4066
|
+
if (allowMultiple && Array.isArray(value)) {
|
|
4067
|
+
setValue(value.filter((_, i) => i !== index));
|
|
4068
|
+
} else {
|
|
4069
|
+
setValue(null);
|
|
4070
|
+
}
|
|
4071
|
+
return;
|
|
4072
|
+
}
|
|
4073
|
+
if (allowMultiple && Array.isArray(value)) {
|
|
4074
|
+
const next = value.filter((_, i) => i !== index);
|
|
4075
|
+
setValue(next.length ? next : null);
|
|
4076
|
+
return;
|
|
4077
|
+
}
|
|
4078
|
+
setValue(null);
|
|
4079
|
+
};
|
|
3890
4080
|
const handleChange = async (files) => {
|
|
3891
4081
|
setTouched();
|
|
3892
4082
|
if (!files || files.length === 0) {
|
|
@@ -3933,11 +4123,12 @@ var FormFileUploadWidget = ({
|
|
|
3933
4123
|
store.decrementPendingUploads();
|
|
3934
4124
|
}
|
|
3935
4125
|
};
|
|
3936
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
3937
|
-
/* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, children: [
|
|
4126
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
4127
|
+
showLabel ? /* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
3938
4128
|
fieldDef.label,
|
|
3939
|
-
|
|
3940
|
-
|
|
4129
|
+
" ",
|
|
4130
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
4131
|
+
] }) : null,
|
|
3941
4132
|
/* @__PURE__ */ jsx(
|
|
3942
4133
|
Upload3,
|
|
3943
4134
|
{
|
|
@@ -3946,14 +4137,39 @@ var FormFileUploadWidget = ({
|
|
|
3946
4137
|
value: localFiles,
|
|
3947
4138
|
onChange: handleChange,
|
|
3948
4139
|
disabled: disabled || isUploading,
|
|
4140
|
+
listLayout,
|
|
3949
4141
|
placeholder: isUploading ? "Uploading..." : def.uploadPlaceholder ?? "Upload File",
|
|
3950
4142
|
formatsLabel: def.uploadFormats,
|
|
3951
|
-
className:
|
|
4143
|
+
className: fieldControlClass(
|
|
4144
|
+
fieldDef,
|
|
4145
|
+
isUploading ? "opacity-70" : void 0
|
|
4146
|
+
)
|
|
3952
4147
|
}
|
|
3953
4148
|
),
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
4149
|
+
listLayout && rows.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-2 mt-2 list-none p-0 m-0", children: rows.map((row) => /* @__PURE__ */ jsxs(
|
|
4150
|
+
"li",
|
|
4151
|
+
{
|
|
4152
|
+
className: "flex items-center justify-between rounded-md bg-white/50 px-3 py-2.5 text-sm text-[#191919] font-normal tracking-[-0.28px]",
|
|
4153
|
+
children: [
|
|
4154
|
+
/* @__PURE__ */ jsx("span", { className: "truncate pr-2", children: row.label }),
|
|
4155
|
+
/* @__PURE__ */ jsx(
|
|
4156
|
+
"button",
|
|
4157
|
+
{
|
|
4158
|
+
type: "button",
|
|
4159
|
+
disabled: disabled || isUploading,
|
|
4160
|
+
onClick: () => removeFileAt(row.index),
|
|
4161
|
+
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-gray-400 text-white hover:bg-gray-500 disabled:opacity-50",
|
|
4162
|
+
"aria-label": `Remove ${row.label}`,
|
|
4163
|
+
children: /* @__PURE__ */ jsx(X, { size: 14, strokeWidth: 2.5 })
|
|
4164
|
+
}
|
|
4165
|
+
)
|
|
4166
|
+
]
|
|
4167
|
+
},
|
|
4168
|
+
`${row.index}-${row.label}`
|
|
4169
|
+
)) }) : null,
|
|
4170
|
+
hasStoredValue && !listLayout ? /* @__PURE__ */ jsx("p", { className: "text-xs text-green-600", children: allowMultiple && Array.isArray(value) ? `${value.length} file(s) uploaded` : "File uploaded" }) : null,
|
|
4171
|
+
fieldDef.description && /* @__PURE__ */ jsx("p", { className: fieldDescriptionClass(fieldDef, "text-xs text-gray-500"), children: fieldDef.description }),
|
|
4172
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
3957
4173
|
] });
|
|
3958
4174
|
};
|
|
3959
4175
|
var EditableTableWidget = ({
|
|
@@ -4264,12 +4480,22 @@ var RadioWidget = ({ fieldId }) => {
|
|
|
4264
4480
|
setValue(opt ? opt.value : val);
|
|
4265
4481
|
setTouched();
|
|
4266
4482
|
};
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4483
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
4484
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
4485
|
+
showLabel ? /* @__PURE__ */ jsxs(
|
|
4486
|
+
Label,
|
|
4487
|
+
{
|
|
4488
|
+
className: fieldLabelClass(
|
|
4489
|
+
fieldDef,
|
|
4490
|
+
showError ? "text-red-600" : ""
|
|
4491
|
+
),
|
|
4492
|
+
children: [
|
|
4493
|
+
fieldDef.label,
|
|
4494
|
+
" ",
|
|
4495
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
4496
|
+
]
|
|
4497
|
+
}
|
|
4498
|
+
) : null,
|
|
4273
4499
|
/* @__PURE__ */ jsx(
|
|
4274
4500
|
RadioGroup,
|
|
4275
4501
|
{
|
|
@@ -4297,7 +4523,7 @@ var RadioWidget = ({ fieldId }) => {
|
|
|
4297
4523
|
}
|
|
4298
4524
|
),
|
|
4299
4525
|
loading && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Loading options..." }),
|
|
4300
|
-
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
4526
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
4301
4527
|
] });
|
|
4302
4528
|
};
|
|
4303
4529
|
function isOptionSelected(selected, optValue) {
|
|
@@ -4329,16 +4555,29 @@ var CheckboxWidget = ({ fieldId }) => {
|
|
|
4329
4555
|
setTouched();
|
|
4330
4556
|
};
|
|
4331
4557
|
if (!fieldDef) return null;
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4558
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
4559
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
4560
|
+
showLabel ? /* @__PURE__ */ jsxs(
|
|
4561
|
+
Label,
|
|
4562
|
+
{
|
|
4563
|
+
className: fieldLabelClass(
|
|
4564
|
+
fieldDef,
|
|
4565
|
+
showError ? "text-red-600" : ""
|
|
4566
|
+
),
|
|
4567
|
+
children: [
|
|
4568
|
+
fieldDef.label,
|
|
4569
|
+
" ",
|
|
4570
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
4571
|
+
]
|
|
4572
|
+
}
|
|
4573
|
+
) : null,
|
|
4338
4574
|
/* @__PURE__ */ jsxs(
|
|
4339
4575
|
"div",
|
|
4340
4576
|
{
|
|
4341
|
-
className:
|
|
4577
|
+
className: fieldControlClass(
|
|
4578
|
+
fieldDef,
|
|
4579
|
+
`border rounded-md p-3 space-y-2 ${showError ? "border-red-500" : ""} ${disabled || loading ? "opacity-50 pointer-events-none" : ""}`
|
|
4580
|
+
),
|
|
4342
4581
|
children: [
|
|
4343
4582
|
loading && /* @__PURE__ */ jsx("div", { className: "text-sm text-muted-foreground", children: "Loading options..." }),
|
|
4344
4583
|
!loading && options.map((opt) => /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
@@ -4363,8 +4602,8 @@ var CheckboxWidget = ({ fieldId }) => {
|
|
|
4363
4602
|
]
|
|
4364
4603
|
}
|
|
4365
4604
|
),
|
|
4366
|
-
fieldDef.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: fieldDef.description }),
|
|
4367
|
-
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
4605
|
+
fieldDef.description && /* @__PURE__ */ jsx("p", { className: fieldDescriptionClass(fieldDef, "text-xs text-muted-foreground"), children: fieldDef.description }),
|
|
4606
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
4368
4607
|
] });
|
|
4369
4608
|
};
|
|
4370
4609
|
var AISuggestionsContext = createContext({});
|
|
@@ -5858,24 +6097,31 @@ var HiddenVitalsWidget = ({ fieldId }) => {
|
|
|
5858
6097
|
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5859
6098
|
fieldDef.label,
|
|
5860
6099
|
" ",
|
|
5861
|
-
|
|
5862
|
-
] });
|
|
5863
|
-
return /* @__PURE__ */ jsxs("div", { className: wrapperClass, "aria-hidden": "true", children: [
|
|
5864
|
-
theme ? /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, children: labelContent }),
|
|
5865
|
-
/* @__PURE__ */ jsx(
|
|
5866
|
-
Textarea,
|
|
5867
|
-
{
|
|
5868
|
-
id: fieldId,
|
|
5869
|
-
value: value ?? "",
|
|
5870
|
-
onChange: (e) => setValue(e.target.value),
|
|
5871
|
-
onBlur: setTouched,
|
|
5872
|
-
disabled,
|
|
5873
|
-
className: inputClass,
|
|
5874
|
-
...height != null && { height }
|
|
5875
|
-
}
|
|
5876
|
-
),
|
|
5877
|
-
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
6100
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
5878
6101
|
] });
|
|
6102
|
+
return /* @__PURE__ */ jsxs(
|
|
6103
|
+
"div",
|
|
6104
|
+
{
|
|
6105
|
+
className: fieldWrapperClass(fieldDef, wrapperClass),
|
|
6106
|
+
"aria-hidden": "true",
|
|
6107
|
+
children: [
|
|
6108
|
+
theme ? /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef, labelClass), children: labelContent }) : /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: labelContent }),
|
|
6109
|
+
/* @__PURE__ */ jsx(
|
|
6110
|
+
Textarea,
|
|
6111
|
+
{
|
|
6112
|
+
id: fieldId,
|
|
6113
|
+
value: value ?? "",
|
|
6114
|
+
onChange: (e) => setValue(e.target.value),
|
|
6115
|
+
onBlur: setTouched,
|
|
6116
|
+
disabled,
|
|
6117
|
+
className: fieldControlClass(fieldDef, inputClass),
|
|
6118
|
+
...height != null && { height }
|
|
6119
|
+
}
|
|
6120
|
+
),
|
|
6121
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
6122
|
+
]
|
|
6123
|
+
}
|
|
6124
|
+
);
|
|
5879
6125
|
};
|
|
5880
6126
|
function normalizeOptions(response) {
|
|
5881
6127
|
if (Array.isArray(response)) {
|
|
@@ -5960,10 +6206,10 @@ var ReferralWidget = ({ fieldId }) => {
|
|
|
5960
6206
|
[selectedItems, setValue, setTouched]
|
|
5961
6207
|
);
|
|
5962
6208
|
if (!fieldDef) return null;
|
|
5963
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
5964
|
-
/* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, children: [
|
|
6209
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
6210
|
+
/* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
5965
6211
|
"Referral to ",
|
|
5966
|
-
|
|
6212
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
5967
6213
|
] }),
|
|
5968
6214
|
loading && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "Loading..." }),
|
|
5969
6215
|
!loading && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -5978,7 +6224,14 @@ var ReferralWidget = ({ fieldId }) => {
|
|
|
5978
6224
|
}
|
|
5979
6225
|
},
|
|
5980
6226
|
children: [
|
|
5981
|
-
/* @__PURE__ */ jsx(
|
|
6227
|
+
/* @__PURE__ */ jsx(
|
|
6228
|
+
SelectTrigger,
|
|
6229
|
+
{
|
|
6230
|
+
id: fieldId,
|
|
6231
|
+
className: fieldControlClass(fieldDef, showError ? "border-red-500" : ""),
|
|
6232
|
+
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select specializations..." })
|
|
6233
|
+
}
|
|
6234
|
+
),
|
|
5982
6235
|
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
5983
6236
|
availableOptions.map((opt) => /* @__PURE__ */ jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value)),
|
|
5984
6237
|
availableOptions.length === 0 && /* @__PURE__ */ jsx("div", { className: "py-2 px-2 text-sm text-muted-foreground", children: "All specializations selected" })
|
|
@@ -6022,7 +6275,7 @@ var ReferralWidget = ({ fieldId }) => {
|
|
|
6022
6275
|
selectedItems.length === 0 && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-1", children: "No specializations selected" }),
|
|
6023
6276
|
selectedItems.length > 0 && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-1.5", children: "Click a chip to mark as urgent" })
|
|
6024
6277
|
] }),
|
|
6025
|
-
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
6278
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
6026
6279
|
] });
|
|
6027
6280
|
};
|
|
6028
6281
|
var Card = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
@@ -6521,29 +6774,41 @@ var SmartTextareaWidget = ({ fieldId }) => {
|
|
|
6521
6774
|
const wrapperClass = theme?.wrapperClassName ?? "space-y-2";
|
|
6522
6775
|
const labelClass = theme?.labelClassName;
|
|
6523
6776
|
const inputClass = cn(theme?.inputClassName, showError && "border-red-500");
|
|
6777
|
+
const showLabel = isLabelVisible(def);
|
|
6524
6778
|
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6525
6779
|
def.label,
|
|
6526
6780
|
" ",
|
|
6527
|
-
|
|
6781
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef: def }),
|
|
6528
6782
|
isProcessing && /* @__PURE__ */ jsx(Loader2, { className: "inline-block ml-1.5 h-3 w-3 animate-spin text-muted-foreground" })
|
|
6529
6783
|
] });
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6784
|
+
const labelEl = showLabel ? theme ? /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(def, labelClass), children: labelContent }) : /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(def), children: labelContent }) : null;
|
|
6785
|
+
return /* @__PURE__ */ jsxs(
|
|
6786
|
+
"div",
|
|
6787
|
+
{
|
|
6788
|
+
className: fieldWrapperClass(
|
|
6789
|
+
def,
|
|
6790
|
+
wrapperClass
|
|
6791
|
+
),
|
|
6792
|
+
children: [
|
|
6793
|
+
labelEl,
|
|
6794
|
+
/* @__PURE__ */ jsx(
|
|
6795
|
+
Textarea,
|
|
6796
|
+
{
|
|
6797
|
+
id: fieldId,
|
|
6798
|
+
value: textValue,
|
|
6799
|
+
onChange: handleTextChange,
|
|
6800
|
+
onBlur: setTouched,
|
|
6801
|
+
disabled,
|
|
6802
|
+
placeholder: def.placeholder,
|
|
6803
|
+
className: fieldControlClass(def, inputClass),
|
|
6804
|
+
"aria-label": !showLabel ? def.label : void 0,
|
|
6805
|
+
...height != null ? { height } : {}
|
|
6806
|
+
}
|
|
6807
|
+
),
|
|
6808
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(def, "text-xs text-red-500"), children: error })
|
|
6809
|
+
]
|
|
6810
|
+
}
|
|
6811
|
+
);
|
|
6547
6812
|
};
|
|
6548
6813
|
function normalizeDiagnosisGrades(payload) {
|
|
6549
6814
|
const result = [];
|
|
@@ -6663,10 +6928,11 @@ var DiagnosisTextareaWidget = ({ fieldId }) => {
|
|
|
6663
6928
|
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6664
6929
|
def.label,
|
|
6665
6930
|
" ",
|
|
6666
|
-
|
|
6931
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef: def })
|
|
6667
6932
|
] });
|
|
6668
|
-
|
|
6669
|
-
|
|
6933
|
+
const showLabel = isLabelVisible(def);
|
|
6934
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(def, wrapperClass), children: [
|
|
6935
|
+
showLabel ? theme ? /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(def, labelClass), children: labelContent }) : /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(def), children: labelContent }) : null,
|
|
6670
6936
|
/* @__PURE__ */ jsx(
|
|
6671
6937
|
Textarea,
|
|
6672
6938
|
{
|
|
@@ -6676,7 +6942,8 @@ var DiagnosisTextareaWidget = ({ fieldId }) => {
|
|
|
6676
6942
|
onBlur: setTouched,
|
|
6677
6943
|
disabled,
|
|
6678
6944
|
placeholder: def.placeholder,
|
|
6679
|
-
className: inputClass,
|
|
6945
|
+
className: fieldControlClass(def, inputClass),
|
|
6946
|
+
"aria-label": !showLabel ? def.label : void 0,
|
|
6680
6947
|
...def.height != null ? { height: def.height } : {}
|
|
6681
6948
|
}
|
|
6682
6949
|
),
|
|
@@ -6710,7 +6977,7 @@ var DiagnosisTextareaWidget = ({ fieldId }) => {
|
|
|
6710
6977
|
] }, group.condition))
|
|
6711
6978
|
}
|
|
6712
6979
|
),
|
|
6713
|
-
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
6980
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(def, "text-xs text-red-500"), children: error })
|
|
6714
6981
|
] });
|
|
6715
6982
|
};
|
|
6716
6983
|
var Switch = React15.forwardRef(
|
|
@@ -10030,7 +10297,7 @@ var OrthopedicExamWidget = ({ fieldId }) => {
|
|
|
10030
10297
|
return /* @__PURE__ */ jsxs("div", { className: `space-y-4 relative ${disabled ? "opacity-60 pointer-events-none" : ""}`, children: [
|
|
10031
10298
|
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxs(Label, { className: "text-sm font-medium", children: [
|
|
10032
10299
|
fieldDef.label,
|
|
10033
|
-
|
|
10300
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
10034
10301
|
] }) }),
|
|
10035
10302
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
10036
10303
|
/* @__PURE__ */ jsx("div", { className: "text-xs font-semibold text-muted-foreground", children: "Concern" }),
|
|
@@ -10221,26 +10488,30 @@ var MarMedicationOrdersWidget = ({ fieldId }) => {
|
|
|
10221
10488
|
const theme = getThemeConfig("textarea", fieldDef.theme);
|
|
10222
10489
|
const wrapperClass = theme?.wrapperClassName ?? "space-y-2";
|
|
10223
10490
|
const labelClass = theme?.labelClassName;
|
|
10491
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
10224
10492
|
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10225
10493
|
fieldDef.label,
|
|
10226
10494
|
" ",
|
|
10227
|
-
|
|
10495
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
10228
10496
|
] });
|
|
10229
|
-
const labelEl = theme ? /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, children: labelContent });
|
|
10497
|
+
const labelEl = showLabel ? theme ? /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef, labelClass), children: labelContent }) : /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: labelContent }) : null;
|
|
10230
10498
|
const text = typeof value === "string" ? value : value == null ? "" : String(value);
|
|
10231
10499
|
const hasHandler = typeof handlers.onOpenMedicationOrders === "function";
|
|
10232
|
-
return /* @__PURE__ */ jsxs("div", { className: wrapperClass, children: [
|
|
10500
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(fieldDef, wrapperClass), children: [
|
|
10233
10501
|
labelEl,
|
|
10234
|
-
fieldDef.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: fieldDef.description }),
|
|
10502
|
+
fieldDef.description && /* @__PURE__ */ jsx("p", { className: fieldDescriptionClass(fieldDef, "text-sm text-muted-foreground"), children: fieldDef.description }),
|
|
10235
10503
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between sm:gap-3", children: [
|
|
10236
10504
|
/* @__PURE__ */ jsx(
|
|
10237
10505
|
"div",
|
|
10238
10506
|
{
|
|
10239
10507
|
id: fieldId,
|
|
10240
|
-
className:
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
|
|
10508
|
+
className: fieldControlClass(
|
|
10509
|
+
fieldDef,
|
|
10510
|
+
cn(
|
|
10511
|
+
"min-h-[80px] flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm whitespace-pre-wrap",
|
|
10512
|
+
showError && "border-red-500",
|
|
10513
|
+
!text && "text-muted-foreground"
|
|
10514
|
+
)
|
|
10244
10515
|
),
|
|
10245
10516
|
style: height != null ? { minHeight: height } : void 0,
|
|
10246
10517
|
"aria-readonly": "true",
|
|
@@ -10259,7 +10530,7 @@ var MarMedicationOrdersWidget = ({ fieldId }) => {
|
|
|
10259
10530
|
}
|
|
10260
10531
|
)
|
|
10261
10532
|
] }),
|
|
10262
|
-
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
10533
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
10263
10534
|
] });
|
|
10264
10535
|
};
|
|
10265
10536
|
function parseFieldValue(value) {
|
|
@@ -10339,22 +10610,25 @@ var DischargeMedicationOrdersWidget = ({ fieldId }) => {
|
|
|
10339
10610
|
[orders, display_lines, setTouched, setValue]
|
|
10340
10611
|
);
|
|
10341
10612
|
if (!visible || !fieldDef) return null;
|
|
10342
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
10613
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
10343
10614
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
10344
|
-
/* @__PURE__ */ jsxs(Label, { className: "text-sm font-medium", children: [
|
|
10615
|
+
/* @__PURE__ */ jsxs(Label, { className: fieldLabelClass(fieldDef, "text-sm font-medium"), children: [
|
|
10345
10616
|
fieldDef.label,
|
|
10346
10617
|
" ",
|
|
10347
|
-
|
|
10618
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
10348
10619
|
] }),
|
|
10349
10620
|
/* @__PURE__ */ jsx(Button, { type: "button", onClick: onAdd, disabled: disabled || !handlers.onOpenDischargeMedicationOrders, children: "Add medicine" })
|
|
10350
10621
|
] }),
|
|
10351
|
-
fieldDef.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: fieldDef.description }),
|
|
10622
|
+
fieldDef.description && /* @__PURE__ */ jsx("p", { className: fieldDescriptionClass(fieldDef, "text-sm text-muted-foreground"), children: fieldDef.description }),
|
|
10352
10623
|
orders.length === 0 ? /* @__PURE__ */ jsx(
|
|
10353
10624
|
"div",
|
|
10354
10625
|
{
|
|
10355
|
-
className:
|
|
10356
|
-
|
|
10357
|
-
|
|
10626
|
+
className: fieldControlClass(
|
|
10627
|
+
fieldDef,
|
|
10628
|
+
cn(
|
|
10629
|
+
"rounded-md border border-input bg-background px-3 py-3 text-sm text-muted-foreground",
|
|
10630
|
+
showError && "border-red-500"
|
|
10631
|
+
)
|
|
10358
10632
|
),
|
|
10359
10633
|
children: "No medicines added."
|
|
10360
10634
|
}
|
|
@@ -10403,7 +10677,7 @@ var DischargeMedicationOrdersWidget = ({ fieldId }) => {
|
|
|
10403
10677
|
] })
|
|
10404
10678
|
] }, o.id);
|
|
10405
10679
|
}) }),
|
|
10406
|
-
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
10680
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
10407
10681
|
] });
|
|
10408
10682
|
};
|
|
10409
10683
|
var DEFAULT_TOKEN_SEPARATOR2 = ", ";
|
|
@@ -10505,13 +10779,15 @@ var SuggestionTextareaWidget = ({ fieldId }) => {
|
|
|
10505
10779
|
const wrapperClass = theme?.wrapperClassName ?? "space-y-2";
|
|
10506
10780
|
const labelClass = theme?.labelClassName;
|
|
10507
10781
|
const inputClass = cn(theme?.inputClassName, showError && "border-red-500");
|
|
10782
|
+
const inputWithStyle = fieldControlClass(def, inputClass);
|
|
10508
10783
|
const height = def.height != null ? typeof def.height === "string" ? Number(def.height) || void 0 : def.height : void 0;
|
|
10509
10784
|
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10510
10785
|
def.label,
|
|
10511
10786
|
" ",
|
|
10512
|
-
|
|
10787
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef: def })
|
|
10513
10788
|
] });
|
|
10514
|
-
const
|
|
10789
|
+
const showLabel = isLabelVisible(def);
|
|
10790
|
+
const labelEl = showLabel ? theme ? /* @__PURE__ */ jsx(Label, { className: fieldLabelClass(def, labelClass), children: labelContent }) : /* @__PURE__ */ jsx(Label, { className: fieldLabelClass(def), children: labelContent }) : null;
|
|
10515
10791
|
const onChipClick = (optValue) => {
|
|
10516
10792
|
if (disabled) return;
|
|
10517
10793
|
setValue(toggleSuggestionTokenInText(textValue, String(optValue), appendSeparator, chipAllowedSet));
|
|
@@ -10535,7 +10811,7 @@ var SuggestionTextareaWidget = ({ fieldId }) => {
|
|
|
10535
10811
|
disabled && "pointer-events-none opacity-50"
|
|
10536
10812
|
);
|
|
10537
10813
|
const textareaShellClass = cn(
|
|
10538
|
-
|
|
10814
|
+
inputWithStyle,
|
|
10539
10815
|
hasShell && cn(
|
|
10540
10816
|
"mt-0 rounded-t-none rounded-b-md border-0 shadow-none focus-visible:ring-offset-0",
|
|
10541
10817
|
isHighlightLabel ? "border-t-0" : "min-h-[80px]"
|
|
@@ -10557,12 +10833,12 @@ var SuggestionTextareaWidget = ({ fieldId }) => {
|
|
|
10557
10833
|
String(opt.value)
|
|
10558
10834
|
);
|
|
10559
10835
|
});
|
|
10560
|
-
return /* @__PURE__ */ jsxs("div", { className: wrapperClass, children: [
|
|
10836
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(def, wrapperClass), children: [
|
|
10561
10837
|
hasVoice ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
10562
10838
|
labelEl,
|
|
10563
10839
|
/* @__PURE__ */ jsx(VoiceMicButton, { fieldId, onTranscriptReady: setValue })
|
|
10564
10840
|
] }) : labelEl,
|
|
10565
|
-
def.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: def.description }),
|
|
10841
|
+
def.description && /* @__PURE__ */ jsx("p", { className: fieldDescriptionClass(def, "text-xs text-muted-foreground"), children: def.description }),
|
|
10566
10842
|
hasShell ? /* @__PURE__ */ jsxs("div", { className: suggestionShellClass, children: [
|
|
10567
10843
|
hasSuggestions && /* @__PURE__ */ jsx("div", { className: chipsRowClass, role: "group", "aria-label": suggestionsAria, children: suggestionButtons }),
|
|
10568
10844
|
hasEmbedded && /* @__PURE__ */ jsx("div", { className: embeddedRowClass, children: embeddedFieldIds.map((id) => /* @__PURE__ */ jsx(EmbeddedSchemaField, { fieldId: id }, id)) }),
|
|
@@ -10576,7 +10852,8 @@ var SuggestionTextareaWidget = ({ fieldId }) => {
|
|
|
10576
10852
|
disabled,
|
|
10577
10853
|
className: textareaShellClass,
|
|
10578
10854
|
placeholder: def.placeholder,
|
|
10579
|
-
style: height != null && Number.isFinite(height) ? { minHeight: height } : void 0
|
|
10855
|
+
style: height != null && Number.isFinite(height) ? { minHeight: height } : void 0,
|
|
10856
|
+
"aria-label": !showLabel ? def.label : void 0
|
|
10580
10857
|
}
|
|
10581
10858
|
)
|
|
10582
10859
|
] }) : /* @__PURE__ */ jsx(
|
|
@@ -10587,12 +10864,13 @@ var SuggestionTextareaWidget = ({ fieldId }) => {
|
|
|
10587
10864
|
onChange: (e) => setValue(e.target.value),
|
|
10588
10865
|
onBlur: setTouched,
|
|
10589
10866
|
disabled,
|
|
10590
|
-
className:
|
|
10867
|
+
className: inputWithStyle,
|
|
10591
10868
|
placeholder: def.placeholder,
|
|
10592
|
-
style: height != null && Number.isFinite(height) ? { minHeight: height } : void 0
|
|
10869
|
+
style: height != null && Number.isFinite(height) ? { minHeight: height } : void 0,
|
|
10870
|
+
"aria-label": !showLabel ? def.label : void 0
|
|
10593
10871
|
}
|
|
10594
10872
|
),
|
|
10595
|
-
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
10873
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(def, "text-xs text-red-500"), children: error })
|
|
10596
10874
|
] });
|
|
10597
10875
|
};
|
|
10598
10876
|
var EMPTY_GRADES = { NO: 0, NC: 0, C: 0, PSC: 0 };
|
|
@@ -11359,23 +11637,27 @@ var SliderWidget = ({ fieldId }) => {
|
|
|
11359
11637
|
const theme = getThemeConfig("textarea", def.theme);
|
|
11360
11638
|
const wrapperClass = theme?.wrapperClassName ?? "space-y-2";
|
|
11361
11639
|
const labelClass = theme?.labelClassName;
|
|
11640
|
+
const showLabel = isLabelVisible(def);
|
|
11362
11641
|
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11363
11642
|
def.label,
|
|
11364
11643
|
" ",
|
|
11365
|
-
|
|
11644
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef: def }),
|
|
11366
11645
|
/* @__PURE__ */ jsxs("span", { className: "ml-2 text-muted-foreground font-normal tabular-nums", children: [
|
|
11367
11646
|
num2,
|
|
11368
11647
|
"/",
|
|
11369
11648
|
max
|
|
11370
11649
|
] })
|
|
11371
11650
|
] });
|
|
11372
|
-
const labelEl = theme ? /* @__PURE__ */ jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { children: labelContent });
|
|
11373
|
-
return /* @__PURE__ */ jsxs("div", { className: wrapperClass, children: [
|
|
11651
|
+
const labelEl = showLabel ? theme ? /* @__PURE__ */ jsx(Label, { className: fieldLabelClass(def, labelClass), children: labelContent }) : /* @__PURE__ */ jsx(Label, { className: fieldLabelClass(def), children: labelContent }) : null;
|
|
11652
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(def, wrapperClass), children: [
|
|
11374
11653
|
labelEl,
|
|
11375
11654
|
/* @__PURE__ */ jsx(
|
|
11376
11655
|
Slider,
|
|
11377
11656
|
{
|
|
11378
|
-
className:
|
|
11657
|
+
className: fieldControlClass(
|
|
11658
|
+
def,
|
|
11659
|
+
cn("py-1", showError && "opacity-90 ring-1 ring-red-500 rounded")
|
|
11660
|
+
),
|
|
11379
11661
|
disabled,
|
|
11380
11662
|
min,
|
|
11381
11663
|
max,
|
|
@@ -11385,10 +11667,11 @@ var SliderWidget = ({ fieldId }) => {
|
|
|
11385
11667
|
const n = v[0] ?? min;
|
|
11386
11668
|
setValue(n);
|
|
11387
11669
|
setTouched();
|
|
11388
|
-
}
|
|
11670
|
+
},
|
|
11671
|
+
"aria-label": !showLabel ? `${def.label} ${num2}/${max}` : void 0
|
|
11389
11672
|
}
|
|
11390
11673
|
),
|
|
11391
|
-
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
11674
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(def, "text-xs text-red-500"), children: error })
|
|
11392
11675
|
] });
|
|
11393
11676
|
};
|
|
11394
11677
|
var CHIEF_CHIPS_FIELD = "chief_complaints_chips";
|
|
@@ -11501,7 +11784,7 @@ var GsSmartHistoryWidget = ({ fieldId }) => {
|
|
|
11501
11784
|
const labelClass = theme?.labelClassName;
|
|
11502
11785
|
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11503
11786
|
fieldDef.label,
|
|
11504
|
-
|
|
11787
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
11505
11788
|
] });
|
|
11506
11789
|
const labelEl = theme ? /* @__PURE__ */ jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { className: "text-sm font-medium", children: labelContent });
|
|
11507
11790
|
const bodyClass = cn(
|
|
@@ -11904,7 +12187,7 @@ var GsExaminationWidget = ({ fieldId }) => {
|
|
|
11904
12187
|
const labelClass = theme?.labelClassName;
|
|
11905
12188
|
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11906
12189
|
fieldDef.label,
|
|
11907
|
-
|
|
12190
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
11908
12191
|
] });
|
|
11909
12192
|
const labelEl = theme ? /* @__PURE__ */ jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { className: "text-sm font-medium", children: labelContent });
|
|
11910
12193
|
const bodyClass = cn(
|
|
@@ -12315,7 +12598,7 @@ var GsGradingWidget = ({ fieldId }) => {
|
|
|
12315
12598
|
const labelClass = theme?.labelClassName;
|
|
12316
12599
|
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12317
12600
|
fieldDef.label,
|
|
12318
|
-
|
|
12601
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
12319
12602
|
] });
|
|
12320
12603
|
const labelEl = theme ? /* @__PURE__ */ jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { className: "text-sm font-medium", children: labelContent });
|
|
12321
12604
|
const bodyClass = cn(
|
|
@@ -12374,6 +12657,7 @@ var PainScaleFlagsWidget = ({ fieldId }) => {
|
|
|
12374
12657
|
const theme = getThemeConfig("textarea", def.theme);
|
|
12375
12658
|
const wrapperClass = theme?.wrapperClassName ?? "space-y-2";
|
|
12376
12659
|
const labelClass = theme?.labelClassName;
|
|
12660
|
+
const showLabel = isLabelVisible(def);
|
|
12377
12661
|
const update = (next) => {
|
|
12378
12662
|
setValue(normalizePainScaleFlags(next, { min, max }));
|
|
12379
12663
|
setTouched();
|
|
@@ -12389,16 +12673,16 @@ var PainScaleFlagsWidget = ({ fieldId }) => {
|
|
|
12389
12673
|
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12390
12674
|
def.label,
|
|
12391
12675
|
" ",
|
|
12392
|
-
|
|
12676
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef: def })
|
|
12393
12677
|
] });
|
|
12394
|
-
const labelEl = theme ? /* @__PURE__ */ jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { children: labelContent });
|
|
12678
|
+
const labelEl = showLabel ? theme ? /* @__PURE__ */ jsx(Label, { className: fieldLabelClass(def, labelClass), children: labelContent }) : /* @__PURE__ */ jsx(Label, { className: fieldLabelClass(def), children: labelContent }) : null;
|
|
12395
12679
|
const bodyClass = cn(
|
|
12396
12680
|
"-mt-1 flex min-w-0 flex-col border-t border-[#D0D0D0] bg-white px-3 py-3",
|
|
12397
12681
|
disabled && "pointer-events-none opacity-60"
|
|
12398
12682
|
);
|
|
12399
|
-
return /* @__PURE__ */ jsxs("div", { className: cn(wrapperClass, "h-full min-h-0 flex flex-col"), children: [
|
|
12683
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(def, cn(wrapperClass, "h-full min-h-0 flex flex-col")), children: [
|
|
12400
12684
|
labelEl,
|
|
12401
|
-
def.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: def.description }),
|
|
12685
|
+
def.description && /* @__PURE__ */ jsx("p", { className: fieldDescriptionClass(def, "text-xs text-muted-foreground"), children: def.description }),
|
|
12402
12686
|
/* @__PURE__ */ jsx("div", { className: cn(bodyClass, "min-h-0 flex-1"), children: /* @__PURE__ */ jsxs("div", { className: "min-w-0 space-y-3", children: [
|
|
12403
12687
|
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
12404
12688
|
/* @__PURE__ */ jsxs(Label, { className: "text-sm font-medium text-slate-700", children: [
|
|
@@ -12484,7 +12768,7 @@ var PainScaleFlagsWidget = ({ fieldId }) => {
|
|
|
12484
12768
|
] }) : null
|
|
12485
12769
|
] }) : null
|
|
12486
12770
|
] }) }),
|
|
12487
|
-
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
12771
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(def, "text-xs text-red-500"), children: error })
|
|
12488
12772
|
] });
|
|
12489
12773
|
};
|
|
12490
12774
|
var CHIEF_CHIPS_FIELD3 = "chief_complaints_chips";
|
|
@@ -12639,7 +12923,7 @@ var UrologySmartHistoryWidget = ({ fieldId }) => {
|
|
|
12639
12923
|
const labelClass = theme?.labelClassName;
|
|
12640
12924
|
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
12641
12925
|
fieldDef.label,
|
|
12642
|
-
|
|
12926
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
12643
12927
|
] });
|
|
12644
12928
|
const labelEl = theme ? /* @__PURE__ */ jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { className: "text-sm font-medium", children: labelContent });
|
|
12645
12929
|
const bodyClass = cn(
|
|
@@ -13002,7 +13286,7 @@ var UrologyExaminationWidget = ({ fieldId }) => {
|
|
|
13002
13286
|
const labelClass = theme?.labelClassName;
|
|
13003
13287
|
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13004
13288
|
fieldDef.label,
|
|
13005
|
-
|
|
13289
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
13006
13290
|
] });
|
|
13007
13291
|
const labelEl = theme ? /* @__PURE__ */ jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { className: "text-sm font-medium", children: labelContent });
|
|
13008
13292
|
const bodyClass = cn(
|
|
@@ -13228,7 +13512,7 @@ var UrologyPathwayWidget = ({ fieldId }) => {
|
|
|
13228
13512
|
const subtitle = fieldDef.meta && typeof fieldDef.meta === "object" && fieldDef.meta !== null ? String(fieldDef.meta.subtitle ?? "") : "";
|
|
13229
13513
|
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13230
13514
|
fieldDef.label,
|
|
13231
|
-
|
|
13515
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
13232
13516
|
] });
|
|
13233
13517
|
const labelEl = theme ? /* @__PURE__ */ jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { className: "text-sm font-medium", children: labelContent });
|
|
13234
13518
|
const bodyClass = cn(
|
|
@@ -13423,7 +13707,7 @@ var OBGExaminationWidget = ({ fieldId }) => {
|
|
|
13423
13707
|
const labelClass = theme?.labelClassName;
|
|
13424
13708
|
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13425
13709
|
fieldDef.label,
|
|
13426
|
-
|
|
13710
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
13427
13711
|
] });
|
|
13428
13712
|
const labelEl = theme ? /* @__PURE__ */ jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { className: "text-sm font-medium", children: labelContent });
|
|
13429
13713
|
const bodyClass = cn(
|
|
@@ -13556,7 +13840,7 @@ var OBGPathwayWidget = ({ fieldId }) => {
|
|
|
13556
13840
|
const labelClass = theme?.labelClassName;
|
|
13557
13841
|
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13558
13842
|
fieldDef.label,
|
|
13559
|
-
|
|
13843
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
13560
13844
|
] });
|
|
13561
13845
|
const labelEl = theme ? /* @__PURE__ */ jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { className: "text-sm font-medium", children: labelContent });
|
|
13562
13846
|
const bodyClass = cn(
|
|
@@ -14044,6 +14328,7 @@ var PhoneInputWidget = ({ fieldId }) => {
|
|
|
14044
14328
|
return () => clearTimeout(t);
|
|
14045
14329
|
}, [resendCooldown]);
|
|
14046
14330
|
if (!fieldDef) return null;
|
|
14331
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
14047
14332
|
const placeholder = typeof fieldDef.placeholder === "string" && fieldDef.placeholder.trim() ? fieldDef.placeholder : "Enter 10-digit mobile number";
|
|
14048
14333
|
const handleChange = (e) => {
|
|
14049
14334
|
const digits = e.target.value.replace(/\D/g, "").slice(0, 10);
|
|
@@ -14125,12 +14410,12 @@ var PhoneInputWidget = ({ fieldId }) => {
|
|
|
14125
14410
|
isResendingRef.current = false;
|
|
14126
14411
|
}
|
|
14127
14412
|
};
|
|
14128
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
14129
|
-
/* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, children: [
|
|
14413
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
14414
|
+
showLabel ? /* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
14130
14415
|
fieldDef.label,
|
|
14131
14416
|
" ",
|
|
14132
|
-
|
|
14133
|
-
] }),
|
|
14417
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
14418
|
+
] }) : null,
|
|
14134
14419
|
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
14135
14420
|
/* @__PURE__ */ jsx(
|
|
14136
14421
|
Input,
|
|
@@ -14144,11 +14429,15 @@ var PhoneInputWidget = ({ fieldId }) => {
|
|
|
14144
14429
|
disabled: disabled || status === "sending",
|
|
14145
14430
|
placeholder,
|
|
14146
14431
|
maxLength: 10,
|
|
14147
|
-
className:
|
|
14148
|
-
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14432
|
+
className: fieldControlClass(
|
|
14433
|
+
fieldDef,
|
|
14434
|
+
cn(
|
|
14435
|
+
showError && "border-red-500",
|
|
14436
|
+
status === "sent" && "border-green-500 pr-9",
|
|
14437
|
+
status === "sending" && "pr-9"
|
|
14438
|
+
)
|
|
14439
|
+
),
|
|
14440
|
+
"aria-label": !showLabel ? fieldDef.label : void 0
|
|
14152
14441
|
}
|
|
14153
14442
|
),
|
|
14154
14443
|
status === "sending" && /* @__PURE__ */ jsx("div", { className: "absolute inset-y-0 right-3 flex items-center pointer-events-none", children: /* @__PURE__ */ jsxs(
|
|
@@ -14201,7 +14490,7 @@ var PhoneInputWidget = ({ fieldId }) => {
|
|
|
14201
14490
|
"OTP sent to +91",
|
|
14202
14491
|
rawPhone
|
|
14203
14492
|
] }),
|
|
14204
|
-
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error }),
|
|
14493
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error }),
|
|
14205
14494
|
status === "sent" && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
|
|
14206
14495
|
/* @__PURE__ */ jsx("span", { children: "Didn't receive it?" }),
|
|
14207
14496
|
/* @__PURE__ */ jsx(
|
|
@@ -14234,6 +14523,7 @@ var OtpInputWidget = ({ fieldId }) => {
|
|
|
14234
14523
|
const isVerifyingRef = useRef(false);
|
|
14235
14524
|
const showError = !!error && (touched || state.submitAttempted) && status !== "verifying" && status !== "verified";
|
|
14236
14525
|
if (!fieldDef) return null;
|
|
14526
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
14237
14527
|
const placeholder = typeof fieldDef.placeholder === "string" && fieldDef.placeholder.trim() ? fieldDef.placeholder : "Enter 4-digit OTP";
|
|
14238
14528
|
const handleChange = (e) => {
|
|
14239
14529
|
const digits = e.target.value.replace(/\D/g, "").slice(0, 4);
|
|
@@ -14287,12 +14577,12 @@ var OtpInputWidget = ({ fieldId }) => {
|
|
|
14287
14577
|
isVerifyingRef.current = false;
|
|
14288
14578
|
}
|
|
14289
14579
|
};
|
|
14290
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
14291
|
-
/* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, children: [
|
|
14580
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
14581
|
+
showLabel ? /* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
14292
14582
|
fieldDef.label,
|
|
14293
14583
|
" ",
|
|
14294
|
-
|
|
14295
|
-
] }),
|
|
14584
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
14585
|
+
] }) : null,
|
|
14296
14586
|
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
14297
14587
|
/* @__PURE__ */ jsx(
|
|
14298
14588
|
Input,
|
|
@@ -14306,12 +14596,16 @@ var OtpInputWidget = ({ fieldId }) => {
|
|
|
14306
14596
|
disabled: disabled || status === "verifying" || status === "verified",
|
|
14307
14597
|
placeholder,
|
|
14308
14598
|
maxLength: 4,
|
|
14309
|
-
className:
|
|
14310
|
-
|
|
14311
|
-
|
|
14312
|
-
|
|
14313
|
-
|
|
14314
|
-
|
|
14599
|
+
className: fieldControlClass(
|
|
14600
|
+
fieldDef,
|
|
14601
|
+
cn(
|
|
14602
|
+
"tracking-widest text-center text-lg",
|
|
14603
|
+
showError && "border-red-500",
|
|
14604
|
+
status === "verified" && "border-green-500 pr-9",
|
|
14605
|
+
status === "verifying" && "pr-9"
|
|
14606
|
+
)
|
|
14607
|
+
),
|
|
14608
|
+
"aria-label": !showLabel ? fieldDef.label : void 0
|
|
14315
14609
|
}
|
|
14316
14610
|
),
|
|
14317
14611
|
status === "verifying" && /* @__PURE__ */ jsx("div", { className: "absolute inset-y-0 right-3 flex items-center pointer-events-none", children: /* @__PURE__ */ jsxs(
|
|
@@ -14361,7 +14655,7 @@ var OtpInputWidget = ({ fieldId }) => {
|
|
|
14361
14655
|
) })
|
|
14362
14656
|
] }),
|
|
14363
14657
|
status === "verified" && /* @__PURE__ */ jsx("p", { className: "text-xs text-green-600", children: "Mobile number verified successfully" }),
|
|
14364
|
-
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
14658
|
+
showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
14365
14659
|
] });
|
|
14366
14660
|
};
|
|
14367
14661
|
var FieldRenderer = ({ fieldId }) => {
|
|
@@ -14465,7 +14759,8 @@ function renderWidget(fieldId, fieldDef) {
|
|
|
14465
14759
|
const { value, setValue, setTouched, disabled } = useField(fieldId);
|
|
14466
14760
|
const store = useFormStore();
|
|
14467
14761
|
const excludes = fieldDef.excludes ?? [];
|
|
14468
|
-
|
|
14762
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
14763
|
+
return /* @__PURE__ */ jsxs("div", { className: fieldWrapperClass(fieldDef, "flex items-center gap-3"), children: [
|
|
14469
14764
|
/* @__PURE__ */ jsx(
|
|
14470
14765
|
Switch,
|
|
14471
14766
|
{
|
|
@@ -14478,7 +14773,20 @@ function renderWidget(fieldId, fieldDef) {
|
|
|
14478
14773
|
}
|
|
14479
14774
|
}
|
|
14480
14775
|
),
|
|
14481
|
-
/* @__PURE__ */
|
|
14776
|
+
showLabel ? /* @__PURE__ */ jsxs(
|
|
14777
|
+
Label,
|
|
14778
|
+
{
|
|
14779
|
+
className: fieldLabelClass(
|
|
14780
|
+
fieldDef,
|
|
14781
|
+
"text-sm font-medium leading-none cursor-pointer select-none"
|
|
14782
|
+
),
|
|
14783
|
+
children: [
|
|
14784
|
+
fieldDef.label,
|
|
14785
|
+
" ",
|
|
14786
|
+
/* @__PURE__ */ jsx(FieldRequiredIndicator, { fieldDef })
|
|
14787
|
+
]
|
|
14788
|
+
}
|
|
14789
|
+
) : null
|
|
14482
14790
|
] });
|
|
14483
14791
|
}
|
|
14484
14792
|
case "suggestion_textarea":
|
|
@@ -14497,10 +14805,19 @@ function renderWidget(fieldId, fieldDef) {
|
|
|
14497
14805
|
const size = def.size ?? "regular";
|
|
14498
14806
|
const labelClass = size === "large" ? "text-base" : "text-sm";
|
|
14499
14807
|
const descClass = size === "large" ? "text-sm" : "text-xs";
|
|
14500
|
-
return /* @__PURE__ */ jsxs(
|
|
14501
|
-
|
|
14502
|
-
|
|
14503
|
-
|
|
14808
|
+
return /* @__PURE__ */ jsxs(
|
|
14809
|
+
"div",
|
|
14810
|
+
{
|
|
14811
|
+
className: fieldWrapperClass(
|
|
14812
|
+
def,
|
|
14813
|
+
cn(labelClass, "text-muted-foreground")
|
|
14814
|
+
),
|
|
14815
|
+
children: [
|
|
14816
|
+
def.label,
|
|
14817
|
+
def.description && /* @__PURE__ */ jsx("p", { className: fieldDescriptionClass(def, cn("mt-1", descClass, "opacity-90")), children: def.description })
|
|
14818
|
+
]
|
|
14819
|
+
}
|
|
14820
|
+
);
|
|
14504
14821
|
}
|
|
14505
14822
|
default:
|
|
14506
14823
|
return /* @__PURE__ */ jsxs("div", { className: "text-red-500", children: [
|
|
@@ -15999,6 +16316,6 @@ function createUploadHandler(options) {
|
|
|
15999
16316
|
};
|
|
16000
16317
|
}
|
|
16001
16318
|
|
|
16002
|
-
export { AddInvestigationField, AddMedicationField, DifferentialDiagnosis, DynamicForm, DynamicFormV2, EMAIL_REGEX, FieldRenderer, FormControls, FormFileUploadWidget, FormProvider, FormStore, ImageUploadWidget, MAR_MEDICATION_ORDERS_META_KEY, MediaUploadWidget, MultiStepForm, ReadOnlyForm, ReadOnlyImageUpload, ReadOnlyMediaUpload, ReadOnlySignature, ReadOnlyTable, RichTextWidget, SignatureUploadWidget, SmartForm, SmartTextareaWidget, Upload3 as Upload, createUploadHandler, evaluateRules, fieldMetaRequestsMarMedicationOrdersButton, useField, useFieldHandlers, useForm, useFormStore, useFrequentItems, usePackages, useSmartKeywords, validateField, validateForm };
|
|
16319
|
+
export { AddInvestigationField, AddMedicationField, DifferentialDiagnosis, DynamicForm, DynamicFormV2, EMAIL_REGEX, FieldRenderer, FieldRequiredIndicator, FormControls, FormFileUploadWidget, FormProvider, FormStore, ImageUploadWidget, MAR_MEDICATION_ORDERS_META_KEY, MediaUploadWidget, MultiStepForm, ReadOnlyForm, ReadOnlyImageUpload, ReadOnlyMediaUpload, ReadOnlySignature, ReadOnlyTable, RichTextWidget, SignatureUploadWidget, SmartForm, SmartTextareaWidget, Upload3 as Upload, createUploadHandler, evaluateRules, fieldControlClass, fieldDescriptionClass, fieldErrorClass, fieldLabelClass, fieldMetaRequestsMarMedicationOrdersButton, fieldWrapperClass, isLabelVisible, useField, useFieldHandlers, useForm, useFormStore, useFrequentItems, usePackages, useSmartKeywords, validateField, validateForm };
|
|
16003
16320
|
//# sourceMappingURL=index.mjs.map
|
|
16004
16321
|
//# sourceMappingURL=index.mjs.map
|