@empathyco/x-components 3.0.0-alpha.166 → 3.0.0-alpha.169

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/core/index.js.map +1 -1
  3. package/design-system/full-theme.css +12 -13
  4. package/docs/API-reference/api/x-components.baseresultimage.md +0 -10
  5. package/docs/API-reference/api/x-components.md +2 -1
  6. package/docs/API-reference/api/x-components.querypreview.config.md +13 -0
  7. package/docs/API-reference/api/x-components.querypreview.maxitemstorender.md +13 -0
  8. package/docs/API-reference/api/x-components.querypreview.md +20 -6
  9. package/docs/API-reference/api/{x-components.baseresultimage.mounted.md → x-components.querypreview.mounted.md} +3 -3
  10. package/docs/API-reference/api/x-components.querypreview.params.md +13 -0
  11. package/docs/API-reference/api/x-components.querypreview.previewresults.md +13 -0
  12. package/docs/API-reference/api/x-components.querypreview.query.md +2 -2
  13. package/docs/API-reference/api/x-components.querypreview.queryorigin.md +13 -0
  14. package/docs/API-reference/api/x-components.querypreview.querypreviewrequest.md +13 -0
  15. package/docs/API-reference/api/x-components.querypreview.querypreviewresults.md +13 -0
  16. package/docs/API-reference/api/x-components.querypreview.results.md +18 -0
  17. package/docs/API-reference/api/x-components.querypreviewinfo.md +21 -0
  18. package/docs/API-reference/api/x-components.querypreviewinfo.query.md +13 -0
  19. package/docs/API-reference/api/{x-components.querypreview.title.md → x-components.querypreviewinfo.title.md} +2 -2
  20. package/docs/API-reference/api/x-components.searchmutations.md +1 -0
  21. package/docs/API-reference/api/x-components.searchmutations.updateresult.md +24 -0
  22. package/docs/API-reference/api/x-components.snippetconfig.md +1 -1
  23. package/docs/API-reference/api/x-components.snippetconfig.queriespreview.md +1 -1
  24. package/docs/API-reference/components/common/result/x-components.base-result-image.md +5 -5
  25. package/docs/API-reference/components/queries-preview/x-components.query-preview.md +192 -0
  26. package/js/components/animations/cross-fade.vue.js +2 -2
  27. package/js/components/animations/cross-fade.vue.js.map +1 -1
  28. package/js/components/animations/cross-fade.vue_rollup-plugin-vue_styles.0.vue.js +1 -1
  29. package/js/components/result/base-result-image.vue.js +21 -34
  30. package/js/components/result/base-result-image.vue.js.map +1 -1
  31. package/js/components/result/base-result-image.vue_rollup-plugin-vue_script.vue.js +24 -69
  32. package/js/components/result/base-result-image.vue_rollup-plugin-vue_script.vue.js.map +1 -1
  33. package/js/components/result/base-result-image.vue_rollup-plugin-vue_styles.0.vue.js +1 -1
  34. package/js/index.js +1 -0
  35. package/js/index.js.map +1 -1
  36. package/js/x-modules/queries-preview/components/query-preview.vue.js +100 -0
  37. package/js/x-modules/queries-preview/components/query-preview.vue.js.map +1 -0
  38. package/js/x-modules/queries-preview/components/query-preview.vue_rollup-plugin-vue_script.vue.js +102 -0
  39. package/js/x-modules/queries-preview/components/query-preview.vue_rollup-plugin-vue_script.vue.js.map +1 -0
  40. package/js/x-modules/queries-preview/wiring.js.map +1 -1
  41. package/js/x-modules/search/store/module.js +6 -0
  42. package/js/x-modules/search/store/module.js.map +1 -1
  43. package/package.json +2 -2
  44. package/queries-preview/index.js +1 -0
  45. package/report/x-components.api.json +430 -154
  46. package/report/x-components.api.md +19 -13
  47. package/types/components/result/base-result-image.vue.d.ts +10 -50
  48. package/types/components/result/base-result-image.vue.d.ts.map +1 -1
  49. package/types/x-installer/api/api.types.d.ts +2 -2
  50. package/types/x-installer/api/api.types.d.ts.map +1 -1
  51. package/types/x-modules/queries-preview/components/index.d.ts +2 -0
  52. package/types/x-modules/queries-preview/components/index.d.ts.map +1 -0
  53. package/types/x-modules/queries-preview/components/query-preview.vue.d.ts +74 -0
  54. package/types/x-modules/queries-preview/components/query-preview.vue.d.ts.map +1 -0
  55. package/types/x-modules/queries-preview/index.d.ts +1 -0
  56. package/types/x-modules/queries-preview/index.d.ts.map +1 -1
  57. package/types/x-modules/queries-preview/wiring.d.ts.map +1 -1
  58. package/types/x-modules/search/store/module.d.ts.map +1 -1
  59. package/types/x-modules/search/store/types.d.ts +6 -0
  60. package/types/x-modules/search/store/types.d.ts.map +1 -1
  61. package/docs/API-reference/api/x-components.baseresultimage._refs.md +0 -15
  62. package/docs/API-reference/api/x-components.baseresultimage.failedimages.md +0 -13
  63. package/docs/API-reference/api/x-components.baseresultimage.hasenteredview.md +0 -13
  64. package/docs/API-reference/api/x-components.baseresultimage.hasimageloaded.md +0 -13
package/CHANGELOG.md CHANGED
@@ -3,6 +3,45 @@
3
3
  All notable changes to this project will be documented in this file. See
4
4
  [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.0.0-alpha.169](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.168...@empathyco/x-components@3.0.0-alpha.169) (2022-09-08)
7
+
8
+ ### Features
9
+
10
+ - **search:** add `updateResult` mutation (#706)
11
+ ([809e346](https://github.com/empathyco/x/commit/809e34694e5a54bd72e92272aa69a9123bef94c4)),
12
+ closes [EX-6894](https://searchbroker.atlassian.net/browse/EX-6894)
13
+
14
+ # Change Log
15
+
16
+ All notable changes to this project will be documented in this file. See
17
+ [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
18
+
19
+ ## [3.0.0-alpha.168](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.167...@empathyco/x-components@3.0.0-alpha.168) (2022-09-07)
20
+
21
+ ### Bug Fixes
22
+
23
+ - **components:** Fix the error on console in `BaseResultImage` with `CrossFade` Animation. (#688)
24
+ ([3bcf6e1](https://github.com/empathyco/x/commit/3bcf6e120918b4257f38ddb5078adfe39a7c8a3f)),
25
+ closes [EX-6924](https://searchbroker.atlassian.net/browse/EX-6924)
26
+
27
+ # Change Log
28
+
29
+ All notable changes to this project will be documented in this file. See
30
+ [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
31
+
32
+ ## [3.0.0-alpha.167](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.166...@empathyco/x-components@3.0.0-alpha.167) (2022-09-06)
33
+
34
+ ### Features
35
+
36
+ - **queries-preview:** add query preview component (#699)
37
+ ([676cda4](https://github.com/empathyco/x/commit/676cda42a3cbd37ee00e3200a89854c6c1bec3ee)),
38
+ closes [EX-6845](https://searchbroker.atlassian.net/browse/EX-6845)
39
+
40
+ # Change Log
41
+
42
+ All notable changes to this project will be documented in this file. See
43
+ [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
44
+
6
45
  ## [3.0.0-alpha.166](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.165...@empathyco/x-components@3.0.0-alpha.166) (2022-09-02)
7
46
 
8
47
  ### Bug Fixes
package/core/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1426,6 +1426,18 @@
1426
1426
  --x-size-border-radius-bottom-right-input-group-pill: var(--x-size-border-radius-input-group-pill);
1427
1427
  --x-size-border-radius-bottom-left-input-group-pill: var(--x-size-border-radius-input-group-pill);
1428
1428
  }
1429
+ .x-input--card.x-input,
1430
+ .x-input--card .x-input {
1431
+ --x-size-border-radius-input-default: var(--x-size-border-radius-input-card);
1432
+ --x-size-border-radius-top-left-input-default: var(--x-size-border-radius-top-left-input-card);
1433
+ --x-size-border-radius-top-right-input-default: var(--x-size-border-radius-top-right-input-card);
1434
+ --x-size-border-radius-bottom-right-input-default: var(
1435
+ --x-size-border-radius-bottom-right-input-card
1436
+ );
1437
+ --x-size-border-radius-bottom-left-input-default: var(
1438
+ --x-size-border-radius-bottom-left-input-card
1439
+ );
1440
+ }
1429
1441
  :root {
1430
1442
  --x-size-border-radius-input-card: var(--x-size-border-radius-base-s);
1431
1443
  --x-size-border-radius-top-left-input-card: var(--x-size-border-radius-input-card);
@@ -7471,16 +7483,3 @@
7471
7483
  .x-normal-case {
7472
7484
  text-transform: none;
7473
7485
  }
7474
-
7475
- .x-input--card.x-input,
7476
- .x-input--card .x-input {
7477
- --x-size-border-radius-input-default: var(--x-size-border-radius-input-card);
7478
- --x-size-border-radius-top-left-input-default: var(--x-size-border-radius-top-left-input-card);
7479
- --x-size-border-radius-top-right-input-default: var(--x-size-border-radius-top-right-input-card);
7480
- --x-size-border-radius-bottom-right-input-default: var(
7481
- --x-size-border-radius-bottom-right-input-card
7482
- );
7483
- --x-size-border-radius-bottom-left-input-default: var(
7484
- --x-size-border-radius-bottom-left-input-card
7485
- );
7486
- }
@@ -17,16 +17,6 @@ export default class BaseResultImage extends Vue
17
17
 
18
18
  | Property | Modifiers | Type | Description |
19
19
  | --- | --- | --- | --- |
20
- | [$refs](./x-components.baseresultimage._refs.md) | | { image: HTMLElement; } | HTMLElement that references the picture element. |
21
20
  | [animation](./x-components.baseresultimage.animation.md) | | string \| typeof Vue | Animation to use when switching between the placeholder, the loaded image, or the failed image fallback. |
22
- | [failedImages](./x-components.baseresultimage.failedimages.md) | | string\[\] | An array of images that failed to load. |
23
- | [hasEnteredView](./x-components.baseresultimage.hasenteredview.md) | | boolean | The image has entered in the port view. |
24
- | [hasImageLoaded](./x-components.baseresultimage.hasimageloaded.md) | | boolean | Indicates if the result image is loaded. |
25
21
  | [result](./x-components.baseresultimage.result.md) | | Result | (Required) The [result](./x-types.result.md) information. |
26
22
 
27
- ## Methods
28
-
29
- | Method | Modifiers | Description |
30
- | --- | --- | --- |
31
- | [mounted()](./x-components.baseresultimage.mounted.md) | | |
32
-
@@ -104,6 +104,7 @@ X-Components is a library usable everywhere not only for search experiences.
104
104
  | [PreselectedFilters](./x-components.preselectedfilters.md) | This component emits [FacetsXEvents.PreselectedFiltersProvided](./x-components.facetsxevents.preselectedfiltersprovided.md) when a preselected filter is set in the snippet config or by using the prop of the component. |
105
105
  | [Promoted](./x-components.promoted.md) | A promoted result is just an item that has been inserted into the search results to advertise something. Usually it is one of the first items in the grid, and has the same shape as a result. It just contains a link to the promoted content, an image, and a title. |
106
106
  | [PromotedsList](./x-components.promotedslist.md) | It renders a [ItemsList](./x-components.itemslist.md) of promoteds from [SearchState.promoteds](./x-components.searchstate.promoteds.md) by default using the <code>ItemsInjectionMixin</code>.<!-- -->The component provides a default slot which wraps the whole component with the <code>promoteds</code> plus the <code>searchInjectedItems</code> which also contains the injected list items from the ancestor.<!-- -->It also provides the parent slots to customize the items. |
107
+ | [QueryPreview](./x-components.querypreview.md) | Retrieves a preview of the results of a query and exposes them in the default slot, along with the query preview and the totalResults of the search request. By default, it renders the names of the results. |
107
108
  | [QuerySuggestion](./x-components.querysuggestion.md) | This component renders a suggestion for a query. A query suggestion is a recommended query based on previous search queries. It contains the query itself and a set of filters associated. For example, if you're searching for \_shirt\_, a query suggestion could be \_long sleeve shirt\_. |
108
109
  | [QuerySuggestions](./x-components.querysuggestions.md) | This component renders a list of possible search queries to select from as a query is entered in the input field. By default, this is a list of \[<code>QuerySuggestion</code>\](./x-components.query-suggestion.md) components. |
109
110
  | [QuerySuggestionsGetter](./x-components.querysuggestionsgetter.md) | Class implementation for the [QuerySuggestionsGetter.querySuggestions()](./x-components.querysuggestionsgetter.querysuggestions.md) getter. |
@@ -280,7 +281,7 @@ X-Components is a library usable everywhere not only for search experiences.
280
281
  | [QueriesPreviewMutations](./x-components.queriespreviewmutations.md) | QueriesPreview store mutations. |
281
282
  | [QueriesPreviewState](./x-components.queriespreviewstate.md) | QueriesPreview store state. |
282
283
  | [QueriesPreviewXEvents](./x-components.queriespreviewxevents.md) | Dictionary of the events of QueriesPreview XModule, where each key is the event name, and the value is the event payload type or <code>void</code> if it has no payload. |
283
- | [QueryPreview](./x-components.querypreview.md) | Information to render a query preview with. |
284
+ | [QueryPreviewInfo](./x-components.querypreviewinfo.md) | Information to render a query preview with. |
284
285
  | [QueryPreviewItem](./x-components.querypreviewitem.md) | QueriesPreview store state. |
285
286
  | [QueryPreviewStatusPayload](./x-components.querypreviewstatuspayload.md) | Payload to use in the <code>setStatus</code> mutation. |
286
287
  | [QuerySuggestionsActions](./x-components.querysuggestionsactions.md) | QuerySuggestions store actions. |
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [QueryPreview](./x-components.querypreview.md) &gt; [config](./x-components.querypreview.config.md)
4
+
5
+ ## QueryPreview.config property
6
+
7
+ As the request is handled in this component, we need the config that will be used in the request.
8
+
9
+ <b>Signature:</b>
10
+
11
+ ```typescript
12
+ config: QueriesPreviewConfig;
13
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [QueryPreview](./x-components.querypreview.md) &gt; [maxItemsToRender](./x-components.querypreview.maxitemstorender.md)
4
+
5
+ ## QueryPreview.maxItemsToRender property
6
+
7
+ Number of query preview results to be rendered.
8
+
9
+ <b>Signature:</b>
10
+
11
+ ```typescript
12
+ protected maxItemsToRender?: number;
13
+ ```
@@ -2,20 +2,34 @@
2
2
 
3
3
  [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [QueryPreview](./x-components.querypreview.md)
4
4
 
5
- ## QueryPreview interface
5
+ ## QueryPreview class
6
6
 
7
- Information to render a query preview with.
7
+ Retrieves a preview of the results of a query and exposes them in the default slot, along with the query preview and the totalResults of the search request. By default, it renders the names of the results.
8
8
 
9
9
  <b>Signature:</b>
10
10
 
11
11
  ```typescript
12
- export interface QueryPreview
12
+ export default class QueryPreview extends Vue
13
13
  ```
14
+ <b>Extends:</b> Vue
14
15
 
15
16
  ## Properties
16
17
 
17
- | Property | Type | Description |
18
+ | Property | Modifiers | Type | Description |
19
+ | --- | --- | --- | --- |
20
+ | [config](./x-components.querypreview.config.md) | | [QueriesPreviewConfig](./x-components.queriespreviewconfig.md) | As the request is handled in this component, we need the config that will be used in the request. |
21
+ | [maxItemsToRender?](./x-components.querypreview.maxitemstorender.md) | | number | <i>(Optional)</i> Number of query preview results to be rendered. |
22
+ | [params](./x-components.querypreview.params.md) | | Dictionary&lt;unknown&gt; | As the request is handled in this component, we need the extra params that will be used in the request. |
23
+ | [previewResults](./x-components.querypreview.previewresults.md) | | Dictionary&lt;[QueryPreviewItem](./x-components.querypreviewitem.md)<!-- -->&gt; | The results preview of the queries preview mounted. It is a dictionary, indexed by the query preview query. |
24
+ | [query](./x-components.querypreview.query.md) | | string | The query to retrieve the results preview. |
25
+ | [queryOrigin](./x-components.querypreview.queryorigin.md) | | [QueryOrigin](./x-components.queryorigin.md) \| undefined | . The origin property for the request |
26
+ | [queryPreviewRequest](./x-components.querypreview.querypreviewrequest.md) | | SearchRequest | The computed request object to be used to retrieve the query preview results. |
27
+ | [queryPreviewResults](./x-components.querypreview.querypreviewresults.md) | | Partial&lt;[QueryPreviewItem](./x-components.querypreviewitem.md)<!-- -->&gt; \| undefined | Gets from the state the results preview of the query preview. |
28
+ | [results](./x-components.querypreview.results.md) | | Result\[\] \| undefined | The results to render from the state. |
29
+
30
+ ## Methods
31
+
32
+ | Method | Modifiers | Description |
18
33
  | --- | --- | --- |
19
- | [query](./x-components.querypreview.query.md) | string | The query to search for. |
20
- | [title?](./x-components.querypreview.title.md) | string | <i>(Optional)</i> An optional title for the container. |
34
+ | [mounted()](./x-components.querypreview.mounted.md) | | |
21
35
 
@@ -1,13 +1,13 @@
1
1
  <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
2
 
3
- [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [BaseResultImage](./x-components.baseresultimage.md) &gt; [mounted](./x-components.baseresultimage.mounted.md)
3
+ [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [QueryPreview](./x-components.querypreview.md) &gt; [mounted](./x-components.querypreview.mounted.md)
4
4
 
5
- ## BaseResultImage.mounted() method
5
+ ## QueryPreview.mounted() method
6
6
 
7
7
  <b>Signature:</b>
8
8
 
9
9
  ```typescript
10
- mounted(): void;
10
+ protected mounted(): void;
11
11
  ```
12
12
  <b>Returns:</b>
13
13
 
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [QueryPreview](./x-components.querypreview.md) &gt; [params](./x-components.querypreview.params.md)
4
+
5
+ ## QueryPreview.params property
6
+
7
+ As the request is handled in this component, we need the extra params that will be used in the request.
8
+
9
+ <b>Signature:</b>
10
+
11
+ ```typescript
12
+ params: Dictionary<unknown>;
13
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [QueryPreview](./x-components.querypreview.md) &gt; [previewResults](./x-components.querypreview.previewresults.md)
4
+
5
+ ## QueryPreview.previewResults property
6
+
7
+ The results preview of the queries preview mounted. It is a dictionary, indexed by the query preview query.
8
+
9
+ <b>Signature:</b>
10
+
11
+ ```typescript
12
+ previewResults: Dictionary<QueryPreviewItem>;
13
+ ```
@@ -4,10 +4,10 @@
4
4
 
5
5
  ## QueryPreview.query property
6
6
 
7
- The query to search for.
7
+ The query to retrieve the results preview.
8
8
 
9
9
  <b>Signature:</b>
10
10
 
11
11
  ```typescript
12
- query: string;
12
+ protected query: string;
13
13
  ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [QueryPreview](./x-components.querypreview.md) &gt; [queryOrigin](./x-components.querypreview.queryorigin.md)
4
+
5
+ ## QueryPreview.queryOrigin property
6
+
7
+ . The origin property for the request
8
+
9
+ <b>Signature:</b>
10
+
11
+ ```typescript
12
+ protected queryOrigin: QueryOrigin | undefined;
13
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [QueryPreview](./x-components.querypreview.md) &gt; [queryPreviewRequest](./x-components.querypreview.querypreviewrequest.md)
4
+
5
+ ## QueryPreview.queryPreviewRequest property
6
+
7
+ The computed request object to be used to retrieve the query preview results.
8
+
9
+ <b>Signature:</b>
10
+
11
+ ```typescript
12
+ get queryPreviewRequest(): SearchRequest;
13
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [QueryPreview](./x-components.querypreview.md) &gt; [queryPreviewResults](./x-components.querypreview.querypreviewresults.md)
4
+
5
+ ## QueryPreview.queryPreviewResults property
6
+
7
+ Gets from the state the results preview of the query preview.
8
+
9
+ <b>Signature:</b>
10
+
11
+ ```typescript
12
+ get queryPreviewResults(): Partial<QueryPreviewItem> | undefined;
13
+ ```
@@ -0,0 +1,18 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [QueryPreview](./x-components.querypreview.md) &gt; [results](./x-components.querypreview.results.md)
4
+
5
+ ## QueryPreview.results property
6
+
7
+ The results to render from the state.
8
+
9
+ <b>Signature:</b>
10
+
11
+ ```typescript
12
+ get results(): Result[] | undefined;
13
+ ```
14
+
15
+ ## Remarks
16
+
17
+ The results list are provided with `items` key. It can be concatenated with list items from components such as `BannersList`<!-- -->, `PromotedsList`<!-- -->, `BaseGrid` or any component that injects the list.
18
+
@@ -0,0 +1,21 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [QueryPreviewInfo](./x-components.querypreviewinfo.md)
4
+
5
+ ## QueryPreviewInfo interface
6
+
7
+ Information to render a query preview with.
8
+
9
+ <b>Signature:</b>
10
+
11
+ ```typescript
12
+ export interface QueryPreviewInfo
13
+ ```
14
+
15
+ ## Properties
16
+
17
+ | Property | Type | Description |
18
+ | --- | --- | --- |
19
+ | [query](./x-components.querypreviewinfo.query.md) | string | The query to search for. |
20
+ | [title?](./x-components.querypreviewinfo.title.md) | string | <i>(Optional)</i> An optional title for the container. |
21
+
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [QueryPreviewInfo](./x-components.querypreviewinfo.md) &gt; [query](./x-components.querypreviewinfo.query.md)
4
+
5
+ ## QueryPreviewInfo.query property
6
+
7
+ The query to search for.
8
+
9
+ <b>Signature:</b>
10
+
11
+ ```typescript
12
+ query: string;
13
+ ```
@@ -1,8 +1,8 @@
1
1
  <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
2
 
3
- [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [QueryPreview](./x-components.querypreview.md) &gt; [title](./x-components.querypreview.title.md)
3
+ [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [QueryPreviewInfo](./x-components.querypreviewinfo.md) &gt; [title](./x-components.querypreviewinfo.title.md)
4
4
 
5
- ## QueryPreview.title property
5
+ ## QueryPreviewInfo.title property
6
6
 
7
7
  An optional title for the container.
8
8
 
@@ -36,4 +36,5 @@ export interface SearchMutations extends StatusMutations, QueryMutations
36
36
  | [setSort(sort)](./x-components.searchmutations.setsort.md) | Sets the selected sort option of the module. |
37
37
  | [setSpellcheck(spellcheckedQuery)](./x-components.searchmutations.setspellcheck.md) | Sets the spellcheckedQuery of the module. |
38
38
  | [setTotalResults(totalResults)](./x-components.searchmutations.settotalresults.md) | Sets the total results of the module. |
39
+ | [updateResult(result)](./x-components.searchmutations.updateresult.md) | Updates a result with new fields. |
39
40
 
@@ -0,0 +1,24 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@empathyco/x-components](./x-components.md) &gt; [SearchMutations](./x-components.searchmutations.md) &gt; [updateResult](./x-components.searchmutations.updateresult.md)
4
+
5
+ ## SearchMutations.updateResult() method
6
+
7
+ Updates a result with new fields.
8
+
9
+ <b>Signature:</b>
10
+
11
+ ```typescript
12
+ updateResult(result: Partial<Result> & Pick<Result, 'id'>): void;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ | Parameter | Type | Description |
18
+ | --- | --- | --- |
19
+ | result | Partial&lt;Result&gt; &amp; Pick&lt;Result, 'id'&gt; | A result containing at least an id, and the properties to modify. |
20
+
21
+ <b>Returns:</b>
22
+
23
+ void
24
+
@@ -26,7 +26,7 @@ export interface SnippetConfig
26
26
  | [isSpa?](./x-components.snippetconfig.isspa.md) | boolean | <i>(Optional)</i> Flag determining if the page is a single page application or not. |
27
27
  | [lang](./x-components.snippetconfig.lang.md) | string | Language to display. |
28
28
  | [productId?](./x-components.snippetconfig.productid.md) | string | <i>(Optional)</i> The id for the current product when product page is loaded. |
29
- | [queriesPreview?](./x-components.snippetconfig.queriespreview.md) | [QueryPreview](./x-components.querypreview.md)<!-- -->\[\] | <i>(Optional)</i> List of queries to preview. |
29
+ | [queriesPreview?](./x-components.snippetconfig.queriespreview.md) | [QueryPreviewInfo](./x-components.querypreviewinfo.md)<!-- -->\[\] | <i>(Optional)</i> List of queries to preview. |
30
30
  | [scope](./x-components.snippetconfig.scope.md) | string | Execution scope (desktop, mobile, app, ...). |
31
31
  | [searchLang?](./x-components.snippetconfig.searchlang.md) | string | <i>(Optional)</i> Language to send to backend services. |
32
32
 
@@ -9,5 +9,5 @@ List of queries to preview.
9
9
  <b>Signature:</b>
10
10
 
11
11
  ```typescript
12
- queriesPreview?: QueryPreview[];
12
+ queriesPreview?: QueryPreviewInfo[];
13
13
  ```
@@ -12,15 +12,15 @@ Component to be reused that renders an `<img>`.
12
12
 
13
13
  | Name | Description | Type | Default |
14
14
  | ---------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------- | ---------------------------- |
15
- | <code>animation</code> | Animation to use when switching between the placeholder, the loaded image, or the failed<br />image fallback. | <code>union</code> | <code>() => NoElement</code> |
16
15
  | <code>result</code> | (Required) The {@link @empathyco/x-types#Result \| result} information. | <code>Result</code> | <code></code> |
16
+ | <code>animation</code> | Animation to use when switching between the placeholder, the loaded image, or the failed<br />image fallback. | <code>union</code> | <code>() => NoElement</code> |
17
17
 
18
18
  ## Slots
19
19
 
20
- | Name | Description | Bindings<br />(name - type - description) |
21
- | ------------------------ | ---------------------------------------------------------------------------------------- | ----------------------------------------- |
22
- | <code>placeholder</code> | (Required) Loading image content. It will be rendered while the real image is not loaded | None |
23
- | <code>fallback</code> | (Required) Fallback image content. It will be rendered when all the images failed | None |
20
+ | Name | Description | Bindings<br />(name - type - description) |
21
+ | ------------------------ | ----------------------------------------------------------------------------- | ----------------------------------------- |
22
+ | <code>fallback</code> | Fallback image content. It will be rendered when all the images failed | None |
23
+ | <code>placeholder</code> | Loading image content. It will be rendered while the real image is not loaded | None |
24
24
 
25
25
  ## Examples
26
26
 
@@ -0,0 +1,192 @@
1
+ ---
2
+
3
+ title: QueryPreview
4
+
5
+ ---
6
+
7
+ # QueryPreview
8
+
9
+ Retrieves a preview of the results of a query and exposes them in the default slot,
10
+ along with the query preview and the totalResults of the search request.
11
+ By default, it renders the names of the results.
12
+
13
+ ## Props
14
+
15
+ | Name | Description | Type | Default |
16
+ | ----------------------------- | ----------------------------------------------- | ------------------- | ------------- |
17
+ | <code>query</code> | The query to retrieve the results preview. | <code>string</code> | <code></code> |
18
+ | <code>queryOrigin</code> | | <code>union</code> | <code></code> |
19
+ | <code>maxItemsToRender</code> | Number of query preview results to be rendered. | <code>number</code> | <code></code> |
20
+
21
+ ## Slots
22
+
23
+ | Name | Description | Bindings<br />(name - type - description) |
24
+ | -------------------- | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
25
+ | <code>default</code> | Query Preview default slot. | **query** <code>string</code> - query<br />**results** <code>Result[]</code> - The results preview of the query preview<br />**totalResults** <code>number</code> - The total results of the search request |
26
+ | <code>result</code> | Query Preview result slot. | **result** <code>Result</code> - A Query Preview result |
27
+
28
+ ## Events
29
+
30
+ A list of events that the component will emit:
31
+
32
+ - `QueryPreviewRequestChanged`: the event is emitted when the component is mounted and when the
33
+ properties of the request object changes. The event payload is the `queryPreviewRequest` object.
34
+
35
+ ## See it in action
36
+
37
+ Here you have a basic example of how the QueryPreview is rendered. Keep in mind that this component
38
+ is intended to be used overriding its default slot. By default it will only render the names of the
39
+ results.
40
+
41
+ ```vue live
42
+ <template>
43
+ <QueryPreview :query="query" />
44
+ </template>
45
+
46
+ <script>
47
+ import { QueryPreview } from "@empathyco/x-components/queries-preview";
48
+
49
+ export default {
50
+ name: "QueryPreviewDemo",
51
+ components: {
52
+ QueryPreview
53
+ },
54
+ data() {
55
+ return {
56
+ query: "sandals"
57
+ };
58
+ }
59
+ };
60
+ </script>
61
+ ```
62
+
63
+ ### Play with the default slot
64
+
65
+ In this example, the results will be rendered inside a sliding panel.
66
+
67
+ ```vue live
68
+ <template>
69
+ <QueryPreview :query="query" #default="{ totalResults, results }">
70
+ <section>
71
+ <p>Total results: {{ totalResults }}</p>
72
+ <SlidingPanel :resetOnContentChange="false">
73
+ <article
74
+ v-for="result in results"
75
+ :key="result.id"
76
+ class="x-result"
77
+ style="max-width: 300px; overflow: hidden"
78
+ >
79
+ <BaseResultLink :result="result">
80
+ <BaseResultImage :result="result" class="x-result__picture" />
81
+ </BaseResultLink>
82
+ <div class="x-result__description">
83
+ <BaseResultLink :result="result">
84
+ <h1 class="x-title3">{{ result.name }}</h1>
85
+ </BaseResultLink>
86
+ </div>
87
+ </article>
88
+ </SlidingPanel>
89
+ </section>
90
+ </QueryPreview>
91
+ </template>
92
+
93
+ <script>
94
+ import { QueryPreview } from "@empathyco/x-components/queries-preview";
95
+ import {
96
+ BaseResultImage,
97
+ BaseResultLink,
98
+ SlidingPanel
99
+ } from "@empathyco/x-components";
100
+
101
+ export default {
102
+ name: "QueryPreviewDemoOverridingSlot",
103
+ components: {
104
+ BaseResultImage,
105
+ BaseResultLink,
106
+ QueryPreview,
107
+ SlidingPanel
108
+ },
109
+ data() {
110
+ return {
111
+ query: "flip-flops"
112
+ };
113
+ }
114
+ };
115
+ </script>
116
+ ```
117
+
118
+ ### Play with the result slot
119
+
120
+ The component exposes a slot to override the result content, without modifying the list.
121
+
122
+ In this example, the ID of the results will be rendered along with the name.
123
+
124
+ ```vue
125
+ <template>
126
+ <QueryPreview :query="query" #result="{ result }">
127
+ <span>{{ result.id }}</span>
128
+ <span>{{ result.name }}</span>
129
+ </QueryPreview>
130
+ </template>
131
+
132
+ <script>
133
+ import { QueryPreview } from "@empathyco/x-components/queries-preview";
134
+
135
+ export default {
136
+ name: "QueryPreviewDemoOverridingResultSlot",
137
+ components: {
138
+ QueryPreview
139
+ },
140
+ data() {
141
+ return {
142
+ query: "flips-flops"
143
+ };
144
+ }
145
+ };
146
+ </script>
147
+ ```
148
+
149
+ ### Play with props
150
+
151
+ In this example, the query preview has been limited to render a maximum of 4 results.
152
+
153
+ ```vue
154
+ <template>
155
+ <QueryPreview
156
+ :maxItemsToRender="maxItemsToRender"
157
+ :query="query"
158
+ #default="{ results }"
159
+ >
160
+ <BaseGrid #default="{ item }" :items="results">
161
+ <BaseResultLink :result="item">
162
+ <BaseResultImage :result="item" />
163
+ </BaseResultLink>
164
+ </BaseGrid>
165
+ </QueryPreview>
166
+ </template>
167
+
168
+ <script>
169
+ import {
170
+ BaseGrid,
171
+ BaseResultImage,
172
+ BaseResultLink
173
+ } from "@empathyco/x-components";
174
+ import { QueryPreview } from "@empathyco/x-components/queries-preview";
175
+
176
+ export default {
177
+ name: "QueryPreviewDemo",
178
+ components: {
179
+ BaseGrid,
180
+ BaseResultImage,
181
+ BaseResultLink,
182
+ QueryPreview
183
+ },
184
+ data() {
185
+ return {
186
+ maxItemsToRender: 4,
187
+ query: "flips-flops"
188
+ };
189
+ }
190
+ };
191
+ </script>
192
+ ```