Skip to content

Chore/UI chart kit release 0.1.0#1

Open
Omaima33 wants to merge 6 commits intodevelopfrom
chore/ui-chart-kit-release-0.1.0
Open

Chore/UI chart kit release 0.1.0#1
Omaima33 wants to merge 6 commits intodevelopfrom
chore/ui-chart-kit-release-0.1.0

Conversation

@Omaima33
Copy link
Copy Markdown

@Omaima33 Omaima33 commented Apr 3, 2026

No description provided.

Copilot AI review requested due to automatic review settings April 3, 2026 14:21
@Omaima33 Omaima33 requested a review from a team as a code owner April 3, 2026 14:22
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 3, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
15.7% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces the initial @ciscode/ui-chart-kit release by adding typed chart primitives (data/theme/contracts), a shared Chart.js config builder, and React components for Bar/Line/Area charts with Vitest coverage.

Changes:

  • Added buildChartConfig utility plus type contracts (ChartDataset, ChartTheme, etc.) and re-exported them from the package entrypoint.
  • Added BarChart, LineChart, and AreaChart components built on react-chartjs-2 with component/unit tests.
  • Updated package metadata/docs for the new chart-kit package and added Chart.js dependencies.

Reviewed changes

Copilot reviewed 22 out of 24 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/utils/index.ts Re-exports the new buildChartConfig util from the utils barrel.
src/utils/buildChartConfig.ts Builds Chart.js config from typed datasets/theme for bar/line/area variants.
src/utils/buildChartConfig.test.ts Unit tests for config building behavior (variants, defaults, color cycling).
src/types/index.ts Exposes chart type contracts via a types barrel export.
src/types/chart.types.ts Defines public chart data/theme/config TypeScript contracts.
src/index.ts Exposes types from the public package entrypoint.
src/components/LineChart/LineChart.types.ts Defines LineChart public props typed with the new chart contracts.
src/components/LineChart/LineChart.tsx Implements LineChart using react-chartjs-2 + shared config builder.
src/components/LineChart/LineChart.test.tsx Component tests for LineChart rendering and smooth option behavior.
src/components/LineChart/index.ts Adds LineChart exports (component + props type).
src/components/index.ts Exposes new chart components from the components barrel.
src/components/BarChart/index.ts Adds BarChart exports (component + props type).
src/components/BarChart/BarChart.types.ts Defines BarChart public props (stacked/horizontal).
src/components/BarChart/BarChart.tsx Implements BarChart with stacked/horizontal support via options mutations.
src/components/BarChart/BarChart.test.tsx Component tests for BarChart rendering and stacked/horizontal options.
src/components/AreaChart/index.ts Adds AreaChart exports (component + props type).
src/components/AreaChart/AreaChart.types.ts Defines AreaChart public props (smooth/stacked).
src/components/AreaChart/AreaChart.tsx Implements AreaChart using area variant + optional smooth/stacked behavior.
src/components/AreaChart/AreaChart.test.tsx Component tests for AreaChart fill/opacity/smooth/stacked behaviors.
README.md Replaces template README with chart-kit installation, types, component usage, and design notes.
package.json Renames package to @ciscode/ui-chart-kit@0.1.0 and adds Chart.js dependencies.
package-lock.json Adds locked dependencies for Chart.js/react-chartjs-2.
ciscode-reactts-developerkit-1.0.0.tgz Adds a committed .tgz artifact to the repo.
.changeset/initial-release.md Adds a Changesets entry describing the initial chart-kit release.

} from '../types/chart.types';

function resolveColor(dataset: ChartDataset, index: number, theme: ChartTheme): string {
return dataset.color ?? theme.colors[index % theme.colors.length];
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resolveColor can return undefined (and produce NaN indexing) when theme.colors is an empty array (index % theme.colors.length). Since ChartTheme.colors is only typed as string[], an empty palette is possible at runtime and would break chart rendering. Consider validating theme.colors.length > 0 (throw a clear error or provide a fallback color) before using it.

Suggested change
return dataset.color ?? theme.colors[index % theme.colors.length];
if (dataset.color) {
return dataset.color;
}
if (theme.colors.length === 0) {
throw new Error('Chart theme must provide at least one color.');
}
return theme.colors[index % theme.colors.length];

Copilot uses AI. Check for mistakes.
datasets: datasets.map((ds, i) => buildDataset(ds, i, theme, variant)),
},
options: {
responsive: true,
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The components expose a height prop and wrap the chart in a fixed-height div, but buildChartConfig doesn't set options.maintainAspectRatio = false. With Chart.js defaults (maintainAspectRatio: true), the chart height typically derives from width/aspectRatio and may ignore the container height, so the documented pixel height may not be honored. Consider setting maintainAspectRatio: false in the returned options to make the height prop effective.

Suggested change
responsive: true,
responsive: true,
maintainAspectRatio: false,

Copilot uses AI. Check for mistakes.
Comment on lines 1 to +5
// Example placeholder export — replace with real components later.
export const __components_placeholder = true;

export * from './NoopButton';
export * from './BarChart';
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The library entrypoint now exports real chart components, but __components_placeholder is still exported as part of the public API. For a v0.1.0 release, this placeholder export is likely unintended surface area that you'll have to support (or break) later. Consider removing the placeholder export now that there are real exports.

Copilot uses AI. Check for mistakes.
Comment on lines 1 to +5
// Example placeholder export — replace with real utils later.
export const __utils_placeholder = true;

export * from './noop';
export * from './buildChartConfig';
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__utils_placeholder remains exported from src/utils/index.ts, which makes it part of the package's public API via src/index.ts. Now that real utilities are present, consider removing this placeholder export to avoid publishing an unintended API symbol.

Copilot uses AI. Check for mistakes.
Comment on lines +2 to +5
'@ciscode/ui-chart-kit': minor
---

Initial release of @ciscode/ui-chart-kit v0.1.0.
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changeset is marked as a minor bump but the PR already sets package.json to 0.1.0 and the text hard-codes "v0.1.0". If you run changeset version, a minor changeset will bump 0.1.0 → 0.2.0, which conflicts with the stated initial release version. Consider adjusting the bump type and/or removing the hard-coded version from the changeset body so the release version is driven by Changesets.

Suggested change
'@ciscode/ui-chart-kit': minor
---
Initial release of @ciscode/ui-chart-kit v0.1.0.
'@ciscode/ui-chart-kit': patch
---
Initial release of @ciscode/ui-chart-kit.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants