formanitor 0.0.35 → 0.0.36
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 +61 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.mjs +61 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -5348,6 +5348,40 @@ var DiagnosisTextareaWidget = ({ fieldId }) => {
|
|
|
5348
5348
|
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
5349
5349
|
] });
|
|
5350
5350
|
};
|
|
5351
|
+
var Switch = React15__namespace.forwardRef(
|
|
5352
|
+
({ className, checked, onCheckedChange, disabled, ...props }, ref) => {
|
|
5353
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5354
|
+
"button",
|
|
5355
|
+
{
|
|
5356
|
+
type: "button",
|
|
5357
|
+
role: "switch",
|
|
5358
|
+
"aria-checked": checked,
|
|
5359
|
+
"data-state": checked ? "checked" : "unchecked",
|
|
5360
|
+
disabled,
|
|
5361
|
+
ref,
|
|
5362
|
+
onClick: () => {
|
|
5363
|
+
if (!disabled && onCheckedChange) {
|
|
5364
|
+
onCheckedChange(!checked);
|
|
5365
|
+
}
|
|
5366
|
+
},
|
|
5367
|
+
className: cn(
|
|
5368
|
+
"peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
|
|
5369
|
+
className
|
|
5370
|
+
),
|
|
5371
|
+
...props,
|
|
5372
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5373
|
+
"span",
|
|
5374
|
+
{
|
|
5375
|
+
"data-state": checked ? "checked" : "unchecked",
|
|
5376
|
+
className: "pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform",
|
|
5377
|
+
style: { transform: checked ? "translateX(1rem)" : "translateX(0)" }
|
|
5378
|
+
}
|
|
5379
|
+
)
|
|
5380
|
+
}
|
|
5381
|
+
);
|
|
5382
|
+
}
|
|
5383
|
+
);
|
|
5384
|
+
Switch.displayName = "Switch";
|
|
5351
5385
|
var DEFAULT_DRAFT = {
|
|
5352
5386
|
gpal: { G: 0, P: 0, A: 0, L: 0 },
|
|
5353
5387
|
lmp: "",
|
|
@@ -7921,6 +7955,26 @@ function renderWidget(fieldId, fieldDef) {
|
|
|
7921
7955
|
return /* @__PURE__ */ jsxRuntime.jsx(OphthalDiagnosisWidget, { fieldId });
|
|
7922
7956
|
case "orthopedic_exam":
|
|
7923
7957
|
return /* @__PURE__ */ jsxRuntime.jsx(OrthopedicExamWidget, { fieldId });
|
|
7958
|
+
case "toggle": {
|
|
7959
|
+
const { value, setValue, setTouched, disabled } = useField(fieldId);
|
|
7960
|
+
const store = useFormStore();
|
|
7961
|
+
const excludes = fieldDef.excludes ?? [];
|
|
7962
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
7963
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7964
|
+
Switch,
|
|
7965
|
+
{
|
|
7966
|
+
checked: value === true,
|
|
7967
|
+
disabled,
|
|
7968
|
+
onCheckedChange: (checked) => {
|
|
7969
|
+
setValue(checked);
|
|
7970
|
+
setTouched();
|
|
7971
|
+
if (checked) excludes.forEach((id) => store.setValue(id, false));
|
|
7972
|
+
}
|
|
7973
|
+
}
|
|
7974
|
+
),
|
|
7975
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-medium leading-none cursor-pointer select-none", children: fieldDef.label })
|
|
7976
|
+
] });
|
|
7977
|
+
}
|
|
7924
7978
|
case "static_text": {
|
|
7925
7979
|
const def = fieldDef;
|
|
7926
7980
|
const size = def.size ?? "regular";
|
|
@@ -8614,6 +8668,13 @@ var ReadOnlyFieldRenderer = ({ fieldDef, value }) => {
|
|
|
8614
8668
|
return /* @__PURE__ */ jsxRuntime.jsx(ReadOnlyReferral, { fieldDef, value });
|
|
8615
8669
|
case "discharge_medication_orders":
|
|
8616
8670
|
return /* @__PURE__ */ jsxRuntime.jsx(ReadOnlyDischargeMedicationOrders, { fieldDef, value });
|
|
8671
|
+
case "toggle": {
|
|
8672
|
+
const isOn = value === true;
|
|
8673
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
|
|
8674
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: fieldDef.label }),
|
|
8675
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: `inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${isOn ? "bg-green-100 text-green-800" : "bg-gray-100 text-gray-600"}`, children: isOn ? "Yes" : "No" })
|
|
8676
|
+
] });
|
|
8677
|
+
}
|
|
8617
8678
|
case "static_text": {
|
|
8618
8679
|
const def = fieldDef;
|
|
8619
8680
|
const size = def.size ?? "regular";
|