@carbon/charts-svelte 1.22.18 → 1.22.20

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +34 -55
  3. package/dist/AlluvialChart.svelte +14 -8
  4. package/dist/AlluvialChart.svelte.d.ts +9 -35
  5. package/dist/AreaChart.svelte +14 -8
  6. package/dist/AreaChart.svelte.d.ts +9 -35
  7. package/dist/BarChartGrouped.svelte +14 -8
  8. package/dist/BarChartGrouped.svelte.d.ts +9 -35
  9. package/dist/BarChartSimple.svelte +14 -8
  10. package/dist/BarChartSimple.svelte.d.ts +9 -35
  11. package/dist/BarChartStacked.svelte +14 -8
  12. package/dist/BarChartStacked.svelte.d.ts +9 -35
  13. package/dist/BaseChart.svelte +23 -23
  14. package/dist/BaseChart.svelte.d.ts +33 -31
  15. package/dist/BoxplotChart.svelte +14 -8
  16. package/dist/BoxplotChart.svelte.d.ts +9 -35
  17. package/dist/BubbleChart.svelte +14 -8
  18. package/dist/BubbleChart.svelte.d.ts +9 -35
  19. package/dist/BulletChart.svelte +14 -8
  20. package/dist/BulletChart.svelte.d.ts +9 -35
  21. package/dist/ChoroplethChart.svelte +14 -8
  22. package/dist/ChoroplethChart.svelte.d.ts +9 -35
  23. package/dist/CirclePackChart.svelte +14 -8
  24. package/dist/CirclePackChart.svelte.d.ts +9 -35
  25. package/dist/ComboChart.svelte +14 -8
  26. package/dist/ComboChart.svelte.d.ts +9 -35
  27. package/dist/DonutChart.svelte +14 -8
  28. package/dist/DonutChart.svelte.d.ts +9 -35
  29. package/dist/GaugeChart.svelte +14 -8
  30. package/dist/GaugeChart.svelte.d.ts +9 -35
  31. package/dist/HeatmapChart.svelte +14 -8
  32. package/dist/HeatmapChart.svelte.d.ts +9 -35
  33. package/dist/HistogramChart.svelte +14 -8
  34. package/dist/HistogramChart.svelte.d.ts +9 -35
  35. package/dist/LineChart.svelte +14 -8
  36. package/dist/LineChart.svelte.d.ts +9 -35
  37. package/dist/LollipopChart.svelte +14 -8
  38. package/dist/LollipopChart.svelte.d.ts +9 -35
  39. package/dist/MeterChart.svelte +14 -8
  40. package/dist/MeterChart.svelte.d.ts +9 -35
  41. package/dist/PieChart.svelte +14 -8
  42. package/dist/PieChart.svelte.d.ts +9 -35
  43. package/dist/RadarChart.svelte +14 -8
  44. package/dist/RadarChart.svelte.d.ts +9 -35
  45. package/dist/ScatterChart.svelte +14 -8
  46. package/dist/ScatterChart.svelte.d.ts +9 -35
  47. package/dist/StackedAreaChart.svelte +14 -8
  48. package/dist/StackedAreaChart.svelte.d.ts +9 -32
  49. package/dist/TreeChart.svelte +14 -8
  50. package/dist/TreeChart.svelte.d.ts +9 -35
  51. package/dist/TreemapChart.svelte +14 -8
  52. package/dist/TreemapChart.svelte.d.ts +9 -35
  53. package/dist/WordCloudChart.svelte +14 -8
  54. package/dist/WordCloudChart.svelte.d.ts +9 -36
  55. package/dist/interfaces.d.ts +24 -0
  56. package/dist/interfaces.js +1 -0
  57. package/dist/styles.css +198 -0
  58. package/dist/styles.css.map +1 -1
  59. package/dist/styles.min.css +197 -0
  60. package/dist/styles.min.css.map +1 -1
  61. package/package.json +13 -13
package/CHANGELOG.md CHANGED
@@ -3,6 +3,24 @@
3
3
  All notable changes to this project will be documented in this file. See
4
4
  [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 1.22.20 (2025-03-05)
7
+
8
+ **Note:** Version bump only for package @carbon/charts-svelte
9
+
10
+ # Change Log
11
+
12
+ All notable changes to this project will be documented in this file. See
13
+ [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
14
+
15
+ ## 1.22.19 (2025-02-27)
16
+
17
+ **Note:** Version bump only for package @carbon/charts-svelte
18
+
19
+ # Change Log
20
+
21
+ All notable changes to this project will be documented in this file. See
22
+ [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
23
+
6
24
  ## 1.22.18 (2025-02-18)
7
25
 
8
26
  **Note:** Version bump only for package @carbon/charts-svelte
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  </a>
5
5
  <h3 align="center">Carbon Charts Svelte</h3>
6
6
  <p align="center">
7
- A component library of 26 charts for Svelte and SvelteKit.
7
+ A component library of 26 charts for Svelte 5.20+ and SvelteKit (optionally).
8
8
  <br /><br />
9
9
  <a href="https://www.npmjs.com/package/@carbon/charts">
10
10
  <img src="https://img.shields.io/npm/v/@carbon/charts.svg" />
@@ -21,7 +21,7 @@
21
21
 
22
22
  ## Maintenance & support
23
23
 
24
- These Svelte wrappers were developed by Eric Liu.
24
+ These Svelte components were developed by Eric Liu and Nate Stuyvesant.
25
25
 
26
26
  Please direct all questions regarding support, bug fixes and feature requests to
27
27
  [@nstuyvesant](https://github.com/nstuyvesant) and [@metonym](https://github.com/metonym).
@@ -31,40 +31,42 @@ Please direct all questions regarding support, bug fixes and feature requests to
31
31
  Run the following command using [npm](https://www.npmjs.com/):
32
32
 
33
33
  ```bash
34
- npm install -D @carbon/charts-svelte
34
+ npm install -D @carbon/charts-svelte@next
35
35
  ```
36
36
 
37
37
  If you prefer [Yarn](https://yarnpkg.com/en/), use the following command instead:
38
38
 
39
39
  ```bash
40
- yarn add -D @carbon/charts-svelte
40
+ yarn add -D @carbon/charts-svelte@next
41
41
  ```
42
42
 
43
43
  The required styles should be imported from `@carbon/charts-svelte/styles.css`.
44
44
 
45
- A release in the near future will move components to runes mode for Svelte 5 and beyond. As this would be a breaking change because event handlers will change to component properties, this version will be published with the distribution tag `next`. Please check <a href="https://www.npmjs.com/package/@carbon/charts-svelte?activeTab=versions">here</a> to see if a version for `latest` has been published.
45
+ ## Breaking Change
46
+
47
+ This release is for Svelte 5.20+ ONLY as it uses runes mode and passing of callback functions as
48
+ properties in place of event handlers. If you need support for Svelte 3 or 4, please use the
49
+ `latest`.
46
50
 
47
51
  ### SvelteKit
48
52
 
49
53
  While this component library can be used with any build environments for Svelte,
50
54
  [SvelteKit](https://kit.svelte.dev) is the official framework for building Svelte apps supporting
51
- client-side and server-side rendering (SSR). SvelteKit is powered by [Vite](https://vitejs.dev).
55
+ client and server-side rendering (SSR). SvelteKit is powered by [Vite](https://vitejs.dev).
52
56
 
53
57
  The module `@carbon/charts` should not be externalized for SSR when building for production.
54
58
 
55
59
  ```js
56
- // vite.config.mjs
60
+ // vite.config.ts
57
61
  import { sveltekit } from '@sveltejs/kit/vite'
62
+ import { defineConfig } from 'vite'
58
63
 
59
- /** @type {import('vite').UserConfig} */
60
- const config = {
64
+ export default defineConfig({
61
65
  plugins: [sveltekit()],
62
66
  ssr: {
63
67
  noExternal: process.env.NODE_ENV === 'production' ? ['@carbon/charts'] : []
64
68
  }
65
- }
66
-
67
- export default config
69
+ })
68
70
  ```
69
71
 
70
72
  #### Circular dependency warnings
@@ -106,39 +108,38 @@ import '@carbon/charts-svelte/styles.css'
106
108
  }} />
107
109
  ```
108
110
 
109
- ### Dispatched events
111
+ ### Lifecycle callbacks
110
112
 
111
- Each Svelte chart component dispatches the following events:
113
+ Chart components fire the following callbacks:
112
114
 
113
- - **on:load**: fired when the chart is instantiated
114
- - **on:update**: fired when `data` or `options` are updated
115
- - **on:destroy**: fired when the component is unmounted and the chart is destroyed
115
+ - **onload**: When the chart is instantiated
116
+ - **onupdate**: When `data` or `options` are updated
117
+ - **ondestroy**: When the component is unmounted and the chart is destroyed
116
118
 
117
119
  ```svelte
118
- <BarChartSimple {data} {options} on:load on:update on:destroy />
120
+ <BarChartSimple {data} {options} {onload} {onupdate} {ondestroy} />
119
121
  ```
120
122
 
121
123
  ### Dynamic import
122
124
 
123
- Dynamically import a chart and instantiate it using the
124
- [svelte:component API](https://svelte.dev/docs/special-elements#svelte-component). By importing
125
- `@carbon/charts` within `onMount()`, you avoid problems with server-side rendering.
125
+ Dynamically importing a chart within `onMount()` avoids issues with server-side rendering (SSR). The
126
+ reason `@carbon/charts-svelte` does not work with SRR is because its dependency `@carbon/charts`
127
+ expects the window object to be present for fullscreen display.
126
128
 
127
129
  ```svelte
128
130
  <script>
129
131
  import '@carbon/charts-svelte/styles.css'
130
132
  import { onMount } from 'svelte'
131
133
 
132
- let chart
134
+ let Chart = $state()
133
135
 
134
136
  onMount(async () => {
135
137
  const charts = await import('@carbon/charts-svelte')
136
- chart = charts.BarChartSimple
138
+ Chart = charts.BarChartSimple
137
139
  })
138
140
  </script>
139
141
 
140
- <svelte:component
141
- this={chart}
142
+ <Chart
142
143
  data={[
143
144
  { group: 'Qty', value: 65000 },
144
145
  { group: 'More', value: 29123 },
@@ -168,7 +169,7 @@ hovering over a bar.
168
169
  import { onMount } from 'svelte'
169
170
  import { BarChartSimple } from '@carbon/charts-svelte'
170
171
 
171
- let chart
172
+ let chart = $state()
172
173
 
173
174
  function barMouseOver(e) {
174
175
  console.log(e.detail)
@@ -202,11 +203,6 @@ hovering over a bar.
202
203
  }} />
203
204
  ```
204
205
 
205
- ## Svelte and TypeScript support
206
-
207
- Svelte 3.31 or greater is required to use this library with TypeScript. Svelte 5.20+ is
208
- recommended.
209
-
210
206
  ### Enums and types
211
207
 
212
208
  For your convenience, enums and types from `@carbon/charts` are re-exported from
@@ -228,22 +224,6 @@ const options: BarChartOptions = {
228
224
  }
229
225
  ```
230
226
 
231
- ### Component type
232
-
233
- Use the `ComponentType` utility type from `svelte` to extract the component type for chart
234
- components.
235
-
236
- ```ts
237
- import { onMount, type ComponentType } from 'svelte'
238
- import type { BarChartSimple } from '@carbon/charts-svelte'
239
-
240
- let component: ComponentType<BarChartSimple> = null
241
-
242
- onMount(async () => {
243
- component = (await import('@carbon/charts-svelte')).BarChartSimple
244
- })
245
- ```
246
-
247
227
  ### Component props
248
228
 
249
229
  Use the `ComponentProps` utility type from `svelte` to extract the props for chart components.
@@ -253,20 +233,19 @@ You can then use an
253
233
  extract types for individual properties.
254
234
 
255
235
  ```ts
256
- import { type ComponentProps } from 'svelte'
236
+ import type { ComponentProps } from 'svelte'
257
237
  import { BarChartSimple } from '@carbon/charts-svelte'
238
+ import { options } from './options'
239
+ import { data } from './data'
258
240
 
259
- type ChartProps = ComponentProps<BarChartSimple>
260
-
261
- // Indexed access type to access the type of the `chart` property
262
- let chart: ChartProps['chart'] = null
241
+ // Errors if these aren't the correct props expected by BarChartSimple
242
+ const props: ComponentProps<typeof BarChartSimple> = { options, data }
263
243
  ```
264
244
 
265
245
  ## <picture><source height="20" width="20" media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-dark.svg"><source height="20" width="20" media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-light.svg"><img height="20" width="20" alt="IBM Telemetry" src="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-light.svg"></picture> IBM Telemetry
266
246
 
267
- This package uses IBM Telemetry to collect de-identified and anonymized metrics
268
- data. By installing this package as a dependency you are agreeing to telemetry
269
- collection. To opt out, see
247
+ This package uses IBM Telemetry to collect de-identified and anonymized metrics data. By installing
248
+ this package as a dependency you are agreeing to telemetry collection. To opt out, see
270
249
  [Opting out of IBM Telemetry data collection](https://github.com/ibm-telemetry/telemetry-js/tree/main#opting-out-of-ibm-telemetry-data-collection).
271
250
  For more information on the data being collected, please see the
272
251
  [IBM Telemetry documentation](https://github.com/ibm-telemetry/telemetry-js/tree/main#ibm-telemetry-collection-basics).
@@ -1,19 +1,25 @@
1
1
  <script>
2
2
  import { AlluvialChart as AlluvialChartCore } from '@carbon/charts'
3
3
  import BaseChart from './BaseChart.svelte'
4
- export let options
5
- export let data
6
- export let chart = undefined
7
- export let ref = undefined
4
+ let {
5
+ data,
6
+ options,
7
+ ref = $bindable(),
8
+ chart = $bindable(),
9
+ onload,
10
+ onupdate,
11
+ ondestroy,
12
+ ...rest
13
+ } = $props()
8
14
  </script>
9
15
 
10
16
  <BaseChart
11
- {...$$restProps}
12
17
  Chart={AlluvialChartCore}
13
18
  {options}
14
19
  {data}
15
20
  bind:ref
16
21
  bind:chart
17
- on:load
18
- on:update
19
- on:destroy />
22
+ {onload}
23
+ {onupdate}
24
+ {ondestroy}
25
+ {...rest} />
@@ -1,35 +1,9 @@
1
- import { SvelteComponentTyped } from 'svelte'
2
- import {
3
- AlluvialChart as AlluvialChartCore,
4
- type AlluvialChartOptions,
5
- type ChartTabularData
6
- } from '@carbon/charts'
7
- declare const __propDef: {
8
- props: {
9
- [x: string]: any
10
- options: AlluvialChartOptions
11
- data: ChartTabularData
12
- chart?: AlluvialChartCore | undefined
13
- ref?: HTMLDivElement | undefined
14
- }
15
- events: {
16
- load: CustomEvent<null>
17
- update: CustomEvent<{
18
- data: ChartTabularData
19
- options: import('@carbon/charts').BaseChartOptions
20
- }>
21
- destroy: CustomEvent<null>
22
- } & {
23
- [evt: string]: CustomEvent<any>
24
- }
25
- slots: {}
26
- }
27
- export type AlluvialChartProps = typeof __propDef.props
28
- export type AlluvialChartEvents = typeof __propDef.events
29
- export type AlluvialChartSlots = typeof __propDef.slots
30
- export default class AlluvialChart extends SvelteComponentTyped<
31
- AlluvialChartProps,
32
- AlluvialChartEvents,
33
- AlluvialChartSlots
34
- > {}
35
- export {}
1
+ import { AlluvialChart as AlluvialChartCore, type AlluvialChartOptions } from '@carbon/charts'
2
+ import type { ChartProps } from './interfaces'
3
+ declare const AlluvialChart: import('svelte').Component<
4
+ ChartProps<AlluvialChartCore, AlluvialChartOptions>,
5
+ {},
6
+ 'ref' | 'chart'
7
+ >
8
+ type AlluvialChart = ReturnType<typeof AlluvialChart>
9
+ export default AlluvialChart
@@ -1,19 +1,25 @@
1
1
  <script>
2
2
  import { AreaChart as AreaChartCore } from '@carbon/charts'
3
3
  import BaseChart from './BaseChart.svelte'
4
- export let options
5
- export let data
6
- export let chart = undefined
7
- export let ref = undefined
4
+ let {
5
+ data,
6
+ options,
7
+ ref = $bindable(),
8
+ chart = $bindable(),
9
+ onload,
10
+ onupdate,
11
+ ondestroy,
12
+ ...rest
13
+ } = $props()
8
14
  </script>
9
15
 
10
16
  <BaseChart
11
- {...$$restProps}
12
17
  Chart={AreaChartCore}
13
18
  {options}
14
19
  {data}
15
20
  bind:ref
16
21
  bind:chart
17
- on:load
18
- on:update
19
- on:destroy />
22
+ {onload}
23
+ {onupdate}
24
+ {ondestroy}
25
+ {...rest} />
@@ -1,35 +1,9 @@
1
- import { SvelteComponentTyped } from 'svelte'
2
- import {
3
- AreaChart as AreaChartCore,
4
- type AreaChartOptions,
5
- type ChartTabularData
6
- } from '@carbon/charts'
7
- declare const __propDef: {
8
- props: {
9
- [x: string]: any
10
- options: AreaChartOptions
11
- data: ChartTabularData
12
- chart?: AreaChartCore | undefined
13
- ref?: HTMLDivElement | undefined
14
- }
15
- events: {
16
- load: CustomEvent<null>
17
- update: CustomEvent<{
18
- data: ChartTabularData
19
- options: import('@carbon/charts').BaseChartOptions
20
- }>
21
- destroy: CustomEvent<null>
22
- } & {
23
- [evt: string]: CustomEvent<any>
24
- }
25
- slots: {}
26
- }
27
- export type AreaChartProps = typeof __propDef.props
28
- export type AreaChartEvents = typeof __propDef.events
29
- export type AreaChartSlots = typeof __propDef.slots
30
- export default class AreaChart extends SvelteComponentTyped<
31
- AreaChartProps,
32
- AreaChartEvents,
33
- AreaChartSlots
34
- > {}
35
- export {}
1
+ import { AreaChart as AreaChartCore, type AreaChartOptions } from '@carbon/charts'
2
+ import type { ChartProps } from './interfaces'
3
+ declare const AreaChart: import('svelte').Component<
4
+ ChartProps<AreaChartCore, AreaChartOptions>,
5
+ {},
6
+ 'ref' | 'chart'
7
+ >
8
+ type AreaChart = ReturnType<typeof AreaChart>
9
+ export default AreaChart
@@ -1,19 +1,25 @@
1
1
  <script>
2
2
  import { GroupedBarChart as GroupedBarChartCore } from '@carbon/charts'
3
3
  import BaseChart from './BaseChart.svelte'
4
- export let options
5
- export let data
6
- export let chart = undefined
7
- export let ref = undefined
4
+ let {
5
+ data,
6
+ options,
7
+ ref = $bindable(),
8
+ chart = $bindable(),
9
+ onload,
10
+ onupdate,
11
+ ondestroy,
12
+ ...rest
13
+ } = $props()
8
14
  </script>
9
15
 
10
16
  <BaseChart
11
- {...$$restProps}
12
17
  Chart={GroupedBarChartCore}
13
18
  {options}
14
19
  {data}
15
20
  bind:ref
16
21
  bind:chart
17
- on:load
18
- on:update
19
- on:destroy />
22
+ {onload}
23
+ {onupdate}
24
+ {ondestroy}
25
+ {...rest} />
@@ -1,35 +1,9 @@
1
- import { SvelteComponentTyped } from 'svelte'
2
- import {
3
- GroupedBarChart as GroupedBarChartCore,
4
- type BarChartOptions,
5
- type ChartTabularData
6
- } from '@carbon/charts'
7
- declare const __propDef: {
8
- props: {
9
- [x: string]: any
10
- options: BarChartOptions
11
- data: ChartTabularData
12
- chart?: GroupedBarChartCore | undefined
13
- ref?: HTMLDivElement | undefined
14
- }
15
- events: {
16
- load: CustomEvent<null>
17
- update: CustomEvent<{
18
- data: ChartTabularData
19
- options: import('@carbon/charts').BaseChartOptions
20
- }>
21
- destroy: CustomEvent<null>
22
- } & {
23
- [evt: string]: CustomEvent<any>
24
- }
25
- slots: {}
26
- }
27
- export type BarChartGroupedProps = typeof __propDef.props
28
- export type BarChartGroupedEvents = typeof __propDef.events
29
- export type BarChartGroupedSlots = typeof __propDef.slots
30
- export default class BarChartGrouped extends SvelteComponentTyped<
31
- BarChartGroupedProps,
32
- BarChartGroupedEvents,
33
- BarChartGroupedSlots
34
- > {}
35
- export {}
1
+ import { GroupedBarChart as GroupedBarChartCore, type BarChartOptions } from '@carbon/charts'
2
+ import type { ChartProps } from './interfaces'
3
+ declare const BarChartGrouped: import('svelte').Component<
4
+ ChartProps<GroupedBarChartCore, BarChartOptions>,
5
+ {},
6
+ 'ref' | 'chart'
7
+ >
8
+ type BarChartGrouped = ReturnType<typeof BarChartGrouped>
9
+ export default BarChartGrouped
@@ -1,19 +1,25 @@
1
1
  <script>
2
2
  import { SimpleBarChart as SimpleBarChartCore } from '@carbon/charts'
3
3
  import BaseChart from './BaseChart.svelte'
4
- export let options
5
- export let data
6
- export let chart = undefined
7
- export let ref = undefined
4
+ let {
5
+ data,
6
+ options,
7
+ ref = $bindable(),
8
+ chart = $bindable(),
9
+ onload,
10
+ onupdate,
11
+ ondestroy,
12
+ ...rest
13
+ } = $props()
8
14
  </script>
9
15
 
10
16
  <BaseChart
11
- {...$$restProps}
12
17
  Chart={SimpleBarChartCore}
13
18
  {options}
14
19
  {data}
15
20
  bind:ref
16
21
  bind:chart
17
- on:load
18
- on:update
19
- on:destroy />
22
+ {onload}
23
+ {onupdate}
24
+ {ondestroy}
25
+ {...rest} />
@@ -1,35 +1,9 @@
1
- import { SvelteComponentTyped } from 'svelte'
2
- import {
3
- SimpleBarChart as SimpleBarChartCore,
4
- type BarChartOptions,
5
- type ChartTabularData
6
- } from '@carbon/charts'
7
- declare const __propDef: {
8
- props: {
9
- [x: string]: any
10
- options: BarChartOptions
11
- data: ChartTabularData
12
- chart?: SimpleBarChartCore | undefined
13
- ref?: HTMLDivElement | undefined
14
- }
15
- events: {
16
- load: CustomEvent<null>
17
- update: CustomEvent<{
18
- data: ChartTabularData
19
- options: import('@carbon/charts').BaseChartOptions
20
- }>
21
- destroy: CustomEvent<null>
22
- } & {
23
- [evt: string]: CustomEvent<any>
24
- }
25
- slots: {}
26
- }
27
- export type BarChartSimpleProps = typeof __propDef.props
28
- export type BarChartSimpleEvents = typeof __propDef.events
29
- export type BarChartSimpleSlots = typeof __propDef.slots
30
- export default class BarChartSimple extends SvelteComponentTyped<
31
- BarChartSimpleProps,
32
- BarChartSimpleEvents,
33
- BarChartSimpleSlots
34
- > {}
35
- export {}
1
+ import { SimpleBarChart as SimpleBarChartCore, type BarChartOptions } from '@carbon/charts'
2
+ import type { ChartProps } from './interfaces'
3
+ declare const BarChartSimple: import('svelte').Component<
4
+ ChartProps<SimpleBarChartCore, BarChartOptions>,
5
+ {},
6
+ 'ref' | 'chart'
7
+ >
8
+ type BarChartSimple = ReturnType<typeof BarChartSimple>
9
+ export default BarChartSimple
@@ -1,19 +1,25 @@
1
1
  <script>
2
2
  import { StackedBarChart as StackedBarChartCore } from '@carbon/charts'
3
3
  import BaseChart from './BaseChart.svelte'
4
- export let options
5
- export let data
6
- export let chart = undefined
7
- export let ref = undefined
4
+ let {
5
+ data,
6
+ options,
7
+ ref = $bindable(),
8
+ chart = $bindable(),
9
+ onload,
10
+ onupdate,
11
+ ondestroy,
12
+ ...rest
13
+ } = $props()
8
14
  </script>
9
15
 
10
16
  <BaseChart
11
- {...$$restProps}
12
17
  Chart={StackedBarChartCore}
13
18
  {options}
14
19
  {data}
15
20
  bind:ref
16
21
  bind:chart
17
- on:load
18
- on:update
19
- on:destroy />
22
+ {onload}
23
+ {onupdate}
24
+ {ondestroy}
25
+ {...rest} />
@@ -1,35 +1,9 @@
1
- import { SvelteComponentTyped } from 'svelte'
2
- import {
3
- StackedBarChart as StackedBarChartCore,
4
- type BarChartOptions,
5
- type ChartTabularData
6
- } from '@carbon/charts'
7
- declare const __propDef: {
8
- props: {
9
- [x: string]: any
10
- options: BarChartOptions
11
- data: ChartTabularData
12
- chart?: StackedBarChartCore | undefined
13
- ref?: HTMLDivElement | undefined
14
- }
15
- events: {
16
- load: CustomEvent<null>
17
- update: CustomEvent<{
18
- data: ChartTabularData
19
- options: import('@carbon/charts').BaseChartOptions
20
- }>
21
- destroy: CustomEvent<null>
22
- } & {
23
- [evt: string]: CustomEvent<any>
24
- }
25
- slots: {}
26
- }
27
- export type BarChartStackedProps = typeof __propDef.props
28
- export type BarChartStackedEvents = typeof __propDef.events
29
- export type BarChartStackedSlots = typeof __propDef.slots
30
- export default class BarChartStacked extends SvelteComponentTyped<
31
- BarChartStackedProps,
32
- BarChartStackedEvents,
33
- BarChartStackedSlots
34
- > {}
35
- export {}
1
+ import { StackedBarChart as StackedBarChartCore, type BarChartOptions } from '@carbon/charts'
2
+ import type { ChartProps } from './interfaces'
3
+ declare const BarChartStacked: import('svelte').Component<
4
+ ChartProps<StackedBarChartCore, BarChartOptions>,
5
+ {},
6
+ 'ref' | 'chart'
7
+ >
8
+ type BarChartStacked = ReturnType<typeof BarChartStacked>
9
+ export default BarChartStacked