formanitor 0.0.35 → 0.0.37
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 +90 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.mjs +90 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3158,6 +3158,19 @@ var BEFORE_AFTER_NORMALIZATION_MAP = {
|
|
|
3158
3158
|
AF: "AFTER FOOD",
|
|
3159
3159
|
BF: "BEFORE FOOD"
|
|
3160
3160
|
};
|
|
3161
|
+
var ROUTE_OPTIONS = [
|
|
3162
|
+
{ label: "Select route", value: "" },
|
|
3163
|
+
{ label: "Per Os", value: "Per Os" },
|
|
3164
|
+
{ label: "Intravenous", value: "Intravenous" },
|
|
3165
|
+
{ label: "Intramuscular", value: "Intramuscular" },
|
|
3166
|
+
{ label: "Subcutaneous", value: "Subcutaneous" },
|
|
3167
|
+
{ label: "Sublingual", value: "Sublingual" },
|
|
3168
|
+
{ label: "Intranasal", value: "Intranasal" },
|
|
3169
|
+
{ label: "Topical", value: "Topical" },
|
|
3170
|
+
{ label: "Per Rectum", value: "Per Rectum" },
|
|
3171
|
+
{ label: "Inhalation", value: "Inhalation" },
|
|
3172
|
+
{ label: "ID Intradermal", value: "ID Intradermal" }
|
|
3173
|
+
];
|
|
3161
3174
|
function mapToMedication(result) {
|
|
3162
3175
|
return {
|
|
3163
3176
|
id: result.id,
|
|
@@ -3168,6 +3181,7 @@ function mapToMedication(result) {
|
|
|
3168
3181
|
duration_value: "3",
|
|
3169
3182
|
duration_unit: "days",
|
|
3170
3183
|
before_after: "AFTER FOOD",
|
|
3184
|
+
route: "",
|
|
3171
3185
|
morning: "0",
|
|
3172
3186
|
afternoon: "0",
|
|
3173
3187
|
night: "0",
|
|
@@ -3185,6 +3199,7 @@ function mapAIMedicationToMedication(ai) {
|
|
|
3185
3199
|
duration_value: "3",
|
|
3186
3200
|
duration_unit: "days",
|
|
3187
3201
|
before_after: "AFTER FOOD",
|
|
3202
|
+
route: "",
|
|
3188
3203
|
morning: "1",
|
|
3189
3204
|
afternoon: "0",
|
|
3190
3205
|
night: "1",
|
|
@@ -3201,6 +3216,7 @@ function createCustomMedication(name, customId) {
|
|
|
3201
3216
|
duration_value: "3",
|
|
3202
3217
|
duration_unit: "days",
|
|
3203
3218
|
before_after: "AFTER FOOD",
|
|
3219
|
+
route: "",
|
|
3204
3220
|
morning: "0",
|
|
3205
3221
|
afternoon: "0",
|
|
3206
3222
|
night: "0",
|
|
@@ -3234,6 +3250,7 @@ function mapFrequentItemToMedication(item) {
|
|
|
3234
3250
|
duration_value,
|
|
3235
3251
|
duration_unit,
|
|
3236
3252
|
before_after,
|
|
3253
|
+
route: item.route ?? "",
|
|
3237
3254
|
morning: item.morning ?? "0",
|
|
3238
3255
|
afternoon: item.afternoon ?? "0",
|
|
3239
3256
|
night: item.night ?? "0",
|
|
@@ -3301,7 +3318,9 @@ function MedicationCard({
|
|
|
3301
3318
|
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "as_needed", children: "As needed" }),
|
|
3302
3319
|
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "fort_night", children: "Fort night" }),
|
|
3303
3320
|
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "at_bed_time", children: "At Bed time" }),
|
|
3304
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "sos", children: "SOS only" })
|
|
3321
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "sos", children: "SOS only" }),
|
|
3322
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "biweekly", children: "Biweekly" }),
|
|
3323
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "stat", children: "STAT" })
|
|
3305
3324
|
]
|
|
3306
3325
|
}
|
|
3307
3326
|
),
|
|
@@ -3362,6 +3381,15 @@ function MedicationCard({
|
|
|
3362
3381
|
onChange: (e) => set("before_after", e.target.value),
|
|
3363
3382
|
children: BEFORE_AFTER_OPTIONS.map((option) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: option.value, children: option.label }, option.label))
|
|
3364
3383
|
}
|
|
3384
|
+
),
|
|
3385
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3386
|
+
"select",
|
|
3387
|
+
{
|
|
3388
|
+
className: "text-xs border border-border rounded px-2 py-1 bg-white shrink-0",
|
|
3389
|
+
value: med.route ?? "",
|
|
3390
|
+
onChange: (e) => set("route", e.target.value),
|
|
3391
|
+
children: ROUTE_OPTIONS.map((option) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: option.value, children: option.label }, option.value))
|
|
3392
|
+
}
|
|
3365
3393
|
)
|
|
3366
3394
|
] }),
|
|
3367
3395
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -5348,6 +5376,40 @@ var DiagnosisTextareaWidget = ({ fieldId }) => {
|
|
|
5348
5376
|
showError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-500", children: error })
|
|
5349
5377
|
] });
|
|
5350
5378
|
};
|
|
5379
|
+
var Switch = React15__namespace.forwardRef(
|
|
5380
|
+
({ className, checked, onCheckedChange, disabled, ...props }, ref) => {
|
|
5381
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5382
|
+
"button",
|
|
5383
|
+
{
|
|
5384
|
+
type: "button",
|
|
5385
|
+
role: "switch",
|
|
5386
|
+
"aria-checked": checked,
|
|
5387
|
+
"data-state": checked ? "checked" : "unchecked",
|
|
5388
|
+
disabled,
|
|
5389
|
+
ref,
|
|
5390
|
+
onClick: () => {
|
|
5391
|
+
if (!disabled && onCheckedChange) {
|
|
5392
|
+
onCheckedChange(!checked);
|
|
5393
|
+
}
|
|
5394
|
+
},
|
|
5395
|
+
className: cn(
|
|
5396
|
+
"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",
|
|
5397
|
+
className
|
|
5398
|
+
),
|
|
5399
|
+
...props,
|
|
5400
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5401
|
+
"span",
|
|
5402
|
+
{
|
|
5403
|
+
"data-state": checked ? "checked" : "unchecked",
|
|
5404
|
+
className: "pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform",
|
|
5405
|
+
style: { transform: checked ? "translateX(1rem)" : "translateX(0)" }
|
|
5406
|
+
}
|
|
5407
|
+
)
|
|
5408
|
+
}
|
|
5409
|
+
);
|
|
5410
|
+
}
|
|
5411
|
+
);
|
|
5412
|
+
Switch.displayName = "Switch";
|
|
5351
5413
|
var DEFAULT_DRAFT = {
|
|
5352
5414
|
gpal: { G: 0, P: 0, A: 0, L: 0 },
|
|
5353
5415
|
lmp: "",
|
|
@@ -7921,6 +7983,26 @@ function renderWidget(fieldId, fieldDef) {
|
|
|
7921
7983
|
return /* @__PURE__ */ jsxRuntime.jsx(OphthalDiagnosisWidget, { fieldId });
|
|
7922
7984
|
case "orthopedic_exam":
|
|
7923
7985
|
return /* @__PURE__ */ jsxRuntime.jsx(OrthopedicExamWidget, { fieldId });
|
|
7986
|
+
case "toggle": {
|
|
7987
|
+
const { value, setValue, setTouched, disabled } = useField(fieldId);
|
|
7988
|
+
const store = useFormStore();
|
|
7989
|
+
const excludes = fieldDef.excludes ?? [];
|
|
7990
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
7991
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7992
|
+
Switch,
|
|
7993
|
+
{
|
|
7994
|
+
checked: value === true,
|
|
7995
|
+
disabled,
|
|
7996
|
+
onCheckedChange: (checked) => {
|
|
7997
|
+
setValue(checked);
|
|
7998
|
+
setTouched();
|
|
7999
|
+
if (checked) excludes.forEach((id) => store.setValue(id, false));
|
|
8000
|
+
}
|
|
8001
|
+
}
|
|
8002
|
+
),
|
|
8003
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { className: "text-sm font-medium leading-none cursor-pointer select-none", children: fieldDef.label })
|
|
8004
|
+
] });
|
|
8005
|
+
}
|
|
7924
8006
|
case "static_text": {
|
|
7925
8007
|
const def = fieldDef;
|
|
7926
8008
|
const size = def.size ?? "regular";
|
|
@@ -8614,6 +8696,13 @@ var ReadOnlyFieldRenderer = ({ fieldDef, value }) => {
|
|
|
8614
8696
|
return /* @__PURE__ */ jsxRuntime.jsx(ReadOnlyReferral, { fieldDef, value });
|
|
8615
8697
|
case "discharge_medication_orders":
|
|
8616
8698
|
return /* @__PURE__ */ jsxRuntime.jsx(ReadOnlyDischargeMedicationOrders, { fieldDef, value });
|
|
8699
|
+
case "toggle": {
|
|
8700
|
+
const isOn = value === true;
|
|
8701
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1", children: [
|
|
8702
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: fieldDef.label }),
|
|
8703
|
+
/* @__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" })
|
|
8704
|
+
] });
|
|
8705
|
+
}
|
|
8617
8706
|
case "static_text": {
|
|
8618
8707
|
const def = fieldDef;
|
|
8619
8708
|
const size = def.size ?? "regular";
|