From 71d01722060f771ecfb964bc6337603658f0b21a Mon Sep 17 00:00:00 2001 From: clarasb Date: Tue, 28 Oct 2025 17:43:40 +0100 Subject: [PATCH 1/6] add text and color parameter to Typography component --- chartlets.js/CHANGES.md | 6 ++++++ .../packages/lib/src/plugins/mui/Typography.tsx | 7 +++++++ chartlets.py/demo/my_extension/my_panel_5.py | 14 +++++++------- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/chartlets.js/CHANGES.md b/chartlets.js/CHANGES.md index 97906fdb..74008ca4 100644 --- a/chartlets.js/CHANGES.md +++ b/chartlets.js/CHANGES.md @@ -1,3 +1,9 @@ +## Version 0.1.7 (in development) + +* Typology component now allows color and text arguments. + If a user uses text and children, the text argument replaces the + children. + ## Version 0.1.6 (from 2025/06/18) * Implemented dynamic resizing for Vega Charts when the side panel's diff --git a/chartlets.js/packages/lib/src/plugins/mui/Typography.tsx b/chartlets.js/packages/lib/src/plugins/mui/Typography.tsx index 3d30bc5c..76f107c6 100644 --- a/chartlets.js/packages/lib/src/plugins/mui/Typography.tsx +++ b/chartlets.js/packages/lib/src/plugins/mui/Typography.tsx @@ -9,6 +9,8 @@ interface TypographyState extends ComponentState { gutterBottom?: boolean; noWrap?: boolean; variant?: TypographyVariant; + text?: string; + color?: string; } interface TypographyProps extends ComponentProps, TypographyState {} @@ -20,9 +22,13 @@ export const Typography = ({ gutterBottom, noWrap, variant, + text, + color, children: nodes, onChange, }: TypographyProps) => { + nodes = text ? [text] : nodes; + return ( diff --git a/chartlets.py/demo/my_extension/my_panel_5.py b/chartlets.py/demo/my_extension/my_panel_5.py index 1b0b4f58..1a6d7eb1 100644 --- a/chartlets.py/demo/my_extension/my_panel_5.py +++ b/chartlets.py/demo/my_extension/my_panel_5.py @@ -39,7 +39,7 @@ def render_panel( ariaDescribedBy="dialog-description", ) - info_text = Typography(id="info_text") + info_text = Typography(id="info_text", color="grey") return Box( style={ @@ -63,17 +63,17 @@ def dialog_on_open(ctx: Context, button) -> bool: @panel.callback( Input("okay_button", "clicked"), Output("dialog", "open"), - Output("info_text", "children"), + Output("info_text", "text"), ) -def dialog_on_close(ctx: Context, button) -> tuple[bool, list[str]]: - return False, ["Okay button was clicked!"] +def dialog_on_close(ctx: Context, button) -> tuple[bool, str]: + return False, "Okay button was clicked!" # noinspection PyUnusedLocal @panel.callback( Input("not_okay_button", "clicked"), Output("dialog", "open"), - Output("info_text", "children"), + Output("info_text", "text"), ) -def dialog_on_close(ctx: Context, button) -> tuple[bool, list[str]]: - return False, ["Not okay button was clicked!"] +def dialog_on_close(ctx: Context, button) -> tuple[bool, str]: + return False, "Not okay button was clicked!" From 32aeab6fce4936a1df85265c60c725b85d3427be Mon Sep 17 00:00:00 2001 From: clarasb Date: Thu, 13 Nov 2025 14:03:11 +0100 Subject: [PATCH 2/6] update test --- chartlets.py/tests/components/charts/vega_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chartlets.py/tests/components/charts/vega_test.py b/chartlets.py/tests/components/charts/vega_test.py index caac501b..dc75e9ee 100644 --- a/chartlets.py/tests/components/charts/vega_test.py +++ b/chartlets.py/tests/components/charts/vega_test.py @@ -32,7 +32,7 @@ def test_with_chart_prop(self): "id": "plot", "theme": "dark", "chart": { - "$schema": "https://vega.github.io/schema/vega-lite/v5.20.1.json", + "$schema": "https://vega.github.io/schema/vega-lite/v5.23.0.json", "config": { "view": {"continuousHeight": 300, "continuousWidth": 300} }, From 7ba95f9c6e0e54711b907e876a27a5bac0f436e9 Mon Sep 17 00:00:00 2001 From: clarasb Date: Thu, 13 Nov 2025 14:18:14 +0100 Subject: [PATCH 3/6] update test --- chartlets.py/tests/components/charts/vega_test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chartlets.py/tests/components/charts/vega_test.py b/chartlets.py/tests/components/charts/vega_test.py index dc75e9ee..d21b6f64 100644 --- a/chartlets.py/tests/components/charts/vega_test.py +++ b/chartlets.py/tests/components/charts/vega_test.py @@ -13,6 +13,7 @@ class VegaChartTest(make_base(VegaChart)): def test_with_chart_prop(self): + self.maxDiff = None source = pd.DataFrame( {"x": ["A", "B", "C", "D", "E"], "a": [28, 55, 43, 91, 81]} ) @@ -32,7 +33,7 @@ def test_with_chart_prop(self): "id": "plot", "theme": "dark", "chart": { - "$schema": "https://vega.github.io/schema/vega-lite/v5.23.0.json", + "$schema": "https://vega.github.io/schema/vega-lite/v5.20.1.json", "config": { "view": {"continuousHeight": 300, "continuousWidth": 300} }, From efdfe73567821ded3c9a3e815e0eb3599cbf44a2 Mon Sep 17 00:00:00 2001 From: clarasb Date: Thu, 13 Nov 2025 16:50:59 +0100 Subject: [PATCH 4/6] fix test --- chartlets.py/environment.yml | 2 +- chartlets.py/tests/components/charts/vega_test.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/chartlets.py/environment.yml b/chartlets.py/environment.yml index 5969485d..0e743d64 100644 --- a/chartlets.py/environment.yml +++ b/chartlets.py/environment.yml @@ -5,7 +5,7 @@ dependencies: # Library Dependencies - python >=3.10,<3.14 # Optional Dependencies - - altair + - altair>=5.5.0,<6.0.0 # Demo Dependencies - pandas - pyaml diff --git a/chartlets.py/tests/components/charts/vega_test.py b/chartlets.py/tests/components/charts/vega_test.py index d21b6f64..caac501b 100644 --- a/chartlets.py/tests/components/charts/vega_test.py +++ b/chartlets.py/tests/components/charts/vega_test.py @@ -13,7 +13,6 @@ class VegaChartTest(make_base(VegaChart)): def test_with_chart_prop(self): - self.maxDiff = None source = pd.DataFrame( {"x": ["A", "B", "C", "D", "E"], "a": [28, 55, 43, 91, 81]} ) From b934847e628651dbc7f9183966f8aff68875c576 Mon Sep 17 00:00:00 2001 From: clarasb Date: Thu, 13 Nov 2025 17:00:49 +0100 Subject: [PATCH 5/6] fix test --- chartlets.py/pyproject.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chartlets.py/pyproject.toml b/chartlets.py/pyproject.toml index e4688338..f99a7165 100644 --- a/chartlets.py/pyproject.toml +++ b/chartlets.py/pyproject.toml @@ -47,10 +47,10 @@ exclude = [ [project.optional-dependencies] opt = [ - "altair", + "altair>=5.5.0,<6.0.0", ] dev = [ - "altair", + "altair>=5.5.0,<6.0.0", "black", "flake8", "pytest", @@ -67,7 +67,7 @@ doc = [ "mkdocstrings-python" ] demo = [ - "altair", + "altair>=5.5.0,<6.0.0", "pyaml", "pandas", "tornado", From ca279fa886083dfa36afb038d09b924b74715166 Mon Sep 17 00:00:00 2001 From: clarasb Date: Thu, 13 Nov 2025 17:08:45 +0100 Subject: [PATCH 6/6] update CHANGES.md --- chartlets.py/CHANGES.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/chartlets.py/CHANGES.md b/chartlets.py/CHANGES.md index 9400510c..1bee5a9c 100644 --- a/chartlets.py/CHANGES.md +++ b/chartlets.py/CHANGES.md @@ -1,3 +1,8 @@ +## Version 0.1.7 (in development) + +* Updated dependencies + - `altair>=5.5.0,<6.0.0` + ## Version 0.1.6 (from 2025/06/18) * **Chore:**: Version bump in `chartlets.py` to align with `chartlets.js` release.