Skip to content

@javaabu/forms v1.0: UI-agnostic core, Onu and shadcn adapters, Inertia and Wayfinder - #19

Open
n4ff4h wants to merge 18 commits into
mainfrom
next-gen
Open

n4ff4h wants to merge 18 commits into
mainfrom
next-gen

Conversation

@n4ff4h

@n4ff4h n4ff4h commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

@javaabu/forms v1.0 (next-gen)

This reworks v0 @javaabu/react-forms into @javaabu/forms: the React version of javaabu/forms, with a core that works with any UI framework. Epic: #17.

What changed

  • Rename and build. @javaabu/forms ships ESM, CJS and .d.ts, with one module per file, all "use client". A prepare script lets dependents install it from github:Javaabu/react-forms#next-gen.
  • Core and adapters. src/core no longer imports Onu. Every component renders through adapter slots, which are typed in src/core/adapter.ts:
    • adapters: @javaabu/forms/onu (plus /onu/editor and /onu/maps), @javaabu/forms/shadcn (createShadcnAdapter), and @javaabu/forms/html (the default)
    • a conformance kit for adapter authors, @javaabu/forms/testing
    • single components can be replaced per app or per form with components={{ Select: MySelect }}
  • Inertia. @javaabu/forms/inertia submits forms as visits and reads errors (including bags) and old input from page props. <Form form={useForm()}> binds fields to useForm() data, and inertiaLinks handles links. fetchRouter covers apps without Inertia.
  • Wayfinder. action accepts route objects, .form() variants and route functions, which are called with the form's model.
  • Binding and errors. Model binding, old input and value precedence are checked against Blade. Errors are matched by dot, bracket and array keys and come from any source. There's a new ErrorSummary, and fields get the right ARIA attributes and focus handling.
  • i18n. Strings use @javaabu/i18n with Blade's forms::strings.* keys, so apps override them in lang/vendor/forms. Generated labels go through __().
  • Dhivehi and RTL. Logical CSS (enforced by lint), Thaana typing for every adapter, and a list of Dhivehi lines that need a native speaker's review.
  • Parity with Blade. docs/parity.md is coordinated with the javaabu/forms v2 agent (Parity with javaabu/forms v2: defaults, Blade-only attributes and string keys #18).
  • Docs. Docusaurus pages, llms.txt, an API reference, an upgrade guide from 0.x, and the Laravel Boost guideline and javaabu-react-forms skill.
  • Examples. One page per integration (Onu, shadcn, HTML, Inertia and fetch, the last two against a mock Laravel endpoint). All of them were checked in headless Chromium.

Breaking changes from 0.x

These are listed in docs/upgrading.md:

  • the package name
  • ui={onu} is now needed for Onu
  • ./editor and ./maps move into the main entry
  • FormsProvider messages is gone, and string keys are snake_case
  • summary now defaults to false
  • form now means Inertia's useForm()
  • several components no longer pass Onu props through

Before merging or releasing (for you)

Checks

pnpm check (lint, format, typecheck, 204 tests, build, examples) passes locally and in CI. Coverage is about 89% of lines.

🤖 Generated with Claude Code

n4ff4h and others added 16 commits November 4, 2026 12:41
…s and CI on next-gen

Closes #2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The core (binding, old input, errors, ids, labels, value precedence, submit)
no longer imports Onu. Components render through adapter slots resolved as
FormsProvider components → ui adapter → the HTML base adapter. The Onu
adapter lives in @javaabu/forms/onu (+ /onu/editor, /onu/maps) and the v0
component tests now run through it.

Refs #3, #4

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@javaabu/forms/testing registers conformance tests for any adapter; the
HTML and Onu adapters pass them. Radios now sync their group on click so
controlled groups update together. Docs: docs/advanced-usage/adapters.md.

Closes #3, closes #4, closes #6

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Package lines use the Blade keys (forms::strings.*); app lines for the
current locale win, then the bundled en/dv lines. Generated labels go
through __(). Keys shared with javaabu/forms v2 are aligned.

Closes #11

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tests for value precedence, null old input, nested/array names, Model,
provider vs form old input, checkbox groups, radios, Select default vs
bound value, relations and date formats. Docs updated.

Closes #9

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Errors from page props, error bags, useForm, 422 responses (onSubmit or
the fetch router) and props; dot/bracket/array keys; ErrorSummary;
aria-invalid/aria-describedby; focus the first invalid field.

Closes #10

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… add pnpm check

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Route objects, .form() variants (the _method query moves into the hidden
field) and route functions called with the bound model.

Closes #8

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@javaabu/forms/inertia: a router that submits forms as Inertia visits and
reads errors (every bag) and old input from page props, plus inertiaLinks
for the Link slot. <Form form={useForm()}> binds fields to its data.
Checkbox and radio stores are seeded once with functional updates.

Closes #7

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
createShadcnAdapter() builds slots from the app's own shadcn components
(each slot only when its components are given), with the shadcn combobox
for searchable/multiple/tag/remote selects. Tested with the conformance
kit against vendored stock new-york-v4 components; example page added.
Radio groups now sync through a core registry, so Radix radios work.

Closes #5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Form summary defaults to false (general messages still show); Errors and
ErrorSummary take bag (page errors from the router too); Textarea
wysiwyg; per_page / export_title / export_options strings; previous/next
keys as in Blade v2.

Refs #12, #18

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Side arrows flip in RTL in the HTML adapter; Thaana typing and RTL are
tested with Thaana text; docs list the Dhivehi lines that need review.
The RTL lint rule matches only Tailwind values, not prose.

Closes #15

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Docusaurus docs rewritten for the adapter-based API (intro, requirements,
installation, every component page, adapters, shadcn, Inertia, Wayfinder,
Dhivehi/RTL, API reference, upgrading, migrating, parity), llms.txt with
rules and an index (kept in sync by src/docs.test.ts), AGENTS.md, README,
and resources/boost (guideline + javaabu-react-forms skill).

Tab panels stay mounted in every adapter (and accordion items in HTML and
shadcn), so fields in other tabs submit; invalid fields reveal their tab.

Closes #13, closes #14

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…verage thresholds

- examples/: Inertia and fetch pages against a mock Laravel endpoint
  (Vite middleware), so every integration has a runnable page
- Loading buttons in the HTML and shadcn adapters use aria-disabled: a
  submit button disabled during its own click doesn't submit (found by
  loading the examples in Chromium)
- shadcn adapter styles Form, DescriptionList/Item and EmptyState
- Tests for listing pages, HTML adapter widgets, MapInput and uploads;
  coverage thresholds at lines 85%

Closes #1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h Blade v2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@n4ff4h n4ff4h mentioned this pull request Nov 4, 2026
15 of 16 tasks
n4ff4h and others added 2 commits November 4, 2026 15:19
Wysiwyg, OnuWysiwyg and OnuMap get explicit return types and a React type
import, so declaration emit no longer reaches into node_modules/@types/react
(TS2883 when the store is under node_modules, as on GitHub Actions). A unit
test requires a React import in every .tsx module.

Refs #20

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…dules

Reproduces the setup of #20 so it can't regress.

Closes #20

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant