Coverage for src / lexigram / ui / molecules / loading_overlay.py: 100%
12 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-10 04:11 +0800
« prev ^ index » next coverage.py v7.13.5, created at 2026-08-10 04:11 +0800
1from __future__ import annotations
3from typing import Any
5from lexigram.ui.atoms.spinner import Spinner
6from lexigram.ui.core.base import Component, el
9class LoadingOverlay(Component):
10 """Full-screen or container loading overlay.
12 Args:
13 message: Optional loading message
14 fullscreen: Whether to cover entire screen
15 """
17 def __init__(
18 self,
19 message: str = "Loading...",
20 fullscreen: bool = True,
21 **props,
22 ) -> None:
23 super().__init__(message=message, fullscreen=fullscreen, **props)
24 self.message = message
25 self.fullscreen = fullscreen
27 def render(self) -> Any:
28 position_class = "fixed inset-0" if self.fullscreen else "absolute inset-0"
30 return el(
31 "div",
32 el(
33 "div",
34 Spinner(size="lg"),
35 el(
36 "p",
37 self.message,
38 class_="mt-4 text-sm text-muted-foreground",
39 )
40 if self.message
41 else "",
42 class_="flex flex-col items-center justify-center",
43 ),
44 class_=f"{position_class} bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center",
45 role="alert",
46 aria_live="polite",
47 )