@wikicasa-dev/components 2.9.1 → 2.10.0-alpha.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-keyboard.css} +0 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: BaseSnackbar
|
|
3
|
+
status: preferred
|
|
4
|
+
category: Feedback
|
|
5
|
+
summary: Temporary toast notification that slides in at the page edge, auto-closes with a progress bar, swipe to dismiss.
|
|
6
|
+
import: @wikicasa-dev/components/UIKit/BaseSnackbar
|
|
7
|
+
version: 2.10.0-alpha.0
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# BaseSnackbar
|
|
11
|
+
|
|
12
|
+
Temporary toast notification that slides in at the page edge, auto-closes with a progress bar, swipe to dismiss.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import BaseSnackbar from "@wikicasa-dev/components/UIKit/BaseSnackbar";
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Use it to confirm an action that happened ("Annuncio salvato nei preferiti", "Annuncio ripristinato") or to report a background error, without taking space in the layout. It closes itself after `duration` ms (default 3000) and shows a progress bar meanwhile. For a message that must stay on the page, use `BaseAlert`.
|
|
19
|
+
|
|
20
|
+
Control it with `v-model:open`. Set `v-model:refresh` to `true` to close and reopen it (restarting the timer) when the same snackbar fires again while already open. Colors: `alertClass` = `primary` (default, lavender/blue), `danger` (pale red/red), `darkblue` (dark blue/white).
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```vue
|
|
25
|
+
<script setup lang="ts">
|
|
26
|
+
import BaseSnackbar from "@wikicasa-dev/components/UIKit/BaseSnackbar";
|
|
27
|
+
import BaseButton from "@wikicasa-dev/components/UIKit/BaseButton";
|
|
28
|
+
import { ref } from "vue";
|
|
29
|
+
|
|
30
|
+
const open = ref(false);
|
|
31
|
+
const refresh = ref(false);
|
|
32
|
+
|
|
33
|
+
const save = () => {
|
|
34
|
+
if (open.value) refresh.value = true;
|
|
35
|
+
else open.value = true;
|
|
36
|
+
};
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<template>
|
|
40
|
+
<BaseButton type="button" @click="save">Salva nei preferiti</BaseButton>
|
|
41
|
+
|
|
42
|
+
<BaseSnackbar
|
|
43
|
+
v-model:open="open"
|
|
44
|
+
v-model:refresh="refresh"
|
|
45
|
+
:duration="3500"
|
|
46
|
+
class="favorites-toast"
|
|
47
|
+
>
|
|
48
|
+
<template #title>
|
|
49
|
+
<strong>Trilocale in Via Roma, Milano</strong>
|
|
50
|
+
</template>
|
|
51
|
+
Annuncio salvato nei preferiti.
|
|
52
|
+
</BaseSnackbar>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<style>
|
|
56
|
+
.favorites-toast { width: 100%; justify-content: space-between; }
|
|
57
|
+
</style>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Do / Don't
|
|
61
|
+
|
|
62
|
+
- One snackbar per message type; drive it with state, don't mount/unmount it with `v-if` per message.
|
|
63
|
+
- The close (X) button is on by default; pass `:with-close-icon="false"` for short confirmations. Replace the icon via the `toast-close` slot.
|
|
64
|
+
- An extra action button (e.g. "Annulla") goes in the `toast-action` slot.
|
|
65
|
+
- By default it is teleported to `body` and sits fixed at the bottom-left. Pass `:to="false"` to render the viewport in place (e.g. inside a modal), or a selector to teleport elsewhere.
|
|
66
|
+
- `swipeDirection` (default `left`) also decides the side it slides in from.
|
|
67
|
+
- Use `type="background"` for messages not caused by the user's own action, so screen readers announce them less intrusively.
|
|
68
|
+
- `class` goes on the toast itself; other fallthrough attributes (including `style` and `id`) are dropped. Use `viewportClasses` for the container (e.g. a `z-index` above modals).
|
|
69
|
+
|
|
70
|
+
## Styling hooks
|
|
71
|
+
|
|
72
|
+
On the viewport (`.uikit-alert-viewport`, add your own class with `viewportClasses`): `--uikit-alert-viewport-padding`, `--uikit-alert-viewport-position`, `--uikit-alert-viewport-top`/`-right`/`-bottom`/`-left`, `--uikit-alert-viewport-display`, `--uikit-alert-viewport-flex-direction`, `--uikit-alert-viewport-align-items`, `--uikit-alert-viewport-justify-content`.
|
|
73
|
+
|
|
74
|
+
On the toast (`.uikit-alert` / `.uikit-toast-root`): `--uikit-alert-bg-color`, `--uikit-alert-text-color`, `--uikit-alert-progress-indicator-bg-color`, `--uikit-toast-root-display` (e.g. `grid` for custom layouts), `--uikit-toast-root-gap`.
|
|
75
|
+
|
|
76
|
+
## API
|
|
77
|
+
|
|
78
|
+
_Generated from the component's types. Do not edit by hand._
|
|
79
|
+
|
|
80
|
+
### Props
|
|
81
|
+
|
|
82
|
+
| Name | Type | Default | Required | Description |
|
|
83
|
+
| --- | --- | --- | --- | --- |
|
|
84
|
+
| `alertClass` | `"primary" \| "danger" \| "darkblue"` | `"primary"` | | |
|
|
85
|
+
| `duration` | `number` | `3000` | | Time in milliseconds that each toast should remain visible for. |
|
|
86
|
+
| `swipeDirection` | `SwipeDirection` | `"left"` | | Direction of pointer swipe that should close the toast. |
|
|
87
|
+
| `to` | `string \| false \| HTMLElement` | `"body"` | | Vue native teleport component prop :to |
|
|
88
|
+
| `dataCy` | `string` | `""` | | |
|
|
89
|
+
| `withCloseIcon` | `boolean` | `true` | | |
|
|
90
|
+
| `closeClasses` | `ClassTypeProp` | | | |
|
|
91
|
+
| `viewportClasses` | `ClassTypeProp` | `""` | | |
|
|
92
|
+
| `type` | `"foreground" \| "background"` | `"foreground"` | | Control the sensitivity of the toast for accessibility purposes. For toasts that are the result of a user action, choose foreground. Toasts generated from background tasks should use background. |
|
|
93
|
+
| `open` | `Optional<boolean>` | `false` | | |
|
|
94
|
+
| `refresh` | `Optional<boolean>` | `false` | | |
|
|
95
|
+
|
|
96
|
+
### Events
|
|
97
|
+
|
|
98
|
+
| Name | Payload |
|
|
99
|
+
| --- | --- |
|
|
100
|
+
| `update:refresh` | `[value: Optional<boolean>]` |
|
|
101
|
+
| `update:open` | `[value: Optional<boolean>]` |
|
|
102
|
+
|
|
103
|
+
### v-model
|
|
104
|
+
|
|
105
|
+
- `v-model:open` (`Optional<boolean>`)
|
|
106
|
+
- `v-model:refresh` (`Optional<boolean>`)
|
|
107
|
+
|
|
108
|
+
### Slots
|
|
109
|
+
|
|
110
|
+
| Name | Slot props |
|
|
111
|
+
| --- | --- |
|
|
112
|
+
| `trigger` | `{ open: () => boolean; }` |
|
|
113
|
+
| `title` | |
|
|
114
|
+
| `default` | |
|
|
115
|
+
| `toast-close` | |
|
|
116
|
+
| `toast-action` | |
|
|
117
|
+
|
|
118
|
+
### Exposed (template ref)
|
|
119
|
+
|
|
120
|
+
None.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: BaseTab
|
|
3
|
+
status: legacy
|
|
4
|
+
category: Navigation
|
|
5
|
+
summary: One tab (header plus panel content) inside the legacy BaseTabView.
|
|
6
|
+
useInstead: BaseTabsTrigger
|
|
7
|
+
import: @wikicasa-dev/components/UIKit/Tab/BaseTab
|
|
8
|
+
version: 2.10.0-alpha.0
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# BaseTab
|
|
12
|
+
|
|
13
|
+
> **Legacy.** Don't use in new designs. Use `BaseTabsTrigger` instead.
|
|
14
|
+
|
|
15
|
+
One tab (header plus panel content) inside the legacy BaseTabView.
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import BaseTab from "@wikicasa-dev/components/UIKit/Tab/BaseTab";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Child of the legacy `BaseTabView`; it renders nothing useful on its own. In the new `BaseTabs` set, a `BaseTab` splits into a `BaseTabsTrigger` (the header) and a `BaseTabsContent` (the panel); see the `BaseTabs` doc.
|
|
22
|
+
|
|
23
|
+
For reading existing code: the tab label is `headerTitle` or the `header` slot; the default slot is the panel content; `tabPanelClasses` styles the panel; `class` styles the tab button. `activeTabPanelIdx` makes the tab show another tab's panel (by index) instead of its own.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```vue
|
|
28
|
+
<script setup lang="ts">
|
|
29
|
+
import BaseTabView from "@wikicasa-dev/components/UIKit/Tab/BaseTabView";
|
|
30
|
+
import BaseTab from "@wikicasa-dev/components/UIKit/Tab/BaseTab";
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<BaseTabView tab-view-description="Foto e mappa">
|
|
35
|
+
<BaseTab class="gallery-tab" tab-panel-classes="gallery-panel">
|
|
36
|
+
<template #header>Foto</template>
|
|
37
|
+
Galleria del bilocale in Via Toledo, Napoli
|
|
38
|
+
</BaseTab>
|
|
39
|
+
<BaseTab header-title="Mappa" class="gallery-tab" tab-panel-classes="gallery-panel">
|
|
40
|
+
Mappa della zona Chiaia
|
|
41
|
+
</BaseTab>
|
|
42
|
+
</BaseTabView>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<style>
|
|
46
|
+
.gallery-tab { padding: 0 10px; }
|
|
47
|
+
.gallery-panel { margin-top: 10px; }
|
|
48
|
+
</style>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Do / Don't
|
|
52
|
+
|
|
53
|
+
- Use it only as a direct child of `BaseTabView`; new code should use `BaseTabsTrigger` + `BaseTabsContent`.
|
|
54
|
+
- Don't toggle its `class` based on state: the content re-renders. Target `[aria-selected="true"]` instead.
|
|
55
|
+
|
|
56
|
+
## API
|
|
57
|
+
|
|
58
|
+
_Generated from the component's types. Do not edit by hand._
|
|
59
|
+
|
|
60
|
+
### Props
|
|
61
|
+
|
|
62
|
+
| Name | Type | Default | Required | Description |
|
|
63
|
+
| --- | --- | --- | --- | --- |
|
|
64
|
+
| `activeTabPanelIdx` | `number` | | | |
|
|
65
|
+
| `headerTitle` | `string` | | | |
|
|
66
|
+
| `tabPanelClasses` | `ClassTypeProp` | | | |
|
|
67
|
+
|
|
68
|
+
### Events
|
|
69
|
+
|
|
70
|
+
None.
|
|
71
|
+
|
|
72
|
+
### v-model
|
|
73
|
+
|
|
74
|
+
None.
|
|
75
|
+
|
|
76
|
+
### Slots
|
|
77
|
+
|
|
78
|
+
| Name | Slot props |
|
|
79
|
+
| --- | --- |
|
|
80
|
+
| `header` | |
|
|
81
|
+
|
|
82
|
+
### Exposed (template ref)
|
|
83
|
+
|
|
84
|
+
None.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: BaseTabView
|
|
3
|
+
status: legacy
|
|
4
|
+
category: Navigation
|
|
5
|
+
summary: First-generation tabs container driven by BaseTab children and an index-based v-model.
|
|
6
|
+
useInstead: BaseTabs
|
|
7
|
+
import: @wikicasa-dev/components/UIKit/Tab/BaseTabView
|
|
8
|
+
version: 2.10.0-alpha.0
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# BaseTabView
|
|
12
|
+
|
|
13
|
+
> **Legacy.** Don't use in new designs. Use `BaseTabs` instead.
|
|
14
|
+
|
|
15
|
+
First-generation tabs container driven by BaseTab children and an index-based v-model.
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import BaseTabView from "@wikicasa-dev/components/UIKit/Tab/BaseTabView";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Older tabs implementation, still used in existing pages. For new work use `BaseTabs` with `BaseTabsList`, `BaseTabsTrigger`, `BaseTabsContent` and `BaseTabsIndicator`: it covers the same cases (bottom tab bar, several tabs sharing one panel) with value-based selection, keyboard navigation and an animated indicator.
|
|
22
|
+
|
|
23
|
+
How it works, for reading existing code: `BaseTabView` builds the tab bar from its direct `BaseTab` children; the active tab is a 0-based index in `v-model:active-idx`. `tabViewDescription` is required (screen-reader label of the tab list) and `tabsPosition` puts the bar on `top` (default) or `bottom`.
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```vue
|
|
28
|
+
<script setup lang="ts">
|
|
29
|
+
import BaseTabView from "@wikicasa-dev/components/UIKit/Tab/BaseTabView";
|
|
30
|
+
import BaseTab from "@wikicasa-dev/components/UIKit/Tab/BaseTab";
|
|
31
|
+
import { ref } from "vue";
|
|
32
|
+
|
|
33
|
+
const activeIdx = ref(0);
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<BaseTabView
|
|
38
|
+
v-model:active-idx="activeIdx"
|
|
39
|
+
tab-view-description="Dati di mercato"
|
|
40
|
+
tab-list-classes="market-tab-list"
|
|
41
|
+
>
|
|
42
|
+
<BaseTab header-title="Prezzi">Prezzo medio a Firenze: 4.150 €/m²</BaseTab>
|
|
43
|
+
<BaseTab header-title="Affitti">Affitto medio a Firenze: 18,90 €/m²</BaseTab>
|
|
44
|
+
</BaseTabView>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<style>
|
|
48
|
+
.market-tab-list { display: flex; gap: 15px; margin-bottom: 10px; }
|
|
49
|
+
</style>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Do / Don't
|
|
53
|
+
|
|
54
|
+
- Don't start new tab UIs with it; migrate to `BaseTabs` when touching one.
|
|
55
|
+
- Only direct `BaseTab` children (or a direct `v-for` of them) become tabs; wrappers in between are ignored.
|
|
56
|
+
- Changing a `BaseTab`'s classes re-renders its content. Style the active tab with `[aria-selected="true"]` instead of toggling classes.
|
|
57
|
+
- `tabClicked` fires with `{ tabIdx, tabElement }` on every tab click.
|
|
58
|
+
|
|
59
|
+
## API
|
|
60
|
+
|
|
61
|
+
_Generated from the component's types. Do not edit by hand._
|
|
62
|
+
|
|
63
|
+
### Props
|
|
64
|
+
|
|
65
|
+
| Name | Type | Default | Required | Description |
|
|
66
|
+
| --- | --- | --- | --- | --- |
|
|
67
|
+
| `tabsPosition` | `"top" \| "bottom"` | `"top"` | | |
|
|
68
|
+
| `tabViewDescription` | `string` | | yes | |
|
|
69
|
+
| `tabListClasses` | `ClassTypeProp` | | | |
|
|
70
|
+
| `dataCy` | `string` | | | |
|
|
71
|
+
| `activeIdx` | `number` | `0` | | Model value which keeps track of the active tab. By default, we will activate the first tab |
|
|
72
|
+
|
|
73
|
+
### Events
|
|
74
|
+
|
|
75
|
+
| Name | Payload |
|
|
76
|
+
| --- | --- |
|
|
77
|
+
| `update:activeIdx` | `[value: number \| undefined]` |
|
|
78
|
+
| `tabClicked` | `[{ tabIdx: number; tabElement: TabType; }]` |
|
|
79
|
+
|
|
80
|
+
### v-model
|
|
81
|
+
|
|
82
|
+
- `v-model:activeIdx` (`number`)
|
|
83
|
+
|
|
84
|
+
### Slots
|
|
85
|
+
|
|
86
|
+
None.
|
|
87
|
+
|
|
88
|
+
### Exposed (template ref)
|
|
89
|
+
|
|
90
|
+
None.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: BaseTabs
|
|
3
|
+
status: preferred
|
|
4
|
+
category: Navigation
|
|
5
|
+
summary: Accessible tabs (root of the compound set): switches between panels with an animated underline indicator.
|
|
6
|
+
import: @wikicasa-dev/components/UIKit/Tab/v2/BaseTabs
|
|
7
|
+
version: 2.10.0-alpha.0
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# BaseTabs
|
|
11
|
+
|
|
12
|
+
Accessible tabs (root of the compound set): switches between panels with an animated underline indicator.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import BaseTabs from "@wikicasa-dev/components/UIKit/Tab/v2/BaseTabs";
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Use it to switch between sibling views of the same context without leaving the page: "Vendita / Affitto / Aste" in a search box, "Preferiti / Ricerche salvate / Visti di recente" in a user area. Don't use it for page navigation (use links) or for a filter that changes a single list (use `BaseButton` selection variants).
|
|
19
|
+
|
|
20
|
+
It is a compound component; always use the five parts together:
|
|
21
|
+
|
|
22
|
+
- `BaseTabs`: the root. Holds the active value (`v-model`, string or number).
|
|
23
|
+
- `BaseTabsList`: the row of tabs.
|
|
24
|
+
- `BaseTabsIndicator`: optional animated underline, placed inside `BaseTabsList`.
|
|
25
|
+
- `BaseTabsTrigger`: one tab button, with a `value`.
|
|
26
|
+
- `BaseTabsContent`: the panel shown when the trigger with the same `value` is active.
|
|
27
|
+
|
|
28
|
+
Keyboard support (arrow keys, Home/End) and ARIA roles come built in.
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
```vue
|
|
33
|
+
<script setup lang="ts">
|
|
34
|
+
import BaseTabs from "@wikicasa-dev/components/UIKit/Tab/v2/BaseTabs";
|
|
35
|
+
import BaseTabsList from "@wikicasa-dev/components/UIKit/Tab/v2/BaseTabsList";
|
|
36
|
+
import BaseTabsIndicator from "@wikicasa-dev/components/UIKit/Tab/v2/BaseTabsIndicator";
|
|
37
|
+
import BaseTabsTrigger from "@wikicasa-dev/components/UIKit/Tab/v2/BaseTabsTrigger";
|
|
38
|
+
import BaseTabsContent from "@wikicasa-dev/components/UIKit/Tab/v2/BaseTabsContent";
|
|
39
|
+
import { ref } from "vue";
|
|
40
|
+
|
|
41
|
+
const tabs = [
|
|
42
|
+
{ value: "vendita", label: "Vendita" },
|
|
43
|
+
{ value: "affitto", label: "Affitto" },
|
|
44
|
+
{ value: "aste", label: "Aste" },
|
|
45
|
+
];
|
|
46
|
+
const active = ref("vendita");
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<template>
|
|
50
|
+
<BaseTabs v-model="active">
|
|
51
|
+
<BaseTabsList style="display: flex; justify-content: center; gap: 20px; margin-bottom: 15px">
|
|
52
|
+
<BaseTabsIndicator />
|
|
53
|
+
<BaseTabsTrigger v-for="tab in tabs" :key="tab.value" :value="tab.value">
|
|
54
|
+
{{ tab.label }}
|
|
55
|
+
</BaseTabsTrigger>
|
|
56
|
+
</BaseTabsList>
|
|
57
|
+
|
|
58
|
+
<BaseTabsContent value="vendita">Case in vendita a Bologna: 2.418 annunci</BaseTabsContent>
|
|
59
|
+
<BaseTabsContent value="affitto">Case in affitto a Bologna: 731 annunci</BaseTabsContent>
|
|
60
|
+
<BaseTabsContent value="aste">Immobili all'asta a Bologna: 96 annunci</BaseTabsContent>
|
|
61
|
+
</BaseTabs>
|
|
62
|
+
</template>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Do / Don't
|
|
66
|
+
|
|
67
|
+
- Give every trigger a unique `value` and a matching `BaseTabsContent`. Several triggers can share one panel: bind the panel's `value` to a computed that returns the active value when it is one of them.
|
|
68
|
+
- Put `BaseTabsIndicator` inside `BaseTabsList`. Without it, the active trigger still gets a static 2px underline (no animation).
|
|
69
|
+
- Inactive panels stay mounted (hidden), so their state survives tab switches. Pass `unmount-on-hide` to unmount them instead.
|
|
70
|
+
- Use `default-value` instead of `v-model` when you don't need to read the active tab. The default slot also exposes `modelValue`.
|
|
71
|
+
- To put the tabs under the panels, place `BaseTabsList` after the `BaseTabsContent`s.
|
|
72
|
+
- Style the selected tab with a `[data-state="active"]` selector on the trigger (inactive ones have `data-state="inactive"`).
|
|
73
|
+
|
|
74
|
+
## Styling hooks
|
|
75
|
+
|
|
76
|
+
Set on `BaseTabs` (with a selector more specific than `.uikit-base-tabs`, or inline `style`):
|
|
77
|
+
`--indicator-bg-color` (indicator color, default primary blue; the fallback underline without `BaseTabsIndicator` is always primary blue), `--indicator-border-radius-top`, `--indicator-border-radius-bottom`, `--indicator-bottom` (lift the underline from the bottom edge).
|
|
78
|
+
|
|
79
|
+
## API
|
|
80
|
+
|
|
81
|
+
_Generated from the component's types. Do not edit by hand._
|
|
82
|
+
|
|
83
|
+
### Props
|
|
84
|
+
|
|
85
|
+
| Name | Type | Default | Required | Description |
|
|
86
|
+
| --- | --- | --- | --- | --- |
|
|
87
|
+
| `dataCy` | `string` | | | |
|
|
88
|
+
| `defaultValue` | `T` | | | The value of the tab that should be active when initially rendered. Use when you do not need to control the state of the tabs |
|
|
89
|
+
| `orientation` | `DataOrientation` | | | The orientation the tabs are laid out. Mainly so arrow navigation is done accordingly (left & right vs. up & down) |
|
|
90
|
+
| `dir` | `Direction` | | | The reading direction of the combobox when applicable. <br> If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. |
|
|
91
|
+
| `activationMode` | `"automatic" \| "manual"` | | | Whether a tab is activated automatically (on focus) or manually (on click). |
|
|
92
|
+
| `modelValue` | `T` | | | The controlled value of the tab to activate. Can be bind as `v-model`. |
|
|
93
|
+
| `unmountOnHide` | `boolean` | | | When `true`, the element will be unmounted on closed state. |
|
|
94
|
+
| `asChild` | `boolean` | | | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our [Composition](https://www.reka-ui.com/docs/guides/composition) guide for more details. |
|
|
95
|
+
| `as` | `AsTag \| Component` | | | The element or component this component should render as. Can be overwritten by `asChild`. |
|
|
96
|
+
|
|
97
|
+
### Events
|
|
98
|
+
|
|
99
|
+
| Name | Payload |
|
|
100
|
+
| --- | --- |
|
|
101
|
+
| `update:modelValue` | `[payload: T]` |
|
|
102
|
+
| `mounted` | |
|
|
103
|
+
|
|
104
|
+
### v-model
|
|
105
|
+
|
|
106
|
+
- `v-model` binds `modelValue` (`T`)
|
|
107
|
+
|
|
108
|
+
### Slots
|
|
109
|
+
|
|
110
|
+
| Name | Slot props |
|
|
111
|
+
| --- | --- |
|
|
112
|
+
| `default` | `{ modelValue: T; }` |
|
|
113
|
+
|
|
114
|
+
### Exposed (template ref)
|
|
115
|
+
|
|
116
|
+
None.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: BaseTabsContent
|
|
3
|
+
status: preferred
|
|
4
|
+
category: Navigation
|
|
5
|
+
summary: The panel of a BaseTabs set, shown while the trigger with the same value is active.
|
|
6
|
+
import: @wikicasa-dev/components/UIKit/Tab/v2/BaseTabsContent
|
|
7
|
+
version: 2.10.0-alpha.0
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# BaseTabsContent
|
|
11
|
+
|
|
12
|
+
The panel of a BaseTabs set, shown while the trigger with the same value is active.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import BaseTabsContent from "@wikicasa-dev/components/UIKit/Tab/v2/BaseTabsContent";
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Part of the `BaseTabs` compound component: see the `BaseTabs` doc for the full composition. Place the panels inside `BaseTabs`, after (or before) `BaseTabsList`.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```vue
|
|
23
|
+
<script setup lang="ts">
|
|
24
|
+
import BaseTabsContent from "@wikicasa-dev/components/UIKit/Tab/v2/BaseTabsContent";
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<!-- inside <BaseTabs> -->
|
|
29
|
+
<BaseTabsContent value="aste" style="padding-top: 15px">
|
|
30
|
+
Immobili all'asta a Napoli: 54 annunci
|
|
31
|
+
</BaseTabsContent>
|
|
32
|
+
</template>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Do / Don't
|
|
36
|
+
|
|
37
|
+
- `value` must match a trigger's `value`. To show one panel for several tabs, bind `:value` to a computed that returns the active value when it is one of them, and something unused otherwise.
|
|
38
|
+
- Hidden panels stay mounted unless `BaseTabs` has `unmount-on-hide`; `forceMount` keeps a panel mounted in either case.
|
|
39
|
+
- No default styling: spacing goes in your own `class`/`style`.
|
|
40
|
+
|
|
41
|
+
## API
|
|
42
|
+
|
|
43
|
+
_Generated from the component's types. Do not edit by hand._
|
|
44
|
+
|
|
45
|
+
### Props
|
|
46
|
+
|
|
47
|
+
| Name | Type | Default | Required | Description |
|
|
48
|
+
| --- | --- | --- | --- | --- |
|
|
49
|
+
| `dataCy` | `string` | | | |
|
|
50
|
+
| `value` | `StringOrNumber` | | yes | A unique value that associates the content with a trigger. |
|
|
51
|
+
| `forceMount` | `boolean` | | | Used to force mounting when more control is needed. Useful when controlling animation with Vue animation libraries. |
|
|
52
|
+
| `asChild` | `boolean` | | | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our [Composition](https://www.reka-ui.com/docs/guides/composition) guide for more details. |
|
|
53
|
+
| `as` | `AsTag \| Component` | | | The element or component this component should render as. Can be overwritten by `asChild`. |
|
|
54
|
+
|
|
55
|
+
### Events
|
|
56
|
+
|
|
57
|
+
None.
|
|
58
|
+
|
|
59
|
+
### v-model
|
|
60
|
+
|
|
61
|
+
None.
|
|
62
|
+
|
|
63
|
+
### Slots
|
|
64
|
+
|
|
65
|
+
| Name | Slot props |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| `default` | |
|
|
68
|
+
|
|
69
|
+
### Exposed (template ref)
|
|
70
|
+
|
|
71
|
+
None.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: BaseTabsIndicator
|
|
3
|
+
status: preferred
|
|
4
|
+
category: Navigation
|
|
5
|
+
summary: Animated underline that slides under the active BaseTabsTrigger.
|
|
6
|
+
import: @wikicasa-dev/components/UIKit/Tab/v2/BaseTabsIndicator
|
|
7
|
+
version: 2.10.0-alpha.0
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# BaseTabsIndicator
|
|
11
|
+
|
|
12
|
+
Animated underline that slides under the active BaseTabsTrigger.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import BaseTabsIndicator from "@wikicasa-dev/components/UIKit/Tab/v2/BaseTabsIndicator";
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Part of the `BaseTabs` compound component: see the `BaseTabs` doc for the full composition. Optional: without it, the active trigger shows a static underline. Place it once, inside `BaseTabsList`.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```vue
|
|
23
|
+
<script setup lang="ts">
|
|
24
|
+
import BaseTabsIndicator from "@wikicasa-dev/components/UIKit/Tab/v2/BaseTabsIndicator";
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<!-- inside <BaseTabs><BaseTabsList> -->
|
|
29
|
+
<BaseTabsIndicator />
|
|
30
|
+
</template>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Do / Don't
|
|
34
|
+
|
|
35
|
+
- It is a 2px bar positioned at the bottom of `BaseTabsList`; don't wrap it in other elements.
|
|
36
|
+
- To replace the bar's look, pass your own element in the default slot (it fills the indicator box).
|
|
37
|
+
- If the tabs' widths change after mount (fonts loading, labels changing), call the exposed `updateIndicatorStyle()` through a template ref to re-measure.
|
|
38
|
+
|
|
39
|
+
## Styling hooks
|
|
40
|
+
|
|
41
|
+
Color, radius and offset come from the CSS custom properties set on `BaseTabs`: `--indicator-bg-color`, `--indicator-border-radius-top`, `--indicator-border-radius-bottom`, `--indicator-bottom`.
|
|
42
|
+
|
|
43
|
+
## API
|
|
44
|
+
|
|
45
|
+
_Generated from the component's types. Do not edit by hand._
|
|
46
|
+
|
|
47
|
+
### Props
|
|
48
|
+
|
|
49
|
+
| Name | Type | Default | Required | Description |
|
|
50
|
+
| --- | --- | --- | --- | --- |
|
|
51
|
+
| `dataCy` | `string` | | | |
|
|
52
|
+
| `asChild` | `boolean` | | | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our [Composition](https://www.reka-ui.com/docs/guides/composition) guide for more details. |
|
|
53
|
+
| `as` | `AsTag \| Component` | | | The element or component this component should render as. Can be overwritten by `asChild`. |
|
|
54
|
+
|
|
55
|
+
### Events
|
|
56
|
+
|
|
57
|
+
None.
|
|
58
|
+
|
|
59
|
+
### v-model
|
|
60
|
+
|
|
61
|
+
None.
|
|
62
|
+
|
|
63
|
+
### Slots
|
|
64
|
+
|
|
65
|
+
| Name | Slot props |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| `default` | |
|
|
68
|
+
|
|
69
|
+
### Exposed (template ref)
|
|
70
|
+
|
|
71
|
+
| Name | Type |
|
|
72
|
+
| --- | --- |
|
|
73
|
+
| `updateIndicatorStyle` | `() => void \| undefined` |
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: BaseTabsList
|
|
3
|
+
status: preferred
|
|
4
|
+
category: Navigation
|
|
5
|
+
summary: Row that holds the BaseTabsTrigger tabs (and the BaseTabsIndicator) inside BaseTabs.
|
|
6
|
+
import: @wikicasa-dev/components/UIKit/Tab/v2/BaseTabsList
|
|
7
|
+
version: 2.10.0-alpha.0
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# BaseTabsList
|
|
11
|
+
|
|
12
|
+
Row that holds the BaseTabsTrigger tabs (and the BaseTabsIndicator) inside BaseTabs.
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import BaseTabsList from "@wikicasa-dev/components/UIKit/Tab/v2/BaseTabsList";
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Part of the `BaseTabs` compound component: see the `BaseTabs` doc for the full composition. Use exactly one per `BaseTabs`, as the parent of the triggers.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```vue
|
|
23
|
+
<script setup lang="ts">
|
|
24
|
+
import BaseTabs from "@wikicasa-dev/components/UIKit/Tab/v2/BaseTabs";
|
|
25
|
+
import BaseTabsList from "@wikicasa-dev/components/UIKit/Tab/v2/BaseTabsList";
|
|
26
|
+
import BaseTabsIndicator from "@wikicasa-dev/components/UIKit/Tab/v2/BaseTabsIndicator";
|
|
27
|
+
import BaseTabsTrigger from "@wikicasa-dev/components/UIKit/Tab/v2/BaseTabsTrigger";
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<BaseTabs default-value="preferiti">
|
|
32
|
+
<BaseTabsList style="display: flex; gap: 36px; overflow-x: auto">
|
|
33
|
+
<BaseTabsIndicator />
|
|
34
|
+
<BaseTabsTrigger value="preferiti">Preferiti</BaseTabsTrigger>
|
|
35
|
+
<BaseTabsTrigger value="ricerche">Ricerche salvate</BaseTabsTrigger>
|
|
36
|
+
</BaseTabsList>
|
|
37
|
+
</BaseTabs>
|
|
38
|
+
</template>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Do / Don't
|
|
42
|
+
|
|
43
|
+
- It has no layout of its own besides `position: relative`: make it a flex row with a gap via your own `class`/`style`.
|
|
44
|
+
- On mobile, make long lists horizontally scrollable (`overflow-x: auto`) rather than wrapping.
|
|
45
|
+
- Arrow keys stop at the first and last tab; pass `loop` to make them wrap around (off by default here, unlike reka-ui).
|
|
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
|
+
| `dataCy` | `string` | | | |
|
|
56
|
+
| `loop` | `boolean` | | | When `true`, keyboard navigation will loop from last tab to first, and vice versa. |
|
|
57
|
+
| `asChild` | `boolean` | | | Change the default rendered element for the one passed as a child, merging their props and behavior. Read our [Composition](https://www.reka-ui.com/docs/guides/composition) guide for more details. |
|
|
58
|
+
| `as` | `AsTag \| Component` | | | The element or component this component should render as. Can be overwritten by `asChild`. |
|
|
59
|
+
|
|
60
|
+
### Events
|
|
61
|
+
|
|
62
|
+
None.
|
|
63
|
+
|
|
64
|
+
### v-model
|
|
65
|
+
|
|
66
|
+
None.
|
|
67
|
+
|
|
68
|
+
### Slots
|
|
69
|
+
|
|
70
|
+
| Name | Slot props |
|
|
71
|
+
| --- | --- |
|
|
72
|
+
| `default` | |
|
|
73
|
+
|
|
74
|
+
### Exposed (template ref)
|
|
75
|
+
|
|
76
|
+
None.
|