From f16c52d70b2b84282a4fb36b52514b0928d46add Mon Sep 17 00:00:00 2001 From: Bryce Date: Mon, 29 Jun 2026 22:23:57 -0700 Subject: [PATCH] refactor(ssr): shared component partials own their CSS classes Bake the Tailwind class base into the shared Selmer component partials so the partials own their markup and callers pass only data + a small variant (width / size / color). Applies across all four modals that share them (bulk-code, invoices, sales-summaries, transaction-edit). - typeahead / select / location-select / money-input / validated-field / button / a-button / a-icon-button: the class base, the validated-field has-error toggle, and the button color ladders now live in the .html. The sc/*-ctx fns pass width / variant / extra / color plus the non-class attrs (computed exactly as before, so every non-class attribute is unchanged). - bulk-code templates updated to the new partial contracts; account-row pulls money-input and a-icon-button in via includes. Verified: every component's class SET is identical to before across all variants (14/14 oracle match -- buttons reorder/dedupe classes, CSS is order-independent); bulk-code full render is DOM-equivalent to the pre-sweep baseline (class-set + attr-order normalized) for empty / populated / error; browser QA of bulk-code (full flow) and transaction-edit (open + render) clean, no JS errors; invoices + sales-summaries compile and render through the same sc/* fns. Co-Authored-By: Claude Opus 4.8 --- resources/templates/components/a-button.html | 2 +- .../templates/components/a-icon-button.html | 2 +- resources/templates/components/button.html | 2 +- .../templates/components/location-select.html | 2 +- .../templates/components/money-input.html | 6 +- resources/templates/components/select.html | 2 +- resources/templates/components/typeahead.html | 4 +- .../templates/components/validated-field.html | 10 +- .../transaction-bulk-code/account-grid.html | 2 +- .../transaction-bulk-code/account-row.html | 8 +- .../templates/transaction-bulk-code/body.html | 4 +- .../transaction-bulk-code/footer.html | 2 +- src/clj/auto_ap/ssr/components/selmer.clj | 97 ++++++++----------- src/clj/auto_ap/ssr/transaction/bulk_code.clj | 9 +- src/clj/auto_ap/ssr/transaction/edit.clj | 5 +- 15 files changed, 69 insertions(+), 88 deletions(-) diff --git a/resources/templates/components/a-button.html b/resources/templates/components/a-button.html index 60387939..0c7f9dc7 100644 --- a/resources/templates/components/a-button.html +++ b/resources/templates/components/a-button.html @@ -1,4 +1,4 @@ - + {% if indicator %}
{% include "templates/components/spinner.html" %} diff --git a/resources/templates/components/a-icon-button.html b/resources/templates/components/a-icon-button.html index 051b9dd2..0c9f6e55 100644 --- a/resources/templates/components/a-icon-button.html +++ b/resources/templates/components/a-icon-button.html @@ -1,3 +1,3 @@ - +
{{ body|safe }}
diff --git a/resources/templates/components/button.html b/resources/templates/components/button.html index 0fd392c8..a71c47f7 100644 --- a/resources/templates/components/button.html +++ b/resources/templates/components/button.html @@ -1,4 +1,4 @@ -