@empathyco/x-components 7.4.1 → 8.0.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 +18 -0
- package/browse/index.js +0 -1
- package/core/index.js +3 -0
- package/core/index.js.map +1 -1
- package/docs/API-reference/api/x-components.baseaddtocart.md +1 -1
- package/docs/API-reference/api/x-components.hierarchicalfilter.md +1 -0
- package/docs/API-reference/api/x-components.md +124 -11
- package/docs/API-reference/api/x-components.setresults.md +13 -0
- 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.sortdropdown.md +30 -4
- package/docs/API-reference/api/x-components.sortlist.md +32 -7
- package/docs/API-reference/api/x-components.sortpickerlist.md +32 -7
- package/docs/API-reference/api/x-components.usealiasapi.browseselectedsort.md +13 -0
- package/docs/API-reference/api/x-components.usealiasapi.md +21 -0
- package/docs/API-reference/api/x-components.vendoractions.md +11 -0
- package/docs/API-reference/api/x-components.vendorgetters.md +11 -0
- package/docs/API-reference/api/x-components.vendormutations.md +54 -0
- package/docs/API-reference/api/x-components.vendormutations.setresults.md +11 -0
- package/docs/API-reference/api/x-components.vendorresult.md +57 -0
- package/docs/API-reference/api/x-components.vendorresult.position.md +11 -0
- package/docs/API-reference/api/x-components.vendorresultslist.md +31 -0
- package/docs/API-reference/api/x-components.vendorstate.md +54 -0
- package/docs/API-reference/api/x-components.vendorstate.results.md +11 -0
- package/docs/API-reference/api/x-components.vendorxevents.md +58 -0
- package/docs/API-reference/api/x-components.vendorxevents.vendorresultschanged.md +13 -0
- package/docs/API-reference/api/x-components.vendorxmodule.md +13 -0
- package/docs/API-reference/api/x-components.vendorxstoremodule.md +11 -0
- package/docs/API-reference/api/x-components.xeventstypes.md +2 -2
- package/docs/API-reference/api/x-components.xmodulestree.md +17 -0
- package/docs/API-reference/api/x-components.xmodulestree.vendor.md +11 -0
- package/docs/API-reference/api/x-types.result.md +2 -2
- package/docs/API-reference/components/{search → common/sort}/x-components.sort-dropdown.md +7 -4
- package/docs/API-reference/components/{search → common/sort}/x-components.sort-list.md +7 -4
- package/docs/API-reference/components/{search → common/sort}/x-components.sort-picker-list.md +8 -5
- package/docs/API-reference/components/vendor/x-components.vendor-results-list.md +21 -0
- package/js/components/result/base-result-add-to-cart.vue.js.map +1 -1
- package/js/components/result/base-result-add-to-cart.vue2.js +1 -1
- package/js/components/result/base-result-add-to-cart.vue2.js.map +1 -1
- package/js/components/result/base-result-link.vue.js +12 -8
- package/js/components/result/base-result-link.vue.js.map +1 -1
- package/js/components/result/base-result-link.vue2.js.map +1 -1
- package/js/{x-modules/search/components → components/sort}/sort-dropdown.vue.js +1 -1
- package/js/components/sort/sort-dropdown.vue.js.map +1 -0
- package/js/{x-modules/search/components → components/sort}/sort-dropdown.vue2.js +19 -12
- package/js/components/sort/sort-dropdown.vue2.js.map +1 -0
- package/js/{x-modules/search/components → components/sort}/sort-list.vue.js +2 -2
- package/js/components/sort/sort-list.vue.js.map +1 -0
- package/js/{x-modules/search/components → components/sort}/sort-list.vue2.js +22 -15
- package/js/components/sort/sort-list.vue2.js.map +1 -0
- package/js/components/sort/sort-list.vue3.js +7 -0
- package/js/{x-modules/search/components → components/sort}/sort-picker-list.vue.js +1 -1
- package/js/components/sort/sort-picker-list.vue.js.map +1 -0
- package/js/{x-modules/search/components → components/sort}/sort-picker-list.vue2.js +21 -14
- package/js/components/sort/sort-picker-list.vue2.js.map +1 -0
- package/js/composables/use-alias-api.js +3 -0
- package/js/composables/use-alias-api.js.map +1 -1
- package/js/index.js +8 -4
- package/js/index.js.map +1 -1
- package/js/x-modules/ai/components/ai-carousel.vue2.js +4 -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 +4 -0
- package/js/x-modules/ai/components/ai-grouped-carousel.vue2.js.map +1 -1
- package/js/x-modules/browse/store/actions/set-url-params.action.js +1 -1
- package/js/x-modules/browse/store/actions/set-url-params.action.js.map +1 -1
- package/js/x-modules/browse/wiring.js +6 -1
- package/js/x-modules/browse/wiring.js.map +1 -1
- package/js/x-modules/empathize/components/empathize.vue2.js +4 -0
- package/js/x-modules/empathize/components/empathize.vue2.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview-button.vue2.js +4 -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 +4 -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 +4 -0
- package/js/x-modules/scroll/components/scroll-to-top.vue2.js.map +1 -1
- package/js/x-modules/search/store/actions/set-url-params.action.js +1 -1
- package/js/x-modules/search/store/actions/set-url-params.action.js.map +1 -1
- package/js/x-modules/search/wiring.js +3 -0
- package/js/x-modules/search/wiring.js.map +1 -1
- package/js/x-modules/vendor/components/vendor-results-list.vue.js +81 -0
- package/js/x-modules/vendor/components/vendor-results-list.vue.js.map +1 -0
- package/js/x-modules/vendor/components/vendor-results-list.vue2.js +6 -0
- package/js/x-modules/vendor/components/vendor-results-list.vue2.js.map +1 -0
- package/js/x-modules/vendor/store/emitters.js +13 -0
- package/js/x-modules/vendor/store/emitters.js.map +1 -0
- package/js/x-modules/vendor/store/module.js +15 -0
- package/js/x-modules/vendor/store/module.js.map +1 -0
- package/js/x-modules/vendor/wiring.js +42 -0
- package/js/x-modules/vendor/wiring.js.map +1 -0
- package/js/x-modules/vendor/x-module.js +21 -0
- package/js/x-modules/vendor/x-module.js.map +1 -0
- package/package.json +4 -4
- package/report/x-components.api.json +1230 -270
- package/report/x-components.api.md +189 -58
- package/report/x-types.api.json +1 -1
- package/search/index.js +0 -3
- package/types/src/components/index.d.ts +1 -0
- package/types/src/components/index.d.ts.map +1 -1
- package/types/src/components/result/base-result-add-to-cart.vue.d.ts +1 -2
- package/types/src/components/result/base-result-add-to-cart.vue.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/sort/index.d.ts +4 -0
- package/types/src/components/sort/index.d.ts.map +1 -0
- package/types/src/{x-modules/search/components → components/sort}/sort-dropdown.vue.d.ts +33 -6
- package/types/src/components/sort/sort-dropdown.vue.d.ts.map +1 -0
- package/types/src/{x-modules/search/components → components/sort}/sort-list.vue.d.ts +35 -10
- package/types/src/components/sort/sort-list.vue.d.ts.map +1 -0
- package/types/src/{x-modules/search/components → components/sort}/sort-picker-list.vue.d.ts +45 -10
- package/types/src/components/sort/sort-picker-list.vue.d.ts.map +1 -0
- package/types/src/composables/use-alias-api.d.ts +2 -0
- package/types/src/composables/use-alias-api.d.ts.map +1 -1
- package/types/src/index.d.ts +1 -0
- package/types/src/index.d.ts.map +1 -1
- package/types/src/wiring/events.types.d.ts +2 -1
- package/types/src/wiring/events.types.d.ts.map +1 -1
- package/types/src/x-modules/browse/components/index.d.ts +0 -1
- package/types/src/x-modules/browse/components/index.d.ts.map +1 -1
- package/types/src/x-modules/browse/wiring.d.ts +6 -1
- package/types/src/x-modules/browse/wiring.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/components/index.d.ts +0 -3
- package/types/src/x-modules/search/components/index.d.ts.map +1 -1
- package/types/src/x-modules/search/wiring.d.ts +3 -0
- package/types/src/x-modules/search/wiring.d.ts.map +1 -1
- package/types/src/x-modules/vendor/components/index.d.ts +2 -0
- package/types/src/x-modules/vendor/components/index.d.ts.map +1 -0
- package/types/src/x-modules/vendor/components/vendor-results-list.vue.d.ts +30 -0
- package/types/src/x-modules/vendor/components/vendor-results-list.vue.d.ts.map +1 -0
- package/types/src/x-modules/vendor/events.types.d.ts +15 -0
- package/types/src/x-modules/vendor/events.types.d.ts.map +1 -0
- package/types/src/x-modules/vendor/index.d.ts +7 -0
- package/types/src/x-modules/vendor/index.d.ts.map +1 -0
- package/types/src/x-modules/vendor/store/emitters.d.ts +7 -0
- package/types/src/x-modules/vendor/store/emitters.d.ts.map +1 -0
- package/types/src/x-modules/vendor/store/index.d.ts +4 -0
- package/types/src/x-modules/vendor/store/index.d.ts.map +1 -0
- package/types/src/x-modules/vendor/store/module.d.ts +3 -0
- package/types/src/x-modules/vendor/store/module.d.ts.map +1 -0
- package/types/src/x-modules/vendor/store/types.d.ts +14 -0
- package/types/src/x-modules/vendor/store/types.d.ts.map +1 -0
- package/types/src/x-modules/vendor/types.d.ts +8 -0
- package/types/src/x-modules/vendor/types.d.ts.map +1 -0
- package/types/src/x-modules/vendor/wiring.d.ts +20 -0
- package/types/src/x-modules/vendor/wiring.d.ts.map +1 -0
- package/types/src/x-modules/vendor/x-module.d.ts +16 -0
- package/types/src/x-modules/vendor/x-module.d.ts.map +1 -0
- package/types/src/x-modules/x-modules.types.d.ts +2 -0
- package/types/src/x-modules/x-modules.types.d.ts.map +1 -1
- package/vendor/index.d.ts +1 -0
- package/vendor/index.js +5 -0
- package/docs/API-reference/api/x-components.browsesortpickerlist.md +0 -45
- package/docs/API-reference/components/browse/x-components.browse-sort-picker-list.md +0 -24
- package/js/x-modules/browse/components/browse-sort-picker-list.vue.js +0 -73
- package/js/x-modules/browse/components/browse-sort-picker-list.vue.js.map +0 -1
- package/js/x-modules/browse/components/browse-sort-picker-list.vue2.js +0 -6
- package/js/x-modules/browse/components/browse-sort-picker-list.vue2.js.map +0 -1
- package/js/x-modules/search/components/sort-dropdown.vue.js.map +0 -1
- package/js/x-modules/search/components/sort-dropdown.vue2.js.map +0 -1
- package/js/x-modules/search/components/sort-list.vue.js.map +0 -1
- package/js/x-modules/search/components/sort-list.vue2.js.map +0 -1
- package/js/x-modules/search/components/sort-list.vue3.js +0 -7
- package/js/x-modules/search/components/sort-picker-list.vue.js.map +0 -1
- package/js/x-modules/search/components/sort-picker-list.vue2.js.map +0 -1
- package/types/src/x-modules/browse/components/browse-sort-picker-list.vue.d.ts +0 -50
- package/types/src/x-modules/browse/components/browse-sort-picker-list.vue.d.ts.map +0 -1
- package/types/src/x-modules/search/components/sort-dropdown.vue.d.ts.map +0 -1
- package/types/src/x-modules/search/components/sort-list.vue.d.ts.map +0 -1
- package/types/src/x-modules/search/components/sort-picker-list.types.d.ts +0 -12
- package/types/src/x-modules/search/components/sort-picker-list.types.d.ts.map +0 -1
- package/types/src/x-modules/search/components/sort-picker-list.vue.d.ts.map +0 -1
- /package/js/{x-modules/search/components → components/sort}/sort-list.vue3.js.map +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [VendorResultsList](./x-components.vendorresultslist.md)
|
|
4
|
+
|
|
5
|
+
## VendorResultsList variable
|
|
6
|
+
|
|
7
|
+
It renders a [ItemsList](./x-components.itemslist.md) of vendor results from [VendorState.results](./x-components.vendorstate.results.md)<!-- -->.
|
|
8
|
+
|
|
9
|
+
The component provides a default slot which wraps the whole component with the `vendorResults` plus the `injectedListItems` which also contains the injected list items from the ancestor.
|
|
10
|
+
|
|
11
|
+
It also provides the parent slots to customize the items.
|
|
12
|
+
|
|
13
|
+
**Signature:**
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
_default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
17
|
+
animation: {
|
|
18
|
+
type: (StringConstructor | ObjectConstructor | FunctionConstructor)[];
|
|
19
|
+
default: string;
|
|
20
|
+
};
|
|
21
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
24
|
+
animation: {
|
|
25
|
+
type: (StringConstructor | ObjectConstructor | FunctionConstructor)[];
|
|
26
|
+
default: string;
|
|
27
|
+
};
|
|
28
|
+
}>> & Readonly<{}>, {
|
|
29
|
+
animation: string | Function | Record<string, any>;
|
|
30
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>
|
|
31
|
+
```
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [VendorState](./x-components.vendorstate.md)
|
|
4
|
+
|
|
5
|
+
## VendorState interface
|
|
6
|
+
|
|
7
|
+
**Signature:**
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
export interface VendorState
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Properties
|
|
14
|
+
|
|
15
|
+
<table><thead><tr><th>
|
|
16
|
+
|
|
17
|
+
Property
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
</th><th>
|
|
21
|
+
|
|
22
|
+
Modifiers
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
</th><th>
|
|
26
|
+
|
|
27
|
+
Type
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
</th><th>
|
|
31
|
+
|
|
32
|
+
Description
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
</th></tr></thead>
|
|
36
|
+
<tbody><tr><td>
|
|
37
|
+
|
|
38
|
+
[results](./x-components.vendorstate.results.md)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
</td><td>
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
</td><td>
|
|
45
|
+
|
|
46
|
+
[VendorResult](./x-components.vendorresult.md)<!-- -->\[\]
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
</td><td>
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
</td></tr>
|
|
53
|
+
</tbody></table>
|
|
54
|
+
|
|
@@ -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) > [VendorState](./x-components.vendorstate.md) > [results](./x-components.vendorstate.results.md)
|
|
4
|
+
|
|
5
|
+
## VendorState.results property
|
|
6
|
+
|
|
7
|
+
**Signature:**
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
results: VendorResult[];
|
|
11
|
+
```
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [VendorXEvents](./x-components.vendorxevents.md)
|
|
4
|
+
|
|
5
|
+
## VendorXEvents interface
|
|
6
|
+
|
|
7
|
+
Directory of events for the vendor module.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export interface VendorXEvents
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Properties
|
|
16
|
+
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Property
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Modifiers
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Type
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th><th>
|
|
33
|
+
|
|
34
|
+
Description
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
</th></tr></thead>
|
|
38
|
+
<tbody><tr><td>
|
|
39
|
+
|
|
40
|
+
[VendorResultsChanged](./x-components.vendorxevents.vendorresultschanged.md)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
</td><td>
|
|
47
|
+
|
|
48
|
+
Omit<[VendorResult](./x-components.vendorresult.md)<!-- -->, 'modelName'>\[\]
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
</td><td>
|
|
52
|
+
|
|
53
|
+
The x consumer has provided vendor results to be inserted in the result grid. Payload: The array of vendor result inputs with their items and positions. modelName is excluded since it is an internal field, and we will assign it under the hood.
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
</td></tr>
|
|
57
|
+
</tbody></table>
|
|
58
|
+
|
|
@@ -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) > [VendorXEvents](./x-components.vendorxevents.md) > [VendorResultsChanged](./x-components.vendorxevents.vendorresultschanged.md)
|
|
4
|
+
|
|
5
|
+
## VendorXEvents.VendorResultsChanged property
|
|
6
|
+
|
|
7
|
+
The x consumer has provided vendor results to be inserted in the result grid. Payload: The array of vendor result inputs with their items and positions. modelName is excluded since it is an internal field, and we will assign it under the hood.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
VendorResultsChanged: Omit<VendorResult, 'modelName'>[];
|
|
13
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [vendorXModule](./x-components.vendorxmodule.md)
|
|
4
|
+
|
|
5
|
+
## vendorXModule variable
|
|
6
|
+
|
|
7
|
+
Vendor [XModule](./x-components.xmodule.md) implementation. This module is auto-registered as soon as you import any component from the `vendor` entry point.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
vendorXModule: VendorXModule
|
|
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) > [vendorXStoreModule](./x-components.vendorxstoremodule.md)
|
|
4
|
+
|
|
5
|
+
## vendorXStoreModule variable
|
|
6
|
+
|
|
7
|
+
**Signature:**
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
vendorXStoreModule: VendorXStoreModule
|
|
11
|
+
```
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
export interface XEventsTypes extends DeviceXEvents, EmpathizeXEvents, ExtraParamsXEvents, FacetsXEvents, HistoryQueriesXEvents, IdentifierResultsXEvents, NextQueriesXEvents, PopularSearchesXEvents, QueriesPreviewXEvents, QuerySuggestionsXEvents, RecommendationsXEvents, RelatedTagsXEvents, ScrollXEvents, SearchBoxXEvents, SearchXEvents, BrowseXEvents, SemanticQueriesXEvents, TaggingXEvents, ExperienceControlsXEvents, UrlXEvents, RelatedPromptsXEvents, AiXEvents
|
|
12
|
+
export interface XEventsTypes extends DeviceXEvents, EmpathizeXEvents, ExtraParamsXEvents, FacetsXEvents, HistoryQueriesXEvents, IdentifierResultsXEvents, NextQueriesXEvents, PopularSearchesXEvents, QueriesPreviewXEvents, QuerySuggestionsXEvents, RecommendationsXEvents, RelatedTagsXEvents, ScrollXEvents, SearchBoxXEvents, SearchXEvents, BrowseXEvents, SemanticQueriesXEvents, TaggingXEvents, ExperienceControlsXEvents, UrlXEvents, RelatedPromptsXEvents, AiXEvents, VendorXEvents
|
|
13
13
|
```
|
|
14
|
-
**Extends:** [DeviceXEvents](./x-components.devicexevents.md)<!-- -->, [EmpathizeXEvents](./x-components.empathizexevents.md)<!-- -->, [ExtraParamsXEvents](./x-components.extraparamsxevents.md)<!-- -->, [FacetsXEvents](./x-components.facetsxevents.md)<!-- -->, [HistoryQueriesXEvents](./x-components.historyqueriesxevents.md)<!-- -->, [IdentifierResultsXEvents](./x-components.identifierresultsxevents.md)<!-- -->, [NextQueriesXEvents](./x-components.nextqueriesxevents.md)<!-- -->, [PopularSearchesXEvents](./x-components.popularsearchesxevents.md)<!-- -->, [QueriesPreviewXEvents](./x-components.queriespreviewxevents.md)<!-- -->, [QuerySuggestionsXEvents](./x-components.querysuggestionsxevents.md)<!-- -->, [RecommendationsXEvents](./x-components.recommendationsxevents.md)<!-- -->, [RelatedTagsXEvents](./x-components.relatedtagsxevents.md)<!-- -->, [ScrollXEvents](./x-components.scrollxevents.md)<!-- -->, [SearchBoxXEvents](./x-components.searchboxxevents.md)<!-- -->, [SearchXEvents](./x-components.searchxevents.md)<!-- -->, [BrowseXEvents](./x-components.browsexevents.md)<!-- -->, [SemanticQueriesXEvents](./x-components.semanticqueriesxevents.md)<!-- -->, [TaggingXEvents](./x-components.taggingxevents.md)<!-- -->, [ExperienceControlsXEvents](./x-components.experiencecontrolsxevents.md)<!-- -->, [UrlXEvents](./x-components.urlxevents.md)<!-- -->, [RelatedPromptsXEvents](./x-components.relatedpromptsxevents.md)<!-- -->, [AiXEvents](./x-components.aixevents.md)
|
|
14
|
+
**Extends:** [DeviceXEvents](./x-components.devicexevents.md)<!-- -->, [EmpathizeXEvents](./x-components.empathizexevents.md)<!-- -->, [ExtraParamsXEvents](./x-components.extraparamsxevents.md)<!-- -->, [FacetsXEvents](./x-components.facetsxevents.md)<!-- -->, [HistoryQueriesXEvents](./x-components.historyqueriesxevents.md)<!-- -->, [IdentifierResultsXEvents](./x-components.identifierresultsxevents.md)<!-- -->, [NextQueriesXEvents](./x-components.nextqueriesxevents.md)<!-- -->, [PopularSearchesXEvents](./x-components.popularsearchesxevents.md)<!-- -->, [QueriesPreviewXEvents](./x-components.queriespreviewxevents.md)<!-- -->, [QuerySuggestionsXEvents](./x-components.querysuggestionsxevents.md)<!-- -->, [RecommendationsXEvents](./x-components.recommendationsxevents.md)<!-- -->, [RelatedTagsXEvents](./x-components.relatedtagsxevents.md)<!-- -->, [ScrollXEvents](./x-components.scrollxevents.md)<!-- -->, [SearchBoxXEvents](./x-components.searchboxxevents.md)<!-- -->, [SearchXEvents](./x-components.searchxevents.md)<!-- -->, [BrowseXEvents](./x-components.browsexevents.md)<!-- -->, [SemanticQueriesXEvents](./x-components.semanticqueriesxevents.md)<!-- -->, [TaggingXEvents](./x-components.taggingxevents.md)<!-- -->, [ExperienceControlsXEvents](./x-components.experiencecontrolsxevents.md)<!-- -->, [UrlXEvents](./x-components.urlxevents.md)<!-- -->, [RelatedPromptsXEvents](./x-components.relatedpromptsxevents.md)<!-- -->, [AiXEvents](./x-components.aixevents.md)<!-- -->, [VendorXEvents](./x-components.vendorxevents.md)
|
|
15
15
|
|
|
16
16
|
## Remarks
|
|
17
17
|
|
|
@@ -408,6 +408,23 @@ Description
|
|
|
408
408
|
</td><td>
|
|
409
409
|
|
|
410
410
|
|
|
411
|
+
</td></tr>
|
|
412
|
+
<tr><td>
|
|
413
|
+
|
|
414
|
+
[vendor](./x-components.xmodulestree.vendor.md)
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
</td><td>
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
</td><td>
|
|
421
|
+
|
|
422
|
+
[VendorXModule](./x-components.vendorxmodule.md)
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
</td><td>
|
|
426
|
+
|
|
427
|
+
|
|
411
428
|
</td></tr>
|
|
412
429
|
</tbody></table>
|
|
413
430
|
|
|
@@ -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) > [XModulesTree](./x-components.xmodulestree.md) > [vendor](./x-components.xmodulestree.vendor.md)
|
|
4
|
+
|
|
5
|
+
## XModulesTree.vendor property
|
|
6
|
+
|
|
7
|
+
**Signature:**
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
vendor: VendorXModule;
|
|
11
|
+
```
|
|
@@ -9,9 +9,9 @@ A search result.
|
|
|
9
9
|
**Signature:**
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
export interface Result extends NamedModel<'Result'>, Identifiable, Taggable
|
|
12
|
+
export interface Result extends NamedModel<'Result' | 'VendorResult'>, Identifiable, Taggable
|
|
13
13
|
```
|
|
14
|
-
**Extends:** [NamedModel](./x-types.namedmodel.md)<!-- --><'Result'>, [Identifiable](./x-types.identifiable.md)<!-- -->, [Taggable](./x-types.taggable.md)
|
|
14
|
+
**Extends:** [NamedModel](./x-types.namedmodel.md)<!-- --><'Result' \| 'VendorResult'>, [Identifiable](./x-types.identifiable.md)<!-- -->, [Taggable](./x-types.taggable.md)
|
|
15
15
|
|
|
16
16
|
## Properties
|
|
17
17
|
|
|
@@ -11,10 +11,13 @@ also allows to change the selected sort programmatically.
|
|
|
11
11
|
|
|
12
12
|
## Props
|
|
13
13
|
|
|
14
|
-
| Name
|
|
15
|
-
|
|
|
16
|
-
| <code>
|
|
17
|
-
| <code>
|
|
14
|
+
| Name | Description | Type | Default |
|
|
15
|
+
| -------------------------------------- | ----------------------------------------------------------- | ------------------- | ----------------------------------- |
|
|
16
|
+
| <code>animation</code> | The transition to use for opening and closing the dropdown. | <code></code> | <code></code> |
|
|
17
|
+
| <code>items</code> | The list of possible sort values. | <code>Sort[]</code> | <code></code> |
|
|
18
|
+
| <code>selectedSort</code> | | <code>Sort</code> | <code></code> |
|
|
19
|
+
| <code>selectedSortProvidedEvent</code> | | <code>XEvent</code> | <code>'SelectedSortProvided'</code> |
|
|
20
|
+
| <code>clickedSortEvent</code> | | <code>XEvent</code> | <code>'UserClickedASort'</code> |
|
|
18
21
|
|
|
19
22
|
## Events
|
|
20
23
|
|
|
@@ -11,10 +11,13 @@ also allows to change the selected sort programmatically.
|
|
|
11
11
|
|
|
12
12
|
## Props
|
|
13
13
|
|
|
14
|
-
| Name
|
|
15
|
-
|
|
|
16
|
-
| <code>
|
|
17
|
-
| <code>
|
|
14
|
+
| Name | Description | Type | Default |
|
|
15
|
+
| -------------------------------------- | --------------------------------------------- | -------------------------------- | ----------------------------------- |
|
|
16
|
+
| <code>animation</code> | The transition to use for rendering the list. | <code>string \| Component</code> | <code>() => 'ul'</code> |
|
|
17
|
+
| <code>items</code> | The list of possible sort values. | <code>Sort[]</code> | <code></code> |
|
|
18
|
+
| <code>selectedSort</code> | | <code>Sort</code> | <code></code> |
|
|
19
|
+
| <code>selectedSortProvidedEvent</code> | | <code>XEvent</code> | <code>'SelectedSortProvided'</code> |
|
|
20
|
+
| <code>clickedSortEvent</code> | | <code>XEvent</code> | <code>'UserClickedASort'</code> |
|
|
18
21
|
|
|
19
22
|
## Slots
|
|
20
23
|
|
package/docs/API-reference/components/{search → common/sort}/x-components.sort-picker-list.md
RENAMED
|
@@ -11,11 +11,14 @@ also allows to change the selected sort programmatically.
|
|
|
11
11
|
|
|
12
12
|
## Props
|
|
13
13
|
|
|
14
|
-
| Name
|
|
15
|
-
|
|
|
16
|
-
| <code>
|
|
17
|
-
| <code>
|
|
18
|
-
| <code>
|
|
14
|
+
| Name | Description | Type | Default |
|
|
15
|
+
| -------------------------------------- | --------------------------------------------- | -------------------------------- | ----------------------------------- |
|
|
16
|
+
| <code>animation</code> | The transition to use for rendering the list. | <code>string \| Component</code> | <code>() => 'div'</code> |
|
|
17
|
+
| <code>items</code> | The list of possible sort values. | <code>Sort[]</code> | <code></code> |
|
|
18
|
+
| <code>selectedSort</code> | | <code>Sort</code> | <code></code> |
|
|
19
|
+
| <code>selectedSortProvidedEvent</code> | | <code>XEvent</code> | <code>'SelectedSortProvided'</code> |
|
|
20
|
+
| <code>clickedSortEvent</code> | | <code>XEvent</code> | <code>'UserClickedASort'</code> |
|
|
21
|
+
| <code>buttonClass</code> | Class inherited by each sort button. | <code>string</code> | <code></code> |
|
|
19
22
|
|
|
20
23
|
## Slots
|
|
21
24
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
|
|
3
|
+
title: VendorResultsList
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# VendorResultsList
|
|
8
|
+
|
|
9
|
+
It renders a ItemsList of vendor results from VendorState.results.
|
|
10
|
+
|
|
11
|
+
The component provides a default slot which wraps the whole component with the `vendorResults`
|
|
12
|
+
plus the `injectedListItems` which also contains the injected list items from
|
|
13
|
+
the ancestor.
|
|
14
|
+
|
|
15
|
+
It also provides the parent slots to customize the items.
|
|
16
|
+
|
|
17
|
+
## Props
|
|
18
|
+
|
|
19
|
+
| Name | Description | Type | Default |
|
|
20
|
+
| ---------------------- | -------------------------------------------------------------------- | -------------------------- | ----------------- |
|
|
21
|
+
| <code>animation</code> | Animation component that will be used to animate the vendor results. | <code>AnimationProp</code> | <code>'ul'</code> |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-result-add-to-cart.vue.js","sources":["../../../../src/components/result/base-result-add-to-cart.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n :metadata=\"metadata\"\n class=\"x-result-add-to-cart xds:button\"\n data-test=\"result-add-to-cart\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot />\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { PropsWithType } from '../../utils/index'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport type { WireMetadata } from '../../wiring/index'\nimport { computed, defineComponent, inject } from 'vue'\nimport BaseEventButton from '../base-event-button.vue'\n\n/**\n * Renders a button with a default slot. It receives the result with the data and emits\n * {@link XEventsTypes.UserClickedResultAddToCart} to the bus on click mouse event.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseEventButton },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n },\n setup(props) {\n /**\n * The list of additional events to be emitted by the component when user clicks the add2cart button.\n *\n * @internal\n */\n const resultAddToCartExtraEvents = inject<PropsWithType<XEventsTypes, Result>[]>(\n 'resultAddToCartExtraEvents',\n [],\n )\n\n /**\n * The metadata to be injected in the events emitted by the component.\n */\n const metadata = inject<Omit<WireMetadata, 'moduleName' | 'origin' | 'location'>>(\n 'resultAddToCartExtraEventsMetadata',\n {},\n )\n\n /**\n * The events to be emitted by the button.\n *\n * @returns Events {@link XEventsTypes} to emit.\n *\n * @public\n */\n const events = computed(() => {\n return resultAddToCartExtraEvents.reduce(\n (acc, event) => {\n acc[event] = props.result\n return acc\n },\n { UserClickedResultAddToCart: props.result } as Partial<XEventsTypes>,\n )\n })\n\n return {\n events,\n metadata,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedResultAddToCart`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button. The event payload is the result data.\n\n## Examples\n\nRenders a button with a default slot. It receives the result with the data and emits an event\n`UserClickedResultAddToCart` to the bus on click mouse event.\n\n### Basic example\n\nThis component is a button to emit `UserClickedResultAddToCart` when clicked by the user.\n\n```vue\n<template>\n <BaseResultAddToCart :result=\"result\">\n <img src=\"./add-to-cart.svg\" alt=\"Add to cart\" />\n <span>Add to cart</span>\n </BaseResultAddToCart>\n</template>\n\n<script setup>\nimport { BaseResultAddToCart } from '@empathyco/x-components'\nconst result = {\n id: '123',\n name: 'Product name',\n price: 19.99,\n // ...other result properties\n}\n</script>\n```\n</docs>\n"],"names":["_createBlock","_renderSlot"],"mappings":";;;;;;sBACEA,WAAA,CAQkB,0BAAA,EAAA;AAAA,IAPf,MAAA,EAAQ,IAAA,CAAA,MAAA;AAAA,IACR,QAAA,EAAU,IAAA,CAAA,QAAA;AAAA,IACX,KAAA,EAAM,iCAAA;AAAA,IACN,WAAA,EAAU;AAAA,GAAA,EAAA;qBAGV,MAAQ;AAAA,MAARC,UAAA,CAAQ,IAAA,CAAA,MAAA,EAAA,SAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"base-result-add-to-cart.vue.js","sources":["../../../../src/components/result/base-result-add-to-cart.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n :metadata=\"metadata\"\n class=\"x-result-add-to-cart xds:button\"\n data-test=\"result-add-to-cart\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot />\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { PropsWithType } from '../../utils/index'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport type { WireMetadata } from '../../wiring/index'\nimport { computed, defineComponent, inject } from 'vue'\nimport BaseEventButton from '../base-event-button.vue'\n\n/**\n * Renders a button with a default slot. It receives the result with the data and emits\n * {@link XEventsTypes.UserClickedResultAddToCart} to the bus on click mouse event.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseEventButton },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n },\n setup(props) {\n /**\n * The list of additional events to be emitted by the component when user clicks the add2cart button.\n *\n * @internal\n */\n const resultAddToCartExtraEvents = inject<PropsWithType<XEventsTypes, Result>[]>(\n 'resultAddToCartExtraEvents',\n [],\n )\n\n /**\n * The metadata to be injected in the events emitted by the component.\n */\n const metadata = inject<Omit<WireMetadata, 'moduleName' | 'origin' | 'location'>>(\n 'resultAddToCartExtraEventsMetadata',\n {},\n )\n\n /**\n * The events to be emitted by the button.\n *\n * @returns Events {@link XEventsTypes} to emit.\n *\n * @public\n */\n const events = computed(() => {\n return resultAddToCartExtraEvents.reduce(\n (acc, event) => {\n acc[event] = props.result\n return acc\n },\n { UserClickedResultAddToCart: props.result } as Partial<XEventsTypes>,\n )\n })\n\n return {\n events: props.result.modelName === 'Result' ? events : {},\n metadata,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedResultAddToCart`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button. The event payload is the result data.\n\n## Examples\n\nRenders a button with a default slot. It receives the result with the data and emits an event\n`UserClickedResultAddToCart` to the bus on click mouse event.\n\n### Basic example\n\nThis component is a button to emit `UserClickedResultAddToCart` when clicked by the user.\n\n```vue\n<template>\n <BaseResultAddToCart :result=\"result\">\n <img src=\"./add-to-cart.svg\" alt=\"Add to cart\" />\n <span>Add to cart</span>\n </BaseResultAddToCart>\n</template>\n\n<script setup>\nimport { BaseResultAddToCart } from '@empathyco/x-components'\nconst result = {\n id: '123',\n name: 'Product name',\n price: 19.99,\n // ...other result properties\n}\n</script>\n```\n</docs>\n"],"names":["_createBlock","_renderSlot"],"mappings":";;;;;;sBACEA,WAAA,CAQkB,0BAAA,EAAA;AAAA,IAPf,MAAA,EAAQ,IAAA,CAAA,MAAA;AAAA,IACR,QAAA,EAAU,IAAA,CAAA,QAAA;AAAA,IACX,KAAA,EAAM,iCAAA;AAAA,IACN,WAAA,EAAU;AAAA,GAAA,EAAA;qBAGV,MAAQ;AAAA,MAARC,UAAA,CAAQ,IAAA,CAAA,MAAA,EAAA,SAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-result-add-to-cart.vue2.js","sources":["../../../../src/components/result/base-result-add-to-cart.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n :metadata=\"metadata\"\n class=\"x-result-add-to-cart xds:button\"\n data-test=\"result-add-to-cart\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot />\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { PropsWithType } from '../../utils/index'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport type { WireMetadata } from '../../wiring/index'\nimport { computed, defineComponent, inject } from 'vue'\nimport BaseEventButton from '../base-event-button.vue'\n\n/**\n * Renders a button with a default slot. It receives the result with the data and emits\n * {@link XEventsTypes.UserClickedResultAddToCart} to the bus on click mouse event.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseEventButton },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n },\n setup(props) {\n /**\n * The list of additional events to be emitted by the component when user clicks the add2cart button.\n *\n * @internal\n */\n const resultAddToCartExtraEvents = inject<PropsWithType<XEventsTypes, Result>[]>(\n 'resultAddToCartExtraEvents',\n [],\n )\n\n /**\n * The metadata to be injected in the events emitted by the component.\n */\n const metadata = inject<Omit<WireMetadata, 'moduleName' | 'origin' | 'location'>>(\n 'resultAddToCartExtraEventsMetadata',\n {},\n )\n\n /**\n * The events to be emitted by the button.\n *\n * @returns Events {@link XEventsTypes} to emit.\n *\n * @public\n */\n const events = computed(() => {\n return resultAddToCartExtraEvents.reduce(\n (acc, event) => {\n acc[event] = props.result\n return acc\n },\n { UserClickedResultAddToCart: props.result } as Partial<XEventsTypes>,\n )\n })\n\n return {\n events,\n metadata,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedResultAddToCart`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button. The event payload is the result data.\n\n## Examples\n\nRenders a button with a default slot. It receives the result with the data and emits an event\n`UserClickedResultAddToCart` to the bus on click mouse event.\n\n### Basic example\n\nThis component is a button to emit `UserClickedResultAddToCart` when clicked by the user.\n\n```vue\n<template>\n <BaseResultAddToCart :result=\"result\">\n <img src=\"./add-to-cart.svg\" alt=\"Add to cart\" />\n <span>Add to cart</span>\n </BaseResultAddToCart>\n</template>\n\n<script setup>\nimport { BaseResultAddToCart } from '@empathyco/x-components'\nconst result = {\n id: '123',\n name: 'Product name',\n price: 19.99,\n // ...other result properties\n}\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;AAqBA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;IAC7B,UAAU,EAAE,EAAE,eAAc,EAAG;AAC/B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAA0B;AAChC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT;;;;AAIE;QACF,MAAM,6BAA6B,MAAM,CACvC,4BAA4B,EAC5B,EAAE,CACJ;AAEA;;AAEE;QACF,MAAM,QAAO,GAAI,MAAM,CACrB,oCAAoC,EACpC,EAAE,CACJ;AAEA;;;;;;AAME;AACF,QAAA,MAAM,MAAK,GAAI,QAAQ,CAAC,MAAI;YAC1B,OAAO,0BAA0B,CAAC,MAAM,CACtC,CAAC,GAAG,EAAE,KAAK,KAAG;AACZ,gBAAA,GAAG,CAAC,KAAK,CAAA,GAAI,KAAK,CAAC,MAAK;AACxB,gBAAA,OAAO,GAAE;YACX,CAAC,EACD,EAAE,0BAA0B,EAAE,KAAK,CAAC,MAAK,EAA4B,CACvE;AACF,QAAA,CAAC,CAAA;QAED,OAAO;
|
|
1
|
+
{"version":3,"file":"base-result-add-to-cart.vue2.js","sources":["../../../../src/components/result/base-result-add-to-cart.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n :metadata=\"metadata\"\n class=\"x-result-add-to-cart xds:button\"\n data-test=\"result-add-to-cart\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot />\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { PropsWithType } from '../../utils/index'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport type { WireMetadata } from '../../wiring/index'\nimport { computed, defineComponent, inject } from 'vue'\nimport BaseEventButton from '../base-event-button.vue'\n\n/**\n * Renders a button with a default slot. It receives the result with the data and emits\n * {@link XEventsTypes.UserClickedResultAddToCart} to the bus on click mouse event.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseEventButton },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n },\n setup(props) {\n /**\n * The list of additional events to be emitted by the component when user clicks the add2cart button.\n *\n * @internal\n */\n const resultAddToCartExtraEvents = inject<PropsWithType<XEventsTypes, Result>[]>(\n 'resultAddToCartExtraEvents',\n [],\n )\n\n /**\n * The metadata to be injected in the events emitted by the component.\n */\n const metadata = inject<Omit<WireMetadata, 'moduleName' | 'origin' | 'location'>>(\n 'resultAddToCartExtraEventsMetadata',\n {},\n )\n\n /**\n * The events to be emitted by the button.\n *\n * @returns Events {@link XEventsTypes} to emit.\n *\n * @public\n */\n const events = computed(() => {\n return resultAddToCartExtraEvents.reduce(\n (acc, event) => {\n acc[event] = props.result\n return acc\n },\n { UserClickedResultAddToCart: props.result } as Partial<XEventsTypes>,\n )\n })\n\n return {\n events: props.result.modelName === 'Result' ? events : {},\n metadata,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedResultAddToCart`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button. The event payload is the result data.\n\n## Examples\n\nRenders a button with a default slot. It receives the result with the data and emits an event\n`UserClickedResultAddToCart` to the bus on click mouse event.\n\n### Basic example\n\nThis component is a button to emit `UserClickedResultAddToCart` when clicked by the user.\n\n```vue\n<template>\n <BaseResultAddToCart :result=\"result\">\n <img src=\"./add-to-cart.svg\" alt=\"Add to cart\" />\n <span>Add to cart</span>\n </BaseResultAddToCart>\n</template>\n\n<script setup>\nimport { BaseResultAddToCart } from '@empathyco/x-components'\nconst result = {\n id: '123',\n name: 'Product name',\n price: 19.99,\n // ...other result properties\n}\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;AAqBA;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;IAC7B,UAAU,EAAE,EAAE,eAAc,EAAG;AAC/B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAA0B;AAChC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT;;;;AAIE;QACF,MAAM,6BAA6B,MAAM,CACvC,4BAA4B,EAC5B,EAAE,CACJ;AAEA;;AAEE;QACF,MAAM,QAAO,GAAI,MAAM,CACrB,oCAAoC,EACpC,EAAE,CACJ;AAEA;;;;;;AAME;AACF,QAAA,MAAM,MAAK,GAAI,QAAQ,CAAC,MAAI;YAC1B,OAAO,0BAA0B,CAAC,MAAM,CACtC,CAAC,GAAG,EAAE,KAAK,KAAG;AACZ,gBAAA,GAAG,CAAC,KAAK,CAAA,GAAI,KAAK,CAAC,MAAK;AACxB,gBAAA,OAAO,GAAE;YACX,CAAC,EACD,EAAE,0BAA0B,EAAE,KAAK,CAAC,MAAK,EAA4B,CACvE;AACF,QAAA,CAAC,CAAA;QAED,OAAO;AACL,YAAA,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,cAAc,QAAO,GAAI,MAAK,GAAI,EAAE;YACzD,QAAQ;SACV;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import _sfc_main from './base-result-link.vue2.js';
|
|
2
|
-
import { openBlock, createElementBlock,
|
|
2
|
+
import { openBlock, createElementBlock, mergeProps, toHandlers, renderSlot } from 'vue';
|
|
3
3
|
import './base-result-link.vue3.js';
|
|
4
4
|
import _export_sfc from '../../_virtual/_plugin-vue_export-helper.js';
|
|
5
5
|
|
|
6
6
|
const _hoisted_1 = ["href"];
|
|
7
7
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
8
|
-
return openBlock(), createElementBlock("a", {
|
|
8
|
+
return openBlock(), createElementBlock("a", mergeProps({
|
|
9
9
|
ref: _ctx.el,
|
|
10
10
|
href: _ctx.result.url,
|
|
11
11
|
class: "x-result-link",
|
|
12
|
-
"data-test": "result-link"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
"data-test": "result-link"
|
|
13
|
+
}, toHandlers(
|
|
14
|
+
_ctx.result.modelName === "Result" ? {
|
|
15
|
+
click: _ctx.emitUserClickedAResult,
|
|
16
|
+
contextmenu: _ctx.emitUserClickedAResult,
|
|
17
|
+
auxclick: (event) => event.button === 1 && _ctx.emitUserClickedAResult()
|
|
18
|
+
} : {},
|
|
19
|
+
true
|
|
20
|
+
)), [
|
|
17
21
|
renderSlot(_ctx.$slots, "default", { result: _ctx.result }, void 0, true)
|
|
18
|
-
],
|
|
22
|
+
], 16, _hoisted_1);
|
|
19
23
|
}
|
|
20
24
|
var baseResultLink = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-4d589f60"]]);
|
|
21
25
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-result-link.vue.js","sources":["../../../../src/components/result/base-result-link.vue"],"sourcesContent":["<template>\n <a\n :ref=\"el\"\n :href=\"result.url\"\n class=\"x-result-link\"\n data-test=\"result-link\"\n
|
|
1
|
+
{"version":3,"file":"base-result-link.vue.js","sources":["../../../../src/components/result/base-result-link.vue"],"sourcesContent":["<template>\n <a\n :ref=\"el\"\n :href=\"result.url\"\n class=\"x-result-link\"\n data-test=\"result-link\"\n v-on=\"\n result.modelName === 'Result'\n ? {\n click: emitUserClickedAResult,\n contextmenu: emitUserClickedAResult,\n auxclick: (event: { button: number }) => event.button === 1 && emitUserClickedAResult(),\n }\n : {}\n \"\n >\n <!--\n @slot (Required) Link content with a text, an image, another component or both\n @binding {Result} result - Result data\n -->\n <slot :result=\"result\" />\n </a>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { PropsWithType } from '../../utils/types'\nimport type { WireMetadata } from '../../wiring'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport { defineComponent, inject, ref } from 'vue'\nimport { use$x } from '../../composables/index'\n\n/**\n * Component to be reused that renders an `<a>` wrapping the result contents.\n *\n * @remarks\n * It has the logic to emit {@link XEventsTypes.UserClickedAResult} to the bus on click mouse\n * events. Additionally, this component may be injected other events to be emitted on click\n * event, so, depending on where it's used its father component may provide this events.\n *\n * @public\n */\nexport default defineComponent({\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n },\n setup(props) {\n const $x = use$x()\n\n /**\n * The rendered DOM element.\n *\n * @internal\n */\n const el = ref()\n\n /**\n * The list of additional events to be emitted by the component when user clicks the link.\n *\n * @internal\n */\n const resultClickExtraEvents = inject<PropsWithType<XEventsTypes, Result>[]>(\n 'resultClickExtraEvents',\n [],\n )\n\n /**\n * The metadata to be injected in the events emitted by the component. This component can emit\n * have extra events so this record pairs each event to its metadata.\n */\n const resultLinkMetadataPerEvent = inject<\n // TODO: Refactor this inject key to the constants when doing EMP-909\n Partial<\n Record<\n PropsWithType<XEventsTypes, Result>,\n Omit<WireMetadata, 'moduleName' | 'origin' | 'location'>\n >\n >\n >('resultLinkMetadataPerEvent', {})\n\n /**\n * Emits the {@link XEventsTypes.UserClickedAResult} when user clicks on the result, and also\n * additional events if have been injected in the component.\n *\n * @internal\n */\n const emitUserClickedAResult = (): void => {\n $x.emit('UserClickedAResult', props.result, {\n target: el.value!,\n ...resultLinkMetadataPerEvent.UserClickedAResult,\n })\n resultClickExtraEvents.forEach(event => {\n $x.emit(event, props.result, { target: el.value!, ...resultLinkMetadataPerEvent[event] })\n })\n }\n\n return {\n el,\n emitUserClickedAResult,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-result-link {\n text-decoration: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following event:\n\n- [`UserClickedAResult`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\nThe component can emit more events on click using the `resultClickExtraEvents` prop.\n\n## Examples\n\nThis component is a wrapper for the result contents (images, name, price...). It may be part of the\nsearch result page, recommendations or other section which needs to include results.\n\nAdditionally, this component may be injected other events to be emitted on click event, so,\ndepending where it's used its father component may provide these events.\n\nThe result prop is required. It will render an anchor element with the href to the result URL:\n\n```vue\n<template>\n <BaseResultLink :result=\"result\">\n <template #default=\"{ result }\">\n <img :src=\"result.images[0]\" alt=\"Result image\" />\n <span>{{ result.name }}</span>\n </template>\n </BaseResultLink>\n</template>\n\n<script setup>\nimport { BaseResultLink } from '@empathyco/x-components'\nconst result = {\n name: 'Jacket',\n url: 'https://shop.com/jacket',\n images: ['https://shop.com/jacket.jpg'],\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_mergeProps","_toHandlers","_renderSlot"],"mappings":";;;;;;;AACE,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA,CAoBI,KApBJC,UAAA,CAoBI;AAAA,IAnBD,GAAA,EAAK,IAAA,CAAA,EAAA;AAAA,IACL,MAAM,IAAA,CAAA,MAAA,CAAO,GAAA;AAAA,IACd,KAAA,EAAM,eAAA;AAAA,IACN,WAAA,EAAU;AAAA,GAAA,EACVC,UAAA;AAAA,IAAa,YAAO,SAAA,KAAS,QAAA,GAAA;AAA6C,MAAA,KAAA,EAAA,IAAA,CAAA,sBAAA;AAAA,MAAA,WAAA,EAAiD,IAAA,CAAA,sBAAA;AAAA,MAAA,QAAA,EAAA,CAA+C,KAAA,KAA8B,KAAA,CAAM,MAAA,KAAM,CAAA,IAAU,IAAA,CAAA,sBAAA;AAAsB,KAAA,GAAA,EAAA;;;IAcpPC,UAAA,CAAyB,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAAlB,QAAQ,IAAA,CAAA,MAAA,EAAM,EAAA,MAAA,EAAA,IAAA;AAAA,GAAA,EAAA,EAAA,EAAA,UAAA,CAAA;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-result-link.vue2.js","sources":["../../../../src/components/result/base-result-link.vue"],"sourcesContent":["<template>\n <a\n :ref=\"el\"\n :href=\"result.url\"\n class=\"x-result-link\"\n data-test=\"result-link\"\n
|
|
1
|
+
{"version":3,"file":"base-result-link.vue2.js","sources":["../../../../src/components/result/base-result-link.vue"],"sourcesContent":["<template>\n <a\n :ref=\"el\"\n :href=\"result.url\"\n class=\"x-result-link\"\n data-test=\"result-link\"\n v-on=\"\n result.modelName === 'Result'\n ? {\n click: emitUserClickedAResult,\n contextmenu: emitUserClickedAResult,\n auxclick: (event: { button: number }) => event.button === 1 && emitUserClickedAResult(),\n }\n : {}\n \"\n >\n <!--\n @slot (Required) Link content with a text, an image, another component or both\n @binding {Result} result - Result data\n -->\n <slot :result=\"result\" />\n </a>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { PropsWithType } from '../../utils/types'\nimport type { WireMetadata } from '../../wiring'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport { defineComponent, inject, ref } from 'vue'\nimport { use$x } from '../../composables/index'\n\n/**\n * Component to be reused that renders an `<a>` wrapping the result contents.\n *\n * @remarks\n * It has the logic to emit {@link XEventsTypes.UserClickedAResult} to the bus on click mouse\n * events. Additionally, this component may be injected other events to be emitted on click\n * event, so, depending on where it's used its father component may provide this events.\n *\n * @public\n */\nexport default defineComponent({\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n },\n setup(props) {\n const $x = use$x()\n\n /**\n * The rendered DOM element.\n *\n * @internal\n */\n const el = ref()\n\n /**\n * The list of additional events to be emitted by the component when user clicks the link.\n *\n * @internal\n */\n const resultClickExtraEvents = inject<PropsWithType<XEventsTypes, Result>[]>(\n 'resultClickExtraEvents',\n [],\n )\n\n /**\n * The metadata to be injected in the events emitted by the component. This component can emit\n * have extra events so this record pairs each event to its metadata.\n */\n const resultLinkMetadataPerEvent = inject<\n // TODO: Refactor this inject key to the constants when doing EMP-909\n Partial<\n Record<\n PropsWithType<XEventsTypes, Result>,\n Omit<WireMetadata, 'moduleName' | 'origin' | 'location'>\n >\n >\n >('resultLinkMetadataPerEvent', {})\n\n /**\n * Emits the {@link XEventsTypes.UserClickedAResult} when user clicks on the result, and also\n * additional events if have been injected in the component.\n *\n * @internal\n */\n const emitUserClickedAResult = (): void => {\n $x.emit('UserClickedAResult', props.result, {\n target: el.value!,\n ...resultLinkMetadataPerEvent.UserClickedAResult,\n })\n resultClickExtraEvents.forEach(event => {\n $x.emit(event, props.result, { target: el.value!, ...resultLinkMetadataPerEvent[event] })\n })\n }\n\n return {\n el,\n emitUserClickedAResult,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-result-link {\n text-decoration: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following event:\n\n- [`UserClickedAResult`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\nThe component can emit more events on click using the `resultClickExtraEvents` prop.\n\n## Examples\n\nThis component is a wrapper for the result contents (images, name, price...). It may be part of the\nsearch result page, recommendations or other section which needs to include results.\n\nAdditionally, this component may be injected other events to be emitted on click event, so,\ndepending where it's used its father component may provide these events.\n\nThe result prop is required. It will render an anchor element with the href to the result URL:\n\n```vue\n<template>\n <BaseResultLink :result=\"result\">\n <template #default=\"{ result }\">\n <img :src=\"result.images[0]\" alt=\"Result image\" />\n <span>{{ result.name }}</span>\n </template>\n </BaseResultLink>\n</template>\n\n<script setup>\nimport { BaseResultLink } from '@empathyco/x-components'\nconst result = {\n name: 'Jacket',\n url: 'https://shop.com/jacket',\n images: ['https://shop.com/jacket.jpg'],\n}\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;AAiCA;;;;;;;;;AASE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,MAA0B;AAChC,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT,QAAA,MAAM,EAAC,GAAI,KAAK,EAAC;AAEjB;;;;AAIE;AACF,QAAA,MAAM,KAAK,GAAG,EAAC;AAEf;;;;AAIE;QACF,MAAM,sBAAqB,GAAI,MAAM,CACnC,wBAAwB,EACxB,EAAE,CACJ;AAEA;;;AAGE;QACF,MAAM,0BAAyB,GAAI,MAAM,CAQvC,4BAA4B,EAAE,EAAE,CAAA;AAElC;;;;;AAKE;QACF,MAAM,sBAAqB,GAAI,MAAU;YACvC,EAAE,CAAC,IAAI,CAAC,oBAAoB,EAAE,KAAK,CAAC,MAAM,EAAE;gBAC1C,MAAM,EAAE,EAAE,CAAC,KAAM;gBACjB,GAAG,0BAA0B,CAAC,kBAAkB;AACjD,aAAA,CAAA;AACD,YAAA,sBAAsB,CAAC,OAAO,CAAC,KAAI,IAAG;gBACpC,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,KAAM,EAAE,GAAG,0BAA0B,CAAC,KAAK,GAAG,CAAA;AAC1F,YAAA,CAAC,CAAA;AACH,QAAA,CAAA;QAEA,OAAO;YACL,EAAE;YACF,sBAAsB;SACxB;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _sfc_main from './sort-dropdown.vue2.js';
|
|
2
2
|
import { resolveComponent, openBlock, createBlock, withCtx, renderSlot, normalizeProps, guardReactiveProps, createTextVNode, toDisplayString } from 'vue';
|
|
3
|
-
import _export_sfc from '
|
|
3
|
+
import _export_sfc from '../../_virtual/_plugin-vue_export-helper.js';
|
|
4
4
|
|
|
5
5
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
6
6
|
const _component_BaseDropdown = resolveComponent("BaseDropdown");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sort-dropdown.vue.js","sources":["../../../../src/components/sort/sort-dropdown.vue"],"sourcesContent":["<template>\n <BaseDropdown\n ref=\"rootRef\"\n :items=\"items\"\n :model-value=\"selectedSort\"\n :animation=\"animation\"\n class=\"x-sort-dropdown\"\n data-test=\"sort-dropdown\"\n aria-label=\"Select sorting\"\n @update:model-value=\"emitUserClickedASort\"\n >\n <template #toggle=\"{ isOpen, item }\">\n <!--\n @slot Used to render the contents of the dropdown toggle button. If not provided, it uses\n the item slot as fallback.\n @binding {Sort} item - The sort data to render.\n @binding {boolean} isOpen - True if the dropdown is opened, and false if it is closed.\n -->\n <slot v-bind=\"{ isOpen, item }\" name=\"toggle\">{{ item }}</slot>\n </template>\n <template #item=\"{ item, isHighlighted, isSelected }\">\n <!--\n @slot (required) Used to render each one of the items content, and as fallback\n for the toggle button content slot if it is not provided.\n @binding {Sort} item - Sort to render\n @binding {boolean} isHighlighted - True when the item has the focus.\n @binding {boolean} isSelected - True when the item is selected.\n -->\n <slot v-bind=\"{ item, isHighlighted, isSelected }\" name=\"item\">{{ item }}</slot>\n </template>\n </BaseDropdown>\n</template>\n\n<script lang=\"ts\">\nimport type { Sort } from '@empathyco/x-types'\nimport type { Component, PropType } from 'vue'\nimport type { XEvent } from '../../wiring/index'\nimport { defineComponent, ref, watch } from 'vue'\nimport { use$x } from '../../composables/use-$x'\nimport BaseDropdown from '../base-dropdown.vue'\n\n/**\n * The `SortDropdown` component allows user to select the search results order. This component\n * also allows to change the selected sort programmatically.\n */\nexport default defineComponent({\n name: 'SortDropdown',\n components: { BaseDropdown },\n props: {\n /** The transition to use for opening and closing the dropdown. */\n animation: [String, Object] as PropType<string | Component>,\n /** The list of possible sort values. */\n items: {\n type: Array as PropType<Sort[]>,\n required: true,\n },\n selectedSort: {\n type: String as PropType<Sort>,\n required: true,\n },\n selectedSortProvidedEvent: {\n type: String as PropType<XEvent>,\n default: 'SelectedSortProvided',\n },\n clickedSortEvent: {\n type: String as PropType<XEvent>,\n default: 'UserClickedASort',\n },\n },\n emits: ['change'],\n setup(props, { emit }) {\n const $x = use$x()\n const rootRef = ref<typeof BaseDropdown>()\n\n watch(\n () => props.selectedSort,\n value => $x.emit(props.selectedSortProvidedEvent, value),\n {\n immediate: true,\n },\n )\n\n /**\n * Emits the events related to the selection of a sort value.\n *\n * @remarks `(rootRef.value as any)?.$el` because rollup-plugin-vue understands\n * `ref<typeof BaseDropdown>` as VueConstructor which doesn't contain $el.\n *\n * @param sort - The selected sort.\n */\n function emitUserClickedASort(sort: Sort) {\n $x.emit(props.clickedSortEvent, sort, { target: (rootRef.value as any)?.$el })\n emit('change', sort)\n }\n\n return {\n emitUserClickedASort,\n rootRef,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Sort Dropdown\n\nThe `SortDropdown` component can be used to change the way the search results are ordered.\n\nTo do so, the list of valid sort values has to be provided using the `items` prop. These are the\nvalues that can be received then in the `SearchAdapter`.\n\nThe component also optionally accepts the selected sort, which can be set using the `v-model` prop.\nThis prop allows changing programmatically the selected sort, as it will be synced with the store\nimmediately. If this prop is not provided, the first item from the `items` prop will be the one\nselected by default.\n\nThis component also allows customizing both the toggle button and each one of the possible sort\nvalues. This can be done with the `toggle` and `item` slots.\n\n## Events\n\nThis component emits 2 different events:\n\n- [`SelectedSortProvided`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n To sync the selected sort with the store state value. This event is emitted as soon as the list of\n items is received, whenever this list changes if there is no provided value, and when the provided\n value changes.\n- [`UserClickedASort`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n As its name suggests, the event is emitted after the user clicks one of the sort options. This does\n not mean that the sort has changed, only that the user has clicked it.\n\n## Examples\n\n### Only providing the list of items\n\n```vue\n<template>\n <SortDropdown :items=\"sortValues\">\n <template #toggle=\"{ item, isOpen }\">{{ item }} {{ isOpen ? '🔼' : '🔽' }}</template>\n <template #item=\"{ item, isHighlighted, isSelected }\">\n <span v-if=\"isSelected\">✅</span>\n <span v-if=\"isHighlighted\">🟢</span>\n {{ item }}\n </template>\n </SortDropdown>\n</template>\n\n<script setup>\nimport { SortDropdown } from '@empathyco/x-components/search'\nimport { ref } from 'vue'\n\nconst sortValues = ref(['Relevance', 'Price asc', 'Price desc'])\n</script>\n```\n\n### Providing also the selected value\n\n```vue\n<template>\n <SortDropdown v-model=\"selectedSort\" :items=\"sortValues\">\n <template #toggle=\"{ item, isOpen }\">{{ item }} {{ isOpen ? '🔼' : '🔽' }}</template>\n <template #item=\"{ item, isHighlighted, isSelected }\">\n <span v-if=\"isSelected\">✅</span>\n <span v-if=\"isHighlighted\">🟢</span>\n {{ item }}\n </template>\n </SortDropdown>\n</template>\n\n<script setup>\nimport { SortDropdown } from '@empathyco/x-components/search'\nimport { ref } from 'vue'\n\nconst selectedSort = ref('Price asc')\nconst sortValues = ref(['Relevance', 'Price asc', 'Price desc'])\n</script>\n```\n</docs>\n"],"names":["_createBlock","_withCtx","_renderSlot","_normalizeProps","_guardReactiveProps","_createTextVNode"],"mappings":";;;;;;sBACEA,WAAA,CA6Be,uBAAA,EAAA;AAAA,IA5Bb,GAAA,EAAI,SAAA;AAAA,IACH,KAAA,EAAO,IAAA,CAAA,KAAA;AAAA,IACP,aAAA,EAAa,IAAA,CAAA,YAAA;AAAA,IACb,SAAA,EAAW,IAAA,CAAA,SAAA;AAAA,IACZ,KAAA,EAAM,iBAAA;AAAA,IACN,WAAA,EAAU,eAAA;AAAA,IACV,YAAA,EAAW,gBAAA;AAAA,IACV,qBAAA,EAAoB,IAAA,CAAA;AAAA,GAAA,EAAA;AAEV,IAAA,MAAA,EAAMC,OAAA,CAOf,CAA+D,EAP5C,MAAA,EAAQ,IAAA,EAAI,KAAA;AAAA,MAO/BC,UAAA,CAA+D,IAAA,CAAA,MAAA,EAAA,QAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAA/C,MAAA,EAAQ,IAAA,MAAxB,MAA+D;AAAA,QAAAC,eAAA;0BAAd,IAAI,CAAA;AAAA,UAAA;AAAA;AAAA;AAAA,OAAA;;AAE5C,IAAA,IAAA,EAAIJ,OAAA,CAQb,CAAgF,EAR/D,IAAA,EAAM,eAAe,UAAA,EAAU,KAAA;AAAA,MAQhDC,WAAgF,IAAA,CAAA,MAAA,EAAA,MAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAhE,IAAA,EAAM,aAAA,EAAe,UAAA,MAArC,MAAgF;AAAA,QAAAC,eAAA;0BAAd,IAAI,CAAA;AAAA,UAAA;AAAA;AAAA;AAAA,OAAA;;;;;;;;;;"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { defineComponent, ref, watch } from 'vue';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { useState } from '../../../composables/use-state.js';
|
|
5
|
-
import { searchXModule } from '../x-module.js';
|
|
2
|
+
import { use$x } from '../../composables/use-_x.js';
|
|
3
|
+
import BaseDropdown from '../base-dropdown.vue.js';
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
* The `SortDropdown` component allows user to select the search results order. This component
|
|
@@ -10,23 +8,33 @@ import { searchXModule } from '../x-module.js';
|
|
|
10
8
|
*/
|
|
11
9
|
var _sfc_main = defineComponent({
|
|
12
10
|
name: 'SortDropdown',
|
|
13
|
-
xModule: searchXModule.name,
|
|
14
11
|
components: { BaseDropdown },
|
|
15
12
|
props: {
|
|
13
|
+
/** The transition to use for opening and closing the dropdown. */
|
|
14
|
+
animation: [String, Object],
|
|
16
15
|
/** The list of possible sort values. */
|
|
17
16
|
items: {
|
|
18
17
|
type: Array,
|
|
19
18
|
required: true,
|
|
20
19
|
},
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
selectedSort: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
selectedSortProvidedEvent: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: 'SelectedSortProvided',
|
|
27
|
+
},
|
|
28
|
+
clickedSortEvent: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: 'UserClickedASort',
|
|
31
|
+
},
|
|
23
32
|
},
|
|
24
33
|
emits: ['change'],
|
|
25
|
-
setup(
|
|
34
|
+
setup(props, { emit }) {
|
|
26
35
|
const $x = use$x();
|
|
27
|
-
const { sort: selectedSort } = useState('search');
|
|
28
36
|
const rootRef = ref();
|
|
29
|
-
watch(selectedSort,
|
|
37
|
+
watch(() => props.selectedSort, value => $x.emit(props.selectedSortProvidedEvent, value), {
|
|
30
38
|
immediate: true,
|
|
31
39
|
});
|
|
32
40
|
/**
|
|
@@ -38,13 +46,12 @@ var _sfc_main = defineComponent({
|
|
|
38
46
|
* @param sort - The selected sort.
|
|
39
47
|
*/
|
|
40
48
|
function emitUserClickedASort(sort) {
|
|
41
|
-
$x.emit(
|
|
49
|
+
$x.emit(props.clickedSortEvent, sort, { target: rootRef.value?.$el });
|
|
42
50
|
emit('change', sort);
|
|
43
51
|
}
|
|
44
52
|
return {
|
|
45
53
|
emitUserClickedASort,
|
|
46
54
|
rootRef,
|
|
47
|
-
selectedSort,
|
|
48
55
|
};
|
|
49
56
|
},
|
|
50
57
|
});
|