Skip to content

Commit 5743653

Browse files
committed
Added LinearProgress which already existed in Python
1 parent d471dfe commit 5743653

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

chartlets.js/CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
- using `schema` instead of `type` property for callback arguments
3838
- using `return` object with `schema` property for callback return values
3939

40+
* New components
41+
- `LinearProgress`
4042

4143
## Version 0.0.29 (from 2024/11/26)
4244

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { describe, it, expect } from "vitest";
2+
import { render, screen } from "@testing-library/react";
3+
import { LinearProgress } from "./LinearProgress";
4+
5+
describe("LinearProgress", () => {
6+
it("should render the LinearProgress component", () => {
7+
render(
8+
<LinearProgress
9+
type="LinearProgress"
10+
id="cp"
11+
value={75}
12+
onChange={() => {}}
13+
/>,
14+
);
15+
// to inspect rendered component, do:
16+
// expect(document.querySelector("#cp")).toEqual({});
17+
expect(screen.getByRole("progressbar")).not.toBeUndefined();
18+
});
19+
});
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import MuiLinearProgress from "@mui/material/LinearProgress";
2+
3+
import type { ComponentState, ComponentProps } from "@/index";
4+
5+
interface LinearProgressState extends ComponentState {
6+
value?: number;
7+
valueBuffer?: number;
8+
variant?: "determinate" | "indeterminate" | "buffer" | "query";
9+
}
10+
11+
interface LinearProgressProps extends ComponentProps, LinearProgressState {}
12+
13+
export function LinearProgress({
14+
id,
15+
style,
16+
value,
17+
variant,
18+
}: LinearProgressProps) {
19+
return (
20+
<MuiLinearProgress id={id} style={style} value={value} variant={variant} />
21+
);
22+
}

0 commit comments

Comments
 (0)