ecodev-front 0.0.44__tar.gz → 0.0.45__tar.gz

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 (30) hide show
  1. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/PKG-INFO +1 -1
  2. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/card.py +10 -12
  3. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/data_table.py +5 -8
  4. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/display_utils.py +1 -3
  5. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/divider.py +4 -3
  6. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/footer.py +9 -12
  7. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/group.py +2 -2
  8. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/ids.py +4 -0
  9. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/navlink.py +4 -3
  10. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/pie_chart.py +6 -10
  11. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/report_value.py +6 -6
  12. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/search_bar.py +1 -4
  13. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/segment_control.py +4 -7
  14. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/select.py +8 -11
  15. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/stack.py +2 -3
  16. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/tabs.py +1 -3
  17. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/text.py +3 -0
  18. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/upload_box.py +1 -4
  19. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/pyproject.toml +1 -1
  20. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/LICENSE.md +0 -0
  21. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/README.md +0 -0
  22. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/__init__.py +0 -0
  23. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/app_layout.py +0 -0
  24. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/constants.py +0 -0
  25. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/div.py +0 -0
  26. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/graph.py +0 -0
  27. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/login.py +0 -0
  28. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/nav_header.py +0 -0
  29. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/nav_items.py +0 -0
  30. {ecodev_front-0.0.44 → ecodev_front-0.0.45}/ecodev_front/stepper.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ecodev-front
3
- Version: 0.0.44
3
+ Version: 0.0.45
4
4
  Summary: Dash component helpers
5
5
  License: MIT
6
6
  Author: Amaury Salles
@@ -1,10 +1,7 @@
1
1
  """
2
2
  Components to create standardised card across apps.
3
3
  """
4
- from typing import Dict
5
- from typing import List
6
- from typing import Optional
7
- from typing import Union
4
+ from typing import Any
8
5
 
9
6
  import dash_mantine_components as dmc
10
7
  from dash import html
@@ -15,9 +12,10 @@ DEFAULT_STYLE = {
15
12
  'justifyContent': 'center'}
16
13
 
17
14
 
18
- def background_card(children: List[Union[dmc.CardSection, html.Div]],
19
- style: Optional[Dict[str, str]] = None,
20
- className: str = '', card_id: Optional[str] = ''
15
+ def background_card(children: list[dmc.CardSection | html.Div],
16
+ style: dict[str, str] | None = None,
17
+ className: str = '',
18
+ card_id: str = ''
21
19
  ) -> dmc.Card:
22
20
  """
23
21
  Returns a formatted dmc.Card
@@ -28,7 +26,7 @@ def background_card(children: List[Union[dmc.CardSection, html.Div]],
28
26
 
29
27
  def card_title(title: str,
30
28
  size: int = 16,
31
- title_id: Optional[str] = '',
29
+ title_id: str = '',
32
30
  color: str = 'white',
33
31
  font: str = 'Averta',
34
32
  align: str = 'left',
@@ -41,7 +39,7 @@ def card_title(title: str,
41
39
  bg=background_color, p=10))
42
40
 
43
41
 
44
- def card_section(children: Union[html.Div, dmc.Text], graph: bool = False) -> dmc.CardSection:
42
+ def card_section(children: Any, graph: bool = False) -> dmc.CardSection:
45
43
  """
46
44
  Returns a formatted dmc.CardSection from passed dmc.Text
47
45
  """
@@ -50,8 +48,8 @@ def card_section(children: Union[html.Div, dmc.Text], graph: bool = False) -> dm
50
48
  style={'height': '100%', 'width': '100%'} if graph else {})
51
49
 
52
50
 
53
- def macro_info(text: Union[str, float], color: str = '#A0AEC0', size: int = 32,
54
- text_id: Optional[str] = '') -> dmc.Text:
51
+ def macro_info(text: str | float, color: str = '#A0AEC0', size: int = 32,
52
+ text_id: str = '') -> dmc.Text:
55
53
  """
56
54
  Returns a formatted dmc.Text element from a string
57
55
  """
@@ -59,7 +57,7 @@ def macro_info(text: Union[str, float], color: str = '#A0AEC0', size: int = 32,
59
57
 
60
58
 
61
59
  def kpi(icon: str, text: str,
62
- tooltip: Optional[str] = None,
60
+ tooltip: str | None = None,
63
61
  c: str = '#A0AEC0', fz: int = 24,
64
62
  fw: int = 700) -> dmc.Card:
65
63
  """
@@ -2,9 +2,6 @@
2
2
  Module implementing a generic Dash AG Grid table
3
3
  """
4
4
  from typing import Any
5
- from typing import Dict
6
- from typing import List
7
- from typing import Union
8
5
 
9
6
  import dash_ag_grid as dag
10
7
  from pydantic_settings import BaseSettings
@@ -34,12 +31,12 @@ DAG_ENTERPRISE_AUTH = DashAgGridEnterprise()
34
31
 
35
32
  def data_table(id: str,
36
33
  df,
37
- column_defs: Union[List[Dict[Any, Any]], None] = None,
38
- default_col_def: Union[Dict, None] = None,
39
- style: Union[Dict, None] = None,
34
+ column_defs: list[dict[Any, Any]] | None = None,
35
+ default_col_def: dict | None = None,
36
+ style: dict | None = None,
40
37
  row_alternating_color='#f5f5f5',
41
- row_style: Union[Dict, None] = None,
42
- dash_grid_options: Union[Dict, None] = None
38
+ row_style: dict | None = None,
39
+ dash_grid_options: dict | None = None
43
40
  ) -> dag.AgGrid:
44
41
  """
45
42
  Generic Dash AG Grid table
@@ -3,8 +3,6 @@ Component helpers to ease display of data to be presented.
3
3
  """
4
4
  from math import floor
5
5
  from math import log
6
- from typing import Tuple
7
- from typing import Union
8
6
 
9
7
  from ecodev_front.constants import BILLION
10
8
  from ecodev_front.constants import MILLION
@@ -22,7 +20,7 @@ def number_formatting(number: float, decimals: int = 0) -> str:
22
20
  return f'%.{decimals}f %s' % (number / k ** magnitude, units[magnitude])
23
21
 
24
22
 
25
- def get_magnitude(number: Union[int, float]) -> Tuple[object, str]:
23
+ def get_magnitude(number: int | float) -> tuple[object, str]:
26
24
  """
27
25
  Returns the metric to divide by and the unit
28
26
  """
@@ -1,11 +1,12 @@
1
- from typing import Union
2
-
1
+ """
2
+ File containing a page divider
3
+ """
3
4
  import dash_mantine_components as dmc
4
5
 
5
6
 
6
7
  def divider(orientation: str = 'horizontal',
7
8
  margin: int = 10,
8
- w: Union[str, int] = '') -> dmc.Divider:
9
+ w: str | int = '') -> dmc.Divider:
9
10
  """
10
11
  Renders a divider
11
12
  """
@@ -1,29 +1,26 @@
1
1
  """
2
2
  Module containing the app footer component style
3
3
  """
4
- from typing import Dict
5
- from typing import Union
6
-
7
4
  from dash import html
8
5
 
9
6
  from ecodev_front.ids import FOOTER_ID
10
7
 
11
8
 
12
- def app_footer(
13
- children: html.Div,
14
- color: str = '#0066A1',
15
- height: str = '4vh',
16
- display: str = 'flex',
17
- ) -> html.Div:
9
+ def app_footer(children: html.Div,
10
+ color: str = '#0066A1',
11
+ height: str = '4vh',
12
+ display: str = 'flex',
13
+ ) -> html.Div:
18
14
  """
19
15
  Main app footer
20
16
  """
21
17
  return html.Div(children, id=FOOTER_ID, style=footer_style(color, height, display))
22
18
 
23
19
 
24
- def footer_style(
25
- color: str = '#0066A1', height: str = '5vh', display: str = 'flex'
26
- ) -> Dict[str, Union[str, int]]:
20
+ def footer_style(color: str = '#0066A1',
21
+ height: str = '5vh',
22
+ display: str = 'flex'
23
+ ) -> dict[str, str | int]:
27
24
  """
28
25
  Main app footer style
29
26
  """
@@ -1,12 +1,12 @@
1
1
  """
2
2
  Module to render dmc.Group elements
3
3
  """
4
- from typing import List
4
+ from typing import Any
5
5
 
6
6
  import dash_mantine_components as dmc
7
7
 
8
8
 
9
- def group(children: List,
9
+ def group(children: list[Any],
10
10
  grow: bool = True,
11
11
  id: str = '',
12
12
  justify: str = 'space-around') -> dmc.Group:
@@ -1,3 +1,7 @@
1
+ """
2
+ File containing component IDs, to use in callbacks
3
+ """
4
+
1
5
  URL = 'url'
2
6
  TOKEN = 'token'
3
7
  NAVBAR_ID = 'navbar-id'
@@ -1,12 +1,13 @@
1
- from typing import Optional
2
-
1
+ """
2
+ File containg a navigation link component
3
+ """
3
4
  import dash_mantine_components as dmc
4
5
  from dash_iconify import DashIconify
5
6
 
6
7
 
7
8
  def navlink(label: str,
8
9
  href: str,
9
- icon: Optional[str] = None) -> dmc.NavLink:
10
+ icon: str | None = None) -> dmc.NavLink:
10
11
  """
11
12
  A simple navigation link component.
12
13
  """
@@ -1,17 +1,13 @@
1
- from typing import List
2
- from typing import Optional
3
- from typing import Union
4
-
5
1
  import plotly.graph_objects as go
6
2
 
7
3
 
8
- def pie_chart(labels: List[str],
9
- values: List[Union[int, float]],
10
- customdata: Optional[List[str]] = None,
11
- hovertemplate: Optional[str] = None,
12
- colors: Optional[List[str]] = None,
4
+ def pie_chart(labels: list[str],
5
+ values: list[int | float],
6
+ customdata: list[str] | None = None,
7
+ hovertemplate: str | None = None,
8
+ colors: list[str] | None = None,
13
9
  text_threshold: float = 0.1,
14
- annotation_text: Optional[str] = None
10
+ annotation_text: str | None = None
15
11
  ):
16
12
  """
17
13
  Function to render a pie chart
@@ -1,17 +1,17 @@
1
1
  """
2
- BLA
2
+ File containing a report value component
3
3
  """
4
- from typing import Optional
5
-
6
4
  import dash_mantine_components as dmc
7
5
  from dash import html
8
6
 
9
- from ecodev_front.components.display_utils import number_formatting
7
+ from ecodev_front.display_utils import number_formatting
10
8
 
11
9
 
12
- def report_value(title: str, value: str | int, unit: Optional[str] = None) -> html.Div:
10
+ def report_value(title: str,
11
+ value: str | int,
12
+ unit: str | None = None) -> html.Div:
13
13
  """
14
- BLA
14
+ Renders a human readable (reportable) value
15
15
  """
16
16
  if isinstance(value, (int, float)):
17
17
  value = number_formatting(value)
@@ -3,9 +3,6 @@ Component to search something in databases.
3
3
 
4
4
  Note: Typically only used as the main search bar on a page.
5
5
  """
6
- from typing import Dict
7
- from typing import Union
8
-
9
6
  import dash_mantine_components as dmc
10
7
  from dash import html
11
8
  from dash_iconify import DashIconify
@@ -15,7 +12,7 @@ def search_bar(id: str,
15
12
  label: str,
16
13
  helper: str,
17
14
  helper_text_color: str = 'gray',
18
- style: Union[Dict[str, str], None] = None,
15
+ style: dict[str, str] | None = None,
19
16
  icon: str = 'quill:search',
20
17
  debounce: int = 750) -> html.Div:
21
18
  """
@@ -1,16 +1,13 @@
1
1
  """
2
2
  Module implementing segmented control
3
3
  """
4
- from typing import List
5
- from typing import Optional
6
-
7
4
  import dash_mantine_components as dmc
8
5
 
9
6
 
10
7
  def segmented_control(id: str,
11
8
  label: str,
12
- value: Optional[str] = None,
13
- data: Optional[List[str]] = []) -> dmc.SegmentedControl:
9
+ value: str | None = None,
10
+ data: list[str] | None = []) -> dmc.SegmentedControl:
14
11
  """
15
12
  Renders a dmc.SegmentedControl that allows to toggle between different values
16
13
  """
@@ -24,8 +21,8 @@ def segmented_control(id: str,
24
21
 
25
22
  def segmented_control_label(id: str,
26
23
  label: str,
27
- value: Optional[str] = None,
28
- data: Optional[List[str]] = [],
24
+ value: str | None = None,
25
+ data: list[str] | None = [],
29
26
  size: str = 'md',
30
27
  c: str = '#A0AEC0') -> dmc.Stack:
31
28
  """
@@ -2,26 +2,23 @@
2
2
  Module implementing select
3
3
  """
4
4
  from typing import Any
5
- from typing import List
6
- from typing import Optional
7
- from typing import Union
8
5
 
9
6
  import dash_mantine_components as dmc
10
7
 
11
8
 
12
- def select(select_id: str,
9
+ def select(id: str,
13
10
  label: str,
14
- value: Optional[Any] = None,
11
+ value: Any | None = None,
15
12
  persistence: bool = True,
16
13
  searchable: bool = True,
17
- w: Union[str, int] = '100%',
14
+ w: str | int = '100%',
18
15
  ) -> dmc.Select:
19
16
  """
20
17
  Renders a formatted html.Div with content at the center
21
18
  Useful to center plotly graphs
22
19
  """
23
20
  return dmc.Select(
24
- id=select_id,
21
+ id=id,
25
22
  label=label,
26
23
  value=value,
27
24
  data=[],
@@ -33,15 +30,15 @@ def select(select_id: str,
33
30
 
34
31
  def select_label(id: str,
35
32
  label: str,
36
- value: Optional[str] = None,
37
- data: Optional[List[str]] = None,
33
+ value: str | None = None,
34
+ data: list[str] | None = None,
38
35
  persistence: bool = True,
39
36
  searchable: bool = True,
40
37
  allow_deselect: bool = True,
41
38
  disabled: bool = False,
42
39
  c: str = '#A0AEC0',
43
- label_id: Optional[str] = '',
44
- stack_id: Optional[str] = '',
40
+ label_id: str | None = '',
41
+ stack_id: str | None = '',
45
42
  ) -> dmc.Stack:
46
43
  """
47
44
  Renders a select with a stylized label
@@ -2,17 +2,16 @@
2
2
  Module to render a dmc.Stack (main element of a page)
3
3
  """
4
4
  from typing import Any
5
- from typing import Optional
6
5
 
7
6
  import dash_mantine_components as dmc
8
7
 
9
8
 
10
9
  def stack(children: Any,
11
- stack_id: Optional[str] = '',
10
+ id: str | None = None,
12
11
  gap: str = 'md',
13
12
  align: str = 'stretch') -> dmc.Stack:
14
13
  """
15
14
  Renders a dmc.Stack component that encapsulates a page
16
15
  """
17
16
  return dmc.Stack(children=children, align=align, justify='flex-end', gap=gap,
18
- id=stack_id)
17
+ id=id)
@@ -1,12 +1,10 @@
1
1
  """
2
2
  Module to render the tabs element (composed of different individual dmc.Tab element)
3
3
  """
4
- from typing import List
5
-
6
4
  import dash_mantine_components as dmc
7
5
 
8
6
 
9
- def tabs(tabs_list: List[dmc.Tab], tabs_id: str, value: str) -> dmc.Tabs:
7
+ def tabs(tabs_list: list[dmc.Tab], tabs_id: str, value: str) -> dmc.Tabs:
10
8
  """
11
9
  Renders a dmc.Tabs components
12
10
  """
@@ -1,3 +1,6 @@
1
+ """
2
+ File containing formatted text components
3
+ """
1
4
  import dash_mantine_components as dmc
2
5
 
3
6
 
@@ -1,9 +1,6 @@
1
1
  """
2
2
  Component which allows document upload.
3
3
  """
4
- from typing import Dict
5
- from typing import Union
6
-
7
4
  from dash import dcc
8
5
  from dash import html
9
6
 
@@ -21,7 +18,7 @@ DEFAULT_STYLE = {'height': '30vh',
21
18
  def upload_box(id: str,
22
19
  label: str,
23
20
  multiple: bool,
24
- style: Union[Dict[str, str], None] = None
21
+ style: dict[str, str] | None = None
25
22
  ) -> dcc.Upload:
26
23
  """
27
24
  Returns an upload box
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "ecodev-front"
3
- version = "0.0.44"
3
+ version = "0.0.45"
4
4
  description = "Dash component helpers"
5
5
  authors = ["Amaury Salles <amaury.salles@gmail.com>",
6
6
  "Yoann Diep <yoann.diep@hotmail.fr>",
File without changes
File without changes