formanitor 0.0.33 → 0.0.34

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.d.cts CHANGED
@@ -308,6 +308,18 @@ interface DoctorFrequentItems {
308
308
  investigations?: InvestigationFrequentItem[];
309
309
  procedures?: ProcedureFrequentItem[];
310
310
  }
311
+ interface DiagnosticPackageTest {
312
+ id: string;
313
+ name: string;
314
+ }
315
+ interface DiagnosticPackage {
316
+ id: string;
317
+ name: string;
318
+ code: string;
319
+ description?: string;
320
+ department?: string;
321
+ tests: DiagnosticPackageTest[];
322
+ }
311
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;
312
324
  interface Condition {
313
325
  field?: string;
@@ -615,6 +627,7 @@ type FieldHandler = {
615
627
  type FieldHandlersMap = Record<string, FieldHandler>;
616
628
  declare function useFieldHandlers(fieldId: string): FieldHandler;
617
629
  declare function useFrequentItems(): DoctorFrequentItems;
630
+ declare function usePackages(): DiagnosticPackage[];
618
631
  interface FormProviderProps {
619
632
  schema: FormDef;
620
633
  config?: StoreConfig;
@@ -624,6 +637,7 @@ interface FormProviderProps {
624
637
  * Consumer fetches and passes this; Forminator flows it to medications, investigations, and procedures widgets.
625
638
  */
626
639
  frequentItems?: DoctorFrequentItems;
640
+ packages?: DiagnosticPackage[];
627
641
  children: React.ReactNode;
628
642
  }
629
643
  declare const FormProvider: React.FC<FormProviderProps>;
@@ -895,8 +909,8 @@ type AddInvestigationFieldProps = {
895
909
  onChange: (items: Investigation[]) => void;
896
910
  onSearch: (query: string) => Promise<InvestigationSearchResult[]>;
897
911
  recentlyUsed?: InvestigationSearchResult[];
898
- /** Doctor-scoped frequently used investigations (from FormProvider frequentItems) */
899
912
  frequentItems?: InvestigationFrequentItem[];
913
+ packages?: DiagnosticPackage[];
900
914
  };
901
915
  declare const AddInvestigationField: React.FC<AddInvestigationFieldProps>;
902
916
 
@@ -939,4 +953,4 @@ declare const SmartTextareaWidget: React.FC<{
939
953
  fieldId: string;
940
954
  }>;
941
955
 
942
- 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, 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, useSmartKeywords, validateField, validateForm };
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 };
package/dist/index.d.ts CHANGED
@@ -308,6 +308,18 @@ interface DoctorFrequentItems {
308
308
  investigations?: InvestigationFrequentItem[];
309
309
  procedures?: ProcedureFrequentItem[];
310
310
  }
311
+ interface DiagnosticPackageTest {
312
+ id: string;
313
+ name: string;
314
+ }
315
+ interface DiagnosticPackage {
316
+ id: string;
317
+ name: string;
318
+ code: string;
319
+ description?: string;
320
+ department?: string;
321
+ tests: DiagnosticPackageTest[];
322
+ }
311
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;
312
324
  interface Condition {
313
325
  field?: string;
@@ -615,6 +627,7 @@ type FieldHandler = {
615
627
  type FieldHandlersMap = Record<string, FieldHandler>;
616
628
  declare function useFieldHandlers(fieldId: string): FieldHandler;
617
629
  declare function useFrequentItems(): DoctorFrequentItems;
630
+ declare function usePackages(): DiagnosticPackage[];
618
631
  interface FormProviderProps {
619
632
  schema: FormDef;
620
633
  config?: StoreConfig;
@@ -624,6 +637,7 @@ interface FormProviderProps {
624
637
  * Consumer fetches and passes this; Forminator flows it to medications, investigations, and procedures widgets.
625
638
  */
626
639
  frequentItems?: DoctorFrequentItems;
640
+ packages?: DiagnosticPackage[];
627
641
  children: React.ReactNode;
628
642
  }
629
643
  declare const FormProvider: React.FC<FormProviderProps>;
@@ -895,8 +909,8 @@ type AddInvestigationFieldProps = {
895
909
  onChange: (items: Investigation[]) => void;
896
910
  onSearch: (query: string) => Promise<InvestigationSearchResult[]>;
897
911
  recentlyUsed?: InvestigationSearchResult[];
898
- /** Doctor-scoped frequently used investigations (from FormProvider frequentItems) */
899
912
  frequentItems?: InvestigationFrequentItem[];
913
+ packages?: DiagnosticPackage[];
900
914
  };
901
915
  declare const AddInvestigationField: React.FC<AddInvestigationFieldProps>;
902
916
 
@@ -939,4 +953,4 @@ declare const SmartTextareaWidget: React.FC<{
939
953
  fieldId: string;
940
954
  }>;
941
955
 
942
- 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, 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, useSmartKeywords, validateField, validateForm };
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 };
package/dist/index.mjs CHANGED
@@ -697,6 +697,7 @@ var emptyFrequentItems = {
697
697
  procedures: []
698
698
  };
699
699
  var FrequentItemsContext = createContext(emptyFrequentItems);
700
+ var PackagesContext = createContext([]);
700
701
  var FieldHandlersContext = createContext({});
701
702
  function useFieldHandlers(fieldId) {
702
703
  const map = useContext(FieldHandlersContext);
@@ -705,11 +706,15 @@ function useFieldHandlers(fieldId) {
705
706
  function useFrequentItems() {
706
707
  return useContext(FrequentItemsContext);
707
708
  }
709
+ function usePackages() {
710
+ return useContext(PackagesContext);
711
+ }
708
712
  var FormProvider = ({
709
713
  schema,
710
714
  config,
711
715
  fieldHandlers,
712
716
  frequentItems,
717
+ packages,
713
718
  children
714
719
  }) => {
715
720
  const storeRef = useRef(null);
@@ -725,7 +730,7 @@ var FormProvider = ({
725
730
  storeRef.current?.load();
726
731
  }, []);
727
732
  const frequentItemsValue = frequentItems ?? emptyFrequentItems;
728
- return /* @__PURE__ */ jsx(FormContext.Provider, { value: storeRef.current, children: /* @__PURE__ */ jsx(FieldHandlersContext.Provider, { value: fieldHandlers ?? {}, children: /* @__PURE__ */ jsx(FrequentItemsContext.Provider, { value: frequentItemsValue, children: /* @__PURE__ */ jsx(VoiceContextProvider, { children }) }) }) });
733
+ return /* @__PURE__ */ jsx(FormContext.Provider, { value: storeRef.current, children: /* @__PURE__ */ jsx(FieldHandlersContext.Provider, { value: fieldHandlers ?? {}, children: /* @__PURE__ */ jsx(FrequentItemsContext.Provider, { value: frequentItemsValue, children: /* @__PURE__ */ jsx(PackagesContext.Provider, { value: packages ?? [], children: /* @__PURE__ */ jsx(VoiceContextProvider, { children }) }) }) }) });
729
734
  };
730
735
  function useFormStore() {
731
736
  const context = useContext(FormContext);
@@ -3078,18 +3083,20 @@ var AddEntityDialog = ({
3078
3083
  open,
3079
3084
  onClose,
3080
3085
  title,
3086
+ chipSections,
3081
3087
  recentlyUsedSlot,
3082
3088
  chipSectionLabel = "Recently Used",
3083
3089
  children,
3084
3090
  actionSlot
3085
3091
  }) => {
3086
- return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: (o) => !o && onClose(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-w-lg w-full p-0 gap-0 flex flex-col max-h-[90vh] overflow-hidden", children: [
3092
+ const sections = chipSections ?? (recentlyUsedSlot ? [{ label: chipSectionLabel, content: recentlyUsedSlot }] : []);
3093
+ return /* @__PURE__ */ jsx(Dialog, { open, onOpenChange: (o) => !o && onClose(), children: /* @__PURE__ */ jsxs(DialogContent, { className: "max-w-4xl w-full p-0 gap-0 flex flex-col max-h-[90vh] overflow-hidden", children: [
3087
3094
  /* @__PURE__ */ jsx(DialogHeader, { className: "px-6 pt-6 pb-4 shrink-0", children: /* @__PURE__ */ jsx(DialogTitle, { className: "text-lg font-semibold", children: title }) }),
3088
3095
  /* @__PURE__ */ jsxs("div", { className: "px-6 flex flex-col gap-4 overflow-y-auto flex-1 min-h-0 pb-4", children: [
3089
- recentlyUsedSlot && /* @__PURE__ */ jsxs("div", { children: [
3090
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mb-2", children: chipSectionLabel }),
3091
- /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: recentlyUsedSlot })
3092
- ] }),
3096
+ sections.map((section) => /* @__PURE__ */ jsxs("div", { children: [
3097
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mb-2", children: section.label }),
3098
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: section.content })
3099
+ ] }, section.label)),
3093
3100
  children
3094
3101
  ] }),
3095
3102
  actionSlot != null && /* @__PURE__ */ jsx("div", { className: "px-6 py-4 flex justify-end shrink-0 border-t border-border bg-background", children: actionSlot })
@@ -3631,7 +3638,8 @@ var AddInvestigationField = ({
3631
3638
  onChange,
3632
3639
  onSearch,
3633
3640
  recentlyUsed = [],
3634
- frequentItems = []
3641
+ frequentItems = [],
3642
+ packages = []
3635
3643
  }) => {
3636
3644
  const [open, setOpen] = useState(false);
3637
3645
  const [query, setQuery] = useState("");
@@ -3642,6 +3650,8 @@ var AddInvestigationField = ({
3642
3650
  const debounceRef = useRef(null);
3643
3651
  const valueRef = useRef([]);
3644
3652
  const searchInputRef = useRef(null);
3653
+ const addedByPackage = useRef(/* @__PURE__ */ new Map());
3654
+ const [selectedPackageIds, setSelectedPackageIds] = useState(/* @__PURE__ */ new Set());
3645
3655
  const safeValue = Array.isArray(value) ? value : [];
3646
3656
  valueRef.current = safeValue;
3647
3657
  const addedIds = new Set(safeValue.map((inv) => inv.id));
@@ -3716,6 +3726,27 @@ var AddInvestigationField = ({
3716
3726
  setAddingFrequentId(null);
3717
3727
  }
3718
3728
  }
3729
+ function handlePackageToggle(pkg) {
3730
+ const alreadyAdded = addedByPackage.current.has(pkg.id);
3731
+ if (alreadyAdded) {
3732
+ const idsToRemove = new Set(addedByPackage.current.get(pkg.id) ?? []);
3733
+ onChange(valueRef.current.filter((inv) => !idsToRemove.has(inv.id)));
3734
+ addedByPackage.current.delete(pkg.id);
3735
+ setSelectedPackageIds((prev) => {
3736
+ const next = new Set(prev);
3737
+ next.delete(pkg.id);
3738
+ return next;
3739
+ });
3740
+ } else {
3741
+ const currentIds = new Set(valueRef.current.map((inv) => inv.id));
3742
+ const newTests = pkg.tests.filter((t) => !currentIds.has(t.id)).map((t) => mapToInvestigation(t));
3743
+ if (newTests.length > 0) {
3744
+ onChange([...valueRef.current, ...newTests]);
3745
+ }
3746
+ addedByPackage.current.set(pkg.id, newTests.map((t) => t.id));
3747
+ setSelectedPackageIds((prev) => new Set(prev).add(pkg.id));
3748
+ }
3749
+ }
3719
3750
  const recentlyUsedChips = recentlyUsed.map((r) => {
3720
3751
  const isAdded = addedIds.has(r.id);
3721
3752
  return /* @__PURE__ */ jsxs(
@@ -3759,6 +3790,38 @@ var AddInvestigationField = ({
3759
3790
  item.id
3760
3791
  );
3761
3792
  }) : [];
3793
+ const packageChips = packages.map((pkg) => {
3794
+ const isAdded = selectedPackageIds.has(pkg.id);
3795
+ return /* @__PURE__ */ jsxs(
3796
+ "button",
3797
+ {
3798
+ type: "button",
3799
+ onClick: () => handlePackageToggle(pkg),
3800
+ className: cn(
3801
+ "rounded-full border text-xs px-4 py-1.5 transition-colors flex items-center gap-2",
3802
+ isAdded ? "border-green-300 bg-green-50 text-green-700" : "border-border bg-white hover:bg-gray-50"
3803
+ ),
3804
+ children: [
3805
+ isAdded && /* @__PURE__ */ jsx("span", { children: "\u2713" }),
3806
+ /* @__PURE__ */ jsx("span", { className: "font-semibold", children: pkg.name }),
3807
+ /* @__PURE__ */ jsx("span", { className: cn(
3808
+ "rounded-full px-1.5 py-0.5 text-[10px] font-medium",
3809
+ isAdded ? "bg-green-100 text-green-600" : "bg-purple-100 text-purple-600"
3810
+ ), children: pkg.tests.length })
3811
+ ]
3812
+ },
3813
+ pkg.id
3814
+ );
3815
+ });
3816
+ const chipSections = [];
3817
+ if (frequentItemChips.length > 0) {
3818
+ chipSections.push({ label: "Frequently used", content: /* @__PURE__ */ jsx(Fragment, { children: frequentItemChips }) });
3819
+ } else if (recentlyUsedChips.length > 0) {
3820
+ chipSections.push({ label: "Recently Used", content: /* @__PURE__ */ jsx(Fragment, { children: recentlyUsedChips }) });
3821
+ }
3822
+ if (packageChips.length > 0) {
3823
+ chipSections.push({ label: "Packages", content: /* @__PURE__ */ jsx(Fragment, { children: packageChips }) });
3824
+ }
3762
3825
  return /* @__PURE__ */ jsxs("div", { className: "rounded-md overflow-hidden flex flex-col bg-white border border-[#D0D0D0] space-y-3 p-3 h-fit", children: [
3763
3826
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-3", children: [
3764
3827
  /* @__PURE__ */ jsx("span", { className: "text-sm font-semibold", children: label }),
@@ -3797,8 +3860,7 @@ var AddInvestigationField = ({
3797
3860
  open,
3798
3861
  onClose: () => setOpen(false),
3799
3862
  title: "Add Investigation",
3800
- recentlyUsedSlot: frequentItemChips.length > 0 ? frequentItemChips : recentlyUsedChips.length > 0 ? recentlyUsedChips : void 0,
3801
- chipSectionLabel: frequentItemChips.length > 0 ? "Frequently used" : void 0,
3863
+ chipSections: chipSections.length > 0 ? chipSections : void 0,
3802
3864
  children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
3803
3865
  /* @__PURE__ */ jsx(
3804
3866
  Input,
@@ -3839,6 +3901,7 @@ var AddInvestigationWidget = ({ fieldId }) => {
3839
3901
  const { value, setValue } = useField(fieldId);
3840
3902
  const handlers = useFieldHandlers(fieldId);
3841
3903
  const { investigations: frequentInvestigations } = useFrequentItems();
3904
+ const packages = usePackages();
3842
3905
  const safeValue = Array.isArray(value) ? value : [];
3843
3906
  return /* @__PURE__ */ jsx(
3844
3907
  AddInvestigationField,
@@ -3847,7 +3910,8 @@ var AddInvestigationWidget = ({ fieldId }) => {
3847
3910
  onChange: setValue,
3848
3911
  onSearch: handlers.onSearch,
3849
3912
  recentlyUsed: handlers.recentlyUsed,
3850
- frequentItems: frequentInvestigations
3913
+ frequentItems: frequentInvestigations,
3914
+ packages
3851
3915
  }
3852
3916
  );
3853
3917
  };
@@ -8700,6 +8764,6 @@ function createUploadHandler(options) {
8700
8764
  };
8701
8765
  }
8702
8766
 
8703
- export { AddInvestigationField, AddMedicationField, DifferentialDiagnosis, DynamicForm, EMAIL_REGEX, FieldRenderer, FormControls, FormProvider, FormStore, ImageUploadWidget, MAR_MEDICATION_ORDERS_META_KEY, MediaUploadWidget, ReadOnlyForm, ReadOnlyImageUpload, ReadOnlyMediaUpload, ReadOnlySignature, ReadOnlyTable, RichTextWidget, SignatureUploadWidget, SmartForm, SmartTextareaWidget, createUploadHandler, evaluateRules, fieldMetaRequestsMarMedicationOrdersButton, useField, useFieldHandlers, useForm, useFormStore, useFrequentItems, useSmartKeywords, validateField, validateForm };
8767
+ export { AddInvestigationField, AddMedicationField, DifferentialDiagnosis, DynamicForm, EMAIL_REGEX, FieldRenderer, FormControls, FormProvider, FormStore, ImageUploadWidget, MAR_MEDICATION_ORDERS_META_KEY, MediaUploadWidget, ReadOnlyForm, ReadOnlyImageUpload, ReadOnlyMediaUpload, ReadOnlySignature, ReadOnlyTable, RichTextWidget, SignatureUploadWidget, SmartForm, SmartTextareaWidget, createUploadHandler, evaluateRules, fieldMetaRequestsMarMedicationOrdersButton, useField, useFieldHandlers, useForm, useFormStore, useFrequentItems, usePackages, useSmartKeywords, validateField, validateForm };
8704
8768
  //# sourceMappingURL=index.mjs.map
8705
8769
  //# sourceMappingURL=index.mjs.map