Coverage for src / lexigram / admin / ui / organisms / components.py: 82%

11 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-08-13 22:14 +0800

1"""UI Organisms Components.""" 

2 

3from __future__ import annotations 

4 

5from typing import Any 

6 

7from lexigram.admin.config import TableConfiguration 

8from lexigram.admin.ui.organisms.command_palette import CommandPalette 

9from lexigram.admin.ui.organisms.data_table import DataTable 

10from lexigram.admin.ui.organisms.sidebar import Sidebar 

11from lexigram.ui import BulkAction, Column, Form, Repeater 

12 

13 

14def page_header(title, subtitle=None, actions=None) -> Any: 

15 """Create a page header with title, subtitle, and optional actions.""" 

16 from lexigram.ui.core.base import el 

17 

18 return el( 

19 "div", 

20 el( 

21 "div", 

22 el("h1", title, class_="text-2xl font-bold text-foreground"), 

23 el("p", subtitle, class_="mt-1 text-sm text-muted-foreground") 

24 if subtitle 

25 else "", 

26 class_="flex-1 min-w-0", 

27 ), 

28 el("div", actions, class_="mt-4 flex sm:mt-0 sm:ml-4") if actions else "", 

29 class_="mb-8 md:flex md:items-center md:justify-between", 

30 ) 

31 

32 

33__all__ = [ 

34 "BulkAction", 

35 "Column", 

36 "CommandPalette", 

37 "DataTable", 

38 "Form", 

39 "Repeater", 

40 "Sidebar", 

41 "TableConfiguration", 

42 "page_header", 

43]