formanitor 0.0.12 → 0.0.15

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
@@ -186,7 +186,38 @@ interface FollowupValue {
186
186
  interface FollowupFieldDef extends BaseFieldDef {
187
187
  type: 'followup';
188
188
  }
189
- type FieldDef = TextFieldDef | NumberFieldDef | SelectFieldDef | RadioFieldDef | CheckboxFieldDef | RepeatableFieldDef | ImageUploadFieldDef | SignatureFieldDef | EditableTableFieldDef | StaticTextFieldDef | MedicationsFieldDef | InvestigationsFieldDef | ProceduresFieldDef | DifferentialDiagnosisFieldDef | VitalsFieldDef | ReferralFieldDef | FollowupFieldDef | BaseFieldDef;
189
+ /** A matched master record returned from a backend search API. */
190
+ interface MatchedCondition {
191
+ id: number | string;
192
+ name: string;
193
+ created_at?: string;
194
+ updated_at?: string;
195
+ }
196
+ /** A single keyword-to-master-record match produced by NLP extraction + search. */
197
+ interface ExtractedKeywordMatch {
198
+ extractedKeyword: string;
199
+ matchedCondition: MatchedCondition;
200
+ }
201
+ /** Structured value stored in form state for smart_textarea fields. */
202
+ interface SmartTextareaValue {
203
+ text: string;
204
+ extractedKeywords: ExtractedKeywordMatch[];
205
+ }
206
+ /**
207
+ * Smart textarea that performs client-side NLP keyword extraction and searches
208
+ * matched terms against backend master tables via `fieldHandlers[fieldId].onSearch`.
209
+ *
210
+ * Value shape: `SmartTextareaValue` — `{ text, extractedKeywords }`.
211
+ */
212
+ interface SmartTextareaFieldDef extends BaseFieldDef {
213
+ type: 'smart_textarea';
214
+ height?: number;
215
+ /** Semantic label for the kind of content (e.g. 'allergies', 'chiefComplaints', 'symptoms'). */
216
+ componentType: string;
217
+ /** Debounce delay in ms before NLP + search triggers. Default: 1000. */
218
+ debounceDelay?: number;
219
+ }
220
+ type FieldDef = TextFieldDef | NumberFieldDef | SelectFieldDef | RadioFieldDef | CheckboxFieldDef | RepeatableFieldDef | ImageUploadFieldDef | SignatureFieldDef | EditableTableFieldDef | StaticTextFieldDef | MedicationsFieldDef | InvestigationsFieldDef | ProceduresFieldDef | DifferentialDiagnosisFieldDef | VitalsFieldDef | ReferralFieldDef | FollowupFieldDef | SmartTextareaFieldDef | BaseFieldDef;
190
221
  interface Condition {
191
222
  field?: string;
192
223
  op: '==' | '!=' | '>' | '<' | '>=' | '<=' | 'in' | 'contains';
@@ -392,6 +423,13 @@ declare class FormStore {
392
423
  * }
393
424
  */
394
425
  getSerializedValuesForSubmission(): FormValues;
426
+ /**
427
+ * Raw form values as stored internally, without any serialization or
428
+ * transformation. Useful when consumers need access to richer structures
429
+ * (e.g. smart_textarea keyword metadata) alongside the flattened values
430
+ * returned by getSerializedValuesForSubmission.
431
+ */
432
+ getRawValues(): FormValues;
395
433
  private serializeValuesForSubmission;
396
434
  private evaluate;
397
435
  getAvailableTransitions(): WorkflowTransition[];
@@ -472,6 +510,7 @@ declare function useForm(): {
472
510
  availableTransitions: WorkflowTransition[];
473
511
  hasPersistence: boolean;
474
512
  getSerializedValues: () => FormValues;
513
+ getRawValues: () => FormValues;
475
514
  markSubmitAttempted: () => void;
476
515
  flushPendingUploads: () => Promise<void>;
477
516
  };
@@ -704,4 +743,23 @@ type DifferentialDiagnosisProps = {
704
743
  */
705
744
  declare const DifferentialDiagnosis: React.FC<DifferentialDiagnosisProps>;
706
745
 
707
- export { type AIDifferentialDiagnosisItem, AddInvestigationField, type AddInvestigationFieldProps, AddMedicationField, type AddMedicationFieldProps, type BaseFieldDef, type CheckboxFieldDef, type ColumnLayout, type Computation, type Condition, type CreateUploadHandlerOptions, type DataSource, DifferentialDiagnosis, type DifferentialDiagnosisFieldDef, type DifferentialDiagnosisItem, type DifferentialDiagnosisProps, DynamicForm, EMAIL_REGEX, type EditableTableColumnDef, type EditableTableFieldDef, type EventDefinition, 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 InvestigationSearchResult, type InvestigationsFieldDef, type LayoutNode, type Medication, type MedicationSearchResult, type MedicationsFieldDef, type NumberFieldDef, type Permission, type PresignedUploadResponse, type ProceduresFieldDef, type RadioFieldDef, ReadOnlyForm, ReadOnlyImageUpload, ReadOnlySignature, ReadOnlyTable, type ReferralFieldDef, type ReferralItem, type RepeatableFieldDef, 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 StaticTextFieldDef, type StoreConfig, type SubmissionData, type SumComputation, type TextFieldDef, type ValidationRule, type VitalsFieldDef, type WebhookDef, type Workflow, type WorkflowTransition, createUploadHandler, evaluateRules, useField, useFieldHandlers, useForm, useFormStore, validateField, validateForm };
746
+ interface SmartKeywordsResult {
747
+ extractedNouns: string[];
748
+ matchedConditions: ExtractedKeywordMatch[];
749
+ isProcessing: boolean;
750
+ error: string | null;
751
+ }
752
+ /**
753
+ * Extracts noun phrases from `text` using compromise, deduplicates, then
754
+ * searches each noun against a backend master table via `onSearch`. Returns
755
+ * the flattened list of keyword-to-master-record matches.
756
+ *
757
+ * All NLP runs client-side; the backend only receives simple query strings.
758
+ */
759
+ declare function useSmartKeywords(text: string, onSearch: (query: string) => Promise<any[]>, debounceDelay?: number): SmartKeywordsResult;
760
+
761
+ declare const SmartTextareaWidget: React.FC<{
762
+ fieldId: string;
763
+ }>;
764
+
765
+ export { type AIDifferentialDiagnosisItem, AddInvestigationField, type AddInvestigationFieldProps, AddMedicationField, type AddMedicationFieldProps, type BaseFieldDef, type CheckboxFieldDef, type ColumnLayout, type Computation, type Condition, type CreateUploadHandlerOptions, type DataSource, DifferentialDiagnosis, type DifferentialDiagnosisFieldDef, type DifferentialDiagnosisItem, type DifferentialDiagnosisProps, 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 InvestigationSearchResult, type InvestigationsFieldDef, type LayoutNode, type MatchedCondition, type Medication, type MedicationSearchResult, type MedicationsFieldDef, type NumberFieldDef, type Permission, type PresignedUploadResponse, type ProceduresFieldDef, type RadioFieldDef, ReadOnlyForm, ReadOnlyImageUpload, ReadOnlySignature, ReadOnlyTable, type ReferralFieldDef, type ReferralItem, type RepeatableFieldDef, 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, useField, useFieldHandlers, useForm, useFormStore, useSmartKeywords, validateField, validateForm };
package/dist/index.d.ts CHANGED
@@ -186,7 +186,38 @@ interface FollowupValue {
186
186
  interface FollowupFieldDef extends BaseFieldDef {
187
187
  type: 'followup';
188
188
  }
189
- type FieldDef = TextFieldDef | NumberFieldDef | SelectFieldDef | RadioFieldDef | CheckboxFieldDef | RepeatableFieldDef | ImageUploadFieldDef | SignatureFieldDef | EditableTableFieldDef | StaticTextFieldDef | MedicationsFieldDef | InvestigationsFieldDef | ProceduresFieldDef | DifferentialDiagnosisFieldDef | VitalsFieldDef | ReferralFieldDef | FollowupFieldDef | BaseFieldDef;
189
+ /** A matched master record returned from a backend search API. */
190
+ interface MatchedCondition {
191
+ id: number | string;
192
+ name: string;
193
+ created_at?: string;
194
+ updated_at?: string;
195
+ }
196
+ /** A single keyword-to-master-record match produced by NLP extraction + search. */
197
+ interface ExtractedKeywordMatch {
198
+ extractedKeyword: string;
199
+ matchedCondition: MatchedCondition;
200
+ }
201
+ /** Structured value stored in form state for smart_textarea fields. */
202
+ interface SmartTextareaValue {
203
+ text: string;
204
+ extractedKeywords: ExtractedKeywordMatch[];
205
+ }
206
+ /**
207
+ * Smart textarea that performs client-side NLP keyword extraction and searches
208
+ * matched terms against backend master tables via `fieldHandlers[fieldId].onSearch`.
209
+ *
210
+ * Value shape: `SmartTextareaValue` — `{ text, extractedKeywords }`.
211
+ */
212
+ interface SmartTextareaFieldDef extends BaseFieldDef {
213
+ type: 'smart_textarea';
214
+ height?: number;
215
+ /** Semantic label for the kind of content (e.g. 'allergies', 'chiefComplaints', 'symptoms'). */
216
+ componentType: string;
217
+ /** Debounce delay in ms before NLP + search triggers. Default: 1000. */
218
+ debounceDelay?: number;
219
+ }
220
+ type FieldDef = TextFieldDef | NumberFieldDef | SelectFieldDef | RadioFieldDef | CheckboxFieldDef | RepeatableFieldDef | ImageUploadFieldDef | SignatureFieldDef | EditableTableFieldDef | StaticTextFieldDef | MedicationsFieldDef | InvestigationsFieldDef | ProceduresFieldDef | DifferentialDiagnosisFieldDef | VitalsFieldDef | ReferralFieldDef | FollowupFieldDef | SmartTextareaFieldDef | BaseFieldDef;
190
221
  interface Condition {
191
222
  field?: string;
192
223
  op: '==' | '!=' | '>' | '<' | '>=' | '<=' | 'in' | 'contains';
@@ -392,6 +423,13 @@ declare class FormStore {
392
423
  * }
393
424
  */
394
425
  getSerializedValuesForSubmission(): FormValues;
426
+ /**
427
+ * Raw form values as stored internally, without any serialization or
428
+ * transformation. Useful when consumers need access to richer structures
429
+ * (e.g. smart_textarea keyword metadata) alongside the flattened values
430
+ * returned by getSerializedValuesForSubmission.
431
+ */
432
+ getRawValues(): FormValues;
395
433
  private serializeValuesForSubmission;
396
434
  private evaluate;
397
435
  getAvailableTransitions(): WorkflowTransition[];
@@ -472,6 +510,7 @@ declare function useForm(): {
472
510
  availableTransitions: WorkflowTransition[];
473
511
  hasPersistence: boolean;
474
512
  getSerializedValues: () => FormValues;
513
+ getRawValues: () => FormValues;
475
514
  markSubmitAttempted: () => void;
476
515
  flushPendingUploads: () => Promise<void>;
477
516
  };
@@ -704,4 +743,23 @@ type DifferentialDiagnosisProps = {
704
743
  */
705
744
  declare const DifferentialDiagnosis: React.FC<DifferentialDiagnosisProps>;
706
745
 
707
- export { type AIDifferentialDiagnosisItem, AddInvestigationField, type AddInvestigationFieldProps, AddMedicationField, type AddMedicationFieldProps, type BaseFieldDef, type CheckboxFieldDef, type ColumnLayout, type Computation, type Condition, type CreateUploadHandlerOptions, type DataSource, DifferentialDiagnosis, type DifferentialDiagnosisFieldDef, type DifferentialDiagnosisItem, type DifferentialDiagnosisProps, DynamicForm, EMAIL_REGEX, type EditableTableColumnDef, type EditableTableFieldDef, type EventDefinition, 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 InvestigationSearchResult, type InvestigationsFieldDef, type LayoutNode, type Medication, type MedicationSearchResult, type MedicationsFieldDef, type NumberFieldDef, type Permission, type PresignedUploadResponse, type ProceduresFieldDef, type RadioFieldDef, ReadOnlyForm, ReadOnlyImageUpload, ReadOnlySignature, ReadOnlyTable, type ReferralFieldDef, type ReferralItem, type RepeatableFieldDef, 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 StaticTextFieldDef, type StoreConfig, type SubmissionData, type SumComputation, type TextFieldDef, type ValidationRule, type VitalsFieldDef, type WebhookDef, type Workflow, type WorkflowTransition, createUploadHandler, evaluateRules, useField, useFieldHandlers, useForm, useFormStore, validateField, validateForm };
746
+ interface SmartKeywordsResult {
747
+ extractedNouns: string[];
748
+ matchedConditions: ExtractedKeywordMatch[];
749
+ isProcessing: boolean;
750
+ error: string | null;
751
+ }
752
+ /**
753
+ * Extracts noun phrases from `text` using compromise, deduplicates, then
754
+ * searches each noun against a backend master table via `onSearch`. Returns
755
+ * the flattened list of keyword-to-master-record matches.
756
+ *
757
+ * All NLP runs client-side; the backend only receives simple query strings.
758
+ */
759
+ declare function useSmartKeywords(text: string, onSearch: (query: string) => Promise<any[]>, debounceDelay?: number): SmartKeywordsResult;
760
+
761
+ declare const SmartTextareaWidget: React.FC<{
762
+ fieldId: string;
763
+ }>;
764
+
765
+ export { type AIDifferentialDiagnosisItem, AddInvestigationField, type AddInvestigationFieldProps, AddMedicationField, type AddMedicationFieldProps, type BaseFieldDef, type CheckboxFieldDef, type ColumnLayout, type Computation, type Condition, type CreateUploadHandlerOptions, type DataSource, DifferentialDiagnosis, type DifferentialDiagnosisFieldDef, type DifferentialDiagnosisItem, type DifferentialDiagnosisProps, 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 InvestigationSearchResult, type InvestigationsFieldDef, type LayoutNode, type MatchedCondition, type Medication, type MedicationSearchResult, type MedicationsFieldDef, type NumberFieldDef, type Permission, type PresignedUploadResponse, type ProceduresFieldDef, type RadioFieldDef, ReadOnlyForm, ReadOnlyImageUpload, ReadOnlySignature, ReadOnlyTable, type ReferralFieldDef, type ReferralItem, type RepeatableFieldDef, 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, useField, useFieldHandlers, useForm, useFormStore, useSmartKeywords, validateField, validateForm };