@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":"form-renderer.js","sourceRoot":"","sources":["../src/form-renderer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,GAOjB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EAAE,cAAc,EAAkB,MAAM,8BAA8B,CAAA;AAC7E,OAAO,EACL,KAAK,EACL,gBAAgB,EAChB,MAAM,EACN,QAAQ,EACR,KAAK,EACL,KAAK,EACL,QAAQ,EACR,EAAE,GACH,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,cAAc,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E5B,MAAM,MAAM,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAA;IACxC,MAAM,IAAI,GAAG,MAAM,CAAC,WAAW,CAC7B,MAAM,CAAC,QAAQ;SACZ,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC;SACtC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;QAChB,OAAO,CAAC,EAAE;QACV,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAiB,CAAC,CAAC,CAAC,EAAE;KAC5E,CAAC,CACL,CAAA;IACD,MAAM,OAAO,GAAgB,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAA;IACvE,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACtC,IAAI,OAAO,CAAC,SAAS;YAAE,SAAQ;QAC/B,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACnC,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,YAAY;gBAAE,SAAQ;YACnE,MAAM,QAAQ,GAAG,mBAAmB,CAAC,KAAK,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;YACjE,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI;gBAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAA;QAC9E,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { ArrowDown, ArrowUp, Plus, Trash2 } from 'lucide-react'\nimport {\n evaluateLogicRule,\n evaluateFormulaTree,\n resolveDefaultValue,\n validateResponse,\n type EntityAttrsByField,\n type EvalContext,\n type FieldType,\n type FormField,\n type FormSchemaV1,\n type ValidationError,\n} from '@braedonsaunders/appkit-forms-core'\nimport { DEFAULT_LOCALE, type AppLocale } from '@braedonsaunders/appkit-i18n'\nimport {\n Alert,\n AlertDescription,\n Button,\n Checkbox,\n Input,\n Label,\n Textarea,\n cn,\n} from '@braedonsaunders/appkit-ui'\nimport { RichTextEditor } from '@braedonsaunders/appkit-editor'\nimport { readText } from './text'\nimport { AddressField, GpsField, MatrixField, RiskField, SignatureField, SketchField, TableField } from './runtime-controls'\nimport type { RiskMatrixConfig } from './risk-matrix'\n\nexport type FormValues = Record<string, unknown>\nexport type FormOption = { value: string; label: string; hint?: string }\n\nexport type FormFieldAdapterProps = {\n field: FormField\n value: unknown\n onChange: (value: unknown) => void\n error?: string\n disabled: boolean\n locale: AppLocale\n}\n\nexport type FormFieldAdapter = (props: FormFieldAdapterProps) => React.ReactNode\n\nexport type FormRendererProps = {\n schema: FormSchemaV1\n values?: FormValues\n defaultValues?: FormValues\n onChange?: (values: FormValues) => void\n onSubmit?: (values: FormValues) => void | Promise<void>\n locale?: AppLocale\n disabled?: boolean\n submitLabel?: string\n optionsByField?: Readonly<Record<string, readonly FormOption[]>>\n fieldAdapters?: Partial<Record<FieldType, FormFieldAdapter>>\n className?: string\n requestContext?: EvalContext['requestContext']\n entities?: EntityAttrsByField\n riskMatrix?: RiskMatrixConfig\n}\n\nconst ADAPTER_FIELD_TYPES = new Set<FieldType>([\n 'photo',\n 'photo_upload',\n 'photo_ai',\n 'photo_annotated',\n 'file',\n 'video',\n 'audio',\n 'lookup',\n 'data_table',\n 'metric',\n])\n\nexport function FormRenderer({\n schema,\n values: controlledValues,\n defaultValues = {},\n onChange,\n onSubmit,\n locale = DEFAULT_LOCALE,\n disabled = false,\n submitLabel = 'Submit',\n optionsByField = {},\n fieldAdapters = {},\n className,\n requestContext,\n entities = {},\n riskMatrix,\n}: FormRendererProps) {\n const initialValues = React.useMemo(\n () => applySchemaDefaults(schema, defaultValues, requestContext, entities),\n [defaultValues, entities, requestContext, schema],\n )\n const [internalValues, setInternalValues] = React.useState<FormValues>(initialValues)\n const [errors, setErrors] = React.useState<ValidationError[]>([])\n const [submitting, setSubmitting] = React.useState(false)\n const [stepIndex, setStepIndex] = React.useState(0)\n const [activeTabId, setActiveTabId] = React.useState(schema.tabs?.[0]?.id ?? '')\n const values = controlledValues ?? internalValues\n const errorMap = new Map(errors.map((error) => [error.fieldId, error.message]))\n const rows = Object.fromEntries(schema.sections.filter((section) => section.repeating).map((section) => [section.id, Array.isArray(values[section.id]) ? values[section.id] as FormValues[] : []]))\n const evalContext: EvalContext = { values, rows, entities, requestContext }\n const steps = schema.workflow?.steps ?? []\n const currentStep = steps[Math.min(stepIndex, Math.max(0, steps.length - 1))]\n const stepSections = currentStep\n ? schema.sections.filter((section) => (section.step ?? steps[0]?.key) === currentStep.key)\n : schema.sections\n const tabs = schema.tabs ?? []\n const visibleSections = tabs.length > 1 && steps.length <= 1\n ? stepSections.filter((section) => (section.tabId ?? tabs[0]?.id) === activeTabId)\n : stepSections\n\n function update(fieldId: string, next: unknown) {\n const updated = { ...values, [fieldId]: next }\n if (controlledValues === undefined) setInternalValues(updated)\n onChange?.(updated)\n if (errorMap.has(fieldId)) setErrors((current) => current.filter((error) => error.fieldId !== fieldId))\n }\n\n async function submit(event: React.FormEvent) {\n event.preventDefault()\n const nextErrors = validateResponse(schema, values, 'submit')\n setErrors(nextErrors)\n if (nextErrors.length > 0 || !onSubmit) return\n setSubmitting(true)\n try {\n await onSubmit(values)\n } finally {\n setSubmitting(false)\n }\n }\n\n function nextStep() {\n const sectionIds = new Set(stepSections.map((section) => section.id))\n const fieldIds = new Set(stepSections.flatMap((section) => section.fields.map((field) => field.id)))\n const nextErrors = validateResponse(schema, values, 'submit').filter((error) => {\n if (error.fieldId.startsWith('__section_')) return sectionIds.has(error.fieldId.slice(10))\n if (fieldIds.has(error.fieldId)) return true\n return [...sectionIds].some((sectionId) => error.fieldId.startsWith(`${sectionId}.`))\n })\n setErrors(nextErrors)\n if (nextErrors.length === 0) setStepIndex((current) => Math.min(steps.length - 1, current + 1))\n }\n\n return (\n <form onSubmit={submit} className={cn('space-y-6', className)} noValidate>\n <header className=\"space-y-1\">\n <h1 className=\"text-2xl font-semibold tracking-tight text-fg\">{readText(schema.title, locale, 'Untitled form')}</h1>\n {schema.description ? <p className=\"text-sm text-fg-muted\">{readText(schema.description, locale)}</p> : null}\n </header>\n {steps.length > 1 ? <nav aria-label=\"Form progress\" className=\"grid gap-2\" style={{ gridTemplateColumns: `repeat(${steps.length}, minmax(0, 1fr))` }}>{steps.map((step, index) => <button key={step.key} type=\"button\" onClick={() => index <= stepIndex && setStepIndex(index)} disabled={index > stepIndex} className={cn('rounded-md border px-3 py-2 text-left text-xs', index === stepIndex ? 'border-primary bg-primary-subtle text-primary' : index < stepIndex ? 'border-success bg-success-subtle text-success' : 'border-border bg-surface text-fg-muted')}><span className=\"block font-semibold\">{index + 1}. {readText(step.title, locale, step.key)}</span></button>)}</nav> : null}\n {tabs.length > 1 && steps.length <= 1 ? <div role=\"tablist\" className=\"flex gap-1 overflow-x-auto border-b border-border\">{tabs.map((tab) => <button key={tab.id} type=\"button\" role=\"tab\" aria-selected={activeTabId === tab.id} onClick={() => setActiveTabId(tab.id)} className={cn('border-b-2 px-3 py-2 text-sm font-medium', activeTabId === tab.id ? 'border-primary text-primary' : 'border-transparent text-fg-muted hover:text-fg')}>{readText(tab.title, locale, tab.id)}</button>)}</div> : null}\n {errors.length > 0 ? (\n <Alert variant=\"destructive\" role=\"alert\"><AlertDescription>Review {errors.length} field{errors.length === 1 ? '' : 's'} before submitting.</AlertDescription></Alert>\n ) : null}\n {visibleSections.map((section) => {\n const visible = !section.showIf || evaluateLogicRule(section.showIf, evalContext)\n if (!visible) return null\n if (section.repeating) {\n const rows = Array.isArray(values[section.id])\n ? (values[section.id] as FormValues[])\n : []\n return (\n <RepeatingSection\n key={section.id}\n section={section}\n rows={rows}\n onChange={(next) => update(section.id, next)}\n errorMap={errorMap}\n disabled={disabled || submitting}\n locale={locale}\n optionsByField={optionsByField}\n fieldAdapters={fieldAdapters}\n evalContext={evalContext}\n riskMatrix={riskMatrix}\n />\n )\n }\n return (\n <section key={section.id} className=\"rounded-xl border border-border bg-surface shadow-sm\">\n {(section.title || section.description) ? (\n <div className=\"border-b border-border bg-bg-subtle px-5 py-4\">\n {section.title ? <h2 className=\"font-semibold text-fg\">{readText(section.title, locale)}</h2> : null}\n {section.description ? <p className=\"mt-1 text-sm text-fg-muted\">{readText(section.description, locale)}</p> : null}\n </div>\n ) : null}\n <div className={cn('grid gap-5 p-5', section.canvas ? 'grid-cols-12 auto-rows-[40px]' : section.layout?.columns === 2 ? 'sm:grid-cols-2' : section.layout?.columns === 3 ? 'sm:grid-cols-2 lg:grid-cols-3' : section.layout?.columns === 4 ? 'sm:grid-cols-2 lg:grid-cols-4' : '')}>\n {section.fields.map((field) => {\n const fieldVisible = !field.showIf || evaluateLogicRule(field.showIf, evalContext)\n if (!fieldVisible) return null\n const canvasItem = section.canvas?.items.find((item) => item.i === field.id)\n const fieldValue = field.type === 'formula' && field.formula\n ? evaluateFormulaTree(field.formula, evalContext)\n : values[field.id]\n return (\n <div key={field.id} className={cn(!canvasItem && field.config?.width === 'full' && 'col-span-full')} style={canvasItem ? { gridColumn: `${canvasItem.x + 1} / span ${canvasItem.w}`, gridRow: `${canvasItem.y + 1} / span ${canvasItem.h}` } : undefined}><FieldControl\n field={field}\n value={fieldValue}\n onChange={(next) => update(field.id, next)}\n error={errorMap.get(field.id)}\n disabled={disabled || submitting}\n locale={locale}\n options={optionsByField[field.id] ?? []}\n adapter={fieldAdapters[field.type]}\n riskMatrix={riskMatrix}\n /></div>\n )\n })}\n </div>\n </section>\n )\n })}\n {onSubmit ? <div className=\"flex justify-between gap-2\">{steps.length > 1 && stepIndex > 0 ? <Button type=\"button\" variant=\"outline\" disabled={disabled || submitting} onClick={() => setStepIndex((current) => Math.max(0, current - 1))}>Back</Button> : <span />}{steps.length > 1 && stepIndex < steps.length - 1 ? <Button type=\"button\" disabled={disabled || submitting} onClick={nextStep}>Next</Button> : <Button type=\"submit\" disabled={disabled || submitting}>{submitting ? 'Submitting…' : submitLabel}</Button>}</div> : null}\n </form>\n )\n}\n\nfunction RepeatingSection({ section, rows, onChange, errorMap, disabled, locale, optionsByField, fieldAdapters, evalContext, riskMatrix }: {\n section: FormSchemaV1['sections'][number]\n rows: FormValues[]\n onChange: (rows: FormValues[]) => void\n errorMap: Map<string, string>\n disabled: boolean\n locale: AppLocale\n optionsByField: Readonly<Record<string, readonly FormOption[]>>\n fieldAdapters: Partial<Record<FieldType, FormFieldAdapter>>\n evalContext: EvalContext\n riskMatrix?: RiskMatrixConfig\n}) {\n const canAdd = section.maxRows === undefined || rows.length < section.maxRows\n const canRemove = rows.length > (section.minRows ?? 0)\n function patchRow(rowIndex: number, fieldId: string, value: unknown) {\n const next = rows.map((row, index) => index === rowIndex ? { ...row, [fieldId]: value } : row)\n onChange(next)\n }\n return (\n <section className=\"rounded-xl border border-border bg-surface shadow-sm\">\n <div className=\"flex items-start justify-between gap-4 border-b border-border bg-bg-subtle px-5 py-4\">\n <div>\n {section.title ? <h2 className=\"font-semibold text-fg\">{readText(section.title, locale)}</h2> : null}\n {section.description ? <p className=\"mt-1 text-sm text-fg-muted\">{readText(section.description, locale)}</p> : null}\n </div>\n <Button type=\"button\" size=\"sm\" variant=\"outline\" disabled={disabled || !canAdd} onClick={() => onChange([...rows, {}])}><Plus size={15} />Add row</Button>\n </div>\n <div className=\"space-y-4 p-5\">\n {errorMap.get(`__section_${section.id}`) ? <p className=\"text-sm text-danger\">{errorMap.get(`__section_${section.id}`)}</p> : null}\n {rows.length === 0 ? <p className=\"rounded-lg border border-dashed border-border-strong px-4 py-6 text-center text-sm text-fg-muted\">No rows yet.</p> : null}\n {rows.map((row, rowIndex) => (\n <div key={rowIndex} className=\"rounded-lg border border-border bg-bg p-4\">\n <div className=\"mb-4 flex items-center justify-between gap-3\">\n <h3 className=\"text-sm font-semibold text-fg\">{rowLabel(section.rowLabelTemplate, rowIndex, row)}</h3>\n <Button type=\"button\" size=\"icon\" variant=\"ghost\" aria-label={`Remove row ${rowIndex + 1}`} disabled={disabled || !canRemove} onClick={() => onChange(rows.filter((_, index) => index !== rowIndex))}><Trash2 size={15} /></Button>\n </div>\n <div className=\"grid gap-5 sm:grid-cols-2\">\n {section.fields.map((field) => {\n const rowContext: EvalContext = { ...evalContext, values: { ...evalContext.values, ...row } }\n const visible = !field.showIf || evaluateLogicRule(field.showIf, rowContext)\n if (!visible) return null\n const fieldValue = field.type === 'formula' && field.formula ? evaluateFormulaTree(field.formula, rowContext) : row[field.id]\n return <FieldControl key={field.id} field={field} value={fieldValue} onChange={(next) => patchRow(rowIndex, field.id, next)} error={errorMap.get(`${section.id}.${rowIndex}.${field.id}`)} disabled={disabled} locale={locale} options={optionsByField[field.id] ?? []} adapter={fieldAdapters[field.type]} riskMatrix={riskMatrix} />\n })}\n </div>\n </div>\n ))}\n </div>\n </section>\n )\n}\n\nfunction rowLabel(template: string | undefined, index: number, row: FormValues): string {\n if (!template) return `Row ${index + 1}`\n return template\n .replaceAll('{index+1}', String(index + 1))\n .replaceAll('{index}', String(index))\n .replace(/\\{([A-Za-z0-9_-]+)\\}/g, (_, key: string) => String(row[key] ?? ''))\n}\n\nfunction FieldControl({ field, value, onChange, error, disabled, locale, options, adapter, riskMatrix }: FormFieldAdapterProps & { options: readonly FormOption[]; adapter?: FormFieldAdapter; riskMatrix?: RiskMatrixConfig }) {\n if (adapter) return <div className=\"space-y-2\">{fieldLabel(field, locale)}{adapter({ field, value, onChange, error, disabled, locale })}{fieldHelp(field, locale, error)}</div>\n\n if (field.type === 'heading') return <h3 className=\"col-span-full text-lg font-semibold text-fg\">{readText(field.label, locale)}</h3>\n if (field.type === 'paragraph') return <p className=\"col-span-full text-sm text-fg-muted\">{readText(field.helpText ?? field.label, locale)}</p>\n if (field.type === 'divider') return <hr className=\"col-span-full border-border\" />\n if (field.type === 'formula') return <OutputField field={field} value={value} locale={locale} />\n const nativeProps = { field, value, onChange, disabled }\n if (field.type === 'gps') return <FieldFrame field={field} locale={locale} error={error}><GpsField {...nativeProps} /></FieldFrame>\n if (field.type === 'address') return <FieldFrame field={field} locale={locale} error={error}><AddressField {...nativeProps} /></FieldFrame>\n if (field.type === 'table') return <FieldFrame field={field} locale={locale} error={error}><TableField {...nativeProps} /></FieldFrame>\n if (field.type === 'matrix') return <FieldFrame field={field} locale={locale} error={error}><MatrixField {...nativeProps} /></FieldFrame>\n if (field.type === 'risk_matrix') return <FieldFrame field={field} locale={locale} error={error} hideLabel><RiskField {...nativeProps} matrix={riskMatrix} /></FieldFrame>\n if (field.type === 'signature') return <FieldFrame field={field} locale={locale} error={error}><SignatureField {...nativeProps} /></FieldFrame>\n if (field.type === 'sketch') return <FieldFrame field={field} locale={locale} error={error}><SketchField {...nativeProps} /></FieldFrame>\n if (ADAPTER_FIELD_TYPES.has(field.type)) throw new Error(`Form field ${field.id} (${field.type}) requires a field adapter`)\n\n const common = { id: field.id, disabled, 'aria-invalid': Boolean(error), 'aria-describedby': `${field.id}-help` } as const\n const choiceOptions = field.validation?.options?.map((option) => ({ value: option.value, label: readText(option.label, locale) })) ?? options\n\n let control: React.ReactNode\n switch (field.type) {\n case 'long_text':\n control = <Textarea {...common} value={typeof value === 'string' ? value : ''} onChange={(event) => onChange(event.target.value)} />\n break\n case 'rich_text':\n control = <RichTextEditor value={typeof value === 'string' ? value : ''} disabled={disabled} onChange={onChange} normalizeLink={safeLink} />\n break\n case 'number':\n case 'currency':\n case 'percentage':\n control = <Input {...common} type=\"number\" inputMode=\"decimal\" value={typeof value === 'number' ? value : ''} min={numberConfig(field, 'min')} max={numberConfig(field, 'max')} step={numberConfig(field, 'step') ?? (field.type === 'currency' ? 0.01 : 'any')} onChange={(event) => onChange(event.target.value === '' ? undefined : Number(event.target.value))} />\n break\n case 'slider': {\n const min = numberConfig(field, 'min') ?? 0\n const max = numberConfig(field, 'max') ?? 10\n control = <div className=\"flex items-center gap-3\"><input {...common} className=\"h-2 flex-1 accent-primary\" type=\"range\" min={min} max={max} step={numberConfig(field, 'step') ?? 1} value={typeof value === 'number' ? value : min} onChange={(event) => onChange(Number(event.target.value))} /><output className=\"w-10 text-right text-sm tabular-nums text-fg\">{typeof value === 'number' ? value : min}</output></div>\n break\n }\n case 'rating': {\n const max = numberConfig(field, 'max') ?? 5\n control = <div className=\"flex flex-wrap gap-2\">{Array.from({ length: max }, (_, index) => index + 1).map((rating) => <Button key={rating} type=\"button\" size=\"icon\" variant={value === rating ? 'default' : 'outline'} disabled={disabled} onClick={() => onChange(rating)} aria-label={`Rate ${rating} of ${max}`}>{rating}</Button>)}</div>\n break\n }\n case 'radio':\n case 'pass_fail_na':\n case 'traffic_light': {\n const items = field.type === 'pass_fail_na' ? [{ value: 'pass', label: 'Pass' }, { value: 'fail', label: 'Fail' }, { value: 'n_a', label: 'N/A' }] : field.type === 'traffic_light' ? [{ value: 'green', label: 'Green' }, { value: 'yellow', label: 'Yellow' }, { value: 'red', label: 'Red' }] : choiceOptions\n control = <div className=\"flex flex-wrap gap-2\">{items.map((option) => <Button key={option.value} type=\"button\" size=\"sm\" variant={value === option.value ? 'default' : 'outline'} disabled={disabled} onClick={() => onChange(option.value)}>{option.label}</Button>)}</div>\n break\n }\n case 'checkbox_group':\n case 'multi_select':\n case 'multi_person_picker': {\n const selected = Array.isArray(value) ? value.filter((item): item is string => typeof item === 'string') : []\n control = <div className=\"space-y-2\">{choiceOptions.map((option) => <label key={option.value} className=\"flex items-center gap-2 text-sm text-fg\"><Checkbox disabled={disabled} checked={selected.includes(option.value)} onChange={(event) => onChange(event.target.checked ? [...selected, option.value] : selected.filter((entry) => entry !== option.value))} />{option.label}</label>)}</div>\n break\n }\n case 'ranking': {\n const ordered = Array.isArray(value) && value.length > 0\n ? value.filter((item): item is string => typeof item === 'string')\n : choiceOptions.map((option) => option.value)\n control = <div className=\"space-y-1\">{ordered.map((entry, index) => { const option = choiceOptions.find((item) => item.value === entry); return <div key={entry} className=\"flex items-center gap-2 rounded-md border border-border bg-bg-subtle px-2 py-1.5\"><span className=\"w-5 text-center text-xs tabular-nums text-fg-muted\">{index + 1}</span><span className=\"min-w-0 flex-1 truncate text-sm text-fg\">{option?.label ?? entry}</span><Button type=\"button\" size=\"icon\" variant=\"ghost\" aria-label={`Move ${option?.label ?? entry} up`} disabled={disabled || index === 0} onClick={() => onChange(move(ordered, index, index - 1))}><ArrowUp size={14} /></Button><Button type=\"button\" size=\"icon\" variant=\"ghost\" aria-label={`Move ${option?.label ?? entry} down`} disabled={disabled || index === ordered.length - 1} onClick={() => onChange(move(ordered, index, index + 1))}><ArrowDown size={14} /></Button></div> })}</div>\n break\n }\n case 'select':\n case 'person_picker':\n case 'customer_picker':\n case 'project_picker':\n case 'site_picker':\n case 'area_picker':\n case 'gl_account':\n case 'party':\n control = <select {...common} className=\"h-10 w-full rounded-md border border-border bg-surface px-3 text-sm text-fg focus:border-primary focus:outline-none focus:ring-2 focus:ring-ring/40\" value={typeof value === 'string' ? value : ''} onChange={(event) => onChange(event.target.value || undefined)}><option value=\"\">Select…</option>{choiceOptions.map((option) => <option key={option.value} value={option.value}>{option.label}</option>)}</select>\n break\n case 'yes_no_comment': {\n const current = typeof value === 'object' && value !== null ? value as { answer?: string; comment?: string } : {}\n control = <div className=\"space-y-3\"><div className=\"flex gap-2\">{['yes', 'no'].map((answer) => <Button key={answer} type=\"button\" size=\"sm\" variant={current.answer === answer ? 'default' : 'outline'} disabled={disabled} onClick={() => onChange({ ...current, answer })}>{answer === 'yes' ? 'Yes' : 'No'}</Button>)}</div>{current.answer === 'no' ? <Textarea value={current.comment ?? ''} placeholder=\"Add a comment…\" disabled={disabled} onChange={(event) => onChange({ ...current, comment: event.target.value })} /> : null}</div>\n break\n }\n case 'typed_attestation': {\n const current = typeof value === 'object' && value !== null ? value as { name?: string; agreed?: boolean } : {}\n control = <div className=\"space-y-2\"><Input {...common} value={current.name ?? ''} placeholder=\"Type your full name\" onChange={(event) => onChange({ ...current, name: event.target.value })} /><label className=\"flex items-center gap-2 text-sm text-fg\"><Checkbox disabled={disabled} checked={current.agreed ?? false} onChange={(event) => onChange({ ...current, agreed: event.target.checked })} />I confirm this attestation.</label></div>\n break\n }\n default: {\n const inputType = field.type === 'email' ? 'email' : field.type === 'phone' ? 'tel' : field.type === 'url' ? 'url' : field.type === 'date' ? 'date' : field.type === 'datetime' ? 'datetime-local' : field.type === 'time' ? 'time' : 'text'\n control = <Input {...common} type={inputType} value={typeof value === 'string' ? value : ''} onChange={(event) => onChange(event.target.value)} />\n }\n }\n\n return <div className={cn('space-y-2', (field.colSpan ?? 1) > 1 && 'sm:col-span-2')}>{fieldLabel(field, locale)}{control}{fieldHelp(field, locale, error)}</div>\n}\n\nfunction FieldFrame({ field, locale, error, hideLabel = false, children }: { field: FormField; locale: AppLocale; error?: string; hideLabel?: boolean; children: React.ReactNode }) {\n return <div className={cn('space-y-2', (field.colSpan ?? 1) > 1 && 'sm:col-span-2')}>{hideLabel ? null : fieldLabel(field, locale)}{children}{fieldHelp(field, locale, error)}</div>\n}\n\nfunction fieldLabel(field: FormField, locale: AppLocale) {\n return <Label htmlFor={field.id}>{readText(field.label, locale)}{field.required || field.validation?.required ? <span className=\"ml-1 text-danger\" aria-hidden=\"true\">*</span> : null}</Label>\n}\n\nfunction fieldHelp(field: FormField, locale: AppLocale, error?: string) {\n return <p id={`${field.id}-help`} className={cn('text-xs', error ? 'text-danger' : 'text-fg-muted')}>{error ?? readText(field.helpText, locale)}</p>\n}\n\nfunction OutputField({ field, value, locale }: { field: FormField; value: unknown; locale: AppLocale }) {\n return <div className=\"space-y-2\"><Label>{readText(field.label, locale)}</Label><output className=\"block rounded-md border border-border bg-bg-subtle px-3 py-2 text-sm font-medium text-fg\">{value === undefined || value === null ? '—' : String(value)}</output></div>\n}\n\nfunction numberConfig(field: FormField, key: 'min' | 'max' | 'step'): number | undefined {\n const value = field.config?.[key]\n return typeof value === 'number' && Number.isFinite(value) ? value : undefined\n}\n\nfunction move(values: string[], from: number, to: number): string[] {\n if (to < 0 || to >= values.length) return values\n const next = [...values]\n const [item] = next.splice(from, 1)\n next.splice(to, 0, item!)\n return next\n}\n\nfunction safeLink(value: string): string | null {\n try {\n const url = new URL(value, window.location.origin)\n return ['http:', 'https:', 'mailto:'].includes(url.protocol) ? url.href : null\n } catch {\n return null\n }\n}\n\nfunction applySchemaDefaults(\n schema: FormSchemaV1,\n supplied: FormValues,\n requestContext: EvalContext['requestContext'],\n entities: EntityAttrsByField,\n): FormValues {\n const values = structuredClone(supplied)\n const rows = Object.fromEntries(\n schema.sections\n .filter((section) => section.repeating)\n .map((section) => [\n section.id,\n Array.isArray(values[section.id]) ? values[section.id] as FormValues[] : [],\n ]),\n )\n const context: EvalContext = { values, rows, entities, requestContext }\n for (const section of schema.sections) {\n if (section.repeating) continue\n for (const field of section.fields) {\n if (values[field.id] !== undefined || !field.defaultValue) continue\n const resolved = resolveDefaultValue(field.defaultValue, context)\n if (resolved !== undefined && resolved !== null) values[field.id] = resolved\n }\n }\n return values\n}\n"]}
@@ -0,0 +1,25 @@
1
+ import { type EntityKind, type FormulaExpression } from '@braedonsaunders/appkit-forms-core';
2
+ type PickerFieldDesc = {
3
+ id: string;
4
+ label: string;
5
+ kind: EntityKind;
6
+ };
7
+ export declare function FormulaBuilder({ value, allFields, repeatingSections, pickerFields, onChange, }: {
8
+ value: FormulaExpression | undefined;
9
+ allFields: {
10
+ id: string;
11
+ label: string;
12
+ }[];
13
+ repeatingSections: {
14
+ id: string;
15
+ label: string;
16
+ fields: {
17
+ id: string;
18
+ label: string;
19
+ }[];
20
+ }[];
21
+ pickerFields?: PickerFieldDesc[];
22
+ onChange: (next: FormulaExpression | undefined) => void;
23
+ }): import("react").JSX.Element;
24
+ export {};
25
+ //# sourceMappingURL=formula-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formula-builder.d.ts","sourceRoot":"","sources":["../src/formula-builder.tsx"],"names":[],"mappings":"AAsBA,OAAO,EAGL,KAAK,UAAU,EAEf,KAAK,iBAAiB,EAEvB,MAAM,oCAAoC,CAAA;AAK3C,KAAK,eAAe,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAA;AAiGtE,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,iBAAiB,GAAG,SAAS,CAAA;IACpC,SAAS,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC1C,iBAAiB,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,EAAE,CAAA;IAI3F,YAAY,CAAC,EAAE,eAAe,EAAE,CAAA;IAChC,QAAQ,EAAE,CAAC,IAAI,EAAE,iBAAiB,GAAG,SAAS,KAAK,IAAI,CAAA;CACxD,+BAuLA"}
@@ -0,0 +1,310 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useGeneratedTranslations, GeneratedValue, useGeneratedValueTranslations, } from './generated-copy.js';
4
+ import { GeneratedText } from './generated-copy.js';
5
+ // Guided builder for a FormulaExpression tree. Used by the designer's "Calc"
6
+ // tab on formula fields. Renders a small recursive editor that lets
7
+ // the user pick an operator, then either literals, field refs, repeating-row
8
+ // sums, or nested sub-expressions.
9
+ //
10
+ // The user is never asked to write JSON. A live "preview value" pane sits
11
+ // beneath the tree so the designer can sanity-check the formula against
12
+ // example data without leaving the screen.
13
+ import { useMemo, useState } from 'react';
14
+ import { Plus, Trash2 } from 'lucide-react';
15
+ import { Button, Input, Label, Select } from '@braedonsaunders/appkit-ui';
16
+ import { ENTITY_ATTRS, evaluateFormulaTree, } from '@braedonsaunders/appkit-forms-core';
17
+ import { LogicBuilder } from './logic-builder.js';
18
+ const OPS = [
19
+ // Value
20
+ { kind: 'literal', label: 'Number / text', group: 'value', description: 'Constant value' },
21
+ { kind: 'field_ref', label: 'Field value', group: 'value', description: 'Read another field' },
22
+ // Math
23
+ { kind: 'sum', label: 'Sum (a + b + …)', group: 'math', description: 'Add a list of values' },
24
+ {
25
+ kind: 'product',
26
+ label: 'Product (a × b × …)',
27
+ group: 'math',
28
+ description: 'Multiply a list of values',
29
+ },
30
+ { kind: 'subtract', label: 'Subtract (a − b)', group: 'math', description: 'a minus b' },
31
+ { kind: 'divide', label: 'Divide (a ÷ b)', group: 'math', description: 'a divided by b' },
32
+ { kind: 'min', label: 'Minimum', group: 'math', description: 'Smallest of a list' },
33
+ { kind: 'max', label: 'Maximum', group: 'math', description: 'Largest of a list' },
34
+ { kind: 'power', label: 'Power (aᵇ)', group: 'math', description: 'Raise a base to an exponent' },
35
+ {
36
+ kind: 'root',
37
+ label: 'Root (ⁿ√a)',
38
+ group: 'math',
39
+ description: 'nth root — degree 2 is a square root, 3 a cube root',
40
+ },
41
+ { kind: 'abs', label: 'Absolute value', group: 'math', description: 'Distance from zero' },
42
+ { kind: 'round', label: 'Round', group: 'math', description: 'Round to N decimal places' },
43
+ {
44
+ kind: 'floor',
45
+ label: 'Round down (floor)',
46
+ group: 'math',
47
+ description: 'Largest integer ≤ value',
48
+ },
49
+ {
50
+ kind: 'ceil',
51
+ label: 'Round up (ceil)',
52
+ group: 'math',
53
+ description: 'Smallest integer ≥ value',
54
+ },
55
+ // Section
56
+ {
57
+ kind: 'sum_section',
58
+ label: 'Sum field across rows',
59
+ group: 'section',
60
+ description: 'Sum a field across every row of a repeating section',
61
+ },
62
+ {
63
+ kind: 'count_section',
64
+ label: 'Count rows in section',
65
+ group: 'section',
66
+ description: 'How many rows in a repeating section',
67
+ },
68
+ {
69
+ kind: 'avg_section',
70
+ label: 'Average field across rows',
71
+ group: 'section',
72
+ description: 'Average a field across every row of a repeating section',
73
+ },
74
+ {
75
+ kind: 'min_section',
76
+ label: 'Minimum field across rows',
77
+ group: 'section',
78
+ description: 'Smallest value of a field across the rows',
79
+ },
80
+ {
81
+ kind: 'max_section',
82
+ label: 'Maximum field across rows',
83
+ group: 'section',
84
+ description: 'Largest value of a field across the rows',
85
+ },
86
+ // String
87
+ {
88
+ kind: 'concat',
89
+ label: 'Concatenate text',
90
+ group: 'string',
91
+ description: 'Join strings together',
92
+ },
93
+ // Conditional
94
+ { kind: 'if', label: 'If / else', group: 'cond', description: 'Branch on a condition' },
95
+ // Entity
96
+ {
97
+ kind: 'entity_attr',
98
+ label: 'Entity attribute',
99
+ group: 'entity',
100
+ description: 'Read an attribute off the entity selected by a picker field',
101
+ },
102
+ ];
103
+ export function FormulaBuilder({ value, allFields, repeatingSections, pickerFields, onChange, }) {
104
+ const tGenerated = useGeneratedTranslations();
105
+ // The preview pane lets the user fill in example values for any field /
106
+ // repeating-row field referenced in the formula and see what evaluates.
107
+ const [preview, setPreview] = useState({
108
+ values: {},
109
+ rowCounts: {},
110
+ });
111
+ const previewCtx = useMemo(() => {
112
+ const rows = {};
113
+ for (const sec of repeatingSections) {
114
+ const count = preview.rowCounts[sec.id] ?? 0;
115
+ rows[sec.id] = Array.from({ length: count }, (_, i) => {
116
+ const r = {};
117
+ for (const f of sec.fields) {
118
+ const k = `${sec.id}.${i}.${f.id}`;
119
+ const v = preview.values[k];
120
+ // Best-effort numeric coercion so sum_section preview makes sense.
121
+ if (v !== undefined && v !== '') {
122
+ const n = Number(v);
123
+ r[f.id] = Number.isFinite(n) ? n : v;
124
+ }
125
+ }
126
+ return r;
127
+ });
128
+ }
129
+ const values = {};
130
+ for (const f of allFields) {
131
+ const v = preview.values[f.id];
132
+ if (v !== undefined && v !== '') {
133
+ const n = Number(v);
134
+ values[f.id] = Number.isFinite(n) ? n : v;
135
+ }
136
+ }
137
+ return { values, rows };
138
+ }, [allFields, preview, repeatingSections]);
139
+ const previewValue = value ? evaluateFormulaTree(value, previewCtx) : null;
140
+ return (_jsxs("div", { className: "space-y-3", children: [_jsx(Node, { value: value, allFields: allFields, repeatingSections: repeatingSections, pickerFields: pickerFields ?? [], onChange: onChange, onClear: () => onChange(undefined) }), _jsxs("details", { className: "rounded-md border border-border bg-bg-subtle/50 p-2 text-xs", children: [_jsxs("summary", { className: "cursor-pointer font-semibold text-fg-muted", children: [_jsx(GeneratedText, { id: "m_07c67e89962d16" }), ' ', _jsx(GeneratedValue, { value: value ? renderPreviewValue(previewValue) : '—' })] }), _jsxs("div", { className: "mt-2 space-y-2", children: [_jsx(GeneratedValue, { value: allFields.length > 0 ? (_jsxs("div", { className: "space-y-1", children: [_jsx("div", { className: "font-semibold text-fg-muted", children: _jsx(GeneratedText, { id: "m_1e3a16a7c41097" }) }), _jsx(GeneratedValue, { value: allFields.map((f) => (_jsxs("div", { className: "flex items-center gap-1", children: [_jsx(Label, { className: "w-32 truncate text-[10px]", children: _jsx(GeneratedValue, { value: f.label }) }), _jsx(Input, { className: "h-7 flex-1 text-xs", value: preview.values[f.id] ?? '', onChange: (e) => setPreview((p) => ({
141
+ ...p,
142
+ values: { ...p.values, [f.id]: e.target.value },
143
+ })) })] }, f.id))) })] })) : null }), _jsx(GeneratedValue, { value: repeatingSections.length > 0 ? (_jsxs("div", { className: "space-y-2", children: [_jsx("div", { className: "font-semibold text-fg-muted", children: _jsx(GeneratedText, { id: "m_04b7380779afc4" }) }), _jsx(GeneratedValue, { value: repeatingSections.map((sec) => {
144
+ const rowCount = preview.rowCounts[sec.id] ?? 0;
145
+ return (_jsxs("div", { className: "rounded border border-border bg-white p-2", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("span", { className: "font-semibold", children: _jsx(GeneratedValue, { value: sec.label }) }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("button", { type: "button", className: "rounded border border-border px-1.5 py-0.5", onClick: () => setPreview((p) => ({
146
+ ...p,
147
+ rowCounts: {
148
+ ...p.rowCounts,
149
+ [sec.id]: Math.max(0, rowCount - 1),
150
+ },
151
+ })), children: "\u2212" }), _jsxs("span", { children: [_jsx(GeneratedValue, { value: rowCount }), ' ', _jsx(GeneratedText, { id: "m_19f38a950f87b6" })] }), _jsx("button", { type: "button", className: "rounded border border-border px-1.5 py-0.5", onClick: () => setPreview((p) => ({
152
+ ...p,
153
+ rowCounts: { ...p.rowCounts, [sec.id]: rowCount + 1 },
154
+ })), children: "+" })] })] }), _jsx(GeneratedValue, { value: Array.from({ length: rowCount }, (_, i) => (_jsx("div", { className: "mt-1 grid grid-cols-2 gap-1 border-t border-border-subtle pt-1", children: _jsx(GeneratedValue, { value: sec.fields.map((f) => {
155
+ const k = `${sec.id}.${i}.${f.id}`;
156
+ return (_jsx(Input, { className: "h-7 text-xs", placeholder: tGenerated('m_14dac40a7e102a', {
157
+ value0: i + 1,
158
+ value1: f.label,
159
+ }), value: preview.values[k] ?? '', onChange: (e) => setPreview((p) => ({
160
+ ...p,
161
+ values: { ...p.values, [k]: e.target.value },
162
+ })) }, f.id));
163
+ }) }) }, i))) })] }, sec.id));
164
+ }) })] })) : null })] })] })] }));
165
+ }
166
+ function renderPreviewValue(v) {
167
+ if (v === null || v === undefined)
168
+ return '—';
169
+ if (typeof v === 'number')
170
+ return Number.isFinite(v) ? String(v) : '—';
171
+ return String(v);
172
+ }
173
+ function Node({ value, allFields, repeatingSections, pickerFields, onChange, onClear, showClear = true, }) {
174
+ const tGeneratedValue = useGeneratedValueTranslations();
175
+ const tGenerated = useGeneratedTranslations();
176
+ if (!value) {
177
+ return (_jsxs(Select, { className: "h-8 text-xs", value: "", onChange: (e) => onChange(makeDefault(e.target.value)), children: [_jsx("option", { value: "", children: '— pick an operator —' }), GROUPS.map((g) => (_jsx("optgroup", { label: tGeneratedValue(g.label), children: OPS.filter((op) => op.group === g.kind).map((op) => (_jsx("option", { value: op.kind, children: op.label }, op.kind))) }, g.label)))] }));
178
+ }
179
+ return (_jsxs("div", { className: "space-y-2 rounded-md border border-border bg-white p-2", children: [_jsxs("div", { className: "flex items-center justify-between gap-1", children: [_jsx(Select, { className: "h-7 flex-1 text-xs", value: value.kind, onChange: (e) => onChange(makeDefault(e.target.value)), children: GROUPS.map((g) => (_jsx("optgroup", { label: tGeneratedValue(g.label), children: OPS.filter((op) => op.group === g.kind).map((op) => (_jsx("option", { value: op.kind, children: op.label }, op.kind))) }, g.label))) }), _jsx(GeneratedValue, { value: showClear && onClear ? (_jsx("button", { type: "button", className: "rounded p-1 text-fg-subtle hover:text-danger", onClick: onClear, title: tGenerated('m_1e4d427e74e767'), children: _jsx(Trash2, { size: 12 }) })) : null })] }), _jsx(NodeBody, { value: value, allFields: allFields, repeatingSections: repeatingSections, pickerFields: pickerFields, onChange: onChange })] }));
180
+ }
181
+ function NodeBody({ value, allFields, repeatingSections, pickerFields, onChange, }) {
182
+ switch (value.kind) {
183
+ case 'literal':
184
+ return (_jsx(Input, { className: "h-7 text-xs", value: String(value.value), onChange: (e) => {
185
+ const raw = e.target.value;
186
+ const asNum = Number(raw);
187
+ onChange({ kind: 'literal', value: raw !== '' && Number.isFinite(asNum) ? asNum : raw });
188
+ } }));
189
+ case 'field_ref':
190
+ return (_jsxs(Select, { className: "h-7 text-xs", value: value.fieldKey, onChange: (e) => onChange({ kind: 'field_ref', fieldKey: e.target.value }), children: [_jsx("option", { value: "", children: '— pick field —' }), allFields.map((f) => (_jsxs("option", { value: f.id, children: [f.label, " (", f.id, ")"] }, f.id)))] }));
191
+ case 'sum':
192
+ case 'product':
193
+ case 'min':
194
+ case 'max':
195
+ case 'concat':
196
+ return (_jsx(NodeList, { items: value.of, allFields: allFields, repeatingSections: repeatingSections, pickerFields: pickerFields, onChange: (of) => onChange({ ...value, of }), children: _jsx(GeneratedValue, { value: value.kind === 'concat' ? (_jsxs("div", { className: "flex items-center gap-1", children: [_jsx(Label, { className: "text-[10px]", children: _jsx(GeneratedText, { id: "m_09a3fb77851262" }) }), _jsx(Input, { className: "h-7 flex-1 text-xs", value: value.separator ?? '', onChange: (e) => onChange({ ...value, separator: e.target.value }) })] })) : null }) }));
197
+ case 'subtract':
198
+ case 'divide':
199
+ return (_jsxs("div", { className: "space-y-1", children: [_jsxs("div", { children: [_jsx("div", { className: "text-[10px] font-semibold text-fg-muted", children: _jsx(GeneratedText, { id: "m_146f7d831bfd96" }) }), _jsx(Node, { value: value.left, allFields: allFields, repeatingSections: repeatingSections, pickerFields: pickerFields, onChange: (next) => onChange({ ...value, left: next }), showClear: false })] }), _jsxs("div", { children: [_jsx("div", { className: "text-[10px] font-semibold text-fg-muted", children: _jsx(GeneratedText, { id: "m_0d4127eb7af91b" }) }), _jsx(Node, { value: value.right, allFields: allFields, repeatingSections: repeatingSections, pickerFields: pickerFields, onChange: (next) => onChange({ ...value, right: next }), showClear: false })] })] }));
200
+ case 'power':
201
+ case 'root': {
202
+ const isPower = value.kind === 'power';
203
+ const left = isPower ? value.base : value.of;
204
+ const right = isPower ? value.exponent : value.degree;
205
+ return (_jsxs("div", { className: "space-y-1", children: [_jsxs("div", { children: [_jsx("div", { className: "text-[10px] font-semibold text-fg-muted", children: _jsx(GeneratedValue, { value: isPower ? (_jsx(GeneratedText, { id: "m_0301e90977d549" })) : (_jsx(GeneratedText, { id: "m_1cc0e5e7b5f442" })) }) }), _jsx(Node, { value: left, allFields: allFields, repeatingSections: repeatingSections, pickerFields: pickerFields, onChange: (next) => onChange(isPower ? { ...value, base: next } : { ...value, of: next }), showClear: false })] }), _jsxs("div", { children: [_jsx("div", { className: "text-[10px] font-semibold text-fg-muted", children: _jsx(GeneratedValue, { value: isPower ? (_jsx(GeneratedText, { id: "m_1979ef2713c627" })) : (_jsx(GeneratedText, { id: "m_10f4f461b6e849" })) }) }), _jsx(Node, { value: right, allFields: allFields, repeatingSections: repeatingSections, pickerFields: pickerFields, onChange: (next) => onChange(isPower ? { ...value, exponent: next } : { ...value, degree: next }), showClear: false })] })] }));
206
+ }
207
+ case 'abs':
208
+ case 'floor':
209
+ case 'ceil':
210
+ return (_jsx(Node, { value: value.of, allFields: allFields, repeatingSections: repeatingSections, pickerFields: pickerFields, onChange: (next) => onChange({ ...value, of: next }), showClear: false }));
211
+ case 'round':
212
+ return (_jsxs("div", { className: "space-y-1", children: [_jsx(Node, { value: value.of, allFields: allFields, repeatingSections: repeatingSections, pickerFields: pickerFields, onChange: (next) => onChange({ ...value, of: next }), showClear: false }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx(Label, { className: "text-[10px]", children: _jsx(GeneratedText, { id: "m_05b9318155a4da" }) }), _jsx(Input, { type: "number", min: "0", className: "h-7 w-20 text-xs", value: String(value.places ?? 0), onChange: (e) => onChange({ ...value, places: Math.max(0, Math.floor(Number(e.target.value) || 0)) }) })] })] }));
213
+ case 'sum_section':
214
+ case 'avg_section':
215
+ case 'min_section':
216
+ case 'max_section': {
217
+ const sec = repeatingSections.find((s) => s.id === value.sectionKey);
218
+ return (_jsxs("div", { className: "space-y-1", children: [_jsxs(Select, { className: "h-7 text-xs", value: value.sectionKey, onChange: (e) => onChange({ ...value, sectionKey: e.target.value, rowFieldKey: '' }), children: [_jsx("option", { value: "", children: '— pick section —' }), repeatingSections.map((s) => (_jsx("option", { value: s.id, children: s.label }, s.id)))] }), _jsxs(Select, { className: "h-7 text-xs", value: value.rowFieldKey, onChange: (e) => onChange({ ...value, rowFieldKey: e.target.value }), disabled: !sec, children: [_jsx("option", { value: "", children: '— pick row field —' }), sec?.fields.map((f) => (_jsx("option", { value: f.id, children: f.label }, f.id)))] })] }));
219
+ }
220
+ case 'count_section':
221
+ return (_jsxs(Select, { className: "h-7 text-xs", value: value.sectionKey, onChange: (e) => onChange({ ...value, sectionKey: e.target.value }), children: [_jsx("option", { value: "", children: '— pick section —' }), repeatingSections.map((s) => (_jsx("option", { value: s.id, children: s.label }, s.id)))] }));
222
+ case 'if':
223
+ return (_jsxs("div", { className: "space-y-2", children: [_jsxs("div", { children: [_jsx("div", { className: "text-[10px] font-semibold text-fg-muted", children: _jsx(GeneratedText, { id: "m_0c75ca758719d2" }) }), _jsx(LogicBuilder, { rule: value.condition, availableFields: allFields, onChange: (rule) => onChange({ ...value, condition: rule ?? ALWAYS_TRUE }) })] }), _jsxs("div", { children: [_jsx("div", { className: "text-[10px] font-semibold text-fg-muted", children: _jsx(GeneratedText, { id: "m_1aea6765cbbb07" }) }), _jsx(Node, { value: value.then, allFields: allFields, repeatingSections: repeatingSections, pickerFields: pickerFields, onChange: (next) => onChange({ ...value, then: next }), showClear: false })] }), _jsxs("div", { children: [_jsx("div", { className: "text-[10px] font-semibold text-fg-muted", children: _jsx(GeneratedText, { id: "m_196f872aa354d3" }) }), _jsx(Node, { value: value.else, allFields: allFields, repeatingSections: repeatingSections, pickerFields: pickerFields, onChange: (next) => onChange({ ...value, else: next }), showClear: false })] })] }));
224
+ case 'entity_attr': {
225
+ // 2-step picker: choose a picker field, then choose an attribute from
226
+ // its kind's ENTITY_ATTRS list. The available attrs change when the
227
+ // picker selection changes, so we reset attrKey whenever the picker
228
+ // does — keeps designers from accidentally bouncing an attr off a
229
+ // mismatched kind.
230
+ const picker = pickerFields.find((p) => p.id === value.pickerFieldKey);
231
+ const attrs = picker ? ENTITY_ATTRS[picker.kind] : [];
232
+ return (_jsxs("div", { className: "space-y-1", children: [_jsx(GeneratedValue, { value: pickerFields.length === 0 ? (_jsx("p", { className: "text-[10px] text-fg-muted italic", children: _jsx(GeneratedText, { id: "m_15ca343c0669d7" }) })) : (_jsxs(Select, { className: "h-7 text-xs", value: value.pickerFieldKey, onChange: (e) => onChange({
233
+ kind: 'entity_attr',
234
+ pickerFieldKey: e.target.value,
235
+ attrKey: '',
236
+ }), children: [_jsx("option", { value: "", children: '— pick picker field —' }), pickerFields.map((p) => (_jsxs("option", { value: p.id, children: [p.label, " (", p.kind, ")"] }, p.id)))] })) }), _jsxs(Select, { className: "h-7 text-xs", value: value.attrKey, onChange: (e) => onChange({ ...value, attrKey: e.target.value }), disabled: !picker, children: [_jsx("option", { value: "", children: '— pick attribute —' }), attrs.map((a) => (_jsx("option", { value: a.key, children: a.label }, a.key)))] })] }));
237
+ }
238
+ }
239
+ }
240
+ function NodeList({ items, allFields, repeatingSections, pickerFields, onChange, children, }) {
241
+ return (_jsxs("div", { className: "space-y-1.5", children: [_jsx(GeneratedValue, { value: children }), _jsx(GeneratedValue, { value: items.map((it, i) => (_jsx("div", { className: "rounded border border-border-subtle bg-bg-subtle p-1", children: _jsx(Node, { value: it, allFields: allFields, repeatingSections: repeatingSections, pickerFields: pickerFields, onChange: (next) => onChange(items.map((x, j) => (j === i ? next : x))), onClear: () => onChange(items.filter((_, j) => j !== i)) }) }, i))) }), _jsxs(Button, { size: "sm", variant: "outline", onClick: () => onChange([...items, { kind: 'literal', value: 0 }]), children: [_jsx(Plus, { size: 12 }), " ", _jsx(GeneratedText, { id: "m_068bf7c4eb45a2" })] })] }));
242
+ }
243
+ const GROUPS = [
244
+ { kind: 'value', label: 'Value' },
245
+ { kind: 'math', label: 'Math' },
246
+ { kind: 'section', label: 'Repeating section' },
247
+ { kind: 'string', label: 'Text' },
248
+ { kind: 'cond', label: 'Conditional' },
249
+ { kind: 'entity', label: 'Entity attribute' },
250
+ ];
251
+ // An empty conjunction is true and does not require an invented field id, so
252
+ // fresh conditional formulas remain valid under schema reference checks.
253
+ const ALWAYS_TRUE = { op: 'and', rules: [] };
254
+ function makeDefault(kind) {
255
+ switch (kind) {
256
+ case 'literal':
257
+ return { kind: 'literal', value: 0 };
258
+ case 'field_ref':
259
+ return { kind: 'field_ref', fieldKey: '' };
260
+ case 'sum':
261
+ case 'product':
262
+ case 'min':
263
+ case 'max':
264
+ return { kind, of: [{ kind: 'literal', value: 0 }] };
265
+ case 'subtract':
266
+ case 'divide':
267
+ return {
268
+ kind,
269
+ left: { kind: 'literal', value: 0 },
270
+ right: { kind: 'literal', value: 1 },
271
+ };
272
+ case 'power':
273
+ return {
274
+ kind: 'power',
275
+ base: { kind: 'literal', value: 0 },
276
+ exponent: { kind: 'literal', value: 2 },
277
+ };
278
+ case 'root':
279
+ return {
280
+ kind: 'root',
281
+ of: { kind: 'literal', value: 0 },
282
+ degree: { kind: 'literal', value: 2 },
283
+ };
284
+ case 'abs':
285
+ case 'floor':
286
+ case 'ceil':
287
+ return { kind, of: { kind: 'literal', value: 0 } };
288
+ case 'round':
289
+ return { kind: 'round', of: { kind: 'literal', value: 0 }, places: 0 };
290
+ case 'sum_section':
291
+ case 'avg_section':
292
+ case 'min_section':
293
+ case 'max_section':
294
+ return { kind, sectionKey: '', rowFieldKey: '' };
295
+ case 'count_section':
296
+ return { kind: 'count_section', sectionKey: '' };
297
+ case 'concat':
298
+ return { kind: 'concat', of: [{ kind: 'literal', value: '' }], separator: '' };
299
+ case 'if':
300
+ return {
301
+ kind: 'if',
302
+ condition: ALWAYS_TRUE,
303
+ then: { kind: 'literal', value: 0 },
304
+ else: { kind: 'literal', value: 0 },
305
+ };
306
+ case 'entity_attr':
307
+ return { kind: 'entity_attr', pickerFieldKey: '', attrKey: '' };
308
+ }
309
+ }
310
+ //# sourceMappingURL=formula-builder.js.map