fix: using Enum instead of StrEnum (>=3.11 only)

This commit is contained in:
Mose Müller 2023-10-11 13:46:15 +02:00
parent 26a366842a
commit a8b14180ad
2 changed files with 4 additions and 4 deletions

View File

@ -294,7 +294,7 @@ if __name__ == "__main__":
#### `ColouredEnum`
This component provides a way to visually represent different states or categories in a data service using colour-coded options. It behaves similarly to a standard `StrEnum`, but the values encode colours in a format understood by CSS. The colours can be defined using various methods like Hexadecimal, RGB, HSL, and more.
This component provides a way to visually represent different states or categories in a data service using colour-coded options. It behaves similarly to a standard `Enum`, but the values encode colours in a format understood by CSS. The colours can be defined using various methods like Hexadecimal, RGB, HSL, and more.
If the property associated with the `ColouredEnum` has a setter function, the keys of the enum will be rendered as a dropdown menu, allowing users to interact and select different options. Without a setter function, the selected key will simply be displayed as a coloured box with text inside, serving as a visual indicator.

View File

@ -1,11 +1,11 @@
from enum import StrEnum
from enum import Enum
class ColouredEnum(StrEnum):
class ColouredEnum(Enum):
"""
Represents a UI element that can display colour-coded text based on its value.
This class extends the standard StrEnum but requires its values to be valid CSS
This class extends the standard Enum but requires its values to be valid CSS
colour codes. Supported colour formats include:
- Hexadecimal colours
- Hexadecimal colours with transparency