formanitor 0.0.34 → 0.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +82 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.mjs +82 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
type FieldType = 'text' | 'number' | 'textarea' | 'diagnosis_textarea' | 'richtext' | 'select' | 'multiselect' | 'radio' | 'repeatable' | 'checkbox' | 'image_upload' | 'media_upload' | 'signature' | 'date' | 'datetime' | 'editable_table' | 'static_text' | 'medications' | 'investigations' | 'procedures' | 'vitals' | 'hidden_vitals' | 'referral' | 'followup' | string;
|
|
3
|
+
type FieldType = 'text' | 'number' | 'textarea' | 'diagnosis_textarea' | 'richtext' | 'select' | 'multiselect' | 'radio' | 'repeatable' | 'checkbox' | 'image_upload' | 'media_upload' | 'signature' | 'date' | 'datetime' | 'editable_table' | 'static_text' | 'medications' | 'investigations' | 'procedures' | 'vitals' | 'hidden_vitals' | 'referral' | 'followup' | 'toggle' | string;
|
|
4
4
|
interface ValidationRule {
|
|
5
5
|
min?: number;
|
|
6
6
|
max?: number;
|
|
@@ -320,7 +320,11 @@ interface DiagnosticPackage {
|
|
|
320
320
|
department?: string;
|
|
321
321
|
tests: DiagnosticPackageTest[];
|
|
322
322
|
}
|
|
323
|
-
type FieldDef = TextFieldDef | RichTextFieldDef | NumberFieldDef | SelectFieldDef | RadioFieldDef | CheckboxFieldDef | RepeatableFieldDef | ImageUploadFieldDef | MediaUploadFieldDef | SignatureFieldDef | EditableTableFieldDef | StaticTextFieldDef | MedicationsFieldDef | InvestigationsFieldDef | ProceduresFieldDef | DifferentialDiagnosisFieldDef | VitalsFieldDef | ReferralFieldDef | FollowupFieldDef | SmartTextareaFieldDef | DiagnosisTextareaFieldDef | BaseFieldDef;
|
|
323
|
+
type FieldDef = TextFieldDef | RichTextFieldDef | NumberFieldDef | SelectFieldDef | RadioFieldDef | CheckboxFieldDef | RepeatableFieldDef | ImageUploadFieldDef | MediaUploadFieldDef | SignatureFieldDef | EditableTableFieldDef | StaticTextFieldDef | MedicationsFieldDef | InvestigationsFieldDef | ProceduresFieldDef | DifferentialDiagnosisFieldDef | VitalsFieldDef | ReferralFieldDef | FollowupFieldDef | SmartTextareaFieldDef | DiagnosisTextareaFieldDef | ToggleFieldDef | BaseFieldDef;
|
|
324
|
+
interface ToggleFieldDef extends BaseFieldDef {
|
|
325
|
+
type: 'toggle';
|
|
326
|
+
excludes?: string[];
|
|
327
|
+
}
|
|
324
328
|
interface Condition {
|
|
325
329
|
field?: string;
|
|
326
330
|
op: '==' | '!=' | '>' | '<' | '>=' | '<=' | 'in' | 'contains';
|
|
@@ -953,4 +957,4 @@ declare const SmartTextareaWidget: React.FC<{
|
|
|
953
957
|
fieldId: string;
|
|
954
958
|
}>;
|
|
955
959
|
|
|
956
|
-
export { type AIDifferentialDiagnosisItem, AddInvestigationField, type AddInvestigationFieldProps, AddMedicationField, type AddMedicationFieldProps, type BaseFieldDef, type CheckboxFieldDef, type ColumnLayout, type Computation, type Condition, type CreateUploadHandlerOptions, type DataSource, type DiagnosisGradeSelection, type DiagnosisTextareaFieldDef, type DiagnosisTextareaValue, type DiagnosticPackage, type DiagnosticPackageTest, DifferentialDiagnosis, type DifferentialDiagnosisFieldDef, type DifferentialDiagnosisItem, type DifferentialDiagnosisProps, type DoctorFrequentItems, DynamicForm, EMAIL_REGEX, type EditableTableColumnDef, type EditableTableFieldDef, type EventDefinition, type ExtractedKeywordMatch, type FieldDef, type FieldHandler, type FieldHandlersMap, type FieldPrefill, FieldRenderer, type FieldState, type FieldType, type FollowupFieldDef, type FollowupValue, FormControls, type FormControlsProps, type FormDef, type FormErrors, FormProvider, type FormState, FormStore, type FormValues, type FormulaComputation, type FormulaExpr, type ImageUploadFieldDef, ImageUploadWidget, type Investigation, type InvestigationFrequentItem, type InvestigationSearchResult, type InvestigationsFieldDef, type LayoutNode, MAR_MEDICATION_ORDERS_META_KEY, type MatchedCondition, type MediaUploadFieldDef, MediaUploadWidget, type Medication, type MedicationFrequentItem, type MedicationSearchResult, type MedicationsFieldDef, type NumberFieldDef, type Permission, type PresignedUploadResponse, type ProcedureFrequentItem, type ProceduresFieldDef, type RadioFieldDef, ReadOnlyForm, ReadOnlyImageUpload, ReadOnlyMediaUpload, ReadOnlySignature, ReadOnlyTable, type ReferralFieldDef, type ReferralItem, type RepeatableFieldDef, type RichTextFieldDef, RichTextWidget, type Rule, type RuleAction, type RuleResult, type ScoreComputation, type ScoreRange, type Section, type SectionChild, type SelectFieldDef, type SelectOption, type SignatureFieldDef, SignatureUploadWidget, SmartForm, type SmartFormProps, type SmartKeywordsResult, type SmartTextareaFieldDef, type SmartTextareaValue, SmartTextareaWidget, type StaticTextFieldDef, type StoreConfig, type SubmissionData, type SumComputation, type TextFieldDef, type ValidationRule, type VitalsFieldDef, type WebhookDef, type Workflow, type WorkflowTransition, createUploadHandler, evaluateRules, fieldMetaRequestsMarMedicationOrdersButton, useField, useFieldHandlers, useForm, useFormStore, useFrequentItems, usePackages, useSmartKeywords, validateField, validateForm };
|
|
960
|
+
export { type AIDifferentialDiagnosisItem, AddInvestigationField, type AddInvestigationFieldProps, AddMedicationField, type AddMedicationFieldProps, type BaseFieldDef, type CheckboxFieldDef, type ColumnLayout, type Computation, type Condition, type CreateUploadHandlerOptions, type DataSource, type DiagnosisGradeSelection, type DiagnosisTextareaFieldDef, type DiagnosisTextareaValue, type DiagnosticPackage, type DiagnosticPackageTest, DifferentialDiagnosis, type DifferentialDiagnosisFieldDef, type DifferentialDiagnosisItem, type DifferentialDiagnosisProps, type DoctorFrequentItems, DynamicForm, EMAIL_REGEX, type EditableTableColumnDef, type EditableTableFieldDef, type EventDefinition, type ExtractedKeywordMatch, type FieldDef, type FieldHandler, type FieldHandlersMap, type FieldPrefill, FieldRenderer, type FieldState, type FieldType, type FollowupFieldDef, type FollowupValue, FormControls, type FormControlsProps, type FormDef, type FormErrors, FormProvider, type FormState, FormStore, type FormValues, type FormulaComputation, type FormulaExpr, type ImageUploadFieldDef, ImageUploadWidget, type Investigation, type InvestigationFrequentItem, type InvestigationSearchResult, type InvestigationsFieldDef, type LayoutNode, MAR_MEDICATION_ORDERS_META_KEY, type MatchedCondition, type MediaUploadFieldDef, MediaUploadWidget, type Medication, type MedicationFrequentItem, type MedicationSearchResult, type MedicationsFieldDef, type NumberFieldDef, type Permission, type PresignedUploadResponse, type ProcedureFrequentItem, type ProceduresFieldDef, type RadioFieldDef, ReadOnlyForm, ReadOnlyImageUpload, ReadOnlyMediaUpload, ReadOnlySignature, ReadOnlyTable, type ReferralFieldDef, type ReferralItem, type RepeatableFieldDef, type RichTextFieldDef, RichTextWidget, type Rule, type RuleAction, type RuleResult, type ScoreComputation, type ScoreRange, type Section, type SectionChild, type SelectFieldDef, type SelectOption, type SignatureFieldDef, SignatureUploadWidget, SmartForm, type SmartFormProps, type SmartKeywordsResult, type SmartTextareaFieldDef, type SmartTextareaValue, SmartTextareaWidget, type StaticTextFieldDef, type StoreConfig, type SubmissionData, type SumComputation, type TextFieldDef, type ToggleFieldDef, type ValidationRule, type VitalsFieldDef, type WebhookDef, type Workflow, type WorkflowTransition, createUploadHandler, evaluateRules, fieldMetaRequestsMarMedicationOrdersButton, useField, useFieldHandlers, useForm, useFormStore, useFrequentItems, usePackages, useSmartKeywords, validateField, validateForm };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
type FieldType = 'text' | 'number' | 'textarea' | 'diagnosis_textarea' | 'richtext' | 'select' | 'multiselect' | 'radio' | 'repeatable' | 'checkbox' | 'image_upload' | 'media_upload' | 'signature' | 'date' | 'datetime' | 'editable_table' | 'static_text' | 'medications' | 'investigations' | 'procedures' | 'vitals' | 'hidden_vitals' | 'referral' | 'followup' | string;
|
|
3
|
+
type FieldType = 'text' | 'number' | 'textarea' | 'diagnosis_textarea' | 'richtext' | 'select' | 'multiselect' | 'radio' | 'repeatable' | 'checkbox' | 'image_upload' | 'media_upload' | 'signature' | 'date' | 'datetime' | 'editable_table' | 'static_text' | 'medications' | 'investigations' | 'procedures' | 'vitals' | 'hidden_vitals' | 'referral' | 'followup' | 'toggle' | string;
|
|
4
4
|
interface ValidationRule {
|
|
5
5
|
min?: number;
|
|
6
6
|
max?: number;
|
|
@@ -320,7 +320,11 @@ interface DiagnosticPackage {
|
|
|
320
320
|
department?: string;
|
|
321
321
|
tests: DiagnosticPackageTest[];
|
|
322
322
|
}
|
|
323
|
-
type FieldDef = TextFieldDef | RichTextFieldDef | NumberFieldDef | SelectFieldDef | RadioFieldDef | CheckboxFieldDef | RepeatableFieldDef | ImageUploadFieldDef | MediaUploadFieldDef | SignatureFieldDef | EditableTableFieldDef | StaticTextFieldDef | MedicationsFieldDef | InvestigationsFieldDef | ProceduresFieldDef | DifferentialDiagnosisFieldDef | VitalsFieldDef | ReferralFieldDef | FollowupFieldDef | SmartTextareaFieldDef | DiagnosisTextareaFieldDef | BaseFieldDef;
|
|
323
|
+
type FieldDef = TextFieldDef | RichTextFieldDef | NumberFieldDef | SelectFieldDef | RadioFieldDef | CheckboxFieldDef | RepeatableFieldDef | ImageUploadFieldDef | MediaUploadFieldDef | SignatureFieldDef | EditableTableFieldDef | StaticTextFieldDef | MedicationsFieldDef | InvestigationsFieldDef | ProceduresFieldDef | DifferentialDiagnosisFieldDef | VitalsFieldDef | ReferralFieldDef | FollowupFieldDef | SmartTextareaFieldDef | DiagnosisTextareaFieldDef | ToggleFieldDef | BaseFieldDef;
|
|
324
|
+
interface ToggleFieldDef extends BaseFieldDef {
|
|
325
|
+
type: 'toggle';
|
|
326
|
+
excludes?: string[];
|
|
327
|
+
}
|
|
324
328
|
interface Condition {
|
|
325
329
|
field?: string;
|
|
326
330
|
op: '==' | '!=' | '>' | '<' | '>=' | '<=' | 'in' | 'contains';
|
|
@@ -953,4 +957,4 @@ declare const SmartTextareaWidget: React.FC<{
|
|
|
953
957
|
fieldId: string;
|
|
954
958
|
}>;
|
|
955
959
|
|
|
956
|
-
export { type AIDifferentialDiagnosisItem, AddInvestigationField, type AddInvestigationFieldProps, AddMedicationField, type AddMedicationFieldProps, type BaseFieldDef, type CheckboxFieldDef, type ColumnLayout, type Computation, type Condition, type CreateUploadHandlerOptions, type DataSource, type DiagnosisGradeSelection, type DiagnosisTextareaFieldDef, type DiagnosisTextareaValue, type DiagnosticPackage, type DiagnosticPackageTest, DifferentialDiagnosis, type DifferentialDiagnosisFieldDef, type DifferentialDiagnosisItem, type DifferentialDiagnosisProps, type DoctorFrequentItems, DynamicForm, EMAIL_REGEX, type EditableTableColumnDef, type EditableTableFieldDef, type EventDefinition, type ExtractedKeywordMatch, type FieldDef, type FieldHandler, type FieldHandlersMap, type FieldPrefill, FieldRenderer, type FieldState, type FieldType, type FollowupFieldDef, type FollowupValue, FormControls, type FormControlsProps, type FormDef, type FormErrors, FormProvider, type FormState, FormStore, type FormValues, type FormulaComputation, type FormulaExpr, type ImageUploadFieldDef, ImageUploadWidget, type Investigation, type InvestigationFrequentItem, type InvestigationSearchResult, type InvestigationsFieldDef, type LayoutNode, MAR_MEDICATION_ORDERS_META_KEY, type MatchedCondition, type MediaUploadFieldDef, MediaUploadWidget, type Medication, type MedicationFrequentItem, type MedicationSearchResult, type MedicationsFieldDef, type NumberFieldDef, type Permission, type PresignedUploadResponse, type ProcedureFrequentItem, type ProceduresFieldDef, type RadioFieldDef, ReadOnlyForm, ReadOnlyImageUpload, ReadOnlyMediaUpload, ReadOnlySignature, ReadOnlyTable, type ReferralFieldDef, type ReferralItem, type RepeatableFieldDef, type RichTextFieldDef, RichTextWidget, type Rule, type RuleAction, type RuleResult, type ScoreComputation, type ScoreRange, type Section, type SectionChild, type SelectFieldDef, type SelectOption, type SignatureFieldDef, SignatureUploadWidget, SmartForm, type SmartFormProps, type SmartKeywordsResult, type SmartTextareaFieldDef, type SmartTextareaValue, SmartTextareaWidget, type StaticTextFieldDef, type StoreConfig, type SubmissionData, type SumComputation, type TextFieldDef, type ValidationRule, type VitalsFieldDef, type WebhookDef, type Workflow, type WorkflowTransition, createUploadHandler, evaluateRules, fieldMetaRequestsMarMedicationOrdersButton, useField, useFieldHandlers, useForm, useFormStore, useFrequentItems, usePackages, useSmartKeywords, validateField, validateForm };
|
|
960
|
+
export { type AIDifferentialDiagnosisItem, AddInvestigationField, type AddInvestigationFieldProps, AddMedicationField, type AddMedicationFieldProps, type BaseFieldDef, type CheckboxFieldDef, type ColumnLayout, type Computation, type Condition, type CreateUploadHandlerOptions, type DataSource, type DiagnosisGradeSelection, type DiagnosisTextareaFieldDef, type DiagnosisTextareaValue, type DiagnosticPackage, type DiagnosticPackageTest, DifferentialDiagnosis, type DifferentialDiagnosisFieldDef, type DifferentialDiagnosisItem, type DifferentialDiagnosisProps, type DoctorFrequentItems, DynamicForm, EMAIL_REGEX, type EditableTableColumnDef, type EditableTableFieldDef, type EventDefinition, type ExtractedKeywordMatch, type FieldDef, type FieldHandler, type FieldHandlersMap, type FieldPrefill, FieldRenderer, type FieldState, type FieldType, type FollowupFieldDef, type FollowupValue, FormControls, type FormControlsProps, type FormDef, type FormErrors, FormProvider, type FormState, FormStore, type FormValues, type FormulaComputation, type FormulaExpr, type ImageUploadFieldDef, ImageUploadWidget, type Investigation, type InvestigationFrequentItem, type InvestigationSearchResult, type InvestigationsFieldDef, type LayoutNode, MAR_MEDICATION_ORDERS_META_KEY, type MatchedCondition, type MediaUploadFieldDef, MediaUploadWidget, type Medication, type MedicationFrequentItem, type MedicationSearchResult, type MedicationsFieldDef, type NumberFieldDef, type Permission, type PresignedUploadResponse, type ProcedureFrequentItem, type ProceduresFieldDef, type RadioFieldDef, ReadOnlyForm, ReadOnlyImageUpload, ReadOnlyMediaUpload, ReadOnlySignature, ReadOnlyTable, type ReferralFieldDef, type ReferralItem, type RepeatableFieldDef, type RichTextFieldDef, RichTextWidget, type Rule, type RuleAction, type RuleResult, type ScoreComputation, type ScoreRange, type Section, type SectionChild, type SelectFieldDef, type SelectOption, type SignatureFieldDef, SignatureUploadWidget, SmartForm, type SmartFormProps, type SmartKeywordsResult, type SmartTextareaFieldDef, type SmartTextareaValue, SmartTextareaWidget, type StaticTextFieldDef, type StoreConfig, type SubmissionData, type SumComputation, type TextFieldDef, type ToggleFieldDef, type ValidationRule, type VitalsFieldDef, type WebhookDef, type Workflow, type WorkflowTransition, createUploadHandler, evaluateRules, fieldMetaRequestsMarMedicationOrdersButton, useField, useFieldHandlers, useForm, useFormStore, useFrequentItems, usePackages, useSmartKeywords, validateField, validateForm };
|
package/dist/index.mjs
CHANGED
|
@@ -618,6 +618,11 @@ var FormStore = class {
|
|
|
618
618
|
this.config.role = next.role;
|
|
619
619
|
needsReeval = true;
|
|
620
620
|
}
|
|
621
|
+
if (next.prefillData !== void 0 && next.prefillData !== this.prefillData) {
|
|
622
|
+
this.prefillData = next.prefillData;
|
|
623
|
+
this.state.values = applyPrefill(this.state.values, this.schema.fields, this.prefillData);
|
|
624
|
+
needsReeval = true;
|
|
625
|
+
}
|
|
621
626
|
if (needsReeval) {
|
|
622
627
|
this.evaluate();
|
|
623
628
|
this.notify();
|
|
@@ -5308,6 +5313,40 @@ var DiagnosisTextareaWidget = ({ fieldId }) => {
|
|
|
5308
5313
|
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
5309
5314
|
] });
|
|
5310
5315
|
};
|
|
5316
|
+
var Switch = React15.forwardRef(
|
|
5317
|
+
({ className, checked, onCheckedChange, disabled, ...props }, ref) => {
|
|
5318
|
+
return /* @__PURE__ */ jsx(
|
|
5319
|
+
"button",
|
|
5320
|
+
{
|
|
5321
|
+
type: "button",
|
|
5322
|
+
role: "switch",
|
|
5323
|
+
"aria-checked": checked,
|
|
5324
|
+
"data-state": checked ? "checked" : "unchecked",
|
|
5325
|
+
disabled,
|
|
5326
|
+
ref,
|
|
5327
|
+
onClick: () => {
|
|
5328
|
+
if (!disabled && onCheckedChange) {
|
|
5329
|
+
onCheckedChange(!checked);
|
|
5330
|
+
}
|
|
5331
|
+
},
|
|
5332
|
+
className: cn(
|
|
5333
|
+
"peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",
|
|
5334
|
+
className
|
|
5335
|
+
),
|
|
5336
|
+
...props,
|
|
5337
|
+
children: /* @__PURE__ */ jsx(
|
|
5338
|
+
"span",
|
|
5339
|
+
{
|
|
5340
|
+
"data-state": checked ? "checked" : "unchecked",
|
|
5341
|
+
className: "pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform",
|
|
5342
|
+
style: { transform: checked ? "translateX(1rem)" : "translateX(0)" }
|
|
5343
|
+
}
|
|
5344
|
+
)
|
|
5345
|
+
}
|
|
5346
|
+
);
|
|
5347
|
+
}
|
|
5348
|
+
);
|
|
5349
|
+
Switch.displayName = "Switch";
|
|
5311
5350
|
var DEFAULT_DRAFT = {
|
|
5312
5351
|
gpal: { G: 0, P: 0, A: 0, L: 0 },
|
|
5313
5352
|
lmp: "",
|
|
@@ -7881,6 +7920,26 @@ function renderWidget(fieldId, fieldDef) {
|
|
|
7881
7920
|
return /* @__PURE__ */ jsx(OphthalDiagnosisWidget, { fieldId });
|
|
7882
7921
|
case "orthopedic_exam":
|
|
7883
7922
|
return /* @__PURE__ */ jsx(OrthopedicExamWidget, { fieldId });
|
|
7923
|
+
case "toggle": {
|
|
7924
|
+
const { value, setValue, setTouched, disabled } = useField(fieldId);
|
|
7925
|
+
const store = useFormStore();
|
|
7926
|
+
const excludes = fieldDef.excludes ?? [];
|
|
7927
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
7928
|
+
/* @__PURE__ */ jsx(
|
|
7929
|
+
Switch,
|
|
7930
|
+
{
|
|
7931
|
+
checked: value === true,
|
|
7932
|
+
disabled,
|
|
7933
|
+
onCheckedChange: (checked) => {
|
|
7934
|
+
setValue(checked);
|
|
7935
|
+
setTouched();
|
|
7936
|
+
if (checked) excludes.forEach((id) => store.setValue(id, false));
|
|
7937
|
+
}
|
|
7938
|
+
}
|
|
7939
|
+
),
|
|
7940
|
+
/* @__PURE__ */ jsx(Label, { className: "text-sm font-medium leading-none cursor-pointer select-none", children: fieldDef.label })
|
|
7941
|
+
] });
|
|
7942
|
+
}
|
|
7884
7943
|
case "static_text": {
|
|
7885
7944
|
const def = fieldDef;
|
|
7886
7945
|
const size = def.size ?? "regular";
|
|
@@ -8482,10 +8541,21 @@ var ReadOnlyReferral = ({ fieldDef, value }) => {
|
|
|
8482
8541
|
}) })
|
|
8483
8542
|
] });
|
|
8484
8543
|
};
|
|
8485
|
-
function
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8544
|
+
function parseOrders(value) {
|
|
8545
|
+
if (value == null) return [];
|
|
8546
|
+
if (Array.isArray(value)) {
|
|
8547
|
+
return value.filter(
|
|
8548
|
+
(v) => v != null && typeof v === "object" && typeof v.id === "string"
|
|
8549
|
+
);
|
|
8550
|
+
}
|
|
8551
|
+
if (typeof value === "object") {
|
|
8552
|
+
const v = value;
|
|
8553
|
+
const orders = Array.isArray(v.orders) ? v.orders : [];
|
|
8554
|
+
return orders.filter(
|
|
8555
|
+
(o) => o != null && typeof o === "object" && typeof o.id === "string"
|
|
8556
|
+
);
|
|
8557
|
+
}
|
|
8558
|
+
return [];
|
|
8489
8559
|
}
|
|
8490
8560
|
function formatDuration2(start, end) {
|
|
8491
8561
|
if (!start && !end) return null;
|
|
@@ -8493,7 +8563,7 @@ function formatDuration2(start, end) {
|
|
|
8493
8563
|
return start ? `Start: ${start}` : `End: ${end}`;
|
|
8494
8564
|
}
|
|
8495
8565
|
var ReadOnlyDischargeMedicationOrders = ({ fieldDef, value }) => {
|
|
8496
|
-
const orders = useMemo(() =>
|
|
8566
|
+
const orders = useMemo(() => parseOrders(value), [value]);
|
|
8497
8567
|
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
8498
8568
|
/* @__PURE__ */ jsx(Label, { className: "text-sm font-medium text-gray-700", children: fieldDef.label }),
|
|
8499
8569
|
orders.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-gray-900 border border-gray-200 rounded-md p-3 bg-gray-50 min-h-[2.5rem]", children: /* @__PURE__ */ jsx("span", { className: "text-gray-400 italic", children: "No medicines added" }) }) : /* @__PURE__ */ jsx("div", { className: "space-y-2", children: orders.map((o) => {
|
|
@@ -8563,6 +8633,13 @@ var ReadOnlyFieldRenderer = ({ fieldDef, value }) => {
|
|
|
8563
8633
|
return /* @__PURE__ */ jsx(ReadOnlyReferral, { fieldDef, value });
|
|
8564
8634
|
case "discharge_medication_orders":
|
|
8565
8635
|
return /* @__PURE__ */ jsx(ReadOnlyDischargeMedicationOrders, { fieldDef, value });
|
|
8636
|
+
case "toggle": {
|
|
8637
|
+
const isOn = value === true;
|
|
8638
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
8639
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: fieldDef.label }),
|
|
8640
|
+
/* @__PURE__ */ jsx("span", { className: `inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${isOn ? "bg-green-100 text-green-800" : "bg-gray-100 text-gray-600"}`, children: isOn ? "Yes" : "No" })
|
|
8641
|
+
] });
|
|
8642
|
+
}
|
|
8566
8643
|
case "static_text": {
|
|
8567
8644
|
const def = fieldDef;
|
|
8568
8645
|
const size = def.size ?? "regular";
|