Skip to content

Commit 8f121bb

Browse files
authored
Merge pull request #126 from bcdev/clarasb-xxx-typography_component
Add text and color parameter to Typography component
2 parents a9c1391 + ca279fa commit 8f121bb

File tree

6 files changed

+28
-12
lines changed

6 files changed

+28
-12
lines changed

chartlets.js/CHANGES.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
* Omitted multiple VegaTheme options. While using `react-vega` v7 the
88
vegaTheme needs to be restricted to: "dark" | "excel" | "ggplot2" |
99
"quartz" | "vox" | "default" | "system" | undefined .
10-
10+
11+
* Typology component now allows color and text arguments.
12+
If a user uses text and children, the text argument replaces the
13+
children.
14+
1115
## Version 0.1.6 (from 2025/06/18)
1216

1317
* Implemented dynamic resizing for Vega Charts when the side panel's

chartlets.js/packages/lib/src/plugins/mui/Typography.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ interface TypographyState extends ComponentState {
99
gutterBottom?: boolean;
1010
noWrap?: boolean;
1111
variant?: TypographyVariant;
12+
text?: string;
13+
color?: string;
1214
}
1315

1416
interface TypographyProps extends ComponentProps, TypographyState {}
@@ -20,9 +22,13 @@ export const Typography = ({
2022
gutterBottom,
2123
noWrap,
2224
variant,
25+
text,
26+
color,
2327
children: nodes,
2428
onChange,
2529
}: TypographyProps) => {
30+
nodes = text ? [text] : nodes;
31+
2632
return (
2733
<MuiTypography
2834
id={id}
@@ -31,6 +37,7 @@ export const Typography = ({
3137
gutterBottom={gutterBottom}
3238
noWrap={noWrap}
3339
variant={variant}
40+
color={color}
3441
>
3542
<Children nodes={nodes} onChange={onChange} />
3643
</MuiTypography>

chartlets.py/CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## Version 0.1.7 (in development)
2+
3+
* Updated dependencies
4+
- `altair>=5.5.0,<6.0.0`
5+
16
## Version 0.1.6 (from 2025/06/18)
27

38
* **Chore:**: Version bump in `chartlets.py` to align with `chartlets.js` release.

chartlets.py/demo/my_extension/my_panel_5.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def render_panel(
3939
ariaDescribedBy="dialog-description",
4040
)
4141

42-
info_text = Typography(id="info_text")
42+
info_text = Typography(id="info_text", color="grey")
4343

4444
return Box(
4545
style={
@@ -63,17 +63,17 @@ def dialog_on_open(ctx: Context, button) -> bool:
6363
@panel.callback(
6464
Input("okay_button", "clicked"),
6565
Output("dialog", "open"),
66-
Output("info_text", "children"),
66+
Output("info_text", "text"),
6767
)
68-
def dialog_on_close(ctx: Context, button) -> tuple[bool, list[str]]:
69-
return False, ["Okay button was clicked!"]
68+
def dialog_on_close(ctx: Context, button) -> tuple[bool, str]:
69+
return False, "Okay button was clicked!"
7070

7171

7272
# noinspection PyUnusedLocal
7373
@panel.callback(
7474
Input("not_okay_button", "clicked"),
7575
Output("dialog", "open"),
76-
Output("info_text", "children"),
76+
Output("info_text", "text"),
7777
)
78-
def dialog_on_close(ctx: Context, button) -> tuple[bool, list[str]]:
79-
return False, ["Not okay button was clicked!"]
78+
def dialog_on_close(ctx: Context, button) -> tuple[bool, str]:
79+
return False, "Not okay button was clicked!"

chartlets.py/environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dependencies:
55
# Library Dependencies
66
- python >=3.10,<3.14
77
# Optional Dependencies
8-
- altair
8+
- altair>=5.5.0,<6.0.0
99
# Demo Dependencies
1010
- pandas
1111
- pyaml

chartlets.py/pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ exclude = [
4747

4848
[project.optional-dependencies]
4949
opt = [
50-
"altair",
50+
"altair>=5.5.0,<6.0.0",
5151
]
5252
dev = [
53-
"altair",
53+
"altair>=5.5.0,<6.0.0",
5454
"black",
5555
"flake8",
5656
"pytest",
@@ -67,7 +67,7 @@ doc = [
6767
"mkdocstrings-python"
6868
]
6969
demo = [
70-
"altair",
70+
"altair>=5.5.0,<6.0.0",
7171
"pyaml",
7272
"pandas",
7373
"tornado",

0 commit comments

Comments
 (0)