formanitor 0.0.35 → 0.0.37
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 +90 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.mjs +90 -1
- 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';
|
|
@@ -860,6 +864,7 @@ type Medication = {
|
|
|
860
864
|
duration_value: string;
|
|
861
865
|
duration_unit: 'days' | 'weeks' | 'months';
|
|
862
866
|
before_after: BeforeAfterOption;
|
|
867
|
+
route: string;
|
|
863
868
|
morning: string;
|
|
864
869
|
afternoon: string;
|
|
865
870
|
night: string;
|
|
@@ -953,4 +958,4 @@ declare const SmartTextareaWidget: React.FC<{
|
|
|
953
958
|
fieldId: string;
|
|
954
959
|
}>;
|
|
955
960
|
|
|
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 };
|
|
961
|
+
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';
|
|
@@ -860,6 +864,7 @@ type Medication = {
|
|
|
860
864
|
duration_value: string;
|
|
861
865
|
duration_unit: 'days' | 'weeks' | 'months';
|
|
862
866
|
before_after: BeforeAfterOption;
|
|
867
|
+
route: string;
|
|
863
868
|
morning: string;
|
|
864
869
|
afternoon: string;
|
|
865
870
|
night: string;
|
|
@@ -953,4 +958,4 @@ declare const SmartTextareaWidget: React.FC<{
|
|
|
953
958
|
fieldId: string;
|
|
954
959
|
}>;
|
|
955
960
|
|
|
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 };
|
|
961
|
+
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
|
@@ -3123,6 +3123,19 @@ var BEFORE_AFTER_NORMALIZATION_MAP = {
|
|
|
3123
3123
|
AF: "AFTER FOOD",
|
|
3124
3124
|
BF: "BEFORE FOOD"
|
|
3125
3125
|
};
|
|
3126
|
+
var ROUTE_OPTIONS = [
|
|
3127
|
+
{ label: "Select route", value: "" },
|
|
3128
|
+
{ label: "Per Os", value: "Per Os" },
|
|
3129
|
+
{ label: "Intravenous", value: "Intravenous" },
|
|
3130
|
+
{ label: "Intramuscular", value: "Intramuscular" },
|
|
3131
|
+
{ label: "Subcutaneous", value: "Subcutaneous" },
|
|
3132
|
+
{ label: "Sublingual", value: "Sublingual" },
|
|
3133
|
+
{ label: "Intranasal", value: "Intranasal" },
|
|
3134
|
+
{ label: "Topical", value: "Topical" },
|
|
3135
|
+
{ label: "Per Rectum", value: "Per Rectum" },
|
|
3136
|
+
{ label: "Inhalation", value: "Inhalation" },
|
|
3137
|
+
{ label: "ID Intradermal", value: "ID Intradermal" }
|
|
3138
|
+
];
|
|
3126
3139
|
function mapToMedication(result) {
|
|
3127
3140
|
return {
|
|
3128
3141
|
id: result.id,
|
|
@@ -3133,6 +3146,7 @@ function mapToMedication(result) {
|
|
|
3133
3146
|
duration_value: "3",
|
|
3134
3147
|
duration_unit: "days",
|
|
3135
3148
|
before_after: "AFTER FOOD",
|
|
3149
|
+
route: "",
|
|
3136
3150
|
morning: "0",
|
|
3137
3151
|
afternoon: "0",
|
|
3138
3152
|
night: "0",
|
|
@@ -3150,6 +3164,7 @@ function mapAIMedicationToMedication(ai) {
|
|
|
3150
3164
|
duration_value: "3",
|
|
3151
3165
|
duration_unit: "days",
|
|
3152
3166
|
before_after: "AFTER FOOD",
|
|
3167
|
+
route: "",
|
|
3153
3168
|
morning: "1",
|
|
3154
3169
|
afternoon: "0",
|
|
3155
3170
|
night: "1",
|
|
@@ -3166,6 +3181,7 @@ function createCustomMedication(name, customId) {
|
|
|
3166
3181
|
duration_value: "3",
|
|
3167
3182
|
duration_unit: "days",
|
|
3168
3183
|
before_after: "AFTER FOOD",
|
|
3184
|
+
route: "",
|
|
3169
3185
|
morning: "0",
|
|
3170
3186
|
afternoon: "0",
|
|
3171
3187
|
night: "0",
|
|
@@ -3199,6 +3215,7 @@ function mapFrequentItemToMedication(item) {
|
|
|
3199
3215
|
duration_value,
|
|
3200
3216
|
duration_unit,
|
|
3201
3217
|
before_after,
|
|
3218
|
+
route: item.route ?? "",
|
|
3202
3219
|
morning: item.morning ?? "0",
|
|
3203
3220
|
afternoon: item.afternoon ?? "0",
|
|
3204
3221
|
night: item.night ?? "0",
|
|
@@ -3266,7 +3283,9 @@ function MedicationCard({
|
|
|
3266
3283
|
/* @__PURE__ */ jsx("option", { value: "as_needed", children: "As needed" }),
|
|
3267
3284
|
/* @__PURE__ */ jsx("option", { value: "fort_night", children: "Fort night" }),
|
|
3268
3285
|
/* @__PURE__ */ jsx("option", { value: "at_bed_time", children: "At Bed time" }),
|
|
3269
|
-
/* @__PURE__ */ jsx("option", { value: "sos", children: "SOS only" })
|
|
3286
|
+
/* @__PURE__ */ jsx("option", { value: "sos", children: "SOS only" }),
|
|
3287
|
+
/* @__PURE__ */ jsx("option", { value: "biweekly", children: "Biweekly" }),
|
|
3288
|
+
/* @__PURE__ */ jsx("option", { value: "stat", children: "STAT" })
|
|
3270
3289
|
]
|
|
3271
3290
|
}
|
|
3272
3291
|
),
|
|
@@ -3327,6 +3346,15 @@ function MedicationCard({
|
|
|
3327
3346
|
onChange: (e) => set("before_after", e.target.value),
|
|
3328
3347
|
children: BEFORE_AFTER_OPTIONS.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.label))
|
|
3329
3348
|
}
|
|
3349
|
+
),
|
|
3350
|
+
/* @__PURE__ */ jsx(
|
|
3351
|
+
"select",
|
|
3352
|
+
{
|
|
3353
|
+
className: "text-xs border border-border rounded px-2 py-1 bg-white shrink-0",
|
|
3354
|
+
value: med.route ?? "",
|
|
3355
|
+
onChange: (e) => set("route", e.target.value),
|
|
3356
|
+
children: ROUTE_OPTIONS.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value))
|
|
3357
|
+
}
|
|
3330
3358
|
)
|
|
3331
3359
|
] }),
|
|
3332
3360
|
/* @__PURE__ */ jsxs(
|
|
@@ -5313,6 +5341,40 @@ var DiagnosisTextareaWidget = ({ fieldId }) => {
|
|
|
5313
5341
|
showError && /* @__PURE__ */ jsx("p", { className: "text-xs text-red-500", children: error })
|
|
5314
5342
|
] });
|
|
5315
5343
|
};
|
|
5344
|
+
var Switch = React15.forwardRef(
|
|
5345
|
+
({ className, checked, onCheckedChange, disabled, ...props }, ref) => {
|
|
5346
|
+
return /* @__PURE__ */ jsx(
|
|
5347
|
+
"button",
|
|
5348
|
+
{
|
|
5349
|
+
type: "button",
|
|
5350
|
+
role: "switch",
|
|
5351
|
+
"aria-checked": checked,
|
|
5352
|
+
"data-state": checked ? "checked" : "unchecked",
|
|
5353
|
+
disabled,
|
|
5354
|
+
ref,
|
|
5355
|
+
onClick: () => {
|
|
5356
|
+
if (!disabled && onCheckedChange) {
|
|
5357
|
+
onCheckedChange(!checked);
|
|
5358
|
+
}
|
|
5359
|
+
},
|
|
5360
|
+
className: cn(
|
|
5361
|
+
"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",
|
|
5362
|
+
className
|
|
5363
|
+
),
|
|
5364
|
+
...props,
|
|
5365
|
+
children: /* @__PURE__ */ jsx(
|
|
5366
|
+
"span",
|
|
5367
|
+
{
|
|
5368
|
+
"data-state": checked ? "checked" : "unchecked",
|
|
5369
|
+
className: "pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform",
|
|
5370
|
+
style: { transform: checked ? "translateX(1rem)" : "translateX(0)" }
|
|
5371
|
+
}
|
|
5372
|
+
)
|
|
5373
|
+
}
|
|
5374
|
+
);
|
|
5375
|
+
}
|
|
5376
|
+
);
|
|
5377
|
+
Switch.displayName = "Switch";
|
|
5316
5378
|
var DEFAULT_DRAFT = {
|
|
5317
5379
|
gpal: { G: 0, P: 0, A: 0, L: 0 },
|
|
5318
5380
|
lmp: "",
|
|
@@ -7886,6 +7948,26 @@ function renderWidget(fieldId, fieldDef) {
|
|
|
7886
7948
|
return /* @__PURE__ */ jsx(OphthalDiagnosisWidget, { fieldId });
|
|
7887
7949
|
case "orthopedic_exam":
|
|
7888
7950
|
return /* @__PURE__ */ jsx(OrthopedicExamWidget, { fieldId });
|
|
7951
|
+
case "toggle": {
|
|
7952
|
+
const { value, setValue, setTouched, disabled } = useField(fieldId);
|
|
7953
|
+
const store = useFormStore();
|
|
7954
|
+
const excludes = fieldDef.excludes ?? [];
|
|
7955
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
7956
|
+
/* @__PURE__ */ jsx(
|
|
7957
|
+
Switch,
|
|
7958
|
+
{
|
|
7959
|
+
checked: value === true,
|
|
7960
|
+
disabled,
|
|
7961
|
+
onCheckedChange: (checked) => {
|
|
7962
|
+
setValue(checked);
|
|
7963
|
+
setTouched();
|
|
7964
|
+
if (checked) excludes.forEach((id) => store.setValue(id, false));
|
|
7965
|
+
}
|
|
7966
|
+
}
|
|
7967
|
+
),
|
|
7968
|
+
/* @__PURE__ */ jsx(Label, { className: "text-sm font-medium leading-none cursor-pointer select-none", children: fieldDef.label })
|
|
7969
|
+
] });
|
|
7970
|
+
}
|
|
7889
7971
|
case "static_text": {
|
|
7890
7972
|
const def = fieldDef;
|
|
7891
7973
|
const size = def.size ?? "regular";
|
|
@@ -8579,6 +8661,13 @@ var ReadOnlyFieldRenderer = ({ fieldDef, value }) => {
|
|
|
8579
8661
|
return /* @__PURE__ */ jsx(ReadOnlyReferral, { fieldDef, value });
|
|
8580
8662
|
case "discharge_medication_orders":
|
|
8581
8663
|
return /* @__PURE__ */ jsx(ReadOnlyDischargeMedicationOrders, { fieldDef, value });
|
|
8664
|
+
case "toggle": {
|
|
8665
|
+
const isOn = value === true;
|
|
8666
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
8667
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: fieldDef.label }),
|
|
8668
|
+
/* @__PURE__ */ jsx("span", { className: `inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${isOn ? "bg-green-100 text-green-800" : "bg-gray-100 text-gray-600"}`, children: isOn ? "Yes" : "No" })
|
|
8669
|
+
] });
|
|
8670
|
+
}
|
|
8582
8671
|
case "static_text": {
|
|
8583
8672
|
const def = fieldDef;
|
|
8584
8673
|
const size = def.size ?? "regular";
|