fastlifeweb 0.25.0__py3-none-any.whl → 0.25.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. CHANGELOG.md +8 -0
  2. fastlife/adapters/jinjax/widget_factory/emailstr_builder.py +1 -0
  3. fastlife/adapters/jinjax/widget_factory/secretstr_builder.py +3 -4
  4. fastlife/adapters/jinjax/widgets/mfa_code.py +25 -0
  5. fastlife/adapters/jinjax/widgets/text.py +29 -2
  6. fastlife/assets/dist.css +768 -0
  7. fastlife/assets/source.css +1 -0
  8. fastlife/components/A.jinja +1 -1
  9. fastlife/components/Button.jinja +1 -1
  10. fastlife/components/Checkbox.jinja +1 -1
  11. fastlife/components/Details.jinja +1 -1
  12. fastlife/components/Form.jinja +1 -1
  13. fastlife/components/H1.jinja +1 -1
  14. fastlife/components/H2.jinja +1 -1
  15. fastlife/components/H3.jinja +1 -1
  16. fastlife/components/H4.jinja +1 -1
  17. fastlife/components/H5.jinja +1 -1
  18. fastlife/components/H6.jinja +1 -1
  19. fastlife/components/Input.jinja +23 -4
  20. fastlife/components/Label.jinja +1 -1
  21. fastlife/components/P.jinja +1 -1
  22. fastlife/components/Password.jinja +51 -0
  23. fastlife/components/Radio.jinja +3 -3
  24. fastlife/components/Select.jinja +1 -1
  25. fastlife/components/Summary.jinja +2 -2
  26. fastlife/components/Table.jinja +1 -1
  27. fastlife/components/Td.jinja +1 -1
  28. fastlife/components/Th.jinja +1 -1
  29. fastlife/components/pydantic_form/Error.jinja +9 -3
  30. fastlife/components/pydantic_form/FatalError.jinja +19 -5
  31. fastlife/service/templates.py +1 -0
  32. fastlife/template_globals.py +14 -0
  33. {fastlifeweb-0.25.0.dist-info → fastlifeweb-0.25.1.dist-info}/METADATA +1 -1
  34. {fastlifeweb-0.25.0.dist-info → fastlifeweb-0.25.1.dist-info}/RECORD +37 -33
  35. {fastlifeweb-0.25.0.dist-info → fastlifeweb-0.25.1.dist-info}/WHEEL +0 -0
  36. {fastlifeweb-0.25.0.dist-info → fastlifeweb-0.25.1.dist-info}/entry_points.txt +0 -0
  37. {fastlifeweb-0.25.0.dist-info → fastlifeweb-0.25.1.dist-info}/licenses/LICENSE +0 -0
CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 0.25.1 - Released on 2025-03-02
2
+ * Update fews JinjaX components
3
+ * New attributes on Input
4
+ * Add Password component for passwords
5
+ * Make Error and Fatal Errors class configurable
6
+ * Update pydantic_form widgets for password
7
+ * Add a widget for MFACode
8
+
1
9
  ## 0.25.0 - Released on 2025-02-18
2
10
  * Migrate CSS to tailwincss 4
3
11
 
@@ -44,4 +44,5 @@ class EmailStrBuilder(BaseWidgetBuilder[Builtins]):
44
44
  token=self.factory.token,
45
45
  value=str(value),
46
46
  error=form_errors.get(field_name),
47
+ autocomplete="email",
47
48
  )
@@ -8,7 +8,7 @@ from pydantic.fields import FieldInfo
8
8
 
9
9
  from fastlife.adapters.jinjax.widget_factory.base import BaseWidgetBuilder
10
10
  from fastlife.adapters.jinjax.widgets.base import Widget
11
- from fastlife.adapters.jinjax.widgets.text import TextWidget
11
+ from fastlife.adapters.jinjax.widgets.text import PasswordWidget
12
12
 
13
13
 
14
14
  class SecretStrBuilder(BaseWidgetBuilder[SecretStr]):
@@ -29,9 +29,8 @@ class SecretStrBuilder(BaseWidgetBuilder[SecretStr]):
29
29
  removable: bool,
30
30
  ) -> Widget[SecretStr]:
31
31
  """Build the widget."""
32
- return TextWidget(
32
+ return PasswordWidget(
33
33
  name=field_name,
34
- input_type="password",
35
34
  placeholder=str(field.examples[0]) if field and field.examples else None,
36
35
  removable=removable,
37
36
  title=field.title or "" if field else "",
@@ -42,6 +41,6 @@ class SecretStrBuilder(BaseWidgetBuilder[SecretStr]):
42
41
  else None
43
42
  ),
44
43
  token=self.factory.token,
45
- value=value.get_secret_value() if value else "",
46
44
  error=form_errors.get(field_name),
45
+ new_password="new-password" in field.metadata if field else False,
47
46
  )
@@ -0,0 +1,25 @@
1
+ from pydantic import Field
2
+
3
+ from .base import Widget
4
+
5
+
6
+ class MFACodeWidget(Widget[str]):
7
+ """
8
+ Widget for MFA code such as TOTP token.
9
+ """
10
+
11
+ template = """
12
+ <pydantic_form.Widget :widget_id="id" :removable="removable">
13
+ <div class="pt-4">
14
+ <Label :for="id">{{title}}</Label>
15
+ <pydantic_form.Error :text="error" />
16
+ <Input :name="name" type="text" :id="id" inputmode="numeric"
17
+ autocomplete="one-time-code" :autofocus="autofocus"
18
+ :aria-label="aria_label" :placeholder="placeholder" />
19
+ <pydantic_form.Hint :text="hint" />
20
+ </div>
21
+ </pydantic_form.Widget>
22
+ """
23
+
24
+ placeholder: str | None = Field(default=None)
25
+ autofocus: bool = Field(default=True)
@@ -1,6 +1,6 @@
1
1
  from collections.abc import Sequence
2
2
 
3
- from pydantic import Field
3
+ from pydantic import Field, SecretStr
4
4
 
5
5
  from fastlife.domain.model.types import Builtins
6
6
 
@@ -18,7 +18,8 @@ class TextWidget(Widget[Builtins]):
18
18
  <Label :for="id">{{title}}</Label>
19
19
  <pydantic_form.Error :text="error" />
20
20
  <Input :name="name" :value="value" :type="input_type" :id="id"
21
- :aria-label="aria_label" :placeholder="placeholder" />
21
+ :aria-label="aria_label" :placeholder="placeholder"
22
+ :autocomplete="autocomplete" />
22
23
  <pydantic_form.Hint :text="hint" />
23
24
  </div>
24
25
  </pydantic_form.Widget>
@@ -26,6 +27,32 @@ class TextWidget(Widget[Builtins]):
26
27
 
27
28
  input_type: str = Field(default="text")
28
29
  placeholder: str | None = Field(default=None)
30
+ autocomplete: str | None = Field(default=None)
31
+
32
+
33
+ class PasswordWidget(Widget[SecretStr]):
34
+ """
35
+ Widget for text like field (email, ...).
36
+ """
37
+
38
+ template = """
39
+ <pydantic_form.Widget :widget_id="id" :removable="removable">
40
+ <div class="pt-4">
41
+ <Label :for="id">{{title}}</Label>
42
+ <pydantic_form.Error :text="error" />
43
+ <Password :name="name" :type="input_type" :id="id"
44
+ autocomplete={{
45
+ {False: 'current-password', True: 'new-password'}[new_password]
46
+ }}
47
+ :aria-label="aria_label" :placeholder="placeholder" />
48
+ <pydantic_form.Hint :text="hint" />
49
+ </div>
50
+ </pydantic_form.Widget>
51
+ """
52
+
53
+ input_type: str = Field(default="password")
54
+ placeholder: str | None = Field(default=None)
55
+ new_password: bool = Field(default=False)
29
56
 
30
57
 
31
58
  class TextareaWidget(Widget[Sequence[str]]):