- docs, AGENT.md, the 16 skills, PROGRAMISTA and README use the preferred names (scripted, same list of forms); past CHANGELOG entries and the proposals in docs/dev are not rewritten - AGENT.md: 'Names: IAPL and ipal-kit' — old name, new name, state in 1.x; what is not renamed; storageNames - iapl-upgrade '→ 1.17.0', PROGRAMISTA §6 item 72, CHANGELOG 1.17.0 (draft): nothing required - env.md, doctor.md (legacy-names, storage-names), stats.md, security.md, project-starter.md, iapl-reference, iapl-setup - skill scripts read ipal-audit-skip and IPAL_IP_HEADER too; audit rule ids stay what they were - reference site: iapl(), iapl-doctor.json, iapl-* skills, storageNames: 'iapl'; INDEX.md regenerated Co-Authored-By: Claude Fable 5.2 <[email protected]>
51 lines
2.4 KiB
TypeScript
51 lines
2.4 KiB
TypeScript
// Only for a form that looks or behaves unlike the default (option cards, a
|
|
// summary step, a custom field type). Same engine as BuilderForm — you write the
|
|
// markup only. Ordinary forms: RenderForm in FormBlock, no file like this.
|
|
//
|
|
// Lighter option first: <BuilderForm renderField={…}> replaces chosen fields only.
|
|
'use client'
|
|
import { honeypotInputProps, useBuilderForm, type UseBuilderFormOptions } from '@intecion/ipal-kit/client'
|
|
|
|
export function QuoteCardsForm(props: UseBuilderFormOptions) {
|
|
const f = useBuilderForm(props)
|
|
if (f.isSuccess) return <div role="status">{f.resultMessage}</div>
|
|
|
|
return (
|
|
<form onSubmit={f.submit} noValidate>
|
|
<input {...honeypotInputProps()} />
|
|
{f.total > 1 && <p aria-live="polite">{props.texts.stepOf?.replace('{current}', String(f.stepIndex + 1)).replace('{total}', String(f.total))}</p>}
|
|
|
|
{f.step.fields.map(({ field }) => {
|
|
if (!field.name) return null
|
|
if (field.blockType === 'radio') {
|
|
// options as clickable cards — still a real radio group (keyboard, screen readers)
|
|
return (
|
|
<fieldset key={field.name} id={f.fieldId(field)} aria-invalid={f.getFieldProps(field)['aria-invalid']} aria-describedby={f.getFieldProps(field)['aria-describedby']}>
|
|
<legend>{field.label}</legend>
|
|
{(field.options ?? []).map((o, i) => (
|
|
<label key={o.value} className="card">
|
|
<input {...f.getOptionProps(field, o, i)} className="sr-only" />
|
|
{o.label}
|
|
</label>
|
|
))}
|
|
{f.errors[field.name] && <p id={f.errorId(field)}>{f.errors[field.name]}</p>}
|
|
</fieldset>
|
|
)
|
|
}
|
|
return (
|
|
<div key={field.name}>
|
|
<label htmlFor={f.fieldId(field)}>{field.label}</label>
|
|
{field.blockType === 'textarea' ? <textarea {...f.getTextareaProps(field)} /> : <input {...f.getInputProps(field)} />}
|
|
{f.errors[field.name] && <p id={f.errorId(field)}>{f.errors[field.name]}</p>}
|
|
</div>
|
|
)
|
|
})}
|
|
|
|
{f.isLast && <f.TurnstileWidget />}
|
|
{f.errorMessage && <p role="alert">{f.errorMessage}</p>}
|
|
{!f.isFirst && <button type="button" onClick={f.back}>{props.texts.back}</button>}
|
|
<button type="submit" disabled={f.isSubmitting}>{f.isLast ? props.form.submitButtonLabel : props.texts.next}</button>
|
|
</form>
|
|
)
|
|
}
|