@empathyco/x-components 6.0.0-alpha.5 → 6.0.0-alpha.50

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 (755) hide show
  1. package/CHANGELOG.md +439 -0
  2. package/core/index.js +8 -1
  3. package/core/index.js.map +1 -1
  4. package/design-system/deprecated-full-theme.css +425 -425
  5. package/docs/API-reference/api/x-adapter-platform.md +12 -0
  6. package/docs/API-reference/api/x-adapter-platform.nextqueriesrelatedpromptsschema.md +11 -0
  7. package/docs/API-reference/api/x-adapter-platform.platformadapter.relatedprompts.md +11 -0
  8. package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.md +23 -0
  9. package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.nextqueries.md +11 -0
  10. package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.suggestiontext.md +11 -0
  11. package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.tagging.md +11 -0
  12. package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.type.md +11 -0
  13. package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptnextqueriestagging.md +22 -0
  14. package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptnextqueriestagging.toolingdisplay.md +11 -0
  15. package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptnextqueriestagging.toolingdisplayadd2cart.md +11 -0
  16. package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptnextqueriestagging.toolingdisplayclick.md +11 -0
  17. package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptsrequest.md +15 -0
  18. package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptsresponse.data.md +13 -0
  19. package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptsresponse.md +21 -0
  20. package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptsresponse.status.md +11 -0
  21. package/docs/API-reference/api/x-adapter-platform.platformrelatedprompttagging.md +22 -0
  22. package/docs/API-reference/api/x-adapter-platform.platformrelatedprompttagging.nextqueries.md +11 -0
  23. package/docs/API-reference/api/x-adapter-platform.platformrelatedprompttagging.toolingdisplay.md +11 -0
  24. package/docs/API-reference/api/x-adapter-platform.platformrelatedprompttagging.toolingdisplayclick.md +11 -0
  25. package/docs/API-reference/api/x-adapter-platform.platformsearchresponse.catalog.md +6 -0
  26. package/docs/API-reference/api/x-adapter-platform.platformsearchresponse.md +1 -1
  27. package/docs/API-reference/api/x-adapter-platform.relatedpromptschema.md +13 -0
  28. package/docs/API-reference/api/x-adapter-platform.relatedpromptsendpointadapter.md +13 -0
  29. package/docs/API-reference/api/x-adapter-platform.relatedpromptsrequestmapper.md +13 -0
  30. package/docs/API-reference/api/x-adapter-platform.relatedpromptsrequestschema.md +13 -0
  31. package/docs/API-reference/api/x-adapter-platform.relatedpromptsresponsemapper.md +13 -0
  32. package/docs/API-reference/api/x-adapter-platform.relatedpromptsresponseschema.md +13 -0
  33. package/docs/API-reference/api/x-components.animationprop.md +6 -1
  34. package/docs/API-reference/api/x-components.bannerslist.md +3 -3
  35. package/docs/API-reference/api/x-components.baseaddtocart.md +1 -0
  36. package/docs/API-reference/api/x-components.basedropdown.md +5 -5
  37. package/docs/API-reference/api/x-components.baseeventsmodal.md +2 -2
  38. package/docs/API-reference/api/x-components.basegrid.md +3 -3
  39. package/docs/API-reference/api/x-components.baseheadertogglepanel.md +5 -5
  40. package/docs/API-reference/api/x-components.baseidmodal.md +2 -2
  41. package/docs/API-reference/api/x-components.baseidtogglepanel.md +5 -5
  42. package/docs/API-reference/api/x-components.basemodal.md +10 -10
  43. package/docs/API-reference/api/x-components.baseresultimage.md +9 -9
  44. package/docs/API-reference/api/x-components.baseslider.md +70 -0
  45. package/docs/API-reference/api/x-components.basesuggestions.md +3 -3
  46. package/docs/API-reference/api/x-components.basetabspanel.md +8 -8
  47. package/docs/API-reference/api/x-components.basetogglepanel.md +3 -3
  48. package/docs/API-reference/api/x-components.basevariablecolumngrid.md +3 -3
  49. package/docs/API-reference/api/x-components.cancelfetchandsaverelatedprompts.md +13 -0
  50. package/docs/API-reference/api/x-components.configmutations.config.md +11 -0
  51. package/docs/API-reference/api/x-components.configmutations.md +29 -0
  52. package/docs/API-reference/api/x-components.configmutations.mergeconfig.md +24 -0
  53. package/docs/API-reference/api/x-components.configmutations.setconfig.md +24 -0
  54. package/docs/API-reference/api/x-components.createrelatedtagsquerygetter.md +26 -0
  55. package/docs/API-reference/api/x-components.createrelatedtagsquerygetteroptions.getrelatedtags.md +13 -0
  56. package/docs/API-reference/api/x-components.createrelatedtagsquerygetteroptions.md +20 -0
  57. package/docs/API-reference/api/x-components.createtrackrelatedprompttoolingdisplayclickwire.md +19 -0
  58. package/docs/API-reference/api/x-components.createtracktoolingadd2cartwire.md +19 -0
  59. package/docs/API-reference/api/x-components.createtracktoolingdisplaywire.md +19 -0
  60. package/docs/API-reference/api/{x-components.defaultpdpaddtocartservice._constructor_.md → x-components.defaultexternaltaggingservice._constructor_.md} +3 -3
  61. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.add_to_cart_id_key.md +13 -0
  62. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.instance.md +13 -0
  63. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.localstorageservice.md +11 -0
  64. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.md +43 -0
  65. package/docs/API-reference/api/{x-components.defaultpdpaddtocartservice.movetosessionstorage.md → x-components.defaultexternaltaggingservice.movetosessionstorage.md} +2 -2
  66. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.result_clicked_id_key.md +13 -0
  67. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.sessionstorageservice.md +11 -0
  68. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.storagekey.md +11 -0
  69. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.storagettlms.md +11 -0
  70. package/docs/API-reference/api/{x-components.defaultpdpaddtocartservice.store.md → x-components.defaultexternaltaggingservice.store.md} +2 -2
  71. package/docs/API-reference/api/x-components.defaultexternaltaggingservice.storeaddtocart.md +24 -0
  72. package/docs/API-reference/api/{x-components.defaultpdpaddtocartservice.storeresultclicked.md → x-components.defaultexternaltaggingservice.storeresultclicked.md} +3 -3
  73. package/docs/API-reference/api/{x-components.defaultpdpaddtocartservice.trackaddtocart.md → x-components.defaultexternaltaggingservice.trackaddtocart.md} +3 -3
  74. package/docs/API-reference/api/x-components.displayclickprovider.md +66 -0
  75. package/docs/API-reference/api/x-components.empathize.md +6 -6
  76. package/docs/API-reference/api/x-components.empathizemutations.md +1 -1
  77. package/docs/API-reference/api/x-components.externaltaggingservice.md +23 -0
  78. package/docs/API-reference/api/{x-components.pdpaddtocartservice.movetosessionstorage.md → x-components.externaltaggingservice.movetosessionstorage.md} +2 -2
  79. package/docs/API-reference/api/x-components.externaltaggingservice.storeaddtocart.md +24 -0
  80. package/docs/API-reference/api/{x-components.pdpaddtocartservice.storeresultclicked.md → x-components.externaltaggingservice.storeresultclicked.md} +3 -3
  81. package/docs/API-reference/api/{x-components.pdpaddtocartservice.trackaddtocart.md → x-components.externaltaggingservice.trackaddtocart.md} +3 -3
  82. package/docs/API-reference/api/x-components.facets.md +3 -3
  83. package/docs/API-reference/api/x-components.facetsmutations.md +1 -1
  84. package/docs/API-reference/api/x-components.featurelocation.md +1 -1
  85. package/docs/API-reference/api/x-components.fetchandsaverelatedprompts.md +13 -0
  86. package/docs/API-reference/api/x-components.fetchrelatedprompts.md +13 -0
  87. package/docs/API-reference/api/x-components.filterslist.md +3 -3
  88. package/docs/API-reference/api/x-components.globalxbus.md +12 -0
  89. package/docs/API-reference/api/x-components.hierarchicalfilter.md +8 -2
  90. package/docs/API-reference/api/x-components.historyqueriesmutations.md +1 -1
  91. package/docs/API-reference/api/x-components.historyqueriesstate.md +1 -1
  92. package/docs/API-reference/api/x-components.identifierresults.md +3 -3
  93. package/docs/API-reference/api/x-components.identifierresultsmutations.md +1 -1
  94. package/docs/API-reference/api/x-components.identifierresultsstate.md +1 -1
  95. package/docs/API-reference/api/x-components.installxoptions.domelement.md +1 -1
  96. package/docs/API-reference/api/x-components.installxoptions.installextraplugins.md +2 -2
  97. package/docs/API-reference/api/x-components.installxoptions.md +1 -1
  98. package/docs/API-reference/api/x-components.itemslist.md +3 -3
  99. package/docs/API-reference/api/x-components.mainmodal.md +2 -2
  100. package/docs/API-reference/api/x-components.md +38 -3
  101. package/docs/API-reference/api/x-components.mergeconfig.md +27 -0
  102. package/docs/API-reference/api/x-components.multicolumnmaxwidthlayout.md +5 -5
  103. package/docs/API-reference/api/x-components.myhistory.md +3 -3
  104. package/docs/API-reference/api/x-components.nextqueriesgroup.md +22 -0
  105. package/docs/API-reference/api/x-components.nextqueriesgroup.modelname.md +11 -0
  106. package/docs/API-reference/api/x-components.nextqueriesgroup.nextqueries.md +11 -0
  107. package/docs/API-reference/api/x-components.nextquerieslist.md +3 -3
  108. package/docs/API-reference/api/x-components.nextqueriesmutations.md +1 -1
  109. package/docs/API-reference/api/x-components.nextqueriesstate.md +1 -1
  110. package/docs/API-reference/api/x-components.pageselector.md +80 -0
  111. package/docs/API-reference/api/x-components.partialresultslist.md +3 -3
  112. package/docs/API-reference/api/x-components.popularsearchesmutations.md +1 -1
  113. package/docs/API-reference/api/x-components.promotedslist.md +3 -3
  114. package/docs/API-reference/api/x-components.queriespreviewmutations.md +1 -1
  115. package/docs/API-reference/api/x-components.queryfeature.md +1 -1
  116. package/docs/API-reference/api/x-components.querymutations.md +20 -0
  117. package/docs/API-reference/api/x-components.querymutations.setquery.md +24 -0
  118. package/docs/API-reference/api/x-components.querypreviewlist.md +3 -3
  119. package/docs/API-reference/api/x-components.querystate.md +20 -0
  120. package/docs/API-reference/api/x-components.querystate.query.md +13 -0
  121. package/docs/API-reference/api/x-components.querysuggestionsmutations.md +1 -1
  122. package/docs/API-reference/api/x-components.querysuggestionsstate.md +1 -1
  123. package/docs/API-reference/api/x-components.recommendations.md +3 -3
  124. package/docs/API-reference/api/x-components.recommendationsmutations.md +1 -1
  125. package/docs/API-reference/api/x-components.relatedprompt.md +33 -0
  126. package/docs/API-reference/api/x-components.relatedpromptrequest.md +13 -0
  127. package/docs/API-reference/api/x-components.relatedpromptsactioncontext.md +15 -0
  128. package/docs/API-reference/api/x-components.relatedpromptsactions.cancelfetchandsaverelatedprompts.md +17 -0
  129. package/docs/API-reference/api/x-components.relatedpromptsactions.fetchandsaverelatedprompts.md +24 -0
  130. package/docs/API-reference/api/x-components.relatedpromptsactions.fetchrelatedprompts.md +24 -0
  131. package/docs/API-reference/api/x-components.relatedpromptsactions.md +22 -0
  132. package/docs/API-reference/api/x-components.relatedpromptsgetters.md +20 -0
  133. package/docs/API-reference/api/x-components.relatedpromptsgetters.request.md +13 -0
  134. package/docs/API-reference/api/x-components.relatedpromptslist.md +72 -0
  135. package/docs/API-reference/api/x-components.relatedpromptsmutations.md +26 -0
  136. package/docs/API-reference/api/x-components.relatedpromptsmutations.resetrelatedpromptsstate.md +17 -0
  137. package/docs/API-reference/api/x-components.relatedpromptsmutations.resetselectedprompt.md +17 -0
  138. package/docs/API-reference/api/x-components.relatedpromptsmutations.setparams.md +24 -0
  139. package/docs/API-reference/api/x-components.relatedpromptsmutations.setrelatedpromptsproducts.md +24 -0
  140. package/docs/API-reference/api/x-components.relatedpromptsmutations.setselectedprompt.md +24 -0
  141. package/docs/API-reference/api/x-components.relatedpromptsmutations.setselectedquery.md +24 -0
  142. package/docs/API-reference/api/x-components.relatedpromptsstate.md +24 -0
  143. package/docs/API-reference/api/x-components.relatedpromptsstate.params.md +13 -0
  144. package/docs/API-reference/api/x-components.relatedpromptsstate.relatedprompts.md +13 -0
  145. package/docs/API-reference/api/x-components.relatedpromptsstate.selectedprompt.md +13 -0
  146. package/docs/API-reference/api/x-components.relatedpromptsstate.selectedquery.md +13 -0
  147. package/docs/API-reference/api/x-components.relatedpromptstaglist.md +73 -0
  148. package/docs/API-reference/api/x-components.relatedpromptsxevents.md +24 -0
  149. package/docs/API-reference/api/x-components.relatedpromptsxevents.relatedpromptsrequestupdated.md +13 -0
  150. package/docs/API-reference/api/x-components.relatedpromptsxevents.userclickedarelatedpromptadd2cart.md +13 -0
  151. package/docs/API-reference/api/x-components.relatedpromptsxevents.userclickedarelatedpromptresult.md +13 -0
  152. package/docs/API-reference/api/x-components.relatedpromptsxevents.userselectedarelatedprompt.md +13 -0
  153. package/docs/API-reference/api/x-components.relatedpromptsxevents.userselectedarelatedpromptquery.md +13 -0
  154. package/docs/API-reference/api/x-components.relatedpromptsxmodule.md +13 -0
  155. package/docs/API-reference/api/x-components.relatedpromptsxstoremodule.md +15 -0
  156. package/docs/API-reference/api/x-components.relatedtags.md +3 -3
  157. package/docs/API-reference/api/x-components.relatedtagsmutations.md +1 -1
  158. package/docs/API-reference/api/x-components.relatedtagsstate.md +1 -1
  159. package/docs/API-reference/api/x-components.resultslist.md +3 -3
  160. package/docs/API-reference/api/x-components.scrolltotop.md +5 -5
  161. package/docs/API-reference/api/x-components.searchboxmutations.md +1 -1
  162. package/docs/API-reference/api/x-components.searchboxstate.md +1 -1
  163. package/docs/API-reference/api/x-components.searchconfig.md +1 -0
  164. package/docs/API-reference/api/x-components.searchconfig.pagemode.md +11 -0
  165. package/docs/API-reference/api/x-components.searchinputplaceholder.md +3 -3
  166. package/docs/API-reference/api/x-components.searchmutations.md +2 -1
  167. package/docs/API-reference/api/x-components.searchmutations.setstats.md +24 -0
  168. package/docs/API-reference/api/x-components.searchstate.md +2 -1
  169. package/docs/API-reference/api/x-components.searchstate.stats.md +13 -0
  170. package/docs/API-reference/api/x-components.searchxevents.md +1 -0
  171. package/docs/API-reference/api/x-components.searchxevents.userselectedapage.md +13 -0
  172. package/docs/API-reference/api/x-components.selectedfilterslist.md +3 -3
  173. package/docs/API-reference/api/x-components.semanticqueriesmutations.md +1 -1
  174. package/docs/API-reference/api/x-components.semanticqueriesstate.md +1 -1
  175. package/docs/API-reference/api/x-components.setconfig.md +27 -0
  176. package/docs/API-reference/api/x-components.setquery.md +25 -0
  177. package/docs/API-reference/api/x-components.simplefilter.md +6 -0
  178. package/docs/API-reference/api/x-components.singlecolumnlayout.md +3 -3
  179. package/docs/API-reference/api/x-components.snippetcallbacks.md +6 -0
  180. package/docs/API-reference/api/x-components.sortdropdown.md +1 -1
  181. package/docs/API-reference/api/x-components.tagging.md +6 -6
  182. package/docs/API-reference/api/x-components.taggingconfig.md +2 -2
  183. package/docs/API-reference/api/{x-components.taggingconfig.clickedresultstoragekey.md → x-components.taggingconfig.storagekey.md} +3 -3
  184. package/docs/API-reference/api/x-components.taggingconfig.storagettlms.md +13 -0
  185. package/docs/API-reference/api/x-components.taggingmutations.md +1 -1
  186. package/docs/API-reference/api/x-components.taggingxevents.md +1 -1
  187. package/docs/API-reference/api/x-components.taggingxevents.resulturltrackingenabled.md +1 -1
  188. package/docs/API-reference/api/x-components.trackrelatedprompttoolingdisplayclickwire.md +13 -0
  189. package/docs/API-reference/api/x-components.tracktoolingadd2cartwire.md +13 -0
  190. package/docs/API-reference/api/x-components.tracktoolingdisplayclickedwire.md +13 -0
  191. package/docs/API-reference/api/x-components.typing.md +13 -0
  192. package/docs/API-reference/api/x-components.typingoptions.md +22 -0
  193. package/docs/API-reference/api/x-components.typingoptions.speed.md +13 -0
  194. package/docs/API-reference/api/x-components.typingoptions.targetattr.md +18 -0
  195. package/docs/API-reference/api/x-components.typingoptions.text.md +13 -0
  196. package/docs/API-reference/api/x-components.urlmutations.md +1 -1
  197. package/docs/API-reference/api/x-components.urlstate.md +1 -1
  198. package/docs/API-reference/api/x-components.usealiasapi.md +1 -0
  199. package/docs/API-reference/api/x-components.usealiasapi.pricestats.md +16 -0
  200. package/docs/API-reference/api/x-components.xeventstypes.md +3 -3
  201. package/docs/API-reference/api/x-components.xmodulestree.md +1 -0
  202. package/docs/API-reference/api/x-components.xmodulestree.relatedprompts.md +11 -0
  203. package/docs/API-reference/api/x-types.md +5 -0
  204. package/docs/API-reference/api/x-types.relatedprompt.md +26 -0
  205. package/docs/API-reference/api/x-types.relatedprompt.nextqueries.md +13 -0
  206. package/docs/API-reference/api/x-types.relatedprompt.relatedpromptnextqueries.md +13 -0
  207. package/docs/API-reference/api/x-types.relatedprompt.suggestiontext.md +13 -0
  208. package/docs/API-reference/api/x-types.relatedprompt.tagging.md +17 -0
  209. package/docs/API-reference/api/x-types.relatedprompt.toolingdisplaytagging.md +13 -0
  210. package/docs/API-reference/api/x-types.relatedprompt.type.md +13 -0
  211. package/docs/API-reference/api/x-types.relatedpromptnextquery.md +23 -0
  212. package/docs/API-reference/api/x-types.relatedpromptnextquery.query.md +13 -0
  213. package/docs/API-reference/api/x-types.relatedpromptnextquery.toolingdisplayadd2carttagging.md +13 -0
  214. package/docs/API-reference/api/x-types.relatedpromptnextquery.toolingdisplayclicktagging.md +13 -0
  215. package/docs/API-reference/api/x-types.relatedpromptnextquery.toolingdisplaytagging.md +13 -0
  216. package/docs/API-reference/api/x-types.relatedpromptsrequest.md +15 -0
  217. package/docs/API-reference/api/x-types.relatedpromptsresponse.md +20 -0
  218. package/docs/API-reference/api/x-types.relatedpromptsresponse.relatedprompts.md +11 -0
  219. package/docs/API-reference/api/x-types.searchresponse.md +1 -0
  220. package/docs/API-reference/api/x-types.searchresponse.stats.md +11 -0
  221. package/docs/API-reference/api/x-types.stats.md +22 -0
  222. package/docs/API-reference/api/x-types.stats.price.md +14 -0
  223. package/docs/API-reference/api/x-types.xcomponentsadapter.md +1 -0
  224. package/docs/API-reference/api/x-types.xcomponentsadapter.relatedprompts.md +11 -0
  225. package/docs/API-reference/components/common/result/x-components.base-result-image.md +2 -2
  226. package/docs/API-reference/components/common/x-components.base-slider.md +189 -0
  227. package/docs/API-reference/components/common/x-components.display-click-provider.md +17 -0
  228. package/docs/API-reference/components/common/x-components.items-list.md +1 -1
  229. package/docs/API-reference/components/common/x-components.page-selector.md +136 -0
  230. package/docs/API-reference/components/facets/x-components.facets/facets.md +1 -1
  231. package/docs/API-reference/components/facets/x-components.lists/selected-filters-list.md +1 -1
  232. package/docs/API-reference/components/related-prompts/x-components.related-prompt.md +22 -0
  233. package/docs/API-reference/components/related-prompts/x-components.related-prompts-list.md +196 -0
  234. package/docs/API-reference/components/related-prompts/x-components.related-prompts-tag-list.md +32 -0
  235. package/docs/API-reference/components/search/x-components.results-list.md +1 -1
  236. package/docs/API-reference/components/tagging/x-components.tagging.md +15 -16
  237. package/js/components/animations/fade-and-slide.vue.js +1 -2
  238. package/js/components/animations/fade-and-slide.vue.js.map +1 -1
  239. package/js/components/base-dropdown.vue.js +1 -3
  240. package/js/components/base-dropdown.vue.js.map +1 -1
  241. package/js/components/base-dropdown.vue2.js +1 -7
  242. package/js/components/base-dropdown.vue2.js.map +1 -1
  243. package/js/components/base-event-button.vue.js +1 -2
  244. package/js/components/base-event-button.vue.js.map +1 -1
  245. package/js/components/base-grid.vue.js +11 -18
  246. package/js/components/base-grid.vue.js.map +1 -1
  247. package/js/components/base-grid.vue2.js.map +1 -1
  248. package/js/components/base-grid.vue3.js +1 -1
  249. package/js/components/base-keyboard-navigation.vue.js +1 -2
  250. package/js/components/base-keyboard-navigation.vue.js.map +1 -1
  251. package/js/components/base-rating.vue.js +1 -3
  252. package/js/components/base-rating.vue.js.map +1 -1
  253. package/js/components/base-slider.vue.js +65 -0
  254. package/js/components/base-slider.vue.js.map +1 -0
  255. package/js/components/base-slider.vue2.js +109 -0
  256. package/js/components/base-slider.vue2.js.map +1 -0
  257. package/js/components/base-slider.vue3.js +7 -0
  258. package/js/components/base-slider.vue3.js.map +1 -0
  259. package/js/components/base-variable-column-grid.vue.js +1 -2
  260. package/js/components/base-variable-column-grid.vue.js.map +1 -1
  261. package/js/components/column-picker/base-column-picker-dropdown.vue.js +1 -3
  262. package/js/components/column-picker/base-column-picker-dropdown.vue.js.map +1 -1
  263. package/js/components/column-picker/base-column-picker-list.vue.js +1 -3
  264. package/js/components/column-picker/base-column-picker-list.vue.js.map +1 -1
  265. package/js/components/display-click-provider.vue.js +74 -0
  266. package/js/components/display-click-provider.vue.js.map +1 -0
  267. package/js/components/display-click-provider.vue2.js +6 -0
  268. package/js/components/display-click-provider.vue2.js.map +1 -0
  269. package/js/components/filters/labels/base-rating-filter-label.vue.js +1 -3
  270. package/js/components/filters/labels/base-rating-filter-label.vue.js.map +1 -1
  271. package/js/components/icons/cross-tiny.vue.js +2 -2
  272. package/js/components/icons/plus.vue.js +2 -2
  273. package/js/components/items-list.vue.js +1 -2
  274. package/js/components/items-list.vue.js.map +1 -1
  275. package/js/components/items-list.vue2.js +2 -2
  276. package/js/components/items-list.vue2.js.map +1 -1
  277. package/js/components/layouts/fixed-header-and-asides-layout.vue.js +1 -7
  278. package/js/components/layouts/fixed-header-and-asides-layout.vue.js.map +1 -1
  279. package/js/components/layouts/multi-column-max-width-layout.vue.js +1 -9
  280. package/js/components/layouts/multi-column-max-width-layout.vue.js.map +1 -1
  281. package/js/components/layouts/single-column-layout.vue.js +1 -9
  282. package/js/components/layouts/single-column-layout.vue.js.map +1 -1
  283. package/js/components/modals/base-events-modal-close.vue.js +1 -2
  284. package/js/components/modals/base-events-modal-close.vue.js.map +1 -1
  285. package/js/components/modals/base-events-modal-open.vue.js +1 -2
  286. package/js/components/modals/base-events-modal-open.vue.js.map +1 -1
  287. package/js/components/modals/base-id-modal-close.vue.js +1 -2
  288. package/js/components/modals/base-id-modal-close.vue.js.map +1 -1
  289. package/js/components/modals/base-id-modal-open.vue.js +1 -2
  290. package/js/components/modals/base-id-modal-open.vue.js.map +1 -1
  291. package/js/components/modals/base-modal.vue.js +1 -2
  292. package/js/components/modals/base-modal.vue.js.map +1 -1
  293. package/js/components/modals/base-modal.vue2.js +13 -6
  294. package/js/components/modals/base-modal.vue2.js.map +1 -1
  295. package/js/components/page-loader-button.vue.js +8 -10
  296. package/js/components/page-loader-button.vue.js.map +1 -1
  297. package/js/components/page-loader-button.vue2.js.map +1 -1
  298. package/js/components/page-loader-button.vue3.js +7 -0
  299. package/js/components/page-loader-button.vue3.js.map +1 -0
  300. package/js/components/page-selector.vue.js +78 -0
  301. package/js/components/page-selector.vue.js.map +1 -0
  302. package/js/components/page-selector.vue2.js +128 -0
  303. package/js/components/page-selector.vue2.js.map +1 -0
  304. package/js/components/page-selector.vue3.js +7 -0
  305. package/js/components/page-selector.vue3.js.map +1 -0
  306. package/js/components/panels/base-header-toggle-panel.vue.js +1 -5
  307. package/js/components/panels/base-header-toggle-panel.vue.js.map +1 -1
  308. package/js/components/panels/base-id-toggle-panel-button.vue.js +1 -2
  309. package/js/components/panels/base-id-toggle-panel-button.vue.js.map +1 -1
  310. package/js/components/panels/base-id-toggle-panel.vue.js +1 -2
  311. package/js/components/panels/base-id-toggle-panel.vue.js.map +1 -1
  312. package/js/components/panels/base-tabs-panel.vue.js +1 -4
  313. package/js/components/panels/base-tabs-panel.vue.js.map +1 -1
  314. package/js/components/panels/base-toggle-panel.vue.js +1 -2
  315. package/js/components/panels/base-toggle-panel.vue.js.map +1 -1
  316. package/js/components/result/base-result-add-to-cart.vue.js +3 -3
  317. package/js/components/result/base-result-add-to-cart.vue.js.map +1 -1
  318. package/js/components/result/base-result-add-to-cart.vue2.js +19 -5
  319. package/js/components/result/base-result-add-to-cart.vue2.js.map +1 -1
  320. package/js/components/result/base-result-current-price.vue.js +1 -2
  321. package/js/components/result/base-result-current-price.vue.js.map +1 -1
  322. package/js/components/result/base-result-image.vue.js +39 -59
  323. package/js/components/result/base-result-image.vue.js.map +1 -1
  324. package/js/components/result/base-result-image.vue2.js +5 -5
  325. package/js/components/result/base-result-image.vue2.js.map +1 -1
  326. package/js/components/result/base-result-link.vue.js +1 -2
  327. package/js/components/result/base-result-link.vue.js.map +1 -1
  328. package/js/components/result/base-result-previous-price.vue.js +1 -2
  329. package/js/components/result/base-result-previous-price.vue.js.map +1 -1
  330. package/js/components/result/base-result-rating.vue.js +1 -4
  331. package/js/components/result/base-result-rating.vue.js.map +1 -1
  332. package/js/components/result/result-variant-selector.vue.js +1 -3
  333. package/js/components/result/result-variant-selector.vue.js.map +1 -1
  334. package/js/components/sliding-panel.vue.js +3 -6
  335. package/js/components/sliding-panel.vue.js.map +1 -1
  336. package/js/components/suggestions/base-suggestion.vue.js +1 -2
  337. package/js/components/suggestions/base-suggestion.vue.js.map +1 -1
  338. package/js/components/suggestions/base-suggestions.vue.js +1 -2
  339. package/js/components/suggestions/base-suggestions.vue.js.map +1 -1
  340. package/js/composables/use-alias-api.js +4 -1
  341. package/js/composables/use-alias-api.js.map +1 -1
  342. package/js/composables/use-getter.js +1 -1
  343. package/js/composables/use-state.js +1 -1
  344. package/js/directives/typing.js +58 -0
  345. package/js/directives/typing.js.map +1 -0
  346. package/js/index.js +20 -3
  347. package/js/index.js.map +1 -1
  348. package/js/types/animation-prop.js +5 -0
  349. package/js/types/animation-prop.js.map +1 -1
  350. package/js/x-installer/x-installer/x-installer.js +3 -3
  351. package/js/x-installer/x-installer/x-installer.js.map +1 -1
  352. package/js/x-modules/device/store/emitters.js +1 -0
  353. package/js/x-modules/device/store/emitters.js.map +1 -1
  354. package/js/x-modules/empathize/components/empathize.vue.js +1 -2
  355. package/js/x-modules/empathize/components/empathize.vue.js.map +1 -1
  356. package/js/x-modules/empathize/components/empathize.vue2.js +8 -3
  357. package/js/x-modules/empathize/components/empathize.vue2.js.map +1 -1
  358. package/js/x-modules/empathize/store/emitters.js +1 -0
  359. package/js/x-modules/empathize/store/emitters.js.map +1 -1
  360. package/js/x-modules/experience-controls/store/emitters.js +1 -0
  361. package/js/x-modules/experience-controls/store/emitters.js.map +1 -1
  362. package/js/x-modules/extra-params/components/extra-params.vue.js +1 -1
  363. package/js/x-modules/extra-params/components/extra-params.vue.js.map +1 -1
  364. package/js/x-modules/extra-params/store/emitters.js +1 -0
  365. package/js/x-modules/extra-params/store/emitters.js.map +1 -1
  366. package/js/x-modules/facets/components/facets/facets.vue.js +20 -33
  367. package/js/x-modules/facets/components/facets/facets.vue.js.map +1 -1
  368. package/js/x-modules/facets/components/facets/facets.vue2.js +2 -2
  369. package/js/x-modules/facets/components/facets/facets.vue2.js.map +1 -1
  370. package/js/x-modules/facets/components/filters/all-filter.vue.js +1 -2
  371. package/js/x-modules/facets/components/filters/all-filter.vue.js.map +1 -1
  372. package/js/x-modules/facets/components/filters/editable-number-range-filter.vue.js +1 -6
  373. package/js/x-modules/facets/components/filters/editable-number-range-filter.vue.js.map +1 -1
  374. package/js/x-modules/facets/components/filters/hierarchical-filter.vue.js +1 -3
  375. package/js/x-modules/facets/components/filters/hierarchical-filter.vue.js.map +1 -1
  376. package/js/x-modules/facets/components/filters/number-range-filter.vue.js +1 -3
  377. package/js/x-modules/facets/components/filters/number-range-filter.vue.js.map +1 -1
  378. package/js/x-modules/facets/components/filters/simple-filter.vue.js +1 -3
  379. package/js/x-modules/facets/components/filters/simple-filter.vue.js.map +1 -1
  380. package/js/x-modules/facets/components/lists/filters-list.vue.js +1 -2
  381. package/js/x-modules/facets/components/lists/filters-list.vue.js.map +1 -1
  382. package/js/x-modules/facets/components/lists/filters-search.vue.js +1 -3
  383. package/js/x-modules/facets/components/lists/filters-search.vue.js.map +1 -1
  384. package/js/x-modules/facets/components/lists/selected-filters-list.vue.js +11 -18
  385. package/js/x-modules/facets/components/lists/selected-filters-list.vue.js.map +1 -1
  386. package/js/x-modules/facets/components/lists/selected-filters-list.vue2.js +2 -2
  387. package/js/x-modules/facets/components/lists/selected-filters-list.vue2.js.map +1 -1
  388. package/js/x-modules/facets/components/lists/sliced-filters.vue.js +1 -4
  389. package/js/x-modules/facets/components/lists/sliced-filters.vue.js.map +1 -1
  390. package/js/x-modules/history-queries/components/clear-history-queries.vue.js +1 -2
  391. package/js/x-modules/history-queries/components/clear-history-queries.vue.js.map +1 -1
  392. package/js/x-modules/history-queries/components/history-queries.vue.js +1 -10
  393. package/js/x-modules/history-queries/components/history-queries.vue.js.map +1 -1
  394. package/js/x-modules/history-queries/components/history-query.vue.js +1 -6
  395. package/js/x-modules/history-queries/components/history-query.vue.js.map +1 -1
  396. package/js/x-modules/history-queries/components/my-history.vue.js +1 -4
  397. package/js/x-modules/history-queries/components/my-history.vue.js.map +1 -1
  398. package/js/x-modules/history-queries/components/remove-history-query.vue.js +1 -2
  399. package/js/x-modules/history-queries/components/remove-history-query.vue.js.map +1 -1
  400. package/js/x-modules/history-queries/store/emitters.js +1 -0
  401. package/js/x-modules/history-queries/store/emitters.js.map +1 -1
  402. package/js/x-modules/identifier-results/components/identifier-results.vue.js +1 -2
  403. package/js/x-modules/identifier-results/components/identifier-results.vue.js.map +1 -1
  404. package/js/x-modules/identifier-results/store/emitters.js +1 -0
  405. package/js/x-modules/identifier-results/store/emitters.js.map +1 -1
  406. package/js/x-modules/next-queries/components/next-queries.vue.js +1 -7
  407. package/js/x-modules/next-queries/components/next-queries.vue.js.map +1 -1
  408. package/js/x-modules/next-queries/components/next-query-preview.vue.js +1 -3
  409. package/js/x-modules/next-queries/components/next-query-preview.vue.js.map +1 -1
  410. package/js/x-modules/next-queries/components/next-query.vue.js +1 -4
  411. package/js/x-modules/next-queries/components/next-query.vue.js.map +1 -1
  412. package/js/x-modules/next-queries/store/emitters.js +1 -0
  413. package/js/x-modules/next-queries/store/emitters.js.map +1 -1
  414. package/js/x-modules/popular-searches/components/popular-search.vue.js +1 -4
  415. package/js/x-modules/popular-searches/components/popular-search.vue.js.map +1 -1
  416. package/js/x-modules/popular-searches/components/popular-searches.vue.js +1 -7
  417. package/js/x-modules/popular-searches/components/popular-searches.vue.js.map +1 -1
  418. package/js/x-modules/queries-preview/components/query-preview-button.vue.js +1 -2
  419. package/js/x-modules/queries-preview/components/query-preview-button.vue.js.map +1 -1
  420. package/js/x-modules/queries-preview/components/query-preview-button.vue2.js +6 -0
  421. package/js/x-modules/queries-preview/components/query-preview-button.vue2.js.map +1 -1
  422. package/js/x-modules/queries-preview/components/query-preview-list.vue.js.map +1 -1
  423. package/js/x-modules/queries-preview/components/query-preview-list.vue2.js +15 -2
  424. package/js/x-modules/queries-preview/components/query-preview-list.vue2.js.map +1 -1
  425. package/js/x-modules/queries-preview/components/query-preview.vue.js +1 -2
  426. package/js/x-modules/queries-preview/components/query-preview.vue.js.map +1 -1
  427. package/js/x-modules/queries-preview/components/query-preview.vue2.js +7 -1
  428. package/js/x-modules/queries-preview/components/query-preview.vue2.js.map +1 -1
  429. package/js/x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.js +2 -1
  430. package/js/x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.js.map +1 -1
  431. package/js/x-modules/queries-preview/store/emitters.js +1 -0
  432. package/js/x-modules/queries-preview/store/emitters.js.map +1 -1
  433. package/js/x-modules/queries-preview/store/module.js +1 -1
  434. package/js/x-modules/queries-preview/store/module.js.map +1 -1
  435. package/js/x-modules/queries-preview/utils/get-hash-from-query-preview.js +6 -4
  436. package/js/x-modules/queries-preview/utils/get-hash-from-query-preview.js.map +1 -1
  437. package/js/x-modules/query-suggestions/components/query-suggestion.vue.js +1 -4
  438. package/js/x-modules/query-suggestions/components/query-suggestion.vue.js.map +1 -1
  439. package/js/x-modules/query-suggestions/components/query-suggestions.vue.js +1 -7
  440. package/js/x-modules/query-suggestions/components/query-suggestions.vue.js.map +1 -1
  441. package/js/x-modules/query-suggestions/store/emitters.js +1 -0
  442. package/js/x-modules/query-suggestions/store/emitters.js.map +1 -1
  443. package/js/x-modules/recommendations/components/recommendations.vue.js +1 -2
  444. package/js/x-modules/recommendations/components/recommendations.vue.js.map +1 -1
  445. package/js/x-modules/recommendations/store/emitters.js +1 -0
  446. package/js/x-modules/recommendations/store/emitters.js.map +1 -1
  447. package/js/x-modules/related-prompts/components/related-prompt.vue.js +26 -0
  448. package/js/x-modules/related-prompts/components/related-prompt.vue.js.map +1 -0
  449. package/js/x-modules/related-prompts/components/related-prompt.vue2.js +31 -0
  450. package/js/x-modules/related-prompts/components/related-prompt.vue2.js.map +1 -0
  451. package/js/x-modules/related-prompts/components/related-prompt.vue3.js +7 -0
  452. package/js/x-modules/related-prompts/components/related-prompt.vue3.js.map +1 -0
  453. package/js/x-modules/related-prompts/components/related-prompts-list.vue.js +154 -0
  454. package/js/x-modules/related-prompts/components/related-prompts-list.vue.js.map +1 -0
  455. package/js/x-modules/related-prompts/components/related-prompts-list.vue2.js +6 -0
  456. package/js/x-modules/related-prompts/components/related-prompts-list.vue2.js.map +1 -0
  457. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue.js +95 -0
  458. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue.js.map +1 -0
  459. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js +224 -0
  460. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js.map +1 -0
  461. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue3.js +7 -0
  462. package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue3.js.map +1 -0
  463. package/js/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.js +29 -0
  464. package/js/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.js.map +1 -0
  465. package/js/x-modules/related-prompts/store/actions/fetch-related-prompts.action.js +20 -0
  466. package/js/x-modules/related-prompts/store/actions/fetch-related-prompts.action.js.map +1 -0
  467. package/js/x-modules/related-prompts/store/emitters.js +15 -0
  468. package/js/x-modules/related-prompts/store/emitters.js.map +1 -0
  469. package/js/x-modules/related-prompts/store/getters/request.getter.js +16 -0
  470. package/js/x-modules/related-prompts/store/getters/request.getter.js.map +1 -0
  471. package/js/x-modules/related-prompts/store/module.js +61 -0
  472. package/js/x-modules/related-prompts/store/module.js.map +1 -0
  473. package/js/x-modules/related-prompts/wiring.js +99 -0
  474. package/js/x-modules/related-prompts/wiring.js.map +1 -0
  475. package/js/x-modules/related-prompts/x-module.js +21 -0
  476. package/js/x-modules/related-prompts/x-module.js.map +1 -0
  477. package/js/x-modules/related-tags/components/related-tag.vue.js +1 -2
  478. package/js/x-modules/related-tags/components/related-tag.vue.js.map +1 -1
  479. package/js/x-modules/related-tags/components/related-tags.vue.js +1 -4
  480. package/js/x-modules/related-tags/components/related-tags.vue.js.map +1 -1
  481. package/js/x-modules/related-tags/store/emitters.js +1 -0
  482. package/js/x-modules/related-tags/store/emitters.js.map +1 -1
  483. package/js/x-modules/scroll/components/scroll-to-top.vue.js +1 -2
  484. package/js/x-modules/scroll/components/scroll-to-top.vue.js.map +1 -1
  485. package/js/x-modules/scroll/components/scroll-to-top.vue2.js +6 -0
  486. package/js/x-modules/scroll/components/scroll-to-top.vue2.js.map +1 -1
  487. package/js/x-modules/scroll/store/emitters.js +1 -0
  488. package/js/x-modules/scroll/store/emitters.js.map +1 -1
  489. package/js/x-modules/search/components/partial-results-list.vue.js +1 -2
  490. package/js/x-modules/search/components/partial-results-list.vue.js.map +1 -1
  491. package/js/x-modules/search/components/results-list.vue.js +2 -2
  492. package/js/x-modules/search/components/results-list.vue.js.map +1 -1
  493. package/js/x-modules/search/components/sort-dropdown.vue.js +1 -3
  494. package/js/x-modules/search/components/sort-dropdown.vue.js.map +1 -1
  495. package/js/x-modules/search/store/actions/fetch-and-save-search-response.action.js +10 -3
  496. package/js/x-modules/search/store/actions/fetch-and-save-search-response.action.js.map +1 -1
  497. package/js/x-modules/search/store/actions/save-search-response.action.js +3 -1
  498. package/js/x-modules/search/store/actions/save-search-response.action.js.map +1 -1
  499. package/js/x-modules/search/store/emitters.js +1 -0
  500. package/js/x-modules/search/store/emitters.js.map +1 -1
  501. package/js/x-modules/search/store/module.js +9 -3
  502. package/js/x-modules/search/store/module.js.map +1 -1
  503. package/js/x-modules/search/wiring.js +4 -0
  504. package/js/x-modules/search/wiring.js.map +1 -1
  505. package/js/x-modules/search-box/components/clear-search-input.vue.js +1 -2
  506. package/js/x-modules/search-box/components/clear-search-input.vue.js.map +1 -1
  507. package/js/x-modules/search-box/components/search-button.vue.js +1 -2
  508. package/js/x-modules/search-box/components/search-button.vue.js.map +1 -1
  509. package/js/x-modules/search-box/store/emitters.js +1 -0
  510. package/js/x-modules/search-box/store/emitters.js.map +1 -1
  511. package/js/x-modules/semantic-queries/components/semantic-queries.vue.js +1 -3
  512. package/js/x-modules/semantic-queries/components/semantic-queries.vue.js.map +1 -1
  513. package/js/x-modules/semantic-queries/components/semantic-query.vue.js +1 -4
  514. package/js/x-modules/semantic-queries/components/semantic-query.vue.js.map +1 -1
  515. package/js/x-modules/tagging/components/tagging.vue.js +8 -7
  516. package/js/x-modules/tagging/components/tagging.vue.js.map +1 -1
  517. package/js/x-modules/tagging/service/{pdp-add-to-cart.service.js → external-tagging.service.js} +56 -25
  518. package/js/x-modules/tagging/service/external-tagging.service.js.map +1 -0
  519. package/js/x-modules/tagging/store/emitters.js +1 -1
  520. package/js/x-modules/tagging/store/emitters.js.map +1 -1
  521. package/js/x-modules/tagging/store/module.js +7 -3
  522. package/js/x-modules/tagging/store/module.js.map +1 -1
  523. package/js/x-modules/tagging/wiring.js +105 -8
  524. package/js/x-modules/tagging/wiring.js.map +1 -1
  525. package/js/x-modules/url/components/url-handler.vue.js.map +1 -1
  526. package/js/x-modules/url/components/url-handler.vue2.js +2 -1
  527. package/js/x-modules/url/components/url-handler.vue2.js.map +1 -1
  528. package/js/x-modules/url/store/emitters.js +1 -0
  529. package/js/x-modules/url/store/emitters.js.map +1 -1
  530. package/package.json +50 -49
  531. package/related-prompts/index.d.ts +1 -0
  532. package/related-prompts/index.js +10 -0
  533. package/report/x-adapter-platform.api.json +936 -81
  534. package/report/x-components.api.json +16156 -17343
  535. package/report/x-components.api.md +794 -209
  536. package/report/x-types.api.json +577 -0
  537. package/tagging/index.js +2 -2
  538. package/types/adapter/e2e-adapter.d.ts.map +1 -1
  539. package/types/adapter/mocked-responses.d.ts +3 -0
  540. package/types/adapter/mocked-responses.d.ts.map +1 -1
  541. package/types/components/base-dropdown.vue.d.ts +5 -5
  542. package/types/components/base-dropdown.vue.d.ts.map +1 -1
  543. package/types/components/base-grid.vue.d.ts +3 -3
  544. package/types/components/base-slider.vue.d.ts +74 -0
  545. package/types/components/base-slider.vue.d.ts.map +1 -0
  546. package/types/components/base-variable-column-grid.vue.d.ts +3 -3
  547. package/types/components/display-click-provider.vue.d.ts +61 -0
  548. package/types/components/display-click-provider.vue.d.ts.map +1 -0
  549. package/types/components/global-x-bus.vue.d.ts +12 -0
  550. package/types/components/global-x-bus.vue.d.ts.map +1 -1
  551. package/types/components/index.d.ts +3 -0
  552. package/types/components/index.d.ts.map +1 -1
  553. package/types/components/items-list.vue.d.ts +3 -3
  554. package/types/components/layouts/multi-column-max-width-layout.vue.d.ts +5 -5
  555. package/types/components/layouts/single-column-layout.vue.d.ts +3 -3
  556. package/types/components/modals/base-events-modal.vue.d.ts +2 -2
  557. package/types/components/modals/base-id-modal.vue.d.ts +2 -2
  558. package/types/components/modals/base-modal.vue.d.ts +10 -10
  559. package/types/components/modals/base-modal.vue.d.ts.map +1 -1
  560. package/types/components/modals/main-modal.vue.d.ts +2 -2
  561. package/types/components/page-selector.vue.d.ts +125 -0
  562. package/types/components/page-selector.vue.d.ts.map +1 -0
  563. package/types/components/panels/base-header-toggle-panel.vue.d.ts +5 -5
  564. package/types/components/panels/base-id-toggle-panel.vue.d.ts +5 -5
  565. package/types/components/panels/base-tabs-panel.vue.d.ts +8 -8
  566. package/types/components/panels/base-toggle-panel.vue.d.ts +3 -3
  567. package/types/components/result/base-result-add-to-cart.vue.d.ts +2 -0
  568. package/types/components/result/base-result-add-to-cart.vue.d.ts.map +1 -1
  569. package/types/components/result/base-result-image.vue.d.ts +10 -10
  570. package/types/components/result/base-result-image.vue.d.ts.map +1 -1
  571. package/types/components/snippet-callbacks.vue.d.ts +6 -0
  572. package/types/components/snippet-callbacks.vue.d.ts.map +1 -1
  573. package/types/components/suggestions/base-suggestions.vue.d.ts +3 -3
  574. package/types/composables/use-alias-api.d.ts +5 -0
  575. package/types/composables/use-alias-api.d.ts.map +1 -1
  576. package/types/composables/use-store.d.ts +2 -2
  577. package/types/composables/use-store.d.ts.map +1 -1
  578. package/types/directives/index.d.ts +1 -0
  579. package/types/directives/index.d.ts.map +1 -1
  580. package/types/directives/typing.d.ts +35 -0
  581. package/types/directives/typing.d.ts.map +1 -0
  582. package/types/index.d.ts +1 -0
  583. package/types/index.d.ts.map +1 -1
  584. package/types/store/index.d.ts +4 -1
  585. package/types/store/index.d.ts.map +1 -1
  586. package/types/tailwind/plugin-options.d.ts +1 -2
  587. package/types/tailwind/plugin-options.d.ts.map +1 -1
  588. package/types/types/animation-prop.d.ts +6 -2
  589. package/types/types/animation-prop.d.ts.map +1 -1
  590. package/types/types/origin.d.ts +2 -2
  591. package/types/types/origin.d.ts.map +1 -1
  592. package/types/types/page-mode.d.ts +2 -0
  593. package/types/types/page-mode.d.ts.map +1 -0
  594. package/types/views/home/types.d.ts +3 -0
  595. package/types/views/home/types.d.ts.map +1 -1
  596. package/types/wiring/events.types.d.ts +3 -1
  597. package/types/wiring/events.types.d.ts.map +1 -1
  598. package/types/x-installer/x-installer/types.d.ts +2 -2
  599. package/types/x-installer/x-installer/types.d.ts.map +1 -1
  600. package/types/x-installer/x-installer/x-installer.d.ts +4 -4
  601. package/types/x-installer/x-installer/x-installer.d.ts.map +1 -1
  602. package/types/x-modules/empathize/components/empathize.vue.d.ts +6 -6
  603. package/types/x-modules/empathize/components/empathize.vue.d.ts.map +1 -1
  604. package/types/x-modules/facets/components/facets/facets.vue.d.ts +3 -3
  605. package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts +8 -2
  606. package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts.map +1 -1
  607. package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts +6 -0
  608. package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts.map +1 -1
  609. package/types/x-modules/facets/components/lists/filters-list.vue.d.ts +3 -3
  610. package/types/x-modules/facets/components/lists/selected-filters-list.vue.d.ts +3 -3
  611. package/types/x-modules/history-queries/components/my-history.vue.d.ts +3 -3
  612. package/types/x-modules/identifier-results/components/identifier-results.vue.d.ts +3 -3
  613. package/types/x-modules/next-queries/components/next-queries-list.vue.d.ts +3 -3
  614. package/types/x-modules/next-queries/index.d.ts +1 -0
  615. package/types/x-modules/next-queries/index.d.ts.map +1 -1
  616. package/types/x-modules/queries-preview/components/query-preview-list.vue.d.ts +3 -3
  617. package/types/x-modules/queries-preview/components/query-preview-list.vue.d.ts.map +1 -1
  618. package/types/x-modules/queries-preview/components/query-preview.vue.d.ts.map +1 -1
  619. package/types/x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.d.ts.map +1 -1
  620. package/types/x-modules/queries-preview/store/module.d.ts.map +1 -1
  621. package/types/x-modules/queries-preview/utils/get-hash-from-query-preview.d.ts +4 -2
  622. package/types/x-modules/queries-preview/utils/get-hash-from-query-preview.d.ts.map +1 -1
  623. package/types/x-modules/recommendations/components/recommendations.vue.d.ts +3 -3
  624. package/types/x-modules/related-prompts/components/index.d.ts +4 -0
  625. package/types/x-modules/related-prompts/components/index.d.ts.map +1 -0
  626. package/types/x-modules/related-prompts/components/related-prompt.vue.d.ts +28 -0
  627. package/types/x-modules/related-prompts/components/related-prompt.vue.d.ts.map +1 -0
  628. package/types/x-modules/related-prompts/components/related-prompts-list.vue.d.ts +106 -0
  629. package/types/x-modules/related-prompts/components/related-prompts-list.vue.d.ts.map +1 -0
  630. package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts +132 -0
  631. package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts.map +1 -0
  632. package/types/x-modules/related-prompts/events.types.d.ts +36 -0
  633. package/types/x-modules/related-prompts/events.types.d.ts.map +1 -0
  634. package/types/x-modules/related-prompts/index.d.ts +6 -0
  635. package/types/x-modules/related-prompts/index.d.ts.map +1 -0
  636. package/types/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.d.ts +17 -0
  637. package/types/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.d.ts.map +1 -0
  638. package/types/x-modules/related-prompts/store/actions/fetch-related-prompts.action.d.ts +13 -0
  639. package/types/x-modules/related-prompts/store/actions/fetch-related-prompts.action.d.ts.map +1 -0
  640. package/types/x-modules/related-prompts/store/emitters.d.ts +9 -0
  641. package/types/x-modules/related-prompts/store/emitters.d.ts.map +1 -0
  642. package/types/x-modules/related-prompts/store/getters/request.getter.d.ts +13 -0
  643. package/types/x-modules/related-prompts/store/getters/request.getter.d.ts.map +1 -0
  644. package/types/x-modules/related-prompts/store/index.d.ts +7 -0
  645. package/types/x-modules/related-prompts/store/index.d.ts.map +1 -0
  646. package/types/x-modules/related-prompts/store/module.d.ts +8 -0
  647. package/types/x-modules/related-prompts/store/module.d.ts.map +1 -0
  648. package/types/x-modules/related-prompts/store/types.d.ts +108 -0
  649. package/types/x-modules/related-prompts/store/types.d.ts.map +1 -0
  650. package/types/x-modules/related-prompts/types.d.ts +10 -0
  651. package/types/x-modules/related-prompts/types.d.ts.map +1 -0
  652. package/types/x-modules/related-prompts/wiring.d.ts +38 -0
  653. package/types/x-modules/related-prompts/wiring.d.ts.map +1 -0
  654. package/types/x-modules/related-prompts/x-module.d.ts +16 -0
  655. package/types/x-modules/related-prompts/x-module.d.ts.map +1 -0
  656. package/types/x-modules/related-tags/components/related-tags.vue.d.ts +3 -3
  657. package/types/x-modules/scroll/components/scroll-to-top.vue.d.ts +5 -5
  658. package/types/x-modules/search/components/banners-list.vue.d.ts +3 -3
  659. package/types/x-modules/search/components/partial-results-list.vue.d.ts +3 -3
  660. package/types/x-modules/search/components/promoteds-list.vue.d.ts +3 -3
  661. package/types/x-modules/search/components/results-list.vue.d.ts +3 -3
  662. package/types/x-modules/search/components/sort-dropdown.vue.d.ts +1 -1
  663. package/types/x-modules/search/config.types.d.ts +2 -0
  664. package/types/x-modules/search/config.types.d.ts.map +1 -1
  665. package/types/x-modules/search/events.types.d.ts +4 -0
  666. package/types/x-modules/search/events.types.d.ts.map +1 -1
  667. package/types/x-modules/search/store/actions/fetch-and-save-search-response.action.d.ts.map +1 -1
  668. package/types/x-modules/search/store/actions/save-search-response.action.d.ts.map +1 -1
  669. package/types/x-modules/search/store/module.d.ts +2 -0
  670. package/types/x-modules/search/store/module.d.ts.map +1 -1
  671. package/types/x-modules/search/store/types.d.ts +9 -1
  672. package/types/x-modules/search/store/types.d.ts.map +1 -1
  673. package/types/x-modules/search/wiring.d.ts +4 -0
  674. package/types/x-modules/search/wiring.d.ts.map +1 -1
  675. package/types/x-modules/search-box/components/search-input-placeholder.vue.d.ts +3 -3
  676. package/types/x-modules/tagging/components/tagging.vue.d.ts +14 -12
  677. package/types/x-modules/tagging/components/tagging.vue.d.ts.map +1 -1
  678. package/types/x-modules/tagging/config.types.d.ts +3 -3
  679. package/types/x-modules/tagging/config.types.d.ts.map +1 -1
  680. package/types/x-modules/tagging/events.types.d.ts +2 -2
  681. package/types/x-modules/tagging/service/{pdp-add-to-cart.service.d.ts → external-tagging.service.d.ts} +31 -13
  682. package/types/x-modules/tagging/service/external-tagging.service.d.ts.map +1 -0
  683. package/types/x-modules/tagging/service/index.d.ts +1 -1
  684. package/types/x-modules/tagging/service/index.d.ts.map +1 -1
  685. package/types/x-modules/tagging/service/types.d.ts +13 -4
  686. package/types/x-modules/tagging/service/types.d.ts.map +1 -1
  687. package/types/x-modules/tagging/store/module.d.ts.map +1 -1
  688. package/types/x-modules/tagging/wiring.d.ts +54 -2
  689. package/types/x-modules/tagging/wiring.d.ts.map +1 -1
  690. package/types/x-modules/url/components/url-handler.vue.d.ts.map +1 -1
  691. package/types/x-modules/x-modules.types.d.ts +2 -0
  692. package/types/x-modules/x-modules.types.d.ts.map +1 -1
  693. package/docs/API-reference/api/x-components.defaultpdpaddtocartservice.clickedresultstoragekey.md +0 -11
  694. package/docs/API-reference/api/x-components.defaultpdpaddtocartservice.clickedresultstoragettlms.md +0 -11
  695. package/docs/API-reference/api/x-components.defaultpdpaddtocartservice.instance.md +0 -13
  696. package/docs/API-reference/api/x-components.defaultpdpaddtocartservice.localstorageservice.md +0 -11
  697. package/docs/API-reference/api/x-components.defaultpdpaddtocartservice.md +0 -41
  698. package/docs/API-reference/api/x-components.defaultpdpaddtocartservice.result_clicked_id_key.md +0 -13
  699. package/docs/API-reference/api/x-components.defaultpdpaddtocartservice.sessionstorageservice.md +0 -11
  700. package/docs/API-reference/api/x-components.pdpaddtocartservice.md +0 -22
  701. package/docs/API-reference/api/x-components.taggingconfig.clickedresultstoragettlms.md +0 -13
  702. package/docs/API-reference/api/x-components.usestore.md +0 -19
  703. package/docs/assets/features/overview-my-history.svg +0 -279
  704. package/docs/assets/features/overview-product-results-card.svg +0 -128
  705. package/docs/assets/interface/build-search-ui.svg +0 -167
  706. package/docs/assets/interface/experience-search-intro.svg +0 -1
  707. package/docs/assets/interface/integration-guide.svg +0 -1
  708. package/docs/assets/interface/integration-video.png +0 -0
  709. package/docs/assets/interface/x-architecture.svg +0 -1
  710. package/docs/assets/interface/x-empathize.gif +0 -0
  711. package/docs/assets/interface/x-facets.gif +0 -0
  712. package/docs/assets/interface/x-facets.svg +0 -189
  713. package/docs/assets/interface/x-history-queries.gif +0 -0
  714. package/docs/assets/interface/x-id-results.gif +0 -0
  715. package/docs/assets/interface/x-next-queries.gif +0 -0
  716. package/docs/assets/interface/x-popular-searches.gif +0 -0
  717. package/docs/assets/interface/x-query-suggestions.gif +0 -0
  718. package/docs/assets/interface/x-recommendations.gif +0 -0
  719. package/docs/assets/interface/x-recommendations.svg +0 -472
  720. package/docs/assets/interface/x-related-tags.gif +0 -0
  721. package/docs/assets/interface/x-results-layout.svg +0 -259
  722. package/docs/assets/interface/x-search-box-elements.svg +0 -1
  723. package/docs/assets/interface/x-search-box.svg +0 -60
  724. package/docs/build-search-ui/README.md +0 -127
  725. package/docs/build-search-ui/sidebar.js +0 -7
  726. package/docs/build-search-ui/web-archetype-development-guide.md +0 -186
  727. package/docs/build-search-ui/web-archetype-integration-guide.md +0 -458
  728. package/docs/build-search-ui/web-how-to-use-x-components-guide.md +0 -200
  729. package/docs/build-search-ui/web-x-architecture.md +0 -83
  730. package/docs/build-search-ui/web-x-components-development-guide.md +0 -157
  731. package/docs/experience-search-and-discovery/README.md +0 -132
  732. package/docs/experience-search-and-discovery/empathize.md +0 -119
  733. package/docs/experience-search-and-discovery/facets-and-filters.md +0 -154
  734. package/docs/experience-search-and-discovery/history-queries.md +0 -70
  735. package/docs/experience-search-and-discovery/id-results.md +0 -49
  736. package/docs/experience-search-and-discovery/my-history.md +0 -60
  737. package/docs/experience-search-and-discovery/next-queries.md +0 -72
  738. package/docs/experience-search-and-discovery/popular-searches.md +0 -50
  739. package/docs/experience-search-and-discovery/product-results-ui.md +0 -82
  740. package/docs/experience-search-and-discovery/query-suggestions.md +0 -48
  741. package/docs/experience-search-and-discovery/recommendations.md +0 -134
  742. package/docs/experience-search-and-discovery/related-tags.md +0 -66
  743. package/docs/experience-search-and-discovery/search-box.md +0 -99
  744. package/docs/experience-search-and-discovery/serp-ui.md +0 -125
  745. package/docs/experience-search-and-discovery/sidebar.js +0 -17
  746. package/docs/experience-search-and-discovery/web-local-storage.md +0 -30
  747. package/docs/input-status-machine-state.png +0 -0
  748. package/js/composables/use-store.js +0 -15
  749. package/js/composables/use-store.js.map +0 -1
  750. package/js/utils/options-api.js +0 -4
  751. package/js/utils/options-api.js.map +0 -1
  752. package/js/x-modules/tagging/service/pdp-add-to-cart.service.js.map +0 -1
  753. package/types/utils/options-api.d.ts +0 -3
  754. package/types/utils/options-api.d.ts.map +0 -1
  755. package/types/x-modules/tagging/service/pdp-add-to-cart.service.d.ts.map +0 -1
@@ -0,0 +1,196 @@
1
+ ---
2
+
3
+ title: RelatedPromptsList
4
+
5
+ ---
6
+
7
+ # RelatedPromptsList
8
+
9
+ Component that inserts groups of related prompts in different positions of the injected search items
10
+ list, based on the provided configuration.
11
+
12
+ ## Props
13
+
14
+ | Name | Description | Type | Default |
15
+ | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | -------------------------- | ---------------------- |
16
+ | <code>animation</code> | Animation component that will be used to animate the related prompts groups. | <code>AnimationProp</code> | <code>'ul'</code> |
17
+ | <code>offset</code> | The first index to insert a group of related prompts at. | <code>number</code> | <code>24</code> |
18
+ | <code>frequency</code> | The items cycle size to keep inserting related prompts groups at. | <code>number</code> | <code>24</code> |
19
+ | <code>maxRelatedPromptsPerGroup</code> | The maximum amount of related prompts to add in a single group. | <code>number</code> | <code>4</code> |
20
+ | <code>maxGroups</code> | The maximum number of groups to insert into the injected list items list. | <code>number</code> | <code>undefined</code> |
21
+ | <code>showOnlyAfterOffset</code> | Determines if a group is added to the injected items list in case the number<br />of items is smaller than the offset. | <code>boolean</code> | <code>false</code> |
22
+
23
+ ## Events
24
+
25
+ This component emits no events.
26
+
27
+ ## See it in action
28
+
29
+ <!-- prettier-ignore-start -->
30
+
31
+ :::warning Backend microservice required To use this component, the <b>QuerySignals</b> microservice
32
+ must be implemented. :::
33
+
34
+ <!-- prettier-ignore-end -->
35
+
36
+ Usually, this component is going to be used together with the `ResultsList` one. Related prompts
37
+ groups will be inserted between the results, guiding users to discover new searches directly from
38
+ the results list.
39
+
40
+ ```vue live
41
+ <template>
42
+ <div>
43
+ <SearchInput />
44
+ <ResultsList>
45
+ <RelatedPromptsList />
46
+ </ResultsList>
47
+ </div>
48
+ </template>
49
+
50
+ <script>
51
+ import { RelatedPromptsList } from '@empathyco/x-components/related-prompts';
52
+ import { ResultsList } from '@empathyco/x-components/search';
53
+ import { SearchInput } from '@empathyco/x-components/search-box';
54
+
55
+ export default {
56
+ name: 'RelatedPromptsListDemo',
57
+ components: {
58
+ RelatedPromptsList,
59
+ ResultsList,
60
+ SearchInput
61
+ }
62
+ };
63
+ </script>
64
+ ```
65
+
66
+ ### Play with the index that related prompts groups are inserted at
67
+
68
+ The component allows to customise where are the related prompts groups inserted. In the following
69
+ example, the first group of related prompts will be inserted at the index `48` (`offset`), and then
70
+ a second group will be inserted at index `120` because of the `frequency` prop configured to `72`.
71
+ Finally, a third group will be inserted at index `192`. Because `maxGroups` is configured to `3`, no
72
+ more groups will be inserted. Each one of this groups will have up to `6` related prompts
73
+ (`maxRelatedPromptsPerGroup`).
74
+
75
+ ```vue live
76
+ <template>
77
+ <div>
78
+ <SearchInput />
79
+ <ResultsList>
80
+ <RelatedPromptsList
81
+ :offset="48"
82
+ :frequency="72"
83
+ :maxRelatedPromptsPerGroup="6"
84
+ :maxGroups="3"
85
+ />
86
+ </ResultsList>
87
+ </div>
88
+ </template>
89
+
90
+ <script>
91
+ import { RelatedPromptsList } from '@empathyco/x-components/related-prompts';
92
+ import { ResultsList } from '@empathyco/x-components/search';
93
+ import { SearchInput } from '@empathyco/x-components/search-box';
94
+
95
+ export default {
96
+ name: 'RelatedPromptsListDemo',
97
+ components: {
98
+ RelatedPromptsList,
99
+ ResultsList,
100
+ SearchInput
101
+ }
102
+ };
103
+ </script>
104
+ ```
105
+
106
+ ### Showing/hiding first related prompts group when no more items
107
+
108
+ By default, the first related prompts group will be inserted when the total number of results is
109
+ smaller than the offset, but this behavior can be deactivated by setting the `showOnlyAfterOffset`
110
+ to `true`.
111
+
112
+ ```vue live
113
+ <template>
114
+ <div>
115
+ <SearchInput />
116
+ <ResultsList>
117
+ <RelatedPromptsList
118
+ :offset="48"
119
+ :frequency="72"
120
+ :maxRelatedPromptsPerGroup="1"
121
+ :showOnlyAfterOffset="true"
122
+ />
123
+ </ResultsList>
124
+ </div>
125
+ </template>
126
+
127
+ <script>
128
+ import { RelatedPromptsList } from '@empathyco/x-components/related-prompts';
129
+ import { ResultsList } from '@empathyco/x-components/search';
130
+ import { SearchInput } from '@empathyco/x-components/search-box';
131
+
132
+ export default {
133
+ name: 'RelatedPromptsListDemo',
134
+ components: {
135
+ RelatedPromptsList,
136
+ ResultsList,
137
+ SearchInput
138
+ }
139
+ };
140
+ </script>
141
+ ```
142
+
143
+ ### Customise the layout of the component
144
+
145
+ This component will render by default the `id` of each search item, both the injected, and for the
146
+ groups of related prompts generated, but the common case is to integrate it with another layout
147
+ component, for example the `BaseGrid`. To do so, you can use the `default` slot
148
+
149
+ ```vue
150
+ <template>
151
+ <div>
152
+ <SearchInput />
153
+ <ResultsList>
154
+ <RelatedPromptsList
155
+ :offset="48"
156
+ :frequency="72"
157
+ :maxRelatedPromptsPerGroup="6"
158
+ :maxGroups="3"
159
+ #default="{ items }"
160
+ >
161
+ <BaseGrid :items="items" :animation="animation">
162
+ <template #related-prompts-group="{ item }">
163
+ <span v-for="const prompt of items.relatedPrompts">
164
+ RelatedPromptsGroup:
165
+ <pre>{{ prompt }}</pre>
166
+ </span>
167
+ </template>
168
+ <template #result="{ item }">
169
+ <span>Result: {{ item.name }}</span>
170
+ </template>
171
+ <template #default="{ item }">
172
+ <span>Default: {{ item }}</span>
173
+ </template>
174
+ </BaseGrid>
175
+ </RelatedPromptsList>
176
+ </ResultsList>
177
+ </div>
178
+ </template>
179
+
180
+ <script>
181
+ import { RelatedPromptsList } from '@empathyco/x-components/related-prompts';
182
+ import { ResultsList } from '@empathyco/x-components/search';
183
+ import { SearchInput } from '@empathyco/x-components/search-box';
184
+ import { BaseGrid } from '@empathyco/x-components';
185
+
186
+ export default {
187
+ name: 'RelatedPromptsListDemo',
188
+ components: {
189
+ RelatedPromptsLis,
190
+ ResultsList,
191
+ BaseGrid,
192
+ SearchInput
193
+ }
194
+ };
195
+ </script>
196
+ ```
@@ -0,0 +1,32 @@
1
+ ---
2
+
3
+ title: RelatedPromptsTagList
4
+
5
+ ---
6
+
7
+ # RelatedPromptsTagList
8
+
9
+ This component shows the list of `RelatedPrompts` components.
10
+
11
+ If the default slot is reimplemented in the consumer, `onSelect` function will be necessary to
12
+ handle the selection of the related prompt and to trigger the stagger-fade-slide animation.
13
+
14
+ ## Props
15
+
16
+ | Name | Description | Type | Default |
17
+ | ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ----------------- |
18
+ | <code>buttonClass</code> | The CSS class for the left and right button of the sliding panel. | <code>string</code> | <code></code> |
19
+ | <code>showButtons</code> | The boolean prop to handle the visiblity of sliding pannel buttons. | <code>boolean</code> | <code>true</code> |
20
+ | <code>scrollContainerClass</code> | The CSS class for the wrapper of all the related prompt wrapper elements. | <code>string</code> | <code></code> |
21
+ | <code>tagClass</code> | The CSS class for all the related prompt wrapper elements. | <code>string</code> | <code></code> |
22
+ | <code>tagColors</code> | Array of colors to apply to the related prompts. It will be applied to tag<br />elements cyclically according to their index in the nex way: `tagColors[index % tagColors.length]`. | <code>string[]</code> | <code></code> |
23
+ | <code>animationDurationInMs</code> | The duration of the total animation in milliseconds. | <code>number</code> | <code>700</code> |
24
+
25
+ ## Slots
26
+
27
+ | Name | Description | Bindings<br />(name - type - description) |
28
+ | ----------------------------------------- | ------------------------------------------------------------------ | ----------------------------------------- |
29
+ | <code>sliding-panel-left-button</code> | The button to be displayed on the left side of the sliding panel. | None |
30
+ | <code>default</code> | - The slot to render related prompt information. | <br /><br /> |
31
+ | <code>related-prompt-extra-content</code> | | |
32
+ | <code>sliding-panel-right-button</code> | The button to be displayed on the right side of the sliding panel. | None |
@@ -17,7 +17,7 @@ result bound.
17
17
 
18
18
  | Name | Description | Type | Default |
19
19
  | ---------------------- | ------------------------------------------------------------- | -------------------------- | ----------------- |
20
- | <code>animation</code> | Animation component that will be used to animate the results. | <code>animationProp</code> | <code>'ul'</code> |
20
+ | <code>animation</code> | Animation component that will be used to animate the results. | <code>AnimationProp</code> | <code>'ul'</code> |
21
21
 
22
22
  ## Events
23
23
 
@@ -12,13 +12,13 @@ It allows you to activate or deactivate the session id management through the `c
12
12
 
13
13
  ## Props
14
14
 
15
- | Name | Description | Type | Default |
16
- | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------ |
17
- | <code>clickedResultStorageTTLMs</code> | The TTL in milliseconds for storing the clicked result info. | <code>number</code> | <code>30000</code> |
18
- | <code>clickedResultStorageKey</code> | The Object key of the @empathyco/x-types#Result clicked by the user<br />that will be used as id for the storage. By default, the Result url will be used. | <code>string</code> | <code>'url'</code> |
19
- | <code>sessionTTLMs</code> | The session TTL in milliseconds. | <code>number</code> | <code></code> |
20
- | <code>queryTaggingDebounceMs</code> | The debounce time in milliseconds to track the query. | <code>number</code> | <code>2000</code> |
21
- | <code>consent</code> | The consent to be emitted. | <code>boolean</code> | <code>null</code> |
15
+ | Name | Description | Type | Default |
16
+ | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------- | ------------------ |
17
+ | <code>storageTTLMs</code> | The TTL in milliseconds for storing the result info. | <code>number</code> | <code>30000</code> |
18
+ | <code>storageKey</code> | The Object key of the @empathyco/x-types#Result clicked or added to the cart by the user<br />that will be used as id for the storage.<br />By default, the Result url will be used. | <code>string</code> | <code>'url'</code> |
19
+ | <code>sessionTTLMs</code> | The session TTL in milliseconds. | <code>number</code> | <code></code> |
20
+ | <code>queryTaggingDebounceMs</code> | The debounce time in milliseconds to track the query. | <code>number</code> | <code>2000</code> |
21
+ | <code>consent</code> | The consent to be emitted. | <code>boolean</code> | <code>null</code> |
22
22
 
23
23
  ## Events
24
24
 
@@ -53,13 +53,12 @@ doesn't render elements to the DOM.
53
53
 
54
54
  In this example, the `Tagging` component will emit `ConsentProvided` with payload false by default
55
55
  if the consent is not provided, the `TaggingConfigProvided` event will be emitted only if the props
56
- `queryTaggingDebounceMs`, `sessionDurationMs`, `clickedResultStorageTTLMs` or
57
- `clickedResultStorageKey`are defined.
56
+ `queryTaggingDebounceMs`, `sessionDurationMs`, `storageTTLMs` or `storageKey`are defined.
58
57
 
59
- Every time the user clicks a result the information for the clicked product will be stored on the
60
- browser during 30 seconds which is the default value for the prop `clickedResultStorageTTLMs`. To
61
- distinguish the storage information for the different results the product url will be used since
62
- `clickedResultStorageKey` default value is 'url'.
58
+ Every time the user clicks a result or adds a result to the cart, the information for the product
59
+ will be stored on the browser during 30 seconds which is the default value for the prop
60
+ `storageTTLMs`. To distinguish the storage information for the different results the product url
61
+ will be used since `storageKey` default value is 'url'.
63
62
 
64
63
  ```vue
65
64
  <template>
@@ -78,12 +77,12 @@ distinguish the storage information for the different results the product url wi
78
77
  </script>
79
78
  ```
80
79
 
81
- In this example, the clicked result information will be stored on the browser during 60 seconds and
82
- the product id will be used as storage key.
80
+ In this example, the clicked or added to cart result information will be stored on the browser
81
+ during 60 seconds and the product id will be used as storage key
83
82
 
84
83
  ```vue
85
84
  <template>
86
- <Tagging :clickedResultStorageTTLMs="60000" :clickedResultStorageKey="'id'" />
85
+ <Tagging :storageTTLMs="60000" :storageKey="'id'" />
87
86
  </template>
88
87
 
89
88
  <script>
@@ -1,5 +1,5 @@
1
1
  import _sfc_main from './fade-and-slide.vue2.js';
2
- import { openBlock, createBlock, TransitionGroup, withCtx, createCommentVNode, renderSlot } from 'vue';
2
+ import { openBlock, createBlock, TransitionGroup, withCtx, renderSlot } from 'vue';
3
3
  import './fade-and-slide.vue3.js';
4
4
  import _export_sfc from '../../_virtual/_plugin-vue_export-helper.js';
5
5
 
@@ -11,7 +11,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
11
11
  appear: _ctx.appear
12
12
  }, {
13
13
  default: withCtx(() => [
14
- createCommentVNode(" @slot (Required) Transition-group content "),
15
14
  renderSlot(_ctx.$slots, "default")
16
15
  ]),
17
16
  _: 3
@@ -1 +1 @@
1
- {"version":3,"file":"fade-and-slide.vue.js","sources":["../../../../src/components/animations/fade-and-slide.vue"],"sourcesContent":["<template>\n <transition-group class=\"x-fade-and-slide\" :name=\"name\" :tag=\"tag\" :appear=\"appear\">\n <!-- @slot (Required) Transition-group content -->\n <slot />\n </transition-group>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent } from 'vue';\n import { useDisableAnimation } from './use-disable-animation';\n\n /**\n * Renders a transition group wrapping the elements passed in the default slot and animating\n * them with a fade and slide animation.\n *\n * @public\n */\n export default defineComponent({\n name: 'FadeAndSlide',\n props: {\n /**\n * HTML Element that the transition-group children will be wrapped in.\n */\n tag: String,\n /**\n * Indicates if the transition must be applied on the initial render of the node.\n */\n appear: {\n type: Boolean,\n default: true\n }\n },\n setup: function () {\n /**\n * The name of the animation.\n */\n const animationName = 'x-fade-and-slide-';\n\n const { name } = useDisableAnimation(animationName);\n\n return { name };\n }\n });\n</script>\n\n<style lang=\"css\">\n .x-fade-and-slide--move,\n .x-fade-and-slide--enter-active,\n .x-fade-and-slide--leave-active {\n transition: opacity 0.2s ease-out, transform 0.3s ease-out;\n }\n\n .x-fade-and-slide--enter-from,\n .x-fade-and-slide--leave-to {\n transform: translate(-20%, 0);\n opacity: 0;\n }\n\n .x-fade-and-slide--leave-active {\n position: absolute;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Examples\n\nThe FadeAndSlide component is intended to be used as a prop in animatable components but also works\nas a wrapper of a transition group that can receive the tag it will render to as a prop.\n\nUsed as a prop in an animatable component:\n\n```vue\n<AnimatableComponent :animation=\"FadeAndSlide\" />\n```\n\nUsed as a regular component passing a the tag as prop:\n\n```vue\n<FadeAndSlide tag=\"ul\">\n <li>Element to animate</li>\n <li>Element to animate</li>\n <li>Element to animate</li>\n</FadeAndSlide>\n```\n</docs>\n"],"names":["name","_createBlock","_TransitionGroup","tag","appear","_withCtx","_createCommentVNode","_renderSlot"],"mappings":";;;;;AACyB,SAAA,WAAA,CAAC,IAAkB,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,KAAA,EAAA,QAAA,EAAA;SAAQA,SAAI,EAAA,EAAAC,WAAA,CAAAC,eAAA,EAAA;AAAA,IAAG,KAAKC,EAAAA,kBAAAA;AAAAA,IAAM,MAAM,IAAEC,CAAAA,IAAAA;AAAAA,IAAAA,GAAAA,EAAAA,IAAAA,CAAAA,GAAAA;AAD9E,IAAA,MAAA,EAAA,IAAA,CAAA,MAAA;AAAA,GAAA,EAAA;aAGIC,OAAQ,CAAA,MAAA;AAAA,MAAAC,kBAAA,CAAA,6CAAA,CAAA;AAHZ,MAAAC,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,CAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
1
+ {"version":3,"file":"fade-and-slide.vue.js","sources":["../../../../src/components/animations/fade-and-slide.vue"],"sourcesContent":["<template>\n <transition-group class=\"x-fade-and-slide\" :name=\"name\" :tag=\"tag\" :appear=\"appear\">\n <!-- @slot (Required) Transition-group content -->\n <slot />\n </transition-group>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent } from 'vue';\n import { useDisableAnimation } from './use-disable-animation';\n\n /**\n * Renders a transition group wrapping the elements passed in the default slot and animating\n * them with a fade and slide animation.\n *\n * @public\n */\n export default defineComponent({\n name: 'FadeAndSlide',\n props: {\n /**\n * HTML Element that the transition-group children will be wrapped in.\n */\n tag: String,\n /**\n * Indicates if the transition must be applied on the initial render of the node.\n */\n appear: {\n type: Boolean,\n default: true\n }\n },\n setup: function () {\n /**\n * The name of the animation.\n */\n const animationName = 'x-fade-and-slide-';\n\n const { name } = useDisableAnimation(animationName);\n\n return { name };\n }\n });\n</script>\n\n<style lang=\"css\">\n .x-fade-and-slide--move,\n .x-fade-and-slide--enter-active,\n .x-fade-and-slide--leave-active {\n transition: opacity 0.2s ease-out, transform 0.3s ease-out;\n }\n\n .x-fade-and-slide--enter-from,\n .x-fade-and-slide--leave-to {\n transform: translate(-20%, 0);\n opacity: 0;\n }\n\n .x-fade-and-slide--leave-active {\n position: absolute;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Examples\n\nThe FadeAndSlide component is intended to be used as a prop in animatable components but also works\nas a wrapper of a transition group that can receive the tag it will render to as a prop.\n\nUsed as a prop in an animatable component:\n\n```vue\n<AnimatableComponent :animation=\"FadeAndSlide\" />\n```\n\nUsed as a regular component passing a the tag as prop:\n\n```vue\n<FadeAndSlide tag=\"ul\">\n <li>Element to animate</li>\n <li>Element to animate</li>\n <li>Element to animate</li>\n</FadeAndSlide>\n```\n</docs>\n"],"names":["name","_createBlock","_TransitionGroup","tag","appear","_renderSlot"],"mappings":";;;;;AACyB,SAAA,WAAA,CAAC,IAAkB,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,KAAA,EAAA,QAAA,EAAA;SAAQA,SAAI,EAAA,EAAAC,WAAA,CAAAC,eAAA,EAAA;AAAA,IAAG,KAAKC,EAAAA,kBAAAA;AAAAA,IAAM,MAAM,IAAEC,CAAAA,IAAAA;AAAAA,IAAAA,GAAAA,EAAAA,IAAAA,CAAAA,GAAAA;AAD9E,IAAA,MAAA,EAAA,IAAA,CAAA,MAAA;AAAA,GAAA,EAAA;;AAAA,MAAAC,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,CAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
1
  import _sfc_main from './base-dropdown.vue2.js';
2
- import { openBlock, createElementBlock, withKeys, withModifiers, normalizeClass, createElementVNode, createCommentVNode, renderSlot, createTextVNode, toDisplayString, createBlock, resolveDynamicComponent, withCtx, withDirectives, Fragment, renderList, vShow } from 'vue';
2
+ import { openBlock, createElementBlock, withKeys, withModifiers, normalizeClass, createElementVNode, renderSlot, createTextVNode, toDisplayString, createBlock, resolveDynamicComponent, withCtx, withDirectives, Fragment, renderList, vShow } from 'vue';
3
3
  import './base-dropdown.vue3.js';
4
4
  import _export_sfc from '../_virtual/_plugin-vue_export-helper.js';
5
5
 
@@ -32,7 +32,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
32
32
  "aria-label": _ctx.ariaLabel,
33
33
  "aria-autocomplete": "none"
34
34
  }, [
35
- createCommentVNode("\n @slot Used to render the contents of the dropdown toggle button. If not provided, it uses\n the item slot as fallback.\n @binding {string|number|Identifiable} item - The item data to render.\n @binding {boolean} isOpen - True if the dropdown is opened, and false if it is closed.\n "),
36
35
  _ctx.hasToggleSlot ? renderSlot(_ctx.$slots, "toggle", {
37
36
  key: 0,
38
37
  isOpen: _ctx.isOpen,
@@ -85,7 +84,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
85
84
  "data-test": "dropdown-item",
86
85
  role: "option"
87
86
  }, [
88
- createCommentVNode("\n @slot (required) Used to render each one of the items content, and as fallback\n for the toggle button content slot if it is not provided.\n @binding {string|number|Identifiable} item - Item to render\n @binding {boolean} isHighlighted - True when the item has the focus.\n @binding {boolean} isSelected - True when the item is selected.\n "),
89
87
  renderSlot(_ctx.$slots, "item", {
90
88
  isHighlighted: index === _ctx.highlightedItemIndex,
91
89
  isSelected: item === _ctx.modelValue,
@@ -1 +1 @@
1
- {"version":3,"file":"base-dropdown.vue.js","sources":["../../../src/components/base-dropdown.vue"],"sourcesContent":["<template>\n <div\n ref=\"rootRef\"\n @keydown=\"updateSearchBuffer\"\n @keydown.down.prevent=\"highlightNextItem\"\n @keydown.up.prevent=\"highlightPreviousItem\"\n :class=\"dropdownCSSClasses\"\n class=\"x-dropdown\"\n >\n <button\n ref=\"toggleButtonRef\"\n @click=\"toggle\"\n @keydown.up.down.prevent.stop=\"open\"\n class=\"x-dropdown__toggle\"\n data-test=\"dropdown-toggle\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n :aria-expanded=\"isOpen.toString()\"\n :aria-controls=\"listId\"\n :aria-label=\"ariaLabel\"\n aria-autocomplete=\"none\"\n >\n <!--\n @slot Used to render the contents of the dropdown toggle button. If not provided, it uses\n the item slot as fallback.\n @binding {string|number|Identifiable} item - The item data to render.\n @binding {boolean} isOpen - True if the dropdown is opened, and false if it is closed.\n -->\n <slot v-if=\"hasToggleSlot\" :isOpen=\"isOpen\" :item=\"modelValue\" name=\"toggle\">\n {{ modelValue }}\n </slot>\n <slot v-else :item=\"modelValue\" name=\"item\">{{ modelValue }}</slot>\n </button>\n\n <component :is=\"animation\">\n <ul\n v-show=\"isOpen\"\n @keydown.end=\"highlightLastItem\"\n @keydown.esc=\"closeAndFocusToggleButton\"\n @keydown.home=\"highlightFirstItem\"\n :id=\"listId\"\n class=\"x-dropdown__items-list\"\n data-test=\"dropdown-list\"\n role=\"listbox\"\n tabindex=\"-1\"\n >\n <li v-for=\"(item, index) in items\" :key=\"item.id || item\" class=\"x-dropdown__list-item\">\n <button\n :ref=\"el => (itemsButtonRefs[index] = el)\"\n @click=\"emitSelectedItemChanged(item)\"\n :aria-selected=\"(item === modelValue).toString()\"\n :class=\"itemsCSSClasses[index]\"\n class=\"x-dropdown__item\"\n data-test=\"dropdown-item\"\n role=\"option\"\n >\n <!--\n @slot (required) Used to render each one of the items content, and as fallback\n for the toggle button content slot if it is not provided.\n @binding {string|number|Identifiable} item - Item to render\n @binding {boolean} isHighlighted - True when the item has the focus.\n @binding {boolean} isSelected - True when the item is selected.\n -->\n <slot\n :isHighlighted=\"index === highlightedItemIndex\"\n :isSelected=\"item === modelValue\"\n :item=\"item\"\n name=\"item\"\n >\n {{ item }}\n </slot>\n </button>\n </li>\n </ul>\n </component>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { Identifiable } from '@empathyco/x-types';\n import { computed, defineComponent, nextTick, onBeforeUnmount, PropType, ref, watch } from 'vue';\n import { AnimationProp } from '../types';\n import { debounceFunction, normalizeString, getTargetElement, isInRange } from '../utils';\n import { NoAnimation } from './animations';\n\n type DropdownItem = string | number | Identifiable;\n let dropdownCount = 0;\n\n /**\n * Dropdown component that mimics a Select element behavior, but with the option\n * to customize the toggle button and each item contents.\n */\n export default defineComponent({\n name: 'BaseDropdown',\n props: {\n /** List of items to display.*/\n items: {\n type: Array as PropType<DropdownItem[]>,\n required: true\n },\n /** The selected item. */\n modelValue: {\n type: null as unknown as PropType<DropdownItem | null>,\n validator: (v: any) =>\n typeof v === 'string' || typeof v === 'number' || typeof v === 'object' || v === null,\n required: true\n },\n /** Description of what the dropdown is used for. */\n ariaLabel: String,\n /**\n * Animation component to use for expanding the dropdown. This is a single element animation,\n * so only `<transition>` components are allowed.\n */\n animation: {\n type: AnimationProp,\n default: () => NoAnimation\n },\n /** Time to wait without receiving any keystroke before resetting the items search query. */\n searchTimeoutMs: {\n type: Number,\n default: 1000\n }\n },\n emits: ['update:modelValue'],\n setup(props, { emit, slots }) {\n const rootRef = ref<HTMLElement>();\n /** The button that opens and closes the list of options. */\n const toggleButtonRef = ref<HTMLButtonElement>();\n /** Array containing the dropdown list buttons HTMLElements. */\n const itemsButtonRefs = ref<HTMLButtonElement[]>([]);\n\n /** Property to check whether the dropdown is expanded or closed. */\n const isOpen = ref(false);\n /** Index of the element that has the focus in the list. -1 means no element has focus. */\n const highlightedItemIndex = ref(-1);\n /** String to search for the first element that starts with it. */\n const searchBuffer = ref('');\n\n /** Resets the search buffer after a certain time has passed. */\n let restartResetSearchTimeout: () => void;\n /* Unique ID to identify the dropdown. */\n const listId = `x-dropdown-${dropdownCount++}`;\n\n /**\n * Dynamic CSS classes to add to the dropdown root element.\n *\n * @returns An object containing the CSS classes to add to the dropdown root element.\n */\n const dropdownCSSClasses = computed(() => ({ 'x-dropdown--is-open': isOpen }));\n\n /**\n * Dynamic CSS classes to add to each one of the items.\n *\n * @returns An object containing the CSS classes to add to each item.\n */\n const itemsCSSClasses = computed(() =>\n props.items.map((item, index) => ({\n 'x-dropdown__item--is-selected': props.modelValue === item,\n 'x-dropdown__item--is-highlighted': highlightedItemIndex.value === index\n }))\n );\n\n /* Opens the dropdown. */\n const open = () => (isOpen.value = true);\n /* Closes the dropdown. */\n const close = () => (isOpen.value = false);\n /* Toggles the dropdown. */\n const toggle = () => (isOpen.value = !isOpen.value);\n\n /**\n * Closes the modal and focuses the toggle button.\n */\n function closeAndFocusToggleButton() {\n close();\n toggleButtonRef.value?.focus();\n }\n\n /**\n * Emits the event that the selected item has changed.\n *\n * @param item - The new selected item.\n */\n function emitSelectedItemChanged(item: DropdownItem) {\n emit('update:modelValue', item);\n closeAndFocusToggleButton();\n }\n\n /**\n * Highlights the item after the one that is currently highlighted.\n */\n function highlightNextItem() {\n open();\n highlightedItemIndex.value = (highlightedItemIndex.value + 1) % props.items.length;\n }\n\n /**\n * Highlights the item before the one that is currently highlighted.\n */\n function highlightPreviousItem() {\n const currentIndex = highlightedItemIndex.value;\n open();\n highlightedItemIndex.value = currentIndex > 0 ? currentIndex - 1 : props.items.length - 1;\n }\n\n /**\n * Highlights the first of the provided items.\n */\n function highlightFirstItem() {\n highlightedItemIndex.value = 0;\n }\n\n /**\n * Highlights the last of the provided items.\n */\n function highlightLastItem() {\n highlightedItemIndex.value = props.items.length - 1;\n }\n\n /**\n * Updates the variable that is used to search in the filters.\n *\n * @param event - The event coming from the user typing.\n */\n function updateSearchBuffer(event: KeyboardEvent) {\n if (/^\\w$/.test(event.key)) {\n const key = event.key;\n searchBuffer.value += key;\n restartResetSearchTimeout();\n }\n }\n\n /**\n * Resets the search buffer.\n */\n function resetSearchBuffer() {\n searchBuffer.value = '';\n }\n\n /**\n * Closes the dropdown if the passed event has happened on an element out of the dropdown.\n *\n * @param event - The event to check if it has happened out of the dropdown component.\n */\n function closeIfEventIsOutOfDropdown(event: MouseEvent | TouchEvent | FocusEvent) {\n if (!rootRef.value?.contains(getTargetElement(event))) {\n close();\n }\n }\n\n /**\n * Adds listeners to the document element to detect if the focus has moved out from the\n * dropdown.\n */\n function addDocumentCloseListeners() {\n document.addEventListener('mousedown', closeIfEventIsOutOfDropdown);\n document.addEventListener('touchstart', closeIfEventIsOutOfDropdown);\n document.addEventListener('focusin', closeIfEventIsOutOfDropdown);\n }\n\n /**\n * Removes the listeners of the document element to detect if the focus has moved out from the\n * dropdown.\n */\n function removeDocumentCloseListeners() {\n document.removeEventListener('mousedown', closeIfEventIsOutOfDropdown);\n document.removeEventListener('touchstart', closeIfEventIsOutOfDropdown);\n document.removeEventListener('focusin', closeIfEventIsOutOfDropdown);\n }\n\n /**\n * Highlights the item that matches the search buffer. To do so it checks the list buttons\n * text content. It highlights items following this priority:\n * - If an element is already highlighted, it starts searching from that element.\n * - If no element is found starting from the previously highlighted, it returns the first one.\n * - If no element is found matching the search query it highlights the first element.\n *\n * @param search - The search string to find in the HTML.\n */\n watch(searchBuffer, search => {\n if (search) {\n const normalizedSearch = normalizeString(search);\n const matchingIndices = itemsButtonRefs?.value?.reduce<number[]>(\n (matchingIndices, button, index) => {\n const safeButtonWordCharacters = button.textContent!.replace(/[^\\w]/g, '');\n const normalizedButtonText = normalizeString(safeButtonWordCharacters);\n if (normalizedButtonText.startsWith(normalizedSearch)) {\n matchingIndices.push(index);\n }\n return matchingIndices;\n },\n []\n );\n highlightedItemIndex.value =\n // First matching item starting to search from the current highlighted element\n matchingIndices?.find(index => index >= highlightedItemIndex.value) ??\n // First matching item\n matchingIndices?.[0] ??\n // First item\n 0;\n }\n });\n\n /**\n * Updates the debounced function to reset the search.\n *\n * @param searchTimeoutMs - The new milliseconds that have to pass without typing before\n * resetting the search.\n */\n watch(\n () => props.searchTimeoutMs,\n searchTimeoutMs => {\n restartResetSearchTimeout = debounceFunction(resetSearchBuffer, searchTimeoutMs);\n },\n { immediate: true }\n );\n\n /**\n * Focuses the DOM element which matches the `highlightedItemIndex`.\n *\n * @param highlightedItemIndex - The index of the HTML element to focus.\n */\n watch(\n highlightedItemIndex,\n highlightedItemIndex => {\n nextTick(() => {\n if (itemsButtonRefs && isInRange(highlightedItemIndex, [0, props.items.length - 1])) {\n const newItem = itemsButtonRefs?.value?.[highlightedItemIndex];\n newItem?.focus();\n }\n });\n },\n { immediate: true }\n );\n\n /**\n * When the dropdown is open it sets the focused element to the one that is selected.\n *\n * @param isOpen - True if the dropdown is open, false otherwise.\n */\n watch(isOpen, isOpen => {\n highlightedItemIndex.value = isOpen\n ? props.modelValue === null\n ? 0\n : props.items.indexOf(props.modelValue)\n : -1;\n });\n\n /**\n * Adds and removes listeners to close the dropdown when it loses the focus.\n *\n * @param isOpen - True if the dropdown is open, false otherwise.\n */\n watch(isOpen, isOpen => {\n /*\n * Because there is an issue with Firefox in macOS and Safari that doesn't focus the target\n * element of the `mousedown` events, the `focusout` event `relatedTarget` property can't be\n * used to detect whether the user has blurred the dropdown. The hack here is to use\n * document listeners that have the side effect of losing the focus.\n */\n if (isOpen) {\n addDocumentCloseListeners();\n } else {\n removeDocumentCloseListeners();\n }\n });\n\n /**\n * If the dropdown is destroyed before removing the document listeners, it ensures that they\n * are removed too.\n */\n onBeforeUnmount(() => {\n removeDocumentCloseListeners();\n });\n\n return {\n hasToggleSlot: !!slots.toggle,\n closeAndFocusToggleButton,\n dropdownCSSClasses,\n emitSelectedItemChanged,\n highlightFirstItem,\n highlightLastItem,\n highlightNextItem,\n highlightPreviousItem,\n highlightedItemIndex,\n isOpen,\n itemsButtonRefs,\n itemsCSSClasses,\n listId,\n open,\n rootRef,\n toggle,\n toggleButtonRef,\n updateSearchBuffer\n };\n }\n });\n</script>\n\n<style lang=\"css\" scoped>\n .x-dropdown {\n position: relative;\n }\n\n .x-dropdown__items-list {\n z-index: 1;\n list-style: none;\n position: absolute;\n padding: 0;\n margin: 0;\n top: calc(100% + var(--x-size-gap-dropdown-default, 0));\n }\n</style>\n\n<docs lang=\"mdx\">\n## Example\n\nThe `Dropdown` component is a simple yet customizable select component. The component needs to work\nthe list of items available to select, which are passed using the `items` prop, and the selected\nitem, which is passed in using the `value` prop.\n\nThe supported items must be an array that can contain unique strings, unique numbers, or objects\nwith a unique `id` property.\n\nThe content of each item can be customized using the `item` slot, which apart from the data of the\nitem, it also receives via prop if the element is selected or highlighted.\n\nThere `toggle` slot can be used to customize the button that opens the dropdown. If this is not\nprovided, the `item` slot will be used for that.\n\n```vue\n<template>\n <BaseDropdown v-model=\"value\" :items=\"items\">\n <template #toggle=\"{ item, isOpen }\">{{ item }} {{ isOpen ? '🔼' : '🔽' }}️</template>\n\n <template #item=\"{ item, isSelected, isHighlighted }\">\n <span v-if=\"isHighlighted\">🟢</span>\n <span v-if=\"isSelected\">✅</span>\n <span>{{ item }}</span>\n </template>\n </BaseDropdown>\n</template>\n\n<script>\n import { BaseDropdown } from '@empathyco/x-components';\n\n export default {\n name: 'DropdownTest',\n components: {\n BaseDropdown\n },\n data() {\n return {\n items: ['a', 2, { id: '3' }],\n value: 'a'\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_withKeys","_withModifiers","dropdownCSSClasses","_normalizeClass","_createElementVNode","listId","ariaLabel","hasToggleSlot","_createCommentVNode","isOpen","_createTextVNode","_toDisplayString","modelValue","_createBlock","_resolveDynamicComponent","_withCtx","_withDirectives","_Fragment","_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down.vue"],"sourcesContent":["<template>\n <div\n ref=\"rootRef\"\n @keydown=\"updateSearchBuffer\"\n @keydown.down.prevent=\"highlightNextItem\"\n @keydown.up.prevent=\"highlightPreviousItem\"\n :class=\"dropdownCSSClasses\"\n class=\"x-dropdown\"\n >\n <button\n ref=\"toggleButtonRef\"\n @click=\"toggle\"\n @keydown.up.down.prevent.stop=\"open\"\n class=\"x-dropdown__toggle\"\n data-test=\"dropdown-toggle\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n :aria-expanded=\"isOpen.toString()\"\n :aria-controls=\"listId\"\n :aria-label=\"ariaLabel\"\n aria-autocomplete=\"none\"\n >\n <!--\n @slot Used to render the contents of the dropdown toggle button. If not provided, it uses\n the item slot as fallback.\n @binding {string|number|Identifiable} item - The item data to render.\n @binding {boolean} isOpen - True if the dropdown is opened, and false if it is closed.\n -->\n <slot v-if=\"hasToggleSlot\" :isOpen=\"isOpen\" :item=\"modelValue\" name=\"toggle\">\n {{ modelValue }}\n </slot>\n <slot v-else :item=\"modelValue\" name=\"item\">{{ modelValue }}</slot>\n </button>\n\n <component :is=\"animation\">\n <ul\n v-show=\"isOpen\"\n @keydown.end=\"highlightLastItem\"\n @keydown.esc=\"closeAndFocusToggleButton\"\n @keydown.home=\"highlightFirstItem\"\n :id=\"listId\"\n class=\"x-dropdown__items-list\"\n data-test=\"dropdown-list\"\n role=\"listbox\"\n tabindex=\"-1\"\n >\n <li v-for=\"(item, index) in items\" :key=\"item.id || item\" class=\"x-dropdown__list-item\">\n <button\n :ref=\"el => (itemsButtonRefs[index] = el)\"\n @click=\"emitSelectedItemChanged(item)\"\n :aria-selected=\"(item === modelValue).toString()\"\n :class=\"itemsCSSClasses[index]\"\n class=\"x-dropdown__item\"\n data-test=\"dropdown-item\"\n role=\"option\"\n >\n <!--\n @slot (required) Used to render each one of the items content, and as fallback\n for the toggle button content slot if it is not provided.\n @binding {string|number|Identifiable} item - Item to render\n @binding {boolean} isHighlighted - True when the item has the focus.\n @binding {boolean} isSelected - True when the item is selected.\n -->\n <slot\n :isHighlighted=\"index === highlightedItemIndex\"\n :isSelected=\"item === modelValue\"\n :item=\"item\"\n name=\"item\"\n >\n {{ item }}\n </slot>\n </button>\n </li>\n </ul>\n </component>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { Identifiable } from '@empathyco/x-types';\n import { computed, defineComponent, nextTick, onBeforeUnmount, PropType, ref, watch } from 'vue';\n import { AnimationProp } from '../types';\n import { debounceFunction, normalizeString, getTargetElement } from '../utils';\n import { NoAnimation } from './animations';\n\n type DropdownItem = string | number | Identifiable;\n let dropdownCount = 0;\n\n /**\n * Dropdown component that mimics a Select element behavior, but with the option\n * to customize the toggle button and each item contents.\n */\n export default defineComponent({\n name: 'BaseDropdown',\n props: {\n /** List of items to display.*/\n items: {\n type: Array as PropType<DropdownItem[]>,\n required: true\n },\n /** The selected item. */\n modelValue: {\n type: null as unknown as PropType<DropdownItem | null>,\n validator: (v: any) =>\n typeof v === 'string' || typeof v === 'number' || typeof v === 'object' || v === null,\n required: true\n },\n /** Description of what the dropdown is used for. */\n ariaLabel: String,\n /**\n * Animation component to use for expanding the dropdown. This is a single element animation,\n * so only `<transition>` components are allowed.\n */\n animation: {\n type: AnimationProp,\n default: () => NoAnimation\n },\n /** Time to wait without receiving any keystroke before resetting the items search query. */\n searchTimeoutMs: {\n type: Number,\n default: 1000\n }\n },\n emits: ['update:modelValue'],\n setup(props, { emit, slots }) {\n const rootRef = ref<HTMLElement>();\n /** The button that opens and closes the list of options. */\n const toggleButtonRef = ref<HTMLButtonElement>();\n /** Array containing the dropdown list buttons HTMLElements. */\n const itemsButtonRefs = ref<HTMLButtonElement[]>([]);\n\n /** Property to check whether the dropdown is expanded or closed. */\n const isOpen = ref(false);\n /** Index of the element that has the focus in the list. -1 means no element has focus. */\n const highlightedItemIndex = ref(-1);\n /** String to search for the first element that starts with it. */\n const searchBuffer = ref('');\n\n /** Resets the search buffer after a certain time has passed. */\n let restartResetSearchTimeout: () => void;\n /* Unique ID to identify the dropdown. */\n const listId = `x-dropdown-${dropdownCount++}`;\n\n /**\n * Dynamic CSS classes to add to the dropdown root element.\n *\n * @returns An object containing the CSS classes to add to the dropdown root element.\n */\n const dropdownCSSClasses = computed(() => ({ 'x-dropdown--is-open': isOpen }));\n\n /**\n * Dynamic CSS classes to add to each one of the items.\n *\n * @returns An object containing the CSS classes to add to each item.\n */\n const itemsCSSClasses = computed(() =>\n props.items.map((item, index) => ({\n 'x-dropdown__item--is-selected': props.modelValue === item,\n 'x-dropdown__item--is-highlighted': highlightedItemIndex.value === index\n }))\n );\n\n /* Opens the dropdown. */\n const open = () => (isOpen.value = true);\n /* Closes the dropdown. */\n const close = () => (isOpen.value = false);\n /* Toggles the dropdown. */\n const toggle = () => (isOpen.value = !isOpen.value);\n\n /**\n * Closes the modal and focuses the toggle button.\n */\n function closeAndFocusToggleButton() {\n close();\n toggleButtonRef.value?.focus();\n }\n\n /**\n * Emits the event that the selected item has changed.\n *\n * @param item - The new selected item.\n */\n function emitSelectedItemChanged(item: DropdownItem) {\n emit('update:modelValue', item);\n closeAndFocusToggleButton();\n }\n\n /**\n * Highlights the item after the one that is currently highlighted.\n */\n function highlightNextItem() {\n open();\n highlightedItemIndex.value = (highlightedItemIndex.value + 1) % props.items.length;\n }\n\n /**\n * Highlights the item before the one that is currently highlighted.\n */\n function highlightPreviousItem() {\n const currentIndex = highlightedItemIndex.value;\n open();\n highlightedItemIndex.value = currentIndex > 0 ? currentIndex - 1 : props.items.length - 1;\n }\n\n /**\n * Highlights the first of the provided items.\n */\n function highlightFirstItem() {\n highlightedItemIndex.value = 0;\n }\n\n /**\n * Highlights the last of the provided items.\n */\n function highlightLastItem() {\n highlightedItemIndex.value = props.items.length - 1;\n }\n\n /**\n * Updates the variable that is used to search in the filters.\n *\n * @param event - The event coming from the user typing.\n */\n function updateSearchBuffer(event: KeyboardEvent) {\n if (/^\\w$/.test(event.key)) {\n const key = event.key;\n searchBuffer.value += key;\n restartResetSearchTimeout();\n }\n }\n\n /**\n * Resets the search buffer.\n */\n function resetSearchBuffer() {\n searchBuffer.value = '';\n }\n\n /**\n * Closes the dropdown if the passed event has happened on an element out of the dropdown.\n *\n * @param event - The event to check if it has happened out of the dropdown component.\n */\n function closeIfEventIsOutOfDropdown(event: MouseEvent | TouchEvent | FocusEvent) {\n if (!rootRef.value?.contains(getTargetElement(event))) {\n close();\n }\n }\n\n /**\n * Adds listeners to the document element to detect if the focus has moved out from the\n * dropdown.\n */\n function addDocumentCloseListeners() {\n document.addEventListener('mousedown', closeIfEventIsOutOfDropdown);\n document.addEventListener('touchstart', closeIfEventIsOutOfDropdown);\n document.addEventListener('focusin', closeIfEventIsOutOfDropdown);\n }\n\n /**\n * Removes the listeners of the document element to detect if the focus has moved out from the\n * dropdown.\n */\n function removeDocumentCloseListeners() {\n document.removeEventListener('mousedown', closeIfEventIsOutOfDropdown);\n document.removeEventListener('touchstart', closeIfEventIsOutOfDropdown);\n document.removeEventListener('focusin', closeIfEventIsOutOfDropdown);\n }\n\n /**\n * Highlights the item that matches the search buffer. To do so it checks the list buttons\n * text content. It highlights items following this priority:\n * - If an element is already highlighted, it starts searching from that element.\n * - If no element is found starting from the previously highlighted, it returns the first one.\n * - If no element is found matching the search query it highlights the first element.\n *\n * @param search - The search string to find in the HTML.\n */\n watch(searchBuffer, search => {\n if (search) {\n const normalizedSearch = normalizeString(search);\n const matchingIndices = itemsButtonRefs?.value?.reduce<number[]>(\n (matchingIndices, button, index) => {\n const safeButtonWordCharacters = button.textContent!.replace(/[^\\w]/g, '');\n const normalizedButtonText = normalizeString(safeButtonWordCharacters);\n if (normalizedButtonText.startsWith(normalizedSearch)) {\n matchingIndices.push(index);\n }\n return matchingIndices;\n },\n []\n );\n highlightedItemIndex.value =\n // First matching item starting to search from the current highlighted element\n matchingIndices?.find(index => index >= highlightedItemIndex.value) ??\n // First matching item\n matchingIndices?.[0] ??\n // First item\n 0;\n }\n });\n\n /**\n * Updates the debounced function to reset the search.\n *\n * @param searchTimeoutMs - The new milliseconds that have to pass without typing before\n * resetting the search.\n */\n watch(\n () => props.searchTimeoutMs,\n searchTimeoutMs => {\n restartResetSearchTimeout = debounceFunction(resetSearchBuffer, searchTimeoutMs);\n },\n { immediate: true }\n );\n\n /**\n * Focuses the DOM element which matches the `highlightedItemIndex`.\n *\n * @param highlightedItemIndex - The index of the HTML element to focus.\n */\n watch(\n highlightedItemIndex,\n highlightedItemIndex => {\n nextTick(() => itemsButtonRefs.value[highlightedItemIndex]?.focus());\n },\n { immediate: true }\n );\n\n /**\n * When the dropdown is open it sets the focused element to the one that is selected.\n *\n * @param isOpen - True if the dropdown is open, false otherwise.\n */\n watch(isOpen, isOpen => {\n highlightedItemIndex.value = isOpen\n ? props.modelValue === null\n ? 0\n : props.items.indexOf(props.modelValue)\n : -1;\n });\n\n /**\n * Adds and removes listeners to close the dropdown when it loses the focus.\n *\n * @param isOpen - True if the dropdown is open, false otherwise.\n */\n watch(isOpen, isOpen => {\n /*\n * Because there is an issue with Firefox in macOS and Safari that doesn't focus the target\n * element of the `mousedown` events, the `focusout` event `relatedTarget` property can't be\n * used to detect whether the user has blurred the dropdown. The hack here is to use\n * document listeners that have the side effect of losing the focus.\n */\n if (isOpen) {\n addDocumentCloseListeners();\n } else {\n removeDocumentCloseListeners();\n }\n });\n\n /**\n * If the dropdown is destroyed before removing the document listeners, it ensures that they\n * are removed too.\n */\n onBeforeUnmount(() => {\n removeDocumentCloseListeners();\n });\n\n return {\n hasToggleSlot: !!slots.toggle,\n closeAndFocusToggleButton,\n dropdownCSSClasses,\n emitSelectedItemChanged,\n highlightFirstItem,\n highlightLastItem,\n highlightNextItem,\n highlightPreviousItem,\n highlightedItemIndex,\n isOpen,\n itemsButtonRefs,\n itemsCSSClasses,\n listId,\n open,\n rootRef,\n toggle,\n toggleButtonRef,\n updateSearchBuffer\n };\n }\n });\n</script>\n\n<style lang=\"css\" scoped>\n .x-dropdown {\n position: relative;\n }\n\n .x-dropdown__items-list {\n z-index: 1;\n list-style: none;\n position: absolute;\n padding: 0;\n margin: 0;\n top: calc(100% + var(--x-size-gap-dropdown-default, 0));\n }\n</style>\n\n<docs lang=\"mdx\">\n## Example\n\nThe `Dropdown` component is a simple yet customizable select component. The component needs to work\nthe list of items available to select, which are passed using the `items` prop, and the selected\nitem, which is passed in using the `value` prop.\n\nThe supported items must be an array that can contain unique strings, unique numbers, or objects\nwith a unique `id` property.\n\nThe content of each item can be customized using the `item` slot, which apart from the data of the\nitem, it also receives via prop if the element is selected or highlighted.\n\nThere `toggle` slot can be used to customize the button that opens the dropdown. If this is not\nprovided, the `item` slot will be used for that.\n\n```vue\n<template>\n <BaseDropdown v-model=\"value\" :items=\"items\">\n <template #toggle=\"{ item, isOpen }\">{{ item }} {{ isOpen ? '🔼' : '🔽' }}️</template>\n\n <template #item=\"{ item, isSelected, isHighlighted }\">\n <span v-if=\"isHighlighted\">🟢</span>\n <span v-if=\"isSelected\">✅</span>\n <span>{{ item }}</span>\n </template>\n </BaseDropdown>\n</template>\n\n<script>\n import { BaseDropdown } from '@empathyco/x-components';\n\n export default {\n name: 'DropdownTest',\n components: {\n BaseDropdown\n },\n data() {\n return {\n items: ['a', 2, { id: '3' }],\n value: 'a'\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_withKeys","_withModifiers","dropdownCSSClasses","_normalizeClass","_createElementVNode","listId","ariaLabel","_renderSlot","isOpen","_createTextVNode","_toDisplayString","modelValue","_createBlock","_resolveDynamicComponent","_withCtx","_withDirectives","_Fragment","_renderList","itemsButtonRefs","itemsCSSClasses"],"mappings":";;;;;AAAA,MAAA,UAAA,GAAA,CAAA,eAAA,EAAA,eAAA,EAAA,YAAA,CAAA,CAAA;;;SAEQ,WAAS,CAAA,IAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,KAAA,EAAA,QAAA,EAAA;SACZA,SAAO,EAAA,EAAAC,kBAAA;AAAA,IAAA,KAAA;AAAA,IAAA;AAAA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gBAAYP,KAAU,CAAA,GAAA,EAAA;AAAA,oBACnC,OAAA,EAnDb,CAmDoBQ,MAAAA,KAAAA,IAAAA,CAAAA,uBAAAA,CAAgB,IAClB,CAAA;AAAA,oBACN,kBAAU,IAAe,KAAA,IAAA,CAAA,UAAA,EAAA,QAAA,EAAA;AAAA,oBACzB,OAAKhB,cAAQ,CAAA,CAAA,IAAA,CAAA,eAAA,CAAA,KAAA,CAAA,EAAA,kBAAA,CAAA,CAAA;AAAA,oBAAA,WAAA,EAAA,eAAA;AASb,oBAAA,IAAA,EAAA,QAAA;AAAA,mBAAA,EAAA;AAEa,oBAAAI,UAAA,CAAA,IAAA,CAAE,MAASI,EAAAA,MAAAA,EAAAA;AAAAA,sBACrB,aAAU,EAAA,KAAA,KAAA,IAAA,CAAA,oBAAA;AAAA,sBAIN,UAAA,EAAA,IAAA,KAAA,IAAA,CAAA,UAAA;AAAA,sBAtEnB,IAAA;AAAA,qBAAA,EAAA,MAAA;;AAAA,wBAAAD,eAAA,CAAA,IAAA,CAAA;AAAA,wBAAA,CAAA;AAAA;AAAA,uBAAA;AAAA,qBAAA,EAAA,IAAA,CAAA;;;;;;AAoCsB,aAAA;AAAA,WAAA,EAAA,EAAA,EAAA,UAAA,CAAA,EAAA;;AApCtB,WAAA,CAAA;AAAA,SAAA,CAAA;;;;;;;;;;;;;"}
@@ -3,7 +3,6 @@ import { AnimationProp } from '../types/animation-prop.js';
3
3
  import { debounce } from '../utils/debounce.js';
4
4
  import { getTargetElement } from '../utils/html.js';
5
5
  import { normalizeString } from '../utils/normalize.js';
6
- import { isInRange } from '../utils/number.js';
7
6
  import '../utils/storage.js';
8
7
  import './animations/animate-width.vue2.js';
9
8
  import './animations/animate-width.vue3.js';
@@ -230,12 +229,7 @@ var _sfc_main = defineComponent({
230
229
  * @param highlightedItemIndex - The index of the HTML element to focus.
231
230
  */
232
231
  watch(highlightedItemIndex, highlightedItemIndex => {
233
- nextTick(() => {
234
- if (itemsButtonRefs && isInRange(highlightedItemIndex, [0, props.items.length - 1])) {
235
- const newItem = itemsButtonRefs?.value?.[highlightedItemIndex];
236
- newItem?.focus();
237
- }
238
- });
232
+ nextTick(() => itemsButtonRefs.value[highlightedItemIndex]?.focus());
239
233
  }, { immediate: true });
240
234
  /**
241
235
  * When the dropdown is open it sets the focused element to the one that is selected.
@@ -1 +1 @@
1
- {"version":3,"file":"base-dropdown.vue2.js","sources":["../../../src/components/base-dropdown.vue"],"sourcesContent":["<template>\n <div\n ref=\"rootRef\"\n @keydown=\"updateSearchBuffer\"\n @keydown.down.prevent=\"highlightNextItem\"\n @keydown.up.prevent=\"highlightPreviousItem\"\n :class=\"dropdownCSSClasses\"\n class=\"x-dropdown\"\n >\n <button\n ref=\"toggleButtonRef\"\n @click=\"toggle\"\n @keydown.up.down.prevent.stop=\"open\"\n class=\"x-dropdown__toggle\"\n data-test=\"dropdown-toggle\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n :aria-expanded=\"isOpen.toString()\"\n :aria-controls=\"listId\"\n :aria-label=\"ariaLabel\"\n aria-autocomplete=\"none\"\n >\n <!--\n @slot Used to render the contents of the dropdown toggle button. If not provided, it uses\n the item slot as fallback.\n @binding {string|number|Identifiable} item - The item data to render.\n @binding {boolean} isOpen - True if the dropdown is opened, and false if it is closed.\n -->\n <slot v-if=\"hasToggleSlot\" :isOpen=\"isOpen\" :item=\"modelValue\" name=\"toggle\">\n {{ modelValue }}\n </slot>\n <slot v-else :item=\"modelValue\" name=\"item\">{{ modelValue }}</slot>\n </button>\n\n <component :is=\"animation\">\n <ul\n v-show=\"isOpen\"\n @keydown.end=\"highlightLastItem\"\n @keydown.esc=\"closeAndFocusToggleButton\"\n @keydown.home=\"highlightFirstItem\"\n :id=\"listId\"\n class=\"x-dropdown__items-list\"\n data-test=\"dropdown-list\"\n role=\"listbox\"\n tabindex=\"-1\"\n >\n <li v-for=\"(item, index) in items\" :key=\"item.id || item\" class=\"x-dropdown__list-item\">\n <button\n :ref=\"el => (itemsButtonRefs[index] = el)\"\n @click=\"emitSelectedItemChanged(item)\"\n :aria-selected=\"(item === modelValue).toString()\"\n :class=\"itemsCSSClasses[index]\"\n class=\"x-dropdown__item\"\n data-test=\"dropdown-item\"\n role=\"option\"\n >\n <!--\n @slot (required) Used to render each one of the items content, and as fallback\n for the toggle button content slot if it is not provided.\n @binding {string|number|Identifiable} item - Item to render\n @binding {boolean} isHighlighted - True when the item has the focus.\n @binding {boolean} isSelected - True when the item is selected.\n -->\n <slot\n :isHighlighted=\"index === highlightedItemIndex\"\n :isSelected=\"item === modelValue\"\n :item=\"item\"\n name=\"item\"\n >\n {{ item }}\n </slot>\n </button>\n </li>\n </ul>\n </component>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { Identifiable } from '@empathyco/x-types';\n import { computed, defineComponent, nextTick, onBeforeUnmount, PropType, ref, watch } from 'vue';\n import { AnimationProp } from '../types';\n import { debounceFunction, normalizeString, getTargetElement, isInRange } from '../utils';\n import { NoAnimation } from './animations';\n\n type DropdownItem = string | number | Identifiable;\n let dropdownCount = 0;\n\n /**\n * Dropdown component that mimics a Select element behavior, but with the option\n * to customize the toggle button and each item contents.\n */\n export default defineComponent({\n name: 'BaseDropdown',\n props: {\n /** List of items to display.*/\n items: {\n type: Array as PropType<DropdownItem[]>,\n required: true\n },\n /** The selected item. */\n modelValue: {\n type: null as unknown as PropType<DropdownItem | null>,\n validator: (v: any) =>\n typeof v === 'string' || typeof v === 'number' || typeof v === 'object' || v === null,\n required: true\n },\n /** Description of what the dropdown is used for. */\n ariaLabel: String,\n /**\n * Animation component to use for expanding the dropdown. This is a single element animation,\n * so only `<transition>` components are allowed.\n */\n animation: {\n type: AnimationProp,\n default: () => NoAnimation\n },\n /** Time to wait without receiving any keystroke before resetting the items search query. */\n searchTimeoutMs: {\n type: Number,\n default: 1000\n }\n },\n emits: ['update:modelValue'],\n setup(props, { emit, slots }) {\n const rootRef = ref<HTMLElement>();\n /** The button that opens and closes the list of options. */\n const toggleButtonRef = ref<HTMLButtonElement>();\n /** Array containing the dropdown list buttons HTMLElements. */\n const itemsButtonRefs = ref<HTMLButtonElement[]>([]);\n\n /** Property to check whether the dropdown is expanded or closed. */\n const isOpen = ref(false);\n /** Index of the element that has the focus in the list. -1 means no element has focus. */\n const highlightedItemIndex = ref(-1);\n /** String to search for the first element that starts with it. */\n const searchBuffer = ref('');\n\n /** Resets the search buffer after a certain time has passed. */\n let restartResetSearchTimeout: () => void;\n /* Unique ID to identify the dropdown. */\n const listId = `x-dropdown-${dropdownCount++}`;\n\n /**\n * Dynamic CSS classes to add to the dropdown root element.\n *\n * @returns An object containing the CSS classes to add to the dropdown root element.\n */\n const dropdownCSSClasses = computed(() => ({ 'x-dropdown--is-open': isOpen }));\n\n /**\n * Dynamic CSS classes to add to each one of the items.\n *\n * @returns An object containing the CSS classes to add to each item.\n */\n const itemsCSSClasses = computed(() =>\n props.items.map((item, index) => ({\n 'x-dropdown__item--is-selected': props.modelValue === item,\n 'x-dropdown__item--is-highlighted': highlightedItemIndex.value === index\n }))\n );\n\n /* Opens the dropdown. */\n const open = () => (isOpen.value = true);\n /* Closes the dropdown. */\n const close = () => (isOpen.value = false);\n /* Toggles the dropdown. */\n const toggle = () => (isOpen.value = !isOpen.value);\n\n /**\n * Closes the modal and focuses the toggle button.\n */\n function closeAndFocusToggleButton() {\n close();\n toggleButtonRef.value?.focus();\n }\n\n /**\n * Emits the event that the selected item has changed.\n *\n * @param item - The new selected item.\n */\n function emitSelectedItemChanged(item: DropdownItem) {\n emit('update:modelValue', item);\n closeAndFocusToggleButton();\n }\n\n /**\n * Highlights the item after the one that is currently highlighted.\n */\n function highlightNextItem() {\n open();\n highlightedItemIndex.value = (highlightedItemIndex.value + 1) % props.items.length;\n }\n\n /**\n * Highlights the item before the one that is currently highlighted.\n */\n function highlightPreviousItem() {\n const currentIndex = highlightedItemIndex.value;\n open();\n highlightedItemIndex.value = currentIndex > 0 ? currentIndex - 1 : props.items.length - 1;\n }\n\n /**\n * Highlights the first of the provided items.\n */\n function highlightFirstItem() {\n highlightedItemIndex.value = 0;\n }\n\n /**\n * Highlights the last of the provided items.\n */\n function highlightLastItem() {\n highlightedItemIndex.value = props.items.length - 1;\n }\n\n /**\n * Updates the variable that is used to search in the filters.\n *\n * @param event - The event coming from the user typing.\n */\n function updateSearchBuffer(event: KeyboardEvent) {\n if (/^\\w$/.test(event.key)) {\n const key = event.key;\n searchBuffer.value += key;\n restartResetSearchTimeout();\n }\n }\n\n /**\n * Resets the search buffer.\n */\n function resetSearchBuffer() {\n searchBuffer.value = '';\n }\n\n /**\n * Closes the dropdown if the passed event has happened on an element out of the dropdown.\n *\n * @param event - The event to check if it has happened out of the dropdown component.\n */\n function closeIfEventIsOutOfDropdown(event: MouseEvent | TouchEvent | FocusEvent) {\n if (!rootRef.value?.contains(getTargetElement(event))) {\n close();\n }\n }\n\n /**\n * Adds listeners to the document element to detect if the focus has moved out from the\n * dropdown.\n */\n function addDocumentCloseListeners() {\n document.addEventListener('mousedown', closeIfEventIsOutOfDropdown);\n document.addEventListener('touchstart', closeIfEventIsOutOfDropdown);\n document.addEventListener('focusin', closeIfEventIsOutOfDropdown);\n }\n\n /**\n * Removes the listeners of the document element to detect if the focus has moved out from the\n * dropdown.\n */\n function removeDocumentCloseListeners() {\n document.removeEventListener('mousedown', closeIfEventIsOutOfDropdown);\n document.removeEventListener('touchstart', closeIfEventIsOutOfDropdown);\n document.removeEventListener('focusin', closeIfEventIsOutOfDropdown);\n }\n\n /**\n * Highlights the item that matches the search buffer. To do so it checks the list buttons\n * text content. It highlights items following this priority:\n * - If an element is already highlighted, it starts searching from that element.\n * - If no element is found starting from the previously highlighted, it returns the first one.\n * - If no element is found matching the search query it highlights the first element.\n *\n * @param search - The search string to find in the HTML.\n */\n watch(searchBuffer, search => {\n if (search) {\n const normalizedSearch = normalizeString(search);\n const matchingIndices = itemsButtonRefs?.value?.reduce<number[]>(\n (matchingIndices, button, index) => {\n const safeButtonWordCharacters = button.textContent!.replace(/[^\\w]/g, '');\n const normalizedButtonText = normalizeString(safeButtonWordCharacters);\n if (normalizedButtonText.startsWith(normalizedSearch)) {\n matchingIndices.push(index);\n }\n return matchingIndices;\n },\n []\n );\n highlightedItemIndex.value =\n // First matching item starting to search from the current highlighted element\n matchingIndices?.find(index => index >= highlightedItemIndex.value) ??\n // First matching item\n matchingIndices?.[0] ??\n // First item\n 0;\n }\n });\n\n /**\n * Updates the debounced function to reset the search.\n *\n * @param searchTimeoutMs - The new milliseconds that have to pass without typing before\n * resetting the search.\n */\n watch(\n () => props.searchTimeoutMs,\n searchTimeoutMs => {\n restartResetSearchTimeout = debounceFunction(resetSearchBuffer, searchTimeoutMs);\n },\n { immediate: true }\n );\n\n /**\n * Focuses the DOM element which matches the `highlightedItemIndex`.\n *\n * @param highlightedItemIndex - The index of the HTML element to focus.\n */\n watch(\n highlightedItemIndex,\n highlightedItemIndex => {\n nextTick(() => {\n if (itemsButtonRefs && isInRange(highlightedItemIndex, [0, props.items.length - 1])) {\n const newItem = itemsButtonRefs?.value?.[highlightedItemIndex];\n newItem?.focus();\n }\n });\n },\n { immediate: true }\n );\n\n /**\n * When the dropdown is open it sets the focused element to the one that is selected.\n *\n * @param isOpen - True if the dropdown is open, false otherwise.\n */\n watch(isOpen, isOpen => {\n highlightedItemIndex.value = isOpen\n ? props.modelValue === null\n ? 0\n : props.items.indexOf(props.modelValue)\n : -1;\n });\n\n /**\n * Adds and removes listeners to close the dropdown when it loses the focus.\n *\n * @param isOpen - True if the dropdown is open, false otherwise.\n */\n watch(isOpen, isOpen => {\n /*\n * Because there is an issue with Firefox in macOS and Safari that doesn't focus the target\n * element of the `mousedown` events, the `focusout` event `relatedTarget` property can't be\n * used to detect whether the user has blurred the dropdown. The hack here is to use\n * document listeners that have the side effect of losing the focus.\n */\n if (isOpen) {\n addDocumentCloseListeners();\n } else {\n removeDocumentCloseListeners();\n }\n });\n\n /**\n * If the dropdown is destroyed before removing the document listeners, it ensures that they\n * are removed too.\n */\n onBeforeUnmount(() => {\n removeDocumentCloseListeners();\n });\n\n return {\n hasToggleSlot: !!slots.toggle,\n closeAndFocusToggleButton,\n dropdownCSSClasses,\n emitSelectedItemChanged,\n highlightFirstItem,\n highlightLastItem,\n highlightNextItem,\n highlightPreviousItem,\n highlightedItemIndex,\n isOpen,\n itemsButtonRefs,\n itemsCSSClasses,\n listId,\n open,\n rootRef,\n toggle,\n toggleButtonRef,\n updateSearchBuffer\n };\n }\n });\n</script>\n\n<style lang=\"css\" scoped>\n .x-dropdown {\n position: relative;\n }\n\n .x-dropdown__items-list {\n z-index: 1;\n list-style: none;\n position: absolute;\n padding: 0;\n margin: 0;\n top: calc(100% + var(--x-size-gap-dropdown-default, 0));\n }\n</style>\n\n<docs lang=\"mdx\">\n## Example\n\nThe `Dropdown` component is a simple yet customizable select component. The component needs to work\nthe list of items available to select, which are passed using the `items` prop, and the selected\nitem, which is passed in using the `value` prop.\n\nThe supported items must be an array that can contain unique strings, unique numbers, or objects\nwith a unique `id` property.\n\nThe content of each item can be customized using the `item` slot, which apart from the data of the\nitem, it also receives via prop if the element is selected or highlighted.\n\nThere `toggle` slot can be used to customize the button that opens the dropdown. If this is not\nprovided, the `item` slot will be used for that.\n\n```vue\n<template>\n <BaseDropdown v-model=\"value\" :items=\"items\">\n <template #toggle=\"{ item, isOpen }\">{{ item }} {{ isOpen ? '🔼' : '🔽' }}️</template>\n\n <template #item=\"{ item, isSelected, isHighlighted }\">\n <span v-if=\"isHighlighted\">🟢</span>\n <span v-if=\"isSelected\">✅</span>\n <span>{{ item }}</span>\n </template>\n </BaseDropdown>\n</template>\n\n<script>\n import { BaseDropdown } from '@empathyco/x-components';\n\n export default {\n name: 'DropdownTest',\n components: {\n BaseDropdown\n },\n data() {\n return {\n items: ['a', 2, { id: '3' }],\n value: 'a'\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":["NoAnimation","debounceFunction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAsFE,IAAI,aAAY,GAAI,CA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uB;YACvB,kBAAkB;YAClB,iBAAiB;YACjB,iBAAiB;YACjB,qBAAqB;YACrB,oBAAoB;YACpB,MAAM;YACN,eAAe;YACf,eAAe;YACf,MAAM;YACN,IAAI;YACJ,OAAO;YACP,MAAM;YACN,eAAe;YACf,kBAAiB;SAClB,CAAA;KACH;AACD,CAAA,CAAC;;;;"}
1
+ {"version":3,"file":"base-dropdown.vue2.js","sources":["../../../src/components/base-dropdown.vue"],"sourcesContent":["<template>\n <div\n ref=\"rootRef\"\n @keydown=\"updateSearchBuffer\"\n @keydown.down.prevent=\"highlightNextItem\"\n @keydown.up.prevent=\"highlightPreviousItem\"\n :class=\"dropdownCSSClasses\"\n class=\"x-dropdown\"\n >\n <button\n ref=\"toggleButtonRef\"\n @click=\"toggle\"\n @keydown.up.down.prevent.stop=\"open\"\n class=\"x-dropdown__toggle\"\n data-test=\"dropdown-toggle\"\n role=\"combobox\"\n aria-haspopup=\"listbox\"\n :aria-expanded=\"isOpen.toString()\"\n :aria-controls=\"listId\"\n :aria-label=\"ariaLabel\"\n aria-autocomplete=\"none\"\n >\n <!--\n @slot Used to render the contents of the dropdown toggle button. If not provided, it uses\n the item slot as fallback.\n @binding {string|number|Identifiable} item - The item data to render.\n @binding {boolean} isOpen - True if the dropdown is opened, and false if it is closed.\n -->\n <slot v-if=\"hasToggleSlot\" :isOpen=\"isOpen\" :item=\"modelValue\" name=\"toggle\">\n {{ modelValue }}\n </slot>\n <slot v-else :item=\"modelValue\" name=\"item\">{{ modelValue }}</slot>\n </button>\n\n <component :is=\"animation\">\n <ul\n v-show=\"isOpen\"\n @keydown.end=\"highlightLastItem\"\n @keydown.esc=\"closeAndFocusToggleButton\"\n @keydown.home=\"highlightFirstItem\"\n :id=\"listId\"\n class=\"x-dropdown__items-list\"\n data-test=\"dropdown-list\"\n role=\"listbox\"\n tabindex=\"-1\"\n >\n <li v-for=\"(item, index) in items\" :key=\"item.id || item\" class=\"x-dropdown__list-item\">\n <button\n :ref=\"el => (itemsButtonRefs[index] = el)\"\n @click=\"emitSelectedItemChanged(item)\"\n :aria-selected=\"(item === modelValue).toString()\"\n :class=\"itemsCSSClasses[index]\"\n class=\"x-dropdown__item\"\n data-test=\"dropdown-item\"\n role=\"option\"\n >\n <!--\n @slot (required) Used to render each one of the items content, and as fallback\n for the toggle button content slot if it is not provided.\n @binding {string|number|Identifiable} item - Item to render\n @binding {boolean} isHighlighted - True when the item has the focus.\n @binding {boolean} isSelected - True when the item is selected.\n -->\n <slot\n :isHighlighted=\"index === highlightedItemIndex\"\n :isSelected=\"item === modelValue\"\n :item=\"item\"\n name=\"item\"\n >\n {{ item }}\n </slot>\n </button>\n </li>\n </ul>\n </component>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { Identifiable } from '@empathyco/x-types';\n import { computed, defineComponent, nextTick, onBeforeUnmount, PropType, ref, watch } from 'vue';\n import { AnimationProp } from '../types';\n import { debounceFunction, normalizeString, getTargetElement } from '../utils';\n import { NoAnimation } from './animations';\n\n type DropdownItem = string | number | Identifiable;\n let dropdownCount = 0;\n\n /**\n * Dropdown component that mimics a Select element behavior, but with the option\n * to customize the toggle button and each item contents.\n */\n export default defineComponent({\n name: 'BaseDropdown',\n props: {\n /** List of items to display.*/\n items: {\n type: Array as PropType<DropdownItem[]>,\n required: true\n },\n /** The selected item. */\n modelValue: {\n type: null as unknown as PropType<DropdownItem | null>,\n validator: (v: any) =>\n typeof v === 'string' || typeof v === 'number' || typeof v === 'object' || v === null,\n required: true\n },\n /** Description of what the dropdown is used for. */\n ariaLabel: String,\n /**\n * Animation component to use for expanding the dropdown. This is a single element animation,\n * so only `<transition>` components are allowed.\n */\n animation: {\n type: AnimationProp,\n default: () => NoAnimation\n },\n /** Time to wait without receiving any keystroke before resetting the items search query. */\n searchTimeoutMs: {\n type: Number,\n default: 1000\n }\n },\n emits: ['update:modelValue'],\n setup(props, { emit, slots }) {\n const rootRef = ref<HTMLElement>();\n /** The button that opens and closes the list of options. */\n const toggleButtonRef = ref<HTMLButtonElement>();\n /** Array containing the dropdown list buttons HTMLElements. */\n const itemsButtonRefs = ref<HTMLButtonElement[]>([]);\n\n /** Property to check whether the dropdown is expanded or closed. */\n const isOpen = ref(false);\n /** Index of the element that has the focus in the list. -1 means no element has focus. */\n const highlightedItemIndex = ref(-1);\n /** String to search for the first element that starts with it. */\n const searchBuffer = ref('');\n\n /** Resets the search buffer after a certain time has passed. */\n let restartResetSearchTimeout: () => void;\n /* Unique ID to identify the dropdown. */\n const listId = `x-dropdown-${dropdownCount++}`;\n\n /**\n * Dynamic CSS classes to add to the dropdown root element.\n *\n * @returns An object containing the CSS classes to add to the dropdown root element.\n */\n const dropdownCSSClasses = computed(() => ({ 'x-dropdown--is-open': isOpen }));\n\n /**\n * Dynamic CSS classes to add to each one of the items.\n *\n * @returns An object containing the CSS classes to add to each item.\n */\n const itemsCSSClasses = computed(() =>\n props.items.map((item, index) => ({\n 'x-dropdown__item--is-selected': props.modelValue === item,\n 'x-dropdown__item--is-highlighted': highlightedItemIndex.value === index\n }))\n );\n\n /* Opens the dropdown. */\n const open = () => (isOpen.value = true);\n /* Closes the dropdown. */\n const close = () => (isOpen.value = false);\n /* Toggles the dropdown. */\n const toggle = () => (isOpen.value = !isOpen.value);\n\n /**\n * Closes the modal and focuses the toggle button.\n */\n function closeAndFocusToggleButton() {\n close();\n toggleButtonRef.value?.focus();\n }\n\n /**\n * Emits the event that the selected item has changed.\n *\n * @param item - The new selected item.\n */\n function emitSelectedItemChanged(item: DropdownItem) {\n emit('update:modelValue', item);\n closeAndFocusToggleButton();\n }\n\n /**\n * Highlights the item after the one that is currently highlighted.\n */\n function highlightNextItem() {\n open();\n highlightedItemIndex.value = (highlightedItemIndex.value + 1) % props.items.length;\n }\n\n /**\n * Highlights the item before the one that is currently highlighted.\n */\n function highlightPreviousItem() {\n const currentIndex = highlightedItemIndex.value;\n open();\n highlightedItemIndex.value = currentIndex > 0 ? currentIndex - 1 : props.items.length - 1;\n }\n\n /**\n * Highlights the first of the provided items.\n */\n function highlightFirstItem() {\n highlightedItemIndex.value = 0;\n }\n\n /**\n * Highlights the last of the provided items.\n */\n function highlightLastItem() {\n highlightedItemIndex.value = props.items.length - 1;\n }\n\n /**\n * Updates the variable that is used to search in the filters.\n *\n * @param event - The event coming from the user typing.\n */\n function updateSearchBuffer(event: KeyboardEvent) {\n if (/^\\w$/.test(event.key)) {\n const key = event.key;\n searchBuffer.value += key;\n restartResetSearchTimeout();\n }\n }\n\n /**\n * Resets the search buffer.\n */\n function resetSearchBuffer() {\n searchBuffer.value = '';\n }\n\n /**\n * Closes the dropdown if the passed event has happened on an element out of the dropdown.\n *\n * @param event - The event to check if it has happened out of the dropdown component.\n */\n function closeIfEventIsOutOfDropdown(event: MouseEvent | TouchEvent | FocusEvent) {\n if (!rootRef.value?.contains(getTargetElement(event))) {\n close();\n }\n }\n\n /**\n * Adds listeners to the document element to detect if the focus has moved out from the\n * dropdown.\n */\n function addDocumentCloseListeners() {\n document.addEventListener('mousedown', closeIfEventIsOutOfDropdown);\n document.addEventListener('touchstart', closeIfEventIsOutOfDropdown);\n document.addEventListener('focusin', closeIfEventIsOutOfDropdown);\n }\n\n /**\n * Removes the listeners of the document element to detect if the focus has moved out from the\n * dropdown.\n */\n function removeDocumentCloseListeners() {\n document.removeEventListener('mousedown', closeIfEventIsOutOfDropdown);\n document.removeEventListener('touchstart', closeIfEventIsOutOfDropdown);\n document.removeEventListener('focusin', closeIfEventIsOutOfDropdown);\n }\n\n /**\n * Highlights the item that matches the search buffer. To do so it checks the list buttons\n * text content. It highlights items following this priority:\n * - If an element is already highlighted, it starts searching from that element.\n * - If no element is found starting from the previously highlighted, it returns the first one.\n * - If no element is found matching the search query it highlights the first element.\n *\n * @param search - The search string to find in the HTML.\n */\n watch(searchBuffer, search => {\n if (search) {\n const normalizedSearch = normalizeString(search);\n const matchingIndices = itemsButtonRefs?.value?.reduce<number[]>(\n (matchingIndices, button, index) => {\n const safeButtonWordCharacters = button.textContent!.replace(/[^\\w]/g, '');\n const normalizedButtonText = normalizeString(safeButtonWordCharacters);\n if (normalizedButtonText.startsWith(normalizedSearch)) {\n matchingIndices.push(index);\n }\n return matchingIndices;\n },\n []\n );\n highlightedItemIndex.value =\n // First matching item starting to search from the current highlighted element\n matchingIndices?.find(index => index >= highlightedItemIndex.value) ??\n // First matching item\n matchingIndices?.[0] ??\n // First item\n 0;\n }\n });\n\n /**\n * Updates the debounced function to reset the search.\n *\n * @param searchTimeoutMs - The new milliseconds that have to pass without typing before\n * resetting the search.\n */\n watch(\n () => props.searchTimeoutMs,\n searchTimeoutMs => {\n restartResetSearchTimeout = debounceFunction(resetSearchBuffer, searchTimeoutMs);\n },\n { immediate: true }\n );\n\n /**\n * Focuses the DOM element which matches the `highlightedItemIndex`.\n *\n * @param highlightedItemIndex - The index of the HTML element to focus.\n */\n watch(\n highlightedItemIndex,\n highlightedItemIndex => {\n nextTick(() => itemsButtonRefs.value[highlightedItemIndex]?.focus());\n },\n { immediate: true }\n );\n\n /**\n * When the dropdown is open it sets the focused element to the one that is selected.\n *\n * @param isOpen - True if the dropdown is open, false otherwise.\n */\n watch(isOpen, isOpen => {\n highlightedItemIndex.value = isOpen\n ? props.modelValue === null\n ? 0\n : props.items.indexOf(props.modelValue)\n : -1;\n });\n\n /**\n * Adds and removes listeners to close the dropdown when it loses the focus.\n *\n * @param isOpen - True if the dropdown is open, false otherwise.\n */\n watch(isOpen, isOpen => {\n /*\n * Because there is an issue with Firefox in macOS and Safari that doesn't focus the target\n * element of the `mousedown` events, the `focusout` event `relatedTarget` property can't be\n * used to detect whether the user has blurred the dropdown. The hack here is to use\n * document listeners that have the side effect of losing the focus.\n */\n if (isOpen) {\n addDocumentCloseListeners();\n } else {\n removeDocumentCloseListeners();\n }\n });\n\n /**\n * If the dropdown is destroyed before removing the document listeners, it ensures that they\n * are removed too.\n */\n onBeforeUnmount(() => {\n removeDocumentCloseListeners();\n });\n\n return {\n hasToggleSlot: !!slots.toggle,\n closeAndFocusToggleButton,\n dropdownCSSClasses,\n emitSelectedItemChanged,\n highlightFirstItem,\n highlightLastItem,\n highlightNextItem,\n highlightPreviousItem,\n highlightedItemIndex,\n isOpen,\n itemsButtonRefs,\n itemsCSSClasses,\n listId,\n open,\n rootRef,\n toggle,\n toggleButtonRef,\n updateSearchBuffer\n };\n }\n });\n</script>\n\n<style lang=\"css\" scoped>\n .x-dropdown {\n position: relative;\n }\n\n .x-dropdown__items-list {\n z-index: 1;\n list-style: none;\n position: absolute;\n padding: 0;\n margin: 0;\n top: calc(100% + var(--x-size-gap-dropdown-default, 0));\n }\n</style>\n\n<docs lang=\"mdx\">\n## Example\n\nThe `Dropdown` component is a simple yet customizable select component. The component needs to work\nthe list of items available to select, which are passed using the `items` prop, and the selected\nitem, which is passed in using the `value` prop.\n\nThe supported items must be an array that can contain unique strings, unique numbers, or objects\nwith a unique `id` property.\n\nThe content of each item can be customized using the `item` slot, which apart from the data of the\nitem, it also receives via prop if the element is selected or highlighted.\n\nThere `toggle` slot can be used to customize the button that opens the dropdown. If this is not\nprovided, the `item` slot will be used for that.\n\n```vue\n<template>\n <BaseDropdown v-model=\"value\" :items=\"items\">\n <template #toggle=\"{ item, isOpen }\">{{ item }} {{ isOpen ? '🔼' : '🔽' }}️</template>\n\n <template #item=\"{ item, isSelected, isHighlighted }\">\n <span v-if=\"isHighlighted\">🟢</span>\n <span v-if=\"isSelected\">✅</span>\n <span>{{ item }}</span>\n </template>\n </BaseDropdown>\n</template>\n\n<script>\n import { BaseDropdown } from '@empathyco/x-components';\n\n export default {\n name: 'DropdownTest',\n components: {\n BaseDropdown\n },\n data() {\n return {\n items: ['a', 2, { id: '3' }],\n value: 'a'\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":["NoAnimation","debounceFunction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsFE,IAAI,aAAY,GAAI,CAAC,CAAA;AAErB;;;AAGE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,cAAc;AACpB,I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createCommentVNode, renderSlot } from 'vue';
2
+ import { openBlock, createElementBlock, renderSlot } from 'vue';
3
3
  import _export_sfc from '../_virtual/_plugin-vue_export-helper.js';
4
4
 
5
5
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
@@ -11,7 +11,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
11
11
  "data-test": "event-button"
12
12
  },
13
13
  [
14
- createCommentVNode(" @slot (Required) Button content with a text, an icon or both "),
15
14
  renderSlot(_ctx.$slots, "default")
16
15
  ],
17
16
  512