formanitor 0.0.17 → 0.0.19

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.mjs CHANGED
@@ -389,6 +389,26 @@ var FormStore = class {
389
389
  result[field.id] = raw?.text ?? null;
390
390
  return;
391
391
  }
392
+ if (field.type === "ophthal_diagnosis") {
393
+ const raw = values[field.id];
394
+ const formatEye = (eyeData, eyeLabel) => {
395
+ if (!eyeData || typeof eyeData !== "object") return "";
396
+ const entries = Object.entries(eyeData).filter(([, value]) => typeof value === "string" && value.trim()).map(([key, value]) => `${key}: ${value.trim()}`);
397
+ if (entries.length === 0) return "";
398
+ return [eyeLabel, ...entries].join("\n");
399
+ };
400
+ const rightEyeText = formatEye(
401
+ raw?.right_eye ?? raw?.rightEye,
402
+ "Right Eye"
403
+ );
404
+ const leftEyeText = formatEye(
405
+ raw?.left_eye ?? raw?.leftEye,
406
+ "Left Eye"
407
+ );
408
+ const parts = [rightEyeText, leftEyeText].filter(Boolean);
409
+ result[field.id] = parts.length > 0 ? parts.join("\n\n") : null;
410
+ return;
411
+ }
392
412
  if (field.type === "image_upload" || field.type === "signature") {
393
413
  const raw = values[field.id];
394
414
  if (raw !== void 0 && raw !== null && raw !== "") {
@@ -3743,6 +3763,38 @@ var VitalsWidget = ({ fieldId }) => {
3743
3763
  }
3744
3764
  );
3745
3765
  };
3766
+ var HiddenVitalsWidget = ({ fieldId }) => {
3767
+ const { fieldDef, value, setValue, setTouched, error, disabled, touched } = useField(fieldId);
3768
+ const { state } = useForm();
3769
+ const showError = !!error && (touched || state.submitAttempted);
3770
+ if (!fieldDef) return null;
3771
+ const height = "height" in fieldDef ? fieldDef.height : void 0;
3772
+ const theme = getThemeConfig("textarea", fieldDef.theme);
3773
+ const wrapperClass = cn(theme?.wrapperClassName ?? "space-y-2", "sr-only");
3774
+ const labelClass = theme?.labelClassName;
3775
+ const inputClass = cn(theme?.inputClassName, showError && "border-red-500");
3776
+ const labelContent = /* @__PURE__ */ jsxs(Fragment, { children: [
3777
+ fieldDef.label,
3778
+ " ",
3779
+ fieldDef.required && /* @__PURE__ */ jsx("span", { className: "text-red-500", children: "*" })
3780
+ ] });
3781
+ return /* @__PURE__ */ jsxs("div", { className: wrapperClass, "aria-hidden": "true", children: [
3782
+ theme ? /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, className: labelClass, children: labelContent }) : /* @__PURE__ */ jsx(Label, { htmlFor: fieldId, children: labelContent }),
3783
+ /* @__PURE__ */ jsx(
3784
+ Textarea,
3785
+ {
3786
+ id: fieldId,
3787
+ value: value ?? "",
3788
+ onChange: (e) => setValue(e.target.value),
3789
+ onBlur: setTouched,
3790
+ disabled,
3791
+ className: inputClass,
3792
+ ...height != null && { height }
3793
+ }
3794
+ ),
3795
+ showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
3796
+ ] });
3797
+ };
3746
3798
  function normalizeOptions(response) {
3747
3799
  if (Array.isArray(response)) {
3748
3800
  return response.map((o) => ({ label: String(o.label), value: String(o.value) }));
@@ -4980,6 +5032,1343 @@ var ObstetricHistoryWidget = ({ fieldId }) => {
4980
5032
  ] })
4981
5033
  ] });
4982
5034
  };
5035
+ var UCVA_OPTIONS = ["", "6/6", "6/9", "6/12", "6/18", "6/24", "6/36", "6/60", "CF", "PL"];
5036
+ var NEAR_VA_OPTIONS = ["", "N4", "N5", "N6", "N8", "N10", "N12", "N14", "N18", "N24", "N36", "<N36"];
5037
+ var PINHOLE_OPTIONS = [
5038
+ "",
5039
+ "PL\u2212",
5040
+ "PL+",
5041
+ "FL",
5042
+ "HM",
5043
+ "CCFCF",
5044
+ "FC",
5045
+ "1/60",
5046
+ "2/60",
5047
+ "3/60",
5048
+ "4/60",
5049
+ "5/60",
5050
+ "6/60",
5051
+ "6/36",
5052
+ "6/24",
5053
+ "6/18",
5054
+ "6/12",
5055
+ "6/9",
5056
+ "6/7.5",
5057
+ "6/6"
5058
+ ];
5059
+ var VA_OPTIONS = UCVA_OPTIONS;
5060
+ var IOP_METHOD_OPTIONS = ["", "NCT", "Goldmann", "Tonopen", "iCare"];
5061
+ function parseFloatOrNull(value) {
5062
+ const trimmed = value.trim();
5063
+ if (!trimmed) return null;
5064
+ const parsed = Number.parseFloat(trimmed);
5065
+ return Number.isFinite(parsed) ? parsed : null;
5066
+ }
5067
+ function parseIntOrNull(value) {
5068
+ const trimmed = value.trim();
5069
+ if (!trimmed) return null;
5070
+ const parsed = Number.parseInt(trimmed, 10);
5071
+ return Number.isFinite(parsed) ? parsed : null;
5072
+ }
5073
+ function ensureRefractionEye(raw) {
5074
+ return {
5075
+ sph: raw?.sph ?? null,
5076
+ cyl: raw?.cyl ?? null,
5077
+ axis: raw?.axis ?? null,
5078
+ va: raw?.va ?? "",
5079
+ pd: raw?.pd ?? null,
5080
+ prism: raw?.prism ?? null
5081
+ };
5082
+ }
5083
+ function ensureAddPowers(raw) {
5084
+ return {
5085
+ right: raw?.right ?? null,
5086
+ left: raw?.left ?? null
5087
+ };
5088
+ }
5089
+ function ensureRefraction(raw) {
5090
+ return {
5091
+ right_eye: ensureRefractionEye(raw?.right_eye),
5092
+ left_eye: ensureRefractionEye(raw?.left_eye),
5093
+ add: ensureAddPowers(raw?.add)
5094
+ };
5095
+ }
5096
+ function ensureUnaidedEyeVa(raw) {
5097
+ return {
5098
+ ucva: raw?.ucva ?? "",
5099
+ pinhole_va: raw?.pinhole_va ?? "",
5100
+ nv: raw?.nv ?? ""
5101
+ };
5102
+ }
5103
+ function ensureIopEye(raw) {
5104
+ return {
5105
+ iop: raw?.iop ?? null,
5106
+ cct: raw?.cct ?? null
5107
+ };
5108
+ }
5109
+ function ensureValue(raw) {
5110
+ const v = raw || {};
5111
+ return {
5112
+ patient_information: {
5113
+ systemic_history: v.patient_information?.systemic_history ?? "",
5114
+ ocular_history: v.patient_information?.ocular_history ?? "",
5115
+ chief_complaints: v.patient_information?.chief_complaints ?? ""
5116
+ },
5117
+ unaided_visual_acuity: {
5118
+ right_eye: ensureUnaidedEyeVa(v.unaided_visual_acuity?.right_eye),
5119
+ left_eye: ensureUnaidedEyeVa(v.unaided_visual_acuity?.left_eye)
5120
+ },
5121
+ current_glass_prescription: ensureRefraction(v.current_glass_prescription),
5122
+ iop_pachy_cct: {
5123
+ method: v.iop_pachy_cct?.method ?? "",
5124
+ time: v.iop_pachy_cct?.time ?? "",
5125
+ right_eye: ensureIopEye(v.iop_pachy_cct?.right_eye),
5126
+ left_eye: ensureIopEye(v.iop_pachy_cct?.left_eye)
5127
+ },
5128
+ refraction: ensureRefraction(v.refraction),
5129
+ dilated_refraction: ensureRefraction(v.dilated_refraction),
5130
+ glass_power_prescription: ensureRefraction(v.glass_power_prescription),
5131
+ notes: v.notes ?? ""
5132
+ };
5133
+ }
5134
+ var sectionWrapperClass = "rounded-md overflow-hidden flex flex-col border border-[#D0D0D0] bg-white";
5135
+ var sectionHeaderClass = "rounded-t-md bg-[#FEE8EC] px-3 py-1 text-sm shrink-0 z-[1] text-slate-600 font-medium";
5136
+ var sectionBodyClass = "rounded-b-md border-t border-[#D0D0D0] bg-white p-3 space-y-3";
5137
+ var tableBaseClass = "w-full border-collapse text-xs";
5138
+ var tableHeaderCellClass = "border border-[#E0E0E0] bg-[#F7F7F7] px-2 py-1 text-center font-semibold";
5139
+ var tableCellClass = "border border-[#E0E0E0] px-1.5 py-1 text-center align-middle";
5140
+ 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";
5141
+ 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";
5142
+ 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";
5143
+ var OphthalmologyWidget = ({ fieldId }) => {
5144
+ const { fieldDef, value, setValue, disabled } = useField(fieldId);
5145
+ const safe = useMemo(() => ensureValue(value), [value]);
5146
+ const label = fieldDef?.label || "";
5147
+ const update = (updater) => {
5148
+ if (disabled) return;
5149
+ setValue(updater(ensureValue(value)));
5150
+ };
5151
+ const setPatientInfo = (key, next) => {
5152
+ update((current) => ({
5153
+ ...current,
5154
+ patient_information: { ...current.patient_information, [key]: next }
5155
+ }));
5156
+ };
5157
+ const setUnaided = (side, key, next) => {
5158
+ update((current) => ({
5159
+ ...current,
5160
+ unaided_visual_acuity: {
5161
+ ...current.unaided_visual_acuity,
5162
+ [side]: { ...current.unaided_visual_acuity[side], [key]: next }
5163
+ }
5164
+ }));
5165
+ };
5166
+ const setRefractionField = (section, side, key, next, mode) => {
5167
+ update((current) => {
5168
+ const base = current[section];
5169
+ const eye = base[side];
5170
+ let val;
5171
+ if (mode === "select") {
5172
+ val = next;
5173
+ } else if (mode === "float") {
5174
+ val = parseFloatOrNull(next);
5175
+ } else {
5176
+ val = parseIntOrNull(next);
5177
+ }
5178
+ return {
5179
+ ...current,
5180
+ [section]: {
5181
+ ...base,
5182
+ [side]: {
5183
+ ...eye,
5184
+ [key]: val
5185
+ }
5186
+ }
5187
+ };
5188
+ });
5189
+ };
5190
+ const setRefractionAdd = (section, side, next) => {
5191
+ update((current) => {
5192
+ const base = current[section];
5193
+ const add = base.add;
5194
+ const val = parseFloatOrNull(next);
5195
+ return {
5196
+ ...current,
5197
+ [section]: {
5198
+ ...base,
5199
+ add: {
5200
+ ...add,
5201
+ [side]: val
5202
+ }
5203
+ }
5204
+ };
5205
+ });
5206
+ };
5207
+ const setIopField = (side, key, next) => {
5208
+ update((current) => {
5209
+ const base = current.iop_pachy_cct;
5210
+ const eye = base[side];
5211
+ const val = parseIntOrNull(next);
5212
+ return {
5213
+ ...current,
5214
+ iop_pachy_cct: {
5215
+ ...base,
5216
+ [side]: {
5217
+ ...eye,
5218
+ [key]: val
5219
+ }
5220
+ }
5221
+ };
5222
+ });
5223
+ };
5224
+ const setIopMeta = (key, next) => {
5225
+ update((current) => ({
5226
+ ...current,
5227
+ iop_pachy_cct: {
5228
+ ...current.iop_pachy_cct,
5229
+ [key]: next
5230
+ }
5231
+ }));
5232
+ };
5233
+ const setNotes = (next) => {
5234
+ update((current) => ({
5235
+ ...current,
5236
+ notes: next
5237
+ }));
5238
+ };
5239
+ return /* @__PURE__ */ jsxs("div", { className: cn("space-y-4", disabled && "opacity-70 pointer-events-none"), children: [
5240
+ /* @__PURE__ */ jsx("h3", { className: "text-base font-semibold text-slate-800", children: label }),
5241
+ /* @__PURE__ */ jsxs("section", { className: sectionWrapperClass, children: [
5242
+ /* @__PURE__ */ jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsx("span", { children: "Patient Information" }) }),
5243
+ /* @__PURE__ */ jsxs("div", { className: cn(sectionBodyClass, "grid gap-3 md:grid-cols-3"), children: [
5244
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
5245
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-slate-700", children: "Systemic History" }),
5246
+ /* @__PURE__ */ jsx(
5247
+ Textarea,
5248
+ {
5249
+ disabled,
5250
+ rows: 4,
5251
+ className: "min-h-[100px] text-xs",
5252
+ value: safe.patient_information.systemic_history,
5253
+ onChange: (e) => setPatientInfo("systemic_history", e.target.value),
5254
+ placeholder: "Enter systemic history..."
5255
+ }
5256
+ )
5257
+ ] }),
5258
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
5259
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-slate-700", children: "Ocular History" }),
5260
+ /* @__PURE__ */ jsx(
5261
+ Textarea,
5262
+ {
5263
+ disabled,
5264
+ rows: 4,
5265
+ className: "min-h-[100px] text-xs",
5266
+ value: safe.patient_information.ocular_history,
5267
+ onChange: (e) => setPatientInfo("ocular_history", e.target.value),
5268
+ placeholder: "Enter ocular history..."
5269
+ }
5270
+ )
5271
+ ] }),
5272
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
5273
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-slate-700", children: "Chief Complaints" }),
5274
+ /* @__PURE__ */ jsx(
5275
+ Textarea,
5276
+ {
5277
+ disabled,
5278
+ rows: 4,
5279
+ className: "min-h-[100px] text-xs",
5280
+ value: safe.patient_information.chief_complaints,
5281
+ onChange: (e) => setPatientInfo("chief_complaints", e.target.value),
5282
+ placeholder: "Enter chief complaints..."
5283
+ }
5284
+ )
5285
+ ] })
5286
+ ] })
5287
+ ] }),
5288
+ /* @__PURE__ */ jsxs("section", { className: sectionWrapperClass, children: [
5289
+ /* @__PURE__ */ jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsx("span", { children: "Unaided Visual Acuity" }) }),
5290
+ /* @__PURE__ */ jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxs("table", { className: tableBaseClass, children: [
5291
+ /* @__PURE__ */ jsxs("thead", { children: [
5292
+ /* @__PURE__ */ jsxs("tr", { children: [
5293
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
5294
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 3, children: "Right Eye" }),
5295
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 3, children: "Left Eye" })
5296
+ ] }),
5297
+ /* @__PURE__ */ jsxs("tr", { children: [
5298
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
5299
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "UCVA" }),
5300
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Pinhole V/A" }),
5301
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "N/V" }),
5302
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "UCVA" }),
5303
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Pinhole V/A" }),
5304
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "N/V" })
5305
+ ] })
5306
+ ] }),
5307
+ /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsxs("tr", { children: [
5308
+ /* @__PURE__ */ jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Unaided" }),
5309
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5310
+ "select",
5311
+ {
5312
+ disabled,
5313
+ className: selectClass,
5314
+ value: safe.unaided_visual_acuity.right_eye.ucva,
5315
+ onChange: (e) => setUnaided("right_eye", "ucva", e.target.value),
5316
+ children: UCVA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5317
+ }
5318
+ ) }),
5319
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5320
+ "select",
5321
+ {
5322
+ disabled,
5323
+ className: selectClass,
5324
+ value: safe.unaided_visual_acuity.right_eye.pinhole_va,
5325
+ onChange: (e) => setUnaided("right_eye", "pinhole_va", e.target.value),
5326
+ children: PINHOLE_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5327
+ }
5328
+ ) }),
5329
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5330
+ "select",
5331
+ {
5332
+ disabled,
5333
+ className: selectClass,
5334
+ value: safe.unaided_visual_acuity.right_eye.nv,
5335
+ onChange: (e) => setUnaided("right_eye", "nv", e.target.value),
5336
+ children: NEAR_VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5337
+ }
5338
+ ) }),
5339
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5340
+ "select",
5341
+ {
5342
+ disabled,
5343
+ className: selectClass,
5344
+ value: safe.unaided_visual_acuity.left_eye.ucva,
5345
+ onChange: (e) => setUnaided("left_eye", "ucva", e.target.value),
5346
+ children: UCVA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5347
+ }
5348
+ ) }),
5349
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5350
+ "select",
5351
+ {
5352
+ disabled,
5353
+ className: selectClass,
5354
+ value: safe.unaided_visual_acuity.left_eye.pinhole_va,
5355
+ onChange: (e) => setUnaided("left_eye", "pinhole_va", e.target.value),
5356
+ children: PINHOLE_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5357
+ }
5358
+ ) }),
5359
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5360
+ "select",
5361
+ {
5362
+ disabled,
5363
+ className: selectClass,
5364
+ value: safe.unaided_visual_acuity.left_eye.nv,
5365
+ onChange: (e) => setUnaided("left_eye", "nv", e.target.value),
5366
+ children: NEAR_VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5367
+ }
5368
+ ) })
5369
+ ] }) })
5370
+ ] }) })
5371
+ ] }),
5372
+ /* @__PURE__ */ jsxs("section", { className: sectionWrapperClass, children: [
5373
+ /* @__PURE__ */ jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsx("span", { children: "Current Glass Prescription" }) }),
5374
+ /* @__PURE__ */ jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxs("table", { className: tableBaseClass, children: [
5375
+ /* @__PURE__ */ jsxs("thead", { children: [
5376
+ /* @__PURE__ */ jsxs("tr", { children: [
5377
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
5378
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 4, children: "Right Eye" }),
5379
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 4, children: "Left Eye" })
5380
+ ] }),
5381
+ /* @__PURE__ */ jsxs("tr", { children: [
5382
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
5383
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
5384
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
5385
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
5386
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "V/A" }),
5387
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
5388
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
5389
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
5390
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "V/A" })
5391
+ ] })
5392
+ ] }),
5393
+ /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsxs("tr", { children: [
5394
+ /* @__PURE__ */ jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Current Glass" }),
5395
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5396
+ Input,
5397
+ {
5398
+ disabled,
5399
+ type: "number",
5400
+ step: "0.25",
5401
+ className: numberInputClass,
5402
+ value: safe.current_glass_prescription.right_eye.sph ?? "",
5403
+ onChange: (e) => setRefractionField(
5404
+ "current_glass_prescription",
5405
+ "right_eye",
5406
+ "sph",
5407
+ e.target.value,
5408
+ "float"
5409
+ )
5410
+ }
5411
+ ) }),
5412
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5413
+ Input,
5414
+ {
5415
+ disabled,
5416
+ type: "number",
5417
+ step: "0.25",
5418
+ className: numberInputClass,
5419
+ value: safe.current_glass_prescription.right_eye.cyl ?? "",
5420
+ onChange: (e) => setRefractionField(
5421
+ "current_glass_prescription",
5422
+ "right_eye",
5423
+ "cyl",
5424
+ e.target.value,
5425
+ "float"
5426
+ )
5427
+ }
5428
+ ) }),
5429
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5430
+ Input,
5431
+ {
5432
+ disabled,
5433
+ type: "number",
5434
+ className: numberInputClass,
5435
+ value: safe.current_glass_prescription.right_eye.axis ?? "",
5436
+ onChange: (e) => setRefractionField(
5437
+ "current_glass_prescription",
5438
+ "right_eye",
5439
+ "axis",
5440
+ e.target.value,
5441
+ "int"
5442
+ )
5443
+ }
5444
+ ) }),
5445
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5446
+ "select",
5447
+ {
5448
+ disabled,
5449
+ className: selectClass,
5450
+ value: safe.current_glass_prescription.right_eye.va,
5451
+ onChange: (e) => setRefractionField(
5452
+ "current_glass_prescription",
5453
+ "right_eye",
5454
+ "va",
5455
+ e.target.value,
5456
+ "select"
5457
+ ),
5458
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5459
+ }
5460
+ ) }),
5461
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5462
+ Input,
5463
+ {
5464
+ disabled,
5465
+ type: "number",
5466
+ step: "0.25",
5467
+ className: numberInputClass,
5468
+ value: safe.current_glass_prescription.left_eye.sph ?? "",
5469
+ onChange: (e) => setRefractionField(
5470
+ "current_glass_prescription",
5471
+ "left_eye",
5472
+ "sph",
5473
+ e.target.value,
5474
+ "float"
5475
+ )
5476
+ }
5477
+ ) }),
5478
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5479
+ Input,
5480
+ {
5481
+ disabled,
5482
+ type: "number",
5483
+ step: "0.25",
5484
+ className: numberInputClass,
5485
+ value: safe.current_glass_prescription.left_eye.cyl ?? "",
5486
+ onChange: (e) => setRefractionField(
5487
+ "current_glass_prescription",
5488
+ "left_eye",
5489
+ "cyl",
5490
+ e.target.value,
5491
+ "float"
5492
+ )
5493
+ }
5494
+ ) }),
5495
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5496
+ Input,
5497
+ {
5498
+ disabled,
5499
+ type: "number",
5500
+ className: numberInputClass,
5501
+ value: safe.current_glass_prescription.left_eye.axis ?? "",
5502
+ onChange: (e) => setRefractionField(
5503
+ "current_glass_prescription",
5504
+ "left_eye",
5505
+ "axis",
5506
+ e.target.value,
5507
+ "int"
5508
+ )
5509
+ }
5510
+ ) }),
5511
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5512
+ "select",
5513
+ {
5514
+ disabled,
5515
+ className: selectClass,
5516
+ value: safe.current_glass_prescription.left_eye.va,
5517
+ onChange: (e) => setRefractionField(
5518
+ "current_glass_prescription",
5519
+ "left_eye",
5520
+ "va",
5521
+ e.target.value,
5522
+ "select"
5523
+ ),
5524
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5525
+ }
5526
+ ) })
5527
+ ] }) })
5528
+ ] }) })
5529
+ ] }),
5530
+ /* @__PURE__ */ jsxs("section", { className: sectionWrapperClass, children: [
5531
+ /* @__PURE__ */ jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsx("span", { children: "IOP / Pachy / CCT Detail" }) }),
5532
+ /* @__PURE__ */ jsxs("div", { className: sectionBodyClass, children: [
5533
+ /* @__PURE__ */ jsxs("div", { className: "grid gap-3 md:grid-cols-[2fr,1fr] mb-3", children: [
5534
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
5535
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-slate-700", children: "Method" }),
5536
+ /* @__PURE__ */ jsx(
5537
+ "select",
5538
+ {
5539
+ disabled,
5540
+ className: selectClass,
5541
+ value: safe.iop_pachy_cct.method,
5542
+ onChange: (e) => setIopMeta("method", e.target.value),
5543
+ children: IOP_METHOD_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt || "Select Method" }, opt || "blank"))
5544
+ }
5545
+ )
5546
+ ] }),
5547
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
5548
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-slate-700", children: "Time" }),
5549
+ /* @__PURE__ */ jsx(
5550
+ Input,
5551
+ {
5552
+ disabled,
5553
+ placeholder: "HH:MM",
5554
+ className: textInputClass,
5555
+ value: safe.iop_pachy_cct.time,
5556
+ onChange: (e) => setIopMeta("time", e.target.value)
5557
+ }
5558
+ )
5559
+ ] })
5560
+ ] }),
5561
+ /* @__PURE__ */ jsxs("table", { className: tableBaseClass, children: [
5562
+ /* @__PURE__ */ jsxs("thead", { children: [
5563
+ /* @__PURE__ */ jsxs("tr", { children: [
5564
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
5565
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 2, children: "Right Eye" }),
5566
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 2, children: "Left Eye" })
5567
+ ] }),
5568
+ /* @__PURE__ */ jsxs("tr", { children: [
5569
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
5570
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "IOP" }),
5571
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "CCT" }),
5572
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "IOP" }),
5573
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "CCT" })
5574
+ ] })
5575
+ ] }),
5576
+ /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsxs("tr", { children: [
5577
+ /* @__PURE__ */ jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Values" }),
5578
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5579
+ Input,
5580
+ {
5581
+ disabled,
5582
+ type: "number",
5583
+ className: numberInputClass,
5584
+ value: safe.iop_pachy_cct.right_eye.iop ?? "",
5585
+ onChange: (e) => setIopField("right_eye", "iop", e.target.value)
5586
+ }
5587
+ ) }),
5588
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5589
+ Input,
5590
+ {
5591
+ disabled,
5592
+ type: "number",
5593
+ className: numberInputClass,
5594
+ value: safe.iop_pachy_cct.right_eye.cct ?? "",
5595
+ onChange: (e) => setIopField("right_eye", "cct", e.target.value)
5596
+ }
5597
+ ) }),
5598
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5599
+ Input,
5600
+ {
5601
+ disabled,
5602
+ type: "number",
5603
+ className: numberInputClass,
5604
+ value: safe.iop_pachy_cct.left_eye.iop ?? "",
5605
+ onChange: (e) => setIopField("left_eye", "iop", e.target.value)
5606
+ }
5607
+ ) }),
5608
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5609
+ Input,
5610
+ {
5611
+ disabled,
5612
+ type: "number",
5613
+ className: numberInputClass,
5614
+ value: safe.iop_pachy_cct.left_eye.cct ?? "",
5615
+ onChange: (e) => setIopField("left_eye", "cct", e.target.value)
5616
+ }
5617
+ ) })
5618
+ ] }) })
5619
+ ] })
5620
+ ] })
5621
+ ] }),
5622
+ /* @__PURE__ */ jsxs("section", { className: sectionWrapperClass, children: [
5623
+ /* @__PURE__ */ jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsx("span", { children: "Refraction (Distance)" }) }),
5624
+ /* @__PURE__ */ jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxs("table", { className: tableBaseClass, children: [
5625
+ /* @__PURE__ */ jsxs("thead", { children: [
5626
+ /* @__PURE__ */ jsxs("tr", { children: [
5627
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
5628
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Right Eye" }),
5629
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Left Eye" })
5630
+ ] }),
5631
+ /* @__PURE__ */ jsxs("tr", { children: [
5632
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
5633
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
5634
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
5635
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
5636
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "V/A" }),
5637
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "P/D" }),
5638
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
5639
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
5640
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
5641
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "V/A" }),
5642
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "P/D" })
5643
+ ] })
5644
+ ] }),
5645
+ /* @__PURE__ */ jsxs("tbody", { children: [
5646
+ /* @__PURE__ */ jsxs("tr", { children: [
5647
+ /* @__PURE__ */ jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Distance" }),
5648
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5649
+ Input,
5650
+ {
5651
+ disabled,
5652
+ type: "number",
5653
+ step: "0.25",
5654
+ className: numberInputClass,
5655
+ value: safe.refraction.right_eye.sph ?? "",
5656
+ onChange: (e) => setRefractionField(
5657
+ "refraction",
5658
+ "right_eye",
5659
+ "sph",
5660
+ e.target.value,
5661
+ "float"
5662
+ )
5663
+ }
5664
+ ) }),
5665
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5666
+ Input,
5667
+ {
5668
+ disabled,
5669
+ type: "number",
5670
+ step: "0.25",
5671
+ className: numberInputClass,
5672
+ value: safe.refraction.right_eye.cyl ?? "",
5673
+ onChange: (e) => setRefractionField(
5674
+ "refraction",
5675
+ "right_eye",
5676
+ "cyl",
5677
+ e.target.value,
5678
+ "float"
5679
+ )
5680
+ }
5681
+ ) }),
5682
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5683
+ Input,
5684
+ {
5685
+ disabled,
5686
+ type: "number",
5687
+ className: numberInputClass,
5688
+ value: safe.refraction.right_eye.axis ?? "",
5689
+ onChange: (e) => setRefractionField(
5690
+ "refraction",
5691
+ "right_eye",
5692
+ "axis",
5693
+ e.target.value,
5694
+ "int"
5695
+ )
5696
+ }
5697
+ ) }),
5698
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5699
+ "select",
5700
+ {
5701
+ disabled,
5702
+ className: selectClass,
5703
+ value: safe.refraction.right_eye.va,
5704
+ onChange: (e) => setRefractionField(
5705
+ "refraction",
5706
+ "right_eye",
5707
+ "va",
5708
+ e.target.value,
5709
+ "select"
5710
+ ),
5711
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5712
+ }
5713
+ ) }),
5714
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5715
+ Input,
5716
+ {
5717
+ disabled,
5718
+ type: "number",
5719
+ min: 10,
5720
+ max: 45,
5721
+ step: "1",
5722
+ className: numberInputClass,
5723
+ value: safe.refraction.right_eye.pd ?? "",
5724
+ onChange: (e) => setRefractionField("refraction", "right_eye", "pd", e.target.value, "int")
5725
+ }
5726
+ ) }),
5727
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5728
+ Input,
5729
+ {
5730
+ disabled,
5731
+ type: "number",
5732
+ step: "0.25",
5733
+ className: numberInputClass,
5734
+ value: safe.refraction.left_eye.sph ?? "",
5735
+ onChange: (e) => setRefractionField(
5736
+ "refraction",
5737
+ "left_eye",
5738
+ "sph",
5739
+ e.target.value,
5740
+ "float"
5741
+ )
5742
+ }
5743
+ ) }),
5744
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5745
+ Input,
5746
+ {
5747
+ disabled,
5748
+ type: "number",
5749
+ step: "0.25",
5750
+ className: numberInputClass,
5751
+ value: safe.refraction.left_eye.cyl ?? "",
5752
+ onChange: (e) => setRefractionField(
5753
+ "refraction",
5754
+ "left_eye",
5755
+ "cyl",
5756
+ e.target.value,
5757
+ "float"
5758
+ )
5759
+ }
5760
+ ) }),
5761
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5762
+ Input,
5763
+ {
5764
+ disabled,
5765
+ type: "number",
5766
+ className: numberInputClass,
5767
+ value: safe.refraction.left_eye.axis ?? "",
5768
+ onChange: (e) => setRefractionField(
5769
+ "refraction",
5770
+ "left_eye",
5771
+ "axis",
5772
+ e.target.value,
5773
+ "int"
5774
+ )
5775
+ }
5776
+ ) }),
5777
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5778
+ "select",
5779
+ {
5780
+ disabled,
5781
+ className: selectClass,
5782
+ value: safe.refraction.left_eye.va,
5783
+ onChange: (e) => setRefractionField(
5784
+ "refraction",
5785
+ "left_eye",
5786
+ "va",
5787
+ e.target.value,
5788
+ "select"
5789
+ ),
5790
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5791
+ }
5792
+ ) }),
5793
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5794
+ Input,
5795
+ {
5796
+ disabled,
5797
+ type: "number",
5798
+ min: 10,
5799
+ max: 45,
5800
+ step: "1",
5801
+ className: numberInputClass,
5802
+ value: safe.refraction.left_eye.pd ?? "",
5803
+ onChange: (e) => setRefractionField("refraction", "left_eye", "pd", e.target.value, "int")
5804
+ }
5805
+ ) })
5806
+ ] }),
5807
+ /* @__PURE__ */ jsxs("tr", { children: [
5808
+ /* @__PURE__ */ jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Add" }),
5809
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsx(
5810
+ Input,
5811
+ {
5812
+ disabled,
5813
+ type: "number",
5814
+ step: "0.25",
5815
+ className: numberInputClass,
5816
+ value: safe.refraction.add.right ?? "",
5817
+ onChange: (e) => setRefractionAdd("refraction", "right", e.target.value)
5818
+ }
5819
+ ) }),
5820
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsx(
5821
+ Input,
5822
+ {
5823
+ disabled,
5824
+ type: "number",
5825
+ step: "0.25",
5826
+ className: numberInputClass,
5827
+ value: safe.refraction.add.left ?? "",
5828
+ onChange: (e) => setRefractionAdd("refraction", "left", e.target.value)
5829
+ }
5830
+ ) })
5831
+ ] })
5832
+ ] })
5833
+ ] }) })
5834
+ ] }),
5835
+ /* @__PURE__ */ jsxs("section", { className: sectionWrapperClass, children: [
5836
+ /* @__PURE__ */ jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsx("span", { children: "Dilated Refraction" }) }),
5837
+ /* @__PURE__ */ jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxs("table", { className: tableBaseClass, children: [
5838
+ /* @__PURE__ */ jsxs("thead", { children: [
5839
+ /* @__PURE__ */ jsxs("tr", { children: [
5840
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
5841
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Right Eye" }),
5842
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Left Eye" })
5843
+ ] }),
5844
+ /* @__PURE__ */ jsxs("tr", { children: [
5845
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
5846
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
5847
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
5848
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
5849
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Prism" }),
5850
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "V/A" }),
5851
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
5852
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
5853
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
5854
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Prism" }),
5855
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "V/A" })
5856
+ ] })
5857
+ ] }),
5858
+ /* @__PURE__ */ jsxs("tbody", { children: [
5859
+ /* @__PURE__ */ jsxs("tr", { children: [
5860
+ /* @__PURE__ */ jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Dilated" }),
5861
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5862
+ Input,
5863
+ {
5864
+ disabled,
5865
+ type: "number",
5866
+ step: "0.25",
5867
+ className: numberInputClass,
5868
+ value: safe.dilated_refraction.right_eye.sph ?? "",
5869
+ onChange: (e) => setRefractionField(
5870
+ "dilated_refraction",
5871
+ "right_eye",
5872
+ "sph",
5873
+ e.target.value,
5874
+ "float"
5875
+ )
5876
+ }
5877
+ ) }),
5878
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5879
+ Input,
5880
+ {
5881
+ disabled,
5882
+ type: "number",
5883
+ step: "0.25",
5884
+ className: numberInputClass,
5885
+ value: safe.dilated_refraction.right_eye.cyl ?? "",
5886
+ onChange: (e) => setRefractionField(
5887
+ "dilated_refraction",
5888
+ "right_eye",
5889
+ "cyl",
5890
+ e.target.value,
5891
+ "float"
5892
+ )
5893
+ }
5894
+ ) }),
5895
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5896
+ Input,
5897
+ {
5898
+ disabled,
5899
+ type: "number",
5900
+ className: numberInputClass,
5901
+ value: safe.dilated_refraction.right_eye.axis ?? "",
5902
+ onChange: (e) => setRefractionField(
5903
+ "dilated_refraction",
5904
+ "right_eye",
5905
+ "axis",
5906
+ e.target.value,
5907
+ "int"
5908
+ )
5909
+ }
5910
+ ) }),
5911
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5912
+ Input,
5913
+ {
5914
+ disabled,
5915
+ type: "number",
5916
+ step: "0.25",
5917
+ className: numberInputClass,
5918
+ value: safe.dilated_refraction.right_eye.prism ?? "",
5919
+ onChange: (e) => setRefractionField(
5920
+ "dilated_refraction",
5921
+ "right_eye",
5922
+ "prism",
5923
+ e.target.value,
5924
+ "float"
5925
+ )
5926
+ }
5927
+ ) }),
5928
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5929
+ "select",
5930
+ {
5931
+ disabled,
5932
+ className: selectClass,
5933
+ value: safe.dilated_refraction.right_eye.va,
5934
+ onChange: (e) => setRefractionField(
5935
+ "dilated_refraction",
5936
+ "right_eye",
5937
+ "va",
5938
+ e.target.value,
5939
+ "select"
5940
+ ),
5941
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
5942
+ }
5943
+ ) }),
5944
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5945
+ Input,
5946
+ {
5947
+ disabled,
5948
+ type: "number",
5949
+ step: "0.25",
5950
+ className: numberInputClass,
5951
+ value: safe.dilated_refraction.left_eye.sph ?? "",
5952
+ onChange: (e) => setRefractionField(
5953
+ "dilated_refraction",
5954
+ "left_eye",
5955
+ "sph",
5956
+ e.target.value,
5957
+ "float"
5958
+ )
5959
+ }
5960
+ ) }),
5961
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5962
+ Input,
5963
+ {
5964
+ disabled,
5965
+ type: "number",
5966
+ step: "0.25",
5967
+ className: numberInputClass,
5968
+ value: safe.dilated_refraction.left_eye.cyl ?? "",
5969
+ onChange: (e) => setRefractionField(
5970
+ "dilated_refraction",
5971
+ "left_eye",
5972
+ "cyl",
5973
+ e.target.value,
5974
+ "float"
5975
+ )
5976
+ }
5977
+ ) }),
5978
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5979
+ Input,
5980
+ {
5981
+ disabled,
5982
+ type: "number",
5983
+ className: numberInputClass,
5984
+ value: safe.dilated_refraction.left_eye.axis ?? "",
5985
+ onChange: (e) => setRefractionField(
5986
+ "dilated_refraction",
5987
+ "left_eye",
5988
+ "axis",
5989
+ e.target.value,
5990
+ "int"
5991
+ )
5992
+ }
5993
+ ) }),
5994
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
5995
+ Input,
5996
+ {
5997
+ disabled,
5998
+ type: "number",
5999
+ step: "0.25",
6000
+ className: numberInputClass,
6001
+ value: safe.dilated_refraction.left_eye.prism ?? "",
6002
+ onChange: (e) => setRefractionField(
6003
+ "dilated_refraction",
6004
+ "left_eye",
6005
+ "prism",
6006
+ e.target.value,
6007
+ "float"
6008
+ )
6009
+ }
6010
+ ) }),
6011
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
6012
+ "select",
6013
+ {
6014
+ disabled,
6015
+ className: selectClass,
6016
+ value: safe.dilated_refraction.left_eye.va,
6017
+ onChange: (e) => setRefractionField(
6018
+ "dilated_refraction",
6019
+ "left_eye",
6020
+ "va",
6021
+ e.target.value,
6022
+ "select"
6023
+ ),
6024
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
6025
+ }
6026
+ ) })
6027
+ ] }),
6028
+ /* @__PURE__ */ jsxs("tr", { children: [
6029
+ /* @__PURE__ */ jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Add" }),
6030
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsx(
6031
+ Input,
6032
+ {
6033
+ disabled,
6034
+ type: "number",
6035
+ step: "0.25",
6036
+ className: numberInputClass,
6037
+ value: safe.dilated_refraction.add.right ?? "",
6038
+ onChange: (e) => setRefractionAdd("dilated_refraction", "right", e.target.value)
6039
+ }
6040
+ ) }),
6041
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsx(
6042
+ Input,
6043
+ {
6044
+ disabled,
6045
+ type: "number",
6046
+ step: "0.25",
6047
+ className: numberInputClass,
6048
+ value: safe.dilated_refraction.add.left ?? "",
6049
+ onChange: (e) => setRefractionAdd("dilated_refraction", "left", e.target.value)
6050
+ }
6051
+ ) })
6052
+ ] })
6053
+ ] })
6054
+ ] }) })
6055
+ ] }),
6056
+ /* @__PURE__ */ jsxs("section", { className: sectionWrapperClass, children: [
6057
+ /* @__PURE__ */ jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsx("span", { children: "Glass Power Prescription" }) }),
6058
+ /* @__PURE__ */ jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsxs("table", { className: tableBaseClass, children: [
6059
+ /* @__PURE__ */ jsxs("thead", { children: [
6060
+ /* @__PURE__ */ jsxs("tr", { children: [
6061
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
6062
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Right Eye" }),
6063
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, colSpan: 5, children: "Left Eye" })
6064
+ ] }),
6065
+ /* @__PURE__ */ jsxs("tr", { children: [
6066
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass }),
6067
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
6068
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
6069
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
6070
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Prism" }),
6071
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "V/A" }),
6072
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Sph" }),
6073
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Cyl" }),
6074
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Axis" }),
6075
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "Prism" }),
6076
+ /* @__PURE__ */ jsx("th", { className: tableHeaderCellClass, children: "V/A" })
6077
+ ] })
6078
+ ] }),
6079
+ /* @__PURE__ */ jsxs("tbody", { children: [
6080
+ /* @__PURE__ */ jsxs("tr", { children: [
6081
+ /* @__PURE__ */ jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Glass Power" }),
6082
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
6083
+ Input,
6084
+ {
6085
+ disabled,
6086
+ type: "number",
6087
+ step: "0.25",
6088
+ className: numberInputClass,
6089
+ value: safe.glass_power_prescription.right_eye.sph ?? "",
6090
+ onChange: (e) => setRefractionField(
6091
+ "glass_power_prescription",
6092
+ "right_eye",
6093
+ "sph",
6094
+ e.target.value,
6095
+ "float"
6096
+ )
6097
+ }
6098
+ ) }),
6099
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
6100
+ Input,
6101
+ {
6102
+ disabled,
6103
+ type: "number",
6104
+ step: "0.25",
6105
+ className: numberInputClass,
6106
+ value: safe.glass_power_prescription.right_eye.cyl ?? "",
6107
+ onChange: (e) => setRefractionField(
6108
+ "glass_power_prescription",
6109
+ "right_eye",
6110
+ "cyl",
6111
+ e.target.value,
6112
+ "float"
6113
+ )
6114
+ }
6115
+ ) }),
6116
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
6117
+ Input,
6118
+ {
6119
+ disabled,
6120
+ type: "number",
6121
+ className: numberInputClass,
6122
+ value: safe.glass_power_prescription.right_eye.axis ?? "",
6123
+ onChange: (e) => setRefractionField(
6124
+ "glass_power_prescription",
6125
+ "right_eye",
6126
+ "axis",
6127
+ e.target.value,
6128
+ "int"
6129
+ )
6130
+ }
6131
+ ) }),
6132
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
6133
+ Input,
6134
+ {
6135
+ disabled,
6136
+ type: "number",
6137
+ step: "0.25",
6138
+ className: numberInputClass,
6139
+ value: safe.glass_power_prescription.right_eye.prism ?? "",
6140
+ onChange: (e) => setRefractionField(
6141
+ "glass_power_prescription",
6142
+ "right_eye",
6143
+ "prism",
6144
+ e.target.value,
6145
+ "float"
6146
+ )
6147
+ }
6148
+ ) }),
6149
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
6150
+ "select",
6151
+ {
6152
+ disabled,
6153
+ className: selectClass,
6154
+ value: safe.glass_power_prescription.right_eye.va,
6155
+ onChange: (e) => setRefractionField(
6156
+ "glass_power_prescription",
6157
+ "right_eye",
6158
+ "va",
6159
+ e.target.value,
6160
+ "select"
6161
+ ),
6162
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
6163
+ }
6164
+ ) }),
6165
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
6166
+ Input,
6167
+ {
6168
+ disabled,
6169
+ type: "number",
6170
+ step: "0.25",
6171
+ className: numberInputClass,
6172
+ value: safe.glass_power_prescription.left_eye.sph ?? "",
6173
+ onChange: (e) => setRefractionField(
6174
+ "glass_power_prescription",
6175
+ "left_eye",
6176
+ "sph",
6177
+ e.target.value,
6178
+ "float"
6179
+ )
6180
+ }
6181
+ ) }),
6182
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
6183
+ Input,
6184
+ {
6185
+ disabled,
6186
+ type: "number",
6187
+ step: "0.25",
6188
+ className: numberInputClass,
6189
+ value: safe.glass_power_prescription.left_eye.cyl ?? "",
6190
+ onChange: (e) => setRefractionField(
6191
+ "glass_power_prescription",
6192
+ "left_eye",
6193
+ "cyl",
6194
+ e.target.value,
6195
+ "float"
6196
+ )
6197
+ }
6198
+ ) }),
6199
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
6200
+ Input,
6201
+ {
6202
+ disabled,
6203
+ type: "number",
6204
+ className: numberInputClass,
6205
+ value: safe.glass_power_prescription.left_eye.axis ?? "",
6206
+ onChange: (e) => setRefractionField(
6207
+ "glass_power_prescription",
6208
+ "left_eye",
6209
+ "axis",
6210
+ e.target.value,
6211
+ "int"
6212
+ )
6213
+ }
6214
+ ) }),
6215
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
6216
+ Input,
6217
+ {
6218
+ disabled,
6219
+ type: "number",
6220
+ step: "0.25",
6221
+ className: numberInputClass,
6222
+ value: safe.glass_power_prescription.left_eye.prism ?? "",
6223
+ onChange: (e) => setRefractionField(
6224
+ "glass_power_prescription",
6225
+ "left_eye",
6226
+ "prism",
6227
+ e.target.value,
6228
+ "float"
6229
+ )
6230
+ }
6231
+ ) }),
6232
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, children: /* @__PURE__ */ jsx(
6233
+ "select",
6234
+ {
6235
+ disabled,
6236
+ className: selectClass,
6237
+ value: safe.glass_power_prescription.left_eye.va,
6238
+ onChange: (e) => setRefractionField(
6239
+ "glass_power_prescription",
6240
+ "left_eye",
6241
+ "va",
6242
+ e.target.value,
6243
+ "select"
6244
+ ),
6245
+ children: VA_OPTIONS.map((opt) => /* @__PURE__ */ jsx("option", { value: opt, children: opt }, opt || "blank"))
6246
+ }
6247
+ ) })
6248
+ ] }),
6249
+ /* @__PURE__ */ jsxs("tr", { children: [
6250
+ /* @__PURE__ */ jsx("td", { className: cn(tableCellClass, "font-semibold text-left px-2"), children: "Add" }),
6251
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsx(
6252
+ Input,
6253
+ {
6254
+ disabled,
6255
+ type: "number",
6256
+ step: "0.25",
6257
+ className: numberInputClass,
6258
+ value: safe.glass_power_prescription.add.right ?? "",
6259
+ onChange: (e) => setRefractionAdd("glass_power_prescription", "right", e.target.value)
6260
+ }
6261
+ ) }),
6262
+ /* @__PURE__ */ jsx("td", { className: tableCellClass, colSpan: 5, children: /* @__PURE__ */ jsx(
6263
+ Input,
6264
+ {
6265
+ disabled,
6266
+ type: "number",
6267
+ step: "0.25",
6268
+ className: numberInputClass,
6269
+ value: safe.glass_power_prescription.add.left ?? "",
6270
+ onChange: (e) => setRefractionAdd("glass_power_prescription", "left", e.target.value)
6271
+ }
6272
+ ) })
6273
+ ] })
6274
+ ] })
6275
+ ] }) })
6276
+ ] }),
6277
+ /* @__PURE__ */ jsxs("section", { className: sectionWrapperClass, children: [
6278
+ /* @__PURE__ */ jsx("div", { className: sectionHeaderClass, children: /* @__PURE__ */ jsx("span", { children: "Notes" }) }),
6279
+ /* @__PURE__ */ jsx("div", { className: sectionBodyClass, children: /* @__PURE__ */ jsx(
6280
+ Textarea,
6281
+ {
6282
+ disabled,
6283
+ rows: 4,
6284
+ className: "w-full text-xs min-h-[100px]",
6285
+ placeholder: "Enter additional notes...",
6286
+ value: safe.notes,
6287
+ onChange: (e) => setNotes(e.target.value)
6288
+ }
6289
+ ) })
6290
+ ] })
6291
+ ] });
6292
+ };
6293
+ var DIAGNOSIS_FIELDS = [
6294
+ "INJURY",
6295
+ "APPENDAGES",
6296
+ "CONJUNCTIVA",
6297
+ "SCLERA",
6298
+ "CORNEA",
6299
+ "ANTERIOR CHAMBER (AC)",
6300
+ "PUPIL",
6301
+ "IRIS",
6302
+ "LENS",
6303
+ "EXTRAOCULAR MOVEMENTS & SQUINT",
6304
+ "INTRAOCULAR PRESSURE (IOP)",
6305
+ "GONIOSCOPY",
6306
+ "FUNDUS"
6307
+ ];
6308
+ function ensureValue2(raw) {
6309
+ const v = raw || {};
6310
+ return {
6311
+ right_eye: v.right_eye ?? {},
6312
+ left_eye: v.left_eye ?? {}
6313
+ };
6314
+ }
6315
+ var containerClass = "rounded-md bg-white overflow-hidden flex flex-col";
6316
+ var headerClass = "px-3 py-2 text-sm font-medium text-slate-800 border-b border-slate-200";
6317
+ var tableClass = "w-full text-xs";
6318
+ var headerCellClass = "border border-slate-200 px-2 py-1 text-center font-semibold align-middle";
6319
+ var cellClass = "border border-slate-200 px-2 py-1 align-top";
6320
+ var OphthalDiagnosisWidget = ({ fieldId }) => {
6321
+ const { fieldDef, value, setValue, disabled } = useField(fieldId);
6322
+ const safe = useMemo(() => ensureValue2(value), [value]);
6323
+ const label = fieldDef?.label || "";
6324
+ const updateEyeField = (eye, fieldLabel, next) => {
6325
+ if (disabled) return;
6326
+ const prev = ensureValue2(value);
6327
+ setValue({
6328
+ ...prev,
6329
+ [eye]: {
6330
+ ...prev[eye],
6331
+ [fieldLabel]: next
6332
+ }
6333
+ });
6334
+ };
6335
+ return /* @__PURE__ */ jsxs("div", { className: cn("space-y-2", disabled && "opacity-70 pointer-events-none"), children: [
6336
+ label && /* @__PURE__ */ jsx("h3", { className: "text-base font-semibold text-slate-800", children: label }),
6337
+ /* @__PURE__ */ jsxs("section", { className: containerClass, children: [
6338
+ /* @__PURE__ */ jsx("div", { className: headerClass, children: /* @__PURE__ */ jsx("span", { className: "text-sm", children: "Diagnosis" }) }),
6339
+ /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { className: tableClass, children: [
6340
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
6341
+ /* @__PURE__ */ jsx("th", { className: cn(headerCellClass, "text-left px-3"), children: "Field" }),
6342
+ /* @__PURE__ */ jsx("th", { className: headerCellClass, children: "Right Eye" }),
6343
+ /* @__PURE__ */ jsx("th", { className: headerCellClass, children: "Left Eye" })
6344
+ ] }) }),
6345
+ /* @__PURE__ */ jsx("tbody", { children: DIAGNOSIS_FIELDS.map((fieldLabel) => /* @__PURE__ */ jsxs("tr", { children: [
6346
+ /* @__PURE__ */ jsx("td", { className: cn(cellClass, "text-left font-semibold px-3"), children: fieldLabel }),
6347
+ /* @__PURE__ */ jsx("td", { className: cellClass, children: /* @__PURE__ */ jsx(
6348
+ Textarea,
6349
+ {
6350
+ disabled,
6351
+ rows: 2,
6352
+ className: "w-full text-xs min-h-[60px] resize-none",
6353
+ value: safe.right_eye[fieldLabel] ?? "",
6354
+ onChange: (e) => updateEyeField("right_eye", fieldLabel, e.target.value)
6355
+ }
6356
+ ) }),
6357
+ /* @__PURE__ */ jsx("td", { className: cellClass, children: /* @__PURE__ */ jsx(
6358
+ Textarea,
6359
+ {
6360
+ disabled,
6361
+ rows: 2,
6362
+ className: "w-full text-xs min-h-[60px] resize-none",
6363
+ value: safe.left_eye[fieldLabel] ?? "",
6364
+ onChange: (e) => updateEyeField("left_eye", fieldLabel, e.target.value)
6365
+ }
6366
+ ) })
6367
+ ] }, fieldLabel)) })
6368
+ ] }) })
6369
+ ] })
6370
+ ] });
6371
+ };
4983
6372
  var FieldRenderer = ({ fieldId }) => {
4984
6373
  const { fieldDef, visible } = useField(fieldId);
4985
6374
  if (!visible || !fieldDef) {
@@ -5022,6 +6411,8 @@ var FieldRenderer = ({ fieldId }) => {
5022
6411
  return /* @__PURE__ */ jsx(DifferentialDiagnosisWidget, { fieldId });
5023
6412
  case "vitals":
5024
6413
  return /* @__PURE__ */ jsx(VitalsWidget, { fieldId });
6414
+ case "hidden_vitals":
6415
+ return /* @__PURE__ */ jsx(HiddenVitalsWidget, { fieldId });
5025
6416
  case "referral":
5026
6417
  return /* @__PURE__ */ jsx(ReferralWidget, { fieldId });
5027
6418
  case "followup":
@@ -5030,6 +6421,10 @@ var FieldRenderer = ({ fieldId }) => {
5030
6421
  return /* @__PURE__ */ jsx(SmartTextareaWidget, { fieldId });
5031
6422
  case "obstetric_history":
5032
6423
  return /* @__PURE__ */ jsx(ObstetricHistoryWidget, { fieldId });
6424
+ case "eye_prescription":
6425
+ return /* @__PURE__ */ jsx(OphthalmologyWidget, { fieldId });
6426
+ case "ophthal_diagnosis":
6427
+ return /* @__PURE__ */ jsx(OphthalDiagnosisWidget, { fieldId });
5033
6428
  case "static_text": {
5034
6429
  const def = fieldDef;
5035
6430
  const size = def.size ?? "regular";