Use element primitives instead of inline Component; add Template primitive

Add a Template() primitive for the standard <template> tag and export it. Replace
inline Component(tag_name="div"/"span"/"input"/"template") in search_select.py
and Pill with Div/Span/Input/Template; drop the private _template helper in favour
of Template at the call sites. Bare custom-styled <button>s stay on Component
(the opinionated Button() would inject unwanted classes). Document the
prefer-primitives convention in CLAUDE.md.

https://claude.ai/code/session_01XzhXvMvw42CQGc9kmin3GS
This commit is contained in:
Claude
2026-06-08 14:49:48 +00:00
committed by Lukáš Kucharczyk
parent 15bb3ce1b9
commit 79fa4bef44
5 changed files with 62 additions and 56 deletions
+2 -2
View File
@@ -71,7 +71,7 @@ class SearchSelectComponentTest(unittest.TestCase):
selected=[{"value": 7, "label": "Game A", "data": {"platform": "2"}}],
)
self.assertIn("data-pill", html)
self.assertIn('<input type="hidden" name="games" value="7">', html)
self.assertIn('<input name="games" value="7" type="hidden">', html)
self.assertIn('data-platform="2"', html)
# exactly one submitted value (the hidden input) — the search box has no
# name. The leading space avoids matching the container's data-name.
@@ -86,7 +86,7 @@ class SearchSelectComponentTest(unittest.TestCase):
self.assertNotIn("data-pill", html)
self.assertIn('value="Game A"', html)
# the value is still submitted via a lone hidden input
self.assertIn('<input type="hidden" name="games" value="7">', html)
self.assertIn('<input name="games" value="7" type="hidden">', html)
self.assertEqual(html.count(' name="games"'), 1)
def test_search_box_has_no_name(self):