formanitor 0.0.43 → 0.0.44

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
@@ -856,6 +856,25 @@ declare function useField(fieldId: string): {
856
856
 
857
857
  declare const DynamicForm: React.FC;
858
858
 
859
+ type DynamicFormV2SectionMode = "accordion" | "plain";
860
+ interface DynamicFormV2Props {
861
+ /** When true, renders `schema.title` as the page heading. Default true. */
862
+ showTitle?: boolean;
863
+ /**
864
+ * `accordion` — bordered collapsible sections (same as DynamicForm).
865
+ * `plain` — simple vertical stack, no card/accordion chrome.
866
+ */
867
+ sectionMode?: DynamicFormV2SectionMode;
868
+ /** In `plain` mode, show the section title above fields. Default true. Ignored for accordion. */
869
+ showSectionTitles?: boolean;
870
+ className?: string;
871
+ }
872
+ /**
873
+ * Alternate layout shell for alternative designs (e.g. marketing / minimal flows).
874
+ * Same schema traversal as {@link DynamicForm}; configurable title and section chrome.
875
+ */
876
+ declare const DynamicFormV2: React.FC<DynamicFormV2Props>;
877
+
859
878
  /** Shape of one differential diagnosis item from AI (must match form field value) */
860
879
  type AIDifferentialDiagnosisItem = {
861
880
  category: string;
@@ -926,6 +945,24 @@ declare const ReadOnlyForm: React.FC<ReadOnlyFormProps>;
926
945
 
927
946
  interface FormControlsProps {
928
947
  className?: string;
948
+ containerStyle?: React.CSSProperties;
949
+ /**
950
+ * When false, hides workflow state + valid/invalid text. Buttons stay right-aligned unless
951
+ * `actionsFullWidth` is used. Default true (existing behaviour).
952
+ */
953
+ showWorkflowStatus?: boolean;
954
+ statusClassName?: string;
955
+ statusStyle?: React.CSSProperties;
956
+ /** Classes for the buttons row wrapper. */
957
+ actionsClassName?: string;
958
+ actionsStyle?: React.CSSProperties;
959
+ /**
960
+ * When workflow status is hidden, make action buttons stretch (column on small screens;
961
+ * on `sm+` submit row grows with flex). Ignored while `showWorkflowStatus` is true.
962
+ */
963
+ actionsFullWidth?: boolean;
964
+ /** Applied to both Save Draft and Submit buttons. */
965
+ buttonClassName?: string;
929
966
  onSaveDraft?: () => void;
930
967
  onSubmit?: (to: string) => void;
931
968
  }
@@ -1136,4 +1173,4 @@ declare const SmartTextareaWidget: React.FC<{
1136
1173
  fieldId: string;
1137
1174
  }>;
1138
1175
 
1139
- 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, 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 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 };
1176
+ 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 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 };
package/dist/index.d.ts CHANGED
@@ -856,6 +856,25 @@ declare function useField(fieldId: string): {
856
856
 
857
857
  declare const DynamicForm: React.FC;
858
858
 
859
+ type DynamicFormV2SectionMode = "accordion" | "plain";
860
+ interface DynamicFormV2Props {
861
+ /** When true, renders `schema.title` as the page heading. Default true. */
862
+ showTitle?: boolean;
863
+ /**
864
+ * `accordion` — bordered collapsible sections (same as DynamicForm).
865
+ * `plain` — simple vertical stack, no card/accordion chrome.
866
+ */
867
+ sectionMode?: DynamicFormV2SectionMode;
868
+ /** In `plain` mode, show the section title above fields. Default true. Ignored for accordion. */
869
+ showSectionTitles?: boolean;
870
+ className?: string;
871
+ }
872
+ /**
873
+ * Alternate layout shell for alternative designs (e.g. marketing / minimal flows).
874
+ * Same schema traversal as {@link DynamicForm}; configurable title and section chrome.
875
+ */
876
+ declare const DynamicFormV2: React.FC<DynamicFormV2Props>;
877
+
859
878
  /** Shape of one differential diagnosis item from AI (must match form field value) */
860
879
  type AIDifferentialDiagnosisItem = {
861
880
  category: string;
@@ -926,6 +945,24 @@ declare const ReadOnlyForm: React.FC<ReadOnlyFormProps>;
926
945
 
927
946
  interface FormControlsProps {
928
947
  className?: string;
948
+ containerStyle?: React.CSSProperties;
949
+ /**
950
+ * When false, hides workflow state + valid/invalid text. Buttons stay right-aligned unless
951
+ * `actionsFullWidth` is used. Default true (existing behaviour).
952
+ */
953
+ showWorkflowStatus?: boolean;
954
+ statusClassName?: string;
955
+ statusStyle?: React.CSSProperties;
956
+ /** Classes for the buttons row wrapper. */
957
+ actionsClassName?: string;
958
+ actionsStyle?: React.CSSProperties;
959
+ /**
960
+ * When workflow status is hidden, make action buttons stretch (column on small screens;
961
+ * on `sm+` submit row grows with flex). Ignored while `showWorkflowStatus` is true.
962
+ */
963
+ actionsFullWidth?: boolean;
964
+ /** Applied to both Save Draft and Submit buttons. */
965
+ buttonClassName?: string;
929
966
  onSaveDraft?: () => void;
930
967
  onSubmit?: (to: string) => void;
931
968
  }
@@ -1136,4 +1173,4 @@ declare const SmartTextareaWidget: React.FC<{
1136
1173
  fieldId: string;
1137
1174
  }>;
1138
1175
 
1139
- 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, 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 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 };
1176
+ 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 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 };
package/dist/index.mjs CHANGED
@@ -12060,6 +12060,75 @@ var DynamicForm = () => {
12060
12060
  })
12061
12061
  ] });
12062
12062
  };
12063
+ function PlainSection({
12064
+ title,
12065
+ showHeading,
12066
+ children
12067
+ }) {
12068
+ return /* @__PURE__ */ jsxs("div", { className: "mb-6 space-y-4", children: [
12069
+ showHeading ? /* @__PURE__ */ jsx("h2", { className: "text-base font-medium text-foreground", children: title }) : null,
12070
+ children
12071
+ ] });
12072
+ }
12073
+ function renderSectionChildren(children) {
12074
+ return children.map((child, index) => {
12075
+ if (typeof child === "string") {
12076
+ return /* @__PURE__ */ jsx(FieldRenderer, { fieldId: child }, child);
12077
+ }
12078
+ if (child.type === "column_layout") {
12079
+ return /* @__PURE__ */ jsx(
12080
+ ColumnLayout,
12081
+ {
12082
+ columns: child.columns,
12083
+ label: child.label,
12084
+ children: child.children.map((fieldId) => /* @__PURE__ */ jsx(FieldRenderer, { fieldId }, fieldId))
12085
+ },
12086
+ child.id
12087
+ );
12088
+ }
12089
+ return /* @__PURE__ */ jsx(React15__default.Fragment, {}, index);
12090
+ });
12091
+ }
12092
+ var DynamicFormV2 = ({
12093
+ showTitle = true,
12094
+ sectionMode = "plain",
12095
+ showSectionTitles = true,
12096
+ className
12097
+ }) => {
12098
+ const store = useFormStore();
12099
+ const schema = store.getSchema();
12100
+ return /* @__PURE__ */ jsxs("div", { className: cn("space-y-6", className), children: [
12101
+ showTitle ? /* @__PURE__ */ jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold", children: schema.title }) }) : null,
12102
+ schema.layout.map((node) => {
12103
+ if (node.type === "section") {
12104
+ if (sectionMode === "accordion") {
12105
+ return /* @__PURE__ */ jsx(Section, { title: node.title, children: renderSectionChildren(node.children) }, node.id);
12106
+ }
12107
+ return /* @__PURE__ */ jsx(
12108
+ PlainSection,
12109
+ {
12110
+ title: node.title,
12111
+ showHeading: showSectionTitles,
12112
+ children: renderSectionChildren(node.children)
12113
+ },
12114
+ node.id
12115
+ );
12116
+ }
12117
+ if (node.type === "column_layout") {
12118
+ return /* @__PURE__ */ jsx(
12119
+ ColumnLayout,
12120
+ {
12121
+ columns: node.columns,
12122
+ label: node.label,
12123
+ children: node.children.map((fieldId) => /* @__PURE__ */ jsx(FieldRenderer, { fieldId }, fieldId))
12124
+ },
12125
+ node.id
12126
+ );
12127
+ }
12128
+ return null;
12129
+ })
12130
+ ] });
12131
+ };
12063
12132
  var SUGGESTION_KEYS = /* @__PURE__ */ new Set(["medications", "investigations", "procedures"]);
12064
12133
  function shallowEqualKeys(a, b) {
12065
12134
  const keysA = Object.keys(a);
@@ -12987,65 +13056,126 @@ var ReadOnlyForm = ({ schema, submission }) => {
12987
13056
  };
12988
13057
  var FormControls = ({
12989
13058
  className,
13059
+ containerStyle,
13060
+ showWorkflowStatus = true,
13061
+ statusClassName,
13062
+ statusStyle,
13063
+ actionsClassName,
13064
+ actionsStyle,
13065
+ actionsFullWidth = false,
13066
+ buttonClassName,
12990
13067
  onSaveDraft,
12991
13068
  onSubmit
12992
13069
  }) => {
12993
- const { state, availableTransitions, submit, transition, hasPersistence, markSubmitAttempted } = useForm();
13070
+ const {
13071
+ state,
13072
+ availableTransitions,
13073
+ submit,
13074
+ transition,
13075
+ hasPersistence,
13076
+ markSubmitAttempted
13077
+ } = useForm();
12994
13078
  const hasUploadsInFlight = (state.pendingUploads ?? 0) > 0;
12995
13079
  const draftAvailable = onSaveDraft || hasPersistence && submit;
12996
13080
  const submitAvailable = onSubmit || availableTransitions.length > 0 && transition;
12997
13081
  if (!draftAvailable && !submitAvailable) {
12998
13082
  return null;
12999
13083
  }
13000
- return /* @__PURE__ */ jsxs("div", { className: `flex gap-4 items-center justify-between p-4 border-t bg-white ${className || ""}`, children: [
13001
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
13002
- /* @__PURE__ */ jsxs("span", { className: "font-bold text-sm text-gray-700", children: [
13003
- "State: ",
13004
- state.workflowState
13005
- ] }),
13006
- /* @__PURE__ */ jsx("span", { className: `text-sm ${state.isValid ? "text-green-600" : "text-red-600"}`, children: state.isValid ? "Valid" : "Invalid" })
13007
- ] }),
13008
- /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
13009
- draftAvailable && /* @__PURE__ */ jsx(
13010
- Button,
13011
- {
13012
- onClick: onSaveDraft || submit,
13013
- variant: "outline",
13014
- size: "sm",
13015
- disabled: hasUploadsInFlight,
13016
- children: hasUploadsInFlight ? "Upload in progress\u2026" : "Save Draft"
13017
- }
13084
+ const useWideActions = !showWorkflowStatus && actionsFullWidth;
13085
+ const buttonCn = cn(
13086
+ buttonClassName,
13087
+ useWideActions && "w-full sm:flex-1 min-w-0"
13088
+ );
13089
+ return /* @__PURE__ */ jsxs(
13090
+ "div",
13091
+ {
13092
+ className: cn(
13093
+ "flex gap-4 border-t bg-white p-4 items-center",
13094
+ showWorkflowStatus ? "justify-between" : useWideActions ? "flex-col sm:flex-row sm:justify-stretch sm:gap-4" : "justify-end",
13095
+ className
13018
13096
  ),
13019
- submitAvailable && /* @__PURE__ */ jsx(Fragment, { children: availableTransitions.length > 0 ? availableTransitions.map((t) => /* @__PURE__ */ jsx(
13020
- Button,
13021
- {
13022
- onClick: () => {
13023
- markSubmitAttempted();
13024
- if (onSubmit) {
13025
- onSubmit(t.to);
13026
- } else {
13027
- transition(t.to);
13028
- }
13029
- },
13030
- disabled: !state.isValid || hasUploadsInFlight,
13031
- size: "sm",
13032
- children: hasUploadsInFlight ? "Upload in progress\u2026" : availableTransitions.length > 1 ? `Submit to ${t.to}` : "Submit"
13033
- },
13034
- t.to
13035
- )) : onSubmit ? /* @__PURE__ */ jsx(
13036
- Button,
13037
- {
13038
- onClick: () => {
13039
- markSubmitAttempted();
13040
- onSubmit(state.workflowState || "submit");
13041
- },
13042
- disabled: !state.isValid || hasUploadsInFlight,
13043
- size: "sm",
13044
- children: hasUploadsInFlight ? "Upload in progress\u2026" : "Submit"
13045
- }
13046
- ) : null })
13047
- ] })
13048
- ] });
13097
+ style: containerStyle,
13098
+ children: [
13099
+ showWorkflowStatus ? /* @__PURE__ */ jsxs(
13100
+ "div",
13101
+ {
13102
+ className: cn("flex items-center gap-4", statusClassName),
13103
+ style: statusStyle,
13104
+ children: [
13105
+ /* @__PURE__ */ jsxs("span", { className: "font-bold text-sm text-gray-700", children: [
13106
+ "State: ",
13107
+ state.workflowState
13108
+ ] }),
13109
+ /* @__PURE__ */ jsx(
13110
+ "span",
13111
+ {
13112
+ className: cn(
13113
+ "text-sm",
13114
+ state.isValid ? "text-green-600" : "text-red-600"
13115
+ ),
13116
+ children: state.isValid ? "Valid" : "Invalid"
13117
+ }
13118
+ )
13119
+ ]
13120
+ }
13121
+ ) : null,
13122
+ /* @__PURE__ */ jsxs(
13123
+ "div",
13124
+ {
13125
+ className: cn(
13126
+ "flex gap-2",
13127
+ useWideActions ? "w-full flex-col sm:flex-row sm:flex-1 sm:justify-end sm:max-w-none" : "flex-shrink-0",
13128
+ actionsClassName
13129
+ ),
13130
+ style: actionsStyle,
13131
+ children: [
13132
+ draftAvailable && /* @__PURE__ */ jsx(
13133
+ Button,
13134
+ {
13135
+ onClick: onSaveDraft || submit,
13136
+ variant: "outline",
13137
+ size: "sm",
13138
+ disabled: hasUploadsInFlight,
13139
+ className: buttonCn,
13140
+ children: hasUploadsInFlight ? "Upload in progress\u2026" : "Save Draft"
13141
+ }
13142
+ ),
13143
+ submitAvailable && /* @__PURE__ */ jsx(Fragment, { children: availableTransitions.length > 0 ? availableTransitions.map((t) => /* @__PURE__ */ jsx(
13144
+ Button,
13145
+ {
13146
+ onClick: () => {
13147
+ markSubmitAttempted();
13148
+ if (onSubmit) {
13149
+ onSubmit(t.to);
13150
+ } else {
13151
+ transition(t.to);
13152
+ }
13153
+ },
13154
+ disabled: !state.isValid || hasUploadsInFlight,
13155
+ size: "sm",
13156
+ className: buttonCn,
13157
+ children: hasUploadsInFlight ? "Upload in progress\u2026" : availableTransitions.length > 1 ? `Submit to ${t.to}` : "Submit"
13158
+ },
13159
+ t.to
13160
+ )) : onSubmit ? /* @__PURE__ */ jsx(
13161
+ Button,
13162
+ {
13163
+ onClick: () => {
13164
+ markSubmitAttempted();
13165
+ onSubmit(state.workflowState || "submit");
13166
+ },
13167
+ disabled: !state.isValid || hasUploadsInFlight,
13168
+ size: "sm",
13169
+ className: buttonCn,
13170
+ children: hasUploadsInFlight ? "Upload in progress\u2026" : "Submit"
13171
+ }
13172
+ ) : null })
13173
+ ]
13174
+ }
13175
+ )
13176
+ ]
13177
+ }
13178
+ );
13049
13179
  };
13050
13180
 
13051
13181
  // src/utils/createUploadHandler.ts
@@ -13078,6 +13208,6 @@ function createUploadHandler(options) {
13078
13208
  };
13079
13209
  }
13080
13210
 
13081
- 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 };
13211
+ export { AddInvestigationField, AddMedicationField, DifferentialDiagnosis, DynamicForm, DynamicFormV2, 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 };
13082
13212
  //# sourceMappingURL=index.mjs.map
13083
13213
  //# sourceMappingURL=index.mjs.map