@empathyco/x-components 6.0.0-alpha.237 → 6.0.0-alpha.239

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 (340) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/core/index.d.ts +0 -1
  3. package/docs/API-reference/api/x-components.aioverview.md +0 -21
  4. package/docs/API-reference/api/x-components.allfilter.md +1 -1
  5. package/docs/API-reference/api/x-components.highlight_2.md +1 -1
  6. package/docs/API-reference/api/x-components.md +0 -11
  7. package/docs/API-reference/api/x-components.slidingpanel.md +2 -2
  8. package/docs/API-reference/components/ai/x-components.ai-overview.md +0 -3
  9. package/docs/API-reference/components/common/column-picker/x-components.base-column-picker-list.md +1 -1
  10. package/docs/API-reference/components/common/x-components.base-slider.md +2 -2
  11. package/js/components/animations/change-height.vue.js.map +1 -1
  12. package/js/components/animations/change-height.vue2.js.map +1 -1
  13. package/js/components/auto-progress-bar.vue.js +2 -2
  14. package/js/components/auto-progress-bar.vue.js.map +1 -1
  15. package/js/components/auto-progress-bar.vue2.js.map +1 -1
  16. package/js/components/base-slider.vue.js.map +1 -1
  17. package/js/components/base-slider.vue2.js.map +1 -1
  18. package/js/components/base-slider.vue3.js +1 -1
  19. package/js/components/base-switch.vue.js.map +1 -1
  20. package/js/components/base-switch.vue2.js +1 -1
  21. package/js/components/base-switch.vue2.js.map +1 -1
  22. package/js/components/column-picker/base-column-picker-list.vue.js +2 -2
  23. package/js/components/column-picker/base-column-picker-list.vue.js.map +1 -1
  24. package/js/components/column-picker/base-column-picker-list.vue2.js +1 -1
  25. package/js/components/column-picker/base-column-picker-list.vue2.js.map +1 -1
  26. package/js/components/highlight.vue.js +1 -1
  27. package/js/components/highlight.vue.js.map +1 -1
  28. package/js/components/highlight.vue2.js +1 -1
  29. package/js/components/highlight.vue2.js.map +1 -1
  30. package/js/components/icons/ai-star.vue.js +1 -0
  31. package/js/components/icons/ai-star.vue.js.map +1 -1
  32. package/js/components/icons/arrow-down.vue.js +1 -1
  33. package/js/components/icons/arrow-down.vue.js.map +1 -1
  34. package/js/components/icons/arrow-left.vue.js +1 -1
  35. package/js/components/icons/arrow-left.vue.js.map +1 -1
  36. package/js/components/icons/arrow-right.vue.js +1 -1
  37. package/js/components/icons/arrow-right.vue.js.map +1 -1
  38. package/js/components/icons/arrow-up.vue.js +1 -1
  39. package/js/components/icons/arrow-up.vue.js.map +1 -1
  40. package/js/components/icons/bag.vue.js +1 -1
  41. package/js/components/icons/bag.vue.js.map +1 -1
  42. package/js/components/icons/bar-code.vue.js +1 -1
  43. package/js/components/icons/bar-code.vue.js.map +1 -1
  44. package/js/components/icons/barcode-tiny.vue.js +1 -1
  45. package/js/components/icons/barcode-tiny.vue.js.map +1 -1
  46. package/js/components/icons/cart-filled.vue.js +1 -1
  47. package/js/components/icons/cart-filled.vue.js.map +1 -1
  48. package/js/components/icons/cart.vue.js +1 -1
  49. package/js/components/icons/cart.vue.js.map +1 -1
  50. package/js/components/icons/check-tiny.vue.js +1 -1
  51. package/js/components/icons/check-tiny.vue.js.map +1 -1
  52. package/js/components/icons/check.vue.js +1 -1
  53. package/js/components/icons/check.vue.js.map +1 -1
  54. package/js/components/icons/checkbox-selected-filled.vue.js +1 -1
  55. package/js/components/icons/checkbox-selected-filled.vue.js.map +1 -1
  56. package/js/components/icons/checkbox-selected.vue.js +1 -1
  57. package/js/components/icons/checkbox-selected.vue.js.map +1 -1
  58. package/js/components/icons/checkbox-unselected-filled.vue.js +1 -1
  59. package/js/components/icons/checkbox-unselected-filled.vue.js.map +1 -1
  60. package/js/components/icons/checkbox-unselected.vue.js +1 -1
  61. package/js/components/icons/checkbox-unselected.vue.js.map +1 -1
  62. package/js/components/icons/chevron-down.vue.js +1 -1
  63. package/js/components/icons/chevron-down.vue.js.map +1 -1
  64. package/js/components/icons/chevron-left.vue.js +1 -1
  65. package/js/components/icons/chevron-left.vue.js.map +1 -1
  66. package/js/components/icons/chevron-right.vue.js +1 -1
  67. package/js/components/icons/chevron-right.vue.js.map +1 -1
  68. package/js/components/icons/chevron-tiny-down.vue.js +1 -1
  69. package/js/components/icons/chevron-tiny-down.vue.js.map +1 -1
  70. package/js/components/icons/chevron-tiny-left.vue.js +1 -1
  71. package/js/components/icons/chevron-tiny-left.vue.js.map +1 -1
  72. package/js/components/icons/chevron-tiny-right.vue.js +1 -1
  73. package/js/components/icons/chevron-tiny-right.vue.js.map +1 -1
  74. package/js/components/icons/chevron-tiny-up.vue.js +1 -1
  75. package/js/components/icons/chevron-tiny-up.vue.js.map +1 -1
  76. package/js/components/icons/chevron-up.vue.js +1 -1
  77. package/js/components/icons/chevron-up.vue.js.map +1 -1
  78. package/js/components/icons/corner-arrow-left.vue.js +1 -1
  79. package/js/components/icons/corner-arrow-left.vue.js.map +1 -1
  80. package/js/components/icons/corner-arrow-right.vue.js +1 -1
  81. package/js/components/icons/corner-arrow-right.vue.js.map +1 -1
  82. package/js/components/icons/cross-tiny.vue.js +1 -1
  83. package/js/components/icons/cross-tiny.vue.js.map +1 -1
  84. package/js/components/icons/cross.vue.js +1 -1
  85. package/js/components/icons/cross.vue.js.map +1 -1
  86. package/js/components/icons/curated-check-filled.vue.js +1 -1
  87. package/js/components/icons/curated-check-filled.vue.js.map +1 -1
  88. package/js/components/icons/curated-check-tiny-filled.vue.js +1 -1
  89. package/js/components/icons/curated-check-tiny-filled.vue.js.map +1 -1
  90. package/js/components/icons/curated-check-tiny.vue.js +1 -1
  91. package/js/components/icons/curated-check-tiny.vue.js.map +1 -1
  92. package/js/components/icons/curated-check.vue.js +1 -1
  93. package/js/components/icons/curated-check.vue.js.map +1 -1
  94. package/js/components/icons/diagonal-arrow-left-down.vue.js +1 -1
  95. package/js/components/icons/diagonal-arrow-left-down.vue.js.map +1 -1
  96. package/js/components/icons/diagonal-arrow-left-top.vue.js +1 -1
  97. package/js/components/icons/diagonal-arrow-left-top.vue.js.map +1 -1
  98. package/js/components/icons/diagonal-arrow-right-down.vue.js +1 -1
  99. package/js/components/icons/diagonal-arrow-right-down.vue.js.map +1 -1
  100. package/js/components/icons/diagonal-arrow-right-top.vue.js +1 -1
  101. package/js/components/icons/diagonal-arrow-right-top.vue.js.map +1 -1
  102. package/js/components/icons/filters.vue.js +1 -1
  103. package/js/components/icons/filters.vue.js.map +1 -1
  104. package/js/components/icons/grid-1-col.vue.js +1 -1
  105. package/js/components/icons/grid-1-col.vue.js.map +1 -1
  106. package/js/components/icons/grid-2-col.vue.js +1 -1
  107. package/js/components/icons/grid-2-col.vue.js.map +1 -1
  108. package/js/components/icons/grid-2-rows.vue.js +1 -1
  109. package/js/components/icons/grid-2-rows.vue.js.map +1 -1
  110. package/js/components/icons/grid-4-col.vue.js +1 -1
  111. package/js/components/icons/grid-4-col.vue.js.map +1 -1
  112. package/js/components/icons/heart-filled.vue.js +1 -1
  113. package/js/components/icons/heart-filled.vue.js.map +1 -1
  114. package/js/components/icons/heart.vue.js +1 -1
  115. package/js/components/icons/heart.vue.js.map +1 -1
  116. package/js/components/icons/hide.vue.js +1 -1
  117. package/js/components/icons/hide.vue.js.map +1 -1
  118. package/js/components/icons/history-tiny.vue.js +1 -1
  119. package/js/components/icons/history-tiny.vue.js.map +1 -1
  120. package/js/components/icons/history.vue.js +1 -1
  121. package/js/components/icons/history.vue.js.map +1 -1
  122. package/js/components/icons/light-bulb-off.vue.js +1 -1
  123. package/js/components/icons/light-bulb-off.vue.js.map +1 -1
  124. package/js/components/icons/light-bulb-on.vue.js +1 -1
  125. package/js/components/icons/light-bulb-on.vue.js.map +1 -1
  126. package/js/components/icons/menu.vue.js +1 -1
  127. package/js/components/icons/menu.vue.js.map +1 -1
  128. package/js/components/icons/minus-tiny.vue.js +1 -1
  129. package/js/components/icons/minus-tiny.vue.js.map +1 -1
  130. package/js/components/icons/minus.vue.js +1 -1
  131. package/js/components/icons/minus.vue.js.map +1 -1
  132. package/js/components/icons/plus-tiny.vue.js +1 -1
  133. package/js/components/icons/plus-tiny.vue.js.map +1 -1
  134. package/js/components/icons/plus.vue.js +1 -1
  135. package/js/components/icons/plus.vue.js.map +1 -1
  136. package/js/components/icons/radiobutton-selected.vue.js +1 -1
  137. package/js/components/icons/radiobutton-selected.vue.js.map +1 -1
  138. package/js/components/icons/radiobutton-unselected.vue.js +1 -1
  139. package/js/components/icons/radiobutton-unselected.vue.js.map +1 -1
  140. package/js/components/icons/search-tiny.vue.js +1 -1
  141. package/js/components/icons/search-tiny.vue.js.map +1 -1
  142. package/js/components/icons/search.vue.js +1 -1
  143. package/js/components/icons/search.vue.js.map +1 -1
  144. package/js/components/icons/settings.vue.js +1 -1
  145. package/js/components/icons/settings.vue.js.map +1 -1
  146. package/js/components/icons/show.vue.js +1 -1
  147. package/js/components/icons/show.vue.js.map +1 -1
  148. package/js/components/icons/sort-az.vue.js +1 -1
  149. package/js/components/icons/sort-az.vue.js.map +1 -1
  150. package/js/components/icons/sort-price-down.vue.js +1 -1
  151. package/js/components/icons/sort-price-down.vue.js.map +1 -1
  152. package/js/components/icons/sort-price-up.vue.js +1 -1
  153. package/js/components/icons/sort-price-up.vue.js.map +1 -1
  154. package/js/components/icons/sort-relevancy.vue.js +1 -1
  155. package/js/components/icons/sort-relevancy.vue.js.map +1 -1
  156. package/js/components/icons/sort-za.vue.js +1 -1
  157. package/js/components/icons/sort-za.vue.js.map +1 -1
  158. package/js/components/icons/spinner.vue.js +1 -1
  159. package/js/components/icons/spinner.vue.js.map +1 -1
  160. package/js/components/icons/star-filled.vue.js +1 -1
  161. package/js/components/icons/star-filled.vue.js.map +1 -1
  162. package/js/components/icons/star.vue.js +1 -1
  163. package/js/components/icons/star.vue.js.map +1 -1
  164. package/js/components/icons/tag-filled.vue.js +1 -1
  165. package/js/components/icons/tag-filled.vue.js.map +1 -1
  166. package/js/components/icons/tag.vue.js +1 -1
  167. package/js/components/icons/tag.vue.js.map +1 -1
  168. package/js/components/icons/trash-open.vue.js +1 -1
  169. package/js/components/icons/trash-open.vue.js.map +1 -1
  170. package/js/components/icons/trash.vue.js +1 -1
  171. package/js/components/icons/trash.vue.js.map +1 -1
  172. package/js/components/icons/trending-tiny.vue.js +1 -1
  173. package/js/components/icons/trending-tiny.vue.js.map +1 -1
  174. package/js/components/icons/trending.vue.js +1 -1
  175. package/js/components/icons/trending.vue.js.map +1 -1
  176. package/js/components/icons/user-filled.vue.js +1 -1
  177. package/js/components/icons/user-filled.vue.js.map +1 -1
  178. package/js/components/icons/user.vue.js +1 -1
  179. package/js/components/icons/user.vue.js.map +1 -1
  180. package/js/components/layouts/multi-column-max-width-layout.vue4.js +1 -1
  181. package/js/components/layouts/single-column-layout.vue3.js +1 -1
  182. package/js/components/modals/base-events-modal-close.vue.js +1 -1
  183. package/js/components/modals/base-events-modal-close.vue.js.map +1 -1
  184. package/js/components/modals/base-events-modal-close.vue2.js.map +1 -1
  185. package/js/components/modals/base-events-modal-open.vue.js +1 -1
  186. package/js/components/modals/base-events-modal-open.vue.js.map +1 -1
  187. package/js/components/modals/base-events-modal-open.vue2.js.map +1 -1
  188. package/js/components/modals/base-id-modal-close.vue.js +1 -1
  189. package/js/components/modals/base-id-modal-close.vue.js.map +1 -1
  190. package/js/components/modals/base-id-modal-close.vue2.js.map +1 -1
  191. package/js/components/modals/base-id-modal-open.vue.js +1 -1
  192. package/js/components/modals/base-id-modal-open.vue.js.map +1 -1
  193. package/js/components/modals/base-id-modal-open.vue2.js.map +1 -1
  194. package/js/components/page-loader-button.vue.js +1 -1
  195. package/js/components/page-loader-button.vue.js.map +1 -1
  196. package/js/components/page-loader-button.vue2.js.map +1 -1
  197. package/js/components/page-selector.vue.js +3 -3
  198. package/js/components/page-selector.vue.js.map +1 -1
  199. package/js/components/page-selector.vue2.js.map +1 -1
  200. package/js/components/panels/base-id-toggle-panel-button.vue.js +1 -1
  201. package/js/components/panels/base-id-toggle-panel-button.vue.js.map +1 -1
  202. package/js/components/panels/base-id-toggle-panel-button.vue2.js.map +1 -1
  203. package/js/components/result/base-result-add-to-cart.vue.js +1 -1
  204. package/js/components/result/base-result-add-to-cart.vue.js.map +1 -1
  205. package/js/components/result/base-result-add-to-cart.vue2.js.map +1 -1
  206. package/js/components/result/base-result-image.vue.js +3 -3
  207. package/js/components/result/base-result-image.vue.js.map +1 -1
  208. package/js/components/result/base-result-image.vue2.js.map +1 -1
  209. package/js/components/scroll/base-scroll.vue.js +1 -1
  210. package/js/components/scroll/base-scroll.vue.js.map +1 -1
  211. package/js/components/scroll/base-scroll.vue2.js.map +1 -1
  212. package/js/components/sliding-panel.vue.js +4 -4
  213. package/js/components/sliding-panel.vue.js.map +1 -1
  214. package/js/components/sliding-panel.vue2.js +2 -2
  215. package/js/components/sliding-panel.vue2.js.map +1 -1
  216. package/js/components/sliding-panel.vue3.js +1 -1
  217. package/js/index.js +1 -1
  218. package/js/x-bus/x-bus.js +1 -3
  219. package/js/x-bus/x-bus.js.map +1 -1
  220. package/js/x-modules/ai/components/ai-carousel.vue.js +1 -1
  221. package/js/x-modules/ai/components/ai-carousel.vue.js.map +1 -1
  222. package/js/x-modules/ai/components/ai-carousel.vue2.js.map +1 -1
  223. package/js/x-modules/ai/components/ai-carousel.vue3.js +1 -1
  224. package/js/x-modules/ai/components/ai-overview.vue.js +120 -173
  225. package/js/x-modules/ai/components/ai-overview.vue.js.map +1 -1
  226. package/js/x-modules/ai/components/ai-overview.vue2.js +2 -38
  227. package/js/x-modules/ai/components/ai-overview.vue2.js.map +1 -1
  228. package/js/x-modules/ai/components/ai-overview.vue3.js +1 -1
  229. package/js/x-modules/ai/wiring.js +2 -6
  230. package/js/x-modules/ai/wiring.js.map +1 -1
  231. package/js/x-modules/facets/components/clear-filters.vue.js +1 -1
  232. package/js/x-modules/facets/components/clear-filters.vue.js.map +1 -1
  233. package/js/x-modules/facets/components/clear-filters.vue2.js.map +1 -1
  234. package/js/x-modules/facets/components/filters/all-filter.vue.js +1 -1
  235. package/js/x-modules/facets/components/filters/all-filter.vue.js.map +1 -1
  236. package/js/x-modules/facets/components/filters/all-filter.vue2.js +1 -1
  237. package/js/x-modules/facets/components/filters/all-filter.vue2.js.map +1 -1
  238. package/js/x-modules/facets/components/filters/editable-number-range-filter.vue.js +4 -4
  239. package/js/x-modules/facets/components/filters/editable-number-range-filter.vue.js.map +1 -1
  240. package/js/x-modules/facets/components/filters/editable-number-range-filter.vue2.js.map +1 -1
  241. package/js/x-modules/facets/components/filters/renderless-filter.vue.js +2 -2
  242. package/js/x-modules/facets/components/filters/renderless-filter.vue.js.map +1 -1
  243. package/js/x-modules/facets/components/lists/filters-search.vue.js +1 -1
  244. package/js/x-modules/facets/components/lists/filters-search.vue.js.map +1 -1
  245. package/js/x-modules/facets/components/lists/filters-search.vue2.js.map +1 -1
  246. package/js/x-modules/facets/components/lists/selected-filters-list.vue.js +1 -1
  247. package/js/x-modules/facets/components/lists/selected-filters-list.vue.js.map +1 -1
  248. package/js/x-modules/facets/components/lists/selected-filters-list.vue2.js.map +1 -1
  249. package/js/x-modules/facets/components/lists/sliced-filters.vue.js +2 -2
  250. package/js/x-modules/facets/components/lists/sliced-filters.vue.js.map +1 -1
  251. package/js/x-modules/facets/components/lists/sliced-filters.vue2.js.map +1 -1
  252. package/js/x-modules/history-queries/components/clear-history-queries.vue.js +1 -1
  253. package/js/x-modules/history-queries/components/clear-history-queries.vue.js.map +1 -1
  254. package/js/x-modules/history-queries/components/clear-history-queries.vue2.js.map +1 -1
  255. package/js/x-modules/history-queries/components/history-queries.vue.js +1 -1
  256. package/js/x-modules/history-queries/components/history-queries.vue.js.map +1 -1
  257. package/js/x-modules/history-queries/components/history-queries.vue2.js.map +1 -1
  258. package/js/x-modules/history-queries/components/history-query.vue.js +2 -2
  259. package/js/x-modules/history-queries/components/history-query.vue.js.map +1 -1
  260. package/js/x-modules/history-queries/components/history-query.vue2.js.map +1 -1
  261. package/js/x-modules/history-queries/components/my-history.vue.js +1 -1
  262. package/js/x-modules/history-queries/components/my-history.vue.js.map +1 -1
  263. package/js/x-modules/history-queries/components/my-history.vue2.js.map +1 -1
  264. package/js/x-modules/next-queries/components/next-queries.vue.js +1 -1
  265. package/js/x-modules/next-queries/components/next-queries.vue.js.map +1 -1
  266. package/js/x-modules/next-queries/components/next-queries.vue2.js.map +1 -1
  267. package/js/x-modules/popular-searches/components/popular-searches.vue.js +1 -1
  268. package/js/x-modules/popular-searches/components/popular-searches.vue.js.map +1 -1
  269. package/js/x-modules/popular-searches/components/popular-searches.vue2.js.map +1 -1
  270. package/js/x-modules/queries-preview/components/query-preview-button.vue.js +1 -1
  271. package/js/x-modules/queries-preview/components/query-preview-button.vue.js.map +1 -1
  272. package/js/x-modules/queries-preview/components/query-preview-button.vue2.js.map +1 -1
  273. package/js/x-modules/queries-preview/components/query-preview-list.vue3.js +1 -1
  274. package/js/x-modules/queries-preview/components/query-preview.vue.js.map +1 -1
  275. package/js/x-modules/queries-preview/components/query-preview.vue2.js.map +1 -1
  276. package/js/x-modules/query-suggestions/components/query-suggestions.vue.js +1 -1
  277. package/js/x-modules/query-suggestions/components/query-suggestions.vue.js.map +1 -1
  278. package/js/x-modules/query-suggestions/components/query-suggestions.vue2.js.map +1 -1
  279. package/js/x-modules/related-prompts/components/related-prompt.vue3.js +1 -1
  280. package/js/x-modules/related-tags/components/related-tag.vue.js +1 -1
  281. package/js/x-modules/related-tags/components/related-tag.vue.js.map +1 -1
  282. package/js/x-modules/related-tags/components/related-tag.vue2.js +1 -1
  283. package/js/x-modules/related-tags/components/related-tag.vue2.js.map +1 -1
  284. package/js/x-modules/scroll/components/scroll-to-top.vue.js +1 -1
  285. package/js/x-modules/scroll/components/scroll-to-top.vue.js.map +1 -1
  286. package/js/x-modules/scroll/components/scroll-to-top.vue2.js.map +1 -1
  287. package/js/x-modules/search/components/partial-query-button.vue.js +1 -1
  288. package/js/x-modules/search/components/partial-query-button.vue.js.map +1 -1
  289. package/js/x-modules/search/components/partial-query-button.vue2.js.map +1 -1
  290. package/js/x-modules/search/components/sort-list.vue.js +1 -1
  291. package/js/x-modules/search/components/sort-list.vue.js.map +1 -1
  292. package/js/x-modules/search/components/sort-list.vue2.js.map +1 -1
  293. package/js/x-modules/search/components/sort-picker-list.vue.js.map +1 -1
  294. package/js/x-modules/search/components/sort-picker-list.vue2.js +1 -1
  295. package/js/x-modules/search/components/sort-picker-list.vue2.js.map +1 -1
  296. package/js/x-modules/search-box/components/clear-search-input.vue.js +1 -1
  297. package/js/x-modules/search-box/components/clear-search-input.vue.js.map +1 -1
  298. package/js/x-modules/search-box/components/clear-search-input.vue2.js.map +1 -1
  299. package/js/x-modules/search-box/components/search-button.vue.js +2 -2
  300. package/js/x-modules/search-box/components/search-button.vue.js.map +1 -1
  301. package/js/x-modules/search-box/components/search-button.vue2.js.map +1 -1
  302. package/js/x-modules/search-box/components/search-input-placeholder.vue.js +1 -1
  303. package/js/x-modules/search-box/components/search-input-placeholder.vue.js.map +1 -1
  304. package/js/x-modules/search-box/components/search-input-placeholder.vue2.js.map +1 -1
  305. package/js/x-modules/search-box/components/search-input-placeholder.vue4.js +1 -1
  306. package/js/x-modules/search-box/components/search-input.vue.js +1 -1
  307. package/js/x-modules/search-box/components/search-input.vue.js.map +1 -1
  308. package/js/x-modules/search-box/components/search-input.vue2.js.map +1 -1
  309. package/js/x-modules/tagging/wiring.js +2 -22
  310. package/js/x-modules/tagging/wiring.js.map +1 -1
  311. package/package.json +6 -9
  312. package/report/x-components.api.json +7 -89
  313. package/report/x-components.api.md +5 -35
  314. package/tagging/index.js +1 -1
  315. package/types/demo/main.d.ts +1 -1
  316. package/types/demo/main.d.ts.map +1 -1
  317. package/types/demo/views/base-config.d.ts.map +1 -1
  318. package/types/demo/views/home/types.d.ts +0 -3
  319. package/types/demo/views/home/types.d.ts.map +1 -1
  320. package/types/demo/vite.config.d.ts.map +1 -1
  321. package/types/src/components/base-grid.types.d.ts.map +1 -1
  322. package/types/src/components/column-picker/base-column-picker-list.vue.d.ts +8 -1
  323. package/types/src/components/column-picker/base-column-picker-list.vue.d.ts.map +1 -1
  324. package/types/src/components/highlight.vue.d.ts +1 -1
  325. package/types/src/components/sliding-panel.vue.d.ts +2 -2
  326. package/types/src/index.d.ts +0 -1
  327. package/types/src/index.d.ts.map +1 -1
  328. package/types/src/x-bus/x-bus.d.ts.map +1 -1
  329. package/types/src/x-modules/ai/components/ai-overview.vue.d.ts +0 -21
  330. package/types/src/x-modules/ai/components/ai-overview.vue.d.ts.map +1 -1
  331. package/types/src/x-modules/ai/wiring.d.ts +0 -3
  332. package/types/src/x-modules/ai/wiring.d.ts.map +1 -1
  333. package/types/src/x-modules/facets/components/filters/all-filter.vue.d.ts +1 -1
  334. package/types/src/x-modules/tagging/wiring.d.ts +0 -9
  335. package/types/src/x-modules/tagging/wiring.d.ts.map +1 -1
  336. package/docs/API-reference/api/x-components.trackaioverviewbuttonclickedwire.md +0 -13
  337. package/types/demo/views/adapter.d.ts +0 -3
  338. package/types/demo/views/adapter.d.ts.map +0 -1
  339. package/types/src/components/column-picker/base-column-picker-list.types.d.ts +0 -9
  340. package/types/src/components/column-picker/base-column-picker-list.types.d.ts.map +0 -1
@@ -14,7 +14,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
14
14
  renderSlot(_ctx.$slots, "suggestion", normalizeProps(guardReactiveProps({ ...baseScope })), () => [
15
15
  createVNode(_component_PopularSearch, {
16
16
  suggestion: baseScope.suggestion,
17
- class: "x-popular-searches__suggestion x-suggestion"
17
+ class: "x-popular-searches__suggestion xds:suggestion"
18
18
  }, {
19
19
  default: withCtx((popularSearchScope) => [
20
20
  renderSlot(_ctx.$slots, "suggestion-content", normalizeProps(guardReactiveProps({ ...baseScope, ...popularSearchScope })))
@@ -1 +1 @@
1
- {"version":3,"file":"popular-searches.vue.js","sources":["../../../../../src/x-modules/popular-searches/components/popular-searches.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"popularSearches\"\n class=\"x-popular-searches\"\n data-test=\"popular-searches\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Popular Search item\n @binding {Object} v-bind - Popular Search suggestion attributes:<br />&nbsp;&nbsp;- **suggestion** <code>Suggestion</code> - Popular Search suggestion data<br />&nbsp;&nbsp;- **index** <code>number</code> - Popular Search suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope }\">\n <PopularSearch\n v-slot=\"popularSearchScope\"\n :suggestion=\"baseScope.suggestion\"\n class=\"x-popular-searches__suggestion x-suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Popular Search content\n @binding {Object} v-bind - Popular Search suggestion attributes:<br />&nbsp;&nbsp;- **suggestion** <code>Suggestion</code> - Popular Search suggestion data<br />&nbsp;&nbsp;- **index** <code>number</code> - Popular Search suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...popularSearchScope }\" />\n </PopularSearch>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables/use-getter'\nimport { popularSearchesXModule } from '../x-module'\nimport PopularSearch from './popular-search.vue'\n\n/**\n * Simple popular-searches component that renders a list of suggestions, allowing the user to\n * select one of them, and emitting the needed events.\n * A popular search is just a query that has been searched a lot in a certain period and may\n * optionally have associated a set of filters.\n *\n * @public\n */\nexport default defineComponent({\n name: 'PopularSearches',\n xModule: popularSearchesXModule.name,\n components: {\n PopularSearch,\n BaseSuggestions,\n },\n setup() {\n /**\n * The list of popular searches.\n *\n * @internal\n */\n const { popularSearches } = useGetter('popularSearches')\n\n return { popularSearches }\n },\n})\n</script>\n\n<!--eslint-disable max-len -->\n<docs lang=\"mdx\">\n## Inherited props\n\nThis component inherits the [`BaseSuggestions`](../base-components/x-components.base-suggestions.md)\nprops.\n\n| Name | Description | Type | Default |\n| ------------------ | ----------------------------------------------------------------- | -------- | ------- |\n| `animation` | Animation component that will be used to animate the suggestions. | `Vue` | `\"ul\"` |\n| `maxItemsToRender` | Number of popular searches to be rendered. | `number` | |\n\n## Examples\n\n### Default Usage\n\nYou don't need to pass any props, or slots. Simply add the component, and when it has any popular\nsearches it will show them.\n\n```vue live\n<template>\n <PopularSearches />\n</template>\n\n<script setup>\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\n</script>\n```\n\nThe component has two optional props. `animation` to render the component with an animation and\n`maxItemsToRender` to limit the number of popular searches will be rendered (by default it is 5).\n\n```vue live\n<template>\n <PopularSearches :animation=\"FadeAndSlide\" :maxItemsToRender=\"10\" />\n</template>\n\n<script setup>\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\nimport FadeAndSlide from '@empathyco/x-components/animations/fade-and-slide.vue'\n</script>\n```\n\n### Overriding Popular Search's Content\n\nYou can use your custom implementation of the Popular Search's content. In the example below,\ninstead of using the default Popular Search's content, an icon is added, as well as a span with the\nquery of the Popular Search's suggestion.\n\n```vue live\n<template>\n <PopularSearches>\n <template #suggestion-content=\"{ suggestion }\">\n <TrendingIcon />\n <span class=\"x-popular-search__query\">{{ suggestion.query }}</span>\n </template>\n </PopularSearches>\n</template>\n\n<script setup>\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\nimport { TrendingIcon } from '@empathyco/x-components'\n</script>\n```\n\n### Adding a Custom Popular Search Item\n\nYou can use your custom implementation for the whole Popular Search item. In the example below, we\nchange the default implementation of the Popular Search in Popular Searches. A custom Popular Search\nimplementation is added, it has an image and a span as content (as in the previous example). Also, a\nbutton with a user customized behaviour is added at the same hierarchical level as the Popular\nSearch component.\n\n```vue live\n<template>\n <PopularSearches>\n <template #suggestion=\"{ suggestion }\">\n <PopularSearch :suggestion=\"suggestion\">\n <template #default=\"{ suggestion }\">\n <TrendingIcon />\n <span class=\"x-popular-search__query\">{{ suggestion.query }}</span>\n </template>\n </PopularSearch>\n <button>Custom Behaviour</button>\n </template>\n </PopularSearches>\n</template>\n\n<script setup>\nimport { PopularSearches, PopularSearch } from '@empathyco/x-components/popular-searches'\nimport { TrendingIcon } from '@empathyco/x-components'\n</script>\n```\n</docs>\n"],"names":["_createBlock","_withCtx","_renderSlot","_normalizeProps","_guardReactiveProps","_createVNode"],"mappings":";;;;;;;sBACEA,WAAA,CA4BkB,0BAAA,EAAA;AAAA,IA3Bf,WAAA,EAAa,IAAA,CAAA,eAAA;AAAA,IACd,KAAA,EAAM,oBAAA;AAAA,IACN,WAAA,EAAU;AAAA,GAAA,EAAA;IAEC,OAAA,EAAOC,OAAA,CAOhB,CAcO,SAAA,KArBoB;AAAA,MAO3BC,UAAA,CAcO,IAAA,CAAA,MAAA,EAAA,YAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAd8B,SAAA,EAAS,CAAA,CAAA,EAA9C,MAcO;AAAA,QAbLC,WAAA,CAYgB,wBAAA,EAAA;AAAA,UAVb,YAAY,SAAA,CAAU,UAAA;AAAA,UACvB,KAAA,EAAM;AAAA,SAAA,EAAA;AAQN,UAAA,OAAA,EAAAJ,OAAA,CAAA,CAAmF,kBAAA,KAVzD;AAAA,YAU1BC,UAAA,CAAmF,IAAA,CAAA,MAAA,EAAA,oBAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAAtC,SAAA,EAAS,GAAK,kBAAA,EAAkB,CAAA,CAAA;AAAA,WAAA,CAAA;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"popular-searches.vue.js","sources":["../../../../../src/x-modules/popular-searches/components/popular-searches.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"popularSearches\"\n class=\"x-popular-searches\"\n data-test=\"popular-searches\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Popular Search item\n @binding {Object} v-bind - Popular Search suggestion attributes:<br />&nbsp;&nbsp;- **suggestion** <code>Suggestion</code> - Popular Search suggestion data<br />&nbsp;&nbsp;- **index** <code>number</code> - Popular Search suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope }\">\n <PopularSearch\n v-slot=\"popularSearchScope\"\n :suggestion=\"baseScope.suggestion\"\n class=\"x-popular-searches__suggestion xds:suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Popular Search content\n @binding {Object} v-bind - Popular Search suggestion attributes:<br />&nbsp;&nbsp;- **suggestion** <code>Suggestion</code> - Popular Search suggestion data<br />&nbsp;&nbsp;- **index** <code>number</code> - Popular Search suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...popularSearchScope }\" />\n </PopularSearch>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables/use-getter'\nimport { popularSearchesXModule } from '../x-module'\nimport PopularSearch from './popular-search.vue'\n\n/**\n * Simple popular-searches component that renders a list of suggestions, allowing the user to\n * select one of them, and emitting the needed events.\n * A popular search is just a query that has been searched a lot in a certain period and may\n * optionally have associated a set of filters.\n *\n * @public\n */\nexport default defineComponent({\n name: 'PopularSearches',\n xModule: popularSearchesXModule.name,\n components: {\n PopularSearch,\n BaseSuggestions,\n },\n setup() {\n /**\n * The list of popular searches.\n *\n * @internal\n */\n const { popularSearches } = useGetter('popularSearches')\n\n return { popularSearches }\n },\n})\n</script>\n\n<!--eslint-disable max-len -->\n<docs lang=\"mdx\">\n## Inherited props\n\nThis component inherits the [`BaseSuggestions`](../base-components/x-components.base-suggestions.md)\nprops.\n\n| Name | Description | Type | Default |\n| ------------------ | ----------------------------------------------------------------- | -------- | ------- |\n| `animation` | Animation component that will be used to animate the suggestions. | `Vue` | `\"ul\"` |\n| `maxItemsToRender` | Number of popular searches to be rendered. | `number` | |\n\n## Examples\n\n### Default Usage\n\nYou don't need to pass any props, or slots. Simply add the component, and when it has any popular\nsearches it will show them.\n\n```vue live\n<template>\n <PopularSearches />\n</template>\n\n<script setup>\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\n</script>\n```\n\nThe component has two optional props. `animation` to render the component with an animation and\n`maxItemsToRender` to limit the number of popular searches will be rendered (by default it is 5).\n\n```vue live\n<template>\n <PopularSearches :animation=\"FadeAndSlide\" :maxItemsToRender=\"10\" />\n</template>\n\n<script setup>\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\nimport FadeAndSlide from '@empathyco/x-components/animations/fade-and-slide.vue'\n</script>\n```\n\n### Overriding Popular Search's Content\n\nYou can use your custom implementation of the Popular Search's content. In the example below,\ninstead of using the default Popular Search's content, an icon is added, as well as a span with the\nquery of the Popular Search's suggestion.\n\n```vue live\n<template>\n <PopularSearches>\n <template #suggestion-content=\"{ suggestion }\">\n <TrendingIcon />\n <span class=\"x-popular-search__query\">{{ suggestion.query }}</span>\n </template>\n </PopularSearches>\n</template>\n\n<script setup>\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\nimport { TrendingIcon } from '@empathyco/x-components'\n</script>\n```\n\n### Adding a Custom Popular Search Item\n\nYou can use your custom implementation for the whole Popular Search item. In the example below, we\nchange the default implementation of the Popular Search in Popular Searches. A custom Popular Search\nimplementation is added, it has an image and a span as content (as in the previous example). Also, a\nbutton with a user customized behaviour is added at the same hierarchical level as the Popular\nSearch component.\n\n```vue live\n<template>\n <PopularSearches>\n <template #suggestion=\"{ suggestion }\">\n <PopularSearch :suggestion=\"suggestion\">\n <template #default=\"{ suggestion }\">\n <TrendingIcon />\n <span class=\"x-popular-search__query\">{{ suggestion.query }}</span>\n </template>\n </PopularSearch>\n <button>Custom Behaviour</button>\n </template>\n </PopularSearches>\n</template>\n\n<script setup>\nimport { PopularSearches, PopularSearch } from '@empathyco/x-components/popular-searches'\nimport { TrendingIcon } from '@empathyco/x-components'\n</script>\n```\n</docs>\n"],"names":["_createBlock","_withCtx","_renderSlot","_normalizeProps","_guardReactiveProps","_createVNode"],"mappings":";;;;;;;sBACEA,WAAA,CA4BkB,0BAAA,EAAA;AAAA,IA3Bf,WAAA,EAAa,IAAA,CAAA,eAAA;AAAA,IACd,KAAA,EAAM,oBAAA;AAAA,IACN,WAAA,EAAU;AAAA,GAAA,EAAA;IAEC,OAAA,EAAOC,OAAA,CAOhB,CAcO,SAAA,KArBoB;AAAA,MAO3BC,UAAA,CAcO,IAAA,CAAA,MAAA,EAAA,YAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAd8B,SAAA,EAAS,CAAA,CAAA,EAA9C,MAcO;AAAA,QAbLC,WAAA,CAYgB,wBAAA,EAAA;AAAA,UAVb,YAAY,SAAA,CAAU,UAAA;AAAA,UACvB,KAAA,EAAM;AAAA,SAAA,EAAA;AAQN,UAAA,OAAA,EAAAJ,OAAA,CAAA,CAAmF,kBAAA,KAVzD;AAAA,YAU1BC,UAAA,CAAmF,IAAA,CAAA,MAAA,EAAA,oBAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAAtC,SAAA,EAAS,GAAK,kBAAA,EAAkB,CAAA,CAAA;AAAA,WAAA,CAAA;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"popular-searches.vue2.js","sources":["../../../../../src/x-modules/popular-searches/components/popular-searches.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"popularSearches\"\n class=\"x-popular-searches\"\n data-test=\"popular-searches\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Popular Search item\n @binding {Object} v-bind - Popular Search suggestion attributes:<br />&nbsp;&nbsp;- **suggestion** <code>Suggestion</code> - Popular Search suggestion data<br />&nbsp;&nbsp;- **index** <code>number</code> - Popular Search suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope }\">\n <PopularSearch\n v-slot=\"popularSearchScope\"\n :suggestion=\"baseScope.suggestion\"\n class=\"x-popular-searches__suggestion x-suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Popular Search content\n @binding {Object} v-bind - Popular Search suggestion attributes:<br />&nbsp;&nbsp;- **suggestion** <code>Suggestion</code> - Popular Search suggestion data<br />&nbsp;&nbsp;- **index** <code>number</code> - Popular Search suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...popularSearchScope }\" />\n </PopularSearch>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables/use-getter'\nimport { popularSearchesXModule } from '../x-module'\nimport PopularSearch from './popular-search.vue'\n\n/**\n * Simple popular-searches component that renders a list of suggestions, allowing the user to\n * select one of them, and emitting the needed events.\n * A popular search is just a query that has been searched a lot in a certain period and may\n * optionally have associated a set of filters.\n *\n * @public\n */\nexport default defineComponent({\n name: 'PopularSearches',\n xModule: popularSearchesXModule.name,\n components: {\n PopularSearch,\n BaseSuggestions,\n },\n setup() {\n /**\n * The list of popular searches.\n *\n * @internal\n */\n const { popularSearches } = useGetter('popularSearches')\n\n return { popularSearches }\n },\n})\n</script>\n\n<!--eslint-disable max-len -->\n<docs lang=\"mdx\">\n## Inherited props\n\nThis component inherits the [`BaseSuggestions`](../base-components/x-components.base-suggestions.md)\nprops.\n\n| Name | Description | Type | Default |\n| ------------------ | ----------------------------------------------------------------- | -------- | ------- |\n| `animation` | Animation component that will be used to animate the suggestions. | `Vue` | `\"ul\"` |\n| `maxItemsToRender` | Number of popular searches to be rendered. | `number` | |\n\n## Examples\n\n### Default Usage\n\nYou don't need to pass any props, or slots. Simply add the component, and when it has any popular\nsearches it will show them.\n\n```vue live\n<template>\n <PopularSearches />\n</template>\n\n<script setup>\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\n</script>\n```\n\nThe component has two optional props. `animation` to render the component with an animation and\n`maxItemsToRender` to limit the number of popular searches will be rendered (by default it is 5).\n\n```vue live\n<template>\n <PopularSearches :animation=\"FadeAndSlide\" :maxItemsToRender=\"10\" />\n</template>\n\n<script setup>\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\nimport FadeAndSlide from '@empathyco/x-components/animations/fade-and-slide.vue'\n</script>\n```\n\n### Overriding Popular Search's Content\n\nYou can use your custom implementation of the Popular Search's content. In the example below,\ninstead of using the default Popular Search's content, an icon is added, as well as a span with the\nquery of the Popular Search's suggestion.\n\n```vue live\n<template>\n <PopularSearches>\n <template #suggestion-content=\"{ suggestion }\">\n <TrendingIcon />\n <span class=\"x-popular-search__query\">{{ suggestion.query }}</span>\n </template>\n </PopularSearches>\n</template>\n\n<script setup>\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\nimport { TrendingIcon } from '@empathyco/x-components'\n</script>\n```\n\n### Adding a Custom Popular Search Item\n\nYou can use your custom implementation for the whole Popular Search item. In the example below, we\nchange the default implementation of the Popular Search in Popular Searches. A custom Popular Search\nimplementation is added, it has an image and a span as content (as in the previous example). Also, a\nbutton with a user customized behaviour is added at the same hierarchical level as the Popular\nSearch component.\n\n```vue live\n<template>\n <PopularSearches>\n <template #suggestion=\"{ suggestion }\">\n <PopularSearch :suggestion=\"suggestion\">\n <template #default=\"{ suggestion }\">\n <TrendingIcon />\n <span class=\"x-popular-search__query\">{{ suggestion.query }}</span>\n </template>\n </PopularSearch>\n <button>Custom Behaviour</button>\n </template>\n </PopularSearches>\n</template>\n\n<script setup>\nimport { PopularSearches, PopularSearch } from '@empathyco/x-components/popular-searches'\nimport { TrendingIcon } from '@empathyco/x-components'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;AAuCA;;;;;;;AAOE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,iBAAiB;IACvB,OAAO,EAAE,sBAAsB,CAAC,IAAI;AACpC,IAAA,UAAU,EAAE;QACV,aAAa;QACb,eAAe;AAChB,KAAA;IACD,KAAK,GAAA;AACH;;;;AAIE;QACF,MAAM,EAAE,eAAc,EAAE,GAAI,SAAS,CAAC,iBAAiB,CAAA;QAEvD,OAAO,EAAE,eAAc,EAAE;IAC3B,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"popular-searches.vue2.js","sources":["../../../../../src/x-modules/popular-searches/components/popular-searches.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"popularSearches\"\n class=\"x-popular-searches\"\n data-test=\"popular-searches\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Popular Search item\n @binding {Object} v-bind - Popular Search suggestion attributes:<br />&nbsp;&nbsp;- **suggestion** <code>Suggestion</code> - Popular Search suggestion data<br />&nbsp;&nbsp;- **index** <code>number</code> - Popular Search suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope }\">\n <PopularSearch\n v-slot=\"popularSearchScope\"\n :suggestion=\"baseScope.suggestion\"\n class=\"x-popular-searches__suggestion xds:suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Popular Search content\n @binding {Object} v-bind - Popular Search suggestion attributes:<br />&nbsp;&nbsp;- **suggestion** <code>Suggestion</code> - Popular Search suggestion data<br />&nbsp;&nbsp;- **index** <code>number</code> - Popular Search suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...popularSearchScope }\" />\n </PopularSearch>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables/use-getter'\nimport { popularSearchesXModule } from '../x-module'\nimport PopularSearch from './popular-search.vue'\n\n/**\n * Simple popular-searches component that renders a list of suggestions, allowing the user to\n * select one of them, and emitting the needed events.\n * A popular search is just a query that has been searched a lot in a certain period and may\n * optionally have associated a set of filters.\n *\n * @public\n */\nexport default defineComponent({\n name: 'PopularSearches',\n xModule: popularSearchesXModule.name,\n components: {\n PopularSearch,\n BaseSuggestions,\n },\n setup() {\n /**\n * The list of popular searches.\n *\n * @internal\n */\n const { popularSearches } = useGetter('popularSearches')\n\n return { popularSearches }\n },\n})\n</script>\n\n<!--eslint-disable max-len -->\n<docs lang=\"mdx\">\n## Inherited props\n\nThis component inherits the [`BaseSuggestions`](../base-components/x-components.base-suggestions.md)\nprops.\n\n| Name | Description | Type | Default |\n| ------------------ | ----------------------------------------------------------------- | -------- | ------- |\n| `animation` | Animation component that will be used to animate the suggestions. | `Vue` | `\"ul\"` |\n| `maxItemsToRender` | Number of popular searches to be rendered. | `number` | |\n\n## Examples\n\n### Default Usage\n\nYou don't need to pass any props, or slots. Simply add the component, and when it has any popular\nsearches it will show them.\n\n```vue live\n<template>\n <PopularSearches />\n</template>\n\n<script setup>\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\n</script>\n```\n\nThe component has two optional props. `animation` to render the component with an animation and\n`maxItemsToRender` to limit the number of popular searches will be rendered (by default it is 5).\n\n```vue live\n<template>\n <PopularSearches :animation=\"FadeAndSlide\" :maxItemsToRender=\"10\" />\n</template>\n\n<script setup>\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\nimport FadeAndSlide from '@empathyco/x-components/animations/fade-and-slide.vue'\n</script>\n```\n\n### Overriding Popular Search's Content\n\nYou can use your custom implementation of the Popular Search's content. In the example below,\ninstead of using the default Popular Search's content, an icon is added, as well as a span with the\nquery of the Popular Search's suggestion.\n\n```vue live\n<template>\n <PopularSearches>\n <template #suggestion-content=\"{ suggestion }\">\n <TrendingIcon />\n <span class=\"x-popular-search__query\">{{ suggestion.query }}</span>\n </template>\n </PopularSearches>\n</template>\n\n<script setup>\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\nimport { TrendingIcon } from '@empathyco/x-components'\n</script>\n```\n\n### Adding a Custom Popular Search Item\n\nYou can use your custom implementation for the whole Popular Search item. In the example below, we\nchange the default implementation of the Popular Search in Popular Searches. A custom Popular Search\nimplementation is added, it has an image and a span as content (as in the previous example). Also, a\nbutton with a user customized behaviour is added at the same hierarchical level as the Popular\nSearch component.\n\n```vue live\n<template>\n <PopularSearches>\n <template #suggestion=\"{ suggestion }\">\n <PopularSearch :suggestion=\"suggestion\">\n <template #default=\"{ suggestion }\">\n <TrendingIcon />\n <span class=\"x-popular-search__query\">{{ suggestion.query }}</span>\n </template>\n </PopularSearch>\n <button>Custom Behaviour</button>\n </template>\n </PopularSearches>\n</template>\n\n<script setup>\nimport { PopularSearches, PopularSearch } from '@empathyco/x-components/popular-searches'\nimport { TrendingIcon } from '@empathyco/x-components'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;AAuCA;;;;;;;AAOE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,iBAAiB;IACvB,OAAO,EAAE,sBAAsB,CAAC,IAAI;AACpC,IAAA,UAAU,EAAE;QACV,aAAa;QACb,eAAe;AAChB,KAAA;IACD,KAAK,GAAA;AACH;;;;AAIE;QACF,MAAM,EAAE,eAAc,EAAE,GAAI,SAAS,CAAC,iBAAiB,CAAA;QAEvD,OAAO,EAAE,eAAc,EAAE;IAC3B,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -7,7 +7,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
7
7
  return openBlock(), createBlock(_component_BaseEventButton, {
8
8
  events: _ctx.events,
9
9
  metadata: _ctx.metadata,
10
- class: "x-query-preview-button x-button",
10
+ class: "x-query-preview-button xds:button",
11
11
  "data-test": "query-preview-button"
12
12
  }, {
13
13
  default: withCtx(() => [
@@ -1 +1 @@
1
- {"version":3,"file":"query-preview-button.vue.js","sources":["../../../../../src/x-modules/queries-preview/components/query-preview-button.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n :metadata=\"metadata\"\n class=\"x-query-preview-button x-button\"\n data-test=\"query-preview-button\"\n >\n <!-- @slot Button content with a text, an icon or both -->\n <slot :query-preview-info=\"fullQueryPreviewInfo\">\n {{ queryPreviewInfo.query }}\n </slot>\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { XEventsTypes } from '../../../wiring/events.types'\nimport type { WireMetadata } from '../../../wiring/index'\nimport type { QueryPreviewInfo } from '../store/types'\nimport { computed, defineComponent } from 'vue'\nimport { BaseEventButton } from '../../../components'\nimport { useState } from '../../../composables/use-state'\nimport { queriesPreviewXModule } from '../x-module'\n\n/**\n * Component containing an event button that emits\n * {@link QueriesPreviewXEvents.UserAcceptedAQueryPreview} when clicked with\n * the full query preview info as payload.\n *\n * It has a default slot to customize its contents.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QueryPreviewButton',\n xModule: queriesPreviewXModule.name,\n components: { BaseEventButton },\n props: {\n /**\n * The information about the request of the query preview.\n *\n * @public\n */\n queryPreviewInfo: {\n type: Object as PropType<QueryPreviewInfo>,\n required: true,\n },\n /**\n * The metadata property for the request on each query preview.\n *\n * @public\n */\n metadata: {\n type: Object as PropType<Omit<WireMetadata, 'moduleName'>>,\n },\n },\n setup(props) {\n /**\n * We use the module extra params to combine them with the query preview's extra params.\n */\n const { params } = useState('queriesPreview')\n\n /**\n * The provided query preview with the base extra params from the module merged in.\n *\n * @returns The query preview info with the base extra params merged in.\n * @public\n */\n const fullQueryPreviewInfo = computed(\n (): QueryPreviewInfo => ({\n ...props.queryPreviewInfo,\n extraParams: {\n ...params.value,\n ...props.queryPreviewInfo.extraParams,\n },\n filters: props.queryPreviewInfo.filters,\n }),\n )\n\n /**\n * List of events to emit by the BaseEventButton.\n *\n * @returns An object with the event and payload.\n *\n * @internal\n */\n const events = computed(\n (): Partial<XEventsTypes> => ({ UserAcceptedAQueryPreview: fullQueryPreviewInfo.value }),\n )\n\n return {\n fullQueryPreviewInfo,\n events,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThe component content has the query preview query as default.\n\n```vue\n<template>\n <QueryPreviewButton queryPreviewInfo=\"queryPreviewInfo\" />\n</template>\n\n<script setup>\nimport { QueryPreviewButton } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst queryPreviewInfo = reactive({ query: 'shoes' })\n</script>\n```\n\n### Customizing slots\n\nThe content of the button is customizable via its default slot.\n\n```vue\n<template>\n <QueryPreviewButton queryPreviewInfo=\"queryPreviewInfo\">\n {{ `Search for: ${queryPreviewInfo.query}` }}\n </QueryPreviewButton>\n</template>\n\n<script setup>\nimport { QueryPreviewButton } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst queryPreviewInfo = reactive({ query: 'shoes' })\n</script>\n```\n\n## Events\n\nA list of events that the component will emit:\n\n- `UserAcceptedAQueryPreview`: the event is emitted after the user clicks the button. The event\n payload is the `QueryPreviewInfo` of the query.\n</docs>\n"],"names":["_createBlock","_renderSlot","_createTextVNode","_toDisplayString"],"mappings":";;;;;;sBACEA,WAAA,CAUkB,0BAAA,EAAA;AAAA,IATf,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,MAEO;AAAA,MAFPC,UAAA,CAEO,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAFA,gBAAA,EAAoB,IAAA,CAAA,oBAAA,IAA3B,MAEO;AAAA,QAAAC,eAAA;AADF,UAAAC,eAAA,CAAA,IAAA,CAAA,gBAAA,CAAiB,KAAK,CAAA;AAAA,UAAA;AAAA;AAAA;AAAA,OAAA;;;;;;;;;;"}
1
+ {"version":3,"file":"query-preview-button.vue.js","sources":["../../../../../src/x-modules/queries-preview/components/query-preview-button.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n :metadata=\"metadata\"\n class=\"x-query-preview-button xds:button\"\n data-test=\"query-preview-button\"\n >\n <!-- @slot Button content with a text, an icon or both -->\n <slot :query-preview-info=\"fullQueryPreviewInfo\">\n {{ queryPreviewInfo.query }}\n </slot>\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { XEventsTypes } from '../../../wiring/events.types'\nimport type { WireMetadata } from '../../../wiring/index'\nimport type { QueryPreviewInfo } from '../store/types'\nimport { computed, defineComponent } from 'vue'\nimport { BaseEventButton } from '../../../components'\nimport { useState } from '../../../composables/use-state'\nimport { queriesPreviewXModule } from '../x-module'\n\n/**\n * Component containing an event button that emits\n * {@link QueriesPreviewXEvents.UserAcceptedAQueryPreview} when clicked with\n * the full query preview info as payload.\n *\n * It has a default slot to customize its contents.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QueryPreviewButton',\n xModule: queriesPreviewXModule.name,\n components: { BaseEventButton },\n props: {\n /**\n * The information about the request of the query preview.\n *\n * @public\n */\n queryPreviewInfo: {\n type: Object as PropType<QueryPreviewInfo>,\n required: true,\n },\n /**\n * The metadata property for the request on each query preview.\n *\n * @public\n */\n metadata: {\n type: Object as PropType<Omit<WireMetadata, 'moduleName'>>,\n },\n },\n setup(props) {\n /**\n * We use the module extra params to combine them with the query preview's extra params.\n */\n const { params } = useState('queriesPreview')\n\n /**\n * The provided query preview with the base extra params from the module merged in.\n *\n * @returns The query preview info with the base extra params merged in.\n * @public\n */\n const fullQueryPreviewInfo = computed(\n (): QueryPreviewInfo => ({\n ...props.queryPreviewInfo,\n extraParams: {\n ...params.value,\n ...props.queryPreviewInfo.extraParams,\n },\n filters: props.queryPreviewInfo.filters,\n }),\n )\n\n /**\n * List of events to emit by the BaseEventButton.\n *\n * @returns An object with the event and payload.\n *\n * @internal\n */\n const events = computed(\n (): Partial<XEventsTypes> => ({ UserAcceptedAQueryPreview: fullQueryPreviewInfo.value }),\n )\n\n return {\n fullQueryPreviewInfo,\n events,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThe component content has the query preview query as default.\n\n```vue\n<template>\n <QueryPreviewButton queryPreviewInfo=\"queryPreviewInfo\" />\n</template>\n\n<script setup>\nimport { QueryPreviewButton } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst queryPreviewInfo = reactive({ query: 'shoes' })\n</script>\n```\n\n### Customizing slots\n\nThe content of the button is customizable via its default slot.\n\n```vue\n<template>\n <QueryPreviewButton queryPreviewInfo=\"queryPreviewInfo\">\n {{ `Search for: ${queryPreviewInfo.query}` }}\n </QueryPreviewButton>\n</template>\n\n<script setup>\nimport { QueryPreviewButton } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst queryPreviewInfo = reactive({ query: 'shoes' })\n</script>\n```\n\n## Events\n\nA list of events that the component will emit:\n\n- `UserAcceptedAQueryPreview`: the event is emitted after the user clicks the button. The event\n payload is the `QueryPreviewInfo` of the query.\n</docs>\n"],"names":["_createBlock","_renderSlot","_createTextVNode","_toDisplayString"],"mappings":";;;;;;sBACEA,WAAA,CAUkB,0BAAA,EAAA;AAAA,IATf,MAAA,EAAQ,IAAA,CAAA,MAAA;AAAA,IACR,QAAA,EAAU,IAAA,CAAA,QAAA;AAAA,IACX,KAAA,EAAM,mCAAA;AAAA,IACN,WAAA,EAAU;AAAA,GAAA,EAAA;qBAGV,MAEO;AAAA,MAFPC,UAAA,CAEO,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAFA,gBAAA,EAAoB,IAAA,CAAA,oBAAA,IAA3B,MAEO;AAAA,QAAAC,eAAA;AADF,UAAAC,eAAA,CAAA,IAAA,CAAA,gBAAA,CAAiB,KAAK,CAAA;AAAA,UAAA;AAAA;AAAA;AAAA,OAAA;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"query-preview-button.vue2.js","sources":["../../../../../src/x-modules/queries-preview/components/query-preview-button.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n :metadata=\"metadata\"\n class=\"x-query-preview-button x-button\"\n data-test=\"query-preview-button\"\n >\n <!-- @slot Button content with a text, an icon or both -->\n <slot :query-preview-info=\"fullQueryPreviewInfo\">\n {{ queryPreviewInfo.query }}\n </slot>\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { XEventsTypes } from '../../../wiring/events.types'\nimport type { WireMetadata } from '../../../wiring/index'\nimport type { QueryPreviewInfo } from '../store/types'\nimport { computed, defineComponent } from 'vue'\nimport { BaseEventButton } from '../../../components'\nimport { useState } from '../../../composables/use-state'\nimport { queriesPreviewXModule } from '../x-module'\n\n/**\n * Component containing an event button that emits\n * {@link QueriesPreviewXEvents.UserAcceptedAQueryPreview} when clicked with\n * the full query preview info as payload.\n *\n * It has a default slot to customize its contents.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QueryPreviewButton',\n xModule: queriesPreviewXModule.name,\n components: { BaseEventButton },\n props: {\n /**\n * The information about the request of the query preview.\n *\n * @public\n */\n queryPreviewInfo: {\n type: Object as PropType<QueryPreviewInfo>,\n required: true,\n },\n /**\n * The metadata property for the request on each query preview.\n *\n * @public\n */\n metadata: {\n type: Object as PropType<Omit<WireMetadata, 'moduleName'>>,\n },\n },\n setup(props) {\n /**\n * We use the module extra params to combine them with the query preview's extra params.\n */\n const { params } = useState('queriesPreview')\n\n /**\n * The provided query preview with the base extra params from the module merged in.\n *\n * @returns The query preview info with the base extra params merged in.\n * @public\n */\n const fullQueryPreviewInfo = computed(\n (): QueryPreviewInfo => ({\n ...props.queryPreviewInfo,\n extraParams: {\n ...params.value,\n ...props.queryPreviewInfo.extraParams,\n },\n filters: props.queryPreviewInfo.filters,\n }),\n )\n\n /**\n * List of events to emit by the BaseEventButton.\n *\n * @returns An object with the event and payload.\n *\n * @internal\n */\n const events = computed(\n (): Partial<XEventsTypes> => ({ UserAcceptedAQueryPreview: fullQueryPreviewInfo.value }),\n )\n\n return {\n fullQueryPreviewInfo,\n events,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThe component content has the query preview query as default.\n\n```vue\n<template>\n <QueryPreviewButton queryPreviewInfo=\"queryPreviewInfo\" />\n</template>\n\n<script setup>\nimport { QueryPreviewButton } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst queryPreviewInfo = reactive({ query: 'shoes' })\n</script>\n```\n\n### Customizing slots\n\nThe content of the button is customizable via its default slot.\n\n```vue\n<template>\n <QueryPreviewButton queryPreviewInfo=\"queryPreviewInfo\">\n {{ `Search for: ${queryPreviewInfo.query}` }}\n </QueryPreviewButton>\n</template>\n\n<script setup>\nimport { QueryPreviewButton } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst queryPreviewInfo = reactive({ query: 'shoes' })\n</script>\n```\n\n## Events\n\nA list of events that the component will emit:\n\n- `UserAcceptedAQueryPreview`: the event is emitted after the user clicks the button. The event\n payload is the `QueryPreviewInfo` of the query.\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA;;;;;;;;AAQE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,oBAAoB;IAC1B,OAAO,EAAE,qBAAqB,CAAC,IAAI;IACnC,UAAU,EAAE,EAAE,eAAc,EAAG;AAC/B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,gBAAgB,EAAE;AAChB,YAAA,IAAI,EAAE,MAAoC;AAC1C,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,QAAQ,EAAE;AACR,YAAA,IAAI,EAAE,MAAoD;AAC3D,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT;;AAEE;QACF,MAAM,EAAE,QAAO,GAAI,QAAQ,CAAC,gBAAgB,CAAA;AAE5C;;;;;AAKE;AACF,QAAA,MAAM,oBAAmB,GAAI,QAAQ,CACnC,OAAyB;YACvB,GAAG,KAAK,CAAC,gBAAgB;AACzB,YAAA,WAAW,EAAE;gBACX,GAAG,MAAM,CAAC,KAAK;AACf,gBAAA,GAAG,KAAK,CAAC,gBAAgB,CAAC,WAAW;AACtC,aAAA;AACD,YAAA,OAAO,EAAE,KAAK,CAAC,gBAAgB,CAAC,OAAO;AACxC,SAAA,CAAC,CACJ;AAEA;;;;;;AAME;AACF,QAAA,MAAM,MAAK,GAAI,QAAQ,CACrB,OAA8B,EAAE,yBAAyB,EAAE,oBAAoB,CAAC,KAAI,EAAG,CAAC,CAC1F;QAEA,OAAO;YACL,oBAAoB;YACpB,MAAM;SACR;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"query-preview-button.vue2.js","sources":["../../../../../src/x-modules/queries-preview/components/query-preview-button.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n :metadata=\"metadata\"\n class=\"x-query-preview-button xds:button\"\n data-test=\"query-preview-button\"\n >\n <!-- @slot Button content with a text, an icon or both -->\n <slot :query-preview-info=\"fullQueryPreviewInfo\">\n {{ queryPreviewInfo.query }}\n </slot>\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { XEventsTypes } from '../../../wiring/events.types'\nimport type { WireMetadata } from '../../../wiring/index'\nimport type { QueryPreviewInfo } from '../store/types'\nimport { computed, defineComponent } from 'vue'\nimport { BaseEventButton } from '../../../components'\nimport { useState } from '../../../composables/use-state'\nimport { queriesPreviewXModule } from '../x-module'\n\n/**\n * Component containing an event button that emits\n * {@link QueriesPreviewXEvents.UserAcceptedAQueryPreview} when clicked with\n * the full query preview info as payload.\n *\n * It has a default slot to customize its contents.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QueryPreviewButton',\n xModule: queriesPreviewXModule.name,\n components: { BaseEventButton },\n props: {\n /**\n * The information about the request of the query preview.\n *\n * @public\n */\n queryPreviewInfo: {\n type: Object as PropType<QueryPreviewInfo>,\n required: true,\n },\n /**\n * The metadata property for the request on each query preview.\n *\n * @public\n */\n metadata: {\n type: Object as PropType<Omit<WireMetadata, 'moduleName'>>,\n },\n },\n setup(props) {\n /**\n * We use the module extra params to combine them with the query preview's extra params.\n */\n const { params } = useState('queriesPreview')\n\n /**\n * The provided query preview with the base extra params from the module merged in.\n *\n * @returns The query preview info with the base extra params merged in.\n * @public\n */\n const fullQueryPreviewInfo = computed(\n (): QueryPreviewInfo => ({\n ...props.queryPreviewInfo,\n extraParams: {\n ...params.value,\n ...props.queryPreviewInfo.extraParams,\n },\n filters: props.queryPreviewInfo.filters,\n }),\n )\n\n /**\n * List of events to emit by the BaseEventButton.\n *\n * @returns An object with the event and payload.\n *\n * @internal\n */\n const events = computed(\n (): Partial<XEventsTypes> => ({ UserAcceptedAQueryPreview: fullQueryPreviewInfo.value }),\n )\n\n return {\n fullQueryPreviewInfo,\n events,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThe component content has the query preview query as default.\n\n```vue\n<template>\n <QueryPreviewButton queryPreviewInfo=\"queryPreviewInfo\" />\n</template>\n\n<script setup>\nimport { QueryPreviewButton } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst queryPreviewInfo = reactive({ query: 'shoes' })\n</script>\n```\n\n### Customizing slots\n\nThe content of the button is customizable via its default slot.\n\n```vue\n<template>\n <QueryPreviewButton queryPreviewInfo=\"queryPreviewInfo\">\n {{ `Search for: ${queryPreviewInfo.query}` }}\n </QueryPreviewButton>\n</template>\n\n<script setup>\nimport { QueryPreviewButton } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst queryPreviewInfo = reactive({ query: 'shoes' })\n</script>\n```\n\n## Events\n\nA list of events that the component will emit:\n\n- `UserAcceptedAQueryPreview`: the event is emitted after the user clicks the button. The event\n payload is the `QueryPreviewInfo` of the query.\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA;;;;;;;;AAQE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,oBAAoB;IAC1B,OAAO,EAAE,qBAAqB,CAAC,IAAI;IACnC,UAAU,EAAE,EAAE,eAAc,EAAG;AAC/B,IAAA,KAAK,EAAE;AACL;;;;AAIE;AACF,QAAA,gBAAgB,EAAE;AAChB,YAAA,IAAI,EAAE,MAAoC;AAC1C,YAAA,QAAQ,EAAE,IAAI;AACf,SAAA;AACD;;;;AAIE;AACF,QAAA,QAAQ,EAAE;AACR,YAAA,IAAI,EAAE,MAAoD;AAC3D,SAAA;AACF,KAAA;AACD,IAAA,KAAK,CAAC,KAAK,EAAA;AACT;;AAEE;QACF,MAAM,EAAE,QAAO,GAAI,QAAQ,CAAC,gBAAgB,CAAA;AAE5C;;;;;AAKE;AACF,QAAA,MAAM,oBAAmB,GAAI,QAAQ,CACnC,OAAyB;YACvB,GAAG,KAAK,CAAC,gBAAgB;AACzB,YAAA,WAAW,EAAE;gBACX,GAAG,MAAM,CAAC,KAAK;AACf,gBAAA,GAAG,KAAK,CAAC,gBAAgB,CAAC,WAAW;AACtC,aAAA;AACD,YAAA,OAAO,EAAE,KAAK,CAAC,gBAAgB,CAAC,OAAO;AACxC,SAAA,CAAC,CACJ;AAEA;;;;;;AAME;AACF,QAAA,MAAM,MAAK,GAAI,QAAQ,CACrB,OAA8B,EAAE,yBAAyB,EAAE,oBAAoB,CAAC,KAAI,EAAG,CAAC,CAC1F;QAEA,OAAO;YACL,oBAAoB;YACpB,MAAM;SACR;IACF,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -1,6 +1,6 @@
1
1
  import injectCss from '../../../../tools/inject-css.js';
2
2
 
3
- var css = ".padding-block-1[data-v-a0750562]{padding-bottom:1px;padding-top:1px}";
3
+ var css = ".padding-block-1[data-v-a0750562]{padding-block:1px}";
4
4
  injectCss(css);
5
5
 
6
6
  export { css };
@@ -1 +1 @@
1
- {"version":3,"file":"query-preview.vue.js","sources":["../../../../../src/x-modules/queries-preview/components/query-preview.vue"],"sourcesContent":["<template>\n <!-- eslint-disable-next-line vue/no-unused-refs -->\n <section ref=\"queryPreviewElement\" class=\"x-query-preview-wrapper__default-content\">\n <ul v-if=\"hasResults\" data-test=\"query-preview\" class=\"x-query-preview\">\n <li\n v-for=\"result in queryPreviewResults?.results\"\n :key=\"result.id\"\n class=\"x-query-preview__item\"\n data-test=\"query-preview-item\"\n >\n <!--\n @slot Query Preview result slot.\n @binding {Result} result - A Query Preview result\n -->\n <slot name=\"result\" :result=\"result\">\n <span data-test=\"result-name\">{{ result.name }}</span>\n </slot>\n </li>\n </ul>\n </section>\n</template>\n\n<script lang=\"ts\">\nimport type { Filter, SearchRequest } from '@empathyco/x-types'\nimport type { PropType, Ref } from 'vue'\nimport type { FeatureLocation, QueryFeature } from '../../../types'\nimport type { DebouncedFunction } from '../../../utils'\nimport type { QueryPreviewInfo } from '../store/types'\nimport { deepEqual } from '@empathyco/x-utils'\nimport { computed, defineComponent, h, inject, onBeforeUnmount, provide, ref, watch } from 'vue'\nimport { LIST_ITEMS_KEY } from '../../../components'\nimport { useOnDisplay, useState, useXBus } from '../../../composables'\nimport { createOrigin, createRawFilters, debounceFunction } from '../../../utils'\nimport { getHashFromQueryPreviewInfo } from '../utils/get-hash-from-query-preview'\nimport { queriesPreviewXModule } from '../x-module'\n\n/**\n * Retrieves a preview of the results of a query and exposes them in the default slot,\n * along with the query preview and the totalResults of the search request.\n * By default, it renders the names of the results.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QueryPreview',\n xModule: queriesPreviewXModule.name,\n props: {\n /** The information about the request of the query preview. */\n queryPreviewInfo: {\n type: Object as PropType<QueryPreviewInfo>,\n required: true,\n },\n /** The origin property for the request. */\n queryFeature: {\n type: String as PropType<QueryFeature>,\n },\n /** Number of query preview results to be rendered. */\n maxItemsToRender: {\n type: Number,\n },\n /**\n * Controls whether the query preview requests should be triggered when the component is visible in the viewport.\n */\n loadWhenVisible: {\n type: Boolean,\n default: false,\n },\n /**\n * Debounce time in milliseconds for triggering the search requests.\n * It will default to 0 to fit the most common use case (pre-search),\n * and it would work properly with a 250 value inside empathize.\n */\n debounceTimeMs: {\n type: Number,\n default: 0,\n },\n /**\n * Controls whether the QueryPreview should be removed from the state\n * when the component is destroyed.\n */\n persistInCache: {\n type: Boolean,\n default: false,\n },\n },\n emits: ['load', 'error'],\n setup(props, { emit, slots }) {\n const xBus = useXBus()\n\n /**\n * previewResults: The results preview of the queries preview cacheable mounted.\n * It is a dictionary, indexed by the query preview query.\n *\n * params: As the request is handled in this component, we need\n * the extra params that will be used in the request.\n *\n * config: As the request is handled in this component, we need\n * the config that will be used in the request.\n */\n const { queriesPreview: previewResults, params, config } = useState('queriesPreview')\n\n /**\n * Template ref for the root element to track visibility.\n */\n const queryPreviewElement = ref<HTMLElement | null>(null)\n\n /**\n * Query Preview key converted into a unique id.\n *\n * @returns The query hash.\n */\n const queryPreviewHash = computed(() =>\n getHashFromQueryPreviewInfo(props.queryPreviewInfo, {\n ...params.value,\n ...props.queryPreviewInfo.extraParams,\n }),\n )\n\n provide('queryPreviewHash', queryPreviewHash)\n\n /**\n * Gets from the state the results preview of the query preview.\n *\n * @returns The results preview of the actual query preview.\n */\n const queryPreviewResults = computed(() => {\n const resultsPreview = previewResults.value[queryPreviewHash.value]\n return resultsPreview?.results\n ? {\n ...resultsPreview,\n results: resultsPreview.results.slice(0, props.maxItemsToRender),\n }\n : undefined\n })\n\n /**\n * The results to render from the state.\n *\n * @remarks The results list are provided with `items` key. It can be\n * concatenated with list items from components such as `BannersList`, `PromotedsList`,\n * `BaseGrid` or any component that injects the list.\n *\n * @returns A list of results.\n */\n const results = computed(() => queryPreviewResults.value?.results)\n provide(LIST_ITEMS_KEY as string, results)\n\n /**\n * It injects the provided {@link FeatureLocation} of the selected query in the search request.\n *\n * @internal\n */\n const injectedLocation = inject<Ref<FeatureLocation> | FeatureLocation>('location', 'none')\n const location =\n typeof injectedLocation === 'object' && 'value' in injectedLocation\n ? injectedLocation.value\n : injectedLocation\n\n /**\n * The computed request object to be used to retrieve the query preview results.\n *\n * @returns The search request object.\n */\n const queryPreviewRequest = computed<SearchRequest>(() => {\n const origin = createOrigin({\n feature: props.queryFeature,\n location,\n })\n const filters = props.queryPreviewInfo.filters?.reduce(\n (filtersList, filterId) => {\n const facetId = filterId.split(':')[0]\n const rawFilter = createRawFilters([filterId])[0]\n filtersList[facetId] = filtersList[facetId]\n ? filtersList[facetId].concat(rawFilter)\n : [rawFilter]\n\n return filtersList\n },\n {} as Record<string, Filter[]>,\n )\n\n return {\n query: props.queryPreviewInfo.query,\n rows: config.value.maxItemsToRequest,\n extraParams: {\n ...params.value,\n ...props.queryPreviewInfo.extraParams,\n },\n filters,\n ...(origin && { origin }),\n }\n })\n\n /**\n * The debounce method to trigger the request after the debounceTimeMs defined\n * for cacheable queries.\n *\n * @returns The search request object.\n */\n const emitQueryPreviewRequestUpdated = computed<DebouncedFunction<[SearchRequest]>>(() =>\n debounceFunction(request => {\n xBus.emit('QueryPreviewRequestUpdated', request, { priority: 0, replaceable: false })\n }, props.debounceTimeMs),\n )\n\n /**\n * Initialises watcher to emit debounced requests, and first value for the requests.\n *\n * @internal\n */\n watch(queryPreviewRequest, (newRequest, oldRequest) => {\n if (!deepEqual(newRequest, oldRequest) && !props.loadWhenVisible) {\n emitQueryPreviewRequestUpdated.value(newRequest)\n }\n })\n\n const cachedQueryPreview = previewResults.value[queryPreviewHash.value]\n\n // If the query has been saved it will emit load instead of the emitting the updated request.\n if (cachedQueryPreview?.status === 'success') {\n emit('load', queryPreviewHash.value)\n xBus.emit('QueryPreviewMounted', queryPreviewHash.value, {\n priority: 0,\n replaceable: false,\n })\n } else if (!props.loadWhenVisible) {\n emitQueryPreviewRequestUpdated.value(queryPreviewRequest.value)\n }\n\n /**\n * Watch element visibility and emit request when it becomes visible for the first time\n * (only when loadWhenVisible is true).\n */\n const { unwatchDisplay } = useOnDisplay({\n element: queryPreviewElement,\n callback: () => {\n if (props.loadWhenVisible && cachedQueryPreview?.status !== 'success') {\n emitQueryPreviewRequestUpdated.value(queryPreviewRequest.value)\n }\n },\n })\n\n /**\n * Cancels the (remaining) requests when the component is destroyed\n * via the `debounce.cancel()` method.\n * If the prop 'persistInCache' is set to false, it also removes the QueryPreview\n * from the state when the component is destroyed.\n */\n onBeforeUnmount(() => {\n unwatchDisplay?.()\n emitQueryPreviewRequestUpdated.value.cancel()\n xBus.emit(\n 'QueryPreviewUnmounted',\n { queryPreviewHash: queryPreviewHash.value, cache: props.persistInCache },\n {\n priority: 0,\n replaceable: false,\n },\n )\n })\n\n /**\n * Cancels the previous request when the debounced function changes (e.g: the debounceTimeMs\n * prop changes or there is a request in progress that cancels it).\n *\n * @param _new - The new debounced function.\n * @param old - The previous debounced function.\n * @internal\n */\n watch(\n emitQueryPreviewRequestUpdated,\n (_new: DebouncedFunction<[SearchRequest]>, old: DebouncedFunction<[SearchRequest]>) => {\n old.cancel()\n },\n )\n\n const queryPreviewResultsStatus = computed(() => queryPreviewResults.value?.status)\n\n /**\n * Emits an event when the query results are loaded or fail to load.\n *\n * @param status - The status of the query preview request.\n */\n watch(queryPreviewResultsStatus, () => {\n if (queryPreviewResultsStatus.value === 'success') {\n emit(results.value?.length ? 'load' : 'error', queryPreviewHash.value)\n } else if (queryPreviewResultsStatus.value === 'error') {\n emit('error', queryPreviewHash.value)\n }\n })\n\n const hasResults = computed(() => (queryPreviewResults.value?.totalResults ?? 0) > 0)\n\n /**\n * Render function to execute the `default` slot, binding `slotsProps` and getting only the\n * first `vNode` to avoid Fragments and Text root nodes.\n *\n * @remarks `slotProps` must be values without Vue reactivity and located inside the\n * render-function to update the binding data properly.\n *\n * @returns The root `vNode` of the `default` slot or empty string if there are no results. Always wrapped in a section\n * element with the `x-query-preview-wrapper__slot-content` class.\n */\n function renderDefaultSlot() {\n const slotProps = {\n queryPreviewInfo: props.queryPreviewInfo,\n results: queryPreviewResults.value?.results,\n totalResults: queryPreviewResults.value?.totalResults,\n displayTagging: queryPreviewResults.value?.displayTagging,\n queryTagging: queryPreviewResults.value?.queryTagging,\n }\n\n const slotContent = hasResults.value ? slots.default?.(slotProps)[0] : ''\n\n return h(\n 'section',\n { ref: queryPreviewElement, class: 'x-query-preview-wrapper__slot-content' },\n [slotContent],\n )\n }\n\n /* Hack to render through a render-function, the `default` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const componentProps = { hasResults, queryPreviewResults, queryPreviewElement }\n return (slots.default ? renderDefaultSlot : componentProps) as typeof componentProps\n },\n})\n</script>\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`QueryPreviewRequestUpdated`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted when the component is mounted and when the properties of the request object\n changes. The event payload is the `queryPreviewRequest` object.\n\n## Vue Events\n\nA list of vue events that the component will emit:\n\n- `load`: the event is emitted when the query results have been loaded.\n- `error`: the event is emitted if there is some error when retrieving the query results.\n\n## See it in action\n\nHere you have a basic example of how the QueryPreview is rendered. Keep in mind that this component\nis intended to be used overriding its default slot. By default it will only render the names of the\nresults.\n\n```vue live\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" />\n</template>\n\n<script setup>\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst queryPreviewInfo = reactive({ query: 'sandals' })\n</script>\n```\n\n### Play with the default slot\n\nIn this example, the results will be rendered inside a sliding panel.\n\n```vue live\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" #default=\"{ totalResults, results }\">\n <section>\n <p>Total results: {{ totalResults }}</p>\n <SlidingPanel :resetOnContentChange=\"false\">\n <article\n v-for=\"result in results\"\n :key=\"result.id\"\n class=\"x-result\"\n style=\"max-width: 300px; overflow: hidden\"\n >\n <BaseResultLink :result=\"result\">\n <BaseResultImage :result=\"result\" class=\"x-result__picture\" />\n </BaseResultLink>\n <div class=\"x-result__description\">\n <BaseResultLink :result=\"result\">\n <h1 class=\"x-title3\">{{ result.name }}</h1>\n </BaseResultLink>\n </div>\n </article>\n </SlidingPanel>\n </section>\n </QueryPreview>\n</template>\n\n<script setup>\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\nimport { BaseResultImage, BaseResultLink, SlidingPanel } from '@empathyco/x-components'\nimport { reactive } from 'vue'\nconst queryPreviewInfo = reactive({ query: 'flip-flops' })\n</script>\n```\n\n### Play with the result slot\n\nThe component exposes a slot to override the result content, without modifying the list.\n\nIn this example, the ID of the results will be rendered along with the name.\n\n```vue\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" #result=\"{ result }\">\n <span>{{ result.id }}</span>\n <span>{{ result.name }}</span>\n </QueryPreview>\n</template>\n\n<script setup>\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst queryPreviewInfo = reactive({ query: 'flip-flops' })\n</script>\n```\n\n### Play with props\n\nIn this example, the query preview has been limited to render a maximum of 4 results.\n\n```vue\n<template>\n <QueryPreview\n :maxItemsToRender=\"maxItemsToRender\"\n :queryPreviewInfo=\"queryPreviewInfo\"\n #default=\"{ results }\"\n >\n <BaseGrid #default=\"{ item }\" :items=\"results\">\n <BaseResultLink :result=\"item\">\n <BaseResultImage :result=\"item\" />\n </BaseResultLink>\n </BaseGrid>\n </QueryPreview>\n</template>\n\n<script setup>\nimport { BaseGrid, BaseResultImage, BaseResultLink } from '@empathyco/x-components'\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst maxItemsToRender = 4\nconst queryPreviewInfo = reactive({ query: 'flip-flops' })\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_Fragment","_renderList","_renderSlot","_createElementVNode","_toDisplayString"],"mappings":";;;;;EAEW,GAAA,EAAI,qBAAA;AAAA,EAAsB,KAAA,EAAM;;;;EACjB,WAAA,EAAU,eAAA;AAAA,EAAgB,KAAA,EAAM;;AAY1C,MAAA,UAAA,GAAA,EAAA,WAAA,EAAU,aAAA,EAAa;;AAbrC,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,IAiBU,SAAA;AAAA,IAjBV,UAAA;AAAA,IAiBU;AAAA,MAhBE,IAAA,CAAA,UAAA,IAAAD,SAAA,EAAA,EAAVC,kBAAA,CAeK,IAAA,EAfL,UAAA,EAeK;AAAA,SAAAD,SAAA,CAAA,IAAA,CAAA,EAdHC,kBAAA;AAAA,UAaKC,QAAA;AAAA,UAAA,IAAA;AAAA,UAAAC,UAAA,CAZc,IAAA,CAAA,mBAAA,EAAqB,OAAA,EAAO,CAAtC,MAAA,KAAM;gCADfF,kBAAA,CAaK,IAAA,EAAA;AAAA,cAXF,KAAK,MAAA,CAAO,EAAA;AAAA,cACb,KAAA,EAAM,uBAAA;AAAA,cACN,WAAA,EAAU;AAAA,aAAA,EAAA;cAMVG,UAAA,CAEO,IAAA,CAAA,MAAA,EAAA,QAAA,EAAA,EAFc,MAAA,EAAc,EAAnC,MAEO;AAAA,gBADLC,kBAAA;AAAA,kBAAsD,MAAA;AAAA,kBAAtD,UAAA;AAAA,kBAAsDC,eAAA,CAArB,OAAO,IAAI,CAAA;AAAA,kBAAA;AAAA;AAAA;AAAA,eAAA;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"query-preview.vue.js","sources":["../../../../../src/x-modules/queries-preview/components/query-preview.vue"],"sourcesContent":["<template>\n <!-- eslint-disable-next-line vue/no-unused-refs -->\n <section ref=\"queryPreviewElement\" class=\"x-query-preview-wrapper__default-content\">\n <ul v-if=\"hasResults\" data-test=\"query-preview\" class=\"x-query-preview\">\n <li\n v-for=\"result in queryPreviewResults?.results\"\n :key=\"result.id\"\n class=\"x-query-preview__item\"\n data-test=\"query-preview-item\"\n >\n <!--\n @slot Query Preview result slot.\n @binding {Result} result - A Query Preview result\n -->\n <slot name=\"result\" :result=\"result\">\n <span data-test=\"result-name\">{{ result.name }}</span>\n </slot>\n </li>\n </ul>\n </section>\n</template>\n\n<script lang=\"ts\">\nimport type { Filter, SearchRequest } from '@empathyco/x-types'\nimport type { PropType, Ref } from 'vue'\nimport type { FeatureLocation, QueryFeature } from '../../../types'\nimport type { DebouncedFunction } from '../../../utils'\nimport type { QueryPreviewInfo } from '../store/types'\nimport { deepEqual } from '@empathyco/x-utils'\nimport { computed, defineComponent, h, inject, onBeforeUnmount, provide, ref, watch } from 'vue'\nimport { LIST_ITEMS_KEY } from '../../../components'\nimport { useOnDisplay, useState, useXBus } from '../../../composables'\nimport { createOrigin, createRawFilters, debounceFunction } from '../../../utils'\nimport { getHashFromQueryPreviewInfo } from '../utils/get-hash-from-query-preview'\nimport { queriesPreviewXModule } from '../x-module'\n\n/**\n * Retrieves a preview of the results of a query and exposes them in the default slot,\n * along with the query preview and the totalResults of the search request.\n * By default, it renders the names of the results.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QueryPreview',\n xModule: queriesPreviewXModule.name,\n props: {\n /** The information about the request of the query preview. */\n queryPreviewInfo: {\n type: Object as PropType<QueryPreviewInfo>,\n required: true,\n },\n /** The origin property for the request. */\n queryFeature: {\n type: String as PropType<QueryFeature>,\n },\n /** Number of query preview results to be rendered. */\n maxItemsToRender: {\n type: Number,\n },\n /**\n * Controls whether the query preview requests should be triggered when the component is visible in the viewport.\n */\n loadWhenVisible: {\n type: Boolean,\n default: false,\n },\n /**\n * Debounce time in milliseconds for triggering the search requests.\n * It will default to 0 to fit the most common use case (pre-search),\n * and it would work properly with a 250 value inside empathize.\n */\n debounceTimeMs: {\n type: Number,\n default: 0,\n },\n /**\n * Controls whether the QueryPreview should be removed from the state\n * when the component is destroyed.\n */\n persistInCache: {\n type: Boolean,\n default: false,\n },\n },\n emits: ['load', 'error'],\n setup(props, { emit, slots }) {\n const xBus = useXBus()\n\n /**\n * previewResults: The results preview of the queries preview cacheable mounted.\n * It is a dictionary, indexed by the query preview query.\n *\n * params: As the request is handled in this component, we need\n * the extra params that will be used in the request.\n *\n * config: As the request is handled in this component, we need\n * the config that will be used in the request.\n */\n const { queriesPreview: previewResults, params, config } = useState('queriesPreview')\n\n /**\n * Template ref for the root element to track visibility.\n */\n const queryPreviewElement = ref<HTMLElement | null>(null)\n\n /**\n * Query Preview key converted into a unique id.\n *\n * @returns The query hash.\n */\n const queryPreviewHash = computed(() =>\n getHashFromQueryPreviewInfo(props.queryPreviewInfo, {\n ...params.value,\n ...props.queryPreviewInfo.extraParams,\n }),\n )\n\n provide('queryPreviewHash', queryPreviewHash)\n\n /**\n * Gets from the state the results preview of the query preview.\n *\n * @returns The results preview of the actual query preview.\n */\n const queryPreviewResults = computed(() => {\n const resultsPreview = previewResults.value[queryPreviewHash.value]\n return resultsPreview?.results\n ? {\n ...resultsPreview,\n results: resultsPreview.results.slice(0, props.maxItemsToRender),\n }\n : undefined\n })\n\n /**\n * The results to render from the state.\n *\n * @remarks The results list are provided with `items` key. It can be\n * concatenated with list items from components such as `BannersList`, `PromotedsList`,\n * `BaseGrid` or any component that injects the list.\n *\n * @returns A list of results.\n */\n const results = computed(() => queryPreviewResults.value?.results)\n provide(LIST_ITEMS_KEY as string, results)\n\n /**\n * It injects the provided {@link FeatureLocation} of the selected query in the search request.\n *\n * @internal\n */\n const injectedLocation = inject<Ref<FeatureLocation> | FeatureLocation>('location', 'none')\n const location =\n typeof injectedLocation === 'object' && 'value' in injectedLocation\n ? injectedLocation.value\n : injectedLocation\n\n /**\n * The computed request object to be used to retrieve the query preview results.\n *\n * @returns The search request object.\n */\n const queryPreviewRequest = computed<SearchRequest>(() => {\n const origin = createOrigin({\n feature: props.queryFeature,\n location,\n })\n const filters = props.queryPreviewInfo.filters?.reduce(\n (filtersList, filterId) => {\n const facetId = filterId.split(':')[0]\n const rawFilter = createRawFilters([filterId])[0]\n filtersList[facetId] = filtersList[facetId]\n ? filtersList[facetId].concat(rawFilter)\n : [rawFilter]\n\n return filtersList\n },\n {} as Record<string, Filter[]>,\n )\n\n return {\n query: props.queryPreviewInfo.query,\n rows: config.value.maxItemsToRequest,\n extraParams: {\n ...params.value,\n ...props.queryPreviewInfo.extraParams,\n },\n filters,\n ...(origin && { origin }),\n }\n })\n\n /**\n * The debounce method to trigger the request after the debounceTimeMs defined\n * for cacheable queries.\n *\n * @returns The search request object.\n */\n const emitQueryPreviewRequestUpdated = computed<DebouncedFunction<[SearchRequest]>>(() =>\n debounceFunction(request => {\n xBus.emit('QueryPreviewRequestUpdated', request, { priority: 0, replaceable: false })\n }, props.debounceTimeMs),\n )\n\n /**\n * Initialises watcher to emit debounced requests, and first value for the requests.\n *\n * @internal\n */\n watch(queryPreviewRequest, (newRequest, oldRequest) => {\n if (!deepEqual(newRequest, oldRequest) && !props.loadWhenVisible) {\n emitQueryPreviewRequestUpdated.value(newRequest)\n }\n })\n\n const cachedQueryPreview = previewResults.value[queryPreviewHash.value]\n\n // If the query has been saved it will emit load instead of the emitting the updated request.\n if (cachedQueryPreview?.status === 'success') {\n emit('load', queryPreviewHash.value)\n xBus.emit('QueryPreviewMounted', queryPreviewHash.value, {\n priority: 0,\n replaceable: false,\n })\n } else if (!props.loadWhenVisible) {\n emitQueryPreviewRequestUpdated.value(queryPreviewRequest.value)\n }\n\n /**\n * Watch element visibility and emit request when it becomes visible for the first time\n * (only when loadWhenVisible is true).\n */\n const { unwatchDisplay } = useOnDisplay({\n element: queryPreviewElement,\n callback: () => {\n if (props.loadWhenVisible && cachedQueryPreview?.status !== 'success') {\n emitQueryPreviewRequestUpdated.value(queryPreviewRequest.value)\n }\n },\n })\n\n /**\n * Cancels the (remaining) requests when the component is destroyed\n * via the `debounce.cancel()` method.\n * If the prop 'persistInCache' is set to false, it also removes the QueryPreview\n * from the state when the component is destroyed.\n */\n onBeforeUnmount(() => {\n unwatchDisplay?.()\n emitQueryPreviewRequestUpdated.value.cancel()\n xBus.emit(\n 'QueryPreviewUnmounted',\n { queryPreviewHash: queryPreviewHash.value, cache: props.persistInCache },\n {\n priority: 0,\n replaceable: false,\n },\n )\n })\n\n /**\n * Cancels the previous request when the debounced function changes (e.g: the debounceTimeMs\n * prop changes or there is a request in progress that cancels it).\n *\n * @param _new - The new debounced function.\n * @param old - The previous debounced function.\n * @internal\n */\n watch(\n emitQueryPreviewRequestUpdated,\n (_new: DebouncedFunction<[SearchRequest]>, old: DebouncedFunction<[SearchRequest]>) => {\n old.cancel()\n },\n )\n\n const queryPreviewResultsStatus = computed(() => queryPreviewResults.value?.status)\n\n /**\n * Emits an event when the query results are loaded or fail to load.\n *\n * @param status - The status of the query preview request.\n */\n watch(queryPreviewResultsStatus, () => {\n if (queryPreviewResultsStatus.value === 'success') {\n emit(results.value?.length ? 'load' : 'error', queryPreviewHash.value)\n } else if (queryPreviewResultsStatus.value === 'error') {\n emit('error', queryPreviewHash.value)\n }\n })\n\n const hasResults = computed(() => (queryPreviewResults.value?.totalResults ?? 0) > 0)\n\n /**\n * Render function to execute the `default` slot, binding `slotsProps` and getting only the\n * first `vNode` to avoid Fragments and Text root nodes.\n *\n * @remarks `slotProps` must be values without Vue reactivity and located inside the\n * render-function to update the binding data properly.\n *\n * @returns The root `vNode` of the `default` slot or empty string if there are no results. Always wrapped in a section\n * element with the `x-query-preview-wrapper__slot-content` class.\n */\n function renderDefaultSlot() {\n const slotProps = {\n queryPreviewInfo: props.queryPreviewInfo,\n results: queryPreviewResults.value?.results,\n totalResults: queryPreviewResults.value?.totalResults,\n displayTagging: queryPreviewResults.value?.displayTagging,\n queryTagging: queryPreviewResults.value?.queryTagging,\n }\n\n const slotContent = hasResults.value ? slots.default?.(slotProps)[0] : ''\n\n return h(\n 'section',\n { ref: queryPreviewElement, class: 'x-query-preview-wrapper__slot-content' },\n [slotContent],\n )\n }\n\n /* Hack to render through a render-function, the `default` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const componentProps = { hasResults, queryPreviewResults, queryPreviewElement }\n return (slots.default ? renderDefaultSlot : componentProps) as typeof componentProps\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`QueryPreviewRequestUpdated`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted when the component is mounted and when the properties of the request object\n changes. The event payload is the `queryPreviewRequest` object.\n\n## Vue Events\n\nA list of vue events that the component will emit:\n\n- `load`: the event is emitted when the query results have been loaded.\n- `error`: the event is emitted if there is some error when retrieving the query results.\n\n## See it in action\n\nHere you have a basic example of how the QueryPreview is rendered. Keep in mind that this component\nis intended to be used overriding its default slot. By default it will only render the names of the\nresults.\n\n```vue live\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" />\n</template>\n\n<script setup>\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst queryPreviewInfo = reactive({ query: 'sandals' })\n</script>\n```\n\n### Play with the default slot\n\nIn this example, the results will be rendered inside a sliding panel.\n\n```vue live\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" #default=\"{ totalResults, results }\">\n <section>\n <p>Total results: {{ totalResults }}</p>\n <SlidingPanel :resetOnContentChange=\"false\">\n <article\n v-for=\"result in results\"\n :key=\"result.id\"\n class=\"x-result\"\n style=\"max-width: 300px; overflow: hidden\"\n >\n <BaseResultLink :result=\"result\">\n <BaseResultImage :result=\"result\" class=\"x-result__picture\" />\n </BaseResultLink>\n <div class=\"x-result__description\">\n <BaseResultLink :result=\"result\">\n <h1 class=\"x-title3\">{{ result.name }}</h1>\n </BaseResultLink>\n </div>\n </article>\n </SlidingPanel>\n </section>\n </QueryPreview>\n</template>\n\n<script setup>\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\nimport { BaseResultImage, BaseResultLink, SlidingPanel } from '@empathyco/x-components'\nimport { reactive } from 'vue'\nconst queryPreviewInfo = reactive({ query: 'flip-flops' })\n</script>\n```\n\n### Play with the result slot\n\nThe component exposes a slot to override the result content, without modifying the list.\n\nIn this example, the ID of the results will be rendered along with the name.\n\n```vue\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" #result=\"{ result }\">\n <span>{{ result.id }}</span>\n <span>{{ result.name }}</span>\n </QueryPreview>\n</template>\n\n<script setup>\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst queryPreviewInfo = reactive({ query: 'flip-flops' })\n</script>\n```\n\n### Play with props\n\nIn this example, the query preview has been limited to render a maximum of 4 results.\n\n```vue\n<template>\n <QueryPreview\n :maxItemsToRender=\"maxItemsToRender\"\n :queryPreviewInfo=\"queryPreviewInfo\"\n #default=\"{ results }\"\n >\n <BaseGrid #default=\"{ item }\" :items=\"results\">\n <BaseResultLink :result=\"item\">\n <BaseResultImage :result=\"item\" />\n </BaseResultLink>\n </BaseGrid>\n </QueryPreview>\n</template>\n\n<script setup>\nimport { BaseGrid, BaseResultImage, BaseResultLink } from '@empathyco/x-components'\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst maxItemsToRender = 4\nconst queryPreviewInfo = reactive({ query: 'flip-flops' })\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_Fragment","_renderList","_renderSlot","_createElementVNode","_toDisplayString"],"mappings":";;;;;EAEW,GAAA,EAAI,qBAAA;AAAA,EAAsB,KAAA,EAAM;;;;EACjB,WAAA,EAAU,eAAA;AAAA,EAAgB,KAAA,EAAM;;AAY1C,MAAA,UAAA,GAAA,EAAA,WAAA,EAAU,aAAA,EAAa;;AAbrC,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,IAiBU,SAAA;AAAA,IAjBV,UAAA;AAAA,IAiBU;AAAA,MAhBE,IAAA,CAAA,UAAA,IAAAD,SAAA,EAAA,EAAVC,kBAAA,CAeK,IAAA,EAfL,UAAA,EAeK;AAAA,SAAAD,SAAA,CAAA,IAAA,CAAA,EAdHC,kBAAA;AAAA,UAaKC,QAAA;AAAA,UAAA,IAAA;AAAA,UAAAC,UAAA,CAZc,IAAA,CAAA,mBAAA,EAAqB,OAAA,EAAO,CAAtC,MAAA,KAAM;gCADfF,kBAAA,CAaK,IAAA,EAAA;AAAA,cAXF,KAAK,MAAA,CAAO,EAAA;AAAA,cACb,KAAA,EAAM,uBAAA;AAAA,cACN,WAAA,EAAU;AAAA,aAAA,EAAA;cAMVG,UAAA,CAEO,IAAA,CAAA,MAAA,EAAA,QAAA,EAAA,EAFc,MAAA,EAAc,EAAnC,MAEO;AAAA,gBADLC,kBAAA;AAAA,kBAAsD,MAAA;AAAA,kBAAtD,UAAA;AAAA,kBAAsDC,eAAA,CAArB,OAAO,IAAI,CAAA;AAAA,kBAAA;AAAA;AAAA;AAAA,eAAA;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"query-preview.vue2.js","sources":["../../../../../src/x-modules/queries-preview/components/query-preview.vue"],"sourcesContent":["<template>\n <!-- eslint-disable-next-line vue/no-unused-refs -->\n <section ref=\"queryPreviewElement\" class=\"x-query-preview-wrapper__default-content\">\n <ul v-if=\"hasResults\" data-test=\"query-preview\" class=\"x-query-preview\">\n <li\n v-for=\"result in queryPreviewResults?.results\"\n :key=\"result.id\"\n class=\"x-query-preview__item\"\n data-test=\"query-preview-item\"\n >\n <!--\n @slot Query Preview result slot.\n @binding {Result} result - A Query Preview result\n -->\n <slot name=\"result\" :result=\"result\">\n <span data-test=\"result-name\">{{ result.name }}</span>\n </slot>\n </li>\n </ul>\n </section>\n</template>\n\n<script lang=\"ts\">\nimport type { Filter, SearchRequest } from '@empathyco/x-types'\nimport type { PropType, Ref } from 'vue'\nimport type { FeatureLocation, QueryFeature } from '../../../types'\nimport type { DebouncedFunction } from '../../../utils'\nimport type { QueryPreviewInfo } from '../store/types'\nimport { deepEqual } from '@empathyco/x-utils'\nimport { computed, defineComponent, h, inject, onBeforeUnmount, provide, ref, watch } from 'vue'\nimport { LIST_ITEMS_KEY } from '../../../components'\nimport { useOnDisplay, useState, useXBus } from '../../../composables'\nimport { createOrigin, createRawFilters, debounceFunction } from '../../../utils'\nimport { getHashFromQueryPreviewInfo } from '../utils/get-hash-from-query-preview'\nimport { queriesPreviewXModule } from '../x-module'\n\n/**\n * Retrieves a preview of the results of a query and exposes them in the default slot,\n * along with the query preview and the totalResults of the search request.\n * By default, it renders the names of the results.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QueryPreview',\n xModule: queriesPreviewXModule.name,\n props: {\n /** The information about the request of the query preview. */\n queryPreviewInfo: {\n type: Object as PropType<QueryPreviewInfo>,\n required: true,\n },\n /** The origin property for the request. */\n queryFeature: {\n type: String as PropType<QueryFeature>,\n },\n /** Number of query preview results to be rendered. */\n maxItemsToRender: {\n type: Number,\n },\n /**\n * Controls whether the query preview requests should be triggered when the component is visible in the viewport.\n */\n loadWhenVisible: {\n type: Boolean,\n default: false,\n },\n /**\n * Debounce time in milliseconds for triggering the search requests.\n * It will default to 0 to fit the most common use case (pre-search),\n * and it would work properly with a 250 value inside empathize.\n */\n debounceTimeMs: {\n type: Number,\n default: 0,\n },\n /**\n * Controls whether the QueryPreview should be removed from the state\n * when the component is destroyed.\n */\n persistInCache: {\n type: Boolean,\n default: false,\n },\n },\n emits: ['load', 'error'],\n setup(props, { emit, slots }) {\n const xBus = useXBus()\n\n /**\n * previewResults: The results preview of the queries preview cacheable mounted.\n * It is a dictionary, indexed by the query preview query.\n *\n * params: As the request is handled in this component, we need\n * the extra params that will be used in the request.\n *\n * config: As the request is handled in this component, we need\n * the config that will be used in the request.\n */\n const { queriesPreview: previewResults, params, config } = useState('queriesPreview')\n\n /**\n * Template ref for the root element to track visibility.\n */\n const queryPreviewElement = ref<HTMLElement | null>(null)\n\n /**\n * Query Preview key converted into a unique id.\n *\n * @returns The query hash.\n */\n const queryPreviewHash = computed(() =>\n getHashFromQueryPreviewInfo(props.queryPreviewInfo, {\n ...params.value,\n ...props.queryPreviewInfo.extraParams,\n }),\n )\n\n provide('queryPreviewHash', queryPreviewHash)\n\n /**\n * Gets from the state the results preview of the query preview.\n *\n * @returns The results preview of the actual query preview.\n */\n const queryPreviewResults = computed(() => {\n const resultsPreview = previewResults.value[queryPreviewHash.value]\n return resultsPreview?.results\n ? {\n ...resultsPreview,\n results: resultsPreview.results.slice(0, props.maxItemsToRender),\n }\n : undefined\n })\n\n /**\n * The results to render from the state.\n *\n * @remarks The results list are provided with `items` key. It can be\n * concatenated with list items from components such as `BannersList`, `PromotedsList`,\n * `BaseGrid` or any component that injects the list.\n *\n * @returns A list of results.\n */\n const results = computed(() => queryPreviewResults.value?.results)\n provide(LIST_ITEMS_KEY as string, results)\n\n /**\n * It injects the provided {@link FeatureLocation} of the selected query in the search request.\n *\n * @internal\n */\n const injectedLocation = inject<Ref<FeatureLocation> | FeatureLocation>('location', 'none')\n const location =\n typeof injectedLocation === 'object' && 'value' in injectedLocation\n ? injectedLocation.value\n : injectedLocation\n\n /**\n * The computed request object to be used to retrieve the query preview results.\n *\n * @returns The search request object.\n */\n const queryPreviewRequest = computed<SearchRequest>(() => {\n const origin = createOrigin({\n feature: props.queryFeature,\n location,\n })\n const filters = props.queryPreviewInfo.filters?.reduce(\n (filtersList, filterId) => {\n const facetId = filterId.split(':')[0]\n const rawFilter = createRawFilters([filterId])[0]\n filtersList[facetId] = filtersList[facetId]\n ? filtersList[facetId].concat(rawFilter)\n : [rawFilter]\n\n return filtersList\n },\n {} as Record<string, Filter[]>,\n )\n\n return {\n query: props.queryPreviewInfo.query,\n rows: config.value.maxItemsToRequest,\n extraParams: {\n ...params.value,\n ...props.queryPreviewInfo.extraParams,\n },\n filters,\n ...(origin && { origin }),\n }\n })\n\n /**\n * The debounce method to trigger the request after the debounceTimeMs defined\n * for cacheable queries.\n *\n * @returns The search request object.\n */\n const emitQueryPreviewRequestUpdated = computed<DebouncedFunction<[SearchRequest]>>(() =>\n debounceFunction(request => {\n xBus.emit('QueryPreviewRequestUpdated', request, { priority: 0, replaceable: false })\n }, props.debounceTimeMs),\n )\n\n /**\n * Initialises watcher to emit debounced requests, and first value for the requests.\n *\n * @internal\n */\n watch(queryPreviewRequest, (newRequest, oldRequest) => {\n if (!deepEqual(newRequest, oldRequest) && !props.loadWhenVisible) {\n emitQueryPreviewRequestUpdated.value(newRequest)\n }\n })\n\n const cachedQueryPreview = previewResults.value[queryPreviewHash.value]\n\n // If the query has been saved it will emit load instead of the emitting the updated request.\n if (cachedQueryPreview?.status === 'success') {\n emit('load', queryPreviewHash.value)\n xBus.emit('QueryPreviewMounted', queryPreviewHash.value, {\n priority: 0,\n replaceable: false,\n })\n } else if (!props.loadWhenVisible) {\n emitQueryPreviewRequestUpdated.value(queryPreviewRequest.value)\n }\n\n /**\n * Watch element visibility and emit request when it becomes visible for the first time\n * (only when loadWhenVisible is true).\n */\n const { unwatchDisplay } = useOnDisplay({\n element: queryPreviewElement,\n callback: () => {\n if (props.loadWhenVisible && cachedQueryPreview?.status !== 'success') {\n emitQueryPreviewRequestUpdated.value(queryPreviewRequest.value)\n }\n },\n })\n\n /**\n * Cancels the (remaining) requests when the component is destroyed\n * via the `debounce.cancel()` method.\n * If the prop 'persistInCache' is set to false, it also removes the QueryPreview\n * from the state when the component is destroyed.\n */\n onBeforeUnmount(() => {\n unwatchDisplay?.()\n emitQueryPreviewRequestUpdated.value.cancel()\n xBus.emit(\n 'QueryPreviewUnmounted',\n { queryPreviewHash: queryPreviewHash.value, cache: props.persistInCache },\n {\n priority: 0,\n replaceable: false,\n },\n )\n })\n\n /**\n * Cancels the previous request when the debounced function changes (e.g: the debounceTimeMs\n * prop changes or there is a request in progress that cancels it).\n *\n * @param _new - The new debounced function.\n * @param old - The previous debounced function.\n * @internal\n */\n watch(\n emitQueryPreviewRequestUpdated,\n (_new: DebouncedFunction<[SearchRequest]>, old: DebouncedFunction<[SearchRequest]>) => {\n old.cancel()\n },\n )\n\n const queryPreviewResultsStatus = computed(() => queryPreviewResults.value?.status)\n\n /**\n * Emits an event when the query results are loaded or fail to load.\n *\n * @param status - The status of the query preview request.\n */\n watch(queryPreviewResultsStatus, () => {\n if (queryPreviewResultsStatus.value === 'success') {\n emit(results.value?.length ? 'load' : 'error', queryPreviewHash.value)\n } else if (queryPreviewResultsStatus.value === 'error') {\n emit('error', queryPreviewHash.value)\n }\n })\n\n const hasResults = computed(() => (queryPreviewResults.value?.totalResults ?? 0) > 0)\n\n /**\n * Render function to execute the `default` slot, binding `slotsProps` and getting only the\n * first `vNode` to avoid Fragments and Text root nodes.\n *\n * @remarks `slotProps` must be values without Vue reactivity and located inside the\n * render-function to update the binding data properly.\n *\n * @returns The root `vNode` of the `default` slot or empty string if there are no results. Always wrapped in a section\n * element with the `x-query-preview-wrapper__slot-content` class.\n */\n function renderDefaultSlot() {\n const slotProps = {\n queryPreviewInfo: props.queryPreviewInfo,\n results: queryPreviewResults.value?.results,\n totalResults: queryPreviewResults.value?.totalResults,\n displayTagging: queryPreviewResults.value?.displayTagging,\n queryTagging: queryPreviewResults.value?.queryTagging,\n }\n\n const slotContent = hasResults.value ? slots.default?.(slotProps)[0] : ''\n\n return h(\n 'section',\n { ref: queryPreviewElement, class: 'x-query-preview-wrapper__slot-content' },\n [slotContent],\n )\n }\n\n /* Hack to render through a render-function, the `default` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const componentProps = { hasResults, queryPreviewResults, queryPreviewElement }\n return (slots.default ? renderDefaultSlot : componentProps) as typeof componentProps\n },\n})\n</script>\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`QueryPreviewRequestUpdated`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted when the component is mounted and when the properties of the request object\n changes. The event payload is the `queryPreviewRequest` object.\n\n## Vue Events\n\nA list of vue events that the component will emit:\n\n- `load`: the event is emitted when the query results have been loaded.\n- `error`: the event is emitted if there is some error when retrieving the query results.\n\n## See it in action\n\nHere you have a basic example of how the QueryPreview is rendered. Keep in mind that this component\nis intended to be used overriding its default slot. By default it will only render the names of the\nresults.\n\n```vue live\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" />\n</template>\n\n<script setup>\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst queryPreviewInfo = reactive({ query: 'sandals' })\n</script>\n```\n\n### Play with the default slot\n\nIn this example, the results will be rendered inside a sliding panel.\n\n```vue live\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" #default=\"{ totalResults, results }\">\n <section>\n <p>Total results: {{ totalResults }}</p>\n <SlidingPanel :resetOnContentChange=\"false\">\n <article\n v-for=\"result in results\"\n :key=\"result.id\"\n class=\"x-result\"\n style=\"max-width: 300px; overflow: hidden\"\n >\n <BaseResultLink :result=\"result\">\n <BaseResultImage :result=\"result\" class=\"x-result__picture\" />\n </BaseResultLink>\n <div class=\"x-result__description\">\n <BaseResultLink :result=\"result\">\n <h1 class=\"x-title3\">{{ result.name }}</h1>\n </BaseResultLink>\n </div>\n </article>\n </SlidingPanel>\n </section>\n </QueryPreview>\n</template>\n\n<script setup>\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\nimport { BaseResultImage, BaseResultLink, SlidingPanel } from '@empathyco/x-components'\nimport { reactive } from 'vue'\nconst queryPreviewInfo = reactive({ query: 'flip-flops' })\n</script>\n```\n\n### Play with the result slot\n\nThe component exposes a slot to override the result content, without modifying the list.\n\nIn this example, the ID of the results will be rendered along with the name.\n\n```vue\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" #result=\"{ result }\">\n <span>{{ result.id }}</span>\n <span>{{ result.name }}</span>\n </QueryPreview>\n</template>\n\n<script setup>\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst queryPreviewInfo = reactive({ query: 'flip-flops' })\n</script>\n```\n\n### Play with props\n\nIn this example, the query preview has been limited to render a maximum of 4 results.\n\n```vue\n<template>\n <QueryPreview\n :maxItemsToRender=\"maxItemsToRender\"\n :queryPreviewInfo=\"queryPreviewInfo\"\n #default=\"{ results }\"\n >\n <BaseGrid #default=\"{ item }\" :items=\"results\">\n <BaseResultLink :result=\"item\">\n <BaseResultImage :result=\"item\" />\n </BaseResultLink>\n </BaseGrid>\n </QueryPreview>\n</template>\n\n<script setup>\nimport { BaseGrid, BaseResultImage, BaseResultLink } from '@empathyco/x-components'\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst maxItemsToRender = 4\nconst queryPreviewInfo = reactive({ query: 'flip-flops' })\n</script>\n```\n</docs>\n"],"names":["debounceFunction"],"mappings":"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"}
1
+ {"version":3,"file":"query-preview.vue2.js","sources":["../../../../../src/x-modules/queries-preview/components/query-preview.vue"],"sourcesContent":["<template>\n <!-- eslint-disable-next-line vue/no-unused-refs -->\n <section ref=\"queryPreviewElement\" class=\"x-query-preview-wrapper__default-content\">\n <ul v-if=\"hasResults\" data-test=\"query-preview\" class=\"x-query-preview\">\n <li\n v-for=\"result in queryPreviewResults?.results\"\n :key=\"result.id\"\n class=\"x-query-preview__item\"\n data-test=\"query-preview-item\"\n >\n <!--\n @slot Query Preview result slot.\n @binding {Result} result - A Query Preview result\n -->\n <slot name=\"result\" :result=\"result\">\n <span data-test=\"result-name\">{{ result.name }}</span>\n </slot>\n </li>\n </ul>\n </section>\n</template>\n\n<script lang=\"ts\">\nimport type { Filter, SearchRequest } from '@empathyco/x-types'\nimport type { PropType, Ref } from 'vue'\nimport type { FeatureLocation, QueryFeature } from '../../../types'\nimport type { DebouncedFunction } from '../../../utils'\nimport type { QueryPreviewInfo } from '../store/types'\nimport { deepEqual } from '@empathyco/x-utils'\nimport { computed, defineComponent, h, inject, onBeforeUnmount, provide, ref, watch } from 'vue'\nimport { LIST_ITEMS_KEY } from '../../../components'\nimport { useOnDisplay, useState, useXBus } from '../../../composables'\nimport { createOrigin, createRawFilters, debounceFunction } from '../../../utils'\nimport { getHashFromQueryPreviewInfo } from '../utils/get-hash-from-query-preview'\nimport { queriesPreviewXModule } from '../x-module'\n\n/**\n * Retrieves a preview of the results of a query and exposes them in the default slot,\n * along with the query preview and the totalResults of the search request.\n * By default, it renders the names of the results.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QueryPreview',\n xModule: queriesPreviewXModule.name,\n props: {\n /** The information about the request of the query preview. */\n queryPreviewInfo: {\n type: Object as PropType<QueryPreviewInfo>,\n required: true,\n },\n /** The origin property for the request. */\n queryFeature: {\n type: String as PropType<QueryFeature>,\n },\n /** Number of query preview results to be rendered. */\n maxItemsToRender: {\n type: Number,\n },\n /**\n * Controls whether the query preview requests should be triggered when the component is visible in the viewport.\n */\n loadWhenVisible: {\n type: Boolean,\n default: false,\n },\n /**\n * Debounce time in milliseconds for triggering the search requests.\n * It will default to 0 to fit the most common use case (pre-search),\n * and it would work properly with a 250 value inside empathize.\n */\n debounceTimeMs: {\n type: Number,\n default: 0,\n },\n /**\n * Controls whether the QueryPreview should be removed from the state\n * when the component is destroyed.\n */\n persistInCache: {\n type: Boolean,\n default: false,\n },\n },\n emits: ['load', 'error'],\n setup(props, { emit, slots }) {\n const xBus = useXBus()\n\n /**\n * previewResults: The results preview of the queries preview cacheable mounted.\n * It is a dictionary, indexed by the query preview query.\n *\n * params: As the request is handled in this component, we need\n * the extra params that will be used in the request.\n *\n * config: As the request is handled in this component, we need\n * the config that will be used in the request.\n */\n const { queriesPreview: previewResults, params, config } = useState('queriesPreview')\n\n /**\n * Template ref for the root element to track visibility.\n */\n const queryPreviewElement = ref<HTMLElement | null>(null)\n\n /**\n * Query Preview key converted into a unique id.\n *\n * @returns The query hash.\n */\n const queryPreviewHash = computed(() =>\n getHashFromQueryPreviewInfo(props.queryPreviewInfo, {\n ...params.value,\n ...props.queryPreviewInfo.extraParams,\n }),\n )\n\n provide('queryPreviewHash', queryPreviewHash)\n\n /**\n * Gets from the state the results preview of the query preview.\n *\n * @returns The results preview of the actual query preview.\n */\n const queryPreviewResults = computed(() => {\n const resultsPreview = previewResults.value[queryPreviewHash.value]\n return resultsPreview?.results\n ? {\n ...resultsPreview,\n results: resultsPreview.results.slice(0, props.maxItemsToRender),\n }\n : undefined\n })\n\n /**\n * The results to render from the state.\n *\n * @remarks The results list are provided with `items` key. It can be\n * concatenated with list items from components such as `BannersList`, `PromotedsList`,\n * `BaseGrid` or any component that injects the list.\n *\n * @returns A list of results.\n */\n const results = computed(() => queryPreviewResults.value?.results)\n provide(LIST_ITEMS_KEY as string, results)\n\n /**\n * It injects the provided {@link FeatureLocation} of the selected query in the search request.\n *\n * @internal\n */\n const injectedLocation = inject<Ref<FeatureLocation> | FeatureLocation>('location', 'none')\n const location =\n typeof injectedLocation === 'object' && 'value' in injectedLocation\n ? injectedLocation.value\n : injectedLocation\n\n /**\n * The computed request object to be used to retrieve the query preview results.\n *\n * @returns The search request object.\n */\n const queryPreviewRequest = computed<SearchRequest>(() => {\n const origin = createOrigin({\n feature: props.queryFeature,\n location,\n })\n const filters = props.queryPreviewInfo.filters?.reduce(\n (filtersList, filterId) => {\n const facetId = filterId.split(':')[0]\n const rawFilter = createRawFilters([filterId])[0]\n filtersList[facetId] = filtersList[facetId]\n ? filtersList[facetId].concat(rawFilter)\n : [rawFilter]\n\n return filtersList\n },\n {} as Record<string, Filter[]>,\n )\n\n return {\n query: props.queryPreviewInfo.query,\n rows: config.value.maxItemsToRequest,\n extraParams: {\n ...params.value,\n ...props.queryPreviewInfo.extraParams,\n },\n filters,\n ...(origin && { origin }),\n }\n })\n\n /**\n * The debounce method to trigger the request after the debounceTimeMs defined\n * for cacheable queries.\n *\n * @returns The search request object.\n */\n const emitQueryPreviewRequestUpdated = computed<DebouncedFunction<[SearchRequest]>>(() =>\n debounceFunction(request => {\n xBus.emit('QueryPreviewRequestUpdated', request, { priority: 0, replaceable: false })\n }, props.debounceTimeMs),\n )\n\n /**\n * Initialises watcher to emit debounced requests, and first value for the requests.\n *\n * @internal\n */\n watch(queryPreviewRequest, (newRequest, oldRequest) => {\n if (!deepEqual(newRequest, oldRequest) && !props.loadWhenVisible) {\n emitQueryPreviewRequestUpdated.value(newRequest)\n }\n })\n\n const cachedQueryPreview = previewResults.value[queryPreviewHash.value]\n\n // If the query has been saved it will emit load instead of the emitting the updated request.\n if (cachedQueryPreview?.status === 'success') {\n emit('load', queryPreviewHash.value)\n xBus.emit('QueryPreviewMounted', queryPreviewHash.value, {\n priority: 0,\n replaceable: false,\n })\n } else if (!props.loadWhenVisible) {\n emitQueryPreviewRequestUpdated.value(queryPreviewRequest.value)\n }\n\n /**\n * Watch element visibility and emit request when it becomes visible for the first time\n * (only when loadWhenVisible is true).\n */\n const { unwatchDisplay } = useOnDisplay({\n element: queryPreviewElement,\n callback: () => {\n if (props.loadWhenVisible && cachedQueryPreview?.status !== 'success') {\n emitQueryPreviewRequestUpdated.value(queryPreviewRequest.value)\n }\n },\n })\n\n /**\n * Cancels the (remaining) requests when the component is destroyed\n * via the `debounce.cancel()` method.\n * If the prop 'persistInCache' is set to false, it also removes the QueryPreview\n * from the state when the component is destroyed.\n */\n onBeforeUnmount(() => {\n unwatchDisplay?.()\n emitQueryPreviewRequestUpdated.value.cancel()\n xBus.emit(\n 'QueryPreviewUnmounted',\n { queryPreviewHash: queryPreviewHash.value, cache: props.persistInCache },\n {\n priority: 0,\n replaceable: false,\n },\n )\n })\n\n /**\n * Cancels the previous request when the debounced function changes (e.g: the debounceTimeMs\n * prop changes or there is a request in progress that cancels it).\n *\n * @param _new - The new debounced function.\n * @param old - The previous debounced function.\n * @internal\n */\n watch(\n emitQueryPreviewRequestUpdated,\n (_new: DebouncedFunction<[SearchRequest]>, old: DebouncedFunction<[SearchRequest]>) => {\n old.cancel()\n },\n )\n\n const queryPreviewResultsStatus = computed(() => queryPreviewResults.value?.status)\n\n /**\n * Emits an event when the query results are loaded or fail to load.\n *\n * @param status - The status of the query preview request.\n */\n watch(queryPreviewResultsStatus, () => {\n if (queryPreviewResultsStatus.value === 'success') {\n emit(results.value?.length ? 'load' : 'error', queryPreviewHash.value)\n } else if (queryPreviewResultsStatus.value === 'error') {\n emit('error', queryPreviewHash.value)\n }\n })\n\n const hasResults = computed(() => (queryPreviewResults.value?.totalResults ?? 0) > 0)\n\n /**\n * Render function to execute the `default` slot, binding `slotsProps` and getting only the\n * first `vNode` to avoid Fragments and Text root nodes.\n *\n * @remarks `slotProps` must be values without Vue reactivity and located inside the\n * render-function to update the binding data properly.\n *\n * @returns The root `vNode` of the `default` slot or empty string if there are no results. Always wrapped in a section\n * element with the `x-query-preview-wrapper__slot-content` class.\n */\n function renderDefaultSlot() {\n const slotProps = {\n queryPreviewInfo: props.queryPreviewInfo,\n results: queryPreviewResults.value?.results,\n totalResults: queryPreviewResults.value?.totalResults,\n displayTagging: queryPreviewResults.value?.displayTagging,\n queryTagging: queryPreviewResults.value?.queryTagging,\n }\n\n const slotContent = hasResults.value ? slots.default?.(slotProps)[0] : ''\n\n return h(\n 'section',\n { ref: queryPreviewElement, class: 'x-query-preview-wrapper__slot-content' },\n [slotContent],\n )\n }\n\n /* Hack to render through a render-function, the `default` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const componentProps = { hasResults, queryPreviewResults, queryPreviewElement }\n return (slots.default ? renderDefaultSlot : componentProps) as typeof componentProps\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`QueryPreviewRequestUpdated`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted when the component is mounted and when the properties of the request object\n changes. The event payload is the `queryPreviewRequest` object.\n\n## Vue Events\n\nA list of vue events that the component will emit:\n\n- `load`: the event is emitted when the query results have been loaded.\n- `error`: the event is emitted if there is some error when retrieving the query results.\n\n## See it in action\n\nHere you have a basic example of how the QueryPreview is rendered. Keep in mind that this component\nis intended to be used overriding its default slot. By default it will only render the names of the\nresults.\n\n```vue live\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" />\n</template>\n\n<script setup>\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst queryPreviewInfo = reactive({ query: 'sandals' })\n</script>\n```\n\n### Play with the default slot\n\nIn this example, the results will be rendered inside a sliding panel.\n\n```vue live\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" #default=\"{ totalResults, results }\">\n <section>\n <p>Total results: {{ totalResults }}</p>\n <SlidingPanel :resetOnContentChange=\"false\">\n <article\n v-for=\"result in results\"\n :key=\"result.id\"\n class=\"x-result\"\n style=\"max-width: 300px; overflow: hidden\"\n >\n <BaseResultLink :result=\"result\">\n <BaseResultImage :result=\"result\" class=\"x-result__picture\" />\n </BaseResultLink>\n <div class=\"x-result__description\">\n <BaseResultLink :result=\"result\">\n <h1 class=\"x-title3\">{{ result.name }}</h1>\n </BaseResultLink>\n </div>\n </article>\n </SlidingPanel>\n </section>\n </QueryPreview>\n</template>\n\n<script setup>\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\nimport { BaseResultImage, BaseResultLink, SlidingPanel } from '@empathyco/x-components'\nimport { reactive } from 'vue'\nconst queryPreviewInfo = reactive({ query: 'flip-flops' })\n</script>\n```\n\n### Play with the result slot\n\nThe component exposes a slot to override the result content, without modifying the list.\n\nIn this example, the ID of the results will be rendered along with the name.\n\n```vue\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" #result=\"{ result }\">\n <span>{{ result.id }}</span>\n <span>{{ result.name }}</span>\n </QueryPreview>\n</template>\n\n<script setup>\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst queryPreviewInfo = reactive({ query: 'flip-flops' })\n</script>\n```\n\n### Play with props\n\nIn this example, the query preview has been limited to render a maximum of 4 results.\n\n```vue\n<template>\n <QueryPreview\n :maxItemsToRender=\"maxItemsToRender\"\n :queryPreviewInfo=\"queryPreviewInfo\"\n #default=\"{ results }\"\n >\n <BaseGrid #default=\"{ item }\" :items=\"results\">\n <BaseResultLink :result=\"item\">\n <BaseResultImage :result=\"item\" />\n </BaseResultLink>\n </BaseGrid>\n </QueryPreview>\n</template>\n\n<script setup>\nimport { BaseGrid, BaseResultImage, BaseResultLink } from '@empathyco/x-components'\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\nimport { reactive } from 'vue'\nconst maxItemsToRender = 4\nconst queryPreviewInfo = reactive({ query: 'flip-flops' })\n</script>\n```\n</docs>\n"],"names":["debounceFunction"],"mappings":"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"}
@@ -14,7 +14,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
14
14
  renderSlot(_ctx.$slots, "suggestion", normalizeProps(guardReactiveProps({ ...baseScope })), () => [
15
15
  createVNode(_component_QuerySuggestion, {
16
16
  suggestion: baseScope.suggestion,
17
- class: "x-query-suggestions__suggestion x-suggestion"
17
+ class: "x-query-suggestions__suggestion xds:suggestion"
18
18
  }, {
19
19
  default: withCtx((querySuggestionScope) => [
20
20
  renderSlot(_ctx.$slots, "suggestion-content", normalizeProps(guardReactiveProps({ ...baseScope, ...querySuggestionScope })))
@@ -1 +1 @@
1
- {"version":3,"file":"query-suggestions.vue.js","sources":["../../../../../src/x-modules/query-suggestions/components/query-suggestions.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"suggestions\"\n class=\"x-query-suggestions\"\n data-test=\"query-suggestions\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom component that replaces the `QuerySuggestion` component\n @binding {Object} v-bind - Query Suggestion attributes:<br />&nbsp;&nbsp;- **suggestion** `Suggestion` - Query Suggestion data<br />&nbsp;&nbsp;- **index** `number` - Query Suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope }\">\n <QuerySuggestion\n v-slot=\"querySuggestionScope\"\n :suggestion=\"baseScope.suggestion\"\n class=\"x-query-suggestions__suggestion x-suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom content that replaces the `QuerySuggestion` default content\n @binding {Object} v-bind - Query Suggestion attributes:<br />&nbsp;&nbsp;- **suggestion** `Suggestion` - Query Suggestion data<br />&nbsp;&nbsp;- **index** `number` - Query Suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...querySuggestionScope }\" />\n </QuerySuggestion>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables'\nimport { querySuggestionsXModule } from '../x-module'\nimport QuerySuggestion from './query-suggestion.vue'\n\n/**\n * This component renders a list of possible search queries to select from as a query is entered\n * in the input field. By default, this is a list of\n * [`QuerySuggestion`](./x-components.query-suggestion.md) components.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QuerySuggestions',\n xModule: querySuggestionsXModule.name,\n components: { BaseSuggestions, QuerySuggestion },\n setup() {\n /** The module's list of suggestions. */\n const { querySuggestions } = useGetter('querySuggestions')\n\n return { suggestions: querySuggestions }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Inherited props\n\nThis component inherits the [`BaseSuggestions`](../base-components/x-components.base-suggestions.md)\nprops.\n\n| Name | Description | Type | Default |\n| ------------------ | ------------------------------------------- | -------- | ------- |\n| `animation` | Animation component for `QuerySuggestions`. | `Vue` | `\"ul\"` |\n| `maxItemsToRender` | Number of query suggestions to be rendered. | `number` | |\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend microservice required\nTo use this component, the <b>Empathize</b> microservice must be\nimplemented.\n:::\n<!-- prettier-ignore-end -->\n\nIn this example, a list of query suggestions is displayed. See how the suggestions change as you\ntype “sandal”. If you click on a suggestion, the search term in the search input is updated and the\nquery suggestions are changed to reflect the new search term.\n\n_Type “sandal” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <SearchInput />\n <QuerySuggestions />\n</template>\n\n<script setup>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n</script>\n```\n\n### Play with props\n\nIn this example, an `StaggeredFadeAndSlide` animation component has been passed as prop, so that the\nmatching query suggestions are shuffled with a slight delay as more letters of the term are typed.\n\n_Type “lipstick” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <SearchInput />\n <QuerySuggestions :animation=\"StaggeredFadeAndSlide\" />\n</template>\n\n<script>\nimport Vue from 'vue'\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport StaggeredFadeAndSlide from '@empathyco/x-components/animations/staggered-fade-and-slide.vue'\n</script>\n```\n\n### Play with suggestion slot\n\nHere, the `suggestion` binding property passes the suggestion data.\n\n_Type “bag” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <SearchInput />\n <QuerySuggestions #suggestion=\"{ suggestion }\">\n <QuerySuggestion :suggestion=\"suggestion\" #default=\"{ suggestion }\">\n <span>🔍</span>\n <span>{{ suggestion.query }}</span>\n </QuerySuggestion>\n </QuerySuggestions>\n</template>\n\n<script setup>\nimport { QuerySuggestion, QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n</script>\n```\n\n<!-- prettier-ignore-start -->\n::: danger\nIf you're not using the [`QuerySuggestion`](./query-suggestion.md) component, then\nyou must implement the `UserAcceptedAQuery` and `UserSelectedAQuerySuggestion` events in\n`QuerySuggestions`.\n\n```vue live\n<template>\n <SearchInput />\n <QuerySuggestions #suggestion=\"{ suggestion }\">\n <button @click=\"emitSuggestionClickedEvents($event, suggestion)\">\n {{ suggestion.query }}\n </button>\n </QuerySuggestions>\n</template>\n\n<script setup>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { use$x } from '../../../composables/use-$x'\n\nconst x = use$x()\nfunction emitSuggestionClickedEvents(event, suggestion) {\n x.emit('UserAcceptedAQuery', suggestion.query, {\n target: event.target\n })\n x.emit('UserSelectedASuggestion', suggestion, {\n target: event.target\n })\n x.emit('UserSelectedAQuerySuggestion', suggestion, {\n target: event.target\n })\n}\n</script>\n```\n\n:::\n<!-- prettier-ignore-end -->\n\n### Play with suggestion-content slot\n\nIn this example, the `suggestion` and `query` properties of the `suggestion-content` slot are used\nto paint a suggestion with an icon.\n\n_Type “trousers” or another toy in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions #suggestion-content=\"{ suggestion, query }\">\n <span>🔍</span>\n <Highlight :text=\"suggestion.query\" :highlight=\"query\" />\n </QuerySuggestions>\n </div>\n</template>\n\n<script setup>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { Highlight } from '@empathyco/x-components'\n</script>\n```\n\n## Extending the component\n\nComponents can be combined and communicate with each other. Commonly, the `QuerySuggestions`\ncomponent communicates with the [`SearchInput`](../search-box/x-components.search-input.md),\nupdating the term in the search input.\n\n_Type “pants” or another toy in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions />\n </div>\n</template>\n\n<script setup>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n</script>\n```\n</docs>\n"],"names":["_createBlock","_withCtx","_renderSlot","_normalizeProps","_guardReactiveProps","_createVNode"],"mappings":";;;;;;;sBACEA,WAAA,CA4BkB,0BAAA,EAAA;AAAA,IA3Bf,WAAA,EAAa,IAAA,CAAA,WAAA;AAAA,IACd,KAAA,EAAM,qBAAA;AAAA,IACN,WAAA,EAAU;AAAA,GAAA,EAAA;IAEC,OAAA,EAAOC,OAAA,CAOhB,CAcO,SAAA,KArBoB;AAAA,MAO3BC,UAAA,CAcO,IAAA,CAAA,MAAA,EAAA,YAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAd8B,SAAA,EAAS,CAAA,CAAA,EAA9C,MAcO;AAAA,QAbLC,WAAA,CAYkB,0BAAA,EAAA;AAAA,UAVf,YAAY,SAAA,CAAU,UAAA;AAAA,UACvB,KAAA,EAAM;AAAA,SAAA,EAAA;AAQN,UAAA,OAAA,EAAAJ,OAAA,CAAA,CAAqF,oBAAA,KAVzD;AAAA,YAU5BC,UAAA,CAAqF,IAAA,CAAA,MAAA,EAAA,oBAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAAxC,SAAA,EAAS,GAAK,oBAAA,EAAoB,CAAA,CAAA;AAAA,WAAA,CAAA;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"query-suggestions.vue.js","sources":["../../../../../src/x-modules/query-suggestions/components/query-suggestions.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"suggestions\"\n class=\"x-query-suggestions\"\n data-test=\"query-suggestions\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom component that replaces the `QuerySuggestion` component\n @binding {Object} v-bind - Query Suggestion attributes:<br />&nbsp;&nbsp;- **suggestion** `Suggestion` - Query Suggestion data<br />&nbsp;&nbsp;- **index** `number` - Query Suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope }\">\n <QuerySuggestion\n v-slot=\"querySuggestionScope\"\n :suggestion=\"baseScope.suggestion\"\n class=\"x-query-suggestions__suggestion xds:suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom content that replaces the `QuerySuggestion` default content\n @binding {Object} v-bind - Query Suggestion attributes:<br />&nbsp;&nbsp;- **suggestion** `Suggestion` - Query Suggestion data<br />&nbsp;&nbsp;- **index** `number` - Query Suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...querySuggestionScope }\" />\n </QuerySuggestion>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables'\nimport { querySuggestionsXModule } from '../x-module'\nimport QuerySuggestion from './query-suggestion.vue'\n\n/**\n * This component renders a list of possible search queries to select from as a query is entered\n * in the input field. By default, this is a list of\n * [`QuerySuggestion`](./x-components.query-suggestion.md) components.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QuerySuggestions',\n xModule: querySuggestionsXModule.name,\n components: { BaseSuggestions, QuerySuggestion },\n setup() {\n /** The module's list of suggestions. */\n const { querySuggestions } = useGetter('querySuggestions')\n\n return { suggestions: querySuggestions }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Inherited props\n\nThis component inherits the [`BaseSuggestions`](../base-components/x-components.base-suggestions.md)\nprops.\n\n| Name | Description | Type | Default |\n| ------------------ | ------------------------------------------- | -------- | ------- |\n| `animation` | Animation component for `QuerySuggestions`. | `Vue` | `\"ul\"` |\n| `maxItemsToRender` | Number of query suggestions to be rendered. | `number` | |\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend microservice required\nTo use this component, the <b>Empathize</b> microservice must be\nimplemented.\n:::\n<!-- prettier-ignore-end -->\n\nIn this example, a list of query suggestions is displayed. See how the suggestions change as you\ntype “sandal”. If you click on a suggestion, the search term in the search input is updated and the\nquery suggestions are changed to reflect the new search term.\n\n_Type “sandal” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <SearchInput />\n <QuerySuggestions />\n</template>\n\n<script setup>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n</script>\n```\n\n### Play with props\n\nIn this example, an `StaggeredFadeAndSlide` animation component has been passed as prop, so that the\nmatching query suggestions are shuffled with a slight delay as more letters of the term are typed.\n\n_Type “lipstick” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <SearchInput />\n <QuerySuggestions :animation=\"StaggeredFadeAndSlide\" />\n</template>\n\n<script>\nimport Vue from 'vue'\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport StaggeredFadeAndSlide from '@empathyco/x-components/animations/staggered-fade-and-slide.vue'\n</script>\n```\n\n### Play with suggestion slot\n\nHere, the `suggestion` binding property passes the suggestion data.\n\n_Type “bag” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <SearchInput />\n <QuerySuggestions #suggestion=\"{ suggestion }\">\n <QuerySuggestion :suggestion=\"suggestion\" #default=\"{ suggestion }\">\n <span>🔍</span>\n <span>{{ suggestion.query }}</span>\n </QuerySuggestion>\n </QuerySuggestions>\n</template>\n\n<script setup>\nimport { QuerySuggestion, QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n</script>\n```\n\n<!-- prettier-ignore-start -->\n::: danger\nIf you're not using the [`QuerySuggestion`](./query-suggestion.md) component, then\nyou must implement the `UserAcceptedAQuery` and `UserSelectedAQuerySuggestion` events in\n`QuerySuggestions`.\n\n```vue live\n<template>\n <SearchInput />\n <QuerySuggestions #suggestion=\"{ suggestion }\">\n <button @click=\"emitSuggestionClickedEvents($event, suggestion)\">\n {{ suggestion.query }}\n </button>\n </QuerySuggestions>\n</template>\n\n<script setup>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { use$x } from '../../../composables/use-$x'\n\nconst x = use$x()\nfunction emitSuggestionClickedEvents(event, suggestion) {\n x.emit('UserAcceptedAQuery', suggestion.query, {\n target: event.target\n })\n x.emit('UserSelectedASuggestion', suggestion, {\n target: event.target\n })\n x.emit('UserSelectedAQuerySuggestion', suggestion, {\n target: event.target\n })\n}\n</script>\n```\n\n:::\n<!-- prettier-ignore-end -->\n\n### Play with suggestion-content slot\n\nIn this example, the `suggestion` and `query` properties of the `suggestion-content` slot are used\nto paint a suggestion with an icon.\n\n_Type “trousers” or another toy in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions #suggestion-content=\"{ suggestion, query }\">\n <span>🔍</span>\n <Highlight :text=\"suggestion.query\" :highlight=\"query\" />\n </QuerySuggestions>\n </div>\n</template>\n\n<script setup>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { Highlight } from '@empathyco/x-components'\n</script>\n```\n\n## Extending the component\n\nComponents can be combined and communicate with each other. Commonly, the `QuerySuggestions`\ncomponent communicates with the [`SearchInput`](../search-box/x-components.search-input.md),\nupdating the term in the search input.\n\n_Type “pants” or another toy in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions />\n </div>\n</template>\n\n<script setup>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n</script>\n```\n</docs>\n"],"names":["_createBlock","_withCtx","_renderSlot","_normalizeProps","_guardReactiveProps","_createVNode"],"mappings":";;;;;;;sBACEA,WAAA,CA4BkB,0BAAA,EAAA;AAAA,IA3Bf,WAAA,EAAa,IAAA,CAAA,WAAA;AAAA,IACd,KAAA,EAAM,qBAAA;AAAA,IACN,WAAA,EAAU;AAAA,GAAA,EAAA;IAEC,OAAA,EAAOC,OAAA,CAOhB,CAcO,SAAA,KArBoB;AAAA,MAO3BC,UAAA,CAcO,IAAA,CAAA,MAAA,EAAA,YAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAd8B,SAAA,EAAS,CAAA,CAAA,EAA9C,MAcO;AAAA,QAbLC,WAAA,CAYkB,0BAAA,EAAA;AAAA,UAVf,YAAY,SAAA,CAAU,UAAA;AAAA,UACvB,KAAA,EAAM;AAAA,SAAA,EAAA;AAQN,UAAA,OAAA,EAAAJ,OAAA,CAAA,CAAqF,oBAAA,KAVzD;AAAA,YAU5BC,UAAA,CAAqF,IAAA,CAAA,MAAA,EAAA,oBAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAAxC,SAAA,EAAS,GAAK,oBAAA,EAAoB,CAAA,CAAA;AAAA,WAAA,CAAA;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"query-suggestions.vue2.js","sources":["../../../../../src/x-modules/query-suggestions/components/query-suggestions.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"suggestions\"\n class=\"x-query-suggestions\"\n data-test=\"query-suggestions\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom component that replaces the `QuerySuggestion` component\n @binding {Object} v-bind - Query Suggestion attributes:<br />&nbsp;&nbsp;- **suggestion** `Suggestion` - Query Suggestion data<br />&nbsp;&nbsp;- **index** `number` - Query Suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope }\">\n <QuerySuggestion\n v-slot=\"querySuggestionScope\"\n :suggestion=\"baseScope.suggestion\"\n class=\"x-query-suggestions__suggestion x-suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom content that replaces the `QuerySuggestion` default content\n @binding {Object} v-bind - Query Suggestion attributes:<br />&nbsp;&nbsp;- **suggestion** `Suggestion` - Query Suggestion data<br />&nbsp;&nbsp;- **index** `number` - Query Suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...querySuggestionScope }\" />\n </QuerySuggestion>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables'\nimport { querySuggestionsXModule } from '../x-module'\nimport QuerySuggestion from './query-suggestion.vue'\n\n/**\n * This component renders a list of possible search queries to select from as a query is entered\n * in the input field. By default, this is a list of\n * [`QuerySuggestion`](./x-components.query-suggestion.md) components.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QuerySuggestions',\n xModule: querySuggestionsXModule.name,\n components: { BaseSuggestions, QuerySuggestion },\n setup() {\n /** The module's list of suggestions. */\n const { querySuggestions } = useGetter('querySuggestions')\n\n return { suggestions: querySuggestions }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Inherited props\n\nThis component inherits the [`BaseSuggestions`](../base-components/x-components.base-suggestions.md)\nprops.\n\n| Name | Description | Type | Default |\n| ------------------ | ------------------------------------------- | -------- | ------- |\n| `animation` | Animation component for `QuerySuggestions`. | `Vue` | `\"ul\"` |\n| `maxItemsToRender` | Number of query suggestions to be rendered. | `number` | |\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend microservice required\nTo use this component, the <b>Empathize</b> microservice must be\nimplemented.\n:::\n<!-- prettier-ignore-end -->\n\nIn this example, a list of query suggestions is displayed. See how the suggestions change as you\ntype “sandal”. If you click on a suggestion, the search term in the search input is updated and the\nquery suggestions are changed to reflect the new search term.\n\n_Type “sandal” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <SearchInput />\n <QuerySuggestions />\n</template>\n\n<script setup>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n</script>\n```\n\n### Play with props\n\nIn this example, an `StaggeredFadeAndSlide` animation component has been passed as prop, so that the\nmatching query suggestions are shuffled with a slight delay as more letters of the term are typed.\n\n_Type “lipstick” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <SearchInput />\n <QuerySuggestions :animation=\"StaggeredFadeAndSlide\" />\n</template>\n\n<script>\nimport Vue from 'vue'\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport StaggeredFadeAndSlide from '@empathyco/x-components/animations/staggered-fade-and-slide.vue'\n</script>\n```\n\n### Play with suggestion slot\n\nHere, the `suggestion` binding property passes the suggestion data.\n\n_Type “bag” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <SearchInput />\n <QuerySuggestions #suggestion=\"{ suggestion }\">\n <QuerySuggestion :suggestion=\"suggestion\" #default=\"{ suggestion }\">\n <span>🔍</span>\n <span>{{ suggestion.query }}</span>\n </QuerySuggestion>\n </QuerySuggestions>\n</template>\n\n<script setup>\nimport { QuerySuggestion, QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n</script>\n```\n\n<!-- prettier-ignore-start -->\n::: danger\nIf you're not using the [`QuerySuggestion`](./query-suggestion.md) component, then\nyou must implement the `UserAcceptedAQuery` and `UserSelectedAQuerySuggestion` events in\n`QuerySuggestions`.\n\n```vue live\n<template>\n <SearchInput />\n <QuerySuggestions #suggestion=\"{ suggestion }\">\n <button @click=\"emitSuggestionClickedEvents($event, suggestion)\">\n {{ suggestion.query }}\n </button>\n </QuerySuggestions>\n</template>\n\n<script setup>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { use$x } from '../../../composables/use-$x'\n\nconst x = use$x()\nfunction emitSuggestionClickedEvents(event, suggestion) {\n x.emit('UserAcceptedAQuery', suggestion.query, {\n target: event.target\n })\n x.emit('UserSelectedASuggestion', suggestion, {\n target: event.target\n })\n x.emit('UserSelectedAQuerySuggestion', suggestion, {\n target: event.target\n })\n}\n</script>\n```\n\n:::\n<!-- prettier-ignore-end -->\n\n### Play with suggestion-content slot\n\nIn this example, the `suggestion` and `query` properties of the `suggestion-content` slot are used\nto paint a suggestion with an icon.\n\n_Type “trousers” or another toy in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions #suggestion-content=\"{ suggestion, query }\">\n <span>🔍</span>\n <Highlight :text=\"suggestion.query\" :highlight=\"query\" />\n </QuerySuggestions>\n </div>\n</template>\n\n<script setup>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { Highlight } from '@empathyco/x-components'\n</script>\n```\n\n## Extending the component\n\nComponents can be combined and communicate with each other. Commonly, the `QuerySuggestions`\ncomponent communicates with the [`SearchInput`](../search-box/x-components.search-input.md),\nupdating the term in the search input.\n\n_Type “pants” or another toy in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions />\n </div>\n</template>\n\n<script setup>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;;;;AAuCA;;;;;;AAME;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,uBAAuB,CAAC,IAAI;AACrC,IAAA,UAAU,EAAE,EAAE,eAAe,EAAE,iBAAiB;IAChD,KAAK,GAAA;;QAEH,MAAM,EAAE,gBAAe,EAAE,GAAI,SAAS,CAAC,kBAAkB,CAAA;AAEzD,QAAA,OAAO,EAAE,WAAW,EAAE,gBAAe,EAAE;IACzC,CAAC;AACF,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"query-suggestions.vue2.js","sources":["../../../../../src/x-modules/query-suggestions/components/query-suggestions.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"suggestions\"\n class=\"x-query-suggestions\"\n data-test=\"query-suggestions\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom component that replaces the `QuerySuggestion` component\n @binding {Object} v-bind - Query Suggestion attributes:<br />&nbsp;&nbsp;- **suggestion** `Suggestion` - Query Suggestion data<br />&nbsp;&nbsp;- **index** `number` - Query Suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope }\">\n <QuerySuggestion\n v-slot=\"querySuggestionScope\"\n :suggestion=\"baseScope.suggestion\"\n class=\"x-query-suggestions__suggestion xds:suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom content that replaces the `QuerySuggestion` default content\n @binding {Object} v-bind - Query Suggestion attributes:<br />&nbsp;&nbsp;- **suggestion** `Suggestion` - Query Suggestion data<br />&nbsp;&nbsp;- **index** `number` - Query Suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...querySuggestionScope }\" />\n </QuerySuggestion>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables'\nimport { querySuggestionsXModule } from '../x-module'\nimport QuerySuggestion from './query-suggestion.vue'\n\n/**\n * This component renders a list of possible search queries to select from as a query is entered\n * in the input field. By default, this is a list of\n * [`QuerySuggestion`](./x-components.query-suggestion.md) components.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QuerySuggestions',\n xModule: querySuggestionsXModule.name,\n components: { BaseSuggestions, QuerySuggestion },\n setup() {\n /** The module's list of suggestions. */\n const { querySuggestions } = useGetter('querySuggestions')\n\n return { suggestions: querySuggestions }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Inherited props\n\nThis component inherits the [`BaseSuggestions`](../base-components/x-components.base-suggestions.md)\nprops.\n\n| Name | Description | Type | Default |\n| ------------------ | ------------------------------------------- | -------- | ------- |\n| `animation` | Animation component for `QuerySuggestions`. | `Vue` | `\"ul\"` |\n| `maxItemsToRender` | Number of query suggestions to be rendered. | `number` | |\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend microservice required\nTo use this component, the <b>Empathize</b> microservice must be\nimplemented.\n:::\n<!-- prettier-ignore-end -->\n\nIn this example, a list of query suggestions is displayed. See how the suggestions change as you\ntype “sandal”. If you click on a suggestion, the search term in the search input is updated and the\nquery suggestions are changed to reflect the new search term.\n\n_Type “sandal” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <SearchInput />\n <QuerySuggestions />\n</template>\n\n<script setup>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n</script>\n```\n\n### Play with props\n\nIn this example, an `StaggeredFadeAndSlide` animation component has been passed as prop, so that the\nmatching query suggestions are shuffled with a slight delay as more letters of the term are typed.\n\n_Type “lipstick” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <SearchInput />\n <QuerySuggestions :animation=\"StaggeredFadeAndSlide\" />\n</template>\n\n<script>\nimport Vue from 'vue'\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport StaggeredFadeAndSlide from '@empathyco/x-components/animations/staggered-fade-and-slide.vue'\n</script>\n```\n\n### Play with suggestion slot\n\nHere, the `suggestion` binding property passes the suggestion data.\n\n_Type “bag” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <SearchInput />\n <QuerySuggestions #suggestion=\"{ suggestion }\">\n <QuerySuggestion :suggestion=\"suggestion\" #default=\"{ suggestion }\">\n <span>🔍</span>\n <span>{{ suggestion.query }}</span>\n </QuerySuggestion>\n </QuerySuggestions>\n</template>\n\n<script setup>\nimport { QuerySuggestion, QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n</script>\n```\n\n<!-- prettier-ignore-start -->\n::: danger\nIf you're not using the [`QuerySuggestion`](./query-suggestion.md) component, then\nyou must implement the `UserAcceptedAQuery` and `UserSelectedAQuerySuggestion` events in\n`QuerySuggestions`.\n\n```vue live\n<template>\n <SearchInput />\n <QuerySuggestions #suggestion=\"{ suggestion }\">\n <button @click=\"emitSuggestionClickedEvents($event, suggestion)\">\n {{ suggestion.query }}\n </button>\n </QuerySuggestions>\n</template>\n\n<script setup>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { use$x } from '../../../composables/use-$x'\n\nconst x = use$x()\nfunction emitSuggestionClickedEvents(event, suggestion) {\n x.emit('UserAcceptedAQuery', suggestion.query, {\n target: event.target\n })\n x.emit('UserSelectedASuggestion', suggestion, {\n target: event.target\n })\n x.emit('UserSelectedAQuerySuggestion', suggestion, {\n target: event.target\n })\n}\n</script>\n```\n\n:::\n<!-- prettier-ignore-end -->\n\n### Play with suggestion-content slot\n\nIn this example, the `suggestion` and `query` properties of the `suggestion-content` slot are used\nto paint a suggestion with an icon.\n\n_Type “trousers” or another toy in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions #suggestion-content=\"{ suggestion, query }\">\n <span>🔍</span>\n <Highlight :text=\"suggestion.query\" :highlight=\"query\" />\n </QuerySuggestions>\n </div>\n</template>\n\n<script setup>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { Highlight } from '@empathyco/x-components'\n</script>\n```\n\n## Extending the component\n\nComponents can be combined and communicate with each other. Commonly, the `QuerySuggestions`\ncomponent communicates with the [`SearchInput`](../search-box/x-components.search-input.md),\nupdating the term in the search input.\n\n_Type “pants” or another toy in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions />\n </div>\n</template>\n\n<script setup>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n</script>\n```\n</docs>\n"],"names":[],"mappings":";;;;;;;;;;;;;AAuCA;;;;;;AAME;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,uBAAuB,CAAC,IAAI;AACrC,IAAA,UAAU,EAAE,EAAE,eAAe,EAAE,iBAAiB;IAChD,KAAK,GAAA;;QAEH,MAAM,EAAE,gBAAe,EAAE,GAAI,SAAS,CAAC,kBAAkB,CAAA;AAEzD,QAAA,OAAO,EAAE,WAAW,EAAE,gBAAe,EAAE;IACzC,CAAC;AACF,CAAA,CAAA;;;;"}
@@ -1,6 +1,6 @@
1
1
  import injectCss from '../../../../tools/inject-css.js';
2
2
 
3
- var css = "[dir=ltr] .x-related-prompt{text-align:left}[dir=rtl] .x-related-prompt{text-align:right}.x-related-prompt{align-items:center;display:flex;gap:8px;height:100%;justify-content:space-between;padding:8px;width:100%}.x-related-prompt-text{flex-grow:1;text-align:left}.x-related-prompt-text.x-related-prompt-text--selected{text-align:center}.x-related-prompt-icon{align-self:start;flex-shrink:0;height:24px}.x-related-prompts-item-image{aspect-ratio:1/1;background-color:#fff;border-radius:50%;flex-shrink:0;object-fit:cover;overflow:hidden}";
3
+ var css = ".x-related-prompt{align-items:center;display:flex;gap:8px;height:100%;justify-content:space-between;padding:8px;text-align:start;width:100%}.x-related-prompt-text{flex-grow:1;text-align:left}.x-related-prompt-text.x-related-prompt-text--selected{text-align:center}.x-related-prompt-icon{align-self:start;flex-shrink:0;height:24px}.x-related-prompts-item-image{aspect-ratio:1/1;background-color:#fff;border-radius:50%;flex-shrink:0;object-fit:cover;overflow:hidden}";
4
4
  injectCss(css);
5
5
 
6
6
  export { css };
@@ -7,7 +7,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
7
7
  "button",
8
8
  {
9
9
  ref: "buttonEl",
10
- class: normalizeClass(["x-tag x-related-tag", _ctx.dynamicClasses]),
10
+ class: normalizeClass(["x-related-tag xds:tag", _ctx.dynamicClasses]),
11
11
  "data-test": "related-tag",
12
12
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickRelatedTag && _ctx.clickRelatedTag(...args))
13
13
  },
@@ -1 +1 @@
1
- {"version":3,"file":"related-tag.vue.js","sources":["../../../../../src/x-modules/related-tags/components/related-tag.vue"],"sourcesContent":["<template>\n <button\n ref=\"buttonEl\"\n class=\"x-tag x-related-tag\"\n data-test=\"related-tag\"\n :class=\"dynamicClasses\"\n @click=\"clickRelatedTag\"\n >\n <!--\n @slot Custom content that replaces the RelatedTag default content.\n @binding {RelatedTag} relatedTag - Related tag data.\n @binding {boolean} isSelected - Related tag status.\n @binding {boolean} shouldHighlightCurated - True if the curated RTs should be displayed.\n -->\n <slot v-bind=\"{ relatedTag, isSelected, shouldHighlightCurated }\">{{ relatedTag.tag }}</slot>\n </button>\n</template>\n\n<script lang=\"ts\">\nimport type { RelatedTag as RelatedTagModel } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../../../utils/types'\nimport type { WireMetadata } from '../../../wiring/wiring.types'\nimport { computed, defineComponent, ref } from 'vue'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { relatedTagsXModule } from '../x-module'\n\n/**\n * This component renders a related tag for a query. A related tag is a descriptive keyword\n * related to the current query to fine-tune the search. For example, if you are searching\n * for *lego*, a related tag could be *city*, refining the search with *lego city*.\n *\n * @public\n */\nexport default defineComponent({\n name: 'RelatedTag',\n xModule: relatedTagsXModule.name,\n props: {\n /**\n * Indicates if the curated related tag should be highlighted.\n *\n * @public\n */\n highlightCurated: {\n type: Boolean,\n default: false,\n },\n /**\n * The related tag model data.\n *\n * @public\n */\n relatedTag: {\n type: Object as PropType<RelatedTagModel>,\n required: true,\n },\n },\n setup(props) {\n const $x = use$x()\n\n const buttonEl = ref<HTMLElement | undefined>()\n\n /**\n * The selected related tags.\n *\n * @internal\n */\n const { selectedRelatedTags } = useState('relatedTags')\n\n /**\n * Check if the related tag is selected or not.\n *\n * @returns If the related tag is selected.\n *\n * @internal\n */\n const isSelected = computed(() => selectedRelatedTags.value.includes(props.relatedTag))\n\n /**\n * Blurs the related tag if it is selected.\n *\n * @public\n */\n const blurRelatedTag = () => {\n if (isSelected.value) {\n buttonEl.value?.blur()\n }\n }\n\n /**\n * Generates the {@link WireMetadata} object omitting the moduleName.\n *\n * @returns The {@link WireMetadata} object omitting the moduleName.\n * @internal\n */\n const createEventMetadata = (): Omit<WireMetadata, 'moduleName'> => ({\n target: buttonEl.value as HTMLElement,\n feature: 'related_tag',\n })\n\n /**\n * Emits events when the button is clicked.\n *\n * @public\n */\n const emitEvents = () => {\n // We have to emit this events first to avoid the UserPickedARelatedTag wires to change the\n // isSelected value before emitting this selection events.\n $x.emit(\n isSelected.value ? 'UserDeselectedARelatedTag' : 'UserSelectedARelatedTag',\n props.relatedTag,\n createEventMetadata(),\n )\n $x.emit('UserPickedARelatedTag', props.relatedTag, createEventMetadata())\n }\n\n /**\n * Handles the click on the button.\n *\n * @public\n */\n const clickRelatedTag = () => {\n emitEvents()\n blurRelatedTag()\n }\n\n /**\n * Check if the related tag is curated and should be highlighted.\n *\n * @returns True if the related tag is curated and should be highlighted.\n *\n * @internal\n */\n const shouldHighlightCurated = computed(\n () => props.highlightCurated && (props.relatedTag.isCurated ?? false),\n )\n\n /**\n * Adds the dynamic css classes to the component.\n *\n * @returns The class to be added to the component.\n *\n * @internal\n */\n const dynamicClasses = computed(\n (): VueCSSClasses => ({\n 'x-selected x-related-tag--is-selected': isSelected.value,\n 'x-related-tag--is-curated': shouldHighlightCurated.value,\n }),\n )\n\n return {\n buttonEl,\n dynamicClasses,\n isSelected,\n clickRelatedTag,\n shouldHighlightCurated,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Dynamic classes\n\n`RelatedTag` uses the following dynamic CSS classes so you can style it when is:\n\n- Selected: `x-related-tag--is-selected`.\n- Curated: `x-related-tag--is-curated`.\n\n## Events\n\nThis component emits the following events:\n\n- [`UserDeselectedARelatedTag`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserPickedARelatedTag`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserSelectedARelatedTag`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend service required\nThe QuerySignals microservice must be implemented.\n:::\n<!-- prettier-ignore-end -->\n\nIn this example related tag data is passed as a prop.\n\n_Here you can see how the RelatedTag component is rendered._\n\n```vue live\n<template>\n <RelatedTag :relatedTag=\"tag\" />\n</template>\n\n<script setup>\nimport { RelatedTag } from '@empathyco/x-components/related-tags'\n\nconst tag = {\n modelName: 'RelatedTag',\n query: 'high heel',\n isCurated: false,\n tag: 'heel',\n}\n</script>\n```\n\n### Play with default slot\n\nIn this example, an HTML span element is passed in the `default` slot.\n\n_See how the related tag can be rendered._\n\n```vue live\n<template>\n <RelatedTag :relatedTag=\"tag\" #default=\"{ relatedTag }\">\n <span :aria-label=\"relatedTag.tag\">{{ relatedTag.tag }}</span>\n </RelatedTag>\n</template>\n\n<script setup>\nimport { RelatedTag } from '@empathyco/x-components/related-tags'\n\nconst tag = {\n modelName: 'RelatedTag',\n query: 'high heel',\n isCurated: false,\n tag: 'heel',\n}\n</script>\n```\n\n### Play with events\n\nIn this example, the [`UserSelectedARelatedTag`](./../../api/x-components.relatedtagsxevents.md)\nevent is implemented, as illustrated by the “Tag” message returned.\n\n_See how the event is triggered when the related tag is clicked._\n\n```vue live\n<template>\n <RelatedTag :relatedTag=\"tag\" @UserSelectedARelatedTag=\"alertRelatedTag\" />\n</template>\n\n<script setup>\nimport { RelatedTag } from '@empathyco/x-components/related-tags'\n\nconst tag = {\n modelName: 'RelatedTag',\n query: 'high heel',\n isCurated: false,\n tag: 'heel',\n}\n\nfunction alertRelatedTag(relatedTag) {\n alert(`You have clicked the related tag: ${relatedTag.query}`)\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_createTextVNode","_toDisplayString"],"mappings":";;;;;AACE,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,IAcS,QAAA;AAAA,IAAA;AAAA,MAbP,GAAA,EAAI,UAAA;AAAA,MACJ,KAAA,EAAKC,cAAA,CAAA,CAAC,qBAAA,EAEE,IAAA,CAAA,cAAc,CAAA,CAAA;AAAA,MADtB,WAAA,EAAU,aAAA;AAAA,MAET,SAAK,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAE,IAAA,CAAA,eAAA,IAAA,IAAA,CAAA,eAAA,CAAA,GAAA,IAAA,CAAA;AAAA,KAAA;;AAQR,MAAAC,UAAA,CAA6F,wEAA7E,IAAA,CAAA,UAAA,EAAU,UAAA,EAAE,iBAAU,sBAAA,EAAE,IAAA,CAAA,sBAAA,MAAxC,MAA6F;AAAA,QAAAC,eAAA;AAAxB,UAAAC,eAAA,CAAA,IAAA,CAAA,UAAA,CAAW,GAAG,CAAA;AAAA,UAAA;AAAA;AAAA;AAAA,OAAA;;;;;;;;;;"}
1
+ {"version":3,"file":"related-tag.vue.js","sources":["../../../../../src/x-modules/related-tags/components/related-tag.vue"],"sourcesContent":["<template>\n <button\n ref=\"buttonEl\"\n class=\"x-related-tag xds:tag\"\n data-test=\"related-tag\"\n :class=\"dynamicClasses\"\n @click=\"clickRelatedTag\"\n >\n <!--\n @slot Custom content that replaces the RelatedTag default content.\n @binding {RelatedTag} relatedTag - Related tag data.\n @binding {boolean} isSelected - Related tag status.\n @binding {boolean} shouldHighlightCurated - True if the curated RTs should be displayed.\n -->\n <slot v-bind=\"{ relatedTag, isSelected, shouldHighlightCurated }\">{{ relatedTag.tag }}</slot>\n </button>\n</template>\n\n<script lang=\"ts\">\nimport type { RelatedTag as RelatedTagModel } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../../../utils/types'\nimport type { WireMetadata } from '../../../wiring/wiring.types'\nimport { computed, defineComponent, ref } from 'vue'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { relatedTagsXModule } from '../x-module'\n\n/**\n * This component renders a related tag for a query. A related tag is a descriptive keyword\n * related to the current query to fine-tune the search. For example, if you are searching\n * for *lego*, a related tag could be *city*, refining the search with *lego city*.\n *\n * @public\n */\nexport default defineComponent({\n name: 'RelatedTag',\n xModule: relatedTagsXModule.name,\n props: {\n /**\n * Indicates if the curated related tag should be highlighted.\n *\n * @public\n */\n highlightCurated: {\n type: Boolean,\n default: false,\n },\n /**\n * The related tag model data.\n *\n * @public\n */\n relatedTag: {\n type: Object as PropType<RelatedTagModel>,\n required: true,\n },\n },\n setup(props) {\n const $x = use$x()\n\n const buttonEl = ref<HTMLElement | undefined>()\n\n /**\n * The selected related tags.\n *\n * @internal\n */\n const { selectedRelatedTags } = useState('relatedTags')\n\n /**\n * Check if the related tag is selected or not.\n *\n * @returns If the related tag is selected.\n *\n * @internal\n */\n const isSelected = computed(() => selectedRelatedTags.value.includes(props.relatedTag))\n\n /**\n * Blurs the related tag if it is selected.\n *\n * @public\n */\n const blurRelatedTag = () => {\n if (isSelected.value) {\n buttonEl.value?.blur()\n }\n }\n\n /**\n * Generates the {@link WireMetadata} object omitting the moduleName.\n *\n * @returns The {@link WireMetadata} object omitting the moduleName.\n * @internal\n */\n const createEventMetadata = (): Omit<WireMetadata, 'moduleName'> => ({\n target: buttonEl.value as HTMLElement,\n feature: 'related_tag',\n })\n\n /**\n * Emits events when the button is clicked.\n *\n * @public\n */\n const emitEvents = () => {\n // We have to emit this events first to avoid the UserPickedARelatedTag wires to change the\n // isSelected value before emitting this selection events.\n $x.emit(\n isSelected.value ? 'UserDeselectedARelatedTag' : 'UserSelectedARelatedTag',\n props.relatedTag,\n createEventMetadata(),\n )\n $x.emit('UserPickedARelatedTag', props.relatedTag, createEventMetadata())\n }\n\n /**\n * Handles the click on the button.\n *\n * @public\n */\n const clickRelatedTag = () => {\n emitEvents()\n blurRelatedTag()\n }\n\n /**\n * Check if the related tag is curated and should be highlighted.\n *\n * @returns True if the related tag is curated and should be highlighted.\n *\n * @internal\n */\n const shouldHighlightCurated = computed(\n () => props.highlightCurated && (props.relatedTag.isCurated ?? false),\n )\n\n /**\n * Adds the dynamic css classes to the component.\n *\n * @returns The class to be added to the component.\n *\n * @internal\n */\n const dynamicClasses = computed(\n (): VueCSSClasses => ({\n 'xds:selected x-related-tag--is-selected': isSelected.value,\n 'x-related-tag--is-curated': shouldHighlightCurated.value,\n }),\n )\n\n return {\n buttonEl,\n dynamicClasses,\n isSelected,\n clickRelatedTag,\n shouldHighlightCurated,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Dynamic classes\n\n`RelatedTag` uses the following dynamic CSS classes so you can style it when is:\n\n- Selected: `x-related-tag--is-selected`.\n- Curated: `x-related-tag--is-curated`.\n\n## Events\n\nThis component emits the following events:\n\n- [`UserDeselectedARelatedTag`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserPickedARelatedTag`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserSelectedARelatedTag`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend service required\nThe QuerySignals microservice must be implemented.\n:::\n<!-- prettier-ignore-end -->\n\nIn this example related tag data is passed as a prop.\n\n_Here you can see how the RelatedTag component is rendered._\n\n```vue live\n<template>\n <RelatedTag :relatedTag=\"tag\" />\n</template>\n\n<script setup>\nimport { RelatedTag } from '@empathyco/x-components/related-tags'\n\nconst tag = {\n modelName: 'RelatedTag',\n query: 'high heel',\n isCurated: false,\n tag: 'heel',\n}\n</script>\n```\n\n### Play with default slot\n\nIn this example, an HTML span element is passed in the `default` slot.\n\n_See how the related tag can be rendered._\n\n```vue live\n<template>\n <RelatedTag :relatedTag=\"tag\" #default=\"{ relatedTag }\">\n <span :aria-label=\"relatedTag.tag\">{{ relatedTag.tag }}</span>\n </RelatedTag>\n</template>\n\n<script setup>\nimport { RelatedTag } from '@empathyco/x-components/related-tags'\n\nconst tag = {\n modelName: 'RelatedTag',\n query: 'high heel',\n isCurated: false,\n tag: 'heel',\n}\n</script>\n```\n\n### Play with events\n\nIn this example, the [`UserSelectedARelatedTag`](./../../api/x-components.relatedtagsxevents.md)\nevent is implemented, as illustrated by the “Tag” message returned.\n\n_See how the event is triggered when the related tag is clicked._\n\n```vue live\n<template>\n <RelatedTag :relatedTag=\"tag\" @UserSelectedARelatedTag=\"alertRelatedTag\" />\n</template>\n\n<script setup>\nimport { RelatedTag } from '@empathyco/x-components/related-tags'\n\nconst tag = {\n modelName: 'RelatedTag',\n query: 'high heel',\n isCurated: false,\n tag: 'heel',\n}\n\nfunction alertRelatedTag(relatedTag) {\n alert(`You have clicked the related tag: ${relatedTag.query}`)\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_createTextVNode","_toDisplayString"],"mappings":";;;;;AACE,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,IAcS,QAAA;AAAA,IAAA;AAAA,MAbP,GAAA,EAAI,UAAA;AAAA,MACJ,KAAA,EAAKC,cAAA,CAAA,CAAC,uBAAA,EAEE,IAAA,CAAA,cAAc,CAAA,CAAA;AAAA,MADtB,WAAA,EAAU,aAAA;AAAA,MAET,SAAK,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAE,IAAA,CAAA,eAAA,IAAA,IAAA,CAAA,eAAA,CAAA,GAAA,IAAA,CAAA;AAAA,KAAA;;AAQR,MAAAC,UAAA,CAA6F,wEAA7E,IAAA,CAAA,UAAA,EAAU,UAAA,EAAE,iBAAU,sBAAA,EAAE,IAAA,CAAA,sBAAA,MAAxC,MAA6F;AAAA,QAAAC,eAAA;AAAxB,UAAAC,eAAA,CAAA,IAAA,CAAA,UAAA,CAAW,GAAG,CAAA;AAAA,UAAA;AAAA;AAAA;AAAA,OAAA;;;;;;;;;;"}
@@ -106,7 +106,7 @@ var _sfc_main = defineComponent({
106
106
  * @internal
107
107
  */
108
108
  const dynamicClasses = computed(() => ({
109
- 'x-selected x-related-tag--is-selected': isSelected.value,
109
+ 'xds:selected x-related-tag--is-selected': isSelected.value,
110
110
  'x-related-tag--is-curated': shouldHighlightCurated.value,
111
111
  }));
112
112
  return {