formanitor 0.0.47 → 0.0.49

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
@@ -500,7 +500,33 @@ interface DiagnosticPackage {
500
500
  department?: string;
501
501
  tests: DiagnosticPackageTest[];
502
502
  }
503
- type FieldDef = TextFieldDef | RichTextFieldDef | NumberFieldDef | SliderFieldDef | SelectFieldDef | RadioFieldDef | CheckboxFieldDef | RepeatableFieldDef | ImageUploadFieldDef | MediaUploadFieldDef | SignatureFieldDef | EditableTableFieldDef | StaticTextFieldDef | MedicationsFieldDef | InvestigationsFieldDef | ProceduresFieldDef | DifferentialDiagnosisFieldDef | VitalsFieldDef | ReferralFieldDef | FollowupFieldDef | SmartTextareaFieldDef | DiagnosisTextareaFieldDef | SuggestionTextareaFieldDef | LensAssessmentFieldDef | FunctionalImpairmentScoreFieldDef | ToggleFieldDef | BiometryIolWorkupFieldDef | SurgicalRiskFlagsFieldDef | GeneralSurgerySmartHistoryFieldDef | GeneralSurgeryExaminationFieldDef | GeneralSurgeryGradingFieldDef | UrologySmartHistoryFieldDef | UrologyExaminationFieldDef | UrologyPathwayFieldDef | OBGExaminationFieldDef | OBGPathwayFieldDef | PainScaleFlagsFieldDef | BaseFieldDef;
503
+ interface PhoneInputFieldDef extends BaseFieldDef {
504
+ type: 'phone_input';
505
+ meta?: {
506
+ /** ID of the sibling otp_input field to clear when the phone is edited after a send. */
507
+ otpFieldId?: string;
508
+ /** Country code prefix, e.g. "+91". Defaults to "+91". */
509
+ countryCode?: string;
510
+ };
511
+ }
512
+ interface OtpInputFieldDef extends BaseFieldDef {
513
+ type: 'otp_input';
514
+ meta?: {
515
+ /** ID of the sibling phone_input field to read the number from. Defaults to "phone". */
516
+ phoneFieldId?: string;
517
+ /** Number of OTP digits. Defaults to 4. */
518
+ length?: 4 | 6;
519
+ };
520
+ }
521
+ /** Value shape stored in the form store after a successful OTP verification. */
522
+ interface OtpVerifiedValue {
523
+ verified: true;
524
+ phone: string;
525
+ /** Digits the user entered; included so submissions can persist `otp_code`. */
526
+ code: string;
527
+ token?: string;
528
+ }
529
+ type FieldDef = TextFieldDef | RichTextFieldDef | NumberFieldDef | SliderFieldDef | SelectFieldDef | RadioFieldDef | CheckboxFieldDef | RepeatableFieldDef | ImageUploadFieldDef | MediaUploadFieldDef | SignatureFieldDef | EditableTableFieldDef | StaticTextFieldDef | MedicationsFieldDef | InvestigationsFieldDef | ProceduresFieldDef | DifferentialDiagnosisFieldDef | VitalsFieldDef | ReferralFieldDef | FollowupFieldDef | SmartTextareaFieldDef | DiagnosisTextareaFieldDef | SuggestionTextareaFieldDef | LensAssessmentFieldDef | FunctionalImpairmentScoreFieldDef | ToggleFieldDef | BiometryIolWorkupFieldDef | SurgicalRiskFlagsFieldDef | GeneralSurgerySmartHistoryFieldDef | GeneralSurgeryExaminationFieldDef | GeneralSurgeryGradingFieldDef | UrologySmartHistoryFieldDef | UrologyExaminationFieldDef | UrologyPathwayFieldDef | OBGExaminationFieldDef | OBGPathwayFieldDef | PainScaleFlagsFieldDef | PhoneInputFieldDef | OtpInputFieldDef | BaseFieldDef;
504
530
  /** Boolean switch; value is `true` | `false`. */
505
531
  interface ToggleFieldDef extends BaseFieldDef {
506
532
  type: 'toggle';
@@ -555,7 +581,27 @@ interface Section {
555
581
  title: string;
556
582
  children: SectionChild[];
557
583
  }
558
- type LayoutNode = Section | ColumnLayout;
584
+ interface MultiStepNode {
585
+ type: 'section';
586
+ id: string;
587
+ title: string;
588
+ children: SectionChild[];
589
+ }
590
+ interface MultiStepLayoutNode {
591
+ type: 'multi_step';
592
+ id: string;
593
+ title?: string;
594
+ steps: MultiStepNode[];
595
+ meta?: {
596
+ /** Show step indicator header. Default true. */
597
+ showStepper?: boolean;
598
+ /** Visual style for the stepper. Default 'numbered'. */
599
+ stepperVariant?: 'numbered' | 'dots' | 'labels';
600
+ /** Collapse completed steps into an accordion. Default true. */
601
+ collapseCompleted?: boolean;
602
+ };
603
+ }
604
+ type LayoutNode = Section | ColumnLayout | MultiStepLayoutNode;
559
605
  interface WebhookDef {
560
606
  method: 'GET' | 'POST' | 'PUT';
561
607
  url: string;
@@ -662,6 +708,21 @@ type Listener = (state: FormState) => void;
662
708
  type EventListener = (event: string, payload?: any) => void;
663
709
  type UploadHandler = (file: File | Blob, filename: string) => Promise<string>;
664
710
  type DraftChangeHandler = (payload: SavedState) => void | Promise<void>;
711
+ interface StoreAuthConfig {
712
+ /**
713
+ * Base URL for OTP API calls. Defaults to `process.env.NEXT_PUBLIC_API_URL` when not set.
714
+ * Set this in the host app to decouple the library from Next.js env vars.
715
+ */
716
+ baseUrl?: string;
717
+ /** Path to send OTP. Defaults to "/api/auth/otp/send/". */
718
+ sendPath?: string;
719
+ /** Path to resend OTP. Defaults to "/api/auth/otp/resend/". */
720
+ resendPath?: string;
721
+ /** Path to verify OTP. Defaults to "/api/auth/otp/verify/". */
722
+ verifyPath?: string;
723
+ /** Country code prefix for phone numbers. Defaults to "+91". */
724
+ defaultCountryCode?: string;
725
+ }
665
726
  interface StoreConfig {
666
727
  persistence?: PersistenceProvider;
667
728
  prefillData?: Record<string, any>;
@@ -669,6 +730,11 @@ interface StoreConfig {
669
730
  onEvent?: EventListener;
670
731
  onUpload?: UploadHandler;
671
732
  onDraftChange?: DraftChangeHandler;
733
+ /**
734
+ * Auth / OTP configuration. Lets the host app supply the API base URL and
735
+ * paths so the library doesn't depend on Next.js environment variables.
736
+ */
737
+ auth?: StoreAuthConfig;
672
738
  /**
673
739
  * Voice dictation support. When provided, fields marked with `voice: true`
674
740
  * in the schema will display a microphone button.
@@ -689,6 +755,7 @@ declare class FormStore {
689
755
  private persistence;
690
756
  private prefillData;
691
757
  private config;
758
+ private externalErrors;
692
759
  private saveTimeout;
693
760
  private draftCallbackTimeout;
694
761
  constructor(schema: FormDef, config?: StoreConfig);
@@ -702,6 +769,7 @@ declare class FormStore {
702
769
  disabled: boolean;
703
770
  };
704
771
  getSchema(): FormDef;
772
+ getConfig(): StoreConfig;
705
773
  getFieldDef(fieldId: string): FieldDef | undefined;
706
774
  getVoice(): StoreConfig['voice'];
707
775
  hasPersistence(): boolean;
@@ -715,6 +783,12 @@ declare class FormStore {
715
783
  setValues(partial: Record<string, any>, options?: {
716
784
  touch?: boolean;
717
785
  }): void;
786
+ /**
787
+ * Let a widget report an error that schema validation cannot express
788
+ * (e.g. "Send OTP to continue" until the API call succeeds).
789
+ * Pass `null` to clear a previously set external error.
790
+ */
791
+ setExternalError(fieldId: string, message: string | null): void;
718
792
  setTouched(fieldId: string): void;
719
793
  setRole(role: string): void;
720
794
  load(): Promise<void>;
@@ -773,7 +847,12 @@ declare class FormStore {
773
847
  }
774
848
 
775
849
  declare const EMAIL_REGEX: RegExp;
776
- declare function validateField(value: any, field: FieldDef): string | null;
850
+ /**
851
+ * Validate a single field.
852
+ * Pass `allValues` when you need cross-field validation (e.g. otp_input checking the
853
+ * sibling phone field's value).
854
+ */
855
+ declare function validateField(value: any, field: FieldDef, allValues?: Record<string, any>): string | null;
777
856
  declare function validateForm(values: Record<string, any>, fields: Record<string, FieldDef>): Record<string, string | null>;
778
857
 
779
858
  interface RuleResult {
@@ -887,6 +966,20 @@ interface DynamicFormV2Props {
887
966
  */
888
967
  declare const DynamicFormV2: React.FC<DynamicFormV2Props>;
889
968
 
969
+ interface MultiStepFormProps {
970
+ /** When true, renders `schema.title` as the page heading. Default true. */
971
+ showTitle?: boolean;
972
+ className?: string;
973
+ }
974
+ /**
975
+ * Renders a form schema that may contain `multi_step` layout nodes in addition
976
+ * to the standard `section` / `column_layout` nodes.
977
+ *
978
+ * Multi-step groups unlock steps linearly: a step becomes visible only when
979
+ * all fields in the previous step are valid (no errors, required fields filled).
980
+ */
981
+ declare const MultiStepForm: React.FC<MultiStepFormProps>;
982
+
890
983
  /** Shape of one differential diagnosis item from AI (must match form field value) */
891
984
  type AIDifferentialDiagnosisItem = {
892
985
  category: string;
@@ -977,6 +1070,8 @@ interface FormControlsProps {
977
1070
  buttonClassName?: string;
978
1071
  onSaveDraft?: () => void;
979
1072
  onSubmit?: (to: string) => void;
1073
+ /** Override the label on the submit/transition button. Defaults to "Submit". */
1074
+ submitLabel?: string;
980
1075
  }
981
1076
  declare const FormControls: React.FC<FormControlsProps>;
982
1077
 
@@ -1185,4 +1280,4 @@ declare const SmartTextareaWidget: React.FC<{
1185
1280
  fieldId: string;
1186
1281
  }>;
1187
1282
 
1188
- export { type AIDifferentialDiagnosisItem, AddInvestigationField, type AddInvestigationFieldProps, AddMedicationField, type AddMedicationFieldProps, type BaseFieldDef, type BiometryIolWorkupFieldDef, type BiometryIolWorkupValue, type BiometryMethod, 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, DynamicFormV2, type DynamicFormV2Props, type DynamicFormV2SectionMode, 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 FunctionalImpairmentDimension, type FunctionalImpairmentScoreFieldDef, type FunctionalImpairmentScoreValue, type GeneralSurgeryExaminationFieldDef, type GeneralSurgeryGradingFieldDef, type GeneralSurgerySmartHistoryFieldDef, type ImageUploadFieldDef, ImageUploadWidget, type Investigation, type InvestigationFrequentItem, type InvestigationSearchResult, type InvestigationsFieldDef, type LayoutNode, type LensAssessmentFieldDef, type LensAssessmentValue, type LocsGrades, MAR_MEDICATION_ORDERS_META_KEY, type MatchedCondition, type MediaUploadFieldDef, MediaUploadWidget, type Medication, type MedicationFrequentItem, type MedicationSearchResult, type MedicationsFieldDef, type NumberFieldDef, type OBGExaminationFieldDef, type OBGPathwayFieldDef, type PainScaleFlagsFieldDef, 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, type SliderFieldDef, SmartForm, type SmartFormProps, type SmartKeywordsResult, type SmartTextareaFieldDef, type SmartTextareaValue, SmartTextareaWidget, type StaticTextFieldDef, type StoreConfig, type SubmissionData, type SuggestionTextareaFieldDef, type SumComputation, type SurgicalRiskFlagsFieldDef, type SurgicalRiskFlagsValue, type TextFieldDef, type ToggleFieldDef, type UrologyExaminationFieldDef, type UrologyPathwayFieldDef, type UrologySmartHistoryFieldDef, type ValidationRule, type VitalsFieldDef, type WebhookDef, type Workflow, type WorkflowTransition, createUploadHandler, evaluateRules, fieldMetaRequestsMarMedicationOrdersButton, useField, useFieldHandlers, useForm, useFormStore, useFrequentItems, usePackages, useSmartKeywords, validateField, validateForm };
1283
+ export { type AIDifferentialDiagnosisItem, AddInvestigationField, type AddInvestigationFieldProps, AddMedicationField, type AddMedicationFieldProps, type BaseFieldDef, type BiometryIolWorkupFieldDef, type BiometryIolWorkupValue, type BiometryMethod, 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, DynamicFormV2, type DynamicFormV2Props, type DynamicFormV2SectionMode, 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 FunctionalImpairmentDimension, type FunctionalImpairmentScoreFieldDef, type FunctionalImpairmentScoreValue, type GeneralSurgeryExaminationFieldDef, type GeneralSurgeryGradingFieldDef, type GeneralSurgerySmartHistoryFieldDef, type ImageUploadFieldDef, ImageUploadWidget, type Investigation, type InvestigationFrequentItem, type InvestigationSearchResult, type InvestigationsFieldDef, type LayoutNode, type LensAssessmentFieldDef, type LensAssessmentValue, type LocsGrades, MAR_MEDICATION_ORDERS_META_KEY, type MatchedCondition, type MediaUploadFieldDef, MediaUploadWidget, type Medication, type MedicationFrequentItem, type MedicationSearchResult, type MedicationsFieldDef, MultiStepForm, type MultiStepFormProps, type MultiStepLayoutNode, type MultiStepNode, type NumberFieldDef, type OBGExaminationFieldDef, type OBGPathwayFieldDef, type OtpInputFieldDef, type OtpVerifiedValue, type PainScaleFlagsFieldDef, type Permission, type PhoneInputFieldDef, 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, type SliderFieldDef, SmartForm, type SmartFormProps, type SmartKeywordsResult, type SmartTextareaFieldDef, type SmartTextareaValue, SmartTextareaWidget, type StaticTextFieldDef, type StoreAuthConfig, type StoreConfig, type SubmissionData, type SuggestionTextareaFieldDef, type SumComputation, type SurgicalRiskFlagsFieldDef, type SurgicalRiskFlagsValue, type TextFieldDef, type ToggleFieldDef, type UrologyExaminationFieldDef, type UrologyPathwayFieldDef, type UrologySmartHistoryFieldDef, 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
@@ -500,7 +500,33 @@ interface DiagnosticPackage {
500
500
  department?: string;
501
501
  tests: DiagnosticPackageTest[];
502
502
  }
503
- type FieldDef = TextFieldDef | RichTextFieldDef | NumberFieldDef | SliderFieldDef | SelectFieldDef | RadioFieldDef | CheckboxFieldDef | RepeatableFieldDef | ImageUploadFieldDef | MediaUploadFieldDef | SignatureFieldDef | EditableTableFieldDef | StaticTextFieldDef | MedicationsFieldDef | InvestigationsFieldDef | ProceduresFieldDef | DifferentialDiagnosisFieldDef | VitalsFieldDef | ReferralFieldDef | FollowupFieldDef | SmartTextareaFieldDef | DiagnosisTextareaFieldDef | SuggestionTextareaFieldDef | LensAssessmentFieldDef | FunctionalImpairmentScoreFieldDef | ToggleFieldDef | BiometryIolWorkupFieldDef | SurgicalRiskFlagsFieldDef | GeneralSurgerySmartHistoryFieldDef | GeneralSurgeryExaminationFieldDef | GeneralSurgeryGradingFieldDef | UrologySmartHistoryFieldDef | UrologyExaminationFieldDef | UrologyPathwayFieldDef | OBGExaminationFieldDef | OBGPathwayFieldDef | PainScaleFlagsFieldDef | BaseFieldDef;
503
+ interface PhoneInputFieldDef extends BaseFieldDef {
504
+ type: 'phone_input';
505
+ meta?: {
506
+ /** ID of the sibling otp_input field to clear when the phone is edited after a send. */
507
+ otpFieldId?: string;
508
+ /** Country code prefix, e.g. "+91". Defaults to "+91". */
509
+ countryCode?: string;
510
+ };
511
+ }
512
+ interface OtpInputFieldDef extends BaseFieldDef {
513
+ type: 'otp_input';
514
+ meta?: {
515
+ /** ID of the sibling phone_input field to read the number from. Defaults to "phone". */
516
+ phoneFieldId?: string;
517
+ /** Number of OTP digits. Defaults to 4. */
518
+ length?: 4 | 6;
519
+ };
520
+ }
521
+ /** Value shape stored in the form store after a successful OTP verification. */
522
+ interface OtpVerifiedValue {
523
+ verified: true;
524
+ phone: string;
525
+ /** Digits the user entered; included so submissions can persist `otp_code`. */
526
+ code: string;
527
+ token?: string;
528
+ }
529
+ type FieldDef = TextFieldDef | RichTextFieldDef | NumberFieldDef | SliderFieldDef | SelectFieldDef | RadioFieldDef | CheckboxFieldDef | RepeatableFieldDef | ImageUploadFieldDef | MediaUploadFieldDef | SignatureFieldDef | EditableTableFieldDef | StaticTextFieldDef | MedicationsFieldDef | InvestigationsFieldDef | ProceduresFieldDef | DifferentialDiagnosisFieldDef | VitalsFieldDef | ReferralFieldDef | FollowupFieldDef | SmartTextareaFieldDef | DiagnosisTextareaFieldDef | SuggestionTextareaFieldDef | LensAssessmentFieldDef | FunctionalImpairmentScoreFieldDef | ToggleFieldDef | BiometryIolWorkupFieldDef | SurgicalRiskFlagsFieldDef | GeneralSurgerySmartHistoryFieldDef | GeneralSurgeryExaminationFieldDef | GeneralSurgeryGradingFieldDef | UrologySmartHistoryFieldDef | UrologyExaminationFieldDef | UrologyPathwayFieldDef | OBGExaminationFieldDef | OBGPathwayFieldDef | PainScaleFlagsFieldDef | PhoneInputFieldDef | OtpInputFieldDef | BaseFieldDef;
504
530
  /** Boolean switch; value is `true` | `false`. */
505
531
  interface ToggleFieldDef extends BaseFieldDef {
506
532
  type: 'toggle';
@@ -555,7 +581,27 @@ interface Section {
555
581
  title: string;
556
582
  children: SectionChild[];
557
583
  }
558
- type LayoutNode = Section | ColumnLayout;
584
+ interface MultiStepNode {
585
+ type: 'section';
586
+ id: string;
587
+ title: string;
588
+ children: SectionChild[];
589
+ }
590
+ interface MultiStepLayoutNode {
591
+ type: 'multi_step';
592
+ id: string;
593
+ title?: string;
594
+ steps: MultiStepNode[];
595
+ meta?: {
596
+ /** Show step indicator header. Default true. */
597
+ showStepper?: boolean;
598
+ /** Visual style for the stepper. Default 'numbered'. */
599
+ stepperVariant?: 'numbered' | 'dots' | 'labels';
600
+ /** Collapse completed steps into an accordion. Default true. */
601
+ collapseCompleted?: boolean;
602
+ };
603
+ }
604
+ type LayoutNode = Section | ColumnLayout | MultiStepLayoutNode;
559
605
  interface WebhookDef {
560
606
  method: 'GET' | 'POST' | 'PUT';
561
607
  url: string;
@@ -662,6 +708,21 @@ type Listener = (state: FormState) => void;
662
708
  type EventListener = (event: string, payload?: any) => void;
663
709
  type UploadHandler = (file: File | Blob, filename: string) => Promise<string>;
664
710
  type DraftChangeHandler = (payload: SavedState) => void | Promise<void>;
711
+ interface StoreAuthConfig {
712
+ /**
713
+ * Base URL for OTP API calls. Defaults to `process.env.NEXT_PUBLIC_API_URL` when not set.
714
+ * Set this in the host app to decouple the library from Next.js env vars.
715
+ */
716
+ baseUrl?: string;
717
+ /** Path to send OTP. Defaults to "/api/auth/otp/send/". */
718
+ sendPath?: string;
719
+ /** Path to resend OTP. Defaults to "/api/auth/otp/resend/". */
720
+ resendPath?: string;
721
+ /** Path to verify OTP. Defaults to "/api/auth/otp/verify/". */
722
+ verifyPath?: string;
723
+ /** Country code prefix for phone numbers. Defaults to "+91". */
724
+ defaultCountryCode?: string;
725
+ }
665
726
  interface StoreConfig {
666
727
  persistence?: PersistenceProvider;
667
728
  prefillData?: Record<string, any>;
@@ -669,6 +730,11 @@ interface StoreConfig {
669
730
  onEvent?: EventListener;
670
731
  onUpload?: UploadHandler;
671
732
  onDraftChange?: DraftChangeHandler;
733
+ /**
734
+ * Auth / OTP configuration. Lets the host app supply the API base URL and
735
+ * paths so the library doesn't depend on Next.js environment variables.
736
+ */
737
+ auth?: StoreAuthConfig;
672
738
  /**
673
739
  * Voice dictation support. When provided, fields marked with `voice: true`
674
740
  * in the schema will display a microphone button.
@@ -689,6 +755,7 @@ declare class FormStore {
689
755
  private persistence;
690
756
  private prefillData;
691
757
  private config;
758
+ private externalErrors;
692
759
  private saveTimeout;
693
760
  private draftCallbackTimeout;
694
761
  constructor(schema: FormDef, config?: StoreConfig);
@@ -702,6 +769,7 @@ declare class FormStore {
702
769
  disabled: boolean;
703
770
  };
704
771
  getSchema(): FormDef;
772
+ getConfig(): StoreConfig;
705
773
  getFieldDef(fieldId: string): FieldDef | undefined;
706
774
  getVoice(): StoreConfig['voice'];
707
775
  hasPersistence(): boolean;
@@ -715,6 +783,12 @@ declare class FormStore {
715
783
  setValues(partial: Record<string, any>, options?: {
716
784
  touch?: boolean;
717
785
  }): void;
786
+ /**
787
+ * Let a widget report an error that schema validation cannot express
788
+ * (e.g. "Send OTP to continue" until the API call succeeds).
789
+ * Pass `null` to clear a previously set external error.
790
+ */
791
+ setExternalError(fieldId: string, message: string | null): void;
718
792
  setTouched(fieldId: string): void;
719
793
  setRole(role: string): void;
720
794
  load(): Promise<void>;
@@ -773,7 +847,12 @@ declare class FormStore {
773
847
  }
774
848
 
775
849
  declare const EMAIL_REGEX: RegExp;
776
- declare function validateField(value: any, field: FieldDef): string | null;
850
+ /**
851
+ * Validate a single field.
852
+ * Pass `allValues` when you need cross-field validation (e.g. otp_input checking the
853
+ * sibling phone field's value).
854
+ */
855
+ declare function validateField(value: any, field: FieldDef, allValues?: Record<string, any>): string | null;
777
856
  declare function validateForm(values: Record<string, any>, fields: Record<string, FieldDef>): Record<string, string | null>;
778
857
 
779
858
  interface RuleResult {
@@ -887,6 +966,20 @@ interface DynamicFormV2Props {
887
966
  */
888
967
  declare const DynamicFormV2: React.FC<DynamicFormV2Props>;
889
968
 
969
+ interface MultiStepFormProps {
970
+ /** When true, renders `schema.title` as the page heading. Default true. */
971
+ showTitle?: boolean;
972
+ className?: string;
973
+ }
974
+ /**
975
+ * Renders a form schema that may contain `multi_step` layout nodes in addition
976
+ * to the standard `section` / `column_layout` nodes.
977
+ *
978
+ * Multi-step groups unlock steps linearly: a step becomes visible only when
979
+ * all fields in the previous step are valid (no errors, required fields filled).
980
+ */
981
+ declare const MultiStepForm: React.FC<MultiStepFormProps>;
982
+
890
983
  /** Shape of one differential diagnosis item from AI (must match form field value) */
891
984
  type AIDifferentialDiagnosisItem = {
892
985
  category: string;
@@ -977,6 +1070,8 @@ interface FormControlsProps {
977
1070
  buttonClassName?: string;
978
1071
  onSaveDraft?: () => void;
979
1072
  onSubmit?: (to: string) => void;
1073
+ /** Override the label on the submit/transition button. Defaults to "Submit". */
1074
+ submitLabel?: string;
980
1075
  }
981
1076
  declare const FormControls: React.FC<FormControlsProps>;
982
1077
 
@@ -1185,4 +1280,4 @@ declare const SmartTextareaWidget: React.FC<{
1185
1280
  fieldId: string;
1186
1281
  }>;
1187
1282
 
1188
- export { type AIDifferentialDiagnosisItem, AddInvestigationField, type AddInvestigationFieldProps, AddMedicationField, type AddMedicationFieldProps, type BaseFieldDef, type BiometryIolWorkupFieldDef, type BiometryIolWorkupValue, type BiometryMethod, 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, DynamicFormV2, type DynamicFormV2Props, type DynamicFormV2SectionMode, 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 FunctionalImpairmentDimension, type FunctionalImpairmentScoreFieldDef, type FunctionalImpairmentScoreValue, type GeneralSurgeryExaminationFieldDef, type GeneralSurgeryGradingFieldDef, type GeneralSurgerySmartHistoryFieldDef, type ImageUploadFieldDef, ImageUploadWidget, type Investigation, type InvestigationFrequentItem, type InvestigationSearchResult, type InvestigationsFieldDef, type LayoutNode, type LensAssessmentFieldDef, type LensAssessmentValue, type LocsGrades, MAR_MEDICATION_ORDERS_META_KEY, type MatchedCondition, type MediaUploadFieldDef, MediaUploadWidget, type Medication, type MedicationFrequentItem, type MedicationSearchResult, type MedicationsFieldDef, type NumberFieldDef, type OBGExaminationFieldDef, type OBGPathwayFieldDef, type PainScaleFlagsFieldDef, 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, type SliderFieldDef, SmartForm, type SmartFormProps, type SmartKeywordsResult, type SmartTextareaFieldDef, type SmartTextareaValue, SmartTextareaWidget, type StaticTextFieldDef, type StoreConfig, type SubmissionData, type SuggestionTextareaFieldDef, type SumComputation, type SurgicalRiskFlagsFieldDef, type SurgicalRiskFlagsValue, type TextFieldDef, type ToggleFieldDef, type UrologyExaminationFieldDef, type UrologyPathwayFieldDef, type UrologySmartHistoryFieldDef, type ValidationRule, type VitalsFieldDef, type WebhookDef, type Workflow, type WorkflowTransition, createUploadHandler, evaluateRules, fieldMetaRequestsMarMedicationOrdersButton, useField, useFieldHandlers, useForm, useFormStore, useFrequentItems, usePackages, useSmartKeywords, validateField, validateForm };
1283
+ export { type AIDifferentialDiagnosisItem, AddInvestigationField, type AddInvestigationFieldProps, AddMedicationField, type AddMedicationFieldProps, type BaseFieldDef, type BiometryIolWorkupFieldDef, type BiometryIolWorkupValue, type BiometryMethod, 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, DynamicFormV2, type DynamicFormV2Props, type DynamicFormV2SectionMode, 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 FunctionalImpairmentDimension, type FunctionalImpairmentScoreFieldDef, type FunctionalImpairmentScoreValue, type GeneralSurgeryExaminationFieldDef, type GeneralSurgeryGradingFieldDef, type GeneralSurgerySmartHistoryFieldDef, type ImageUploadFieldDef, ImageUploadWidget, type Investigation, type InvestigationFrequentItem, type InvestigationSearchResult, type InvestigationsFieldDef, type LayoutNode, type LensAssessmentFieldDef, type LensAssessmentValue, type LocsGrades, MAR_MEDICATION_ORDERS_META_KEY, type MatchedCondition, type MediaUploadFieldDef, MediaUploadWidget, type Medication, type MedicationFrequentItem, type MedicationSearchResult, type MedicationsFieldDef, MultiStepForm, type MultiStepFormProps, type MultiStepLayoutNode, type MultiStepNode, type NumberFieldDef, type OBGExaminationFieldDef, type OBGPathwayFieldDef, type OtpInputFieldDef, type OtpVerifiedValue, type PainScaleFlagsFieldDef, type Permission, type PhoneInputFieldDef, 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, type SliderFieldDef, SmartForm, type SmartFormProps, type SmartKeywordsResult, type SmartTextareaFieldDef, type SmartTextareaValue, SmartTextareaWidget, type StaticTextFieldDef, type StoreAuthConfig, type StoreConfig, type SubmissionData, type SuggestionTextareaFieldDef, type SumComputation, type SurgicalRiskFlagsFieldDef, type SurgicalRiskFlagsValue, type TextFieldDef, type ToggleFieldDef, type UrologyExaminationFieldDef, type UrologyPathwayFieldDef, type UrologySmartHistoryFieldDef, type ValidationRule, type VitalsFieldDef, type WebhookDef, type Workflow, type WorkflowTransition, createUploadHandler, evaluateRules, fieldMetaRequestsMarMedicationOrdersButton, useField, useFieldHandlers, useForm, useFormStore, useFrequentItems, usePackages, useSmartKeywords, validateField, validateForm };