@krizaka/charts 0.3.1 → 0.4.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.
Files changed (171) hide show
  1. package/dist/actions-5VG352VZ.js +53 -0
  2. package/dist/actions-5VG352VZ.js.map +1 -0
  3. package/dist/bar.d.ts +3 -3
  4. package/dist/bar.js +7 -6
  5. package/dist/candlestick.d.ts +2 -2
  6. package/dist/candlestick.js +6 -5
  7. package/dist/card.d.ts +52 -0
  8. package/dist/card.js +19 -0
  9. package/dist/card.js.map +1 -0
  10. package/dist/{cartesian-BRhNQ3ib.d.ts → cartesian-CEY_wwe_.d.ts} +12 -2
  11. package/dist/chart.d.ts +2 -2
  12. package/dist/chart.js +5 -4
  13. package/dist/{chunk-BV4DBGN7.js → chunk-7W4T255Q.js} +4 -4
  14. package/dist/{chunk-W5ILLSPK.js → chunk-AGSSNMK5.js} +5 -5
  15. package/dist/{chunk-VKZZY2QD.js → chunk-FE4LUGAE.js} +5 -5
  16. package/dist/{chunk-ARARFMNE.js → chunk-FIQHMJZK.js} +5 -5
  17. package/dist/chunk-FIQHMJZK.js.map +1 -0
  18. package/dist/{chunk-ANUCSRUN.js → chunk-GD7TWEN3.js} +3 -3
  19. package/dist/chunk-GRRFPI27.js +89 -0
  20. package/dist/chunk-GRRFPI27.js.map +1 -0
  21. package/dist/{chunk-SLEJDQ3A.js → chunk-HH65IEUV.js} +3 -3
  22. package/dist/{chunk-OIRHLJBC.js → chunk-IJTI6VJD.js} +3 -3
  23. package/dist/{chunk-WVTIKOII.js → chunk-IURCLBUQ.js} +2 -2
  24. package/dist/{chunk-CVWSMUUB.js → chunk-JST4HJC3.js} +33 -15
  25. package/dist/chunk-JST4HJC3.js.map +1 -0
  26. package/dist/{chunk-IKQV3NSL.js → chunk-KERGFVSN.js} +3 -3
  27. package/dist/{chunk-XDDALY4C.js → chunk-KMQ7RANJ.js} +5 -5
  28. package/dist/{chunk-NCIQMRV3.js → chunk-LLUQEK5J.js} +5 -5
  29. package/dist/{chunk-AA5EWWYV.js → chunk-LZPZWBBY.js} +2 -2
  30. package/dist/{chunk-PBQV3B6O.js → chunk-MK2ZFUWM.js} +31 -16
  31. package/dist/chunk-MK2ZFUWM.js.map +1 -0
  32. package/dist/{chunk-CSSZLFLO.js → chunk-MRGMLDNS.js} +5 -5
  33. package/dist/{chunk-I3D7KUGN.js → chunk-NLTZWJLV.js} +3 -3
  34. package/dist/{chunk-PWMMXRMC.js → chunk-NV52AKHG.js} +3 -3
  35. package/dist/{chunk-MXLITIGU.js → chunk-NWJ5VDN7.js} +5 -5
  36. package/dist/{chunk-3CJHBJXA.js → chunk-OVASCEGF.js} +12 -73
  37. package/dist/chunk-OVASCEGF.js.map +1 -0
  38. package/dist/{chunk-EQLC2QVN.js → chunk-OZOAKP5F.js} +4 -4
  39. package/dist/chunk-OZOAKP5F.js.map +1 -0
  40. package/dist/{chunk-KNDHO67X.js → chunk-P2NK5L3B.js} +3 -3
  41. package/dist/{chunk-JTKR7ZWP.js → chunk-P6RS2L23.js} +140 -36
  42. package/dist/chunk-P6RS2L23.js.map +1 -0
  43. package/dist/{chunk-W5FX4TU3.js → chunk-PGD6SH5I.js} +30 -2
  44. package/dist/chunk-PGD6SH5I.js.map +1 -0
  45. package/dist/{chunk-4LBXEAGC.js → chunk-PWZHIGPO.js} +5 -5
  46. package/dist/{chunk-L2EKYWVI.js → chunk-VEOJNMPF.js} +3 -3
  47. package/dist/chunk-YHQFW2PR.js +71 -0
  48. package/dist/chunk-YHQFW2PR.js.map +1 -0
  49. package/dist/{chunk-C4MFZLJM.js → chunk-Z4T3JFNU.js} +2 -2
  50. package/dist/{chunk-EEP7PS2L.js → chunk-ZF7LVQTR.js} +3 -3
  51. package/dist/{context-BgYUymEO.d.ts → context-DNW7bJYw.d.ts} +19 -0
  52. package/dist/credits.d.ts +1 -1
  53. package/dist/credits.js +7 -6
  54. package/dist/earnings.d.ts +3 -3
  55. package/dist/earnings.js +8 -7
  56. package/dist/{frame-I7_xYGy5.d.ts → frame-B1HDNm7c.d.ts} +9 -5
  57. package/dist/funnel.d.ts +2 -2
  58. package/dist/funnel.js +6 -5
  59. package/dist/gauge.d.ts +2 -2
  60. package/dist/gauge.js +4 -3
  61. package/dist/geo.d.ts +2 -2
  62. package/dist/geo.js +5 -4
  63. package/dist/globe.d.ts +2 -2
  64. package/dist/globe.js +4 -3
  65. package/dist/goal.d.ts +2 -2
  66. package/dist/goal.js +5 -4
  67. package/dist/heatmap.d.ts +2 -2
  68. package/dist/heatmap.js +6 -5
  69. package/dist/index.d.ts +5 -3
  70. package/dist/index.js +45 -37
  71. package/dist/latency.d.ts +3 -3
  72. package/dist/latency.js +8 -7
  73. package/dist/line.d.ts +3 -3
  74. package/dist/line.js +7 -6
  75. package/dist/native.d.ts +19 -0
  76. package/dist/native.js +13 -1
  77. package/dist/native.js.map +1 -1
  78. package/dist/pie.d.ts +2 -2
  79. package/dist/pie.js +6 -5
  80. package/dist/provider.d.ts +2 -2
  81. package/dist/provider.js +4 -2
  82. package/dist/radar.d.ts +2 -2
  83. package/dist/radar.js +6 -5
  84. package/dist/sankey.d.ts +2 -2
  85. package/dist/sankey.js +6 -5
  86. package/dist/scatter.d.ts +2 -2
  87. package/dist/scatter.js +6 -5
  88. package/dist/sparkline.d.ts +2 -2
  89. package/dist/sparkline.js +6 -5
  90. package/dist/table-sheet-CQBIAV5N.js +36 -0
  91. package/dist/table-sheet-CQBIAV5N.js.map +1 -0
  92. package/dist/throughput.d.ts +3 -3
  93. package/dist/throughput.js +8 -7
  94. package/dist/ticker.d.ts +3 -3
  95. package/dist/ticker.js +8 -7
  96. package/dist/treemap.d.ts +2 -2
  97. package/dist/treemap.js +7 -6
  98. package/package.json +292 -50
  99. package/registry/area-chart.json +82 -12
  100. package/registry/bar-chart.json +82 -12
  101. package/registry/calendar-heatmap.json +46 -18
  102. package/registry/candlestick.json +46 -18
  103. package/registry/chart-card.json +235 -0
  104. package/registry/chart.json +40 -12
  105. package/registry/charts-provider.json +2 -2
  106. package/registry/earnings-chart.json +82 -12
  107. package/registry/examples/chart-card/before-after.d.ts +4 -0
  108. package/registry/examples/chart-card/before-after.js +22 -0
  109. package/registry/examples/chart-card/before-after.tsx +22 -0
  110. package/registry/examples/chart-card/jobs-activity.d.ts +4 -0
  111. package/registry/examples/chart-card/jobs-activity.js +20 -0
  112. package/registry/examples/chart-card/jobs-activity.tsx +20 -0
  113. package/registry/examples/chart-card/sparse-and-empty.d.ts +4 -0
  114. package/registry/examples/chart-card/sparse-and-empty.js +16 -0
  115. package/registry/examples/chart-card/sparse-and-empty.tsx +18 -0
  116. package/registry/examples/chart-card/usage-donut.d.ts +4 -0
  117. package/registry/examples/chart-card/usage-donut.js +18 -0
  118. package/registry/examples/chart-card/usage-donut.tsx +18 -0
  119. package/registry/examples/charts-provider/french-orazaka.js +1 -1
  120. package/registry/examples/charts-provider/french-orazaka.tsx +1 -1
  121. package/registry/examples/kpi-stat/dashboard-row.d.ts +4 -0
  122. package/registry/examples/kpi-stat/dashboard-row.js +19 -0
  123. package/registry/examples/kpi-stat/dashboard-row.tsx +17 -0
  124. package/registry/examples/kpi-stat/single.d.ts +4 -0
  125. package/registry/examples/kpi-stat/single.js +11 -0
  126. package/registry/examples/kpi-stat/single.tsx +6 -0
  127. package/registry/funnel.json +46 -18
  128. package/registry/gauge.json +42 -14
  129. package/registry/geo-map.json +46 -18
  130. package/registry/globe.json +40 -12
  131. package/registry/goal-progress.json +36 -8
  132. package/registry/heatmap.json +46 -18
  133. package/registry/index.json +49 -1
  134. package/registry/job-throughput.json +82 -12
  135. package/registry/kpi-stat.json +296 -0
  136. package/registry/latency-chart.json +82 -12
  137. package/registry/line-chart.json +82 -12
  138. package/registry/pie-chart.json +92 -36
  139. package/registry/price-ticker.json +82 -12
  140. package/registry/radar-chart.json +46 -18
  141. package/registry/sankey.json +46 -18
  142. package/registry/scatter-chart.json +46 -18
  143. package/registry/sparkline.json +38 -10
  144. package/registry/treemap.json +40 -12
  145. package/dist/chunk-3CJHBJXA.js.map +0 -1
  146. package/dist/chunk-ARARFMNE.js.map +0 -1
  147. package/dist/chunk-CVWSMUUB.js.map +0 -1
  148. package/dist/chunk-EQLC2QVN.js.map +0 -1
  149. package/dist/chunk-JTKR7ZWP.js.map +0 -1
  150. package/dist/chunk-PBQV3B6O.js.map +0 -1
  151. package/dist/chunk-W5FX4TU3.js.map +0 -1
  152. /package/dist/{chunk-BV4DBGN7.js.map → chunk-7W4T255Q.js.map} +0 -0
  153. /package/dist/{chunk-W5ILLSPK.js.map → chunk-AGSSNMK5.js.map} +0 -0
  154. /package/dist/{chunk-VKZZY2QD.js.map → chunk-FE4LUGAE.js.map} +0 -0
  155. /package/dist/{chunk-ANUCSRUN.js.map → chunk-GD7TWEN3.js.map} +0 -0
  156. /package/dist/{chunk-SLEJDQ3A.js.map → chunk-HH65IEUV.js.map} +0 -0
  157. /package/dist/{chunk-OIRHLJBC.js.map → chunk-IJTI6VJD.js.map} +0 -0
  158. /package/dist/{chunk-WVTIKOII.js.map → chunk-IURCLBUQ.js.map} +0 -0
  159. /package/dist/{chunk-IKQV3NSL.js.map → chunk-KERGFVSN.js.map} +0 -0
  160. /package/dist/{chunk-XDDALY4C.js.map → chunk-KMQ7RANJ.js.map} +0 -0
  161. /package/dist/{chunk-NCIQMRV3.js.map → chunk-LLUQEK5J.js.map} +0 -0
  162. /package/dist/{chunk-AA5EWWYV.js.map → chunk-LZPZWBBY.js.map} +0 -0
  163. /package/dist/{chunk-CSSZLFLO.js.map → chunk-MRGMLDNS.js.map} +0 -0
  164. /package/dist/{chunk-I3D7KUGN.js.map → chunk-NLTZWJLV.js.map} +0 -0
  165. /package/dist/{chunk-PWMMXRMC.js.map → chunk-NV52AKHG.js.map} +0 -0
  166. /package/dist/{chunk-MXLITIGU.js.map → chunk-NWJ5VDN7.js.map} +0 -0
  167. /package/dist/{chunk-KNDHO67X.js.map → chunk-P2NK5L3B.js.map} +0 -0
  168. /package/dist/{chunk-4LBXEAGC.js.map → chunk-PWZHIGPO.js.map} +0 -0
  169. /package/dist/{chunk-L2EKYWVI.js.map → chunk-VEOJNMPF.js.map} +0 -0
  170. /package/dist/{chunk-C4MFZLJM.js.map → chunk-Z4T3JFNU.js.map} +0 -0
  171. /package/dist/{chunk-EEP7PS2L.js.map → chunk-ZF7LVQTR.js.map} +0 -0
@@ -94,13 +94,6 @@
94
94
  "description": "The field (or function) naming where the flow goes.",
95
95
  "required": true
96
96
  },
97
- {
98
- "name": "title",
99
- "type": "string",
100
- "default": null,
101
- "description": "What the chart shows, in a few words: its accessible name, and its heading unless `hideTitle`.",
102
- "required": true
103
- },
104
97
  {
105
98
  "name": "value",
106
99
  "type": "string | ((datum: T, index: number) => number)",
@@ -108,6 +101,13 @@
108
101
  "description": "The field of its amount.",
109
102
  "required": true
110
103
  },
104
+ {
105
+ "name": "actionsMenu",
106
+ "type": "boolean",
107
+ "default": null,
108
+ "description": "The ⋯ actions menu of the kit. `false`: the former “Show data” and export buttons, drawn in line. Default true.",
109
+ "required": false
110
+ },
111
111
  {
112
112
  "name": "brand",
113
113
  "type": "BrandId",
@@ -126,7 +126,7 @@
126
126
  "name": "dataTable",
127
127
  "type": "boolean",
128
128
  "default": null,
129
- "description": "The \"Show data\" button (the table is in the page for screen readers either way). Default true.",
129
+ "description": "“View as table” in the actions menu (the table is in the page for screen readers either way). Default true.",
130
130
  "required": false
131
131
  },
132
132
  {
@@ -154,7 +154,7 @@
154
154
  "name": "exportable",
155
155
  "type": "boolean | readonly ExportFormat[]",
156
156
  "default": null,
157
- "description": "Export buttons: `true` for PNG, SVG and CSV, or the formats you want.",
157
+ "description": "The downloads of the actions menu: all three by default, or the formats you want, or `false` for none.",
158
158
  "required": false
159
159
  },
160
160
  {
@@ -185,6 +185,13 @@
185
185
  "description": "The id of the figure.",
186
186
  "required": false
187
187
  },
188
+ {
189
+ "name": "insight",
190
+ "type": "ReactNode",
191
+ "default": null,
192
+ "description": "One line that says what the chart shows, between the title and the chart: “100 jobs · +100 % vs last week”.",
193
+ "required": false
194
+ },
188
195
  {
189
196
  "name": "labels",
190
197
  "type": "ChartLabelsInput",
@@ -255,6 +262,13 @@
255
262
  "description": "The header of the targets.",
256
263
  "required": false
257
264
  },
265
+ {
266
+ "name": "title",
267
+ "type": "string",
268
+ "default": null,
269
+ "description": "What the chart shows, in a few words: its accessible name, and its heading unless `hideTitle`. Inside a `ChartCard`, the card's title is the default.",
270
+ "required": false
271
+ },
258
272
  {
259
273
  "name": "valueLabel",
260
274
  "type": "string",
@@ -322,13 +336,6 @@
322
336
  "description": "The field (or function) naming where the flow goes.",
323
337
  "required": true
324
338
  },
325
- {
326
- "name": "title",
327
- "type": "string",
328
- "default": null,
329
- "description": "What the chart shows, in a few words: its accessible name, and its heading unless `hideTitle`.",
330
- "required": true
331
- },
332
339
  {
333
340
  "name": "value",
334
341
  "type": "string | ((datum: T, index: number) => number)",
@@ -336,6 +343,13 @@
336
343
  "description": "The field of its amount.",
337
344
  "required": true
338
345
  },
346
+ {
347
+ "name": "actionsMenu",
348
+ "type": "boolean",
349
+ "default": null,
350
+ "description": "The ⋯ actions menu of the kit. `false`: the former “Show data” and export buttons, drawn in line. Default true.",
351
+ "required": false
352
+ },
339
353
  {
340
354
  "name": "brand",
341
355
  "type": "BrandId",
@@ -354,7 +368,7 @@
354
368
  "name": "dataTable",
355
369
  "type": "boolean",
356
370
  "default": null,
357
- "description": "The \"Show data\" button (the table is in the page for screen readers either way). Default true.",
371
+ "description": "“View as table” in the actions menu (the table is in the page for screen readers either way). Default true.",
358
372
  "required": false
359
373
  },
360
374
  {
@@ -382,7 +396,7 @@
382
396
  "name": "exportable",
383
397
  "type": "boolean | readonly ExportFormat[]",
384
398
  "default": null,
385
- "description": "Export buttons: `true` for PNG, SVG and CSV, or the formats you want.",
399
+ "description": "The downloads of the actions menu: all three by default, or the formats you want, or `false` for none.",
386
400
  "required": false
387
401
  },
388
402
  {
@@ -413,6 +427,13 @@
413
427
  "description": "The id of the figure.",
414
428
  "required": false
415
429
  },
430
+ {
431
+ "name": "insight",
432
+ "type": "ReactNode",
433
+ "default": null,
434
+ "description": "One line that says what the chart shows, between the title and the chart: “100 jobs · +100 % vs last week”.",
435
+ "required": false
436
+ },
416
437
  {
417
438
  "name": "labels",
418
439
  "type": "ChartLabelsInput",
@@ -483,6 +504,13 @@
483
504
  "description": "The header of the targets.",
484
505
  "required": false
485
506
  },
507
+ {
508
+ "name": "title",
509
+ "type": "string",
510
+ "default": null,
511
+ "description": "What the chart shows, in a few words: its accessible name, and its heading unless `hideTitle`. Inside a `ChartCard`, the card's title is the default.",
512
+ "required": false
513
+ },
486
514
  {
487
515
  "name": "valueLabel",
488
516
  "type": "string",
@@ -80,13 +80,6 @@
80
80
  "description": "One row per point.",
81
81
  "required": true
82
82
  },
83
- {
84
- "name": "title",
85
- "type": "string",
86
- "default": null,
87
- "description": "What the chart shows, in a few words: its accessible name, and its heading unless `hideTitle`.",
88
- "required": true
89
- },
90
83
  {
91
84
  "name": "x",
92
85
  "type": "string | ((datum: T, index: number) => number)",
@@ -115,6 +108,13 @@
115
108
  "description": "The name of the vertical measure.",
116
109
  "required": true
117
110
  },
111
+ {
112
+ "name": "actionsMenu",
113
+ "type": "boolean",
114
+ "default": null,
115
+ "description": "The ⋯ actions menu of the kit. `false`: the former “Show data” and export buttons, drawn in line. Default true.",
116
+ "required": false
117
+ },
118
118
  {
119
119
  "name": "brand",
120
120
  "type": "BrandId",
@@ -133,7 +133,7 @@
133
133
  "name": "dataTable",
134
134
  "type": "boolean",
135
135
  "default": null,
136
- "description": "The \"Show data\" button (the table is in the page for screen readers either way). Default true.",
136
+ "description": "“View as table” in the actions menu (the table is in the page for screen readers either way). Default true.",
137
137
  "required": false
138
138
  },
139
139
  {
@@ -161,7 +161,7 @@
161
161
  "name": "exportable",
162
162
  "type": "boolean | readonly ExportFormat[]",
163
163
  "default": null,
164
- "description": "Export buttons: `true` for PNG, SVG and CSV, or the formats you want.",
164
+ "description": "The downloads of the actions menu: all three by default, or the formats you want, or `false` for none.",
165
165
  "required": false
166
166
  },
167
167
  {
@@ -192,6 +192,13 @@
192
192
  "description": "The id of the figure.",
193
193
  "required": false
194
194
  },
195
+ {
196
+ "name": "insight",
197
+ "type": "ReactNode",
198
+ "default": null,
199
+ "description": "One line that says what the chart shows, between the title and the chart: “100 jobs · +100 % vs last week”.",
200
+ "required": false
201
+ },
195
202
  {
196
203
  "name": "labels",
197
204
  "type": "ChartLabelsInput",
@@ -283,6 +290,13 @@
283
290
  "description": "Horizontal lines at a y value.",
284
291
  "required": false
285
292
  },
293
+ {
294
+ "name": "title",
295
+ "type": "string",
296
+ "default": null,
297
+ "description": "What the chart shows, in a few words: its accessible name, and its heading unless `hideTitle`. Inside a `ChartCard`, the card's title is the default.",
298
+ "required": false
299
+ },
286
300
  {
287
301
  "name": "xFormat",
288
302
  "type": "ValueFormat",
@@ -336,13 +350,6 @@
336
350
  "description": "One row per point.",
337
351
  "required": true
338
352
  },
339
- {
340
- "name": "title",
341
- "type": "string",
342
- "default": null,
343
- "description": "What the chart shows, in a few words: its accessible name, and its heading unless `hideTitle`.",
344
- "required": true
345
- },
346
353
  {
347
354
  "name": "x",
348
355
  "type": "string | ((datum: T, index: number) => number)",
@@ -371,6 +378,13 @@
371
378
  "description": "The name of the vertical measure.",
372
379
  "required": true
373
380
  },
381
+ {
382
+ "name": "actionsMenu",
383
+ "type": "boolean",
384
+ "default": null,
385
+ "description": "The ⋯ actions menu of the kit. `false`: the former “Show data” and export buttons, drawn in line. Default true.",
386
+ "required": false
387
+ },
374
388
  {
375
389
  "name": "brand",
376
390
  "type": "BrandId",
@@ -389,7 +403,7 @@
389
403
  "name": "dataTable",
390
404
  "type": "boolean",
391
405
  "default": null,
392
- "description": "The \"Show data\" button (the table is in the page for screen readers either way). Default true.",
406
+ "description": "“View as table” in the actions menu (the table is in the page for screen readers either way). Default true.",
393
407
  "required": false
394
408
  },
395
409
  {
@@ -417,7 +431,7 @@
417
431
  "name": "exportable",
418
432
  "type": "boolean | readonly ExportFormat[]",
419
433
  "default": null,
420
- "description": "Export buttons: `true` for PNG, SVG and CSV, or the formats you want.",
434
+ "description": "The downloads of the actions menu: all three by default, or the formats you want, or `false` for none.",
421
435
  "required": false
422
436
  },
423
437
  {
@@ -448,6 +462,13 @@
448
462
  "description": "The id of the figure.",
449
463
  "required": false
450
464
  },
465
+ {
466
+ "name": "insight",
467
+ "type": "ReactNode",
468
+ "default": null,
469
+ "description": "One line that says what the chart shows, between the title and the chart: “100 jobs · +100 % vs last week”.",
470
+ "required": false
471
+ },
451
472
  {
452
473
  "name": "labels",
453
474
  "type": "ChartLabelsInput",
@@ -539,6 +560,13 @@
539
560
  "description": "Horizontal lines at a y value.",
540
561
  "required": false
541
562
  },
563
+ {
564
+ "name": "title",
565
+ "type": "string",
566
+ "default": null,
567
+ "description": "What the chart shows, in a few words: its accessible name, and its heading unless `hideTitle`. Inside a `ChartCard`, the card's title is the default.",
568
+ "required": false
569
+ },
542
570
  {
543
571
  "name": "xFormat",
544
572
  "type": "ValueFormat",
@@ -62,11 +62,11 @@
62
62
  "required": true
63
63
  },
64
64
  {
65
- "name": "title",
66
- "type": "string",
65
+ "name": "actionsMenu",
66
+ "type": "boolean",
67
67
  "default": null,
68
- "description": "What the chart shows, in a few words: its accessible name, and its heading unless `hideTitle`.",
69
- "required": true
68
+ "description": "The ⋯ actions menu of the kit. `false`: the former “Show data” and export buttons, drawn in line. Default true.",
69
+ "required": false
70
70
  },
71
71
  {
72
72
  "name": "brand",
@@ -131,6 +131,13 @@
131
131
  "description": "The id of the figure.",
132
132
  "required": false
133
133
  },
134
+ {
135
+ "name": "insight",
136
+ "type": "ReactNode",
137
+ "default": null,
138
+ "description": "One line that says what the chart shows, between the title and the chart: “100 jobs · +100 % vs last week”.",
139
+ "required": false
140
+ },
134
141
  {
135
142
  "name": "labels",
136
143
  "type": "ChartLabelsInput",
@@ -187,6 +194,13 @@
187
194
  "description": "A dashed reference line (yesterday's average, a quota).",
188
195
  "required": false
189
196
  },
197
+ {
198
+ "name": "title",
199
+ "type": "string",
200
+ "default": null,
201
+ "description": "What the chart shows, in a few words: its accessible name, and its heading unless `hideTitle`. Inside a `ChartCard`, the card's title is the default.",
202
+ "required": false
203
+ },
190
204
  {
191
205
  "name": "trendTone",
192
206
  "type": "boolean | \"inverse\"",
@@ -196,7 +210,7 @@
196
210
  },
197
211
  {
198
212
  "name": "variant",
199
- "type": "\"line\" | \"area\" | \"bar\"",
213
+ "type": "\"area\" | \"line\" | \"bar\"",
200
214
  "default": null,
201
215
  "description": "`line` (default), `area` (line over a wash) or `bar` (discrete counts: jobs per hour).",
202
216
  "required": false
@@ -411,11 +425,11 @@
411
425
  "required": true
412
426
  },
413
427
  {
414
- "name": "title",
415
- "type": "string",
428
+ "name": "actionsMenu",
429
+ "type": "boolean",
416
430
  "default": null,
417
- "description": "What the chart shows, in a few words: its accessible name, and its heading unless `hideTitle`.",
418
- "required": true
431
+ "description": "The ⋯ actions menu of the kit. `false`: the former “Show data” and export buttons, drawn in line. Default true.",
432
+ "required": false
419
433
  },
420
434
  {
421
435
  "name": "brand",
@@ -480,6 +494,13 @@
480
494
  "description": "The id of the figure.",
481
495
  "required": false
482
496
  },
497
+ {
498
+ "name": "insight",
499
+ "type": "ReactNode",
500
+ "default": null,
501
+ "description": "One line that says what the chart shows, between the title and the chart: “100 jobs · +100 % vs last week”.",
502
+ "required": false
503
+ },
483
504
  {
484
505
  "name": "labels",
485
506
  "type": "ChartLabelsInput",
@@ -536,6 +557,13 @@
536
557
  "description": "A dashed reference line (yesterday's average, a quota).",
537
558
  "required": false
538
559
  },
560
+ {
561
+ "name": "title",
562
+ "type": "string",
563
+ "default": null,
564
+ "description": "What the chart shows, in a few words: its accessible name, and its heading unless `hideTitle`. Inside a `ChartCard`, the card's title is the default.",
565
+ "required": false
566
+ },
539
567
  {
540
568
  "name": "trendTone",
541
569
  "type": "boolean | \"inverse\"",
@@ -545,7 +573,7 @@
545
573
  },
546
574
  {
547
575
  "name": "variant",
548
- "type": "\"line\" | \"area\" | \"bar\"",
576
+ "type": "\"area\" | \"line\" | \"bar\"",
549
577
  "default": null,
550
578
  "description": "`line` (default), `area` (line over a wash) or `bar` (discrete counts: jobs per hour).",
551
579
  "required": false
@@ -80,11 +80,11 @@
80
80
  "required": true
81
81
  },
82
82
  {
83
- "name": "title",
84
- "type": "string",
83
+ "name": "actionsMenu",
84
+ "type": "boolean",
85
85
  "default": null,
86
- "description": "What the chart shows, in a few words: its accessible name, and its heading unless `hideTitle`.",
87
- "required": true
86
+ "description": "The ⋯ actions menu of the kit. `false`: the former “Show data” and export buttons, drawn in line. Default true.",
87
+ "required": false
88
88
  },
89
89
  {
90
90
  "name": "brand",
@@ -104,7 +104,7 @@
104
104
  "name": "dataTable",
105
105
  "type": "boolean",
106
106
  "default": null,
107
- "description": "The \"Show data\" button (the table is in the page for screen readers either way). Default true.",
107
+ "description": "“View as table” in the actions menu (the table is in the page for screen readers either way). Default true.",
108
108
  "required": false
109
109
  },
110
110
  {
@@ -132,7 +132,7 @@
132
132
  "name": "exportable",
133
133
  "type": "boolean | readonly ExportFormat[]",
134
134
  "default": null,
135
- "description": "Export buttons: `true` for PNG, SVG and CSV, or the formats you want.",
135
+ "description": "The downloads of the actions menu: all three by default, or the formats you want, or `false` for none.",
136
136
  "required": false
137
137
  },
138
138
  {
@@ -163,6 +163,13 @@
163
163
  "description": "The id of the figure.",
164
164
  "required": false
165
165
  },
166
+ {
167
+ "name": "insight",
168
+ "type": "ReactNode",
169
+ "default": null,
170
+ "description": "One line that says what the chart shows, between the title and the chart: “100 jobs · +100 % vs last week”.",
171
+ "required": false
172
+ },
166
173
  {
167
174
  "name": "labels",
168
175
  "type": "ChartLabelsInput",
@@ -226,6 +233,13 @@
226
233
  "description": "Your own summary instead of the generated one (still read first by screen readers).",
227
234
  "required": false
228
235
  },
236
+ {
237
+ "name": "title",
238
+ "type": "string",
239
+ "default": null,
240
+ "description": "What the chart shows, in a few words: its accessible name, and its heading unless `hideTitle`. Inside a `ChartCard`, the card's title is the default.",
241
+ "required": false
242
+ },
229
243
  {
230
244
  "name": "valueLabel",
231
245
  "type": "string",
@@ -273,11 +287,11 @@
273
287
  "required": true
274
288
  },
275
289
  {
276
- "name": "title",
277
- "type": "string",
290
+ "name": "actionsMenu",
291
+ "type": "boolean",
278
292
  "default": null,
279
- "description": "What the chart shows, in a few words: its accessible name, and its heading unless `hideTitle`.",
280
- "required": true
293
+ "description": "The ⋯ actions menu of the kit. `false`: the former “Show data” and export buttons, drawn in line. Default true.",
294
+ "required": false
281
295
  },
282
296
  {
283
297
  "name": "brand",
@@ -297,7 +311,7 @@
297
311
  "name": "dataTable",
298
312
  "type": "boolean",
299
313
  "default": null,
300
- "description": "The \"Show data\" button (the table is in the page for screen readers either way). Default true.",
314
+ "description": "“View as table” in the actions menu (the table is in the page for screen readers either way). Default true.",
301
315
  "required": false
302
316
  },
303
317
  {
@@ -325,7 +339,7 @@
325
339
  "name": "exportable",
326
340
  "type": "boolean | readonly ExportFormat[]",
327
341
  "default": null,
328
- "description": "Export buttons: `true` for PNG, SVG and CSV, or the formats you want.",
342
+ "description": "The downloads of the actions menu: all three by default, or the formats you want, or `false` for none.",
329
343
  "required": false
330
344
  },
331
345
  {
@@ -356,6 +370,13 @@
356
370
  "description": "The id of the figure.",
357
371
  "required": false
358
372
  },
373
+ {
374
+ "name": "insight",
375
+ "type": "ReactNode",
376
+ "default": null,
377
+ "description": "One line that says what the chart shows, between the title and the chart: “100 jobs · +100 % vs last week”.",
378
+ "required": false
379
+ },
359
380
  {
360
381
  "name": "labels",
361
382
  "type": "ChartLabelsInput",
@@ -419,6 +440,13 @@
419
440
  "description": "Your own summary instead of the generated one (still read first by screen readers).",
420
441
  "required": false
421
442
  },
443
+ {
444
+ "name": "title",
445
+ "type": "string",
446
+ "default": null,
447
+ "description": "What the chart shows, in a few words: its accessible name, and its heading unless `hideTitle`. Inside a `ChartCard`, the card's title is the default.",
448
+ "required": false
449
+ },
422
450
  {
423
451
  "name": "valueLabel",
424
452
  "type": "string",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/core/labels.ts","../src/web/context.tsx","../src/core/palette.ts"],"sourcesContent":["// The words a chart says on its own: its controls, its states and its written summary. English by default; an app\n// passes its own (translated through its catalogue) once, to `ChartsProvider labels`, or to one chart's `labels`.\n// Placeholders are written `{name}`.\n\nexport interface ChartLabels {\n /** The button that shows the data table. */\n showData: string;\n /** The button that hides it. */\n hideData: string;\n /** The caption of the data table: `{title}`. */\n tableCaption: string;\n /** The export buttons. */\n exportPng: string;\n exportSvg: string;\n exportCsv: string;\n /** Announced while the data loads. */\n loading: string;\n /** Shown when there is nothing to draw. */\n empty: string;\n /** Shown when the data could not be loaded. */\n error: string;\n /** The keyboard hint, read once when the plot takes the focus. */\n keyboardHint: string;\n /** The role description of the plot (`chart`). */\n roleDescription: string;\n /** Summary pieces. `{kind}` is the chart's name (`Line chart`), `{count}` a number of points or series. */\n summaryIntro: string;\n summarySeries: string;\n summaryRange: string;\n summaryTrendUp: string;\n summaryTrendDown: string;\n summaryTrendFlat: string;\n summaryTotal: string;\n summaryThreshold: string;\n summaryShare: string;\n /** Scatter: the correlation of x and y (Pearson's r). */\n summaryCorrelation: string;\n /** Funnel: from one stage to the next, and from the first to the last. */\n summaryConversion: string;\n summaryOverall: string;\n /** Heatmap, calendar: the largest cell and the number of cells with a value. */\n summaryPeak: string;\n summaryActive: string;\n /** Candlestick: the period's range. */\n summaryOhlc: string;\n /** The names of the charts, read first in the summary. */\n kinds: Record<ChartKind, string>;\n /** The column of the values, when the chart has no value label. */\n value: string;\n /** The column of the categories in the data table, when the chart has no x label. */\n category: string;\n /** The total row of a stacked chart, a pie, a funnel. */\n total: string;\n /** What a missing value reads as. */\n noValue: string;\n}\n\nexport type ChartKind =\n | \"line\"\n | \"area\"\n | \"bar\"\n | \"pie\"\n | \"donut\"\n | \"gauge\"\n | \"sparkline\"\n | \"radar\"\n | \"heatmap\"\n | \"calendar\"\n | \"sankey\"\n | \"funnel\"\n | \"candlestick\"\n | \"treemap\"\n | \"scatter\"\n | \"map\"\n | \"globe\"\n | \"chart\";\n\nexport const DEFAULT_LABELS: ChartLabels = {\n showData: \"Show data\",\n hideData: \"Hide data\",\n tableCaption: \"{title} — data\",\n exportPng: \"PNG\",\n exportSvg: \"SVG\",\n exportCsv: \"CSV\",\n loading: \"Loading chart…\",\n empty: \"No data for this period yet.\",\n error: \"The chart could not be loaded.\",\n keyboardHint: \"Use the arrow keys to move between points, Home and End to jump to the ends.\",\n roleDescription: \"chart\",\n summaryIntro: \"{kind}, {count}.\",\n summarySeries: \"{label}: from {first} to {last}\",\n summaryRange: \"lowest {min} ({minAt}), highest {max} ({maxAt})\",\n summaryTrendUp: \"up {change}\",\n summaryTrendDown: \"down {change}\",\n summaryTrendFlat: \"stable\",\n summaryTotal: \"total {total}\",\n summaryThreshold: \"{label} at {value}\",\n summaryShare: \"{label} {value} ({share})\",\n summaryCorrelation: \"correlation {r}\",\n summaryConversion: \"{from} → {to} {rate}\",\n summaryOverall: \"overall {rate}\",\n summaryPeak: \"peak {value} ({at})\",\n summaryActive: \"{count} with a value\",\n summaryOhlc: \"opened at {open}, closed at {close}, low {low}, high {high}\",\n kinds: {\n line: \"Line chart\",\n area: \"Area chart\",\n bar: \"Bar chart\",\n pie: \"Pie chart\",\n donut: \"Donut chart\",\n gauge: \"Gauge\",\n sparkline: \"Sparkline\",\n radar: \"Radar chart\",\n heatmap: \"Heatmap\",\n calendar: \"Calendar heatmap\",\n sankey: \"Flow diagram\",\n funnel: \"Funnel\",\n candlestick: \"Candlestick chart\",\n treemap: \"Treemap\",\n scatter: \"Scatter chart\",\n map: \"Map\",\n globe: \"Globe\",\n chart: \"Chart\",\n },\n category: \"Category\",\n value: \"Value\",\n total: \"Total\",\n noValue: \"—\",\n};\n\n/** The words an app or a chart passes: any of them, and any of the chart names. */\nexport type ChartLabelsInput = Partial<Omit<ChartLabels, \"kinds\">> & { kinds?: Partial<Record<ChartKind, string>> };\n\n/** The default labels with an app's and a chart's on top (`kinds` merged too). */\nexport function mergeLabels(...layers: (ChartLabelsInput | undefined)[]): ChartLabels {\n let out = DEFAULT_LABELS;\n for (const layer of layers) {\n if (!layer) continue;\n out = { ...out, ...layer, kinds: { ...out.kinds, ...layer.kinds } };\n }\n return out;\n}\n\n/** A sentence's first letter in upper case (a template that may open a sentence: `total {total}`). */\nexport function capitalize(text: string): string {\n return text.charAt(0).toLocaleUpperCase() + text.slice(1);\n}\n\n/** `{name}` → its value; an unknown placeholder stays as written. */\nexport function fill(template: string, values: Record<string, string | number>): string {\n return template.replace(/\\{(\\w+)\\}/g, (match, name: string) => (name in values ? String(values[name]) : match));\n}\n","\"use client\";\n// One place for what every chart of an app shares: the locale its figures are written in, the brand its palette\n// leads with, and the words it says (translated once, from the app's catalogue). Each chart may still override them.\nimport { createContext, type ReactNode, useContext, useMemo } from \"react\";\n\nimport { type ChartLabels, type ChartLabelsInput, mergeLabels } from \"../core/labels\";\nimport type { BrandId, Locale } from \"../core/types\";\n\nexport interface ChartsSettings {\n /** The locale of every figure and date (`\"fr-FR\"`). Default `\"en-US\"`. */\n locale?: Locale;\n /**\n * The brand whose palette the charts use. Without it, a chart follows a `.brand-<id>` ancestor, else Krizaka. Set it\n * when the app loads a brand stylesheet on `:root` (`@krizaka/tokens/brands/orazaka.css`).\n */\n brand?: BrandId;\n /** The words, translated: the buttons, the states, the written summary. */\n labels?: ChartLabelsInput;\n}\n\ninterface ResolvedSettings {\n readonly locale: Locale;\n readonly brand?: BrandId;\n readonly labels: ChartLabels;\n readonly raw?: ChartLabelsInput;\n}\n\nconst DEFAULTS: ResolvedSettings = { locale: \"en-US\", labels: mergeLabels() };\nconst Context = createContext<ResolvedSettings>(DEFAULTS);\n\nexport interface ChartsProviderProps extends ChartsSettings {\n children: ReactNode;\n}\n\n/** Sets the locale, the brand and the words of every chart below it. */\nexport function ChartsProvider({ locale, brand, labels, children }: ChartsProviderProps) {\n const parent = useContext(Context);\n const value = useMemo<ResolvedSettings>(() => {\n const raw: ChartLabelsInput | undefined = labels ? { ...parent.raw, ...labels, kinds: { ...parent.raw?.kinds, ...labels.kinds } } : parent.raw;\n return { locale: locale ?? parent.locale, brand: brand ?? parent.brand, labels: mergeLabels(raw), raw };\n }, [locale, brand, labels, parent]);\n return <Context.Provider value={value}>{children}</Context.Provider>;\n}\n\n/** The settings of a chart: its own props over the provider's over the defaults. */\nexport function useChartSettings(own: ChartsSettings): { locale: Locale; brand?: BrandId; labels: ChartLabels } {\n const shared = useContext(Context);\n return useMemo(\n () => ({ locale: own.locale ?? shared.locale, brand: own.brand ?? shared.brand, labels: own.labels ? mergeLabels(shared.raw, own.labels) : shared.labels }),\n [own.locale, own.brand, own.labels, shared],\n );\n}\n","// The data palettes. One categorical set of eight hues, stepped for each theme (the dark steps are chosen for the\n// dark surface, not flipped), ordered per brand so that the first series wears the brand's own hue — Krizaka blue,\n// Orazaka orange, Orochia violet then magenta, its gradient. Every order was chosen among the ones that pass the\n// colour-vision checks (scripts/palette.test: lightness band, chroma floor, adjacent ΔE under protan/deutan ≥ 8 —\n// Orochia light 7.2, inside the 6–8 band that requires the secondary encoding every chart carries: legend, direct\n// labels, data table —, normal-vision ΔE ≥ 15, ≥ 3:1 on the surface, the first three slots distinct all-pairs).\n// A 9th series never gets a generated hue: it folds into “Other” or a second chart.\nimport type { BrandId } from \"./types\";\n\nexport type Mode = \"dark\" | \"light\";\n\n/** The eight hues, light and dark steps. */\nexport const HUES = {\n blue: { light: \"#2a78d6\", dark: \"#3987e5\" },\n orange: { light: \"#eb6834\", dark: \"#d95926\" },\n aqua: { light: \"#1baf7a\", dark: \"#199e70\" },\n yellow: { light: \"#eda100\", dark: \"#c98500\" },\n magenta: { light: \"#e87ba4\", dark: \"#d55181\" },\n green: { light: \"#008300\", dark: \"#008300\" },\n violet: { light: \"#6250d6\", dark: \"#9085e9\" },\n red: { light: \"#e34948\", dark: \"#e66767\" },\n} as const;\n\nexport type Hue = keyof typeof HUES;\n\n/** The order of the hues for each brand: slot 1 is the brand. */\nexport const ORDERS: Record<BrandId, readonly Hue[]> = {\n krizaka: [\"blue\", \"green\", \"magenta\", \"yellow\", \"aqua\", \"orange\", \"violet\", \"red\"],\n orazaka: [\"orange\", \"aqua\", \"blue\", \"yellow\", \"magenta\", \"green\", \"violet\", \"red\"],\n orochia: [\"violet\", \"magenta\", \"yellow\", \"aqua\", \"orange\", \"blue\", \"green\", \"red\"],\n};\n\n/** The categorical palette of a brand in a theme: eight hex colours, slot 1 first. */\nexport function palette(brand: BrandId, mode: Mode): string[] {\n return ORDERS[brand].map((hue) => HUES[hue][mode]);\n}\n\n/** The diverging poles (below / above the midpoint): blue ↔ red, a neutral grey between them. */\nexport const DIVERGING = {\n light: { low: HUES.blue.light, high: HUES.red.light },\n dark: { low: HUES.blue.dark, high: HUES.red.dark },\n} as const;\n\n// --- Colour arithmetic (OKLab), for the sequential ramps the canvas engine needs as plain colours. ---------------\n\ntype Rgb = [number, number, number];\n\n/** `#rrggbb`, `#rgb`, `rgb(r, g, b)` / `rgba(…)` or `rgb(r g b / a)` → [r, g, b] in 0–255; null otherwise. */\nexport function parseColor(color: string): Rgb | null {\n const hex = color.trim().match(/^#([\\da-f]{3}|[\\da-f]{6})$/i);\n if (hex) {\n const h = hex[1]!.length === 3 ? [...hex[1]!].map((c) => c + c).join(\"\") : hex[1]!;\n return [0, 2, 4].map((i) => Number.parseInt(h.slice(i, i + 2), 16)) as Rgb;\n }\n const rgb = color.trim().match(/^rgba?\\(\\s*([\\d.]+)[\\s,]+([\\d.]+)[\\s,]+([\\d.]+)/i);\n if (rgb) return [Number(rgb[1]), Number(rgb[2]), Number(rgb[3])];\n return null;\n}\n\nconst toLinear = (c: number) => {\n const v = c / 255;\n return v <= 0.04045 ? v / 12.92 : ((v + 0.055) / 1.055) ** 2.4;\n};\nconst fromLinear = (v: number) => {\n const c = v <= 0.0031308 ? v * 12.92 : 1.055 * v ** (1 / 2.4) - 0.055;\n return Math.round(Math.min(1, Math.max(0, c)) * 255);\n};\n\nfunction toOklab([r8, g8, b8]: Rgb): Rgb {\n const [r, g, b] = [toLinear(r8), toLinear(g8), toLinear(b8)];\n const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);\n const m = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);\n const s = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);\n return [0.2104542553 * l + 0.793617785 * m - 0.0040720468 * s, 1.9779984951 * l - 2.428592205 * m + 0.4505937099 * s, 0.0259040371 * l + 0.7827717662 * m - 0.808675766 * s];\n}\n\nfunction fromOklab([L, a, b]: Rgb): Rgb {\n const l = (L + 0.3963377774 * a + 0.2158037573 * b) ** 3;\n const m = (L - 0.1055613458 * a - 0.0638541728 * b) ** 3;\n const s = (L - 0.0894841775 * a - 1.291485548 * b) ** 3;\n return [\n fromLinear(4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s),\n fromLinear(-1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s),\n fromLinear(-0.0041960863 * l - 0.7034186147 * m + 1.707614031 * s),\n ];\n}\n\nconst hex = ([r, g, b]: Rgb) => `#${[r, g, b].map((c) => c.toString(16).padStart(2, \"0\")).join(\"\")}`;\n\n/** `a` → `b` at `t` (0–1), interpolated in OKLab (even steps to the eye). Unparseable colours return `b`. */\nexport function mix(a: string, b: string, t: number): string {\n const ca = parseColor(a);\n const cb = parseColor(b);\n if (!ca || !cb) return b;\n const la = toOklab(ca);\n const lb = toOklab(cb);\n return hex(fromOklab([0, 1, 2].map((i) => la[i]! + (lb[i]! - la[i]!) * t) as Rgb));\n}\n\n/**\n * A sequential ramp of `steps` colours, one hue from near the surface (`0`, “almost nothing”) to the full hue: the\n * magnitude of a heatmap, a calendar or a choropleth. The first step is still distinct from the surface.\n */\nexport function sequential(hue: string, surface: string, steps = 5): string[] {\n return Array.from({ length: steps }, (_, i) => mix(surface, hue, 0.22 + (0.78 * i) / Math.max(1, steps - 1)));\n}\n\n/** WCAG contrast ratio between two colours (for the tests and the labels drawn inside a mark). */\nexport function contrast(a: string, b: string): number {\n const lum = (c: string) => {\n const rgb = parseColor(c);\n if (!rgb) return 0;\n const [r, g, bl] = rgb.map(toLinear) as Rgb;\n return 0.2126 * r + 0.7152 * g + 0.0722 * bl;\n };\n const [hi, lo] = [lum(a), lum(b)].sort((x, y) => y - x) as [number, number];\n return (hi + 0.05) / (lo + 0.05);\n}\n"],"mappings":";;;AA6EO,IAAM,iBAA8B;AAAA,EACzC,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,cAAc;AAAA,EACd,iBAAiB;AAAA,EACjB,cAAc;AAAA,EACd,eAAe;AAAA,EACf,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,kBAAkB;AAAA,EAClB,cAAc;AAAA,EACd,kBAAkB;AAAA,EAClB,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,aAAa;AAAA,EACb,eAAe;AAAA,EACf,aAAa;AAAA,EACb,OAAO;AAAA,IACL,MAAM;AAAA,IACN,MAAM;AAAA,IACN,KAAK;AAAA,IACL,KAAK;AAAA,IACL,OAAO;AAAA,IACP,OAAO;AAAA,IACP,WAAW;AAAA,IACX,OAAO;AAAA,IACP,SAAS;AAAA,IACT,UAAU;AAAA,IACV,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,SAAS;AAAA,IACT,SAAS;AAAA,IACT,KAAK;AAAA,IACL,OAAO;AAAA,IACP,OAAO;AAAA,EACT;AAAA,EACA,UAAU;AAAA,EACV,OAAO;AAAA,EACP,OAAO;AAAA,EACP,SAAS;AACX;AAMO,SAAS,e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;AACjB,UAAM,CAAC,GAAG,GAAG,EAAE,IAAI,IAAI,IAAI,QAAQ;AACnC,WAAO,SAAS,IAAI,SAAS,IAAI,SAAS;AAAA,EAC5C;AACA,QAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,MAAM,IAAI,CAAC;AACtD,UAAQ,KAAK,SAAS,KAAK;AAC7B;","names":["hex"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/sparkline/sparkline.tsx"],"sourcesContent":["\"use client\";\n// A word-sized chart: the shape of a series inside a sentence, a table cell or a stat. With a `width` it is drawn on\n// the server too (no placeholder); otherwise it fills its container. No axes: its title and summary carry the figures.\nimport { useMemo } from \"react\";\n\nimport { describeSeries } from \"../core/describe\";\nimport { categoryFormatter, shareFormatter, valueFormatter } from \"../core/format\";\nimport { niceDomain } from \"../core/scale\";\nimport { areaPath, barPath, linePath, type Point, segments } from \"../core/shape\";\nimport type { SeriesColor, Threshold, ValueFormat } from \"../core/types\";\nimport { ChartFrame, type ChartFrameProps, useSettings } from \"../web/frame\";\nimport { colorOf } from \"../web/parts\";\n\nexport interface SparklineProps extends Omit<ChartFrameProps, \"hideTitle\" | \"dataTable\" | \"exportable\" | \"description\"> {\n /** The values, oldest first (`null` for a gap). */\n data: readonly (number | null)[];\n /** The labels of the values (dates, ISO or `Date`), for the summary and the table. Default: their positions. */\n categories?: readonly unknown[];\n /** `line` (default), `area` (line over a wash) or `bar` (discrete counts: jobs per hour). */\n variant?: \"line\" | \"area\" | \"bar\";\n /** A palette slot, a tone or a CSS colour. Default: the trend's tone when `trendTone`, else slot 1. */\n color?: SeriesColor;\n /** Colour by the trend: success up, danger down (or the reverse with `\"inverse\"`: costs, latency). */\n trendTone?: boolean | \"inverse\";\n /** A dashed reference line (yesterday's average, a quota). */\n threshold?: Threshold;\n /** How the values are written in the summary and table. */\n format?: ValueFormat;\n /** A fixed width in pixels: drawn on the server too. Default: the container's width. */\n width?: number;\n}\n\n/** The shape of a trend in a few pixels: a stat's last 30 days, a job's throughput. */\nexport function Sparkline(props: SparklineProps) {\n const { data, categories, variant = \"line\", color, trendTone, threshold, format, width: fixed, height = 32 } = props;\n const { locale, labels } = useSettings(props);\n const table = useMemo(() => ({ categories: categories ?? data.map((_, i) => i + 1), series: [{ id: \"v\", label: props.title, values: data, slot: 1 }] }), [data, categories, props.title]);\n const fmt = useMemo(() => ({ value: valueFormatter(format, locale, labels.noValue), category: categoryFormatter(undefined, locale), share: shareFormatter(locale) }), [format, locale, labels.noValue]);\n const values = data.filter((v): v is number => v != null);\n const isEmpty = values.length === 0;\n const summary = isEmpty ? labels.empty : describeSeries(table, { kind: \"sparkline\", labels, value: fmt.value, category: fmt.category, share: fmt.share, thresholds: threshold ? [threshold] : [] });\n const first = values[0] ?? 0;\n const last = values[values.length - 1] ?? 0;\n const up = last >= first;\n const tone = trendTone ? ((trendTone === \"inverse\" ? !up : up) ? \"success\" : \"danger\") : undefined;\n const stroke = colorOf(color ?? tone, 1);\n\n return (\n <ChartFrame\n kind=\"sparkline\"\n frame={{ ...props, hideTitle: true, dataTable: false, height, style: { ...(fixed ? { width: fixed, display: \"inline-flex\" } : {}), ...props.style } }}\n defaultHeight={32}\n table={{ columns: [labels.category, props.title], rows: table.categories.map((c, i) => [fmt.category(c), fmt.value(data[i])]) }}\n summary={summary}\n isEmpty={isEmpty}\n navigable={false}\n ssrWidth={fixed}\n compact\n >\n {(width, h) => {\n let lo = Math.min(...values, threshold?.value ?? Number.POSITIVE_INFINITY);\n let hi = Math.max(...values, threshold?.value ?? Number.NEGATIVE_INFINITY);\n if (variant === \"bar\") {\n lo = Math.min(0, lo);\n hi = Math.max(0, hi);\n }\n const [d0, d1] = lo === hi ? niceDomain(lo, hi).domain : [lo, hi];\n const pad = variant === \"bar\" ? 0 : 3;\n const yOf = (v: number) => pad + (1 - (v - d0) / (d1 - d0 || 1)) * (h - pad * 2);\n const n = data.length;\n const xOf = (i: number) => (variant === \"bar\" ? (i + 0.5) * (width / n) : n > 1 ? pad + (i / (n - 1)) * (width - pad * 2) : width / 2);\n const pts = data.map((v, i) => (v == null ? null : ([xOf(i), yOf(v)] as Point)));\n const lastPoint = [...pts].reverse().find(Boolean);\n return (\n <svg className=\"kzc-svg\" width={width} height={h} viewBox={`0 0 ${width} ${h}`} aria-hidden>\n {threshold && <line x1={0} x2={width} y1={yOf(threshold.value)} y2={yOf(threshold.value)} data-tone={threshold.tone ?? \"neutral\"} className=\"kzc-threshold\" style={{ strokeWidth: 1 }} />}\n {variant === \"bar\"\n ? data.map((v, i) => {\n if (v == null || v === 0) return null;\n const bw = Math.max(1, Math.min(8, (width / n) * 0.7));\n const top = Math.min(yOf(v), yOf(0));\n return <path key={i} d={barPath(xOf(i) - bw / 2, top, bw, Math.abs(yOf(v) - yOf(0)), 1.5, false, v < 0)} style={{ fill: stroke }} />;\n })\n : segments(pts).map((seg) => (\n <g key={seg[0]![0]}>\n {variant === \"area\" && <path d={areaPath(seg, h, \"monotone\")} className=\"kzc-area\" style={{ fill: stroke }} />}\n <path d={linePath(seg, \"monotone\")} className=\"kzc-line\" style={{ stroke, strokeWidth: 1.75 }} />\n </g>\n ))}\n {variant !== \"bar\" && lastPoint && <circle cx={lastPoint[0]} cy={lastPoint[1]} r={2.75} style={{ fill: stroke }} />}\n </svg>\n );\n }}\n </ChartFrame>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAS,eAAe;AAwEE,cASR,YATQ;AA1CnB,SAAS,UAAU,OAAuB;AAC/C,QAAM,EAAE,MAAM,YAAY,UAAU,QAAQ,OAAO,WAAW,WAAW,QAAQ,OAAO,OAAO,SAAS,GAAG,IAAI;AAC/G,QAAM,EAAE,QAAQ,OAAO,IAAI,YAAY,KAAK;AAC5C,QAAM,QAAQ,QAAQ,OAAO,EAAE,YAAY,cAAc,KAAK,IAAI,CAAC,GAAG,MAAM,IAAI,CAAC,GAAG,QAAQ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