feat: add 13 components adapted from Oat UI

Components (.cljc + .css + tests):
- Alert (success/warning/danger/info variants)
- Badge (primary/secondary/outline/success/warning/danger)
- Card (card/card-header/card-body/card-footer)
- Accordion (collapsible with open/closed state)
- Table (headers/rows, striped/bordered variants)
- Dialog (modal with header/body/footer sections)
- Breadcrumb (nav with active item)
- Pagination (current/total with prev/next)
- Progress (value bar with color variants)
- Spinner (sm/md/lg sizes)
- Skeleton (line/box/circle/heading placeholders)
- Switch (toggle with checked/disabled states)
- Tooltip (hover text via data-tooltip attr)

CSS-only additions:
- Form elements (inputs, selects, checkboxes, radios, range, groups)
- Grid (12-column system with offsets, responsive)
- Utilities (flex, spacing, alignment, sr-only)

Also adds warning/fg-on-warning tokens to light and dark themes.
All 3 dev targets updated with full component showcase.
40 tests, 213 assertions, all passing.
This commit is contained in:
Florian Schroedl
2026-03-03 11:37:05 +01:00
parent d55e3d3a90
commit 18043cb150
47 changed files with 2556 additions and 106 deletions

31
test/ui/table_test.clj Normal file
View File

@@ -0,0 +1,31 @@
(ns ui.table-test
(:require [clojure.test :refer [deftest is testing]]
[ui.table :as table]))
(deftest table-class-list-test
(testing "default table"
(is (= ["table"] (table/table-class-list {}))))
(testing "striped variant"
(is (= ["table" "table--striped"] (table/table-class-list {:variant :striped}))))
(testing "bordered variant"
(is (= ["table" "table--bordered"] (table/table-class-list {:variant :bordered})))))
(deftest table-classes-test
(testing "space-joined output"
(is (= "table" (table/table-classes {})))
(is (= "table table--striped" (table/table-classes {:variant :striped})))))
(deftest table-component-test
(testing "renders a table with headers and rows"
(let [result (table/table {:headers ["Name" "Email"]
:rows [["Alice" "alice@example.com"]
["Bob" "bob@example.com"]]})]
;; outer div.table-wrapper
(is (= :div (first result)))
(is (= "table-wrapper" (get-in result [1 :class])))
;; table element inside
(let [tbl (nth result 2)]
(is (= :table (first tbl)))
(is (= "table" (get-in tbl [1 :class])))))))