layerchart 0.72.2 → 0.73.0

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.
@@ -92,6 +92,13 @@
92
92
  points?: Partial<ComponentProps<Points>>;
93
93
  highlight?: Partial<ComponentProps<Highlight>>;
94
94
  labels?: Partial<ComponentProps<Labels>>;
95
+ tooltip?: {
96
+ root?: Partial<ComponentProps<Tooltip.Root>>;
97
+ header?: Partial<ComponentProps<Tooltip.Header>>;
98
+ list?: Partial<ComponentProps<Tooltip.List>>;
99
+ item?: Partial<ComponentProps<Tooltip.Item>>;
100
+ separator?: Partial<ComponentProps<Tooltip.Separator>>;
101
+ };
95
102
  } = {};
96
103
 
97
104
  export let renderContext: 'svg' | 'canvas' = 'svg';
@@ -303,9 +310,9 @@
303
310
  </slot>
304
311
 
305
312
  <slot name="tooltip" {...slotProps}>
306
- <Tooltip.Root let:data>
307
- <Tooltip.Header>{format(x(data))}</Tooltip.Header>
308
- <Tooltip.List>
313
+ <Tooltip.Root {...props.tooltip?.root} let:data>
314
+ <Tooltip.Header {...props.tooltip?.header}>{format(x(data))}</Tooltip.Header>
315
+ <Tooltip.List {...props.tooltip?.list}>
309
316
  <!-- Reverse series order so tooltip items match stacks -->
310
317
  {@const seriesItems = stackSeries ? [...series].reverse() : series}
311
318
  {#each seriesItems as s}
@@ -318,11 +325,12 @@
318
325
  color={s.color}
319
326
  {format}
320
327
  valueAlign="right"
328
+ {...props.tooltip?.item}
321
329
  />
322
330
  {/each}
323
331
 
324
332
  {#if stackSeries}
325
- <Tooltip.Separator />
333
+ <Tooltip.Separator {...props.tooltip?.separator} />
326
334
 
327
335
  <Tooltip.Item
328
336
  label="total"
@@ -334,6 +342,7 @@
334
342
  })}
335
343
  format="integer"
336
344
  valueAlign="right"
345
+ {...props.tooltip?.root}
337
346
  />
338
347
  {/if}
339
348
  </Tooltip.List>
@@ -127,6 +127,13 @@
127
127
  legend?: Partial<ComponentProps<Legend>>;
128
128
  highlight?: Partial<ComponentProps<Highlight>>;
129
129
  labels?: Partial<ComponentProps<Labels>>;
130
+ tooltip?: {
131
+ root?: Partial<ComponentProps<Tooltip.Root>>;
132
+ header?: Partial<ComponentProps<Tooltip.Header>>;
133
+ list?: Partial<ComponentProps<Tooltip.List>>;
134
+ item?: Partial<ComponentProps<Tooltip.Item>>;
135
+ separator?: Partial<ComponentProps<Tooltip.Separator>>;
136
+ };
130
137
  } = {};
131
138
 
132
139
  export let renderContext: 'svg' | 'canvas' = 'svg';
@@ -337,9 +344,11 @@
337
344
  </slot>
338
345
 
339
346
  <slot name="tooltip" {...slotProps}>
340
- <Tooltip.Root let:data>
341
- <Tooltip.Header>{format(isVertical ? x(data) : y(data))}</Tooltip.Header>
342
- <Tooltip.List>
347
+ <Tooltip.Root {...props.tooltip?.root} let:data>
348
+ <Tooltip.Header {...props.tooltip?.header}
349
+ >{format(isVertical ? x(data) : y(data))}</Tooltip.Header
350
+ >
351
+ <Tooltip.List {...props.tooltip?.list}>
343
352
  <!-- Reverse series order so tooltip items match stacks -->
344
353
  {@const seriesItems = stackSeries ? [...series].reverse() : series}
345
354
  {#each seriesItems as s}
@@ -351,11 +360,12 @@
351
360
  color={s.color ?? cScale?.(c(data))}
352
361
  {format}
353
362
  valueAlign="right"
363
+ {...props.tooltip?.item}
354
364
  />
355
365
  {/each}
356
366
 
357
367
  {#if stackSeries || groupSeries}
358
- <Tooltip.Separator />
368
+ <Tooltip.Separator {...props.tooltip?.separator} />
359
369
 
360
370
  <Tooltip.Item
361
371
  label="total"
@@ -366,6 +376,7 @@
366
376
  })}
367
377
  format="integer"
368
378
  valueAlign="right"
379
+ {...props.tooltip?.item}
369
380
  />
370
381
  {/if}
371
382
  </Tooltip.List>
@@ -83,6 +83,13 @@
83
83
  highlight?: Partial<ComponentProps<Highlight>>;
84
84
  labels?: Partial<ComponentProps<Labels>>;
85
85
  points?: Partial<ComponentProps<Points>>;
86
+ tooltip?: {
87
+ root?: Partial<ComponentProps<Tooltip.Root>>;
88
+ header?: Partial<ComponentProps<Tooltip.Header>>;
89
+ list?: Partial<ComponentProps<Tooltip.List>>;
90
+ item?: Partial<ComponentProps<Tooltip.Item>>;
91
+ separator?: Partial<ComponentProps<Tooltip.Separator>>;
92
+ };
86
93
  } = {};
87
94
 
88
95
  export let renderContext: 'svg' | 'canvas' = 'svg';
@@ -243,9 +250,9 @@
243
250
  </slot>
244
251
 
245
252
  <slot name="tooltip" {...slotProps}>
246
- <Tooltip.Root let:data>
247
- <Tooltip.Header>{format(x(data))}</Tooltip.Header>
248
- <Tooltip.List>
253
+ <Tooltip.Root {...props.tooltip?.root} let:data>
254
+ <Tooltip.Header {...props.tooltip?.header}>{format(x(data))}</Tooltip.Header>
255
+ <Tooltip.List {...props.tooltip?.list}>
249
256
  {#each series as s}
250
257
  {@const seriesTooltipData = s.data ? findRelatedData(s.data, data, x) : data}
251
258
  {@const valueAccessor = accessor(s.value ?? (s.data ? asAny(y) : s.key))}
@@ -255,6 +262,7 @@
255
262
  value={seriesTooltipData ? valueAccessor(seriesTooltipData) : null}
256
263
  color={s.color}
257
264
  {format}
265
+ {...props.tooltip?.item}
258
266
  />
259
267
  {/each}
260
268
  </Tooltip.List>
@@ -107,6 +107,13 @@
107
107
  group?: Partial<ComponentProps<Group>>;
108
108
  arc?: Partial<ComponentProps<Arc>>;
109
109
  legend?: Partial<ComponentProps<Legend>>;
110
+ tooltip?: {
111
+ root?: Partial<ComponentProps<Tooltip.Root>>;
112
+ header?: Partial<ComponentProps<Tooltip.Header>>;
113
+ list?: Partial<ComponentProps<Tooltip.List>>;
114
+ item?: Partial<ComponentProps<Tooltip.Item>>;
115
+ separator?: Partial<ComponentProps<Tooltip.Separator>>;
116
+ };
110
117
  } = {};
111
118
 
112
119
  export let renderContext: 'svg' | 'canvas' = 'svg';
@@ -257,13 +264,14 @@
257
264
  </slot>
258
265
 
259
266
  <slot name="tooltip" {...slotProps}>
260
- <Tooltip.Root let:data>
261
- <Tooltip.List>
267
+ <Tooltip.Root {...props.tooltip?.root} let:data>
268
+ <Tooltip.List {...props.tooltip?.list}>
262
269
  <Tooltip.Item
263
270
  label={labelAccessor(data) || keyAccessor(data)}
264
271
  value={valueAccessor(data)}
265
272
  color={cScale?.(c(data))}
266
273
  {format}
274
+ {...props.tooltip?.item}
267
275
  />
268
276
  </Tooltip.List>
269
277
  </Tooltip.Root>
@@ -4,6 +4,7 @@ import Arc from '../Arc.svelte';
4
4
  import Group from '../Group.svelte';
5
5
  import Legend from '../Legend.svelte';
6
6
  import Pie from '../Pie.svelte';
7
+ import * as Tooltip from '../tooltip/index.js';
7
8
  import { type Accessor } from '../../utils/common.js';
8
9
  declare class __sveltets_Render<TData> {
9
10
  props(): {
@@ -230,6 +231,13 @@ declare class __sveltets_Render<TData> {
230
231
  group?: Partial<ComponentProps<Group>>;
231
232
  arc?: Partial<ComponentProps<Arc>>;
232
233
  legend?: Partial<ComponentProps<Legend>>;
234
+ tooltip?: {
235
+ root?: Partial<ComponentProps<Tooltip.Root>>;
236
+ header?: Partial<ComponentProps<Tooltip.Header>>;
237
+ list?: Partial<ComponentProps<Tooltip.List>>;
238
+ item?: Partial<ComponentProps<Tooltip.Item>>;
239
+ separator?: Partial<ComponentProps<Tooltip.Separator>>;
240
+ } | undefined;
233
241
  } | undefined;
234
242
  range?: number[];
235
243
  series?: {
@@ -64,6 +64,13 @@
64
64
  labels?: Partial<ComponentProps<Labels>>;
65
65
  legend?: Partial<ComponentProps<Legend>>;
66
66
  rule?: Partial<ComponentProps<Rule>>;
67
+ tooltip?: {
68
+ root?: Partial<ComponentProps<Tooltip.Root>>;
69
+ header?: Partial<ComponentProps<Tooltip.Header>>;
70
+ list?: Partial<ComponentProps<Tooltip.List>>;
71
+ item?: Partial<ComponentProps<Tooltip.Item>>;
72
+ separator?: Partial<ComponentProps<Tooltip.Separator>>;
73
+ };
67
74
  } = {};
68
75
 
69
76
  export let renderContext: 'svg' | 'canvas' = 'svg';
@@ -199,28 +206,31 @@
199
206
  </slot>
200
207
 
201
208
  <slot name="tooltip" {...slotProps}>
202
- <Tooltip.Root let:data>
209
+ <Tooltip.Root {...props.tooltip?.root} let:data>
203
210
  {#if activeSeries?.key !== 'default'}
204
- <Tooltip.Header color={activeSeries?.color}>
211
+ <Tooltip.Header {...props.tooltip?.header} color={activeSeries?.color}>
205
212
  {activeSeries?.label ?? activeSeries?.key}
206
213
  </Tooltip.Header>
207
214
  {/if}
208
- <Tooltip.List>
215
+ <Tooltip.List {...props.tooltip?.list}>
209
216
  <Tooltip.Item
210
217
  label={typeof config.x === 'string' ? config.x : 'x'}
211
218
  value={x(data)}
212
219
  {format}
220
+ {...props.tooltip?.item}
213
221
  />
214
222
  <Tooltip.Item
215
223
  label={typeof config.y === 'string' ? config.y : 'y'}
216
224
  value={y(data)}
217
225
  {format}
226
+ {...props.tooltip?.item}
218
227
  />
219
228
  {#if config.r}
220
229
  <Tooltip.Item
221
230
  label={typeof config.r === 'string' ? config.r : 'r'}
222
231
  value={r(data)}
223
232
  {format}
233
+ {...props.tooltip?.item}
224
234
  />
225
235
  {/if}
226
236
  </Tooltip.List>
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "author": "Sean Lynch <techniq35@gmail.com>",
5
5
  "license": "MIT",
6
6
  "repository": "techniq/layerchart",
7
- "version": "0.72.2",
7
+ "version": "0.73.0",
8
8
  "devDependencies": {
9
9
  "@changesets/cli": "^2.27.10",
10
10
  "@mdi/js": "^7.4.47",