formanitor 0.0.49 → 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 +864 -338
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +144 -69
- package/dist/index.d.ts +144 -69
- package/dist/index.mjs +856 -339
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
var React15 = require('react');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var lucideReact = require('lucide-react');
|
|
6
5
|
var clsx = require('clsx');
|
|
7
6
|
var tailwindMerge = require('tailwind-merge');
|
|
7
|
+
var lucideReact = require('lucide-react');
|
|
8
8
|
var LabelPrimitive = require('@radix-ui/react-label');
|
|
9
9
|
var classVarianceAuthority = require('class-variance-authority');
|
|
10
10
|
var react = require('@tiptap/react');
|
|
@@ -1548,16 +1548,28 @@ var FormStore = class {
|
|
|
1548
1548
|
result[field.id] = null;
|
|
1549
1549
|
return;
|
|
1550
1550
|
}
|
|
1551
|
-
if (field.type === "image_upload" || field.type === "media_upload" || field.type === "signature") {
|
|
1551
|
+
if (field.type === "image_upload" || field.type === "media_upload" || field.type === "signature" || field.type === "file_upload") {
|
|
1552
1552
|
const raw = values[field.id];
|
|
1553
|
-
if (raw
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1553
|
+
if (raw === void 0 || raw === null || raw === "") {
|
|
1554
|
+
return;
|
|
1555
|
+
}
|
|
1556
|
+
const wrapKey = (key2) => {
|
|
1557
|
+
if (typeof key2 !== "string" || !key2) return null;
|
|
1558
|
+
return { _type: "s3_key", value: key2 };
|
|
1559
|
+
};
|
|
1560
|
+
if (Array.isArray(raw)) {
|
|
1561
|
+
const wrapped2 = raw.map(
|
|
1562
|
+
(item) => typeof item === "string" ? wrapKey(item) : wrapKey(item.s3_key ?? item.value)
|
|
1563
|
+
).filter(Boolean);
|
|
1564
|
+
if (wrapped2.length > 0) {
|
|
1565
|
+
result[field.id] = wrapped2;
|
|
1560
1566
|
}
|
|
1567
|
+
return;
|
|
1568
|
+
}
|
|
1569
|
+
const key = typeof raw === "string" ? raw : raw.s3_key ?? raw.value ?? null;
|
|
1570
|
+
const wrapped = wrapKey(key);
|
|
1571
|
+
if (wrapped) {
|
|
1572
|
+
result[field.id] = wrapped;
|
|
1561
1573
|
}
|
|
1562
1574
|
}
|
|
1563
1575
|
});
|
|
@@ -1914,6 +1926,9 @@ function useField(fieldId) {
|
|
|
1914
1926
|
setTouched
|
|
1915
1927
|
};
|
|
1916
1928
|
}
|
|
1929
|
+
function cn(...inputs) {
|
|
1930
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
1931
|
+
}
|
|
1917
1932
|
function RecordingWave() {
|
|
1918
1933
|
const bars = [
|
|
1919
1934
|
{ dur: "0.6s", values: "3;10;3", yValues: "4.5;0;4.5", delay: "0s" },
|
|
@@ -1980,9 +1995,6 @@ function VoiceMicButton({ fieldId, onTranscriptReady }) {
|
|
|
1980
1995
|
}
|
|
1981
1996
|
);
|
|
1982
1997
|
}
|
|
1983
|
-
function cn(...inputs) {
|
|
1984
|
-
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
1985
|
-
}
|
|
1986
1998
|
var Input = React15__namespace.forwardRef(
|
|
1987
1999
|
({ className, type, ...props }, ref) => {
|
|
1988
2000
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2053,6 +2065,41 @@ function getThemeConfig(fieldType, themeName) {
|
|
|
2053
2065
|
if (!registry) return void 0;
|
|
2054
2066
|
return registry[themeName];
|
|
2055
2067
|
}
|
|
2068
|
+
function isLabelVisible(fieldDef) {
|
|
2069
|
+
return fieldDef.style?.labelVisible !== false;
|
|
2070
|
+
}
|
|
2071
|
+
function FieldRequiredIndicator({
|
|
2072
|
+
fieldDef
|
|
2073
|
+
}) {
|
|
2074
|
+
if (!fieldDef.required) return null;
|
|
2075
|
+
if (fieldDef.style?.showRequiredAsterisk === false) return null;
|
|
2076
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2077
|
+
"span",
|
|
2078
|
+
{
|
|
2079
|
+
className: cn(
|
|
2080
|
+
"text-red-500",
|
|
2081
|
+
fieldDef.style?.classNames?.requiredIndicator
|
|
2082
|
+
),
|
|
2083
|
+
"aria-hidden": true,
|
|
2084
|
+
children: "*"
|
|
2085
|
+
}
|
|
2086
|
+
);
|
|
2087
|
+
}
|
|
2088
|
+
function fieldWrapperClass(fieldDef, ...defaults) {
|
|
2089
|
+
return cn(...defaults, fieldDef.style?.classNames?.wrapper);
|
|
2090
|
+
}
|
|
2091
|
+
function fieldLabelClass(fieldDef, ...defaults) {
|
|
2092
|
+
return cn(...defaults, fieldDef.style?.classNames?.label);
|
|
2093
|
+
}
|
|
2094
|
+
function fieldControlClass(fieldDef, ...defaults) {
|
|
2095
|
+
return cn(...defaults, fieldDef.style?.classNames?.control);
|
|
2096
|
+
}
|
|
2097
|
+
function fieldDescriptionClass(fieldDef, ...defaults) {
|
|
2098
|
+
return cn(...defaults, fieldDef.style?.classNames?.description);
|
|
2099
|
+
}
|
|
2100
|
+
function fieldErrorClass(fieldDef, ...defaults) {
|
|
2101
|
+
return cn(...defaults, fieldDef.style?.classNames?.error);
|
|
2102
|
+
}
|
|
2056
2103
|
var TextWidget = ({ fieldId }) => {
|
|
2057
2104
|
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
2058
2105
|
const { state } = useForm();
|
|
@@ -2070,34 +2117,50 @@ var TextWidget = ({ fieldId }) => {
|
|
|
2070
2117
|
const wrapperClass = theme?.wrapperClassName ?? "space-y-2";
|
|
2071
2118
|
const labelClass = theme?.labelClassName;
|
|
2072
2119
|
const inputClass = cn(theme?.inputClassName, showError && "border-red-500");
|
|
2120
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
2073
2121
|
const labelContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2074
2122
|
fieldDef.label,
|
|
2075
2123
|
" ",
|
|
2076
|
-
|
|
2124
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
2077
2125
|
] });
|
|
2078
|
-
const labelEl = theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, className: labelClass, children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, children: labelContent });
|
|
2126
|
+
const labelEl = showLabel ? theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef, labelClass), children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: labelContent }) : null;
|
|
2079
2127
|
const placeholder = typeof fieldDef.placeholder === "string" && fieldDef.placeholder.trim() ? fieldDef.placeholder : void 0;
|
|
2080
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2128
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2129
|
+
"div",
|
|
2130
|
+
{
|
|
2131
|
+
className: fieldWrapperClass(
|
|
2132
|
+
fieldDef,
|
|
2133
|
+
wrapperClass,
|
|
2134
|
+
isTextarea && "flex h-full min-h-0 flex-col"
|
|
2135
|
+
),
|
|
2136
|
+
children: [
|
|
2137
|
+
hasVoice ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
2138
|
+
labelEl,
|
|
2139
|
+
/* @__PURE__ */ jsxRuntime.jsx(VoiceMicButton, { fieldId, onTranscriptReady: setValue })
|
|
2140
|
+
] }) : labelEl,
|
|
2141
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2142
|
+
Component,
|
|
2143
|
+
{
|
|
2144
|
+
id: fieldId,
|
|
2145
|
+
value: value || "",
|
|
2146
|
+
onChange: (e) => setValue(fieldDef.type === "number" ? Number(e.target.value) : e.target.value),
|
|
2147
|
+
onBlur: setTouched,
|
|
2148
|
+
disabled,
|
|
2149
|
+
type: fieldDef.type === "number" ? "number" : "text",
|
|
2150
|
+
className: fieldControlClass(
|
|
2151
|
+
fieldDef,
|
|
2152
|
+
inputClass,
|
|
2153
|
+
isTextarea && height == null && "min-h-[80px] flex-1"
|
|
2154
|
+
),
|
|
2155
|
+
placeholder,
|
|
2156
|
+
"aria-label": !showLabel ? fieldDef.label : void 0,
|
|
2157
|
+
...isTextarea && { height }
|
|
2158
|
+
}
|
|
2159
|
+
),
|
|
2160
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
2161
|
+
]
|
|
2162
|
+
}
|
|
2163
|
+
);
|
|
2101
2164
|
};
|
|
2102
2165
|
var buttonVariants = classVarianceAuthority.cva(
|
|
2103
2166
|
"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",
|
|
@@ -2361,24 +2424,28 @@ var RichTextWidget = ({ fieldId }) => {
|
|
|
2361
2424
|
}
|
|
2362
2425
|
}, [stringValue, editor]);
|
|
2363
2426
|
if (!fieldDef) return null;
|
|
2427
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
2364
2428
|
const labelContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2365
2429
|
fieldDef.label,
|
|
2366
2430
|
" ",
|
|
2367
|
-
|
|
2431
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
2368
2432
|
] });
|
|
2369
|
-
const labelEl = /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, children: labelContent });
|
|
2370
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
2433
|
+
const labelEl = /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: labelContent });
|
|
2434
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
2371
2435
|
hasVoice ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
2372
|
-
labelEl,
|
|
2436
|
+
showLabel ? labelEl : null,
|
|
2373
2437
|
/* @__PURE__ */ jsxRuntime.jsx(VoiceMicButton, { fieldId, onTranscriptReady: setValue })
|
|
2374
|
-
] }) : labelEl,
|
|
2438
|
+
] }) : showLabel ? labelEl : null,
|
|
2375
2439
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2376
2440
|
"div",
|
|
2377
2441
|
{
|
|
2378
|
-
className:
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2442
|
+
className: fieldControlClass(
|
|
2443
|
+
fieldDef,
|
|
2444
|
+
cn(
|
|
2445
|
+
"rounded-md border border-input bg-background text-sm ring-offset-background overflow-hidden",
|
|
2446
|
+
showError && "border-red-500",
|
|
2447
|
+
disabled && "opacity-60"
|
|
2448
|
+
)
|
|
2382
2449
|
),
|
|
2383
2450
|
children: [
|
|
2384
2451
|
/* @__PURE__ */ jsxRuntime.jsx(RichTextToolbar, { editor, disabled }),
|
|
@@ -2404,7 +2471,7 @@ var RichTextWidget = ({ fieldId }) => {
|
|
|
2404
2471
|
]
|
|
2405
2472
|
}
|
|
2406
2473
|
),
|
|
2407
|
-
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
2474
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
2408
2475
|
] });
|
|
2409
2476
|
};
|
|
2410
2477
|
var Select = SelectPrimitive__namespace.Root;
|
|
@@ -2570,12 +2637,13 @@ var SelectWidget = ({ fieldId }) => {
|
|
|
2570
2637
|
if (!fieldDef) return null;
|
|
2571
2638
|
const schemaPlaceholder = typeof fieldDef.placeholder === "string" && fieldDef.placeholder.trim() ? fieldDef.placeholder : void 0;
|
|
2572
2639
|
const selectPlaceholder = loading ? "Loading..." : schemaPlaceholder ?? "Select...";
|
|
2573
|
-
|
|
2574
|
-
|
|
2640
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
2641
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
2642
|
+
showLabel ? /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
2575
2643
|
fieldDef.label,
|
|
2576
2644
|
" ",
|
|
2577
|
-
|
|
2578
|
-
] }),
|
|
2645
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
2646
|
+
] }) : null,
|
|
2579
2647
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2580
2648
|
Select,
|
|
2581
2649
|
{
|
|
@@ -2587,12 +2655,22 @@ var SelectWidget = ({ fieldId }) => {
|
|
|
2587
2655
|
setTouched();
|
|
2588
2656
|
},
|
|
2589
2657
|
children: [
|
|
2590
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2658
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2659
|
+
SelectTrigger,
|
|
2660
|
+
{
|
|
2661
|
+
id: fieldId,
|
|
2662
|
+
className: fieldControlClass(
|
|
2663
|
+
fieldDef,
|
|
2664
|
+
showError ? "border-red-500" : ""
|
|
2665
|
+
),
|
|
2666
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: selectPlaceholder })
|
|
2667
|
+
}
|
|
2668
|
+
),
|
|
2591
2669
|
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { children: options.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: String(opt.value), children: opt.label }, String(opt.value))) })
|
|
2592
2670
|
]
|
|
2593
2671
|
}
|
|
2594
2672
|
),
|
|
2595
|
-
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
2673
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
2596
2674
|
] });
|
|
2597
2675
|
};
|
|
2598
2676
|
var Checkbox = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2639,34 +2717,44 @@ var MultiSelectWidget = ({ fieldId }) => {
|
|
|
2639
2717
|
setTouched();
|
|
2640
2718
|
};
|
|
2641
2719
|
if (!fieldDef) return null;
|
|
2642
|
-
|
|
2643
|
-
|
|
2720
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
2721
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
2722
|
+
showLabel ? /* @__PURE__ */ jsxRuntime.jsxs(Label, { className: fieldLabelClass(fieldDef), children: [
|
|
2644
2723
|
fieldDef.label,
|
|
2645
2724
|
" ",
|
|
2646
|
-
|
|
2647
|
-
] }),
|
|
2648
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
{
|
|
2654
|
-
id: `${fieldId}-${opt.value}`,
|
|
2655
|
-
checked: currentValues.includes(opt.value),
|
|
2656
|
-
onCheckedChange: () => toggleValue(opt.value)
|
|
2657
|
-
}
|
|
2725
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
2726
|
+
] }) : null,
|
|
2727
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2728
|
+
"div",
|
|
2729
|
+
{
|
|
2730
|
+
className: fieldControlClass(
|
|
2731
|
+
fieldDef,
|
|
2732
|
+
`border rounded-md p-3 space-y-2 ${showError ? "border-red-500" : ""} ${disabled ? "opacity-50 pointer-events-none" : ""}`
|
|
2658
2733
|
),
|
|
2659
|
-
|
|
2660
|
-
"
|
|
2661
|
-
{
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2734
|
+
children: [
|
|
2735
|
+
loading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-gray-500", children: "Loading options..." }),
|
|
2736
|
+
!loading && options.map((opt) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
2737
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2738
|
+
Checkbox,
|
|
2739
|
+
{
|
|
2740
|
+
id: `${fieldId}-${opt.value}`,
|
|
2741
|
+
checked: currentValues.includes(opt.value),
|
|
2742
|
+
onCheckedChange: () => toggleValue(opt.value)
|
|
2743
|
+
}
|
|
2744
|
+
),
|
|
2745
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2746
|
+
"label",
|
|
2747
|
+
{
|
|
2748
|
+
htmlFor: `${fieldId}-${opt.value}`,
|
|
2749
|
+
className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
2750
|
+
children: opt.label
|
|
2751
|
+
}
|
|
2752
|
+
)
|
|
2753
|
+
] }, String(opt.value)))
|
|
2754
|
+
]
|
|
2755
|
+
}
|
|
2756
|
+
),
|
|
2757
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
2670
2758
|
] });
|
|
2671
2759
|
};
|
|
2672
2760
|
var Table = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3005,22 +3093,26 @@ var DateWidget = ({ fieldId }) => {
|
|
|
3005
3093
|
const { state } = useForm();
|
|
3006
3094
|
const showError = !!error && (touched || state.submitAttempted);
|
|
3007
3095
|
if (!fieldDef) return null;
|
|
3008
|
-
|
|
3009
|
-
|
|
3096
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
3097
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
3098
|
+
showLabel ? /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
3010
3099
|
fieldDef.label,
|
|
3011
3100
|
" ",
|
|
3012
|
-
|
|
3013
|
-
] }),
|
|
3101
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
3102
|
+
] }) : null,
|
|
3014
3103
|
/* @__PURE__ */ jsxRuntime.jsx("div", { onBlur: () => setTouched(), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3015
3104
|
DatePicker,
|
|
3016
3105
|
{
|
|
3017
3106
|
date: value ? new Date(value) : void 0,
|
|
3018
3107
|
setDate: (date) => setValue(date ? date.toISOString() : void 0),
|
|
3019
3108
|
placeholder: fieldDef.placeholder,
|
|
3020
|
-
className:
|
|
3109
|
+
className: fieldControlClass(
|
|
3110
|
+
fieldDef,
|
|
3111
|
+
showError ? "border-red-500 w-full" : "w-full"
|
|
3112
|
+
)
|
|
3021
3113
|
}
|
|
3022
3114
|
) }),
|
|
3023
|
-
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
3115
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
3024
3116
|
] });
|
|
3025
3117
|
};
|
|
3026
3118
|
function parseTimeString(value) {
|
|
@@ -3137,6 +3229,7 @@ var DateTimeWidget = ({ fieldId }) => {
|
|
|
3137
3229
|
const showError = !!error && (touched || state.submitAttempted);
|
|
3138
3230
|
if (!fieldDef) return null;
|
|
3139
3231
|
const currentDate = value ? new Date(value) : void 0;
|
|
3232
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
3140
3233
|
const handleChange = (date) => {
|
|
3141
3234
|
if (!date) {
|
|
3142
3235
|
setValue(void 0);
|
|
@@ -3144,12 +3237,12 @@ var DateTimeWidget = ({ fieldId }) => {
|
|
|
3144
3237
|
}
|
|
3145
3238
|
setValue(date.toISOString());
|
|
3146
3239
|
};
|
|
3147
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
3148
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: fieldId, children: [
|
|
3240
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
3241
|
+
showLabel ? /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
3149
3242
|
fieldDef.label,
|
|
3150
3243
|
" ",
|
|
3151
|
-
|
|
3152
|
-
] }),
|
|
3244
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
3245
|
+
] }) : null,
|
|
3153
3246
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3154
3247
|
"div",
|
|
3155
3248
|
{
|
|
@@ -3161,12 +3254,15 @@ var DateTimeWidget = ({ fieldId }) => {
|
|
|
3161
3254
|
dateTime: currentDate,
|
|
3162
3255
|
setDateTime: handleChange,
|
|
3163
3256
|
placeholder: fieldDef.placeholder,
|
|
3164
|
-
className:
|
|
3257
|
+
className: fieldControlClass(
|
|
3258
|
+
fieldDef,
|
|
3259
|
+
showError ? "border-red-500 w-full" : "w-full"
|
|
3260
|
+
)
|
|
3165
3261
|
}
|
|
3166
3262
|
)
|
|
3167
3263
|
}
|
|
3168
3264
|
),
|
|
3169
|
-
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
3265
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
3170
3266
|
] });
|
|
3171
3267
|
};
|
|
3172
3268
|
function extractImageDisplayUrl(value) {
|
|
@@ -3197,13 +3293,15 @@ var ImageUploadWidget = ({ fieldId }) => {
|
|
|
3197
3293
|
}
|
|
3198
3294
|
};
|
|
3199
3295
|
if (!fieldDef) return null;
|
|
3296
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
3200
3297
|
const uploadHandler = store.getUploadHandler();
|
|
3201
3298
|
if (!uploadHandler) {
|
|
3202
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
3203
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: fieldId, children: [
|
|
3299
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
3300
|
+
showLabel ? /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
3204
3301
|
fieldDef.label,
|
|
3205
|
-
|
|
3206
|
-
|
|
3302
|
+
" ",
|
|
3303
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
3304
|
+
] }) : null,
|
|
3207
3305
|
/* @__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." }) })
|
|
3208
3306
|
] });
|
|
3209
3307
|
}
|
|
@@ -3271,49 +3369,59 @@ var ImageUploadWidget = ({ fieldId }) => {
|
|
|
3271
3369
|
const handleUploadClick = () => {
|
|
3272
3370
|
fileInputRef.current?.click();
|
|
3273
3371
|
};
|
|
3274
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
3275
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: fieldId, children: [
|
|
3372
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
3373
|
+
showLabel ? /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
3276
3374
|
fieldDef.label,
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
children:
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3375
|
+
" ",
|
|
3376
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
3377
|
+
] }) : null,
|
|
3378
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3379
|
+
"div",
|
|
3380
|
+
{
|
|
3381
|
+
className: fieldControlClass(
|
|
3382
|
+
fieldDef,
|
|
3383
|
+
"border-2 border-dashed border-gray-300 rounded-lg p-4"
|
|
3384
|
+
),
|
|
3385
|
+
children: preview ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
3386
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3387
|
+
"img",
|
|
3388
|
+
{
|
|
3389
|
+
src: preview,
|
|
3390
|
+
alt: "Uploaded image",
|
|
3391
|
+
className: "max-w-full max-h-48 mx-auto rounded-lg"
|
|
3392
|
+
}
|
|
3393
|
+
),
|
|
3394
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3395
|
+
Button,
|
|
3396
|
+
{
|
|
3397
|
+
type: "button",
|
|
3398
|
+
variant: "destructive",
|
|
3399
|
+
size: "sm",
|
|
3400
|
+
className: "absolute top-2 right-2",
|
|
3401
|
+
onClick: handleRemove,
|
|
3402
|
+
disabled: disabled || isUploading,
|
|
3403
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" })
|
|
3404
|
+
}
|
|
3405
|
+
)
|
|
3406
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center py-8", children: [
|
|
3407
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Image, { className: "h-12 w-12 mx-auto text-gray-400 mb-4" }),
|
|
3408
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-600 mb-4", children: "Click to upload an image or drag and drop" }),
|
|
3409
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3410
|
+
Button,
|
|
3411
|
+
{
|
|
3412
|
+
type: "button",
|
|
3413
|
+
variant: "outline",
|
|
3414
|
+
onClick: handleUploadClick,
|
|
3415
|
+
disabled: disabled || isUploading,
|
|
3416
|
+
children: [
|
|
3417
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Upload, { className: "h-4 w-4 mr-2" }),
|
|
3418
|
+
isUploading ? "Uploading..." : "Choose Image"
|
|
3419
|
+
]
|
|
3420
|
+
}
|
|
3421
|
+
)
|
|
3422
|
+
] })
|
|
3423
|
+
}
|
|
3424
|
+
),
|
|
3317
3425
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3318
3426
|
"input",
|
|
3319
3427
|
{
|
|
@@ -3325,8 +3433,8 @@ var ImageUploadWidget = ({ fieldId }) => {
|
|
|
3325
3433
|
disabled: disabled || isUploading
|
|
3326
3434
|
}
|
|
3327
3435
|
),
|
|
3328
|
-
fieldDef.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-gray-500", children: fieldDef.description }),
|
|
3329
|
-
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
3436
|
+
fieldDef.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldDescriptionClass(fieldDef, "text-xs text-gray-500"), children: fieldDef.description }),
|
|
3437
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
3330
3438
|
] });
|
|
3331
3439
|
};
|
|
3332
3440
|
function urlLooksLikePdf(url) {
|
|
@@ -3368,13 +3476,15 @@ var MediaUploadWidget = ({ fieldId }) => {
|
|
|
3368
3476
|
}
|
|
3369
3477
|
};
|
|
3370
3478
|
if (!fieldDef) return null;
|
|
3479
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
3371
3480
|
const uploadHandler = store.getUploadHandler();
|
|
3372
3481
|
if (!uploadHandler) {
|
|
3373
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
3374
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: fieldId, children: [
|
|
3482
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
3483
|
+
showLabel ? /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
3375
3484
|
fieldDef.label,
|
|
3376
|
-
|
|
3377
|
-
|
|
3485
|
+
" ",
|
|
3486
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
3487
|
+
] }) : null,
|
|
3378
3488
|
/* @__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." }) })
|
|
3379
3489
|
] });
|
|
3380
3490
|
}
|
|
@@ -3457,56 +3567,66 @@ var MediaUploadWidget = ({ fieldId }) => {
|
|
|
3457
3567
|
const handleUploadClick = () => {
|
|
3458
3568
|
fileInputRef.current?.click();
|
|
3459
3569
|
};
|
|
3460
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
3461
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: fieldId, children: [
|
|
3570
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
3571
|
+
showLabel ? /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
3462
3572
|
fieldDef.label,
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
children:
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3573
|
+
" ",
|
|
3574
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
3575
|
+
] }) : null,
|
|
3576
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3577
|
+
"div",
|
|
3578
|
+
{
|
|
3579
|
+
className: fieldControlClass(
|
|
3580
|
+
fieldDef,
|
|
3581
|
+
"border-2 border-dashed border-gray-300 rounded-lg p-4"
|
|
3582
|
+
),
|
|
3583
|
+
children: preview ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
3584
|
+
previewIsPdf ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3585
|
+
"iframe",
|
|
3586
|
+
{
|
|
3587
|
+
src: preview,
|
|
3588
|
+
title: "Uploaded PDF",
|
|
3589
|
+
className: "w-full max-h-48 min-h-36 rounded-lg border border-gray-200 bg-white"
|
|
3590
|
+
}
|
|
3591
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3592
|
+
"img",
|
|
3593
|
+
{
|
|
3594
|
+
src: preview,
|
|
3595
|
+
alt: "Uploaded image",
|
|
3596
|
+
className: "max-w-full max-h-48 mx-auto rounded-lg"
|
|
3597
|
+
}
|
|
3598
|
+
),
|
|
3599
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3600
|
+
Button,
|
|
3601
|
+
{
|
|
3602
|
+
type: "button",
|
|
3603
|
+
variant: "destructive",
|
|
3604
|
+
size: "sm",
|
|
3605
|
+
className: "absolute top-2 right-2",
|
|
3606
|
+
onClick: handleRemove,
|
|
3607
|
+
disabled: disabled || isUploading,
|
|
3608
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "h-4 w-4" })
|
|
3609
|
+
}
|
|
3610
|
+
)
|
|
3611
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center py-8", children: [
|
|
3612
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Image, { className: "h-12 w-12 mx-auto text-gray-400 mb-4" }),
|
|
3613
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-600 mb-4", children: "Click to upload an image or PDF, or drag and drop" }),
|
|
3614
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3615
|
+
Button,
|
|
3616
|
+
{
|
|
3617
|
+
type: "button",
|
|
3618
|
+
variant: "outline",
|
|
3619
|
+
onClick: handleUploadClick,
|
|
3620
|
+
disabled: disabled || isUploading,
|
|
3621
|
+
children: [
|
|
3622
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Upload, { className: "h-4 w-4 mr-2" }),
|
|
3623
|
+
isUploading ? "Uploading..." : "Choose Image"
|
|
3624
|
+
]
|
|
3625
|
+
}
|
|
3626
|
+
)
|
|
3627
|
+
] })
|
|
3628
|
+
}
|
|
3629
|
+
),
|
|
3510
3630
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3511
3631
|
"input",
|
|
3512
3632
|
{
|
|
@@ -3518,8 +3638,8 @@ var MediaUploadWidget = ({ fieldId }) => {
|
|
|
3518
3638
|
disabled: disabled || isUploading
|
|
3519
3639
|
}
|
|
3520
3640
|
),
|
|
3521
|
-
fieldDef.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-gray-500", children: fieldDef.description }),
|
|
3522
|
-
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
3641
|
+
fieldDef.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldDescriptionClass(fieldDef, "text-xs text-gray-500"), children: fieldDef.description }),
|
|
3642
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
3523
3643
|
] });
|
|
3524
3644
|
};
|
|
3525
3645
|
var distance = (a, b) => Math.hypot(a.x - b.x, a.y - b.y);
|
|
@@ -3708,23 +3828,34 @@ var SignatureUploadWidget = ({ fieldId }) => {
|
|
|
3708
3828
|
};
|
|
3709
3829
|
confirmSignatureRef.current = confirmSignature;
|
|
3710
3830
|
const canClear = showPreview ? !disabled : hasDrawing || isConfirmed;
|
|
3711
|
-
|
|
3712
|
-
|
|
3831
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
3832
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
3833
|
+
showLabel ? /* @__PURE__ */ jsxRuntime.jsxs(Label, { className: fieldLabelClass(fieldDef), children: [
|
|
3713
3834
|
fieldDef.label,
|
|
3714
|
-
|
|
3715
|
-
|
|
3835
|
+
" ",
|
|
3836
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
3837
|
+
] }) : null,
|
|
3716
3838
|
showPreview ? (
|
|
3717
3839
|
/* ── Preview mode: existing signature from backend ── */
|
|
3718
3840
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
3719
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3720
|
-
"
|
|
3841
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3842
|
+
"div",
|
|
3721
3843
|
{
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3844
|
+
className: fieldControlClass(
|
|
3845
|
+
fieldDef,
|
|
3846
|
+
"border border-gray-200 rounded bg-white flex items-center justify-start p-2"
|
|
3847
|
+
),
|
|
3848
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3849
|
+
"img",
|
|
3850
|
+
{
|
|
3851
|
+
src: displayUrl,
|
|
3852
|
+
alt: "Signature",
|
|
3853
|
+
className: "object-contain max-w-full",
|
|
3854
|
+
style: { width: 400, height: 200 }
|
|
3855
|
+
}
|
|
3856
|
+
)
|
|
3726
3857
|
}
|
|
3727
|
-
)
|
|
3858
|
+
),
|
|
3728
3859
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3729
3860
|
Button,
|
|
3730
3861
|
{
|
|
@@ -3747,7 +3878,10 @@ var SignatureUploadWidget = ({ fieldId }) => {
|
|
|
3747
3878
|
"canvas",
|
|
3748
3879
|
{
|
|
3749
3880
|
ref: canvasRef,
|
|
3750
|
-
className:
|
|
3881
|
+
className: fieldControlClass(
|
|
3882
|
+
fieldDef,
|
|
3883
|
+
`border rounded touch-none ${isConfirmed ? "border-green-300 cursor-default" : "border-gray-200 cursor-crosshair"}`
|
|
3884
|
+
),
|
|
3751
3885
|
onMouseDown: startDrawing,
|
|
3752
3886
|
onMouseMove: draw,
|
|
3753
3887
|
onMouseUp: stopDrawing,
|
|
@@ -3792,7 +3926,285 @@ var SignatureUploadWidget = ({ fieldId }) => {
|
|
|
3792
3926
|
] })
|
|
3793
3927
|
] })
|
|
3794
3928
|
),
|
|
3795
|
-
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
3929
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
3930
|
+
] });
|
|
3931
|
+
};
|
|
3932
|
+
function Upload3({
|
|
3933
|
+
value,
|
|
3934
|
+
accept,
|
|
3935
|
+
multiple,
|
|
3936
|
+
disabled,
|
|
3937
|
+
onChange,
|
|
3938
|
+
className,
|
|
3939
|
+
formatsLabel,
|
|
3940
|
+
placeholder = "Upload File",
|
|
3941
|
+
beforeUploadContent,
|
|
3942
|
+
id: idProp,
|
|
3943
|
+
listLayout = false
|
|
3944
|
+
}) {
|
|
3945
|
+
const inputRef = React15__namespace.default.useRef(null);
|
|
3946
|
+
const generatedId = React15__namespace.default.useId();
|
|
3947
|
+
const inputId = idProp ?? generatedId;
|
|
3948
|
+
const handleFileChange = (e) => {
|
|
3949
|
+
onChange(e.target.files ?? null);
|
|
3950
|
+
};
|
|
3951
|
+
React15__namespace.default.useEffect(() => {
|
|
3952
|
+
if (!value && inputRef.current) {
|
|
3953
|
+
inputRef.current.value = "";
|
|
3954
|
+
}
|
|
3955
|
+
}, [value]);
|
|
3956
|
+
const count = value?.length ?? 0;
|
|
3957
|
+
const formatsText = formatsLabel ?? accept;
|
|
3958
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3959
|
+
"div",
|
|
3960
|
+
{
|
|
3961
|
+
className: cn(
|
|
3962
|
+
"border border-dashed bg-[#F7F7F7] border-gray-200 rounded-lg py-5 px-4 flex items-center justify-center text-[#989898]",
|
|
3963
|
+
disabled && "opacity-50 pointer-events-none",
|
|
3964
|
+
className
|
|
3965
|
+
),
|
|
3966
|
+
children: [
|
|
3967
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3968
|
+
"input",
|
|
3969
|
+
{
|
|
3970
|
+
type: "file",
|
|
3971
|
+
ref: inputRef,
|
|
3972
|
+
accept,
|
|
3973
|
+
id: inputId,
|
|
3974
|
+
className: "hidden",
|
|
3975
|
+
multiple,
|
|
3976
|
+
disabled,
|
|
3977
|
+
onChange: handleFileChange
|
|
3978
|
+
}
|
|
3979
|
+
),
|
|
3980
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3981
|
+
"label",
|
|
3982
|
+
{
|
|
3983
|
+
htmlFor: inputId,
|
|
3984
|
+
className: cn(
|
|
3985
|
+
"cursor-pointer w-full",
|
|
3986
|
+
disabled && "cursor-not-allowed"
|
|
3987
|
+
),
|
|
3988
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: count > 0 && !listLayout ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center text-sm font-semibold text-gray-700", children: [
|
|
3989
|
+
count,
|
|
3990
|
+
" file",
|
|
3991
|
+
count === 1 ? "" : "s",
|
|
3992
|
+
" selected"
|
|
3993
|
+
] }) : beforeUploadContent ? beforeUploadContent : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center", children: [
|
|
3994
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-sm text-black font-normal leading-[120%] tracking-[-0.28px] text-center", children: [
|
|
3995
|
+
"Upload your surgery prescription",
|
|
3996
|
+
/* @__PURE__ */ jsxRuntime.jsx("br", {}),
|
|
3997
|
+
"and medical records"
|
|
3998
|
+
] }),
|
|
3999
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4000
|
+
lucideReact.Upload,
|
|
4001
|
+
{
|
|
4002
|
+
size: 20,
|
|
4003
|
+
className: "rotate-180 text-[#727272] mt-4"
|
|
4004
|
+
}
|
|
4005
|
+
),
|
|
4006
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs mt-1 text-text-shades-2", children: placeholder }),
|
|
4007
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-2 text-10px leading-[140%] text-[#989898]", children: [
|
|
4008
|
+
"Supported formats - ",
|
|
4009
|
+
formatsText
|
|
4010
|
+
] })
|
|
4011
|
+
] }) })
|
|
4012
|
+
}
|
|
4013
|
+
)
|
|
4014
|
+
]
|
|
4015
|
+
}
|
|
4016
|
+
);
|
|
4017
|
+
}
|
|
4018
|
+
function fileListFromArray(files) {
|
|
4019
|
+
const dt = new DataTransfer();
|
|
4020
|
+
files.forEach((f) => dt.items.add(f));
|
|
4021
|
+
return dt.files;
|
|
4022
|
+
}
|
|
4023
|
+
function matchesAccept(file, accept) {
|
|
4024
|
+
if (!accept || accept === "*/*") return true;
|
|
4025
|
+
const tokens = accept.split(",").map((t) => t.trim().toLowerCase());
|
|
4026
|
+
const name = file.name.toLowerCase();
|
|
4027
|
+
const type = file.type.toLowerCase();
|
|
4028
|
+
return tokens.some((token) => {
|
|
4029
|
+
if (token.startsWith(".")) return name.endsWith(token);
|
|
4030
|
+
if (token.endsWith("/*")) {
|
|
4031
|
+
const prefix = token.slice(0, -1);
|
|
4032
|
+
return type.startsWith(prefix);
|
|
4033
|
+
}
|
|
4034
|
+
return type === token;
|
|
4035
|
+
});
|
|
4036
|
+
}
|
|
4037
|
+
function basenameKey(key) {
|
|
4038
|
+
const parts = key.split("/");
|
|
4039
|
+
return parts[parts.length - 1] || key;
|
|
4040
|
+
}
|
|
4041
|
+
function fileRows(listLayout, localFiles, value) {
|
|
4042
|
+
if (!listLayout) return [];
|
|
4043
|
+
if (localFiles && localFiles.length > 0) {
|
|
4044
|
+
return Array.from(localFiles).map((f, i) => ({ label: f.name, index: i }));
|
|
4045
|
+
}
|
|
4046
|
+
if (Array.isArray(value) && value.length > 0) {
|
|
4047
|
+
return value.map((k, i) => ({
|
|
4048
|
+
label: basenameKey(String(k)),
|
|
4049
|
+
index: i
|
|
4050
|
+
}));
|
|
4051
|
+
}
|
|
4052
|
+
if (value !== null && value !== void 0 && value !== "") {
|
|
4053
|
+
return [{ label: basenameKey(String(value)), index: 0 }];
|
|
4054
|
+
}
|
|
4055
|
+
return [];
|
|
4056
|
+
}
|
|
4057
|
+
var FormFileUploadWidget = ({
|
|
4058
|
+
fieldId
|
|
4059
|
+
}) => {
|
|
4060
|
+
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
4061
|
+
const store = useFormStore();
|
|
4062
|
+
const { state } = useForm();
|
|
4063
|
+
const [localFiles, setLocalFiles] = React15.useState(null);
|
|
4064
|
+
const [isUploading, setIsUploading] = React15.useState(false);
|
|
4065
|
+
const showError = !!error && (touched || state.submitAttempted);
|
|
4066
|
+
const listLayout = fieldDef?.type === "file_upload" && fieldDef.list === true;
|
|
4067
|
+
const rows = React15.useMemo(
|
|
4068
|
+
() => fileRows(listLayout, localFiles, value),
|
|
4069
|
+
[listLayout, localFiles, value]
|
|
4070
|
+
);
|
|
4071
|
+
if (!fieldDef || fieldDef.type !== "file_upload") return null;
|
|
4072
|
+
const def = fieldDef;
|
|
4073
|
+
const accept = def.accept ?? "*/*";
|
|
4074
|
+
const maxSize = def.maxSize ?? 10 * 1024 * 1024;
|
|
4075
|
+
const allowMultiple = def.multiple === true;
|
|
4076
|
+
const uploadHandler = store.getUploadHandler();
|
|
4077
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
4078
|
+
if (!uploadHandler) {
|
|
4079
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
4080
|
+
showLabel ? /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
4081
|
+
fieldDef.label,
|
|
4082
|
+
" ",
|
|
4083
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
4084
|
+
] }) : null,
|
|
4085
|
+
/* @__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." }) })
|
|
4086
|
+
] });
|
|
4087
|
+
}
|
|
4088
|
+
const hasStoredValue = value !== null && value !== void 0 && value !== "" && !(Array.isArray(value) && value.length === 0);
|
|
4089
|
+
const removeFileAt = (index) => {
|
|
4090
|
+
setTouched();
|
|
4091
|
+
if (disabled || isUploading) return;
|
|
4092
|
+
const hadLocal = localFiles != null && localFiles.length > 0;
|
|
4093
|
+
if (hadLocal) {
|
|
4094
|
+
const next = Array.from(localFiles).filter((_, i) => i !== index);
|
|
4095
|
+
if (next.length === 0) {
|
|
4096
|
+
setLocalFiles(null);
|
|
4097
|
+
setValue(null);
|
|
4098
|
+
return;
|
|
4099
|
+
}
|
|
4100
|
+
setLocalFiles(fileListFromArray(next));
|
|
4101
|
+
if (allowMultiple && Array.isArray(value)) {
|
|
4102
|
+
setValue(value.filter((_, i) => i !== index));
|
|
4103
|
+
} else {
|
|
4104
|
+
setValue(null);
|
|
4105
|
+
}
|
|
4106
|
+
return;
|
|
4107
|
+
}
|
|
4108
|
+
if (allowMultiple && Array.isArray(value)) {
|
|
4109
|
+
const next = value.filter((_, i) => i !== index);
|
|
4110
|
+
setValue(next.length ? next : null);
|
|
4111
|
+
return;
|
|
4112
|
+
}
|
|
4113
|
+
setValue(null);
|
|
4114
|
+
};
|
|
4115
|
+
const handleChange = async (files) => {
|
|
4116
|
+
setTouched();
|
|
4117
|
+
if (!files || files.length === 0) {
|
|
4118
|
+
setLocalFiles(null);
|
|
4119
|
+
setValue(null);
|
|
4120
|
+
return;
|
|
4121
|
+
}
|
|
4122
|
+
const selected = Array.from(files);
|
|
4123
|
+
for (const file of selected) {
|
|
4124
|
+
if (!matchesAccept(file, accept)) {
|
|
4125
|
+
alert(`File type not allowed: ${file.name}`);
|
|
4126
|
+
return;
|
|
4127
|
+
}
|
|
4128
|
+
if (file.size > maxSize) {
|
|
4129
|
+
alert(
|
|
4130
|
+
`File must be less than ${Math.round(maxSize / (1024 * 1024))}MB: ${file.name}`
|
|
4131
|
+
);
|
|
4132
|
+
return;
|
|
4133
|
+
}
|
|
4134
|
+
}
|
|
4135
|
+
const toUpload = allowMultiple ? selected : [selected[0]];
|
|
4136
|
+
setLocalFiles(fileListFromArray(toUpload));
|
|
4137
|
+
setIsUploading(true);
|
|
4138
|
+
store.incrementPendingUploads();
|
|
4139
|
+
try {
|
|
4140
|
+
if (allowMultiple) {
|
|
4141
|
+
const keys = [];
|
|
4142
|
+
for (const file of toUpload) {
|
|
4143
|
+
keys.push(await uploadHandler(file, file.name));
|
|
4144
|
+
}
|
|
4145
|
+
setValue(keys);
|
|
4146
|
+
} else {
|
|
4147
|
+
const key = await uploadHandler(toUpload[0], toUpload[0].name);
|
|
4148
|
+
setValue(key);
|
|
4149
|
+
}
|
|
4150
|
+
} catch (err) {
|
|
4151
|
+
console.error("[FormFileUpload] Upload failed:", err);
|
|
4152
|
+
const message = err instanceof Error ? err.message : "Upload failed. Please try again.";
|
|
4153
|
+
alert(message);
|
|
4154
|
+
setLocalFiles(null);
|
|
4155
|
+
setValue(null);
|
|
4156
|
+
} finally {
|
|
4157
|
+
setIsUploading(false);
|
|
4158
|
+
store.decrementPendingUploads();
|
|
4159
|
+
}
|
|
4160
|
+
};
|
|
4161
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
4162
|
+
showLabel ? /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
4163
|
+
fieldDef.label,
|
|
4164
|
+
" ",
|
|
4165
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
4166
|
+
] }) : null,
|
|
4167
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4168
|
+
Upload3,
|
|
4169
|
+
{
|
|
4170
|
+
accept,
|
|
4171
|
+
multiple: allowMultiple,
|
|
4172
|
+
value: localFiles,
|
|
4173
|
+
onChange: handleChange,
|
|
4174
|
+
disabled: disabled || isUploading,
|
|
4175
|
+
listLayout,
|
|
4176
|
+
placeholder: isUploading ? "Uploading..." : def.uploadPlaceholder ?? "Upload File",
|
|
4177
|
+
formatsLabel: def.uploadFormats,
|
|
4178
|
+
className: fieldControlClass(
|
|
4179
|
+
fieldDef,
|
|
4180
|
+
isUploading ? "opacity-70" : void 0
|
|
4181
|
+
)
|
|
4182
|
+
}
|
|
4183
|
+
),
|
|
4184
|
+
listLayout && rows.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "flex flex-col gap-2 mt-2 list-none p-0 m-0", children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4185
|
+
"li",
|
|
4186
|
+
{
|
|
4187
|
+
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]",
|
|
4188
|
+
children: [
|
|
4189
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate pr-2", children: row.label }),
|
|
4190
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4191
|
+
"button",
|
|
4192
|
+
{
|
|
4193
|
+
type: "button",
|
|
4194
|
+
disabled: disabled || isUploading,
|
|
4195
|
+
onClick: () => removeFileAt(row.index),
|
|
4196
|
+
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",
|
|
4197
|
+
"aria-label": `Remove ${row.label}`,
|
|
4198
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 14, strokeWidth: 2.5 })
|
|
4199
|
+
}
|
|
4200
|
+
)
|
|
4201
|
+
]
|
|
4202
|
+
},
|
|
4203
|
+
`${row.index}-${row.label}`
|
|
4204
|
+
)) }) : null,
|
|
4205
|
+
hasStoredValue && !listLayout ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-green-600", children: allowMultiple && Array.isArray(value) ? `${value.length} file(s) uploaded` : "File uploaded" }) : null,
|
|
4206
|
+
fieldDef.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldDescriptionClass(fieldDef, "text-xs text-gray-500"), children: fieldDef.description }),
|
|
4207
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
3796
4208
|
] });
|
|
3797
4209
|
};
|
|
3798
4210
|
var EditableTableWidget = ({
|
|
@@ -4103,12 +4515,22 @@ var RadioWidget = ({ fieldId }) => {
|
|
|
4103
4515
|
setValue(opt ? opt.value : val);
|
|
4104
4516
|
setTouched();
|
|
4105
4517
|
};
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4518
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
4519
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
4520
|
+
showLabel ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4521
|
+
Label,
|
|
4522
|
+
{
|
|
4523
|
+
className: fieldLabelClass(
|
|
4524
|
+
fieldDef,
|
|
4525
|
+
showError ? "text-red-600" : ""
|
|
4526
|
+
),
|
|
4527
|
+
children: [
|
|
4528
|
+
fieldDef.label,
|
|
4529
|
+
" ",
|
|
4530
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
4531
|
+
]
|
|
4532
|
+
}
|
|
4533
|
+
) : null,
|
|
4112
4534
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4113
4535
|
RadioGroup,
|
|
4114
4536
|
{
|
|
@@ -4136,7 +4558,7 @@ var RadioWidget = ({ fieldId }) => {
|
|
|
4136
4558
|
}
|
|
4137
4559
|
),
|
|
4138
4560
|
loading && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Loading options..." }),
|
|
4139
|
-
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
4561
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
4140
4562
|
] });
|
|
4141
4563
|
};
|
|
4142
4564
|
function isOptionSelected(selected, optValue) {
|
|
@@ -4168,16 +4590,29 @@ var CheckboxWidget = ({ fieldId }) => {
|
|
|
4168
4590
|
setTouched();
|
|
4169
4591
|
};
|
|
4170
4592
|
if (!fieldDef) return null;
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4593
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
4594
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
4595
|
+
showLabel ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4596
|
+
Label,
|
|
4597
|
+
{
|
|
4598
|
+
className: fieldLabelClass(
|
|
4599
|
+
fieldDef,
|
|
4600
|
+
showError ? "text-red-600" : ""
|
|
4601
|
+
),
|
|
4602
|
+
children: [
|
|
4603
|
+
fieldDef.label,
|
|
4604
|
+
" ",
|
|
4605
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
4606
|
+
]
|
|
4607
|
+
}
|
|
4608
|
+
) : null,
|
|
4177
4609
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4178
4610
|
"div",
|
|
4179
4611
|
{
|
|
4180
|
-
className:
|
|
4612
|
+
className: fieldControlClass(
|
|
4613
|
+
fieldDef,
|
|
4614
|
+
`border rounded-md p-3 space-y-2 ${showError ? "border-red-500" : ""} ${disabled || loading ? "opacity-50 pointer-events-none" : ""}`
|
|
4615
|
+
),
|
|
4181
4616
|
children: [
|
|
4182
4617
|
loading && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-muted-foreground", children: "Loading options..." }),
|
|
4183
4618
|
!loading && options.map((opt) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
@@ -4202,8 +4637,8 @@ var CheckboxWidget = ({ fieldId }) => {
|
|
|
4202
4637
|
]
|
|
4203
4638
|
}
|
|
4204
4639
|
),
|
|
4205
|
-
fieldDef.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: fieldDef.description }),
|
|
4206
|
-
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
4640
|
+
fieldDef.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldDescriptionClass(fieldDef, "text-xs text-muted-foreground"), children: fieldDef.description }),
|
|
4641
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
4207
4642
|
] });
|
|
4208
4643
|
};
|
|
4209
4644
|
var AISuggestionsContext = React15.createContext({});
|
|
@@ -5697,24 +6132,31 @@ var HiddenVitalsWidget = ({ fieldId }) => {
|
|
|
5697
6132
|
const labelContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5698
6133
|
fieldDef.label,
|
|
5699
6134
|
" ",
|
|
5700
|
-
|
|
5701
|
-
] });
|
|
5702
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: wrapperClass, "aria-hidden": "true", children: [
|
|
5703
|
-
theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, className: labelClass, children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, children: labelContent }),
|
|
5704
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5705
|
-
Textarea,
|
|
5706
|
-
{
|
|
5707
|
-
id: fieldId,
|
|
5708
|
-
value: value ?? "",
|
|
5709
|
-
onChange: (e) => setValue(e.target.value),
|
|
5710
|
-
onBlur: setTouched,
|
|
5711
|
-
disabled,
|
|
5712
|
-
className: inputClass,
|
|
5713
|
-
...height != null && { height }
|
|
5714
|
-
}
|
|
5715
|
-
),
|
|
5716
|
-
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
6135
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
5717
6136
|
] });
|
|
6137
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6138
|
+
"div",
|
|
6139
|
+
{
|
|
6140
|
+
className: fieldWrapperClass(fieldDef, wrapperClass),
|
|
6141
|
+
"aria-hidden": "true",
|
|
6142
|
+
children: [
|
|
6143
|
+
theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef, labelClass), children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: labelContent }),
|
|
6144
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6145
|
+
Textarea,
|
|
6146
|
+
{
|
|
6147
|
+
id: fieldId,
|
|
6148
|
+
value: value ?? "",
|
|
6149
|
+
onChange: (e) => setValue(e.target.value),
|
|
6150
|
+
onBlur: setTouched,
|
|
6151
|
+
disabled,
|
|
6152
|
+
className: fieldControlClass(fieldDef, inputClass),
|
|
6153
|
+
...height != null && { height }
|
|
6154
|
+
}
|
|
6155
|
+
),
|
|
6156
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
6157
|
+
]
|
|
6158
|
+
}
|
|
6159
|
+
);
|
|
5718
6160
|
};
|
|
5719
6161
|
function normalizeOptions(response) {
|
|
5720
6162
|
if (Array.isArray(response)) {
|
|
@@ -5799,10 +6241,10 @@ var ReferralWidget = ({ fieldId }) => {
|
|
|
5799
6241
|
[selectedItems, setValue, setTouched]
|
|
5800
6242
|
);
|
|
5801
6243
|
if (!fieldDef) return null;
|
|
5802
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
5803
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: fieldId, children: [
|
|
6244
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
6245
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
5804
6246
|
"Referral to ",
|
|
5805
|
-
|
|
6247
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
5806
6248
|
] }),
|
|
5807
6249
|
loading && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "Loading..." }),
|
|
5808
6250
|
!loading && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -5817,7 +6259,14 @@ var ReferralWidget = ({ fieldId }) => {
|
|
|
5817
6259
|
}
|
|
5818
6260
|
},
|
|
5819
6261
|
children: [
|
|
5820
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6262
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6263
|
+
SelectTrigger,
|
|
6264
|
+
{
|
|
6265
|
+
id: fieldId,
|
|
6266
|
+
className: fieldControlClass(fieldDef, showError ? "border-red-500" : ""),
|
|
6267
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select specializations..." })
|
|
6268
|
+
}
|
|
6269
|
+
),
|
|
5821
6270
|
/* @__PURE__ */ jsxRuntime.jsxs(SelectContent, { children: [
|
|
5822
6271
|
availableOptions.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value)),
|
|
5823
6272
|
availableOptions.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-2 px-2 text-sm text-muted-foreground", children: "All specializations selected" })
|
|
@@ -5861,7 +6310,7 @@ var ReferralWidget = ({ fieldId }) => {
|
|
|
5861
6310
|
selectedItems.length === 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1", children: "No specializations selected" }),
|
|
5862
6311
|
selectedItems.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground mt-1.5", children: "Click a chip to mark as urgent" })
|
|
5863
6312
|
] }),
|
|
5864
|
-
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
6313
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
5865
6314
|
] });
|
|
5866
6315
|
};
|
|
5867
6316
|
var Card = React15__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -6360,29 +6809,41 @@ var SmartTextareaWidget = ({ fieldId }) => {
|
|
|
6360
6809
|
const wrapperClass = theme?.wrapperClassName ?? "space-y-2";
|
|
6361
6810
|
const labelClass = theme?.labelClassName;
|
|
6362
6811
|
const inputClass = cn(theme?.inputClassName, showError && "border-red-500");
|
|
6812
|
+
const showLabel = isLabelVisible(def);
|
|
6363
6813
|
const labelContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6364
6814
|
def.label,
|
|
6365
6815
|
" ",
|
|
6366
|
-
|
|
6816
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef: def }),
|
|
6367
6817
|
isProcessing && /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "inline-block ml-1.5 h-3 w-3 animate-spin text-muted-foreground" })
|
|
6368
6818
|
] });
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6819
|
+
const labelEl = showLabel ? theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(def, labelClass), children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(def), children: labelContent }) : null;
|
|
6820
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
6821
|
+
"div",
|
|
6822
|
+
{
|
|
6823
|
+
className: fieldWrapperClass(
|
|
6824
|
+
def,
|
|
6825
|
+
wrapperClass
|
|
6826
|
+
),
|
|
6827
|
+
children: [
|
|
6828
|
+
labelEl,
|
|
6829
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6830
|
+
Textarea,
|
|
6831
|
+
{
|
|
6832
|
+
id: fieldId,
|
|
6833
|
+
value: textValue,
|
|
6834
|
+
onChange: handleTextChange,
|
|
6835
|
+
onBlur: setTouched,
|
|
6836
|
+
disabled,
|
|
6837
|
+
placeholder: def.placeholder,
|
|
6838
|
+
className: fieldControlClass(def, inputClass),
|
|
6839
|
+
"aria-label": !showLabel ? def.label : void 0,
|
|
6840
|
+
...height != null ? { height } : {}
|
|
6841
|
+
}
|
|
6842
|
+
),
|
|
6843
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(def, "text-xs text-red-500"), children: error })
|
|
6844
|
+
]
|
|
6845
|
+
}
|
|
6846
|
+
);
|
|
6386
6847
|
};
|
|
6387
6848
|
function normalizeDiagnosisGrades(payload) {
|
|
6388
6849
|
const result = [];
|
|
@@ -6502,10 +6963,11 @@ var DiagnosisTextareaWidget = ({ fieldId }) => {
|
|
|
6502
6963
|
const labelContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6503
6964
|
def.label,
|
|
6504
6965
|
" ",
|
|
6505
|
-
|
|
6966
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef: def })
|
|
6506
6967
|
] });
|
|
6507
|
-
|
|
6508
|
-
|
|
6968
|
+
const showLabel = isLabelVisible(def);
|
|
6969
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(def, wrapperClass), children: [
|
|
6970
|
+
showLabel ? theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(def, labelClass), children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(def), children: labelContent }) : null,
|
|
6509
6971
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6510
6972
|
Textarea,
|
|
6511
6973
|
{
|
|
@@ -6515,7 +6977,8 @@ var DiagnosisTextareaWidget = ({ fieldId }) => {
|
|
|
6515
6977
|
onBlur: setTouched,
|
|
6516
6978
|
disabled,
|
|
6517
6979
|
placeholder: def.placeholder,
|
|
6518
|
-
className: inputClass,
|
|
6980
|
+
className: fieldControlClass(def, inputClass),
|
|
6981
|
+
"aria-label": !showLabel ? def.label : void 0,
|
|
6519
6982
|
...def.height != null ? { height: def.height } : {}
|
|
6520
6983
|
}
|
|
6521
6984
|
),
|
|
@@ -6549,7 +7012,7 @@ var DiagnosisTextareaWidget = ({ fieldId }) => {
|
|
|
6549
7012
|
] }, group.condition))
|
|
6550
7013
|
}
|
|
6551
7014
|
),
|
|
6552
|
-
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
7015
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(def, "text-xs text-red-500"), children: error })
|
|
6553
7016
|
] });
|
|
6554
7017
|
};
|
|
6555
7018
|
var Switch = React15__namespace.forwardRef(
|
|
@@ -9869,7 +10332,7 @@ var OrthopedicExamWidget = ({ fieldId }) => {
|
|
|
9869
10332
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `space-y-4 relative ${disabled ? "opacity-60 pointer-events-none" : ""}`, children: [
|
|
9870
10333
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsxRuntime.jsxs(Label, { className: "text-sm font-medium", children: [
|
|
9871
10334
|
fieldDef.label,
|
|
9872
|
-
|
|
10335
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
9873
10336
|
] }) }),
|
|
9874
10337
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
9875
10338
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-xs font-semibold text-muted-foreground", children: "Concern" }),
|
|
@@ -10060,26 +10523,30 @@ var MarMedicationOrdersWidget = ({ fieldId }) => {
|
|
|
10060
10523
|
const theme = getThemeConfig("textarea", fieldDef.theme);
|
|
10061
10524
|
const wrapperClass = theme?.wrapperClassName ?? "space-y-2";
|
|
10062
10525
|
const labelClass = theme?.labelClassName;
|
|
10526
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
10063
10527
|
const labelContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10064
10528
|
fieldDef.label,
|
|
10065
10529
|
" ",
|
|
10066
|
-
|
|
10530
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
10067
10531
|
] });
|
|
10068
|
-
const labelEl = theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, className: labelClass, children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, children: labelContent });
|
|
10532
|
+
const labelEl = showLabel ? theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef, labelClass), children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: labelContent }) : null;
|
|
10069
10533
|
const text = typeof value === "string" ? value : value == null ? "" : String(value);
|
|
10070
10534
|
const hasHandler = typeof handlers.onOpenMedicationOrders === "function";
|
|
10071
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: wrapperClass, children: [
|
|
10535
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(fieldDef, wrapperClass), children: [
|
|
10072
10536
|
labelEl,
|
|
10073
|
-
fieldDef.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: fieldDef.description }),
|
|
10537
|
+
fieldDef.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldDescriptionClass(fieldDef, "text-sm text-muted-foreground"), children: fieldDef.description }),
|
|
10074
10538
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between sm:gap-3", children: [
|
|
10075
10539
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10076
10540
|
"div",
|
|
10077
10541
|
{
|
|
10078
10542
|
id: fieldId,
|
|
10079
|
-
className:
|
|
10080
|
-
|
|
10081
|
-
|
|
10082
|
-
|
|
10543
|
+
className: fieldControlClass(
|
|
10544
|
+
fieldDef,
|
|
10545
|
+
cn(
|
|
10546
|
+
"min-h-[80px] flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm whitespace-pre-wrap",
|
|
10547
|
+
showError && "border-red-500",
|
|
10548
|
+
!text && "text-muted-foreground"
|
|
10549
|
+
)
|
|
10083
10550
|
),
|
|
10084
10551
|
style: height != null ? { minHeight: height } : void 0,
|
|
10085
10552
|
"aria-readonly": "true",
|
|
@@ -10098,7 +10565,7 @@ var MarMedicationOrdersWidget = ({ fieldId }) => {
|
|
|
10098
10565
|
}
|
|
10099
10566
|
)
|
|
10100
10567
|
] }),
|
|
10101
|
-
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
10568
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
10102
10569
|
] });
|
|
10103
10570
|
};
|
|
10104
10571
|
function parseFieldValue(value) {
|
|
@@ -10178,22 +10645,25 @@ var DischargeMedicationOrdersWidget = ({ fieldId }) => {
|
|
|
10178
10645
|
[orders, display_lines, setTouched, setValue]
|
|
10179
10646
|
);
|
|
10180
10647
|
if (!visible || !fieldDef) return null;
|
|
10181
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
10648
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
10182
10649
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
10183
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Label, { className: "text-sm font-medium", children: [
|
|
10650
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Label, { className: fieldLabelClass(fieldDef, "text-sm font-medium"), children: [
|
|
10184
10651
|
fieldDef.label,
|
|
10185
10652
|
" ",
|
|
10186
|
-
|
|
10653
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
10187
10654
|
] }),
|
|
10188
10655
|
/* @__PURE__ */ jsxRuntime.jsx(Button, { type: "button", onClick: onAdd, disabled: disabled || !handlers.onOpenDischargeMedicationOrders, children: "Add medicine" })
|
|
10189
10656
|
] }),
|
|
10190
|
-
fieldDef.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: fieldDef.description }),
|
|
10657
|
+
fieldDef.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldDescriptionClass(fieldDef, "text-sm text-muted-foreground"), children: fieldDef.description }),
|
|
10191
10658
|
orders.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
10192
10659
|
"div",
|
|
10193
10660
|
{
|
|
10194
|
-
className:
|
|
10195
|
-
|
|
10196
|
-
|
|
10661
|
+
className: fieldControlClass(
|
|
10662
|
+
fieldDef,
|
|
10663
|
+
cn(
|
|
10664
|
+
"rounded-md border border-input bg-background px-3 py-3 text-sm text-muted-foreground",
|
|
10665
|
+
showError && "border-red-500"
|
|
10666
|
+
)
|
|
10197
10667
|
),
|
|
10198
10668
|
children: "No medicines added."
|
|
10199
10669
|
}
|
|
@@ -10242,7 +10712,7 @@ var DischargeMedicationOrdersWidget = ({ fieldId }) => {
|
|
|
10242
10712
|
] })
|
|
10243
10713
|
] }, o.id);
|
|
10244
10714
|
}) }),
|
|
10245
|
-
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
10715
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
10246
10716
|
] });
|
|
10247
10717
|
};
|
|
10248
10718
|
var DEFAULT_TOKEN_SEPARATOR2 = ", ";
|
|
@@ -10344,13 +10814,15 @@ var SuggestionTextareaWidget = ({ fieldId }) => {
|
|
|
10344
10814
|
const wrapperClass = theme?.wrapperClassName ?? "space-y-2";
|
|
10345
10815
|
const labelClass = theme?.labelClassName;
|
|
10346
10816
|
const inputClass = cn(theme?.inputClassName, showError && "border-red-500");
|
|
10817
|
+
const inputWithStyle = fieldControlClass(def, inputClass);
|
|
10347
10818
|
const height = def.height != null ? typeof def.height === "string" ? Number(def.height) || void 0 : def.height : void 0;
|
|
10348
10819
|
const labelContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10349
10820
|
def.label,
|
|
10350
10821
|
" ",
|
|
10351
|
-
|
|
10822
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef: def })
|
|
10352
10823
|
] });
|
|
10353
|
-
const
|
|
10824
|
+
const showLabel = isLabelVisible(def);
|
|
10825
|
+
const labelEl = showLabel ? theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { className: fieldLabelClass(def, labelClass), children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { className: fieldLabelClass(def), children: labelContent }) : null;
|
|
10354
10826
|
const onChipClick = (optValue) => {
|
|
10355
10827
|
if (disabled) return;
|
|
10356
10828
|
setValue(toggleSuggestionTokenInText(textValue, String(optValue), appendSeparator, chipAllowedSet));
|
|
@@ -10374,7 +10846,7 @@ var SuggestionTextareaWidget = ({ fieldId }) => {
|
|
|
10374
10846
|
disabled && "pointer-events-none opacity-50"
|
|
10375
10847
|
);
|
|
10376
10848
|
const textareaShellClass = cn(
|
|
10377
|
-
|
|
10849
|
+
inputWithStyle,
|
|
10378
10850
|
hasShell && cn(
|
|
10379
10851
|
"mt-0 rounded-t-none rounded-b-md border-0 shadow-none focus-visible:ring-offset-0",
|
|
10380
10852
|
isHighlightLabel ? "border-t-0" : "min-h-[80px]"
|
|
@@ -10396,12 +10868,12 @@ var SuggestionTextareaWidget = ({ fieldId }) => {
|
|
|
10396
10868
|
String(opt.value)
|
|
10397
10869
|
);
|
|
10398
10870
|
});
|
|
10399
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: wrapperClass, children: [
|
|
10871
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(def, wrapperClass), children: [
|
|
10400
10872
|
hasVoice ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
10401
10873
|
labelEl,
|
|
10402
10874
|
/* @__PURE__ */ jsxRuntime.jsx(VoiceMicButton, { fieldId, onTranscriptReady: setValue })
|
|
10403
10875
|
] }) : labelEl,
|
|
10404
|
-
def.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: def.description }),
|
|
10876
|
+
def.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldDescriptionClass(def, "text-xs text-muted-foreground"), children: def.description }),
|
|
10405
10877
|
hasShell ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: suggestionShellClass, children: [
|
|
10406
10878
|
hasSuggestions && /* @__PURE__ */ jsxRuntime.jsx("div", { className: chipsRowClass, role: "group", "aria-label": suggestionsAria, children: suggestionButtons }),
|
|
10407
10879
|
hasEmbedded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: embeddedRowClass, children: embeddedFieldIds.map((id) => /* @__PURE__ */ jsxRuntime.jsx(EmbeddedSchemaField, { fieldId: id }, id)) }),
|
|
@@ -10415,7 +10887,8 @@ var SuggestionTextareaWidget = ({ fieldId }) => {
|
|
|
10415
10887
|
disabled,
|
|
10416
10888
|
className: textareaShellClass,
|
|
10417
10889
|
placeholder: def.placeholder,
|
|
10418
|
-
style: height != null && Number.isFinite(height) ? { minHeight: height } : void 0
|
|
10890
|
+
style: height != null && Number.isFinite(height) ? { minHeight: height } : void 0,
|
|
10891
|
+
"aria-label": !showLabel ? def.label : void 0
|
|
10419
10892
|
}
|
|
10420
10893
|
)
|
|
10421
10894
|
] }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -10426,12 +10899,13 @@ var SuggestionTextareaWidget = ({ fieldId }) => {
|
|
|
10426
10899
|
onChange: (e) => setValue(e.target.value),
|
|
10427
10900
|
onBlur: setTouched,
|
|
10428
10901
|
disabled,
|
|
10429
|
-
className:
|
|
10902
|
+
className: inputWithStyle,
|
|
10430
10903
|
placeholder: def.placeholder,
|
|
10431
|
-
style: height != null && Number.isFinite(height) ? { minHeight: height } : void 0
|
|
10904
|
+
style: height != null && Number.isFinite(height) ? { minHeight: height } : void 0,
|
|
10905
|
+
"aria-label": !showLabel ? def.label : void 0
|
|
10432
10906
|
}
|
|
10433
10907
|
),
|
|
10434
|
-
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
10908
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(def, "text-xs text-red-500"), children: error })
|
|
10435
10909
|
] });
|
|
10436
10910
|
};
|
|
10437
10911
|
var EMPTY_GRADES = { NO: 0, NC: 0, C: 0, PSC: 0 };
|
|
@@ -11198,23 +11672,27 @@ var SliderWidget = ({ fieldId }) => {
|
|
|
11198
11672
|
const theme = getThemeConfig("textarea", def.theme);
|
|
11199
11673
|
const wrapperClass = theme?.wrapperClassName ?? "space-y-2";
|
|
11200
11674
|
const labelClass = theme?.labelClassName;
|
|
11675
|
+
const showLabel = isLabelVisible(def);
|
|
11201
11676
|
const labelContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11202
11677
|
def.label,
|
|
11203
11678
|
" ",
|
|
11204
|
-
|
|
11679
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef: def }),
|
|
11205
11680
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-2 text-muted-foreground font-normal tabular-nums", children: [
|
|
11206
11681
|
num2,
|
|
11207
11682
|
"/",
|
|
11208
11683
|
max
|
|
11209
11684
|
] })
|
|
11210
11685
|
] });
|
|
11211
|
-
const labelEl = theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { children: labelContent });
|
|
11212
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: wrapperClass, children: [
|
|
11686
|
+
const labelEl = showLabel ? theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { className: fieldLabelClass(def, labelClass), children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { className: fieldLabelClass(def), children: labelContent }) : null;
|
|
11687
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(def, wrapperClass), children: [
|
|
11213
11688
|
labelEl,
|
|
11214
11689
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
11215
11690
|
Slider,
|
|
11216
11691
|
{
|
|
11217
|
-
className:
|
|
11692
|
+
className: fieldControlClass(
|
|
11693
|
+
def,
|
|
11694
|
+
cn("py-1", showError && "opacity-90 ring-1 ring-red-500 rounded")
|
|
11695
|
+
),
|
|
11218
11696
|
disabled,
|
|
11219
11697
|
min,
|
|
11220
11698
|
max,
|
|
@@ -11224,10 +11702,11 @@ var SliderWidget = ({ fieldId }) => {
|
|
|
11224
11702
|
const n = v[0] ?? min;
|
|
11225
11703
|
setValue(n);
|
|
11226
11704
|
setTouched();
|
|
11227
|
-
}
|
|
11705
|
+
},
|
|
11706
|
+
"aria-label": !showLabel ? `${def.label} ${num2}/${max}` : void 0
|
|
11228
11707
|
}
|
|
11229
11708
|
),
|
|
11230
|
-
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
11709
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(def, "text-xs text-red-500"), children: error })
|
|
11231
11710
|
] });
|
|
11232
11711
|
};
|
|
11233
11712
|
var CHIEF_CHIPS_FIELD = "chief_complaints_chips";
|
|
@@ -11340,7 +11819,7 @@ var GsSmartHistoryWidget = ({ fieldId }) => {
|
|
|
11340
11819
|
const labelClass = theme?.labelClassName;
|
|
11341
11820
|
const labelContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11342
11821
|
fieldDef.label,
|
|
11343
|
-
|
|
11822
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
11344
11823
|
] });
|
|
11345
11824
|
const labelEl = theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-medium", children: labelContent });
|
|
11346
11825
|
const bodyClass = cn(
|
|
@@ -11743,7 +12222,7 @@ var GsExaminationWidget = ({ fieldId }) => {
|
|
|
11743
12222
|
const labelClass = theme?.labelClassName;
|
|
11744
12223
|
const labelContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11745
12224
|
fieldDef.label,
|
|
11746
|
-
|
|
12225
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
11747
12226
|
] });
|
|
11748
12227
|
const labelEl = theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-medium", children: labelContent });
|
|
11749
12228
|
const bodyClass = cn(
|
|
@@ -12154,7 +12633,7 @@ var GsGradingWidget = ({ fieldId }) => {
|
|
|
12154
12633
|
const labelClass = theme?.labelClassName;
|
|
12155
12634
|
const labelContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
12156
12635
|
fieldDef.label,
|
|
12157
|
-
|
|
12636
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
12158
12637
|
] });
|
|
12159
12638
|
const labelEl = theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-medium", children: labelContent });
|
|
12160
12639
|
const bodyClass = cn(
|
|
@@ -12213,6 +12692,7 @@ var PainScaleFlagsWidget = ({ fieldId }) => {
|
|
|
12213
12692
|
const theme = getThemeConfig("textarea", def.theme);
|
|
12214
12693
|
const wrapperClass = theme?.wrapperClassName ?? "space-y-2";
|
|
12215
12694
|
const labelClass = theme?.labelClassName;
|
|
12695
|
+
const showLabel = isLabelVisible(def);
|
|
12216
12696
|
const update = (next) => {
|
|
12217
12697
|
setValue(normalizePainScaleFlags(next, { min, max }));
|
|
12218
12698
|
setTouched();
|
|
@@ -12228,16 +12708,16 @@ var PainScaleFlagsWidget = ({ fieldId }) => {
|
|
|
12228
12708
|
const labelContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
12229
12709
|
def.label,
|
|
12230
12710
|
" ",
|
|
12231
|
-
|
|
12711
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef: def })
|
|
12232
12712
|
] });
|
|
12233
|
-
const labelEl = theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { children: labelContent });
|
|
12713
|
+
const labelEl = showLabel ? theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { className: fieldLabelClass(def, labelClass), children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { className: fieldLabelClass(def), children: labelContent }) : null;
|
|
12234
12714
|
const bodyClass = cn(
|
|
12235
12715
|
"-mt-1 flex min-w-0 flex-col border-t border-[#D0D0D0] bg-white px-3 py-3",
|
|
12236
12716
|
disabled && "pointer-events-none opacity-60"
|
|
12237
12717
|
);
|
|
12238
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn(wrapperClass, "h-full min-h-0 flex flex-col"), children: [
|
|
12718
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(def, cn(wrapperClass, "h-full min-h-0 flex flex-col")), children: [
|
|
12239
12719
|
labelEl,
|
|
12240
|
-
def.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: def.description }),
|
|
12720
|
+
def.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldDescriptionClass(def, "text-xs text-muted-foreground"), children: def.description }),
|
|
12241
12721
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cn(bodyClass, "min-h-0 flex-1"), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 space-y-3", children: [
|
|
12242
12722
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
12243
12723
|
/* @__PURE__ */ jsxRuntime.jsxs(Label, { className: "text-sm font-medium text-slate-700", children: [
|
|
@@ -12323,7 +12803,7 @@ var PainScaleFlagsWidget = ({ fieldId }) => {
|
|
|
12323
12803
|
] }) : null
|
|
12324
12804
|
] }) : null
|
|
12325
12805
|
] }) }),
|
|
12326
|
-
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
12806
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(def, "text-xs text-red-500"), children: error })
|
|
12327
12807
|
] });
|
|
12328
12808
|
};
|
|
12329
12809
|
var CHIEF_CHIPS_FIELD3 = "chief_complaints_chips";
|
|
@@ -12478,7 +12958,7 @@ var UrologySmartHistoryWidget = ({ fieldId }) => {
|
|
|
12478
12958
|
const labelClass = theme?.labelClassName;
|
|
12479
12959
|
const labelContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
12480
12960
|
fieldDef.label,
|
|
12481
|
-
|
|
12961
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
12482
12962
|
] });
|
|
12483
12963
|
const labelEl = theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-medium", children: labelContent });
|
|
12484
12964
|
const bodyClass = cn(
|
|
@@ -12841,7 +13321,7 @@ var UrologyExaminationWidget = ({ fieldId }) => {
|
|
|
12841
13321
|
const labelClass = theme?.labelClassName;
|
|
12842
13322
|
const labelContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
12843
13323
|
fieldDef.label,
|
|
12844
|
-
|
|
13324
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
12845
13325
|
] });
|
|
12846
13326
|
const labelEl = theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-medium", children: labelContent });
|
|
12847
13327
|
const bodyClass = cn(
|
|
@@ -13067,7 +13547,7 @@ var UrologyPathwayWidget = ({ fieldId }) => {
|
|
|
13067
13547
|
const subtitle = fieldDef.meta && typeof fieldDef.meta === "object" && fieldDef.meta !== null ? String(fieldDef.meta.subtitle ?? "") : "";
|
|
13068
13548
|
const labelContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
13069
13549
|
fieldDef.label,
|
|
13070
|
-
|
|
13550
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
13071
13551
|
] });
|
|
13072
13552
|
const labelEl = theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-medium", children: labelContent });
|
|
13073
13553
|
const bodyClass = cn(
|
|
@@ -13262,7 +13742,7 @@ var OBGExaminationWidget = ({ fieldId }) => {
|
|
|
13262
13742
|
const labelClass = theme?.labelClassName;
|
|
13263
13743
|
const labelContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
13264
13744
|
fieldDef.label,
|
|
13265
|
-
|
|
13745
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
13266
13746
|
] });
|
|
13267
13747
|
const labelEl = theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-medium", children: labelContent });
|
|
13268
13748
|
const bodyClass = cn(
|
|
@@ -13395,7 +13875,7 @@ var OBGPathwayWidget = ({ fieldId }) => {
|
|
|
13395
13875
|
const labelClass = theme?.labelClassName;
|
|
13396
13876
|
const labelContent = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
13397
13877
|
fieldDef.label,
|
|
13398
|
-
|
|
13878
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
13399
13879
|
] });
|
|
13400
13880
|
const labelEl = theme ? /* @__PURE__ */ jsxRuntime.jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-medium", children: labelContent });
|
|
13401
13881
|
const bodyClass = cn(
|
|
@@ -13883,6 +14363,7 @@ var PhoneInputWidget = ({ fieldId }) => {
|
|
|
13883
14363
|
return () => clearTimeout(t);
|
|
13884
14364
|
}, [resendCooldown]);
|
|
13885
14365
|
if (!fieldDef) return null;
|
|
14366
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
13886
14367
|
const placeholder = typeof fieldDef.placeholder === "string" && fieldDef.placeholder.trim() ? fieldDef.placeholder : "Enter 10-digit mobile number";
|
|
13887
14368
|
const handleChange = (e) => {
|
|
13888
14369
|
const digits = e.target.value.replace(/\D/g, "").slice(0, 10);
|
|
@@ -13964,12 +14445,12 @@ var PhoneInputWidget = ({ fieldId }) => {
|
|
|
13964
14445
|
isResendingRef.current = false;
|
|
13965
14446
|
}
|
|
13966
14447
|
};
|
|
13967
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
13968
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: fieldId, children: [
|
|
14448
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
14449
|
+
showLabel ? /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
13969
14450
|
fieldDef.label,
|
|
13970
14451
|
" ",
|
|
13971
|
-
|
|
13972
|
-
] }),
|
|
14452
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
14453
|
+
] }) : null,
|
|
13973
14454
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
13974
14455
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13975
14456
|
Input,
|
|
@@ -13983,11 +14464,15 @@ var PhoneInputWidget = ({ fieldId }) => {
|
|
|
13983
14464
|
disabled: disabled || status === "sending",
|
|
13984
14465
|
placeholder,
|
|
13985
14466
|
maxLength: 10,
|
|
13986
|
-
className:
|
|
13987
|
-
|
|
13988
|
-
|
|
13989
|
-
|
|
13990
|
-
|
|
14467
|
+
className: fieldControlClass(
|
|
14468
|
+
fieldDef,
|
|
14469
|
+
cn(
|
|
14470
|
+
showError && "border-red-500",
|
|
14471
|
+
status === "sent" && "border-green-500 pr-9",
|
|
14472
|
+
status === "sending" && "pr-9"
|
|
14473
|
+
)
|
|
14474
|
+
),
|
|
14475
|
+
"aria-label": !showLabel ? fieldDef.label : void 0
|
|
13991
14476
|
}
|
|
13992
14477
|
),
|
|
13993
14478
|
status === "sending" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-y-0 right-3 flex items-center pointer-events-none", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -14040,7 +14525,7 @@ var PhoneInputWidget = ({ fieldId }) => {
|
|
|
14040
14525
|
"OTP sent to +91",
|
|
14041
14526
|
rawPhone
|
|
14042
14527
|
] }),
|
|
14043
|
-
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error }),
|
|
14528
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error }),
|
|
14044
14529
|
status === "sent" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
|
|
14045
14530
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: "Didn't receive it?" }),
|
|
14046
14531
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -14073,6 +14558,7 @@ var OtpInputWidget = ({ fieldId }) => {
|
|
|
14073
14558
|
const isVerifyingRef = React15.useRef(false);
|
|
14074
14559
|
const showError = !!error && (touched || state.submitAttempted) && status !== "verifying" && status !== "verified";
|
|
14075
14560
|
if (!fieldDef) return null;
|
|
14561
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
14076
14562
|
const placeholder = typeof fieldDef.placeholder === "string" && fieldDef.placeholder.trim() ? fieldDef.placeholder : "Enter 4-digit OTP";
|
|
14077
14563
|
const handleChange = (e) => {
|
|
14078
14564
|
const digits = e.target.value.replace(/\D/g, "").slice(0, 4);
|
|
@@ -14126,12 +14612,12 @@ var OtpInputWidget = ({ fieldId }) => {
|
|
|
14126
14612
|
isVerifyingRef.current = false;
|
|
14127
14613
|
}
|
|
14128
14614
|
};
|
|
14129
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-2", children: [
|
|
14130
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: fieldId, children: [
|
|
14615
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(fieldDef, "space-y-2"), children: [
|
|
14616
|
+
showLabel ? /* @__PURE__ */ jsxRuntime.jsxs(Label, { htmlFor: fieldId, className: fieldLabelClass(fieldDef), children: [
|
|
14131
14617
|
fieldDef.label,
|
|
14132
14618
|
" ",
|
|
14133
|
-
|
|
14134
|
-
] }),
|
|
14619
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
14620
|
+
] }) : null,
|
|
14135
14621
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
|
|
14136
14622
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14137
14623
|
Input,
|
|
@@ -14145,12 +14631,16 @@ var OtpInputWidget = ({ fieldId }) => {
|
|
|
14145
14631
|
disabled: disabled || status === "verifying" || status === "verified",
|
|
14146
14632
|
placeholder,
|
|
14147
14633
|
maxLength: 4,
|
|
14148
|
-
className:
|
|
14149
|
-
|
|
14150
|
-
|
|
14151
|
-
|
|
14152
|
-
|
|
14153
|
-
|
|
14634
|
+
className: fieldControlClass(
|
|
14635
|
+
fieldDef,
|
|
14636
|
+
cn(
|
|
14637
|
+
"tracking-widest text-center text-lg",
|
|
14638
|
+
showError && "border-red-500",
|
|
14639
|
+
status === "verified" && "border-green-500 pr-9",
|
|
14640
|
+
status === "verifying" && "pr-9"
|
|
14641
|
+
)
|
|
14642
|
+
),
|
|
14643
|
+
"aria-label": !showLabel ? fieldDef.label : void 0
|
|
14154
14644
|
}
|
|
14155
14645
|
),
|
|
14156
14646
|
status === "verifying" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-y-0 right-3 flex items-center pointer-events-none", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -14200,7 +14690,7 @@ var OtpInputWidget = ({ fieldId }) => {
|
|
|
14200
14690
|
) })
|
|
14201
14691
|
] }),
|
|
14202
14692
|
status === "verified" && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-green-600", children: "Mobile number verified successfully" }),
|
|
14203
|
-
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
14693
|
+
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
|
|
14204
14694
|
] });
|
|
14205
14695
|
};
|
|
14206
14696
|
var FieldRenderer = ({ fieldId }) => {
|
|
@@ -14242,6 +14732,8 @@ function renderWidget(fieldId, fieldDef) {
|
|
|
14242
14732
|
return /* @__PURE__ */ jsxRuntime.jsx(ImageUploadWidget, { fieldId });
|
|
14243
14733
|
case "media_upload":
|
|
14244
14734
|
return /* @__PURE__ */ jsxRuntime.jsx(MediaUploadWidget, { fieldId });
|
|
14735
|
+
case "file_upload":
|
|
14736
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FormFileUploadWidget, { fieldId });
|
|
14245
14737
|
case "signature":
|
|
14246
14738
|
return /* @__PURE__ */ jsxRuntime.jsx(SignatureUploadWidget, { fieldId });
|
|
14247
14739
|
case "editable_table":
|
|
@@ -14302,7 +14794,8 @@ function renderWidget(fieldId, fieldDef) {
|
|
|
14302
14794
|
const { value, setValue, setTouched, disabled } = useField(fieldId);
|
|
14303
14795
|
const store = useFormStore();
|
|
14304
14796
|
const excludes = fieldDef.excludes ?? [];
|
|
14305
|
-
|
|
14797
|
+
const showLabel = isLabelVisible(fieldDef);
|
|
14798
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: fieldWrapperClass(fieldDef, "flex items-center gap-3"), children: [
|
|
14306
14799
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14307
14800
|
Switch,
|
|
14308
14801
|
{
|
|
@@ -14315,7 +14808,20 @@ function renderWidget(fieldId, fieldDef) {
|
|
|
14315
14808
|
}
|
|
14316
14809
|
}
|
|
14317
14810
|
),
|
|
14318
|
-
/* @__PURE__ */ jsxRuntime.
|
|
14811
|
+
showLabel ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
14812
|
+
Label,
|
|
14813
|
+
{
|
|
14814
|
+
className: fieldLabelClass(
|
|
14815
|
+
fieldDef,
|
|
14816
|
+
"text-sm font-medium leading-none cursor-pointer select-none"
|
|
14817
|
+
),
|
|
14818
|
+
children: [
|
|
14819
|
+
fieldDef.label,
|
|
14820
|
+
" ",
|
|
14821
|
+
/* @__PURE__ */ jsxRuntime.jsx(FieldRequiredIndicator, { fieldDef })
|
|
14822
|
+
]
|
|
14823
|
+
}
|
|
14824
|
+
) : null
|
|
14319
14825
|
] });
|
|
14320
14826
|
}
|
|
14321
14827
|
case "suggestion_textarea":
|
|
@@ -14334,10 +14840,19 @@ function renderWidget(fieldId, fieldDef) {
|
|
|
14334
14840
|
const size = def.size ?? "regular";
|
|
14335
14841
|
const labelClass = size === "large" ? "text-base" : "text-sm";
|
|
14336
14842
|
const descClass = size === "large" ? "text-sm" : "text-xs";
|
|
14337
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
14338
|
-
|
|
14339
|
-
|
|
14340
|
-
|
|
14843
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
14844
|
+
"div",
|
|
14845
|
+
{
|
|
14846
|
+
className: fieldWrapperClass(
|
|
14847
|
+
def,
|
|
14848
|
+
cn(labelClass, "text-muted-foreground")
|
|
14849
|
+
),
|
|
14850
|
+
children: [
|
|
14851
|
+
def.label,
|
|
14852
|
+
def.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: fieldDescriptionClass(def, cn("mt-1", descClass, "opacity-90")), children: def.description })
|
|
14853
|
+
]
|
|
14854
|
+
}
|
|
14855
|
+
);
|
|
14341
14856
|
}
|
|
14342
14857
|
default:
|
|
14343
14858
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-red-500", children: [
|
|
@@ -15340,6 +15855,8 @@ var ReadOnlyFieldRenderer = ({
|
|
|
15340
15855
|
return /* @__PURE__ */ jsxRuntime.jsx(ReadOnlyImageUpload, { fieldDef, value });
|
|
15341
15856
|
case "media_upload":
|
|
15342
15857
|
return /* @__PURE__ */ jsxRuntime.jsx(ReadOnlyMediaUpload, { fieldDef, value });
|
|
15858
|
+
case "file_upload":
|
|
15859
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ReadOnlyMediaUpload, { fieldDef, value });
|
|
15343
15860
|
case "signature":
|
|
15344
15861
|
return /* @__PURE__ */ jsxRuntime.jsx(ReadOnlySignature, { fieldDef, value });
|
|
15345
15862
|
case "editable_table":
|
|
@@ -15841,7 +16358,9 @@ exports.DynamicForm = DynamicForm;
|
|
|
15841
16358
|
exports.DynamicFormV2 = DynamicFormV2;
|
|
15842
16359
|
exports.EMAIL_REGEX = EMAIL_REGEX;
|
|
15843
16360
|
exports.FieldRenderer = FieldRenderer;
|
|
16361
|
+
exports.FieldRequiredIndicator = FieldRequiredIndicator;
|
|
15844
16362
|
exports.FormControls = FormControls;
|
|
16363
|
+
exports.FormFileUploadWidget = FormFileUploadWidget;
|
|
15845
16364
|
exports.FormProvider = FormProvider;
|
|
15846
16365
|
exports.FormStore = FormStore;
|
|
15847
16366
|
exports.ImageUploadWidget = ImageUploadWidget;
|
|
@@ -15857,9 +16376,16 @@ exports.RichTextWidget = RichTextWidget;
|
|
|
15857
16376
|
exports.SignatureUploadWidget = SignatureUploadWidget;
|
|
15858
16377
|
exports.SmartForm = SmartForm;
|
|
15859
16378
|
exports.SmartTextareaWidget = SmartTextareaWidget;
|
|
16379
|
+
exports.Upload = Upload3;
|
|
15860
16380
|
exports.createUploadHandler = createUploadHandler;
|
|
15861
16381
|
exports.evaluateRules = evaluateRules;
|
|
16382
|
+
exports.fieldControlClass = fieldControlClass;
|
|
16383
|
+
exports.fieldDescriptionClass = fieldDescriptionClass;
|
|
16384
|
+
exports.fieldErrorClass = fieldErrorClass;
|
|
16385
|
+
exports.fieldLabelClass = fieldLabelClass;
|
|
15862
16386
|
exports.fieldMetaRequestsMarMedicationOrdersButton = fieldMetaRequestsMarMedicationOrdersButton;
|
|
16387
|
+
exports.fieldWrapperClass = fieldWrapperClass;
|
|
16388
|
+
exports.isLabelVisible = isLabelVisible;
|
|
15863
16389
|
exports.useField = useField;
|
|
15864
16390
|
exports.useFieldHandlers = useFieldHandlers;
|
|
15865
16391
|
exports.useForm = useForm;
|