formanitor 0.1.8 → 0.1.9

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
@@ -111,6 +111,8 @@ interface RichTextFieldDef extends BaseFieldDef {
111
111
  type: "richtext";
112
112
  /** Minimum height of the editor body in pixels. Default: 160. */
113
113
  minHeight?: number;
114
+ /** When true, enables table insert/edit controls in the toolbar. Default: false. */
115
+ tables?: boolean;
114
116
  }
115
117
  interface NumberFieldDef extends BaseFieldDef {
116
118
  type: "number";
@@ -1074,6 +1076,8 @@ declare const FieldRenderer: React.FC<FieldRendererProps>;
1074
1076
  declare const RichTextWidget: React.FC<{
1075
1077
  fieldId: string;
1076
1078
  }>;
1079
+ /** Tailwind classes for rendering stored richtext HTML (e.g. read-only views). */
1080
+ declare function richTextHtmlClassName(): string;
1077
1081
 
1078
1082
  interface SubmissionData {
1079
1083
  created_at: string;
@@ -1362,4 +1366,4 @@ declare const SmartTextareaWidget: React.FC<{
1362
1366
  fieldId: string;
1363
1367
  }>;
1364
1368
 
1365
- 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, FieldRequiredIndicator, type FieldState, type FieldStyleClassNames, type FieldStyleConfig, type FieldType, type FileUploadFieldDef, type FollowupFieldDef, type FollowupValue, FormControls, type FormControlsProps, type FormDef, type FormErrors, FormFileUploadWidget, 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, Upload, type UploadProps, type UrologyExaminationFieldDef, type UrologyPathwayFieldDef, type UrologySmartHistoryFieldDef, type ValidationRule, type VitalsFieldDef, type WebhookDef, type Workflow, type WorkflowTransition, createUploadHandler, evaluateRules, fieldControlClass, fieldDescriptionClass, fieldErrorClass, fieldLabelClass, fieldMetaRequestsMarMedicationOrdersButton, fieldWrapperClass, isLabelVisible, useField, useFieldHandlers, useForm, useFormStore, useFrequentItems, usePackages, useSmartKeywords, validateField, validateForm };
1369
+ 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, FieldRequiredIndicator, type FieldState, type FieldStyleClassNames, type FieldStyleConfig, type FieldType, type FileUploadFieldDef, type FollowupFieldDef, type FollowupValue, FormControls, type FormControlsProps, type FormDef, type FormErrors, FormFileUploadWidget, 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, Upload, type UploadProps, type UrologyExaminationFieldDef, type UrologyPathwayFieldDef, type UrologySmartHistoryFieldDef, type ValidationRule, type VitalsFieldDef, type WebhookDef, type Workflow, type WorkflowTransition, createUploadHandler, evaluateRules, fieldControlClass, fieldDescriptionClass, fieldErrorClass, fieldLabelClass, fieldMetaRequestsMarMedicationOrdersButton, fieldWrapperClass, isLabelVisible, richTextHtmlClassName, useField, useFieldHandlers, useForm, useFormStore, useFrequentItems, usePackages, useSmartKeywords, validateField, validateForm };
package/dist/index.d.ts CHANGED
@@ -111,6 +111,8 @@ interface RichTextFieldDef extends BaseFieldDef {
111
111
  type: "richtext";
112
112
  /** Minimum height of the editor body in pixels. Default: 160. */
113
113
  minHeight?: number;
114
+ /** When true, enables table insert/edit controls in the toolbar. Default: false. */
115
+ tables?: boolean;
114
116
  }
115
117
  interface NumberFieldDef extends BaseFieldDef {
116
118
  type: "number";
@@ -1074,6 +1076,8 @@ declare const FieldRenderer: React.FC<FieldRendererProps>;
1074
1076
  declare const RichTextWidget: React.FC<{
1075
1077
  fieldId: string;
1076
1078
  }>;
1079
+ /** Tailwind classes for rendering stored richtext HTML (e.g. read-only views). */
1080
+ declare function richTextHtmlClassName(): string;
1077
1081
 
1078
1082
  interface SubmissionData {
1079
1083
  created_at: string;
@@ -1362,4 +1366,4 @@ declare const SmartTextareaWidget: React.FC<{
1362
1366
  fieldId: string;
1363
1367
  }>;
1364
1368
 
1365
- 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, FieldRequiredIndicator, type FieldState, type FieldStyleClassNames, type FieldStyleConfig, type FieldType, type FileUploadFieldDef, type FollowupFieldDef, type FollowupValue, FormControls, type FormControlsProps, type FormDef, type FormErrors, FormFileUploadWidget, 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, Upload, type UploadProps, type UrologyExaminationFieldDef, type UrologyPathwayFieldDef, type UrologySmartHistoryFieldDef, type ValidationRule, type VitalsFieldDef, type WebhookDef, type Workflow, type WorkflowTransition, createUploadHandler, evaluateRules, fieldControlClass, fieldDescriptionClass, fieldErrorClass, fieldLabelClass, fieldMetaRequestsMarMedicationOrdersButton, fieldWrapperClass, isLabelVisible, useField, useFieldHandlers, useForm, useFormStore, useFrequentItems, usePackages, useSmartKeywords, validateField, validateForm };
1369
+ 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, FieldRequiredIndicator, type FieldState, type FieldStyleClassNames, type FieldStyleConfig, type FieldType, type FileUploadFieldDef, type FollowupFieldDef, type FollowupValue, FormControls, type FormControlsProps, type FormDef, type FormErrors, FormFileUploadWidget, 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, Upload, type UploadProps, type UrologyExaminationFieldDef, type UrologyPathwayFieldDef, type UrologySmartHistoryFieldDef, type ValidationRule, type VitalsFieldDef, type WebhookDef, type Workflow, type WorkflowTransition, createUploadHandler, evaluateRules, fieldControlClass, fieldDescriptionClass, fieldErrorClass, fieldLabelClass, fieldMetaRequestsMarMedicationOrdersButton, fieldWrapperClass, isLabelVisible, richTextHtmlClassName, useField, useFieldHandlers, useForm, useFormStore, useFrequentItems, usePackages, useSmartKeywords, validateField, validateForm };
package/dist/index.mjs CHANGED
@@ -3,13 +3,14 @@ import React15__default, { createContext, useContext, useRef, useEffect, useStat
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { clsx } from 'clsx';
5
5
  import { twMerge } from 'tailwind-merge';
6
- import { ChevronDown, ChevronUp, Check, Circle, X, Image, Upload, Trash2, Plus, Loader2, PenTool, Mic, Undo, Redo, ChevronRight, Calendar as Calendar$1, ChevronLeft, RefreshCw, Clock, Bold, Italic, Underline as Underline$1, Strikethrough, List, ListOrdered } from 'lucide-react';
6
+ import { ChevronDown, ChevronUp, Check, Circle, X, Image, Upload, Trash2, Plus, Loader2, PenTool, Mic, Undo, Redo, ChevronRight, Calendar as Calendar$1, ChevronLeft, RefreshCw, Clock, Bold, Italic, Underline as Underline$1, Strikethrough, List, ListOrdered, Table as Table$1, Rows2, Columns2, TableRowsSplit, TableColumnsSplit } from 'lucide-react';
7
7
  import * as LabelPrimitive from '@radix-ui/react-label';
8
8
  import { cva } from 'class-variance-authority';
9
9
  import { useEditor, EditorContent } from '@tiptap/react';
10
10
  import StarterKit from '@tiptap/starter-kit';
11
11
  import Placeholder from '@tiptap/extension-placeholder';
12
12
  import Underline from '@tiptap/extension-underline';
13
+ import { TableRow, TableHeader, TableCell, Table } from '@tiptap/extension-table';
13
14
  import { Slot } from '@radix-ui/react-slot';
14
15
  import * as SeparatorPrimitive from '@radix-ui/react-separator';
15
16
  import * as SelectPrimitive from '@radix-ui/react-select';
@@ -2193,9 +2194,47 @@ function isEmptyHtml(html) {
2193
2194
  const t = html.trim();
2194
2195
  return t === "" || t === "<p></p>" || t === "<p><br></p>" || t === '<p><br class="ProseMirror-trailingBreak"></p>';
2195
2196
  }
2197
+ function buildRichTextExtensions(placeholder, tables) {
2198
+ const base = [
2199
+ StarterKit.configure({
2200
+ // Disable headings entirely so the UI/content can't introduce H2/H3.
2201
+ heading: false,
2202
+ bulletList: {
2203
+ HTMLAttributes: {
2204
+ class: "list-disc pl-6 my-2"
2205
+ }
2206
+ },
2207
+ orderedList: {
2208
+ HTMLAttributes: {
2209
+ class: "list-decimal pl-6 my-2"
2210
+ }
2211
+ },
2212
+ listItem: {
2213
+ HTMLAttributes: {
2214
+ class: "my-1"
2215
+ }
2216
+ }
2217
+ }),
2218
+ Underline,
2219
+ Placeholder.configure({
2220
+ placeholder
2221
+ })
2222
+ ];
2223
+ if (!tables) return base;
2224
+ return [
2225
+ ...base,
2226
+ Table.configure({
2227
+ resizable: false
2228
+ }),
2229
+ TableRow,
2230
+ TableHeader,
2231
+ TableCell
2232
+ ];
2233
+ }
2196
2234
  function RichTextToolbar({
2197
2235
  editor,
2198
- disabled
2236
+ disabled,
2237
+ tablesEnabled
2199
2238
  }) {
2200
2239
  const [, rerender] = useReducer((n) => n + 1, 0);
2201
2240
  useEffect(() => {
@@ -2226,6 +2265,7 @@ function RichTextToolbar({
2226
2265
  children: icon
2227
2266
  }
2228
2267
  );
2268
+ const inTable = tablesEnabled && editor.isActive("table");
2229
2269
  return /* @__PURE__ */ jsxs(
2230
2270
  "div",
2231
2271
  {
@@ -2270,6 +2310,46 @@ function RichTextToolbar({
2270
2310
  /* @__PURE__ */ jsx(ListOrdered, { className: "h-4 w-4" }),
2271
2311
  "Numbered list"
2272
2312
  ),
2313
+ tablesEnabled && /* @__PURE__ */ jsxs(Fragment, { children: [
2314
+ /* @__PURE__ */ jsx(Separator, { orientation: "vertical", className: "mx-0.5 h-6" }),
2315
+ !inTable ? fmtBtn(
2316
+ false,
2317
+ () => editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run(),
2318
+ /* @__PURE__ */ jsx(Table$1, { className: "h-4 w-4" }),
2319
+ "Insert table"
2320
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
2321
+ fmtBtn(
2322
+ false,
2323
+ () => editor.chain().focus().addRowAfter().run(),
2324
+ /* @__PURE__ */ jsx(Rows2, { className: "h-4 w-4" }),
2325
+ "Add row below"
2326
+ ),
2327
+ fmtBtn(
2328
+ false,
2329
+ () => editor.chain().focus().addColumnAfter().run(),
2330
+ /* @__PURE__ */ jsx(Columns2, { className: "h-4 w-4" }),
2331
+ "Add column right"
2332
+ ),
2333
+ fmtBtn(
2334
+ false,
2335
+ () => editor.chain().focus().deleteRow().run(),
2336
+ /* @__PURE__ */ jsx(TableRowsSplit, { className: "h-4 w-4" }),
2337
+ "Delete row"
2338
+ ),
2339
+ fmtBtn(
2340
+ false,
2341
+ () => editor.chain().focus().deleteColumn().run(),
2342
+ /* @__PURE__ */ jsx(TableColumnsSplit, { className: "h-4 w-4" }),
2343
+ "Delete column"
2344
+ ),
2345
+ fmtBtn(
2346
+ false,
2347
+ () => editor.chain().focus().deleteTable().run(),
2348
+ /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" }),
2349
+ "Delete table"
2350
+ )
2351
+ ] })
2352
+ ] }),
2273
2353
  /* @__PURE__ */ jsx(Separator, { orientation: "vertical", className: "mx-0.5 h-6" }),
2274
2354
  /* @__PURE__ */ jsx(
2275
2355
  Button,
@@ -2310,33 +2390,10 @@ var RichTextWidget = ({ fieldId }) => {
2310
2390
  const def = fieldDef;
2311
2391
  const placeholder = def?.placeholder ?? "Start typing\u2026";
2312
2392
  const minHeight = def?.minHeight ?? 160;
2393
+ const tablesEnabled = !!def?.tables;
2313
2394
  const extensions = useMemo(
2314
- () => [
2315
- StarterKit.configure({
2316
- // Disable headings entirely so the UI/content can't introduce H2/H3.
2317
- heading: false,
2318
- bulletList: {
2319
- HTMLAttributes: {
2320
- class: "list-disc pl-6 my-2"
2321
- }
2322
- },
2323
- orderedList: {
2324
- HTMLAttributes: {
2325
- class: "list-decimal pl-6 my-2"
2326
- }
2327
- },
2328
- listItem: {
2329
- HTMLAttributes: {
2330
- class: "my-1"
2331
- }
2332
- }
2333
- }),
2334
- Underline,
2335
- Placeholder.configure({
2336
- placeholder
2337
- })
2338
- ],
2339
- [placeholder]
2395
+ () => buildRichTextExtensions(placeholder, tablesEnabled),
2396
+ [placeholder, tablesEnabled]
2340
2397
  );
2341
2398
  const stringValue = typeof value === "string" ? value : "";
2342
2399
  const editor = useEditor(
@@ -2353,7 +2410,7 @@ var RichTextWidget = ({ fieldId }) => {
2353
2410
  editorProps: {
2354
2411
  attributes: {
2355
2412
  id: fieldId,
2356
- class: "focus:outline-none",
2413
+ class: "tiptap focus:outline-none",
2357
2414
  style: `min-height: ${minHeight}px`
2358
2415
  }
2359
2416
  }
@@ -2419,7 +2476,14 @@ var RichTextWidget = ({ fieldId }) => {
2419
2476
  )
2420
2477
  ),
2421
2478
  children: [
2422
- /* @__PURE__ */ jsx(RichTextToolbar, { editor, disabled }),
2479
+ /* @__PURE__ */ jsx(
2480
+ RichTextToolbar,
2481
+ {
2482
+ editor,
2483
+ disabled,
2484
+ tablesEnabled
2485
+ }
2486
+ ),
2423
2487
  /* @__PURE__ */ jsx(
2424
2488
  "div",
2425
2489
  {
@@ -2445,6 +2509,9 @@ var RichTextWidget = ({ fieldId }) => {
2445
2509
  showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
2446
2510
  ] });
2447
2511
  };
2512
+ function richTextHtmlClassName() {
2513
+ return cn("richtext-content prose prose-sm max-w-none");
2514
+ }
2448
2515
  var Select = SelectPrimitive.Root;
2449
2516
  var SelectValue = SelectPrimitive.Value;
2450
2517
  var SelectTrigger = React15.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(
@@ -2728,7 +2795,7 @@ var MultiSelectWidget = ({ fieldId }) => {
2728
2795
  showError && /* @__PURE__ */ jsx("p", { className: fieldErrorClass(fieldDef, "text-xs text-red-500"), children: error })
2729
2796
  ] });
2730
2797
  };
2731
- var Table = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
2798
+ var Table2 = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
2732
2799
  "table",
2733
2800
  {
2734
2801
  ref,
@@ -2736,9 +2803,9 @@ var Table = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */
2736
2803
  ...props
2737
2804
  }
2738
2805
  ) }));
2739
- Table.displayName = "Table";
2740
- var TableHeader = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
2741
- TableHeader.displayName = "TableHeader";
2806
+ Table2.displayName = "Table";
2807
+ var TableHeader2 = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
2808
+ TableHeader2.displayName = "TableHeader";
2742
2809
  var TableBody = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2743
2810
  "tbody",
2744
2811
  {
@@ -2760,7 +2827,7 @@ var TableFooter = React15.forwardRef(({ className, ...props }, ref) => /* @__PUR
2760
2827
  }
2761
2828
  ));
2762
2829
  TableFooter.displayName = "TableFooter";
2763
- var TableRow = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2830
+ var TableRow2 = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2764
2831
  "tr",
2765
2832
  {
2766
2833
  ref,
@@ -2771,7 +2838,7 @@ var TableRow = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__
2771
2838
  ...props
2772
2839
  }
2773
2840
  ));
2774
- TableRow.displayName = "TableRow";
2841
+ TableRow2.displayName = "TableRow";
2775
2842
  var TableHead = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2776
2843
  "th",
2777
2844
  {
@@ -2784,7 +2851,7 @@ var TableHead = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE_
2784
2851
  }
2785
2852
  ));
2786
2853
  TableHead.displayName = "TableHead";
2787
- var TableCell = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2854
+ var TableCell2 = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2788
2855
  "td",
2789
2856
  {
2790
2857
  ref,
@@ -2792,7 +2859,7 @@ var TableCell = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE_
2792
2859
  ...props
2793
2860
  }
2794
2861
  ));
2795
- TableCell.displayName = "TableCell";
2862
+ TableCell2.displayName = "TableCell";
2796
2863
  var TableCaption = React15.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
2797
2864
  "caption",
2798
2865
  {
@@ -2842,15 +2909,15 @@ var RepeatableWidget = ({
2842
2909
  }
2843
2910
  )
2844
2911
  ] }),
2845
- /* @__PURE__ */ jsx("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxs(Table, { children: [
2846
- /* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
2912
+ /* @__PURE__ */ jsx("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxs(Table2, { children: [
2913
+ /* @__PURE__ */ jsx(TableHeader2, { children: /* @__PURE__ */ jsxs(TableRow2, { children: [
2847
2914
  def.row.map((subDef) => /* @__PURE__ */ jsx(TableHead, { children: subDef.label }, subDef.id)),
2848
2915
  /* @__PURE__ */ jsx(TableHead, { className: "w-[50px]" })
2849
2916
  ] }) }),
2850
2917
  /* @__PURE__ */ jsxs(TableBody, { children: [
2851
2918
  rows.map(
2852
- (row, index) => /* @__PURE__ */ jsxs(TableRow, { children: [
2853
- def.row.map((subDef) => /* @__PURE__ */ jsx(TableCell, { children: subDef.type === "number" ? /* @__PURE__ */ jsx(
2919
+ (row, index) => /* @__PURE__ */ jsxs(TableRow2, { children: [
2920
+ def.row.map((subDef) => /* @__PURE__ */ jsx(TableCell2, { children: subDef.type === "number" ? /* @__PURE__ */ jsx(
2854
2921
  "input",
2855
2922
  {
2856
2923
  type: "number",
@@ -2868,7 +2935,7 @@ var RepeatableWidget = ({
2868
2935
  disabled
2869
2936
  }
2870
2937
  ) }, subDef.id)),
2871
- /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(
2938
+ /* @__PURE__ */ jsx(TableCell2, { children: /* @__PURE__ */ jsx(
2872
2939
  Button,
2873
2940
  {
2874
2941
  type: "button",
@@ -2882,8 +2949,8 @@ var RepeatableWidget = ({
2882
2949
  ) })
2883
2950
  ] }, index)
2884
2951
  ),
2885
- rows.length === 0 && /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(
2886
- TableCell,
2952
+ rows.length === 0 && /* @__PURE__ */ jsx(TableRow2, { children: /* @__PURE__ */ jsx(
2953
+ TableCell2,
2887
2954
  {
2888
2955
  colSpan: def.row.length + 1,
2889
2956
  className: "h-24 text-center",
@@ -4359,23 +4426,23 @@ var EditableTableWidget = ({
4359
4426
  /* @__PURE__ */ jsx(Label, { children: fieldDef.label }),
4360
4427
  fieldDef.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: fieldDef.description })
4361
4428
  ] }),
4362
- /* @__PURE__ */ jsx("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxs(Table, { children: [
4363
- /* @__PURE__ */ jsx(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx(TableRow, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx(TableHead, { children: header.isPlaceholder ? null : flexRender(
4429
+ /* @__PURE__ */ jsx("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxs(Table2, { children: [
4430
+ /* @__PURE__ */ jsx(TableHeader2, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx(TableRow2, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx(TableHead, { children: header.isPlaceholder ? null : flexRender(
4364
4431
  header.column.columnDef.header,
4365
4432
  header.getContext()
4366
4433
  ) }, header.id)) }, headerGroup.id)) }),
4367
4434
  /* @__PURE__ */ jsx(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx(
4368
- TableRow,
4435
+ TableRow2,
4369
4436
  {
4370
4437
  "data-state": row.getIsSelected() && "selected",
4371
- children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(TableCell, { className: "p-1", children: flexRender(
4438
+ children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(TableCell2, { className: "p-1", children: flexRender(
4372
4439
  cell.column.columnDef.cell,
4373
4440
  cell.getContext()
4374
4441
  ) }, cell.id))
4375
4442
  },
4376
4443
  row.id
4377
- )) : /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(
4378
- TableCell,
4444
+ )) : /* @__PURE__ */ jsx(TableRow2, { children: /* @__PURE__ */ jsx(
4445
+ TableCell2,
4379
4446
  {
4380
4447
  colSpan: columns.length,
4381
4448
  className: "h-24 text-center",
@@ -15375,7 +15442,10 @@ var ReadOnlyText = ({ fieldDef, value }) => {
15375
15442
  isRichText ? /* @__PURE__ */ jsx(
15376
15443
  "div",
15377
15444
  {
15378
- className: "prose prose-sm max-w-none text-gray-900 border border-gray-200 rounded-md p-3 bg-gray-50",
15445
+ className: cn(
15446
+ richTextHtmlClassName(),
15447
+ "text-gray-900 border border-gray-200 rounded-md p-3 bg-gray-50"
15448
+ ),
15379
15449
  dangerouslySetInnerHTML: { __html: displayValue }
15380
15450
  }
15381
15451
  ) : /* @__PURE__ */ jsx("div", { className: "text-gray-900 border border-gray-200 rounded-md p-3 bg-gray-50 min-h-[2.5rem] whitespace-pre-wrap", children: displayValue || /* @__PURE__ */ jsx("span", { className: "text-gray-400 italic", children: "No value" }) })
@@ -15444,10 +15514,10 @@ var ReadOnlyRepeatable = ({ fieldDef, value }) => {
15444
15514
  const rows = Array.isArray(value) ? value : [];
15445
15515
  return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
15446
15516
  /* @__PURE__ */ jsx(Label, { className: "text-sm font-medium text-gray-700", children: fieldDef.label }),
15447
- rows.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-gray-400 italic border border-gray-200 rounded-md p-4 bg-gray-50 text-center", children: "No items" }) : /* @__PURE__ */ jsx("div", { className: "rounded-md border border-gray-200 overflow-hidden", children: /* @__PURE__ */ jsxs(Table, { children: [
15448
- /* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsx(TableRow, { children: fieldDef.row.map((subDef) => /* @__PURE__ */ jsx(TableHead, { className: "bg-gray-50", children: subDef.label }, subDef.id)) }) }),
15517
+ rows.length === 0 ? /* @__PURE__ */ jsx("div", { className: "text-gray-400 italic border border-gray-200 rounded-md p-4 bg-gray-50 text-center", children: "No items" }) : /* @__PURE__ */ jsx("div", { className: "rounded-md border border-gray-200 overflow-hidden", children: /* @__PURE__ */ jsxs(Table2, { children: [
15518
+ /* @__PURE__ */ jsx(TableHeader2, { children: /* @__PURE__ */ jsx(TableRow2, { children: fieldDef.row.map((subDef) => /* @__PURE__ */ jsx(TableHead, { className: "bg-gray-50", children: subDef.label }, subDef.id)) }) }),
15449
15519
  /* @__PURE__ */ jsx(TableBody, { children: rows.map(
15450
- (row, index) => /* @__PURE__ */ jsx(TableRow, { children: fieldDef.row.map((subDef) => /* @__PURE__ */ jsx(TableCell, { className: "text-gray-900", children: row[subDef.id] ?? /* @__PURE__ */ jsx("span", { className: "text-gray-400 italic", children: "\u2014" }) }, subDef.id)) }, index)
15520
+ (row, index) => /* @__PURE__ */ jsx(TableRow2, { children: fieldDef.row.map((subDef) => /* @__PURE__ */ jsx(TableCell2, { className: "text-gray-900", children: row[subDef.id] ?? /* @__PURE__ */ jsx("span", { className: "text-gray-400 italic", children: "\u2014" }) }, subDef.id)) }, index)
15451
15521
  ) })
15452
15522
  ] }) })
15453
15523
  ] });
@@ -15627,16 +15697,16 @@ var ReadOnlyTable = ({
15627
15697
  return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
15628
15698
  /* @__PURE__ */ jsx(Label, { children: fieldDef.label }),
15629
15699
  fieldDef.description && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: fieldDef.description }),
15630
- /* @__PURE__ */ jsx("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxs(Table, { children: [
15631
- /* @__PURE__ */ jsx(TableHeader, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx(TableRow, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx(TableHead, { children: header.isPlaceholder ? null : flexRender(
15700
+ /* @__PURE__ */ jsx("div", { className: "rounded-md border", children: /* @__PURE__ */ jsxs(Table2, { children: [
15701
+ /* @__PURE__ */ jsx(TableHeader2, { children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx(TableRow2, { children: headerGroup.headers.map((header) => /* @__PURE__ */ jsx(TableHead, { children: header.isPlaceholder ? null : flexRender(
15632
15702
  header.column.columnDef.header,
15633
15703
  header.getContext()
15634
15704
  ) }, header.id)) }, headerGroup.id)) }),
15635
- /* @__PURE__ */ jsx(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx(TableRow, { children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(TableCell, { className: "p-2", children: flexRender(
15705
+ /* @__PURE__ */ jsx(TableBody, { children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row) => /* @__PURE__ */ jsx(TableRow2, { children: row.getVisibleCells().map((cell) => /* @__PURE__ */ jsx(TableCell2, { className: "p-2", children: flexRender(
15636
15706
  cell.column.columnDef.cell,
15637
15707
  cell.getContext()
15638
- ) }, cell.id)) }, row.id)) : /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(
15639
- TableCell,
15708
+ ) }, cell.id)) }, row.id)) : /* @__PURE__ */ jsx(TableRow2, { children: /* @__PURE__ */ jsx(
15709
+ TableCell2,
15640
15710
  {
15641
15711
  colSpan: columns.length,
15642
15712
  className: "h-16 text-center text-muted-foreground",
@@ -16342,6 +16412,6 @@ function createUploadHandler(options) {
16342
16412
  );
16343
16413
  }
16344
16414
 
16345
- export { AddInvestigationField, AddMedicationField, DifferentialDiagnosis, DynamicForm, DynamicFormV2, EMAIL_REGEX, FieldRenderer, FieldRequiredIndicator, FormControls, FormFileUploadWidget, FormProvider, FormStore, ImageUploadWidget, MAR_MEDICATION_ORDERS_META_KEY, MediaUploadWidget, MultiStepForm, ReadOnlyForm, ReadOnlyImageUpload, ReadOnlyMediaUpload, ReadOnlySignature, ReadOnlyTable, RichTextWidget, SignatureUploadWidget, SmartForm, SmartTextareaWidget, Upload3 as Upload, createUploadHandler, evaluateRules, fieldControlClass, fieldDescriptionClass, fieldErrorClass, fieldLabelClass, fieldMetaRequestsMarMedicationOrdersButton, fieldWrapperClass, isLabelVisible, useField, useFieldHandlers, useForm, useFormStore, useFrequentItems, usePackages, useSmartKeywords, validateField, validateForm };
16415
+ export { AddInvestigationField, AddMedicationField, DifferentialDiagnosis, DynamicForm, DynamicFormV2, EMAIL_REGEX, FieldRenderer, FieldRequiredIndicator, FormControls, FormFileUploadWidget, FormProvider, FormStore, ImageUploadWidget, MAR_MEDICATION_ORDERS_META_KEY, MediaUploadWidget, MultiStepForm, ReadOnlyForm, ReadOnlyImageUpload, ReadOnlyMediaUpload, ReadOnlySignature, ReadOnlyTable, RichTextWidget, SignatureUploadWidget, SmartForm, SmartTextareaWidget, Upload3 as Upload, createUploadHandler, evaluateRules, fieldControlClass, fieldDescriptionClass, fieldErrorClass, fieldLabelClass, fieldMetaRequestsMarMedicationOrdersButton, fieldWrapperClass, isLabelVisible, richTextHtmlClassName, useField, useFieldHandlers, useForm, useFormStore, useFrequentItems, usePackages, useSmartKeywords, validateField, validateForm };
16346
16416
  //# sourceMappingURL=index.mjs.map
16347
16417
  //# sourceMappingURL=index.mjs.map