@wikicasa-dev/components 2.9.1 → 2.10.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.
- package/dist/UIKit/BaseSnackbar.vue.js +1 -1
- package/dist/assets/AccessibleSelect.css +1 -1
- package/dist/assets/BaseBadge.css +1 -1
- package/dist/assets/BaseComplexToggle2.css +1 -1
- package/dist/assets/BaseDropDown.css +1 -1
- package/dist/assets/BaseFloatingLabel2.css +1 -1
- package/dist/assets/BaseSlider2.css +1 -1
- package/dist/assets/BaseSnackbar.css +1 -1
- package/dist/assets/BaseTabs.css +1 -1
- package/dist/assets/BaseTextarea2.css +1 -1
- package/dist/assets/BaseTooltip2.css +1 -1
- package/dist/assets/baseAlert.css +1 -1
- package/dist/assets/baseComplexToggle.css +1 -1
- package/dist/assets/baseFloatingLabel.css +1 -1
- package/dist/assets/baseSlider.css +1 -1
- package/dist/assets/baseTextarea.css +1 -1
- package/dist/assets/baseTooltip.css +1 -1
- package/dist/assets/tailwind.css +1 -1
- package/dist/assets/tokens.css +1 -0
- package/dist/docs/AccessibleSelect.md +121 -0
- package/dist/docs/AccordionContentPrimitive.md +70 -0
- package/dist/docs/AccordionHeaderPrimitive.md +70 -0
- package/dist/docs/AccordionItemPrimitive.md +98 -0
- package/dist/docs/AccordionTriggerPrimitive.md +71 -0
- package/dist/docs/BaseAccordion.md +98 -0
- package/dist/docs/BaseAccordionItem.md +100 -0
- package/dist/docs/BaseAlert.md +83 -0
- package/dist/docs/BaseAutocomplete.md +125 -0
- package/dist/docs/BaseBadge.md +92 -0
- package/dist/docs/BaseBreadcrumb.md +83 -0
- package/dist/docs/BaseButton.md +129 -0
- package/dist/docs/BaseCard.md +110 -0
- package/dist/docs/BaseComplexToggle.md +99 -0
- package/dist/docs/BaseDropDown.md +122 -0
- package/dist/docs/BaseFloatingLabel.md +89 -0
- package/dist/docs/BaseInput.md +130 -0
- package/dist/docs/BaseModal.md +129 -0
- package/dist/docs/BasePagination.md +109 -0
- package/dist/docs/BaseShimmerLoader.md +86 -0
- package/dist/docs/BaseSlider.md +87 -0
- package/dist/docs/BaseSnackbar.md +120 -0
- package/dist/docs/BaseTab.md +84 -0
- package/dist/docs/BaseTabView.md +90 -0
- package/dist/docs/BaseTabs.md +116 -0
- package/dist/docs/BaseTabsContent.md +71 -0
- package/dist/docs/BaseTabsIndicator.md +73 -0
- package/dist/docs/BaseTabsList.md +76 -0
- package/dist/docs/BaseTabsTrigger.md +70 -0
- package/dist/docs/BaseTextarea.md +99 -0
- package/dist/docs/BaseToggle.md +88 -0
- package/dist/docs/BaseTooltip.md +87 -0
- package/dist/docs/BaseUploadFile.md +96 -0
- package/dist/docs/CardDescriptionPrimitive.md +73 -0
- package/dist/docs/CardImagePrimitive.md +73 -0
- package/dist/docs/CardRootPrimitive.md +99 -0
- package/dist/docs/CheckboxBtn.md +96 -0
- package/dist/docs/CheckboxButtonGroup.md +115 -0
- package/dist/docs/CheckboxGroup.md +102 -0
- package/dist/docs/CheckboxGroupItemPrimitive.md +104 -0
- package/dist/docs/CheckboxGroupPrimitive.md +105 -0
- package/dist/docs/ClearableAutocomplete.md +135 -0
- package/dist/docs/DoughnutChart.md +88 -0
- package/dist/docs/INDEX.md +133 -0
- package/dist/docs/IntersectionObservable.md +78 -0
- package/dist/docs/IntersectionObserver.md +84 -0
- package/dist/docs/IntersectionObserverProvider.md +98 -0
- package/dist/docs/IntersectionObserverTarget.md +73 -0
- package/dist/docs/LineChart.md +98 -0
- package/dist/docs/ProgressIndicatorPrimitive.md +70 -0
- package/dist/docs/ProgressRootPrimitive.md +106 -0
- package/dist/docs/RadioButton.md +86 -0
- package/dist/docs/RadioButtonGroup.md +107 -0
- package/dist/docs/RadioButtonItem.md +101 -0
- package/dist/docs/RadioGroup.md +95 -0
- package/dist/docs/RadioGroupItemPrimitive.md +102 -0
- package/dist/docs/SelectItem.md +100 -0
- package/dist/docs/ShimmerMultiLine.md +79 -0
- package/dist/docs/SimpleSlider.md +80 -0
- package/dist/docs/StaticSpinner.md +76 -0
- package/dist/docs/SwiperCarousel.md +126 -0
- package/dist/docs/SwiperNavigationPrimitive.md +83 -0
- package/dist/docs/SwiperPaginationPrimitive.md +80 -0
- package/dist/docs/SwiperPrimitive.md +77 -0
- package/dist/docs/SwiperRootPrimitive.md +123 -0
- package/dist/docs/SwiperSlide.md +75 -0
- package/dist/docs/SwiperSlideImagePrimitive.md +98 -0
- package/dist/docs/SwiperThumbnailPrimitive.md +96 -0
- package/dist/docs/TOKENS.md +50 -0
- package/dist/docs/agent-index.md +86 -0
- package/dist/lazyModules/Swiper/Autoplay/index.js +1 -1
- package/dist/lazyModules/Swiper/Controller/index.js +1 -1
- package/dist/lazyModules/Swiper/Keyboard/index.js +1 -1
- package/dist/lazyModules/Swiper/Thumbs/index.js +1 -1
- package/package.json +9 -8
- /package/dist/assets/{swiper-thumbs.css → swiper-autoplay.css} +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: DoughnutChart
|
|
3
|
+
status: preferred
|
|
4
|
+
category: Charts
|
|
5
|
+
summary: Chart.js doughnut chart for shares of a whole, e.g. a mortgage split into capital and interest.
|
|
6
|
+
import: @wikicasa-dev/components/chart/DoughnutChart
|
|
7
|
+
version: 2.10.0
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# DoughnutChart
|
|
11
|
+
|
|
12
|
+
Chart.js doughnut chart for shares of a whole, e.g. a mortgage split into capital and interest.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import DoughnutChart from "@wikicasa-dev/components/chart/DoughnutChart";
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
A Chart.js doughnut chart (via vue-chartjs) for parts of a whole: capital vs. interest of a mortgage, sale vs. rent listings in a city. Pass Chart.js `data` and `options`; it renders a `<canvas>` on the client (Chart.js loads lazily, nothing appears in server HTML). A common pattern is a label absolutely positioned in the hole (see Usage).
|
|
19
|
+
|
|
20
|
+
Tooltip, legend and title are registered **only if** `options.plugins.tooltip`, `.legend` or `.title` is set (an empty object `{}` is enough).
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```vue
|
|
25
|
+
<script setup lang="ts">
|
|
26
|
+
import DoughnutChart from "@wikicasa-dev/components/chart/DoughnutChart";
|
|
27
|
+
import type { ChartData, ChartOptions } from "@wikicasa-dev/components";
|
|
28
|
+
|
|
29
|
+
const data: ChartData<"doughnut"> = {
|
|
30
|
+
labels: ["Capitale", "Interessi"],
|
|
31
|
+
datasets: [{ data: [200000, 64300], backgroundColor: ["#2B5DFF", "#B4C2F0"], borderWidth: 0 }],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const options: ChartOptions<"doughnut"> = {
|
|
35
|
+
cutout: 50,
|
|
36
|
+
responsive: true,
|
|
37
|
+
maintainAspectRatio: true,
|
|
38
|
+
plugins: { legend: { display: false }, tooltip: { enabled: false } },
|
|
39
|
+
};
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<div class="installment">
|
|
44
|
+
<DoughnutChart :data="data" :options="options" />
|
|
45
|
+
<p class="installment__label"><strong>€ 1.102</strong><br />al mese</p>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<style scoped>
|
|
50
|
+
.installment { position: relative; width: 136px; height: 136px; margin: 0 auto; }
|
|
51
|
+
.installment__label { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0; text-align: center; }
|
|
52
|
+
</style>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Do / Don't
|
|
56
|
+
|
|
57
|
+
- Do give it a sized, `position: relative` container; with the default aspect ratio the chart is a square as wide as its container.
|
|
58
|
+
- Do set `plugins.legend: { display: false }` explicitly when you don't want a legend: plugins are registered globally, so once any chart on the page has loaded the legend, every chart shows one by default.
|
|
59
|
+
- Do decide `plugins` up front: which modules to load is decided once, when the chart is created.
|
|
60
|
+
- Use `cutout` (px or %) for the hole size, `backgroundColor` per slice from the design tokens' colors.
|
|
61
|
+
- Use static mock data in mockups; `ChartData` / `ChartOptions` types are re-exported from `@wikicasa-dev/components`.
|
|
62
|
+
|
|
63
|
+
## API
|
|
64
|
+
|
|
65
|
+
_Generated from the component's types. Do not edit by hand._
|
|
66
|
+
|
|
67
|
+
### Props
|
|
68
|
+
|
|
69
|
+
| Name | Type | Default | Required | Description |
|
|
70
|
+
| --- | --- | --- | --- | --- |
|
|
71
|
+
| `options` | `_DeepPartialObject<CoreChartOptions<"doughnut"> & ElementChartOptions<"doughnut"> & PluginChartOptions<"doughnut"> & DatasetChartOptions<"doughnut"> & ScaleChartOptions<"doughnut"> & DoughnutControllerChartOptions>` | | yes | |
|
|
72
|
+
| `data` | `ChartData<"doughnut", number[], unknown>` | | yes | |
|
|
73
|
+
|
|
74
|
+
### Events
|
|
75
|
+
|
|
76
|
+
None.
|
|
77
|
+
|
|
78
|
+
### v-model
|
|
79
|
+
|
|
80
|
+
None.
|
|
81
|
+
|
|
82
|
+
### Slots
|
|
83
|
+
|
|
84
|
+
None.
|
|
85
|
+
|
|
86
|
+
### Exposed (template ref)
|
|
87
|
+
|
|
88
|
+
None.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# @wikicasa-dev/components 2.10.0: component catalog
|
|
2
|
+
|
|
3
|
+
Start here. Each component has its own doc with usage notes and its full API (props, events, slots, v-model).
|
|
4
|
+
|
|
5
|
+
## Rules
|
|
6
|
+
|
|
7
|
+
- Use components as black boxes: read their doc, not their source in `dist/`.
|
|
8
|
+
- Prefer `preferred` components. `primitive` ones are building blocks for something new; `legacy` ones must not be used in new work.
|
|
9
|
+
- Import each component from the path shown in its doc (deep imports keep bundles small).
|
|
10
|
+
- Load the global stylesheet once: `import "@wikicasa-dev/components/style";`. It includes the design tokens. Component styles load automatically with each component.
|
|
11
|
+
- Colors, radii, shadows and font weights come from the design tokens in [TOKENS.md](./TOKENS.md).
|
|
12
|
+
|
|
13
|
+
## Actions
|
|
14
|
+
|
|
15
|
+
| Component | Status | Use it for |
|
|
16
|
+
| --- | --- | --- |
|
|
17
|
+
| [BaseButton](./BaseButton.md) | preferred | The standard button: primary/secondary/danger CTAs, light and text-style buttons, selectable chips, loading state. |
|
|
18
|
+
|
|
19
|
+
## Charts
|
|
20
|
+
|
|
21
|
+
| Component | Status | Use it for |
|
|
22
|
+
| --- | --- | --- |
|
|
23
|
+
| [DoughnutChart](./DoughnutChart.md) | preferred | Chart.js doughnut chart for shares of a whole, e.g. a mortgage split into capital and interest. |
|
|
24
|
+
| [LineChart](./LineChart.md) | preferred | Chart.js line chart (category, linear or time x-axis) for trends such as average €/m² over time. |
|
|
25
|
+
|
|
26
|
+
## Feedback
|
|
27
|
+
|
|
28
|
+
| Component | Status | Use it for |
|
|
29
|
+
| --- | --- | --- |
|
|
30
|
+
| [BaseAlert](./BaseAlert.md) | preferred | Inline, static message box (success/info, error, dark) shown in the page flow, e.g. under a form. |
|
|
31
|
+
| [BaseBadge](./BaseBadge.md) | preferred | Small non-interactive label or pill: listing status, "Vetrina", Premium/Gold tiers, tags and counters. |
|
|
32
|
+
| [BaseSnackbar](./BaseSnackbar.md) | preferred | Temporary toast notification that slides in at the page edge, auto-closes with a progress bar, swipe to dismiss. |
|
|
33
|
+
|
|
34
|
+
## Forms
|
|
35
|
+
|
|
36
|
+
| Component | Status | Use it for |
|
|
37
|
+
| --- | --- | --- |
|
|
38
|
+
| [AccessibleSelect](./AccessibleSelect.md) | preferred | Single-choice select field (combobox + listbox) with floating label, validation state and keyboard support. |
|
|
39
|
+
| [BaseInput](./BaseInput.md) | preferred | Single-line text field with floating label, validation state, feedback messages and optional icons. |
|
|
40
|
+
| [BaseSlider](./BaseSlider.md) | preferred | Dual-thumb range slider with linked Min/Max number fields, linear or logarithmic. |
|
|
41
|
+
| [BaseTextarea](./BaseTextarea.md) | preferred | Multi-line text field with floating label and validation state, matching BaseInput's look. |
|
|
42
|
+
| [BaseToggle](./BaseToggle.md) | preferred | On/off switch bound to a boolean, with a label on the left or right. |
|
|
43
|
+
| [BaseUploadFile](./BaseUploadFile.md) | preferred | Dashed, field-shaped file picker with a floating label that emits the chosen File. |
|
|
44
|
+
| [CheckboxBtn](./CheckboxBtn.md) | preferred | Single accessible checkbox with a clickable text label, bound to a boolean. |
|
|
45
|
+
| [ClearableAutocomplete](./ClearableAutocomplete.md) | preferred | Unstyled search-as-you-type input with an inline clear button, loading slot and race-safe async results. |
|
|
46
|
+
| [SimpleSlider](./SimpleSlider.md) | preferred | Single-thumb draggable slider bound with v-model to one number (linear or logarithmic scale). |
|
|
47
|
+
| [BaseFloatingLabel](./BaseFloatingLabel.md) | primitive | The floating field label used by BaseInput and BaseTextarea, for labelling custom field-like controls. |
|
|
48
|
+
| [BaseAutocomplete](./BaseAutocomplete.md) | legacy | Use `ClearableAutocomplete` instead. |
|
|
49
|
+
|
|
50
|
+
## Layout
|
|
51
|
+
|
|
52
|
+
| Component | Status | Use it for |
|
|
53
|
+
| --- | --- | --- |
|
|
54
|
+
| [BaseAccordion](./BaseAccordion.md) | preferred | Accessible accordion root: a stack of collapsible sections (FAQs, grouped filters), one or many open at a time. |
|
|
55
|
+
| [BaseAccordionItem](./BaseAccordionItem.md) | preferred | One collapsible section of BaseAccordion: a header with title and rotating arrow, plus the content. |
|
|
56
|
+
| [BaseCard](./BaseCard.md) | preferred | Image + body card with fixed layouts (default row, mini, vertical, news) for listings, agencies and articles. |
|
|
57
|
+
| [AccordionContentPrimitive](./AccordionContentPrimitive.md) | primitive | Unstyled collapsible panel of a primitive accordion item; hidden while the item is closed. |
|
|
58
|
+
| [AccordionHeaderPrimitive](./AccordionHeaderPrimitive.md) | primitive | Unstyled heading element (h3 by default) wrapping the trigger of a primitive accordion item. |
|
|
59
|
+
| [AccordionItemPrimitive](./AccordionItemPrimitive.md) | primitive | Unstyled accordion section wrapper, for custom accordion items composed from the Accordion*Primitive parts. |
|
|
60
|
+
| [AccordionTriggerPrimitive](./AccordionTriggerPrimitive.md) | primitive | Unstyled button that opens and closes a primitive accordion item. |
|
|
61
|
+
| [CardDescriptionPrimitive](./CardDescriptionPrimitive.md) | primitive | The body cell (.card-body) of a CardRootPrimitive composition, with the card's standard padding. |
|
|
62
|
+
| [CardImagePrimitive](./CardImagePrimitive.md) | primitive | The image cell (.card-img) of a CardRootPrimitive composition, sized by the card type. |
|
|
63
|
+
| [CardRootPrimitive](./CardRootPrimitive.md) | primitive | Card shell (rounded, shadowed root with the BaseCard layouts) to compose with CardImagePrimitive and CardDescriptionPrimitive. |
|
|
64
|
+
|
|
65
|
+
## Loading
|
|
66
|
+
|
|
67
|
+
| Component | Status | Use it for |
|
|
68
|
+
| --- | --- | --- |
|
|
69
|
+
| [BaseShimmerLoader](./BaseShimmerLoader.md) | preferred | Animated skeleton block (lavender box with a moving shine) that stands in for content while it loads. |
|
|
70
|
+
| [ShimmerMultiLine](./ShimmerMultiLine.md) | preferred | Stack of BaseShimmerLoader lines, a quick skeleton for a paragraph or a card description. |
|
|
71
|
+
| [StaticSpinner](./StaticSpinner.md) | preferred | Small rotating SVG ring (24px) for inline waits, e.g. inside a button while a request runs. |
|
|
72
|
+
| [ProgressIndicatorPrimitive](./ProgressIndicatorPrimitive.md) | primitive | Unstyled fill element of a progress bar; must sit inside ProgressRootPrimitive, which you size and position yourself. |
|
|
73
|
+
| [ProgressRootPrimitive](./ProgressRootPrimitive.md) | primitive | Unstyled accessible progress bar root (role="progressbar"); compose with ProgressIndicatorPrimitive and style it yourself. |
|
|
74
|
+
|
|
75
|
+
## Media
|
|
76
|
+
|
|
77
|
+
| Component | Status | Use it for |
|
|
78
|
+
| --- | --- | --- |
|
|
79
|
+
| [SwiperCarousel](./SwiperCarousel.md) | preferred | Ready-made Swiper carousel for slides or an image gallery, with optional arrows, bullets, autoplay and thumbnails. |
|
|
80
|
+
| [SwiperSlide](./SwiperSlide.md) | preferred | One slide of a SwiperCarousel or SwiperPrimitive track; holds any content (card, image, banner). |
|
|
81
|
+
| [SwiperNavigationPrimitive](./SwiperNavigationPrimitive.md) | primitive | Swiper prev/next arrows for a SwiperRootPrimitive carousel. |
|
|
82
|
+
| [SwiperPaginationPrimitive](./SwiperPaginationPrimitive.md) | primitive | Pagination (bullets or "2 / 8" fraction) for a SwiperRootPrimitive carousel. |
|
|
83
|
+
| [SwiperPrimitive](./SwiperPrimitive.md) | primitive | The slide track (.swiper-wrapper) of a SwiperRootPrimitive carousel; holds the slides and emits click. |
|
|
84
|
+
| [SwiperRootPrimitive](./SwiperRootPrimitive.md) | primitive | Root of the composable Swiper carousel; owns the Swiper instance, deferred image loading and the reveal. |
|
|
85
|
+
| [SwiperSlideImagePrimitive](./SwiperSlideImagePrimitive.md) | primitive | A slide holding one image, with optional deferred loading driven by SwiperRootPrimitive or SwiperThumbnailPrimitive. |
|
|
86
|
+
| [SwiperThumbnailPrimitive](./SwiperThumbnailPrimitive.md) | primitive | Thumbnail strip linked to a SwiperRootPrimitive carousel; tapping a thumbnail shows that slide. |
|
|
87
|
+
|
|
88
|
+
## Navigation
|
|
89
|
+
|
|
90
|
+
| Component | Status | Use it for |
|
|
91
|
+
| --- | --- | --- |
|
|
92
|
+
| [BaseBreadcrumb](./BaseBreadcrumb.md) | preferred | Breadcrumb trail of links separated by arrows, e.g. Home › Vendita › Milano › Navigli. |
|
|
93
|
+
| [BasePagination](./BasePagination.md) | preferred | Page navigator for result lists: prev/next arrows, first/last page, siblings and ellipses, or a compact prev/next form. |
|
|
94
|
+
| [BaseTabs](./BaseTabs.md) | preferred | Accessible tabs (root of the compound set): switches between panels with an animated underline indicator. |
|
|
95
|
+
| [BaseTabsContent](./BaseTabsContent.md) | preferred | The panel of a BaseTabs set, shown while the trigger with the same value is active. |
|
|
96
|
+
| [BaseTabsIndicator](./BaseTabsIndicator.md) | preferred | Animated underline that slides under the active BaseTabsTrigger. |
|
|
97
|
+
| [BaseTabsList](./BaseTabsList.md) | preferred | Row that holds the BaseTabsTrigger tabs (and the BaseTabsIndicator) inside BaseTabs. |
|
|
98
|
+
| [BaseTabsTrigger](./BaseTabsTrigger.md) | preferred | A single tab button inside BaseTabsList; activates the BaseTabsContent with the same value. |
|
|
99
|
+
| [BaseTab](./BaseTab.md) | legacy | Use `BaseTabsTrigger` instead. |
|
|
100
|
+
| [BaseTabView](./BaseTabView.md) | legacy | Use `BaseTabs` instead. |
|
|
101
|
+
|
|
102
|
+
## Overlays
|
|
103
|
+
|
|
104
|
+
| Component | Status | Use it for |
|
|
105
|
+
| --- | --- | --- |
|
|
106
|
+
| [BaseDropDown](./BaseDropDown.md) | preferred | Toggle button with an attached dropdown panel for menus, link lists and custom filter content. |
|
|
107
|
+
| [BaseModal](./BaseModal.md) | preferred | Dialog over a dimmed backdrop: centered card on desktop, bottom sheet on mobile, with header/body/footer slots. |
|
|
108
|
+
| [BaseTooltip](./BaseTooltip.md) | preferred | CSS hover tooltip with an arrow, opening below a trigger (e.g. an info icon) to explain a value. |
|
|
109
|
+
|
|
110
|
+
## Selection
|
|
111
|
+
|
|
112
|
+
| Component | Status | Use it for |
|
|
113
|
+
| --- | --- | --- |
|
|
114
|
+
| [BaseComplexToggle](./BaseComplexToggle.md) | preferred | Two-option segmented toggle (pill with a sliding highlight) that picks one of two labelled choices. |
|
|
115
|
+
| [CheckboxButtonGroup](./CheckboxButtonGroup.md) | preferred | Group of CheckboxBtn bound to one array of selected values, with an optional "select all" reset option. |
|
|
116
|
+
| [RadioButtonGroup](./RadioButtonGroup.md) | preferred | Accessible single-choice radio group bound to one value, rendering items from a list or from its slot. |
|
|
117
|
+
| [RadioButtonItem](./RadioButtonItem.md) | preferred | Classic radio button (circle + clickable label) used inside RadioButtonGroup. |
|
|
118
|
+
| [CheckboxGroupItemPrimitive](./CheckboxGroupItemPrimitive.md) | primitive | Unstyled checkbox item (reka-ui CheckboxRoot) for building custom chips or tiles inside CheckboxGroupPrimitive. |
|
|
119
|
+
| [CheckboxGroupPrimitive](./CheckboxGroupPrimitive.md) | primitive | Unstyled multi-select group root (reka-ui CheckboxGroupRoot) holding an array of checked values. |
|
|
120
|
+
| [RadioGroupItemPrimitive](./RadioGroupItemPrimitive.md) | primitive | Unstyled radio option (reka-ui RadioGroupItem) for custom segmented buttons or cards inside RadioButtonGroup. |
|
|
121
|
+
| [SelectItem](./SelectItem.md) | primitive | List row (`<li>`) with an active/highlighted state, for building option lists inside BaseDropDown. |
|
|
122
|
+
| [CheckboxGroup](./CheckboxGroup.md) | legacy | Use `CheckboxButtonGroup` instead. |
|
|
123
|
+
| [RadioButton](./RadioButton.md) | legacy | Use `RadioButtonItem` instead. |
|
|
124
|
+
| [RadioGroup](./RadioGroup.md) | legacy | Use `RadioButtonGroup` instead. |
|
|
125
|
+
|
|
126
|
+
## Utilities
|
|
127
|
+
|
|
128
|
+
| Component | Status | Use it for |
|
|
129
|
+
| --- | --- | --- |
|
|
130
|
+
| [IntersectionObserverProvider](./IntersectionObserverProvider.md) | preferred | Shares one IntersectionObserver with its IntersectionObserverTarget children to lazy-render content or detect scroll-into-view. |
|
|
131
|
+
| [IntersectionObserverTarget](./IntersectionObserverTarget.md) | preferred | Element watched by the surrounding IntersectionObserverProvider; exposes isVisible to its slot. |
|
|
132
|
+
| [IntersectionObservable](./IntersectionObservable.md) | legacy | Use `IntersectionObserverTarget` instead. |
|
|
133
|
+
| [IntersectionObserver](./IntersectionObserver.md) | legacy | Use `IntersectionObserverProvider` instead. |
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: IntersectionObservable
|
|
3
|
+
status: legacy
|
|
4
|
+
category: Utilities
|
|
5
|
+
summary: Older element wrapper registered with the observer passed in from IntersectionObserver's #observer slot.
|
|
6
|
+
useInstead: IntersectionObserverTarget
|
|
7
|
+
import: @wikicasa-dev/components/generic/IntersectionObserver/IntersectionObservable
|
|
8
|
+
version: 2.10.0
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# IntersectionObservable
|
|
12
|
+
|
|
13
|
+
> **Legacy.** Don't use in new designs. Use `IntersectionObserverTarget` instead.
|
|
14
|
+
|
|
15
|
+
Older element wrapper registered with the observer passed in from IntersectionObserver's #observer slot.
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import IntersectionObservable from "@wikicasa-dev/components/generic/IntersectionObserver/IntersectionObservable";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The observed element of the legacy `IntersectionObserver` pair: it wraps its slot in a `<div>` and registers that `<div>` with the `observer` prop when mounted. Visibility is not tracked here; it comes from the parent's shared `isVisible` slot prop. Passing `:is-visible="isVisible"` back in removes the wrapper `<div>` once visible. See `IntersectionObserver` for the full legacy pattern.
|
|
22
|
+
|
|
23
|
+
For new work use `IntersectionObserverTarget` inside an `IntersectionObserverProvider`: it tracks visibility per element and needs no `observer` prop.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Shown so existing code can be read; don't add new instances.
|
|
28
|
+
|
|
29
|
+
```vue
|
|
30
|
+
<script setup lang="ts">
|
|
31
|
+
import IntersectionObserver from "@wikicasa-dev/components/generic/IntersectionObserver/IntersectionObserver";
|
|
32
|
+
import IntersectionObservable from "@wikicasa-dev/components/generic/IntersectionObserver/IntersectionObservable";
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<IntersectionObserver>
|
|
37
|
+
<template #observer="{ observer, isVisible }">
|
|
38
|
+
<IntersectionObservable :observer="observer" :is-visible="isVisible">
|
|
39
|
+
<img v-if="isVisible" src="/img/attico-roma.jpg" alt="Attico a Roma" width="120" height="110" />
|
|
40
|
+
</IntersectionObservable>
|
|
41
|
+
</template>
|
|
42
|
+
</IntersectionObserver>
|
|
43
|
+
</template>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Do / Don't
|
|
47
|
+
|
|
48
|
+
- Don't use in new designs; use `IntersectionObserverTarget`.
|
|
49
|
+
- Always pass the slot's `observer`; without it nothing is observed and content gated on `isVisible` never shows.
|
|
50
|
+
|
|
51
|
+
## API
|
|
52
|
+
|
|
53
|
+
_Generated from the component's types. Do not edit by hand._
|
|
54
|
+
|
|
55
|
+
### Props
|
|
56
|
+
|
|
57
|
+
| Name | Type | Default | Required | Description |
|
|
58
|
+
| --- | --- | --- | --- | --- |
|
|
59
|
+
| `observer` | `IntersectionObserver \| null` | `null` | | |
|
|
60
|
+
| `isVisible` | `boolean` | `false` | | |
|
|
61
|
+
|
|
62
|
+
### Events
|
|
63
|
+
|
|
64
|
+
None.
|
|
65
|
+
|
|
66
|
+
### v-model
|
|
67
|
+
|
|
68
|
+
None.
|
|
69
|
+
|
|
70
|
+
### Slots
|
|
71
|
+
|
|
72
|
+
| Name | Slot props |
|
|
73
|
+
| --- | --- |
|
|
74
|
+
| `default` | |
|
|
75
|
+
|
|
76
|
+
### Exposed (template ref)
|
|
77
|
+
|
|
78
|
+
None.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: IntersectionObserver
|
|
3
|
+
status: legacy
|
|
4
|
+
category: Utilities
|
|
5
|
+
summary: Older lazy-render helper exposing one observer and a single shared isVisible flag through its #observer slot.
|
|
6
|
+
useInstead: IntersectionObserverProvider
|
|
7
|
+
import: @wikicasa-dev/components/generic/IntersectionObserver/IntersectionObserver
|
|
8
|
+
version: 2.10.0
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# IntersectionObserver
|
|
12
|
+
|
|
13
|
+
> **Legacy.** Don't use in new designs. Use `IntersectionObserverProvider` instead.
|
|
14
|
+
|
|
15
|
+
Older lazy-render helper exposing one observer and a single shared isVisible flag through its #observer slot.
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import IntersectionObserver from "@wikicasa-dev/components/generic/IntersectionObserver/IntersectionObserver";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
First-generation viewport detection. It creates an `IntersectionObserver` and passes `{ observer, isVisible }` to its `#observer` slot; you hand `observer` to one or more `IntersectionObservable` elements, and `isVisible` becomes `true` (for all of them, and stays true) as soon as any one is seen. Still used in older pages.
|
|
22
|
+
|
|
23
|
+
For new work use `IntersectionObserverProvider` + `IntersectionObserverTarget`: same lazy-render use case, a per-target `isVisible`, no observer object to pass around. The one feature without a direct v2 equivalent is `skip` (render as visible immediately); with v2, render the content outside the provider instead.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Shown so existing code can be read; don't add new instances.
|
|
28
|
+
|
|
29
|
+
```vue
|
|
30
|
+
<script setup lang="ts">
|
|
31
|
+
import IntersectionObserver from "@wikicasa-dev/components/generic/IntersectionObserver/IntersectionObserver";
|
|
32
|
+
import IntersectionObservable from "@wikicasa-dev/components/generic/IntersectionObserver/IntersectionObservable";
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<IntersectionObserver>
|
|
37
|
+
<template #observer="{ observer, isVisible }">
|
|
38
|
+
<IntersectionObservable :observer="observer">
|
|
39
|
+
<section v-if="isVisible">Notizie dal mercato immobiliare</section>
|
|
40
|
+
<div v-else style="height: 400px" />
|
|
41
|
+
</IntersectionObservable>
|
|
42
|
+
</template>
|
|
43
|
+
</IntersectionObserver>
|
|
44
|
+
</template>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Do / Don't
|
|
48
|
+
|
|
49
|
+
- Don't use in new designs; use `IntersectionObserverProvider`.
|
|
50
|
+
- `observe-once` (default `true`) only stops repeated `intersection` events; `isVisible` never goes back to `false` either way.
|
|
51
|
+
- Classes for the temporary wrapper `<div>` go in the `root-classes` attribute (kebab-case); the wrapper is removed once visible.
|
|
52
|
+
- Importing it as `IntersectionObserver` shadows the browser's `IntersectionObserver` class in that file.
|
|
53
|
+
|
|
54
|
+
## API
|
|
55
|
+
|
|
56
|
+
_Generated from the component's types. Do not edit by hand._
|
|
57
|
+
|
|
58
|
+
### Props
|
|
59
|
+
|
|
60
|
+
| Name | Type | Default | Required | Description |
|
|
61
|
+
| --- | --- | --- | --- | --- |
|
|
62
|
+
| `observeOnce` | `boolean` | `true` | | |
|
|
63
|
+
| `skip` | `boolean` | `false` | | |
|
|
64
|
+
| `threshold` | `number` | `0` | | |
|
|
65
|
+
|
|
66
|
+
### Events
|
|
67
|
+
|
|
68
|
+
| Name | Payload |
|
|
69
|
+
| --- | --- |
|
|
70
|
+
| `intersection` | |
|
|
71
|
+
|
|
72
|
+
### v-model
|
|
73
|
+
|
|
74
|
+
None.
|
|
75
|
+
|
|
76
|
+
### Slots
|
|
77
|
+
|
|
78
|
+
| Name | Slot props |
|
|
79
|
+
| --- | --- |
|
|
80
|
+
| `observer` | `{ observer: { readonly root: Element \| Document \| null; readonly rootMargin: string; readonly scrollMargin: string; readonly thresholds: readonly number[]; disconnect: () => void; observe: (target: Element) => void; takeRecords: () => IntersectionObserverEntry[]; unobserve: (target: Element) => void; } \| null; isVisible: false; }` |
|
|
81
|
+
|
|
82
|
+
### Exposed (template ref)
|
|
83
|
+
|
|
84
|
+
None.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: IntersectionObserverProvider
|
|
3
|
+
status: preferred
|
|
4
|
+
category: Utilities
|
|
5
|
+
summary: Shares one IntersectionObserver with its IntersectionObserverTarget children to lazy-render content or detect scroll-into-view.
|
|
6
|
+
import: @wikicasa-dev/components/generic/IntersectionObserver/v2/IntersectionObserverProvider
|
|
7
|
+
version: 2.10.0
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# IntersectionObserverProvider
|
|
11
|
+
|
|
12
|
+
Shares one IntersectionObserver with its IntersectionObserverTarget children to lazy-render content or detect scroll-into-view.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import IntersectionObserverProvider from "@wikicasa-dev/components/generic/IntersectionObserver/v2/IntersectionObserverProvider";
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Renderless wrapper that creates one browser `IntersectionObserver` (viewport as root) and shares it with every `IntersectionObserverTarget` inside it. Each target gets its own `isVisible` flag. Use the pair to:
|
|
19
|
+
|
|
20
|
+
- render a heavy section (chart, map, carousel, list of cards) only when it scrolls into view;
|
|
21
|
+
- run something when a sentinel becomes visible (infinite scroll: "load more" when the last row appears), via the provider's `intersection` event.
|
|
22
|
+
|
|
23
|
+
This replaces the older `IntersectionObserver` + `IntersectionObservable` pair.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
Lazy section plus an infinite-scroll sentinel:
|
|
28
|
+
|
|
29
|
+
```vue
|
|
30
|
+
<script setup lang="ts">
|
|
31
|
+
import { ref } from "vue";
|
|
32
|
+
import IntersectionObserverProvider from "@wikicasa-dev/components/generic/IntersectionObserver/v2/IntersectionObserverProvider";
|
|
33
|
+
import IntersectionObserverTarget from "@wikicasa-dev/components/generic/IntersectionObserver/v2/IntersectionObserverTarget";
|
|
34
|
+
|
|
35
|
+
const listings = ref(["Bilocale a Bari", "Villa a Lecce", "Attico a Taranto"]);
|
|
36
|
+
const loadMore = () => listings.value.push(`Annuncio ${listings.value.length + 1}`);
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<template>
|
|
40
|
+
<IntersectionObserverProvider :threshold="0.1">
|
|
41
|
+
<IntersectionObserverTarget v-slot="{ isVisible }">
|
|
42
|
+
<section v-if="isVisible">Andamento prezzi a Bari (grafico)</section>
|
|
43
|
+
<div v-else style="height: 270px" />
|
|
44
|
+
</IntersectionObserverTarget>
|
|
45
|
+
</IntersectionObserverProvider>
|
|
46
|
+
|
|
47
|
+
<ul>
|
|
48
|
+
<li v-for="l in listings" :key="l">{{ l }}</li>
|
|
49
|
+
</ul>
|
|
50
|
+
<IntersectionObserverProvider @intersection="loadMore">
|
|
51
|
+
<IntersectionObserverTarget :observe-once="false">
|
|
52
|
+
<p>Caricamento altri annunci…</p>
|
|
53
|
+
</IntersectionObserverTarget>
|
|
54
|
+
</IntersectionObserverProvider>
|
|
55
|
+
</template>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Do / Don't
|
|
59
|
+
|
|
60
|
+
- Do put every `IntersectionObserverTarget` inside a provider; outside one, `isVisible` stays `false` forever.
|
|
61
|
+
- Do reserve the final height in the not-visible branch so the page doesn't jump when content appears.
|
|
62
|
+
- `intersection` fires every time any target enters the viewport (repeatedly for targets with `:observe-once="false"`).
|
|
63
|
+
- Use `emit-once` only with a single target: it disconnects the whole observer after the first intersection, so other targets never become visible.
|
|
64
|
+
- Don't use `skip` to "show everything immediately": it ignores all intersections, so targets never become visible. To bypass lazy rendering, render your content without the provider (e.g. `v-if="!lazy"` / `v-else`).
|
|
65
|
+
- `threshold` (0–1, share of the target that must be visible) is read once, when the provider is created.
|
|
66
|
+
- Observation runs only in the browser: on the server every target renders its not-visible branch.
|
|
67
|
+
|
|
68
|
+
## API
|
|
69
|
+
|
|
70
|
+
_Generated from the component's types. Do not edit by hand._
|
|
71
|
+
|
|
72
|
+
### Props
|
|
73
|
+
|
|
74
|
+
| Name | Type | Default | Required | Description |
|
|
75
|
+
| --- | --- | --- | --- | --- |
|
|
76
|
+
| `emitOnce` | `boolean` | `false` | | |
|
|
77
|
+
| `skip` | `boolean` | `false` | | |
|
|
78
|
+
| `threshold` | `number` | `0` | | |
|
|
79
|
+
|
|
80
|
+
### Events
|
|
81
|
+
|
|
82
|
+
| Name | Payload |
|
|
83
|
+
| --- | --- |
|
|
84
|
+
| `intersection` | |
|
|
85
|
+
|
|
86
|
+
### v-model
|
|
87
|
+
|
|
88
|
+
None.
|
|
89
|
+
|
|
90
|
+
### Slots
|
|
91
|
+
|
|
92
|
+
| Name | Slot props |
|
|
93
|
+
| --- | --- |
|
|
94
|
+
| `default` | `{ observer: IntersectionObserver \| undefined; }` |
|
|
95
|
+
|
|
96
|
+
### Exposed (template ref)
|
|
97
|
+
|
|
98
|
+
None.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: IntersectionObserverTarget
|
|
3
|
+
status: preferred
|
|
4
|
+
category: Utilities
|
|
5
|
+
summary: Element watched by the surrounding IntersectionObserverProvider; exposes isVisible to its slot.
|
|
6
|
+
import: @wikicasa-dev/components/generic/IntersectionObserver/v2/IntersectionObserverTarget
|
|
7
|
+
version: 2.10.0
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# IntersectionObserverTarget
|
|
11
|
+
|
|
12
|
+
Element watched by the surrounding IntersectionObserverProvider; exposes isVisible to its slot.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import IntersectionObserverTarget from "@wikicasa-dev/components/generic/IntersectionObserver/v2/IntersectionObserverTarget";
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
One observed element inside an `IntersectionObserverProvider`. It wraps its slot in a `<div>` that the provider's observer watches, and passes `{ isVisible }` to the slot. See `IntersectionObserverProvider` for the full pattern (lazy section and infinite scroll).
|
|
19
|
+
|
|
20
|
+
- `observe-once` (default `true`): once the element has been seen, observation stops, `isVisible` stays `true` and the wrapper `<div>` is removed (the slot renders directly in its place).
|
|
21
|
+
- `:observe-once="false"`: the wrapper stays and `isVisible` follows the element in and out of the viewport. Use for sentinels and "is this on screen right now" logic.
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```vue
|
|
26
|
+
<script setup lang="ts">
|
|
27
|
+
import IntersectionObserverProvider from "@wikicasa-dev/components/generic/IntersectionObserver/v2/IntersectionObserverProvider";
|
|
28
|
+
import IntersectionObserverTarget from "@wikicasa-dev/components/generic/IntersectionObserver/v2/IntersectionObserverTarget";
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<template>
|
|
32
|
+
<IntersectionObserverProvider>
|
|
33
|
+
<IntersectionObserverTarget v-slot="{ isVisible }">
|
|
34
|
+
<img v-if="isVisible" src="/img/mappa-quartiere.png" alt="Mappa del quartiere Prati, Roma" width="600" height="300" />
|
|
35
|
+
<div v-else style="width: 600px; height: 300px; background: #e9effe" />
|
|
36
|
+
</IntersectionObserverTarget>
|
|
37
|
+
</IntersectionObserverProvider>
|
|
38
|
+
</template>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Do / Don't
|
|
42
|
+
|
|
43
|
+
- Do use it only inside an `IntersectionObserverProvider`.
|
|
44
|
+
- Do give the not-visible branch a real size: an empty, zero-height wrapper makes layout jump when content appears.
|
|
45
|
+
- Don't rely on `class`/attributes set on the target with the default `observe-once`: they sit on the wrapper `<div>`, which disappears once the element is visible. Style your own slot content instead.
|
|
46
|
+
|
|
47
|
+
## API
|
|
48
|
+
|
|
49
|
+
_Generated from the component's types. Do not edit by hand._
|
|
50
|
+
|
|
51
|
+
### Props
|
|
52
|
+
|
|
53
|
+
| Name | Type | Default | Required | Description |
|
|
54
|
+
| --- | --- | --- | --- | --- |
|
|
55
|
+
| `observeOnce` | `boolean` | `true` | | |
|
|
56
|
+
|
|
57
|
+
### Events
|
|
58
|
+
|
|
59
|
+
None.
|
|
60
|
+
|
|
61
|
+
### v-model
|
|
62
|
+
|
|
63
|
+
None.
|
|
64
|
+
|
|
65
|
+
### Slots
|
|
66
|
+
|
|
67
|
+
| Name | Slot props |
|
|
68
|
+
| --- | --- |
|
|
69
|
+
| `default` | `{ isVisible: boolean; }` |
|
|
70
|
+
|
|
71
|
+
### Exposed (template ref)
|
|
72
|
+
|
|
73
|
+
None.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: LineChart
|
|
3
|
+
status: preferred
|
|
4
|
+
category: Charts
|
|
5
|
+
summary: Chart.js line chart (category, linear or time x-axis) for trends such as average €/m² over time.
|
|
6
|
+
import: @wikicasa-dev/components/chart/LineChart
|
|
7
|
+
version: 2.10.0
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# LineChart
|
|
11
|
+
|
|
12
|
+
Chart.js line chart (category, linear or time x-axis) for trends such as average €/m² over time.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import LineChart from "@wikicasa-dev/components/chart/LineChart";
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
A Chart.js line chart (via vue-chartjs) for values over time or categories: price trends, number of listings per month. Pass Chart.js `data` and `options` objects; the chart renders into a `<canvas>` on the client (the Chart.js code is loaded lazily, so there is nothing to see in server HTML).
|
|
19
|
+
|
|
20
|
+
Only what the options ask for is loaded:
|
|
21
|
+
|
|
22
|
+
- Tooltip, legend and title are registered **only if** `options.plugins.tooltip`, `.legend` or `.title` is set (an empty object `{}` is enough).
|
|
23
|
+
- A time x-axis (`options.scales.x.type: "time"`, labels as dates, timestamps or ISO strings) loads the date-fns adapter. Otherwise the x-axis is a category axis and the y-axis linear. No other scale types (logarithmic, radial, time on y) are available.
|
|
24
|
+
- `fill: true` area charts work.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```vue
|
|
29
|
+
<script setup lang="ts">
|
|
30
|
+
import LineChart from "@wikicasa-dev/components/chart/LineChart";
|
|
31
|
+
import type { ChartData, ChartOptions } from "@wikicasa-dev/components";
|
|
32
|
+
|
|
33
|
+
const data: ChartData<"line"> = {
|
|
34
|
+
labels: ["Gen", "Feb", "Mar", "Apr", "Mag", "Giu"],
|
|
35
|
+
datasets: [
|
|
36
|
+
{
|
|
37
|
+
label: "Prezzo medio vendita Milano (€/m²)",
|
|
38
|
+
data: [5120, 5180, 5210, 5260, 5245, 5310],
|
|
39
|
+
borderColor: "#2B5DFF",
|
|
40
|
+
backgroundColor: "rgba(43, 93, 255, 0.15)",
|
|
41
|
+
pointBackgroundColor: "#2B5DFF",
|
|
42
|
+
fill: true,
|
|
43
|
+
tension: 0.4,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const options: ChartOptions<"line"> = {
|
|
49
|
+
responsive: true,
|
|
50
|
+
maintainAspectRatio: false,
|
|
51
|
+
plugins: { legend: { display: false }, tooltip: { mode: "index", intersect: false } },
|
|
52
|
+
};
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<template>
|
|
56
|
+
<div style="position: relative; height: 220px">
|
|
57
|
+
<LineChart :data="data" :options="options" />
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Do / Don't
|
|
63
|
+
|
|
64
|
+
- Do wrap it in a container with `position: relative` and an explicit height, and set `maintainAspectRatio: false`; otherwise Chart.js sizes the canvas from its width (2:1).
|
|
65
|
+
- Do set `plugins.legend: { display: false }` explicitly when you don't want a legend: plugins are registered globally, so once any chart on the page has loaded the legend, every chart shows one by default.
|
|
66
|
+
- Do decide `plugins` and `scales.x.type` up front: which modules to load is decided once, when the chart is created.
|
|
67
|
+
- Don't use it for bar or pie charts; only line (and `DoughnutChart`) exist.
|
|
68
|
+
- Use static mock data in mockups; `ChartData` / `ChartOptions` types are re-exported from `@wikicasa-dev/components`.
|
|
69
|
+
- The exposed `chartInstance` (template ref) gives the Chart.js instance once it has rendered.
|
|
70
|
+
|
|
71
|
+
## API
|
|
72
|
+
|
|
73
|
+
_Generated from the component's types. Do not edit by hand._
|
|
74
|
+
|
|
75
|
+
### Props
|
|
76
|
+
|
|
77
|
+
| Name | Type | Default | Required | Description |
|
|
78
|
+
| --- | --- | --- | --- | --- |
|
|
79
|
+
| `options` | `_DeepPartialObject<CoreChartOptions<"line"> & ElementChartOptions<"line"> & PluginChartOptions<"line"> & DatasetChartOptions<"line"> & ScaleChartOptions<"line"> & LineControllerChartOptions>` | | yes | |
|
|
80
|
+
| `data` | `ChartData<"line", (number \| Point \| null)[], unknown>` | | yes | |
|
|
81
|
+
|
|
82
|
+
### Events
|
|
83
|
+
|
|
84
|
+
None.
|
|
85
|
+
|
|
86
|
+
### v-model
|
|
87
|
+
|
|
88
|
+
None.
|
|
89
|
+
|
|
90
|
+
### Slots
|
|
91
|
+
|
|
92
|
+
None.
|
|
93
|
+
|
|
94
|
+
### Exposed (template ref)
|
|
95
|
+
|
|
96
|
+
| Name | Type |
|
|
97
|
+
| --- | --- |
|
|
98
|
+
| `chartInstance` | `Optional<Chart<"line", (number \| Point \| null)[], unknown>>` |
|