formanitor 0.0.37 → 0.0.39
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 +2748 -271
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +165 -2
- package/dist/index.d.ts +165 -2
- package/dist/index.mjs +2748 -271
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -3
- package/src/styles/index.css +116 -0
package/dist/index.mjs
CHANGED
|
@@ -62,6 +62,15 @@ function validateField(value, field) {
|
|
|
62
62
|
return `Must be at most ${rules.max}`;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
+
if (field.type === "slider") {
|
|
66
|
+
const num = Number(value);
|
|
67
|
+
if (isNaN(num)) return "Must be a valid number";
|
|
68
|
+
const s = field;
|
|
69
|
+
const min = s.min ?? 0;
|
|
70
|
+
const max = s.max ?? 10;
|
|
71
|
+
if (num < min) return `Must be at least ${min}`;
|
|
72
|
+
if (num > max) return `Must be at most ${max}`;
|
|
73
|
+
}
|
|
65
74
|
if (typeof value === "string") {
|
|
66
75
|
if (rules.minLength !== void 0 && value.length < rules.minLength) {
|
|
67
76
|
return `Must be at least ${rules.minLength} characters`;
|
|
@@ -94,6 +103,13 @@ function validateForm(values, fields) {
|
|
|
94
103
|
}
|
|
95
104
|
|
|
96
105
|
// src/core/rules.ts
|
|
106
|
+
function tokenListContainsString(text, needle) {
|
|
107
|
+
if (typeof text !== "string") return false;
|
|
108
|
+
const want = String(needle).trim();
|
|
109
|
+
if (!want) return false;
|
|
110
|
+
const parts = text.split(",").map((p) => p.trim()).filter(Boolean);
|
|
111
|
+
return parts.includes(want);
|
|
112
|
+
}
|
|
97
113
|
function evaluateCondition(value, condition) {
|
|
98
114
|
switch (condition.op) {
|
|
99
115
|
case "==":
|
|
@@ -112,7 +128,13 @@ function evaluateCondition(value, condition) {
|
|
|
112
128
|
case "in":
|
|
113
129
|
return Array.isArray(condition.value) && condition.value.includes(value);
|
|
114
130
|
case "contains":
|
|
115
|
-
|
|
131
|
+
if (Array.isArray(value)) {
|
|
132
|
+
return value.includes(condition.value);
|
|
133
|
+
}
|
|
134
|
+
if (typeof value === "string") {
|
|
135
|
+
return tokenListContainsString(value, condition.value);
|
|
136
|
+
}
|
|
137
|
+
return false;
|
|
116
138
|
default:
|
|
117
139
|
return false;
|
|
118
140
|
}
|
|
@@ -187,6 +209,227 @@ function applyPrefill(currentValues, fields, prefilledData = {}) {
|
|
|
187
209
|
return newValues;
|
|
188
210
|
}
|
|
189
211
|
|
|
212
|
+
// src/core/generalSurgeryPathway.ts
|
|
213
|
+
var defaultGeneralSurgerySmartHistory = () => ({
|
|
214
|
+
pain: {
|
|
215
|
+
site: "",
|
|
216
|
+
onset: "",
|
|
217
|
+
character: "",
|
|
218
|
+
radiation: "",
|
|
219
|
+
associated: "",
|
|
220
|
+
timing: "",
|
|
221
|
+
exacerbating: "",
|
|
222
|
+
severity: 0
|
|
223
|
+
},
|
|
224
|
+
swelling: { duration: "", sizeProgression: "", painfulPainless: "", checks: [] },
|
|
225
|
+
gi: { appetite: "", weightLoss: "", bowelHabits: "", checks: [] },
|
|
226
|
+
breast: { lumpDuration: "", nippleDischarge: "", checks: [] },
|
|
227
|
+
ano: { checks: [] },
|
|
228
|
+
thyroid: { swellingDuration: "", checks: [] },
|
|
229
|
+
systemic: ""
|
|
230
|
+
});
|
|
231
|
+
var defaultGeneralSurgeryExamination = () => ({
|
|
232
|
+
general: [],
|
|
233
|
+
regions: [],
|
|
234
|
+
abdomen: {
|
|
235
|
+
inspection: [],
|
|
236
|
+
palpation: [],
|
|
237
|
+
percussion: [],
|
|
238
|
+
massNotes: "",
|
|
239
|
+
bowelSounds: "none"
|
|
240
|
+
},
|
|
241
|
+
hernia: { site: "", reducible: false, coughImpulse: false, tenderness: false },
|
|
242
|
+
breast: { lumpSizeCm: "", mobile: false, skinInvolvement: false, axillaryNodes: false },
|
|
243
|
+
thyroid: { size: "", mobileDeglutition: false, nodules: false, cervicalNodes: false },
|
|
244
|
+
anorectal: { inspection: "", dreDone: false, proctoscopyDone: false, notes: "" },
|
|
245
|
+
limb: { dilatedVeins: false, ulcer: false, oedema: false }
|
|
246
|
+
});
|
|
247
|
+
var ALL_GS_CONDITIONS = [
|
|
248
|
+
"hernia",
|
|
249
|
+
"appendicitis",
|
|
250
|
+
"gallbladder",
|
|
251
|
+
"breast",
|
|
252
|
+
"thyroid",
|
|
253
|
+
"piles",
|
|
254
|
+
"varicose",
|
|
255
|
+
"ulcer"
|
|
256
|
+
];
|
|
257
|
+
var defaultGeneralSurgeryGrading = () => ({
|
|
258
|
+
hernia: 0,
|
|
259
|
+
appendicitis: 0,
|
|
260
|
+
gallbladder: 0,
|
|
261
|
+
breast: 0,
|
|
262
|
+
thyroid: 0,
|
|
263
|
+
piles: 0,
|
|
264
|
+
varicose: 0,
|
|
265
|
+
ulcer: 0
|
|
266
|
+
});
|
|
267
|
+
var GS_CONDITION_TRIGGERS = {
|
|
268
|
+
hernia: { regions: ["hernia", "abdomen"], chips: ["swelling_lump", "obstruction"] },
|
|
269
|
+
appendicitis: { regions: ["abdomen"], chips: ["pain", "obstruction"] },
|
|
270
|
+
gallbladder: { regions: ["abdomen"], chips: ["pain"] },
|
|
271
|
+
breast: { regions: ["breast"], chips: ["breast", "swelling_lump"] },
|
|
272
|
+
thyroid: { regions: ["thyroid"], chips: ["thyroid", "swelling_lump"] },
|
|
273
|
+
piles: { regions: ["anorectal"], chips: ["anorectal", "bleeding"] },
|
|
274
|
+
varicose: { regions: ["limb"], chips: ["swelling_lump"] },
|
|
275
|
+
ulcer: { regions: ["limb", "anorectal"], chips: ["ulcer_wound", "discharge"] }
|
|
276
|
+
};
|
|
277
|
+
var GS_CONDITION_LABELS = {
|
|
278
|
+
hernia: "Hernia",
|
|
279
|
+
appendicitis: "Appendicitis",
|
|
280
|
+
gallbladder: "Gallbladder disease",
|
|
281
|
+
breast: "Breast lump (BIRADS)",
|
|
282
|
+
thyroid: "Thyroid nodule (TIRADS)",
|
|
283
|
+
piles: "Haemorrhoids",
|
|
284
|
+
varicose: "Varicose veins (CEAP)",
|
|
285
|
+
ulcer: "Ulcer / wound"
|
|
286
|
+
};
|
|
287
|
+
var GS_GRADE_DESCRIPTIONS = {
|
|
288
|
+
hernia: ["\u2014", "Small reducible", "Large reducible", "Irreducible", "Obstructed", "Strangulated"],
|
|
289
|
+
appendicitis: ["\u2014", "Mild (clinical)", "Confirmed (USG/CT)", "Complicated (mass)", "Abscess", "Perforation"],
|
|
290
|
+
gallbladder: ["\u2014", "Asymptomatic stones", "Symptomatic", "Acute cholecystitis", "Complicated (CBD stone)", "Perforation/empyema"],
|
|
291
|
+
breast: ["\u2014", "BIRADS 1 \u2014 Negative", "BIRADS 2 \u2014 Benign", "BIRADS 3 \u2014 Probably benign", "BIRADS 4 \u2014 Suspicious", "BIRADS 5 \u2014 Malignant"],
|
|
292
|
+
thyroid: ["\u2014", "TIRADS 1 \u2014 Normal", "TIRADS 2 \u2014 Benign", "TIRADS 3 \u2014 Indeterminate", "TIRADS 4 \u2014 Suspicious", "TIRADS 5 \u2014 Highly suspicious"],
|
|
293
|
+
piles: ["\u2014", "Grade 1", "Grade 2", "Grade 3", "Grade 4", "Grade 5"],
|
|
294
|
+
varicose: ["\u2014", "C1 telangiectasia", "C2 varicose", "C3 oedema", "C4 skin changes", "C5-C6 ulcer"],
|
|
295
|
+
ulcer: ["\u2014", "Superficial", "Deep", "Infected", "Necrotic", "Gangrene"]
|
|
296
|
+
};
|
|
297
|
+
function normalizeGeneralSurgerySmartHistory(raw) {
|
|
298
|
+
const d = defaultGeneralSurgerySmartHistory();
|
|
299
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return d;
|
|
300
|
+
const v = raw;
|
|
301
|
+
const painIn = v.pain && typeof v.pain === "object" ? v.pain : {};
|
|
302
|
+
const sev = Number(painIn.severity);
|
|
303
|
+
const pain = {
|
|
304
|
+
...d.pain,
|
|
305
|
+
...painIn,
|
|
306
|
+
severity: Number.isFinite(sev) ? Math.min(10, Math.max(0, Math.round(sev))) : d.pain.severity
|
|
307
|
+
};
|
|
308
|
+
const str2 = (x) => typeof x === "string" ? x : "";
|
|
309
|
+
const strArr = (x) => Array.isArray(x) ? x.filter((i) => typeof i === "string") : [];
|
|
310
|
+
const swell = v.swelling && typeof v.swelling === "object" ? v.swelling : {};
|
|
311
|
+
const gi = v.gi && typeof v.gi === "object" ? v.gi : {};
|
|
312
|
+
const breast = v.breast && typeof v.breast === "object" ? v.breast : {};
|
|
313
|
+
const ano = v.ano && typeof v.ano === "object" ? v.ano : {};
|
|
314
|
+
const thy = v.thyroid && typeof v.thyroid === "object" ? v.thyroid : {};
|
|
315
|
+
return {
|
|
316
|
+
pain,
|
|
317
|
+
swelling: {
|
|
318
|
+
duration: str2(swell.duration),
|
|
319
|
+
sizeProgression: str2(swell.sizeProgression),
|
|
320
|
+
painfulPainless: str2(swell.painfulPainless),
|
|
321
|
+
checks: strArr(swell.checks)
|
|
322
|
+
},
|
|
323
|
+
gi: {
|
|
324
|
+
appetite: str2(gi.appetite),
|
|
325
|
+
weightLoss: str2(gi.weightLoss),
|
|
326
|
+
bowelHabits: str2(gi.bowelHabits),
|
|
327
|
+
checks: strArr(gi.checks)
|
|
328
|
+
},
|
|
329
|
+
breast: {
|
|
330
|
+
lumpDuration: str2(breast.lumpDuration),
|
|
331
|
+
nippleDischarge: str2(breast.nippleDischarge),
|
|
332
|
+
checks: strArr(breast.checks)
|
|
333
|
+
},
|
|
334
|
+
ano: { checks: strArr(ano.checks) },
|
|
335
|
+
thyroid: {
|
|
336
|
+
swellingDuration: str2(thy.swellingDuration),
|
|
337
|
+
checks: strArr(thy.checks)
|
|
338
|
+
},
|
|
339
|
+
systemic: typeof v.systemic === "string" ? v.systemic : d.systemic
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
function normalizeGeneralSurgeryExamination(raw) {
|
|
343
|
+
const d = defaultGeneralSurgeryExamination();
|
|
344
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return d;
|
|
345
|
+
const v = raw;
|
|
346
|
+
const strArr = (x) => Array.isArray(x) ? x.filter((i) => typeof i === "string") : [];
|
|
347
|
+
const ab = v.abdomen && typeof v.abdomen === "object" ? v.abdomen : {};
|
|
348
|
+
const bowel = ab.bowelSounds;
|
|
349
|
+
const bowels = bowel === "normal" || bowel === "up" || bowel === "down" || bowel === "absent" ? bowel : "none";
|
|
350
|
+
const hb = v.hernia && typeof v.hernia === "object" ? v.hernia : {};
|
|
351
|
+
const br = v.breast && typeof v.breast === "object" ? v.breast : {};
|
|
352
|
+
const th = v.thyroid && typeof v.thyroid === "object" ? v.thyroid : {};
|
|
353
|
+
const ar = v.anorectal && typeof v.anorectal === "object" ? v.anorectal : {};
|
|
354
|
+
const lm = v.limb && typeof v.limb === "object" ? v.limb : {};
|
|
355
|
+
const bool = (x) => x === true;
|
|
356
|
+
return {
|
|
357
|
+
general: strArr(v.general),
|
|
358
|
+
regions: strArr(v.regions),
|
|
359
|
+
abdomen: {
|
|
360
|
+
inspection: strArr(ab.inspection),
|
|
361
|
+
palpation: strArr(ab.palpation),
|
|
362
|
+
percussion: strArr(ab.percussion),
|
|
363
|
+
massNotes: typeof ab.massNotes === "string" ? ab.massNotes : d.abdomen.massNotes,
|
|
364
|
+
bowelSounds: bowels
|
|
365
|
+
},
|
|
366
|
+
hernia: {
|
|
367
|
+
site: typeof hb.site === "string" ? hb.site : "",
|
|
368
|
+
reducible: bool(hb.reducible),
|
|
369
|
+
coughImpulse: bool(hb.coughImpulse),
|
|
370
|
+
tenderness: bool(hb.tenderness)
|
|
371
|
+
},
|
|
372
|
+
breast: {
|
|
373
|
+
lumpSizeCm: typeof br.lumpSizeCm === "string" ? br.lumpSizeCm : "",
|
|
374
|
+
mobile: bool(br.mobile),
|
|
375
|
+
skinInvolvement: bool(br.skinInvolvement),
|
|
376
|
+
axillaryNodes: bool(br.axillaryNodes)
|
|
377
|
+
},
|
|
378
|
+
thyroid: {
|
|
379
|
+
size: typeof th.size === "string" ? th.size : "",
|
|
380
|
+
mobileDeglutition: bool(th.mobileDeglutition),
|
|
381
|
+
nodules: bool(th.nodules),
|
|
382
|
+
cervicalNodes: bool(th.cervicalNodes)
|
|
383
|
+
},
|
|
384
|
+
anorectal: {
|
|
385
|
+
inspection: typeof ar.inspection === "string" ? ar.inspection : "",
|
|
386
|
+
dreDone: bool(ar.dreDone),
|
|
387
|
+
proctoscopyDone: bool(ar.proctoscopyDone),
|
|
388
|
+
notes: typeof ar.notes === "string" ? ar.notes : ""
|
|
389
|
+
},
|
|
390
|
+
limb: {
|
|
391
|
+
dilatedVeins: bool(lm.dilatedVeins),
|
|
392
|
+
ulcer: bool(lm.ulcer),
|
|
393
|
+
oedema: bool(lm.oedema)
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
function normalizeGeneralSurgeryGrading(raw) {
|
|
398
|
+
const d = defaultGeneralSurgeryGrading();
|
|
399
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return d;
|
|
400
|
+
const v = raw;
|
|
401
|
+
const out = { ...d };
|
|
402
|
+
for (const k of ALL_GS_CONDITIONS) {
|
|
403
|
+
const n = Number(v[k]);
|
|
404
|
+
if (Number.isFinite(n) && n >= 0 && n <= 5) out[k] = Math.round(n);
|
|
405
|
+
}
|
|
406
|
+
return out;
|
|
407
|
+
}
|
|
408
|
+
function gsGradingRowVisible(cond, chips, regions, grade) {
|
|
409
|
+
if (grade > 0) return true;
|
|
410
|
+
const t = GS_CONDITION_TRIGGERS[cond];
|
|
411
|
+
if (t.chips.some((c) => chips.includes(c))) return true;
|
|
412
|
+
if (t.regions.some((r) => regions.includes(r))) return true;
|
|
413
|
+
return false;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// src/core/painScaleFlags.ts
|
|
417
|
+
function normalizePainScaleFlags(raw, bounds) {
|
|
418
|
+
const min = bounds?.min ?? 0;
|
|
419
|
+
const max = bounds?.max ?? 10;
|
|
420
|
+
let pain = min;
|
|
421
|
+
let flags = [];
|
|
422
|
+
if (raw && typeof raw === "object" && !Array.isArray(raw)) {
|
|
423
|
+
const o = raw;
|
|
424
|
+
const p = Number(o.pain);
|
|
425
|
+
if (Number.isFinite(p)) pain = Math.min(max, Math.max(min, p));
|
|
426
|
+
if (Array.isArray(o.flags)) {
|
|
427
|
+
flags = o.flags.filter((x) => typeof x === "string");
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
return { pain, flags };
|
|
431
|
+
}
|
|
432
|
+
|
|
190
433
|
// src/core/store.ts
|
|
191
434
|
var FormStore = class {
|
|
192
435
|
state;
|
|
@@ -232,9 +475,63 @@ var FormStore = class {
|
|
|
232
475
|
values[field.id] = field.defaultValue;
|
|
233
476
|
} else {
|
|
234
477
|
if (field.type === "repeatable") values[field.id] = [];
|
|
235
|
-
else if (field.type === "checkbox") values[field.id] = [];
|
|
478
|
+
else if (field.type === "checkbox" || field.type === "multiselect") values[field.id] = [];
|
|
236
479
|
else if (field.type === "smart_textarea") values[field.id] = { text: "", extractedKeywords: [] };
|
|
237
|
-
else values[field.id] =
|
|
480
|
+
else if (field.type === "suggestion_textarea" || field.type === "complaint_chips") values[field.id] = "";
|
|
481
|
+
else if (field.type === "lens_assessment")
|
|
482
|
+
values[field.id] = {
|
|
483
|
+
notes: "",
|
|
484
|
+
assessmentKey: void 0,
|
|
485
|
+
locs: {
|
|
486
|
+
OD: { NO: 0, NC: 0, C: 0, PSC: 0 },
|
|
487
|
+
OS: { NO: 0, NC: 0, C: 0, PSC: 0 }
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
else if (field.type === "functional_impairment_score")
|
|
491
|
+
values[field.id] = {
|
|
492
|
+
reading: 0,
|
|
493
|
+
nightDriving: 0,
|
|
494
|
+
glare: 0,
|
|
495
|
+
occupation: 0,
|
|
496
|
+
adl: 0
|
|
497
|
+
};
|
|
498
|
+
else if (field.type === "biometry_iol_workup")
|
|
499
|
+
values[field.id] = {
|
|
500
|
+
axialLengthOD: "",
|
|
501
|
+
axialLengthOS: "",
|
|
502
|
+
k1k2AxisOD: "",
|
|
503
|
+
k1k2AxisOS: "",
|
|
504
|
+
anteriorChamberDepthOD: "",
|
|
505
|
+
anteriorChamberDepthOS: "",
|
|
506
|
+
iolPowerOD: "",
|
|
507
|
+
iolPowerOS: "",
|
|
508
|
+
targetRefractionOD: "",
|
|
509
|
+
targetRefractionOS: "",
|
|
510
|
+
formula: "SRK/T",
|
|
511
|
+
method: "optical_biometry",
|
|
512
|
+
cornealTopoUploaded: false,
|
|
513
|
+
specularMicroscopyDone: false,
|
|
514
|
+
endothelialCount: ""
|
|
515
|
+
};
|
|
516
|
+
else if (field.type === "surgical_risk_flags")
|
|
517
|
+
values[field.id] = { OD: [], OS: [] };
|
|
518
|
+
else if (field.type === "toggle") values[field.id] = false;
|
|
519
|
+
else if (field.type === "slider") {
|
|
520
|
+
const s = field;
|
|
521
|
+
values[field.id] = s.defaultValue ?? s.min ?? 0;
|
|
522
|
+
} else if (field.type === "general_surgery_smart_history") {
|
|
523
|
+
values[field.id] = field.defaultValue ?? defaultGeneralSurgerySmartHistory();
|
|
524
|
+
} else if (field.type === "general_surgery_examination") {
|
|
525
|
+
values[field.id] = field.defaultValue ?? defaultGeneralSurgeryExamination();
|
|
526
|
+
} else if (field.type === "general_surgery_grading") {
|
|
527
|
+
values[field.id] = field.defaultValue ?? defaultGeneralSurgeryGrading();
|
|
528
|
+
} else if (field.type === "pain_scale_flags") {
|
|
529
|
+
const f = field;
|
|
530
|
+
values[field.id] = normalizePainScaleFlags(
|
|
531
|
+
f.defaultValue ?? { pain: f.min ?? 0, flags: [] },
|
|
532
|
+
{ min: f.min, max: f.max }
|
|
533
|
+
);
|
|
534
|
+
} else values[field.id] = null;
|
|
238
535
|
}
|
|
239
536
|
});
|
|
240
537
|
this.state.values = values;
|
|
@@ -954,7 +1251,8 @@ var TextWidget = ({ fieldId }) => {
|
|
|
954
1251
|
fieldDef.required && /* @__PURE__ */ jsx("span", { className: "text-red-500", children: "*" })
|
|
955
1252
|
] });
|
|
956
1253
|
const labelEl = theme ? /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, children: labelContent });
|
|
957
|
-
|
|
1254
|
+
const placeholder = typeof fieldDef.placeholder === "string" && fieldDef.placeholder.trim() ? fieldDef.placeholder : void 0;
|
|
1255
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(wrapperClass, isTextarea && "flex h-full min-h-0 flex-col"), children: [
|
|
958
1256
|
hasVoice ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
959
1257
|
labelEl,
|
|
960
1258
|
/* @__PURE__ */ jsx(VoiceMicButton, { fieldId, onTranscriptReady: setValue })
|
|
@@ -968,7 +1266,8 @@ var TextWidget = ({ fieldId }) => {
|
|
|
968
1266
|
onBlur: setTouched,
|
|
969
1267
|
disabled,
|
|
970
1268
|
type: fieldDef.type === "number" ? "number" : "text",
|
|
971
|
-
className: inputClass,
|
|
1269
|
+
className: cn(inputClass, isTextarea && height == null && "min-h-[80px] flex-1"),
|
|
1270
|
+
placeholder,
|
|
972
1271
|
...isTextarea && { height }
|
|
973
1272
|
}
|
|
974
1273
|
),
|
|
@@ -1444,6 +1743,8 @@ var SelectWidget = ({ fieldId }) => {
|
|
|
1444
1743
|
}
|
|
1445
1744
|
}, [fieldDef]);
|
|
1446
1745
|
if (!fieldDef) return null;
|
|
1746
|
+
const schemaPlaceholder = typeof fieldDef.placeholder === "string" && fieldDef.placeholder.trim() ? fieldDef.placeholder : void 0;
|
|
1747
|
+
const selectPlaceholder = loading ? "Loading..." : schemaPlaceholder ?? "Select...";
|
|
1447
1748
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
1448
1749
|
/* @__PURE__ */ jsxs(Label, { htmlFor: fieldId, children: [
|
|
1449
1750
|
fieldDef.label,
|
|
@@ -1461,7 +1762,7 @@ var SelectWidget = ({ fieldId }) => {
|
|
|
1461
1762
|
setTouched();
|
|
1462
1763
|
},
|
|
1463
1764
|
children: [
|
|
1464
|
-
/* @__PURE__ */ jsx(SelectTrigger, { id: fieldId, className: showError ? "border-red-500" : "", children: /* @__PURE__ */ jsx(SelectValue, { placeholder:
|
|
1765
|
+
/* @__PURE__ */ jsx(SelectTrigger, { id: fieldId, className: showError ? "border-red-500" : "", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: selectPlaceholder }) }),
|
|
1465
1766
|
/* @__PURE__ */ jsx(SelectContent, { children: options.map((opt) => /* @__PURE__ */ jsx(SelectItem, { value: String(opt.value), children: opt.label }, String(opt.value))) })
|
|
1466
1767
|
]
|
|
1467
1768
|
}
|
|
@@ -6065,6 +6366,12 @@ var tableCellClass = "border border-[#E0E0E0] px-1.5 py-1 text-center align-midd
|
|
|
6065
6366
|
var selectClass = "w-full border border-[#D0D0D0] rounded-md bg-white px-2 py-1 text-xs focus-visible:outline-none focus-visible:ring-0";
|
|
6066
6367
|
var numberInputClass = "w-full border border-[#D0D0D0] rounded-md bg-white px-2 py-1 text-xs text-right focus-visible:outline-none focus-visible:ring-0";
|
|
6067
6368
|
var textInputClass = "w-full border border-[#D0D0D0] rounded-md bg-white px-2 py-1 text-xs focus-visible:outline-none focus-visible:ring-0";
|
|
6369
|
+
var refractionTableClass = "w-full table-fixed border-collapse text-xs";
|
|
6370
|
+
var refractionHeaderCellClass = "border border-[#E0E0E0] bg-[#F7F7F7] px-1 py-1 text-center font-semibold text-[11px]";
|
|
6371
|
+
var refractionDataCellClass = "border border-[#E0E0E0] p-0 text-center align-middle min-w-0";
|
|
6372
|
+
var refractionLabelCellClass = "border border-[#E0E0E0] px-2 py-1 text-left align-middle font-semibold whitespace-nowrap";
|
|
6373
|
+
var refractionInputClass = "h-7 w-full min-w-0 border-0 rounded-none bg-transparent px-1 py-0.5 text-xs text-right shadow-none ring-0 focus-visible:ring-0 focus-visible:ring-offset-0 disabled:opacity-50";
|
|
6374
|
+
var refractionSelectClass = "box-border h-7 w-full min-w-0 max-w-full cursor-pointer border-0 rounded-none bg-transparent px-1 py-0.5 pr-6 text-xs shadow-none focus-visible:outline-none focus-visible:ring-0 disabled:opacity-50";
|
|
6068
6375
|
var OphthalmologyWidget = ({ fieldId }) => {
|
|
6069
6376
|
const { fieldDef, value, setValue, disabled } = useField(fieldId);
|
|
6070
6377
|
const safe = useMemo(() => ensureValue(value), [value]);
|
|
@@ -6296,34 +6603,45 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6296
6603
|
] }),
|
|
6297
6604
|
/* @__PURE__ */ jsxs("section", { className: sectionWrapperClass, children: [
|
|
6298
6605
|
/* @__PURE__ */ jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsx("span", { children: "Current Glass Prescription" }) }),
|
|
6299
|
-
/* @__PURE__ */ jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxs("table", { className:
|
|
6606
|
+
/* @__PURE__ */ jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxs("table", { className: refractionTableClass, children: [
|
|
6607
|
+
/* @__PURE__ */ jsxs("colgroup", { children: [
|
|
6608
|
+
/* @__PURE__ */ jsx("col", { className: "w-[10%]" }),
|
|
6609
|
+
/* @__PURE__ */ jsx("col", { className: "w-[7%]" }),
|
|
6610
|
+
/* @__PURE__ */ jsx("col", { className: "w-[7%]" }),
|
|
6611
|
+
/* @__PURE__ */ jsx("col", { className: "w-[6%]" }),
|
|
6612
|
+
/* @__PURE__ */ jsx("col", { className: "w-[25%]" }),
|
|
6613
|
+
/* @__PURE__ */ jsx("col", { className: "w-[7%]" }),
|
|
6614
|
+
/* @__PURE__ */ jsx("col", { className: "w-[7%]" }),
|
|
6615
|
+
/* @__PURE__ */ jsx("col", { className: "w-[6%]" }),
|
|
6616
|
+
/* @__PURE__ */ jsx("col", { className: "w-[25%]" })
|
|
6617
|
+
] }),
|
|
6300
6618
|
/* @__PURE__ */ jsxs("thead", { children: [
|
|
6301
6619
|
/* @__PURE__ */ jsxs("tr", { children: [
|
|
6302
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6303
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6304
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6620
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass }),
|
|
6621
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, colSpan: 4, children: "Right Eye" }),
|
|
6622
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, colSpan: 4, children: "Left Eye" })
|
|
6305
6623
|
] }),
|
|
6306
6624
|
/* @__PURE__ */ jsxs("tr", { children: [
|
|
6307
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6308
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6309
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6310
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6311
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6312
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6313
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6314
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6315
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6625
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass }),
|
|
6626
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Sph" }),
|
|
6627
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Cyl" }),
|
|
6628
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Axis" }),
|
|
6629
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "V/A" }),
|
|
6630
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Sph" }),
|
|
6631
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Cyl" }),
|
|
6632
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Axis" }),
|
|
6633
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "V/A" })
|
|
6316
6634
|
] })
|
|
6317
6635
|
] }),
|
|
6318
6636
|
/* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
6319
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
6320
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
6637
|
+
/* @__PURE__ */ jsx("td", { className: refractionLabelCellClass, children: "Current Glass" }),
|
|
6638
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6321
6639
|
Input,
|
|
6322
6640
|
{
|
|
6323
6641
|
disabled,
|
|
6324
6642
|
type: "number",
|
|
6325
6643
|
step: "0.25",
|
|
6326
|
-
className:
|
|
6644
|
+
className: refractionInputClass,
|
|
6327
6645
|
value: safe.current_glass_prescription.right_eye.sph ?? "",
|
|
6328
6646
|
onChange: (e) => setRefractionField(
|
|
6329
6647
|
"current_glass_prescription",
|
|
@@ -6334,13 +6652,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6334
6652
|
)
|
|
6335
6653
|
}
|
|
6336
6654
|
) }),
|
|
6337
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
6655
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6338
6656
|
Input,
|
|
6339
6657
|
{
|
|
6340
6658
|
disabled,
|
|
6341
6659
|
type: "number",
|
|
6342
6660
|
step: "0.25",
|
|
6343
|
-
className:
|
|
6661
|
+
className: refractionInputClass,
|
|
6344
6662
|
value: safe.current_glass_prescription.right_eye.cyl ?? "",
|
|
6345
6663
|
onChange: (e) => setRefractionField(
|
|
6346
6664
|
"current_glass_prescription",
|
|
@@ -6351,12 +6669,12 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6351
6669
|
)
|
|
6352
6670
|
}
|
|
6353
6671
|
) }),
|
|
6354
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
6672
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6355
6673
|
Input,
|
|
6356
6674
|
{
|
|
6357
6675
|
disabled,
|
|
6358
6676
|
type: "number",
|
|
6359
|
-
className:
|
|
6677
|
+
className: refractionInputClass,
|
|
6360
6678
|
value: safe.current_glass_prescription.right_eye.axis ?? "",
|
|
6361
6679
|
onChange: (e) => setRefractionField(
|
|
6362
6680
|
"current_glass_prescription",
|
|
@@ -6367,11 +6685,11 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6367
6685
|
)
|
|
6368
6686
|
}
|
|
6369
6687
|
) }),
|
|
6370
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
6688
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6371
6689
|
"select",
|
|
6372
6690
|
{
|
|
6373
6691
|
disabled,
|
|
6374
|
-
className:
|
|
6692
|
+
className: refractionSelectClass,
|
|
6375
6693
|
value: safe.current_glass_prescription.right_eye.va,
|
|
6376
6694
|
onChange: (e) => setRefractionField(
|
|
6377
6695
|
"current_glass_prescription",
|
|
@@ -6383,13 +6701,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6383
6701
|
children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
|
|
6384
6702
|
}
|
|
6385
6703
|
) }),
|
|
6386
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
6704
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6387
6705
|
Input,
|
|
6388
6706
|
{
|
|
6389
6707
|
disabled,
|
|
6390
6708
|
type: "number",
|
|
6391
6709
|
step: "0.25",
|
|
6392
|
-
className:
|
|
6710
|
+
className: refractionInputClass,
|
|
6393
6711
|
value: safe.current_glass_prescription.left_eye.sph ?? "",
|
|
6394
6712
|
onChange: (e) => setRefractionField(
|
|
6395
6713
|
"current_glass_prescription",
|
|
@@ -6400,13 +6718,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6400
6718
|
)
|
|
6401
6719
|
}
|
|
6402
6720
|
) }),
|
|
6403
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
6721
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6404
6722
|
Input,
|
|
6405
6723
|
{
|
|
6406
6724
|
disabled,
|
|
6407
6725
|
type: "number",
|
|
6408
6726
|
step: "0.25",
|
|
6409
|
-
className:
|
|
6727
|
+
className: refractionInputClass,
|
|
6410
6728
|
value: safe.current_glass_prescription.left_eye.cyl ?? "",
|
|
6411
6729
|
onChange: (e) => setRefractionField(
|
|
6412
6730
|
"current_glass_prescription",
|
|
@@ -6417,12 +6735,12 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6417
6735
|
)
|
|
6418
6736
|
}
|
|
6419
6737
|
) }),
|
|
6420
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
6738
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6421
6739
|
Input,
|
|
6422
6740
|
{
|
|
6423
6741
|
disabled,
|
|
6424
6742
|
type: "number",
|
|
6425
|
-
className:
|
|
6743
|
+
className: refractionInputClass,
|
|
6426
6744
|
value: safe.current_glass_prescription.left_eye.axis ?? "",
|
|
6427
6745
|
onChange: (e) => setRefractionField(
|
|
6428
6746
|
"current_glass_prescription",
|
|
@@ -6433,11 +6751,11 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6433
6751
|
)
|
|
6434
6752
|
}
|
|
6435
6753
|
) }),
|
|
6436
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
6754
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6437
6755
|
"select",
|
|
6438
6756
|
{
|
|
6439
6757
|
disabled,
|
|
6440
|
-
className:
|
|
6758
|
+
className: refractionSelectClass,
|
|
6441
6759
|
value: safe.current_glass_prescription.left_eye.va,
|
|
6442
6760
|
onChange: (e) => setRefractionField(
|
|
6443
6761
|
"current_glass_prescription",
|
|
@@ -6546,37 +6864,50 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6546
6864
|
] }),
|
|
6547
6865
|
/* @__PURE__ */ jsxs("section", { className: sectionWrapperClass, children: [
|
|
6548
6866
|
/* @__PURE__ */ jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsx("span", { children: "Refraction (Distance)" }) }),
|
|
6549
|
-
/* @__PURE__ */ jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxs("table", { className:
|
|
6867
|
+
/* @__PURE__ */ jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxs("table", { className: refractionTableClass, children: [
|
|
6868
|
+
/* @__PURE__ */ jsxs("colgroup", { children: [
|
|
6869
|
+
/* @__PURE__ */ jsx("col", { className: "w-[10%]" }),
|
|
6870
|
+
/* @__PURE__ */ jsx("col", { className: "w-[7%]" }),
|
|
6871
|
+
/* @__PURE__ */ jsx("col", { className: "w-[7%]" }),
|
|
6872
|
+
/* @__PURE__ */ jsx("col", { className: "w-[6%]" }),
|
|
6873
|
+
/* @__PURE__ */ jsx("col", { className: "w-[13%]" }),
|
|
6874
|
+
/* @__PURE__ */ jsx("col", { className: "w-[12%]" }),
|
|
6875
|
+
/* @__PURE__ */ jsx("col", { className: "w-[7%]" }),
|
|
6876
|
+
/* @__PURE__ */ jsx("col", { className: "w-[7%]" }),
|
|
6877
|
+
/* @__PURE__ */ jsx("col", { className: "w-[6%]" }),
|
|
6878
|
+
/* @__PURE__ */ jsx("col", { className: "w-[13%]" }),
|
|
6879
|
+
/* @__PURE__ */ jsx("col", { className: "w-[12%]" })
|
|
6880
|
+
] }),
|
|
6550
6881
|
/* @__PURE__ */ jsxs("thead", { children: [
|
|
6551
6882
|
/* @__PURE__ */ jsxs("tr", { children: [
|
|
6552
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6553
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6554
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6883
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass }),
|
|
6884
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, colSpan: 5, children: "Right Eye" }),
|
|
6885
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, colSpan: 5, children: "Left Eye" })
|
|
6555
6886
|
] }),
|
|
6556
6887
|
/* @__PURE__ */ jsxs("tr", { children: [
|
|
6557
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6558
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6559
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6560
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6561
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6562
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6563
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6564
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6565
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6566
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6567
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6888
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass }),
|
|
6889
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Sph" }),
|
|
6890
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Cyl" }),
|
|
6891
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Axis" }),
|
|
6892
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "V/A" }),
|
|
6893
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "P/D" }),
|
|
6894
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Sph" }),
|
|
6895
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Cyl" }),
|
|
6896
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Axis" }),
|
|
6897
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "V/A" }),
|
|
6898
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "P/D" })
|
|
6568
6899
|
] })
|
|
6569
6900
|
] }),
|
|
6570
6901
|
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
6571
6902
|
/* @__PURE__ */ jsxs("tr", { children: [
|
|
6572
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
6573
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
6903
|
+
/* @__PURE__ */ jsx("td", { className: refractionLabelCellClass, children: "Distance" }),
|
|
6904
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6574
6905
|
Input,
|
|
6575
6906
|
{
|
|
6576
6907
|
disabled,
|
|
6577
6908
|
type: "number",
|
|
6578
6909
|
step: "0.25",
|
|
6579
|
-
className:
|
|
6910
|
+
className: refractionInputClass,
|
|
6580
6911
|
value: safe.refraction.right_eye.sph ?? "",
|
|
6581
6912
|
onChange: (e) => setRefractionField(
|
|
6582
6913
|
"refraction",
|
|
@@ -6587,13 +6918,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6587
6918
|
)
|
|
6588
6919
|
}
|
|
6589
6920
|
) }),
|
|
6590
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
6921
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6591
6922
|
Input,
|
|
6592
6923
|
{
|
|
6593
6924
|
disabled,
|
|
6594
6925
|
type: "number",
|
|
6595
6926
|
step: "0.25",
|
|
6596
|
-
className:
|
|
6927
|
+
className: refractionInputClass,
|
|
6597
6928
|
value: safe.refraction.right_eye.cyl ?? "",
|
|
6598
6929
|
onChange: (e) => setRefractionField(
|
|
6599
6930
|
"refraction",
|
|
@@ -6604,12 +6935,12 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6604
6935
|
)
|
|
6605
6936
|
}
|
|
6606
6937
|
) }),
|
|
6607
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
6938
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6608
6939
|
Input,
|
|
6609
6940
|
{
|
|
6610
6941
|
disabled,
|
|
6611
6942
|
type: "number",
|
|
6612
|
-
className:
|
|
6943
|
+
className: refractionInputClass,
|
|
6613
6944
|
value: safe.refraction.right_eye.axis ?? "",
|
|
6614
6945
|
onChange: (e) => setRefractionField(
|
|
6615
6946
|
"refraction",
|
|
@@ -6620,11 +6951,11 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6620
6951
|
)
|
|
6621
6952
|
}
|
|
6622
6953
|
) }),
|
|
6623
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
6954
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6624
6955
|
"select",
|
|
6625
6956
|
{
|
|
6626
6957
|
disabled,
|
|
6627
|
-
className:
|
|
6958
|
+
className: refractionSelectClass,
|
|
6628
6959
|
value: safe.refraction.right_eye.va,
|
|
6629
6960
|
onChange: (e) => setRefractionField(
|
|
6630
6961
|
"refraction",
|
|
@@ -6636,7 +6967,7 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6636
6967
|
children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
|
|
6637
6968
|
}
|
|
6638
6969
|
) }),
|
|
6639
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
6970
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6640
6971
|
Input,
|
|
6641
6972
|
{
|
|
6642
6973
|
disabled,
|
|
@@ -6644,18 +6975,18 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6644
6975
|
min: 10,
|
|
6645
6976
|
max: 45,
|
|
6646
6977
|
step: "1",
|
|
6647
|
-
className:
|
|
6978
|
+
className: refractionInputClass,
|
|
6648
6979
|
value: safe.refraction.right_eye.pd ?? "",
|
|
6649
6980
|
onChange: (e) => setRefractionField("refraction", "right_eye", "pd", e.target.value, "int")
|
|
6650
6981
|
}
|
|
6651
6982
|
) }),
|
|
6652
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
6983
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6653
6984
|
Input,
|
|
6654
6985
|
{
|
|
6655
6986
|
disabled,
|
|
6656
6987
|
type: "number",
|
|
6657
6988
|
step: "0.25",
|
|
6658
|
-
className:
|
|
6989
|
+
className: refractionInputClass,
|
|
6659
6990
|
value: safe.refraction.left_eye.sph ?? "",
|
|
6660
6991
|
onChange: (e) => setRefractionField(
|
|
6661
6992
|
"refraction",
|
|
@@ -6666,13 +6997,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6666
6997
|
)
|
|
6667
6998
|
}
|
|
6668
6999
|
) }),
|
|
6669
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7000
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6670
7001
|
Input,
|
|
6671
7002
|
{
|
|
6672
7003
|
disabled,
|
|
6673
7004
|
type: "number",
|
|
6674
7005
|
step: "0.25",
|
|
6675
|
-
className:
|
|
7006
|
+
className: refractionInputClass,
|
|
6676
7007
|
value: safe.refraction.left_eye.cyl ?? "",
|
|
6677
7008
|
onChange: (e) => setRefractionField(
|
|
6678
7009
|
"refraction",
|
|
@@ -6683,12 +7014,12 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6683
7014
|
)
|
|
6684
7015
|
}
|
|
6685
7016
|
) }),
|
|
6686
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7017
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6687
7018
|
Input,
|
|
6688
7019
|
{
|
|
6689
7020
|
disabled,
|
|
6690
7021
|
type: "number",
|
|
6691
|
-
className:
|
|
7022
|
+
className: refractionInputClass,
|
|
6692
7023
|
value: safe.refraction.left_eye.axis ?? "",
|
|
6693
7024
|
onChange: (e) => setRefractionField(
|
|
6694
7025
|
"refraction",
|
|
@@ -6699,11 +7030,11 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6699
7030
|
)
|
|
6700
7031
|
}
|
|
6701
7032
|
) }),
|
|
6702
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7033
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6703
7034
|
"select",
|
|
6704
7035
|
{
|
|
6705
7036
|
disabled,
|
|
6706
|
-
className:
|
|
7037
|
+
className: refractionSelectClass,
|
|
6707
7038
|
value: safe.refraction.left_eye.va,
|
|
6708
7039
|
onChange: (e) => setRefractionField(
|
|
6709
7040
|
"refraction",
|
|
@@ -6715,7 +7046,7 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6715
7046
|
children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
|
|
6716
7047
|
}
|
|
6717
7048
|
) }),
|
|
6718
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7049
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6719
7050
|
Input,
|
|
6720
7051
|
{
|
|
6721
7052
|
disabled,
|
|
@@ -6723,32 +7054,32 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6723
7054
|
min: 10,
|
|
6724
7055
|
max: 45,
|
|
6725
7056
|
step: "1",
|
|
6726
|
-
className:
|
|
7057
|
+
className: refractionInputClass,
|
|
6727
7058
|
value: safe.refraction.left_eye.pd ?? "",
|
|
6728
7059
|
onChange: (e) => setRefractionField("refraction", "left_eye", "pd", e.target.value, "int")
|
|
6729
7060
|
}
|
|
6730
7061
|
) })
|
|
6731
7062
|
] }),
|
|
6732
7063
|
/* @__PURE__ */ jsxs("tr", { children: [
|
|
6733
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
6734
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7064
|
+
/* @__PURE__ */ jsx("td", { className: refractionLabelCellClass, children: "Add" }),
|
|
7065
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, colSpan: 5, children: /* @__PURE__ */ jsx(
|
|
6735
7066
|
Input,
|
|
6736
7067
|
{
|
|
6737
7068
|
disabled,
|
|
6738
7069
|
type: "number",
|
|
6739
7070
|
step: "0.25",
|
|
6740
|
-
className:
|
|
7071
|
+
className: refractionInputClass,
|
|
6741
7072
|
value: safe.refraction.add.right ?? "",
|
|
6742
7073
|
onChange: (e) => setRefractionAdd("refraction", "right", e.target.value)
|
|
6743
7074
|
}
|
|
6744
7075
|
) }),
|
|
6745
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7076
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, colSpan: 5, children: /* @__PURE__ */ jsx(
|
|
6746
7077
|
Input,
|
|
6747
7078
|
{
|
|
6748
7079
|
disabled,
|
|
6749
7080
|
type: "number",
|
|
6750
7081
|
step: "0.25",
|
|
6751
|
-
className:
|
|
7082
|
+
className: refractionInputClass,
|
|
6752
7083
|
value: safe.refraction.add.left ?? "",
|
|
6753
7084
|
onChange: (e) => setRefractionAdd("refraction", "left", e.target.value)
|
|
6754
7085
|
}
|
|
@@ -6759,37 +7090,50 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6759
7090
|
] }),
|
|
6760
7091
|
/* @__PURE__ */ jsxs("section", { className: sectionWrapperClass, children: [
|
|
6761
7092
|
/* @__PURE__ */ jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsx("span", { children: "Dilated Refraction" }) }),
|
|
6762
|
-
/* @__PURE__ */ jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxs("table", { className:
|
|
7093
|
+
/* @__PURE__ */ jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxs("table", { className: refractionTableClass, children: [
|
|
7094
|
+
/* @__PURE__ */ jsxs("colgroup", { children: [
|
|
7095
|
+
/* @__PURE__ */ jsx("col", { className: "w-[10%]" }),
|
|
7096
|
+
/* @__PURE__ */ jsx("col", { className: "w-[7%]" }),
|
|
7097
|
+
/* @__PURE__ */ jsx("col", { className: "w-[7%]" }),
|
|
7098
|
+
/* @__PURE__ */ jsx("col", { className: "w-[6%]" }),
|
|
7099
|
+
/* @__PURE__ */ jsx("col", { className: "w-[8%]" }),
|
|
7100
|
+
/* @__PURE__ */ jsx("col", { className: "w-[17%]" }),
|
|
7101
|
+
/* @__PURE__ */ jsx("col", { className: "w-[7%]" }),
|
|
7102
|
+
/* @__PURE__ */ jsx("col", { className: "w-[7%]" }),
|
|
7103
|
+
/* @__PURE__ */ jsx("col", { className: "w-[6%]" }),
|
|
7104
|
+
/* @__PURE__ */ jsx("col", { className: "w-[8%]" }),
|
|
7105
|
+
/* @__PURE__ */ jsx("col", { className: "w-[17%]" })
|
|
7106
|
+
] }),
|
|
6763
7107
|
/* @__PURE__ */ jsxs("thead", { children: [
|
|
6764
7108
|
/* @__PURE__ */ jsxs("tr", { children: [
|
|
6765
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6766
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6767
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
7109
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass }),
|
|
7110
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, colSpan: 5, children: "Right Eye" }),
|
|
7111
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, colSpan: 5, children: "Left Eye" })
|
|
6768
7112
|
] }),
|
|
6769
7113
|
/* @__PURE__ */ jsxs("tr", { children: [
|
|
6770
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6771
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6772
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6773
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6774
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6775
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6776
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6777
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6778
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6779
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6780
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
7114
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass }),
|
|
7115
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Sph" }),
|
|
7116
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Cyl" }),
|
|
7117
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Axis" }),
|
|
7118
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Prism" }),
|
|
7119
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "V/A" }),
|
|
7120
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Sph" }),
|
|
7121
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Cyl" }),
|
|
7122
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Axis" }),
|
|
7123
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Prism" }),
|
|
7124
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "V/A" })
|
|
6781
7125
|
] })
|
|
6782
7126
|
] }),
|
|
6783
7127
|
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
6784
7128
|
/* @__PURE__ */ jsxs("tr", { children: [
|
|
6785
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
6786
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7129
|
+
/* @__PURE__ */ jsx("td", { className: refractionLabelCellClass, children: "Dilated" }),
|
|
7130
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6787
7131
|
Input,
|
|
6788
7132
|
{
|
|
6789
7133
|
disabled,
|
|
6790
7134
|
type: "number",
|
|
6791
7135
|
step: "0.25",
|
|
6792
|
-
className:
|
|
7136
|
+
className: refractionInputClass,
|
|
6793
7137
|
value: safe.dilated_refraction.right_eye.sph ?? "",
|
|
6794
7138
|
onChange: (e) => setRefractionField(
|
|
6795
7139
|
"dilated_refraction",
|
|
@@ -6800,13 +7144,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6800
7144
|
)
|
|
6801
7145
|
}
|
|
6802
7146
|
) }),
|
|
6803
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7147
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6804
7148
|
Input,
|
|
6805
7149
|
{
|
|
6806
7150
|
disabled,
|
|
6807
7151
|
type: "number",
|
|
6808
7152
|
step: "0.25",
|
|
6809
|
-
className:
|
|
7153
|
+
className: refractionInputClass,
|
|
6810
7154
|
value: safe.dilated_refraction.right_eye.cyl ?? "",
|
|
6811
7155
|
onChange: (e) => setRefractionField(
|
|
6812
7156
|
"dilated_refraction",
|
|
@@ -6817,12 +7161,12 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6817
7161
|
)
|
|
6818
7162
|
}
|
|
6819
7163
|
) }),
|
|
6820
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7164
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6821
7165
|
Input,
|
|
6822
7166
|
{
|
|
6823
7167
|
disabled,
|
|
6824
7168
|
type: "number",
|
|
6825
|
-
className:
|
|
7169
|
+
className: refractionInputClass,
|
|
6826
7170
|
value: safe.dilated_refraction.right_eye.axis ?? "",
|
|
6827
7171
|
onChange: (e) => setRefractionField(
|
|
6828
7172
|
"dilated_refraction",
|
|
@@ -6833,13 +7177,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6833
7177
|
)
|
|
6834
7178
|
}
|
|
6835
7179
|
) }),
|
|
6836
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7180
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6837
7181
|
Input,
|
|
6838
7182
|
{
|
|
6839
7183
|
disabled,
|
|
6840
7184
|
type: "number",
|
|
6841
7185
|
step: "0.25",
|
|
6842
|
-
className:
|
|
7186
|
+
className: refractionInputClass,
|
|
6843
7187
|
value: safe.dilated_refraction.right_eye.prism ?? "",
|
|
6844
7188
|
onChange: (e) => setRefractionField(
|
|
6845
7189
|
"dilated_refraction",
|
|
@@ -6850,11 +7194,11 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6850
7194
|
)
|
|
6851
7195
|
}
|
|
6852
7196
|
) }),
|
|
6853
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7197
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6854
7198
|
"select",
|
|
6855
7199
|
{
|
|
6856
7200
|
disabled,
|
|
6857
|
-
className:
|
|
7201
|
+
className: refractionSelectClass,
|
|
6858
7202
|
value: safe.dilated_refraction.right_eye.va,
|
|
6859
7203
|
onChange: (e) => setRefractionField(
|
|
6860
7204
|
"dilated_refraction",
|
|
@@ -6866,13 +7210,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6866
7210
|
children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
|
|
6867
7211
|
}
|
|
6868
7212
|
) }),
|
|
6869
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7213
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6870
7214
|
Input,
|
|
6871
7215
|
{
|
|
6872
7216
|
disabled,
|
|
6873
7217
|
type: "number",
|
|
6874
7218
|
step: "0.25",
|
|
6875
|
-
className:
|
|
7219
|
+
className: refractionInputClass,
|
|
6876
7220
|
value: safe.dilated_refraction.left_eye.sph ?? "",
|
|
6877
7221
|
onChange: (e) => setRefractionField(
|
|
6878
7222
|
"dilated_refraction",
|
|
@@ -6883,13 +7227,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6883
7227
|
)
|
|
6884
7228
|
}
|
|
6885
7229
|
) }),
|
|
6886
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7230
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6887
7231
|
Input,
|
|
6888
7232
|
{
|
|
6889
7233
|
disabled,
|
|
6890
7234
|
type: "number",
|
|
6891
7235
|
step: "0.25",
|
|
6892
|
-
className:
|
|
7236
|
+
className: refractionInputClass,
|
|
6893
7237
|
value: safe.dilated_refraction.left_eye.cyl ?? "",
|
|
6894
7238
|
onChange: (e) => setRefractionField(
|
|
6895
7239
|
"dilated_refraction",
|
|
@@ -6900,12 +7244,12 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6900
7244
|
)
|
|
6901
7245
|
}
|
|
6902
7246
|
) }),
|
|
6903
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7247
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6904
7248
|
Input,
|
|
6905
7249
|
{
|
|
6906
7250
|
disabled,
|
|
6907
7251
|
type: "number",
|
|
6908
|
-
className:
|
|
7252
|
+
className: refractionInputClass,
|
|
6909
7253
|
value: safe.dilated_refraction.left_eye.axis ?? "",
|
|
6910
7254
|
onChange: (e) => setRefractionField(
|
|
6911
7255
|
"dilated_refraction",
|
|
@@ -6916,13 +7260,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6916
7260
|
)
|
|
6917
7261
|
}
|
|
6918
7262
|
) }),
|
|
6919
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7263
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6920
7264
|
Input,
|
|
6921
7265
|
{
|
|
6922
7266
|
disabled,
|
|
6923
7267
|
type: "number",
|
|
6924
7268
|
step: "0.25",
|
|
6925
|
-
className:
|
|
7269
|
+
className: refractionInputClass,
|
|
6926
7270
|
value: safe.dilated_refraction.left_eye.prism ?? "",
|
|
6927
7271
|
onChange: (e) => setRefractionField(
|
|
6928
7272
|
"dilated_refraction",
|
|
@@ -6933,11 +7277,11 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6933
7277
|
)
|
|
6934
7278
|
}
|
|
6935
7279
|
) }),
|
|
6936
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7280
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
6937
7281
|
"select",
|
|
6938
7282
|
{
|
|
6939
7283
|
disabled,
|
|
6940
|
-
className:
|
|
7284
|
+
className: refractionSelectClass,
|
|
6941
7285
|
value: safe.dilated_refraction.left_eye.va,
|
|
6942
7286
|
onChange: (e) => setRefractionField(
|
|
6943
7287
|
"dilated_refraction",
|
|
@@ -6951,25 +7295,25 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6951
7295
|
) })
|
|
6952
7296
|
] }),
|
|
6953
7297
|
/* @__PURE__ */ jsxs("tr", { children: [
|
|
6954
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
6955
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7298
|
+
/* @__PURE__ */ jsx("td", { className: refractionLabelCellClass, children: "Add" }),
|
|
7299
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, colSpan: 5, children: /* @__PURE__ */ jsx(
|
|
6956
7300
|
Input,
|
|
6957
7301
|
{
|
|
6958
7302
|
disabled,
|
|
6959
7303
|
type: "number",
|
|
6960
7304
|
step: "0.25",
|
|
6961
|
-
className:
|
|
7305
|
+
className: refractionInputClass,
|
|
6962
7306
|
value: safe.dilated_refraction.add.right ?? "",
|
|
6963
7307
|
onChange: (e) => setRefractionAdd("dilated_refraction", "right", e.target.value)
|
|
6964
7308
|
}
|
|
6965
7309
|
) }),
|
|
6966
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7310
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, colSpan: 5, children: /* @__PURE__ */ jsx(
|
|
6967
7311
|
Input,
|
|
6968
7312
|
{
|
|
6969
7313
|
disabled,
|
|
6970
7314
|
type: "number",
|
|
6971
7315
|
step: "0.25",
|
|
6972
|
-
className:
|
|
7316
|
+
className: refractionInputClass,
|
|
6973
7317
|
value: safe.dilated_refraction.add.left ?? "",
|
|
6974
7318
|
onChange: (e) => setRefractionAdd("dilated_refraction", "left", e.target.value)
|
|
6975
7319
|
}
|
|
@@ -6980,37 +7324,50 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
6980
7324
|
] }),
|
|
6981
7325
|
/* @__PURE__ */ jsxs("section", { className: sectionWrapperClass, children: [
|
|
6982
7326
|
/* @__PURE__ */ jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsx("span", { children: "Glass Power Prescription" }) }),
|
|
6983
|
-
/* @__PURE__ */ jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxs("table", { className:
|
|
7327
|
+
/* @__PURE__ */ jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxs("table", { className: refractionTableClass, children: [
|
|
7328
|
+
/* @__PURE__ */ jsxs("colgroup", { children: [
|
|
7329
|
+
/* @__PURE__ */ jsx("col", { className: "w-[10%]" }),
|
|
7330
|
+
/* @__PURE__ */ jsx("col", { className: "w-[7%]" }),
|
|
7331
|
+
/* @__PURE__ */ jsx("col", { className: "w-[7%]" }),
|
|
7332
|
+
/* @__PURE__ */ jsx("col", { className: "w-[6%]" }),
|
|
7333
|
+
/* @__PURE__ */ jsx("col", { className: "w-[8%]" }),
|
|
7334
|
+
/* @__PURE__ */ jsx("col", { className: "w-[17%]" }),
|
|
7335
|
+
/* @__PURE__ */ jsx("col", { className: "w-[7%]" }),
|
|
7336
|
+
/* @__PURE__ */ jsx("col", { className: "w-[7%]" }),
|
|
7337
|
+
/* @__PURE__ */ jsx("col", { className: "w-[6%]" }),
|
|
7338
|
+
/* @__PURE__ */ jsx("col", { className: "w-[8%]" }),
|
|
7339
|
+
/* @__PURE__ */ jsx("col", { className: "w-[17%]" })
|
|
7340
|
+
] }),
|
|
6984
7341
|
/* @__PURE__ */ jsxs("thead", { children: [
|
|
6985
7342
|
/* @__PURE__ */ jsxs("tr", { children: [
|
|
6986
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6987
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6988
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
7343
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass }),
|
|
7344
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, colSpan: 5, children: "Right Eye" }),
|
|
7345
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, colSpan: 5, children: "Left Eye" })
|
|
6989
7346
|
] }),
|
|
6990
7347
|
/* @__PURE__ */ jsxs("tr", { children: [
|
|
6991
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6992
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6993
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6994
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6995
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6996
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6997
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6998
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
6999
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
7000
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
7001
|
-
/* @__PURE__ */ jsx("th", { className:
|
|
7348
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass }),
|
|
7349
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Sph" }),
|
|
7350
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Cyl" }),
|
|
7351
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Axis" }),
|
|
7352
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Prism" }),
|
|
7353
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "V/A" }),
|
|
7354
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Sph" }),
|
|
7355
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Cyl" }),
|
|
7356
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Axis" }),
|
|
7357
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "Prism" }),
|
|
7358
|
+
/* @__PURE__ */ jsx("th", { className: refractionHeaderCellClass, children: "V/A" })
|
|
7002
7359
|
] })
|
|
7003
7360
|
] }),
|
|
7004
7361
|
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
7005
7362
|
/* @__PURE__ */ jsxs("tr", { children: [
|
|
7006
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7007
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7363
|
+
/* @__PURE__ */ jsx("td", { className: refractionLabelCellClass, children: "Glass Power" }),
|
|
7364
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
7008
7365
|
Input,
|
|
7009
7366
|
{
|
|
7010
7367
|
disabled,
|
|
7011
7368
|
type: "number",
|
|
7012
7369
|
step: "0.25",
|
|
7013
|
-
className:
|
|
7370
|
+
className: refractionInputClass,
|
|
7014
7371
|
value: safe.glass_power_prescription.right_eye.sph ?? "",
|
|
7015
7372
|
onChange: (e) => setRefractionField(
|
|
7016
7373
|
"glass_power_prescription",
|
|
@@ -7021,13 +7378,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
7021
7378
|
)
|
|
7022
7379
|
}
|
|
7023
7380
|
) }),
|
|
7024
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7381
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
7025
7382
|
Input,
|
|
7026
7383
|
{
|
|
7027
7384
|
disabled,
|
|
7028
7385
|
type: "number",
|
|
7029
7386
|
step: "0.25",
|
|
7030
|
-
className:
|
|
7387
|
+
className: refractionInputClass,
|
|
7031
7388
|
value: safe.glass_power_prescription.right_eye.cyl ?? "",
|
|
7032
7389
|
onChange: (e) => setRefractionField(
|
|
7033
7390
|
"glass_power_prescription",
|
|
@@ -7038,12 +7395,12 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
7038
7395
|
)
|
|
7039
7396
|
}
|
|
7040
7397
|
) }),
|
|
7041
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7398
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
7042
7399
|
Input,
|
|
7043
7400
|
{
|
|
7044
7401
|
disabled,
|
|
7045
7402
|
type: "number",
|
|
7046
|
-
className:
|
|
7403
|
+
className: refractionInputClass,
|
|
7047
7404
|
value: safe.glass_power_prescription.right_eye.axis ?? "",
|
|
7048
7405
|
onChange: (e) => setRefractionField(
|
|
7049
7406
|
"glass_power_prescription",
|
|
@@ -7054,13 +7411,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
7054
7411
|
)
|
|
7055
7412
|
}
|
|
7056
7413
|
) }),
|
|
7057
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7414
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
7058
7415
|
Input,
|
|
7059
7416
|
{
|
|
7060
7417
|
disabled,
|
|
7061
7418
|
type: "number",
|
|
7062
7419
|
step: "0.25",
|
|
7063
|
-
className:
|
|
7420
|
+
className: refractionInputClass,
|
|
7064
7421
|
value: safe.glass_power_prescription.right_eye.prism ?? "",
|
|
7065
7422
|
onChange: (e) => setRefractionField(
|
|
7066
7423
|
"glass_power_prescription",
|
|
@@ -7071,11 +7428,11 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
7071
7428
|
)
|
|
7072
7429
|
}
|
|
7073
7430
|
) }),
|
|
7074
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7431
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
7075
7432
|
"select",
|
|
7076
7433
|
{
|
|
7077
7434
|
disabled,
|
|
7078
|
-
className:
|
|
7435
|
+
className: refractionSelectClass,
|
|
7079
7436
|
value: safe.glass_power_prescription.right_eye.va,
|
|
7080
7437
|
onChange: (e) => setRefractionField(
|
|
7081
7438
|
"glass_power_prescription",
|
|
@@ -7087,13 +7444,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
7087
7444
|
children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
|
|
7088
7445
|
}
|
|
7089
7446
|
) }),
|
|
7090
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7447
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
7091
7448
|
Input,
|
|
7092
7449
|
{
|
|
7093
7450
|
disabled,
|
|
7094
7451
|
type: "number",
|
|
7095
7452
|
step: "0.25",
|
|
7096
|
-
className:
|
|
7453
|
+
className: refractionInputClass,
|
|
7097
7454
|
value: safe.glass_power_prescription.left_eye.sph ?? "",
|
|
7098
7455
|
onChange: (e) => setRefractionField(
|
|
7099
7456
|
"glass_power_prescription",
|
|
@@ -7104,13 +7461,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
7104
7461
|
)
|
|
7105
7462
|
}
|
|
7106
7463
|
) }),
|
|
7107
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7464
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
7108
7465
|
Input,
|
|
7109
7466
|
{
|
|
7110
7467
|
disabled,
|
|
7111
7468
|
type: "number",
|
|
7112
7469
|
step: "0.25",
|
|
7113
|
-
className:
|
|
7470
|
+
className: refractionInputClass,
|
|
7114
7471
|
value: safe.glass_power_prescription.left_eye.cyl ?? "",
|
|
7115
7472
|
onChange: (e) => setRefractionField(
|
|
7116
7473
|
"glass_power_prescription",
|
|
@@ -7121,12 +7478,12 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
7121
7478
|
)
|
|
7122
7479
|
}
|
|
7123
7480
|
) }),
|
|
7124
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7481
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
7125
7482
|
Input,
|
|
7126
7483
|
{
|
|
7127
7484
|
disabled,
|
|
7128
7485
|
type: "number",
|
|
7129
|
-
className:
|
|
7486
|
+
className: refractionInputClass,
|
|
7130
7487
|
value: safe.glass_power_prescription.left_eye.axis ?? "",
|
|
7131
7488
|
onChange: (e) => setRefractionField(
|
|
7132
7489
|
"glass_power_prescription",
|
|
@@ -7137,13 +7494,13 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
7137
7494
|
)
|
|
7138
7495
|
}
|
|
7139
7496
|
) }),
|
|
7140
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7497
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
7141
7498
|
Input,
|
|
7142
7499
|
{
|
|
7143
7500
|
disabled,
|
|
7144
7501
|
type: "number",
|
|
7145
7502
|
step: "0.25",
|
|
7146
|
-
className:
|
|
7503
|
+
className: refractionInputClass,
|
|
7147
7504
|
value: safe.glass_power_prescription.left_eye.prism ?? "",
|
|
7148
7505
|
onChange: (e) => setRefractionField(
|
|
7149
7506
|
"glass_power_prescription",
|
|
@@ -7154,11 +7511,11 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
7154
7511
|
)
|
|
7155
7512
|
}
|
|
7156
7513
|
) }),
|
|
7157
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7514
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, children: /* @__PURE__ */ jsx(
|
|
7158
7515
|
"select",
|
|
7159
7516
|
{
|
|
7160
7517
|
disabled,
|
|
7161
|
-
className:
|
|
7518
|
+
className: refractionSelectClass,
|
|
7162
7519
|
value: safe.glass_power_prescription.left_eye.va,
|
|
7163
7520
|
onChange: (e) => setRefractionField(
|
|
7164
7521
|
"glass_power_prescription",
|
|
@@ -7172,25 +7529,25 @@ var OphthalmologyWidget = ({ fieldId }) => {
|
|
|
7172
7529
|
) })
|
|
7173
7530
|
] }),
|
|
7174
7531
|
/* @__PURE__ */ jsxs("tr", { children: [
|
|
7175
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7176
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7532
|
+
/* @__PURE__ */ jsx("td", { className: refractionLabelCellClass, children: "Add" }),
|
|
7533
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, colSpan: 5, children: /* @__PURE__ */ jsx(
|
|
7177
7534
|
Input,
|
|
7178
7535
|
{
|
|
7179
7536
|
disabled,
|
|
7180
7537
|
type: "number",
|
|
7181
7538
|
step: "0.25",
|
|
7182
|
-
className:
|
|
7539
|
+
className: refractionInputClass,
|
|
7183
7540
|
value: safe.glass_power_prescription.add.right ?? "",
|
|
7184
7541
|
onChange: (e) => setRefractionAdd("glass_power_prescription", "right", e.target.value)
|
|
7185
7542
|
}
|
|
7186
7543
|
) }),
|
|
7187
|
-
/* @__PURE__ */ jsx("td", { className:
|
|
7544
|
+
/* @__PURE__ */ jsx("td", { className: refractionDataCellClass, colSpan: 5, children: /* @__PURE__ */ jsx(
|
|
7188
7545
|
Input,
|
|
7189
7546
|
{
|
|
7190
7547
|
disabled,
|
|
7191
7548
|
type: "number",
|
|
7192
7549
|
step: "0.25",
|
|
7193
|
-
className:
|
|
7550
|
+
className: refractionInputClass,
|
|
7194
7551
|
value: safe.glass_power_prescription.add.left ?? "",
|
|
7195
7552
|
onChange: (e) => setRefractionAdd("glass_power_prescription", "left", e.target.value)
|
|
7196
7553
|
}
|
|
@@ -7877,123 +8234,2083 @@ var DischargeMedicationOrdersWidget = ({ fieldId }) => {
|
|
|
7877
8234
|
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
7878
8235
|
] });
|
|
7879
8236
|
};
|
|
7880
|
-
var
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
8237
|
+
var DEFAULT_TOKEN_SEPARATOR = ", ";
|
|
8238
|
+
function getAppendSeparator(def) {
|
|
8239
|
+
const raw = def.meta && typeof def.meta.appendSeparator === "string" ? def.meta.appendSeparator : DEFAULT_TOKEN_SEPARATOR;
|
|
8240
|
+
return raw;
|
|
8241
|
+
}
|
|
8242
|
+
function getSuggestionTokensFromText(text) {
|
|
8243
|
+
return text.split(",").map((p) => p.trim()).filter(Boolean);
|
|
8244
|
+
}
|
|
8245
|
+
function toggleSuggestionTokenInText(current, token, separator = DEFAULT_TOKEN_SEPARATOR) {
|
|
8246
|
+
const t = String(token).trim();
|
|
8247
|
+
if (!t) return current;
|
|
8248
|
+
const parts = getSuggestionTokensFromText(current);
|
|
8249
|
+
const i = parts.findIndex((p) => p === t);
|
|
8250
|
+
if (i >= 0) {
|
|
8251
|
+
parts.splice(i, 1);
|
|
8252
|
+
} else {
|
|
8253
|
+
parts.push(t);
|
|
8254
|
+
}
|
|
8255
|
+
return parts.join(separator);
|
|
8256
|
+
}
|
|
8257
|
+
function isTokenSelected(text, optionValue) {
|
|
8258
|
+
const t = String(optionValue).trim();
|
|
8259
|
+
if (!t) return false;
|
|
8260
|
+
return getSuggestionTokensFromText(text).some((p) => p === t);
|
|
8261
|
+
}
|
|
8262
|
+
function deriveKnownSuggestionChipValues(text, options) {
|
|
8263
|
+
if (!options.length) return [];
|
|
8264
|
+
const allowed = new Map(options.map((o) => [String(o.value), o.value]));
|
|
8265
|
+
const tokens = getSuggestionTokensFromText(text);
|
|
8266
|
+
const out = [];
|
|
8267
|
+
const seen = /* @__PURE__ */ new Set();
|
|
8268
|
+
for (const t of tokens) {
|
|
8269
|
+
if (!allowed.has(t) || seen.has(t)) continue;
|
|
8270
|
+
seen.add(t);
|
|
8271
|
+
out.push(allowed.get(t));
|
|
8272
|
+
}
|
|
8273
|
+
return out;
|
|
8274
|
+
}
|
|
8275
|
+
function parallelChipArraysEqual(a, b) {
|
|
8276
|
+
if (!Array.isArray(a) || !Array.isArray(b)) return false;
|
|
8277
|
+
if (a.length !== b.length) return false;
|
|
8278
|
+
for (let i = 0; i < a.length; i++) {
|
|
8279
|
+
if (a[i] !== b[i]) return false;
|
|
7884
8280
|
}
|
|
7885
|
-
return
|
|
7886
|
-
}
|
|
7887
|
-
function
|
|
8281
|
+
return true;
|
|
8282
|
+
}
|
|
8283
|
+
function isSuggestionField(type) {
|
|
8284
|
+
return type === "suggestion_textarea" || type === "complaint_chips";
|
|
8285
|
+
}
|
|
8286
|
+
function EmbeddedSchemaField({ fieldId }) {
|
|
8287
|
+
const store = useFormStore();
|
|
8288
|
+
const fieldDef = store.getFieldDef(fieldId);
|
|
8289
|
+
if (!fieldDef) return null;
|
|
7888
8290
|
switch (fieldDef.type) {
|
|
7889
8291
|
case "text":
|
|
7890
8292
|
case "number":
|
|
7891
|
-
return /* @__PURE__ */ jsx(TextWidget, { fieldId });
|
|
7892
8293
|
case "textarea":
|
|
7893
|
-
if (fieldMetaRequestsMarMedicationOrdersButton(fieldDef.meta)) {
|
|
7894
|
-
return /* @__PURE__ */ jsx(MarMedicationOrdersWidget, { fieldId });
|
|
7895
|
-
}
|
|
7896
8294
|
return /* @__PURE__ */ jsx(TextWidget, { fieldId });
|
|
7897
|
-
case "richtext":
|
|
7898
|
-
return /* @__PURE__ */ jsx(RichTextWidget, { fieldId });
|
|
7899
|
-
case "date":
|
|
7900
|
-
return /* @__PURE__ */ jsx(DateWidget, { fieldId });
|
|
7901
|
-
case "datetime":
|
|
7902
|
-
return /* @__PURE__ */ jsx(DateTimeWidget, { fieldId });
|
|
7903
8295
|
case "select":
|
|
7904
8296
|
return /* @__PURE__ */ jsx(SelectWidget, { fieldId });
|
|
7905
|
-
case "radio":
|
|
7906
|
-
return /* @__PURE__ */ jsx(RadioWidget, { fieldId });
|
|
7907
|
-
case "checkbox":
|
|
7908
|
-
return /* @__PURE__ */ jsx(CheckboxWidget, { fieldId });
|
|
7909
|
-
case "multiselect":
|
|
7910
|
-
return /* @__PURE__ */ jsx(MultiSelectWidget, { fieldId });
|
|
7911
|
-
case "repeatable":
|
|
7912
|
-
return /* @__PURE__ */ jsx(RepeatableWidget, { fieldId });
|
|
7913
|
-
case "image_upload":
|
|
7914
|
-
return /* @__PURE__ */ jsx(ImageUploadWidget, { fieldId });
|
|
7915
|
-
case "media_upload":
|
|
7916
|
-
return /* @__PURE__ */ jsx(MediaUploadWidget, { fieldId });
|
|
7917
|
-
case "signature":
|
|
7918
|
-
return /* @__PURE__ */ jsx(SignatureUploadWidget, { fieldId });
|
|
7919
|
-
case "editable_table":
|
|
7920
|
-
return /* @__PURE__ */ jsx(EditableTableWidget, { fieldId });
|
|
7921
|
-
case "medications":
|
|
7922
|
-
return /* @__PURE__ */ jsx(AddMedicationWidget, { fieldId });
|
|
7923
|
-
case "discharge_medication_orders":
|
|
7924
|
-
return /* @__PURE__ */ jsx(DischargeMedicationOrdersWidget, { fieldId });
|
|
7925
|
-
case "investigations":
|
|
7926
|
-
return /* @__PURE__ */ jsx(AddInvestigationWidget, { fieldId });
|
|
7927
|
-
case "procedures":
|
|
7928
|
-
return /* @__PURE__ */ jsx(AddProcedureWidget, { fieldId });
|
|
7929
|
-
case "differential_diagnosis":
|
|
7930
|
-
return /* @__PURE__ */ jsx(DifferentialDiagnosisWidget, { fieldId });
|
|
7931
|
-
case "vitals":
|
|
7932
|
-
return /* @__PURE__ */ jsx(VitalsWidget, { fieldId });
|
|
7933
|
-
case "hidden_vitals":
|
|
7934
|
-
return /* @__PURE__ */ jsx(HiddenVitalsWidget, { fieldId });
|
|
7935
|
-
case "referral":
|
|
7936
|
-
return /* @__PURE__ */ jsx(ReferralWidget, { fieldId });
|
|
7937
|
-
case "followup":
|
|
7938
|
-
return /* @__PURE__ */ jsx(FollowupWidget, { fieldId });
|
|
7939
|
-
case "smart_textarea":
|
|
7940
|
-
return /* @__PURE__ */ jsx(SmartTextareaWidget, { fieldId });
|
|
7941
|
-
case "diagnosis_textarea":
|
|
7942
|
-
return /* @__PURE__ */ jsx(DiagnosisTextareaWidget, { fieldId });
|
|
7943
|
-
case "obstetric_history":
|
|
7944
|
-
return /* @__PURE__ */ jsx(ObstetricHistoryWidget, { fieldId });
|
|
7945
|
-
case "eye_prescription":
|
|
7946
|
-
return /* @__PURE__ */ jsx(OphthalmologyWidget, { fieldId });
|
|
7947
|
-
case "ophthal_diagnosis":
|
|
7948
|
-
return /* @__PURE__ */ jsx(OphthalDiagnosisWidget, { fieldId });
|
|
7949
|
-
case "orthopedic_exam":
|
|
7950
|
-
return /* @__PURE__ */ jsx(OrthopedicExamWidget, { fieldId });
|
|
7951
|
-
case "toggle": {
|
|
7952
|
-
const { value, setValue, setTouched, disabled } = useField(fieldId);
|
|
7953
|
-
const store = useFormStore();
|
|
7954
|
-
const excludes = fieldDef.excludes ?? [];
|
|
7955
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
7956
|
-
/* @__PURE__ */ jsx(
|
|
7957
|
-
Switch,
|
|
7958
|
-
{
|
|
7959
|
-
checked: value === true,
|
|
7960
|
-
disabled,
|
|
7961
|
-
onCheckedChange: (checked) => {
|
|
7962
|
-
setValue(checked);
|
|
7963
|
-
setTouched();
|
|
7964
|
-
if (checked) excludes.forEach((id) => store.setValue(id, false));
|
|
7965
|
-
}
|
|
7966
|
-
}
|
|
7967
|
-
),
|
|
7968
|
-
/* @__PURE__ */ jsx(Label, { className: "text-sm font-medium leading-none cursor-pointer select-none", children: fieldDef.label })
|
|
7969
|
-
] });
|
|
7970
|
-
}
|
|
7971
|
-
case "static_text": {
|
|
7972
|
-
const def = fieldDef;
|
|
7973
|
-
const size = def.size ?? "regular";
|
|
7974
|
-
const labelClass = size === "large" ? "text-base" : "text-sm";
|
|
7975
|
-
const descClass = size === "large" ? "text-sm" : "text-xs";
|
|
7976
|
-
return /* @__PURE__ */ jsxs("div", { className: `${labelClass} text-muted-foreground`, children: [
|
|
7977
|
-
def.label,
|
|
7978
|
-
def.description && /* @__PURE__ */ jsx("p", { className: `mt-1 ${descClass} opacity-90`, children: def.description })
|
|
7979
|
-
] });
|
|
7980
|
-
}
|
|
7981
8297
|
default:
|
|
7982
|
-
return
|
|
7983
|
-
"Unknown field type: ",
|
|
7984
|
-
fieldDef.type
|
|
7985
|
-
] });
|
|
8298
|
+
return null;
|
|
7986
8299
|
}
|
|
7987
8300
|
}
|
|
7988
|
-
var
|
|
7989
|
-
const
|
|
7990
|
-
const
|
|
7991
|
-
const
|
|
7992
|
-
|
|
7993
|
-
|
|
7994
|
-
);
|
|
7995
|
-
|
|
7996
|
-
|
|
8301
|
+
var SuggestionTextareaWidget = ({ fieldId }) => {
|
|
8302
|
+
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
8303
|
+
const { state } = useForm();
|
|
8304
|
+
const store = useFormStore();
|
|
8305
|
+
const hasVoice = !!(fieldDef?.voice && store.getVoice());
|
|
8306
|
+
const [options, setOptions] = useState([]);
|
|
8307
|
+
const [loading, setLoading] = useState(false);
|
|
8308
|
+
const showError = !!error && (touched || state.submitAttempted);
|
|
8309
|
+
const def = fieldDef && isSuggestionField(fieldDef.type) ? fieldDef : void 0;
|
|
8310
|
+
const textValue = value == null || typeof value === "string" ? value || "" : String(value);
|
|
8311
|
+
const parallelChipFieldId = def?.meta && typeof def.meta.parallelChipFieldId === "string" ? def.meta.parallelChipFieldId.trim() : void 0;
|
|
8312
|
+
const embeddedFieldIds = useMemo(() => {
|
|
8313
|
+
const raw = def?.meta && Array.isArray(def.meta.embeddedFieldIds) ? def.meta.embeddedFieldIds : [];
|
|
8314
|
+
return raw.filter((id) => typeof id === "string" && id.trim().length > 0).map((id) => id.trim()).filter((id) => store.getFieldDef(id));
|
|
8315
|
+
}, [def?.meta, store]);
|
|
8316
|
+
useEffect(() => {
|
|
8317
|
+
if (!def) {
|
|
8318
|
+
setOptions([]);
|
|
8319
|
+
return;
|
|
8320
|
+
}
|
|
8321
|
+
if (def.options?.length) {
|
|
8322
|
+
setOptions(def.options);
|
|
8323
|
+
} else if (def.dataSource) {
|
|
8324
|
+
setLoading(true);
|
|
8325
|
+
fetchOptions(def.dataSource.source, def.dataSource.params).then((opts) => setOptions(opts)).finally(() => setLoading(false));
|
|
8326
|
+
} else {
|
|
8327
|
+
setOptions([]);
|
|
8328
|
+
}
|
|
8329
|
+
}, [def]);
|
|
8330
|
+
useEffect(() => {
|
|
8331
|
+
if (!parallelChipFieldId || !def) return;
|
|
8332
|
+
const parallelDef = store.getFieldDef(parallelChipFieldId);
|
|
8333
|
+
if (!parallelDef || parallelDef.type !== "multiselect") return;
|
|
8334
|
+
const next = deriveKnownSuggestionChipValues(textValue, options);
|
|
8335
|
+
const prev = store.getFieldState(parallelChipFieldId).value;
|
|
8336
|
+
if (parallelChipArraysEqual(prev, next)) return;
|
|
8337
|
+
store.setValues({ [parallelChipFieldId]: next }, { touch: false });
|
|
8338
|
+
}, [def, parallelChipFieldId, textValue, options, store]);
|
|
8339
|
+
if (!def) {
|
|
8340
|
+
return null;
|
|
8341
|
+
}
|
|
8342
|
+
const appendSeparator = getAppendSeparator(def);
|
|
8343
|
+
const suggestionsAria = def.meta && typeof def.meta.suggestionsAriaLabel === "string" ? def.meta.suggestionsAriaLabel : "Quick suggestions";
|
|
8344
|
+
const theme = getThemeConfig("textarea", def.theme);
|
|
8345
|
+
const wrapperClass = theme?.wrapperClassName ?? "space-y-2";
|
|
8346
|
+
const labelClass = theme?.labelClassName;
|
|
8347
|
+
const inputClass = cn(theme?.inputClassName, showError && "border-red-500");
|
|
8348
|
+
const height = def.height != null ? typeof def.height === "string" ? Number(def.height) || void 0 : def.height : void 0;
|
|
8349
|
+
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8350
|
+
def.label,
|
|
8351
|
+
" ",
|
|
8352
|
+
def.required && /* @__PURE__ */ jsx("span", { className: "text-red-500", children: "*" })
|
|
8353
|
+
] });
|
|
8354
|
+
const labelEl = theme ? /* @__PURE__ */ jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { children: labelContent });
|
|
8355
|
+
const onChipClick = (optValue) => {
|
|
8356
|
+
if (disabled) return;
|
|
8357
|
+
setValue(toggleSuggestionTokenInText(textValue, String(optValue), appendSeparator));
|
|
8358
|
+
};
|
|
8359
|
+
const hasSuggestions = options.length > 0;
|
|
8360
|
+
const hasEmbedded = embeddedFieldIds.length > 0;
|
|
8361
|
+
const hasShell = hasSuggestions || hasEmbedded;
|
|
8362
|
+
const isHighlightLabel = def.theme === "highlight-label";
|
|
8363
|
+
const suggestionShellClass = cn(
|
|
8364
|
+
"flex min-w-0 flex-col overflow-hidden",
|
|
8365
|
+
hasShell && (isHighlightLabel ? "-mt-1 rounded-b-md border-[#D0D0D0] bg-white" : "rounded-md border border-input bg-background")
|
|
8366
|
+
);
|
|
8367
|
+
const chipsRowClass = cn(
|
|
8368
|
+
"flex flex-wrap gap-2 px-3 pb-2 pt-3",
|
|
8369
|
+
hasSuggestions && (isHighlightLabel ? "" : "border-b border-input/70"),
|
|
8370
|
+
disabled && "pointer-events-none opacity-50"
|
|
8371
|
+
);
|
|
8372
|
+
const embeddedRowClass = cn(
|
|
8373
|
+
"grid gap-3 px-3 sm:grid-cols-3",
|
|
8374
|
+
hasEmbedded && (hasSuggestions ? cn("py-2", isHighlightLabel && "border-t border-input/70") : "border-b border-input/70 py-3"),
|
|
8375
|
+
disabled && "pointer-events-none opacity-50"
|
|
8376
|
+
);
|
|
8377
|
+
const textareaShellClass = cn(
|
|
8378
|
+
inputClass,
|
|
8379
|
+
hasShell && cn(
|
|
8380
|
+
"mt-0 rounded-t-none rounded-b-md border-0 shadow-none focus-visible:ring-offset-0",
|
|
8381
|
+
isHighlightLabel ? "border-t-0" : "min-h-[80px]"
|
|
8382
|
+
)
|
|
8383
|
+
);
|
|
8384
|
+
const suggestionButtons = loading ? /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "Loading suggestions\u2026" }) : options.map((opt) => {
|
|
8385
|
+
const on = isTokenSelected(textValue, opt.value);
|
|
8386
|
+
return /* @__PURE__ */ jsx(
|
|
8387
|
+
"button",
|
|
8388
|
+
{
|
|
8389
|
+
type: "button",
|
|
8390
|
+
onClick: () => onChipClick(opt.value),
|
|
8391
|
+
className: cn(
|
|
8392
|
+
"inline-flex min-h-8 items-center rounded-full border px-3 py-1 text-xs font-medium leading-none transition-colors",
|
|
8393
|
+
on ? "border-primary bg-primary/10 text-primary" : "border-muted-foreground/30 bg-background hover:bg-muted/60"
|
|
8394
|
+
),
|
|
8395
|
+
children: opt.label
|
|
8396
|
+
},
|
|
8397
|
+
String(opt.value)
|
|
8398
|
+
);
|
|
8399
|
+
});
|
|
8400
|
+
return /* @__PURE__ */ jsxs("div", { className: wrapperClass, children: [
|
|
8401
|
+
hasVoice ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
8402
|
+
labelEl,
|
|
8403
|
+
/* @__PURE__ */ jsx(VoiceMicButton, { fieldId, onTranscriptReady: setValue })
|
|
8404
|
+
] }) : labelEl,
|
|
8405
|
+
def.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: def.description }),
|
|
8406
|
+
hasShell ? /* @__PURE__ */ jsxs("div", { className: suggestionShellClass, children: [
|
|
8407
|
+
hasSuggestions && /* @__PURE__ */ jsx("div", { className: chipsRowClass, role: "group", "aria-label": suggestionsAria, children: suggestionButtons }),
|
|
8408
|
+
hasEmbedded && /* @__PURE__ */ jsx("div", { className: embeddedRowClass, children: embeddedFieldIds.map((id) => /* @__PURE__ */ jsx(EmbeddedSchemaField, { fieldId: id }, id)) }),
|
|
8409
|
+
/* @__PURE__ */ jsx(
|
|
8410
|
+
Textarea,
|
|
8411
|
+
{
|
|
8412
|
+
id: fieldId,
|
|
8413
|
+
value: textValue,
|
|
8414
|
+
onChange: (e) => setValue(e.target.value),
|
|
8415
|
+
onBlur: setTouched,
|
|
8416
|
+
disabled,
|
|
8417
|
+
className: textareaShellClass,
|
|
8418
|
+
placeholder: def.placeholder,
|
|
8419
|
+
style: height != null && Number.isFinite(height) ? { minHeight: height } : void 0
|
|
8420
|
+
}
|
|
8421
|
+
)
|
|
8422
|
+
] }) : /* @__PURE__ */ jsx(
|
|
8423
|
+
Textarea,
|
|
8424
|
+
{
|
|
8425
|
+
id: fieldId,
|
|
8426
|
+
value: textValue,
|
|
8427
|
+
onChange: (e) => setValue(e.target.value),
|
|
8428
|
+
onBlur: setTouched,
|
|
8429
|
+
disabled,
|
|
8430
|
+
className: inputClass,
|
|
8431
|
+
placeholder: def.placeholder,
|
|
8432
|
+
style: height != null && Number.isFinite(height) ? { minHeight: height } : void 0
|
|
8433
|
+
}
|
|
8434
|
+
),
|
|
8435
|
+
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
8436
|
+
] });
|
|
8437
|
+
};
|
|
8438
|
+
var EMPTY_GRADES = { NO: 0, NC: 0, C: 0, PSC: 0 };
|
|
8439
|
+
var LOCS_FIELDS = [
|
|
8440
|
+
{ key: "NO", label: "Nuclear Opalescence", max: 4, hint: "0\u20134" },
|
|
8441
|
+
{ key: "NC", label: "Nuclear Colour", max: 4, hint: "0\u20134" },
|
|
8442
|
+
{ key: "C", label: "Cortical", max: 4, hint: "0\u20134" },
|
|
8443
|
+
{ key: "PSC", label: "Posterior Subcapsular", max: 4, hint: "0\u20134" }
|
|
8444
|
+
];
|
|
8445
|
+
var LOCS_GRID_STYLE = {
|
|
8446
|
+
display: "grid",
|
|
8447
|
+
gridTemplateColumns: "minmax(0, 1fr) minmax(5.5rem, auto) minmax(5.5rem, auto)",
|
|
8448
|
+
columnGap: "1rem",
|
|
8449
|
+
rowGap: "0.5rem",
|
|
8450
|
+
alignItems: "center",
|
|
8451
|
+
width: "100%",
|
|
8452
|
+
minWidth: 0
|
|
8453
|
+
};
|
|
8454
|
+
function parseGrades(raw) {
|
|
8455
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
|
|
8456
|
+
const r = raw;
|
|
8457
|
+
const n = (k) => {
|
|
8458
|
+
const v = Number(r[k]);
|
|
8459
|
+
return Number.isFinite(v) ? Math.trunc(v) : 0;
|
|
8460
|
+
};
|
|
8461
|
+
return { NO: n("NO"), NC: n("NC"), C: n("C"), PSC: n("PSC") };
|
|
8462
|
+
}
|
|
8463
|
+
function clampGrade(v) {
|
|
8464
|
+
return Math.max(0, Math.min(4, Math.trunc(v)));
|
|
8465
|
+
}
|
|
8466
|
+
function parseValue(raw) {
|
|
8467
|
+
const locs = {
|
|
8468
|
+
OD: { ...EMPTY_GRADES },
|
|
8469
|
+
OS: { ...EMPTY_GRADES }
|
|
8470
|
+
};
|
|
8471
|
+
if (raw && typeof raw === "object" && !Array.isArray(raw)) {
|
|
8472
|
+
const o = raw;
|
|
8473
|
+
const locsRaw = o.locs;
|
|
8474
|
+
if (locsRaw && typeof locsRaw === "object" && !Array.isArray(locsRaw)) {
|
|
8475
|
+
const L = locsRaw;
|
|
8476
|
+
const od = parseGrades(L.OD);
|
|
8477
|
+
const os = parseGrades(L.OS);
|
|
8478
|
+
if (od)
|
|
8479
|
+
locs.OD = {
|
|
8480
|
+
NO: clampGrade(od.NO),
|
|
8481
|
+
NC: clampGrade(od.NC),
|
|
8482
|
+
C: clampGrade(od.C),
|
|
8483
|
+
PSC: clampGrade(od.PSC)
|
|
8484
|
+
};
|
|
8485
|
+
if (os)
|
|
8486
|
+
locs.OS = {
|
|
8487
|
+
NO: clampGrade(os.NO),
|
|
8488
|
+
NC: clampGrade(os.NC),
|
|
8489
|
+
C: clampGrade(os.C),
|
|
8490
|
+
PSC: clampGrade(os.PSC)
|
|
8491
|
+
};
|
|
8492
|
+
}
|
|
8493
|
+
return {
|
|
8494
|
+
notes: typeof o.notes === "string" ? o.notes : "",
|
|
8495
|
+
assessmentKey: typeof o.assessmentKey === "string" ? o.assessmentKey : void 0,
|
|
8496
|
+
locs
|
|
8497
|
+
};
|
|
8498
|
+
}
|
|
8499
|
+
return { notes: "", assessmentKey: void 0, locs };
|
|
8500
|
+
}
|
|
8501
|
+
function cataractStage(eye, locs) {
|
|
8502
|
+
const g = locs[eye];
|
|
8503
|
+
const total = g.NO + g.NC + g.C + g.PSC;
|
|
8504
|
+
if (total === 0) return "\u2014";
|
|
8505
|
+
if (total <= 4) return "Early";
|
|
8506
|
+
if (total <= 8) return "Moderate";
|
|
8507
|
+
if (total <= 12) return "Advanced";
|
|
8508
|
+
return "Hypermature";
|
|
8509
|
+
}
|
|
8510
|
+
function Stepper({
|
|
8511
|
+
value,
|
|
8512
|
+
max,
|
|
8513
|
+
disabled,
|
|
8514
|
+
ariaLabel,
|
|
8515
|
+
onChange
|
|
8516
|
+
}) {
|
|
8517
|
+
return /* @__PURE__ */ jsxs(
|
|
8518
|
+
"div",
|
|
8519
|
+
{
|
|
8520
|
+
className: "flex items-center gap-1 justify-self-center",
|
|
8521
|
+
role: "group",
|
|
8522
|
+
"aria-label": ariaLabel,
|
|
8523
|
+
children: [
|
|
8524
|
+
/* @__PURE__ */ jsx(
|
|
8525
|
+
"button",
|
|
8526
|
+
{
|
|
8527
|
+
type: "button",
|
|
8528
|
+
disabled,
|
|
8529
|
+
onClick: () => onChange(Math.max(0, value - 1)),
|
|
8530
|
+
className: "h-6 w-6 shrink-0 rounded border border-input text-xs hover:bg-muted disabled:pointer-events-none disabled:opacity-50",
|
|
8531
|
+
children: "-"
|
|
8532
|
+
}
|
|
8533
|
+
),
|
|
8534
|
+
/* @__PURE__ */ jsx(
|
|
8535
|
+
"input",
|
|
8536
|
+
{
|
|
8537
|
+
type: "number",
|
|
8538
|
+
min: 0,
|
|
8539
|
+
max,
|
|
8540
|
+
disabled,
|
|
8541
|
+
value,
|
|
8542
|
+
"aria-label": ariaLabel,
|
|
8543
|
+
onChange: (e) => onChange(Math.max(0, Math.min(max, Number(e.target.value) || 0))),
|
|
8544
|
+
className: "h-6 w-10 shrink-0 rounded border border-input bg-background px-1 py-0 text-center text-xs disabled:opacity-50"
|
|
8545
|
+
}
|
|
8546
|
+
),
|
|
8547
|
+
/* @__PURE__ */ jsx(
|
|
8548
|
+
"button",
|
|
8549
|
+
{
|
|
8550
|
+
type: "button",
|
|
8551
|
+
disabled,
|
|
8552
|
+
onClick: () => onChange(Math.min(max, value + 1)),
|
|
8553
|
+
className: "h-6 w-6 shrink-0 rounded border border-input text-xs hover:bg-muted disabled:pointer-events-none disabled:opacity-50",
|
|
8554
|
+
children: "+"
|
|
8555
|
+
}
|
|
8556
|
+
)
|
|
8557
|
+
]
|
|
8558
|
+
}
|
|
8559
|
+
);
|
|
8560
|
+
}
|
|
8561
|
+
function StageBadge({ stage }) {
|
|
8562
|
+
const cls = {
|
|
8563
|
+
Early: "border border-emerald-200 text-foreground",
|
|
8564
|
+
Moderate: "border border-amber-200 text-foreground",
|
|
8565
|
+
Advanced: "border border-orange-300 text-foreground",
|
|
8566
|
+
Hypermature: "border border-destructive text-foreground",
|
|
8567
|
+
"\u2014": "border border-border text-muted-foreground"
|
|
8568
|
+
};
|
|
8569
|
+
return /* @__PURE__ */ jsx(
|
|
8570
|
+
"span",
|
|
8571
|
+
{
|
|
8572
|
+
className: cn(
|
|
8573
|
+
"rounded-full bg-background px-2 py-0.5 text-[11px] font-medium",
|
|
8574
|
+
cls[stage] ?? "border border-border text-muted-foreground"
|
|
8575
|
+
),
|
|
8576
|
+
children: stage
|
|
8577
|
+
}
|
|
8578
|
+
);
|
|
8579
|
+
}
|
|
8580
|
+
var DEFAULT_TITLE = "Lens Assessment \u2014 LOCS III";
|
|
8581
|
+
var LensAssessmentWidget = ({ fieldId }) => {
|
|
8582
|
+
const { fieldDef, value, setValue, error, disabled, touched } = useField(fieldId);
|
|
8583
|
+
const { state } = useForm();
|
|
8584
|
+
const showError = !!error && (touched || state.submitAttempted);
|
|
8585
|
+
if (!fieldDef || fieldDef.type !== "lens_assessment") {
|
|
8586
|
+
return null;
|
|
8587
|
+
}
|
|
8588
|
+
const def = fieldDef;
|
|
8589
|
+
const v = parseValue(value);
|
|
8590
|
+
const locs = v.locs ?? { OD: { ...EMPTY_GRADES }, OS: { ...EMPTY_GRADES } };
|
|
8591
|
+
const title = def.meta?.cardTitle || (def.label?.trim() ? def.label : DEFAULT_TITLE);
|
|
8592
|
+
const setPartial = (patch) => {
|
|
8593
|
+
setValue({ ...v, ...patch, locs: patch.locs ?? v.locs ?? locs });
|
|
8594
|
+
};
|
|
8595
|
+
const setLocs = (eye, key, n) => {
|
|
8596
|
+
const next = clampGrade(n);
|
|
8597
|
+
setPartial({
|
|
8598
|
+
locs: {
|
|
8599
|
+
...locs,
|
|
8600
|
+
[eye]: { ...locs[eye], [key]: next }
|
|
8601
|
+
}
|
|
8602
|
+
});
|
|
8603
|
+
};
|
|
8604
|
+
return /* @__PURE__ */ jsxs(
|
|
8605
|
+
"div",
|
|
8606
|
+
{
|
|
8607
|
+
id: `lens-assessment-${fieldId}`,
|
|
8608
|
+
className: "w-full min-w-0 max-w-full rounded-lg border border-border bg-card p-4 text-card-foreground shadow-sm",
|
|
8609
|
+
children: [
|
|
8610
|
+
/* @__PURE__ */ jsx("h3", { className: "mb-3 text-sm font-semibold text-foreground", children: title }),
|
|
8611
|
+
/* @__PURE__ */ jsxs("div", { style: LOCS_GRID_STYLE, children: [
|
|
8612
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0", "aria-hidden": true }),
|
|
8613
|
+
/* @__PURE__ */ jsx("div", { className: "w-24 justify-self-center text-center text-xs font-semibold", children: "Right Eye" }),
|
|
8614
|
+
/* @__PURE__ */ jsx("div", { className: "w-24 justify-self-center text-center text-xs font-semibold", children: "Left Eye" }),
|
|
8615
|
+
LOCS_FIELDS.map((f) => /* @__PURE__ */ jsxs("div", { style: { display: "contents" }, children: [
|
|
8616
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 text-xs", children: [
|
|
8617
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium", children: f.label }),
|
|
8618
|
+
/* @__PURE__ */ jsx("div", { className: "text-muted-foreground", children: f.hint })
|
|
8619
|
+
] }),
|
|
8620
|
+
/* @__PURE__ */ jsx(
|
|
8621
|
+
Stepper,
|
|
8622
|
+
{
|
|
8623
|
+
value: locs.OD[f.key],
|
|
8624
|
+
max: f.max,
|
|
8625
|
+
disabled,
|
|
8626
|
+
ariaLabel: `${f.label} right eye`,
|
|
8627
|
+
onChange: (n) => setLocs("OD", f.key, n)
|
|
8628
|
+
}
|
|
8629
|
+
),
|
|
8630
|
+
/* @__PURE__ */ jsx(
|
|
8631
|
+
Stepper,
|
|
8632
|
+
{
|
|
8633
|
+
value: locs.OS[f.key],
|
|
8634
|
+
max: f.max,
|
|
8635
|
+
disabled,
|
|
8636
|
+
ariaLabel: `${f.label} left eye`,
|
|
8637
|
+
onChange: (n) => setLocs("OS", f.key, n)
|
|
8638
|
+
}
|
|
8639
|
+
)
|
|
8640
|
+
] }, f.key))
|
|
8641
|
+
] }),
|
|
8642
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-3 border-t border-border pt-3 text-xs", children: [
|
|
8643
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Cataract Stage" }),
|
|
8644
|
+
" ",
|
|
8645
|
+
/* @__PURE__ */ jsxs("span", { className: "ml-1 inline-flex items-center gap-1", children: [
|
|
8646
|
+
"OD ",
|
|
8647
|
+
/* @__PURE__ */ jsx(StageBadge, { stage: cataractStage("OD", locs) })
|
|
8648
|
+
] }),
|
|
8649
|
+
/* @__PURE__ */ jsxs("span", { className: "ml-2 inline-flex items-center gap-1", children: [
|
|
8650
|
+
"OS ",
|
|
8651
|
+
/* @__PURE__ */ jsx(StageBadge, { stage: cataractStage("OS", locs) })
|
|
8652
|
+
] })
|
|
8653
|
+
] }),
|
|
8654
|
+
def.description && /* @__PURE__ */ jsx("p", { className: "mt-2 text-xs text-muted-foreground", children: def.description }),
|
|
8655
|
+
showError && /* @__PURE__ */ jsx("p", { className: "mt-2 text-xs text-red-500", children: error })
|
|
8656
|
+
]
|
|
8657
|
+
}
|
|
8658
|
+
);
|
|
8659
|
+
};
|
|
8660
|
+
|
|
8661
|
+
// src/core/functionalImpairmentScore.ts
|
|
8662
|
+
function clampFunctionalScore03(n) {
|
|
8663
|
+
const v = typeof n === "number" ? n : Number(n);
|
|
8664
|
+
if (!Number.isFinite(v)) return 0;
|
|
8665
|
+
return Math.max(0, Math.min(3, Math.trunc(v)));
|
|
8666
|
+
}
|
|
8667
|
+
function parseFunctionalImpairmentScore(raw) {
|
|
8668
|
+
const base = {
|
|
8669
|
+
reading: 0,
|
|
8670
|
+
nightDriving: 0,
|
|
8671
|
+
glare: 0,
|
|
8672
|
+
occupation: 0,
|
|
8673
|
+
adl: 0
|
|
8674
|
+
};
|
|
8675
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return base;
|
|
8676
|
+
const o = raw;
|
|
8677
|
+
for (const k of Object.keys(base)) {
|
|
8678
|
+
base[k] = clampFunctionalScore03(o[k]);
|
|
8679
|
+
}
|
|
8680
|
+
return base;
|
|
8681
|
+
}
|
|
8682
|
+
function functionalImpairmentTotal(v) {
|
|
8683
|
+
return v.reading + v.nightDriving + v.glare + v.occupation + v.adl;
|
|
8684
|
+
}
|
|
8685
|
+
var ITEMS = [
|
|
8686
|
+
{ key: "reading", label: "Difficulty reading" },
|
|
8687
|
+
{ key: "nightDriving", label: "Night driving difficulty" },
|
|
8688
|
+
{ key: "glare", label: "Glare sensitivity" },
|
|
8689
|
+
{ key: "occupation", label: "Occupational impact" },
|
|
8690
|
+
{ key: "adl", label: "ADL limitation" }
|
|
8691
|
+
];
|
|
8692
|
+
var SCALE_LABELS = ["None", "Mild", "Moderate", "Severe"];
|
|
8693
|
+
var DEFAULT_TITLE2 = "Functional Impairment Score (Stage 5)";
|
|
8694
|
+
var ITEMS_GRID_STYLE = {
|
|
8695
|
+
display: "grid",
|
|
8696
|
+
gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 8rem), 1fr))",
|
|
8697
|
+
columnGap: "0.5rem",
|
|
8698
|
+
rowGap: "0.5rem",
|
|
8699
|
+
width: "100%",
|
|
8700
|
+
minWidth: 0
|
|
8701
|
+
};
|
|
8702
|
+
function clamp03(n) {
|
|
8703
|
+
const v = typeof n === "number" ? n : Number(n);
|
|
8704
|
+
if (!Number.isFinite(v)) return 0;
|
|
8705
|
+
return Math.max(0, Math.min(3, Math.trunc(v)));
|
|
8706
|
+
}
|
|
8707
|
+
var FunctionalImpairmentScoreWidget = ({
|
|
8708
|
+
fieldId
|
|
8709
|
+
}) => {
|
|
8710
|
+
const { fieldDef, value, setValue, error, disabled, touched } = useField(fieldId);
|
|
8711
|
+
const { state } = useForm();
|
|
8712
|
+
const showError = !!error && (touched || state.submitAttempted);
|
|
8713
|
+
if (!fieldDef || fieldDef.type !== "functional_impairment_score") {
|
|
8714
|
+
return null;
|
|
8715
|
+
}
|
|
8716
|
+
const def = fieldDef;
|
|
8717
|
+
const v = parseFunctionalImpairmentScore(value);
|
|
8718
|
+
const total = functionalImpairmentTotal(v);
|
|
8719
|
+
const title = def.meta?.cardTitle?.trim() || (def.label?.trim() ? def.label : DEFAULT_TITLE2);
|
|
8720
|
+
const setDim = (key, n) => {
|
|
8721
|
+
setValue({ ...v, [key]: clamp03(n) });
|
|
8722
|
+
};
|
|
8723
|
+
return /* @__PURE__ */ jsxs(
|
|
8724
|
+
"div",
|
|
8725
|
+
{
|
|
8726
|
+
id: `functional-impairment-${fieldId}`,
|
|
8727
|
+
className: "w-full min-w-0 max-w-full rounded-lg border border-border bg-card p-3 text-card-foreground shadow-sm",
|
|
8728
|
+
children: [
|
|
8729
|
+
/* @__PURE__ */ jsx("h3", { className: "mb-2 text-xs font-semibold leading-tight text-foreground sm:text-[13px]", children: title }),
|
|
8730
|
+
/* @__PURE__ */ jsx("div", { style: ITEMS_GRID_STYLE, children: ITEMS.map((it) => /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [
|
|
8731
|
+
/* @__PURE__ */ jsx("div", { className: "text-[10px] font-medium leading-snug text-foreground sm:text-[11px]", children: it.label }),
|
|
8732
|
+
/* @__PURE__ */ jsx("div", { className: "flex w-fit max-w-full shrink-0 gap-0.5", children: [0, 1, 2, 3].map((score) => /* @__PURE__ */ jsx(
|
|
8733
|
+
"button",
|
|
8734
|
+
{
|
|
8735
|
+
type: "button",
|
|
8736
|
+
title: SCALE_LABELS[score],
|
|
8737
|
+
disabled,
|
|
8738
|
+
onClick: () => setDim(it.key, score),
|
|
8739
|
+
className: cn(
|
|
8740
|
+
"h-6 w-7 shrink-0 rounded border text-[10px] transition-colors sm:text-[11px]",
|
|
8741
|
+
v[it.key] === score ? "border-primary bg-primary text-primary-foreground" : "border-input hover:bg-muted",
|
|
8742
|
+
disabled && "pointer-events-none opacity-50"
|
|
8743
|
+
),
|
|
8744
|
+
children: score
|
|
8745
|
+
},
|
|
8746
|
+
score
|
|
8747
|
+
)) })
|
|
8748
|
+
] }, it.key)) }),
|
|
8749
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-2 flex flex-col gap-1.5 border-t border-border pt-2 sm:flex-row sm:items-center sm:justify-between sm:gap-2", children: [
|
|
8750
|
+
/* @__PURE__ */ jsx("div", { className: "text-[10px] leading-snug text-muted-foreground sm:text-[11px]", children: "Score scale: 0 = none, 3 = severe (each item)" }),
|
|
8751
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-1.5 sm:justify-end", children: [
|
|
8752
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground sm:text-[11px]", children: "Total" }),
|
|
8753
|
+
/* @__PURE__ */ jsxs("span", { className: "text-sm font-bold tabular-nums sm:text-[15px]", children: [
|
|
8754
|
+
total,
|
|
8755
|
+
/* @__PURE__ */ jsx("span", { className: "font-normal text-muted-foreground", children: "/15" })
|
|
8756
|
+
] })
|
|
8757
|
+
] })
|
|
8758
|
+
] }),
|
|
8759
|
+
def.description && /* @__PURE__ */ jsx("p", { className: "mt-2 text-xs text-muted-foreground", children: def.description }),
|
|
8760
|
+
showError && /* @__PURE__ */ jsx("p", { className: "mt-2 text-xs text-red-500", children: error })
|
|
8761
|
+
]
|
|
8762
|
+
}
|
|
8763
|
+
);
|
|
8764
|
+
};
|
|
8765
|
+
var FORMULA_OPTIONS = [
|
|
8766
|
+
"SRK/T",
|
|
8767
|
+
"Barrett Universal II",
|
|
8768
|
+
"Hoffer Q",
|
|
8769
|
+
"Haigis",
|
|
8770
|
+
"Holladay 1",
|
|
8771
|
+
"Holladay 2",
|
|
8772
|
+
"Kane"
|
|
8773
|
+
];
|
|
8774
|
+
var METHODS = [
|
|
8775
|
+
{ value: "optical_biometry", label: "Optical biometry (IOL Master)" },
|
|
8776
|
+
{ value: "ascan_immersion", label: "A-scan (immersion)" },
|
|
8777
|
+
{ value: "ascan_contact", label: "A-scan (contact)" }
|
|
8778
|
+
];
|
|
8779
|
+
var EMPTY = {
|
|
8780
|
+
axialLengthOD: "",
|
|
8781
|
+
axialLengthOS: "",
|
|
8782
|
+
k1k2AxisOD: "",
|
|
8783
|
+
k1k2AxisOS: "",
|
|
8784
|
+
anteriorChamberDepthOD: "",
|
|
8785
|
+
anteriorChamberDepthOS: "",
|
|
8786
|
+
iolPowerOD: "",
|
|
8787
|
+
iolPowerOS: "",
|
|
8788
|
+
targetRefractionOD: "",
|
|
8789
|
+
targetRefractionOS: "",
|
|
8790
|
+
formula: "SRK/T",
|
|
8791
|
+
method: "optical_biometry",
|
|
8792
|
+
cornealTopoUploaded: false,
|
|
8793
|
+
specularMicroscopyDone: false,
|
|
8794
|
+
endothelialCount: ""
|
|
8795
|
+
};
|
|
8796
|
+
function str(x) {
|
|
8797
|
+
return typeof x === "string" ? x : "";
|
|
8798
|
+
}
|
|
8799
|
+
function parseValue2(raw) {
|
|
8800
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return { ...EMPTY };
|
|
8801
|
+
const o = raw;
|
|
8802
|
+
const m = o.method;
|
|
8803
|
+
const method = m === "ascan_immersion" || m === "ascan_contact" || m === "optical_biometry" ? m : "optical_biometry";
|
|
8804
|
+
const formula = str(o.formula);
|
|
8805
|
+
return {
|
|
8806
|
+
...EMPTY,
|
|
8807
|
+
axialLengthOD: str(o.axialLengthOD),
|
|
8808
|
+
axialLengthOS: str(o.axialLengthOS),
|
|
8809
|
+
k1k2AxisOD: str(o.k1k2AxisOD),
|
|
8810
|
+
k1k2AxisOS: str(o.k1k2AxisOS),
|
|
8811
|
+
anteriorChamberDepthOD: str(o.anteriorChamberDepthOD),
|
|
8812
|
+
anteriorChamberDepthOS: str(o.anteriorChamberDepthOS),
|
|
8813
|
+
iolPowerOD: str(o.iolPowerOD),
|
|
8814
|
+
iolPowerOS: str(o.iolPowerOS),
|
|
8815
|
+
targetRefractionOD: str(o.targetRefractionOD),
|
|
8816
|
+
targetRefractionOS: str(o.targetRefractionOS),
|
|
8817
|
+
formula: formula || "SRK/T",
|
|
8818
|
+
method,
|
|
8819
|
+
cornealTopoUploaded: o.cornealTopoUploaded === true,
|
|
8820
|
+
specularMicroscopyDone: o.specularMicroscopyDone === true,
|
|
8821
|
+
endothelialCount: str(o.endothelialCount)
|
|
8822
|
+
};
|
|
8823
|
+
}
|
|
8824
|
+
var paramCell = "emr-biometry-param text-[11px] font-semibold leading-snug text-foreground sm:text-xs py-2";
|
|
8825
|
+
var eyeTh = "emr-biometry-eye text-center text-[11px] font-semibold sm:text-xs py-2";
|
|
8826
|
+
function Inp({
|
|
8827
|
+
value,
|
|
8828
|
+
onChange,
|
|
8829
|
+
disabled,
|
|
8830
|
+
placeholder
|
|
8831
|
+
}) {
|
|
8832
|
+
return /* @__PURE__ */ jsx(
|
|
8833
|
+
"input",
|
|
8834
|
+
{
|
|
8835
|
+
value,
|
|
8836
|
+
disabled,
|
|
8837
|
+
placeholder,
|
|
8838
|
+
onChange: (e) => onChange(e.target.value),
|
|
8839
|
+
className: "box-border w-full min-w-0 rounded border border-input bg-background px-2 py-1 text-[11px] sm:text-xs"
|
|
8840
|
+
}
|
|
8841
|
+
);
|
|
8842
|
+
}
|
|
8843
|
+
var DEFAULT_TITLE3 = "Biometry & IOL Workup (Stage 7)";
|
|
8844
|
+
var BiometryIolWorkupWidget = ({ fieldId }) => {
|
|
8845
|
+
const { fieldDef, value, setValue, error, disabled, touched } = useField(fieldId);
|
|
8846
|
+
const { state } = useForm();
|
|
8847
|
+
const showError = !!error && (touched || state.submitAttempted);
|
|
8848
|
+
if (!fieldDef || fieldDef.type !== "biometry_iol_workup") {
|
|
8849
|
+
return null;
|
|
8850
|
+
}
|
|
8851
|
+
const def = fieldDef;
|
|
8852
|
+
const v = parseValue2(value);
|
|
8853
|
+
const title = def.meta?.cardTitle?.trim() || (def.label?.trim() ? def.label : DEFAULT_TITLE3);
|
|
8854
|
+
const patch = (p) => setValue({ ...v, ...p });
|
|
8855
|
+
return /* @__PURE__ */ jsxs(
|
|
8856
|
+
"div",
|
|
8857
|
+
{
|
|
8858
|
+
id: `biometry-iol-${fieldId}`,
|
|
8859
|
+
className: "w-full min-w-0 max-w-full self-stretch rounded-lg border border-border bg-card p-3 text-card-foreground shadow-sm",
|
|
8860
|
+
children: [
|
|
8861
|
+
/* @__PURE__ */ jsx("h3", { className: "mb-2.5 text-sm font-semibold leading-tight text-foreground", children: title }),
|
|
8862
|
+
/* @__PURE__ */ jsx("div", { className: "w-full min-w-0 overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { className: "emr-table emr-table--biometry min-w-full", children: [
|
|
8863
|
+
/* @__PURE__ */ jsxs("colgroup", { children: [
|
|
8864
|
+
/* @__PURE__ */ jsx("col", { style: { width: "32%" } }),
|
|
8865
|
+
/* @__PURE__ */ jsx("col", { style: { width: "34%" } }),
|
|
8866
|
+
/* @__PURE__ */ jsx("col", { style: { width: "34%" } })
|
|
8867
|
+
] }),
|
|
8868
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
8869
|
+
/* @__PURE__ */ jsx("th", { scope: "col", className: paramCell, children: "Parameter" }),
|
|
8870
|
+
/* @__PURE__ */ jsx("th", { scope: "col", className: eyeTh, children: "Right Eye" }),
|
|
8871
|
+
/* @__PURE__ */ jsx("th", { scope: "col", className: eyeTh, children: "Left Eye" })
|
|
8872
|
+
] }) }),
|
|
8873
|
+
/* @__PURE__ */ jsxs("tbody", { children: [
|
|
8874
|
+
/* @__PURE__ */ jsxs("tr", { children: [
|
|
8875
|
+
/* @__PURE__ */ jsx("td", { className: paramCell, children: "Axial Length (mm)" }),
|
|
8876
|
+
/* @__PURE__ */ jsx("td", { className: "emr-biometry-eye min-w-0 px-2 py-2", children: /* @__PURE__ */ jsx(
|
|
8877
|
+
Inp,
|
|
8878
|
+
{
|
|
8879
|
+
value: v.axialLengthOD,
|
|
8880
|
+
disabled,
|
|
8881
|
+
placeholder: "e.g. 23.45",
|
|
8882
|
+
onChange: (s) => patch({ axialLengthOD: s })
|
|
8883
|
+
}
|
|
8884
|
+
) }),
|
|
8885
|
+
/* @__PURE__ */ jsx("td", { className: "emr-biometry-eye min-w-0 px-2 py-2", children: /* @__PURE__ */ jsx(
|
|
8886
|
+
Inp,
|
|
8887
|
+
{
|
|
8888
|
+
value: v.axialLengthOS,
|
|
8889
|
+
disabled,
|
|
8890
|
+
placeholder: "e.g. 23.45",
|
|
8891
|
+
onChange: (s) => patch({ axialLengthOS: s })
|
|
8892
|
+
}
|
|
8893
|
+
) })
|
|
8894
|
+
] }),
|
|
8895
|
+
/* @__PURE__ */ jsxs("tr", { children: [
|
|
8896
|
+
/* @__PURE__ */ jsx("td", { className: paramCell, children: "K1 / K2 / Axis" }),
|
|
8897
|
+
/* @__PURE__ */ jsx("td", { className: "emr-biometry-eye min-w-0 px-2 py-2", children: /* @__PURE__ */ jsx(
|
|
8898
|
+
Inp,
|
|
8899
|
+
{
|
|
8900
|
+
value: v.k1k2AxisOD,
|
|
8901
|
+
disabled,
|
|
8902
|
+
placeholder: "44.0 / 44.5 / 90",
|
|
8903
|
+
onChange: (s) => patch({ k1k2AxisOD: s })
|
|
8904
|
+
}
|
|
8905
|
+
) }),
|
|
8906
|
+
/* @__PURE__ */ jsx("td", { className: "emr-biometry-eye min-w-0 px-2 py-2", children: /* @__PURE__ */ jsx(
|
|
8907
|
+
Inp,
|
|
8908
|
+
{
|
|
8909
|
+
value: v.k1k2AxisOS,
|
|
8910
|
+
disabled,
|
|
8911
|
+
placeholder: "44.0 / 44.5 / 90",
|
|
8912
|
+
onChange: (s) => patch({ k1k2AxisOS: s })
|
|
8913
|
+
}
|
|
8914
|
+
) })
|
|
8915
|
+
] }),
|
|
8916
|
+
/* @__PURE__ */ jsxs("tr", { children: [
|
|
8917
|
+
/* @__PURE__ */ jsx("td", { className: `${paramCell} whitespace-nowrap`, children: "Anterior Chamber Depth (mm)" }),
|
|
8918
|
+
/* @__PURE__ */ jsx("td", { className: "emr-biometry-eye min-w-0 px-2 py-2", children: /* @__PURE__ */ jsx(
|
|
8919
|
+
Inp,
|
|
8920
|
+
{
|
|
8921
|
+
value: v.anteriorChamberDepthOD,
|
|
8922
|
+
disabled,
|
|
8923
|
+
onChange: (s) => patch({ anteriorChamberDepthOD: s })
|
|
8924
|
+
}
|
|
8925
|
+
) }),
|
|
8926
|
+
/* @__PURE__ */ jsx("td", { className: "emr-biometry-eye min-w-0 px-2 py-2", children: /* @__PURE__ */ jsx(
|
|
8927
|
+
Inp,
|
|
8928
|
+
{
|
|
8929
|
+
value: v.anteriorChamberDepthOS,
|
|
8930
|
+
disabled,
|
|
8931
|
+
onChange: (s) => patch({ anteriorChamberDepthOS: s })
|
|
8932
|
+
}
|
|
8933
|
+
) })
|
|
8934
|
+
] }),
|
|
8935
|
+
/* @__PURE__ */ jsxs("tr", { children: [
|
|
8936
|
+
/* @__PURE__ */ jsx("td", { className: paramCell, children: "IOL Power (D)" }),
|
|
8937
|
+
/* @__PURE__ */ jsx("td", { className: "emr-biometry-eye min-w-0 px-2 py-2", children: /* @__PURE__ */ jsx(Inp, { value: v.iolPowerOD, disabled, onChange: (s) => patch({ iolPowerOD: s }) }) }),
|
|
8938
|
+
/* @__PURE__ */ jsx("td", { className: "emr-biometry-eye min-w-0 px-2 py-2", children: /* @__PURE__ */ jsx(Inp, { value: v.iolPowerOS, disabled, onChange: (s) => patch({ iolPowerOS: s }) }) })
|
|
8939
|
+
] }),
|
|
8940
|
+
/* @__PURE__ */ jsxs("tr", { children: [
|
|
8941
|
+
/* @__PURE__ */ jsx("td", { className: paramCell, children: "Target Refraction (D)" }),
|
|
8942
|
+
/* @__PURE__ */ jsx("td", { className: "emr-biometry-eye min-w-0 px-2 py-2", children: /* @__PURE__ */ jsx(
|
|
8943
|
+
Inp,
|
|
8944
|
+
{
|
|
8945
|
+
value: v.targetRefractionOD,
|
|
8946
|
+
disabled,
|
|
8947
|
+
placeholder: "e.g. -0.25",
|
|
8948
|
+
onChange: (s) => patch({ targetRefractionOD: s })
|
|
8949
|
+
}
|
|
8950
|
+
) }),
|
|
8951
|
+
/* @__PURE__ */ jsx("td", { className: "emr-biometry-eye min-w-0 px-2 py-2", children: /* @__PURE__ */ jsx(
|
|
8952
|
+
Inp,
|
|
8953
|
+
{
|
|
8954
|
+
value: v.targetRefractionOS,
|
|
8955
|
+
disabled,
|
|
8956
|
+
placeholder: "e.g. -0.25",
|
|
8957
|
+
onChange: (s) => patch({ targetRefractionOS: s })
|
|
8958
|
+
}
|
|
8959
|
+
) })
|
|
8960
|
+
] }),
|
|
8961
|
+
/* @__PURE__ */ jsxs("tr", { children: [
|
|
8962
|
+
/* @__PURE__ */ jsx("td", { className: paramCell, children: "Formula" }),
|
|
8963
|
+
/* @__PURE__ */ jsx("td", { className: "min-w-0 px-2 py-2 align-middle", colSpan: 2, children: /* @__PURE__ */ jsx(
|
|
8964
|
+
"select",
|
|
8965
|
+
{
|
|
8966
|
+
value: v.formula,
|
|
8967
|
+
disabled,
|
|
8968
|
+
onChange: (e) => patch({ formula: e.target.value }),
|
|
8969
|
+
className: "box-border w-full min-w-0 rounded border border-input bg-background px-2 py-1 text-[11px] sm:text-xs",
|
|
8970
|
+
children: FORMULA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt))
|
|
8971
|
+
}
|
|
8972
|
+
) })
|
|
8973
|
+
] }),
|
|
8974
|
+
/* @__PURE__ */ jsxs("tr", { children: [
|
|
8975
|
+
/* @__PURE__ */ jsx("td", { className: `${paramCell} align-top`, children: "Method" }),
|
|
8976
|
+
/* @__PURE__ */ jsx("td", { className: "min-w-0 px-2 py-2 align-middle", colSpan: 2, children: /* @__PURE__ */ jsx(
|
|
8977
|
+
"div",
|
|
8978
|
+
{
|
|
8979
|
+
role: "radiogroup",
|
|
8980
|
+
"aria-label": "Biometry method",
|
|
8981
|
+
className: "flex w-full flex-wrap items-center justify-center gap-x-3 gap-y-2 text-[11px] sm:gap-x-4 sm:text-xs",
|
|
8982
|
+
children: METHODS.map(({ value: mv, label }) => /* @__PURE__ */ jsxs("label", { className: "flex min-w-0 shrink-0 cursor-pointer items-center gap-1.5", children: [
|
|
8983
|
+
/* @__PURE__ */ jsx(
|
|
8984
|
+
"input",
|
|
8985
|
+
{
|
|
8986
|
+
type: "radio",
|
|
8987
|
+
name: `${fieldId}-biom-method`,
|
|
8988
|
+
value: mv,
|
|
8989
|
+
checked: v.method === mv,
|
|
8990
|
+
disabled,
|
|
8991
|
+
onChange: () => patch({ method: mv }),
|
|
8992
|
+
className: "shrink-0"
|
|
8993
|
+
}
|
|
8994
|
+
),
|
|
8995
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 whitespace-nowrap leading-tight", children: label })
|
|
8996
|
+
] }, mv))
|
|
8997
|
+
}
|
|
8998
|
+
) })
|
|
8999
|
+
] }),
|
|
9000
|
+
/* @__PURE__ */ jsxs("tr", { children: [
|
|
9001
|
+
/* @__PURE__ */ jsx("td", { className: `${paramCell} align-top text-muted-foreground`, children: "Optional workup" }),
|
|
9002
|
+
/* @__PURE__ */ jsx("td", { className: "min-w-0 px-2 py-2 align-middle", colSpan: 2, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
9003
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-center gap-x-4 gap-y-2 sm:justify-between", children: [
|
|
9004
|
+
/* @__PURE__ */ jsxs("label", { className: "inline-flex min-w-0 cursor-pointer items-center gap-1.5 text-[11px] leading-snug sm:text-xs", children: [
|
|
9005
|
+
/* @__PURE__ */ jsx(
|
|
9006
|
+
"input",
|
|
9007
|
+
{
|
|
9008
|
+
type: "checkbox",
|
|
9009
|
+
className: "shrink-0",
|
|
9010
|
+
checked: v.cornealTopoUploaded,
|
|
9011
|
+
disabled,
|
|
9012
|
+
onChange: (e) => patch({ cornealTopoUploaded: e.target.checked })
|
|
9013
|
+
}
|
|
9014
|
+
),
|
|
9015
|
+
/* @__PURE__ */ jsx("span", { children: "Corneal topography uploaded" })
|
|
9016
|
+
] }),
|
|
9017
|
+
/* @__PURE__ */ jsxs("label", { className: "inline-flex min-w-0 cursor-pointer items-center gap-1.5 text-[11px] leading-snug sm:text-xs", children: [
|
|
9018
|
+
/* @__PURE__ */ jsx(
|
|
9019
|
+
"input",
|
|
9020
|
+
{
|
|
9021
|
+
type: "checkbox",
|
|
9022
|
+
className: "shrink-0",
|
|
9023
|
+
checked: v.specularMicroscopyDone,
|
|
9024
|
+
disabled,
|
|
9025
|
+
onChange: (e) => patch({ specularMicroscopyDone: e.target.checked })
|
|
9026
|
+
}
|
|
9027
|
+
),
|
|
9028
|
+
/* @__PURE__ */ jsx("span", { children: "Specular microscopy done" })
|
|
9029
|
+
] })
|
|
9030
|
+
] }),
|
|
9031
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-end gap-2 text-[11px] sm:text-xs", children: [
|
|
9032
|
+
/* @__PURE__ */ jsx("span", { className: "shrink-0 text-muted-foreground", children: "Endothelial count:" }),
|
|
9033
|
+
/* @__PURE__ */ jsx(
|
|
9034
|
+
"input",
|
|
9035
|
+
{
|
|
9036
|
+
value: v.endothelialCount,
|
|
9037
|
+
disabled,
|
|
9038
|
+
placeholder: "cells/mm\xB2",
|
|
9039
|
+
onChange: (e) => patch({ endothelialCount: e.target.value }),
|
|
9040
|
+
className: "box-border w-[5.5rem] min-w-0 shrink-0 rounded border border-input bg-background px-2 py-1 text-[11px] sm:text-xs"
|
|
9041
|
+
}
|
|
9042
|
+
)
|
|
9043
|
+
] })
|
|
9044
|
+
] }) })
|
|
9045
|
+
] })
|
|
9046
|
+
] })
|
|
9047
|
+
] }) }),
|
|
9048
|
+
def.description && /* @__PURE__ */ jsx("p", { className: "mt-2 text-xs text-muted-foreground", children: def.description }),
|
|
9049
|
+
showError && /* @__PURE__ */ jsx("p", { className: "mt-2 text-xs text-red-500", children: error })
|
|
9050
|
+
]
|
|
9051
|
+
}
|
|
9052
|
+
);
|
|
9053
|
+
};
|
|
9054
|
+
var RISKS = [
|
|
9055
|
+
"Small pupil",
|
|
9056
|
+
"Pseudoexfoliation",
|
|
9057
|
+
"Diabetes",
|
|
9058
|
+
"Shallow AC",
|
|
9059
|
+
"Previous ocular surgery",
|
|
9060
|
+
"Zonular weakness",
|
|
9061
|
+
"Mature/white cataract"
|
|
9062
|
+
];
|
|
9063
|
+
var DIABETES = "Diabetes";
|
|
9064
|
+
function parseValue3(raw) {
|
|
9065
|
+
const empty = { OD: [], OS: [] };
|
|
9066
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return empty;
|
|
9067
|
+
const o = raw;
|
|
9068
|
+
const arr = (x) => Array.isArray(x) ? x.filter((i) => typeof i === "string") : [];
|
|
9069
|
+
let OD = arr(o.OD);
|
|
9070
|
+
let OS = arr(o.OS);
|
|
9071
|
+
const odD = OD.includes(DIABETES);
|
|
9072
|
+
const osD = OS.includes(DIABETES);
|
|
9073
|
+
if (odD !== osD) {
|
|
9074
|
+
if (odD && !osD) OS = [...OS, DIABETES];
|
|
9075
|
+
else if (osD && !odD) OD = [...OD, DIABETES];
|
|
9076
|
+
}
|
|
9077
|
+
return { OD, OS };
|
|
9078
|
+
}
|
|
9079
|
+
function riskTierForCount(n) {
|
|
9080
|
+
if (n === 0) return "Low";
|
|
9081
|
+
if (n <= 2) return "Moderate";
|
|
9082
|
+
return "High";
|
|
9083
|
+
}
|
|
9084
|
+
function tierBadgeClass(tier) {
|
|
9085
|
+
if (tier === "High") return "bg-red-600 text-white";
|
|
9086
|
+
if (tier === "Moderate") return "bg-amber-500 text-white";
|
|
9087
|
+
return "bg-emerald-600 text-white";
|
|
9088
|
+
}
|
|
9089
|
+
var DEFAULT_TITLE4 = "Surgical Risk Flags (Stage 11)";
|
|
9090
|
+
function RiskCol({
|
|
9091
|
+
eye,
|
|
9092
|
+
value,
|
|
9093
|
+
disabled,
|
|
9094
|
+
onToggle
|
|
9095
|
+
}) {
|
|
9096
|
+
const selected = new Set(value[eye]);
|
|
9097
|
+
const tier = riskTierForCount(selected.size);
|
|
9098
|
+
return /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
9099
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center justify-between gap-2", children: [
|
|
9100
|
+
/* @__PURE__ */ jsx("div", { className: "text-xs font-semibold text-foreground", children: eye === "OD" ? "Right Eye (OD)" : "Left Eye (OS)" }),
|
|
9101
|
+
/* @__PURE__ */ jsxs(
|
|
9102
|
+
"span",
|
|
9103
|
+
{
|
|
9104
|
+
className: cn(
|
|
9105
|
+
"whitespace-nowrap rounded-full px-2 py-0.5 text-[11px] font-medium",
|
|
9106
|
+
tierBadgeClass(tier)
|
|
9107
|
+
),
|
|
9108
|
+
children: [
|
|
9109
|
+
tier,
|
|
9110
|
+
" risk"
|
|
9111
|
+
]
|
|
9112
|
+
}
|
|
9113
|
+
)
|
|
9114
|
+
] }),
|
|
9115
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-1.5", children: RISKS.map((r) => /* @__PURE__ */ jsxs(
|
|
9116
|
+
"label",
|
|
9117
|
+
{
|
|
9118
|
+
className: "flex cursor-pointer items-center gap-2 rounded px-2 py-1 text-xs hover:bg-muted/50",
|
|
9119
|
+
children: [
|
|
9120
|
+
/* @__PURE__ */ jsx(
|
|
9121
|
+
"input",
|
|
9122
|
+
{
|
|
9123
|
+
type: "checkbox",
|
|
9124
|
+
className: "shrink-0",
|
|
9125
|
+
checked: selected.has(r),
|
|
9126
|
+
disabled,
|
|
9127
|
+
onChange: () => onToggle(eye, r)
|
|
9128
|
+
}
|
|
9129
|
+
),
|
|
9130
|
+
/* @__PURE__ */ jsx("span", { children: r })
|
|
9131
|
+
]
|
|
9132
|
+
},
|
|
9133
|
+
r
|
|
9134
|
+
)) })
|
|
9135
|
+
] });
|
|
9136
|
+
}
|
|
9137
|
+
var SurgicalRiskFlagsWidget = ({ fieldId }) => {
|
|
9138
|
+
const { fieldDef, value, setValue, error, disabled, touched } = useField(fieldId);
|
|
9139
|
+
const { state } = useForm();
|
|
9140
|
+
const showError = !!error && (touched || state.submitAttempted);
|
|
9141
|
+
if (!fieldDef || fieldDef.type !== "surgical_risk_flags") {
|
|
9142
|
+
return null;
|
|
9143
|
+
}
|
|
9144
|
+
const def = fieldDef;
|
|
9145
|
+
const v = parseValue3(value);
|
|
9146
|
+
const title = def.meta?.cardTitle?.trim() || (def.label?.trim() ? def.label : DEFAULT_TITLE4);
|
|
9147
|
+
const toggleRisk = (eye, risk) => {
|
|
9148
|
+
const next = {
|
|
9149
|
+
OD: [...v.OD],
|
|
9150
|
+
OS: [...v.OS]
|
|
9151
|
+
};
|
|
9152
|
+
if (risk === DIABETES) {
|
|
9153
|
+
const had = next.OD.includes(DIABETES) || next.OS.includes(DIABETES);
|
|
9154
|
+
if (had) {
|
|
9155
|
+
next.OD = next.OD.filter((x) => x !== DIABETES);
|
|
9156
|
+
next.OS = next.OS.filter((x) => x !== DIABETES);
|
|
9157
|
+
} else {
|
|
9158
|
+
if (!next.OD.includes(DIABETES)) next.OD.push(DIABETES);
|
|
9159
|
+
if (!next.OS.includes(DIABETES)) next.OS.push(DIABETES);
|
|
9160
|
+
}
|
|
9161
|
+
setValue(next);
|
|
9162
|
+
return;
|
|
9163
|
+
}
|
|
9164
|
+
const list = next[eye];
|
|
9165
|
+
const i = list.indexOf(risk);
|
|
9166
|
+
if (i === -1) list.push(risk);
|
|
9167
|
+
else list.splice(i, 1);
|
|
9168
|
+
setValue(next);
|
|
9169
|
+
};
|
|
9170
|
+
return /* @__PURE__ */ jsxs(
|
|
9171
|
+
"div",
|
|
9172
|
+
{
|
|
9173
|
+
id: `surgical-risk-flags-${fieldId}`,
|
|
9174
|
+
className: "w-full min-w-0 max-w-full rounded-lg border border-border bg-card p-3 text-card-foreground shadow-sm",
|
|
9175
|
+
children: [
|
|
9176
|
+
/* @__PURE__ */ jsx("h3", { className: "mb-3 text-sm font-semibold leading-tight text-foreground", children: title }),
|
|
9177
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-6", children: [
|
|
9178
|
+
/* @__PURE__ */ jsx(RiskCol, { eye: "OD", value: v, disabled, onToggle: toggleRisk }),
|
|
9179
|
+
/* @__PURE__ */ jsx("div", { className: "w-px shrink-0 bg-border", "aria-hidden": true }),
|
|
9180
|
+
/* @__PURE__ */ jsx(RiskCol, { eye: "OS", value: v, disabled, onToggle: toggleRisk })
|
|
9181
|
+
] }),
|
|
9182
|
+
def.description && /* @__PURE__ */ jsx("p", { className: "mt-2 text-xs text-muted-foreground", children: def.description }),
|
|
9183
|
+
showError && /* @__PURE__ */ jsx("p", { className: "mt-2 text-xs text-red-500", children: error })
|
|
9184
|
+
]
|
|
9185
|
+
}
|
|
9186
|
+
);
|
|
9187
|
+
};
|
|
9188
|
+
var SliderWidget = ({ fieldId }) => {
|
|
9189
|
+
const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
|
|
9190
|
+
const { state } = useForm();
|
|
9191
|
+
const showError = !!error && (touched || state.submitAttempted);
|
|
9192
|
+
if (!fieldDef || fieldDef.type !== "slider") return null;
|
|
9193
|
+
const def = fieldDef;
|
|
9194
|
+
const min = def.min ?? 0;
|
|
9195
|
+
const max = def.max ?? 10;
|
|
9196
|
+
const step = def.step ?? 1;
|
|
9197
|
+
const raw = value == null || value === "" ? min : Number(value);
|
|
9198
|
+
const num = Number.isFinite(raw) ? Math.min(max, Math.max(min, raw)) : min;
|
|
9199
|
+
const theme = getThemeConfig("textarea", def.theme);
|
|
9200
|
+
const wrapperClass = theme?.wrapperClassName ?? "space-y-2";
|
|
9201
|
+
const labelClass = theme?.labelClassName;
|
|
9202
|
+
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9203
|
+
def.label,
|
|
9204
|
+
" ",
|
|
9205
|
+
def.required && /* @__PURE__ */ jsx("span", { className: "text-red-500", children: "*" }),
|
|
9206
|
+
/* @__PURE__ */ jsxs("span", { className: "ml-2 text-muted-foreground font-normal tabular-nums", children: [
|
|
9207
|
+
num,
|
|
9208
|
+
"/",
|
|
9209
|
+
max
|
|
9210
|
+
] })
|
|
9211
|
+
] });
|
|
9212
|
+
const labelEl = theme ? /* @__PURE__ */ jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { children: labelContent });
|
|
9213
|
+
return /* @__PURE__ */ jsxs("div", { className: wrapperClass, children: [
|
|
9214
|
+
labelEl,
|
|
9215
|
+
/* @__PURE__ */ jsx(
|
|
9216
|
+
Slider,
|
|
9217
|
+
{
|
|
9218
|
+
className: cn("py-1", showError && "opacity-90 ring-1 ring-red-500 rounded"),
|
|
9219
|
+
disabled,
|
|
9220
|
+
min,
|
|
9221
|
+
max,
|
|
9222
|
+
step,
|
|
9223
|
+
value: [num],
|
|
9224
|
+
onValueChange: (v) => {
|
|
9225
|
+
const n = v[0] ?? min;
|
|
9226
|
+
setValue(n);
|
|
9227
|
+
setTouched();
|
|
9228
|
+
}
|
|
9229
|
+
}
|
|
9230
|
+
),
|
|
9231
|
+
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
9232
|
+
] });
|
|
9233
|
+
};
|
|
9234
|
+
var CHIEF_CHIPS_FIELD = "chief_complaints_chips";
|
|
9235
|
+
var SWELLING_OPTS = [
|
|
9236
|
+
{ value: "reducible_hernia", label: "Reducible (hernia)" },
|
|
9237
|
+
{ value: "cough_impulse", label: "Cough impulse" },
|
|
9238
|
+
{ value: "skin_changes", label: "Skin changes" }
|
|
9239
|
+
];
|
|
9240
|
+
var GI_OPTS = [
|
|
9241
|
+
{ value: "bleeding_pr", label: "Bleeding PR" },
|
|
9242
|
+
{ value: "vomiting", label: "Vomiting" },
|
|
9243
|
+
{ value: "haematemesis", label: "Haematemesis" }
|
|
9244
|
+
];
|
|
9245
|
+
var BREAST_OPTS = [
|
|
9246
|
+
{ value: "pain", label: "Pain" },
|
|
9247
|
+
{ value: "fh_ca_breast", label: "Family history of Ca breast" }
|
|
9248
|
+
];
|
|
9249
|
+
var ANO_OPTS = [
|
|
9250
|
+
{ value: "pain_defecation", label: "Pain during defecation" },
|
|
9251
|
+
{ value: "bleeding", label: "Bleeding" },
|
|
9252
|
+
{ value: "constipation", label: "Constipation" },
|
|
9253
|
+
{ value: "discharge", label: "Discharge" }
|
|
9254
|
+
];
|
|
9255
|
+
var THYROID_OPTS = [
|
|
9256
|
+
{ value: "dysphagia", label: "Dysphagia" },
|
|
9257
|
+
{ value: "voice_change", label: "Voice change" },
|
|
9258
|
+
{ value: "thyrotoxicosis", label: "Thyrotoxicosis symptoms" }
|
|
9259
|
+
];
|
|
9260
|
+
var SOCRATES_KEYS = [
|
|
9261
|
+
"site",
|
|
9262
|
+
"onset",
|
|
9263
|
+
"character",
|
|
9264
|
+
"radiation",
|
|
9265
|
+
"associated",
|
|
9266
|
+
"timing",
|
|
9267
|
+
"exacerbating"
|
|
9268
|
+
];
|
|
9269
|
+
function Panel({ title, children }) {
|
|
9270
|
+
return /* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-md border border-[#D0D0D0] bg-white", children: [
|
|
9271
|
+
/* @__PURE__ */ jsx("div", { className: "border-b border-[#D0D0D0] bg-[#FEE8EC]/50 px-3 py-1.5 text-xs font-semibold text-slate-700", children: title }),
|
|
9272
|
+
/* @__PURE__ */ jsx("div", { className: "p-3", children })
|
|
9273
|
+
] });
|
|
9274
|
+
}
|
|
9275
|
+
function chipList(state) {
|
|
9276
|
+
const raw = state.values[CHIEF_CHIPS_FIELD];
|
|
9277
|
+
return Array.isArray(raw) ? raw.filter((x) => typeof x === "string") : [];
|
|
9278
|
+
}
|
|
9279
|
+
var GsSmartHistoryWidget = ({ fieldId }) => {
|
|
9280
|
+
const { fieldDef, value, setValue, setTouched, error, touched, disabled } = useField(fieldId);
|
|
9281
|
+
const { state } = useForm();
|
|
9282
|
+
const showError = !!error && (touched || state.submitAttempted);
|
|
9283
|
+
const safe = useMemo(() => normalizeGeneralSurgerySmartHistory(value), [value]);
|
|
9284
|
+
const chips = useMemo(() => chipList(state), [state]);
|
|
9285
|
+
const showPain = chips.includes("pain");
|
|
9286
|
+
const showSwelling = chips.includes("swelling_lump");
|
|
9287
|
+
const showGI = chips.includes("bleeding") || chips.includes("obstruction");
|
|
9288
|
+
const showBreast = chips.includes("breast");
|
|
9289
|
+
const showAno = chips.includes("anorectal");
|
|
9290
|
+
const showThyroid = chips.includes("thyroid");
|
|
9291
|
+
const update = (next) => {
|
|
9292
|
+
setValue(next);
|
|
9293
|
+
setTouched();
|
|
9294
|
+
};
|
|
9295
|
+
const setPain = (key, v) => {
|
|
9296
|
+
if (key === "severity") {
|
|
9297
|
+
const n = typeof v === "number" ? v : Number(v);
|
|
9298
|
+
const sev = Number.isFinite(n) ? Math.min(10, Math.max(0, Math.round(n))) : 0;
|
|
9299
|
+
update({ ...safe, pain: { ...safe.pain, severity: sev } });
|
|
9300
|
+
return;
|
|
9301
|
+
}
|
|
9302
|
+
update({ ...safe, pain: { ...safe.pain, [key]: String(v) } });
|
|
9303
|
+
};
|
|
9304
|
+
const toggleArr = (section, val) => {
|
|
9305
|
+
if (section === "swelling") {
|
|
9306
|
+
const a = safe.swelling.checks;
|
|
9307
|
+
const next = a.includes(val) ? a.filter((x) => x !== val) : [...a, val];
|
|
9308
|
+
update({ ...safe, swelling: { ...safe.swelling, checks: next } });
|
|
9309
|
+
} else if (section === "gi") {
|
|
9310
|
+
const a = safe.gi.checks;
|
|
9311
|
+
const next = a.includes(val) ? a.filter((x) => x !== val) : [...a, val];
|
|
9312
|
+
update({ ...safe, gi: { ...safe.gi, checks: next } });
|
|
9313
|
+
} else if (section === "breast") {
|
|
9314
|
+
const a = safe.breast.checks;
|
|
9315
|
+
const next = a.includes(val) ? a.filter((x) => x !== val) : [...a, val];
|
|
9316
|
+
update({ ...safe, breast: { ...safe.breast, checks: next } });
|
|
9317
|
+
} else if (section === "ano") {
|
|
9318
|
+
const a = safe.ano.checks;
|
|
9319
|
+
const next = a.includes(val) ? a.filter((x) => x !== val) : [...a, val];
|
|
9320
|
+
update({ ...safe, ano: { ...safe.ano, checks: next } });
|
|
9321
|
+
} else {
|
|
9322
|
+
const a = safe.thyroid.checks;
|
|
9323
|
+
const next = a.includes(val) ? a.filter((x) => x !== val) : [...a, val];
|
|
9324
|
+
update({ ...safe, thyroid: { ...safe.thyroid, checks: next } });
|
|
9325
|
+
}
|
|
9326
|
+
};
|
|
9327
|
+
if (!fieldDef) return null;
|
|
9328
|
+
const theme = getThemeConfig("textarea", fieldDef.theme);
|
|
9329
|
+
const wrapperClass = theme?.wrapperClassName ?? "rounded-md overflow-hidden flex flex-col border border-[#D0D0D0]";
|
|
9330
|
+
const labelClass = theme?.labelClassName;
|
|
9331
|
+
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9332
|
+
fieldDef.label,
|
|
9333
|
+
fieldDef.required ? /* @__PURE__ */ jsx("span", { className: "ml-1 text-red-500", children: "*" }) : null
|
|
9334
|
+
] });
|
|
9335
|
+
const labelEl = theme ? /* @__PURE__ */ jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { className: "text-sm font-medium", children: labelContent });
|
|
9336
|
+
const bodyClass = cn(
|
|
9337
|
+
"-mt-1 flex min-w-0 flex-col gap-3 border-t border-[#D0D0D0] bg-white px-3 py-3",
|
|
9338
|
+
disabled && "pointer-events-none opacity-60"
|
|
9339
|
+
);
|
|
9340
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("w-full min-w-0", wrapperClass), children: [
|
|
9341
|
+
labelEl,
|
|
9342
|
+
/* @__PURE__ */ jsxs("div", { className: bodyClass, children: [
|
|
9343
|
+
showPain ? /* @__PURE__ */ jsx(Panel, { title: "SOCRATES \u2014 pain", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-2 md:grid-cols-4", children: [
|
|
9344
|
+
SOCRATES_KEYS.map((k) => /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
9345
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: k }),
|
|
9346
|
+
/* @__PURE__ */ jsx(
|
|
9347
|
+
Input,
|
|
9348
|
+
{
|
|
9349
|
+
className: "h-8 text-xs",
|
|
9350
|
+
value: safe.pain[k],
|
|
9351
|
+
onChange: (e) => setPain(k, e.target.value),
|
|
9352
|
+
disabled
|
|
9353
|
+
}
|
|
9354
|
+
)
|
|
9355
|
+
] }, k)),
|
|
9356
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
9357
|
+
/* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: "Severity 0\u201310" }),
|
|
9358
|
+
/* @__PURE__ */ jsx(
|
|
9359
|
+
Input,
|
|
9360
|
+
{
|
|
9361
|
+
type: "number",
|
|
9362
|
+
min: 0,
|
|
9363
|
+
max: 10,
|
|
9364
|
+
className: "h-8 text-xs",
|
|
9365
|
+
value: safe.pain.severity,
|
|
9366
|
+
onChange: (e) => setPain("severity", e.target.value),
|
|
9367
|
+
disabled
|
|
9368
|
+
}
|
|
9369
|
+
)
|
|
9370
|
+
] })
|
|
9371
|
+
] }) }) : null,
|
|
9372
|
+
showSwelling ? /* @__PURE__ */ jsxs(Panel, { title: "Swelling history", children: [
|
|
9373
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-3 text-xs md:grid-cols-3", children: [
|
|
9374
|
+
/* @__PURE__ */ jsxs("label", { className: "flex flex-col gap-1", children: [
|
|
9375
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: "Duration" }),
|
|
9376
|
+
/* @__PURE__ */ jsx(
|
|
9377
|
+
Input,
|
|
9378
|
+
{
|
|
9379
|
+
className: "h-8 text-xs",
|
|
9380
|
+
value: safe.swelling.duration,
|
|
9381
|
+
onChange: (e) => update({ ...safe, swelling: { ...safe.swelling, duration: e.target.value } }),
|
|
9382
|
+
disabled
|
|
9383
|
+
}
|
|
9384
|
+
)
|
|
9385
|
+
] }),
|
|
9386
|
+
/* @__PURE__ */ jsxs("label", { className: "flex flex-col gap-1", children: [
|
|
9387
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: "Size progression" }),
|
|
9388
|
+
/* @__PURE__ */ jsx(
|
|
9389
|
+
Input,
|
|
9390
|
+
{
|
|
9391
|
+
className: "h-8 text-xs",
|
|
9392
|
+
value: safe.swelling.sizeProgression,
|
|
9393
|
+
onChange: (e) => update({ ...safe, swelling: { ...safe.swelling, sizeProgression: e.target.value } }),
|
|
9394
|
+
disabled
|
|
9395
|
+
}
|
|
9396
|
+
)
|
|
9397
|
+
] }),
|
|
9398
|
+
/* @__PURE__ */ jsxs("label", { className: "flex flex-col gap-1", children: [
|
|
9399
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: "Painful / painless" }),
|
|
9400
|
+
/* @__PURE__ */ jsx(
|
|
9401
|
+
Input,
|
|
9402
|
+
{
|
|
9403
|
+
className: "h-8 text-xs",
|
|
9404
|
+
value: safe.swelling.painfulPainless,
|
|
9405
|
+
onChange: (e) => update({ ...safe, swelling: { ...safe.swelling, painfulPainless: e.target.value } }),
|
|
9406
|
+
disabled
|
|
9407
|
+
}
|
|
9408
|
+
)
|
|
9409
|
+
] })
|
|
9410
|
+
] }),
|
|
9411
|
+
/* @__PURE__ */ jsx("div", { className: "mt-3 flex flex-wrap gap-x-4 gap-y-2", children: SWELLING_OPTS.map((o) => /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 text-xs", children: [
|
|
9412
|
+
/* @__PURE__ */ jsx(
|
|
9413
|
+
Checkbox,
|
|
9414
|
+
{
|
|
9415
|
+
checked: safe.swelling.checks.includes(o.value),
|
|
9416
|
+
onCheckedChange: () => toggleArr("swelling", o.value),
|
|
9417
|
+
disabled
|
|
9418
|
+
}
|
|
9419
|
+
),
|
|
9420
|
+
o.label
|
|
9421
|
+
] }, o.value)) })
|
|
9422
|
+
] }) : null,
|
|
9423
|
+
showGI ? /* @__PURE__ */ jsxs(Panel, { title: "GI history", children: [
|
|
9424
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-2 text-xs md:grid-cols-3", children: [
|
|
9425
|
+
/* @__PURE__ */ jsxs("label", { className: "flex flex-col gap-1", children: [
|
|
9426
|
+
"Appetite",
|
|
9427
|
+
/* @__PURE__ */ jsx(
|
|
9428
|
+
Input,
|
|
9429
|
+
{
|
|
9430
|
+
className: "h-8 text-xs",
|
|
9431
|
+
value: safe.gi.appetite,
|
|
9432
|
+
onChange: (e) => update({ ...safe, gi: { ...safe.gi, appetite: e.target.value } }),
|
|
9433
|
+
disabled
|
|
9434
|
+
}
|
|
9435
|
+
)
|
|
9436
|
+
] }),
|
|
9437
|
+
/* @__PURE__ */ jsxs("label", { className: "flex flex-col gap-1", children: [
|
|
9438
|
+
"Weight loss",
|
|
9439
|
+
/* @__PURE__ */ jsx(
|
|
9440
|
+
Input,
|
|
9441
|
+
{
|
|
9442
|
+
className: "h-8 text-xs",
|
|
9443
|
+
value: safe.gi.weightLoss,
|
|
9444
|
+
onChange: (e) => update({ ...safe, gi: { ...safe.gi, weightLoss: e.target.value } }),
|
|
9445
|
+
disabled
|
|
9446
|
+
}
|
|
9447
|
+
)
|
|
9448
|
+
] }),
|
|
9449
|
+
/* @__PURE__ */ jsxs("label", { className: "flex flex-col gap-1", children: [
|
|
9450
|
+
"Bowel habits",
|
|
9451
|
+
/* @__PURE__ */ jsx(
|
|
9452
|
+
Input,
|
|
9453
|
+
{
|
|
9454
|
+
className: "h-8 text-xs",
|
|
9455
|
+
value: safe.gi.bowelHabits,
|
|
9456
|
+
onChange: (e) => update({ ...safe, gi: { ...safe.gi, bowelHabits: e.target.value } }),
|
|
9457
|
+
disabled
|
|
9458
|
+
}
|
|
9459
|
+
)
|
|
9460
|
+
] })
|
|
9461
|
+
] }),
|
|
9462
|
+
/* @__PURE__ */ jsx("div", { className: "mt-3 flex flex-wrap gap-x-4 gap-y-2", children: GI_OPTS.map((o) => /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 text-xs", children: [
|
|
9463
|
+
/* @__PURE__ */ jsx(
|
|
9464
|
+
Checkbox,
|
|
9465
|
+
{
|
|
9466
|
+
checked: safe.gi.checks.includes(o.value),
|
|
9467
|
+
onCheckedChange: () => toggleArr("gi", o.value),
|
|
9468
|
+
disabled
|
|
9469
|
+
}
|
|
9470
|
+
),
|
|
9471
|
+
o.label
|
|
9472
|
+
] }, o.value)) })
|
|
9473
|
+
] }) : null,
|
|
9474
|
+
showBreast ? /* @__PURE__ */ jsxs(Panel, { title: "Breast history", children: [
|
|
9475
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-2 text-xs md:grid-cols-2", children: [
|
|
9476
|
+
/* @__PURE__ */ jsxs("label", { className: "flex flex-col gap-1", children: [
|
|
9477
|
+
"Lump duration",
|
|
9478
|
+
/* @__PURE__ */ jsx(
|
|
9479
|
+
Input,
|
|
9480
|
+
{
|
|
9481
|
+
className: "h-8 text-xs",
|
|
9482
|
+
value: safe.breast.lumpDuration,
|
|
9483
|
+
onChange: (e) => update({ ...safe, breast: { ...safe.breast, lumpDuration: e.target.value } }),
|
|
9484
|
+
disabled
|
|
9485
|
+
}
|
|
9486
|
+
)
|
|
9487
|
+
] }),
|
|
9488
|
+
/* @__PURE__ */ jsxs("label", { className: "flex flex-col gap-1", children: [
|
|
9489
|
+
"Nipple discharge",
|
|
9490
|
+
/* @__PURE__ */ jsx(
|
|
9491
|
+
Input,
|
|
9492
|
+
{
|
|
9493
|
+
className: "h-8 text-xs",
|
|
9494
|
+
value: safe.breast.nippleDischarge,
|
|
9495
|
+
onChange: (e) => update({ ...safe, breast: { ...safe.breast, nippleDischarge: e.target.value } }),
|
|
9496
|
+
disabled
|
|
9497
|
+
}
|
|
9498
|
+
)
|
|
9499
|
+
] })
|
|
9500
|
+
] }),
|
|
9501
|
+
/* @__PURE__ */ jsx("div", { className: "mt-3 flex flex-wrap gap-x-4 gap-y-2", children: BREAST_OPTS.map((o) => /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 text-xs", children: [
|
|
9502
|
+
/* @__PURE__ */ jsx(
|
|
9503
|
+
Checkbox,
|
|
9504
|
+
{
|
|
9505
|
+
checked: safe.breast.checks.includes(o.value),
|
|
9506
|
+
onCheckedChange: () => toggleArr("breast", o.value),
|
|
9507
|
+
disabled
|
|
9508
|
+
}
|
|
9509
|
+
),
|
|
9510
|
+
o.label
|
|
9511
|
+
] }, o.value)) })
|
|
9512
|
+
] }) : null,
|
|
9513
|
+
showAno ? /* @__PURE__ */ jsx(Panel, { title: "Anorectal history", children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-2 text-xs md:grid-cols-2", children: ANO_OPTS.map((o) => /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
9514
|
+
/* @__PURE__ */ jsx(
|
|
9515
|
+
Checkbox,
|
|
9516
|
+
{
|
|
9517
|
+
checked: safe.ano.checks.includes(o.value),
|
|
9518
|
+
onCheckedChange: () => toggleArr("ano", o.value),
|
|
9519
|
+
disabled
|
|
9520
|
+
}
|
|
9521
|
+
),
|
|
9522
|
+
o.label
|
|
9523
|
+
] }, o.value)) }) }) : null,
|
|
9524
|
+
showThyroid ? /* @__PURE__ */ jsxs(Panel, { title: "Thyroid history", children: [
|
|
9525
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-2 text-xs md:grid-cols-2", children: /* @__PURE__ */ jsxs("label", { className: "flex flex-col gap-1 md:col-span-2", children: [
|
|
9526
|
+
"Swelling duration",
|
|
9527
|
+
/* @__PURE__ */ jsx(
|
|
9528
|
+
Input,
|
|
9529
|
+
{
|
|
9530
|
+
className: "h-8 text-xs",
|
|
9531
|
+
value: safe.thyroid.swellingDuration,
|
|
9532
|
+
onChange: (e) => update({ ...safe, thyroid: { ...safe.thyroid, swellingDuration: e.target.value } }),
|
|
9533
|
+
disabled
|
|
9534
|
+
}
|
|
9535
|
+
)
|
|
9536
|
+
] }) }),
|
|
9537
|
+
/* @__PURE__ */ jsx("div", { className: "mt-3 flex flex-wrap gap-x-4 gap-y-2", children: THYROID_OPTS.map((o) => /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 text-xs", children: [
|
|
9538
|
+
/* @__PURE__ */ jsx(
|
|
9539
|
+
Checkbox,
|
|
9540
|
+
{
|
|
9541
|
+
checked: safe.thyroid.checks.includes(o.value),
|
|
9542
|
+
onCheckedChange: () => toggleArr("thyroid", o.value),
|
|
9543
|
+
disabled
|
|
9544
|
+
}
|
|
9545
|
+
),
|
|
9546
|
+
o.label
|
|
9547
|
+
] }, o.value)) })
|
|
9548
|
+
] }) : null,
|
|
9549
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
9550
|
+
/* @__PURE__ */ jsx(Label, { className: "text-xs font-medium text-slate-700", children: "Systemic surgical screening" }),
|
|
9551
|
+
/* @__PURE__ */ jsx(
|
|
9552
|
+
Textarea,
|
|
9553
|
+
{
|
|
9554
|
+
className: "min-h-[72px] rounded-md border border-input bg-white text-sm",
|
|
9555
|
+
placeholder: "Fever, weight loss, appetite loss, fatigue, malignancy red flags\u2026",
|
|
9556
|
+
value: safe.systemic,
|
|
9557
|
+
onChange: (e) => update({ ...safe, systemic: e.target.value }),
|
|
9558
|
+
disabled
|
|
9559
|
+
}
|
|
9560
|
+
)
|
|
9561
|
+
] })
|
|
9562
|
+
] }),
|
|
9563
|
+
showError ? /* @__PURE__ */ jsx("p", { className: "px-3 pb-2 text-xs text-red-500", children: error }) : null
|
|
9564
|
+
] });
|
|
9565
|
+
};
|
|
9566
|
+
var GS_CLINICAL_EXAMINATION_FIELD = "clinical_examination";
|
|
9567
|
+
var GENERAL = [
|
|
9568
|
+
{ value: "pallor", label: "Pallor" },
|
|
9569
|
+
{ value: "icterus", label: "Icterus" },
|
|
9570
|
+
{ value: "cyanosis", label: "Cyanosis" },
|
|
9571
|
+
{ value: "clubbing", label: "Clubbing" },
|
|
9572
|
+
{ value: "lymphadenopathy", label: "Lymphadenopathy" },
|
|
9573
|
+
{ value: "oedema", label: "Oedema" }
|
|
9574
|
+
];
|
|
9575
|
+
var REGIONS = [
|
|
9576
|
+
{ key: "abdomen", label: "Abdomen" },
|
|
9577
|
+
{ key: "hernia", label: "Hernia" },
|
|
9578
|
+
{ key: "breast", label: "Breast" },
|
|
9579
|
+
{ key: "thyroid", label: "Thyroid" },
|
|
9580
|
+
{ key: "anorectal", label: "Anorectal" },
|
|
9581
|
+
{ key: "limb", label: "Limb / varicose" }
|
|
9582
|
+
];
|
|
9583
|
+
var ABD_INSP = [
|
|
9584
|
+
{ value: "distension", label: "Distension" },
|
|
9585
|
+
{ value: "scars", label: "Scars" },
|
|
9586
|
+
{ value: "visible_peristalsis", label: "Visible peristalsis" }
|
|
9587
|
+
];
|
|
9588
|
+
var ABD_PALP = [
|
|
9589
|
+
{ value: "tenderness", label: "Tenderness" },
|
|
9590
|
+
{ value: "guarding", label: "Guarding" },
|
|
9591
|
+
{ value: "rigidity", label: "Rigidity" },
|
|
9592
|
+
{ value: "mass", label: "Palpable mass" }
|
|
9593
|
+
];
|
|
9594
|
+
var ABD_PERC = [
|
|
9595
|
+
{ value: "tympany", label: "Tympany" },
|
|
9596
|
+
{ value: "shifting_dullness", label: "Shifting dullness" }
|
|
9597
|
+
];
|
|
9598
|
+
function SubGroup({ title, children }) {
|
|
9599
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
9600
|
+
/* @__PURE__ */ jsx("p", { className: "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: title }),
|
|
9601
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-2", children })
|
|
9602
|
+
] });
|
|
9603
|
+
}
|
|
9604
|
+
function RegionCard({ title, children }) {
|
|
9605
|
+
return /* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-md border border-[#D0D0D0] bg-white", children: [
|
|
9606
|
+
/* @__PURE__ */ jsx("div", { className: "border-b border-[#D0D0D0] bg-[#FEE8EC]/50 px-3 py-1.5 text-xs font-semibold text-slate-700", children: title }),
|
|
9607
|
+
/* @__PURE__ */ jsx("div", { className: "p-3", children })
|
|
9608
|
+
] });
|
|
9609
|
+
}
|
|
9610
|
+
var GsExaminationWidget = ({ fieldId }) => {
|
|
9611
|
+
const { fieldDef, value, setValue, setTouched, error, touched, disabled } = useField(fieldId);
|
|
9612
|
+
const clinicalField = useField(GS_CLINICAL_EXAMINATION_FIELD);
|
|
9613
|
+
const { state } = useForm();
|
|
9614
|
+
const showError = !!error && (touched || state.submitAttempted);
|
|
9615
|
+
const safe = useMemo(() => normalizeGeneralSurgeryExamination(value), [value]);
|
|
9616
|
+
const update = (next) => {
|
|
9617
|
+
setValue(next);
|
|
9618
|
+
setTouched();
|
|
9619
|
+
};
|
|
9620
|
+
const toggleIn = (arr, val) => arr.includes(val) ? arr.filter((x) => x !== val) : [...arr, val];
|
|
9621
|
+
const toggleGeneral = (val) => {
|
|
9622
|
+
update({ ...safe, general: toggleIn(safe.general, val) });
|
|
9623
|
+
};
|
|
9624
|
+
const toggleRegion = (key) => {
|
|
9625
|
+
update({ ...safe, regions: toggleIn(safe.regions, key) });
|
|
9626
|
+
};
|
|
9627
|
+
const toggleAbd = (key, val) => {
|
|
9628
|
+
update({
|
|
9629
|
+
...safe,
|
|
9630
|
+
abdomen: { ...safe.abdomen, [key]: toggleIn(safe.abdomen[key], val) }
|
|
9631
|
+
});
|
|
9632
|
+
};
|
|
9633
|
+
if (!fieldDef) return null;
|
|
9634
|
+
const has = (r) => safe.regions.includes(r);
|
|
9635
|
+
const theme = getThemeConfig("textarea", fieldDef.theme);
|
|
9636
|
+
const wrapperClass = theme?.wrapperClassName ?? "rounded-md overflow-hidden flex flex-col border border-[#D0D0D0]";
|
|
9637
|
+
const labelClass = theme?.labelClassName;
|
|
9638
|
+
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
9639
|
+
fieldDef.label,
|
|
9640
|
+
fieldDef.required ? /* @__PURE__ */ jsx("span", { className: "ml-1 text-red-500", children: "*" }) : null
|
|
9641
|
+
] });
|
|
9642
|
+
const labelEl = theme ? /* @__PURE__ */ jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { className: "text-sm font-medium", children: labelContent });
|
|
9643
|
+
const bodyClass = cn(
|
|
9644
|
+
"-mt-1 flex min-w-0 flex-col gap-3 border-t border-[#D0D0D0] bg-white px-3 py-3",
|
|
9645
|
+
disabled && "pointer-events-none opacity-60"
|
|
9646
|
+
);
|
|
9647
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("w-full min-w-0", wrapperClass), children: [
|
|
9648
|
+
labelEl,
|
|
9649
|
+
/* @__PURE__ */ jsxs("div", { className: bodyClass, children: [
|
|
9650
|
+
/* @__PURE__ */ jsxs("div", { className: "overflow-hidden rounded-md border border-[#D0D0D0] bg-white", children: [
|
|
9651
|
+
/* @__PURE__ */ jsx("div", { className: "border-b border-[#D0D0D0] bg-[#FEE8EC]/50 px-3 py-1.5 text-xs font-semibold text-slate-700", children: "General examination" }),
|
|
9652
|
+
/* @__PURE__ */ jsx("div", { className: "p-3", children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-2 text-xs md:grid-cols-3 lg:grid-cols-6", children: GENERAL.map((g) => /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
9653
|
+
/* @__PURE__ */ jsx(
|
|
9654
|
+
Checkbox,
|
|
9655
|
+
{
|
|
9656
|
+
checked: safe.general.includes(g.value),
|
|
9657
|
+
onCheckedChange: () => toggleGeneral(g.value),
|
|
9658
|
+
disabled
|
|
9659
|
+
}
|
|
9660
|
+
),
|
|
9661
|
+
g.label
|
|
9662
|
+
] }, g.value)) }) })
|
|
9663
|
+
] }),
|
|
9664
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
9665
|
+
/* @__PURE__ */ jsx("p", { className: "mb-2 text-xs font-semibold text-slate-700", children: "Regional examination \u2014 select region(s)" }),
|
|
9666
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: REGIONS.map((r) => {
|
|
9667
|
+
const on = safe.regions.includes(r.key);
|
|
9668
|
+
return /* @__PURE__ */ jsx(
|
|
9669
|
+
Button,
|
|
9670
|
+
{
|
|
9671
|
+
type: "button",
|
|
9672
|
+
size: "sm",
|
|
9673
|
+
variant: on ? "default" : "outline",
|
|
9674
|
+
className: "h-7 rounded-full px-3 text-xs",
|
|
9675
|
+
onClick: () => toggleRegion(r.key),
|
|
9676
|
+
disabled,
|
|
9677
|
+
children: r.label
|
|
9678
|
+
},
|
|
9679
|
+
r.key
|
|
9680
|
+
);
|
|
9681
|
+
}) })
|
|
9682
|
+
] }),
|
|
9683
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
9684
|
+
has("abdomen") ? /* @__PURE__ */ jsx(RegionCard, { title: "Abdomen \u2014 inspection \xB7 palpation \xB7 percussion \xB7 auscultation", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-4", children: [
|
|
9685
|
+
/* @__PURE__ */ jsx(SubGroup, { title: "Inspection", children: ABD_INSP.map((o) => /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 text-xs", children: [
|
|
9686
|
+
/* @__PURE__ */ jsx(
|
|
9687
|
+
Checkbox,
|
|
9688
|
+
{
|
|
9689
|
+
checked: safe.abdomen.inspection.includes(o.value),
|
|
9690
|
+
onCheckedChange: () => toggleAbd("inspection", o.value),
|
|
9691
|
+
disabled
|
|
9692
|
+
}
|
|
9693
|
+
),
|
|
9694
|
+
o.label
|
|
9695
|
+
] }, o.value)) }),
|
|
9696
|
+
/* @__PURE__ */ jsxs(SubGroup, { title: "Palpation", children: [
|
|
9697
|
+
ABD_PALP.map((o) => /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 text-xs", children: [
|
|
9698
|
+
/* @__PURE__ */ jsx(
|
|
9699
|
+
Checkbox,
|
|
9700
|
+
{
|
|
9701
|
+
checked: safe.abdomen.palpation.includes(o.value),
|
|
9702
|
+
onCheckedChange: () => toggleAbd("palpation", o.value),
|
|
9703
|
+
disabled
|
|
9704
|
+
}
|
|
9705
|
+
),
|
|
9706
|
+
o.label
|
|
9707
|
+
] }, o.value)),
|
|
9708
|
+
/* @__PURE__ */ jsxs("label", { className: "mt-2 block text-xs", children: [
|
|
9709
|
+
/* @__PURE__ */ jsx("span", { className: "mb-1 block font-medium", children: "Mass size / mobility" }),
|
|
9710
|
+
/* @__PURE__ */ jsx(
|
|
9711
|
+
Input,
|
|
9712
|
+
{
|
|
9713
|
+
className: "h-8 text-xs",
|
|
9714
|
+
value: safe.abdomen.massNotes,
|
|
9715
|
+
onChange: (e) => update({ ...safe, abdomen: { ...safe.abdomen, massNotes: e.target.value } }),
|
|
9716
|
+
disabled
|
|
9717
|
+
}
|
|
9718
|
+
)
|
|
9719
|
+
] })
|
|
9720
|
+
] }),
|
|
9721
|
+
/* @__PURE__ */ jsx(SubGroup, { title: "Percussion", children: ABD_PERC.map((o) => /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 text-xs", children: [
|
|
9722
|
+
/* @__PURE__ */ jsx(
|
|
9723
|
+
Checkbox,
|
|
9724
|
+
{
|
|
9725
|
+
checked: safe.abdomen.percussion.includes(o.value),
|
|
9726
|
+
onCheckedChange: () => toggleAbd("percussion", o.value),
|
|
9727
|
+
disabled
|
|
9728
|
+
}
|
|
9729
|
+
),
|
|
9730
|
+
o.label
|
|
9731
|
+
] }, o.value)) }),
|
|
9732
|
+
/* @__PURE__ */ jsxs(SubGroup, { title: "Auscultation", children: [
|
|
9733
|
+
/* @__PURE__ */ jsx("span", { className: "mb-1 block text-xs font-medium", children: "Bowel sounds" }),
|
|
9734
|
+
/* @__PURE__ */ jsxs(
|
|
9735
|
+
Select,
|
|
9736
|
+
{
|
|
9737
|
+
value: safe.abdomen.bowelSounds,
|
|
9738
|
+
onValueChange: (val) => update({
|
|
9739
|
+
...safe,
|
|
9740
|
+
abdomen: {
|
|
9741
|
+
...safe.abdomen,
|
|
9742
|
+
bowelSounds: val
|
|
9743
|
+
}
|
|
9744
|
+
}),
|
|
9745
|
+
disabled,
|
|
9746
|
+
children: [
|
|
9747
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select\u2026" }) }),
|
|
9748
|
+
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
9749
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "none", children: "\u2014" }),
|
|
9750
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "normal", children: "Normal" }),
|
|
9751
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "up", children: "\u2191" }),
|
|
9752
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "down", children: "\u2193" }),
|
|
9753
|
+
/* @__PURE__ */ jsx(SelectItem, { value: "absent", children: "Absent" })
|
|
9754
|
+
] })
|
|
9755
|
+
]
|
|
9756
|
+
}
|
|
9757
|
+
)
|
|
9758
|
+
] })
|
|
9759
|
+
] }) }) : null,
|
|
9760
|
+
has("hernia") ? /* @__PURE__ */ jsx(RegionCard, { title: "Hernia exam", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-3 text-xs md:grid-cols-4", children: [
|
|
9761
|
+
/* @__PURE__ */ jsxs("label", { className: "block", children: [
|
|
9762
|
+
/* @__PURE__ */ jsx("span", { className: "mb-1 block font-medium", children: "Site" }),
|
|
9763
|
+
/* @__PURE__ */ jsx(
|
|
9764
|
+
Input,
|
|
9765
|
+
{
|
|
9766
|
+
className: "h-8 text-xs",
|
|
9767
|
+
value: safe.hernia.site,
|
|
9768
|
+
onChange: (e) => update({ ...safe, hernia: { ...safe.hernia, site: e.target.value } }),
|
|
9769
|
+
disabled
|
|
9770
|
+
}
|
|
9771
|
+
)
|
|
9772
|
+
] }),
|
|
9773
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
9774
|
+
/* @__PURE__ */ jsx(
|
|
9775
|
+
Checkbox,
|
|
9776
|
+
{
|
|
9777
|
+
checked: safe.hernia.reducible,
|
|
9778
|
+
onCheckedChange: (c) => update({ ...safe, hernia: { ...safe.hernia, reducible: c === true } }),
|
|
9779
|
+
disabled
|
|
9780
|
+
}
|
|
9781
|
+
),
|
|
9782
|
+
"Reducible"
|
|
9783
|
+
] }),
|
|
9784
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
9785
|
+
/* @__PURE__ */ jsx(
|
|
9786
|
+
Checkbox,
|
|
9787
|
+
{
|
|
9788
|
+
checked: safe.hernia.coughImpulse,
|
|
9789
|
+
onCheckedChange: (c) => update({ ...safe, hernia: { ...safe.hernia, coughImpulse: c === true } }),
|
|
9790
|
+
disabled
|
|
9791
|
+
}
|
|
9792
|
+
),
|
|
9793
|
+
"Cough impulse"
|
|
9794
|
+
] }),
|
|
9795
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
9796
|
+
/* @__PURE__ */ jsx(
|
|
9797
|
+
Checkbox,
|
|
9798
|
+
{
|
|
9799
|
+
checked: safe.hernia.tenderness,
|
|
9800
|
+
onCheckedChange: (c) => update({ ...safe, hernia: { ...safe.hernia, tenderness: c === true } }),
|
|
9801
|
+
disabled
|
|
9802
|
+
}
|
|
9803
|
+
),
|
|
9804
|
+
"Tenderness"
|
|
9805
|
+
] })
|
|
9806
|
+
] }) }) : null,
|
|
9807
|
+
has("breast") ? /* @__PURE__ */ jsx(RegionCard, { title: "Breast exam", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-3 text-xs md:grid-cols-4", children: [
|
|
9808
|
+
/* @__PURE__ */ jsxs("label", { className: "block", children: [
|
|
9809
|
+
/* @__PURE__ */ jsx("span", { className: "mb-1 block font-medium", children: "Lump size (cm)" }),
|
|
9810
|
+
/* @__PURE__ */ jsx(
|
|
9811
|
+
Input,
|
|
9812
|
+
{
|
|
9813
|
+
className: "h-8 text-xs",
|
|
9814
|
+
value: safe.breast.lumpSizeCm,
|
|
9815
|
+
onChange: (e) => update({ ...safe, breast: { ...safe.breast, lumpSizeCm: e.target.value } }),
|
|
9816
|
+
disabled
|
|
9817
|
+
}
|
|
9818
|
+
)
|
|
9819
|
+
] }),
|
|
9820
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
9821
|
+
/* @__PURE__ */ jsx(
|
|
9822
|
+
Checkbox,
|
|
9823
|
+
{
|
|
9824
|
+
checked: safe.breast.mobile,
|
|
9825
|
+
onCheckedChange: (c) => update({ ...safe, breast: { ...safe.breast, mobile: c === true } }),
|
|
9826
|
+
disabled
|
|
9827
|
+
}
|
|
9828
|
+
),
|
|
9829
|
+
"Mobile"
|
|
9830
|
+
] }),
|
|
9831
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
9832
|
+
/* @__PURE__ */ jsx(
|
|
9833
|
+
Checkbox,
|
|
9834
|
+
{
|
|
9835
|
+
checked: safe.breast.skinInvolvement,
|
|
9836
|
+
onCheckedChange: (c) => update({ ...safe, breast: { ...safe.breast, skinInvolvement: c === true } }),
|
|
9837
|
+
disabled
|
|
9838
|
+
}
|
|
9839
|
+
),
|
|
9840
|
+
"Skin involvement"
|
|
9841
|
+
] }),
|
|
9842
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
9843
|
+
/* @__PURE__ */ jsx(
|
|
9844
|
+
Checkbox,
|
|
9845
|
+
{
|
|
9846
|
+
checked: safe.breast.axillaryNodes,
|
|
9847
|
+
onCheckedChange: (c) => update({ ...safe, breast: { ...safe.breast, axillaryNodes: c === true } }),
|
|
9848
|
+
disabled
|
|
9849
|
+
}
|
|
9850
|
+
),
|
|
9851
|
+
"Axillary nodes"
|
|
9852
|
+
] })
|
|
9853
|
+
] }) }) : null,
|
|
9854
|
+
has("thyroid") ? /* @__PURE__ */ jsx(RegionCard, { title: "Thyroid exam", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-3 text-xs md:grid-cols-4", children: [
|
|
9855
|
+
/* @__PURE__ */ jsxs("label", { className: "block", children: [
|
|
9856
|
+
/* @__PURE__ */ jsx("span", { className: "mb-1 block font-medium", children: "Size" }),
|
|
9857
|
+
/* @__PURE__ */ jsx(
|
|
9858
|
+
Input,
|
|
9859
|
+
{
|
|
9860
|
+
className: "h-8 text-xs",
|
|
9861
|
+
value: safe.thyroid.size,
|
|
9862
|
+
onChange: (e) => update({ ...safe, thyroid: { ...safe.thyroid, size: e.target.value } }),
|
|
9863
|
+
disabled
|
|
9864
|
+
}
|
|
9865
|
+
)
|
|
9866
|
+
] }),
|
|
9867
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
9868
|
+
/* @__PURE__ */ jsx(
|
|
9869
|
+
Checkbox,
|
|
9870
|
+
{
|
|
9871
|
+
checked: safe.thyroid.mobileDeglutition,
|
|
9872
|
+
onCheckedChange: (c) => update({ ...safe, thyroid: { ...safe.thyroid, mobileDeglutition: c === true } }),
|
|
9873
|
+
disabled
|
|
9874
|
+
}
|
|
9875
|
+
),
|
|
9876
|
+
"Mobile with deglutition"
|
|
9877
|
+
] }),
|
|
9878
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
9879
|
+
/* @__PURE__ */ jsx(
|
|
9880
|
+
Checkbox,
|
|
9881
|
+
{
|
|
9882
|
+
checked: safe.thyroid.nodules,
|
|
9883
|
+
onCheckedChange: (c) => update({ ...safe, thyroid: { ...safe.thyroid, nodules: c === true } }),
|
|
9884
|
+
disabled
|
|
9885
|
+
}
|
|
9886
|
+
),
|
|
9887
|
+
"Nodules"
|
|
9888
|
+
] }),
|
|
9889
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
9890
|
+
/* @__PURE__ */ jsx(
|
|
9891
|
+
Checkbox,
|
|
9892
|
+
{
|
|
9893
|
+
checked: safe.thyroid.cervicalNodes,
|
|
9894
|
+
onCheckedChange: (c) => update({ ...safe, thyroid: { ...safe.thyroid, cervicalNodes: c === true } }),
|
|
9895
|
+
disabled
|
|
9896
|
+
}
|
|
9897
|
+
),
|
|
9898
|
+
"Cervical lymph nodes"
|
|
9899
|
+
] })
|
|
9900
|
+
] }) }) : null,
|
|
9901
|
+
has("anorectal") ? /* @__PURE__ */ jsx(RegionCard, { title: "Anorectal exam", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-3 text-xs md:grid-cols-3", children: [
|
|
9902
|
+
/* @__PURE__ */ jsxs("label", { className: "block md:col-span-3", children: [
|
|
9903
|
+
/* @__PURE__ */ jsx("span", { className: "mb-1 block font-medium", children: "Inspection findings" }),
|
|
9904
|
+
/* @__PURE__ */ jsx(
|
|
9905
|
+
Input,
|
|
9906
|
+
{
|
|
9907
|
+
className: "h-8 text-xs",
|
|
9908
|
+
value: safe.anorectal.inspection,
|
|
9909
|
+
onChange: (e) => update({ ...safe, anorectal: { ...safe.anorectal, inspection: e.target.value } }),
|
|
9910
|
+
disabled
|
|
9911
|
+
}
|
|
9912
|
+
)
|
|
9913
|
+
] }),
|
|
9914
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
9915
|
+
/* @__PURE__ */ jsx(
|
|
9916
|
+
Checkbox,
|
|
9917
|
+
{
|
|
9918
|
+
checked: safe.anorectal.dreDone,
|
|
9919
|
+
onCheckedChange: (c) => update({ ...safe, anorectal: { ...safe.anorectal, dreDone: c === true } }),
|
|
9920
|
+
disabled
|
|
9921
|
+
}
|
|
9922
|
+
),
|
|
9923
|
+
"DRE done"
|
|
9924
|
+
] }),
|
|
9925
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
9926
|
+
/* @__PURE__ */ jsx(
|
|
9927
|
+
Checkbox,
|
|
9928
|
+
{
|
|
9929
|
+
checked: safe.anorectal.proctoscopyDone,
|
|
9930
|
+
onCheckedChange: (c) => update({ ...safe, anorectal: { ...safe.anorectal, proctoscopyDone: c === true } }),
|
|
9931
|
+
disabled
|
|
9932
|
+
}
|
|
9933
|
+
),
|
|
9934
|
+
"Proctoscopy done"
|
|
9935
|
+
] }),
|
|
9936
|
+
/* @__PURE__ */ jsxs("div", { className: "md:col-span-3", children: [
|
|
9937
|
+
/* @__PURE__ */ jsx(Label, { className: "text-xs font-semibold", children: "DRE / proctoscopy notes" }),
|
|
9938
|
+
/* @__PURE__ */ jsx(
|
|
9939
|
+
Textarea,
|
|
9940
|
+
{
|
|
9941
|
+
className: "mt-1 min-h-[64px] text-sm",
|
|
9942
|
+
placeholder: "Sphincter tone, masses, prostate, bleeding\u2026",
|
|
9943
|
+
value: safe.anorectal.notes,
|
|
9944
|
+
onChange: (e) => update({ ...safe, anorectal: { ...safe.anorectal, notes: e.target.value } }),
|
|
9945
|
+
disabled
|
|
9946
|
+
}
|
|
9947
|
+
)
|
|
9948
|
+
] })
|
|
9949
|
+
] }) }) : null,
|
|
9950
|
+
has("limb") ? /* @__PURE__ */ jsx(RegionCard, { title: "Limb / varicose veins", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-x-4 gap-y-2 text-xs", children: [
|
|
9951
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
9952
|
+
/* @__PURE__ */ jsx(
|
|
9953
|
+
Checkbox,
|
|
9954
|
+
{
|
|
9955
|
+
checked: safe.limb.dilatedVeins,
|
|
9956
|
+
onCheckedChange: (c) => update({ ...safe, limb: { ...safe.limb, dilatedVeins: c === true } }),
|
|
9957
|
+
disabled
|
|
9958
|
+
}
|
|
9959
|
+
),
|
|
9960
|
+
"Dilated veins"
|
|
9961
|
+
] }),
|
|
9962
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
9963
|
+
/* @__PURE__ */ jsx(
|
|
9964
|
+
Checkbox,
|
|
9965
|
+
{
|
|
9966
|
+
checked: safe.limb.ulcer,
|
|
9967
|
+
onCheckedChange: (c) => update({ ...safe, limb: { ...safe.limb, ulcer: c === true } }),
|
|
9968
|
+
disabled
|
|
9969
|
+
}
|
|
9970
|
+
),
|
|
9971
|
+
"Ulcer"
|
|
9972
|
+
] }),
|
|
9973
|
+
/* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2", children: [
|
|
9974
|
+
/* @__PURE__ */ jsx(
|
|
9975
|
+
Checkbox,
|
|
9976
|
+
{
|
|
9977
|
+
checked: safe.limb.oedema,
|
|
9978
|
+
onCheckedChange: (c) => update({ ...safe, limb: { ...safe.limb, oedema: c === true } }),
|
|
9979
|
+
disabled
|
|
9980
|
+
}
|
|
9981
|
+
),
|
|
9982
|
+
"Oedema"
|
|
9983
|
+
] })
|
|
9984
|
+
] }) }) : null
|
|
9985
|
+
] }),
|
|
9986
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
9987
|
+
/* @__PURE__ */ jsx(Label, { className: "text-xs font-semibold text-slate-700", children: clinicalField.fieldDef?.label ?? "Clinical examination" }),
|
|
9988
|
+
/* @__PURE__ */ jsx(
|
|
9989
|
+
Textarea,
|
|
9990
|
+
{
|
|
9991
|
+
className: "min-h-[88px] rounded-md border border-input bg-white text-sm",
|
|
9992
|
+
value: typeof clinicalField.value === "string" ? clinicalField.value : clinicalField.value == null ? "" : String(clinicalField.value),
|
|
9993
|
+
onChange: (e) => {
|
|
9994
|
+
clinicalField.setValue(e.target.value);
|
|
9995
|
+
clinicalField.setTouched();
|
|
9996
|
+
},
|
|
9997
|
+
disabled: disabled || clinicalField.disabled
|
|
9998
|
+
}
|
|
9999
|
+
)
|
|
10000
|
+
] })
|
|
10001
|
+
] }),
|
|
10002
|
+
showError ? /* @__PURE__ */ jsx("p", { className: "px-3 pb-2 text-xs text-red-500", children: error }) : null
|
|
10003
|
+
] });
|
|
10004
|
+
};
|
|
10005
|
+
var CHIEF_CHIPS_FIELD2 = "chief_complaints_chips";
|
|
10006
|
+
var GS_EXAMINATION_FIELD = "gs_examination";
|
|
10007
|
+
function chipList2(state) {
|
|
10008
|
+
const raw = state.values[CHIEF_CHIPS_FIELD2];
|
|
10009
|
+
return Array.isArray(raw) ? raw.filter((x) => typeof x === "string") : [];
|
|
10010
|
+
}
|
|
10011
|
+
function regionList(state) {
|
|
10012
|
+
const raw = state.values[GS_EXAMINATION_FIELD];
|
|
10013
|
+
const ex = normalizeGeneralSurgeryExamination(raw);
|
|
10014
|
+
return ex.regions;
|
|
10015
|
+
}
|
|
10016
|
+
var GsGradingWidget = ({ fieldId }) => {
|
|
10017
|
+
const { fieldDef, value, setValue, setTouched, error, touched, disabled } = useField(fieldId);
|
|
10018
|
+
const { state } = useForm();
|
|
10019
|
+
const showError = !!error && (touched || state.submitAttempted);
|
|
10020
|
+
const safe = useMemo(() => normalizeGeneralSurgeryGrading(value), [value]);
|
|
10021
|
+
const chips = useMemo(() => chipList2(state), [state]);
|
|
10022
|
+
const regions = useMemo(() => regionList(state), [state]);
|
|
10023
|
+
const visibleRows = useMemo(() => {
|
|
10024
|
+
return ALL_GS_CONDITIONS.filter(
|
|
10025
|
+
(c) => gsGradingRowVisible(c, chips, regions, safe[c] ?? 0)
|
|
10026
|
+
);
|
|
10027
|
+
}, [chips, regions, safe]);
|
|
10028
|
+
const update = (next) => {
|
|
10029
|
+
setValue(next);
|
|
10030
|
+
setTouched();
|
|
10031
|
+
};
|
|
10032
|
+
const setGrade = (cond, gradeStr) => {
|
|
10033
|
+
const n = Math.min(5, Math.max(0, Math.round(Number(gradeStr)) || 0));
|
|
10034
|
+
update({ ...safe, [cond]: n });
|
|
10035
|
+
};
|
|
10036
|
+
if (!fieldDef) return null;
|
|
10037
|
+
const theme = getThemeConfig("textarea", fieldDef.theme);
|
|
10038
|
+
const wrapperClass = theme?.wrapperClassName ?? "rounded-md overflow-hidden flex flex-col border border-[#D0D0D0]";
|
|
10039
|
+
const labelClass = theme?.labelClassName;
|
|
10040
|
+
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10041
|
+
fieldDef.label,
|
|
10042
|
+
fieldDef.required ? /* @__PURE__ */ jsx("span", { className: "ml-1 text-red-500", children: "*" }) : null
|
|
10043
|
+
] });
|
|
10044
|
+
const labelEl = theme ? /* @__PURE__ */ jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { className: "text-sm font-medium", children: labelContent });
|
|
10045
|
+
const bodyClass = cn(
|
|
10046
|
+
"-mt-1 flex min-w-0 flex-col gap-3 border-t border-[#D0D0D0] bg-white px-3 py-3",
|
|
10047
|
+
disabled && "pointer-events-none opacity-60"
|
|
10048
|
+
);
|
|
10049
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("w-full min-w-0", wrapperClass), children: [
|
|
10050
|
+
labelEl,
|
|
10051
|
+
/* @__PURE__ */ jsx("div", { className: bodyClass, children: visibleRows.length === 0 ? /* @__PURE__ */ jsx("div", { className: "rounded-md border border-dashed border-[#D0D0D0] bg-white p-6 text-center text-xs text-muted-foreground", children: "No conditions to grade yet. Select a chief complaint category or pick an examination region." }) : /* @__PURE__ */ jsx("div", { className: "overflow-x-auto rounded-md border border-[#D0D0D0]", children: /* @__PURE__ */ jsxs("table", { className: "w-full min-w-[520px] border-collapse text-xs", children: [
|
|
10052
|
+
/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "border-b border-[#D0D0D0] bg-[#FEE8EC]/50", children: [
|
|
10053
|
+
/* @__PURE__ */ jsx("th", { className: "px-3 py-2 text-left font-semibold text-slate-700", children: "Condition" }),
|
|
10054
|
+
/* @__PURE__ */ jsx("th", { className: "w-24 px-2 py-2 font-semibold text-slate-700", children: "Grade" }),
|
|
10055
|
+
/* @__PURE__ */ jsx("th", { className: "px-3 py-2 text-left font-semibold text-slate-700", children: "Description" })
|
|
10056
|
+
] }) }),
|
|
10057
|
+
/* @__PURE__ */ jsx("tbody", { className: "bg-white", children: visibleRows.map((c) => {
|
|
10058
|
+
const g = safe[c] ?? 0;
|
|
10059
|
+
const desc = GS_GRADE_DESCRIPTIONS[c][g] ?? "\u2014";
|
|
10060
|
+
return /* @__PURE__ */ jsxs("tr", { className: "border-b border-[#D0D0D0]/80 last:border-0", children: [
|
|
10061
|
+
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 font-medium", children: GS_CONDITION_LABELS[c] }),
|
|
10062
|
+
/* @__PURE__ */ jsx("td", { className: "px-2 py-1.5 align-middle", children: /* @__PURE__ */ jsxs(
|
|
10063
|
+
Select,
|
|
10064
|
+
{
|
|
10065
|
+
value: String(g),
|
|
10066
|
+
onValueChange: (v) => setGrade(c, v),
|
|
10067
|
+
disabled,
|
|
10068
|
+
children: [
|
|
10069
|
+
/* @__PURE__ */ jsx(SelectTrigger, { className: "h-8 text-xs", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
|
|
10070
|
+
/* @__PURE__ */ jsx(SelectContent, { children: [0, 1, 2, 3, 4, 5].map((n) => /* @__PURE__ */ jsx(SelectItem, { value: String(n), children: n === 0 ? "\u2014" : String(n) }, n)) })
|
|
10071
|
+
]
|
|
10072
|
+
}
|
|
10073
|
+
) }),
|
|
10074
|
+
/* @__PURE__ */ jsx("td", { className: "px-3 py-2 text-muted-foreground", children: desc })
|
|
10075
|
+
] }, c);
|
|
10076
|
+
}) })
|
|
10077
|
+
] }) }) }),
|
|
10078
|
+
showError ? /* @__PURE__ */ jsx("p", { className: "px-3 pb-2 text-xs text-red-500", children: error }) : null
|
|
10079
|
+
] });
|
|
10080
|
+
};
|
|
10081
|
+
function isFlagSelected(selected, optValue) {
|
|
10082
|
+
return selected.some((v) => v === optValue || String(v) === String(optValue));
|
|
10083
|
+
}
|
|
10084
|
+
var PainScaleFlagsWidget = ({ fieldId }) => {
|
|
10085
|
+
const { fieldDef, value, setValue, setTouched, error, touched, disabled } = useField(fieldId);
|
|
10086
|
+
const { state } = useForm();
|
|
10087
|
+
const showError = !!error && (touched || state.submitAttempted);
|
|
10088
|
+
if (!fieldDef || fieldDef.type !== "pain_scale_flags") return null;
|
|
10089
|
+
const def = fieldDef;
|
|
10090
|
+
const min = def.min ?? 0;
|
|
10091
|
+
const max = def.max ?? 10;
|
|
10092
|
+
const step = def.step ?? 1;
|
|
10093
|
+
const flagOptions = def.options ?? [];
|
|
10094
|
+
const safe = useMemo(
|
|
10095
|
+
() => normalizePainScaleFlags(value, { min, max }),
|
|
10096
|
+
[value, min, max]
|
|
10097
|
+
);
|
|
10098
|
+
const theme = getThemeConfig("textarea", def.theme);
|
|
10099
|
+
const wrapperClass = theme?.wrapperClassName ?? "space-y-2";
|
|
10100
|
+
const labelClass = theme?.labelClassName;
|
|
10101
|
+
const update = (next) => {
|
|
10102
|
+
setValue(normalizePainScaleFlags(next, { min, max }));
|
|
10103
|
+
setTouched();
|
|
10104
|
+
};
|
|
10105
|
+
const toggleFlag = (optValue) => {
|
|
10106
|
+
const sel = safe.flags;
|
|
10107
|
+
const isSelected = isFlagSelected(sel, optValue);
|
|
10108
|
+
const nextFlags = isSelected ? sel.filter((v) => v !== optValue && String(v) !== String(optValue)) : [...sel, String(optValue)];
|
|
10109
|
+
update({ pain: safe.pain, flags: nextFlags });
|
|
10110
|
+
};
|
|
10111
|
+
const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10112
|
+
def.label,
|
|
10113
|
+
" ",
|
|
10114
|
+
def.required && /* @__PURE__ */ jsx("span", { className: "text-red-500", children: "*" })
|
|
10115
|
+
] });
|
|
10116
|
+
const labelEl = theme ? /* @__PURE__ */ jsx(Label, { className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { children: labelContent });
|
|
10117
|
+
const bodyClass = cn(
|
|
10118
|
+
"-mt-1 flex min-w-0 flex-col border-t border-[#D0D0D0] bg-white px-3 py-3",
|
|
10119
|
+
disabled && "pointer-events-none opacity-60"
|
|
10120
|
+
);
|
|
10121
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(wrapperClass, "h-full min-h-0 flex flex-col"), children: [
|
|
10122
|
+
labelEl,
|
|
10123
|
+
def.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: def.description }),
|
|
10124
|
+
/* @__PURE__ */ jsx("div", { className: cn(bodyClass, "min-h-0 flex-1"), children: /* @__PURE__ */ jsxs("div", { className: "min-w-0 space-y-3", children: [
|
|
10125
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
10126
|
+
/* @__PURE__ */ jsxs(Label, { className: "text-sm font-medium text-slate-700", children: [
|
|
10127
|
+
"Pain score (VAS)",
|
|
10128
|
+
/* @__PURE__ */ jsxs("span", { className: "ml-2 font-normal tabular-nums text-muted-foreground", children: [
|
|
10129
|
+
safe.pain,
|
|
10130
|
+
"/",
|
|
10131
|
+
max
|
|
10132
|
+
] })
|
|
10133
|
+
] }),
|
|
10134
|
+
/* @__PURE__ */ jsx(
|
|
10135
|
+
Slider,
|
|
10136
|
+
{
|
|
10137
|
+
className: cn("py-1", showError && "rounded opacity-90 ring-1 ring-red-500"),
|
|
10138
|
+
disabled,
|
|
10139
|
+
min,
|
|
10140
|
+
max,
|
|
10141
|
+
step,
|
|
10142
|
+
value: [safe.pain],
|
|
10143
|
+
onValueChange: (v) => {
|
|
10144
|
+
const n = v[0] ?? min;
|
|
10145
|
+
update({ pain: n, flags: safe.flags });
|
|
10146
|
+
}
|
|
10147
|
+
}
|
|
10148
|
+
)
|
|
10149
|
+
] }),
|
|
10150
|
+
flagOptions.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "min-w-0 space-y-1.5", children: [
|
|
10151
|
+
/* @__PURE__ */ jsx(Label, { className: "text-sm font-medium text-slate-700", children: "Triage flags" }),
|
|
10152
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-x-4 gap-y-2", children: flagOptions.map((opt) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
10153
|
+
/* @__PURE__ */ jsx(
|
|
10154
|
+
Checkbox,
|
|
10155
|
+
{
|
|
10156
|
+
id: `${fieldId}-flag-${String(opt.value)}`,
|
|
10157
|
+
checked: isFlagSelected(safe.flags, opt.value),
|
|
10158
|
+
onCheckedChange: () => toggleFlag(opt.value),
|
|
10159
|
+
disabled
|
|
10160
|
+
}
|
|
10161
|
+
),
|
|
10162
|
+
/* @__PURE__ */ jsx(
|
|
10163
|
+
Label,
|
|
10164
|
+
{
|
|
10165
|
+
htmlFor: `${fieldId}-flag-${String(opt.value)}`,
|
|
10166
|
+
className: "cursor-pointer text-sm font-normal leading-none",
|
|
10167
|
+
children: opt.label
|
|
10168
|
+
}
|
|
10169
|
+
)
|
|
10170
|
+
] }, String(opt.value))) })
|
|
10171
|
+
] }) : null
|
|
10172
|
+
] }) }),
|
|
10173
|
+
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
10174
|
+
] });
|
|
10175
|
+
};
|
|
10176
|
+
var FieldRenderer = ({ fieldId }) => {
|
|
10177
|
+
const { fieldDef, visible } = useField(fieldId);
|
|
10178
|
+
if (!visible || !fieldDef) {
|
|
10179
|
+
return null;
|
|
10180
|
+
}
|
|
10181
|
+
return renderWidget(fieldId, fieldDef);
|
|
10182
|
+
};
|
|
10183
|
+
function renderWidget(fieldId, fieldDef) {
|
|
10184
|
+
switch (fieldDef.type) {
|
|
10185
|
+
case "text":
|
|
10186
|
+
case "number":
|
|
10187
|
+
return /* @__PURE__ */ jsx(TextWidget, { fieldId });
|
|
10188
|
+
case "slider":
|
|
10189
|
+
return /* @__PURE__ */ jsx(SliderWidget, { fieldId });
|
|
10190
|
+
case "textarea":
|
|
10191
|
+
if (fieldMetaRequestsMarMedicationOrdersButton(fieldDef.meta)) {
|
|
10192
|
+
return /* @__PURE__ */ jsx(MarMedicationOrdersWidget, { fieldId });
|
|
10193
|
+
}
|
|
10194
|
+
return /* @__PURE__ */ jsx(TextWidget, { fieldId });
|
|
10195
|
+
case "richtext":
|
|
10196
|
+
return /* @__PURE__ */ jsx(RichTextWidget, { fieldId });
|
|
10197
|
+
case "date":
|
|
10198
|
+
return /* @__PURE__ */ jsx(DateWidget, { fieldId });
|
|
10199
|
+
case "datetime":
|
|
10200
|
+
return /* @__PURE__ */ jsx(DateTimeWidget, { fieldId });
|
|
10201
|
+
case "select":
|
|
10202
|
+
return /* @__PURE__ */ jsx(SelectWidget, { fieldId });
|
|
10203
|
+
case "radio":
|
|
10204
|
+
return /* @__PURE__ */ jsx(RadioWidget, { fieldId });
|
|
10205
|
+
case "checkbox":
|
|
10206
|
+
return /* @__PURE__ */ jsx(CheckboxWidget, { fieldId });
|
|
10207
|
+
case "multiselect":
|
|
10208
|
+
return /* @__PURE__ */ jsx(MultiSelectWidget, { fieldId });
|
|
10209
|
+
case "repeatable":
|
|
10210
|
+
return /* @__PURE__ */ jsx(RepeatableWidget, { fieldId });
|
|
10211
|
+
case "image_upload":
|
|
10212
|
+
return /* @__PURE__ */ jsx(ImageUploadWidget, { fieldId });
|
|
10213
|
+
case "media_upload":
|
|
10214
|
+
return /* @__PURE__ */ jsx(MediaUploadWidget, { fieldId });
|
|
10215
|
+
case "signature":
|
|
10216
|
+
return /* @__PURE__ */ jsx(SignatureUploadWidget, { fieldId });
|
|
10217
|
+
case "editable_table":
|
|
10218
|
+
return /* @__PURE__ */ jsx(EditableTableWidget, { fieldId });
|
|
10219
|
+
case "medications":
|
|
10220
|
+
return /* @__PURE__ */ jsx(AddMedicationWidget, { fieldId });
|
|
10221
|
+
case "discharge_medication_orders":
|
|
10222
|
+
return /* @__PURE__ */ jsx(DischargeMedicationOrdersWidget, { fieldId });
|
|
10223
|
+
case "investigations":
|
|
10224
|
+
return /* @__PURE__ */ jsx(AddInvestigationWidget, { fieldId });
|
|
10225
|
+
case "procedures":
|
|
10226
|
+
return /* @__PURE__ */ jsx(AddProcedureWidget, { fieldId });
|
|
10227
|
+
case "differential_diagnosis":
|
|
10228
|
+
return /* @__PURE__ */ jsx(DifferentialDiagnosisWidget, { fieldId });
|
|
10229
|
+
case "vitals":
|
|
10230
|
+
return /* @__PURE__ */ jsx(VitalsWidget, { fieldId });
|
|
10231
|
+
case "hidden_vitals":
|
|
10232
|
+
return /* @__PURE__ */ jsx(HiddenVitalsWidget, { fieldId });
|
|
10233
|
+
case "referral":
|
|
10234
|
+
return /* @__PURE__ */ jsx(ReferralWidget, { fieldId });
|
|
10235
|
+
case "followup":
|
|
10236
|
+
return /* @__PURE__ */ jsx(FollowupWidget, { fieldId });
|
|
10237
|
+
case "smart_textarea":
|
|
10238
|
+
return /* @__PURE__ */ jsx(SmartTextareaWidget, { fieldId });
|
|
10239
|
+
case "diagnosis_textarea":
|
|
10240
|
+
return /* @__PURE__ */ jsx(DiagnosisTextareaWidget, { fieldId });
|
|
10241
|
+
case "obstetric_history":
|
|
10242
|
+
return /* @__PURE__ */ jsx(ObstetricHistoryWidget, { fieldId });
|
|
10243
|
+
case "eye_prescription":
|
|
10244
|
+
return /* @__PURE__ */ jsx(OphthalmologyWidget, { fieldId });
|
|
10245
|
+
case "ophthal_diagnosis":
|
|
10246
|
+
return /* @__PURE__ */ jsx(OphthalDiagnosisWidget, { fieldId });
|
|
10247
|
+
case "orthopedic_exam":
|
|
10248
|
+
return /* @__PURE__ */ jsx(OrthopedicExamWidget, { fieldId });
|
|
10249
|
+
case "general_surgery_smart_history":
|
|
10250
|
+
return /* @__PURE__ */ jsx(GsSmartHistoryWidget, { fieldId });
|
|
10251
|
+
case "general_surgery_examination":
|
|
10252
|
+
return /* @__PURE__ */ jsx(GsExaminationWidget, { fieldId });
|
|
10253
|
+
case "general_surgery_grading":
|
|
10254
|
+
return /* @__PURE__ */ jsx(GsGradingWidget, { fieldId });
|
|
10255
|
+
case "pain_scale_flags":
|
|
10256
|
+
return /* @__PURE__ */ jsx(PainScaleFlagsWidget, { fieldId });
|
|
10257
|
+
case "toggle": {
|
|
10258
|
+
const { value, setValue, setTouched, disabled } = useField(fieldId);
|
|
10259
|
+
const store = useFormStore();
|
|
10260
|
+
const excludes = fieldDef.excludes ?? [];
|
|
10261
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
10262
|
+
/* @__PURE__ */ jsx(
|
|
10263
|
+
Switch,
|
|
10264
|
+
{
|
|
10265
|
+
checked: value === true,
|
|
10266
|
+
disabled,
|
|
10267
|
+
onCheckedChange: (checked) => {
|
|
10268
|
+
setValue(checked);
|
|
10269
|
+
setTouched();
|
|
10270
|
+
if (checked) excludes.forEach((id) => store.setValue(id, false));
|
|
10271
|
+
}
|
|
10272
|
+
}
|
|
10273
|
+
),
|
|
10274
|
+
/* @__PURE__ */ jsx(Label, { className: "text-sm font-medium leading-none cursor-pointer select-none", children: fieldDef.label })
|
|
10275
|
+
] });
|
|
10276
|
+
}
|
|
10277
|
+
case "suggestion_textarea":
|
|
10278
|
+
case "complaint_chips":
|
|
10279
|
+
return /* @__PURE__ */ jsx(SuggestionTextareaWidget, { fieldId });
|
|
10280
|
+
case "lens_assessment":
|
|
10281
|
+
return /* @__PURE__ */ jsx(LensAssessmentWidget, { fieldId });
|
|
10282
|
+
case "functional_impairment_score":
|
|
10283
|
+
return /* @__PURE__ */ jsx(FunctionalImpairmentScoreWidget, { fieldId });
|
|
10284
|
+
case "biometry_iol_workup":
|
|
10285
|
+
return /* @__PURE__ */ jsx(BiometryIolWorkupWidget, { fieldId });
|
|
10286
|
+
case "surgical_risk_flags":
|
|
10287
|
+
return /* @__PURE__ */ jsx(SurgicalRiskFlagsWidget, { fieldId });
|
|
10288
|
+
case "static_text": {
|
|
10289
|
+
const def = fieldDef;
|
|
10290
|
+
const size = def.size ?? "regular";
|
|
10291
|
+
const labelClass = size === "large" ? "text-base" : "text-sm";
|
|
10292
|
+
const descClass = size === "large" ? "text-sm" : "text-xs";
|
|
10293
|
+
return /* @__PURE__ */ jsxs("div", { className: `${labelClass} text-muted-foreground`, children: [
|
|
10294
|
+
def.label,
|
|
10295
|
+
def.description && /* @__PURE__ */ jsx("p", { className: `mt-1 ${descClass} opacity-90`, children: def.description })
|
|
10296
|
+
] });
|
|
10297
|
+
}
|
|
10298
|
+
default:
|
|
10299
|
+
return /* @__PURE__ */ jsxs("div", { className: "text-red-500", children: [
|
|
10300
|
+
"Unknown field type: ",
|
|
10301
|
+
fieldDef.type
|
|
10302
|
+
] });
|
|
10303
|
+
}
|
|
10304
|
+
}
|
|
10305
|
+
var Section = ({ title, children }) => {
|
|
10306
|
+
const [expanded, setExpanded] = useState(true);
|
|
10307
|
+
const handleToggle = () => setExpanded((prev) => !prev);
|
|
10308
|
+
const contentClassName = cn(
|
|
10309
|
+
"overflow-hidden transition-[height] duration-200 ease-in-out",
|
|
10310
|
+
!expanded && "hidden"
|
|
10311
|
+
);
|
|
10312
|
+
return /* @__PURE__ */ jsxs("div", { className: "mb-6 border rounded-lg bg-white shadow-sm overflow-hidden", children: [
|
|
10313
|
+
/* @__PURE__ */ jsxs(
|
|
7997
10314
|
"button",
|
|
7998
10315
|
{
|
|
7999
10316
|
type: "button",
|
|
@@ -8172,14 +10489,24 @@ var SmartForm = ({
|
|
|
8172
10489
|
if (position !== "left") return null;
|
|
8173
10490
|
return /* @__PURE__ */ jsx(FieldRenderer, { fieldId }, fieldId);
|
|
8174
10491
|
}) }),
|
|
8175
|
-
/* @__PURE__ */ jsx("div", { className: "col-span-2 grid grid-cols-2 gap-
|
|
10492
|
+
/* @__PURE__ */ jsx("div", { className: "col-span-2 grid grid-cols-2 gap-2", children: fieldIds.map((fieldId) => {
|
|
8176
10493
|
const fieldDef = store.getFieldDef(fieldId);
|
|
8177
10494
|
if (!fieldDef) return null;
|
|
8178
10495
|
const position = fieldDef.position ?? "center";
|
|
8179
10496
|
if (position !== "center") return null;
|
|
8180
10497
|
const colSpanRaw = fieldDef.colSpan ?? 1;
|
|
8181
10498
|
const colSpan = colSpanRaw === 2 ? 2 : 1;
|
|
8182
|
-
return /* @__PURE__ */ jsx(
|
|
10499
|
+
return /* @__PURE__ */ jsx(
|
|
10500
|
+
"div",
|
|
10501
|
+
{
|
|
10502
|
+
className: cn(
|
|
10503
|
+
"min-h-0 flex flex-col",
|
|
10504
|
+
colSpan === 2 ? "col-span-2" : "col-span-1 h-full"
|
|
10505
|
+
),
|
|
10506
|
+
children: /* @__PURE__ */ jsx(FieldRenderer, { fieldId })
|
|
10507
|
+
},
|
|
10508
|
+
fieldId
|
|
10509
|
+
);
|
|
8183
10510
|
}) }),
|
|
8184
10511
|
/* @__PURE__ */ jsx("div", { className: "col-span-1 flex flex-col gap-2", children: fieldIds.map((fieldId) => {
|
|
8185
10512
|
const fieldDef = store.getFieldDef(fieldId);
|
|
@@ -8627,11 +10954,17 @@ var ReadOnlyDischargeMedicationOrders = ({ fieldDef, value }) => {
|
|
|
8627
10954
|
}) })
|
|
8628
10955
|
] });
|
|
8629
10956
|
};
|
|
8630
|
-
var ReadOnlyFieldRenderer = ({
|
|
10957
|
+
var ReadOnlyFieldRenderer = ({
|
|
10958
|
+
fieldDef,
|
|
10959
|
+
value,
|
|
10960
|
+
allValues,
|
|
10961
|
+
resolveFieldDef
|
|
10962
|
+
}) => {
|
|
8631
10963
|
if (!fieldDef) return null;
|
|
8632
10964
|
switch (fieldDef.type) {
|
|
8633
10965
|
case "text":
|
|
8634
10966
|
case "number":
|
|
10967
|
+
case "slider":
|
|
8635
10968
|
case "textarea":
|
|
8636
10969
|
case "richtext":
|
|
8637
10970
|
return /* @__PURE__ */ jsx(ReadOnlyText, { fieldDef, value });
|
|
@@ -8668,6 +11001,144 @@ var ReadOnlyFieldRenderer = ({ fieldDef, value }) => {
|
|
|
8668
11001
|
/* @__PURE__ */ 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" })
|
|
8669
11002
|
] });
|
|
8670
11003
|
}
|
|
11004
|
+
case "suggestion_textarea":
|
|
11005
|
+
case "complaint_chips": {
|
|
11006
|
+
const embeddedIds = fieldDef.meta && Array.isArray(fieldDef.meta.embeddedFieldIds) ? fieldDef.meta.embeddedFieldIds.filter((id) => typeof id === "string" && id.trim().length > 0).map((id) => id.trim()) : [];
|
|
11007
|
+
const showEmbedded = embeddedIds.length > 0 && resolveFieldDef && allValues && typeof allValues === "object";
|
|
11008
|
+
if (!showEmbedded) {
|
|
11009
|
+
return /* @__PURE__ */ jsx(ReadOnlyText, { fieldDef, value });
|
|
11010
|
+
}
|
|
11011
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
11012
|
+
/* @__PURE__ */ jsx(ReadOnlyText, { fieldDef, value }),
|
|
11013
|
+
/* @__PURE__ */ jsx("div", { className: "grid gap-3 border-t border-muted-foreground/20 pt-3 sm:grid-cols-3", children: embeddedIds.map((id) => {
|
|
11014
|
+
const fd = resolveFieldDef(id);
|
|
11015
|
+
if (!fd) return null;
|
|
11016
|
+
return /* @__PURE__ */ jsx(
|
|
11017
|
+
ReadOnlyFieldRenderer,
|
|
11018
|
+
{
|
|
11019
|
+
fieldDef: fd,
|
|
11020
|
+
value: allValues[id],
|
|
11021
|
+
allValues,
|
|
11022
|
+
resolveFieldDef
|
|
11023
|
+
},
|
|
11024
|
+
id
|
|
11025
|
+
);
|
|
11026
|
+
}) })
|
|
11027
|
+
] });
|
|
11028
|
+
}
|
|
11029
|
+
case "lens_assessment": {
|
|
11030
|
+
const v = value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
11031
|
+
const notes = typeof v?.notes === "string" ? v.notes : "";
|
|
11032
|
+
const key = typeof v?.assessmentKey === "string" ? v.assessmentKey : null;
|
|
11033
|
+
const locs = v?.locs;
|
|
11034
|
+
const locsRecord = locs != null && typeof locs === "object" && !Array.isArray(locs) ? locs : null;
|
|
11035
|
+
const eyeLine = (label, g) => {
|
|
11036
|
+
if (!g || typeof g !== "object") return null;
|
|
11037
|
+
const num = (k) => typeof g[k] === "number" ? g[k] : "\u2014";
|
|
11038
|
+
return /* @__PURE__ */ jsxs("p", { className: "text-xs text-foreground", children: [
|
|
11039
|
+
label,
|
|
11040
|
+
": NO ",
|
|
11041
|
+
String(num("NO")),
|
|
11042
|
+
", NC ",
|
|
11043
|
+
String(num("NC")),
|
|
11044
|
+
", C ",
|
|
11045
|
+
String(num("C")),
|
|
11046
|
+
", PSC",
|
|
11047
|
+
" ",
|
|
11048
|
+
String(num("PSC"))
|
|
11049
|
+
] });
|
|
11050
|
+
};
|
|
11051
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-2 rounded-md border p-3 text-sm", children: [
|
|
11052
|
+
fieldDef.label && /* @__PURE__ */ jsx("p", { className: "font-medium text-foreground", children: fieldDef.label }),
|
|
11053
|
+
locsRecord ? /* @__PURE__ */ jsxs("div", { className: "space-y-1 border-l-2 border-muted pl-2", children: [
|
|
11054
|
+
eyeLine("Right (OD)", locsRecord.OD),
|
|
11055
|
+
eyeLine("Left (OS)", locsRecord.OS)
|
|
11056
|
+
] }) : null,
|
|
11057
|
+
key && /* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
11058
|
+
"Assessment (legacy): ",
|
|
11059
|
+
key
|
|
11060
|
+
] }),
|
|
11061
|
+
notes && /* @__PURE__ */ jsx("p", { className: "whitespace-pre-wrap text-foreground", children: notes })
|
|
11062
|
+
] });
|
|
11063
|
+
}
|
|
11064
|
+
case "functional_impairment_score": {
|
|
11065
|
+
const v = parseFunctionalImpairmentScore(value);
|
|
11066
|
+
const total = functionalImpairmentTotal(v);
|
|
11067
|
+
const lines = [
|
|
11068
|
+
`Reading: ${v.reading}`,
|
|
11069
|
+
`Night driving: ${v.nightDriving}`,
|
|
11070
|
+
`Glare: ${v.glare}`,
|
|
11071
|
+
`Occupation: ${v.occupation}`,
|
|
11072
|
+
`ADL: ${v.adl}`,
|
|
11073
|
+
`Total: ${total}/15`
|
|
11074
|
+
].join("\n");
|
|
11075
|
+
return /* @__PURE__ */ jsx(ReadOnlyText, { fieldDef, value: lines });
|
|
11076
|
+
}
|
|
11077
|
+
case "biometry_iol_workup": {
|
|
11078
|
+
const v = value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
11079
|
+
const s = (k) => typeof v[k] === "string" ? v[k] : "";
|
|
11080
|
+
const b = (k) => v[k] === true;
|
|
11081
|
+
const method = v.method === "ascan_immersion" ? "A-scan (immersion)" : v.method === "ascan_contact" ? "A-scan (contact)" : "Optical biometry (IOL Master)";
|
|
11082
|
+
const lines = [
|
|
11083
|
+
`Axial length OD/OS (mm): ${s("axialLengthOD")} / ${s("axialLengthOS")}`,
|
|
11084
|
+
`K1/K2/Axis OD/OS: ${s("k1k2AxisOD")} / ${s("k1k2AxisOS")}`,
|
|
11085
|
+
`AC depth OD/OS (mm): ${s("anteriorChamberDepthOD")} / ${s("anteriorChamberDepthOS")}`,
|
|
11086
|
+
`IOL power (D) OD/OS: ${s("iolPowerOD")} / ${s("iolPowerOS")}`,
|
|
11087
|
+
`Target refraction (D) OD/OS: ${s("targetRefractionOD")} / ${s("targetRefractionOS")}`,
|
|
11088
|
+
`Formula: ${s("formula") || "\u2014"}`,
|
|
11089
|
+
`Method: ${method}`,
|
|
11090
|
+
`Corneal topography uploaded: ${b("cornealTopoUploaded") ? "Yes" : "No"}`,
|
|
11091
|
+
`Specular microscopy: ${b("specularMicroscopyDone") ? "Yes" : "No"}`,
|
|
11092
|
+
`Endothelial count: ${s("endothelialCount") || "\u2014"}`
|
|
11093
|
+
].join("\n");
|
|
11094
|
+
return /* @__PURE__ */ jsx(ReadOnlyText, { fieldDef, value: lines });
|
|
11095
|
+
}
|
|
11096
|
+
case "surgical_risk_flags": {
|
|
11097
|
+
const v = value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
11098
|
+
const list = (x) => Array.isArray(x) ? x.filter((i) => typeof i === "string").join(", ") : "\u2014";
|
|
11099
|
+
const od = list(v?.OD);
|
|
11100
|
+
const os = list(v?.OS);
|
|
11101
|
+
const lines = [`Right eye (OD): ${od}`, `Left eye (OS): ${os}`].join("\n");
|
|
11102
|
+
return /* @__PURE__ */ jsx(ReadOnlyText, { fieldDef, value: lines });
|
|
11103
|
+
}
|
|
11104
|
+
case "pain_scale_flags": {
|
|
11105
|
+
const def = fieldDef;
|
|
11106
|
+
const min = def.min ?? 0;
|
|
11107
|
+
const max = def.max ?? 10;
|
|
11108
|
+
const safe = normalizePainScaleFlags(value, { min, max });
|
|
11109
|
+
const opts = def.options ?? [];
|
|
11110
|
+
const flagLabels = safe.flags.map((fv) => {
|
|
11111
|
+
const o = opts.find((x) => x.value === fv || String(x.value) === String(fv));
|
|
11112
|
+
return o?.label ?? fv;
|
|
11113
|
+
});
|
|
11114
|
+
const lines = [
|
|
11115
|
+
`Pain score (VAS): ${safe.pain}/${max}`,
|
|
11116
|
+
flagLabels.length > 0 ? `Triage flags: ${flagLabels.join(", ")}` : "Triage flags: \u2014"
|
|
11117
|
+
].join("\n");
|
|
11118
|
+
return /* @__PURE__ */ jsx(ReadOnlyText, { fieldDef, value: lines });
|
|
11119
|
+
}
|
|
11120
|
+
case "general_surgery_smart_history":
|
|
11121
|
+
case "general_surgery_grading":
|
|
11122
|
+
return /* @__PURE__ */ jsx(
|
|
11123
|
+
ReadOnlyText,
|
|
11124
|
+
{
|
|
11125
|
+
fieldDef,
|
|
11126
|
+
value: value && typeof value === "object" ? JSON.stringify(value, null, 2) : value == null || value === "" ? "\u2014" : String(value)
|
|
11127
|
+
}
|
|
11128
|
+
);
|
|
11129
|
+
case "general_surgery_examination": {
|
|
11130
|
+
const structuredDisplay = value && typeof value === "object" ? JSON.stringify(value, null, 2) : value == null || value === "" ? "\u2014" : String(value);
|
|
11131
|
+
const clinicalDef = resolveFieldDef?.("clinical_examination");
|
|
11132
|
+
const clinicalRaw = allValues?.["clinical_examination"];
|
|
11133
|
+
const clinicalStr = typeof clinicalRaw === "string" ? clinicalRaw : clinicalRaw != null && clinicalRaw !== "" ? String(clinicalRaw) : "";
|
|
11134
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
11135
|
+
/* @__PURE__ */ jsx(ReadOnlyText, { fieldDef, value: structuredDisplay }),
|
|
11136
|
+
clinicalDef ? /* @__PURE__ */ jsx(ReadOnlyText, { fieldDef: clinicalDef, value: clinicalStr }) : clinicalStr ? /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
11137
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-gray-700", children: "Clinical examination" }),
|
|
11138
|
+
/* @__PURE__ */ jsx("div", { className: "text-gray-900 border border-gray-200 rounded-md p-3 bg-gray-50 min-h-[2.5rem] whitespace-pre-wrap", children: clinicalStr })
|
|
11139
|
+
] }) : null
|
|
11140
|
+
] });
|
|
11141
|
+
}
|
|
8671
11142
|
case "static_text": {
|
|
8672
11143
|
const def = fieldDef;
|
|
8673
11144
|
const size = def.size ?? "regular";
|
|
@@ -8714,7 +11185,9 @@ var ReadOnlyForm = ({ schema, submission }) => {
|
|
|
8714
11185
|
ReadOnlyFieldRenderer,
|
|
8715
11186
|
{
|
|
8716
11187
|
fieldDef,
|
|
8717
|
-
value: formData[child]
|
|
11188
|
+
value: formData[child],
|
|
11189
|
+
allValues: formData,
|
|
11190
|
+
resolveFieldDef: (id) => fieldMap.get(id)
|
|
8718
11191
|
},
|
|
8719
11192
|
child
|
|
8720
11193
|
) : null;
|
|
@@ -8733,7 +11206,9 @@ var ReadOnlyForm = ({ schema, submission }) => {
|
|
|
8733
11206
|
ReadOnlyFieldRenderer,
|
|
8734
11207
|
{
|
|
8735
11208
|
fieldDef,
|
|
8736
|
-
value: formData[fieldId]
|
|
11209
|
+
value: formData[fieldId],
|
|
11210
|
+
allValues: formData,
|
|
11211
|
+
resolveFieldDef: (id) => fieldMap.get(id)
|
|
8737
11212
|
},
|
|
8738
11213
|
fieldId
|
|
8739
11214
|
))
|
|
@@ -8764,7 +11239,9 @@ var ReadOnlyForm = ({ schema, submission }) => {
|
|
|
8764
11239
|
ReadOnlyFieldRenderer,
|
|
8765
11240
|
{
|
|
8766
11241
|
fieldDef,
|
|
8767
|
-
value: formData[fieldId]
|
|
11242
|
+
value: formData[fieldId],
|
|
11243
|
+
allValues: formData,
|
|
11244
|
+
resolveFieldDef: (id) => fieldMap.get(id)
|
|
8768
11245
|
},
|
|
8769
11246
|
fieldId
|
|
8770
11247
|
))
|