iryx-ui 0.9.0 → 0.10.2
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/README.md +178 -3
- package/dist/component-names.d.ts +1 -1
- package/dist/component-names.js +4 -0
- package/dist/{packages/iryx-ui/src/components → components}/Alert.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/{packages/iryx-ui/src/components → components}/Banner.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/BarChart.vue.d.ts +61 -2
- package/dist/components/BarChart.vue_vue_type_script_setup_true_lang.js +258 -0
- package/dist/{packages/iryx-ui/src/components → components}/Breadcrumb.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/{packages/iryx-ui/src/components → components}/Button.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/ChartLegend.js +5 -0
- package/dist/components/ChartLegend.vue.d.ts +12 -0
- package/dist/components/ChartLegend.vue_vue_type_script_setup_true_lang.js +31 -0
- package/dist/{packages/iryx-ui/src/components → components}/Checkbox.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/{packages/iryx-ui/src/components → components}/Combobox.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/{packages/iryx-ui/src/components → components}/DatePicker.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/{packages/iryx-ui/src/components → components}/DateRangePicker.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/Dialog.vue_vue_type_script_setup_true_lang.js +99 -0
- package/dist/{packages/iryx-ui/src/components → components}/DropdownMenuItems.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/{packages/iryx-ui/src/components → components}/FileUpload.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/{packages/iryx-ui/src/components → components}/Icon.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/{packages/iryx-ui/src/components → components}/Input.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/LineChart.js +5 -0
- package/dist/components/LineChart.vue.d.ts +100 -0
- package/dist/components/LineChart.vue_vue_type_script_setup_true_lang.js +265 -0
- package/dist/{packages/iryx-ui/src/components → components}/NumberInput.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/{packages/iryx-ui/src/components → components}/Pagination.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/{packages/iryx-ui/src/components → components}/PasswordInput.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/{packages/iryx-ui/src/components → components}/Select.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/{packages/iryx-ui/src/components → components}/Stat.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/{packages/iryx-ui/src/components → components}/Stepper.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/{packages/iryx-ui/src/components → components}/Table.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/{packages/iryx-ui/src/components → components}/Toaster.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +88 -0
- package/dist/composables/cartesian.d.ts +105 -0
- package/dist/composables/cartesian.js +43 -0
- package/dist/{packages/iryx-ui/src/composables → composables}/date.js +4 -4
- package/dist/index.d.ts +3 -0
- package/dist/index.js +94 -89
- package/dist/nuxt.js +1 -1
- package/dist/theme/bar-chart.d.ts +21 -0
- package/dist/{packages/iryx-ui/src/theme → theme}/bar-chart.js +2 -1
- package/dist/theme/breadcrumb.d.ts +3 -3
- package/dist/theme/chart-legend.d.ts +55 -0
- package/dist/theme/chart-legend.js +10 -0
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/line-chart.d.ts +143 -0
- package/dist/theme/line-chart.js +22 -0
- package/package.json +8 -8
- package/theme.css +42 -0
- package/dist/packages/iryx-ui/src/component-names.js +0 -4
- package/dist/packages/iryx-ui/src/components/BarChart.vue_vue_type_script_setup_true_lang.js +0 -178
- package/dist/packages/iryx-ui/src/components/Dialog.vue_vue_type_script_setup_true_lang.js +0 -99
- package/dist/packages/iryx-ui/src/components/index.js +0 -84
- /package/dist/{packages/iryx-ui/src/components → components}/Alert.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/App.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/App.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Badge.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Badge.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Banner.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/BarChart.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Breadcrumb.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Button.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/ButtonGroup.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/ButtonGroup.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Card.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Card.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Checkbox.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Combobox.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/ConfirmDialog.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/ConfirmDialog.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/DatePicker.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/DateRangePicker.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Dialog.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/DropdownMenu.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/DropdownMenu.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/DropdownMenuItems.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/EmptyState.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/EmptyState.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/FileUpload.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Form.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Form.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/FormField.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/FormField.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Icon.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Input.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Label.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Label.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/NumberInput.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Pagination.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/PasswordInput.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Progress.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Progress.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/RadioGroup.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/RadioGroup.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Select.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Separator.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Separator.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Skeleton.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Skeleton.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Sparkline.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Sparkline.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Stat.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Stepper.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Switch.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Switch.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Table.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Tabs.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Tabs.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Textarea.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Textarea.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Toaster.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Tooltip.js +0 -0
- /package/dist/{packages/iryx-ui/src/components → components}/Tooltip.vue_vue_type_script_setup_true_lang.js +0 -0
- /package/dist/{packages/iryx-ui/src/composables → composables}/appearance.js +0 -0
- /package/dist/{packages/iryx-ui/src/composables → composables}/button-group.js +0 -0
- /package/dist/{packages/iryx-ui/src/composables → composables}/confirm.js +0 -0
- /package/dist/{packages/iryx-ui/src/composables → composables}/data-table.js +0 -0
- /package/dist/{packages/iryx-ui/src/composables → composables}/decimal.js +0 -0
- /package/dist/{packages/iryx-ui/src/composables → composables}/dropdown-menu.js +0 -0
- /package/dist/{packages/iryx-ui/src/composables → composables}/element-size.js +0 -0
- /package/dist/{packages/iryx-ui/src/composables → composables}/form.js +0 -0
- /package/dist/{packages/iryx-ui/src/composables → composables}/icon.js +0 -0
- /package/dist/{packages/iryx-ui/src/composables → composables}/scale.js +0 -0
- /package/dist/{packages/iryx-ui/src/composables → composables}/toast.js +0 -0
- /package/dist/{packages/iryx-ui/src/config.js → config.js} +0 -0
- /package/dist/{packages/iryx-ui/src/plugin.js → plugin.js} +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/alert.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/badge.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/banner.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/breadcrumb.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/button-group.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/button.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/card.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/checkbox.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/combobox.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/date-picker.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/dialog.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/dropdown-menu.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/empty-state.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/file-upload.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/form.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/input.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/label.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/number-input.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/pagination.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/password-input.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/presets.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/progress.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/radio-group.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/select.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/separator.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/skeleton.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/sparkline.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/stat.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/stepper.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/switch.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/table.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/tabs.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/toast.js +0 -0
- /package/dist/{packages/iryx-ui/src/theme → theme}/tooltip.js +0 -0
package/README.md
CHANGED
|
@@ -291,6 +291,7 @@ app.use(createIryxUi({ unstyled: true }))
|
|
|
291
291
|
| `INumberInput` | Decimal-safe numeric field — the model is a **string**, with `min`/`max`/`step`, `precision` and locale-aware display |
|
|
292
292
|
| `ISparkline` | Tiny inline trend chart — pure SVG, no charting dependency |
|
|
293
293
|
| `IBarChart` | Categorical bar chart with a round-number axis, hover tooltip and a table view |
|
|
294
|
+
| `ILineChart` | Line or area chart with a crosshair, hover marker and a table view |
|
|
294
295
|
| `IFileUpload` | Drag-and-drop file field with `accept` / `maxSize` / `maxFiles`, thumbnails and a remove action |
|
|
295
296
|
| `IDatePicker` | Calendar in a popover; the model is an ISO `YYYY-MM-DD` **string** |
|
|
296
297
|
| `IDateRangePicker` | Two-month range calendar; the model is `{ start, end }` ISO strings |
|
|
@@ -482,6 +483,172 @@ chrome; use `ui` to reach the parts (`root`, `input`, `leading`, `trailing`,
|
|
|
482
483
|
forwarded to the `<input>` itself. `ref` exposes the element as `.input` for
|
|
483
484
|
focus management.
|
|
484
485
|
|
|
486
|
+
#### Multiple series
|
|
487
|
+
|
|
488
|
+
Both charts take plain rows plus a `series` descriptor — the same shape
|
|
489
|
+
`ITable` uses. Omit `series` for the single-measure case.
|
|
490
|
+
|
|
491
|
+
```vue
|
|
492
|
+
<IBarChart
|
|
493
|
+
:data="[
|
|
494
|
+
{ label: 'Jan', revenue: 4200, expenses: 3100 },
|
|
495
|
+
{ label: 'Feb', revenue: 5600, expenses: 3400 },
|
|
496
|
+
]"
|
|
497
|
+
:series="[
|
|
498
|
+
{ key: 'revenue', name: 'Revenue', slot: 0 },
|
|
499
|
+
{ key: 'expenses', name: 'Expenses', slot: 1 },
|
|
500
|
+
]"
|
|
501
|
+
label="Cashflow by month"
|
|
502
|
+
/>
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
Bars group inside their category; lines draw one path each. One hover reports
|
|
506
|
+
**every** series for that category in a single tooltip, so the reader compares
|
|
507
|
+
in one place instead of chasing marks.
|
|
508
|
+
|
|
509
|
+
**`slot` pins a series to a palette colour.** Without it, colour follows array
|
|
510
|
+
position — so filtering a series out repaints the survivors and the reader has
|
|
511
|
+
to relearn the chart. Pin the slots whenever series can be toggled.
|
|
512
|
+
|
|
513
|
+
**The legend is mandatory from two series up.** `legend: false` only silences
|
|
514
|
+
the single-series case, where the title already names what is plotted. Colour
|
|
515
|
+
alone is never a dependable identity channel, so this is not configurable.
|
|
516
|
+
|
|
517
|
+
Past eight series the colours stop identifying anything; the chart warns in
|
|
518
|
+
development and you should fold the tail into "Other" or switch to small
|
|
519
|
+
multiples.
|
|
520
|
+
|
|
521
|
+
`variant="area"` is ignored for multiple series — overlapping washes muddy into
|
|
522
|
+
a colour that belongs to neither.
|
|
523
|
+
|
|
524
|
+
#### Annotations, and why there is no plugin API
|
|
525
|
+
|
|
526
|
+
Chart.js has plugins because canvas is opaque — once painted you cannot select
|
|
527
|
+
or style anything, so the only way in is an imperative draw hook. SVG has no
|
|
528
|
+
such problem, so these charts hand you the layout and let you write ordinary
|
|
529
|
+
markup into it:
|
|
530
|
+
|
|
531
|
+
```vue
|
|
532
|
+
<ILineChart :data="revenue" label="Revenue against target">
|
|
533
|
+
<template #overlay="{ plot, value }">
|
|
534
|
+
<line
|
|
535
|
+
:x1="plot.left" :y1="value(7000)"
|
|
536
|
+
:x2="plot.left + plot.width" :y2="value(7000)"
|
|
537
|
+
stroke="var(--iryx-warning)" stroke-width="2" stroke-dasharray="4 4"
|
|
538
|
+
/>
|
|
539
|
+
</template>
|
|
540
|
+
</ILineChart>
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
`#underlay` renders behind the marks — target bands, shaded regions. `#overlay`
|
|
544
|
+
renders in front — reference lines, callouts. Both sit below the hit targets,
|
|
545
|
+
so hovering keeps working through whatever you draw.
|
|
546
|
+
|
|
547
|
+
Both receive the `CartesianLayout`:
|
|
548
|
+
|
|
549
|
+
| Prop | What it gives you |
|
|
550
|
+
| --- | --- |
|
|
551
|
+
| `plot` | `{ left, top, width, height }` of the plot rectangle, in px |
|
|
552
|
+
| `value(n)` | A data value to its pixel on the value axis |
|
|
553
|
+
| `bandCentre(i)` | The centre of category `i`, in px |
|
|
554
|
+
| `bandWidth` | Size of one category slot |
|
|
555
|
+
| `ticks` | The axis values actually drawn |
|
|
556
|
+
| `orientation` | `'vertical'` or `'horizontal'` |
|
|
557
|
+
|
|
558
|
+
That's strictly more capable than a draw hook: it's declarative, reactive, and
|
|
559
|
+
type-checked, with no lifecycle or registration order to learn.
|
|
560
|
+
|
|
561
|
+
For a chart type that doesn't exist here, the same primitives are exported —
|
|
562
|
+
`cartesianLayout`, `linearScale`, `niceTicks`, `seriesColor` — so you can build
|
|
563
|
+
one on the same spine rather than starting over.
|
|
564
|
+
|
|
565
|
+
#### Chart colours
|
|
566
|
+
|
|
567
|
+
Eight categorical slots, `--iryx-chart-1` … `--iryx-chart-8`, usable as Tailwind
|
|
568
|
+
colours (`text-chart-3`, `fill-chart-5`). They encode **identity** — which
|
|
569
|
+
series a mark belongs to — never magnitude.
|
|
570
|
+
|
|
571
|
+
```vue
|
|
572
|
+
<!-- One series per slot, assigned in order. -->
|
|
573
|
+
<ISparkline :data="revenue" class="text-chart-1" />
|
|
574
|
+
|
|
575
|
+
<ISparkline :data="expenses" class="text-chart-2" />
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
Three rules, and they are not stylistic:
|
|
579
|
+
|
|
580
|
+
- **Assign in order, never cycle.** A ninth series is not a generated ninth
|
|
581
|
+
hue — fold it into "Other", or switch to small multiples. A generated colour
|
|
582
|
+
hasn't been checked for separation against its neighbours.
|
|
583
|
+
- **Status colours are never series colours.** A series that happens to land in
|
|
584
|
+
slot 4 must not read as a warning. `success`/`warning`/`danger`/`info` stay
|
|
585
|
+
reserved.
|
|
586
|
+
- **Colour follows the entity, not its rank.** If a filter removes a series,
|
|
587
|
+
the survivors keep their slots rather than shifting up.
|
|
588
|
+
|
|
589
|
+
Tailwind scans source text, so a class name assembled at runtime is never
|
|
590
|
+
generated — write the slots out, or reach for the variable:
|
|
591
|
+
|
|
592
|
+
```vue
|
|
593
|
+
<!-- Silently unstyled: Tailwind never sees this string -->
|
|
594
|
+
<ISparkline :class="`text-chart-${index + 1}`" />
|
|
595
|
+
|
|
596
|
+
<!-- Either of these works -->
|
|
597
|
+
<ISparkline :class="['text-chart-1', 'text-chart-2'][index]" />
|
|
598
|
+
|
|
599
|
+
<ISparkline :style="{ color: `var(--iryx-chart-${index + 1})` }" />
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
The steps are not eyeballed. Each clears a lightness band, a chroma floor, and
|
|
603
|
+
protanopia/deuteranopia separation against its own surface, checked with a
|
|
604
|
+
validator rather than by eye. **Dark has its own steps**, validated against the
|
|
605
|
+
dark background — not an automatic flip of the light ones.
|
|
606
|
+
|
|
607
|
+
Two caps worth knowing before you design around them:
|
|
608
|
+
|
|
609
|
+
| Chart form | Max series |
|
|
610
|
+
| --- | --- |
|
|
611
|
+
| Bars, lines, stacks — only neighbours touch | **8** |
|
|
612
|
+
| Scatter, bubble, small multiples — any two marks can sit side by side | **3** |
|
|
613
|
+
|
|
614
|
+
Past those, the answer is fewer series or facets, not more colours. If you
|
|
615
|
+
re-step any slot, re-run the validator for **both** modes.
|
|
616
|
+
|
|
617
|
+
#### Line charts
|
|
618
|
+
|
|
619
|
+
```vue
|
|
620
|
+
<ILineChart
|
|
621
|
+
:data="[
|
|
622
|
+
{ label: 'Jan', value: 4200 },
|
|
623
|
+
{ label: 'Feb', value: null },
|
|
624
|
+
{ label: 'Mar', value: 5600 },
|
|
625
|
+
]"
|
|
626
|
+
variant="area"
|
|
627
|
+
label="Revenue by month"
|
|
628
|
+
/>
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
Same `data`, `height`, `ticks`, `axis`, `locale`, `format` and `label` props as
|
|
632
|
+
`IBarChart`, plus:
|
|
633
|
+
|
|
634
|
+
| Prop | Effect |
|
|
635
|
+
| --- | --- |
|
|
636
|
+
| `variant` | `line` (default) or `area`, which adds a wash beneath the line |
|
|
637
|
+
| `zero` | Force zero onto the axis. **Off by default** |
|
|
638
|
+
|
|
639
|
+
**`zero` is off here and always on for bars, deliberately.** A bar is read by
|
|
640
|
+
length, so a truncated baseline lies about the comparison. A line is read by
|
|
641
|
+
its *shape*, and a series hovering around 8,000 flattens into a straight edge
|
|
642
|
+
once the axis starts at nothing. Turn it on when the distance from zero is the
|
|
643
|
+
point.
|
|
644
|
+
|
|
645
|
+
`null` breaks the line rather than bridging it, so a missing reading never
|
|
646
|
+
draws a slope that didn't happen.
|
|
647
|
+
|
|
648
|
+
Hovering shows a crosshair and a single ringed marker on the reading under the
|
|
649
|
+
cursor — not a dot on every point, which is noise the axis and tooltip already
|
|
650
|
+
cover.
|
|
651
|
+
|
|
485
652
|
#### Bar charts
|
|
486
653
|
|
|
487
654
|
```vue
|
|
@@ -523,9 +690,17 @@ visually-hidden table instead, so a screen reader gets the actual numbers
|
|
|
523
690
|
rather than a blank graphic. That table renders even before the container has
|
|
524
691
|
been measured — the data is never gated behind layout.
|
|
525
692
|
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
693
|
+
**`orientation="horizontal"`** runs the categories down the side:
|
|
694
|
+
|
|
695
|
+
```vue
|
|
696
|
+
<IBarChart :data="spend" orientation="horizontal" label="Spend by category" />
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
Vertical charts thin colliding labels to every *n*th, which is fine for `Jan`
|
|
700
|
+
/ `Feb` and lossy for `Travel and accommodation`. Turn the chart and the names
|
|
701
|
+
get real width, so nothing is dropped — that's the case horizontal is for.
|
|
702
|
+
Everything else behaves the same: grouped series, the tooltip, the round-number
|
|
703
|
+
axis anchored at zero.
|
|
529
704
|
|
|
530
705
|
#### Sparklines
|
|
531
706
|
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Consumed by the Vue plugin (global registration) and the Nuxt module
|
|
4
4
|
* (auto-imports). Keep in sync with `src/components/index.ts`.
|
|
5
5
|
*/
|
|
6
|
-
export declare const componentNames: readonly ["Alert", "App", "Badge", "BarChart", "Banner", "Breadcrumb", "Button", "ButtonGroup", "Card", "Checkbox", "Combobox", "ConfirmDialog", "DatePicker", "DateRangePicker", "Dialog", "DropdownMenu", "EmptyState", "FileUpload", "Form", "FormField", "Input", "Label", "NumberInput", "Pagination", "PasswordInput", "Progress", "RadioGroup", "Select", "Separator", "Skeleton", "Sparkline", "Stat", "Stepper", "Switch", "Table", "Tabs", "Textarea", "Toaster", "Tooltip"];
|
|
6
|
+
export declare const componentNames: readonly ["Alert", "App", "Badge", "BarChart", "Banner", "Breadcrumb", "Button", "ButtonGroup", "Card", "ChartLegend", "Checkbox", "Combobox", "ConfirmDialog", "DatePicker", "DateRangePicker", "Dialog", "DropdownMenu", "EmptyState", "FileUpload", "Form", "FormField", "Input", "Label", "LineChart", "NumberInput", "Pagination", "PasswordInput", "Progress", "RadioGroup", "Select", "Separator", "Skeleton", "Sparkline", "Stat", "Stepper", "Switch", "Table", "Tabs", "Textarea", "Toaster", "Tooltip"];
|
|
7
7
|
export type ComponentName = (typeof componentNames)[number];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
//#region src/component-names.ts
|
|
2
|
+
var e = /* @__PURE__ */ "Alert.App.Badge.BarChart.Banner.Breadcrumb.Button.ButtonGroup.Card.ChartLegend.Checkbox.Combobox.ConfirmDialog.DatePicker.DateRangePicker.Dialog.DropdownMenu.EmptyState.FileUpload.Form.FormField.Input.Label.LineChart.NumberInput.Pagination.PasswordInput.Progress.RadioGroup.Select.Separator.Skeleton.Sparkline.Stat.Stepper.Switch.Table.Tabs.Textarea.Toaster.Tooltip".split(".");
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as componentNames };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Alert02Icon as e, AlertCircleIcon as t, Cancel01Icon as n, CheckmarkCircle02Icon as r, InformationCircleIcon as i } from "
|
|
1
|
+
import { Alert02Icon as e, AlertCircleIcon as t, Cancel01Icon as n, CheckmarkCircle02Icon as r, InformationCircleIcon as i } from "../node_modules/.pnpm/@hugeicons_core-free-icons@4.2.3/node_modules/@hugeicons/core-free-icons/dist/esm/index.js";
|
|
2
2
|
import { useIryxUiConfig as a } from "../config.js";
|
|
3
3
|
import { alertTheme as o } from "../theme/alert.js";
|
|
4
4
|
import s from "./Icon.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Cancel01Icon as e } from "
|
|
1
|
+
import { Cancel01Icon as e } from "../node_modules/.pnpm/@hugeicons_core-free-icons@4.2.3/node_modules/@hugeicons/core-free-icons/dist/esm/index.js";
|
|
2
2
|
import { useIryxUiConfig as t } from "../config.js";
|
|
3
3
|
import n from "./Icon.js";
|
|
4
4
|
import { bannerTheme as r } from "../theme/banner.js";
|
|
@@ -1,17 +1,34 @@
|
|
|
1
|
+
import type { ChartSeries } from '../composables/cartesian';
|
|
1
2
|
import type { SparseValue } from '../composables/scale';
|
|
3
|
+
/**
|
|
4
|
+
* A row. `value` is the single-series shortcut; with `series` set, each entry
|
|
5
|
+
* reads its own key off the row instead — plain objects and a descriptor, the
|
|
6
|
+
* same shape `ITable` uses.
|
|
7
|
+
*/
|
|
2
8
|
export interface BarChartDatum {
|
|
3
9
|
label: string;
|
|
4
10
|
/** `null` is a missing reading — no bar is drawn, which is not the same as 0. */
|
|
5
|
-
value
|
|
11
|
+
value?: SparseValue;
|
|
12
|
+
[key: string]: unknown;
|
|
6
13
|
}
|
|
7
14
|
export interface BarChartProps {
|
|
8
15
|
data?: readonly BarChartDatum[];
|
|
16
|
+
/** Two or more measures per category. Omit for the single-series case. */
|
|
17
|
+
series?: readonly ChartSeries[];
|
|
18
|
+
/**
|
|
19
|
+
* `horizontal` runs the categories down the side, where a long name has room
|
|
20
|
+
* to be read. Vertical charts thin their labels to avoid collisions, so long
|
|
21
|
+
* or numerous category names are the case to turn the chart for.
|
|
22
|
+
*/
|
|
23
|
+
orientation?: 'vertical' | 'horizontal';
|
|
9
24
|
/** Rendered height in px. Width always fills the container. */
|
|
10
25
|
height?: number;
|
|
11
26
|
/** Target tick count. The axis lands on round numbers, so this is a hint. */
|
|
12
27
|
ticks?: number;
|
|
13
28
|
/** Drop the value axis and its gridlines. */
|
|
14
29
|
axis?: boolean;
|
|
30
|
+
/** Drop the legend. Only honoured for a single series — see below. */
|
|
31
|
+
legend?: boolean;
|
|
15
32
|
/** Locale and options for every number shown — ticks and tooltip alike. */
|
|
16
33
|
locale?: string;
|
|
17
34
|
format?: Intl.NumberFormatOptions;
|
|
@@ -25,12 +42,54 @@ export interface BarChartProps {
|
|
|
25
42
|
class?: string;
|
|
26
43
|
ui?: Partial<Record<'root' | 'svg' | 'grid' | 'tick' | 'category' | 'bar' | 'tooltip' | 'tooltipLabel' | 'tooltipValue' | 'table', string>>;
|
|
27
44
|
}
|
|
28
|
-
declare
|
|
45
|
+
declare var __VLS_6: {
|
|
46
|
+
orientation: import("..").ChartOrientation;
|
|
47
|
+
ticks: number[];
|
|
48
|
+
plot: {
|
|
49
|
+
left: number;
|
|
50
|
+
top: number;
|
|
51
|
+
width: number;
|
|
52
|
+
height: number;
|
|
53
|
+
};
|
|
54
|
+
value: (value: number) => number;
|
|
55
|
+
y: (value: number) => number;
|
|
56
|
+
bandWidth: number;
|
|
57
|
+
labelStep: number;
|
|
58
|
+
bandCentre: (index: number) => number;
|
|
59
|
+
}, __VLS_8: {
|
|
60
|
+
orientation: import("..").ChartOrientation;
|
|
61
|
+
ticks: number[];
|
|
62
|
+
plot: {
|
|
63
|
+
left: number;
|
|
64
|
+
top: number;
|
|
65
|
+
width: number;
|
|
66
|
+
height: number;
|
|
67
|
+
};
|
|
68
|
+
value: (value: number) => number;
|
|
69
|
+
y: (value: number) => number;
|
|
70
|
+
bandWidth: number;
|
|
71
|
+
labelStep: number;
|
|
72
|
+
bandCentre: (index: number) => number;
|
|
73
|
+
};
|
|
74
|
+
type __VLS_Slots = {} & {
|
|
75
|
+
underlay?: (props: typeof __VLS_6) => any;
|
|
76
|
+
} & {
|
|
77
|
+
overlay?: (props: typeof __VLS_8) => any;
|
|
78
|
+
};
|
|
79
|
+
declare const __VLS_base: import("vue").DefineComponent<BarChartProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<BarChartProps> & Readonly<{}>, {
|
|
29
80
|
unstyled: boolean;
|
|
30
81
|
data: readonly BarChartDatum[];
|
|
82
|
+
legend: boolean;
|
|
83
|
+
orientation: "vertical" | "horizontal";
|
|
31
84
|
height: number;
|
|
32
85
|
ticks: number;
|
|
33
86
|
axis: boolean;
|
|
34
87
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
88
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
35
89
|
declare const _default: typeof __VLS_export;
|
|
36
90
|
export default _default;
|
|
91
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
92
|
+
new (): {
|
|
93
|
+
$slots: S;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { useIryxUiConfig as e } from "../config.js";
|
|
2
|
+
import { cartesianLayout as t, clampTooltip as n, seriesColor as r, slotOf as i, tooltipHalfWidth as a, warnOnSlotOverflow as o } from "../composables/cartesian.js";
|
|
3
|
+
import { useElementSize as s } from "../composables/element-size.js";
|
|
4
|
+
import { barChartTheme as c } from "../theme/bar-chart.js";
|
|
5
|
+
import l from "./ChartLegend.js";
|
|
6
|
+
import { Fragment as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, defineComponent as g, guardReactiveProps as _, normalizeClass as v, normalizeProps as y, normalizeStyle as b, openBlock as x, ref as S, renderList as C, renderSlot as w, toDisplayString as T, unref as E } from "vue";
|
|
7
|
+
//#region src/components/BarChart.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
+
var D = ["role", "aria-label"], O = [
|
|
9
|
+
"width",
|
|
10
|
+
"height",
|
|
11
|
+
"viewBox"
|
|
12
|
+
], k = [
|
|
13
|
+
"x1",
|
|
14
|
+
"y1",
|
|
15
|
+
"x2",
|
|
16
|
+
"y2"
|
|
17
|
+
], A = [
|
|
18
|
+
"x",
|
|
19
|
+
"y",
|
|
20
|
+
"text-anchor",
|
|
21
|
+
"dominant-baseline"
|
|
22
|
+
], j = ["d"], ee = [
|
|
23
|
+
"x",
|
|
24
|
+
"y",
|
|
25
|
+
"text-anchor",
|
|
26
|
+
"dominant-baseline"
|
|
27
|
+
], te = [
|
|
28
|
+
"x",
|
|
29
|
+
"y",
|
|
30
|
+
"width",
|
|
31
|
+
"height",
|
|
32
|
+
"onPointerenter"
|
|
33
|
+
], ne = { scope: "row" }, re = .7, M = /*@__PURE__*/ g({
|
|
34
|
+
__name: "BarChart",
|
|
35
|
+
props: {
|
|
36
|
+
data: { default: () => [] },
|
|
37
|
+
series: {},
|
|
38
|
+
orientation: { default: "vertical" },
|
|
39
|
+
height: { default: 240 },
|
|
40
|
+
ticks: { default: 5 },
|
|
41
|
+
axis: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: !0
|
|
44
|
+
},
|
|
45
|
+
legend: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: !0
|
|
48
|
+
},
|
|
49
|
+
locale: {},
|
|
50
|
+
format: {},
|
|
51
|
+
label: {},
|
|
52
|
+
unstyled: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: void 0
|
|
55
|
+
},
|
|
56
|
+
class: {},
|
|
57
|
+
ui: {}
|
|
58
|
+
},
|
|
59
|
+
setup(g) {
|
|
60
|
+
let M = g, N = e(), P = d(() => M.unstyled ?? N.unstyled), F = S(), { width: I } = s(F), L = d(() => new Intl.NumberFormat(M.locale, M.format));
|
|
61
|
+
function R(e) {
|
|
62
|
+
return L.value.format(e);
|
|
63
|
+
}
|
|
64
|
+
let z = d(() => {
|
|
65
|
+
let e = M.series?.length ? [...M.series] : [{ key: "value" }];
|
|
66
|
+
return o(e.length), e;
|
|
67
|
+
}), B = d(() => z.value.length > 1), V = d(() => B.value || M.legend && z.value[0].name != null);
|
|
68
|
+
function H(e, t) {
|
|
69
|
+
let n = e[t];
|
|
70
|
+
return typeof n == "number" && Number.isFinite(n) ? n : null;
|
|
71
|
+
}
|
|
72
|
+
let U = d(() => M.orientation === "horizontal"), W = d(() => t({
|
|
73
|
+
orientation: M.orientation,
|
|
74
|
+
values: M.data.flatMap((e) => z.value.map((t) => H(e, t.key))),
|
|
75
|
+
categories: M.data.length,
|
|
76
|
+
longestLabel: Math.max(...M.data.map((e) => e.label.length), 1),
|
|
77
|
+
width: I.value,
|
|
78
|
+
height: M.height,
|
|
79
|
+
tickCount: M.ticks,
|
|
80
|
+
showAxis: M.axis,
|
|
81
|
+
formatTick: R,
|
|
82
|
+
includeZero: !0
|
|
83
|
+
})), G = d(() => W.value.plot), K = d(() => W.value.y), q = d(() => W.value.bandWidth), J = d(() => q.value * re), Y = d(() => Math.max(2, Math.min(24, J.value / z.value.length))), ie = d(() => {
|
|
84
|
+
if (!I.value || !M.data.length) return [];
|
|
85
|
+
let e = W.value.value(0), t = z.value.length, n = +(t > 1);
|
|
86
|
+
return M.data.flatMap((r, i) => z.value.flatMap((a, o) => {
|
|
87
|
+
let s = H(r, a.key);
|
|
88
|
+
if (s == null) return [];
|
|
89
|
+
let c = W.value.value(s), l = W.value.bandCentre(i) - Y.value * t / 2 + Y.value * o + n, u = Math.max(Y.value - n * 2, 1), d = Math.abs(c - e);
|
|
90
|
+
return [U.value ? {
|
|
91
|
+
x: Math.min(c, e),
|
|
92
|
+
y: l,
|
|
93
|
+
width: d,
|
|
94
|
+
height: u,
|
|
95
|
+
direction: s >= 0 ? "right" : "left",
|
|
96
|
+
seriesIndex: o,
|
|
97
|
+
categoryIndex: i
|
|
98
|
+
} : {
|
|
99
|
+
x: l,
|
|
100
|
+
y: Math.min(c, e),
|
|
101
|
+
width: u,
|
|
102
|
+
height: d,
|
|
103
|
+
direction: s >= 0 ? "up" : "down",
|
|
104
|
+
seriesIndex: o,
|
|
105
|
+
categoryIndex: i
|
|
106
|
+
}];
|
|
107
|
+
}));
|
|
108
|
+
});
|
|
109
|
+
function ae(e) {
|
|
110
|
+
let { x: t, y: n, width: r, height: i } = e, a = t + r, o = n + i, s = Math.min(4, r / 2, i / 2, e.direction === "up" || e.direction === "down" ? i : r);
|
|
111
|
+
switch (e.direction) {
|
|
112
|
+
case "up": return `M${t} ${o} L${t} ${n + s} Q${t} ${n} ${t + s} ${n} L${a - s} ${n} Q${a} ${n} ${a} ${n + s} L${a} ${o} Z`;
|
|
113
|
+
case "down": return `M${t} ${n} L${t} ${o - s} Q${t} ${o} ${t + s} ${o} L${a - s} ${o} Q${a} ${o} ${a} ${o - s} L${a} ${n} Z`;
|
|
114
|
+
case "right": return `M${t} ${n} L${a - s} ${n} Q${a} ${n} ${a} ${n + s} L${a} ${o - s} Q${a} ${o} ${a - s} ${o} L${t} ${o} Z`;
|
|
115
|
+
default: return `M${a} ${n} L${t + s} ${n} Q${t} ${n} ${t} ${n + s} L${t} ${o - s} Q${t} ${o} ${t + s} ${o} L${a} ${o} Z`;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
let oe = d(() => W.value.labelStep), X = S(), Z = d(() => {
|
|
119
|
+
if (X.value == null) return;
|
|
120
|
+
let e = M.data[X.value];
|
|
121
|
+
if (!e) return;
|
|
122
|
+
let t = z.value.map((t, n) => ({
|
|
123
|
+
name: t.name ?? t.key,
|
|
124
|
+
color: r(i(t, n)),
|
|
125
|
+
value: H(e, t.key)
|
|
126
|
+
})).filter((e) => e.value != null).map((e) => ({
|
|
127
|
+
...e,
|
|
128
|
+
value: R(e.value)
|
|
129
|
+
}));
|
|
130
|
+
if (!t.length) return;
|
|
131
|
+
let o = B.value ? Math.max(e.label.length, ...t.map((e) => e.name.length + e.value.length + 3)) : e.label.length + t[0].value.length + 2, s = W.value.bandCentre(X.value);
|
|
132
|
+
if (U.value) {
|
|
133
|
+
let r = Math.max(...z.value.map((t) => {
|
|
134
|
+
let n = H(e, t.key);
|
|
135
|
+
return n == null ? -Infinity : W.value.value(n);
|
|
136
|
+
})), i = "x".repeat(o), c = a(i), l = r + c + 8, u = l + c <= I.value;
|
|
137
|
+
return {
|
|
138
|
+
label: e.label,
|
|
139
|
+
rows: t,
|
|
140
|
+
multi: B.value,
|
|
141
|
+
x: n(u ? l : r - c - 8, i, I.value),
|
|
142
|
+
y: s
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
let c = Math.min(...z.value.map((t) => {
|
|
146
|
+
let n = H(e, t.key);
|
|
147
|
+
return n == null ? Infinity : Math.min(W.value.value(n), W.value.value(0));
|
|
148
|
+
}));
|
|
149
|
+
return {
|
|
150
|
+
label: e.label,
|
|
151
|
+
rows: t,
|
|
152
|
+
multi: B.value,
|
|
153
|
+
x: n(s, "x".repeat(o), I.value),
|
|
154
|
+
y: c
|
|
155
|
+
};
|
|
156
|
+
}), Q = d(() => c());
|
|
157
|
+
function $(e, t) {
|
|
158
|
+
let n = M.ui?.[e];
|
|
159
|
+
return P.value ? [n, t] : Q.value[e]({ class: [n, t] });
|
|
160
|
+
}
|
|
161
|
+
function se(e) {
|
|
162
|
+
let t = X.value != null && X.value !== e.categoryIndex;
|
|
163
|
+
return P.value ? [M.ui?.bar] : Q.value.bar({ class: [M.ui?.bar, t ? Q.value.faded() : void 0] });
|
|
164
|
+
}
|
|
165
|
+
return (e, t) => (x(), m("div", {
|
|
166
|
+
ref_key: "root",
|
|
167
|
+
ref: F,
|
|
168
|
+
role: M.label ? "figure" : void 0,
|
|
169
|
+
"aria-label": M.label,
|
|
170
|
+
class: v($("root", M.class))
|
|
171
|
+
}, [
|
|
172
|
+
V.value ? (x(), f(l, {
|
|
173
|
+
key: 0,
|
|
174
|
+
series: z.value,
|
|
175
|
+
unstyled: M.unstyled
|
|
176
|
+
}, null, 8, ["series", "unstyled"])) : p("", !0),
|
|
177
|
+
h("div", { class: v(P.value ? void 0 : Q.value.plot()) }, [(x(), m("svg", {
|
|
178
|
+
width: E(I),
|
|
179
|
+
height: M.height,
|
|
180
|
+
viewBox: `0 0 ${E(I)} ${M.height}`,
|
|
181
|
+
"aria-hidden": "true",
|
|
182
|
+
class: v($("svg"))
|
|
183
|
+
}, [
|
|
184
|
+
M.axis ? (x(!0), m(u, { key: 0 }, C(W.value.ticks, (e) => (x(), m("g", { key: `tick-${e}` }, [h("line", {
|
|
185
|
+
x1: U.value ? W.value.value(e) : G.value.left,
|
|
186
|
+
y1: U.value ? G.value.top : K.value(e),
|
|
187
|
+
x2: U.value ? W.value.value(e) : G.value.left + G.value.width,
|
|
188
|
+
y2: U.value ? G.value.top + G.value.height : K.value(e),
|
|
189
|
+
"stroke-width": "1",
|
|
190
|
+
class: v($("grid"))
|
|
191
|
+
}, null, 10, k), h("text", {
|
|
192
|
+
x: U.value ? W.value.value(e) : G.value.left - E(8),
|
|
193
|
+
y: U.value ? G.value.top + G.value.height + 14 : K.value(e),
|
|
194
|
+
"text-anchor": U.value ? "middle" : "end",
|
|
195
|
+
"dominant-baseline": U.value ? void 0 : "middle",
|
|
196
|
+
class: v($("tick"))
|
|
197
|
+
}, T(R(e)), 11, A)]))), 128)) : p("", !0),
|
|
198
|
+
w(e.$slots, "underlay", y(_(W.value))),
|
|
199
|
+
(x(!0), m(u, null, C(ie.value, (e, t) => (x(), m("path", {
|
|
200
|
+
key: `bar-${e.categoryIndex}-${e.seriesIndex}-${t}`,
|
|
201
|
+
d: ae(e),
|
|
202
|
+
style: b({ fill: E(r)(E(i)(z.value[e.seriesIndex], e.seriesIndex)) }),
|
|
203
|
+
class: v(se(e))
|
|
204
|
+
}, null, 14, j))), 128)),
|
|
205
|
+
(x(!0), m(u, null, C(M.data, (e, t) => (x(), m(u, { key: `label-${e.label}-${t}` }, [t % oe.value === 0 ? (x(), m("text", {
|
|
206
|
+
key: 0,
|
|
207
|
+
x: U.value ? G.value.left - E(8) : W.value.bandCentre(t),
|
|
208
|
+
y: U.value ? W.value.bandCentre(t) : G.value.top + G.value.height + 14,
|
|
209
|
+
"text-anchor": U.value ? "end" : "middle",
|
|
210
|
+
"dominant-baseline": U.value ? "middle" : void 0,
|
|
211
|
+
class: v($("category"))
|
|
212
|
+
}, T(e.label), 11, ee)) : p("", !0)], 64))), 128)),
|
|
213
|
+
w(e.$slots, "overlay", y(_(W.value))),
|
|
214
|
+
(x(!0), m(u, null, C(M.data, (e, n) => (x(), m("rect", {
|
|
215
|
+
key: `hit-${e.label}-${n}`,
|
|
216
|
+
x: U.value ? G.value.left : G.value.left + q.value * n,
|
|
217
|
+
y: U.value ? G.value.top + q.value * n : G.value.top,
|
|
218
|
+
width: U.value ? G.value.width : q.value,
|
|
219
|
+
height: U.value ? q.value : G.value.height,
|
|
220
|
+
class: v(P.value ? void 0 : Q.value.hit()),
|
|
221
|
+
onPointerenter: (e) => X.value = n,
|
|
222
|
+
onPointerleave: t[0] ||= (e) => X.value = void 0
|
|
223
|
+
}, null, 42, te))), 128))
|
|
224
|
+
], 10, O)), Z.value ? (x(), m("div", {
|
|
225
|
+
key: 0,
|
|
226
|
+
class: v($("tooltip", Z.value.multi ? "flex-col items-start gap-1" : void 0)),
|
|
227
|
+
style: b({
|
|
228
|
+
left: `${Z.value.x}px`,
|
|
229
|
+
top: `${Z.value.y}px`,
|
|
230
|
+
transform: U.value ? "translate(-50%, -50%)" : "translate(-50%, -100%) translateY(-8px)"
|
|
231
|
+
})
|
|
232
|
+
}, [h("span", { class: v($("tooltipLabel")) }, T(Z.value.label), 3), Z.value.multi ? (x(!0), m(u, { key: 0 }, C(Z.value.rows, (e) => (x(), m("span", {
|
|
233
|
+
key: e.name,
|
|
234
|
+
class: "flex items-center gap-1.5"
|
|
235
|
+
}, [
|
|
236
|
+
h("span", {
|
|
237
|
+
class: "size-2 shrink-0 rounded-full",
|
|
238
|
+
style: b({ background: e.color })
|
|
239
|
+
}, null, 4),
|
|
240
|
+
h("span", { class: v($("tooltipLabel")) }, T(e.name), 3),
|
|
241
|
+
h("span", { class: v($("tooltipValue")) }, T(e.value), 3)
|
|
242
|
+
]))), 128)) : (x(), m("span", {
|
|
243
|
+
key: 1,
|
|
244
|
+
class: v($("tooltipValue"))
|
|
245
|
+
}, T(Z.value.rows[0].value), 3))], 6)) : p("", !0)], 2),
|
|
246
|
+
h("table", { class: v($("table")) }, [
|
|
247
|
+
h("caption", null, T(M.label), 1),
|
|
248
|
+
h("thead", null, [h("tr", null, [t[1] ||= h("th", { scope: "col" }, " Category ", -1), (x(!0), m(u, null, C(z.value, (e) => (x(), m("th", {
|
|
249
|
+
key: e.key,
|
|
250
|
+
scope: "col"
|
|
251
|
+
}, T(e.name ?? "Value"), 1))), 128))])]),
|
|
252
|
+
h("tbody", null, [(x(!0), m(u, null, C(M.data, (e, t) => (x(), m("tr", { key: `row-${e.label}-${t}` }, [h("th", ne, T(e.label), 1), (x(!0), m(u, null, C(z.value, (t) => (x(), m("td", { key: t.key }, T(H(e, t.key) == null ? "—" : R(H(e, t.key))), 1))), 128))]))), 128))])
|
|
253
|
+
], 2)
|
|
254
|
+
], 10, D));
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
//#endregion
|
|
258
|
+
export { M as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrowRight01Icon as e } from "
|
|
1
|
+
import { ArrowRight01Icon as e } from "../node_modules/.pnpm/@hugeicons_core-free-icons@4.2.3/node_modules/@hugeicons/core-free-icons/dist/esm/index.js";
|
|
2
2
|
import { useIryxUiConfig as t } from "../config.js";
|
|
3
3
|
import n from "./Icon.js";
|
|
4
4
|
import { breadcrumbTheme as r } from "../theme/breadcrumb.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Loading03Icon as e } from "
|
|
1
|
+
import { Loading03Icon as e } from "../node_modules/.pnpm/@hugeicons_core-free-icons@4.2.3/node_modules/@hugeicons/core-free-icons/dist/esm/index.js";
|
|
2
2
|
import { useIryxUiConfig as t } from "../config.js";
|
|
3
3
|
import n from "./Icon.js";
|
|
4
4
|
import { useButtonGroup as r } from "../composables/button-group.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ChartSeries } from '../composables/cartesian';
|
|
2
|
+
export interface ChartLegendProps {
|
|
3
|
+
series: readonly ChartSeries[];
|
|
4
|
+
/** Dim the entries that are not the one being hovered. */
|
|
5
|
+
active?: number;
|
|
6
|
+
unstyled?: boolean;
|
|
7
|
+
class?: string;
|
|
8
|
+
ui?: Partial<Record<'root' | 'item' | 'swatch' | 'name', string>>;
|
|
9
|
+
}
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<ChartLegendProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ChartLegendProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useIryxUiConfig as e } from "../config.js";
|
|
2
|
+
import { seriesColor as t, slotOf as n } from "../composables/cartesian.js";
|
|
3
|
+
import { chartLegendTheme as r } from "../theme/chart-legend.js";
|
|
4
|
+
import { Fragment as i, computed as a, createElementBlock as o, createElementVNode as s, defineComponent as c, normalizeClass as l, normalizeStyle as u, openBlock as d, renderList as f, toDisplayString as p, unref as m } from "vue";
|
|
5
|
+
//#region src/components/ChartLegend.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var h = /*@__PURE__*/ c({
|
|
7
|
+
__name: "ChartLegend",
|
|
8
|
+
props: {
|
|
9
|
+
series: {},
|
|
10
|
+
active: {},
|
|
11
|
+
unstyled: { type: Boolean },
|
|
12
|
+
class: {},
|
|
13
|
+
ui: {}
|
|
14
|
+
},
|
|
15
|
+
setup(c) {
|
|
16
|
+
let h = c, g = e(), _ = a(() => h.unstyled ?? g.unstyled), v = a(() => r());
|
|
17
|
+
function y(e, t) {
|
|
18
|
+
let n = h.ui?.[e];
|
|
19
|
+
return _.value ? [n, t] : v.value[e]({ class: [n, t] });
|
|
20
|
+
}
|
|
21
|
+
return (e, r) => (d(), o("ul", { class: l(y("root", h.class)) }, [(d(!0), o(i, null, f(h.series, (e, r) => (d(), o("li", {
|
|
22
|
+
key: e.key,
|
|
23
|
+
class: l(y("item", h.active != null && h.active !== r ? "opacity-40" : void 0))
|
|
24
|
+
}, [s("span", {
|
|
25
|
+
class: l(y("swatch")),
|
|
26
|
+
style: u({ background: m(t)(m(n)(e, r)) })
|
|
27
|
+
}, null, 6), s("span", { class: l(y("name")) }, p(e.name ?? e.key), 3)], 2))), 128))], 2));
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
//#endregion
|
|
31
|
+
export { h as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MinusSignIcon as e, Tick02Icon as t } from "
|
|
1
|
+
import { MinusSignIcon as e, Tick02Icon as t } from "../node_modules/.pnpm/@hugeicons_core-free-icons@4.2.3/node_modules/@hugeicons/core-free-icons/dist/esm/index.js";
|
|
2
2
|
import { useIryxUiConfig as n } from "../config.js";
|
|
3
3
|
import r from "./Icon.js";
|
|
4
4
|
import { checkboxTheme as i } from "../theme/checkbox.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ArrowDown01Icon as e, Tick02Icon as t } from "
|
|
1
|
+
import { ArrowDown01Icon as e, Tick02Icon as t } from "../node_modules/.pnpm/@hugeicons_core-free-icons@4.2.3/node_modules/@hugeicons/core-free-icons/dist/esm/index.js";
|
|
2
2
|
import { useIryxUiConfig as n } from "../config.js";
|
|
3
3
|
import r from "./Icon.js";
|
|
4
4
|
import { useFormField as i } from "../composables/form.js";
|