@empathyco/x-components 10.0.1 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/core/index.js +1 -0
- package/core/index.js.map +1 -1
- package/docs/API-reference/api/x-components.arialabels.md +19 -0
- package/docs/API-reference/api/x-components.arialabels.tabs.md +13 -0
- package/docs/API-reference/api/x-components.extraparamsstate.catalogsectionparamkey.md +18 -0
- package/docs/API-reference/api/x-components.extraparamsstate.md +19 -0
- package/docs/API-reference/api/x-components.hierarchicalfilter.md +1 -0
- package/docs/API-reference/api/x-components.md +77 -0
- package/docs/API-reference/api/x-components.resetcatalogsection.md +13 -0
- package/docs/API-reference/api/x-components.reseturlcatalogsection.md +13 -0
- package/docs/API-reference/api/x-components.searchconfig.defaultcatalogsection.md +13 -0
- package/docs/API-reference/api/x-components.searchconfig.md +19 -0
- package/docs/API-reference/api/x-components.searchmutations.md +19 -0
- package/docs/API-reference/api/x-components.searchmutations.setcatalogsection.md +13 -0
- package/docs/API-reference/api/x-components.searchstate.catalogsection.md +13 -0
- package/docs/API-reference/api/x-components.searchstate.md +19 -0
- package/docs/API-reference/api/x-components.setcatalogsection.md +13 -0
- package/docs/API-reference/api/x-components.setcatalogsectionfromurl.md +13 -0
- package/docs/API-reference/api/x-components.seturlcatalogsection.md +13 -0
- package/docs/API-reference/api/x-components.seturlparams.md +1 -1
- package/docs/API-reference/api/x-components.simplefilter.md +1 -0
- package/docs/API-reference/api/x-components.snippetcallbacks.md +1 -0
- package/docs/API-reference/api/x-components.tab.click.md +13 -0
- package/docs/API-reference/api/x-components.tab.id.md +13 -0
- package/docs/API-reference/api/x-components.tab.label.md +13 -0
- package/docs/API-reference/api/x-components.tab.md +115 -0
- package/docs/API-reference/api/x-components.tab.selected.md +13 -0
- package/docs/API-reference/api/x-components.tabs.md +29 -0
- package/docs/API-reference/api/x-components.urlmutations.md +19 -0
- package/docs/API-reference/api/x-components.urlmutations.setcatalogsection.md +13 -0
- package/docs/API-reference/api/x-components.urlparams.catalogsection.md +11 -0
- package/docs/API-reference/api/x-components.urlparams.md +17 -0
- package/docs/API-reference/api/x-components.xeventstypes.md +19 -0
- package/docs/API-reference/api/x-components.xeventstypes.userselectedacatalogsection.md +13 -0
- package/docs/API-reference/components/common/tabs/x-components.tabs.md +24 -0
- package/js/components/tabs/tabs.vue.js +44 -0
- package/js/components/tabs/tabs.vue.js.map +1 -0
- package/js/components/tabs/tabs.vue2.js +44 -0
- package/js/components/tabs/tabs.vue2.js.map +1 -0
- package/js/index.js +3 -2
- package/js/index.js.map +1 -1
- package/js/types/accessibility.js.map +1 -1
- package/js/x-modules/ai/components/ai-carousel.vue2.js +1 -0
- package/js/x-modules/ai/components/ai-carousel.vue2.js.map +1 -1
- package/js/x-modules/ai/components/ai-grouped-carousel.vue2.js +1 -0
- package/js/x-modules/ai/components/ai-grouped-carousel.vue2.js.map +1 -1
- package/js/x-modules/empathize/components/empathize.vue2.js +1 -0
- package/js/x-modules/empathize/components/empathize.vue2.js.map +1 -1
- package/js/x-modules/extra-params/store/emitters.js +23 -2
- package/js/x-modules/extra-params/store/emitters.js.map +1 -1
- package/js/x-modules/extra-params/store/module.js +1 -0
- package/js/x-modules/extra-params/store/module.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview-button.vue2.js +1 -0
- package/js/x-modules/queries-preview/components/query-preview-button.vue2.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview.vue2.js +1 -0
- package/js/x-modules/queries-preview/components/query-preview.vue2.js.map +1 -1
- package/js/x-modules/scroll/components/scroll-to-top.vue2.js +1 -0
- package/js/x-modules/scroll/components/scroll-to-top.vue2.js.map +1 -1
- package/js/x-modules/search/store/getters/request.getter.js +24 -10
- package/js/x-modules/search/store/getters/request.getter.js.map +1 -1
- package/js/x-modules/search/store/module.js +5 -0
- package/js/x-modules/search/store/module.js.map +1 -1
- package/js/x-modules/search/wiring.js +29 -1
- package/js/x-modules/search/wiring.js.map +1 -1
- package/js/x-modules/tagging/wiring.js +2 -1
- package/js/x-modules/tagging/wiring.js.map +1 -1
- package/js/x-modules/url/components/url-handler.vue.js.map +1 -1
- package/js/x-modules/url/components/url-handler.vue2.js +6 -2
- package/js/x-modules/url/components/url-handler.vue2.js.map +1 -1
- package/js/x-modules/url/store/initial-state.js +1 -0
- package/js/x-modules/url/store/initial-state.js.map +1 -1
- package/js/x-modules/url/store/module.js +3 -0
- package/js/x-modules/url/store/module.js.map +1 -1
- package/js/x-modules/url/wiring.js +19 -1
- package/js/x-modules/url/wiring.js.map +1 -1
- package/package.json +3 -3
- package/report/x-components.api.json +671 -5
- package/report/x-components.api.md +77 -6
- package/search/index.js +1 -1
- package/types/src/components/index.d.ts +1 -0
- package/types/src/components/index.d.ts.map +1 -1
- package/types/src/components/snippet-callbacks.vue.d.ts +1 -0
- package/types/src/components/snippet-callbacks.vue.d.ts.map +1 -1
- package/types/src/components/tabs/index.d.ts +3 -0
- package/types/src/components/tabs/index.d.ts.map +1 -0
- package/types/src/components/tabs/tab.types.d.ts +16 -0
- package/types/src/components/tabs/tab.types.d.ts.map +1 -0
- package/types/src/components/tabs/tabs.vue.d.ts +48 -0
- package/types/src/components/tabs/tabs.vue.d.ts.map +1 -0
- package/types/src/types/accessibility.d.ts +3 -0
- package/types/src/types/accessibility.d.ts.map +1 -1
- package/types/src/types/url-params.d.ts +1 -0
- package/types/src/types/url-params.d.ts.map +1 -1
- package/types/src/wiring/events.types.d.ts +5 -0
- package/types/src/wiring/events.types.d.ts.map +1 -1
- package/types/src/x-modules/extra-params/store/emitters.d.ts +4 -1
- package/types/src/x-modules/extra-params/store/emitters.d.ts.map +1 -1
- package/types/src/x-modules/extra-params/store/module.d.ts.map +1 -1
- package/types/src/x-modules/extra-params/store/types.d.ts +8 -0
- package/types/src/x-modules/extra-params/store/types.d.ts.map +1 -1
- package/types/src/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts +1 -0
- package/types/src/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts.map +1 -1
- package/types/src/x-modules/facets/components/filters/simple-filter.vue.d.ts +1 -0
- package/types/src/x-modules/facets/components/filters/simple-filter.vue.d.ts.map +1 -1
- package/types/src/x-modules/search/config.types.d.ts +5 -0
- package/types/src/x-modules/search/config.types.d.ts.map +1 -1
- package/types/src/x-modules/search/store/getters/request.getter.d.ts +2 -0
- package/types/src/x-modules/search/store/getters/request.getter.d.ts.map +1 -1
- package/types/src/x-modules/search/store/module.d.ts.map +1 -1
- package/types/src/x-modules/search/store/types.d.ts +14 -0
- package/types/src/x-modules/search/store/types.d.ts.map +1 -1
- package/types/src/x-modules/search/wiring.d.ts +31 -2
- package/types/src/x-modules/search/wiring.d.ts.map +1 -1
- package/types/src/x-modules/tagging/wiring.d.ts.map +1 -1
- package/types/src/x-modules/url/components/url-handler.vue.d.ts.map +1 -1
- package/types/src/x-modules/url/store/initial-state.d.ts.map +1 -1
- package/types/src/x-modules/url/store/module.d.ts.map +1 -1
- package/types/src/x-modules/url/store/types.d.ts +6 -0
- package/types/src/x-modules/url/store/types.d.ts.map +1 -1
- package/types/src/x-modules/url/wiring.d.ts +18 -0
- package/types/src/x-modules/url/wiring.d.ts.map +1 -1
- package/url/index.js +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [Tabs](./x-components.tabs.md)
|
|
4
|
+
|
|
5
|
+
## Tabs variable
|
|
6
|
+
|
|
7
|
+
Renders a list of tabs from the given `items`<!-- -->. It keeps track of the selected tab internally: clicking a tab marks it as selected and invokes its `click` callback.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
_default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
13
|
+
items: {
|
|
14
|
+
type: PropType<Tab[]>;
|
|
15
|
+
required: true;
|
|
16
|
+
};
|
|
17
|
+
itemClasses: StringConstructor;
|
|
18
|
+
}>, {
|
|
19
|
+
ariaLabels: import("vue").ComputedRef<{
|
|
20
|
+
root?: string;
|
|
21
|
+
}>;
|
|
22
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
23
|
+
items: {
|
|
24
|
+
type: PropType<Tab[]>;
|
|
25
|
+
required: true;
|
|
26
|
+
};
|
|
27
|
+
itemClasses: StringConstructor;
|
|
28
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>
|
|
29
|
+
```
|
|
@@ -54,6 +54,25 @@ Description
|
|
|
54
54
|
Sets the new browseCategory.
|
|
55
55
|
|
|
56
56
|
|
|
57
|
+
</td></tr>
|
|
58
|
+
<tr><td>
|
|
59
|
+
|
|
60
|
+
[setCatalogSection](./x-components.urlmutations.setcatalogsection.md)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
</td><td>
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
</td><td>
|
|
67
|
+
|
|
68
|
+
(catalogSection: string) => void
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
</td><td>
|
|
72
|
+
|
|
73
|
+
Sets the new catalog section of the url, the id of the selected catalog section.
|
|
74
|
+
|
|
75
|
+
|
|
57
76
|
</td></tr>
|
|
58
77
|
<tr><td>
|
|
59
78
|
|
|
@@ -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) > [UrlMutations](./x-components.urlmutations.md) > [setCatalogSection](./x-components.urlmutations.setcatalogsection.md)
|
|
4
|
+
|
|
5
|
+
## UrlMutations.setCatalogSection property
|
|
6
|
+
|
|
7
|
+
Sets the new catalog section of the url, the id of the selected catalog section.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
setCatalogSection: (catalogSection: string) => void;
|
|
13
|
+
```
|
|
@@ -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) > [UrlParams](./x-components.urlparams.md) > [catalogSection](./x-components.urlparams.catalogsection.md)
|
|
4
|
+
|
|
5
|
+
## UrlParams.catalogSection property
|
|
6
|
+
|
|
7
|
+
**Signature:**
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
catalogSection: string;
|
|
11
|
+
```
|
|
@@ -554,6 +554,25 @@ void
|
|
|
554
554
|
The user has reached the top of the empathize and keeps navigating in that direction. Payload: none.
|
|
555
555
|
|
|
556
556
|
|
|
557
|
+
</td></tr>
|
|
558
|
+
<tr><td>
|
|
559
|
+
|
|
560
|
+
[UserSelectedACatalogSection](./x-components.xeventstypes.userselectedacatalogsection.md)
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
</td><td>
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
</td><td>
|
|
567
|
+
|
|
568
|
+
string
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
</td><td>
|
|
572
|
+
|
|
573
|
+
The user selected a catalog section. Payload: String containing the id of the selected catalog section.
|
|
574
|
+
|
|
575
|
+
|
|
557
576
|
</td></tr>
|
|
558
577
|
<tr><td>
|
|
559
578
|
|
|
@@ -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) > [XEventsTypes](./x-components.xeventstypes.md) > [UserSelectedACatalogSection](./x-components.xeventstypes.userselectedacatalogsection.md)
|
|
4
|
+
|
|
5
|
+
## XEventsTypes.UserSelectedACatalogSection property
|
|
6
|
+
|
|
7
|
+
The user selected a catalog section. Payload: String containing the id of the selected catalog section.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
UserSelectedACatalogSection: string;
|
|
13
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
|
|
3
|
+
title: Tabs
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Tabs
|
|
8
|
+
|
|
9
|
+
Renders a list of tabs from the given `items`. It keeps track of the
|
|
10
|
+
selected tab internally: clicking a tab marks it as selected and invokes
|
|
11
|
+
its `click` callback.
|
|
12
|
+
|
|
13
|
+
## Props
|
|
14
|
+
|
|
15
|
+
| Name | Description | Type | Default |
|
|
16
|
+
| ------------------------ | ------------------------- | ------------------- | ------------- |
|
|
17
|
+
| <code>items</code> | The tabs to render. | <code>Tab[]</code> | <code></code> |
|
|
18
|
+
| <code>itemClasses</code> | The classes for tab item. | <code>string</code> | <code></code> |
|
|
19
|
+
|
|
20
|
+
## Slots
|
|
21
|
+
|
|
22
|
+
| Name | Description | Bindings<br />(name - type - description) |
|
|
23
|
+
| -------------------- | ----------- | ----------------------------------------- |
|
|
24
|
+
| <code>default</code> | | |
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import _sfc_main from './tabs.vue2.js';
|
|
2
|
+
import { openBlock, createElementBlock, Fragment, renderList, normalizeClass, renderSlot, createTextVNode, toDisplayString } from 'vue';
|
|
3
|
+
import _export_sfc from '../../_virtual/_plugin-vue_export-helper.js';
|
|
4
|
+
|
|
5
|
+
const _hoisted_1 = ["aria-label"];
|
|
6
|
+
const _hoisted_2 = ["aria-selected", "onClick"];
|
|
7
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
8
|
+
return openBlock(), createElementBlock("nav", {
|
|
9
|
+
class: "xds:tabs",
|
|
10
|
+
"data-test": "tabs",
|
|
11
|
+
"aria-label": _ctx.ariaLabels?.root,
|
|
12
|
+
role: "tablist"
|
|
13
|
+
}, [
|
|
14
|
+
(openBlock(true), createElementBlock(
|
|
15
|
+
Fragment,
|
|
16
|
+
null,
|
|
17
|
+
renderList(_ctx.items, (item) => {
|
|
18
|
+
return openBlock(), createElementBlock("button", {
|
|
19
|
+
key: item.id,
|
|
20
|
+
type: "button",
|
|
21
|
+
class: normalizeClass(["xds:tab", [_ctx.itemClasses, { "xds:selected": item.selected }]]),
|
|
22
|
+
"data-test": "tab",
|
|
23
|
+
role: "tab",
|
|
24
|
+
"aria-selected": item.selected,
|
|
25
|
+
onClick: ($event) => item.click()
|
|
26
|
+
}, [
|
|
27
|
+
renderSlot(_ctx.$slots, "default", { item }, () => [
|
|
28
|
+
createTextVNode(
|
|
29
|
+
toDisplayString(item.label),
|
|
30
|
+
1
|
|
31
|
+
/* TEXT */
|
|
32
|
+
)
|
|
33
|
+
])
|
|
34
|
+
], 10, _hoisted_2);
|
|
35
|
+
}),
|
|
36
|
+
128
|
|
37
|
+
/* KEYED_FRAGMENT */
|
|
38
|
+
))
|
|
39
|
+
], 8, _hoisted_1);
|
|
40
|
+
}
|
|
41
|
+
var tabs = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
42
|
+
|
|
43
|
+
export { tabs as default };
|
|
44
|
+
//# sourceMappingURL=tabs.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.vue.js","sources":["../../../../src/components/tabs/tabs.vue"],"sourcesContent":["<template>\n <nav class=\"xds:tabs\" data-test=\"tabs\" :aria-label=\"ariaLabels?.root\" role=\"tablist\">\n <button\n v-for=\"item in items\"\n :key=\"item.id\"\n type=\"button\"\n class=\"xds:tab\"\n :class=\"[itemClasses, { 'xds:selected': item.selected }]\"\n data-test=\"tab\"\n role=\"tab\"\n :aria-selected=\"item.selected\"\n @click=\"item.click()\"\n >\n <slot :item=\"item\">{{ item.label }}</slot>\n </button>\n </nav>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { Tab } from './tab.types'\nimport { useAccessibilityLabels } from '@x/composables'\nimport { defineComponent } from 'vue'\n\n/**\n * Renders a list of tabs from the given `items`. It keeps track of the\n * selected tab internally: clicking a tab marks it as selected and invokes\n * its `click` callback.\n *\n * @public\n */\nexport default defineComponent({\n name: 'Tabs',\n props: {\n /**\n * The tabs to render.\n *\n * @public\n */\n items: {\n type: Array as PropType<Tab[]>,\n required: true,\n },\n /**\n * The classes for tab item.\n *\n * @public\n */\n itemClasses: String,\n },\n setup() {\n const ariaLabels = useAccessibilityLabels('tabs')\n\n return { ariaLabels }\n },\n})\n</script>\n"],"names":["_createElementBlock","_openBlock","_Fragment","_renderList","_normalizeClass","_renderSlot","_createTextVNode","_toDisplayString"],"mappings":";;;;;;;sBACEA,kBAAA,CAcM,KAAA,EAAA;AAAA,IAdD,KAAA,EAAM,UAAA;AAAA,IAAW,WAAA,EAAU,MAAA;AAAA,IAAQ,cAAY,IAAA,CAAA,UAAA,EAAY,IAAA;AAAA,IAAM,IAAA,EAAK;AAAA,GAAA,EAAA;AACzE,KAAAC,SAAA,CAAA,IAAA,CAAA,EAAAD,kBAAA;AAAA,MAYSE,QAAA;AAAA,MAAA,IAAA;AAAA,MAAAC,UAAA,CAXQ,IAAA,CAAA,KAAA,EAAK,CAAb,IAAA,KAAI;4BADbH,kBAAA,CAYS,QAAA,EAAA;AAAA,UAVN,KAAK,IAAA,CAAK,EAAA;AAAA,UACX,IAAA,EAAK,QAAA;AAAA,UACL,OAAKI,cAAA,CAAA,CAAC,SAAA,EAAS,CACN,IAAA,CAAA,WAAA,EAAW,EAAA,cAAA,EAAoB,KAAK,QAAA,EAAQ,CAAA,CAAA,CAAA;AAAA,UACrD,WAAA,EAAU,KAAA;AAAA,UACV,IAAA,EAAK,KAAA;AAAA,UACJ,iBAAe,IAAA,CAAK,QAAA;AAAA,UACpB,OAAA,EAAK,CAAA,MAAA,KAAE,IAAA,CAAK,KAAA;AAAK,SAAA,EAAA;UAElBC,UAAA,CAA0C,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAAnC,IAAA,EAAU,EAAjB,MAA0C;AAAA,YAAAC,eAAA;AAApB,cAAAC,eAAA,CAAA,IAAA,CAAK,KAAK,CAAA;AAAA,cAAA;AAAA;AAAA;AAAA,WAAA;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import '../../composables/create-use-device.js';
|
|
2
|
+
import 'vuex';
|
|
3
|
+
import '../../plugins/x-bus.js';
|
|
4
|
+
import '@empathyco/x-utils';
|
|
5
|
+
import '../../plugins/x-plugin.js';
|
|
6
|
+
import 'rxjs';
|
|
7
|
+
import { defineComponent } from 'vue';
|
|
8
|
+
import { useAccessibilityLabels } from '../../composables/use-accessibility-labels.js';
|
|
9
|
+
import '@vueuse/core';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Renders a list of tabs from the given `items`. It keeps track of the
|
|
13
|
+
* selected tab internally: clicking a tab marks it as selected and invokes
|
|
14
|
+
* its `click` callback.
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
var _sfc_main = defineComponent({
|
|
19
|
+
name: 'Tabs',
|
|
20
|
+
props: {
|
|
21
|
+
/**
|
|
22
|
+
* The tabs to render.
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
items: {
|
|
27
|
+
type: Array,
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* The classes for tab item.
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
itemClasses: String,
|
|
36
|
+
},
|
|
37
|
+
setup() {
|
|
38
|
+
const ariaLabels = useAccessibilityLabels('tabs');
|
|
39
|
+
return { ariaLabels };
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export { _sfc_main as default };
|
|
44
|
+
//# sourceMappingURL=tabs.vue2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.vue2.js","sources":["../../../../src/components/tabs/tabs.vue"],"sourcesContent":["<template>\n <nav class=\"xds:tabs\" data-test=\"tabs\" :aria-label=\"ariaLabels?.root\" role=\"tablist\">\n <button\n v-for=\"item in items\"\n :key=\"item.id\"\n type=\"button\"\n class=\"xds:tab\"\n :class=\"[itemClasses, { 'xds:selected': item.selected }]\"\n data-test=\"tab\"\n role=\"tab\"\n :aria-selected=\"item.selected\"\n @click=\"item.click()\"\n >\n <slot :item=\"item\">{{ item.label }}</slot>\n </button>\n </nav>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { Tab } from './tab.types'\nimport { useAccessibilityLabels } from '@x/composables'\nimport { defineComponent } from 'vue'\n\n/**\n * Renders a list of tabs from the given `items`. It keeps track of the\n * selected tab internally: clicking a tab marks it as selected and invokes\n * its `click` callback.\n *\n * @public\n */\nexport default defineComponent({\n name: 'Tabs',\n props: {\n /**\n * The tabs to render.\n *\n * @public\n */\n items: {\n type: Array as PropType<Tab[]>,\n required: true,\n },\n /**\n * The classes for tab item.\n *\n * @public\n */\n itemClasses: String,\n },\n setup() {\n const ariaLabels = useAccessibilityLabels('tabs')\n\n return { ariaLabels }\n },\n})\n</script>\n"],"names":[],"mappings":";;;;;;;;;;AAwBA;;;;;;AAME;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAE,KAAwB;AAC9B,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,WAAW,EAAE,MAAM;AACpB,KAAA;IACD,KAAK,GAAA;AACH,QAAA,MAAM,UAAS,GAAI,sBAAsB,CAAC,MAAM,CAAA;QAEhD,OAAO,EAAE,UAAS,EAAE;IACtB,CAAC;AACF,CAAA,CAAA;;;;"}
|
package/js/index.js
CHANGED
|
@@ -150,6 +150,7 @@ export { default as SortList } from './components/sort/sort-list.vue.js';
|
|
|
150
150
|
export { default as SortPickerList } from './components/sort/sort-picker-list.vue.js';
|
|
151
151
|
export { default as BaseSuggestion } from './components/suggestions/base-suggestion.vue.js';
|
|
152
152
|
export { default as BaseSuggestions } from './components/suggestions/base-suggestions.vue.js';
|
|
153
|
+
export { default as Tabs } from './components/tabs/tabs.vue.js';
|
|
153
154
|
export { getRootXComponent, getXComponentXModuleName, isXComponent } from './components/x-component.utils.js';
|
|
154
155
|
export { createUseDevice } from './composables/create-use-device.js';
|
|
155
156
|
export { use$x } from './composables/use-_x.js';
|
|
@@ -431,7 +432,7 @@ export { searchEmitters } from './x-modules/search/store/emitters.js';
|
|
|
431
432
|
export { query as searchQuery } from './x-modules/search/store/getters/query.getter.js';
|
|
432
433
|
export { request as searchRequest } from './x-modules/search/store/getters/request.getter.js';
|
|
433
434
|
export { resettableState, searchXStoreModule } from './x-modules/search/store/module.js';
|
|
434
|
-
export { cancelFetchAndSaveSearchResponseWire, clearSearchQuery, fetchAndSaveSearchResponseWire, increasePageAppendingResultsWire, resetAppending, resetFromNoResultsWithFilters, resetIsNoResults, resetRequestOnRefinementWire, resetSpellcheckQuery, resetStateForReloadWire, resetStateIfNoRequestWire, saveOriginWire, searchWiring, setRelatedTags, setSearchExtraParams, setSearchExtraParamsFromPreview, setSearchPage, setSearchQuery, setSearchQueryFromPreview, setSearchSelectedFiltersFromHistoryQuery, setSearchSelectedFiltersFromPreview, setSelectedFilters, setSort, setUrlParams } from './x-modules/search/wiring.js';
|
|
435
|
+
export { cancelFetchAndSaveSearchResponseWire, clearSearchQuery, fetchAndSaveSearchResponseWire, increasePageAppendingResultsWire, resetAppending, resetCatalogSection, resetFromNoResultsWithFilters, resetIsNoResults, resetRequestOnRefinementWire, resetSpellcheckQuery, resetStateForReloadWire, resetStateIfNoRequestWire, saveOriginWire, searchWiring, setCatalogSection, setCatalogSectionFromUrl, setRelatedTags, setSearchExtraParams, setSearchExtraParamsFromPreview, setSearchPage, setSearchQuery, setSearchQueryFromPreview, setSearchSelectedFiltersFromHistoryQuery, setSearchSelectedFiltersFromPreview, setSelectedFilters, setSort, setUrlParams } from './x-modules/search/wiring.js';
|
|
435
436
|
export { searchXModule } from './x-modules/search/x-module.js';
|
|
436
437
|
export { default as ClearSearchInput } from './x-modules/search-box/components/clear-search-input.vue.js';
|
|
437
438
|
export { default as SearchButton } from './x-modules/search-box/components/search-button.vue.js';
|
|
@@ -459,7 +460,7 @@ export { taggingXModule } from './x-modules/tagging/x-module.js';
|
|
|
459
460
|
export { default as UrlHandler } from './x-modules/url/components/url-handler.vue.js';
|
|
460
461
|
export { replaceableParams, urlEmitters } from './x-modules/url/store/emitters.js';
|
|
461
462
|
export { urlXStoreModule } from './x-modules/url/store/module.js';
|
|
462
|
-
export { resetUrlBrowseCategory, resetUrlQuery, setInitialExtraParams, setParams, setUrlBrowseCategory, setUrlFilters, setUrlPage, setUrlParamsFromPreview, setUrlPrompt, setUrlQuery, setUrlQueryFromPreview, setUrlRelatedTags, setUrlScroll, setUrlSelectedFiltersFromBrowse, setUrlSelectedFiltersFromPreview, setUrlSort, urlWiring } from './x-modules/url/wiring.js';
|
|
463
|
+
export { resetUrlBrowseCategory, resetUrlCatalogSection, resetUrlQuery, setInitialExtraParams, setParams, setUrlBrowseCategory, setUrlCatalogSection, setUrlFilters, setUrlPage, setUrlParamsFromPreview, setUrlPrompt, setUrlQuery, setUrlQueryFromPreview, setUrlRelatedTags, setUrlScroll, setUrlSelectedFiltersFromBrowse, setUrlSelectedFiltersFromPreview, setUrlSort, urlWiring } from './x-modules/url/wiring.js';
|
|
463
464
|
export { urlXModule } from './x-modules/url/x-module.js';
|
|
464
465
|
export { default as VendorBannersList } from './x-modules/vendor/components/vendor-banners-list.vue.js';
|
|
465
466
|
export { default as VendorResultsList } from './x-modules/vendor/components/vendor-results-list.vue.js';
|
package/js/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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accessibility.js","sources":["../../../src/types/accessibility.ts"],"sourcesContent":["import type { InjectionKey } from 'vue'\n\n/**\n * Configuration of the global aria labels for the components. Namespaces are the PascalCase\n * component names and every entry is optional, so the map can be set partially. The entries\n * `PageSelector.numberPage` and `BaseColumnPickerList.ariaLabel` are template strings: their\n * `page` and `column` tokens are substituted per item at resolution.\n *\n * @public\n */\nexport interface AriaLabels {\n pageSelector?: {\n pagination?: string\n prevPage?: string\n nextPage?: string\n numberPage?: (page: number | string) => string\n }\n aiCarousel?: { expand?: string; collapse?: string }\n baseColumnPickerDropdown?: { dropdown?: string }\n baseColumnPickerList?: { button?: (page: number) => string }\n pageLoaderButton?: { button?: string }\n baseModal?: { modal?: string }\n baseEventsModalOpen?: { button?: string }\n baseEventsModalClose?: { button?: string }\n sortDropdown?: { dropdown?: string }\n facets?: { root?: string }\n filtersSearch?: { input?: string }\n sliderFilter?: { min?: string; max?: string }\n editableNumberRangeFilter?: { min?: string; max?: string }\n searchInput?: { input?: string }\n clearHistoryQueries?: { button?: string }\n historyQueriesSwitch?: { root?: string }\n historyQuery?: { removeButton?: string }\n removeHistoryQuery?: { button?: string }\n scrollToTop?: { button?: string }\n baseDropdown?: { toggleButton?: string }\n}\n\nexport const ACCESSIBILITY_KEY: InjectionKey<AriaLabels> = Symbol('accessibility')\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"accessibility.js","sources":["../../../src/types/accessibility.ts"],"sourcesContent":["import type { InjectionKey } from 'vue'\n\n/**\n * Configuration of the global aria labels for the components. Namespaces are the PascalCase\n * component names and every entry is optional, so the map can be set partially. The entries\n * `PageSelector.numberPage` and `BaseColumnPickerList.ariaLabel` are template strings: their\n * `page` and `column` tokens are substituted per item at resolution.\n *\n * @public\n */\nexport interface AriaLabels {\n pageSelector?: {\n pagination?: string\n prevPage?: string\n nextPage?: string\n numberPage?: (page: number | string) => string\n }\n aiCarousel?: { expand?: string; collapse?: string }\n baseColumnPickerDropdown?: { dropdown?: string }\n baseColumnPickerList?: { button?: (page: number) => string }\n pageLoaderButton?: { button?: string }\n baseModal?: { modal?: string }\n baseEventsModalOpen?: { button?: string }\n baseEventsModalClose?: { button?: string }\n sortDropdown?: { dropdown?: string }\n facets?: { root?: string }\n filtersSearch?: { input?: string }\n sliderFilter?: { min?: string; max?: string }\n editableNumberRangeFilter?: { min?: string; max?: string }\n searchInput?: { input?: string }\n clearHistoryQueries?: { button?: string }\n historyQueriesSwitch?: { root?: string }\n historyQuery?: { removeButton?: string }\n removeHistoryQuery?: { button?: string }\n scrollToTop?: { button?: string }\n baseDropdown?: { toggleButton?: string }\n tabs?: { root?: string }\n}\n\nexport const ACCESSIBILITY_KEY: InjectionKey<AriaLabels> = Symbol('accessibility')\n"],"names":[],"mappings":"MAuCa,iBAAiB,GAA6B,MAAM,CAAC,eAAe;;;;"}
|
|
@@ -94,6 +94,7 @@ import '../../../components/sort/sort-picker-list.vue2.js';
|
|
|
94
94
|
import '../../../components/suggestions/base-suggestion.vue2.js';
|
|
95
95
|
import '../../../components/suggestions/base-suggestions.vue2.js';
|
|
96
96
|
import '../../../components/suggestions/base-suggestions.vue3.js';
|
|
97
|
+
import '../../../components/tabs/tabs.vue2.js';
|
|
97
98
|
import '../../../composables/create-use-device.js';
|
|
98
99
|
import { useAccessibilityLabels } from '../../../composables/use-accessibility-labels.js';
|
|
99
100
|
import 'vuex';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-carousel.vue2.js","sources":["../../../../../src/x-modules/ai/components/ai-carousel.vue"],"sourcesContent":["<template>\n <CollapseHeight>\n <div v-if=\"suggestionsSearch.length\" class=\"x-ai-carousel\">\n <DisplayEmitter\n :payload=\"tagging?.toolingDisplay ?? emptyTaggingRequest\"\n :event-metadata=\"{\n feature: 'ai_carousel',\n displayOriginalQuery: query || 'ai-carousel-without-query',\n replaceable: false,\n }\"\n data-test=\"ai-carousel-display-emitter\"\n >\n <span\n class=\"x-ai-carousel-title\"\n :class=\"{ 'x-ai-carousel-title--expanded': titleExpanded }\"\n data-test=\"ai-carousel-title\"\n @click=\"toggleTitleExpansion\"\n >\n <AIStarIcon class=\"x-ai-carousel-title-icon\" />\n <ChangeHeight>\n <span\n ref=\"titleRef\"\n class=\"x-ai-carousel-title-text\"\n :class=\"{ 'x-ai-carousel-title-text--expanded': titleExpanded }\"\n >\n {{ title }}\n </span>\n </ChangeHeight>\n <button\n v-if=\"isTitleOverflowing\"\n class=\"x-ai-carousel-title-button\"\n data-test=\"ai-carousel-title-button\"\n :aria-label=\"titleExpanded ? ariaLabels?.collapse : ariaLabels?.expand\"\n >\n <ChevronDownIcon\n class=\"x-ai-carousel-title-button-icon\"\n :class=\"{ 'x-ai-carousel-title-button-icon--expanded': titleExpanded }\"\n />\n </button>\n </span>\n </DisplayEmitter>\n\n <AiGroupedCarousel\n v-if=\"group\"\n :sliding-panel-classes=\"slidingPanelClasses\"\n :sliding-panel-container-classes=\"slidingPanelContainerClasses\"\n :sliding-panel-buttons-classes=\"slidingPanelButtonsClasses\"\n >\n <template #sliding-panels-addons=\"{ arrivedState }\">\n <slot name=\"sliding-panels-addons\" :arrived-state=\"arrivedState\" />\n </template>\n <template #sliding-panels-left-button>\n <slot name=\"sliding-panels-left-button\" />\n </template>\n <template #sliding-panels-right-button>\n <slot name=\"sliding-panels-right-button\" />\n </template>\n <template #result=\"{ result }\">\n <slot name=\"result\" :result=\"result\" />\n </template>\n </AiGroupedCarousel>\n\n <div v-else class=\"x-ai-carousel-suggestions\" data-test=\"ai-carousel-suggestions-container\">\n <DisplayEmitter\n v-for=\"{ query: suggestionQuery, results: queriesResults } in suggestionsSearch\"\n :key=\"suggestionQuery\"\n :payload=\"tagging?.searchQueries[suggestionQuery].toolingDisplay ?? emptyTaggingRequest\"\n :event-metadata=\"{\n feature: 'ai_carousel',\n displayOriginalQuery: query || 'ai-carousel-without-query',\n replaceable: false,\n }\"\n data-test=\"ai-carousel-query-display-emitter\"\n >\n <div class=\"x-ai-carousel-suggestion\" data-test=\"ai-carousel-suggestion\">\n <BaseEventButton\n class=\"x-ai-carousel-suggestion-query-btn\"\n :events=\"{ UserAcceptedAQuery: suggestionQuery }\"\n >\n {{ suggestionQuery }}\n <ArrowRightIcon class=\"x-ai-carousel-suggestion-query-btn-icon\" />\n </BaseEventButton>\n\n <DisplayClickProvider\n :tooling-display-tagging=\"tagging?.searchQueries[suggestionQuery].toolingDisplayClick\"\n :tooling-add2-cart-tagging=\"\n tagging?.searchQueries[suggestionQuery].toolingDisplayAdd2Cart\n \"\n result-feature=\"ai_carousel\"\n >\n <slot name=\"sliding-panel\" :results=\"queriesResults\">\n <SlidingPanel\n :class=\"slidingPanelClasses\"\n :scroll-container-class=\"slidingPanelContainerClasses\"\n :button-class=\"slidingPanelButtonsClasses\"\n :reset-on-content-change=\"false\"\n >\n <template #sliding-panel-addons=\"{ arrivedState }\">\n <slot name=\"sliding-panels-addons\" :arrived-state=\"arrivedState\" />\n </template>\n <template #sliding-panel-left-button>\n <slot name=\"sliding-panels-left-button\" />\n </template>\n <template #sliding-panel-right-button>\n <slot name=\"sliding-panels-right-button\" />\n </template>\n <ul class=\"x-ai-carousel-suggestion-results\">\n <li\n v-for=\"result in queriesResults\"\n :key=\"result.id\"\n data-test=\"ai-carousel-suggestion-result\"\n >\n <!-- @slot (required) result card -->\n <slot name=\"result\" :result=\"result\" />\n </li>\n </ul>\n </SlidingPanel>\n </slot>\n </DisplayClickProvider>\n </div>\n </DisplayEmitter>\n <slot name=\"suggestions-extra-content\" />\n </div>\n\n <slot name=\"extra-content\" />\n <slot name=\"cta-button\" />\n </div>\n </CollapseHeight>\n</template>\n\n<script lang=\"ts\">\nimport type { TaggingRequest } from '@empathyco/x-types'\nimport { useResizeObserver } from '@vueuse/core'\nimport { computed, defineComponent, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport {\n AIStarIcon,\n ArrowRightIcon,\n BaseEventButton,\n ChangeHeight,\n ChevronDownIcon,\n CollapseHeight,\n DisplayClickProvider,\n DisplayEmitter,\n SlidingPanel,\n} from '../../../components'\nimport { use$x, useAccessibilityLabels, useState } from '../../../composables'\nimport { aiXModule } from '../x-module'\nimport AiGroupedCarousel from './ai-grouped-carousel.vue'\n\nexport default defineComponent({\n xModule: aiXModule.name,\n components: {\n AIStarIcon,\n AiGroupedCarousel,\n ArrowRightIcon,\n BaseEventButton,\n ChangeHeight,\n ChevronDownIcon,\n CollapseHeight,\n DisplayClickProvider,\n DisplayEmitter,\n SlidingPanel,\n },\n props: {\n /* The title text displayed */\n title: String,\n /* The classes added to the sliding panel. */\n slidingPanelClasses: String,\n /* The classes added to the sliding panel container. */\n slidingPanelContainerClasses: String,\n /* The classes added to the sliding panel buttons. */\n slidingPanelButtonsClasses: String,\n /* Controls whether the carousel should group results or display N carousels per N queries. */\n group: {\n type: Boolean,\n default: true,\n },\n },\n setup(props) {\n const $x = use$x()\n const { query, suggestionsSearch, queries, tagging } = useState('ai')\n const emptyTaggingRequest: TaggingRequest = { url: '', params: {} }\n\n const ariaLabels = useAccessibilityLabels('aiCarousel')\n\n const titleRef = ref<HTMLElement | null>(null)\n const titleExpanded = ref(false)\n const isTitleOverflowing = ref(false)\n\n /**\n * Checks if the title is overflowing and updates the state.\n */\n function updateTitleOverflow() {\n if (titleExpanded.value) {\n return\n }\n if (titleRef.value) {\n isTitleOverflowing.value = titleRef.value.scrollWidth > titleRef.value.clientWidth\n }\n }\n\n /**\n * Toggles the title expanded state if it is overflowing.\n */\n function toggleTitleExpansion() {\n if (isTitleOverflowing.value) {\n titleExpanded.value = !titleExpanded.value\n }\n }\n\n const title = computed(() => {\n if (!props.title) {\n const queriesList = new Intl.ListFormat('en', {\n style: 'long',\n type: 'conjunction',\n }).format(queries.value.map(({ query }) => query))\n return `Searching for ${queriesList}`\n }\n return props.title\n })\n\n watch(queries, () => {\n if (queries.value.length > 0) {\n $x.emit('AiSuggestionsSearchRequestUpdated')\n }\n })\n\n onMounted(() => {\n $x.emit('AiComponentMounted', undefined, { feature: 'ai_carousel' })\n })\n\n onBeforeUnmount(() => {\n $x.emit('AiComponentUnmounted')\n })\n\n useResizeObserver(titleRef, updateTitleOverflow)\n\n return {\n ariaLabels,\n emptyTaggingRequest,\n isTitleOverflowing,\n queries,\n query,\n suggestionsSearch,\n tagging,\n title,\n titleExpanded,\n titleRef,\n toggleTitleExpansion,\n }\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-ai-carousel {\n --color: var(--x-ai-carousel-color, #bbc9cf);\n --color-lighter: var(--x-ai-carousel-color-lighter, color-mix(in srgb, var(--color) 25%, white));\n\n padding: 8px 0;\n position: relative;\n border-radius: 1.5rem;\n background-color: var(--color-lighter);\n}\n\n.x-ai-carousel-title {\n display: flex;\n font-size: 12px;\n gap: 8px;\n align-items: flex-start;\n margin: 0 14px 8px;\n cursor: pointer;\n}\n.x-ai-carousel-title-text {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.x-ai-carousel-title-text--expanded {\n white-space: normal;\n}\n.x-ai-carousel-title-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n color: var(--color);\n flex-shrink: 0;\n margin-bottom: auto;\n}\n.x-ai-carousel-title-button {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--color);\n margin-bottom: auto;\n}\n.x-ai-carousel-title-button-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n transition: transform 0.3s ease;\n}\n.x-ai-carousel-title-button-icon--expanded {\n transform: rotate(180deg);\n}\n\n.x-ai-carousel-suggestions {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding-bottom: 1rem;\n}\n\n.x-ai-carousel-suggestion {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.x-ai-carousel-suggestion-query-btn {\n border-color: transparent;\n background-color: transparent;\n margin-left: 1rem;\n margin-right: 1rem;\n font-weight: 700;\n width: fit-content;\n display: flex;\n align-items: center;\n gap: 1rem;\n cursor: pointer;\n}\n\n.x-ai-carousel-suggestion-query-btn-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n}\n\n.x-ai-carousel-suggestion-results {\n display: flex;\n gap: 1rem;\n padding-left: 1rem;\n padding-right: 1rem;\n}\n</style>\n"],"names":["DisplayClickProvider","DisplayEmitter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqJA,gBAAe,eAAe,CAAC;IAC7B,OAAO,EAAE,SAAS,CAAC,IAAI;AACvB,IAAA,UAAU,EAAE;QACV,UAAU;QACV,iBAAiB;QACjB,cAAc;QACd,eAAe;QACf,YAAY;QACZ,eAAe;QACf,cAAc;8BACdA,WAAoB;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,QAAQ,CAAC,MAAI;AACzB,YAAA,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;gBAChB,MAAM,WAAU,GAAI,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE;AAC5C,oBAAA,KAAK,EAAE,MAAM;AACb,oBAAA,IAAI,EAAE,aAAa;AACpB,iBAAA,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,KAAK,KAAK,CAAC,CAAA;gBACjD,OAAO,CAAA,cAAA,EAAiB,WAAW,CAAA,CAAC;YACtC;YACA,OAAO,KAAK,CAAC,KAAI;AACnB,QAAA,CAAC,CAAA;AAED,QAAA,KAAK,CAAC,OAAO,EAAE,MAAI;YACjB,IAAI,OAAO,CAAC,KAAK,CAAC,MAAK,GAAI,CAAC,EAAE;AAC5B,gBAAA,EAAE,CAAC,IAAI,CAAC,mCAAmC,CAAA;YAC7C;AACF,QAAA,CAAC,CAAA;QAED,SAAS,CAAC,MAAI;AACZ,YAAA,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,aAAY,EAAG,CAAA;AACrE,QAAA,CAAC,CAAA;QAED,eAAe,CAAC,MAAI;AAClB,YAAA,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAA;AAChC,QAAA,CAAC,CAAA;AAED,QAAA,iBAAiB,CAAC,QAAQ,EAAE,mBAAmB,CAAA;QAE/C,OAAO;YACL,UAAU;YACV,mBAAmB;YACnB,kBAAkB;YAClB,OAAO;YACP,KAAK;YACL,iBAAiB;YACjB,OAAO;YACP,KAAK;YACL,aAAa;YACb,QAAQ;YACR,oBAAoB;SACtB;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"ai-carousel.vue2.js","sources":["../../../../../src/x-modules/ai/components/ai-carousel.vue"],"sourcesContent":["<template>\n <CollapseHeight>\n <div v-if=\"suggestionsSearch.length\" class=\"x-ai-carousel\">\n <DisplayEmitter\n :payload=\"tagging?.toolingDisplay ?? emptyTaggingRequest\"\n :event-metadata=\"{\n feature: 'ai_carousel',\n displayOriginalQuery: query || 'ai-carousel-without-query',\n replaceable: false,\n }\"\n data-test=\"ai-carousel-display-emitter\"\n >\n <span\n class=\"x-ai-carousel-title\"\n :class=\"{ 'x-ai-carousel-title--expanded': titleExpanded }\"\n data-test=\"ai-carousel-title\"\n @click=\"toggleTitleExpansion\"\n >\n <AIStarIcon class=\"x-ai-carousel-title-icon\" />\n <ChangeHeight>\n <span\n ref=\"titleRef\"\n class=\"x-ai-carousel-title-text\"\n :class=\"{ 'x-ai-carousel-title-text--expanded': titleExpanded }\"\n >\n {{ title }}\n </span>\n </ChangeHeight>\n <button\n v-if=\"isTitleOverflowing\"\n class=\"x-ai-carousel-title-button\"\n data-test=\"ai-carousel-title-button\"\n :aria-label=\"titleExpanded ? ariaLabels?.collapse : ariaLabels?.expand\"\n >\n <ChevronDownIcon\n class=\"x-ai-carousel-title-button-icon\"\n :class=\"{ 'x-ai-carousel-title-button-icon--expanded': titleExpanded }\"\n />\n </button>\n </span>\n </DisplayEmitter>\n\n <AiGroupedCarousel\n v-if=\"group\"\n :sliding-panel-classes=\"slidingPanelClasses\"\n :sliding-panel-container-classes=\"slidingPanelContainerClasses\"\n :sliding-panel-buttons-classes=\"slidingPanelButtonsClasses\"\n >\n <template #sliding-panels-addons=\"{ arrivedState }\">\n <slot name=\"sliding-panels-addons\" :arrived-state=\"arrivedState\" />\n </template>\n <template #sliding-panels-left-button>\n <slot name=\"sliding-panels-left-button\" />\n </template>\n <template #sliding-panels-right-button>\n <slot name=\"sliding-panels-right-button\" />\n </template>\n <template #result=\"{ result }\">\n <slot name=\"result\" :result=\"result\" />\n </template>\n </AiGroupedCarousel>\n\n <div v-else class=\"x-ai-carousel-suggestions\" data-test=\"ai-carousel-suggestions-container\">\n <DisplayEmitter\n v-for=\"{ query: suggestionQuery, results: queriesResults } in suggestionsSearch\"\n :key=\"suggestionQuery\"\n :payload=\"tagging?.searchQueries[suggestionQuery].toolingDisplay ?? emptyTaggingRequest\"\n :event-metadata=\"{\n feature: 'ai_carousel',\n displayOriginalQuery: query || 'ai-carousel-without-query',\n replaceable: false,\n }\"\n data-test=\"ai-carousel-query-display-emitter\"\n >\n <div class=\"x-ai-carousel-suggestion\" data-test=\"ai-carousel-suggestion\">\n <BaseEventButton\n class=\"x-ai-carousel-suggestion-query-btn\"\n :events=\"{ UserAcceptedAQuery: suggestionQuery }\"\n >\n {{ suggestionQuery }}\n <ArrowRightIcon class=\"x-ai-carousel-suggestion-query-btn-icon\" />\n </BaseEventButton>\n\n <DisplayClickProvider\n :tooling-display-tagging=\"tagging?.searchQueries[suggestionQuery].toolingDisplayClick\"\n :tooling-add2-cart-tagging=\"\n tagging?.searchQueries[suggestionQuery].toolingDisplayAdd2Cart\n \"\n result-feature=\"ai_carousel\"\n >\n <slot name=\"sliding-panel\" :results=\"queriesResults\">\n <SlidingPanel\n :class=\"slidingPanelClasses\"\n :scroll-container-class=\"slidingPanelContainerClasses\"\n :button-class=\"slidingPanelButtonsClasses\"\n :reset-on-content-change=\"false\"\n >\n <template #sliding-panel-addons=\"{ arrivedState }\">\n <slot name=\"sliding-panels-addons\" :arrived-state=\"arrivedState\" />\n </template>\n <template #sliding-panel-left-button>\n <slot name=\"sliding-panels-left-button\" />\n </template>\n <template #sliding-panel-right-button>\n <slot name=\"sliding-panels-right-button\" />\n </template>\n <ul class=\"x-ai-carousel-suggestion-results\">\n <li\n v-for=\"result in queriesResults\"\n :key=\"result.id\"\n data-test=\"ai-carousel-suggestion-result\"\n >\n <!-- @slot (required) result card -->\n <slot name=\"result\" :result=\"result\" />\n </li>\n </ul>\n </SlidingPanel>\n </slot>\n </DisplayClickProvider>\n </div>\n </DisplayEmitter>\n <slot name=\"suggestions-extra-content\" />\n </div>\n\n <slot name=\"extra-content\" />\n <slot name=\"cta-button\" />\n </div>\n </CollapseHeight>\n</template>\n\n<script lang=\"ts\">\nimport type { TaggingRequest } from '@empathyco/x-types'\nimport { useResizeObserver } from '@vueuse/core'\nimport { computed, defineComponent, onBeforeUnmount, onMounted, ref, watch } from 'vue'\nimport {\n AIStarIcon,\n ArrowRightIcon,\n BaseEventButton,\n ChangeHeight,\n ChevronDownIcon,\n CollapseHeight,\n DisplayClickProvider,\n DisplayEmitter,\n SlidingPanel,\n} from '../../../components'\nimport { use$x, useAccessibilityLabels, useState } from '../../../composables'\nimport { aiXModule } from '../x-module'\nimport AiGroupedCarousel from './ai-grouped-carousel.vue'\n\nexport default defineComponent({\n xModule: aiXModule.name,\n components: {\n AIStarIcon,\n AiGroupedCarousel,\n ArrowRightIcon,\n BaseEventButton,\n ChangeHeight,\n ChevronDownIcon,\n CollapseHeight,\n DisplayClickProvider,\n DisplayEmitter,\n SlidingPanel,\n },\n props: {\n /* The title text displayed */\n title: String,\n /* The classes added to the sliding panel. */\n slidingPanelClasses: String,\n /* The classes added to the sliding panel container. */\n slidingPanelContainerClasses: String,\n /* The classes added to the sliding panel buttons. */\n slidingPanelButtonsClasses: String,\n /* Controls whether the carousel should group results or display N carousels per N queries. */\n group: {\n type: Boolean,\n default: true,\n },\n },\n setup(props) {\n const $x = use$x()\n const { query, suggestionsSearch, queries, tagging } = useState('ai')\n const emptyTaggingRequest: TaggingRequest = { url: '', params: {} }\n\n const ariaLabels = useAccessibilityLabels('aiCarousel')\n\n const titleRef = ref<HTMLElement | null>(null)\n const titleExpanded = ref(false)\n const isTitleOverflowing = ref(false)\n\n /**\n * Checks if the title is overflowing and updates the state.\n */\n function updateTitleOverflow() {\n if (titleExpanded.value) {\n return\n }\n if (titleRef.value) {\n isTitleOverflowing.value = titleRef.value.scrollWidth > titleRef.value.clientWidth\n }\n }\n\n /**\n * Toggles the title expanded state if it is overflowing.\n */\n function toggleTitleExpansion() {\n if (isTitleOverflowing.value) {\n titleExpanded.value = !titleExpanded.value\n }\n }\n\n const title = computed(() => {\n if (!props.title) {\n const queriesList = new Intl.ListFormat('en', {\n style: 'long',\n type: 'conjunction',\n }).format(queries.value.map(({ query }) => query))\n return `Searching for ${queriesList}`\n }\n return props.title\n })\n\n watch(queries, () => {\n if (queries.value.length > 0) {\n $x.emit('AiSuggestionsSearchRequestUpdated')\n }\n })\n\n onMounted(() => {\n $x.emit('AiComponentMounted', undefined, { feature: 'ai_carousel' })\n })\n\n onBeforeUnmount(() => {\n $x.emit('AiComponentUnmounted')\n })\n\n useResizeObserver(titleRef, updateTitleOverflow)\n\n return {\n ariaLabels,\n emptyTaggingRequest,\n isTitleOverflowing,\n queries,\n query,\n suggestionsSearch,\n tagging,\n title,\n titleExpanded,\n titleRef,\n toggleTitleExpansion,\n }\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-ai-carousel {\n --color: var(--x-ai-carousel-color, #bbc9cf);\n --color-lighter: var(--x-ai-carousel-color-lighter, color-mix(in srgb, var(--color) 25%, white));\n\n padding: 8px 0;\n position: relative;\n border-radius: 1.5rem;\n background-color: var(--color-lighter);\n}\n\n.x-ai-carousel-title {\n display: flex;\n font-size: 12px;\n gap: 8px;\n align-items: flex-start;\n margin: 0 14px 8px;\n cursor: pointer;\n}\n.x-ai-carousel-title-text {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.x-ai-carousel-title-text--expanded {\n white-space: normal;\n}\n.x-ai-carousel-title-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n color: var(--color);\n flex-shrink: 0;\n margin-bottom: auto;\n}\n.x-ai-carousel-title-button {\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--color);\n margin-bottom: auto;\n}\n.x-ai-carousel-title-button-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n transition: transform 0.3s ease;\n}\n.x-ai-carousel-title-button-icon--expanded {\n transform: rotate(180deg);\n}\n\n.x-ai-carousel-suggestions {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding-bottom: 1rem;\n}\n\n.x-ai-carousel-suggestion {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.x-ai-carousel-suggestion-query-btn {\n border-color: transparent;\n background-color: transparent;\n margin-left: 1rem;\n margin-right: 1rem;\n font-weight: 700;\n width: fit-content;\n display: flex;\n align-items: center;\n gap: 1rem;\n cursor: pointer;\n}\n\n.x-ai-carousel-suggestion-query-btn-icon {\n height: 1rem;\n aspect-ratio: 1 / 1;\n}\n\n.x-ai-carousel-suggestion-results {\n display: flex;\n gap: 1rem;\n padding-left: 1rem;\n padding-right: 1rem;\n}\n</style>\n"],"names":["DisplayClickProvider","DisplayEmitter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqJA,gBAAe,eAAe,CAAC;IAC7B,OAAO,EAAE,SAAS,CAAC,IAAI;AACvB,IAAA,UAAU,EAAE;QACV,UAAU;QACV,iBAAiB;QACjB,cAAc;QACd,eAAe;QACf,YAAY;QACZ,eAAe;QACf,cAAc;8BACdA,WAAoB;wBACpBC,WAAc;QACd,YAAY;AACb,KAAA;AACD,IAAA,KAAK,EAAE;;AAEL,QAAA,KAAK,EAAE,MAAM;;AAEb,QAAA,mBAAmB,EAAE,MAAM;;AAE3B,QAAA,4BAA4B,EAAE,MAAM;;AAEpC,QAAA,0BAA0B,EAAE,MAAM;;AAElC,QAAA,KAAK,EAAE;AACL,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,EAAC,GAAI,KAAK,EAAC;AACjB,QAAA,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,OAAM,EAAE,GAAI,QAAQ,CAAC,IAAI,CAAA;QACpE,MAAM,mBAAmB,GAAmB,EAAE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CAAC,EAAE;AAC5B,gBAAA,EAAE,CAAC,IAAI,CAAC,mCAAmC,CAAA;YAC7C;AACF,QAAA,CAAC,CAAA;QAED,SAAS,CAAC,MAAI;AACZ,YAAA,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,aAAY,EAAG,CAAA;AACrE,QAAA,CAAC,CAAA;QAED,eAAe,CAAC,MAAI;AAClB,YAAA,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAA;AAChC,QAAA,CAAC,CAAA;AAED,QAAA,iBAAiB,CAAC,QAAQ,EAAE,mBAAmB,CAAA;QAE/C,OAAO;YACL,UAAU;YACV,mBAAmB;YACnB,kBAAkB;YAClB,OAAO;YACP,KAAK;YACL,iBAAiB;YACjB,OAAO;YACP,KAAK;YACL,aAAa;YACb,QAAQ;YACR,oBAAoB;SACtB;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
|
|
@@ -95,6 +95,7 @@ import '../../../components/sort/sort-picker-list.vue2.js';
|
|
|
95
95
|
import '../../../components/suggestions/base-suggestion.vue2.js';
|
|
96
96
|
import '../../../components/suggestions/base-suggestions.vue2.js';
|
|
97
97
|
import '../../../components/suggestions/base-suggestions.vue3.js';
|
|
98
|
+
import '../../../components/tabs/tabs.vue2.js';
|
|
98
99
|
import '../../../composables/create-use-device.js';
|
|
99
100
|
import '../../../utils/storage.js';
|
|
100
101
|
import '@vueuse/core';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-grouped-carousel.vue2.js","sources":["../../../../../src/x-modules/ai/components/ai-grouped-carousel.vue"],"sourcesContent":["<template>\n <SlidingPanel\n :class=\"slidingPanelClasses\"\n :scroll-container-class=\"slidingPanelContainerClasses\"\n :button-class=\"slidingPanelButtonsClasses\"\n :reset-on-content-change=\"false\"\n >\n <template #sliding-panel-addons=\"{ arrivedState }\">\n <slot name=\"sliding-panels-addons\" :arrived-state=\"arrivedState\" />\n </template>\n <template #sliding-panel-left-button>\n <slot name=\"sliding-panels-left-button\" />\n </template>\n <template #sliding-panel-right-button>\n <slot name=\"sliding-panels-right-button\" />\n </template>\n <ul class=\"x-ai-carousel-suggestion-results\">\n <DisplayClickProvider\n v-for=\"suggestion in suggestionsSearch\"\n :key=\"suggestion.query\"\n :tooling-display-tagging=\"tagging?.searchQueries[suggestion.query].toolingDisplayClick\"\n :tooling-add2-cart-tagging=\"tagging?.searchQueries[suggestion.query].toolingDisplayAdd2Cart\"\n result-feature=\"ai_carousel\"\n >\n <li\n v-for=\"result in suggestion.results\"\n :key=\"result.id\"\n data-test=\"ai-carousel-suggestion-result\"\n >\n <!-- @slot (required) result card -->\n <slot name=\"result\" :result=\"result\" />\n </li>\n </DisplayClickProvider>\n </ul>\n </SlidingPanel>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport { DisplayClickProvider, SlidingPanel } from '../../../components'\nimport { useState } from '../../../composables'\n\nexport default defineComponent({\n components: {\n DisplayClickProvider,\n SlidingPanel,\n },\n props: {\n /* The title text displayed */\n title: String,\n /* The classes added to the sliding panel. */\n slidingPanelClasses: String,\n /* The classes added to the sliding panel container. */\n slidingPanelContainerClasses: String,\n /* The classes added to the sliding panel buttons. */\n slidingPanelButtonsClasses: String,\n },\n setup() {\n const { suggestionsSearch, tagging } = useState('ai')\n\n return {\n suggestionsSearch,\n tagging,\n }\n },\n})\n</script>\n"],"names":["DisplayClickProvider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ai-grouped-carousel.vue2.js","sources":["../../../../../src/x-modules/ai/components/ai-grouped-carousel.vue"],"sourcesContent":["<template>\n <SlidingPanel\n :class=\"slidingPanelClasses\"\n :scroll-container-class=\"slidingPanelContainerClasses\"\n :button-class=\"slidingPanelButtonsClasses\"\n :reset-on-content-change=\"false\"\n >\n <template #sliding-panel-addons=\"{ arrivedState }\">\n <slot name=\"sliding-panels-addons\" :arrived-state=\"arrivedState\" />\n </template>\n <template #sliding-panel-left-button>\n <slot name=\"sliding-panels-left-button\" />\n </template>\n <template #sliding-panel-right-button>\n <slot name=\"sliding-panels-right-button\" />\n </template>\n <ul class=\"x-ai-carousel-suggestion-results\">\n <DisplayClickProvider\n v-for=\"suggestion in suggestionsSearch\"\n :key=\"suggestion.query\"\n :tooling-display-tagging=\"tagging?.searchQueries[suggestion.query].toolingDisplayClick\"\n :tooling-add2-cart-tagging=\"tagging?.searchQueries[suggestion.query].toolingDisplayAdd2Cart\"\n result-feature=\"ai_carousel\"\n >\n <li\n v-for=\"result in suggestion.results\"\n :key=\"result.id\"\n data-test=\"ai-carousel-suggestion-result\"\n >\n <!-- @slot (required) result card -->\n <slot name=\"result\" :result=\"result\" />\n </li>\n </DisplayClickProvider>\n </ul>\n </SlidingPanel>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport { DisplayClickProvider, SlidingPanel } from '../../../components'\nimport { useState } from '../../../composables'\n\nexport default defineComponent({\n components: {\n DisplayClickProvider,\n SlidingPanel,\n },\n props: {\n /* The title text displayed */\n title: String,\n /* The classes added to the sliding panel. */\n slidingPanelClasses: String,\n /* The classes added to the sliding panel container. */\n slidingPanelContainerClasses: String,\n /* The classes added to the sliding panel buttons. */\n slidingPanelButtonsClasses: String,\n },\n setup() {\n const { suggestionsSearch, tagging } = useState('ai')\n\n return {\n suggestionsSearch,\n tagging,\n }\n },\n})\n</script>\n"],"names":["DisplayClickProvider"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,gBAAe,eAAe,CAAC;AAC7B,IAAA,UAAU,EAAE;8BACVA,WAAoB;QACpB,YAAY;AACb,KAAA;AACD,IAAA,KAAK,EAAE;;AAEL,QAAA,KAAK,EAAE,MAAM;;AAEb,QAAA,mBAAmB,EAAE,MAAM;;AAE3B,QAAA,4BAA4B,EAAE,MAAM;;AAEpC,QAAA,0BAA0B,EAAE,MAAM;AACnC,KAAA;IACD,KAAK,GAAA;QACH,MAAM,EAAE,iBAAiB,EAAE,OAAM,EAAE,GAAI,QAAQ,CAAC,IAAI,CAAA;QAEpD,OAAO;YACL,iBAAiB;YACjB,OAAO;SACT;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
|
|
@@ -94,6 +94,7 @@ import '../../../components/sort/sort-picker-list.vue2.js';
|
|
|
94
94
|
import '../../../components/suggestions/base-suggestion.vue2.js';
|
|
95
95
|
import '../../../components/suggestions/base-suggestions.vue2.js';
|
|
96
96
|
import '../../../components/suggestions/base-suggestions.vue3.js';
|
|
97
|
+
import '../../../components/tabs/tabs.vue2.js';
|
|
97
98
|
import '../../../composables/create-use-device.js';
|
|
98
99
|
import { getActiveElement } from '../../../utils/html.js';
|
|
99
100
|
import '../../../utils/storage.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empathize.vue2.js","sources":["../../../../../src/x-modules/empathize/components/empathize.vue"],"sourcesContent":["<template>\n <component :is=\"animation\">\n <div\n v-show=\"isOpenAndHasContent\"\n ref=\"empathizeRef\"\n class=\"x-empathize\"\n data-test=\"empathize\"\n @mousedown.prevent\n @focusin=\"open\"\n @focusout=\"close\"\n >\n <!-- @slot (Required) Modal container content -->\n <slot />\n </div>\n </component>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType, WatchStopHandle } from 'vue'\nimport type { XEvent } from '../../../wiring'\nimport { computed, defineComponent, ref, watch } from 'vue'\nimport { NoAnimation } from '../../../components'\nimport { use$x, useDebounce } from '../../../composables'\nimport { AnimationProp } from '../../../types'\nimport { getActiveElement } from '../../../utils'\nimport { empathizeXModule } from '../x-module'\n\n/**\n * Component containing the empathize. It has a required slot to define its content.\n *\n * @public\n */\nexport default defineComponent({\n name: 'Empathize',\n xModule: empathizeXModule.name,\n props: {\n /** Array of {@link XEvent} to open the empathize. */\n eventsToOpenEmpathize: {\n type: Array as PropType<XEvent[]>,\n default: () => ['UserFocusedSearchBox', 'UserIsTypingAQuery', 'UserClickedSearchBox'],\n },\n /** Array of {@link XEvent} to close the empathize. */\n eventsToCloseEmpathize: {\n type: Array as PropType<XEvent[]>,\n default: () => [\n 'UserClosedEmpathize',\n 'UserSelectedASuggestion',\n 'UserPressedEnterKey',\n 'UserBlurredSearchBox',\n ],\n },\n /** Animation component that will be used to animate the empathize. */\n animation: {\n type: AnimationProp,\n default: () => NoAnimation,\n },\n /** Whether the empathize has content or not. As it is only known in the client, it is a prop. */\n hasContent: {\n type: Boolean,\n default: true,\n },\n /** Fallback flag to trigger a search and close the empathize when has no-content. */\n searchAndCloseOnNoContent: {\n type: Boolean,\n default: false,\n },\n /** Debounce time in milliseconds to search and close the empathize when has no-content. */\n searchAndCloseDebounceInMs: {\n type: Number,\n default: 1000,\n },\n },\n setup(props) {\n const $x = use$x()\n\n const empathizeRef = ref<HTMLDivElement | null>(null)\n const isOpen = ref(false)\n const isOpenAndHasContent = computed(() => isOpen.value && props.hasContent)\n\n /** Emit 'EmpathizeOpened' or 'EmpathizeClosed' event when computed changes. */\n watch(isOpenAndHasContent, () => {\n const empathizeEvent = isOpenAndHasContent.value ? 'EmpathizeOpened' : 'EmpathizeClosed'\n $x.emit(empathizeEvent, undefined, { target: empathizeRef.value })\n })\n\n /** Debounce function to change the state `isOpen` to the new value. */\n const changeOpenDebounced = useDebounce((newOpen: boolean) => (isOpen.value = newOpen), 0)\n\n /**\n * Open empathize. This function will be executed on any event in\n * {@link Empathize.eventsToOpenEmpathize} and on DOM event `focusin` on the Empathize root\n * element.\n */\n function open() {\n changeOpenDebounced(true)\n }\n\n /**\n * Close empathize. This function will be executed on any event in\n * {@link Empathize.eventsToCloseEmpathize} and on DOM event `focusout` on the Empathize root\n * element.\n */\n function close() {\n const activeElement = getActiveElement()\n if (!empathizeRef.value?.contains(activeElement)) {\n changeOpenDebounced(false)\n }\n }\n\n /** Events subscriptions to open and close empathize. */\n props.eventsToOpenEmpathize.forEach(event => $x.on(event, false).subscribe(open))\n props.eventsToCloseEmpathize.forEach(event => $x.on(event, false).subscribe(close))\n\n let unwatchSearchBoxQuery: WatchStopHandle = () => {}\n\n /** Debounced function to unwatch the search-box query and also search and close empathize. */\n const searchAndCloseDebounced = useDebounce(async () => {\n if (isOpen.value) {\n unwatchSearchBoxQuery()\n await $x.emit('UserAcceptedAQuery', $x.query.searchBox)\n close()\n }\n }, props.searchAndCloseDebounceInMs)\n\n /**\n * Watcher triggered when `hasContent` change and the `searchAndCloseOnNoContent` flag is active\n * with the following casuistics:\n * 1. Empathize has content: unwatch the search-box query and cancel debounced search&close.\n * 2. Empathize has NO content: create a watcher for the search-box query. It is to debounce the\n * search fallback when the user types in the search-box during debounced time.\n */\n watch(\n () => props.hasContent,\n () => {\n if (props.searchAndCloseOnNoContent) {\n if (props.hasContent) {\n unwatchSearchBoxQuery()\n searchAndCloseDebounced.cancel()\n } else {\n unwatchSearchBoxQuery = watch(() => $x.query.searchBox, searchAndCloseDebounced, {\n immediate: true,\n })\n }\n }\n },\n )\n\n return { empathizeRef, isOpenAndHasContent, open, close }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`EmpathizeOpened`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after receiving an event to change the state `isOpen` to `true` and `hasContent` to `true`.\n The event payload is undefined and can have a metadata with the module and the element that emitted it.\n- [`EmpathizeClosed`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after receiving an event to change the state `isOpen` to `false` and `hasContent` to `true`.\n The event payload is undefined and can have a metadata with the module and the element that emitted it.\n\n## Examples\n\nThis component will listen to the configured events in `eventsToOpenEmpathize` and\n`eventsToCloseEmpathize` props and open/close itself accordingly. By default, those props values\nare:\n\n- Open: `UserFocusedSearchBox`, `UserIsTypingAQuery`, `UserClickedSearchBox`\n- Close: `UserClosedEmpathize`, `UserSelectedASuggestion`, `UserPressedEnterKey`, `UserBlurredSearchBox`\n\n### Basic example\n\nThe component rendering the query suggestions, popular searches and history queries with keyboard\nnavigation.\n\n```vue\n<template>\n <Empathize>\n <BaseKeyboardNavigation>\n <QuerySuggestions />\n <PopularSearches />\n <HistoryQueries />\n </BaseKeyboardNavigation>\n </Empathize>\n</template>\n\n<script setup>\nimport Empathize from '@empathyco/x-components/js/x-modules/empathize/components/empathize.vue'\nimport BaseKeyboardNavigation from '@empathyco/x-components/js/components/base-keyboard-navigation.vue'\nimport QuerySuggestions from '@empathyco/x-components/js/x-modules/query-suggestions/components/query-suggestions.vue'\nimport PopularSearches from '@empathyco/x-components/js/x-modules/popular-searches/components/popular-searches.vue'\nimport HistoryQueries from '@empathyco/x-components/js/x-modules/history-queries/components/history-queries.vue'\n</script>\n```\n\nDefining custom values for the events to open and close the Empathize. For example, opening it when\nthe search box loses the focus and closing it when the search box receives the focus:\n\n```vue\n<template>\n <Empathize\n :events-to-open-empathize=\"['UserBlurredSearchBox']\"\n :events-to-close-empathize=\"['UserFocusedSearchBox']\"\n >\n Please, type a query in the Search Box.\n </Empathize>\n</template>\n\n<script setup>\nimport Empathize from '@empathyco/x-components/js/x-modules/empathize/components/empathize.vue'\n</script>\n```\n\nAn animation can be used for the opening and closing using the `animation` prop. The animation must\nbe a component with a `Transition` and a slot inside:\n\n```vue\n<template>\n <Empathize :animation=\"collapseFromTop\">\n <PopularSearches />\n </Empathize>\n</template>\n\n<script setup>\nimport Empathize from '@empathyco/x-components/js/x-modules/empathize/components/empathize.vue'\nimport PopularSearches from '@empathyco/x-components/js/x-modules/popular-searches/components/popular-searches.vue'\nimport CollapseFromTop from './collapseFromTop.vue'\nconst animation = CollapseFromTop\n</script>\n```\n\n### Advanced example\n\nThe component rendering the query suggestions, popular searches and history queries with keyboard\nnavigation. It also configures `searchAndCloseOnNoContent` to trigger a search and close the empathize\nwhen it has no content as fallback behaviour. To do that, `hasContent` prop must be reactive to know\nif the empathize has content or not. It also configures `searchAndCloseDebounceInMs` to 500ms as debounce time to search and close the empathize when it has no content.\n\n```vue\n<template>\n <Empathize\n :animation=\"empathizeAnimation\"\n :events-to-close-empathize=\"empathizeCloseEvents\"\n :has-content=\"showEmpathize\"\n :search-and-close-debounce-in-ms=\"500\"\n search-and-close-on-no-content\n >\n <BaseKeyboardNavigation>\n <QuerySuggestions />\n <PopularSearches />\n <HistoryQueries />\n </BaseKeyboardNavigation>\n </Empathize>\n</template>\n\n<script setup>\nimport Empathize from '@empathyco/x-components/js/x-modules/empathize/components/empathize.vue'\nimport BaseKeyboardNavigation from '@empathyco/x-components/js/components/base-keyboard-navigation.vue'\nimport QuerySuggestions from '@empathyco/x-components/js/x-modules/query-suggestions/components/query-suggestions.vue'\nimport PopularSearches from '@empathyco/x-components/js/x-modules/popular-searches/components/popular-searches.vue'\nimport HistoryQueries from '@empathyco/x-components/js/x-modules/history-queries/components/history-queries.vue'\nimport CollapseFromTop from './collapseFromTop.vue'\nimport { ref } from 'vue'\nconst empathizeAnimation = CollapseFromTop\nconst empathizeCloseEvents = ['UserClosedEmpathize', 'UserSelectedASuggestion']\nconst showEmpathize = ref(true)\n</script>\n```\n</docs>\n"],"names":["NoAnimation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA;;;;AAIE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,gBAAgB,CAAC,IAAI;AAC9B,IAAA,KAAK,EAAE;;AAEL,QAAA,qBAAqB,EAAE;AACrB,YAAA,IAAI,EAAE,KAA2B;YACjC,OAAO,EAAE,MAAM,CAAC,sBAAsB,EAAE,oBAAoB,EAAE,sBAAsB,CAAC;AACtF,SAAA;;AAED,QAAA,sBAAsB,EAAE;AACtB,YAAA,IAAI,EAAE,KAA2B;YACjC,OAAO,EAAE,MAAM;gBACb,qBAAq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AY,EAAE,mBAAmB,EAAE,IAAI,EAAE,KAAI,EAAE;IAC1D,CAAC;AACF,CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"empathize.vue2.js","sources":["../../../../../src/x-modules/empathize/components/empathize.vue"],"sourcesContent":["<template>\n <component :is=\"animation\">\n <div\n v-show=\"isOpenAndHasContent\"\n ref=\"empathizeRef\"\n class=\"x-empathize\"\n data-test=\"empathize\"\n @mousedown.prevent\n @focusin=\"open\"\n @focusout=\"close\"\n >\n <!-- @slot (Required) Modal container content -->\n <slot />\n </div>\n </component>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType, WatchStopHandle } from 'vue'\nimport type { XEvent } from '../../../wiring'\nimport { computed, defineComponent, ref, watch } from 'vue'\nimport { NoAnimation } from '../../../components'\nimport { use$x, useDebounce } from '../../../composables'\nimport { AnimationProp } from '../../../types'\nimport { getActiveElement } from '../../../utils'\nimport { empathizeXModule } from '../x-module'\n\n/**\n * Component containing the empathize. It has a required slot to define its content.\n *\n * @public\n */\nexport default defineComponent({\n name: 'Empathize',\n xModule: empathizeXModule.name,\n props: {\n /** Array of {@link XEvent} to open the empathize. */\n eventsToOpenEmpathize: {\n type: Array as PropType<XEvent[]>,\n default: () => ['UserFocusedSearchBox', 'UserIsTypingAQuery', 'UserClickedSearchBox'],\n },\n /** Array of {@link XEvent} to close the empathize. */\n eventsToCloseEmpathize: {\n type: Array as PropType<XEvent[]>,\n default: () => [\n 'UserClosedEmpathize',\n 'UserSelectedASuggestion',\n 'UserPressedEnterKey',\n 'UserBlurredSearchBox',\n ],\n },\n /** Animation component that will be used to animate the empathize. */\n animation: {\n type: AnimationProp,\n default: () => NoAnimation,\n },\n /** Whether the empathize has content or not. As it is only known in the client, it is a prop. */\n hasContent: {\n type: Boolean,\n default: true,\n },\n /** Fallback flag to trigger a search and close the empathize when has no-content. */\n searchAndCloseOnNoContent: {\n type: Boolean,\n default: false,\n },\n /** Debounce time in milliseconds to search and close the empathize when has no-content. */\n searchAndCloseDebounceInMs: {\n type: Number,\n default: 1000,\n },\n },\n setup(props) {\n const $x = use$x()\n\n const empathizeRef = ref<HTMLDivElement | null>(null)\n const isOpen = ref(false)\n const isOpenAndHasContent = computed(() => isOpen.value && props.hasContent)\n\n /** Emit 'EmpathizeOpened' or 'EmpathizeClosed' event when computed changes. */\n watch(isOpenAndHasContent, () => {\n const empathizeEvent = isOpenAndHasContent.value ? 'EmpathizeOpened' : 'EmpathizeClosed'\n $x.emit(empathizeEvent, undefined, { target: empathizeRef.value })\n })\n\n /** Debounce function to change the state `isOpen` to the new value. */\n const changeOpenDebounced = useDebounce((newOpen: boolean) => (isOpen.value = newOpen), 0)\n\n /**\n * Open empathize. This function will be executed on any event in\n * {@link Empathize.eventsToOpenEmpathize} and on DOM event `focusin` on the Empathize root\n * element.\n */\n function open() {\n changeOpenDebounced(true)\n }\n\n /**\n * Close empathize. This function will be executed on any event in\n * {@link Empathize.eventsToCloseEmpathize} and on DOM event `focusout` on the Empathize root\n * element.\n */\n function close() {\n const activeElement = getActiveElement()\n if (!empathizeRef.value?.contains(activeElement)) {\n changeOpenDebounced(false)\n }\n }\n\n /** Events subscriptions to open and close empathize. */\n props.eventsToOpenEmpathize.forEach(event => $x.on(event, false).subscribe(open))\n props.eventsToCloseEmpathize.forEach(event => $x.on(event, false).subscribe(close))\n\n let unwatchSearchBoxQuery: WatchStopHandle = () => {}\n\n /** Debounced function to unwatch the search-box query and also search and close empathize. */\n const searchAndCloseDebounced = useDebounce(async () => {\n if (isOpen.value) {\n unwatchSearchBoxQuery()\n await $x.emit('UserAcceptedAQuery', $x.query.searchBox)\n close()\n }\n }, props.searchAndCloseDebounceInMs)\n\n /**\n * Watcher triggered when `hasContent` change and the `searchAndCloseOnNoContent` flag is active\n * with the following casuistics:\n * 1. Empathize has content: unwatch the search-box query and cancel debounced search&close.\n * 2. Empathize has NO content: create a watcher for the search-box query. It is to debounce the\n * search fallback when the user types in the search-box during debounced time.\n */\n watch(\n () => props.hasContent,\n () => {\n if (props.searchAndCloseOnNoContent) {\n if (props.hasContent) {\n unwatchSearchBoxQuery()\n searchAndCloseDebounced.cancel()\n } else {\n unwatchSearchBoxQuery = watch(() => $x.query.searchBox, searchAndCloseDebounced, {\n immediate: true,\n })\n }\n }\n },\n )\n\n return { empathizeRef, isOpenAndHasContent, open, close }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`EmpathizeOpened`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after receiving an event to change the state `isOpen` to `true` and `hasContent` to `true`.\n The event payload is undefined and can have a metadata with the module and the element that emitted it.\n- [`EmpathizeClosed`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after receiving an event to change the state `isOpen` to `false` and `hasContent` to `true`.\n The event payload is undefined and can have a metadata with the module and the element that emitted it.\n\n## Examples\n\nThis component will listen to the configured events in `eventsToOpenEmpathize` and\n`eventsToCloseEmpathize` props and open/close itself accordingly. By default, those props values\nare:\n\n- Open: `UserFocusedSearchBox`, `UserIsTypingAQuery`, `UserClickedSearchBox`\n- Close: `UserClosedEmpathize`, `UserSelectedASuggestion`, `UserPressedEnterKey`, `UserBlurredSearchBox`\n\n### Basic example\n\nThe component rendering the query suggestions, popular searches and history queries with keyboard\nnavigation.\n\n```vue\n<template>\n <Empathize>\n <BaseKeyboardNavigation>\n <QuerySuggestions />\n <PopularSearches />\n <HistoryQueries />\n </BaseKeyboardNavigation>\n </Empathize>\n</template>\n\n<script setup>\nimport Empathize from '@empathyco/x-components/js/x-modules/empathize/components/empathize.vue'\nimport BaseKeyboardNavigation from '@empathyco/x-components/js/components/base-keyboard-navigation.vue'\nimport QuerySuggestions from '@empathyco/x-components/js/x-modules/query-suggestions/components/query-suggestions.vue'\nimport PopularSearches from '@empathyco/x-components/js/x-modules/popular-searches/components/popular-searches.vue'\nimport HistoryQueries from '@empathyco/x-components/js/x-modules/history-queries/components/history-queries.vue'\n</script>\n```\n\nDefining custom values for the events to open and close the Empathize. For example, opening it when\nthe search box loses the focus and closing it when the search box receives the focus:\n\n```vue\n<template>\n <Empathize\n :events-to-open-empathize=\"['UserBlurredSearchBox']\"\n :events-to-close-empathize=\"['UserFocusedSearchBox']\"\n >\n Please, type a query in the Search Box.\n </Empathize>\n</template>\n\n<script setup>\nimport Empathize from '@empathyco/x-components/js/x-modules/empathize/components/empathize.vue'\n</script>\n```\n\nAn animation can be used for the opening and closing using the `animation` prop. The animation must\nbe a component with a `Transition` and a slot inside:\n\n```vue\n<template>\n <Empathize :animation=\"collapseFromTop\">\n <PopularSearches />\n </Empathize>\n</template>\n\n<script setup>\nimport Empathize from '@empathyco/x-components/js/x-modules/empathize/components/empathize.vue'\nimport PopularSearches from '@empathyco/x-components/js/x-modules/popular-searches/components/popular-searches.vue'\nimport CollapseFromTop from './collapseFromTop.vue'\nconst animation = CollapseFromTop\n</script>\n```\n\n### Advanced example\n\nThe component rendering the query suggestions, popular searches and history queries with keyboard\nnavigation. It also configures `searchAndCloseOnNoContent` to trigger a search and close the empathize\nwhen it has no content as fallback behaviour. To do that, `hasContent` prop must be reactive to know\nif the empathize has content or not. It also configures `searchAndCloseDebounceInMs` to 500ms as debounce time to search and close the empathize when it has no content.\n\n```vue\n<template>\n <Empathize\n :animation=\"empathizeAnimation\"\n :events-to-close-empathize=\"empathizeCloseEvents\"\n :has-content=\"showEmpathize\"\n :search-and-close-debounce-in-ms=\"500\"\n search-and-close-on-no-content\n >\n <BaseKeyboardNavigation>\n <QuerySuggestions />\n <PopularSearches />\n <HistoryQueries />\n </BaseKeyboardNavigation>\n </Empathize>\n</template>\n\n<script setup>\nimport Empathize from '@empathyco/x-components/js/x-modules/empathize/components/empathize.vue'\nimport BaseKeyboardNavigation from '@empathyco/x-components/js/components/base-keyboard-navigation.vue'\nimport QuerySuggestions from '@empathyco/x-components/js/x-modules/query-suggestions/components/query-suggestions.vue'\nimport PopularSearches from '@empathyco/x-components/js/x-modules/popular-searches/components/popular-searches.vue'\nimport HistoryQueries from '@empathyco/x-components/js/x-modules/history-queries/components/history-queries.vue'\nimport CollapseFromTop from './collapseFromTop.vue'\nimport { ref } from 'vue'\nconst empathizeAnimation = CollapseFromTop\nconst empathizeCloseEvents = ['UserClosedEmpathize', 'UserSelectedASuggestion']\nconst showEmpathize = ref(true)\n</script>\n```\n</docs>\n"],"names":["NoAnimation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA;;;;AAIE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,gBAAgB,CAAC,IAAI;AAC9B,IAAA,KAAK,EAAE;;AAEL,QAAA,qBAAqB,EAAE;AACrB,YAAA,IAAI,EAAE,KAA2B;YACjC,OAAO,EAAE,MAAM,CAAC,sBAAsB,EAAE,oBAAoB,EAAE,sBAAsB,CAAC;AACtF,SAAA;;AAED,QAAA,sBAAsB,EAAE;AACtB,YAAA,IAAI,EAAE,KAA2B;YACjC,OAAO,EAAE,MAAM;gBACb,qBAAqB;gBACrB,yBAAyB;gBACzB,qBAAqB;gBACrB,sBAAsB;AACvB,aAAA;AACF,SAAA;;AAED,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,aAAa;AACnB,YAAA,OAAO,EAAE,MAAMA,WAAW;AAC3B,SAAA;;AAED,QAAA,UAAU,EAAE;AACV,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IAAI;AACd,SAAA;;AAED,QAAA,yBAAyB,EAAE;AACzB,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,KAAK;AACf,SAAA;;AAED,QAAA,0BAA0B,EAAE;AAC1B,YAAA,IAAI,EAAE,MAAM;AACZ,YAAA,OAAO,EAAE,IAAI;AACd,SAA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ElF,QAAA,IAAI,qBAAqB,GAAoB,QAAO,CAAA;;AAGpD,QAAA,MAAM,uBAAsB,GAAI,WAAW,CAAC,YAAU;AACpD,YAAA,IAAI,MAAM,CAAC,KAAK,EAAE;AAChB,gBAAA,qBAAqB,EAAC;AACtB,gBAAA,MAAM,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAA;AACtD,gBAAA,KAAK,EAAC;YACR;AACF,QAAA,CAAC,EAAE,KAAK,CAAC,0BAA0B,CAAA;AAEnC;;;;;;AAME;QACF,KAAK,CACH,MAAM,KAAK,CAAC,UAAU,EACtB,MAAI;AACF,YAAA,IAAI,KAAK,CAAC,yBAAyB,EAAE;AACnC,gBAAA,IAAI,KAAK,CAAC,UAAU,EAAE;AACpB,oBAAA,qBAAqB,EAAC;oBACtB,uBAAuB,CAAC,MAAM,EAAC;gBACjC;qBAAO;AACL,oBAAA,qBAAoB,GAAI,KAAK,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,uBAAuB,EAAE;AAC/E,wBAAA,SAAS,EAAE,IAAI;AAChB,qBAAA,CAAA;gBACH;YACF;AACF,QAAA,CAAC,CACH;QAEA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,IAAI,EAAE,KAAI,EAAE;IAC1D,CAAC;AACF,CAAA,CAAA;;;;"}
|
|
@@ -1,7 +1,23 @@
|
|
|
1
|
-
import '@empathyco/x-utils';
|
|
1
|
+
import { deepEqual } from '@empathyco/x-utils';
|
|
2
2
|
import { createStoreEmitters } from '../../../store/utils/store-emitters.utils.js';
|
|
3
3
|
import { extraParamsXStoreModule } from './module.js';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Removes the catalog section param from the given extra params, as it is only consumed by the
|
|
7
|
+
* search request. The key used to send the catalog section is configurable through the
|
|
8
|
+
* {@link ExtraParamsState.catalogSectionParamKey} state property.
|
|
9
|
+
*
|
|
10
|
+
* @param params - The extra params stored in the {@link ExtraParamsXModule}.
|
|
11
|
+
* @param catalogSectionParamKey - The key under which the catalog section is sent.
|
|
12
|
+
* @returns The given extra params without the catalog section param.
|
|
13
|
+
*
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
function omitCatalogSection(params, catalogSectionParamKey) {
|
|
17
|
+
const paramsWithoutCatalogSection = { ...params };
|
|
18
|
+
delete paramsWithoutCatalogSection[catalogSectionParamKey];
|
|
19
|
+
return paramsWithoutCatalogSection;
|
|
20
|
+
}
|
|
5
21
|
/**
|
|
6
22
|
* {@link StoreEmitters} For the {@link ExtraParamsXModule}.
|
|
7
23
|
*
|
|
@@ -9,7 +25,12 @@ import { extraParamsXStoreModule } from './module.js';
|
|
|
9
25
|
*/
|
|
10
26
|
const extraParamsEmitters = createStoreEmitters(extraParamsXStoreModule, {
|
|
11
27
|
ExtraParamsChanged: {
|
|
12
|
-
|
|
28
|
+
// The catalog section is only consumed by the search request, which reads it from the extra
|
|
29
|
+
// params state as a fallback, so it is not broadcasted to the rest of the modules.
|
|
30
|
+
selector: (state) => omitCatalogSection(state.params, state.catalogSectionParamKey),
|
|
31
|
+
// Emits only when a param other than the catalog section changes. Otherwise, changing just
|
|
32
|
+
// the catalog section would still trigger a refetch on every other module.
|
|
33
|
+
filter: (newValue, oldValue) => !deepEqual(newValue, oldValue),
|
|
13
34
|
metadata: { priority: 9 },
|
|
14
35
|
},
|
|
15
36
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emitters.js","sources":["../../../../../src/x-modules/extra-params/store/emitters.ts"],"sourcesContent":["import { createStoreEmitters } from '../../../store'\nimport { extraParamsXStoreModule } from './module'\n\n/**\n * {@link StoreEmitters} For the {@link ExtraParamsXModule}.\n *\n * @internal\n */\nexport const extraParamsEmitters = createStoreEmitters(extraParamsXStoreModule, {\n ExtraParamsChanged: {\n selector: state
|
|
1
|
+
{"version":3,"file":"emitters.js","sources":["../../../../../src/x-modules/extra-params/store/emitters.ts"],"sourcesContent":["import type { Dictionary } from '@empathyco/x-utils'\nimport type { ExtraParamsState } from './types'\nimport { deepEqual } from '@empathyco/x-utils'\nimport { createStoreEmitters } from '../../../store'\nimport { extraParamsXStoreModule } from './module'\n\n/**\n * Removes the catalog section param from the given extra params, as it is only consumed by the\n * search request. The key used to send the catalog section is configurable through the\n * {@link ExtraParamsState.catalogSectionParamKey} state property.\n *\n * @param params - The extra params stored in the {@link ExtraParamsXModule}.\n * @param catalogSectionParamKey - The key under which the catalog section is sent.\n * @returns The given extra params without the catalog section param.\n *\n * @internal\n */\nfunction omitCatalogSection(\n params: Dictionary<unknown>,\n catalogSectionParamKey: string,\n): Dictionary<unknown> {\n const paramsWithoutCatalogSection = { ...params }\n delete paramsWithoutCatalogSection[catalogSectionParamKey]\n return paramsWithoutCatalogSection\n}\n\n/**\n * {@link StoreEmitters} For the {@link ExtraParamsXModule}.\n *\n * @internal\n */\nexport const extraParamsEmitters = createStoreEmitters(extraParamsXStoreModule, {\n ExtraParamsChanged: {\n // The catalog section is only consumed by the search request, which reads it from the extra\n // params state as a fallback, so it is not broadcasted to the rest of the modules.\n selector: (state: ExtraParamsState) =>\n omitCatalogSection(state.params, state.catalogSectionParamKey),\n // Emits only when a param other than the catalog section changes. Otherwise, changing just\n // the catalog section would still trigger a refetch on every other module.\n filter: (newValue, oldValue) => !deepEqual(newValue, oldValue),\n metadata: { priority: 9 },\n },\n})\n"],"names":[],"mappings":";;;;AAMA;;;;;;;;;;AAUG;AACH,SAAS,kBAAkB,CACzB,MAA2B,EAC3B,sBAA8B,EAAA;AAE9B,IAAA,MAAM,2BAA2B,GAAG,EAAE,GAAG,MAAM,EAAE;AACjD,IAAA,OAAO,2BAA2B,CAAC,sBAAsB,CAAC;AAC1D,IAAA,OAAO,2BAA2B;AACpC;AAEA;;;;AAIG;AACI,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,uBAAuB,EAAE;AAC9E,IAAA,kBAAkB,EAAE;;;AAGlB,QAAA,QAAQ,EAAE,CAAC,KAAuB,KAChC,kBAAkB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,sBAAsB,CAAC;;;AAGhE,QAAA,MAAM,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC;AAC9D,QAAA,QAAQ,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;AAC1B,KAAA;AACF,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sources":["../../../../../src/x-modules/extra-params/store/module.ts"],"sourcesContent":["import type { ExtraParamsXStoreModule } from './types'\n\n/**\n * {@link XStoreModule} For the ExtraParams module.\n *\n * @internal\n */\nexport const extraParamsXStoreModule: ExtraParamsXStoreModule = {\n state: () => ({\n params: {},\n }),\n getters: {},\n mutations: {\n setParams(state, params) {\n state.params = { ...state.params, ...params }\n },\n },\n actions: {},\n}\n"],"names":[],"mappings":"AAEA;;;;AAIG;AACI,MAAM,uBAAuB,GAA4B;AAC9D,IAAA,KAAK,EAAE,OAAO;AACZ,QAAA,MAAM,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"module.js","sources":["../../../../../src/x-modules/extra-params/store/module.ts"],"sourcesContent":["import type { ExtraParamsXStoreModule } from './types'\n\n/**\n * {@link XStoreModule} For the ExtraParams module.\n *\n * @internal\n */\nexport const extraParamsXStoreModule: ExtraParamsXStoreModule = {\n state: () => ({\n params: {},\n catalogSectionParamKey: 'catalogSection',\n }),\n getters: {},\n mutations: {\n setParams(state, params) {\n state.params = { ...state.params, ...params }\n },\n },\n actions: {},\n}\n"],"names":[],"mappings":"AAEA;;;;AAIG;AACI,MAAM,uBAAuB,GAA4B;AAC9D,IAAA,KAAK,EAAE,OAAO;AACZ,QAAA,MAAM,EAAE,EAAE;AACV,QAAA,sBAAsB,EAAE,gBAAgB;KACzC,CAAC;AACF,IAAA,OAAO,EAAE,EAAE;AACX,IAAA,SAAS,EAAE;QACT,SAAS,CAAC,KAAK,EAAE,MAAM,EAAA;AACrB,YAAA,KAAK,CAAC,MAAM,GAAG,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE;QAC/C,CAAC;AACF,KAAA;AACD,IAAA,OAAO,EAAE,EAAE;;;;;"}
|
|
@@ -96,6 +96,7 @@ import '../../../components/sort/sort-picker-list.vue2.js';
|
|
|
96
96
|
import '../../../components/suggestions/base-suggestion.vue2.js';
|
|
97
97
|
import '../../../components/suggestions/base-suggestions.vue2.js';
|
|
98
98
|
import '../../../components/suggestions/base-suggestions.vue3.js';
|
|
99
|
+
import '../../../components/tabs/tabs.vue2.js';
|
|
99
100
|
import { useState } from '../../../composables/use-state.js';
|
|
100
101
|
import { queriesPreviewXModule } from '../x-module.js';
|
|
101
102
|
|