@carbon/charts-svelte 1.22.17 → 1.22.19

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 (63) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +35 -54
  3. package/dist/AlluvialChart.svelte +16 -15
  4. package/dist/AlluvialChart.svelte.d.ts +9 -32
  5. package/dist/AreaChart.svelte +16 -15
  6. package/dist/AreaChart.svelte.d.ts +9 -32
  7. package/dist/BarChartGrouped.svelte +16 -15
  8. package/dist/BarChartGrouped.svelte.d.ts +9 -32
  9. package/dist/BarChartSimple.svelte +16 -15
  10. package/dist/BarChartSimple.svelte.d.ts +9 -32
  11. package/dist/BarChartStacked.svelte +16 -14
  12. package/dist/BarChartStacked.svelte.d.ts +9 -32
  13. package/dist/BaseChart.svelte +24 -39
  14. package/dist/BaseChart.svelte.d.ts +32 -34
  15. package/dist/BoxplotChart.svelte +16 -15
  16. package/dist/BoxplotChart.svelte.d.ts +9 -32
  17. package/dist/BubbleChart.svelte +16 -15
  18. package/dist/BubbleChart.svelte.d.ts +9 -32
  19. package/dist/BulletChart.svelte +16 -15
  20. package/dist/BulletChart.svelte.d.ts +9 -32
  21. package/dist/ChoroplethChart.svelte +16 -15
  22. package/dist/ChoroplethChart.svelte.d.ts +9 -32
  23. package/dist/CirclePackChart.svelte +16 -15
  24. package/dist/CirclePackChart.svelte.d.ts +9 -32
  25. package/dist/ComboChart.svelte +16 -15
  26. package/dist/ComboChart.svelte.d.ts +9 -32
  27. package/dist/DonutChart.svelte +16 -15
  28. package/dist/DonutChart.svelte.d.ts +9 -32
  29. package/dist/GaugeChart.svelte +16 -15
  30. package/dist/GaugeChart.svelte.d.ts +9 -32
  31. package/dist/HeatmapChart.svelte +16 -15
  32. package/dist/HeatmapChart.svelte.d.ts +9 -32
  33. package/dist/HistogramChart.svelte +16 -15
  34. package/dist/HistogramChart.svelte.d.ts +9 -32
  35. package/dist/LineChart.svelte +16 -15
  36. package/dist/LineChart.svelte.d.ts +9 -32
  37. package/dist/LollipopChart.svelte +16 -15
  38. package/dist/LollipopChart.svelte.d.ts +9 -32
  39. package/dist/MeterChart.svelte +16 -15
  40. package/dist/MeterChart.svelte.d.ts +9 -32
  41. package/dist/PieChart.svelte +16 -15
  42. package/dist/PieChart.svelte.d.ts +9 -32
  43. package/dist/RadarChart.svelte +16 -15
  44. package/dist/RadarChart.svelte.d.ts +9 -32
  45. package/dist/ScatterChart.svelte +16 -15
  46. package/dist/ScatterChart.svelte.d.ts +9 -32
  47. package/dist/StackedAreaChart.svelte +16 -15
  48. package/dist/StackedAreaChart.svelte.d.ts +12 -32
  49. package/dist/TreeChart.svelte +16 -15
  50. package/dist/TreeChart.svelte.d.ts +9 -32
  51. package/dist/TreemapChart.svelte +16 -15
  52. package/dist/TreemapChart.svelte.d.ts +9 -32
  53. package/dist/WordCloudChart.svelte +16 -16
  54. package/dist/WordCloudChart.svelte.d.ts +9 -32
  55. package/dist/index.d.ts +141 -36
  56. package/dist/index.js +109 -31
  57. package/dist/interfaces.d.ts +24 -0
  58. package/dist/interfaces.js +1 -0
  59. package/dist/styles.css +4656 -4357
  60. package/dist/styles.css.map +1 -1
  61. package/dist/styles.min.css +7097 -1
  62. package/dist/styles.min.css.map +1 -1
  63. package/package.json +16 -12
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.19 (2025-02-27)
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.18 (2025-02-18)
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.17 (2025-02-12)
7
25
 
8
26
  ### Bug Fixes
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,38 +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
+ ## 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`.
50
+
45
51
  ### SvelteKit
46
52
 
47
53
  While this component library can be used with any build environments for Svelte,
48
54
  [SvelteKit](https://kit.svelte.dev) is the official framework for building Svelte apps supporting
49
- 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).
50
56
 
51
57
  The module `@carbon/charts` should not be externalized for SSR when building for production.
52
58
 
53
59
  ```js
54
- // vite.config.mjs
60
+ // vite.config.ts
55
61
  import { sveltekit } from '@sveltejs/kit/vite'
62
+ import { defineConfig } from 'vite'
56
63
 
57
- /** @type {import('vite').UserConfig} */
58
- const config = {
64
+ export default defineConfig({
59
65
  plugins: [sveltekit()],
60
66
  ssr: {
61
67
  noExternal: process.env.NODE_ENV === 'production' ? ['@carbon/charts'] : []
62
68
  }
63
- }
64
-
65
- export default config
69
+ })
66
70
  ```
67
71
 
68
72
  #### Circular dependency warnings
@@ -104,39 +108,38 @@ import '@carbon/charts-svelte/styles.css'
104
108
  }} />
105
109
  ```
106
110
 
107
- ### Dispatched events
111
+ ### Lifecycle callbacks
108
112
 
109
- Each Svelte chart component dispatches the following events:
113
+ Chart components fire the following callbacks:
110
114
 
111
- - **on:load**: fired when the chart is instantiated
112
- - **on:update**: fired when `data` or `options` are updated
113
- - **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
114
118
 
115
119
  ```svelte
116
- <BarChartSimple {data} {options} on:load on:update on:destroy />
120
+ <BarChartSimple {data} {options} {onload} {onupdate} {ondestroy} />
117
121
  ```
118
122
 
119
123
  ### Dynamic import
120
124
 
121
- Dynamically import a chart and instantiate it using the
122
- [svelte:component API](https://svelte.dev/docs/special-elements#svelte-component). By importing
123
- `@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.
124
128
 
125
129
  ```svelte
126
130
  <script>
127
131
  import '@carbon/charts-svelte/styles.css'
128
132
  import { onMount } from 'svelte'
129
133
 
130
- let chart
134
+ let Chart = $state()
131
135
 
132
136
  onMount(async () => {
133
137
  const charts = await import('@carbon/charts-svelte')
134
- chart = charts.BarChartSimple
138
+ Chart = charts.BarChartSimple
135
139
  })
136
140
  </script>
137
141
 
138
- <svelte:component
139
- this={chart}
142
+ <Chart
140
143
  data={[
141
144
  { group: 'Qty', value: 65000 },
142
145
  { group: 'More', value: 29123 },
@@ -166,7 +169,7 @@ hovering over a bar.
166
169
  import { onMount } from 'svelte'
167
170
  import { BarChartSimple } from '@carbon/charts-svelte'
168
171
 
169
- let chart
172
+ let chart = $state()
170
173
 
171
174
  function barMouseOver(e) {
172
175
  console.log(e.detail)
@@ -200,11 +203,6 @@ hovering over a bar.
200
203
  }} />
201
204
  ```
202
205
 
203
- ## TypeScript support
204
-
205
- Svelte version 3.31 or greater is required to use this library with TypeScript. Svelte 4.x+ is
206
- recommended.
207
-
208
206
  ### Enums and types
209
207
 
210
208
  For your convenience, enums and types from `@carbon/charts` are re-exported from
@@ -226,22 +224,6 @@ const options: BarChartOptions = {
226
224
  }
227
225
  ```
228
226
 
229
- ### Component type
230
-
231
- Use the `ComponentType` utility type from `svelte` to extract the component type for chart
232
- components.
233
-
234
- ```ts
235
- import { onMount, type ComponentType } from 'svelte'
236
- import type { BarChartSimple } from '@carbon/charts-svelte'
237
-
238
- let component: ComponentType<BarChartSimple> = null
239
-
240
- onMount(async () => {
241
- component = (await import('@carbon/charts-svelte')).BarChartSimple
242
- })
243
- ```
244
-
245
227
  ### Component props
246
228
 
247
229
  Use the `ComponentProps` utility type from `svelte` to extract the props for chart components.
@@ -251,20 +233,19 @@ You can then use an
251
233
  extract types for individual properties.
252
234
 
253
235
  ```ts
254
- import { type ComponentProps } from 'svelte'
236
+ import type { ComponentProps } from 'svelte'
255
237
  import { BarChartSimple } from '@carbon/charts-svelte'
238
+ import { options } from './options'
239
+ import { data } from './data'
256
240
 
257
- type ChartProps = ComponentProps<BarChartSimple>
258
-
259
- // Indexed access type to access the type of the `chart` property
260
- 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 }
261
243
  ```
262
244
 
263
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
264
246
 
265
- This package uses IBM Telemetry to collect de-identified and anonymized metrics
266
- data. By installing this package as a dependency you are agreeing to telemetry
267
- 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
268
249
  [Opting out of IBM Telemetry data collection](https://github.com/ibm-telemetry/telemetry-js/tree/main#opting-out-of-ibm-telemetry-data-collection).
269
250
  For more information on the data being collected, please see the
270
251
  [IBM Telemetry documentation](https://github.com/ibm-telemetry/telemetry-js/tree/main#ibm-telemetry-collection-basics).
@@ -1,24 +1,25 @@
1
- <script lang="ts">
2
- import {
3
- AlluvialChart as AlluvialChartCore,
4
- type AlluvialChartOptions,
5
- type ChartTabularData
6
- } from '@carbon/charts'
1
+ <script>
2
+ import { AlluvialChart as AlluvialChartCore } from '@carbon/charts'
7
3
  import BaseChart from './BaseChart.svelte'
8
-
9
- export let options: AlluvialChartOptions
10
- export let data: ChartTabularData
11
- export let chart: AlluvialChartCore | undefined = undefined
12
- export let ref: HTMLDivElement | undefined = undefined
4
+ let {
5
+ data,
6
+ options,
7
+ ref = $bindable(),
8
+ chart = $bindable(),
9
+ onload,
10
+ onupdate,
11
+ ondestroy,
12
+ ...rest
13
+ } = $props()
13
14
  </script>
14
15
 
15
16
  <BaseChart
16
- {...$$restProps}
17
17
  Chart={AlluvialChartCore}
18
18
  {options}
19
19
  {data}
20
20
  bind:ref
21
21
  bind:chart
22
- on:load
23
- on:update
24
- on:destroy />
22
+ {onload}
23
+ {onupdate}
24
+ {ondestroy}
25
+ {...rest} />
@@ -1,32 +1,9 @@
1
- import { AlluvialChart as AlluvialChartCore, type AlluvialChartOptions, type ChartTabularData } from '@carbon/charts';
2
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
- $$bindings?: Bindings;
5
- } & Exports;
6
- (internal: unknown, props: Props & {
7
- $$events?: Events;
8
- $$slots?: Slots;
9
- }): Exports & {
10
- $set?: any;
11
- $on?: any;
12
- };
13
- z_$$bindings?: Bindings;
14
- }
15
- declare const AlluvialChart: $$__sveltets_2_IsomorphicComponent<{
16
- [x: string]: any;
17
- options: AlluvialChartOptions;
18
- data: ChartTabularData;
19
- chart?: AlluvialChartCore | undefined;
20
- ref?: HTMLDivElement | undefined;
21
- }, {
22
- load: CustomEvent<null>;
23
- update: CustomEvent<{
24
- data: ChartTabularData;
25
- options: import("@carbon/charts").BaseChartOptions;
26
- }>;
27
- destroy: CustomEvent<null>;
28
- } & {
29
- [evt: string]: CustomEvent<any>;
30
- }, {}, {}, string>;
31
- type AlluvialChart = InstanceType<typeof AlluvialChart>;
32
- export default AlluvialChart;
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,24 +1,25 @@
1
- <script lang="ts">
2
- import {
3
- AreaChart as AreaChartCore,
4
- type AreaChartOptions,
5
- type ChartTabularData
6
- } from '@carbon/charts'
1
+ <script>
2
+ import { AreaChart as AreaChartCore } from '@carbon/charts'
7
3
  import BaseChart from './BaseChart.svelte'
8
-
9
- export let options: AreaChartOptions
10
- export let data: ChartTabularData
11
- export let chart: AreaChartCore | undefined = undefined
12
- export let ref: HTMLDivElement | undefined = undefined
4
+ let {
5
+ data,
6
+ options,
7
+ ref = $bindable(),
8
+ chart = $bindable(),
9
+ onload,
10
+ onupdate,
11
+ ondestroy,
12
+ ...rest
13
+ } = $props()
13
14
  </script>
14
15
 
15
16
  <BaseChart
16
- {...$$restProps}
17
17
  Chart={AreaChartCore}
18
18
  {options}
19
19
  {data}
20
20
  bind:ref
21
21
  bind:chart
22
- on:load
23
- on:update
24
- on:destroy />
22
+ {onload}
23
+ {onupdate}
24
+ {ondestroy}
25
+ {...rest} />
@@ -1,32 +1,9 @@
1
- import { AreaChart as AreaChartCore, type AreaChartOptions, type ChartTabularData } from '@carbon/charts';
2
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
- $$bindings?: Bindings;
5
- } & Exports;
6
- (internal: unknown, props: Props & {
7
- $$events?: Events;
8
- $$slots?: Slots;
9
- }): Exports & {
10
- $set?: any;
11
- $on?: any;
12
- };
13
- z_$$bindings?: Bindings;
14
- }
15
- declare const AreaChart: $$__sveltets_2_IsomorphicComponent<{
16
- [x: string]: any;
17
- options: AreaChartOptions;
18
- data: ChartTabularData;
19
- chart?: AreaChartCore | undefined;
20
- ref?: HTMLDivElement | undefined;
21
- }, {
22
- load: CustomEvent<null>;
23
- update: CustomEvent<{
24
- data: ChartTabularData;
25
- options: import("@carbon/charts").BaseChartOptions;
26
- }>;
27
- destroy: CustomEvent<null>;
28
- } & {
29
- [evt: string]: CustomEvent<any>;
30
- }, {}, {}, string>;
31
- type AreaChart = InstanceType<typeof AreaChart>;
32
- export default AreaChart;
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,24 +1,25 @@
1
- <script lang="ts">
2
- import {
3
- GroupedBarChart as GroupedBarChartCore,
4
- type BarChartOptions,
5
- type ChartTabularData
6
- } from '@carbon/charts'
1
+ <script>
2
+ import { GroupedBarChart as GroupedBarChartCore } from '@carbon/charts'
7
3
  import BaseChart from './BaseChart.svelte'
8
-
9
- export let options: BarChartOptions
10
- export let data: ChartTabularData
11
- export let chart: GroupedBarChartCore | undefined = undefined
12
- export let ref: HTMLDivElement | undefined = undefined
4
+ let {
5
+ data,
6
+ options,
7
+ ref = $bindable(),
8
+ chart = $bindable(),
9
+ onload,
10
+ onupdate,
11
+ ondestroy,
12
+ ...rest
13
+ } = $props()
13
14
  </script>
14
15
 
15
16
  <BaseChart
16
- {...$$restProps}
17
17
  Chart={GroupedBarChartCore}
18
18
  {options}
19
19
  {data}
20
20
  bind:ref
21
21
  bind:chart
22
- on:load
23
- on:update
24
- on:destroy />
22
+ {onload}
23
+ {onupdate}
24
+ {ondestroy}
25
+ {...rest} />
@@ -1,32 +1,9 @@
1
- import { GroupedBarChart as GroupedBarChartCore, type BarChartOptions, type ChartTabularData } from '@carbon/charts';
2
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
- $$bindings?: Bindings;
5
- } & Exports;
6
- (internal: unknown, props: Props & {
7
- $$events?: Events;
8
- $$slots?: Slots;
9
- }): Exports & {
10
- $set?: any;
11
- $on?: any;
12
- };
13
- z_$$bindings?: Bindings;
14
- }
15
- declare const BarChartGrouped: $$__sveltets_2_IsomorphicComponent<{
16
- [x: string]: any;
17
- options: BarChartOptions;
18
- data: ChartTabularData;
19
- chart?: GroupedBarChartCore | undefined;
20
- ref?: HTMLDivElement | undefined;
21
- }, {
22
- load: CustomEvent<null>;
23
- update: CustomEvent<{
24
- data: ChartTabularData;
25
- options: import("@carbon/charts").BaseChartOptions;
26
- }>;
27
- destroy: CustomEvent<null>;
28
- } & {
29
- [evt: string]: CustomEvent<any>;
30
- }, {}, {}, string>;
31
- type BarChartGrouped = InstanceType<typeof BarChartGrouped>;
32
- export default BarChartGrouped;
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,24 +1,25 @@
1
- <script lang="ts">
2
- import {
3
- SimpleBarChart as SimpleBarChartCore,
4
- type BarChartOptions,
5
- type ChartTabularData
6
- } from '@carbon/charts'
1
+ <script>
2
+ import { SimpleBarChart as SimpleBarChartCore } from '@carbon/charts'
7
3
  import BaseChart from './BaseChart.svelte'
8
-
9
- export let options: BarChartOptions
10
- export let data: ChartTabularData
11
- export let chart: SimpleBarChartCore | undefined = undefined
12
- export let ref: HTMLDivElement | undefined = undefined
4
+ let {
5
+ data,
6
+ options,
7
+ ref = $bindable(),
8
+ chart = $bindable(),
9
+ onload,
10
+ onupdate,
11
+ ondestroy,
12
+ ...rest
13
+ } = $props()
13
14
  </script>
14
15
 
15
16
  <BaseChart
16
- {...$$restProps}
17
17
  Chart={SimpleBarChartCore}
18
18
  {options}
19
19
  {data}
20
20
  bind:ref
21
21
  bind:chart
22
- on:load
23
- on:update
24
- on:destroy />
22
+ {onload}
23
+ {onupdate}
24
+ {ondestroy}
25
+ {...rest} />
@@ -1,32 +1,9 @@
1
- import { SimpleBarChart as SimpleBarChartCore, type BarChartOptions, type ChartTabularData } from '@carbon/charts';
2
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
- $$bindings?: Bindings;
5
- } & Exports;
6
- (internal: unknown, props: Props & {
7
- $$events?: Events;
8
- $$slots?: Slots;
9
- }): Exports & {
10
- $set?: any;
11
- $on?: any;
12
- };
13
- z_$$bindings?: Bindings;
14
- }
15
- declare const BarChartSimple: $$__sveltets_2_IsomorphicComponent<{
16
- [x: string]: any;
17
- options: BarChartOptions;
18
- data: ChartTabularData;
19
- chart?: SimpleBarChartCore | undefined;
20
- ref?: HTMLDivElement | undefined;
21
- }, {
22
- load: CustomEvent<null>;
23
- update: CustomEvent<{
24
- data: ChartTabularData;
25
- options: import("@carbon/charts").BaseChartOptions;
26
- }>;
27
- destroy: CustomEvent<null>;
28
- } & {
29
- [evt: string]: CustomEvent<any>;
30
- }, {}, {}, string>;
31
- type BarChartSimple = InstanceType<typeof BarChartSimple>;
32
- export default BarChartSimple;
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,23 +1,25 @@
1
- <script lang="ts">
2
- import {
3
- StackedBarChart as StackedBarChartCore,
4
- type BarChartOptions,
5
- type ChartTabularData
6
- } from '@carbon/charts'
1
+ <script>
2
+ import { StackedBarChart as StackedBarChartCore } from '@carbon/charts'
7
3
  import BaseChart from './BaseChart.svelte'
8
- export let options: BarChartOptions
9
- export let data: ChartTabularData
10
- export let chart: StackedBarChartCore | undefined = undefined
11
- export let ref: HTMLDivElement | undefined = undefined
4
+ let {
5
+ data,
6
+ options,
7
+ ref = $bindable(),
8
+ chart = $bindable(),
9
+ onload,
10
+ onupdate,
11
+ ondestroy,
12
+ ...rest
13
+ } = $props()
12
14
  </script>
13
15
 
14
16
  <BaseChart
15
- {...$$restProps}
16
17
  Chart={StackedBarChartCore}
17
18
  {options}
18
19
  {data}
19
20
  bind:ref
20
21
  bind:chart
21
- on:load
22
- on:update
23
- on:destroy />
22
+ {onload}
23
+ {onupdate}
24
+ {ondestroy}
25
+ {...rest} />
@@ -1,32 +1,9 @@
1
- import { StackedBarChart as StackedBarChartCore, type BarChartOptions, type ChartTabularData } from '@carbon/charts';
2
- interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
3
- new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
4
- $$bindings?: Bindings;
5
- } & Exports;
6
- (internal: unknown, props: Props & {
7
- $$events?: Events;
8
- $$slots?: Slots;
9
- }): Exports & {
10
- $set?: any;
11
- $on?: any;
12
- };
13
- z_$$bindings?: Bindings;
14
- }
15
- declare const BarChartStacked: $$__sveltets_2_IsomorphicComponent<{
16
- [x: string]: any;
17
- options: BarChartOptions;
18
- data: ChartTabularData;
19
- chart?: StackedBarChartCore | undefined;
20
- ref?: HTMLDivElement | undefined;
21
- }, {
22
- load: CustomEvent<null>;
23
- update: CustomEvent<{
24
- data: ChartTabularData;
25
- options: import("@carbon/charts").BaseChartOptions;
26
- }>;
27
- destroy: CustomEvent<null>;
28
- } & {
29
- [evt: string]: CustomEvent<any>;
30
- }, {}, {}, string>;
31
- type BarChartStacked = InstanceType<typeof BarChartStacked>;
32
- export default BarChartStacked;
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