@mindbill/react 0.77.38 → 0.77.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.js CHANGED
@@ -10061,12 +10061,12 @@ import { useEffect as useEffect13, useRef as useRef10, useState as useState15 }
10061
10061
  // src/rfa-identity-select.tsx
10062
10062
  import { useId as useId5, useRef as useRef9, useState as useState13 } from "react";
10063
10063
  import { Fragment as Fragment12, jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
10064
- function RfaIdentitySelect({ label: label5, placeholder, searchPlaceholder, query, searchable, disabled = false, loading = false, error = "", value, options, onSearch, onSelect }) {
10064
+ function RfaIdentitySelect({ label: label5, placeholder, searchPlaceholder, query, searchable, disabled = false, loading = false, error = "", value, options, onSearch, onSelect, current }) {
10065
10065
  const id = useId5();
10066
10066
  const trigger = useRef9(null);
10067
10067
  const [open, setOpen] = useState13(false);
10068
10068
  const [active, setActive] = useState13(0);
10069
- const selected = options.find((option) => option.id === value);
10069
+ const selected = options.find((option) => option.id === value) ?? (current?.id === value ? current : void 0);
10070
10070
  const choose = (option) => {
10071
10071
  onSelect(option.id);
10072
10072
  setOpen(false);
@@ -10505,8 +10505,10 @@ function TreatmentDraftShell({ title, description, children, hideHeading = false
10505
10505
  .mbtd .mbrfa-picker p,.mbtd .mbrfa-guidance p{margin:0;font-size:12px}.mbtd .mbrfa-guidance{display:grid;gap:4px}
10506
10506
  .mbtd .mbrfa-section-actions{display:flex;gap:12px;align-items:center;margin-top:14px;font-size:12px;color:var(--mb-muted)}
10507
10507
  .mbtd .mbrfa-field-hint{font-size:12px;color:var(--mb-muted);font-weight:400}
10508
- .mbtd .mbrfa-template-save{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 16px;margin-top:10px}.mbtd .mbrfa-template-save>label{display:grid;gap:4px;font-size:12px;color:var(--mb-muted)}.mbtd .mbrfa-template-save>.mbrfa-check{display:flex;flex-direction:row;align-items:center;gap:8px;cursor:pointer}.mbtd .mbrfa-template-save>.mbrfa-check>input{width:16px;height:16px;min-height:16px;margin:0;padding:0;flex:0 0 16px;accent-color:var(--mb-accent)}.mbtd .mbrfa-template-save>:is(.mbrfa-check,.mbrfa-section-actions){grid-column:1/-1;margin-top:0;padding-top:0;border-top:0}
10508
+ .mbtd .mbrfa-template-save{display:grid;grid-template-columns:minmax(0,420px);gap:10px 16px;margin-top:10px}.mbtd .mbrfa-template-save>label{display:grid;gap:4px;font-size:12px;color:var(--mb-muted)}.mbtd .mbrfa-template-save>.mbrfa-check{display:flex;flex-direction:row;align-items:center;gap:8px;cursor:pointer}.mbtd .mbrfa-template-save>.mbrfa-check>input{width:16px;height:16px;min-height:16px;margin:0;padding:0;flex:0 0 16px;accent-color:var(--mb-accent)}.mbtd .mbrfa-template-save>:is(.mbrfa-check,.mbrfa-section-actions){grid-column:1/-1;margin-top:0;padding-top:0;border-top:0}
10509
10509
  @media(max-width:760px){.mbtd .mbrfa-template-save{grid-template-columns:minmax(0,1fr)}}
10510
+ .mbtd .mbrfa-form-grid>.mbrfa-row-start{grid-column:1/span 3}.mbtd .mbrfa-form-grid textarea[rows="2"]{min-height:44px}
10511
+ .mbtd .mbrfa-review-type{display:grid;gap:4px;margin-top:10px;padding-top:12px;border-top:1px dashed var(--mb-border)}.mbtd .mbrfa-review-type>span{font-size:12px;font-weight:500;color:var(--mb-muted)}.mbtd .mbrfa-review-type>span>small{margin-left:10px;font-weight:400}
10510
10512
  .mbtd .mbrfa-req{color:var(--mb-danger,#c0392b);font-weight:700}
10511
10513
  .mbtd .mbrfa-contact-grid{grid-template-columns:repeat(4,minmax(0,1fr))}.mbtd .mbrfa-contact-grid>.mbrfa-s3{grid-column:span 2}.mbtd .mbrfa-contact-grid>:is(.mbrfa-s1,.mbrfa-s2){grid-column:span 1}
10512
10514
  .mbtd .mbrfa-link-out{color:var(--mb-muted)!important;text-decoration:none}.mbtd .mbrfa-link-out:hover{text-decoration:underline}.mbtd .mbrfa-picker-links a{text-decoration:none}
@@ -12760,6 +12762,7 @@ function RfaDiagnosisFields({ code, description, onChange, search, officialForm
12760
12762
  const [query, setQuery] = useState24("");
12761
12763
  const [results, setResults] = useState24([]);
12762
12764
  const [error, setError] = useState24("");
12765
+ const [manualDiagnosis, setManualDiagnosis] = useState24(false);
12763
12766
  useEffect21(() => {
12764
12767
  let active = true;
12765
12768
  setResults([]);
@@ -12769,7 +12772,7 @@ function RfaDiagnosisFields({ code, description, onChange, search, officialForm
12769
12772
  void search(query.trim()).then((items) => {
12770
12773
  if (active) setResults(items);
12771
12774
  }).catch(() => {
12772
- if (active) setError("Diagnosis search is unavailable. Enter the code and description below.");
12775
+ if (active) setError("Diagnosis search is unavailable.");
12773
12776
  });
12774
12777
  }, 250);
12775
12778
  return () => {
@@ -12777,25 +12780,59 @@ function RfaDiagnosisFields({ code, description, onChange, search, officialForm
12777
12780
  clearTimeout(timer);
12778
12781
  };
12779
12782
  }, [query, search]);
12783
+ if (officialForm && search) {
12784
+ const typed = query.trim().toUpperCase(), known = results.some((item) => item.code.toUpperCase() === typed);
12785
+ const options = [
12786
+ ...code && !typed && !results.some((item) => item.code === code) ? [{ id: code, label: code, ...description ? { detail: description } : {} }] : [],
12787
+ ...results.map((item) => ({ id: item.code, label: item.code, detail: item.description })),
12788
+ .../^[A-Z]\d[0-9A-Z](\.?[0-9A-Z]{1,4})?$/.test(typed) && !known && typed !== code ? [{ id: `entered:${typed}`, label: `Use ${typed}`, detail: "Enter the diagnosis yourself" }] : []
12789
+ ];
12790
+ const listed = results.find((item) => item.code === code);
12791
+ return /* @__PURE__ */ jsxs37(Fragment22, { children: [
12792
+ /* @__PURE__ */ jsx39("div", { className: "mbrfa-s3", children: /* @__PURE__ */ jsx39(RfaPicker, { required: true, label: "ICD-10 Code", children: /* @__PURE__ */ jsx39(
12793
+ RfaIdentitySelect,
12794
+ {
12795
+ label: "ICD-10 Code",
12796
+ placeholder: "Enter code",
12797
+ searchPlaceholder: "Search by code or diagnosis",
12798
+ query,
12799
+ onSearch: setQuery,
12800
+ searchable: true,
12801
+ value: code,
12802
+ current: code ? { id: code, label: code, ...description ? { detail: description } : {} } : void 0,
12803
+ options,
12804
+ error,
12805
+ onSelect: (value) => {
12806
+ const item = results.find((item2) => item2.code === value);
12807
+ if (item) onChange({ diagnosisCode: item.code, diagnosisDescription: item.description });
12808
+ else if (value.startsWith("entered:")) onChange({ diagnosisCode: value.slice(8), diagnosisDescription: "" });
12809
+ setQuery("");
12810
+ }
12811
+ }
12812
+ ) }) }),
12813
+ code && !listed && (manualDiagnosis || !description) ? /* @__PURE__ */ jsxs37("label", { className: "mbrfa-s3", children: [
12814
+ /* @__PURE__ */ jsxs37("span", { children: [
12815
+ "Diagnosis",
12816
+ /* @__PURE__ */ jsx39(RfaRequired, {})
12817
+ ] }),
12818
+ /* @__PURE__ */ jsx39("input", { required: true, autoFocus: manualDiagnosis, maxLength: 1e3, placeholder: "Diagnosis for this code", value: description ?? "", onFocus: () => setManualDiagnosis(true), onChange: (event) => onChange({ diagnosisCode: code, diagnosisDescription: event.target.value }) })
12819
+ ] }) : null
12820
+ ] });
12821
+ }
12780
12822
  if (officialForm) return /* @__PURE__ */ jsxs37(Fragment22, { children: [
12781
- search ? /* @__PURE__ */ jsx39("div", { className: "mbrfa-s6", children: /* @__PURE__ */ jsx39(RfaPicker, { label: "Find diagnosis", children: /* @__PURE__ */ jsx39(RfaIdentitySelect, { label: "Find diagnosis", placeholder: "Search by ICD code or description", searchPlaceholder: "Search ICD code or diagnosis", query, onSearch: setQuery, searchable: true, value: "", options: results.map((item) => ({ id: item.code, label: `${item.code} \u2014 ${item.description}` })), onSelect: (value) => {
12782
- const item = results.find((item2) => item2.code === value);
12783
- if (item) onChange({ diagnosisCode: item.code, diagnosisDescription: item.description });
12784
- setQuery("");
12785
- }, error }) }) }) : null,
12786
- /* @__PURE__ */ jsxs37("label", { className: "mbrfa-s4", children: [
12823
+ /* @__PURE__ */ jsxs37("label", { className: "mbrfa-s2", children: [
12787
12824
  /* @__PURE__ */ jsxs37("span", { children: [
12788
- "Diagnosis",
12825
+ "ICD-10 Code",
12789
12826
  /* @__PURE__ */ jsx39(RfaRequired, {})
12790
12827
  ] }),
12791
- /* @__PURE__ */ jsx39("input", { required: true, maxLength: 1e3, value: description ?? "", onChange: (event) => onChange({ diagnosisCode: code, diagnosisDescription: event.target.value }) })
12828
+ /* @__PURE__ */ jsx39("input", { required: true, maxLength: 16, placeholder: "Enter code", value: code, onChange: (event) => onChange({ diagnosisCode: event.target.value, diagnosisDescription: description ?? "" }) })
12792
12829
  ] }),
12793
- /* @__PURE__ */ jsxs37("label", { className: "mbrfa-s2", children: [
12830
+ /* @__PURE__ */ jsxs37("label", { className: "mbrfa-s4", children: [
12794
12831
  /* @__PURE__ */ jsxs37("span", { children: [
12795
- "ICD-Code",
12832
+ "Diagnosis",
12796
12833
  /* @__PURE__ */ jsx39(RfaRequired, {})
12797
12834
  ] }),
12798
- /* @__PURE__ */ jsx39("input", { required: true, maxLength: 16, value: code, onChange: (event) => onChange({ diagnosisCode: event.target.value, diagnosisDescription: description ?? "" }) })
12835
+ /* @__PURE__ */ jsx39("input", { required: true, maxLength: 1e3, value: description ?? "", onChange: (event) => onChange({ diagnosisCode: code, diagnosisDescription: event.target.value }) })
12799
12836
  ] })
12800
12837
  ] });
12801
12838
  return /* @__PURE__ */ jsxs37(Fragment22, { children: [
@@ -12977,7 +13014,6 @@ function RfaTemplateBar({ templates, items, renderingProviderId, physicianName,
12977
13014
  const [applied, setApplied] = useState26("");
12978
13015
  const [saving, setSaving] = useState26(false);
12979
13016
  const [name, setName] = useState26("");
12980
- const [description, setDescription] = useState26("");
12981
13017
  const [mine, setMine] = useState26(false);
12982
13018
  const [busy, setBusy] = useState26(false);
12983
13019
  const [error, setError] = useState26("");
@@ -12988,10 +13024,9 @@ function RfaTemplateBar({ templates, items, renderingProviderId, physicianName,
12988
13024
  setBusy(true);
12989
13025
  setError("");
12990
13026
  try {
12991
- await onSave({ name: name.trim(), ...description.trim() ? { description: description.trim() } : {}, ...mine && renderingProviderId ? { renderingProviderId } : {}, items: reusable });
13027
+ await onSave({ name: name.trim(), ...mine && renderingProviderId ? { renderingProviderId } : {}, items: reusable });
12992
13028
  setSaving(false);
12993
13029
  setName("");
12994
- setDescription("");
12995
13030
  setMine(false);
12996
13031
  } catch {
12997
13032
  setError("The template could not be saved. Try again.");
@@ -13031,15 +13066,6 @@ function RfaTemplateBar({ templates, items, renderingProviderId, physicianName,
13031
13066
  }
13032
13067
  } })
13033
13068
  ] }),
13034
- /* @__PURE__ */ jsxs39("label", { children: [
13035
- /* @__PURE__ */ jsx41("span", { children: "Description (optional)" }),
13036
- /* @__PURE__ */ jsx41("input", { maxLength: 200, value: description, onChange: (event) => setDescription(event.target.value), onKeyDown: (event) => {
13037
- if (event.key === "Enter") {
13038
- event.preventDefault();
13039
- void save();
13040
- }
13041
- } })
13042
- ] }),
13043
13069
  renderingProviderId ? /* @__PURE__ */ jsxs39("label", { className: "mbrfa-check", children: [
13044
13070
  /* @__PURE__ */ jsx41("input", { type: "checkbox", checked: mine, onChange: (event) => setMine(event.target.checked) }),
13045
13071
  /* @__PURE__ */ jsxs39("span", { children: [
@@ -13269,6 +13295,21 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
13269
13295
  /* @__PURE__ */ jsxs40("label", { className: "mbrfa-check", children: [
13270
13296
  /* @__PURE__ */ jsx42("input", { type: "checkbox", checked: draft2.writtenConfirmation ?? false, onChange: (event) => update({ writtenConfirmation: event.target.checked }) }),
13271
13297
  "Check box if request is a written confirmation of a prior oral request"
13298
+ ] }),
13299
+ /* @__PURE__ */ jsxs40("div", { className: "mbrfa-review-type", children: [
13300
+ /* @__PURE__ */ jsxs40("span", { children: [
13301
+ "Review type",
13302
+ /* @__PURE__ */ jsx42(RfaRequired, {}),
13303
+ /* @__PURE__ */ jsx42("small", { children: "Sets the decision due date. Not printed on the RFA." })
13304
+ ] }),
13305
+ /* @__PURE__ */ jsx42("div", { className: "mbrfa-request-types", role: "group", "aria-label": "Review type", children: [["prospective", "Prospective", "before treatment"], ["concurrent", "Concurrent", "during inpatient treatment"], ["retrospective", "Retrospective", "after treatment"]].map(([value, name, when]) => /* @__PURE__ */ jsxs40("label", { className: "mbrfa-check", children: [
13306
+ /* @__PURE__ */ jsx42("input", { type: "radio", name: "review-type", checked: (draft2.reviewType ?? "prospective") === value, onChange: () => update({ reviewType: value }) }),
13307
+ /* @__PURE__ */ jsxs40("span", { children: [
13308
+ /* @__PURE__ */ jsx42("strong", { children: name }),
13309
+ " \u2013 ",
13310
+ when
13311
+ ] })
13312
+ ] }, value)) })
13272
13313
  ] })
13273
13314
  ] })
13274
13315
  ] }),
@@ -13311,20 +13352,20 @@ function RfaDraftForm({ initialDraft, identity, officialForm = false, formDetail
13311
13352
  index === 0 && (treatmentTemplates || onSaveTreatmentTemplate) ? /* @__PURE__ */ jsx42(RfaTemplateBar, { templates: treatmentTemplates ?? [], items: draft2.items, renderingProviderId: draft2.renderingProviderId, physicianName: draft2.providerName, disabled: locked, onApply: (items) => update({ items }), onSave: onSaveTreatmentTemplate, onManage: onManageTreatmentTemplates }) : null,
13312
13353
  /* @__PURE__ */ jsxs40("div", { className: "mbrfa-form-grid", children: [
13313
13354
  /* @__PURE__ */ jsx42(RfaDiagnosisFields, { officialForm: true, code: item.diagnosisCode, ...item.diagnosisDescription !== void 0 ? { description: item.diagnosisDescription } : {}, ...searchDiagnosisCodes ? { search: searchDiagnosisCodes } : {}, onChange: (value) => updateItem(index, value) }),
13314
- /* @__PURE__ */ jsxs40("label", { className: "mbrfa-s4", children: [
13355
+ /* @__PURE__ */ jsxs40("label", { className: "mbrfa-s3 mbrfa-row-start", children: [
13315
13356
  /* @__PURE__ */ jsxs40("span", { children: [
13316
13357
  "Service/Good Requested",
13317
13358
  /* @__PURE__ */ jsx42(RfaRequired, {})
13318
13359
  ] }),
13319
- /* @__PURE__ */ jsx42("textarea", { required: true, maxLength: 1e3, value: item.serviceDescription, onChange: (event) => updateItem(index, { serviceDescription: event.target.value }) })
13360
+ /* @__PURE__ */ jsx42("textarea", { rows: 2, required: true, maxLength: 1e3, value: item.serviceDescription, onChange: (event) => updateItem(index, { serviceDescription: event.target.value }) })
13320
13361
  ] }),
13321
- /* @__PURE__ */ jsxs40("label", { className: "mbrfa-s2", children: [
13322
- "CPT/HCPCS Code (If known)",
13323
- /* @__PURE__ */ jsx42("input", { maxLength: 16, value: item.procedureCode ?? "", onChange: (event) => updateItem(index, { procedureCode: event.target.value }) })
13362
+ /* @__PURE__ */ jsxs40("label", { className: "mbrfa-s1", children: [
13363
+ /* @__PURE__ */ jsx42("span", { children: "CPT/HCPCS Code" }),
13364
+ /* @__PURE__ */ jsx42("input", { placeholder: "Optional", maxLength: 16, value: item.procedureCode ?? "", onChange: (event) => updateItem(index, { procedureCode: event.target.value }) })
13324
13365
  ] }),
13325
- /* @__PURE__ */ jsxs40("label", { className: "mbrfa-s6", children: [
13326
- "Other Information: (Frequency, Duration, Quantity, etc.)",
13327
- /* @__PURE__ */ jsx42("textarea", { maxLength: 2e3, value: typeof item.metadata?.otherInformation === "string" ? item.metadata.otherInformation : [item.quantity !== void 0 ? `Quantity: ${item.quantity}` : "", item.units !== void 0 ? `Units: ${item.units}` : "", item.frequency, item.duration, item.requestedFrom ? `From: ${item.requestedFrom}` : "", item.requestedTo ? `Through: ${item.requestedTo}` : ""].filter(Boolean).join("; "), onChange: (event) => updateItem(index, { metadata: { ...item.metadata, otherInformation: event.target.value } }) })
13366
+ /* @__PURE__ */ jsxs40("label", { className: "mbrfa-s2", children: [
13367
+ /* @__PURE__ */ jsx42("span", { children: "Other Information" }),
13368
+ /* @__PURE__ */ jsx42("textarea", { rows: 2, placeholder: "Frequency, duration, quantity, etc. (optional)", maxLength: 2e3, value: typeof item.metadata?.otherInformation === "string" ? item.metadata.otherInformation : [item.quantity !== void 0 ? `Quantity: ${item.quantity}` : "", item.units !== void 0 ? `Units: ${item.units}` : "", item.frequency, item.duration, item.requestedFrom ? `From: ${item.requestedFrom}` : "", item.requestedTo ? `Through: ${item.requestedTo}` : ""].filter(Boolean).join("; "), onChange: (event) => updateItem(index, { metadata: { ...item.metadata, otherInformation: event.target.value } }) })
13328
13369
  ] })
13329
13370
  ] }),
13330
13371
  /* @__PURE__ */ jsxs40("div", { className: "mbtd-actions", children: [