@carbon/charts-svelte 1.13.10 → 1.13.12

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/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
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.13.12 (2023-12-18)
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.13.11 (2023-12-18)
16
+
17
+ ### Bug Fixes
18
+
19
+ - **svelte:** strongly type dispatched events
20
+ ([#1703](https://github.com/carbon-design-system/carbon-charts/issues/1703))
21
+ ([1a37ef2](https://github.com/carbon-design-system/carbon-charts/commit/1a37ef2be692400b257446f62d1350899e27dd59))
22
+
23
+ # Change Log
24
+
25
+ All notable changes to this project will be documented in this file. See
26
+ [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
27
+
6
28
  ## 1.13.10 (2023-12-18)
7
29
 
8
30
  **Note:** Version bump only for package @carbon/charts-svelte
package/README.md CHANGED
@@ -145,7 +145,7 @@ In this example, an event listener is attached to the `BarChartSimple` component
145
145
  ```svelte
146
146
  <script>
147
147
  import '@carbon/charts-svelte/styles.css'
148
- import { onDestroy, onMount } from 'svelte'
148
+ import { onMount } from 'svelte'
149
149
  import { BarChartSimple } from '@carbon/charts-svelte'
150
150
 
151
151
  let chart
@@ -155,16 +155,12 @@ In this example, an event listener is attached to the `BarChartSimple` component
155
155
  }
156
156
 
157
157
  onMount(() => {
158
- // do something
159
- })
158
+ chart.services.events.addEventListener('bar-mouseover', barMouseOver)
160
159
 
161
- onDestroy(() => {
162
- if (chart) {
163
- chart.services.events.removeEventListener('bar-mouseover', barMouseOver)
160
+ return () => {
161
+ chart?.services.events.removeEventListener('bar-mouseover', barMouseOver)
164
162
  }
165
163
  })
166
-
167
- $: if (chart) chart.services.events.addEventListener('bar-mouseover', barMouseOver)
168
164
  </script>
169
165
 
170
166
  <BarChartSimple
@@ -206,3 +202,58 @@ Customizable options (specific to chart type) can be found
206
202
  ## TypeScript support
207
203
 
208
204
  Svelte version 3.31 or greater is required to use this library with TypeScript. Svelte 4.x+ is recommended.
205
+
206
+ ### Enums and types
207
+
208
+ For your convenience, enums and types from `@carbon/charts` are re-exported from
209
+ `@carbon/charts-svelte`.
210
+
211
+ ```ts
212
+ import { ScaleTypes, type BarChartOptions } from '@carbon/charts-svelte'
213
+
214
+ const options: BarChartOptions = {
215
+ title: 'Simple bar (discrete)',
216
+ height: '400px',
217
+ axes: {
218
+ left: { mapsTo: 'value' },
219
+ bottom: {
220
+ mapsTo: 'group',
221
+ scaleType: ScaleTypes.LABELS
222
+ }
223
+ }
224
+ }
225
+ ```
226
+
227
+ ### Component type
228
+
229
+ Use the `ComponentType` utility type from `svelte` to extract the component type for chart
230
+ components.
231
+
232
+ ```ts
233
+ import { onMount, type ComponentType } from 'svelte'
234
+ import type { BarChartSimple } from '@carbon/charts-svelte'
235
+
236
+ let component: ComponentType<BarChartSimple> = null
237
+
238
+ onMount(async () => {
239
+ component = (await import('@carbon/charts-svelte')).BarChartSimple
240
+ })
241
+ ```
242
+
243
+ ### Component props
244
+
245
+ Use the `ComponentProps` utility type from `svelte` to extract the props for chart components.
246
+
247
+ You can then use an
248
+ [indexed access type](https://www.typescriptlang.org/docs/handbook/2/indexed-access-types.html) to
249
+ extract types for individual properties.
250
+
251
+ ```ts
252
+ import { type ComponentProps } from 'svelte'
253
+ import { BarChartSimple } from '@carbon/charts-svelte'
254
+
255
+ type ChartProps = ComponentProps<BarChartSimple>
256
+
257
+ // Indexed access type to access the type of the `chart` property
258
+ let chart: ChartProps['chart'] = null
259
+ ```
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -14,9 +14,12 @@ declare const __propDef: {
14
14
  id?: string;
15
15
  };
16
16
  events: {
17
- load: CustomEvent<any>;
18
- update: CustomEvent<any>;
19
- destroy: CustomEvent<any>;
17
+ load: CustomEvent<null>;
18
+ update: CustomEvent<{
19
+ data: ChartTabularData;
20
+ options: ChartOptions;
21
+ }>;
22
+ destroy: CustomEvent<null>;
20
23
  } & {
21
24
  [evt: string]: CustomEvent<any>;
22
25
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
@@ -9,9 +9,12 @@ declare const __propDef: {
9
9
  ref?: HTMLDivElement | null;
10
10
  };
11
11
  events: {
12
- load: CustomEvent<any>;
13
- update: CustomEvent<any>;
14
- destroy: CustomEvent<any>;
12
+ load: CustomEvent<null>;
13
+ update: CustomEvent<{
14
+ data: ChartTabularData;
15
+ options: import("@carbon/charts").ChartOptions;
16
+ }>;
17
+ destroy: CustomEvent<null>;
15
18
  } & {
16
19
  [evt: string]: CustomEvent<any>;
17
20
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbon/charts-svelte",
3
- "version": "1.13.10",
3
+ "version": "1.13.12",
4
4
  "description": "Carbon Charts component library for Svelte",
5
5
  "scripts": {
6
6
  "postinstall": "carbon-telemetry collect --install",
@@ -42,7 +42,7 @@
42
42
  "svelte": "^3.31.0 || ^4.0.0"
43
43
  },
44
44
  "dependencies": {
45
- "@carbon/charts": "1.13.10",
45
+ "@carbon/charts": "1.13.12",
46
46
  "@carbon/telemetry": "~0.1.0"
47
47
  },
48
48
  "devDependencies": {
@@ -119,5 +119,5 @@
119
119
  "data",
120
120
  "typescript"
121
121
  ],
122
- "gitHead": "b9a0536ba2cdcd7f1c23473e4275c17fd40e7cd8"
122
+ "gitHead": "8e029f879a8c0236afb243c70d3fd0ada8ba9e8a"
123
123
  }