Pular para o conteúdo principal
Versão: main (dev) 🚧

ADR-019 — Four screen archetypes and one section container (SPA design system)

Substituída pela ADR-021. O SPA adotou o padrão de UI do Guardian (Clássico + Portal). PageShell, ListToolbar, DetailShell, FormSection, FormFooterActions e os demais componentes citados abaixo foram removidos. O texto a seguir é o registro histórico da decisão.

Date: 2026-10-06 Status: Substituída pela ADR-021 (2026-10-16) Extends: ADR-007 (SPA, shadcn/ui). Origin: ABBC Hub backport, S9 (the hub's ADR 0053, after its SPA — a copy of this one — grew three layout dialects).

Context​

The SPA had a guide on how to create screens (docs/guides/building-screens.md) but no normative rule on how a screen looks and behaves. A project derived from this template showed the cost: screens written in parallel came out with differences nobody decided. Its survey of 41 pages found, besides the cosmetic drift, listings that render a failed call as "no results", privileged actions offered with a bare <Button> to users who get 403, forms whose API refusal never reaches the fields, and entity screens whose breadcrumb stops before the record.

The template itself had the same drift on a smaller scale. Its reference screens predated the kit they were supposed to demonstrate: raw Intl with a local locale map, hand-built search boxes with setTimeout debounce, space-y-* containers, and an edit page with a hand-made header, a two-column card and the save button at the bottom of the scroll.

Decision​

The look and behaviour of a screen are normative and live in src/ITLab.Template.Next.Spa/docs/, versioned with the code they govern. A new screen follows them; a divergence is justified in the PR, or becomes an ADR when it changes the rule for everyone.

Founding choices:

  1. Four archetypes, and only four: Listing, Entity, Panel, Authentication. Every screen declares its archetype and follows its anatomy in order. A case that fits none goes to review; if it repeats, it becomes an archetype with an ADR, never by silent precedent.
  2. The filter bar is ListToolbar: compact search (SearchInput, settled by useSearchFilter) outside the popover, every other filter as a FILTER_DEFS entry in DataTableFilter, view and column controls at the trailing edge. Adding a filter is an array entry, not a hand-tuned grid.
  3. One section container for reading and editing (FormSection; DetailGrid is the same box with a <dl>). A field that is editable in one state and read-only in another makes a section alternate between a Field* and a read-only value; with two containers the section would change shape with the state.
  4. A screen about one record uses DetailShell + DetailHeader on a full-bleed route, with Save and Cancel in the fixed footer (FormFooterActions). The deciding factor is the footer: on a long form the operator never scrolls to find Save.
  5. Corollary — with tabs, the filter bar lives inside <Tabs>, between </TabsList> and <TabsContent>. That is what lets one tab offer a filter another tab's route would refuse.

The reference screens are the oracle the documents point to, so they were brought to the canon in the same change: system/users (listing with filters and cards; entity), features/orders (minimal listing; panel), system/auth/SignInPage (authentication).

Consequences​

  • Nothing here is enforced by CI. The publish pipeline runs the scaffold's pnpm test and pnpm build; neither looks at layout, element order or table/card parity. Review enforces it: the rule is written, not guaranteed.
  • The kit had to say what the documents say. ConfirmDialog disabled Cancel while pending and now keeps it enabled (labelled Close), like FormFooterActions, because the HTTP client has no timeout. Raw palette classes in the home and health screens became theme tokens; the remaining exceptions are listed in fundamentos.md.
  • docs/guides/building-screens.md stops describing layout (it contradicted the archetypes: a two-column card for the user form, StatCard, hand-made search) and keeps the wiring: slice layout, route, menu, permissions, i18n.
  • The component promotion rule applies: a local component whose name describes a generic role moves to components/itlab/ in the commit where a second slice needs it.
  • Screens outside the reference set (system/groups, system/tenants, system/client-certificates) predate the documents and are aligned as they are touched. They are not references.

Alternatives considered​

  • Standardise by review alone. It is what produced the dialects: a reviewer without a written reference compares a screen with the last one they saw.
  • Keep both section containers and document when to use each. A selection criterion is where divergence comes back: each developer reads the boundary differently.
  • Put the documents in the repository's docs/. Far from the code they govern; a PR that changes a component would no longer carry the rule in the same diff.
  • Copy the hub's documents verbatim. They name hub screens, a registrar filter and components the template does not have (FieldDocumento, a stepper). The documents were rewritten against the template's kit and screens.