@photonhealth/react 2.0.0-rc.1 → 2.0.0-rc.2
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/README.md +35 -8
- package/dist/adapters/tailwind.d.ts.map +1 -1
- package/dist/adapters/tailwind.js +7 -4
- package/dist/adapters/tailwind.js.map +1 -1
- package/dist/analytics/PhotonAnalyticsProvider.d.ts +16 -0
- package/dist/analytics/PhotonAnalyticsProvider.d.ts.map +1 -0
- package/dist/analytics/PhotonAnalyticsProvider.js +57 -0
- package/dist/analytics/PhotonAnalyticsProvider.js.map +1 -0
- package/dist/analytics/fieldInteraction.d.ts +18 -0
- package/dist/analytics/fieldInteraction.d.ts.map +1 -0
- package/dist/analytics/fieldInteraction.js +102 -0
- package/dist/analytics/fieldInteraction.js.map +1 -0
- package/dist/analytics/tracker.d.ts +17 -0
- package/dist/analytics/tracker.d.ts.map +1 -0
- package/dist/analytics/tracker.js +36 -0
- package/dist/analytics/tracker.js.map +1 -0
- package/dist/analytics/viewed.d.ts +11 -0
- package/dist/analytics/viewed.d.ts.map +1 -0
- package/dist/analytics/viewed.js +16 -0
- package/dist/analytics/viewed.js.map +1 -0
- package/dist/components/PhotonOrder.d.ts.map +1 -1
- package/dist/components/PhotonOrder.js +20 -16
- package/dist/components/PhotonOrder.js.map +1 -1
- package/dist/components/PhotonPatient.d.ts.map +1 -1
- package/dist/components/PhotonPatient.js +4 -2
- package/dist/components/PhotonPatient.js.map +1 -1
- package/dist/components/PhotonPrescription.d.ts +1 -12
- package/dist/components/PhotonPrescription.d.ts.map +1 -1
- package/dist/components/PhotonPrescription.js +7 -360
- package/dist/components/PhotonPrescription.js.map +1 -1
- package/dist/components/format.d.ts +2 -2
- package/dist/components/format.js +2 -2
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/order/DraftOrderPrompt.d.ts +18 -0
- package/dist/components/order/DraftOrderPrompt.d.ts.map +1 -0
- package/dist/components/order/DraftOrderPrompt.js +26 -0
- package/dist/components/order/DraftOrderPrompt.js.map +1 -0
- package/dist/components/patient/Benefits.d.ts.map +1 -1
- package/dist/components/patient/Benefits.js +2 -1
- package/dist/components/patient/Benefits.js.map +1 -1
- package/dist/components/patient/Clinical.d.ts +3 -2
- package/dist/components/patient/Clinical.d.ts.map +1 -1
- package/dist/components/patient/Clinical.js +21 -20
- package/dist/components/patient/Clinical.js.map +1 -1
- package/dist/components/patient/IntakeForm.d.ts.map +1 -1
- package/dist/components/patient/IntakeForm.js +52 -43
- package/dist/components/patient/IntakeForm.js.map +1 -1
- package/dist/components/patient/Summary.d.ts +1 -1
- package/dist/components/patient/Summary.d.ts.map +1 -1
- package/dist/components/patient/Summary.js +13 -3
- package/dist/components/patient/Summary.js.map +1 -1
- package/dist/components/patient/fields.d.ts +1 -2
- package/dist/components/patient/fields.d.ts.map +1 -1
- package/dist/components/patient/fields.js +2 -1
- package/dist/components/patient/fields.js.map +1 -1
- package/dist/components/patient/query.d.ts +14 -0
- package/dist/components/patient/query.d.ts.map +1 -1
- package/dist/components/patient/query.js +5 -0
- package/dist/components/patient/query.js.map +1 -1
- package/dist/components/prescription/PrescriptionCard.d.ts +45 -0
- package/dist/components/prescription/PrescriptionCard.d.ts.map +1 -0
- package/dist/components/prescription/PrescriptionCard.js +179 -0
- package/dist/components/prescription/PrescriptionCard.js.map +1 -0
- package/dist/components/prescription/PrescriptionDetailsForm/DirectionsInput.d.ts +15 -0
- package/dist/components/prescription/PrescriptionDetailsForm/DirectionsInput.d.ts.map +1 -0
- package/dist/components/prescription/PrescriptionDetailsForm/DirectionsInput.js +18 -0
- package/dist/components/prescription/PrescriptionDetailsForm/DirectionsInput.js.map +1 -0
- package/dist/components/prescription/PrescriptionDetailsForm/DispenseInputs.d.ts +23 -0
- package/dist/components/prescription/PrescriptionDetailsForm/DispenseInputs.d.ts.map +1 -0
- package/dist/components/prescription/PrescriptionDetailsForm/DispenseInputs.js +42 -0
- package/dist/components/prescription/PrescriptionDetailsForm/DispenseInputs.js.map +1 -0
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.d.ts +27 -0
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.d.ts.map +1 -0
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.js +169 -0
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.js.map +1 -0
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.d.ts +8 -0
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.d.ts.map +1 -0
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.js +12 -0
- package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.js.map +1 -0
- package/dist/components/prescription/PrescriptionDetailsForm/TemplatePicker.d.ts +11 -0
- package/dist/components/prescription/PrescriptionDetailsForm/TemplatePicker.d.ts.map +1 -0
- package/dist/components/prescription/PrescriptionDetailsForm/TemplatePicker.js +25 -0
- package/dist/components/prescription/PrescriptionDetailsForm/TemplatePicker.js.map +1 -0
- package/dist/components/prescription/TreatmentSearch/TreatmentPicker.d.ts +50 -0
- package/dist/components/prescription/TreatmentSearch/TreatmentPicker.d.ts.map +1 -0
- package/dist/components/{TreatmentPicker.js → prescription/TreatmentSearch/TreatmentPicker.js} +113 -105
- package/dist/components/prescription/TreatmentSearch/TreatmentPicker.js.map +1 -0
- package/dist/components/prescription/TreatmentSearch/TreatmentSearch.d.ts +28 -0
- package/dist/components/prescription/TreatmentSearch/TreatmentSearch.d.ts.map +1 -0
- package/dist/components/prescription/TreatmentSearch/TreatmentSearch.js +146 -0
- package/dist/components/prescription/TreatmentSearch/TreatmentSearch.js.map +1 -0
- package/dist/components/schemaErrors.d.ts +12 -0
- package/dist/components/schemaErrors.d.ts.map +1 -0
- package/dist/components/schemaErrors.js +24 -0
- package/dist/components/schemaErrors.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/meta/version.d.ts +5 -0
- package/dist/meta/version.d.ts.map +1 -0
- package/dist/meta/version.js +5 -0
- package/dist/meta/version.js.map +1 -0
- package/dist/primitives/PhotonProvider.d.ts +3 -1
- package/dist/primitives/PhotonProvider.d.ts.map +1 -1
- package/dist/primitives/PhotonProvider.js +23 -11
- package/dist/primitives/PhotonProvider.js.map +1 -1
- package/dist/primitives/defaults.d.ts.map +1 -1
- package/dist/primitives/defaults.js +6 -3
- package/dist/primitives/defaults.js.map +1 -1
- package/dist/primitives/photonContext.d.ts +3 -0
- package/dist/primitives/photonContext.d.ts.map +1 -0
- package/dist/primitives/photonContext.js +3 -0
- package/dist/primitives/photonContext.js.map +1 -0
- package/dist/primitives/types.d.ts +15 -3
- package/dist/primitives/types.d.ts.map +1 -1
- package/dist/primitives/types.js.map +1 -1
- package/dist/primitives/useProvidedPhoton.d.ts +8 -0
- package/dist/primitives/useProvidedPhoton.d.ts.map +1 -0
- package/dist/primitives/useProvidedPhoton.js +8 -0
- package/dist/primitives/useProvidedPhoton.js.map +1 -0
- package/dist/styles.css +45 -3
- package/dist/test-utils/contract.d.ts.map +1 -1
- package/dist/test-utils/contract.js +23 -2
- package/dist/test-utils/contract.js.map +1 -1
- package/package.json +5 -3
- package/src/adapters/tailwind.tsx +52 -24
- package/src/analytics/PhotonAnalyticsProvider.test.tsx +191 -0
- package/src/analytics/PhotonAnalyticsProvider.tsx +96 -0
- package/src/analytics/fieldInteraction.test.tsx +184 -0
- package/src/analytics/fieldInteraction.tsx +148 -0
- package/src/analytics/tracker.test.ts +52 -0
- package/src/analytics/tracker.ts +42 -0
- package/src/analytics/viewed.ts +27 -0
- package/src/components/PhotonOrder.test.tsx +256 -0
- package/src/components/PhotonOrder.tsx +45 -30
- package/src/components/PhotonPatient.tsx +11 -7
- package/src/components/PhotonPrescription.test.tsx +116 -0
- package/src/components/PhotonPrescription.tsx +10 -570
- package/src/components/format.ts +2 -2
- package/src/components/index.ts +1 -1
- package/src/components/order/DraftOrderPrompt.test.tsx +80 -0
- package/src/components/order/DraftOrderPrompt.tsx +81 -0
- package/src/components/patient/Benefits.tsx +21 -13
- package/src/components/patient/Clinical.tsx +31 -26
- package/src/components/patient/IntakeForm.test.tsx +89 -0
- package/src/components/patient/IntakeForm.tsx +168 -136
- package/src/components/patient/Summary.test.tsx +106 -0
- package/src/components/patient/Summary.tsx +54 -34
- package/src/components/patient/fields.tsx +52 -38
- package/src/components/patient/query.ts +6 -0
- package/src/components/prescription/PrescriptionCard.test.tsx +85 -0
- package/src/components/prescription/PrescriptionCard.tsx +347 -0
- package/src/components/prescription/PrescriptionDetailsForm/DirectionsInput.test.tsx +85 -0
- package/src/components/prescription/PrescriptionDetailsForm/DirectionsInput.tsx +41 -0
- package/src/components/prescription/PrescriptionDetailsForm/DispenseInputs.test.tsx +209 -0
- package/src/components/prescription/PrescriptionDetailsForm/DispenseInputs.tsx +99 -0
- package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.test.tsx +456 -0
- package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.tsx +238 -0
- package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.test.ts +63 -0
- package/src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.ts +15 -0
- package/src/components/prescription/PrescriptionDetailsForm/TemplatePicker.test.tsx +75 -0
- package/src/components/prescription/PrescriptionDetailsForm/TemplatePicker.tsx +41 -0
- package/src/components/prescription/TreatmentSearch/TreatmentPicker.tsx +375 -0
- package/src/components/prescription/TreatmentSearch/TreatmentSearch.test.tsx +699 -0
- package/src/components/prescription/TreatmentSearch/TreatmentSearch.tsx +220 -0
- package/src/components/schemaErrors.test.ts +49 -0
- package/src/components/schemaErrors.ts +33 -0
- package/src/index.ts +2 -0
- package/src/meta/version.test.ts +10 -0
- package/src/meta/version.ts +4 -0
- package/src/primitives/PhotonProvider.tsx +30 -15
- package/src/primitives/defaults.tsx +44 -21
- package/src/primitives/photonContext.ts +4 -0
- package/src/primitives/types.ts +15 -3
- package/src/primitives/useProvidedPhoton.ts +21 -0
- package/src/styles.css +45 -3
- package/src/test-utils/contract.tsx +45 -2
- package/dist/components/TreatmentPicker.d.ts +0 -45
- package/dist/components/TreatmentPicker.d.ts.map +0 -1
- package/dist/components/TreatmentPicker.js.map +0 -1
- package/src/components/TreatmentPicker.tsx +0 -350
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrescriptionCard.js","sourceRoot":"","sources":["../../../src/components/prescription/PrescriptionCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EACL,QAAQ,EACR,OAAO,EACP,YAAY,GAQb,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAe,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAc,MAAM,YAAY,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAmB,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,sDAAuD,CAAC;AAChG,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAwB,MAAM,sCAAuC,CAAC;AA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C,WAAW,YAAE,QAAQ,GAAQ,CACzC,CAAC,CAAC,CAAC,IAAI,CAAC;IACT,OAAO,CACL,MAAC,KAAK,IAAC,GAAG,EAAC,GAAG,aACZ,MAAC,GAAG,IAAC,GAAG,EAAC,GAAG,EAAC,OAAO,EAAC,SAAS,aAC3B,KAAK,IAAI,gBAAQ,EACjB,MAAM,IACH,EACL,EAAE,CAAC,YAAY,IAAI,QAAQ,IAAI,KAAC,IAAI,IAAC,IAAI,EAAC,WAAW,YAAE,QAAQ,GAAQ,IAClE,CACT,CAAC;AACJ,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,GAAG,CAAC,EAA6B,EAAE,EAAE,CACnD,EAAE,EAAE,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,eAAe,IAAI,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** A prescription's directions (sig). Its value is kept by PrescriptionDetailsForm, which decides what's saved. */
|
|
2
|
+
export interface DirectionsInputProps {
|
|
3
|
+
value: string;
|
|
4
|
+
/** What's wrong with it, shown under it. */
|
|
5
|
+
errorMessage?: string;
|
|
6
|
+
/** Typed since it was last committed. */
|
|
7
|
+
edited: boolean;
|
|
8
|
+
/** Where the card flow (← / →) lands, when Treatment isn't. */
|
|
9
|
+
focusable: boolean;
|
|
10
|
+
onEdit: (value: string) => void;
|
|
11
|
+
/** Leaving the field after editing it. */
|
|
12
|
+
onCommit: () => void;
|
|
13
|
+
}
|
|
14
|
+
export declare function DirectionsInput({ value, errorMessage, edited, focusable, onEdit, onCommit }: DirectionsInputProps): import("react").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=DirectionsInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DirectionsInput.d.ts","sourceRoot":"","sources":["../../../../src/components/prescription/PrescriptionDetailsForm/DirectionsInput.tsx"],"names":[],"mappings":"AAIA,mHAAmH;AACnH,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,MAAM,EAAE,OAAO,CAAC;IAChB,+DAA+D;IAC/D,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,oBAAoB,+BAsBjH"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useComponents } from "../../../primitives/index.js";
|
|
3
|
+
import { focusProps } from "../../flow.js";
|
|
4
|
+
import { useFieldInteractions } from "../../../analytics/fieldInteraction.js";
|
|
5
|
+
export function DirectionsInput({ value, errorMessage, edited, focusable, onEdit, onCommit }) {
|
|
6
|
+
const { Textarea } = useComponents();
|
|
7
|
+
const directions = useFieldInteractions("add_prescription_form")("instructions", { isOptional: false });
|
|
8
|
+
return (_jsx("div", { ...(focusable ? focusProps : {}), ...directions, children: _jsx(Textarea, { label: "Directions (sig)", rows: 2, value: value, invalid: Boolean(errorMessage), errorMessage: errorMessage,
|
|
9
|
+
// A value the server filled in (e.g. "Take as directed") is selected, so typing replaces it.
|
|
10
|
+
onFocus: (e) => {
|
|
11
|
+
if (!edited)
|
|
12
|
+
e.currentTarget.select();
|
|
13
|
+
}, onChange: (e) => onEdit(e.target.value), onBlur: () => {
|
|
14
|
+
if (edited)
|
|
15
|
+
onCommit();
|
|
16
|
+
} }) }));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=DirectionsInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DirectionsInput.js","sourceRoot":"","sources":["../../../../src/components/prescription/PrescriptionDetailsForm/DirectionsInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAyC,CAAC;AAgB/E,MAAM,UAAU,eAAe,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAwB;IAChH,MAAM,EAAE,QAAQ,EAAE,GAAG,aAAa,EAAE,CAAC;IACrC,MAAM,UAAU,GAAG,oBAAoB,CAAC,uBAAuB,CAAC,CAAC,cAAc,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;IACxG,OAAO,CACL,iBAAS,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,KAAM,UAAU,YACpD,KAAC,QAAQ,IACP,KAAK,EAAC,kBAAkB,EACxB,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,EAC9B,YAAY,EAAE,YAAY;YAC1B,6FAA6F;YAC7F,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;gBACb,IAAI,CAAC,MAAM;oBAAE,CAAC,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC;YACxC,CAAC,EACD,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACvC,MAAM,EAAE,GAAG,EAAE;gBACX,IAAI,MAAM;oBAAE,QAAQ,EAAE,CAAC;YACzB,CAAC,GACD,GACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { PrescriptionEdits } from "@photonhealth/client";
|
|
2
|
+
export type DispenseField = "quantity" | "unit" | "daysSupply" | "refills";
|
|
3
|
+
export type DispenseValues = Record<DispenseField, string> & {
|
|
4
|
+
dispenseAsWritten: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type DispensePatch = NonNullable<PrescriptionEdits["dispense"]>;
|
|
7
|
+
/** Quantity / unit / days / refills, then DAW. Their values are kept by PrescriptionDetailsForm, which saves them. */
|
|
8
|
+
export interface DispenseInputsProps {
|
|
9
|
+
values: DispenseValues;
|
|
10
|
+
/** What's wrong with a field, shown under it. */
|
|
11
|
+
errors?: Partial<Record<DispenseField, string>>;
|
|
12
|
+
/** The units the picked drug is dispensed in; without them the unit is typed. */
|
|
13
|
+
units: readonly string[];
|
|
14
|
+
/** Fields typed in since they were last saved. */
|
|
15
|
+
edited: ReadonlySet<DispenseField>;
|
|
16
|
+
/** The field whose save is in flight. */
|
|
17
|
+
spinning: string | null;
|
|
18
|
+
onEdit: (field: DispenseField, value: string) => void;
|
|
19
|
+
/** Only the field that changed: network-api merges a partial dispense. */
|
|
20
|
+
save: (field: DispenseField | "daw", patch: DispensePatch) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function DispenseInputs({ values, errors, units, edited, spinning, onEdit, save }: DispenseInputsProps): import("react").JSX.Element;
|
|
23
|
+
//# sourceMappingURL=DispenseInputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DispenseInputs.d.ts","sourceRoot":"","sources":["../../../../src/components/prescription/PrescriptionDetailsForm/DispenseInputs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAI9D,MAAM,MAAM,aAAa,GAAG,UAAU,GAAG,MAAM,GAAG,YAAY,GAAG,SAAS,CAAC;AAC3E,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,GAAG;IAAE,iBAAiB,EAAE,OAAO,CAAA;CAAE,CAAC;AAC5F,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC;AAEvE,sHAAsH;AACtH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,cAAc,CAAC;IACvB,iDAAiD;IACjD,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;IAChD,iFAAiF;IACjF,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,kDAAkD;IAClD,MAAM,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;IACnC,yCAAyC;IACzC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,0EAA0E;IAC1E,IAAI,EAAE,CAAC,KAAK,EAAE,aAAa,GAAG,KAAK,EAAE,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;CACpE;AAID,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,MAAW,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,mBAAmB,+BAwEjH"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useComponents } from "../../../primitives/index.js";
|
|
3
|
+
import { TrackedField, useFieldInteractions } from "../../../analytics/fieldInteraction.js";
|
|
4
|
+
const num = (value) => (value.trim() === "" ? undefined : Number(value));
|
|
5
|
+
export function DispenseInputs({ values, errors = {}, units, edited, spinning, onEdit, save }) {
|
|
6
|
+
const { Checkbox, Grid, Input, Select } = useComponents();
|
|
7
|
+
const fieldInteraction = useFieldInteractions("add_prescription_form");
|
|
8
|
+
const unitPicked = fieldInteraction("dispenseUnit", { isOptional: false, hasValue: Boolean(values.unit.trim()) });
|
|
9
|
+
const dispenseAsWritten = fieldInteraction("dispenseAsWritten", {
|
|
10
|
+
isOptional: true,
|
|
11
|
+
hasValue: values.dispenseAsWritten,
|
|
12
|
+
});
|
|
13
|
+
const typed = (field, toPatch) => ({
|
|
14
|
+
value: values[field],
|
|
15
|
+
invalid: Boolean(errors[field]),
|
|
16
|
+
errorMessage: errors[field],
|
|
17
|
+
// A value the server filled in (e.g. quantity 30) is selected, so typing replaces it.
|
|
18
|
+
onFocus: (e) => {
|
|
19
|
+
if (!edited.has(field))
|
|
20
|
+
e.currentTarget.select();
|
|
21
|
+
},
|
|
22
|
+
onChange: (e) => onEdit(field, e.target.value),
|
|
23
|
+
onBlur: () => {
|
|
24
|
+
if (edited.has(field))
|
|
25
|
+
save(field, toPatch(values[field]));
|
|
26
|
+
},
|
|
27
|
+
loading: spinning === field,
|
|
28
|
+
});
|
|
29
|
+
// The prescription's own unit stays listed, even when it isn't one the drug is dispensed in.
|
|
30
|
+
const unit = values.unit.trim();
|
|
31
|
+
const listedUnit = units.find((u) => u.toLowerCase() === unit.toLowerCase());
|
|
32
|
+
const unitOptions = [...units, ...(unit && !listedUnit ? [values.unit] : [])].map((u) => ({ value: u, label: u }));
|
|
33
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Grid, { min: "64px", gap: "2", children: [_jsx(TrackedField, { formName: "add_prescription_form", fieldName: "dispenseQuantity", isOptional: false, children: _jsx(Input, { label: "Quantity", inputMode: "decimal", ...typed("quantity", (v) => ({ quantity: num(v) })) }) }), units.length > 0 ? (_jsx("div", { style: { display: "contents" }, onFocus: unitPicked.onFocus, onBlur: unitPicked.onBlur, children: _jsx(Select, { label: "Unit", options: unitOptions, value: listedUnit ?? (values.unit || null), onChange: (value) => {
|
|
34
|
+
unitPicked.onChange(true);
|
|
35
|
+
onEdit("unit", value);
|
|
36
|
+
save("unit", { unit: value });
|
|
37
|
+
} }) })) : (_jsx(TrackedField, { formName: "add_prescription_form", fieldName: "dispenseUnit", isOptional: false, children: _jsx(Input, { label: "Unit", ...typed("unit", (v) => ({ unit: v || undefined })) }) })), _jsx(TrackedField, { formName: "add_prescription_form", fieldName: "daysSupply", isOptional: true, children: _jsx(Input, { label: "Days supply", inputMode: "numeric", ...typed("daysSupply", (v) => ({ daysSupply: num(v) })) }) }), _jsx(TrackedField, { formName: "add_prescription_form", fieldName: "refills", isOptional: true, children: _jsx(Input, { label: "Refills", inputMode: "numeric", ...typed("refills", (v) => ({ refillsAllowed: num(v) })) }) })] }), _jsx("div", { onFocus: dispenseAsWritten.onFocus, onBlur: dispenseAsWritten.onBlur, children: _jsx(Checkbox, { label: "Dispense as written", checked: values.dispenseAsWritten, onChange: (checked) => {
|
|
38
|
+
dispenseAsWritten.onChange(checked);
|
|
39
|
+
save("daw", { dispenseAsWritten: checked });
|
|
40
|
+
} }) })] }));
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=DispenseInputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DispenseInputs.js","sourceRoot":"","sources":["../../../../src/components/prescription/PrescriptionDetailsForm/DispenseInputs.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,wCAAyC,CAAC;AAsB7F,MAAM,GAAG,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAEjF,MAAM,UAAU,cAAc,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAuB;IAChH,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,aAAa,EAAE,CAAC;IAC1D,MAAM,gBAAgB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pC,IAAI,CAAC,KAAK,EAAE,EAAE,iBAAiB,EAAE,OAAO,EAAE,CAAC,CAAC;oBAC9C,CAAC,GACD,GACE,IACL,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Prescription, PrescriptionEdits, PrescriptionRecord, PrescriptionTemplate } from "@photonhealth/client";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
export interface PrescriptionDetailsFormProps {
|
|
4
|
+
live: Prescription | null;
|
|
5
|
+
rx: PrescriptionRecord | null;
|
|
6
|
+
/** Once a drug is set. Kept mounted while closed, so what's typed survives a drug being chosen. */
|
|
7
|
+
open: boolean;
|
|
8
|
+
/** Where the card flow (← / →) lands, when Treatment isn't. */
|
|
9
|
+
focusable: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* The draft's templates: those with a name or directions are offered as templates; the recommended
|
|
12
|
+
* ones' units are the units offered.
|
|
13
|
+
*/
|
|
14
|
+
templates: readonly PrescriptionTemplate[];
|
|
15
|
+
/** The field whose save is in flight. */
|
|
16
|
+
spinning: string | null;
|
|
17
|
+
save: (edits: PrescriptionEdits, from?: string) => void;
|
|
18
|
+
/** Beside Add: the prescription's status (e.g. changed since signing). */
|
|
19
|
+
status?: ReactNode;
|
|
20
|
+
/** Add, once every field is valid: the card signs it. */
|
|
21
|
+
onAdd: () => void;
|
|
22
|
+
/** The add is in flight. */
|
|
23
|
+
adding: boolean;
|
|
24
|
+
addDisabled: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare function PrescriptionDetailsForm({ live, rx, open, focusable, templates, spinning, save, status, onAdd, adding, addDisabled, }: PrescriptionDetailsFormProps): import("react").JSX.Element | null;
|
|
27
|
+
//# sourceMappingURL=PrescriptionDetailsForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrescriptionDetailsForm.d.ts","sourceRoot":"","sources":["../../../../src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAGtH,OAAO,EAAwC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAO7E,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,YAAY,GAAG,IAAI,CAAC;IAC1B,EAAE,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAC9B,mGAAmG;IACnG,IAAI,EAAE,OAAO,CAAC;IACd,+DAA+D;IAC/D,SAAS,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC3C,yCAAyC;IACzC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,CAAC,KAAK,EAAE,iBAAiB,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,0EAA0E;IAC1E,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,yDAAyD;IACzD,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,4BAA4B;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,uBAAuB,CAAC,EACtC,IAAI,EACJ,EAAE,EACF,IAAI,EACJ,SAAS,EACT,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,KAAK,EACL,MAAM,EACN,WAAW,GACZ,EAAE,4BAA4B,sCAqL9B"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useLatestCallback } from "../../../hooks/index.js";
|
|
3
|
+
import { useComponents } from "../../../primitives/index.js";
|
|
4
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { schemaErrors } from "../../schemaErrors.js";
|
|
6
|
+
import { DirectionsInput } from "./DirectionsInput.js";
|
|
7
|
+
import { DispenseInputs } from "./DispenseInputs.js";
|
|
8
|
+
import { PrescriptionDetailsSchema } from "./PrescriptionDetailsSchema.js";
|
|
9
|
+
import { TemplatePicker } from "./TemplatePicker.js";
|
|
10
|
+
export function PrescriptionDetailsForm({ live, rx, open, focusable, templates, spinning, save, status, onAdd, adding, addDisabled, }) {
|
|
11
|
+
const { Button, CardBody, CardFooter, Stack } = useComponents();
|
|
12
|
+
const [instructions, setInstructions] = useState(rx?.instructions ?? "");
|
|
13
|
+
const [quantity, setQuantity] = useState(rx?.dispense?.quantity?.toString() ?? "");
|
|
14
|
+
const [unit, setUnit] = useState(rx?.dispense?.unit ?? "");
|
|
15
|
+
const [daysSupply, setDaysSupply] = useState(rx?.dispense?.daysSupply?.toString() ?? "");
|
|
16
|
+
const [refills, setRefills] = useState(rx?.dispense?.refillsAllowed?.toString() ?? "");
|
|
17
|
+
const [daw, setDaw] = useState(rx?.dispense?.dispenseAsWritten ?? false);
|
|
18
|
+
// Fields edited but not yet saved. A server copy (a save's response, a hydrate) never overwrites
|
|
19
|
+
// them — otherwise a response landing mid-typing replaces what the prescriber is entering.
|
|
20
|
+
const [dirty, setDirty] = useState(new Set());
|
|
21
|
+
const edit = (field) => setDirty((d) => (d.has(field) ? d : new Set(d).add(field)));
|
|
22
|
+
const clean = (field) => setDirty((d) => {
|
|
23
|
+
if (!d.has(field))
|
|
24
|
+
return d;
|
|
25
|
+
const next = new Set(d);
|
|
26
|
+
next.delete(field);
|
|
27
|
+
return next;
|
|
28
|
+
});
|
|
29
|
+
// When the server's copy changes (a hydrate, a chosen option, signing), show its version.
|
|
30
|
+
// Adjusted during render, keyed on id + contentHash — React's pattern for deriving state from props.
|
|
31
|
+
const serverKey = rx ? `${rx.id}:${rx.signing.contentHash}:${rx.signing.state}` : null;
|
|
32
|
+
const [syncedKey, setSyncedKey] = useState(serverKey);
|
|
33
|
+
if (rx && serverKey !== syncedKey) {
|
|
34
|
+
setSyncedKey(serverKey);
|
|
35
|
+
if (!dirty.has("instructions"))
|
|
36
|
+
setInstructions(rx.instructions ?? "");
|
|
37
|
+
if (!dirty.has("quantity"))
|
|
38
|
+
setQuantity(rx.dispense?.quantity?.toString() ?? "");
|
|
39
|
+
if (!dirty.has("unit"))
|
|
40
|
+
setUnit(rx.dispense?.unit ?? "");
|
|
41
|
+
if (!dirty.has("daysSupply"))
|
|
42
|
+
setDaysSupply(rx.dispense?.daysSupply?.toString() ?? "");
|
|
43
|
+
if (!dirty.has("refills"))
|
|
44
|
+
setRefills(rx.dispense?.refillsAllowed?.toString() ?? "");
|
|
45
|
+
setDaw(rx.dispense?.dispenseAsWritten ?? false);
|
|
46
|
+
}
|
|
47
|
+
// A line without a record shows what's entered on it — e.g. given as props (a sig): once per object.
|
|
48
|
+
const [filledFrom, setFilledFrom] = useState(null);
|
|
49
|
+
if (live && live !== filledFrom) {
|
|
50
|
+
setFilledFrom(live);
|
|
51
|
+
const { instructions: sig, dispense: d } = rx ? {} : live.entered;
|
|
52
|
+
const shown = [
|
|
53
|
+
[sig, setInstructions],
|
|
54
|
+
[d?.quantity?.toString(), setQuantity],
|
|
55
|
+
[d?.unit, setUnit],
|
|
56
|
+
[d?.daysSupply?.toString(), setDaysSupply],
|
|
57
|
+
[d?.refillsAllowed?.toString(), setRefills],
|
|
58
|
+
];
|
|
59
|
+
for (const [value, set] of shown)
|
|
60
|
+
if (value)
|
|
61
|
+
set(value);
|
|
62
|
+
if (d?.dispenseAsWritten)
|
|
63
|
+
setDaw(true);
|
|
64
|
+
}
|
|
65
|
+
// What's wrong with the fields: shown once Add is clicked (and following the values from then on), and never sent.
|
|
66
|
+
const [showErrors, setShowErrors] = useState(false);
|
|
67
|
+
const errors = schemaErrors(PrescriptionDetailsSchema, { instructions, quantity, daysSupply });
|
|
68
|
+
const shown = showErrors ? errors : {};
|
|
69
|
+
const invalid = (field) => field in errors;
|
|
70
|
+
// Patch only the field that changed (network-api merges a partial dispense); sending the whole
|
|
71
|
+
// block from the screen could write stale values over newer ones.
|
|
72
|
+
const dispense = (field, patch) => {
|
|
73
|
+
clean(field);
|
|
74
|
+
if (patch.dispenseAsWritten !== undefined)
|
|
75
|
+
setDaw(patch.dispenseAsWritten);
|
|
76
|
+
if (!invalid(field))
|
|
77
|
+
save({ dispense: patch }, field);
|
|
78
|
+
};
|
|
79
|
+
// Memoized so typing doesn't hand DirectionsInput new options, which would reopen them.
|
|
80
|
+
const choosableTemplates = useMemo(() => templates.filter((template) => template.name || template.instructions), [templates]);
|
|
81
|
+
// The picked drug's own templates say its units before the draft's templates load
|
|
82
|
+
const pickedTemplates = live?.treatment?.templates;
|
|
83
|
+
const units = useMemo(() => recommendedUnits([...templates, ...(pickedTemplates ?? [])]), [templates, pickedTemplates]);
|
|
84
|
+
// The first of them is the unit until the prescriber picks another — never left blank. Saved once per drug: a response without it shows it again, but doesn't send it again.
|
|
85
|
+
const unitsFor = units.join("|");
|
|
86
|
+
const unitSavedFor = useRef(null);
|
|
87
|
+
const fillUnit = useLatestCallback(() => {
|
|
88
|
+
if (!open || !units.length || unit.trim())
|
|
89
|
+
return;
|
|
90
|
+
setUnit(units[0]);
|
|
91
|
+
if (unitSavedFor.current === unitsFor)
|
|
92
|
+
return;
|
|
93
|
+
unitSavedFor.current = unitsFor;
|
|
94
|
+
dispense("unit", { unit: units[0] });
|
|
95
|
+
});
|
|
96
|
+
useEffect(() => fillUnit(), [unitsFor, unit, open, fillUnit]);
|
|
97
|
+
// A template overwrites the fields it sets and leaves the rest alone, saved together in one call.
|
|
98
|
+
const chooseTemplate = (template) => {
|
|
99
|
+
const chosen = [];
|
|
100
|
+
if (template.instructions !== null)
|
|
101
|
+
chosen.push(["instructions", template.instructions, setInstructions]);
|
|
102
|
+
const d = template.dispense;
|
|
103
|
+
if (d?.quantity != null)
|
|
104
|
+
chosen.push(["quantity", d.quantity.toString(), setQuantity]);
|
|
105
|
+
if (d?.unit != null)
|
|
106
|
+
chosen.push(["unit", d.unit, setUnit]);
|
|
107
|
+
if (d?.daysSupply != null)
|
|
108
|
+
chosen.push(["daysSupply", d.daysSupply.toString(), setDaysSupply]);
|
|
109
|
+
if (d?.refillsAllowed != null)
|
|
110
|
+
chosen.push(["refills", d.refillsAllowed.toString(), setRefills]);
|
|
111
|
+
for (const [field, value, set] of chosen) {
|
|
112
|
+
set(value);
|
|
113
|
+
clean(field);
|
|
114
|
+
}
|
|
115
|
+
if (d?.dispenseAsWritten != null)
|
|
116
|
+
setDaw(d.dispenseAsWritten);
|
|
117
|
+
const dispensePatch = {
|
|
118
|
+
...(d?.quantity != null && { quantity: d.quantity }),
|
|
119
|
+
...(d?.unit != null && { unit: d.unit }),
|
|
120
|
+
...(d?.daysSupply != null && { daysSupply: d.daysSupply }),
|
|
121
|
+
...(d?.refillsAllowed != null && { refillsAllowed: d.refillsAllowed }),
|
|
122
|
+
...(d?.dispenseAsWritten != null && { dispenseAsWritten: d.dispenseAsWritten }),
|
|
123
|
+
};
|
|
124
|
+
const edits = {
|
|
125
|
+
...(template.instructions !== null &&
|
|
126
|
+
template.instructions !== (rx?.instructions ?? "") && { instructions: template.instructions }),
|
|
127
|
+
...(Object.keys(dispensePatch).length > 0 && { dispense: dispensePatch }),
|
|
128
|
+
};
|
|
129
|
+
if (Object.keys(edits).length > 0)
|
|
130
|
+
save(edits, "instructions");
|
|
131
|
+
};
|
|
132
|
+
if (!open)
|
|
133
|
+
return null;
|
|
134
|
+
const setters = {
|
|
135
|
+
quantity: setQuantity,
|
|
136
|
+
unit: setUnit,
|
|
137
|
+
daysSupply: setDaysSupply,
|
|
138
|
+
refills: setRefills,
|
|
139
|
+
};
|
|
140
|
+
const dispenseValues = { quantity, unit, daysSupply, refills, dispenseAsWritten: daw };
|
|
141
|
+
const dispenseFields = Object.keys(setters);
|
|
142
|
+
return (_jsxs(_Fragment, { children: [_jsx(CardBody, { children: _jsxs(Stack, { gap: "4", children: [_jsx(TemplatePicker, { templates: choosableTemplates, hasDirections: instructions.trim() !== "", onChoose: chooseTemplate }), _jsx(DirectionsInput, { value: instructions, errorMessage: shown.instructions, edited: dirty.has("instructions"), focusable: focusable, onEdit: (value) => {
|
|
143
|
+
setInstructions(value);
|
|
144
|
+
edit("instructions");
|
|
145
|
+
}, onCommit: () => {
|
|
146
|
+
clean("instructions");
|
|
147
|
+
if (!invalid("instructions") && instructions !== (rx?.instructions ?? ""))
|
|
148
|
+
save({ instructions }, "instructions");
|
|
149
|
+
} }), _jsx(DispenseInputs, { values: dispenseValues, errors: shown, units: units, edited: new Set(dispenseFields.filter((field) => dirty.has(field))), spinning: spinning, onEdit: (field, value) => {
|
|
150
|
+
setters[field](value);
|
|
151
|
+
edit(field);
|
|
152
|
+
}, save: dispense })] }) }), _jsx(CardFooter, { start: status, children: _jsx(Button, { variant: "secondary" // Send is the page's one primary action
|
|
153
|
+
,
|
|
154
|
+
// Not disabled while saving: clicking Add leaves a field, which saves it — the sign waits
|
|
155
|
+
// for that save (a disabled button would swallow the click).
|
|
156
|
+
loading: adding, disabled: addDisabled, onClick: () => {
|
|
157
|
+
setShowErrors(true);
|
|
158
|
+
if (Object.keys(errors).length === 0)
|
|
159
|
+
onAdd();
|
|
160
|
+
}, children: "Add" }) })] }));
|
|
161
|
+
}
|
|
162
|
+
// The units the recommended templates set — a recommended sig's, then the unit-only ones — in the server's order.
|
|
163
|
+
const recommendedUnits = (templates) => [
|
|
164
|
+
...new Set(templates
|
|
165
|
+
.filter((template) => template.source === "RECOMMENDED")
|
|
166
|
+
.map((template) => template.dispense?.unit)
|
|
167
|
+
.filter((unit) => Boolean(unit))),
|
|
168
|
+
];
|
|
169
|
+
//# sourceMappingURL=PrescriptionDetailsForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrescriptionDetailsForm.js","sourceRoot":"","sources":["../../../../src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsForm.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB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wCAAwC;;oBAC5D,0FAA0F;oBAC1F,6DAA6D;oBAC7D,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,WAAW,EACrB,OAAO,EAAE,GAAG,EAAE;wBACZ,aAAa,CAAC,IAAI,CAAC,CAAC;wBACpB,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC;4BAAE,KAAK,EAAE,CAAC;oBAChD,CAAC,oBAGM,GACE,IACZ,CACJ,CAAC;AACJ,CAAC;AAED,kHAAkH;AAClH,MAAM,gBAAgB,GAAG,CAAC,SAA0C,EAAY,EAAE,CAAC;IACjF,GAAG,IAAI,GAAG,CACR,SAAS;SACN,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,KAAK,aAAa,CAAC;SACvD,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;SAC1C,MAAM,CAAC,CAAC,IAAI,EAAkB,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CACnD;CACF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const PrescriptionDetailsSchema: z.ZodObject<{
|
|
3
|
+
instructions: z.ZodString;
|
|
4
|
+
quantity: z.ZodPipe<z.ZodString, z.ZodCoercedNumber<string>>;
|
|
5
|
+
daysSupply: z.ZodPipe<z.ZodString, z.ZodCoercedNumber<string>>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export type PrescriptionDetails = z.input<typeof PrescriptionDetailsSchema>;
|
|
8
|
+
//# sourceMappingURL=PrescriptionDetailsSchema.d.ts.map
|
package/dist/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrescriptionDetailsSchema.d.ts","sourceRoot":"","sources":["../../../../src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,yBAAyB;;;;iBAIpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const textToNumber = z
|
|
3
|
+
.string()
|
|
4
|
+
.trim()
|
|
5
|
+
.min(1, "Required")
|
|
6
|
+
.pipe(z.coerce.number({ error: "Must be a number" }).gt(0, "Must be greater than 0"));
|
|
7
|
+
export const PrescriptionDetailsSchema = z.object({
|
|
8
|
+
instructions: z.string().trim().min(1, "Required"),
|
|
9
|
+
quantity: textToNumber,
|
|
10
|
+
daysSupply: textToNumber,
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=PrescriptionDetailsSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PrescriptionDetailsSchema.js","sourceRoot":"","sources":["../../../../src/components/prescription/PrescriptionDetailsForm/PrescriptionDetailsSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,YAAY,GAAG,CAAC;KACnB,MAAM,EAAE;KACR,IAAI,EAAE;KACN,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC;KAClB,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAS,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,wBAAwB,CAAC,CAAC,CAAC;AAEhG,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC;IAClD,QAAQ,EAAE,YAAY;IACtB,UAAU,EAAE,YAAY;CACzB,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PrescriptionTemplate } from "@photonhealth/client";
|
|
2
|
+
/** The templates a prescription's directions and dispense can be filled from. */
|
|
3
|
+
export interface TemplatePickerProps {
|
|
4
|
+
/** Each has a name, directions, or both. */
|
|
5
|
+
templates: readonly PrescriptionTemplate[];
|
|
6
|
+
/** The prescription already has directions, so the templates start closed. */
|
|
7
|
+
hasDirections: boolean;
|
|
8
|
+
onChoose: (template: PrescriptionTemplate) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function TemplatePicker({ templates, hasDirections, onChoose }: TemplatePickerProps): import("react").JSX.Element | null;
|
|
11
|
+
//# sourceMappingURL=TemplatePicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemplatePicker.d.ts","sourceRoot":"","sources":["../../../../src/components/prescription/PrescriptionDetailsForm/TemplatePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAIjE,iFAAiF;AACjF,MAAM,WAAW,mBAAmB;IAClC,4CAA4C;IAC5C,SAAS,EAAE,SAAS,oBAAoB,EAAE,CAAC;IAC3C,8EAA8E;IAC9E,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,CAAC,QAAQ,EAAE,oBAAoB,KAAK,IAAI,CAAC;CACpD;AAED,wBAAgB,cAAc,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,EAAE,mBAAmB,sCA2BzF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { useComponents } from "../../../primitives/index.js";
|
|
4
|
+
export function TemplatePicker({ templates, hasDirections, onChoose }) {
|
|
5
|
+
const { ChoiceList, Disclosure } = useComponents();
|
|
6
|
+
// Each new set of templates opens, unless someone already entered directions (e.g. an existing draft's).
|
|
7
|
+
// Choosing one closes them, and the toggle opens them again.
|
|
8
|
+
const [open, setOpen] = useState(!hasDirections);
|
|
9
|
+
const [shownTemplates, setShownTemplates] = useState(templates);
|
|
10
|
+
if (templates !== shownTemplates) {
|
|
11
|
+
setShownTemplates(templates);
|
|
12
|
+
setOpen(!hasDirections);
|
|
13
|
+
}
|
|
14
|
+
if (templates.length === 0)
|
|
15
|
+
return null;
|
|
16
|
+
return (_jsx(Disclosure, { summary: "Templates", open: open, onOpenChange: setOpen, children: _jsx(ChoiceList, { label: "Templates", choices: templates.map((template, index) => ({
|
|
17
|
+
key: String(index),
|
|
18
|
+
label: template.name ?? template.instructions ?? "",
|
|
19
|
+
description: (template.name && template.instructions) ?? undefined,
|
|
20
|
+
})), onChoose: (key) => {
|
|
21
|
+
setOpen(false);
|
|
22
|
+
onChoose(templates[Number(key)]);
|
|
23
|
+
} }) }));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=TemplatePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemplatePicker.js","sourceRoot":"","sources":["../../../../src/components/prescription/PrescriptionDetailsForm/TemplatePicker.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAW7D,MAAM,UAAU,cAAc,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAuB;IACxF,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,aAAa,EAAE,CAAC;IACnD,yGAAyG;IACzG,6DAA6D;IAC7D,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC,aAAa,CAAC,CAAC;IACjD,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IAChE,IAAI,SAAS,KAAK,cAAc,EAAE,CAAC;QACjC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAC7B,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC;IAC1B,CAAC;IACD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACxC,OAAO,CACL,KAAC,UAAU,IAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,YAC/D,KAAC,UAAU,IACT,KAAK,EAAC,WAAW,EACjB,OAAO,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;gBAC3C,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC;gBAClB,KAAK,EAAE,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,YAAY,IAAI,EAAE;gBACnD,WAAW,EAAE,CAAC,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,YAAY,CAAC,IAAI,SAAS;aACnE,CAAC,CAAC,EACH,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE;gBAChB,OAAO,CAAC,KAAK,CAAC,CAAC;gBACf,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAE,CAAC,CAAC;YACpC,CAAC,GACD,GACS,CACd,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Change, ChangeOption } from "@photonhealth/client";
|
|
2
|
+
import { type SearchHandle } from "../../search.tsx";
|
|
3
|
+
/**
|
|
4
|
+
* The drug search's results (search.tsx): the server's drug choices, grouped the way a prescriber decides —
|
|
5
|
+
* drug, then form, then strength (instead of one long list of product names), from the parts each option's
|
|
6
|
+
* treatment carries (display.ts). Treatment works like a select: the card owns which drug is picked (`drug`, its
|
|
7
|
+
* name — shown in the field) and whether the list is open (`listOpen`); this draws one or the other.
|
|
8
|
+
*
|
|
9
|
+
* - The list (`listOpen`): a row per drug, its one form or one strength said under its name, else how many
|
|
10
|
+
* ("2 forms · 3 strengths"). Picking a row picks the drug (`onDrug`) — or, for a drug that's one product, chooses
|
|
11
|
+
* that product (no chevron).
|
|
12
|
+
* - The drug picked (`drug`, the list closed): its forms and strengths as chips under the field — never inside its
|
|
13
|
+
* row. Nothing is picked for the prescriber: no chip starts pressed, and they're picked in either order. A pick greys out what doesn't go with it in the other group (a
|
|
14
|
+
* form: the strengths it doesn't come in; a strength: the forms that don't come in it); picking it again takes
|
|
15
|
+
* it back. A greyed chip can still be picked: it drops the other group's pick, and that's the prescriber's to
|
|
16
|
+
* pick again. The pick that leaves nothing more to pick chooses the product: the second chip — or the first,
|
|
17
|
+
* when it settles both (a form with one strength, a strength only one form comes in). While the choice saves
|
|
18
|
+
* (`chosen`), the chips stay as they were picked.
|
|
19
|
+
*
|
|
20
|
+
* Keys. In the list: as every search's (1–9 / 0 picks a drug; Option/Alt + the digit from Treatment), plus ↓ ↑ (or J
|
|
21
|
+
* K, or Tab / Shift+Tab — past the last / first, Tab leaves the list) move the highlight, Home / End (or g / G) to
|
|
22
|
+
* the first / last, D to the next one, Enter picks the one highlighted; the list is one tab stop. Picking a drug puts
|
|
23
|
+
* focus on its first chips; there, Tab moves between chips, F / S to the next form / strength chip, Enter (or Space)
|
|
24
|
+
* picks the one focused. Esc goes back to Treatment, from either. ← → leave the card (the card flow's: flow.ts). A
|
|
25
|
+
* few drugs for what's typed and Treatment puts focus on the first (`focus(true)`): typing carries on there until a
|
|
26
|
+
* key acts on the list (search.tsx). `handleRef` is how the Treatment field reaches the list.
|
|
27
|
+
*/
|
|
28
|
+
export interface TreatmentPickerHandle extends SearchHandle {
|
|
29
|
+
/** Enter from Treatment: pick the drug highlighted (the list open), else go to the picked drug's first chips. */
|
|
30
|
+
enter: () => void;
|
|
31
|
+
}
|
|
32
|
+
export declare function TreatmentPicker({ change, drug: drugName, listOpen, onDrug, onChoose, busy, chosen, handleRef, onBack, }: {
|
|
33
|
+
change: Change;
|
|
34
|
+
/** The drug picked, by name (null: none) — the card's; shown in Treatment. */
|
|
35
|
+
drug: string | null;
|
|
36
|
+
/** The list of drugs is open (else the picked drug's chips show). */
|
|
37
|
+
listOpen: boolean;
|
|
38
|
+
/** A drug was picked from the list: its name. */
|
|
39
|
+
onDrug: (name: string) => void;
|
|
40
|
+
onChoose?: (option: ChangeOption) => void;
|
|
41
|
+
busy?: boolean;
|
|
42
|
+
/** The product chosen, while its save runs: shown picked; nothing else can be picked. */
|
|
43
|
+
chosen?: ChangeOption | null;
|
|
44
|
+
handleRef?: {
|
|
45
|
+
current: TreatmentPickerHandle | null;
|
|
46
|
+
};
|
|
47
|
+
/** Esc: back to the field that searched (Treatment). */
|
|
48
|
+
onBack?: () => void;
|
|
49
|
+
}): import("react").JSX.Element;
|
|
50
|
+
//# sourceMappingURL=TreatmentPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreatmentPicker.d.ts","sourceRoot":"","sources":["../../../../src/components/prescription/TreatmentSearch/TreatmentPicker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEjE,OAAO,EAAgE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAInH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,qBAAsB,SAAQ,YAAY;IACzD,iHAAiH;IACjH,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAKD,wBAAgB,eAAe,CAAC,EAC9B,MAAM,EACN,IAAI,EAAE,QAAQ,EACd,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,SAAS,EACT,MAAM,GACP,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,qEAAqE;IACrE,QAAQ,EAAE,OAAO,CAAC;IAClB,iDAAiD;IACjD,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAI,CAAC;IAC1C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,yFAAyF;IACzF,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAC7B,SAAS,CAAC,EAAE;QAAE,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAAA;KAAE,CAAC;IACtD,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB,+BAwSA"}
|