@spatika/react 1.1.0 → 1.2.0
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.
- package/AGENTS.md +71 -0
- package/README.md +4 -3
- package/dist/composites/Card.d.ts +7 -1
- package/dist/composites/Card.d.ts.map +1 -1
- package/dist/composites/Card.js +10 -0
- package/dist/composites/ChartDataGrid.d.ts +33 -0
- package/dist/composites/ChartDataGrid.d.ts.map +1 -0
- package/dist/composites/ChartDataGrid.js +77 -0
- package/dist/composites/CoverHero.d.ts +1 -1
- package/dist/composites/CoverHero.d.ts.map +1 -1
- package/dist/composites/CoverHero.js +2 -2
- package/dist/composites/EntityMediaCard.d.ts +1 -1
- package/dist/composites/EntityMediaCard.d.ts.map +1 -1
- package/dist/composites/EntityMediaCard.js +12 -4
- package/dist/composites/EventCalendar.d.ts +35 -0
- package/dist/composites/EventCalendar.d.ts.map +1 -0
- package/dist/composites/EventCalendar.js +339 -0
- package/dist/composites/EventEditor.d.ts +22 -0
- package/dist/composites/EventEditor.d.ts.map +1 -0
- package/dist/composites/EventEditor.js +86 -0
- package/dist/composites/EventTimeline.d.ts +24 -0
- package/dist/composites/EventTimeline.d.ts.map +1 -0
- package/dist/composites/EventTimeline.js +184 -0
- package/dist/composites/MapChart.d.ts +24 -0
- package/dist/composites/MapChart.d.ts.map +1 -0
- package/dist/composites/MapChart.js +58 -0
- package/dist/composites/ProfileHero.d.ts +6 -4
- package/dist/composites/ProfileHero.d.ts.map +1 -1
- package/dist/composites/ProfileHero.js +8 -8
- package/dist/composites/ScatterWebGL.d.ts +22 -0
- package/dist/composites/ScatterWebGL.d.ts.map +1 -0
- package/dist/composites/ScatterWebGL.js +45 -0
- package/dist/composites/SiteFooter.d.ts +1 -1
- package/dist/composites/SiteFooter.js +1 -1
- package/dist/composites/SiteNav.d.ts +7 -2
- package/dist/composites/SiteNav.d.ts.map +1 -1
- package/dist/composites/SiteNav.js +9 -5
- package/dist/composites/StatCard.d.ts +2 -1
- package/dist/composites/StatCard.d.ts.map +1 -1
- package/dist/composites/StatCard.js +3 -3
- package/dist/composites/StatusDot.d.ts +1 -1
- package/dist/composites/Wordmark.d.ts +2 -2
- package/dist/composites/Wordmark.d.ts.map +1 -1
- package/dist/composites/cartesian-charts.d.ts +138 -0
- package/dist/composites/cartesian-charts.d.ts.map +1 -0
- package/dist/composites/cartesian-charts.js +401 -0
- package/dist/composites/chart-composition.d.ts +139 -0
- package/dist/composites/chart-composition.d.ts.map +1 -0
- package/dist/composites/chart-composition.js +486 -0
- package/dist/composites/chart-ui.d.ts +83 -0
- package/dist/composites/chart-ui.d.ts.map +1 -0
- package/dist/composites/chart-ui.js +108 -0
- package/dist/composites/charts-3d.d.ts +37 -0
- package/dist/composites/charts-3d.d.ts.map +1 -0
- package/dist/composites/charts-3d.js +121 -0
- package/dist/composites/flow-charts.d.ts +89 -0
- package/dist/composites/flow-charts.d.ts.map +1 -0
- package/dist/composites/flow-charts.js +186 -0
- package/dist/composites/radial-charts.d.ts +109 -0
- package/dist/composites/radial-charts.d.ts.map +1 -0
- package/dist/composites/radial-charts.js +176 -0
- package/dist/composites/scheduler-ui.d.ts +43 -0
- package/dist/composites/scheduler-ui.d.ts.map +1 -0
- package/dist/composites/scheduler-ui.js +71 -0
- package/dist/index.d.ts +67 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +57 -7
- package/dist/lib/chart-export.d.ts +10 -0
- package/dist/lib/chart-export.d.ts.map +1 -0
- package/dist/lib/chart-export.js +102 -0
- package/dist/lib/charts.d.ts +235 -0
- package/dist/lib/charts.d.ts.map +1 -0
- package/dist/lib/charts.js +744 -0
- package/dist/lib/geo.d.ts +39 -0
- package/dist/lib/geo.d.ts.map +1 -0
- package/dist/lib/geo.js +101 -0
- package/dist/lib/iso.d.ts +21 -0
- package/dist/lib/iso.d.ts.map +1 -0
- package/dist/lib/iso.js +56 -0
- package/dist/lib/rrule.d.ts +20 -0
- package/dist/lib/rrule.d.ts.map +1 -0
- package/dist/lib/rrule.js +236 -0
- package/dist/lib/scheduler.d.ts +152 -0
- package/dist/lib/scheduler.d.ts.map +1 -0
- package/dist/lib/scheduler.js +501 -0
- package/dist/lib/webgl-scatter.d.ts +44 -0
- package/dist/lib/webgl-scatter.d.ts.map +1 -0
- package/dist/lib/webgl-scatter.js +185 -0
- package/dist/primitives/Accordion.d.ts +44 -20
- package/dist/primitives/Accordion.d.ts.map +1 -1
- package/dist/primitives/Accordion.js +82 -22
- package/dist/primitives/AppBar.d.ts +13 -0
- package/dist/primitives/AppBar.d.ts.map +1 -0
- package/dist/primitives/AppBar.js +27 -0
- package/dist/primitives/Autocomplete.d.ts +28 -0
- package/dist/primitives/Autocomplete.d.ts.map +1 -0
- package/dist/primitives/Autocomplete.js +118 -0
- package/dist/primitives/Avatar.d.ts +13 -1
- package/dist/primitives/Avatar.d.ts.map +1 -1
- package/dist/primitives/Avatar.js +17 -2
- package/dist/primitives/Backdrop.d.ts +17 -0
- package/dist/primitives/Backdrop.d.ts.map +1 -0
- package/dist/primitives/Backdrop.js +17 -0
- package/dist/primitives/BottomNavigation.d.ts +23 -0
- package/dist/primitives/BottomNavigation.d.ts.map +1 -0
- package/dist/primitives/BottomNavigation.js +30 -0
- package/dist/primitives/ButtonBase.d.ts +14 -0
- package/dist/primitives/ButtonBase.d.ts.map +1 -0
- package/dist/primitives/ButtonBase.js +13 -0
- package/dist/primitives/ButtonGroup.d.ts +25 -0
- package/dist/primitives/ButtonGroup.d.ts.map +1 -0
- package/dist/primitives/ButtonGroup.js +44 -0
- package/dist/primitives/CircularProgress.d.ts +16 -0
- package/dist/primitives/CircularProgress.d.ts.map +1 -0
- package/dist/primitives/CircularProgress.js +17 -0
- package/dist/primitives/ClickAwayListener.d.ts +16 -0
- package/dist/primitives/ClickAwayListener.d.ts.map +1 -0
- package/dist/primitives/ClickAwayListener.js +33 -0
- package/dist/primitives/Collapse.d.ts +19 -0
- package/dist/primitives/Collapse.d.ts.map +1 -0
- package/dist/primitives/Collapse.js +14 -0
- package/dist/primitives/Container.d.ts +13 -0
- package/dist/primitives/Container.d.ts.map +1 -0
- package/dist/primitives/Container.js +26 -0
- package/dist/primitives/Fab.d.ts +22 -0
- package/dist/primitives/Fab.d.ts.map +1 -0
- package/dist/primitives/Fab.js +42 -0
- package/dist/primitives/FormControl.d.ts +27 -0
- package/dist/primitives/FormControl.d.ts.map +1 -0
- package/dist/primitives/FormControl.js +24 -0
- package/dist/primitives/FormControlLabel.d.ts +18 -0
- package/dist/primitives/FormControlLabel.d.ts.map +1 -0
- package/dist/primitives/FormControlLabel.js +19 -0
- package/dist/primitives/Grid.d.ts +32 -0
- package/dist/primitives/Grid.d.ts.map +1 -0
- package/dist/primitives/Grid.js +50 -0
- package/dist/primitives/IconButton.d.ts +22 -0
- package/dist/primitives/IconButton.d.ts.map +1 -0
- package/dist/primitives/IconButton.js +39 -0
- package/dist/primitives/ImageList.d.ts +31 -0
- package/dist/primitives/ImageList.d.ts.map +1 -0
- package/dist/primitives/ImageList.js +33 -0
- package/dist/primitives/InputAdornment.d.ts +28 -0
- package/dist/primitives/InputAdornment.d.ts.map +1 -0
- package/dist/primitives/InputAdornment.js +13 -0
- package/dist/primitives/Link.d.ts +17 -0
- package/dist/primitives/Link.d.ts.map +1 -0
- package/dist/primitives/Link.js +29 -0
- package/dist/primitives/List.d.ts +41 -0
- package/dist/primitives/List.d.ts.map +1 -0
- package/dist/primitives/List.js +22 -0
- package/dist/primitives/Masonry.d.ts +14 -0
- package/dist/primitives/Masonry.d.ts.map +1 -0
- package/dist/primitives/Masonry.js +15 -0
- package/dist/primitives/Menu.d.ts +28 -0
- package/dist/primitives/Menu.d.ts.map +1 -0
- package/dist/primitives/Menu.js +54 -0
- package/dist/primitives/MobileStepper.d.ts +15 -0
- package/dist/primitives/MobileStepper.d.ts.map +1 -0
- package/dist/primitives/MobileStepper.js +8 -0
- package/dist/primitives/Modal.d.ts +18 -0
- package/dist/primitives/Modal.d.ts.map +1 -0
- package/dist/primitives/Modal.js +29 -0
- package/dist/primitives/NoSsr.d.ts +15 -0
- package/dist/primitives/NoSsr.d.ts.map +1 -0
- package/dist/primitives/NoSsr.js +19 -0
- package/dist/primitives/Paper.d.ts +22 -0
- package/dist/primitives/Paper.d.ts.map +1 -0
- package/dist/primitives/Paper.js +33 -0
- package/dist/primitives/Progress.d.ts +6 -2
- package/dist/primitives/Progress.d.ts.map +1 -1
- package/dist/primitives/Progress.js +8 -3
- package/dist/primitives/Snackbar.d.ts +23 -0
- package/dist/primitives/Snackbar.d.ts.map +1 -0
- package/dist/primitives/Snackbar.js +33 -0
- package/dist/primitives/SpeedDial.d.ts +26 -0
- package/dist/primitives/SpeedDial.d.ts.map +1 -0
- package/dist/primitives/SpeedDial.js +26 -0
- package/dist/primitives/Stack.d.ts +15 -0
- package/dist/primitives/Stack.d.ts.map +1 -0
- package/dist/primitives/Stack.js +45 -0
- package/dist/primitives/StarRating.d.ts +19 -1
- package/dist/primitives/StarRating.d.ts.map +1 -1
- package/dist/primitives/StarRating.js +36 -6
- package/dist/primitives/Stepper.d.ts +36 -0
- package/dist/primitives/Stepper.d.ts.map +1 -0
- package/dist/primitives/Stepper.js +53 -0
- package/dist/primitives/TablePagination.d.ts +16 -0
- package/dist/primitives/TablePagination.d.ts.map +1 -0
- package/dist/primitives/TablePagination.js +12 -0
- package/dist/primitives/TextField.d.ts +24 -0
- package/dist/primitives/TextField.d.ts.map +1 -0
- package/dist/primitives/TextField.js +19 -0
- package/dist/primitives/TextareaAutosize.d.ts +11 -0
- package/dist/primitives/TextareaAutosize.d.ts.map +1 -0
- package/dist/primitives/TextareaAutosize.js +26 -0
- package/dist/primitives/ToggleButton.d.ts +28 -0
- package/dist/primitives/ToggleButton.d.ts.map +1 -0
- package/dist/primitives/ToggleButton.js +56 -0
- package/dist/primitives/TransferList.d.ts +21 -0
- package/dist/primitives/TransferList.d.ts.map +1 -0
- package/dist/primitives/TransferList.js +40 -0
- package/dist/primitives/Typography.d.ts +23 -0
- package/dist/primitives/Typography.d.ts.map +1 -0
- package/dist/primitives/Typography.js +69 -0
- package/dist/primitives/transitions.d.ts +29 -0
- package/dist/primitives/transitions.d.ts.map +1 -0
- package/dist/primitives/transitions.js +52 -0
- package/package.json +28 -4
- package/skills/spatika-ui/SKILL.md +96 -0
- package/src/composites/Card.tsx +51 -1
- package/src/composites/ChartDataGrid.test.tsx +57 -0
- package/src/composites/ChartDataGrid.tsx +196 -0
- package/src/composites/CoverHero.test.tsx +38 -0
- package/src/composites/CoverHero.tsx +29 -22
- package/src/composites/EntityMediaCard.test.tsx +58 -0
- package/src/composites/EntityMediaCard.tsx +31 -13
- package/src/composites/EventCalendar.tsx +928 -0
- package/src/composites/EventEditor.tsx +268 -0
- package/src/composites/EventTimeline.tsx +357 -0
- package/src/composites/MapChart.test.tsx +39 -0
- package/src/composites/MapChart.tsx +130 -0
- package/src/composites/ProfileHero.test.tsx +33 -0
- package/src/composites/ProfileHero.tsx +96 -79
- package/src/composites/ScatterWebGL.test.tsx +25 -0
- package/src/composites/ScatterWebGL.tsx +79 -0
- package/src/composites/SiteFooter.test.tsx +37 -0
- package/src/composites/SiteFooter.tsx +1 -1
- package/src/composites/SiteNav.test.tsx +46 -0
- package/src/composites/SiteNav.tsx +14 -4
- package/src/composites/StatCard.test.tsx +30 -0
- package/src/composites/StatCard.tsx +4 -0
- package/src/composites/Wordmark.test.tsx +23 -0
- package/src/composites/Wordmark.tsx +2 -2
- package/src/composites/cartesian-charts.test.tsx +52 -0
- package/src/composites/cartesian-charts.tsx +1287 -0
- package/src/composites/chart-composition.test.tsx +53 -0
- package/src/composites/chart-composition.tsx +898 -0
- package/src/composites/chart-ui.tsx +328 -0
- package/src/composites/charts-3d.test.tsx +25 -0
- package/src/composites/charts-3d.tsx +318 -0
- package/src/composites/charts.test.tsx +254 -0
- package/src/composites/chrome.test.tsx +29 -0
- package/src/composites/flow-charts.test.tsx +79 -0
- package/src/composites/flow-charts.tsx +607 -0
- package/src/composites/marketing.test.tsx +38 -34
- package/src/composites/radial-charts.test.tsx +74 -0
- package/src/composites/radial-charts.tsx +617 -0
- package/src/composites/scheduler-ui.tsx +304 -0
- package/src/composites/scheduler.test.tsx +194 -0
- package/src/index.test.ts +22 -0
- package/src/index.ts +277 -5
- package/src/lib/chart-export.test.ts +20 -0
- package/src/lib/chart-export.ts +99 -0
- package/src/lib/charts-platform.test.ts +93 -0
- package/src/lib/charts.test.ts +132 -0
- package/src/lib/charts.ts +1021 -0
- package/src/lib/geo.test.ts +42 -0
- package/src/lib/geo.ts +138 -0
- package/src/lib/iso.test.ts +22 -0
- package/src/lib/iso.ts +102 -0
- package/src/lib/rrule.test.ts +53 -0
- package/src/lib/rrule.ts +281 -0
- package/src/lib/scheduler.test.ts +186 -0
- package/src/lib/scheduler.ts +688 -0
- package/src/lib/tokens.test.ts +2 -2
- package/src/lib/webgl-scatter.test.ts +36 -0
- package/src/lib/webgl-scatter.ts +230 -0
- package/src/primitives/Accordion.tsx +218 -63
- package/src/primitives/AppBar.tsx +39 -0
- package/src/primitives/Autocomplete.tsx +236 -0
- package/src/primitives/Avatar.tsx +52 -1
- package/src/primitives/Backdrop.tsx +48 -0
- package/src/primitives/BottomNavigation.tsx +102 -0
- package/src/primitives/ButtonBase.tsx +34 -0
- package/src/primitives/ButtonGroup.tsx +90 -0
- package/src/primitives/CircularProgress.tsx +104 -0
- package/src/primitives/ClickAwayListener.tsx +46 -0
- package/src/primitives/Collapse.tsx +39 -0
- package/src/primitives/Container.tsx +40 -0
- package/src/primitives/Fab.tsx +62 -0
- package/src/primitives/FormControl.tsx +90 -0
- package/src/primitives/FormControlLabel.tsx +51 -0
- package/src/primitives/Grid.tsx +101 -0
- package/src/primitives/IconButton.tsx +59 -0
- package/src/primitives/ImageList.test.tsx +48 -0
- package/src/primitives/ImageList.tsx +112 -0
- package/src/primitives/InputAdornment.tsx +86 -0
- package/src/primitives/Link.tsx +48 -0
- package/src/primitives/List.tsx +121 -0
- package/src/primitives/Masonry.tsx +32 -0
- package/src/primitives/Menu.tsx +112 -0
- package/src/primitives/MobileStepper.tsx +64 -0
- package/src/primitives/Modal.tsx +70 -0
- package/src/primitives/NoSsr.tsx +28 -0
- package/src/primitives/Paper.tsx +55 -0
- package/src/primitives/Progress.tsx +25 -7
- package/src/primitives/Snackbar.tsx +83 -0
- package/src/primitives/SpeedDial.tsx +110 -0
- package/src/primitives/Stack.tsx +88 -0
- package/src/primitives/StarRating.tsx +87 -28
- package/src/primitives/Stepper.tsx +184 -0
- package/src/primitives/TablePagination.tsx +58 -0
- package/src/primitives/TextField.tsx +105 -0
- package/src/primitives/TextareaAutosize.tsx +49 -0
- package/src/primitives/ToggleButton.tsx +148 -0
- package/src/primitives/TransferList.tsx +110 -0
- package/src/primitives/Typography.tsx +90 -0
- package/src/primitives/mui-more.test.tsx +76 -0
- package/src/primitives/mui.test.tsx +134 -0
- package/src/primitives/transitions.tsx +120 -0
|
@@ -5,7 +5,6 @@ import { Tag } from "./Tag";
|
|
|
5
5
|
import { SectionHeading } from "./SectionHeading";
|
|
6
6
|
import { SiteNav } from "./SiteNav";
|
|
7
7
|
import { SiteFooter } from "./SiteFooter";
|
|
8
|
-
import { StatCard } from "./StatCard";
|
|
9
8
|
import { GradientText } from "./GradientText";
|
|
10
9
|
import { Wordmark } from "./Wordmark";
|
|
11
10
|
import { AvailabilityBadge } from "./AvailabilityBadge";
|
|
@@ -33,11 +32,11 @@ describe("Tag", () => {
|
|
|
33
32
|
describe("SectionHeading", () => {
|
|
34
33
|
it("renders eyebrow, title, and subtitle without a header element", () => {
|
|
35
34
|
const { container } = render(
|
|
36
|
-
<SectionHeading eyebrow="
|
|
35
|
+
<SectionHeading eyebrow="Product" title="What's shipping" subtitle="Glass composites." />,
|
|
37
36
|
);
|
|
38
|
-
expect(screen.getByText("
|
|
39
|
-
expect(screen.getByRole("heading", { name: "
|
|
40
|
-
expect(screen.getByText("
|
|
37
|
+
expect(screen.getByText("Product")).toBeInTheDocument();
|
|
38
|
+
expect(screen.getByRole("heading", { name: "What's shipping" })).toBeInTheDocument();
|
|
39
|
+
expect(screen.getByText("Glass composites.")).toBeInTheDocument();
|
|
41
40
|
expect(container.querySelector("header")).toBeNull();
|
|
42
41
|
expect(container.querySelector("[data-slot='section-heading']")).toBeTruthy();
|
|
43
42
|
});
|
|
@@ -61,6 +60,19 @@ describe("SiteNav", () => {
|
|
|
61
60
|
await user.click(screen.getByRole("button", { name: "Toggle menu" }));
|
|
62
61
|
expect(screen.getByLabelText("Toggle menu")).toHaveAttribute("aria-expanded", "true");
|
|
63
62
|
});
|
|
63
|
+
|
|
64
|
+
it("does not pin to the viewport when contained", () => {
|
|
65
|
+
render(
|
|
66
|
+
<SiteNav
|
|
67
|
+
contained
|
|
68
|
+
brand={<a href="/">Brand</a>}
|
|
69
|
+
links={[{ href: "#about", label: "About" }]}
|
|
70
|
+
/>,
|
|
71
|
+
);
|
|
72
|
+
const nav = screen.getByRole("navigation");
|
|
73
|
+
expect(nav.className).toContain("absolute");
|
|
74
|
+
expect(nav.className).not.toMatch(/\bfixed\b/);
|
|
75
|
+
});
|
|
64
76
|
});
|
|
65
77
|
|
|
66
78
|
describe("SiteFooter", () => {
|
|
@@ -80,41 +92,33 @@ describe("SiteFooter", () => {
|
|
|
80
92
|
});
|
|
81
93
|
});
|
|
82
94
|
|
|
83
|
-
describe("StatCard metric", () => {
|
|
84
|
-
it("renders value-first metric layout", () => {
|
|
85
|
-
render(<StatCard variant="metric" label="Years Exp." value="7+" />);
|
|
86
|
-
expect(screen.getByText("7+")).toBeInTheDocument();
|
|
87
|
-
expect(screen.getByText("Years Exp.")).toBeInTheDocument();
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
|
|
91
95
|
describe("marketing chrome", () => {
|
|
92
96
|
it("renders a gradient wordmark", () => {
|
|
93
|
-
render(<Wordmark name="
|
|
94
|
-
expect(screen.getByText("
|
|
95
|
-
expect(screen.getByText(".
|
|
97
|
+
render(<Wordmark name="Acme" accent=".io" />);
|
|
98
|
+
expect(screen.getByText("Acme")).toBeInTheDocument();
|
|
99
|
+
expect(screen.getByText(".io")).toBeInTheDocument();
|
|
96
100
|
});
|
|
97
101
|
|
|
98
102
|
it("renders gradient text", () => {
|
|
99
|
-
render(<GradientText>
|
|
100
|
-
expect(screen.getByText("
|
|
103
|
+
render(<GradientText>Spatika</GradientText>);
|
|
104
|
+
expect(screen.getByText("Spatika")).toBeInTheDocument();
|
|
101
105
|
});
|
|
102
106
|
|
|
103
107
|
it("renders an availability badge with a live pip", () => {
|
|
104
|
-
render(<AvailabilityBadge>
|
|
105
|
-
expect(screen.getByText("
|
|
108
|
+
render(<AvailabilityBadge>Live</AvailabilityBadge>);
|
|
109
|
+
expect(screen.getByText("Live")).toBeInTheDocument();
|
|
106
110
|
expect(document.querySelector("[data-slot='presence-dot']")).toBeTruthy();
|
|
107
111
|
});
|
|
108
112
|
|
|
109
113
|
it("renders a float chip", () => {
|
|
110
|
-
render(<FloatChip icon="
|
|
111
|
-
expect(screen.getByText("
|
|
112
|
-
expect(screen.getByText("
|
|
114
|
+
render(<FloatChip icon="✨" title="Glass" subtitle="UI" />);
|
|
115
|
+
expect(screen.getByText("Glass")).toBeInTheDocument();
|
|
116
|
+
expect(screen.getByText("UI")).toBeInTheDocument();
|
|
113
117
|
});
|
|
114
118
|
|
|
115
119
|
it("renders a live float chip", () => {
|
|
116
|
-
render(<FloatChip live>
|
|
117
|
-
expect(screen.getByText("
|
|
120
|
+
render(<FloatChip live>In production</FloatChip>);
|
|
121
|
+
expect(screen.getByText("In production")).toBeInTheDocument();
|
|
118
122
|
});
|
|
119
123
|
|
|
120
124
|
it("renders a presence dot", () => {
|
|
@@ -173,16 +177,16 @@ describe("ProjectCard", () => {
|
|
|
173
177
|
it("renders title, company, outcome, and tags", () => {
|
|
174
178
|
render(
|
|
175
179
|
<ProjectCard
|
|
176
|
-
title="
|
|
177
|
-
company="
|
|
178
|
-
outcome="
|
|
179
|
-
description="
|
|
180
|
-
tags={["
|
|
180
|
+
title="Spatika UI"
|
|
181
|
+
company="Open source"
|
|
182
|
+
outcome="Shipped"
|
|
183
|
+
description="Glass React design system."
|
|
184
|
+
tags={["React"]}
|
|
181
185
|
/>,
|
|
182
186
|
);
|
|
183
|
-
expect(screen.getByText("
|
|
184
|
-
expect(screen.getByText("
|
|
185
|
-
expect(screen.getByText("
|
|
186
|
-
expect(screen.getByText("
|
|
187
|
+
expect(screen.getByText("Spatika UI")).toBeInTheDocument();
|
|
188
|
+
expect(screen.getByText("Open source")).toBeInTheDocument();
|
|
189
|
+
expect(screen.getByText("Shipped")).toBeInTheDocument();
|
|
190
|
+
expect(screen.getByText("React")).toBeInTheDocument();
|
|
187
191
|
});
|
|
188
192
|
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { render, screen } from "@testing-library/react";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { Gauge, LinearGauge, PieChart, RadarChart } from "./radial-charts";
|
|
4
|
+
|
|
5
|
+
describe("radial-charts", () => {
|
|
6
|
+
it("renders a pie chart from slice values", () => {
|
|
7
|
+
const { container } = render(
|
|
8
|
+
<PieChart
|
|
9
|
+
width={200}
|
|
10
|
+
height={200}
|
|
11
|
+
series={[{ data: [{ value: 10, label: "A" }, { value: 20, label: "B" }] }]}
|
|
12
|
+
/>,
|
|
13
|
+
);
|
|
14
|
+
expect(container.querySelector('[data-slot="pie-chart"]')).toBeTruthy();
|
|
15
|
+
expect(screen.getByRole("button", { name: "A" })).toBeInTheDocument();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("renders a single-value gauge with a percent label", () => {
|
|
19
|
+
render(<Gauge value={40} width={160} height={120} />);
|
|
20
|
+
expect(screen.getByRole("img", { name: "Gauge 40" })).toBeInTheDocument();
|
|
21
|
+
expect(screen.getByText("40%")).toBeInTheDocument();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("renders a segmented gauge with a section legend", () => {
|
|
25
|
+
const { container } = render(
|
|
26
|
+
<Gauge
|
|
27
|
+
width={160}
|
|
28
|
+
height={120}
|
|
29
|
+
startAngle={-90}
|
|
30
|
+
endAngle={90}
|
|
31
|
+
sections={[
|
|
32
|
+
{ value: 40, label: "v5" },
|
|
33
|
+
{ value: 35, label: "v6" },
|
|
34
|
+
{ value: 25, label: "v7" },
|
|
35
|
+
]}
|
|
36
|
+
/>,
|
|
37
|
+
);
|
|
38
|
+
expect(container.querySelector('[data-slot="gauge"]')).toBeTruthy();
|
|
39
|
+
expect(screen.getByRole("button", { name: "v5" })).toBeInTheDocument();
|
|
40
|
+
expect(container.querySelectorAll('[data-slot="gauge"] path').length).toBe(3);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("hides the section legend and accepts a text formatter", () => {
|
|
44
|
+
render(
|
|
45
|
+
<Gauge
|
|
46
|
+
value={72}
|
|
47
|
+
width={160}
|
|
48
|
+
height={120}
|
|
49
|
+
hideLegend
|
|
50
|
+
text={(value) => `${value} pts`}
|
|
51
|
+
sections={[{ value: 1, label: "hidden" }]}
|
|
52
|
+
/>,
|
|
53
|
+
);
|
|
54
|
+
expect(screen.queryByRole("button", { name: "hidden" })).not.toBeInTheDocument();
|
|
55
|
+
expect(screen.getByText("72 pts")).toBeInTheDocument();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("renders a linear gauge and a radar polygon", () => {
|
|
59
|
+
const { container } = render(
|
|
60
|
+
<div>
|
|
61
|
+
<LinearGauge value={25} width={200} />
|
|
62
|
+
<RadarChart
|
|
63
|
+
width={220}
|
|
64
|
+
height={220}
|
|
65
|
+
radar={{ metrics: ["A", "B", "C"] }}
|
|
66
|
+
series={[{ label: "One", data: [3, 5, 4] }]}
|
|
67
|
+
/>
|
|
68
|
+
</div>,
|
|
69
|
+
);
|
|
70
|
+
expect(container.querySelector('[data-slot="linear-gauge"]')).toBeTruthy();
|
|
71
|
+
expect(container.querySelector('[data-slot="radar-chart"]')).toBeTruthy();
|
|
72
|
+
expect(screen.getByRole("button", { name: "One" })).toBeInTheDocument();
|
|
73
|
+
});
|
|
74
|
+
});
|