@braedonsaunders/appkit-forms 0.2.2

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.
Files changed (120) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +74 -0
  3. package/canvas-editor.d.ts +24 -0
  4. package/canvas-editor.d.ts.map +1 -0
  5. package/canvas-editor.js +115 -0
  6. package/canvas-editor.js.map +1 -0
  7. package/canvas-runtime.d.ts +12 -0
  8. package/canvas-runtime.d.ts.map +1 -0
  9. package/canvas-runtime.js +54 -0
  10. package/canvas-runtime.js.map +1 -0
  11. package/element-preview.d.ts +9 -0
  12. package/element-preview.d.ts.map +1 -0
  13. package/element-preview.js +167 -0
  14. package/element-preview.js.map +1 -0
  15. package/form-designer.d.ts +29 -0
  16. package/form-designer.d.ts.map +1 -0
  17. package/form-designer.js +214 -0
  18. package/form-designer.js.map +1 -0
  19. package/form-flow-validation.d.ts +5 -0
  20. package/form-flow-validation.d.ts.map +1 -0
  21. package/form-flow-validation.js +154 -0
  22. package/form-flow-validation.js.map +1 -0
  23. package/form-renderer.d.ts +37 -0
  24. package/form-renderer.d.ts.map +1 -0
  25. package/form-renderer.js +282 -0
  26. package/form-renderer.js.map +1 -0
  27. package/formula-builder.d.ts +25 -0
  28. package/formula-builder.d.ts.map +1 -0
  29. package/formula-builder.js +310 -0
  30. package/formula-builder.js.map +1 -0
  31. package/generated-copy.d.ts +17 -0
  32. package/generated-copy.d.ts.map +1 -0
  33. package/generated-copy.js +396 -0
  34. package/generated-copy.js.map +1 -0
  35. package/index.d.ts +27 -0
  36. package/index.d.ts.map +1 -0
  37. package/index.js +25 -0
  38. package/index.js.map +1 -0
  39. package/logic-builder.d.ts +27 -0
  40. package/logic-builder.d.ts.map +1 -0
  41. package/logic-builder.js +106 -0
  42. package/logic-builder.js.map +1 -0
  43. package/package.json +54 -0
  44. package/photo-field-state.d.ts +9 -0
  45. package/photo-field-state.d.ts.map +1 -0
  46. package/photo-field-state.js +11 -0
  47. package/photo-field-state.js.map +1 -0
  48. package/production-designer-adapter.d.ts +100 -0
  49. package/production-designer-adapter.d.ts.map +1 -0
  50. package/production-designer-adapter.js +2 -0
  51. package/production-designer-adapter.js.map +1 -0
  52. package/production-file-upload.d.ts +27 -0
  53. package/production-file-upload.d.ts.map +1 -0
  54. package/production-file-upload.js +105 -0
  55. package/production-file-upload.js.map +1 -0
  56. package/production-form-designer.d.ts +3 -0
  57. package/production-form-designer.d.ts.map +1 -0
  58. package/production-form-designer.js +1124 -0
  59. package/production-form-designer.js.map +1 -0
  60. package/production-form-renderer.d.ts +16 -0
  61. package/production-form-renderer.d.ts.map +1 -0
  62. package/production-form-renderer.js +2134 -0
  63. package/production-form-renderer.js.map +1 -0
  64. package/production-runtime-adapter.d.ts +187 -0
  65. package/production-runtime-adapter.d.ts.map +1 -0
  66. package/production-runtime-adapter.js +2 -0
  67. package/production-runtime-adapter.js.map +1 -0
  68. package/production-runtime-context.d.ts +29 -0
  69. package/production-runtime-context.d.ts.map +1 -0
  70. package/production-runtime-context.js +35 -0
  71. package/production-runtime-context.js.map +1 -0
  72. package/production-runtime-layout.d.ts +21 -0
  73. package/production-runtime-layout.d.ts.map +1 -0
  74. package/production-runtime-layout.js +33 -0
  75. package/production-runtime-layout.js.map +1 -0
  76. package/properties.d.ts +36 -0
  77. package/properties.d.ts.map +1 -0
  78. package/properties.js +133 -0
  79. package/properties.js.map +1 -0
  80. package/record-actions-panel.d.ts +28 -0
  81. package/record-actions-panel.d.ts.map +1 -0
  82. package/record-actions-panel.js +136 -0
  83. package/record-actions-panel.js.map +1 -0
  84. package/record-behavior-panel.d.ts +15 -0
  85. package/record-behavior-panel.d.ts.map +1 -0
  86. package/record-behavior-panel.js +59 -0
  87. package/record-behavior-panel.js.map +1 -0
  88. package/record-config.d.ts +44 -0
  89. package/record-config.d.ts.map +1 -0
  90. package/record-config.js +2 -0
  91. package/record-config.js.map +1 -0
  92. package/record-list-panel.d.ts +16 -0
  93. package/record-list-panel.d.ts.map +1 -0
  94. package/record-list-panel.js +86 -0
  95. package/record-list-panel.js.map +1 -0
  96. package/risk-matrix.d.ts +93 -0
  97. package/risk-matrix.d.ts.map +1 -0
  98. package/risk-matrix.js +239 -0
  99. package/risk-matrix.js.map +1 -0
  100. package/runtime-controls.d.ts +19 -0
  101. package/runtime-controls.d.ts.map +1 -0
  102. package/runtime-controls.js +61 -0
  103. package/runtime-controls.js.map +1 -0
  104. package/sketch-pad-client.d.ts +4 -0
  105. package/sketch-pad-client.d.ts.map +1 -0
  106. package/sketch-pad-client.js +54 -0
  107. package/sketch-pad-client.js.map +1 -0
  108. package/sketch-pad.d.ts +13 -0
  109. package/sketch-pad.d.ts.map +1 -0
  110. package/sketch-pad.js +17 -0
  111. package/sketch-pad.js.map +1 -0
  112. package/styles.css +7 -0
  113. package/text.d.ts +5 -0
  114. package/text.d.ts.map +1 -0
  115. package/text.js +10 -0
  116. package/text.js.map +1 -0
  117. package/workflow-properties.d.ts +16 -0
  118. package/workflow-properties.d.ts.map +1 -0
  119. package/workflow-properties.js +31 -0
  120. package/workflow-properties.js.map +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element-preview.js","sourceRoot":"","sources":["../src/element-preview.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAE1F,2EAA2E;AAC3E,gFAAgF;AAChF,8EAA8E;AAE9E,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACzF,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAEpE,OAAO,EAAE,YAAY,EAAkB,MAAM,8BAA8B,CAAA;AAE3E,SAAS,GAAG,CAAC,KAAgB;IAC3B,OAAQ,KAAK,CAAC,MAA8C,IAAI,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cAAc,IACb,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACvB,cAAa,SAAS,EAAC,oCAAoC,YACzD,KAAC,cAAc,IACb,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACtB,cAEE,SAAS,EAAC,+EAA+E,wBADpF,CAAC,CAAC,GAAG,CAIN,CACP,CAAC,GACF,IAVM,CAAC,CAWL,CACP,CAAC,GACF,IACE,CACP,CAAA;AACH,CAAC","sourcesContent":["'use client'\n\nimport { GeneratedText, useGeneratedTranslations, GeneratedValue } from './generated-copy'\n\n// A representative, read-only preview of ONE element — how it looks in the\n// shipped product. Used by the canvas blocks (WYSIWYG building) and the Preview\n// drawer. Uses the element's real label / options / config, not placeholders.\n\nimport { AlertTriangle, BarChart3, MapPin, ScanLine, Sparkles, Star } from 'lucide-react'\nimport { Input, Select, Textarea } from '@braedonsaunders/appkit-ui'\nimport type { FormField } from '@braedonsaunders/appkit-forms-core'\nimport { localizeText, type AppLocale } from '@braedonsaunders/appkit-i18n'\n\nfunction cfg(field: FormField): Record<string, unknown> {\n return (field.config as Record<string, unknown> | undefined) ?? {}\n}\n\nfunction optionLabels(field: FormField, locale: AppLocale, defaultLocale: AppLocale): string[] {\n const opts =\n (field.validation?.options as { value: string; label: unknown }[] | undefined) ??\n (cfg(field).options as { value: string; label: unknown }[] | undefined) ??\n []\n return opts.map((o) =>\n localizeText(o.label as Record<string, string>, locale, o.value, defaultLocale),\n )\n}\n\nexport function ElementPreview({\n field,\n locale,\n defaultLocale,\n compact = false,\n}: {\n field: FormField\n locale: AppLocale\n defaultLocale: AppLocale\n compact?: boolean\n}) {\n const label = localizeText(field.label, locale, field.id, defaultLocale)\n const helpText = localizeText(field.helpText, locale, '', defaultLocale)\n const t = field.type\n\n // Content elements ARE their content — no separate field label.\n if (t === 'heading')\n return (\n <h3 className=\"text-base font-semibold text-fg\">\n <GeneratedValue value={label} />\n </h3>\n )\n if (t === 'paragraph')\n return (\n <p className=\"text-sm leading-snug text-fg-muted\">\n <GeneratedValue value={label} />\n </p>\n )\n if (t === 'divider') return <hr className=\"my-1 border-border\" />\n return (\n <div className=\"space-y-1\">\n <div className=\"text-xs font-medium text-fg-muted\">\n <GeneratedValue value={label} />\n <GeneratedValue value={field.required ? <span className=\"text-danger\"> *</span> : null} />\n </div>\n <ElementInput field={field} locale={locale} defaultLocale={defaultLocale} compact={compact} />\n <GeneratedValue\n value={\n helpText ? (\n <p className=\"text-[10px] text-fg-subtle\">\n <GeneratedValue value={helpText} />\n </p>\n ) : null\n }\n />\n </div>\n )\n}\n\nfunction ElementInput({\n field,\n locale,\n defaultLocale,\n compact,\n}: {\n field: FormField\n locale: AppLocale\n defaultLocale: AppLocale\n compact?: boolean\n}) {\n const tGenerated = useGeneratedTranslations()\n const t = field.type\n const labels = optionLabels(field, locale, defaultLocale)\n const choices = labels.length ? labels : ['Option A', 'Option B']\n\n switch (t) {\n case 'long_text':\n return <Textarea rows={compact ? 2 : 3} disabled placeholder=\"\" className=\"bg-white\" />\n case 'number':\n return <Input type=\"number\" disabled placeholder=\"0\" className=\"bg-white\" />\n case 'date':\n return <Input type=\"date\" disabled className=\"bg-white\" />\n case 'datetime':\n return <Input type=\"datetime-local\" disabled className=\"bg-white\" />\n case 'time':\n return <Input type=\"time\" disabled className=\"bg-white\" />\n case 'email':\n return (\n <Input\n type=\"email\"\n disabled\n placeholder={tGenerated('m_1b781270c0d2f5')}\n className=\"bg-white\"\n />\n )\n case 'phone':\n return <Input disabled placeholder=\"(555) 555-5555\" className=\"bg-white\" />\n case 'url':\n return <Input disabled placeholder=\"https://\" className=\"bg-white\" />\n case 'select':\n case 'customer_picker':\n case 'site_picker':\n case 'project_picker':\n case 'area_picker':\n case 'person_picker':\n case 'multi_person_picker':\n return (\n <Select disabled className=\"bg-white\">\n <option>{labels[0] ?? 'Select…'}</option>\n </Select>\n )\n case 'radio':\n return (\n <div className=\"space-y-1\">\n <GeneratedValue\n value={choices.slice(0, 4).map((l, i) => (\n <label key={i} className=\"flex items-center gap-2 text-xs text-fg-muted\">\n <input type=\"radio\" disabled /> <GeneratedValue value={l} />\n </label>\n ))}\n />\n </div>\n )\n case 'checkbox_group':\n case 'multi_select':\n return (\n <div className=\"space-y-1\">\n <GeneratedValue\n value={choices.slice(0, 4).map((l, i) => (\n <label key={i} className=\"flex items-center gap-2 text-xs text-fg-muted\">\n <input type=\"checkbox\" disabled /> <GeneratedValue value={l} />\n </label>\n ))}\n />\n </div>\n )\n case 'yes_no_comment':\n return (\n <div className=\"flex gap-2\">\n <GeneratedValue\n value={['Yes', 'No'].map((v) => (\n <span\n key={v}\n className=\"rounded-md border border-border px-3 py-1 text-xs text-fg-muted\"\n >\n <GeneratedValue value={v} />\n </span>\n ))}\n />\n </div>\n )\n case 'pass_fail_na':\n return (\n <div className=\"flex gap-1\">\n <GeneratedValue\n value={['PASS', 'FAIL', 'N/A'].map((v) => (\n <span\n key={v}\n className=\"rounded border border-border px-2 py-1 text-[10px] text-fg-muted\"\n >\n <GeneratedValue value={v} />\n </span>\n ))}\n />\n </div>\n )\n case 'traffic_light':\n return (\n <div className=\"flex gap-1.5\">\n <GeneratedValue\n value={['bg-success', 'bg-warning', 'bg-danger'].map((tone) => (\n <span key={tone} className={`h-5 w-5 rounded-full ${tone}`} />\n ))}\n />\n </div>\n )\n case 'rating':\n return (\n <div className=\"flex gap-0.5 text-warning\">\n <GeneratedValue\n value={[1, 2, 3, 4, 5].map((i) => (\n <Star key={i} size={16} fill=\"currentColor\" strokeWidth={0} />\n ))}\n />\n </div>\n )\n case 'signature':\n return (\n <div className=\"flex h-16 items-center justify-center rounded border border-dashed border-border-strong bg-bg-subtle text-xs text-fg-subtle italic\">\n <GeneratedText id=\"m_05a0e2d38bded7\" />\n </div>\n )\n case 'photo':\n case 'photo_upload':\n case 'file':\n case 'video':\n case 'audio':\n return (\n <div className=\"flex h-16 items-center justify-center rounded border border-dashed border-border-strong bg-bg-subtle text-xs text-fg-subtle\">\n <GeneratedText id=\"m_10e50435ff2693\" />\n </div>\n )\n case 'sketch':\n return (\n <div className=\"flex h-20 items-center justify-center rounded border border-dashed border-border-strong bg-[repeating-linear-gradient(45deg,transparent,transparent_9px,rgba(148,163,184,0.12)_9px,rgba(148,163,184,0.12)_10px)] text-xs text-fg-subtle italic\">\n <GeneratedText id=\"m_1abf555859c0a8\" />\n </div>\n )\n case 'photo_ai':\n return (\n <div className=\"space-y-1.5\">\n <div className=\"flex h-14 items-center justify-center rounded border border-dashed border-border-strong bg-bg-subtle text-xs text-fg-subtle\">\n <GeneratedText id=\"m_18010438ac7907\" />\n </div>\n <span className=\"inline-flex items-center gap-1 rounded-md border border-info bg-info-subtle px-2 py-1 text-[11px] text-info\">\n <Sparkles size={12} /> <GeneratedText id=\"m_0fec93e95858fc\" />\n </span>\n <div className=\"flex items-center gap-1 text-[10px] text-fg-subtle\">\n <AlertTriangle size={11} className=\"text-warning\" />{' '}\n <GeneratedText id=\"m_0289ca8aa7b891\" />\n </div>\n </div>\n )\n case 'typed_attestation':\n return <Input disabled placeholder={tGenerated('m_0d0facbd71aa6a')} className=\"bg-white\" />\n case 'formula':\n return <Input disabled value=\"= computed\" className=\"bg-bg-subtle italic\" />\n case 'slider': {\n const c = cfg(field) as { min?: number; max?: number }\n const min = c.min ?? 0\n const max = c.max ?? 10\n return (\n <div className=\"flex items-center gap-2\">\n <input\n type=\"range\"\n min={min}\n max={max}\n defaultValue={(min + max) / 2}\n disabled\n className=\"h-2 flex-1 rounded-full bg-border accent-primary\"\n />\n <span className=\"text-xs text-fg-subtle\">\n <GeneratedValue value={Math.round((min + max) / 2)} />\n </span>\n </div>\n )\n }\n case 'gps':\n return (\n <div className=\"flex items-center gap-1.5 rounded border border-border bg-white px-2 py-1.5 text-xs text-fg-muted\">\n <MapPin size={13} /> <GeneratedText id=\"m_07cd022cc38d60\" />\n </div>\n )\n case 'matrix': {\n const c = cfg(field) as {\n rows?: { key: string; label: string }[]\n scale?: { value: string; label: string }[]\n }\n const rows = c.rows ?? [\n { key: 'r1', label: 'Item 1' },\n { key: 'r2', label: 'Item 2' },\n ]\n const scale = c.scale ?? [\n { value: '1', label: '1' },\n { value: '2', label: '2' },\n { value: '3', label: '3' },\n ]\n return (\n <table className=\"w-full text-[10px]\">\n <thead>\n <tr>\n <th />\n <GeneratedValue\n value={scale.map((s) => (\n <th key={s.value} className=\"px-1 text-center font-normal text-fg-subtle\">\n <GeneratedValue value={s.label} />\n </th>\n ))}\n />\n </tr>\n </thead>\n <tbody>\n <GeneratedValue\n value={rows.slice(0, 3).map((r) => (\n <tr key={r.key}>\n <td className=\"pr-1 text-fg-muted\">\n <GeneratedValue value={r.label} />\n </td>\n <GeneratedValue\n value={scale.map((s) => (\n <td key={s.value} className=\"text-center\">\n <input type=\"radio\" disabled />\n </td>\n ))}\n />\n </tr>\n ))}\n />\n </tbody>\n </table>\n )\n }\n case 'risk_matrix':\n return (\n <div className=\"grid w-fit grid-cols-5 gap-0.5\">\n <GeneratedValue\n value={Array.from({ length: 25 }).map((_, i) => {\n const sev = (i % 5) + Math.floor(i / 5)\n const tone =\n sev >= 6\n ? 'bg-danger'\n : sev >= 4\n ? 'bg-warning'\n : sev >= 2\n ? 'bg-warning-subtle'\n : 'bg-success-subtle'\n return <span key={i} className={`h-3.5 w-3.5 rounded-sm ${tone}`} />\n })}\n />\n </div>\n )\n case 'photo_annotated':\n return (\n <div className=\"space-y-1\">\n <div className=\"relative flex h-24 items-center justify-center rounded border border-dashed border-border-strong bg-bg-subtle text-xs text-fg-subtle\">\n <GeneratedText id=\"m_18010438ac7907\" />\n <span className=\"absolute top-1/3 left-1/3 flex h-5 w-5 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full bg-danger text-[10px] font-bold text-danger-fg ring-2 ring-surface\">\n 1\n </span>\n <span className=\"absolute top-1/2 left-2/3 flex h-5 w-5 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full bg-danger text-[10px] font-bold text-white ring-2 ring-white\">\n 2\n </span>\n </div>\n <div className=\"text-[10px] text-fg-subtle\">\n <GeneratedText id=\"m_18c006b02858b9\" />\n </div>\n </div>\n )\n case 'qr_scanner':\n return (\n <div className=\"flex items-center gap-2\">\n <Input\n disabled\n placeholder={tGenerated('m_0a43fb83c91fdf')}\n className=\"flex-1 bg-white\"\n />\n <span className=\"inline-flex items-center gap-1 rounded border border-border px-1.5 py-1 text-[11px] text-fg-muted\">\n <ScanLine size={12} /> <GeneratedText id=\"m_198b8dba5a829c\" />\n </span>\n </div>\n )\n case 'ranking': {\n const ls = optionLabels(field, locale, defaultLocale)\n const itemsR = ls.length ? ls : ['Option A', 'Option B', 'Option C']\n return (\n <ol className=\"space-y-1\">\n <GeneratedValue\n value={itemsR.slice(0, 4).map((l, i) => (\n <li\n key={i}\n className=\"flex items-center gap-2 rounded border border-border bg-white px-2 py-1 text-xs\"\n >\n <span className=\"w-4 text-center font-semibold text-fg-subtle\">\n <GeneratedValue value={i + 1} />\n </span>\n <span className=\"flex-1 truncate text-fg-muted\">\n <GeneratedValue value={l} />\n </span>\n <span className=\"text-fg-subtle\">⇅</span>\n </li>\n ))}\n />\n </ol>\n )\n }\n case 'rich_text':\n return (\n <div className=\"rounded border border-border\">\n <div className=\"flex gap-2 border-b border-border bg-bg-subtle px-1.5 py-1 text-[11px] text-fg-subtle\">\n <span className=\"font-bold\">\n <GeneratedText id=\"m_03d716fddcdd92\" />\n </span>\n <span className=\"italic\">\n <GeneratedText id=\"m_01f47383f19f8c\" />\n </span>\n <span>\n <GeneratedText id=\"m_1287c1049195af\" />\n </span>\n </div>\n <div className=\"space-y-1 p-2\">\n <div className=\"h-1.5 w-3/4 rounded bg-surface-hover\" />\n <div className=\"h-1.5 w-1/2 rounded bg-surface-hover\" />\n </div>\n </div>\n )\n case 'address':\n return (\n <div className=\"space-y-1.5\">\n <div className=\"flex items-center gap-1 rounded border border-border bg-white px-2 py-1.5 text-xs text-fg-subtle\">\n <MapPin size={12} /> <GeneratedText id=\"m_178de0c94da150\" />\n </div>\n <div className=\"grid grid-cols-2 gap-1.5\">\n <div className=\"col-span-2 h-7 rounded border border-border bg-white\" />\n <div className=\"h-7 rounded border border-border bg-white\" />\n <div className=\"h-7 rounded border border-border bg-white\" />\n </div>\n </div>\n )\n case 'table':\n return <MiniTable field={field} />\n case 'lookup':\n return (\n <div className=\"space-y-1\">\n <Select disabled className=\"bg-white\">\n <option>{'Select…'}</option>\n </Select>\n <GeneratedValue\n value={\n field.binding?.autofill?.length ? (\n <p className=\"text-[10px] text-info\">\n <GeneratedText id=\"m_011434db59926f\" />{' '}\n <GeneratedValue value={field.binding.autofill.length} />{' '}\n <GeneratedText id=\"m_1d6aa8702d3fac\" />\n <GeneratedValue\n value={\n field.binding.autofill.length === 1 ? (\n ''\n ) : (\n <GeneratedText id=\"m_00ded356f0f424\" />\n )\n }\n />\n </p>\n ) : null\n }\n />\n </div>\n )\n case 'data_table': {\n const keys = field.binding?.columns ?? []\n const headers = keys.length ? keys : ['Column A', 'Column B', 'Column C']\n const sel = field.binding?.selectable\n return (\n <div className=\"overflow-hidden rounded border border-border text-[10px]\">\n <div className=\"flex bg-bg-subtle\">\n <GeneratedValue\n value={headers.slice(0, 5).map((h, i) => (\n <div\n key={i}\n className=\"flex-1 truncate border-r border-border px-1.5 py-1 font-medium text-fg-muted last:border-0\"\n >\n <GeneratedValue value={h} />\n </div>\n ))}\n />\n </div>\n <GeneratedValue\n value={[0, 1, 2].map((r) => (\n <div key={r} className=\"flex border-t border-border-subtle\">\n <GeneratedValue\n value={headers.slice(0, 5).map((_, i) => (\n <div\n key={i}\n className=\"flex-1 border-r border-border-subtle px-1.5 py-1 text-fg-subtle last:border-0\"\n >\n —\n </div>\n ))}\n />\n </div>\n ))}\n />\n <GeneratedValue\n value={\n sel && sel !== 'none' ? (\n <div className=\"bg-bg-subtle px-1.5 py-0.5 text-[9px] text-fg-subtle\">\n <GeneratedValue\n value={\n sel === 'single' ? (\n <GeneratedText id=\"m_1d33f094c621dc\" />\n ) : (\n <GeneratedText id=\"m_1a1dcc7d0b9e8a\" />\n )\n }\n />\n </div>\n ) : null\n }\n />\n </div>\n )\n }\n case 'metric': {\n const agg = field.binding?.aggregate\n const grouped =\n !!agg?.groupBy || (!!field.binding?.display && field.binding.display !== 'number')\n if (grouped) {\n return (\n <div className=\"flex h-14 items-end gap-1\">\n <GeneratedValue\n value={[8, 14, 10, 16, 6].map((h, i) => (\n <span key={i} className=\"w-3 rounded-t bg-primary\" style={{ height: h * 3 }} />\n ))}\n />\n </div>\n )\n }\n return (\n <div className=\"inline-flex items-center gap-2 rounded-lg border border-border bg-white px-3 py-2\">\n <BarChart3 size={18} className=\"text-primary\" />\n <div>\n <div className=\"text-2xl leading-none font-semibold text-fg\">—</div>\n <div className=\"mt-0.5 text-[10px] tracking-wide text-fg-subtle uppercase\">\n <GeneratedValue value={agg?.fn ?? <GeneratedText id=\"m_15f748343d3956\" />} />\n <GeneratedValue value={agg?.column ? ` · ${agg.column}` : ''} />\n </div>\n </div>\n </div>\n )\n }\n default:\n return <Input disabled placeholder=\"\" className=\"bg-white\" />\n }\n}\n\nfunction MiniTable({ field }: { field: FormField }) {\n const cols = (cfg(field).columns as { key: string; label: string }[] | undefined) ?? []\n if (cols.length === 0) {\n return (\n <div className=\"rounded border border-dashed border-border-strong p-2 text-center text-[11px] text-fg-subtle\">\n <GeneratedText id=\"m_0d90d1eceb566b\" />\n </div>\n )\n }\n const shown = cols.slice(0, 5)\n return (\n <div className=\"overflow-hidden rounded border border-border text-[10px]\">\n <div className=\"flex bg-bg-subtle\">\n <GeneratedValue\n value={shown.map((c) => (\n <div\n key={c.key}\n className=\"flex-1 truncate border-r border-border px-1.5 py-1 font-medium text-fg-muted last:border-0\"\n >\n <GeneratedValue value={c.label || c.key} />\n </div>\n ))}\n />\n </div>\n <GeneratedValue\n value={[0, 1].map((r) => (\n <div key={r} className=\"flex border-t border-border-subtle\">\n <GeneratedValue\n value={shown.map((c) => (\n <div\n key={c.key}\n className=\"flex-1 border-r border-border-subtle px-1.5 py-1 text-fg-subtle last:border-0\"\n >\n —\n </div>\n ))}\n />\n </div>\n ))}\n />\n </div>\n )\n}\n"]}
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+ import { type FieldType, type FormField, type FormSchemaV1 } from '@braedonsaunders/appkit-forms-core';
3
+ import { type AppLocale } from '@braedonsaunders/appkit-i18n';
4
+ import type { RecordActionFlow, RecordActionFlowAdapter, RecordConfig } from './record-config.js';
5
+ import { type FormDataSource } from './properties.js';
6
+ export type FormDesignerProps = {
7
+ value: FormSchemaV1;
8
+ onChange: (schema: FormSchemaV1) => void;
9
+ locale?: AppLocale;
10
+ availableFieldTypes?: readonly FieldType[];
11
+ className?: string;
12
+ readOnly?: boolean;
13
+ recordConfig?: RecordConfig;
14
+ onRecordConfigChange?: (config: RecordConfig) => void;
15
+ onRecordConfigSave?: (config: RecordConfig) => void | Promise<void>;
16
+ roles?: {
17
+ key: string;
18
+ name: string;
19
+ }[];
20
+ recordActionFlows?: RecordActionFlow[];
21
+ recordActionAdapter?: RecordActionFlowAdapter;
22
+ onRecordActionsChanged?: () => void | Promise<void>;
23
+ dataSources?: readonly FormDataSource[];
24
+ dataSourcesLoading?: boolean;
25
+ onRefreshDataSources?: () => void | Promise<void>;
26
+ };
27
+ export declare function createFormField(type: FieldType, existing?: ReadonlySet<string>): FormField;
28
+ export declare function FormDesigner({ value, onChange, locale, availableFieldTypes, className, readOnly, recordConfig, onRecordConfigChange, onRecordConfigSave, roles, recordActionFlows, recordActionAdapter, onRecordActionsChanged, dataSources, dataSourcesLoading, onRefreshDataSources, }: FormDesignerProps): React.JSX.Element;
29
+ //# sourceMappingURL=form-designer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-designer.d.ts","sourceRoot":"","sources":["../src/form-designer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,C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AAWD,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,GAAE,WAAW,CAAC,MAAM,CAAa,GAAG,SAAS,CAuCrG;AAED,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,MAAuB,EACvB,mBAAmB,EACnB,SAAS,EACT,QAAgB,EAChB,YAAY,EACZ,oBAAoB,EACpB,kBAAkB,EAClB,KAAK,EACL,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,WAAW,EACX,kBAAkB,EAClB,oBAAoB,GACrB,EAAE,iBAAiB,qBAoUnB"}
@@ -0,0 +1,214 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import * as React from 'react';
4
+ import { ArrowDown, ArrowUp, GitBranch, GripVertical, List, MousePointerClick, Plus, Search, Settings2, Trash2, Wrench } from 'lucide-react';
5
+ import { CHOICE_FIELD_TYPES, FIELD_TYPES, } from '@braedonsaunders/appkit-forms-core';
6
+ import { DEFAULT_LOCALE } from '@braedonsaunders/appkit-i18n';
7
+ import { Badge, Button, Card, CardContent, CardHeader, CardTitle, Drawer, Input, cn, } from '@braedonsaunders/appkit-ui';
8
+ import { readText, writeText } from './text.js';
9
+ import { CanvasEditor, defaultBox } from './canvas-editor.js';
10
+ import { RecordBehaviorPanel } from './record-behavior-panel.js';
11
+ import { RecordListPanel } from './record-list-panel.js';
12
+ import { RecordActionsPanel } from './record-actions-panel.js';
13
+ import { FieldProperties, SectionProperties } from './properties.js';
14
+ import { FormTabsEditor, FormWorkflowEditor } from './workflow-properties.js';
15
+ const CATEGORY_ORDER = ['standard', 'choice', 'scoring', 'picker', 'media', 'identity', 'computed', 'data', 'display'];
16
+ function newId(prefix, existing) {
17
+ let index = 1;
18
+ let candidate = prefix;
19
+ while (existing.has(candidate))
20
+ candidate = `${prefix}_${++index}`;
21
+ return candidate;
22
+ }
23
+ export function createFormField(type, existing = new Set()) {
24
+ const meta = FIELD_TYPES[type];
25
+ const field = {
26
+ id: newId(type, existing),
27
+ type,
28
+ label: meta.label,
29
+ };
30
+ if (CHOICE_FIELD_TYPES.has(type)) {
31
+ field.validation = {
32
+ options: [
33
+ { value: 'option_1', label: 'Option 1' },
34
+ { value: 'option_2', label: 'Option 2' },
35
+ ],
36
+ };
37
+ }
38
+ if (type === 'rating')
39
+ field.config = { max: 5 };
40
+ if (type === 'slider')
41
+ field.config = { min: 0, max: 10, step: 1 };
42
+ if (type === 'table') {
43
+ field.config = {
44
+ columns: [{ key: 'column_1', label: 'Column 1', type: 'text' }],
45
+ rowMode: 'addable',
46
+ };
47
+ }
48
+ if (type === 'matrix') {
49
+ field.config = {
50
+ rows: [{ key: 'row_1', label: 'Row 1' }],
51
+ scale: [
52
+ { value: '1', label: 'Low' },
53
+ { value: '2', label: 'High' },
54
+ ],
55
+ };
56
+ }
57
+ if (type === 'formula')
58
+ field.formula = { kind: 'literal', value: 0 };
59
+ if (type === 'lookup')
60
+ field.binding = { sourceKey: 'source' };
61
+ if (type === 'data_table')
62
+ field.binding = { sourceKey: 'source', selectable: 'multi' };
63
+ if (type === 'metric') {
64
+ field.binding = { sourceKey: 'source', aggregate: { fn: 'count' }, display: 'number' };
65
+ }
66
+ return field;
67
+ }
68
+ export function FormDesigner({ value, onChange, locale = DEFAULT_LOCALE, availableFieldTypes, className, readOnly = false, recordConfig, onRecordConfigChange, onRecordConfigSave, roles, recordActionFlows, recordActionAdapter, onRecordActionsChanged, dataSources, dataSourcesLoading, onRefreshDataSources, }) {
69
+ const [query, setQuery] = React.useState('');
70
+ const [rail, setRail] = React.useState('fields');
71
+ const [selected, setSelected] = React.useState(() => ({
72
+ sectionId: value.sections[0]?.id ?? '',
73
+ }));
74
+ const [propertiesOpen, setPropertiesOpen] = React.useState(false);
75
+ const dragTypeRef = React.useRef(null);
76
+ const types = availableFieldTypes ?? Object.keys(FIELD_TYPES);
77
+ const normalizedQuery = query.trim().toLowerCase();
78
+ const palette = types.filter((type) => {
79
+ const meta = FIELD_TYPES[type];
80
+ return !normalizedQuery || `${meta.label} ${meta.description} ${meta.category}`.toLowerCase().includes(normalizedQuery);
81
+ });
82
+ const sectionIndex = value.sections.findIndex((section) => section.id === selected.sectionId);
83
+ const section = value.sections[sectionIndex];
84
+ const fieldIndex = section?.fields.findIndex((field) => field.id === selected.fieldId) ?? -1;
85
+ const field = section?.fields[fieldIndex];
86
+ const recordFields = React.useMemo(() => value.sections.flatMap((itemSection) => itemSection.fields.map((itemField) => ({ id: itemField.id, label: readText(itemField.label, locale, itemField.id) }))), [locale, value.sections]);
87
+ const railItems = React.useMemo(() => [
88
+ { id: 'fields', label: 'Fields', icon: Wrench, available: true },
89
+ { id: 'workflow', label: 'Pages', icon: GitBranch, available: true },
90
+ { id: 'record', label: 'Record', icon: Settings2, available: Boolean(onRecordConfigChange) },
91
+ { id: 'list', label: 'List', icon: List, available: Boolean(onRecordConfigChange) },
92
+ { id: 'actions', label: 'Actions', icon: MousePointerClick, available: Boolean(recordActionAdapter) },
93
+ ].filter((item) => item.available), [onRecordConfigChange, recordActionAdapter]);
94
+ const commit = React.useCallback((mutate) => {
95
+ const draft = structuredClone(value);
96
+ mutate(draft);
97
+ onChange(draft);
98
+ }, [onChange, value]);
99
+ function addField(type) {
100
+ const targetIndex = sectionIndex >= 0 ? sectionIndex : 0;
101
+ const existing = new Set(value.sections.flatMap((item) => item.fields.map((itemField) => itemField.id)));
102
+ const next = createFormField(type, existing);
103
+ commit((draft) => {
104
+ const target = draft.sections[targetIndex];
105
+ target.fields.push(next);
106
+ if (target.canvas) {
107
+ const box = defaultBox(type);
108
+ const bottom = target.canvas.items.reduce((max, item) => Math.max(max, item.y + item.h), 0);
109
+ target.canvas.items.push({ i: next.id, x: 0, y: bottom, ...box });
110
+ }
111
+ });
112
+ setSelected({ sectionId: value.sections[targetIndex].id, fieldId: next.id });
113
+ setPropertiesOpen(true);
114
+ }
115
+ function addSection() {
116
+ const existing = new Set(value.sections.map((item) => item.id));
117
+ const id = newId('section', existing);
118
+ commit((draft) => draft.sections.push({ id, title: 'New section', fields: [] }));
119
+ setSelected({ sectionId: id });
120
+ setPropertiesOpen(true);
121
+ }
122
+ return (_jsxs("div", { className: cn('flex h-full min-h-0 flex-col overflow-hidden bg-bg', className), children: [_jsxs("div", { className: "flex min-h-0 flex-1 flex-col overflow-hidden lg:flex-row", children: [_jsxs("aside", { className: "flex h-64 w-full shrink-0 flex-col border-b border-border bg-surface lg:h-auto lg:w-80 lg:border-r lg:border-b-0", children: [railItems.length > 1 ? (_jsx("div", { className: "flex shrink-0 border-b border-border p-1", children: railItems.map((item) => {
123
+ const Icon = item.icon;
124
+ return _jsxs("button", { type: "button", "aria-pressed": rail === item.id, onClick: () => setRail(item.id), className: cn('flex min-w-0 flex-1 flex-col items-center gap-0.5 rounded px-1 py-1.5 text-[10px] font-medium transition-colors', rail === item.id ? 'bg-primary-subtle text-primary' : 'text-fg-muted hover:bg-surface-hover hover:text-fg'), children: [_jsx(Icon, { size: 14 }), _jsx("span", { className: "truncate", children: item.label })] }, item.id);
125
+ }) })) : null, rail === 'fields' ? _jsxs(_Fragment, { children: [_jsxs("div", { className: "flex shrink-0 items-center justify-between border-b border-border px-3 py-2.5", children: [_jsxs("div", { children: [_jsx("h2", { className: "text-sm font-semibold text-fg", children: "Field library" }), _jsx("p", { className: "text-xs text-fg-muted", children: "Choose a field to add it." })] }), _jsx(Badge, { variant: "secondary", children: types.length })] }), _jsx("div", { className: "shrink-0 border-b border-border p-3", children: _jsxs("div", { className: "relative", children: [_jsx(Search, { className: "pointer-events-none absolute top-2.5 left-3 size-4 text-fg-subtle" }), _jsx(Input, { value: query, onChange: (event) => setQuery(event.target.value), placeholder: "Find a field\u2026", className: "pl-9" })] }) }), _jsx("div", { className: "app-scroll min-h-0 flex-1 overflow-y-auto p-3", children: CATEGORY_ORDER.map((category) => {
126
+ const items = palette.filter((type) => FIELD_TYPES[type].category === category);
127
+ if (items.length === 0)
128
+ return null;
129
+ return (_jsxs("section", { className: "mb-3", children: [_jsx("h3", { className: "px-1 pb-1 text-[10px] font-semibold tracking-wider text-fg-subtle uppercase", children: category }), _jsx("div", { className: "grid grid-cols-1 gap-1", children: items.map((type) => (_jsxs("button", { type: "button", disabled: readOnly, draggable: !readOnly, onDragStart: (event) => {
130
+ dragTypeRef.current = type;
131
+ event.dataTransfer.effectAllowed = 'copy';
132
+ event.dataTransfer.setData('application/x-appkit-form-field', type);
133
+ }, onDragEnd: () => { dragTypeRef.current = null; }, onClick: () => addField(type), className: "flex items-center gap-2 rounded border border-border px-2 py-1.5 text-left text-xs text-fg hover:border-primary hover:bg-primary-subtle disabled:cursor-not-allowed disabled:opacity-50", title: `Add ${FIELD_TYPES[type].label}`, children: [_jsx(Plus, { className: "size-3 shrink-0" }), _jsx("span", { className: "truncate", children: FIELD_TYPES[type].label })] }, type))) })] }, category));
134
+ }) })] }) : null, rail === 'workflow' ? _jsxs("div", { className: "app-scroll min-h-0 flex-1 space-y-4 overflow-y-auto p-3", children: [_jsx(FormTabsEditor, { schema: value, locale: locale, readOnly: readOnly, onChange: (tabs, sectionTabs) => commit((draft) => { draft.tabs = tabs; for (const itemSection of draft.sections)
135
+ itemSection.tabId = sectionTabs[itemSection.id]; }) }), _jsx(FormWorkflowEditor, { schema: value, locale: locale, readOnly: readOnly, onChange: (steps) => commit((draft) => { draft.workflow = { ...(draft.workflow ?? {}), steps }; }) })] }) : null, rail === 'record' && onRecordConfigChange ? _jsx("div", { className: "app-scroll min-h-0 flex-1 overflow-y-auto p-3", children: _jsx(RecordBehaviorPanel, { value: recordConfig, roles: roles, onChange: onRecordConfigChange, onSave: onRecordConfigSave, readOnly: readOnly }) }) : null, rail === 'list' && onRecordConfigChange ? _jsx("div", { className: "app-scroll min-h-0 flex-1 overflow-y-auto p-3", children: _jsx(RecordListPanel, { value: recordConfig?.list, fields: recordFields, onChange: (list) => onRecordConfigChange({ ...recordConfig, list }), onSave: onRecordConfigSave ? async (list) => onRecordConfigSave({ ...recordConfig, list }) : undefined, readOnly: readOnly }) }) : null, rail === 'actions' && recordActionAdapter ? _jsx("div", { className: "app-scroll min-h-0 flex-1 overflow-y-auto p-3", children: _jsx(RecordActionsPanel, { flows: recordActionFlows ?? [], adapter: recordActionAdapter, onChanged: onRecordActionsChanged, readOnly: readOnly }) }) : null] }), _jsxs("div", { className: "flex min-w-0 flex-1 flex-col bg-bg-subtle", children: [_jsxs("div", { className: "flex shrink-0 items-center gap-2 border-b border-border bg-surface px-3 py-2", children: [_jsx("span", { className: "text-xs font-semibold text-fg", children: "Build" }), _jsxs("span", { className: "text-xs text-fg-muted", children: [value.sections.length, " section", value.sections.length === 1 ? '' : 's'] }), _jsx("div", { className: "ml-auto w-full max-w-sm", children: _jsx(Input, { id: "form-title", "aria-label": "Form title", className: "h-8 text-sm font-semibold", value: readText(value.title, locale), disabled: readOnly, onChange: (event) => commit((draft) => { draft.title = writeText(draft.title, event.target.value, locale); }) }) })] }), _jsx("main", { className: "app-scroll min-h-0 flex-1 overflow-y-auto p-4 lg:p-6", children: _jsxs("div", { className: "w-full space-y-3", children: [value.sections.map((itemSection, itemSectionIndex) => {
136
+ const sectionActive = selected.sectionId === itemSection.id && !selected.fieldId;
137
+ return (_jsxs(Card, { className: cn('border transition-colors', sectionActive ? 'border-primary ring-1 ring-ring' : 'border-border'), children: [_jsxs(CardHeader, { className: "flex flex-row items-center justify-between gap-2 p-4 pb-2", children: [_jsxs("button", { type: "button", onClick: () => {
138
+ setSelected({ sectionId: itemSection.id });
139
+ setPropertiesOpen(true);
140
+ }, className: "min-w-0 flex-1 text-left", children: [_jsx(CardTitle, { className: "truncate text-base", children: readText(itemSection.title, locale, 'Untitled section') }), _jsxs("span", { className: "text-xs text-fg-muted", children: [itemSection.fields.length, " field", itemSection.fields.length === 1 ? '' : 's'] })] }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx(IconButton, { label: "Move section up", disabled: readOnly || itemSectionIndex === 0, onClick: () => commit((draft) => { const [moved] = draft.sections.splice(itemSectionIndex, 1); draft.sections.splice(itemSectionIndex - 1, 0, moved); }), children: _jsx(ArrowUp, { size: 14 }) }), _jsx(IconButton, { label: "Move section down", disabled: readOnly || itemSectionIndex === value.sections.length - 1, onClick: () => commit((draft) => { const [moved] = draft.sections.splice(itemSectionIndex, 1); draft.sections.splice(itemSectionIndex + 1, 0, moved); }), children: _jsx(ArrowDown, { size: 14 }) }), _jsx(IconButton, { label: "Delete section", disabled: readOnly || value.sections.length === 1, onClick: () => {
141
+ const nextSection = value.sections[itemSectionIndex === 0 ? 1 : itemSectionIndex - 1];
142
+ commit((draft) => draft.sections.splice(itemSectionIndex, 1));
143
+ if (nextSection)
144
+ setSelected({ sectionId: nextSection.id });
145
+ }, children: _jsx(Trash2, { size: 14, className: "text-danger" }) })] })] }), _jsx(CardContent, { className: "p-4 pt-0", children: itemSection.canvas ? (_jsx(CanvasEditor, { section: itemSection, locale: locale, defaultLocale: locale, selectedFieldId: selected.sectionId === itemSection.id ? selected.fieldId ?? null : null, dragTypeRef: dragTypeRef, onLayout: (items) => {
146
+ if (readOnly)
147
+ return;
148
+ commit((draft) => { draft.sections[itemSectionIndex].canvas = { ...draft.sections[itemSectionIndex].canvas, items }; });
149
+ }, onAddWidget: (type, box) => {
150
+ if (readOnly)
151
+ return;
152
+ const existing = new Set(value.sections.flatMap((candidate) => candidate.fields.map((candidateField) => candidateField.id)));
153
+ const next = createFormField(type, existing);
154
+ commit((draft) => {
155
+ const target = draft.sections[itemSectionIndex];
156
+ target.fields.push(next);
157
+ target.canvas.items.push({ i: next.id, ...box });
158
+ });
159
+ setSelected({ sectionId: itemSection.id, fieldId: next.id });
160
+ setPropertiesOpen(true);
161
+ }, onSelect: (fieldId) => {
162
+ setSelected({ sectionId: itemSection.id, fieldId });
163
+ setPropertiesOpen(true);
164
+ }, onDelete: (fieldId) => {
165
+ if (readOnly)
166
+ return;
167
+ commit((draft) => {
168
+ const target = draft.sections[itemSectionIndex];
169
+ target.fields = target.fields.filter((candidate) => candidate.id !== fieldId);
170
+ target.canvas.items = target.canvas.items.filter((item) => item.i !== fieldId);
171
+ });
172
+ setSelected({ sectionId: itemSection.id });
173
+ } })) : itemSection.fields.length === 0 ? (_jsx("button", { type: "button", onClick: () => {
174
+ setSelected({ sectionId: itemSection.id });
175
+ setPropertiesOpen(true);
176
+ }, className: "w-full rounded-md border border-dashed border-border-strong p-4 text-center text-xs text-fg-subtle", children: "Select this section, then add a field from the library." })) : (_jsx("ul", { className: "divide-y divide-border-subtle", children: itemSection.fields.map((itemField, itemFieldIndex) => (_jsx("li", { children: _jsxs("button", { type: "button", onClick: () => {
177
+ setSelected({ sectionId: itemSection.id, fieldId: itemField.id });
178
+ setPropertiesOpen(true);
179
+ }, className: cn('flex w-full items-center gap-2 rounded px-2 py-2 text-left transition-colors hover:bg-surface-hover', selected.fieldId === itemField.id && 'bg-primary-subtle text-primary'), children: [_jsx(GripVertical, { className: "size-4 shrink-0 text-fg-subtle" }), _jsx("span", { className: "min-w-0 flex-1 truncate text-sm font-medium", children: readText(itemField.label, locale, FIELD_TYPES[itemField.type].label) }), _jsx(Badge, { variant: "secondary", className: "text-[10px]", children: FIELD_TYPES[itemField.type].label }), itemField.required || itemField.validation?.required ? _jsx(Badge, { variant: "warning", className: "text-[10px]", children: "Required" }) : null, _jsx("span", { className: "w-5 text-right text-xs tabular-nums text-fg-subtle", children: itemFieldIndex + 1 })] }) }, itemField.id))) })) })] }, itemSection.id));
180
+ }), _jsxs(Button, { type: "button", variant: "outline", onClick: addSection, disabled: readOnly, className: "w-full", children: [_jsx(Plus, { size: 14 }), "Add section"] })] }) })] })] }), _jsx(Drawer, { open: propertiesOpen, onClose: () => setPropertiesOpen(false), title: field ? 'Field properties' : 'Section properties', size: "sm", children: field && section ? (_jsx(FieldInspector, { field: field, sections: value.sections, availableFields: value.sections.flatMap((itemSection) => itemSection.fields
181
+ .filter((itemField) => itemField.id !== field.id)
182
+ .map((itemField) => ({
183
+ id: itemField.id,
184
+ label: readText(itemField.label, locale, itemField.id),
185
+ }))), locale: locale, schema: value, sectionId: section.id, dataSources: dataSources, dataSourcesLoading: dataSourcesLoading, onRefreshDataSources: onRefreshDataSources, readOnly: readOnly, onPatch: (patch) => {
186
+ commit((draft) => Object.assign(draft.sections[sectionIndex].fields[fieldIndex], patch));
187
+ if (patch.id && patch.id !== field.id) {
188
+ setSelected({ sectionId: section.id, fieldId: patch.id });
189
+ }
190
+ }, onMove: (offset) => commit((draft) => {
191
+ const fields = draft.sections[sectionIndex].fields;
192
+ const target = fieldIndex + offset;
193
+ if (target < 0 || target >= fields.length)
194
+ return;
195
+ const [moved] = fields.splice(fieldIndex, 1);
196
+ fields.splice(target, 0, moved);
197
+ }), onDelete: () => {
198
+ commit((draft) => draft.sections[sectionIndex].fields.splice(fieldIndex, 1));
199
+ setSelected({ sectionId: section.id });
200
+ }, canMoveUp: fieldIndex > 0, canMoveDown: fieldIndex < section.fields.length - 1 })) : section ? (_jsx(SectionInspector, { section: section, schema: value, locale: locale, readOnly: readOnly, onChange: (patch) => commit((draft) => Object.assign(draft.sections[sectionIndex], patch)), onDelete: value.sections.length > 1 ? () => {
201
+ commit((draft) => draft.sections.splice(sectionIndex, 1));
202
+ setSelected({ sectionId: value.sections[sectionIndex === 0 ? 1 : sectionIndex - 1].id });
203
+ } : undefined })) : _jsx("p", { className: "text-sm text-fg-muted", children: "Select a section or field to edit it." }) })] }));
204
+ }
205
+ function IconButton({ label, onClick, disabled, children }) {
206
+ return _jsx("button", { type: "button", title: label, "aria-label": label, onClick: onClick, disabled: disabled, className: "rounded p-1 text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-40", children: children });
207
+ }
208
+ function SectionInspector({ section, schema, locale, readOnly, onChange, onDelete }) {
209
+ return _jsxs("div", { className: "space-y-4", children: [_jsx(SectionProperties, { section: section, schema: schema, locale: locale, readOnly: readOnly, onChange: onChange }), onDelete ? _jsxs(Button, { variant: "destructive", size: "sm", onClick: onDelete, disabled: readOnly, children: [_jsx(Trash2, { size: 15 }), "Delete section"] }) : null] });
210
+ }
211
+ function FieldInspector({ field, schema, sectionId, locale, readOnly, dataSources, dataSourcesLoading, onRefreshDataSources, onPatch, onMove, onDelete, canMoveUp, canMoveDown }) {
212
+ return (_jsxs("div", { className: "space-y-4", children: [_jsx(FieldProperties, { sectionId: sectionId, field: field, schema: schema, locale: locale, dataSources: dataSources, dataSourcesLoading: dataSourcesLoading, onRefreshDataSources: onRefreshDataSources, readOnly: readOnly, onChange: onPatch }), _jsxs("div", { className: "flex flex-wrap gap-1", children: [_jsx(Button, { type: "button", size: "icon", variant: "outline", "aria-label": "Move field up", disabled: readOnly || !canMoveUp, onClick: () => onMove(-1), children: _jsx(ArrowUp, { size: 15 }) }), _jsx(Button, { type: "button", size: "icon", variant: "outline", "aria-label": "Move field down", disabled: readOnly || !canMoveDown, onClick: () => onMove(1), children: _jsx(ArrowDown, { size: 15 }) }), _jsxs(Button, { type: "button", size: "sm", variant: "destructive", disabled: readOnly, onClick: onDelete, children: [_jsx(Trash2, { size: 15 }), "Delete"] })] })] }));
213
+ }
214
+ //# sourceMappingURL=form-designer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-designer.js","sourceRoot":"","sources":["../src/form-designer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC5I,OAAO,EACL,kBAAkB,EAClB,WAAW,GAIZ,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAkB,MAAM,8BAA8B,CAAA;AAC7E,OAAO,EACL,KAAK,EACL,MAAM,EACN,IAAI,EACJ,WAAW,EACX,UAAU,EAC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,EAAC,aAAa,EAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,aAAE,KAAC,MAAM,IAAC,IAAI,EAAE,EAAE,GAAI,cAAe,IAAM,IACjgB,CACP,CAAA;AACH,CAAC","sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { ArrowDown, ArrowUp, GitBranch, GripVertical, List, MousePointerClick, Plus, Search, Settings2, Trash2, Wrench } from 'lucide-react'\nimport {\n CHOICE_FIELD_TYPES,\n FIELD_TYPES,\n type FieldType,\n type FormField,\n type FormSchemaV1,\n} from '@braedonsaunders/appkit-forms-core'\nimport { DEFAULT_LOCALE, type AppLocale } from '@braedonsaunders/appkit-i18n'\nimport {\n Badge,\n Button,\n Card,\n CardContent,\n CardHeader,\n CardTitle,\n Drawer,\n Input,\n cn,\n} from '@braedonsaunders/appkit-ui'\nimport { readText, writeText } from './text'\nimport { CanvasEditor, defaultBox } from './canvas-editor'\nimport { RecordBehaviorPanel } from './record-behavior-panel'\nimport { RecordListPanel } from './record-list-panel'\nimport { RecordActionsPanel } from './record-actions-panel'\nimport type { RecordActionFlow, RecordActionFlowAdapter, RecordConfig } from './record-config'\nimport { FieldProperties, SectionProperties, type FormDataSource } from './properties'\nimport { FormTabsEditor, FormWorkflowEditor } from './workflow-properties'\n\nexport type FormDesignerProps = {\n value: FormSchemaV1\n onChange: (schema: FormSchemaV1) => void\n locale?: AppLocale\n availableFieldTypes?: readonly FieldType[]\n className?: string\n readOnly?: boolean\n recordConfig?: RecordConfig\n onRecordConfigChange?: (config: RecordConfig) => void\n onRecordConfigSave?: (config: RecordConfig) => void | Promise<void>\n roles?: { key: string; name: string }[]\n recordActionFlows?: RecordActionFlow[]\n recordActionAdapter?: RecordActionFlowAdapter\n onRecordActionsChanged?: () => void | Promise<void>\n dataSources?: readonly FormDataSource[]\n dataSourcesLoading?: boolean\n onRefreshDataSources?: () => void | Promise<void>\n}\n\nconst CATEGORY_ORDER = ['standard', 'choice', 'scoring', 'picker', 'media', 'identity', 'computed', 'data', 'display'] as const\n\nfunction newId(prefix: string, existing: ReadonlySet<string>): string {\n let index = 1\n let candidate = prefix\n while (existing.has(candidate)) candidate = `${prefix}_${++index}`\n return candidate\n}\n\nexport function createFormField(type: FieldType, existing: ReadonlySet<string> = new Set()): FormField {\n const meta = FIELD_TYPES[type]\n const field: FormField = {\n id: newId(type, existing),\n type,\n label: meta.label,\n }\n if (CHOICE_FIELD_TYPES.has(type)) {\n field.validation = {\n options: [\n { value: 'option_1', label: 'Option 1' },\n { value: 'option_2', label: 'Option 2' },\n ],\n }\n }\n if (type === 'rating') field.config = { max: 5 }\n if (type === 'slider') field.config = { min: 0, max: 10, step: 1 }\n if (type === 'table') {\n field.config = {\n columns: [{ key: 'column_1', label: 'Column 1', type: 'text' }],\n rowMode: 'addable',\n }\n }\n if (type === 'matrix') {\n field.config = {\n rows: [{ key: 'row_1', label: 'Row 1' }],\n scale: [\n { value: '1', label: 'Low' },\n { value: '2', label: 'High' },\n ],\n }\n }\n if (type === 'formula') field.formula = { kind: 'literal', value: 0 }\n if (type === 'lookup') field.binding = { sourceKey: 'source' }\n if (type === 'data_table') field.binding = { sourceKey: 'source', selectable: 'multi' }\n if (type === 'metric') {\n field.binding = { sourceKey: 'source', aggregate: { fn: 'count' }, display: 'number' }\n }\n return field\n}\n\nexport function FormDesigner({\n value,\n onChange,\n locale = DEFAULT_LOCALE,\n availableFieldTypes,\n className,\n readOnly = false,\n recordConfig,\n onRecordConfigChange,\n onRecordConfigSave,\n roles,\n recordActionFlows,\n recordActionAdapter,\n onRecordActionsChanged,\n dataSources,\n dataSourcesLoading,\n onRefreshDataSources,\n}: FormDesignerProps) {\n const [query, setQuery] = React.useState('')\n const [rail, setRail] = React.useState<'fields' | 'workflow' | 'record' | 'list' | 'actions'>('fields')\n const [selected, setSelected] = React.useState<{ sectionId: string; fieldId?: string }>(() => ({\n sectionId: value.sections[0]?.id ?? '',\n }))\n const [propertiesOpen, setPropertiesOpen] = React.useState(false)\n const dragTypeRef = React.useRef<FieldType | null>(null)\n const types = availableFieldTypes ?? (Object.keys(FIELD_TYPES) as FieldType[])\n const normalizedQuery = query.trim().toLowerCase()\n const palette = types.filter((type) => {\n const meta = FIELD_TYPES[type]\n return !normalizedQuery || `${meta.label} ${meta.description} ${meta.category}`.toLowerCase().includes(normalizedQuery)\n })\n const sectionIndex = value.sections.findIndex((section) => section.id === selected.sectionId)\n const section = value.sections[sectionIndex]\n const fieldIndex = section?.fields.findIndex((field) => field.id === selected.fieldId) ?? -1\n const field = section?.fields[fieldIndex]\n const recordFields = React.useMemo(() => value.sections.flatMap((itemSection) => itemSection.fields.map((itemField) => ({ id: itemField.id, label: readText(itemField.label, locale, itemField.id) }))), [locale, value.sections])\n const railItems = React.useMemo(() => [\n { id: 'fields' as const, label: 'Fields', icon: Wrench, available: true },\n { id: 'workflow' as const, label: 'Pages', icon: GitBranch, available: true },\n { id: 'record' as const, label: 'Record', icon: Settings2, available: Boolean(onRecordConfigChange) },\n { id: 'list' as const, label: 'List', icon: List, available: Boolean(onRecordConfigChange) },\n { id: 'actions' as const, label: 'Actions', icon: MousePointerClick, available: Boolean(recordActionAdapter) },\n ].filter((item) => item.available), [onRecordConfigChange, recordActionAdapter])\n\n const commit = React.useCallback(\n (mutate: (draft: FormSchemaV1) => void) => {\n const draft = structuredClone(value)\n mutate(draft)\n onChange(draft)\n },\n [onChange, value],\n )\n\n function addField(type: FieldType) {\n const targetIndex = sectionIndex >= 0 ? sectionIndex : 0\n const existing = new Set(value.sections.flatMap((item) => item.fields.map((itemField) => itemField.id)))\n const next = createFormField(type, existing)\n commit((draft) => {\n const target = draft.sections[targetIndex]!\n target.fields.push(next)\n if (target.canvas) {\n const box = defaultBox(type)\n const bottom = target.canvas.items.reduce((max, item) => Math.max(max, item.y + item.h), 0)\n target.canvas.items.push({ i: next.id, x: 0, y: bottom, ...box })\n }\n })\n setSelected({ sectionId: value.sections[targetIndex]!.id, fieldId: next.id })\n setPropertiesOpen(true)\n }\n\n function addSection() {\n const existing = new Set(value.sections.map((item) => item.id))\n const id = newId('section', existing)\n commit((draft) => draft.sections.push({ id, title: 'New section', fields: [] }))\n setSelected({ sectionId: id })\n setPropertiesOpen(true)\n }\n\n return (\n <div className={cn('flex h-full min-h-0 flex-col overflow-hidden bg-bg', className)}>\n <div className=\"flex min-h-0 flex-1 flex-col overflow-hidden lg:flex-row\">\n {/* Fixed, independently scrolling builder rail. */}\n <aside className=\"flex h-64 w-full shrink-0 flex-col border-b border-border bg-surface lg:h-auto lg:w-80 lg:border-r lg:border-b-0\">\n {railItems.length > 1 ? (\n <div className=\"flex shrink-0 border-b border-border p-1\">\n {railItems.map((item) => {\n const Icon = item.icon\n return <button key={item.id} type=\"button\" aria-pressed={rail === item.id} onClick={() => setRail(item.id)} className={cn('flex min-w-0 flex-1 flex-col items-center gap-0.5 rounded px-1 py-1.5 text-[10px] font-medium transition-colors', rail === item.id ? 'bg-primary-subtle text-primary' : 'text-fg-muted hover:bg-surface-hover hover:text-fg')}><Icon size={14} /><span className=\"truncate\">{item.label}</span></button>\n })}\n </div>\n ) : null}\n {rail === 'fields' ? <>\n <div className=\"flex shrink-0 items-center justify-between border-b border-border px-3 py-2.5\">\n <div>\n <h2 className=\"text-sm font-semibold text-fg\">Field library</h2>\n <p className=\"text-xs text-fg-muted\">Choose a field to add it.</p>\n </div>\n <Badge variant=\"secondary\">{types.length}</Badge>\n </div>\n <div className=\"shrink-0 border-b border-border p-3\">\n <div className=\"relative\">\n <Search className=\"pointer-events-none absolute top-2.5 left-3 size-4 text-fg-subtle\" />\n <Input value={query} onChange={(event) => setQuery(event.target.value)} placeholder=\"Find a field…\" className=\"pl-9\" />\n </div>\n </div>\n <div className=\"app-scroll min-h-0 flex-1 overflow-y-auto p-3\">\n {CATEGORY_ORDER.map((category) => {\n const items = palette.filter((type) => FIELD_TYPES[type].category === category)\n if (items.length === 0) return null\n return (\n <section key={category} className=\"mb-3\">\n <h3 className=\"px-1 pb-1 text-[10px] font-semibold tracking-wider text-fg-subtle uppercase\">{category}</h3>\n <div className=\"grid grid-cols-1 gap-1\">\n {items.map((type) => (\n <button\n key={type}\n type=\"button\"\n disabled={readOnly}\n draggable={!readOnly}\n onDragStart={(event) => {\n dragTypeRef.current = type\n event.dataTransfer.effectAllowed = 'copy'\n event.dataTransfer.setData('application/x-appkit-form-field', type)\n }}\n onDragEnd={() => { dragTypeRef.current = null }}\n onClick={() => addField(type)}\n className=\"flex items-center gap-2 rounded border border-border px-2 py-1.5 text-left text-xs text-fg hover:border-primary hover:bg-primary-subtle disabled:cursor-not-allowed disabled:opacity-50\"\n title={`Add ${FIELD_TYPES[type].label}`}\n >\n <Plus className=\"size-3 shrink-0\" />\n <span className=\"truncate\">{FIELD_TYPES[type].label}</span>\n </button>\n ))}\n </div>\n </section>\n )\n })}\n </div>\n </> : null}\n {rail === 'workflow' ? <div className=\"app-scroll min-h-0 flex-1 space-y-4 overflow-y-auto p-3\"><FormTabsEditor schema={value} locale={locale} readOnly={readOnly} onChange={(tabs, sectionTabs) => commit((draft) => { draft.tabs = tabs; for (const itemSection of draft.sections) itemSection.tabId = sectionTabs[itemSection.id] })} /><FormWorkflowEditor schema={value} locale={locale} readOnly={readOnly} onChange={(steps) => commit((draft) => { draft.workflow = { ...(draft.workflow ?? {}), steps } })} /></div> : null}\n {rail === 'record' && onRecordConfigChange ? <div className=\"app-scroll min-h-0 flex-1 overflow-y-auto p-3\"><RecordBehaviorPanel value={recordConfig} roles={roles} onChange={onRecordConfigChange} onSave={onRecordConfigSave} readOnly={readOnly} /></div> : null}\n {rail === 'list' && onRecordConfigChange ? <div className=\"app-scroll min-h-0 flex-1 overflow-y-auto p-3\"><RecordListPanel value={recordConfig?.list} fields={recordFields} onChange={(list) => onRecordConfigChange({ ...recordConfig, list })} onSave={onRecordConfigSave ? async (list) => onRecordConfigSave({ ...recordConfig, list }) : undefined} readOnly={readOnly} /></div> : null}\n {rail === 'actions' && recordActionAdapter ? <div className=\"app-scroll min-h-0 flex-1 overflow-y-auto p-3\"><RecordActionsPanel flows={recordActionFlows ?? []} adapter={recordActionAdapter} onChanged={onRecordActionsChanged} readOnly={readOnly} /></div> : null}\n </aside>\n\n {/* The build surface owns the remaining space. */}\n <div className=\"flex min-w-0 flex-1 flex-col bg-bg-subtle\">\n <div className=\"flex shrink-0 items-center gap-2 border-b border-border bg-surface px-3 py-2\">\n <span className=\"text-xs font-semibold text-fg\">Build</span>\n <span className=\"text-xs text-fg-muted\">{value.sections.length} section{value.sections.length === 1 ? '' : 's'}</span>\n <div className=\"ml-auto w-full max-w-sm\">\n <Input\n id=\"form-title\"\n aria-label=\"Form title\"\n className=\"h-8 text-sm font-semibold\"\n value={readText(value.title, locale)}\n disabled={readOnly}\n onChange={(event) => commit((draft) => { draft.title = writeText(draft.title, event.target.value, locale) })}\n />\n </div>\n </div>\n <main className=\"app-scroll min-h-0 flex-1 overflow-y-auto p-4 lg:p-6\">\n <div className=\"w-full space-y-3\">\n {value.sections.map((itemSection, itemSectionIndex) => {\n const sectionActive = selected.sectionId === itemSection.id && !selected.fieldId\n return (\n <Card\n key={itemSection.id}\n className={cn(\n 'border transition-colors',\n sectionActive ? 'border-primary ring-1 ring-ring' : 'border-border',\n )}\n >\n <CardHeader className=\"flex flex-row items-center justify-between gap-2 p-4 pb-2\">\n <button\n type=\"button\"\n onClick={() => {\n setSelected({ sectionId: itemSection.id })\n setPropertiesOpen(true)\n }}\n className=\"min-w-0 flex-1 text-left\"\n >\n <CardTitle className=\"truncate text-base\">{readText(itemSection.title, locale, 'Untitled section')}</CardTitle>\n <span className=\"text-xs text-fg-muted\">{itemSection.fields.length} field{itemSection.fields.length === 1 ? '' : 's'}</span>\n </button>\n <div className=\"flex items-center gap-1\">\n <IconButton label=\"Move section up\" disabled={readOnly || itemSectionIndex === 0} onClick={() => commit((draft) => { const [moved] = draft.sections.splice(itemSectionIndex, 1); draft.sections.splice(itemSectionIndex - 1, 0, moved!) })}><ArrowUp size={14} /></IconButton>\n <IconButton label=\"Move section down\" disabled={readOnly || itemSectionIndex === value.sections.length - 1} onClick={() => commit((draft) => { const [moved] = draft.sections.splice(itemSectionIndex, 1); draft.sections.splice(itemSectionIndex + 1, 0, moved!) })}><ArrowDown size={14} /></IconButton>\n <IconButton label=\"Delete section\" disabled={readOnly || value.sections.length === 1} onClick={() => {\n const nextSection = value.sections[itemSectionIndex === 0 ? 1 : itemSectionIndex - 1]\n commit((draft) => draft.sections.splice(itemSectionIndex, 1))\n if (nextSection) setSelected({ sectionId: nextSection.id })\n }}><Trash2 size={14} className=\"text-danger\" /></IconButton>\n </div>\n </CardHeader>\n <CardContent className=\"p-4 pt-0\">\n {itemSection.canvas ? (\n <CanvasEditor\n section={itemSection}\n locale={locale}\n defaultLocale={locale}\n selectedFieldId={selected.sectionId === itemSection.id ? selected.fieldId ?? null : null}\n dragTypeRef={dragTypeRef}\n onLayout={(items) => {\n if (readOnly) return\n commit((draft) => { draft.sections[itemSectionIndex]!.canvas = { ...draft.sections[itemSectionIndex]!.canvas!, items } })\n }}\n onAddWidget={(type, box) => {\n if (readOnly) return\n const existing = new Set(value.sections.flatMap((candidate) => candidate.fields.map((candidateField) => candidateField.id)))\n const next = createFormField(type, existing)\n commit((draft) => {\n const target = draft.sections[itemSectionIndex]!\n target.fields.push(next)\n target.canvas!.items.push({ i: next.id, ...box })\n })\n setSelected({ sectionId: itemSection.id, fieldId: next.id })\n setPropertiesOpen(true)\n }}\n onSelect={(fieldId) => {\n setSelected({ sectionId: itemSection.id, fieldId })\n setPropertiesOpen(true)\n }}\n onDelete={(fieldId) => {\n if (readOnly) return\n commit((draft) => {\n const target = draft.sections[itemSectionIndex]!\n target.fields = target.fields.filter((candidate) => candidate.id !== fieldId)\n target.canvas!.items = target.canvas!.items.filter((item) => item.i !== fieldId)\n })\n setSelected({ sectionId: itemSection.id })\n }}\n />\n ) : itemSection.fields.length === 0 ? (\n <button\n type=\"button\"\n onClick={() => {\n setSelected({ sectionId: itemSection.id })\n setPropertiesOpen(true)\n }}\n className=\"w-full rounded-md border border-dashed border-border-strong p-4 text-center text-xs text-fg-subtle\"\n >\n Select this section, then add a field from the library.\n </button>\n ) : (\n <ul className=\"divide-y divide-border-subtle\">\n {itemSection.fields.map((itemField, itemFieldIndex) => (\n <li key={itemField.id}>\n <button\n type=\"button\"\n onClick={() => {\n setSelected({ sectionId: itemSection.id, fieldId: itemField.id })\n setPropertiesOpen(true)\n }}\n className={cn(\n 'flex w-full items-center gap-2 rounded px-2 py-2 text-left transition-colors hover:bg-surface-hover',\n selected.fieldId === itemField.id && 'bg-primary-subtle text-primary',\n )}\n >\n <GripVertical className=\"size-4 shrink-0 text-fg-subtle\" />\n <span className=\"min-w-0 flex-1 truncate text-sm font-medium\">{readText(itemField.label, locale, FIELD_TYPES[itemField.type].label)}</span>\n <Badge variant=\"secondary\" className=\"text-[10px]\">{FIELD_TYPES[itemField.type].label}</Badge>\n {itemField.required || itemField.validation?.required ? <Badge variant=\"warning\" className=\"text-[10px]\">Required</Badge> : null}\n <span className=\"w-5 text-right text-xs tabular-nums text-fg-subtle\">{itemFieldIndex + 1}</span>\n </button>\n </li>\n ))}\n </ul>\n )}\n </CardContent>\n </Card>\n )\n })}\n <Button type=\"button\" variant=\"outline\" onClick={addSection} disabled={readOnly} className=\"w-full\"><Plus size={14} />Add section</Button>\n </div>\n </main>\n </div>\n </div>\n\n {/* Properties use a flyout rather than a permanent third column. */}\n <Drawer\n open={propertiesOpen}\n onClose={() => setPropertiesOpen(false)}\n title={field ? 'Field properties' : 'Section properties'}\n size=\"sm\"\n >\n {field && section ? (\n <FieldInspector\n field={field}\n sections={value.sections}\n availableFields={value.sections.flatMap((itemSection) =>\n itemSection.fields\n .filter((itemField) => itemField.id !== field.id)\n .map((itemField) => ({\n id: itemField.id,\n label: readText(itemField.label, locale, itemField.id),\n })),\n )}\n locale={locale}\n schema={value}\n sectionId={section.id}\n dataSources={dataSources}\n dataSourcesLoading={dataSourcesLoading}\n onRefreshDataSources={onRefreshDataSources}\n readOnly={readOnly}\n onPatch={(patch) => {\n commit((draft) => Object.assign(draft.sections[sectionIndex]!.fields[fieldIndex]!, patch))\n if (patch.id && patch.id !== field.id) {\n setSelected({ sectionId: section.id, fieldId: patch.id })\n }\n }}\n onMove={(offset) => commit((draft) => {\n const fields = draft.sections[sectionIndex]!.fields\n const target = fieldIndex + offset\n if (target < 0 || target >= fields.length) return\n const [moved] = fields.splice(fieldIndex, 1)\n fields.splice(target, 0, moved!)\n })}\n onDelete={() => {\n commit((draft) => draft.sections[sectionIndex]!.fields.splice(fieldIndex, 1))\n setSelected({ sectionId: section.id })\n }}\n canMoveUp={fieldIndex > 0}\n canMoveDown={fieldIndex < section.fields.length - 1}\n />\n ) : section ? (\n <SectionInspector\n section={section}\n schema={value}\n locale={locale}\n readOnly={readOnly}\n onChange={(patch) => commit((draft) => Object.assign(draft.sections[sectionIndex]!, patch))}\n onDelete={value.sections.length > 1 ? () => {\n commit((draft) => draft.sections.splice(sectionIndex, 1))\n setSelected({ sectionId: value.sections[sectionIndex === 0 ? 1 : sectionIndex - 1]!.id })\n } : undefined}\n />\n ) : <p className=\"text-sm text-fg-muted\">Select a section or field to edit it.</p>}\n </Drawer>\n </div>\n )\n}\n\nfunction IconButton({ label, onClick, disabled, children }: { label: string; onClick: () => void; disabled?: boolean; children: React.ReactNode }) {\n return <button type=\"button\" title={label} aria-label={label} onClick={onClick} disabled={disabled} className=\"rounded p-1 text-fg-muted hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-40\">{children}</button>\n}\n\nfunction SectionInspector({ section, schema, locale, readOnly, onChange, onDelete }: { section: FormSchemaV1['sections'][number]; schema: FormSchemaV1; locale: AppLocale; readOnly: boolean; onChange: (patch: Partial<FormSchemaV1['sections'][number]>) => void; onDelete?: () => void }) {\n return <div className=\"space-y-4\"><SectionProperties section={section} schema={schema} locale={locale} readOnly={readOnly} onChange={onChange} />{onDelete ? <Button variant=\"destructive\" size=\"sm\" onClick={onDelete} disabled={readOnly}><Trash2 size={15} />Delete section</Button> : null}</div>\n}\n\nfunction FieldInspector({ field, schema, sectionId, locale, readOnly, dataSources, dataSourcesLoading, onRefreshDataSources, onPatch, onMove, onDelete, canMoveUp, canMoveDown }: { field: FormField; schema: FormSchemaV1; sectionId: string; sections: FormSchemaV1['sections']; availableFields: { id: string; label: string }[]; locale: AppLocale; readOnly: boolean; dataSources?: readonly FormDataSource[]; dataSourcesLoading?: boolean; onRefreshDataSources?: () => void | Promise<void>; onPatch: (patch: Partial<FormField>) => void; onMove: (offset: number) => void; onDelete: () => void; canMoveUp: boolean; canMoveDown: boolean }) {\n return (\n <div className=\"space-y-4\">\n <FieldProperties sectionId={sectionId} field={field} schema={schema} locale={locale} dataSources={dataSources} dataSourcesLoading={dataSourcesLoading} onRefreshDataSources={onRefreshDataSources} readOnly={readOnly} onChange={onPatch} />\n <div className=\"flex flex-wrap gap-1\"><Button type=\"button\" size=\"icon\" variant=\"outline\" aria-label=\"Move field up\" disabled={readOnly || !canMoveUp} onClick={() => onMove(-1)}><ArrowUp size={15} /></Button><Button type=\"button\" size=\"icon\" variant=\"outline\" aria-label=\"Move field down\" disabled={readOnly || !canMoveDown} onClick={() => onMove(1)}><ArrowDown size={15} /></Button><Button type=\"button\" size=\"sm\" variant=\"destructive\" disabled={readOnly} onClick={onDelete}><Trash2 size={15} />Delete</Button></div>\n </div>\n )\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import { type AutomationGraph, type FlowSubjectProfile, type FormSchemaV1 } from '@braedonsaunders/appkit-forms-core';
2
+ import { type AppLocale } from '@braedonsaunders/appkit-i18n';
3
+ export declare function formFlowProfile(templateId: string, label: string, schema: FormSchemaV1, locale?: AppLocale, defaultLocale?: AppLocale): FlowSubjectProfile;
4
+ export declare function lintFormFlowGraph(graph: AutomationGraph, templateId: string, label: string, schema: FormSchemaV1): string[];
5
+ //# sourceMappingURL=form-flow-validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form-flow-validation.d.ts","sourceRoot":"","sources":["../src/form-flow-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAUL,KAAK,eAAe,EAEpB,KAAK,kBAAkB,EAEvB,KAAK,YAAY,EAClB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAyB7E,wBAAgB,eAAe,CAC7B,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,YAAY,EACpB,MAAM,GAAE,SAA0B,EAClC,aAAa,GAAE,SAA0B,GACxC,kBAAkB,CA2CpB;AAwBD,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,eAAe,EACtB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,YAAY,GACnB,MAAM,EAAE,CAqEV"}