Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(svelte): add TypeScript definitions for BoxplotChart, WordCloudChart #1003

Merged
merged 2 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions packages/svelte/tests/BoxplotChart.test.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<script lang="ts">
import { BoxplotChart } from '../types';
import type { BoxplotChart as BC } from '@carbon/charts';
import {
simpleBoxplotData as data,
simpleBoxplotOptions,
} from '@carbon/charts/demo/data';

let chart: BC = null;
let ref = null;

const options = simpleBoxplotOptions as any;
</script>

<BoxplotChart
bind:chart
bind:ref
on:load={(e) => {
console.log(e.detail);
}}
on:update={(e) => {
console.log(e.detail);
}}
on:destroy={(e) => {
console.log(e.detail);
}}
{data}
{options}
/>

<svelte:component
this={BoxplotChart}
on:load={(e) => {
console.log(e.detail);
}}
on:update={(e) => {
console.log(e.detail);
}}
on:destroy={(e) => {
console.log(e.detail);
}}
{data}
{options}
/>
44 changes: 44 additions & 0 deletions packages/svelte/tests/WordCloudChart.test.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<script lang="ts">
import { WordCloudChart } from '../types';
import type { WordCloudChart as WC } from '@carbon/charts';
import {
wordCloudData as data,
wordCloudOptions,
} from '@carbon/charts/demo/data';

let chart: WC = null;
let ref = null;

const options = wordCloudOptions as any;
</script>

<WordCloudChart
bind:chart
bind:ref
on:load={(e) => {
console.log(e.detail);
}}
on:update={(e) => {
console.log(e.detail);
}}
on:destroy={(e) => {
console.log(e.detail);
}}
{data}
{options}
/>

<svelte:component
this={WordCloudChart}
on:load={(e) => {
console.log(e.detail);
}}
on:update={(e) => {
console.log(e.detail);
}}
on:destroy={(e) => {
console.log(e.detail);
}}
{data}
{options}
/>
5 changes: 5 additions & 0 deletions packages/svelte/types/BoxplotChart.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { BoxplotChart as BC } from "@carbon/charts";
import type { BoxplotChartOptions } from "@carbon/charts/interfaces";
import BaseChart from "./BaseChart";

export default class BoxplotChart extends BaseChart<BC, BoxplotChartOptions> {}
5 changes: 5 additions & 0 deletions packages/svelte/types/WordCloudChart.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { WordCloudChart as WC } from "@carbon/charts";
import type { WorldCloudChartOptions } from "@carbon/charts/interfaces";
import BaseChart from "./BaseChart";

export default class WordCloudChart extends BaseChart<WC, WorldCloudChartOptions> {}
2 changes: 2 additions & 0 deletions packages/svelte/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export { default as StackedAreaChart } from "./StackedAreaChart";
export { default as BarChartGrouped } from "./BarChartGrouped";
export { default as BarChartSimple } from "./BarChartSimple";
export { default as BarChartStacked } from "./BarChartStacked";
export { default as BoxplotChart } from "./BoxplotChart";
export { default as BubbleChart } from "./BubbleChart";
export { default as ComboChart } from "./ComboChart";
export { default as DonutChart } from "./DonutChart";
Expand All @@ -14,3 +15,4 @@ export { default as RadarChart } from "./RadarChart";
export { default as GaugeChart } from "./GaugeChart";
export { default as MeterChart } from "./MeterChart";
export { default as TreemapChart } from "./TreemapChart";
export { default as WordCloudChart } from "./WordCloudChart";