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

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 (41) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/core/index.js.map +1 -1
  3. package/design-system/full-theme.css +28 -29
  4. package/docs/API-reference/api/x-components.md +2 -1
  5. package/docs/API-reference/api/x-components.querypreview.config.md +13 -0
  6. package/docs/API-reference/api/x-components.querypreview.maxitemstorender.md +13 -0
  7. package/docs/API-reference/api/x-components.querypreview.md +20 -6
  8. package/docs/API-reference/api/x-components.querypreview.mounted.md +15 -0
  9. package/docs/API-reference/api/x-components.querypreview.params.md +13 -0
  10. package/docs/API-reference/api/x-components.querypreview.previewresults.md +13 -0
  11. package/docs/API-reference/api/x-components.querypreview.query.md +2 -2
  12. package/docs/API-reference/api/x-components.querypreview.queryorigin.md +13 -0
  13. package/docs/API-reference/api/x-components.querypreview.querypreviewrequest.md +13 -0
  14. package/docs/API-reference/api/x-components.querypreview.querypreviewresults.md +13 -0
  15. package/docs/API-reference/api/x-components.querypreview.results.md +18 -0
  16. package/docs/API-reference/api/x-components.querypreviewinfo.md +21 -0
  17. package/docs/API-reference/api/x-components.querypreviewinfo.query.md +13 -0
  18. package/docs/API-reference/api/{x-components.querypreview.title.md → x-components.querypreviewinfo.title.md} +2 -2
  19. package/docs/API-reference/api/x-components.snippetconfig.md +1 -1
  20. package/docs/API-reference/api/x-components.snippetconfig.queriespreview.md +1 -1
  21. package/docs/API-reference/components/queries-preview/x-components.query-preview.md +192 -0
  22. package/js/index.js +1 -0
  23. package/js/index.js.map +1 -1
  24. package/js/x-modules/queries-preview/components/query-preview.vue.js +100 -0
  25. package/js/x-modules/queries-preview/components/query-preview.vue.js.map +1 -0
  26. package/js/x-modules/queries-preview/components/query-preview.vue_rollup-plugin-vue_script.vue.js +102 -0
  27. package/js/x-modules/queries-preview/components/query-preview.vue_rollup-plugin-vue_script.vue.js.map +1 -0
  28. package/js/x-modules/queries-preview/wiring.js.map +1 -1
  29. package/package.json +2 -2
  30. package/queries-preview/index.js +1 -0
  31. package/report/x-components.api.json +354 -8
  32. package/report/x-components.api.md +17 -2
  33. package/types/x-installer/api/api.types.d.ts +2 -2
  34. package/types/x-installer/api/api.types.d.ts.map +1 -1
  35. package/types/x-modules/queries-preview/components/index.d.ts +2 -0
  36. package/types/x-modules/queries-preview/components/index.d.ts.map +1 -0
  37. package/types/x-modules/queries-preview/components/query-preview.vue.d.ts +74 -0
  38. package/types/x-modules/queries-preview/components/query-preview.vue.d.ts.map +1 -0
  39. package/types/x-modules/queries-preview/index.d.ts +1 -0
  40. package/types/x-modules/queries-preview/index.d.ts.map +1 -1
  41. package/types/x-modules/queries-preview/wiring.d.ts.map +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,19 @@
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.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)
7
+
8
+ ### Features
9
+
10
+ - **queries-preview:** add query preview component (#699)
11
+ ([676cda4](https://github.com/empathyco/x/commit/676cda42a3cbd37ee00e3200a89854c6c1bec3ee)),
12
+ closes [EX-6845](https://searchbroker.atlassian.net/browse/EX-6845)
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
+
6
19
  ## [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
20
 
8
21
  ### 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1403,22 +1403,6 @@
1403
1403
  --x-size-border-width-bottom-input-group-line: var(--x-size-border-width-input-group-line);
1404
1404
  --x-size-border-width-left-input-group-line: 0;
1405
1405
  }
1406
- .x-input-group--pill.x-input-group,
1407
- .x-input-group--pill .x-input-group {
1408
- --x-size-border-radius-input-group-default: var(--x-size-border-radius-input-group-pill);
1409
- --x-size-border-radius-top-left-input-group-default: var(
1410
- --x-size-border-radius-top-left-input-group-pill
1411
- );
1412
- --x-size-border-radius-top-right-input-group-default: var(
1413
- --x-size-border-radius-top-right-input-group-pill
1414
- );
1415
- --x-size-border-radius-bottom-right-input-group-default: var(
1416
- --x-size-border-radius-bottom-right-input-group-pill
1417
- );
1418
- --x-size-border-radius-bottom-left-input-group-default: var(
1419
- --x-size-border-radius-bottom-left-input-group-pill
1420
- );
1421
- }
1422
1406
  :root {
1423
1407
  --x-size-border-radius-input-group-pill: var(--x-size-border-radius-base-pill);
1424
1408
  --x-size-border-radius-top-left-input-group-pill: var(--x-size-border-radius-input-group-pill);
@@ -1426,6 +1410,18 @@
1426
1410
  --x-size-border-radius-bottom-right-input-group-pill: var(--x-size-border-radius-input-group-pill);
1427
1411
  --x-size-border-radius-bottom-left-input-group-pill: var(--x-size-border-radius-input-group-pill);
1428
1412
  }
1413
+ .x-input--card.x-input,
1414
+ .x-input--card .x-input {
1415
+ --x-size-border-radius-input-default: var(--x-size-border-radius-input-card);
1416
+ --x-size-border-radius-top-left-input-default: var(--x-size-border-radius-top-left-input-card);
1417
+ --x-size-border-radius-top-right-input-default: var(--x-size-border-radius-top-right-input-card);
1418
+ --x-size-border-radius-bottom-right-input-default: var(
1419
+ --x-size-border-radius-bottom-right-input-card
1420
+ );
1421
+ --x-size-border-radius-bottom-left-input-default: var(
1422
+ --x-size-border-radius-bottom-left-input-card
1423
+ );
1424
+ }
1429
1425
  :root {
1430
1426
  --x-size-border-radius-input-card: var(--x-size-border-radius-base-s);
1431
1427
  --x-size-border-radius-top-left-input-card: var(--x-size-border-radius-input-card);
@@ -1491,6 +1487,22 @@
1491
1487
  font-weight: var(--x-number-font-weight-input-placeholder-default);
1492
1488
  line-height: var(--x-size-line-height-input-placeholder-default);
1493
1489
  }
1490
+ .x-input-group--pill.x-input-group,
1491
+ .x-input-group--pill .x-input-group {
1492
+ --x-size-border-radius-input-group-default: var(--x-size-border-radius-input-group-pill);
1493
+ --x-size-border-radius-top-left-input-group-default: var(
1494
+ --x-size-border-radius-top-left-input-group-pill
1495
+ );
1496
+ --x-size-border-radius-top-right-input-group-default: var(
1497
+ --x-size-border-radius-top-right-input-group-pill
1498
+ );
1499
+ --x-size-border-radius-bottom-right-input-group-default: var(
1500
+ --x-size-border-radius-bottom-right-input-group-pill
1501
+ );
1502
+ --x-size-border-radius-bottom-left-input-group-default: var(
1503
+ --x-size-border-radius-bottom-left-input-group-pill
1504
+ );
1505
+ }
1494
1506
  :root {
1495
1507
  --x-color-background-input-default: var(--x-color-base-neutral-100);
1496
1508
  --x-color-border-input-default: var(--x-color-base-neutral-70);
@@ -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
- }
@@ -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
 
@@ -0,0 +1,15 @@
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; [mounted](./x-components.querypreview.mounted.md)
4
+
5
+ ## QueryPreview.mounted() method
6
+
7
+ <b>Signature:</b>
8
+
9
+ ```typescript
10
+ protected mounted(): void;
11
+ ```
12
+ <b>Returns:</b>
13
+
14
+ void
15
+
@@ -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
 
@@ -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
  ```
@@ -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
+ ```
package/js/index.js CHANGED
@@ -265,6 +265,7 @@ export { popularSearches } from './x-modules/popular-searches/store/getters/popu
265
265
  export { popularSearchesXStoreModule } from './x-modules/popular-searches/store/module.js';
266
266
  export { popularSearchesWiring, setPopularSearchesExtraParams, setSearchedQueriesInPopularSearches } from './x-modules/popular-searches/wiring.js';
267
267
  export { popularSearchesXModule } from './x-modules/popular-searches/x-module.js';
268
+ export { default as QueryPreview } from './x-modules/queries-preview/components/query-preview.vue.js';
268
269
  export { fetchQueryPreview } from './x-modules/queries-preview/store/actions/fetch-query-preview.action.js';
269
270
  export { fetchAndSaveQueryPreview } from './x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.js';
270
271
  export { queriesPreviewEmitters } from './x-modules/queries-preview/store/emitters.js';
package/js/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}