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

36
test/ui/card_test.clj Normal file
View File

@@ -0,0 +1,36 @@
(ns ui.card-test
(:require [clojure.test :refer [deftest is testing]]
[ui.card :as card]))
(deftest card-class-list-test
(testing "always returns card class"
(is (= ["card"] (card/card-class-list {})))))
(deftest card-component-test
(testing "renders an article"
(let [result (card/card {} "Content")]
(is (= :article (first result)))
(is (= "card" (get-in result [1 :class])))
(is (= "Content" (nth result 2)))))
(testing "extra class gets appended"
(let [result (card/card {:class "extra"} "X")]
(is (= "card extra" (get-in result [1 :class]))))))
(deftest card-header-test
(testing "renders header"
(let [result (card/card-header {} [:h3 "Title"])]
(is (= :header (first result)))
(is (= "card-header" (get-in result [1 :class]))))))
(deftest card-body-test
(testing "renders body"
(let [result (card/card-body {} "Content")]
(is (= :div (first result)))
(is (= "card-body" (get-in result [1 :class]))))))
(deftest card-footer-test
(testing "renders footer"
(let [result (card/card-footer {} "Actions")]
(is (= :footer (first result)))
(is (= "card-footer" (get-in result [1 :class]))))))