@empathyco/x-components 6.0.0-alpha.139 → 6.0.0-alpha.140
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 +11 -0
- package/docs/API-reference/api/x-components.aimutations.md +1 -1
- package/docs/API-reference/api/{x-components.aimutations.settaggings.md → x-components.aimutations.settagging.md} +4 -4
- package/docs/API-reference/api/x-components.aioverview.md +3 -1
- package/docs/API-reference/api/x-components.aistate.md +1 -1
- package/docs/API-reference/api/{x-components.aistate.taggings.md → x-components.aistate.tagging.md} +3 -3
- package/docs/API-reference/api/x-components.aixevents.md +1 -0
- package/docs/API-reference/api/x-components.aixevents.userclickedaioverviewexpandbutton.md +11 -0
- package/docs/API-reference/api/x-components.featurelocation.md +1 -1
- package/docs/API-reference/api/x-components.hierarchicalfilter.md +1 -0
- package/docs/API-reference/api/x-components.md +1 -0
- package/docs/API-reference/api/x-components.queryfeature.md +1 -1
- package/docs/API-reference/api/x-components.resultfeature.md +1 -1
- package/docs/API-reference/api/x-components.simplefilter.md +1 -0
- package/docs/API-reference/api/x-components.slidingpanel.md +8 -3
- package/docs/API-reference/api/x-components.snippetcallbacks.md +1 -0
- package/docs/API-reference/api/x-components.trackaioverviewbuttonclickedwire.md +13 -0
- package/docs/API-reference/components/common/x-components.sliding-panel.md +2 -1
- package/js/components/sliding-panel.vue.js +42 -35
- package/js/components/sliding-panel.vue.js.map +1 -1
- package/js/components/sliding-panel.vue2.js +25 -83
- package/js/components/sliding-panel.vue2.js.map +1 -1
- package/js/components/sliding-panel.vue3.js +1 -1
- package/js/index.js +1 -1
- package/js/x-modules/ai/components/ai-overview.vue.js +34 -20
- package/js/x-modules/ai/components/ai-overview.vue.js.map +1 -1
- package/js/x-modules/ai/components/ai-overview.vue2.js +20 -11
- package/js/x-modules/ai/components/ai-overview.vue2.js.map +1 -1
- package/js/x-modules/ai/store/actions/fetch-and-save-ai-suggestions.action.js +7 -1
- package/js/x-modules/ai/store/actions/fetch-and-save-ai-suggestions.action.js.map +1 -1
- package/js/x-modules/ai/store/module.js +3 -3
- package/js/x-modules/ai/store/module.js.map +1 -1
- package/js/x-modules/tagging/wiring.js +22 -2
- package/js/x-modules/tagging/wiring.js.map +1 -1
- package/package.json +4 -4
- package/report/x-components.api.json +132 -32
- package/report/x-components.api.md +29 -10
- package/tagging/index.js +1 -1
- package/types/components/sliding-panel.vue.d.ts +8 -3
- package/types/components/sliding-panel.vue.d.ts.map +1 -1
- package/types/components/snippet-callbacks.vue.d.ts +1 -0
- package/types/components/snippet-callbacks.vue.d.ts.map +1 -1
- package/types/types/origin.d.ts +3 -3
- package/types/types/origin.d.ts.map +1 -1
- package/types/x-modules/ai/components/ai-overview.vue.d.ts +3 -1
- package/types/x-modules/ai/components/ai-overview.vue.d.ts.map +1 -1
- package/types/x-modules/ai/events.types.d.ts +1 -0
- package/types/x-modules/ai/events.types.d.ts.map +1 -1
- package/types/x-modules/ai/store/actions/fetch-and-save-ai-suggestions.action.d.ts.map +1 -1
- package/types/x-modules/ai/store/types.d.ts +5 -5
- package/types/x-modules/ai/store/types.d.ts.map +1 -1
- package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts +1 -0
- package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts +1 -0
- package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts.map +1 -1
- package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts.map +1 -1
- package/types/x-modules/tagging/wiring.d.ts +9 -0
- package/types/x-modules/tagging/wiring.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 6.0.0-alpha.140 (2025-09-11)
|
|
7
|
+
|
|
8
|
+
* refactor(sliding-panel): simplify scrolling logic and enhance reactivity (#1870) ([c659e00](https://github.com/empathyco/x/commit/c659e00)), closes [#1870](https://github.com/empathyco/x/issues/1870)
|
|
9
|
+
* chore: pr review ([6a1d503](https://github.com/empathyco/x/commit/6a1d503))
|
|
10
|
+
* feat(AiOverview): add display tagging ([73aa630](https://github.com/empathyco/x/commit/73aa630))
|
|
11
|
+
* feat(AiOverview): add toolingDisplayClick tagging ([42f1fd4](https://github.com/empathyco/x/commit/42f1fd4))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## 6.0.0-alpha.139 (2025-09-09)
|
|
7
18
|
|
|
8
19
|
* chore: pr review ([d30c56f](https://github.com/empathyco/x/commit/d30c56f))
|
|
@@ -26,5 +26,5 @@ export interface AiMutations extends ConfigMutations<AiState>, QueryMutations
|
|
|
26
26
|
| [setSuggestionsSearch](./x-components.aimutations.setsuggestionssearch.md) | | (suggestionsSearch: AiSuggestionSearch\[\]) => void | Sets the suggestions search from the suggestions search response. |
|
|
27
27
|
| [setSuggestionsSearchLoading](./x-components.aimutations.setsuggestionssearchloading.md) | | (value: boolean) => void | Sets the loading fot the suggestions search response. |
|
|
28
28
|
| [setSuggestionText](./x-components.aimutations.setsuggestiontext.md) | | (suggestionText: string) => void | Sets the suggestionText from the streamed response. |
|
|
29
|
-
| [
|
|
29
|
+
| [setTagging](./x-components.aimutations.settagging.md) | | (tagging: AiSuggestionTagging) => void | Sets the tagging from the streamed response. |
|
|
30
30
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
2
|
|
|
3
|
-
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [AiMutations](./x-components.aimutations.md) > [
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [AiMutations](./x-components.aimutations.md) > [setTagging](./x-components.aimutations.settagging.md)
|
|
4
4
|
|
|
5
|
-
## AiMutations.
|
|
5
|
+
## AiMutations.setTagging property
|
|
6
6
|
|
|
7
|
-
Sets the
|
|
7
|
+
Sets the tagging from the streamed response.
|
|
8
8
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
|
|
12
|
+
setTagging: (tagging: AiSuggestionTagging) => void;
|
|
13
13
|
```
|
|
@@ -36,7 +36,9 @@ _default: import("vue").DefineComponent<{
|
|
|
36
36
|
}>>;
|
|
37
37
|
suggestionsSearch: import("vue").ComputedRef<AiSuggestionSearch[]>;
|
|
38
38
|
suggestionText: import("vue").ComputedRef<string>;
|
|
39
|
-
|
|
39
|
+
setExpanded: (newValue: boolean) => void;
|
|
40
|
+
query: import("vue").ComputedRef<string>;
|
|
41
|
+
tagging: import("vue").ComputedRef<import("@empathyco/x-types").AiSuggestionTagging | undefined>;
|
|
40
42
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
41
43
|
title: {
|
|
42
44
|
type: PropType<string>;
|
|
@@ -26,5 +26,5 @@ export interface AiState extends QueryState
|
|
|
26
26
|
| [suggestionsSearch](./x-components.aistate.suggestionssearch.md) | | AiSuggestionSearch\[\] | The results per query retrieved by the suggestion search endpoint |
|
|
27
27
|
| [suggestionsSearchLoading](./x-components.aistate.suggestionssearchloading.md) | | boolean | Loading state for the suggestions search response |
|
|
28
28
|
| [suggestionText](./x-components.aistate.suggestiontext.md) | | string | |
|
|
29
|
-
| [
|
|
29
|
+
| [tagging](./x-components.aistate.tagging.md) | | AiSuggestionTagging \| undefined | |
|
|
30
30
|
|
package/docs/API-reference/api/{x-components.aistate.taggings.md → x-components.aistate.tagging.md}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
2
|
|
|
3
|
-
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [AiState](./x-components.aistate.md) > [
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [AiState](./x-components.aistate.md) > [tagging](./x-components.aistate.tagging.md)
|
|
4
4
|
|
|
5
|
-
## AiState.
|
|
5
|
+
## AiState.tagging property
|
|
6
6
|
|
|
7
7
|
**Signature:**
|
|
8
8
|
|
|
9
9
|
```typescript
|
|
10
|
-
|
|
10
|
+
tagging: AiSuggestionTagging | undefined;
|
|
11
11
|
```
|
|
@@ -18,4 +18,5 @@ export interface AiXEvents
|
|
|
18
18
|
| --- | --- | --- | --- |
|
|
19
19
|
| [AiSuggestionsRequestUpdated](./x-components.aixevents.aisuggestionsrequestupdated.md) | | AiSuggestionsRequest \| null | |
|
|
20
20
|
| [AiSuggestionsSearchRequestUpdated](./x-components.aixevents.aisuggestionssearchrequestupdated.md) | | AiSuggestionsSearchRequest \| null | |
|
|
21
|
+
| [UserClickedAiOverviewExpandButton](./x-components.aixevents.userclickedaioverviewexpandbutton.md) | | boolean | |
|
|
21
22
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [AiXEvents](./x-components.aixevents.md) > [UserClickedAiOverviewExpandButton](./x-components.aixevents.userclickedaioverviewexpandbutton.md)
|
|
4
|
+
|
|
5
|
+
## AiXEvents.UserClickedAiOverviewExpandButton property
|
|
6
|
+
|
|
7
|
+
**Signature:**
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
UserClickedAiOverviewExpandButton: boolean;
|
|
11
|
+
```
|
|
@@ -9,7 +9,7 @@ Indicates where the feature is placed.
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
export type FeatureLocation = 'external' | 'my_history' | 'no_query' | 'results' | 'no_results' | 'low_results' | 'none' | 'predictive_layer' | 'pdp' | 'url_history' | 'url_history_pdp' | 'related_prompts' | 'add2cart';
|
|
12
|
+
export type FeatureLocation = 'external' | 'my_history' | 'no_query' | 'results' | 'no_results' | 'low_results' | 'none' | 'predictive_layer' | 'pdp' | 'url_history' | 'url_history_pdp' | 'related_prompts' | 'add2cart' | 'overview';
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Example 1
|
|
@@ -194,6 +194,7 @@ _default: import("vue").DefineComponent<{
|
|
|
194
194
|
ReloadRelatedPromptsRequested?: void | undefined;
|
|
195
195
|
AiSuggestionsRequestUpdated?: import("@empathyco/x-types").AiSuggestionsRequest | null | undefined;
|
|
196
196
|
AiSuggestionsSearchRequestUpdated?: import("@empathyco/x-types").AiSuggestionsSearchRequest | null | undefined;
|
|
197
|
+
UserClickedAiOverviewExpandButton?: boolean | undefined;
|
|
197
198
|
}>;
|
|
198
199
|
innerCssClasses: import("vue").ComputedRef<(string | Dictionary<boolean>)[]>;
|
|
199
200
|
renderedChildrenFilters: import("vue").ComputedRef<HierarchicalFilterModel[]>;
|
|
@@ -666,6 +666,7 @@ X-Components is a library usable everywhere not only for search experiences.
|
|
|
666
666
|
| [toggleRelatedTagWire](./x-components.togglerelatedtagwire.md) | Sets the selected related tags. |
|
|
667
667
|
| [track](./x-components.track.md) | Default implementation for the [TaggingActions.track](./x-components.taggingactions.track.md)<!-- -->. |
|
|
668
668
|
| [trackAddToCartWire](./x-components.trackaddtocartwire.md) | Performs a track of a result added to the cart. |
|
|
669
|
+
| [trackAiOverviewButtonClickedWire](./x-components.trackaioverviewbuttonclickedwire.md) | Performs a track of clicking the AI overview expand button when the playload (expanded) is false. |
|
|
669
670
|
| [trackBannerClickedWire](./x-components.trackbannerclickedwire.md) | Tracks the tagging of the banner. |
|
|
670
671
|
| [trackDisplayClickedWire](./x-components.trackdisplayclickedwire.md) | Performs a track of a display result being clicked. |
|
|
671
672
|
| [trackElementDisplayedWire](./x-components.trackelementdisplayedwire.md) | Performs a track of a display element appearing. |
|
|
@@ -9,5 +9,5 @@ The name of the tool that generated the query.
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
export type QueryFeature = 'search_box' | 'url' | 'query_suggestion' | 'next_query' | 'popular_search' | 'history_query' | 'partial_result' | 'related_tag' | 'spellcheck' | 'customer' | 'semantics' | 'related_prompts';
|
|
12
|
+
export type QueryFeature = 'search_box' | 'url' | 'query_suggestion' | 'next_query' | 'popular_search' | 'history_query' | 'partial_result' | 'related_tag' | 'spellcheck' | 'customer' | 'semantics' | 'related_prompts' | 'overview';
|
|
13
13
|
```
|
|
@@ -9,5 +9,5 @@ The name of the tool that generated the results.
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
export type ResultFeature = 'search' | 'topclicked_recommendations' | 'brand_recommendations' | 'next_query_recommendations' | 'semantic_recommendations' | 'partial_results' | 'identifier_result' | 'related_prompts';
|
|
12
|
+
export type ResultFeature = 'search' | 'topclicked_recommendations' | 'brand_recommendations' | 'next_query_recommendations' | 'semantic_recommendations' | 'partial_results' | 'identifier_result' | 'related_prompts' | 'overview';
|
|
13
13
|
```
|
|
@@ -191,6 +191,7 @@ _default: import("vue").DefineComponent<{
|
|
|
191
191
|
ReloadRelatedPromptsRequested?: void | undefined;
|
|
192
192
|
AiSuggestionsRequestUpdated?: import("@empathyco/x-types").AiSuggestionsRequest | null | undefined;
|
|
193
193
|
AiSuggestionsSearchRequestUpdated?: import("@empathyco/x-types").AiSuggestionsSearchRequest | null | undefined;
|
|
194
|
+
UserClickedAiOverviewExpandButton?: boolean | undefined;
|
|
194
195
|
}>;
|
|
195
196
|
innerCssClasses: import("vue").ComputedRef<(string | Dictionary<boolean>)[]>;
|
|
196
197
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -31,14 +31,19 @@ _default: import("vue").DefineComponent<{
|
|
|
31
31
|
type: PropType<VueCSSClasses>;
|
|
32
32
|
};
|
|
33
33
|
}, {
|
|
34
|
+
arrivedState: {
|
|
35
|
+
left: boolean;
|
|
36
|
+
right: boolean;
|
|
37
|
+
top: boolean;
|
|
38
|
+
bottom: boolean;
|
|
39
|
+
};
|
|
34
40
|
cssClasses: import("vue").ComputedRef<{
|
|
35
41
|
'x-sliding-panel-at-start': boolean;
|
|
36
42
|
'x-sliding-panel-at-end': boolean;
|
|
37
43
|
}>;
|
|
38
|
-
debouncedUpdateScroll: import("../utils/types").DebouncedFunction<[]>;
|
|
39
44
|
scrollContainerRef: import("vue").Ref<HTMLDivElement | undefined>;
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
slotContainerWidth: import("vue").Ref<number>;
|
|
46
|
+
xScroll: import("vue").WritableComputedRef<number>;
|
|
42
47
|
slots: Readonly<{
|
|
43
48
|
[name: string]: import("vue").Slot<any> | undefined;
|
|
44
49
|
}>;
|
|
@@ -181,6 +181,7 @@ _default: import("vue").DefineComponent<{}, {
|
|
|
181
181
|
ReloadRelatedPromptsRequested: (payload: undefined, metadata: WireMetadata) => unknown;
|
|
182
182
|
AiSuggestionsRequestUpdated: (payload: import("@empathyco/x-types").AiSuggestionsRequest | null, metadata: WireMetadata) => unknown;
|
|
183
183
|
AiSuggestionsSearchRequestUpdated: (payload: import("@empathyco/x-types").AiSuggestionsSearchRequest | null, metadata: WireMetadata) => unknown;
|
|
184
|
+
UserClickedAiOverviewExpandButton: (payload: boolean, metadata: WireMetadata) => unknown;
|
|
184
185
|
}>>;
|
|
185
186
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>
|
|
186
187
|
```
|
|
@@ -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) > [trackAiOverviewButtonClickedWire](./x-components.trackaioverviewbuttonclickedwire.md)
|
|
4
|
+
|
|
5
|
+
## trackAiOverviewButtonClickedWire variable
|
|
6
|
+
|
|
7
|
+
Performs a track of clicking the AI overview expand button when the playload (expanded) is false.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
trackAiOverviewButtonClickedWire: Wire<any>
|
|
13
|
+
```
|
|
@@ -27,8 +27,9 @@ elements: `buttonClass`.
|
|
|
27
27
|
|
|
28
28
|
| Name | Description | Bindings<br />(name - type - description) |
|
|
29
29
|
| --------------------------------------- | -------------------------------- | ----------------------------------------- |
|
|
30
|
-
| <code>sliding-panel-left-button</code> | Left button content | None |
|
|
31
30
|
| <code>default</code> | (Required) Sliding panel content | None |
|
|
31
|
+
| <code>sliding-panel-addons</code> | | <br /> |
|
|
32
|
+
| <code>sliding-panel-left-button</code> | Left button content | None |
|
|
32
33
|
| <code>sliding-panel-right-button</code> | Right button content | None |
|
|
33
34
|
|
|
34
35
|
## Events
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _sfc_main from './sliding-panel.vue2.js';
|
|
2
|
-
import { openBlock, createElementBlock, normalizeClass, renderSlot, createTextVNode, createCommentVNode
|
|
2
|
+
import { openBlock, createElementBlock, normalizeClass, createElementVNode, renderSlot, Fragment, createTextVNode, createCommentVNode } from 'vue';
|
|
3
3
|
import './sliding-panel.vue3.js';
|
|
4
4
|
import _export_sfc from '../_virtual/_plugin-vue_export-helper.js';
|
|
5
5
|
|
|
@@ -12,53 +12,60 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
12
12
|
"data-test": "sliding-panel"
|
|
13
13
|
},
|
|
14
14
|
[
|
|
15
|
-
_ctx.showButtons ? (openBlock(), createElementBlock(
|
|
16
|
-
"button",
|
|
17
|
-
{
|
|
18
|
-
key: 0,
|
|
19
|
-
class: normalizeClass(["x-sliding-panel__button x-button x-sliding-panel-button-left", _ctx.buttonClass]),
|
|
20
|
-
"data-test": "sliding-panel-left-button",
|
|
21
|
-
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.scrollLeft && _ctx.scrollLeft(...args))
|
|
22
|
-
},
|
|
23
|
-
[
|
|
24
|
-
renderSlot(_ctx.$slots, "sliding-panel-left-button", {}, () => [
|
|
25
|
-
createTextVNode("ᐸ")
|
|
26
|
-
], true)
|
|
27
|
-
],
|
|
28
|
-
2
|
|
29
|
-
/* CLASS */
|
|
30
|
-
)) : createCommentVNode("v-if", true),
|
|
31
15
|
createElementVNode(
|
|
32
16
|
"div",
|
|
33
17
|
{
|
|
34
18
|
ref: "scrollContainerRef",
|
|
35
19
|
class: normalizeClass([_ctx.scrollContainerClass, "x-sliding-panel__scroll"]),
|
|
36
|
-
"data-test": "sliding-panel-scroll"
|
|
37
|
-
onScroll: _cache[1] || (_cache[1] = (...args) => _ctx.debouncedUpdateScroll && _ctx.debouncedUpdateScroll(...args)),
|
|
38
|
-
onTransitionend: _cache[2] || (_cache[2] = (...args) => _ctx.debouncedUpdateScroll && _ctx.debouncedUpdateScroll(...args)),
|
|
39
|
-
onAnimationend: _cache[3] || (_cache[3] = (...args) => _ctx.debouncedUpdateScroll && _ctx.debouncedUpdateScroll(...args))
|
|
20
|
+
"data-test": "sliding-panel-scroll"
|
|
40
21
|
},
|
|
41
22
|
[
|
|
42
23
|
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
43
24
|
],
|
|
44
|
-
|
|
45
|
-
/* CLASS
|
|
25
|
+
2
|
|
26
|
+
/* CLASS */
|
|
46
27
|
),
|
|
28
|
+
renderSlot(_ctx.$slots, "sliding-panel-addons", {
|
|
29
|
+
arrivedState: _ctx.arrivedState,
|
|
30
|
+
scroll: _ctx.xScroll
|
|
31
|
+
}, void 0, true),
|
|
47
32
|
_ctx.showButtons ? (openBlock(), createElementBlock(
|
|
48
|
-
|
|
49
|
-
{
|
|
50
|
-
key: 1,
|
|
51
|
-
class: normalizeClass(["x-sliding-panel__button x-button x-sliding-panel-button-right", _ctx.buttonClass]),
|
|
52
|
-
"data-test": "sliding-panel-right-button",
|
|
53
|
-
onClick: _cache[4] || (_cache[4] = (...args) => _ctx.scrollRight && _ctx.scrollRight(...args))
|
|
54
|
-
},
|
|
33
|
+
Fragment,
|
|
34
|
+
{ key: 0 },
|
|
55
35
|
[
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
36
|
+
createElementVNode(
|
|
37
|
+
"button",
|
|
38
|
+
{
|
|
39
|
+
class: normalizeClass(["x-sliding-panel__button x-button x-sliding-panel-button-left", _ctx.buttonClass]),
|
|
40
|
+
"data-test": "sliding-panel-left-button",
|
|
41
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.xScroll -= _ctx.slotContainerWidth * _ctx.scrollFactor)
|
|
42
|
+
},
|
|
43
|
+
[
|
|
44
|
+
renderSlot(_ctx.$slots, "sliding-panel-left-button", {}, () => [
|
|
45
|
+
createTextVNode("ᐸ")
|
|
46
|
+
], true)
|
|
47
|
+
],
|
|
48
|
+
2
|
|
49
|
+
/* CLASS */
|
|
50
|
+
),
|
|
51
|
+
createElementVNode(
|
|
52
|
+
"button",
|
|
53
|
+
{
|
|
54
|
+
class: normalizeClass(["x-sliding-panel__button x-button x-sliding-panel-button-right", _ctx.buttonClass]),
|
|
55
|
+
"data-test": "sliding-panel-right-button",
|
|
56
|
+
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.xScroll += _ctx.slotContainerWidth * _ctx.scrollFactor)
|
|
57
|
+
},
|
|
58
|
+
[
|
|
59
|
+
renderSlot(_ctx.$slots, "sliding-panel-right-button", {}, () => [
|
|
60
|
+
createTextVNode("ᐳ")
|
|
61
|
+
], true)
|
|
62
|
+
],
|
|
63
|
+
2
|
|
64
|
+
/* CLASS */
|
|
65
|
+
)
|
|
59
66
|
],
|
|
60
|
-
|
|
61
|
-
/*
|
|
67
|
+
64
|
|
68
|
+
/* STABLE_FRAGMENT */
|
|
62
69
|
)) : createCommentVNode("v-if", true)
|
|
63
70
|
],
|
|
64
71
|
2
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sliding-panel.vue.js","sources":["../../../src/components/sliding-panel.vue"],"sourcesContent":["<template>\n <div v-if=\"slots.default\" class=\"x-sliding-panel\" :class=\"cssClasses\" data-test=\"sliding-panel\">\n <button\n v-if=\"showButtons\"\n class=\"x-sliding-panel__button x-button x-sliding-panel-button-left\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-left-button\"\n @click=\"scrollLeft\"\n >\n <!-- @slot Left button content -->\n <slot name=\"sliding-panel-left-button\">ᐸ</slot>\n </button>\n <div\n ref=\"scrollContainerRef\"\n :class=\"scrollContainerClass\"\n class=\"x-sliding-panel__scroll\"\n data-test=\"sliding-panel-scroll\"\n @scroll=\"debouncedUpdateScroll\"\n @transitionend=\"debouncedUpdateScroll\"\n @animationend=\"debouncedUpdateScroll\"\n >\n <!-- @slot (Required) Sliding panel content -->\n <slot />\n </div>\n <button\n v-if=\"showButtons\"\n class=\"x-sliding-panel__button x-button x-sliding-panel-button-right\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-right-button\"\n @click=\"scrollRight\"\n >\n <!-- @slot Right button content -->\n <slot name=\"sliding-panel-right-button\">ᐳ</slot>\n </button>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../utils/types'\nimport { computed, defineComponent, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useDebounce } from '../composables/use-debounce'\n\n/**\n * This component allows for any other component or element inside it to be horizontally\n * navigable. It also implements customizable buttons as well as other minor customizations to its\n * general behavior.\n *\n * Additionally, this component exposes the following props to modify the classes of the\n * elements: `buttonClass`.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SlidingPanel',\n props: {\n /**\n * Scroll factor that will dictate how much the scroll moves when pressing a navigation button.\n */\n scrollFactor: {\n type: Number,\n default: 0.7,\n },\n /** Would make the navigation buttons visible when they're needed or always hide them. */\n showButtons: {\n type: Boolean,\n default: true,\n },\n /**\n * When true, whenever the DOM content in the sliding panel slot changes, it will reset\n * the scroll position to 0.\n */\n resetOnContentChange: {\n type: Boolean,\n default: true,\n },\n buttonClass: { type: [String, Object, Array] as PropType<VueCSSClasses> },\n scrollContainerClass: { type: [String, Object, Array] as PropType<VueCSSClasses> },\n },\n setup(props, { slots }) {\n /** Indicates if the scroll is at the start of the sliding panel. */\n const isScrollAtStart = ref(true)\n /** Indicates if the scroll is at the end of the sliding panel. */\n const isScrollAtEnd = ref(true)\n const scrollContainerRef = ref<HTMLDivElement>()\n\n /**\n * Updates the values of the scroll positions to show or hide the buttons depending on it.\n *\n * @remarks The 2px extra is to fix some cases in some resolutions where the scroll + client\n * size is less than the scroll width even when the scroll is at the end.\n */\n function updateScrollPosition() {\n if (scrollContainerRef.value) {\n const { scrollLeft, clientWidth, scrollWidth } = scrollContainerRef.value\n isScrollAtStart.value = !scrollLeft\n isScrollAtEnd.value = scrollLeft + clientWidth + 2 >= scrollWidth\n }\n }\n\n /**\n * Debounced version of the {@link SlidingPanel.updateScrollPosition} method.\n */\n const debouncedUpdateScroll = useDebounce(updateScrollPosition, 50, { leading: true })\n\n /**\n * Resets the scroll and updates the values of the scroll for the buttons to react.\n */\n const debouncedRestoreAndUpdateScroll = useDebounce(\n () => {\n scrollContainerRef.value!.scroll({ left: 0, behavior: 'smooth' })\n updateScrollPosition()\n },\n 50,\n { leading: true },\n )\n\n /**\n * Scrolls the wrapper element towards the provided scroll value.\n *\n * @param scrollValue - The value the scroll will go towards.\n */\n function scrollTo(scrollValue: number) {\n scrollContainerRef.value!.scrollBy({\n left: scrollValue * props.scrollFactor,\n behavior: 'smooth',\n })\n }\n\n /** Scrolls the wrapper element to the left. */\n function scrollLeft() {\n scrollTo(-scrollContainerRef.value!.clientWidth)\n }\n\n /** Scrolls the wrapper element to the right. */\n function scrollRight() {\n scrollTo(scrollContainerRef.value!.clientWidth)\n }\n\n /** CSS classes to apply based on the scroll position. */\n const cssClasses = computed(() => ({\n 'x-sliding-panel-at-start': isScrollAtStart.value,\n 'x-sliding-panel-at-end': isScrollAtEnd.value,\n }))\n\n let resizeObserver: ResizeObserver\n let contentChangedObserver: MutationObserver\n\n /**\n * Initialises browser platform code:\n * - Creates a mutation observer to detect content changes and reset scroll position.\n * - Stores initial size and scroll position values.\n */\n onMounted(() => {\n resizeObserver = new ResizeObserver(debouncedUpdateScroll)\n resizeObserver.observe(scrollContainerRef.value!)\n contentChangedObserver = new MutationObserver(debouncedRestoreAndUpdateScroll)\n\n watch(\n () => props.resetOnContentChange,\n shouldReset => {\n if (shouldReset) {\n contentChangedObserver.observe(scrollContainerRef.value!, {\n subtree: true,\n childList: true,\n attributes: false,\n characterData: false,\n })\n } else {\n contentChangedObserver.disconnect()\n }\n },\n { immediate: true },\n )\n\n updateScrollPosition()\n })\n\n onBeforeUnmount(() => {\n contentChangedObserver.disconnect()\n resizeObserver.disconnect()\n })\n\n return {\n cssClasses,\n debouncedUpdateScroll,\n scrollContainerRef,\n scrollLeft,\n scrollRight,\n slots,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-sliding-panel {\n align-items: center;\n display: flex;\n flex-flow: row nowrap;\n position: relative;\n}\n\n.x-sliding-panel__button {\n opacity: 0;\n pointer-events: none;\n position: absolute;\n transition: all ease-out 0.2s;\n z-index: 2; /* To overlay the design system gradient with z-index:1 */\n}\n.x-sliding-panel-button-left {\n left: 0;\n}\n.x-sliding-panel-button-right {\n right: 0;\n}\n\n.x-sliding-panel__scroll {\n display: flex;\n flex: 100%;\n flex-flow: row nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none; /* Firefox */\n -ms-overflow-style: none; /* IE */\n}\n\n/* Chrome, Edge & Safari */\n.x-sliding-panel__scroll::-webkit-scrollbar {\n display: none;\n}\n\n.x-sliding-panel__scroll > * {\n flex: 0 0 auto;\n}\n\n/* prettier-ignore */\n.x-sliding-panel:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-start) .x-sliding-panel-button-left {\n opacity: 1;\n pointer-events: all;\n }\n\n/* prettier-ignore */\n.x-sliding-panel:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-end) .x-sliding-panel-button-right {\n opacity: 1;\n pointer-events: all;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events.\n\n## See it in action\n\nSimplest implementation of the component, just a list-based component inside its slot.\n\n```vue\n<template>\n <SlidingPanel>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n### Play with props\n\n#### Modifying scroll buttons travel distance\n\nEdit how much the scroll travels when navigating with the buttons by changing the `scrollFactor`\nprop.\n\n```vue\n<template>\n <SlidingPanel :scrollFactor=\"1.5\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Hiding scroll buttons\n\nHide the navigational buttons completely by setting the `showButtons` prop to `false`. This is\nintended to be used when other scrolling options are available, like in mobile, where you can scroll\njust by swiping.\n\n```vue\n<template>\n <SlidingPanel :showButtons=\"false\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Customizing the content with classes\n\nThe `buttonClass` prop can be used to add classes to the buttons.\n\nThe `scrollContainerClass` prop can be used to add classes to the scroll content.\n\n```vue\n<template>\n <SlidingPanel buttonClass=\"x-button--round\" scrollContainerClass=\"x-sliding-panel-fade\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Disabling reset the scroll when content changes\n\nBy default, whenever the content of the sliding panel changes, it auto resets its scroll position.\nYou can disable this behavior setting the `resetOnContentChange` prop to `false`.\n\n```vue\n<template>\n <div>\n <button @click=\"items++\">Add item</button>\n <label>\n <input type=\"checkbox\" v-model=\"resetOnContentChange\" />\n Reset content onchange\n </label>\n <SlidingPanel :resetOnContentChange=\"resetOnContentChange\">\n <div class=\"item\" v-for=\"item in items\" :key=\"item\">Item {{ item }}</div>\n </SlidingPanel>\n </div>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n data() {\n return {\n items: 4,\n resetOnContentChange: false,\n }\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n## Extending the component\n\n### Overriding Button content\n\nBy default the buttons show an arrow depicting the direction the scroll would go to when clicked,\nbut this content can be customized with anything, from characters to SVG and images.\n\n```vue\n<template>\n <SlidingPanel>\n <template #sliding-panel-left-button>Left</template>\n <template #default>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </template>\n <template #sliding-panel-right-button>Right</template>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_createTextVNode","_createCommentVNode","_createElementVNode"],"mappings":";;;;;;AACa,EAAA,OAAA,IAAA,CAAA,KAAA,CAAM,OAAjB,IAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,IAiCM,KAAA;AAAA,IAAA;AAAA,MAlCR,GAAA,EAAA,CAAA;AAAA,MAC4B,KAAA,EAD5BC,cACkC,CAAA,CAAA,iBAAA,EAA0B,IAAU,CAAA,UAAA,CAAA,CAAA;AAAA,MAAE,WAAU,EAAA,eAAA;AAAA,KAAA;;MAEtE,IADR,CAAA,WAAA,IAAAF,SAAA,EAAA,EAAAC,kBAAA;AAAA,QASS,QAAA;AAAA,QAAA;AAAA,UAXb,GAAA,EAAA,CAAA;AAAA,UAIM,KAAA,EAJNC,cAIY,CAAA,CAAA,8DAAA,EACE,IAAW,CAAA,WAAA,CAAA,CAAA;AAAA,UACnB,WAAU,EAAA,2BAAA;AAAA,UACT,SAAK,MAAE,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAA,IAAA,CAAA,UAAA,IAAA,IAAA,CAAA,UAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA,SAAA;;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A;AAAA,UACnB,WAAU,EAAA,4BAAA;AAAA,UACT,SAAK,MAAE,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAA,IAAA,CAAA,WAAA,IAAA,IAAA,CAAA,WAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA,SAAA;;AAGR,UAAAC,UAAA,CAAgD,+CAAhD,MAAgD;AAAA,YAhCtDC,gBAgC8C,GAAC,CAAA;AAAA,WAAA,EAAA,IAAA,CAAA;;;;AAhC/C,OAAA,IAAAC,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA;AAAA,KAAA;;;AAAA,GAAA,IAAAA,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA,CAAA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"sliding-panel.vue.js","sources":["../../../src/components/sliding-panel.vue"],"sourcesContent":["<template>\n <div v-if=\"slots.default\" class=\"x-sliding-panel\" :class=\"cssClasses\" data-test=\"sliding-panel\">\n <div\n ref=\"scrollContainerRef\"\n :class=\"scrollContainerClass\"\n class=\"x-sliding-panel__scroll\"\n data-test=\"sliding-panel-scroll\"\n >\n <!-- @slot (Required) Sliding panel content -->\n <slot />\n </div>\n <slot name=\"sliding-panel-addons\" :arrived-state=\"arrivedState\" :scroll=\"xScroll\" />\n <template v-if=\"showButtons\">\n <button\n class=\"x-sliding-panel__button x-button x-sliding-panel-button-left\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-left-button\"\n @click=\"xScroll -= slotContainerWidth * scrollFactor\"\n >\n <!-- @slot Left button content -->\n <slot name=\"sliding-panel-left-button\">ᐸ</slot>\n </button>\n <button\n class=\"x-sliding-panel__button x-button x-sliding-panel-button-right\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-right-button\"\n @click=\"xScroll += slotContainerWidth * scrollFactor\"\n >\n <!-- @slot Right button content -->\n <slot name=\"sliding-panel-right-button\">ᐳ</slot>\n </button>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../utils/types'\nimport {\n useElementBounding,\n useElementVisibility,\n useMutationObserver,\n useScroll,\n whenever,\n} from '@vueuse/core'\nimport { computed, defineComponent, ref } from 'vue'\n\n/**\n * This component allows for any other component or element inside it to be horizontally\n * navigable. It also implements customizable buttons as well as other minor customizations to its\n * general behavior.\n *\n * Additionally, this component exposes the following props to modify the classes of the\n * elements: `buttonClass`.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SlidingPanel',\n props: {\n /**\n * Scroll factor that will dictate how much the scroll moves when pressing a navigation button.\n */\n scrollFactor: {\n type: Number,\n default: 0.7,\n },\n /** Would make the navigation buttons visible when they're needed or always hide them. */\n showButtons: {\n type: Boolean,\n default: true,\n },\n /**\n * When true, whenever the DOM content in the sliding panel slot changes, it will reset\n * the scroll position to 0.\n */\n resetOnContentChange: {\n type: Boolean,\n default: true,\n },\n buttonClass: { type: [String, Object, Array] as PropType<VueCSSClasses> },\n scrollContainerClass: { type: [String, Object, Array] as PropType<VueCSSClasses> },\n },\n setup(props, { slots }) {\n const scrollContainerRef = ref<HTMLDivElement>()\n\n const { width: slotContainerWidth } = useElementBounding(scrollContainerRef)\n const isVisible = useElementVisibility(scrollContainerRef)\n\n const {\n x: xScroll,\n arrivedState,\n measure,\n } = useScroll(scrollContainerRef, {\n behavior: 'smooth',\n })\n\n /** CSS classes to apply based on the scroll position. */\n const cssClasses = computed(() => ({\n 'x-sliding-panel-at-start': arrivedState.left,\n 'x-sliding-panel-at-end': arrivedState.right,\n }))\n\n if (props.resetOnContentChange) {\n useMutationObserver(\n scrollContainerRef,\n mutations => {\n if (mutations.length > 0) {\n xScroll.value = 0\n }\n },\n {\n subtree: true,\n childList: true,\n attributes: false,\n characterData: false,\n },\n )\n }\n //ensure positions are right calculated as soon as the sliding panel is shown\n whenever(isVisible, measure)\n\n return {\n arrivedState,\n cssClasses,\n scrollContainerRef,\n slotContainerWidth,\n xScroll,\n slots,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-sliding-panel {\n align-items: center;\n display: flex;\n flex-flow: row nowrap;\n position: relative;\n}\n\n.x-sliding-panel__button {\n opacity: 0;\n pointer-events: none;\n position: absolute;\n transition: all ease-out 0.2s;\n z-index: 2; /* To overlay the design system gradient with z-index:1 */\n}\n.x-sliding-panel-button-left {\n left: var(--x-sliding-panel-buttons-distance, 0);\n}\n.x-sliding-panel-button-right {\n right: var(--x-sliding-panel-buttons-distance, 0);\n}\n\n.x-sliding-panel__scroll {\n display: flex;\n flex: 100%;\n flex-flow: row nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none; /* Firefox */\n -ms-overflow-style: none; /* IE */\n}\n\n/* Chrome, Edge & Safari */\n.x-sliding-panel__scroll::-webkit-scrollbar {\n display: none;\n}\n\n.x-sliding-panel__scroll > * {\n flex: 0 0 auto;\n}\n\n/* prettier-ignore */\n.x-sliding-panel:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-start) .x-sliding-panel-button-left {\n opacity: 1;\n pointer-events: all;\n }\n\n/* prettier-ignore */\n.x-sliding-panel:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-end) .x-sliding-panel-button-right {\n opacity: 1;\n pointer-events: all;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events.\n\n## See it in action\n\nSimplest implementation of the component, just a list-based component inside its slot.\n\n```vue\n<template>\n <SlidingPanel>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n### Play with props\n\n#### Modifying scroll buttons travel distance\n\nEdit how much the scroll travels when navigating with the buttons by changing the `scrollFactor`\nprop.\n\n```vue\n<template>\n <SlidingPanel :scrollFactor=\"1.5\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Hiding scroll buttons\n\nHide the navigational buttons completely by setting the `showButtons` prop to `false`. This is\nintended to be used when other scrolling options are available, like in mobile, where you can scroll\njust by swiping.\n\n```vue\n<template>\n <SlidingPanel :showButtons=\"false\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Customizing the content with classes\n\nThe `buttonClass` prop can be used to add classes to the buttons.\n\nThe `scrollContainerClass` prop can be used to add classes to the scroll content.\n\n```vue\n<template>\n <SlidingPanel buttonClass=\"x-button--round\" scrollContainerClass=\"x-sliding-panel-fade\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Disabling reset the scroll when content changes\n\nBy default, whenever the content of the sliding panel changes, it auto resets its scroll position.\nYou can disable this behavior setting the `resetOnContentChange` prop to `false`.\n\n```vue\n<template>\n <div>\n <button @click=\"items++\">Add item</button>\n <label>\n <input type=\"checkbox\" v-model=\"resetOnContentChange\" />\n Reset content onchange\n </label>\n <SlidingPanel :resetOnContentChange=\"resetOnContentChange\">\n <div class=\"item\" v-for=\"item in items\" :key=\"item\">Item {{ item }}</div>\n </SlidingPanel>\n </div>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n data() {\n return {\n items: 4,\n resetOnContentChange: false,\n }\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n## Extending the component\n\n### Overriding Button content\n\nBy default the buttons show an arrow depicting the direction the scroll would go to when clicked,\nbut this content can be customized with anything, from characters to SVG and images.\n\n```vue\n<template>\n <SlidingPanel>\n <template #sliding-panel-left-button>Left</template>\n <template #default>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </template>\n <template #sliding-panel-right-button>Right</template>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_createElementVNode","_renderSlot","_Fragment","_createTextVNode","_createCommentVNode"],"mappings":";;;;;;AACa,EAAA,OAAA,IAAA,CAAA,KAAA,CAAM,OAAjB,IAAAA,SAAA,EAAA,EAAAC,kBAAA;A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CAA+C,8CAA/C,MAA+C;AAAA,gBApBvDE,gBAoB+C,GAAC,CAAA;AAAA,eAAA,EAAA,IAAA,CAAA;;;;;AAE1C,UAAAH,kBAAA;AAAA,YAQS,QAAA;AAAA,YAAA;AAAA,cAPP,KAAA,EAvBRD,cAuBc,CAAA,CAAA,+DAAA,EACE,IAAW,CAAA,WAAA,CAAA,CAAA;AAAA,cACnB,WAAU,EAAA,4BAAA;AAAA,cACT,OAAA,EAAK,MAAE,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,MAAA,KAAA,IAAA,CAAA,OAAA,IAAW,IAAqB,CAAA,kBAAA,GAAA,IAAA,CAAA,YAAA,CAAA;AAAA,aAAA;;AAGxC,cAAAE,UAAA,CAAgD,+CAAhD,MAAgD;AAAA,gBA7BxDE,gBA6BgD,GAAC,CAAA;AAAA,eAAA,EAAA,IAAA,CAAA;;;;;;;;AA7BjD,OAAA,IAAAC,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA;AAAA,KAAA;;;AAAA,GAAA,IAAAA,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA,CAAA;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useElementBounding, useElementVisibility, useScroll, useMutationObserver, whenever } from '@vueuse/core';
|
|
2
|
+
import { defineComponent, ref, computed } from 'vue';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* This component allows for any other component or element inside it to be horizontally
|
|
@@ -38,95 +38,37 @@ var _sfc_main = defineComponent({
|
|
|
38
38
|
scrollContainerClass: { type: [String, Object, Array] },
|
|
39
39
|
},
|
|
40
40
|
setup(props, { slots }) {
|
|
41
|
-
/** Indicates if the scroll is at the start of the sliding panel. */
|
|
42
|
-
const isScrollAtStart = ref(true);
|
|
43
|
-
/** Indicates if the scroll is at the end of the sliding panel. */
|
|
44
|
-
const isScrollAtEnd = ref(true);
|
|
45
41
|
const scrollContainerRef = ref();
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
*/
|
|
52
|
-
function updateScrollPosition() {
|
|
53
|
-
if (scrollContainerRef.value) {
|
|
54
|
-
const { scrollLeft, clientWidth, scrollWidth } = scrollContainerRef.value;
|
|
55
|
-
isScrollAtStart.value = !scrollLeft;
|
|
56
|
-
isScrollAtEnd.value = scrollLeft + clientWidth + 2 >= scrollWidth;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Debounced version of the {@link SlidingPanel.updateScrollPosition} method.
|
|
61
|
-
*/
|
|
62
|
-
const debouncedUpdateScroll = useDebounce(updateScrollPosition, 50, { leading: true });
|
|
63
|
-
/**
|
|
64
|
-
* Resets the scroll and updates the values of the scroll for the buttons to react.
|
|
65
|
-
*/
|
|
66
|
-
const debouncedRestoreAndUpdateScroll = useDebounce(() => {
|
|
67
|
-
scrollContainerRef.value.scroll({ left: 0, behavior: 'smooth' });
|
|
68
|
-
updateScrollPosition();
|
|
69
|
-
}, 50, { leading: true });
|
|
70
|
-
/**
|
|
71
|
-
* Scrolls the wrapper element towards the provided scroll value.
|
|
72
|
-
*
|
|
73
|
-
* @param scrollValue - The value the scroll will go towards.
|
|
74
|
-
*/
|
|
75
|
-
function scrollTo(scrollValue) {
|
|
76
|
-
scrollContainerRef.value.scrollBy({
|
|
77
|
-
left: scrollValue * props.scrollFactor,
|
|
78
|
-
behavior: 'smooth',
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
/** Scrolls the wrapper element to the left. */
|
|
82
|
-
function scrollLeft() {
|
|
83
|
-
scrollTo(-scrollContainerRef.value.clientWidth);
|
|
84
|
-
}
|
|
85
|
-
/** Scrolls the wrapper element to the right. */
|
|
86
|
-
function scrollRight() {
|
|
87
|
-
scrollTo(scrollContainerRef.value.clientWidth);
|
|
88
|
-
}
|
|
42
|
+
const { width: slotContainerWidth } = useElementBounding(scrollContainerRef);
|
|
43
|
+
const isVisible = useElementVisibility(scrollContainerRef);
|
|
44
|
+
const { x: xScroll, arrivedState, measure, } = useScroll(scrollContainerRef, {
|
|
45
|
+
behavior: 'smooth',
|
|
46
|
+
});
|
|
89
47
|
/** CSS classes to apply based on the scroll position. */
|
|
90
48
|
const cssClasses = computed(() => ({
|
|
91
|
-
'x-sliding-panel-at-start':
|
|
92
|
-
'x-sliding-panel-at-end':
|
|
49
|
+
'x-sliding-panel-at-start': arrivedState.left,
|
|
50
|
+
'x-sliding-panel-at-end': arrivedState.right,
|
|
93
51
|
}));
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
* - Creates a mutation observer to detect content changes and reset scroll position.
|
|
99
|
-
* - Stores initial size and scroll position values.
|
|
100
|
-
*/
|
|
101
|
-
onMounted(() => {
|
|
102
|
-
resizeObserver = new ResizeObserver(debouncedUpdateScroll);
|
|
103
|
-
resizeObserver.observe(scrollContainerRef.value);
|
|
104
|
-
contentChangedObserver = new MutationObserver(debouncedRestoreAndUpdateScroll);
|
|
105
|
-
watch(() => props.resetOnContentChange, shouldReset => {
|
|
106
|
-
if (shouldReset) {
|
|
107
|
-
contentChangedObserver.observe(scrollContainerRef.value, {
|
|
108
|
-
subtree: true,
|
|
109
|
-
childList: true,
|
|
110
|
-
attributes: false,
|
|
111
|
-
characterData: false,
|
|
112
|
-
});
|
|
52
|
+
if (props.resetOnContentChange) {
|
|
53
|
+
useMutationObserver(scrollContainerRef, mutations => {
|
|
54
|
+
if (mutations.length > 0) {
|
|
55
|
+
xScroll.value = 0;
|
|
113
56
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
});
|
|
57
|
+
}, {
|
|
58
|
+
subtree: true,
|
|
59
|
+
childList: true,
|
|
60
|
+
attributes: false,
|
|
61
|
+
characterData: false,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
//ensure positions are right calculated as soon as the sliding panel is shown
|
|
65
|
+
whenever(isVisible, measure);
|
|
124
66
|
return {
|
|
67
|
+
arrivedState,
|
|
125
68
|
cssClasses,
|
|
126
|
-
debouncedUpdateScroll,
|
|
127
69
|
scrollContainerRef,
|
|
128
|
-
|
|
129
|
-
|
|
70
|
+
slotContainerWidth,
|
|
71
|
+
xScroll,
|
|
130
72
|
slots,
|
|
131
73
|
};
|
|
132
74
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sliding-panel.vue2.js","sources":["../../../src/components/sliding-panel.vue"],"sourcesContent":["<template>\n <div v-if=\"slots.default\" class=\"x-sliding-panel\" :class=\"cssClasses\" data-test=\"sliding-panel\">\n <button\n v-if=\"showButtons\"\n class=\"x-sliding-panel__button x-button x-sliding-panel-button-left\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-left-button\"\n @click=\"scrollLeft\"\n >\n <!-- @slot Left button content -->\n <slot name=\"sliding-panel-left-button\">ᐸ</slot>\n </button>\n <div\n ref=\"scrollContainerRef\"\n :class=\"scrollContainerClass\"\n class=\"x-sliding-panel__scroll\"\n data-test=\"sliding-panel-scroll\"\n @scroll=\"debouncedUpdateScroll\"\n @transitionend=\"debouncedUpdateScroll\"\n @animationend=\"debouncedUpdateScroll\"\n >\n <!-- @slot (Required) Sliding panel content -->\n <slot />\n </div>\n <button\n v-if=\"showButtons\"\n class=\"x-sliding-panel__button x-button x-sliding-panel-button-right\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-right-button\"\n @click=\"scrollRight\"\n >\n <!-- @slot Right button content -->\n <slot name=\"sliding-panel-right-button\">ᐳ</slot>\n </button>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../utils/types'\nimport { computed, defineComponent, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport { useDebounce } from '../composables/use-debounce'\n\n/**\n * This component allows for any other component or element inside it to be horizontally\n * navigable. It also implements customizable buttons as well as other minor customizations to its\n * general behavior.\n *\n * Additionally, this component exposes the following props to modify the classes of the\n * elements: `buttonClass`.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SlidingPanel',\n props: {\n /**\n * Scroll factor that will dictate how much the scroll moves when pressing a navigation button.\n */\n scrollFactor: {\n type: Number,\n default: 0.7,\n },\n /** Would make the navigation buttons visible when they're needed or always hide them. */\n showButtons: {\n type: Boolean,\n default: true,\n },\n /**\n * When true, whenever the DOM content in the sliding panel slot changes, it will reset\n * the scroll position to 0.\n */\n resetOnContentChange: {\n type: Boolean,\n default: true,\n },\n buttonClass: { type: [String, Object, Array] as PropType<VueCSSClasses> },\n scrollContainerClass: { type: [String, Object, Array] as PropType<VueCSSClasses> },\n },\n setup(props, { slots }) {\n /** Indicates if the scroll is at the start of the sliding panel. */\n const isScrollAtStart = ref(true)\n /** Indicates if the scroll is at the end of the sliding panel. */\n const isScrollAtEnd = ref(true)\n const scrollContainerRef = ref<HTMLDivElement>()\n\n /**\n * Updates the values of the scroll positions to show or hide the buttons depending on it.\n *\n * @remarks The 2px extra is to fix some cases in some resolutions where the scroll + client\n * size is less than the scroll width even when the scroll is at the end.\n */\n function updateScrollPosition() {\n if (scrollContainerRef.value) {\n const { scrollLeft, clientWidth, scrollWidth } = scrollContainerRef.value\n isScrollAtStart.value = !scrollLeft\n isScrollAtEnd.value = scrollLeft + clientWidth + 2 >= scrollWidth\n }\n }\n\n /**\n * Debounced version of the {@link SlidingPanel.updateScrollPosition} method.\n */\n const debouncedUpdateScroll = useDebounce(updateScrollPosition, 50, { leading: true })\n\n /**\n * Resets the scroll and updates the values of the scroll for the buttons to react.\n */\n const debouncedRestoreAndUpdateScroll = useDebounce(\n () => {\n scrollContainerRef.value!.scroll({ left: 0, behavior: 'smooth' })\n updateScrollPosition()\n },\n 50,\n { leading: true },\n )\n\n /**\n * Scrolls the wrapper element towards the provided scroll value.\n *\n * @param scrollValue - The value the scroll will go towards.\n */\n function scrollTo(scrollValue: number) {\n scrollContainerRef.value!.scrollBy({\n left: scrollValue * props.scrollFactor,\n behavior: 'smooth',\n })\n }\n\n /** Scrolls the wrapper element to the left. */\n function scrollLeft() {\n scrollTo(-scrollContainerRef.value!.clientWidth)\n }\n\n /** Scrolls the wrapper element to the right. */\n function scrollRight() {\n scrollTo(scrollContainerRef.value!.clientWidth)\n }\n\n /** CSS classes to apply based on the scroll position. */\n const cssClasses = computed(() => ({\n 'x-sliding-panel-at-start': isScrollAtStart.value,\n 'x-sliding-panel-at-end': isScrollAtEnd.value,\n }))\n\n let resizeObserver: ResizeObserver\n let contentChangedObserver: MutationObserver\n\n /**\n * Initialises browser platform code:\n * - Creates a mutation observer to detect content changes and reset scroll position.\n * - Stores initial size and scroll position values.\n */\n onMounted(() => {\n resizeObserver = new ResizeObserver(debouncedUpdateScroll)\n resizeObserver.observe(scrollContainerRef.value!)\n contentChangedObserver = new MutationObserver(debouncedRestoreAndUpdateScroll)\n\n watch(\n () => props.resetOnContentChange,\n shouldReset => {\n if (shouldReset) {\n contentChangedObserver.observe(scrollContainerRef.value!, {\n subtree: true,\n childList: true,\n attributes: false,\n characterData: false,\n })\n } else {\n contentChangedObserver.disconnect()\n }\n },\n { immediate: true },\n )\n\n updateScrollPosition()\n })\n\n onBeforeUnmount(() => {\n contentChangedObserver.disconnect()\n resizeObserver.disconnect()\n })\n\n return {\n cssClasses,\n debouncedUpdateScroll,\n scrollContainerRef,\n scrollLeft,\n scrollRight,\n slots,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-sliding-panel {\n align-items: center;\n display: flex;\n flex-flow: row nowrap;\n position: relative;\n}\n\n.x-sliding-panel__button {\n opacity: 0;\n pointer-events: none;\n position: absolute;\n transition: all ease-out 0.2s;\n z-index: 2; /* To overlay the design system gradient with z-index:1 */\n}\n.x-sliding-panel-button-left {\n left: 0;\n}\n.x-sliding-panel-button-right {\n right: 0;\n}\n\n.x-sliding-panel__scroll {\n display: flex;\n flex: 100%;\n flex-flow: row nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none; /* Firefox */\n -ms-overflow-style: none; /* IE */\n}\n\n/* Chrome, Edge & Safari */\n.x-sliding-panel__scroll::-webkit-scrollbar {\n display: none;\n}\n\n.x-sliding-panel__scroll > * {\n flex: 0 0 auto;\n}\n\n/* prettier-ignore */\n.x-sliding-panel:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-start) .x-sliding-panel-button-left {\n opacity: 1;\n pointer-events: all;\n }\n\n/* prettier-ignore */\n.x-sliding-panel:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-end) .x-sliding-panel-button-right {\n opacity: 1;\n pointer-events: all;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events.\n\n## See it in action\n\nSimplest implementation of the component, just a list-based component inside its slot.\n\n```vue\n<template>\n <SlidingPanel>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n### Play with props\n\n#### Modifying scroll buttons travel distance\n\nEdit how much the scroll travels when navigating with the buttons by changing the `scrollFactor`\nprop.\n\n```vue\n<template>\n <SlidingPanel :scrollFactor=\"1.5\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Hiding scroll buttons\n\nHide the navigational buttons completely by setting the `showButtons` prop to `false`. This is\nintended to be used when other scrolling options are available, like in mobile, where you can scroll\njust by swiping.\n\n```vue\n<template>\n <SlidingPanel :showButtons=\"false\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Customizing the content with classes\n\nThe `buttonClass` prop can be used to add classes to the buttons.\n\nThe `scrollContainerClass` prop can be used to add classes to the scroll content.\n\n```vue\n<template>\n <SlidingPanel buttonClass=\"x-button--round\" scrollContainerClass=\"x-sliding-panel-fade\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Disabling reset the scroll when content changes\n\nBy default, whenever the content of the sliding panel changes, it auto resets its scroll position.\nYou can disable this behavior setting the `resetOnContentChange` prop to `false`.\n\n```vue\n<template>\n <div>\n <button @click=\"items++\">Add item</button>\n <label>\n <input type=\"checkbox\" v-model=\"resetOnContentChange\" />\n Reset content onchange\n </label>\n <SlidingPanel :resetOnContentChange=\"resetOnContentChange\">\n <div class=\"item\" v-for=\"item in items\" :key=\"item\">Item {{ item }}</div>\n </SlidingPanel>\n </div>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n data() {\n return {\n items: 4,\n resetOnContentChange: false,\n }\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n## Extending the component\n\n### Overriding Button content\n\nBy default the buttons show an arrow depicting the direction the scroll would go to when clicked,\nbut this content can be customized with anything, from characters to SVG and images.\n\n```vue\n<template>\n <SlidingPanel>\n <template #sliding-panel-left-button>Left</template>\n <template #default>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </template>\n <template #sliding-panel-right-button>Right</template>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n</docs>\n"],"names":[],"mappings":";;;AA2CA;;;;;;;;;AASE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,cAAc;AACpB,IAAA,KAAK,EAAE;AACL;;AAEE;AACF,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,GAAG;AACb,SAAA;;AAED,QAAA,WAAW,EAAE;AACX,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACD;;;AAGE;AACF,QAAA,oBAAoB,EAAE;AACpB,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;QACD,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,GAA8B;QACzE,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;YAClC,cAAc,CAAC,UAAU,EAAC,CAAA;AAC5B,SAAC,CAAA,CAAA;QAED,OAAO;YACL,UAAU;YACV,qBAAqB;YACrB,kBAAkB;YAClB,UAAU;YACV,WAAW;YACX,KAAK;SACP,CAAA;KACD;AACF,CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"sliding-panel.vue2.js","sources":["../../../src/components/sliding-panel.vue"],"sourcesContent":["<template>\n <div v-if=\"slots.default\" class=\"x-sliding-panel\" :class=\"cssClasses\" data-test=\"sliding-panel\">\n <div\n ref=\"scrollContainerRef\"\n :class=\"scrollContainerClass\"\n class=\"x-sliding-panel__scroll\"\n data-test=\"sliding-panel-scroll\"\n >\n <!-- @slot (Required) Sliding panel content -->\n <slot />\n </div>\n <slot name=\"sliding-panel-addons\" :arrived-state=\"arrivedState\" :scroll=\"xScroll\" />\n <template v-if=\"showButtons\">\n <button\n class=\"x-sliding-panel__button x-button x-sliding-panel-button-left\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-left-button\"\n @click=\"xScroll -= slotContainerWidth * scrollFactor\"\n >\n <!-- @slot Left button content -->\n <slot name=\"sliding-panel-left-button\">ᐸ</slot>\n </button>\n <button\n class=\"x-sliding-panel__button x-button x-sliding-panel-button-right\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-right-button\"\n @click=\"xScroll += slotContainerWidth * scrollFactor\"\n >\n <!-- @slot Right button content -->\n <slot name=\"sliding-panel-right-button\">ᐳ</slot>\n </button>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../utils/types'\nimport {\n useElementBounding,\n useElementVisibility,\n useMutationObserver,\n useScroll,\n whenever,\n} from '@vueuse/core'\nimport { computed, defineComponent, ref } from 'vue'\n\n/**\n * This component allows for any other component or element inside it to be horizontally\n * navigable. It also implements customizable buttons as well as other minor customizations to its\n * general behavior.\n *\n * Additionally, this component exposes the following props to modify the classes of the\n * elements: `buttonClass`.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SlidingPanel',\n props: {\n /**\n * Scroll factor that will dictate how much the scroll moves when pressing a navigation button.\n */\n scrollFactor: {\n type: Number,\n default: 0.7,\n },\n /** Would make the navigation buttons visible when they're needed or always hide them. */\n showButtons: {\n type: Boolean,\n default: true,\n },\n /**\n * When true, whenever the DOM content in the sliding panel slot changes, it will reset\n * the scroll position to 0.\n */\n resetOnContentChange: {\n type: Boolean,\n default: true,\n },\n buttonClass: { type: [String, Object, Array] as PropType<VueCSSClasses> },\n scrollContainerClass: { type: [String, Object, Array] as PropType<VueCSSClasses> },\n },\n setup(props, { slots }) {\n const scrollContainerRef = ref<HTMLDivElement>()\n\n const { width: slotContainerWidth } = useElementBounding(scrollContainerRef)\n const isVisible = useElementVisibility(scrollContainerRef)\n\n const {\n x: xScroll,\n arrivedState,\n measure,\n } = useScroll(scrollContainerRef, {\n behavior: 'smooth',\n })\n\n /** CSS classes to apply based on the scroll position. */\n const cssClasses = computed(() => ({\n 'x-sliding-panel-at-start': arrivedState.left,\n 'x-sliding-panel-at-end': arrivedState.right,\n }))\n\n if (props.resetOnContentChange) {\n useMutationObserver(\n scrollContainerRef,\n mutations => {\n if (mutations.length > 0) {\n xScroll.value = 0\n }\n },\n {\n subtree: true,\n childList: true,\n attributes: false,\n characterData: false,\n },\n )\n }\n //ensure positions are right calculated as soon as the sliding panel is shown\n whenever(isVisible, measure)\n\n return {\n arrivedState,\n cssClasses,\n scrollContainerRef,\n slotContainerWidth,\n xScroll,\n slots,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-sliding-panel {\n align-items: center;\n display: flex;\n flex-flow: row nowrap;\n position: relative;\n}\n\n.x-sliding-panel__button {\n opacity: 0;\n pointer-events: none;\n position: absolute;\n transition: all ease-out 0.2s;\n z-index: 2; /* To overlay the design system gradient with z-index:1 */\n}\n.x-sliding-panel-button-left {\n left: var(--x-sliding-panel-buttons-distance, 0);\n}\n.x-sliding-panel-button-right {\n right: var(--x-sliding-panel-buttons-distance, 0);\n}\n\n.x-sliding-panel__scroll {\n display: flex;\n flex: 100%;\n flex-flow: row nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none; /* Firefox */\n -ms-overflow-style: none; /* IE */\n}\n\n/* Chrome, Edge & Safari */\n.x-sliding-panel__scroll::-webkit-scrollbar {\n display: none;\n}\n\n.x-sliding-panel__scroll > * {\n flex: 0 0 auto;\n}\n\n/* prettier-ignore */\n.x-sliding-panel:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-start) .x-sliding-panel-button-left {\n opacity: 1;\n pointer-events: all;\n }\n\n/* prettier-ignore */\n.x-sliding-panel:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-end) .x-sliding-panel-button-right {\n opacity: 1;\n pointer-events: all;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events.\n\n## See it in action\n\nSimplest implementation of the component, just a list-based component inside its slot.\n\n```vue\n<template>\n <SlidingPanel>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n### Play with props\n\n#### Modifying scroll buttons travel distance\n\nEdit how much the scroll travels when navigating with the buttons by changing the `scrollFactor`\nprop.\n\n```vue\n<template>\n <SlidingPanel :scrollFactor=\"1.5\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Hiding scroll buttons\n\nHide the navigational buttons completely by setting the `showButtons` prop to `false`. This is\nintended to be used when other scrolling options are available, like in mobile, where you can scroll\njust by swiping.\n\n```vue\n<template>\n <SlidingPanel :showButtons=\"false\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Customizing the content with classes\n\nThe `buttonClass` prop can be used to add classes to the buttons.\n\nThe `scrollContainerClass` prop can be used to add classes to the scroll content.\n\n```vue\n<template>\n <SlidingPanel buttonClass=\"x-button--round\" scrollContainerClass=\"x-sliding-panel-fade\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Disabling reset the scroll when content changes\n\nBy default, whenever the content of the sliding panel changes, it auto resets its scroll position.\nYou can disable this behavior setting the `resetOnContentChange` prop to `false`.\n\n```vue\n<template>\n <div>\n <button @click=\"items++\">Add item</button>\n <label>\n <input type=\"checkbox\" v-model=\"resetOnContentChange\" />\n Reset content onchange\n </label>\n <SlidingPanel :resetOnContentChange=\"resetOnContentChange\">\n <div class=\"item\" v-for=\"item in items\" :key=\"item\">Item {{ item }}</div>\n </SlidingPanel>\n </div>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n data() {\n return {\n items: 4,\n resetOnContentChange: false,\n }\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n## Extending the component\n\n### Overriding Button content\n\nBy default the buttons show an arrow depicting the direction the scroll would go to when clicked,\nbut this content can be customized with anything, from characters to SVG and images.\n\n```vue\n<template>\n <SlidingPanel>\n <template #sliding-panel-left-button>Left</template>\n <template #default>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </template>\n <template #sliding-panel-right-button>Right</template>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n</docs>\n"],"names":[],"mappings":";;;AA+CA;;;;;;;;;AASE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,cAAc;AACpB,IAAA,KAAK,EAAE;AACL;;AAEE;AACF,QAAA,YAAY,EAAE;AACZ,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,GAAG;AACb,SAAA;;AAED,QAAA,WAAW,EAAE;AACX,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACD;;;AAGE;AACF,QAAA,oBAAoB,EAAE;AACpB,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;QACD,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,MA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A;KACD;AACF,CAAA,CAAA;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import injectCss from '../../tools/inject-css.js';
|
|
2
2
|
|
|
3
|
-
var css = ".x-sliding-panel[data-v-9402d5ce]{align-items:center;display:flex;flex-flow:row nowrap;position:relative}.x-sliding-panel__button[data-v-9402d5ce]{opacity:0;pointer-events:none;position:absolute;transition:all .2s ease-out;z-index:2}.x-sliding-panel-button-left[data-v-9402d5ce]{left:0}.x-sliding-panel-button-right[data-v-9402d5ce]{right:0}.x-sliding-panel__scroll[data-v-9402d5ce]{-ms-overflow-style:none;display:flex;flex:100%;flex-flow:row nowrap;overflow-x:auto;overflow-y:hidden;scrollbar-width:none}.x-sliding-panel__scroll[data-v-9402d5ce]::-webkit-scrollbar{display:none}.x-sliding-panel__scroll[data-v-9402d5ce]>*{flex:0 0 auto}.x-sliding-panel:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-end) .x-sliding-panel-button-right[data-v-9402d5ce],.x-sliding-panel:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-start) .x-sliding-panel-button-left[data-v-9402d5ce]{opacity:1;pointer-events:all}";
|
|
3
|
+
var css = ".x-sliding-panel[data-v-9402d5ce]{align-items:center;display:flex;flex-flow:row nowrap;position:relative}.x-sliding-panel__button[data-v-9402d5ce]{opacity:0;pointer-events:none;position:absolute;transition:all .2s ease-out;z-index:2}.x-sliding-panel-button-left[data-v-9402d5ce]{left:var(--x-sliding-panel-buttons-distance,0)}.x-sliding-panel-button-right[data-v-9402d5ce]{right:var(--x-sliding-panel-buttons-distance,0)}.x-sliding-panel__scroll[data-v-9402d5ce]{-ms-overflow-style:none;display:flex;flex:100%;flex-flow:row nowrap;overflow-x:auto;overflow-y:hidden;scrollbar-width:none}.x-sliding-panel__scroll[data-v-9402d5ce]::-webkit-scrollbar{display:none}.x-sliding-panel__scroll[data-v-9402d5ce]>*{flex:0 0 auto}.x-sliding-panel:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-end) .x-sliding-panel-button-right[data-v-9402d5ce],.x-sliding-panel:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-start) .x-sliding-panel-button-left[data-v-9402d5ce]{opacity:1;pointer-events:all}";
|
|
4
4
|
injectCss(css);
|
|
5
5
|
|
|
6
6
|
export { css, css as default };
|