@empathyco/x-components 3.0.0-alpha.235 → 3.0.0-alpha.237
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/CHANGELOG.md +25 -0
- package/core/index.js +1 -0
- package/core/index.js.map +1 -1
- package/docs/API-reference/api/x-components.basetabspanel.allowtabdeselect.md +13 -0
- package/docs/API-reference/api/x-components.basetabspanel.contentanimation.md +13 -0
- package/docs/API-reference/api/x-components.basetabspanel.initialtab.md +13 -0
- package/docs/API-reference/api/x-components.basetabspanel.md +24 -0
- package/docs/API-reference/api/x-components.basetabspanel.tabsanimation.md +13 -0
- package/docs/API-reference/api/x-components.md +1 -0
- package/docs/API-reference/api/x-components.recommendationsmutations.md +1 -0
- package/docs/API-reference/api/x-components.recommendationsmutations.updaterecommendation.md +24 -0
- package/docs/API-reference/components/common/panels/x-components.base-tabs-panel.md +334 -0
- package/js/components/panels/base-tabs-panel.vue.js +151 -0
- package/js/components/panels/base-tabs-panel.vue.js.map +1 -0
- package/js/components/panels/base-tabs-panel.vue_rollup-plugin-vue_script.vue.js +78 -0
- package/js/components/panels/base-tabs-panel.vue_rollup-plugin-vue_script.vue.js.map +1 -0
- package/js/index.js +1 -0
- package/js/index.js.map +1 -1
- package/js/x-modules/extra-params/components/extra-params.vue_rollup-plugin-vue_script.vue.js +1 -0
- package/js/x-modules/extra-params/components/extra-params.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/extra-params/components/renderless-extra-param.vue_rollup-plugin-vue_script.vue.js +1 -0
- package/js/x-modules/extra-params/components/renderless-extra-param.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/facets/components/clear-filters.vue_rollup-plugin-vue_script.vue.js +1 -0
- package/js/x-modules/facets/components/clear-filters.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/facets/components/facets/facets-provider.vue_rollup-plugin-vue_script.vue.js +1 -0
- package/js/x-modules/facets/components/facets/facets-provider.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/all-filter.vue_rollup-plugin-vue_script.vue.js +1 -0
- package/js/x-modules/facets/components/filters/all-filter.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/number-range-filter.vue_rollup-plugin-vue_script.vue.js +1 -0
- package/js/x-modules/facets/components/filters/number-range-filter.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/renderless-filter.vue_rollup-plugin-vue_script.vue.js +1 -0
- package/js/x-modules/facets/components/filters/renderless-filter.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/simple-filter.vue_rollup-plugin-vue_script.vue.js +1 -0
- package/js/x-modules/facets/components/filters/simple-filter.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/facets/components/lists/exclude-filters-with-no-results.vue_rollup-plugin-vue_script.vue.js +1 -0
- package/js/x-modules/facets/components/lists/exclude-filters-with-no-results.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/facets/components/lists/filters-list.vue_rollup-plugin-vue_script.vue.js +1 -0
- package/js/x-modules/facets/components/lists/filters-list.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/facets/components/lists/filters-search.vue_rollup-plugin-vue_script.vue.js +1 -0
- package/js/x-modules/facets/components/lists/filters-search.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/facets/components/lists/selected-filters.vue_rollup-plugin-vue_script.vue.js +1 -0
- package/js/x-modules/facets/components/lists/selected-filters.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/facets/components/lists/sliced-filters.vue_rollup-plugin-vue_script.vue.js +1 -0
- package/js/x-modules/facets/components/lists/sliced-filters.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/facets/components/lists/sorted-filters.vue_rollup-plugin-vue_script.vue.js +1 -0
- package/js/x-modules/facets/components/lists/sorted-filters.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/recommendations/store/module.js +6 -0
- package/js/x-modules/recommendations/store/module.js.map +1 -1
- package/js/x-modules/scroll/components/main-scroll-item.vue_rollup-plugin-vue_script.vue.js +1 -0
- package/js/x-modules/scroll/components/main-scroll-item.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/scroll/components/scroll-to-top.vue_rollup-plugin-vue_script.vue.js +1 -0
- package/js/x-modules/scroll/components/scroll-to-top.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/scroll/components/window-scroll.vue_rollup-plugin-vue_script.vue.js +1 -0
- package/js/x-modules/scroll/components/window-scroll.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/search/components/sort-list.vue_rollup-plugin-vue_script.vue.js +1 -0
- package/js/x-modules/search/components/sort-list.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/search/components/sort.mixin.js +1 -0
- package/js/x-modules/search/components/sort.mixin.js.map +1 -1
- package/js/x-modules/search/components/spellcheck.vue_rollup-plugin-vue_script.vue.js +1 -0
- package/js/x-modules/search/components/spellcheck.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/search-box/components/search-input-placeholder.vue_rollup-plugin-vue_script.vue.js +1 -0
- package/js/x-modules/search-box/components/search-input-placeholder.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-modules/url/components/url-handler.vue_rollup-plugin-vue_script.vue.js +1 -0
- package/js/x-modules/url/components/url-handler.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/package.json +2 -2
- package/report/x-components.api.json +223 -0
- package/report/x-components.api.md +19 -0
- package/types/components/panels/base-tabs-panel.vue.d.ts +67 -0
- package/types/components/panels/base-tabs-panel.vue.d.ts.map +1 -0
- package/types/components/panels/index.d.ts +1 -0
- package/types/components/panels/index.d.ts.map +1 -1
- package/types/x-modules/recommendations/store/module.d.ts.map +1 -1
- package/types/x-modules/recommendations/store/types.d.ts +7 -0
- package/types/x-modules/recommendations/store/types.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,31 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See
|
|
4
4
|
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.0.0-alpha.237](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.236...@empathyco/x-components@3.0.0-alpha.237) (2022-12-01)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **recommendations:** add `updateRecommendation` mutation (#891)
|
|
11
|
+
([0e9ceec](https://github.com/empathyco/x/commit/0e9ceec145458a55ccbe4abf8e7b49f64d1717ae))
|
|
12
|
+
|
|
13
|
+
# Change Log
|
|
14
|
+
|
|
15
|
+
All notable changes to this project will be documented in this file. See
|
|
16
|
+
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
17
|
+
|
|
18
|
+
## [3.0.0-alpha.236](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.235...@empathyco/x-components@3.0.0-alpha.236) (2022-11-29)
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
- **tabs-panel:** add base tabs panel component (#871)
|
|
23
|
+
([ebd5feb](https://github.com/empathyco/x/commit/ebd5feb4006315236ae62f8de03d6a986d9ced10)),
|
|
24
|
+
closes [EX-6142](https://searchbroker.atlassian.net/browse/EX-6142)
|
|
25
|
+
|
|
26
|
+
# Change Log
|
|
27
|
+
|
|
28
|
+
All notable changes to this project will be documented in this file. See
|
|
29
|
+
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
30
|
+
|
|
6
31
|
## [3.0.0-alpha.235](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.234...@empathyco/x-components@3.0.0-alpha.235) (2022-11-29)
|
|
7
32
|
|
|
8
33
|
**Note:** Version bump only for package @empathyco/x-components
|
package/core/index.js
CHANGED
|
@@ -91,6 +91,7 @@ export { default as BaseHeaderTogglePanel } from '../js/components/panels/base-h
|
|
|
91
91
|
export { default as BaseTogglePanel } from '../js/components/panels/base-toggle-panel.vue.js';
|
|
92
92
|
export { default as BaseIdTogglePanel } from '../js/components/panels/base-id-toggle-panel.vue.js';
|
|
93
93
|
export { default as BaseIdTogglePanelButton } from '../js/components/panels/base-id-toggle-panel-button.vue.js';
|
|
94
|
+
export { default as BaseTabsPanel } from '../js/components/panels/base-tabs-panel.vue.js';
|
|
94
95
|
export { default as BaseAddToCart } from '../js/components/result/base-result-add-to-cart.vue.js';
|
|
95
96
|
export { default as BaseResultCurrentPrice } from '../js/components/result/base-result-current-price.vue.js';
|
|
96
97
|
export { default as BaseResultImage } from '../js/components/result/base-result-image.vue.js';
|
package/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [BaseTabsPanel](./x-components.basetabspanel.md) > [allowTabDeselect](./x-components.basetabspanel.allowtabdeselect.md)
|
|
4
|
+
|
|
5
|
+
## BaseTabsPanel.allowTabDeselect property
|
|
6
|
+
|
|
7
|
+
Allows the tabs to be unselected.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
allowTabDeselect: boolean;
|
|
13
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [BaseTabsPanel](./x-components.basetabspanel.md) > [contentAnimation](./x-components.basetabspanel.contentanimation.md)
|
|
4
|
+
|
|
5
|
+
## BaseTabsPanel.contentAnimation property
|
|
6
|
+
|
|
7
|
+
Animation component that will be used to animate the selected tab content.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
contentAnimation: Vue | string;
|
|
13
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [BaseTabsPanel](./x-components.basetabspanel.md) > [initialTab](./x-components.basetabspanel.initialtab.md)
|
|
4
|
+
|
|
5
|
+
## BaseTabsPanel.initialTab property
|
|
6
|
+
|
|
7
|
+
The tab to be initially selected.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
initialTab: string;
|
|
13
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [BaseTabsPanel](./x-components.basetabspanel.md)
|
|
4
|
+
|
|
5
|
+
## BaseTabsPanel class
|
|
6
|
+
|
|
7
|
+
Base Tabs Panel.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export default class BaseTabsPanel extends BaseTabsPanel_base
|
|
13
|
+
```
|
|
14
|
+
<b>Extends:</b> BaseTabsPanel\_base
|
|
15
|
+
|
|
16
|
+
## Properties
|
|
17
|
+
|
|
18
|
+
| Property | Modifiers | Type | Description |
|
|
19
|
+
| --- | --- | --- | --- |
|
|
20
|
+
| [allowTabDeselect](./x-components.basetabspanel.allowtabdeselect.md) | | boolean | Allows the tabs to be unselected. |
|
|
21
|
+
| [contentAnimation](./x-components.basetabspanel.contentanimation.md) | | Vue \| string | Animation component that will be used to animate the selected tab content. |
|
|
22
|
+
| [initialTab](./x-components.basetabspanel.initialtab.md) | | string | The tab to be initially selected. |
|
|
23
|
+
| [tabsAnimation](./x-components.basetabspanel.tabsanimation.md) | | Vue \| string | Animation component that will be used to animate the tabs list. |
|
|
24
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [BaseTabsPanel](./x-components.basetabspanel.md) > [tabsAnimation](./x-components.basetabspanel.tabsanimation.md)
|
|
4
|
+
|
|
5
|
+
## BaseTabsPanel.tabsAnimation property
|
|
6
|
+
|
|
7
|
+
Animation component that will be used to animate the tabs list.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
tabsAnimation: Vue | string;
|
|
13
|
+
```
|
|
@@ -46,6 +46,7 @@ X-Components is a library usable everywhere not only for search experiences.
|
|
|
46
46
|
| [BaseSuggestion](./x-components.basesuggestion.md) | Renders a button with a default slot. It receives a query, which should be the query of the module using this component, a suggestion, the [XEvents](./x-components.xevent.md) that will be emitted on click with a given feature.<!-- -->The default slot receives the suggestion and the matched query has props. |
|
|
47
47
|
| [BaseSuggestions](./x-components.basesuggestions.md) | Paints a list of suggestions passed in by prop. Requires a component for a single suggestion in the default slot for working. |
|
|
48
48
|
| [BaseSwitch](./x-components.baseswitch.md) | Basic switch component to handle boolean values. This component receives its selected state using a prop, and emits a Vue event whenever the user clicks it. |
|
|
49
|
+
| [BaseTabsPanel](./x-components.basetabspanel.md) | Base Tabs Panel. |
|
|
49
50
|
| [BaseTogglePanel](./x-components.basetogglepanel.md) | Simple panel that receives its open state via prop, which is responsible of rendering default slot inside a configurable transition. |
|
|
50
51
|
| [BaseVariableColumnGrid](./x-components.basevariablecolumngrid.md) | The <code>BaseVariableColumnGrid</code> component is a wrapper of the <code>BaseGrid</code> component that listens to the <code>UserClickedColumnPicker</code> and the <code>ColumnsNumberProvided</code> events and passes the selected number of columns to the grid. It also allows to customize the grid items using the available <code>scopedSlots</code>. |
|
|
51
52
|
| [BaseXAPI](./x-components.basexapi.md) | Default implementation for [XAPI](./x-components.xapi.md)<!-- -->. |
|
|
@@ -19,4 +19,5 @@ export interface RecommendationsMutations extends StatusMutations
|
|
|
19
19
|
| --- | --- |
|
|
20
20
|
| [setParams(params)](./x-components.recommendationsmutations.setparams.md) | Sets the extra params of the module. |
|
|
21
21
|
| [setRecommendations(recommendations)](./x-components.recommendationsmutations.setrecommendations.md) | Sets the recommendations of the module. |
|
|
22
|
+
| [updateRecommendation(recommendation)](./x-components.recommendationsmutations.updaterecommendation.md) | Updates a recommendation with new fields. |
|
|
22
23
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [RecommendationsMutations](./x-components.recommendationsmutations.md) > [updateRecommendation](./x-components.recommendationsmutations.updaterecommendation.md)
|
|
4
|
+
|
|
5
|
+
## RecommendationsMutations.updateRecommendation() method
|
|
6
|
+
|
|
7
|
+
Updates a recommendation with new fields.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
updateRecommendation(recommendation: Partial<Result> & Pick<Result, 'id'>): void;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
| Parameter | Type | Description |
|
|
18
|
+
| --- | --- | --- |
|
|
19
|
+
| recommendation | Partial<Result> & Pick<Result, 'id'> | A recommendation containing at least an id and the properties to modify. |
|
|
20
|
+
|
|
21
|
+
<b>Returns:</b>
|
|
22
|
+
|
|
23
|
+
void
|
|
24
|
+
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
---
|
|
2
|
+
|
|
3
|
+
title: BaseTabsPanel
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# BaseTabsPanel
|
|
8
|
+
|
|
9
|
+
Base Tabs Panel.
|
|
10
|
+
|
|
11
|
+
## Props
|
|
12
|
+
|
|
13
|
+
| Name | Description | Type | Default |
|
|
14
|
+
| ----------------------------- | -------------------------------------------------------------------------- | -------------------- | ---------------------------- |
|
|
15
|
+
| <code>tabsAnimation</code> | Animation component that will be used to animate the tabs list. | <code>union</code> | <code>'header'</code> |
|
|
16
|
+
| <code>contentAnimation</code> | Animation component that will be used to animate the selected tab content. | <code>union</code> | <code>() => NoElement</code> |
|
|
17
|
+
| <code>initialTab</code> | The tab to be initially selected. | <code>string</code> | <code>''</code> |
|
|
18
|
+
| <code>allowTabDeselect</code> | Allows the tabs to be unselected. | <code>boolean</code> | <code>false</code> |
|
|
19
|
+
|
|
20
|
+
## Slots
|
|
21
|
+
|
|
22
|
+
| Name | Description | Bindings<br />(name - type - description) |
|
|
23
|
+
| ------------------------ | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
24
|
+
| <code>tab</code> | Slot used to replace the whole tab. | **tab** <code>string</code> - The tab name.<br />**isSelected** <code>boolean</code> - Indicates if the tab is selected.<br />**select** <code>function</code> - Function to select the tab. |
|
|
25
|
+
| <code>tab-content</code> | Slot used to just pass the content. | **tab** <code>string</code> - The tab name.<br />**isSelected** <code>boolean</code> - Indicates if the tab is selected. |
|
|
26
|
+
| <code>default</code> | Slot used to display the selected tab content. | **tab** <code>string</code> - This content's tab name.<br />**selectTab** <code>function</code> - Function to select a tab.<br />**deselectTab** <code>function</code> - Function to deselect the tab.<br /> |
|
|
27
|
+
|
|
28
|
+
## Examples
|
|
29
|
+
|
|
30
|
+
This component renders a list of tabs based on the name of the slots passed on its template. By
|
|
31
|
+
default, the name of each slot will be used as tab label. If an initial tab is passed by prop, the
|
|
32
|
+
content of its correspondent slot will displayed in a panel. Otherwise, no content will be displayed
|
|
33
|
+
until a tab is selected.
|
|
34
|
+
|
|
35
|
+
### Basic example
|
|
36
|
+
|
|
37
|
+
It renders a list of tabs and, when a tab is clicked, a panel with its content will be displayed.
|
|
38
|
+
|
|
39
|
+
```vue
|
|
40
|
+
<template>
|
|
41
|
+
<BaseTabsPanel>
|
|
42
|
+
<template #summer>
|
|
43
|
+
<div>Summer Top Sales</div>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<template #fall>
|
|
47
|
+
<div>Fall Top Sales</div>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<template #outlet>
|
|
51
|
+
<div>Outlet Top Sales</div>
|
|
52
|
+
</template>
|
|
53
|
+
</BaseTabsPanel>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<script>
|
|
57
|
+
import { BaseTabsPanel } from "@empathyco/x-components";
|
|
58
|
+
|
|
59
|
+
export default {
|
|
60
|
+
name: "BaseTabsPanelDemo",
|
|
61
|
+
components: {
|
|
62
|
+
BaseTabsPanel
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
</script>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Play with props
|
|
69
|
+
|
|
70
|
+
#### Define the tab to be initially opened
|
|
71
|
+
|
|
72
|
+
By default, no tab is selected so any panel is displayed. The `initialTab` prop allows to indicate
|
|
73
|
+
which tab should be opened at first.
|
|
74
|
+
|
|
75
|
+
```vue
|
|
76
|
+
<template>
|
|
77
|
+
<BaseTabsPanel initialTab="summer">
|
|
78
|
+
<template #summer>
|
|
79
|
+
<div>Summer Top Sales</div>
|
|
80
|
+
</template>
|
|
81
|
+
|
|
82
|
+
<template #fall>
|
|
83
|
+
<div>Fall Top Sales</div>
|
|
84
|
+
</template>
|
|
85
|
+
|
|
86
|
+
<template #outlet>
|
|
87
|
+
<div>Outlet Top Sales</div>
|
|
88
|
+
</template>
|
|
89
|
+
</BaseTabsPanel>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<script>
|
|
93
|
+
import { BaseTabsPanel } from "@empathyco/x-components";
|
|
94
|
+
|
|
95
|
+
export default {
|
|
96
|
+
name: "BaseTabsPanelDemo",
|
|
97
|
+
components: {
|
|
98
|
+
BaseTabsPanel
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
</script>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### Allowing tabs deselection
|
|
105
|
+
|
|
106
|
+
The prop `allowTabDeselect` allows the tabs to be deselected. When a tab that is already selected is
|
|
107
|
+
clicked again, the tab will be deselected and no panel content will be displayed. By default, this
|
|
108
|
+
behavior is disabled.
|
|
109
|
+
|
|
110
|
+
```vue
|
|
111
|
+
<template>
|
|
112
|
+
<BaseTabsPanel initialTab="summer" allowTabDeselect>
|
|
113
|
+
<template #summer>
|
|
114
|
+
<div>Summer Top Sales</div>
|
|
115
|
+
</template>
|
|
116
|
+
|
|
117
|
+
<template #fall>
|
|
118
|
+
<div>Fall Top Sales</div>
|
|
119
|
+
</template>
|
|
120
|
+
|
|
121
|
+
<template #outlet>
|
|
122
|
+
<div>Outlet Top Sales</div>
|
|
123
|
+
</template>
|
|
124
|
+
</BaseTabsPanel>
|
|
125
|
+
</template>
|
|
126
|
+
|
|
127
|
+
<script>
|
|
128
|
+
import { BaseTabsPanel } from "@empathyco/x-components";
|
|
129
|
+
|
|
130
|
+
export default {
|
|
131
|
+
name: "BaseTabsPanelDemo",
|
|
132
|
+
components: {
|
|
133
|
+
BaseTabsPanel
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
</script>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
#### Customizing the content with classes
|
|
140
|
+
|
|
141
|
+
- The `activeTabClass` prop can be used to add classes to the active tab button.
|
|
142
|
+
- The `contentClass` prop can be used to add classes to the content.
|
|
143
|
+
- The `tabClass` prop can be used to add classes to the tab buttons.
|
|
144
|
+
- The `tabsListClass` prop can be used to add classes to the tabs list.
|
|
145
|
+
|
|
146
|
+
```vue
|
|
147
|
+
<template>
|
|
148
|
+
<BaseTabsPanel
|
|
149
|
+
activeTabClass="x-button-auxiliary"
|
|
150
|
+
contentClass="x-padding--04 x-background--auxiliary"
|
|
151
|
+
tabClass="x-button-ghost"
|
|
152
|
+
tabsListClass="x-list--horizontal"
|
|
153
|
+
>
|
|
154
|
+
<template #summer>
|
|
155
|
+
<div>Summer Top Sales</div>
|
|
156
|
+
</template>
|
|
157
|
+
|
|
158
|
+
<template #fall>
|
|
159
|
+
<div>Fall Top Sales</div>
|
|
160
|
+
</template>
|
|
161
|
+
|
|
162
|
+
<template #outlet>
|
|
163
|
+
<div>Outlet Top Sales</div>
|
|
164
|
+
</template>
|
|
165
|
+
</BaseTabsPanel>
|
|
166
|
+
</template>
|
|
167
|
+
|
|
168
|
+
<script>
|
|
169
|
+
import { BaseTabsPanel } from "@empathyco/x-components";
|
|
170
|
+
|
|
171
|
+
export default {
|
|
172
|
+
name: "BaseTabsPanelDemo",
|
|
173
|
+
components: {
|
|
174
|
+
BaseTabsPanel
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
</script>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
#### Play with the animations
|
|
181
|
+
|
|
182
|
+
- The `tabsAnimation` prop can be used to animate the tabs list.
|
|
183
|
+
- The `contentAnimation` prop can be used to animate the selected tab content.
|
|
184
|
+
|
|
185
|
+
```vue
|
|
186
|
+
<template>
|
|
187
|
+
<BaseTabsPanel
|
|
188
|
+
:tabsAnimation="staggeredFadeAndSlide"
|
|
189
|
+
:contentAnimation="staggeredFadeAndSlide"
|
|
190
|
+
>
|
|
191
|
+
<template #summer>
|
|
192
|
+
<div>Summer Top Sales</div>
|
|
193
|
+
</template>
|
|
194
|
+
|
|
195
|
+
<template #fall>
|
|
196
|
+
<div>Fall Top Sales</div>
|
|
197
|
+
</template>
|
|
198
|
+
</BaseTabsPanel>
|
|
199
|
+
</template>
|
|
200
|
+
|
|
201
|
+
<script>
|
|
202
|
+
import { BaseTabsPanel, StaggeredFadeAndSlide } from "@empathyco/x-components";
|
|
203
|
+
|
|
204
|
+
export default {
|
|
205
|
+
name: "BaseTabsPanelDemo",
|
|
206
|
+
components: {
|
|
207
|
+
BaseTabsPanel
|
|
208
|
+
},
|
|
209
|
+
data() {
|
|
210
|
+
return {
|
|
211
|
+
staggeredFadeAndSlide: StaggeredFadeAndSlide
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
</script>
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Overriding the slots
|
|
219
|
+
|
|
220
|
+
#### Customizing the tab button
|
|
221
|
+
|
|
222
|
+
By default, the component is rendering a button for each tab to be displayed. This button can be
|
|
223
|
+
replaced entirely through the `tab` slot.
|
|
224
|
+
|
|
225
|
+
```vue
|
|
226
|
+
<template>
|
|
227
|
+
<BaseTabsPanel>
|
|
228
|
+
<template #tab="{ tab, isSelected, select }">
|
|
229
|
+
<CheckIcon v-if="isSelected" />
|
|
230
|
+
This is the {{ tab }} tab.
|
|
231
|
+
<button @click="select">Open tab</button>
|
|
232
|
+
</template>
|
|
233
|
+
|
|
234
|
+
<template #summer>
|
|
235
|
+
<div>Summer Top Sales</div>
|
|
236
|
+
</template>
|
|
237
|
+
|
|
238
|
+
<template #fall>
|
|
239
|
+
<div>Fall Top Sales</div>
|
|
240
|
+
</template>
|
|
241
|
+
|
|
242
|
+
<template #outlet>
|
|
243
|
+
<div>Outlet Top Sales</div>
|
|
244
|
+
</template>
|
|
245
|
+
</BaseTabsPanel>
|
|
246
|
+
</template>
|
|
247
|
+
|
|
248
|
+
<script>
|
|
249
|
+
import { BaseTabsPanel, CheckIcon } from "@empathyco/x-components";
|
|
250
|
+
|
|
251
|
+
export default {
|
|
252
|
+
name: "BaseTabsPanelDemo",
|
|
253
|
+
components: {
|
|
254
|
+
BaseTabsPanel,
|
|
255
|
+
CheckIcon
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
</script>
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
#### Customizing the tab button content
|
|
262
|
+
|
|
263
|
+
Alternatively to the previous example, instead of changing the whole tab button, the slot
|
|
264
|
+
`tab-content` offers the possibility of changing just its contents.
|
|
265
|
+
|
|
266
|
+
```vue
|
|
267
|
+
<template>
|
|
268
|
+
<BaseTabsPanel>
|
|
269
|
+
<template #tab-content="{ tab, isSelected }">
|
|
270
|
+
<CheckIcon v-if="isSelected" />
|
|
271
|
+
{{ tab }}
|
|
272
|
+
</template>
|
|
273
|
+
|
|
274
|
+
<template #summer>
|
|
275
|
+
<div>Summer Top Sales</div>
|
|
276
|
+
</template>
|
|
277
|
+
|
|
278
|
+
<template #fall>
|
|
279
|
+
<div>Fall Top Sales</div>
|
|
280
|
+
</template>
|
|
281
|
+
|
|
282
|
+
<template #outlet>
|
|
283
|
+
<div>Outlet Top Sales</div>
|
|
284
|
+
</template>
|
|
285
|
+
</BaseTabsPanel>
|
|
286
|
+
</template>
|
|
287
|
+
|
|
288
|
+
<script>
|
|
289
|
+
import { BaseTabsPanel, CheckIcon } from "@empathyco/x-components";
|
|
290
|
+
|
|
291
|
+
export default {
|
|
292
|
+
name: "BaseTabsPanelDemo",
|
|
293
|
+
components: {
|
|
294
|
+
BaseTabsPanel,
|
|
295
|
+
CheckIcon
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
</script>
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
#### Customizing the tab panel content
|
|
302
|
+
|
|
303
|
+
The displayed tab name and a method to select a tab are exposed to the tab panel content slot.
|
|
304
|
+
|
|
305
|
+
```vue
|
|
306
|
+
<template>
|
|
307
|
+
<BaseTabsPanel>
|
|
308
|
+
<template #summer="{ tab, selectTab, deselectTab }">
|
|
309
|
+
<h1>{{ tab }}</h1>
|
|
310
|
+
<button @click="() => selectTab('fall')">Open Fall</button>
|
|
311
|
+
<button @click="deselectTab">Close tab</button>
|
|
312
|
+
</template>
|
|
313
|
+
|
|
314
|
+
<template #fall>
|
|
315
|
+
<div>Fall Top Sales</div>
|
|
316
|
+
</template>
|
|
317
|
+
</BaseTabsPanel>
|
|
318
|
+
</template>
|
|
319
|
+
|
|
320
|
+
<script>
|
|
321
|
+
import { BaseTabsPanel } from "@empathyco/x-components";
|
|
322
|
+
|
|
323
|
+
export default {
|
|
324
|
+
name: "BaseTabsPanelDemo",
|
|
325
|
+
components: {
|
|
326
|
+
BaseTabsPanel
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
</script>
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## Events
|
|
333
|
+
|
|
334
|
+
This component emits no events.
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import script from './base-tabs-panel.vue_rollup-plugin-vue_script.vue.js';
|
|
2
|
+
import __vue_normalize__ from 'vue-runtime-helpers/dist/normalize-component.mjs';
|
|
3
|
+
|
|
4
|
+
/* script */
|
|
5
|
+
const __vue_script__ = script;
|
|
6
|
+
|
|
7
|
+
/* template */
|
|
8
|
+
var __vue_render__ = function () {
|
|
9
|
+
var _vm = this;
|
|
10
|
+
var _h = _vm.$createElement;
|
|
11
|
+
var _c = _vm._self._c || _h;
|
|
12
|
+
return _vm.getTabs().length > 0
|
|
13
|
+
? _c(
|
|
14
|
+
"section",
|
|
15
|
+
{
|
|
16
|
+
staticClass: "x-tabs-panel",
|
|
17
|
+
attrs: { "data-test": "base-tabs-panel" },
|
|
18
|
+
},
|
|
19
|
+
[
|
|
20
|
+
_c(
|
|
21
|
+
_vm.tabsAnimation,
|
|
22
|
+
{
|
|
23
|
+
tag: "component",
|
|
24
|
+
staticClass: "x-tabs-panel__items-list x-list",
|
|
25
|
+
class: _vm.tabsListClass,
|
|
26
|
+
attrs: { "data-test": "base-tabs-panel-list", role: "tablist" },
|
|
27
|
+
},
|
|
28
|
+
[
|
|
29
|
+
_vm._l(_vm.getTabs(), function (tab) {
|
|
30
|
+
return _vm._t(
|
|
31
|
+
"tab",
|
|
32
|
+
function () {
|
|
33
|
+
return [
|
|
34
|
+
_c(
|
|
35
|
+
"button",
|
|
36
|
+
{
|
|
37
|
+
key: tab,
|
|
38
|
+
staticClass:
|
|
39
|
+
"x-tabs-panel__list-item x-list__item x-button x-tabs-panel__button",
|
|
40
|
+
class: _vm.tabIsSelected(tab)
|
|
41
|
+
? _vm.activeTabClass
|
|
42
|
+
: _vm.tabClass,
|
|
43
|
+
attrs: {
|
|
44
|
+
id: "base-tabs-panel-" + tab,
|
|
45
|
+
"aria-selected": _vm.tabIsSelected(tab),
|
|
46
|
+
"data-test": "base-tabs-panel-button",
|
|
47
|
+
role: "tab",
|
|
48
|
+
},
|
|
49
|
+
on: {
|
|
50
|
+
click: function ($event) {
|
|
51
|
+
return _vm.selectTab(tab)
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
[
|
|
56
|
+
_vm._t(
|
|
57
|
+
"tab-content",
|
|
58
|
+
function () {
|
|
59
|
+
return [
|
|
60
|
+
_vm._v(
|
|
61
|
+
"\n " + _vm._s(tab) + "\n "
|
|
62
|
+
),
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
null,
|
|
66
|
+
{ tab: tab, isSelected: _vm.tabIsSelected(tab) }
|
|
67
|
+
),
|
|
68
|
+
],
|
|
69
|
+
2
|
|
70
|
+
),
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
null,
|
|
74
|
+
{
|
|
75
|
+
tab: tab,
|
|
76
|
+
isSelected: _vm.tabIsSelected(tab),
|
|
77
|
+
select: function () {
|
|
78
|
+
return _vm.selectTab(tab)
|
|
79
|
+
},
|
|
80
|
+
}
|
|
81
|
+
)
|
|
82
|
+
}),
|
|
83
|
+
],
|
|
84
|
+
2
|
|
85
|
+
),
|
|
86
|
+
_vm._v(" "),
|
|
87
|
+
_c(_vm.contentAnimation, { tag: "component" }, [
|
|
88
|
+
_vm.selectedTab && _vm.$scopedSlots[_vm.selectedTab]
|
|
89
|
+
? _c(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
key: _vm.selectedTab,
|
|
93
|
+
class: _vm.contentClass,
|
|
94
|
+
attrs: {
|
|
95
|
+
"aria-labelledby": "base-tabs-panel-" + _vm.selectedTab,
|
|
96
|
+
"data-test": "base-tabs-panel-content",
|
|
97
|
+
role: "tabpanel",
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
[
|
|
101
|
+
_vm._t(_vm.selectedTab, null, null, {
|
|
102
|
+
tab: _vm.selectedTab,
|
|
103
|
+
selectTab: _vm.selectTab,
|
|
104
|
+
deselectTab: function () {
|
|
105
|
+
return _vm.selectTab(_vm.selectedTab)
|
|
106
|
+
},
|
|
107
|
+
}),
|
|
108
|
+
],
|
|
109
|
+
2
|
|
110
|
+
)
|
|
111
|
+
: _vm._e(),
|
|
112
|
+
]),
|
|
113
|
+
],
|
|
114
|
+
1
|
|
115
|
+
)
|
|
116
|
+
: _vm._e()
|
|
117
|
+
};
|
|
118
|
+
var __vue_staticRenderFns__ = [];
|
|
119
|
+
__vue_render__._withStripped = true;
|
|
120
|
+
|
|
121
|
+
/* style */
|
|
122
|
+
const __vue_inject_styles__ = undefined;
|
|
123
|
+
/* scoped */
|
|
124
|
+
const __vue_scope_id__ = undefined;
|
|
125
|
+
/* module identifier */
|
|
126
|
+
const __vue_module_identifier__ = undefined;
|
|
127
|
+
/* functional template */
|
|
128
|
+
const __vue_is_functional_template__ = false;
|
|
129
|
+
/* style inject */
|
|
130
|
+
|
|
131
|
+
/* style inject SSR */
|
|
132
|
+
|
|
133
|
+
/* style inject shadow dom */
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
const __vue_component__ = /*#__PURE__*/__vue_normalize__(
|
|
138
|
+
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
|
|
139
|
+
__vue_inject_styles__,
|
|
140
|
+
__vue_script__,
|
|
141
|
+
__vue_scope_id__,
|
|
142
|
+
__vue_is_functional_template__,
|
|
143
|
+
__vue_module_identifier__,
|
|
144
|
+
false,
|
|
145
|
+
undefined,
|
|
146
|
+
undefined,
|
|
147
|
+
undefined
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
export { __vue_component__ as default };
|
|
151
|
+
//# sourceMappingURL=base-tabs-panel.vue.js.map
|