@empathyco/x-components 6.0.0-alpha.184 → 6.0.0-alpha.186
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/docs/API-reference/api/x-components.aioverview.md +22 -8
- package/docs/API-reference/api/x-components.allfilter.md +6 -4
- package/docs/API-reference/api/x-components.animatewidth.md +1 -1
- package/docs/API-reference/api/x-components.autoprogressbar.md +5 -5
- package/docs/API-reference/api/x-components.banner.md +5 -5
- package/docs/API-reference/api/x-components.bannerslist.md +5 -5
- package/docs/API-reference/api/x-components.baseaddtocart.md +6 -4
- package/docs/API-reference/api/x-components.basecolumnpickerdropdown.md +8 -6
- package/docs/API-reference/api/x-components.basecolumnpickerlist.md +7 -5
- package/docs/API-reference/api/x-components.basecurrency.md +4 -4
- package/docs/API-reference/api/x-components.basedropdown.md +12 -12
- package/docs/API-reference/api/x-components.baseeventbutton.md +5 -5
- package/docs/API-reference/api/x-components.baseeventsmodal.md +10 -8
- package/docs/API-reference/api/x-components.baseeventsmodalclose.md +7 -5
- package/docs/API-reference/api/x-components.baseeventsmodalopen.md +7 -5
- package/docs/API-reference/api/x-components.basegrid.md +9 -7
- package/docs/API-reference/api/x-components.baseheadertogglepanel.md +9 -7
- package/docs/API-reference/api/x-components.baseidmodal.md +8 -6
- package/docs/API-reference/api/x-components.baseidmodalclose.md +4 -4
- package/docs/API-reference/api/x-components.baseidmodalopen.md +4 -4
- package/docs/API-reference/api/x-components.baseidtogglepanel.md +8 -6
- package/docs/API-reference/api/x-components.baseidtogglepanelbutton.md +7 -5
- package/docs/API-reference/api/x-components.basekeyboardnavigation.md +6 -6
- package/docs/API-reference/api/x-components.basemodal.md +9 -9
- package/docs/API-reference/api/x-components.basepricefilterlabel.md +6 -4
- package/docs/API-reference/api/x-components.baserating.md +7 -5
- package/docs/API-reference/api/x-components.baseratingfilterlabel.md +7 -5
- package/docs/API-reference/api/x-components.baseresultcurrentprice.md +6 -4
- package/docs/API-reference/api/x-components.baseresultimage.md +9 -9
- package/docs/API-reference/api/x-components.baseresultlink.md +5 -5
- package/docs/API-reference/api/x-components.baseresultpreviousprice.md +5 -3
- package/docs/API-reference/api/x-components.baseresultrating.md +7 -5
- package/docs/API-reference/api/x-components.basescroll.md +7 -7
- package/docs/API-reference/api/x-components.baseslider.md +7 -7
- package/docs/API-reference/api/x-components.basesuggestion.md +8 -6
- package/docs/API-reference/api/x-components.basesuggestions.md +5 -5
- package/docs/API-reference/api/x-components.baseswitch.md +6 -6
- package/docs/API-reference/api/x-components.basetabspanel.md +6 -6
- package/docs/API-reference/api/x-components.baseteleport.md +6 -6
- package/docs/API-reference/api/x-components.basetogglepanel.md +4 -4
- package/docs/API-reference/api/x-components.basevariablecolumngrid.md +7 -5
- package/docs/API-reference/api/x-components.changeheight.md +2 -2
- package/docs/API-reference/api/x-components.clearfilters.md +7 -5
- package/docs/API-reference/api/x-components.clearhistoryqueries.md +3 -1
- package/docs/API-reference/api/x-components.clearsearchinput.md +7 -1
- package/docs/API-reference/api/x-components.closemainmodal.md +3 -1
- package/docs/API-reference/api/x-components.collapseheight.md +5 -5
- package/docs/API-reference/api/x-components.collapsewidth.md +5 -5
- package/docs/API-reference/api/x-components.crossfade.md +4 -4
- package/docs/API-reference/api/x-components.devicedetector.md +9 -5
- package/docs/API-reference/api/x-components.displayclickprovider.md +5 -5
- package/docs/API-reference/api/x-components.displayemitter.md +4 -4
- package/docs/API-reference/api/x-components.editablenumberrangefilter.md +7 -7
- package/docs/API-reference/api/x-components.empathize.md +6 -6
- package/docs/API-reference/api/x-components.excludefilterswithnoresults.md +4 -4
- package/docs/API-reference/api/x-components.experiencecontrols.md +1 -1
- package/docs/API-reference/api/x-components.extraparams.md +3 -3
- package/docs/API-reference/api/x-components.facets.md +5 -5
- package/docs/API-reference/api/x-components.facetsprovider.md +4 -4
- package/docs/API-reference/api/x-components.fade.md +4 -4
- package/docs/API-reference/api/x-components.fadeandslide.md +5 -5
- package/docs/API-reference/api/x-components.fallbackdisclaimer.md +1 -1
- package/docs/API-reference/api/x-components.filterslist.md +5 -5
- package/docs/API-reference/api/x-components.filterssearch.md +6 -6
- package/docs/API-reference/api/x-components.fixedheaderandasideslayout.md +9 -5
- package/docs/API-reference/api/x-components.globalxbus.md +3 -3
- package/docs/API-reference/api/x-components.hierarchicalfilter.md +8 -5
- package/docs/API-reference/api/x-components.highlight_2.md +5 -5
- package/docs/API-reference/api/x-components.historyqueries.md +4 -1
- package/docs/API-reference/api/x-components.historyqueriesswitch.md +3 -1
- package/docs/API-reference/api/x-components.historyquery.md +8 -5
- package/docs/API-reference/api/x-components.identifierresult.md +4 -4
- package/docs/API-reference/api/x-components.identifierresults.md +5 -5
- package/docs/API-reference/api/x-components.itemslist.md +5 -5
- package/docs/API-reference/api/x-components.locationprovider.md +4 -4
- package/docs/API-reference/api/x-components.mainmodal.md +6 -4
- package/docs/API-reference/api/x-components.mainscroll.md +5 -5
- package/docs/API-reference/api/x-components.mainscrollitem.md +6 -6
- package/docs/API-reference/api/x-components.md +1 -0
- package/docs/API-reference/api/x-components.multicolumnmaxwidthlayout.md +9 -5
- package/docs/API-reference/api/x-components.myhistory.md +8 -5
- package/docs/API-reference/api/x-components.nextqueries.md +8 -5
- package/docs/API-reference/api/x-components.nextquerieslist.md +5 -5
- package/docs/API-reference/api/x-components.nextquery.md +7 -5
- package/docs/API-reference/api/x-components.nextquerypreview.md +4 -4
- package/docs/API-reference/api/x-components.noanimation.md +2 -2
- package/docs/API-reference/api/x-components.numberrangefilter.md +7 -5
- package/docs/API-reference/api/x-components.openmainmodal.md +3 -1
- package/docs/API-reference/api/x-components.pageloaderbutton.md +7 -5
- package/docs/API-reference/api/x-components.pageselector.md +5 -5
- package/docs/API-reference/api/x-components.partialquerybutton.md +5 -5
- package/docs/API-reference/api/x-components.partialresultslist.md +5 -5
- package/docs/API-reference/api/x-components.popularsearch.md +6 -4
- package/docs/API-reference/api/x-components.popularsearches.md +4 -1
- package/docs/API-reference/api/x-components.preselectedfilters.md +5 -5
- package/docs/API-reference/api/x-components.promoted.md +4 -4
- package/docs/API-reference/api/x-components.promotedslist.md +5 -5
- package/docs/API-reference/api/x-components.querypreview.md +6 -6
- package/docs/API-reference/api/x-components.querypreviewbutton.md +6 -4
- package/docs/API-reference/api/x-components.querypreviewlist.md +8 -6
- package/docs/API-reference/api/x-components.querysuggestion.md +6 -4
- package/docs/API-reference/api/x-components.querysuggestions.md +4 -1
- package/docs/API-reference/api/x-components.recommendations.md +5 -5
- package/docs/API-reference/api/x-components.redirection.md +6 -6
- package/docs/API-reference/api/x-components.relatedprompt.md +9 -4
- package/docs/API-reference/api/x-components.relatedpromptslist.md +5 -5
- package/docs/API-reference/api/x-components.relatedpromptstaglist.md +11 -7
- package/docs/API-reference/api/x-components.relatedtag.md +6 -6
- package/docs/API-reference/api/x-components.relatedtags.md +7 -5
- package/docs/API-reference/api/x-components.removehistoryquery.md +6 -4
- package/docs/API-reference/api/x-components.renderlessextraparams.md +4 -4
- package/docs/API-reference/api/x-components.renderlessfilter.md +5 -5
- package/docs/API-reference/api/x-components.resultslist.md +6 -6
- package/docs/API-reference/api/x-components.resultvariantselector.md +6 -6
- package/docs/API-reference/api/x-components.resultvariantsprovider.md +5 -5
- package/docs/API-reference/api/x-components.scroll.md +8 -6
- package/docs/API-reference/api/x-components.scrolltotop.md +7 -5
- package/docs/API-reference/api/x-components.searchbutton.md +2 -2
- package/docs/API-reference/api/x-components.searchinput.md +6 -6
- package/docs/API-reference/api/x-components.searchinputplaceholder.md +6 -6
- package/docs/API-reference/api/x-components.selectedfilters.md +5 -5
- package/docs/API-reference/api/x-components.selectedfilterslist.md +7 -5
- package/docs/API-reference/api/x-components.semanticqueries.md +4 -1
- package/docs/API-reference/api/x-components.semanticquery.md +6 -4
- package/docs/API-reference/api/x-components.simplefilter.md +7 -5
- package/docs/API-reference/api/x-components.singlecolumnlayout.md +10 -5
- package/docs/API-reference/api/x-components.slicedfilters.md +6 -6
- package/docs/API-reference/api/x-components.slidingpanel.md +8 -8
- package/docs/API-reference/api/x-components.snippetcallbacks.md +3 -1
- package/docs/API-reference/api/x-components.snippetconfigextraparams.md +8 -6
- package/docs/API-reference/api/x-components.sortdropdown.md +8 -6
- package/docs/API-reference/api/x-components.sortedfilters.md +4 -4
- package/docs/API-reference/api/x-components.sortlist.md +7 -5
- package/docs/API-reference/api/x-components.sortpickerlist.md +7 -5
- package/docs/API-reference/api/x-components.spellcheck.md +1 -1
- package/docs/API-reference/api/x-components.spellcheckbutton.md +2 -2
- package/docs/API-reference/api/x-components.staggeredfadeandslide.md +5 -5
- package/docs/API-reference/api/x-components.tagging.md +4 -4
- package/docs/API-reference/api/x-components.typinghtmlelement.__timeoutid.md +11 -0
- package/docs/API-reference/api/x-components.typinghtmlelement.md +19 -0
- package/docs/API-reference/api/x-components.urlhandler.md +5 -1
- package/js/components/animations/animate-scale/animate-scale.style.scss.js +1 -1
- package/js/components/animations/animate-width.vue.js.map +1 -1
- package/js/components/animations/collapse-height.vue.js.map +1 -1
- package/js/components/animations/collapse-width.vue.js.map +1 -1
- package/js/components/animations/cross-fade.vue.js.map +1 -1
- package/js/components/animations/fade-and-slide.vue.js.map +1 -1
- package/js/components/animations/fade.vue.js.map +1 -1
- package/js/components/animations/staggered-fade-and-slide.vue.js.map +1 -1
- package/js/components/auto-progress-bar.vue.js.map +1 -1
- package/js/components/base-dropdown.vue.js.map +1 -1
- package/js/components/base-grid.vue.js.map +1 -1
- package/js/components/base-keyboard-navigation.vue.js.map +1 -1
- package/js/components/base-rating.vue.js.map +1 -1
- package/js/components/base-rating.vue3.js +1 -1
- package/js/components/base-slider.vue.js +16 -18
- package/js/components/base-slider.vue.js.map +1 -1
- package/js/components/base-switch.vue.js +10 -13
- package/js/components/base-switch.vue.js.map +1 -1
- package/js/components/base-teleport.vue.js.map +1 -1
- package/js/components/base-variable-column-grid.vue.js.map +1 -1
- package/js/components/column-picker/base-column-picker-dropdown.vue.js.map +1 -1
- package/js/components/column-picker/base-column-picker-list.vue.js.map +1 -1
- package/js/components/currency/base-currency.vue.js.map +1 -1
- package/js/components/filters/labels/base-rating-filter-label.vue.js.map +1 -1
- package/js/components/highlight.vue.js.map +1 -1
- package/js/components/icons/ai-star.vue.js +19 -22
- package/js/components/icons/ai-star.vue.js.map +1 -1
- package/js/components/icons/arrow-down.vue.js +16 -19
- package/js/components/icons/arrow-down.vue.js.map +1 -1
- package/js/components/icons/arrow-left.vue.js +16 -19
- package/js/components/icons/arrow-left.vue.js.map +1 -1
- package/js/components/icons/arrow-right.vue.js +16 -19
- package/js/components/icons/arrow-right.vue.js.map +1 -1
- package/js/components/icons/arrow-up.vue.js +16 -19
- package/js/components/icons/arrow-up.vue.js.map +1 -1
- package/js/components/icons/bag.vue.js +16 -19
- package/js/components/icons/bag.vue.js.map +1 -1
- package/js/components/icons/bar-code.vue.js +8 -10
- package/js/components/icons/bar-code.vue.js.map +1 -1
- package/js/components/icons/barcode-tiny.vue.js +8 -10
- package/js/components/icons/barcode-tiny.vue.js.map +1 -1
- package/js/components/icons/cart-filled.vue.js +21 -25
- package/js/components/icons/cart-filled.vue.js.map +1 -1
- package/js/components/icons/cart.vue.js +16 -19
- package/js/components/icons/cart.vue.js.map +1 -1
- package/js/components/icons/check-tiny.vue.js +9 -11
- package/js/components/icons/check-tiny.vue.js.map +1 -1
- package/js/components/icons/check.vue.js +9 -11
- package/js/components/icons/check.vue.js.map +1 -1
- package/js/components/icons/checkbox-selected-filled.vue.js +20 -23
- package/js/components/icons/checkbox-selected-filled.vue.js.map +1 -1
- package/js/components/icons/checkbox-selected.vue.js +19 -22
- package/js/components/icons/checkbox-selected.vue.js.map +1 -1
- package/js/components/icons/checkbox-unselected-filled.vue.js +13 -15
- package/js/components/icons/checkbox-unselected-filled.vue.js.map +1 -1
- package/js/components/icons/checkbox-unselected.vue.js +12 -14
- package/js/components/icons/checkbox-unselected.vue.js.map +1 -1
- package/js/components/icons/chevron-down.vue.js +9 -11
- package/js/components/icons/chevron-down.vue.js.map +1 -1
- package/js/components/icons/chevron-left.vue.js +9 -11
- package/js/components/icons/chevron-left.vue.js.map +1 -1
- package/js/components/icons/chevron-right.vue.js +9 -11
- package/js/components/icons/chevron-right.vue.js.map +1 -1
- package/js/components/icons/chevron-tiny-down.vue.js +9 -11
- package/js/components/icons/chevron-tiny-down.vue.js.map +1 -1
- package/js/components/icons/chevron-tiny-left.vue.js +9 -11
- package/js/components/icons/chevron-tiny-left.vue.js.map +1 -1
- package/js/components/icons/chevron-tiny-right.vue.js +9 -11
- package/js/components/icons/chevron-tiny-right.vue.js.map +1 -1
- package/js/components/icons/chevron-tiny-up.vue.js +9 -11
- package/js/components/icons/chevron-tiny-up.vue.js.map +1 -1
- package/js/components/icons/chevron-up.vue.js +9 -11
- package/js/components/icons/chevron-up.vue.js.map +1 -1
- package/js/components/icons/corner-arrow-left.vue.js +9 -11
- package/js/components/icons/corner-arrow-left.vue.js.map +1 -1
- package/js/components/icons/corner-arrow-right.vue.js +9 -11
- package/js/components/icons/corner-arrow-right.vue.js.map +1 -1
- package/js/components/icons/cross-tiny.vue.js +9 -11
- package/js/components/icons/cross-tiny.vue.js.map +1 -1
- package/js/components/icons/cross.vue.js +9 -11
- package/js/components/icons/cross.vue.js.map +1 -1
- package/js/components/icons/curated-check-filled.vue.js +19 -22
- package/js/components/icons/curated-check-filled.vue.js.map +1 -1
- package/js/components/icons/curated-check-tiny-filled.vue.js +19 -22
- package/js/components/icons/curated-check-tiny-filled.vue.js.map +1 -1
- package/js/components/icons/curated-check-tiny.vue.js +18 -21
- package/js/components/icons/curated-check-tiny.vue.js.map +1 -1
- package/js/components/icons/curated-check.vue.js +18 -21
- package/js/components/icons/curated-check.vue.js.map +1 -1
- package/js/components/icons/diagonal-arrow-left-down.vue.js +9 -11
- package/js/components/icons/diagonal-arrow-left-down.vue.js.map +1 -1
- package/js/components/icons/diagonal-arrow-left-top.vue.js +9 -11
- package/js/components/icons/diagonal-arrow-left-top.vue.js.map +1 -1
- package/js/components/icons/diagonal-arrow-right-down.vue.js +9 -11
- package/js/components/icons/diagonal-arrow-right-down.vue.js.map +1 -1
- package/js/components/icons/diagonal-arrow-right-top.vue.js +9 -11
- package/js/components/icons/diagonal-arrow-right-top.vue.js.map +1 -1
- package/js/components/icons/filters.vue.js +8 -10
- package/js/components/icons/filters.vue.js.map +1 -1
- package/js/components/icons/grid-1-col.vue.js +8 -10
- package/js/components/icons/grid-1-col.vue.js.map +1 -1
- package/js/components/icons/grid-2-col.vue.js +8 -10
- package/js/components/icons/grid-2-col.vue.js.map +1 -1
- package/js/components/icons/grid-2-rows.vue.js +19 -22
- package/js/components/icons/grid-2-rows.vue.js.map +1 -1
- package/js/components/icons/grid-4-col.vue.js +8 -10
- package/js/components/icons/grid-4-col.vue.js.map +1 -1
- package/js/components/icons/heart-filled.vue.js +10 -12
- package/js/components/icons/heart-filled.vue.js.map +1 -1
- package/js/components/icons/heart.vue.js +9 -11
- package/js/components/icons/heart.vue.js.map +1 -1
- package/js/components/icons/hide.vue.js +9 -11
- package/js/components/icons/hide.vue.js.map +1 -1
- package/js/components/icons/history-tiny.vue.js +16 -19
- package/js/components/icons/history-tiny.vue.js.map +1 -1
- package/js/components/icons/history.vue.js +16 -19
- package/js/components/icons/history.vue.js.map +1 -1
- package/js/components/icons/light-bulb-off.vue.js +14 -17
- package/js/components/icons/light-bulb-off.vue.js.map +1 -1
- package/js/components/icons/light-bulb-on.vue.js +20 -24
- package/js/components/icons/light-bulb-on.vue.js.map +1 -1
- package/js/components/icons/menu.vue.js +9 -11
- package/js/components/icons/menu.vue.js.map +1 -1
- package/js/components/icons/minus-tiny.vue.js +9 -11
- package/js/components/icons/minus-tiny.vue.js.map +1 -1
- package/js/components/icons/minus.vue.js +9 -11
- package/js/components/icons/minus.vue.js.map +1 -1
- package/js/components/icons/plus-tiny.vue.js +9 -11
- package/js/components/icons/plus-tiny.vue.js.map +1 -1
- package/js/components/icons/plus.vue.js +9 -11
- package/js/components/icons/plus.vue.js.map +1 -1
- package/js/components/icons/radiobutton-selected.vue.js +3 -5
- package/js/components/icons/radiobutton-selected.vue.js.map +1 -1
- package/js/components/icons/radiobutton-unselected.vue.js +20 -23
- package/js/components/icons/radiobutton-unselected.vue.js.map +1 -1
- package/js/components/icons/search-tiny.vue.js +9 -11
- package/js/components/icons/search-tiny.vue.js.map +1 -1
- package/js/components/icons/search.vue.js +9 -11
- package/js/components/icons/search.vue.js.map +1 -1
- package/js/components/icons/settings.vue.js +3 -5
- package/js/components/icons/settings.vue.js.map +1 -1
- package/js/components/icons/show.vue.js +18 -21
- package/js/components/icons/show.vue.js.map +1 -1
- package/js/components/icons/sort-az.vue.js +31 -36
- package/js/components/icons/sort-az.vue.js.map +1 -1
- package/js/components/icons/sort-price-down.vue.js +3 -5
- package/js/components/icons/sort-price-down.vue.js.map +1 -1
- package/js/components/icons/sort-price-up.vue.js +3 -5
- package/js/components/icons/sort-price-up.vue.js.map +1 -1
- package/js/components/icons/sort-relevancy.vue.js +23 -27
- package/js/components/icons/sort-relevancy.vue.js.map +1 -1
- package/js/components/icons/sort-za.vue.js +31 -36
- package/js/components/icons/sort-za.vue.js.map +1 -1
- package/js/components/icons/spinner.vue.js +3 -5
- package/js/components/icons/spinner.vue.js.map +1 -1
- package/js/components/icons/star-filled.vue.js +23 -26
- package/js/components/icons/star-filled.vue.js.map +1 -1
- package/js/components/icons/star.vue.js +11 -13
- package/js/components/icons/star.vue.js.map +1 -1
- package/js/components/icons/tag-filled.vue.js +17 -20
- package/js/components/icons/tag-filled.vue.js.map +1 -1
- package/js/components/icons/tag.vue.js +16 -19
- package/js/components/icons/tag.vue.js.map +1 -1
- package/js/components/icons/trash-open.vue.js +3 -5
- package/js/components/icons/trash-open.vue.js.map +1 -1
- package/js/components/icons/trash.vue.js +3 -5
- package/js/components/icons/trash.vue.js.map +1 -1
- package/js/components/icons/trending-tiny.vue.js +16 -19
- package/js/components/icons/trending-tiny.vue.js.map +1 -1
- package/js/components/icons/trending.vue.js +16 -19
- package/js/components/icons/trending.vue.js.map +1 -1
- package/js/components/icons/user-filled.vue.js +13 -16
- package/js/components/icons/user-filled.vue.js.map +1 -1
- package/js/components/icons/user.vue.js +9 -11
- package/js/components/icons/user.vue.js.map +1 -1
- package/js/components/items-list.vue.js.map +1 -1
- package/js/components/layouts/fixed-header-and-asides-layout.vue.js.map +1 -1
- package/js/components/layouts/multi-column-max-width-layout.vue.js.map +1 -1
- package/js/components/layouts/single-column-layout.vue.js.map +1 -1
- package/js/components/modals/base-events-modal-close.vue.js.map +1 -1
- package/js/components/modals/base-events-modal-open.vue.js.map +1 -1
- package/js/components/modals/base-events-modal.vue.js.map +1 -1
- package/js/components/modals/base-id-modal.vue.js.map +1 -1
- package/js/components/modals/base-modal.vue.js.map +1 -1
- package/js/components/modals/close-main-modal.vue.js.map +1 -1
- package/js/components/modals/main-modal.vue.js.map +1 -1
- package/js/components/modals/open-main-modal.vue.js.map +1 -1
- package/js/components/page-loader-button.vue.js +5 -1
- package/js/components/page-loader-button.vue.js.map +1 -1
- package/js/components/page-selector.vue.js +10 -2
- package/js/components/page-selector.vue.js.map +1 -1
- package/js/components/panels/base-header-toggle-panel.vue.js.map +1 -1
- package/js/components/panels/base-id-toggle-panel-button.vue.js.map +1 -1
- package/js/components/panels/base-id-toggle-panel.vue.js.map +1 -1
- package/js/components/panels/base-tabs-panel.vue.js.map +1 -1
- package/js/components/panels/base-toggle-panel.vue.js.map +1 -1
- package/js/components/result/base-result-add-to-cart.vue.js.map +1 -1
- package/js/components/result/base-result-current-price.vue.js.map +1 -1
- package/js/components/result/base-result-fallback-image.vue.js +15 -18
- package/js/components/result/base-result-fallback-image.vue.js.map +1 -1
- package/js/components/result/base-result-image.vue.js.map +1 -1
- package/js/components/result/base-result-link.vue.js.map +1 -1
- package/js/components/result/base-result-placeholder-image.vue.js +14 -17
- package/js/components/result/base-result-placeholder-image.vue.js.map +1 -1
- package/js/components/result/base-result-previous-price.vue.js.map +1 -1
- package/js/components/result/base-result-rating.vue.js.map +1 -1
- package/js/components/result/result-variant-selector.vue.js.map +1 -1
- package/js/components/sliding-panel.vue.js +10 -2
- package/js/components/sliding-panel.vue.js.map +1 -1
- package/js/components/sliding-panel.vue3.js +1 -1
- package/js/components/suggestions/base-suggestion.vue.js.map +1 -1
- package/js/components/suggestions/base-suggestions.vue.js.map +1 -1
- package/js/composables/use-on-display.js +1 -1
- package/js/composables/use-on-display.js.map +1 -1
- package/js/directives/infinite-scroll.js +1 -1
- package/js/directives/infinite-scroll.js.map +1 -1
- package/js/directives/typing.js.map +1 -1
- package/js/x-modules/ai/components/ai-overview.vue.js +25 -26
- package/js/x-modules/ai/components/ai-overview.vue.js.map +1 -1
- package/js/x-modules/device/components/device-detector.vue.js.map +1 -1
- package/js/x-modules/empathize/components/empathize.vue.js.map +1 -1
- package/js/x-modules/facets/components/clear-filters.vue.js.map +1 -1
- package/js/x-modules/facets/components/facets/facets.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/all-filter.vue.js +5 -1
- package/js/x-modules/facets/components/filters/all-filter.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/editable-number-range-filter.vue.js +10 -2
- package/js/x-modules/facets/components/filters/editable-number-range-filter.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/hierarchical-filter.vue.js +3 -3
- package/js/x-modules/facets/components/filters/hierarchical-filter.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/number-range-filter.vue.js.map +1 -1
- package/js/x-modules/facets/components/filters/simple-filter.vue.js.map +1 -1
- package/js/x-modules/facets/components/lists/filters-list.vue.js.map +1 -1
- package/js/x-modules/facets/components/lists/filters-search.vue.js.map +1 -1
- package/js/x-modules/facets/components/lists/filters-search.vue3.js +1 -1
- package/js/x-modules/facets/components/lists/selected-filters-list.vue.js.map +1 -1
- package/js/x-modules/facets/components/lists/sliced-filters.vue.js +20 -4
- package/js/x-modules/facets/components/lists/sliced-filters.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/clear-history-queries.vue.js +5 -1
- package/js/x-modules/history-queries/components/clear-history-queries.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/history-queries.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/history-query.vue.js +5 -1
- package/js/x-modules/history-queries/components/history-query.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/my-history.vue.js +3 -3
- package/js/x-modules/history-queries/components/my-history.vue.js.map +1 -1
- package/js/x-modules/history-queries/components/remove-history-query.vue.js.map +1 -1
- package/js/x-modules/identifier-results/components/identifier-result.vue.js.map +1 -1
- package/js/x-modules/identifier-results/components/identifier-results.vue.js.map +1 -1
- package/js/x-modules/next-queries/components/next-queries.vue.js.map +1 -1
- package/js/x-modules/next-queries/components/next-query-preview.vue.js.map +1 -1
- package/js/x-modules/next-queries/components/next-query.vue.js.map +1 -1
- package/js/x-modules/popular-searches/components/popular-search.vue.js.map +1 -1
- package/js/x-modules/popular-searches/components/popular-searches.vue.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview-button.vue.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview-list.vue.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview.vue.js.map +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestion.vue.js.map +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestions.vue.js.map +1 -1
- package/js/x-modules/recommendations/components/recommendations.vue.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompt.vue.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue.js.map +1 -1
- package/js/x-modules/related-tags/components/related-tag.vue.js.map +1 -1
- package/js/x-modules/related-tags/components/related-tags.vue.js +3 -3
- package/js/x-modules/related-tags/components/related-tags.vue.js.map +1 -1
- package/js/x-modules/scroll/components/main-scroll-item.vue.js.map +1 -1
- package/js/x-modules/scroll/components/scroll-to-top.vue.js.map +1 -1
- package/js/x-modules/scroll/components/scroll.vue.js.map +1 -1
- package/js/x-modules/search/components/banner.vue.js.map +1 -1
- package/js/x-modules/search/components/fallback-disclaimer.vue.js.map +1 -1
- package/js/x-modules/search/components/partial-query-button.vue.js.map +1 -1
- package/js/x-modules/search/components/partial-results-list.vue.js.map +1 -1
- package/js/x-modules/search/components/promoted.vue.js.map +1 -1
- package/js/x-modules/search/components/redirection.vue.js.map +1 -1
- package/js/x-modules/search/components/sort-dropdown.vue.js.map +1 -1
- package/js/x-modules/search/components/sort-list.vue.js.map +1 -1
- package/js/x-modules/search/components/sort-picker-list.vue.js.map +1 -1
- package/js/x-modules/search/components/spellcheck-button.vue.js.map +1 -1
- package/js/x-modules/search/components/spellcheck.vue.js.map +1 -1
- package/js/x-modules/search-box/components/clear-search-input.vue.js +5 -1
- package/js/x-modules/search-box/components/clear-search-input.vue.js.map +1 -1
- package/js/x-modules/search-box/components/search-button.vue.js +7 -8
- package/js/x-modules/search-box/components/search-button.vue.js.map +1 -1
- package/js/x-modules/search-box/components/search-input-placeholder.vue.js.map +1 -1
- package/js/x-modules/search-box/components/search-input.vue.js.map +1 -1
- package/js/x-modules/semantic-queries/components/semantic-queries.vue.js +3 -3
- package/js/x-modules/semantic-queries/components/semantic-queries.vue.js.map +1 -1
- package/js/x-modules/semantic-queries/components/semantic-query.vue.js.map +1 -1
- package/package.json +11 -11
- package/report/x-components.api.json +6216 -1603
- package/report/x-components.api.md +819 -647
- package/types/components/animations/animate-width.vue.d.ts +1 -1
- package/types/components/animations/change-height.vue.d.ts +2 -2
- package/types/components/animations/collapse-height.vue.d.ts +5 -5
- package/types/components/animations/collapse-width.vue.d.ts +5 -5
- package/types/components/animations/cross-fade.vue.d.ts +4 -4
- package/types/components/animations/fade-and-slide.vue.d.ts +5 -5
- package/types/components/animations/fade.vue.d.ts +4 -4
- package/types/components/animations/no-animation.vue.d.ts +2 -2
- package/types/components/animations/staggered-fade-and-slide.vue.d.ts +5 -5
- package/types/components/animations/staggered-fade-and-slide.vue.d.ts.map +1 -1
- package/types/components/auto-progress-bar.vue.d.ts +5 -5
- package/types/components/base-dropdown.vue.d.ts +12 -12
- package/types/components/base-event-button.vue.d.ts +5 -5
- package/types/components/base-grid.vue.d.ts +9 -7
- package/types/components/base-grid.vue.d.ts.map +1 -1
- package/types/components/base-keyboard-navigation.vue.d.ts +6 -6
- package/types/components/base-rating.vue.d.ts +7 -5
- package/types/components/base-rating.vue.d.ts.map +1 -1
- package/types/components/base-slider.vue.d.ts +7 -7
- package/types/components/base-switch.vue.d.ts +6 -6
- package/types/components/base-teleport.vue.d.ts +6 -6
- package/types/components/base-variable-column-grid.vue.d.ts +7 -5
- package/types/components/base-variable-column-grid.vue.d.ts.map +1 -1
- package/types/components/column-picker/base-column-picker-dropdown.vue.d.ts +8 -6
- package/types/components/column-picker/base-column-picker-dropdown.vue.d.ts.map +1 -1
- package/types/components/column-picker/base-column-picker-list.vue.d.ts +7 -5
- package/types/components/column-picker/base-column-picker-list.vue.d.ts.map +1 -1
- package/types/components/currency/base-currency.vue.d.ts +4 -4
- package/types/components/display-click-provider.vue.d.ts +5 -5
- package/types/components/display-emitter.vue.d.ts +4 -4
- package/types/components/filters/labels/base-price-filter-label.vue.d.ts +6 -4
- package/types/components/filters/labels/base-price-filter-label.vue.d.ts.map +1 -1
- package/types/components/filters/labels/base-rating-filter-label.vue.d.ts +7 -5
- package/types/components/filters/labels/base-rating-filter-label.vue.d.ts.map +1 -1
- package/types/components/global-x-bus.vue.d.ts +3 -3
- package/types/components/highlight.vue.d.ts +5 -5
- package/types/components/items-list.vue.d.ts +5 -5
- package/types/components/layouts/fixed-header-and-asides-layout.vue.d.ts +9 -5
- package/types/components/layouts/fixed-header-and-asides-layout.vue.d.ts.map +1 -1
- package/types/components/layouts/multi-column-max-width-layout.vue.d.ts +9 -5
- package/types/components/layouts/multi-column-max-width-layout.vue.d.ts.map +1 -1
- package/types/components/layouts/single-column-layout.vue.d.ts +10 -5
- package/types/components/layouts/single-column-layout.vue.d.ts.map +1 -1
- package/types/components/location-provider.vue.d.ts +4 -4
- package/types/components/modals/base-events-modal-close.vue.d.ts +7 -5
- package/types/components/modals/base-events-modal-close.vue.d.ts.map +1 -1
- package/types/components/modals/base-events-modal-open.vue.d.ts +7 -5
- package/types/components/modals/base-events-modal-open.vue.d.ts.map +1 -1
- package/types/components/modals/base-events-modal.vue.d.ts +10 -8
- package/types/components/modals/base-events-modal.vue.d.ts.map +1 -1
- package/types/components/modals/base-id-modal-close.vue.d.ts +4 -4
- package/types/components/modals/base-id-modal-open.vue.d.ts +4 -4
- package/types/components/modals/base-id-modal.vue.d.ts +8 -6
- package/types/components/modals/base-id-modal.vue.d.ts.map +1 -1
- package/types/components/modals/base-modal.vue.d.ts +9 -9
- package/types/components/modals/close-main-modal.vue.d.ts +3 -1
- package/types/components/modals/close-main-modal.vue.d.ts.map +1 -1
- package/types/components/modals/main-modal.vue.d.ts +6 -4
- package/types/components/modals/main-modal.vue.d.ts.map +1 -1
- package/types/components/modals/open-main-modal.vue.d.ts +3 -1
- package/types/components/modals/open-main-modal.vue.d.ts.map +1 -1
- package/types/components/page-loader-button.vue.d.ts +7 -5
- package/types/components/page-loader-button.vue.d.ts.map +1 -1
- package/types/components/page-selector.vue.d.ts +5 -5
- package/types/components/panels/base-header-toggle-panel.vue.d.ts +9 -7
- package/types/components/panels/base-header-toggle-panel.vue.d.ts.map +1 -1
- package/types/components/panels/base-id-toggle-panel-button.vue.d.ts +7 -5
- package/types/components/panels/base-id-toggle-panel-button.vue.d.ts.map +1 -1
- package/types/components/panels/base-id-toggle-panel.vue.d.ts +8 -6
- package/types/components/panels/base-id-toggle-panel.vue.d.ts.map +1 -1
- package/types/components/panels/base-tabs-panel.vue.d.ts +6 -6
- package/types/components/panels/base-toggle-panel.vue.d.ts +4 -4
- package/types/components/result/base-result-add-to-cart.vue.d.ts +6 -4
- package/types/components/result/base-result-add-to-cart.vue.d.ts.map +1 -1
- package/types/components/result/base-result-current-price.vue.d.ts +6 -4
- package/types/components/result/base-result-current-price.vue.d.ts.map +1 -1
- package/types/components/result/base-result-image.vue.d.ts +9 -9
- package/types/components/result/base-result-link.vue.d.ts +5 -5
- package/types/components/result/base-result-previous-price.vue.d.ts +5 -3
- package/types/components/result/base-result-previous-price.vue.d.ts.map +1 -1
- package/types/components/result/base-result-rating.vue.d.ts +7 -5
- package/types/components/result/base-result-rating.vue.d.ts.map +1 -1
- package/types/components/result/result-variant-selector.vue.d.ts +6 -6
- package/types/components/result/result-variants-provider.vue.d.ts +5 -5
- package/types/components/scroll/base-scroll.vue.d.ts +7 -7
- package/types/components/sliding-panel.vue.d.ts +8 -8
- package/types/components/snippet-callbacks.vue.d.ts +3 -1
- package/types/components/snippet-callbacks.vue.d.ts.map +1 -1
- package/types/components/suggestions/base-suggestion.vue.d.ts +8 -6
- package/types/components/suggestions/base-suggestion.vue.d.ts.map +1 -1
- package/types/components/suggestions/base-suggestions.vue.d.ts +5 -5
- package/types/directives/infinite-scroll.d.ts.map +1 -1
- package/types/directives/typing.d.ts +1 -2
- package/types/directives/typing.d.ts.map +1 -1
- package/types/x-modules/ai/components/ai-overview.vue.d.ts +22 -8
- package/types/x-modules/ai/components/ai-overview.vue.d.ts.map +1 -1
- package/types/x-modules/device/components/device-detector.vue.d.ts +9 -5
- package/types/x-modules/device/components/device-detector.vue.d.ts.map +1 -1
- package/types/x-modules/empathize/components/empathize.vue.d.ts +6 -6
- package/types/x-modules/experience-controls/components/experience-controls.vue.d.ts +1 -1
- package/types/x-modules/extra-params/components/extra-params.vue.d.ts +3 -3
- package/types/x-modules/extra-params/components/renderless-extra-param.vue.d.ts +4 -4
- package/types/x-modules/extra-params/components/snippet-config-extra-params.vue.d.ts +8 -6
- package/types/x-modules/extra-params/components/snippet-config-extra-params.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/clear-filters.vue.d.ts +7 -5
- package/types/x-modules/facets/components/clear-filters.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/facets/facets-provider.vue.d.ts +4 -4
- package/types/x-modules/facets/components/facets/facets.vue.d.ts +5 -5
- package/types/x-modules/facets/components/filters/all-filter.vue.d.ts +6 -4
- package/types/x-modules/facets/components/filters/all-filter.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/filters/editable-number-range-filter.vue.d.ts +7 -7
- package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts +8 -5
- package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/filters/number-range-filter.vue.d.ts +7 -5
- package/types/x-modules/facets/components/filters/number-range-filter.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/filters/renderless-filter.vue.d.ts +5 -5
- package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts +7 -5
- package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/lists/exclude-filters-with-no-results.vue.d.ts +4 -4
- package/types/x-modules/facets/components/lists/filters-list.vue.d.ts +5 -5
- package/types/x-modules/facets/components/lists/filters-search.vue.d.ts +6 -6
- package/types/x-modules/facets/components/lists/selected-filters-list.vue.d.ts +7 -5
- package/types/x-modules/facets/components/lists/selected-filters-list.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/lists/selected-filters.vue.d.ts +5 -5
- package/types/x-modules/facets/components/lists/sliced-filters.vue.d.ts +6 -6
- package/types/x-modules/facets/components/lists/sorted-filters.vue.d.ts +4 -4
- package/types/x-modules/facets/components/preselected-filters.vue.d.ts +5 -5
- package/types/x-modules/history-queries/components/clear-history-queries.vue.d.ts +3 -1
- package/types/x-modules/history-queries/components/clear-history-queries.vue.d.ts.map +1 -1
- package/types/x-modules/history-queries/components/history-queries-switch.vue.d.ts +3 -1
- package/types/x-modules/history-queries/components/history-queries-switch.vue.d.ts.map +1 -1
- package/types/x-modules/history-queries/components/history-queries.vue.d.ts +4 -1
- package/types/x-modules/history-queries/components/history-queries.vue.d.ts.map +1 -1
- package/types/x-modules/history-queries/components/history-query.vue.d.ts +8 -5
- package/types/x-modules/history-queries/components/history-query.vue.d.ts.map +1 -1
- package/types/x-modules/history-queries/components/my-history.vue.d.ts +8 -5
- package/types/x-modules/history-queries/components/my-history.vue.d.ts.map +1 -1
- package/types/x-modules/history-queries/components/remove-history-query.vue.d.ts +6 -4
- package/types/x-modules/history-queries/components/remove-history-query.vue.d.ts.map +1 -1
- package/types/x-modules/identifier-results/components/identifier-result.vue.d.ts +4 -4
- package/types/x-modules/identifier-results/components/identifier-results.vue.d.ts +5 -5
- package/types/x-modules/next-queries/components/next-queries-list.vue.d.ts +5 -5
- package/types/x-modules/next-queries/components/next-queries.vue.d.ts +8 -5
- package/types/x-modules/next-queries/components/next-queries.vue.d.ts.map +1 -1
- package/types/x-modules/next-queries/components/next-query-preview.vue.d.ts +4 -4
- package/types/x-modules/next-queries/components/next-query.vue.d.ts +7 -5
- package/types/x-modules/next-queries/components/next-query.vue.d.ts.map +1 -1
- package/types/x-modules/popular-searches/components/popular-search.vue.d.ts +6 -4
- package/types/x-modules/popular-searches/components/popular-search.vue.d.ts.map +1 -1
- package/types/x-modules/popular-searches/components/popular-searches.vue.d.ts +4 -1
- package/types/x-modules/popular-searches/components/popular-searches.vue.d.ts.map +1 -1
- package/types/x-modules/queries-preview/components/query-preview-button.vue.d.ts +6 -4
- package/types/x-modules/queries-preview/components/query-preview-button.vue.d.ts.map +1 -1
- package/types/x-modules/queries-preview/components/query-preview-list.vue.d.ts +8 -6
- package/types/x-modules/queries-preview/components/query-preview-list.vue.d.ts.map +1 -1
- package/types/x-modules/queries-preview/components/query-preview.vue.d.ts +6 -6
- package/types/x-modules/query-suggestions/components/query-suggestion.vue.d.ts +6 -4
- package/types/x-modules/query-suggestions/components/query-suggestion.vue.d.ts.map +1 -1
- package/types/x-modules/query-suggestions/components/query-suggestions.vue.d.ts +4 -1
- package/types/x-modules/query-suggestions/components/query-suggestions.vue.d.ts.map +1 -1
- package/types/x-modules/recommendations/components/recommendations.vue.d.ts +5 -5
- package/types/x-modules/related-prompts/components/related-prompt.vue.d.ts +9 -4
- package/types/x-modules/related-prompts/components/related-prompt.vue.d.ts.map +1 -1
- package/types/x-modules/related-prompts/components/related-prompts-list.vue.d.ts +5 -5
- package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts +11 -7
- package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts.map +1 -1
- package/types/x-modules/related-tags/components/related-tag.vue.d.ts +6 -6
- package/types/x-modules/related-tags/components/related-tags.vue.d.ts +7 -5
- package/types/x-modules/related-tags/components/related-tags.vue.d.ts.map +1 -1
- package/types/x-modules/scroll/components/main-scroll-item.vue.d.ts +6 -6
- package/types/x-modules/scroll/components/main-scroll.vue.d.ts +5 -5
- package/types/x-modules/scroll/components/scroll-to-top.vue.d.ts +7 -5
- package/types/x-modules/scroll/components/scroll-to-top.vue.d.ts.map +1 -1
- package/types/x-modules/scroll/components/scroll.vue.d.ts +8 -6
- package/types/x-modules/scroll/components/scroll.vue.d.ts.map +1 -1
- package/types/x-modules/search/components/banner.vue.d.ts +5 -5
- package/types/x-modules/search/components/banners-list.vue.d.ts +5 -5
- package/types/x-modules/search/components/fallback-disclaimer.vue.d.ts +1 -1
- package/types/x-modules/search/components/partial-query-button.vue.d.ts +5 -5
- package/types/x-modules/search/components/partial-results-list.vue.d.ts +5 -5
- package/types/x-modules/search/components/promoted.vue.d.ts +4 -4
- package/types/x-modules/search/components/promoteds-list.vue.d.ts +5 -5
- package/types/x-modules/search/components/redirection.vue.d.ts +6 -6
- package/types/x-modules/search/components/results-list.vue.d.ts +6 -6
- package/types/x-modules/search/components/sort-dropdown.vue.d.ts +8 -6
- package/types/x-modules/search/components/sort-dropdown.vue.d.ts.map +1 -1
- package/types/x-modules/search/components/sort-list.vue.d.ts +7 -5
- package/types/x-modules/search/components/sort-list.vue.d.ts.map +1 -1
- package/types/x-modules/search/components/sort-picker-list.vue.d.ts +7 -5
- package/types/x-modules/search/components/sort-picker-list.vue.d.ts.map +1 -1
- package/types/x-modules/search/components/spellcheck-button.vue.d.ts +2 -2
- package/types/x-modules/search/components/spellcheck.vue.d.ts +1 -1
- package/types/x-modules/search-box/components/clear-search-input.vue.d.ts +7 -1
- package/types/x-modules/search-box/components/clear-search-input.vue.d.ts.map +1 -1
- package/types/x-modules/search-box/components/search-button.vue.d.ts +2 -2
- package/types/x-modules/search-box/components/search-input-placeholder.vue.d.ts +6 -6
- package/types/x-modules/search-box/components/search-input.vue.d.ts +6 -6
- package/types/x-modules/semantic-queries/components/semantic-queries.vue.d.ts +4 -1
- package/types/x-modules/semantic-queries/components/semantic-queries.vue.d.ts.map +1 -1
- package/types/x-modules/semantic-queries/components/semantic-query.vue.d.ts +6 -4
- package/types/x-modules/semantic-queries/components/semantic-query.vue.d.ts.map +1 -1
- package/types/x-modules/tagging/components/tagging.vue.d.ts +4 -4
- package/types/x-modules/url/components/url-handler.vue.d.ts +5 -1
- package/types/x-modules/url/components/url-handler.vue.d.ts.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popular-searches.vue.js","sources":["../../../../../src/x-modules/popular-searches/components/popular-searches.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"popularSearches\"\n class=\"x-popular-searches\"\n data-test=\"popular-searches\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Popular Search item\n @binding {Object} v-bind - Popular Search suggestion attributes:<br /> - **suggestion** <code>Suggestion</code> - Popular Search suggestion data<br /> - **index** <code>number</code> - Popular Search suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope }\">\n <PopularSearch\n v-slot=\"popularSearchScope\"\n :suggestion=\"baseScope.suggestion\"\n class=\"x-popular-searches__suggestion x-suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Popular Search content\n @binding {Object} v-bind - Popular Search suggestion attributes:<br /> - **suggestion** <code>Suggestion</code> - Popular Search suggestion data<br /> - **index** <code>number</code> - Popular Search suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...popularSearchScope }\" />\n </PopularSearch>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables/use-getter'\nimport { popularSearchesXModule } from '../x-module'\nimport PopularSearch from './popular-search.vue'\n\n/**\n * Simple popular-searches component that renders a list of suggestions, allowing the user to\n * select one of them, and emitting the needed events.\n * A popular search is just a query that has been searched a lot in a certain period and may\n * optionally have associated a set of filters.\n *\n * @public\n */\nexport default defineComponent({\n name: 'PopularSearches',\n xModule: popularSearchesXModule.name,\n components: {\n PopularSearch,\n BaseSuggestions,\n },\n setup() {\n /**\n * The list of popular searches.\n *\n * @internal\n */\n const { popularSearches } = useGetter('popularSearches')\n\n return { popularSearches }\n },\n})\n</script>\n\n<!--eslint-disable max-len -->\n<docs lang=\"mdx\">\n## Inherited props\n\nThis component inherits the [`BaseSuggestions`](../base-components/x-components.base-suggestions.md)\nprops.\n\n| Name | Description | Type | Default |\n| ------------------ | ----------------------------------------------------------------- | -------- | ------- |\n| `animation` | Animation component that will be used to animate the suggestions. | `Vue` | `\"ul\"` |\n| `maxItemsToRender` | Number of popular searches to be rendered. | `number` | |\n\n## Examples\n\n### Default Usage\n\nYou don't need to pass any props, or slots. Simply add the component, and when it has any popular\nsearches it will show them.\n\n```vue live\n<template>\n <PopularSearches />\n</template>\n\n<script>\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\nexport default {\n name: 'PopularSearchesDemo',\n components: {\n PopularSearches,\n },\n}\n</script>\n```\n\nThe component has two optional props. `animation` to render the component with an animation and\n`maxItemsToRender` to limit the number of popular searches will be rendered (by default it is 5).\n\n```vue live\n<template>\n <PopularSearches :animation=\"'FadeAndSlide'\" :maxItemsToRender=\"10\" />\n</template>\n\n<script>\nimport Vue from 'vue'\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\nimport FadeAndSlide from '@empathyco/x-components'\n\n// Registering the animation as a global component\nVue.component('FadeAndSlide', FadeAndSlide)\nexport default {\n name: 'PopularSearchesDemo',\n components: {\n PopularSearches,\n FadeAndSlide,\n },\n}\n</script>\n```\n\n### Overriding Popular Search's Content\n\nYou can use your custom implementation of the Popular Search's content. In the example below,\ninstead of using the default Popular Search's content, an icon is added, as well as a span with the\nquery of the Popular Search's suggestion.\n\n```vue live\n<template>\n <PopularSearches>\n <template #suggestion-content=\"{ suggestion }\">\n <TrendingIcon />\n <span class=\"x-popular-search__query\">{{ suggestion.query }}</span>\n </template>\n </PopularSearches>\n</template>\n\n<script>\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\nimport { TrendingIcon } from '@empathyco/x-components'\n\nexport default {\n name: 'PopularSearchesDemo',\n components: {\n PopularSearches,\n TrendingIcon,\n },\n}\n</script>\n```\n\n### Adding a Custom Popular Search Item\n\nYou can use your custom implementation for the whole Popular Search item. In the example below, we\nchange the default implementation of the Popular Search in Popular Searches. A custom Popular Search\nimplementation is added, it has an image and a span as content (as in the previous example). Also, a\nbutton with a user customized behaviour is added at the same hierarchical level as the Popular\nSearch component.\n\n```vue live\n<template>\n <PopularSearches>\n <template #suggestion=\"{ suggestion }\">\n <PopularSearch :suggestion=\"suggestion\">\n <template #default=\"{ suggestion }\">\n <TrendingIcon />\n <span class=\"x-popular-search__query\">{{ suggestion.query }}</span>\n </template>\n </PopularSearch>\n <button>Custom Behaviour</button>\n </template>\n </PopularSearches>\n</template>\n\n<script>\nimport { PopularSearches, PopularSearch } from '@empathyco/x-components/popular-searches'\nimport { TrendingIcon } from '@empathyco/x-components'\n\nexport default {\n name: 'PopularSearchesDemo',\n components: {\n PopularSearches,\n PopularSearch,\n TrendingIcon,\n },\n}\n</script>\n```\n</docs>\n"],"names":["_createBlock","_withCtx","_renderSlot","_normalizeProps","_guardReactiveProps","_createVNode"],"mappings":";;;;;;;sBACEA,WA4BkB,CAAA,0BAAA,EAAA;AAAA,IA3Bf,WAAa,EAAA,IAAA,CAAA,eAAA;AAAA,IACd,KAAM,EAAA,oBAAA;AAAA,IACN,WAAU,EAAA,kBAAA;AAAA,GAAA,EAAA;IAEC,OAAO,EAAAC,OAAA,CAOhB,CAcO,SArBoB,KAAA;AAAA,MAO3BC,UAcO,CAAA,IAAA,CAAA,MAAA,EAAA,YAAA,
|
|
1
|
+
{"version":3,"file":"popular-searches.vue.js","sources":["../../../../../src/x-modules/popular-searches/components/popular-searches.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"popularSearches\"\n class=\"x-popular-searches\"\n data-test=\"popular-searches\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Popular Search item\n @binding {Object} v-bind - Popular Search suggestion attributes:<br /> - **suggestion** <code>Suggestion</code> - Popular Search suggestion data<br /> - **index** <code>number</code> - Popular Search suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope }\">\n <PopularSearch\n v-slot=\"popularSearchScope\"\n :suggestion=\"baseScope.suggestion\"\n class=\"x-popular-searches__suggestion x-suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Popular Search content\n @binding {Object} v-bind - Popular Search suggestion attributes:<br /> - **suggestion** <code>Suggestion</code> - Popular Search suggestion data<br /> - **index** <code>number</code> - Popular Search suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...popularSearchScope }\" />\n </PopularSearch>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables/use-getter'\nimport { popularSearchesXModule } from '../x-module'\nimport PopularSearch from './popular-search.vue'\n\n/**\n * Simple popular-searches component that renders a list of suggestions, allowing the user to\n * select one of them, and emitting the needed events.\n * A popular search is just a query that has been searched a lot in a certain period and may\n * optionally have associated a set of filters.\n *\n * @public\n */\nexport default defineComponent({\n name: 'PopularSearches',\n xModule: popularSearchesXModule.name,\n components: {\n PopularSearch,\n BaseSuggestions,\n },\n setup() {\n /**\n * The list of popular searches.\n *\n * @internal\n */\n const { popularSearches } = useGetter('popularSearches')\n\n return { popularSearches }\n },\n})\n</script>\n\n<!--eslint-disable max-len -->\n<docs lang=\"mdx\">\n## Inherited props\n\nThis component inherits the [`BaseSuggestions`](../base-components/x-components.base-suggestions.md)\nprops.\n\n| Name | Description | Type | Default |\n| ------------------ | ----------------------------------------------------------------- | -------- | ------- |\n| `animation` | Animation component that will be used to animate the suggestions. | `Vue` | `\"ul\"` |\n| `maxItemsToRender` | Number of popular searches to be rendered. | `number` | |\n\n## Examples\n\n### Default Usage\n\nYou don't need to pass any props, or slots. Simply add the component, and when it has any popular\nsearches it will show them.\n\n```vue live\n<template>\n <PopularSearches />\n</template>\n\n<script>\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\nexport default {\n name: 'PopularSearchesDemo',\n components: {\n PopularSearches,\n },\n}\n</script>\n```\n\nThe component has two optional props. `animation` to render the component with an animation and\n`maxItemsToRender` to limit the number of popular searches will be rendered (by default it is 5).\n\n```vue live\n<template>\n <PopularSearches :animation=\"'FadeAndSlide'\" :maxItemsToRender=\"10\" />\n</template>\n\n<script>\nimport Vue from 'vue'\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\nimport FadeAndSlide from '@empathyco/x-components'\n\n// Registering the animation as a global component\nVue.component('FadeAndSlide', FadeAndSlide)\nexport default {\n name: 'PopularSearchesDemo',\n components: {\n PopularSearches,\n FadeAndSlide,\n },\n}\n</script>\n```\n\n### Overriding Popular Search's Content\n\nYou can use your custom implementation of the Popular Search's content. In the example below,\ninstead of using the default Popular Search's content, an icon is added, as well as a span with the\nquery of the Popular Search's suggestion.\n\n```vue live\n<template>\n <PopularSearches>\n <template #suggestion-content=\"{ suggestion }\">\n <TrendingIcon />\n <span class=\"x-popular-search__query\">{{ suggestion.query }}</span>\n </template>\n </PopularSearches>\n</template>\n\n<script>\nimport { PopularSearches } from '@empathyco/x-components/popular-searches'\nimport { TrendingIcon } from '@empathyco/x-components'\n\nexport default {\n name: 'PopularSearchesDemo',\n components: {\n PopularSearches,\n TrendingIcon,\n },\n}\n</script>\n```\n\n### Adding a Custom Popular Search Item\n\nYou can use your custom implementation for the whole Popular Search item. In the example below, we\nchange the default implementation of the Popular Search in Popular Searches. A custom Popular Search\nimplementation is added, it has an image and a span as content (as in the previous example). Also, a\nbutton with a user customized behaviour is added at the same hierarchical level as the Popular\nSearch component.\n\n```vue live\n<template>\n <PopularSearches>\n <template #suggestion=\"{ suggestion }\">\n <PopularSearch :suggestion=\"suggestion\">\n <template #default=\"{ suggestion }\">\n <TrendingIcon />\n <span class=\"x-popular-search__query\">{{ suggestion.query }}</span>\n </template>\n </PopularSearch>\n <button>Custom Behaviour</button>\n </template>\n </PopularSearches>\n</template>\n\n<script>\nimport { PopularSearches, PopularSearch } from '@empathyco/x-components/popular-searches'\nimport { TrendingIcon } from '@empathyco/x-components'\n\nexport default {\n name: 'PopularSearchesDemo',\n components: {\n PopularSearches,\n PopularSearch,\n TrendingIcon,\n },\n}\n</script>\n```\n</docs>\n"],"names":["_createBlock","_withCtx","_renderSlot","_normalizeProps","_guardReactiveProps","_createVNode"],"mappings":";;;;;;;sBACEA,WA4BkB,CAAA,0BAAA,EAAA;AAAA,IA3Bf,WAAa,EAAA,IAAA,CAAA,eAAA;AAAA,IACd,KAAM,EAAA,oBAAA;AAAA,IACN,WAAU,EAAA,kBAAA;AAAA,GAAA,EAAA;IAEC,OAAO,EAAAC,OAAA,CAOhB,CAcO,SArBoB,KAAA;AAAA,MAO3BC,UAcO,CAAA,IAAA,CAAA,MAAA,EAAA,YAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAd8B,SAAS,EAAA,CAAA,CAAA,EAA9C,MAcO;AAAA,QAbLC,WAYgB,CAAA,wBAAA,EAAA;AAAA,UAVb,YAAY,SAAU,CAAA,UAAA;AAAA,UACvB,KAAM,EAAA,6CAAA;AAAA,SAAA,EAAA;AAQN,UAAA,OAAA,EAAAJ,OAAA,CAAA,CAAmF,kBAVzD,KAAA;AAAA,YAU1BC,UAAmF,CAAA,IAAA,CAAA,MAAA,EAAA,oBAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAAtC,SAAS,EAAA,GAAK,kBAAkB,EAAA,CAAA,CAAA,CAAA;AAAA,WAAA,CAAA;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-preview-button.vue.js","sources":["../../../../../src/x-modules/queries-preview/components/query-preview-button.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n :metadata=\"metadata\"\n class=\"x-query-preview-button x-button\"\n data-test=\"query-preview-button\"\n >\n <!-- @slot Button content with a text, an icon or both -->\n <slot :query-preview-info=\"fullQueryPreviewInfo\">\n {{ queryPreviewInfo.query }}\n </slot>\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { XEventsTypes } from '../../../wiring/events.types'\nimport type { WireMetadata } from '../../../wiring/index'\nimport type { QueryPreviewInfo } from '../store/types'\nimport { computed, defineComponent } from 'vue'\nimport { BaseEventButton } from '../../../components'\nimport { useState } from '../../../composables/use-state'\nimport { queriesPreviewXModule } from '../x-module'\n\n/**\n * Component containing an event button that emits\n * {@link QueriesPreviewXEvents.UserAcceptedAQueryPreview} when clicked with\n * the full query preview info as payload.\n *\n * It has a default slot to customize its contents.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QueryPreviewButton',\n xModule: queriesPreviewXModule.name,\n components: { BaseEventButton },\n props: {\n /**\n * The information about the request of the query preview.\n *\n * @public\n */\n queryPreviewInfo: {\n type: Object as PropType<QueryPreviewInfo>,\n required: true,\n },\n /**\n * The metadata property for the request on each query preview.\n *\n * @public\n */\n metadata: {\n type: Object as PropType<Omit<WireMetadata, 'moduleName'>>,\n },\n },\n setup(props) {\n /**\n * We use the module extra params to combine them with the query preview's extra params.\n */\n const { params } = useState('queriesPreview')\n\n /**\n * The provided query preview with the base extra params from the module merged in.\n *\n * @returns The query preview info with the base extra params merged in.\n * @public\n */\n const fullQueryPreviewInfo = computed(\n (): QueryPreviewInfo => ({\n ...props.queryPreviewInfo,\n extraParams: {\n ...params.value,\n ...props.queryPreviewInfo.extraParams,\n },\n filters: props.queryPreviewInfo.filters,\n }),\n )\n\n /**\n * List of events to emit by the BaseEventButton.\n *\n * @returns An object with the event and payload.\n *\n * @internal\n */\n const events = computed(\n (): Partial<XEventsTypes> => ({ UserAcceptedAQueryPreview: fullQueryPreviewInfo.value }),\n )\n\n return {\n fullQueryPreviewInfo,\n events,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThe component content has the query preview query as default\n\n```vue\n<template>\n <div>\n <QueryPreviewButton queryPreviewInfo=\"queryPreviewInfo\" />\n </div>\n</template>\n\n<script>\nimport { QueryPreviewButton } from '@empathyco/x-components/queries-preview'\n\nexport default {\n components: {\n QueryPreviewButton,\n },\n data: function () {\n return {\n queryPreviewInfo: {\n query: 'shoes',\n },\n }\n },\n}\n</script>\n```\n\n### Customizing slots\n\nThe content of the button is customizable via its default slot\n\n```vue\n<template>\n <div>\n <QueryPreviewButton queryPreviewInfo=\"queryPreviewInfo\">\n {{ `Search for: ${queryPreviewInfo.query}` }}\n </QueryPreviewButton>\n </div>\n</template>\n\n<script>\nimport { QueryPreviewButton } from '@empathyco/x-components/queries-preview'\n\nexport default {\n components: {\n QueryPreviewButton,\n },\n data: function () {\n return {\n queryPreviewInfo: {\n query: 'shoes',\n },\n }\n },\n}\n</script>\n```\n\n## Events\n\nA list of events that the component will emit:\n\n- `UserAcceptedAQueryPreview`: the event is emitted after the user clicks the button. The event\n payload is the `QueryPreviewInfo` of the query.\n</docs>\n"],"names":["_createBlock","
|
|
1
|
+
{"version":3,"file":"query-preview-button.vue.js","sources":["../../../../../src/x-modules/queries-preview/components/query-preview-button.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n :metadata=\"metadata\"\n class=\"x-query-preview-button x-button\"\n data-test=\"query-preview-button\"\n >\n <!-- @slot Button content with a text, an icon or both -->\n <slot :query-preview-info=\"fullQueryPreviewInfo\">\n {{ queryPreviewInfo.query }}\n </slot>\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { XEventsTypes } from '../../../wiring/events.types'\nimport type { WireMetadata } from '../../../wiring/index'\nimport type { QueryPreviewInfo } from '../store/types'\nimport { computed, defineComponent } from 'vue'\nimport { BaseEventButton } from '../../../components'\nimport { useState } from '../../../composables/use-state'\nimport { queriesPreviewXModule } from '../x-module'\n\n/**\n * Component containing an event button that emits\n * {@link QueriesPreviewXEvents.UserAcceptedAQueryPreview} when clicked with\n * the full query preview info as payload.\n *\n * It has a default slot to customize its contents.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QueryPreviewButton',\n xModule: queriesPreviewXModule.name,\n components: { BaseEventButton },\n props: {\n /**\n * The information about the request of the query preview.\n *\n * @public\n */\n queryPreviewInfo: {\n type: Object as PropType<QueryPreviewInfo>,\n required: true,\n },\n /**\n * The metadata property for the request on each query preview.\n *\n * @public\n */\n metadata: {\n type: Object as PropType<Omit<WireMetadata, 'moduleName'>>,\n },\n },\n setup(props) {\n /**\n * We use the module extra params to combine them with the query preview's extra params.\n */\n const { params } = useState('queriesPreview')\n\n /**\n * The provided query preview with the base extra params from the module merged in.\n *\n * @returns The query preview info with the base extra params merged in.\n * @public\n */\n const fullQueryPreviewInfo = computed(\n (): QueryPreviewInfo => ({\n ...props.queryPreviewInfo,\n extraParams: {\n ...params.value,\n ...props.queryPreviewInfo.extraParams,\n },\n filters: props.queryPreviewInfo.filters,\n }),\n )\n\n /**\n * List of events to emit by the BaseEventButton.\n *\n * @returns An object with the event and payload.\n *\n * @internal\n */\n const events = computed(\n (): Partial<XEventsTypes> => ({ UserAcceptedAQueryPreview: fullQueryPreviewInfo.value }),\n )\n\n return {\n fullQueryPreviewInfo,\n events,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThe component content has the query preview query as default\n\n```vue\n<template>\n <div>\n <QueryPreviewButton queryPreviewInfo=\"queryPreviewInfo\" />\n </div>\n</template>\n\n<script>\nimport { QueryPreviewButton } from '@empathyco/x-components/queries-preview'\n\nexport default {\n components: {\n QueryPreviewButton,\n },\n data: function () {\n return {\n queryPreviewInfo: {\n query: 'shoes',\n },\n }\n },\n}\n</script>\n```\n\n### Customizing slots\n\nThe content of the button is customizable via its default slot\n\n```vue\n<template>\n <div>\n <QueryPreviewButton queryPreviewInfo=\"queryPreviewInfo\">\n {{ `Search for: ${queryPreviewInfo.query}` }}\n </QueryPreviewButton>\n </div>\n</template>\n\n<script>\nimport { QueryPreviewButton } from '@empathyco/x-components/queries-preview'\n\nexport default {\n components: {\n QueryPreviewButton,\n },\n data: function () {\n return {\n queryPreviewInfo: {\n query: 'shoes',\n },\n }\n },\n}\n</script>\n```\n\n## Events\n\nA list of events that the component will emit:\n\n- `UserAcceptedAQueryPreview`: the event is emitted after the user clicks the button. The event\n payload is the `QueryPreviewInfo` of the query.\n</docs>\n"],"names":["_createBlock","_renderSlot","_createTextVNode","_toDisplayString"],"mappings":";;;;;;sBACEA,WAUkB,CAAA,0BAAA,EAAA;AAAA,IATf,MAAQ,EAAA,IAAA,CAAA,MAAA;AAAA,IACR,QAAU,EAAA,IAAA,CAAA,QAAA;AAAA,IACX,KAAM,EAAA,iCAAA;AAAA,IACN,WAAU,EAAA,sBAAA;AAAA,GAAA,EAAA;qBAGV,MAEO;AAAA,MAFPC,UAEO,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAFA,gBAAoB,EAAA,IAAA,CAAA,oBAAA,IAA3B,MAEO;AAAA,QAAAC,eAAA;AADF,UAAAC,eAAA,CAAA,IAAA,CAAA,gBAAA,CAAiB,KAAK,CAAA;AAAA,UAAA,CAAA;AAAA;AAAA,SAAA;AAAA,OAAA,CAAA;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-preview-list.vue.js","sources":["../../../../../src/x-modules/queries-preview/components/query-preview-list.vue"],"sourcesContent":["<template>\n <component :is=\"animation\" class=\"x-query-preview-list\" tag=\"ul\">\n <li\n v-for=\"(queryPreview, index) in renderedQueryPreviews\"\n :key=\"index\"\n data-test=\"query-preview-item\"\n >\n <QueryPreview\n :debounce-time-ms=\"debounceTimeMs\"\n :max-items-to-render=\"maxItemsToRender\"\n :persist-in-cache=\"persistInCache\"\n :query-feature=\"queryFeature\"\n :query-preview-info=\"queryPreview\"\n @load=\"flagAsLoaded\"\n @error=\"flagAsFailed\"\n >\n <template v-for=\"(_, slotName) in $slots\" #[slotName]=\"scope\">\n <slot :name=\"slotName\" v-bind=\"scope\" />\n </template>\n </QueryPreview>\n </li>\n </component>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { RequestStatus } from '../../../store'\nimport type { QueryFeature } from '../../../types'\nimport type { QueryPreviewInfo } from '../store/types'\nimport { computed, defineComponent, ref, watch } from 'vue'\nimport { useState } from '../../../composables/index'\nimport { AnimationProp } from '../../../types'\nimport { getHashFromQueryPreviewInfo } from '../utils/get-hash-from-query-preview'\nimport { queriesPreviewXModule } from '../x-module'\nimport QueryPreview from './query-preview.vue'\n\ninterface QueryPreviewStatusRecord {\n [query: string]: RequestStatus\n}\n\n/**\n * Renders the results previews of a list of objects with the information about the query preview,\n * and exposes the {@link QueryPreview} slots to modify the content.\n * The requests are made in sequential order.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QueryPreviewList',\n xModule: queriesPreviewXModule.name,\n components: { QueryPreview },\n props: {\n /**\n * The list of queries preview to render.\n *\n * @public\n */\n queriesPreviewInfo: {\n type: Array as PropType<QueryPreviewInfo[]>,\n required: true,\n },\n /**\n * The origin property for the request on each query preview.\n *\n * @public\n */\n queryFeature: {\n type: String as PropType<QueryFeature>,\n },\n /**\n * Number of query preview results to be rendered on each query preview.\n *\n * @public\n */\n maxItemsToRender: {\n type: Number,\n },\n /**\n * Debounce time in milliseconds for triggering the search requests\n * on each query preview.\n * It will default to 0 to fit the most common use case (pre-search),\n * and it would work properly with a 250 value inside empathize.\n */\n debounceTimeMs: {\n type: Number,\n default: 0,\n },\n /**\n * Controls whether all the QueryPreview should be removed from the state\n * when the component is destroyed.\n *\n * @public\n */\n persistInCache: Boolean,\n /**\n * Animation component that will be used to animate the elements.\n *\n * @public\n */\n animation: {\n type: AnimationProp,\n default: 'ul',\n },\n },\n setup(props) {\n const { params } = useState('queriesPreview')\n\n /**\n * Contains the status of the preview requests, indexed by query.\n */\n const queriesStatus = ref<QueryPreviewStatusRecord>({})\n\n /**\n * The list of queries to preview.\n *\n * @returns The list of queries in the queriesPreviewInfo list.\n * @internal\n */\n const queries = computed((): string[] =>\n props.queriesPreviewInfo.map(item =>\n getHashFromQueryPreviewInfo(item, { ...params.value, ...item.extraParams }),\n ),\n )\n\n /**\n * Gets all the queries to render, that are those that don't have an `error` status.\n *\n * @returns A list of queries.\n * @internal\n */\n const renderedQueryPreviews = computed((): QueryPreviewInfo[] => {\n return props.queriesPreviewInfo.filter(item => {\n const queryPreviewHash = getHashFromQueryPreviewInfo(item, {\n ...params.value,\n ...item.extraParams,\n })\n return (\n queriesStatus.value[queryPreviewHash] === 'success' ||\n queriesStatus.value[queryPreviewHash] === 'loading'\n )\n })\n })\n\n /**\n * Tries to load the next query.\n *\n * @internal\n */\n const loadNext = (): void => {\n const queryToLoad = queries.value.find(query => !(query in queriesStatus.value))\n if (queryToLoad) {\n queriesStatus.value[queryToLoad] = 'loading'\n }\n }\n\n /**\n * Resets the status of all queries if they change.\n *\n * @param newQueries - The new queries.\n * @param oldQueries - The old queries.\n * @internal\n */\n watch(\n queries,\n (newQueries: string[], oldQueries: string[] | undefined) => {\n if (newQueries.toString() !== oldQueries?.toString()) {\n for (const key of Object.keys(queriesStatus.value)) {\n if (!newQueries.includes(key)) {\n delete queriesStatus.value[key]\n }\n }\n loadNext()\n }\n },\n { immediate: true, deep: true },\n )\n\n /**\n * Sets the status of a given query to `success`.\n *\n * @param loadedQuery - The query to flag as loaded.\n * @internal\n */\n const flagAsLoaded = (loadedQuery: string): void => {\n queriesStatus.value[loadedQuery] = 'success'\n loadNext()\n }\n\n /**\n * Sets the status of a given query to `error`.\n *\n * @param failedQuery - The query to flag as failed.\n * @internal\n */\n const flagAsFailed = (failedQuery: string): void => {\n queriesStatus.value[failedQuery] = 'error'\n loadNext()\n }\n\n return {\n renderedQueryPreviews,\n flagAsFailed,\n flagAsLoaded,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## See it in action\n\nHere you have a basic example of how the QueryPreviewList is rendered. Keep in mind that this\ncomponent is intended to be used overriding its default slot. By default it will only render the\nnames of the results.\n\n```vue live\n<template>\n <QueryPreviewList :queriesPreviewInfo=\"queriesPreviewInfo\" />\n</template>\n\n<script>\nimport { QueryPreviewList } from '@empathyco/x-components/queries-preview'\n\nexport default {\n name: 'QueryPreviewListDemo',\n components: {\n QueryPreviewList,\n },\n data() {\n return {\n queriesPreviewInfo: [{ query: 'sandals' }, { query: 'tshirt' }, { query: 'jacket' }],\n }\n },\n}\n</script>\n```\n\n### Play with the default slot\n\nIn this example, the results will be rendered inside a sliding panel.\n\n```vue live\n<template>\n <QueryPreviewList\n :queriesPreviewInfo=\"queriesPreviewInfo\"\n #default=\"{ queryPreviewInfo, totalResults, results }\"\n >\n <div class=\"x-flex x-flex-col x-gap-8 x-mb-16\">\n <h1 class=\"x-title2\">{{ queryPreviewInfo.query }} ({{ totalResults }})</h1>\n <SlidingPanel :resetOnContentChange=\"false\">\n <div class=\"x-flex x-gap-8\">\n <Result\n v-for=\"result in results\"\n :key=\"result.id\"\n :result=\"result\"\n style=\"max-width: 180px\"\n />\n </div>\n </SlidingPanel>\n </div>\n </QueryPreviewList>\n</template>\n\n<script>\nimport { QueryPreviewList } from '@empathyco/x-components/queries-preview'\nimport { BaseResultImage, BaseResultLink, SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'QueryPreviewListDemoOverridingSlot',\n components: {\n BaseResultImage,\n BaseResultLink,\n QueryPreviewList,\n SlidingPanel,\n },\n data() {\n return {\n queriesPreviewInfo: [{ query: 'sandals' }, { query: 'tshirt' }, { query: 'jacket' }],\n }\n },\n}\n</script>\n```\n\n### Play with the result slot\n\nThe component exposes a slot to override the result content, without modifying the list.\n\nIn this example, the ID of the results will be rendered along with the name.\n\n```vue\n<template>\n <QueryPreviewList\n class=\"x-flex x-gap-8\"\n :queriesPreviewInfo=\"queriesPreviewInfo\"\n #result=\"{ result }\"\n >\n <span class=\"x-font-bold\">{{ result.id }}:</span>\n <span>{{ result.name }}</span>\n </QueryPreviewList>\n</template>\n\n<script>\nimport { QueryPreviewList } from '@empathyco/x-components/queries-preview'\n\nexport default {\n name: 'QueryPreviewListDemoOverridingResultSlot',\n components: {\n QueryPreviewList,\n },\n data() {\n return {\n queriesPreviewInfo: [{ query: 'sandals' }, { query: 'tshirt' }, { query: 'jacket' }],\n }\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createBlock","_resolveDynamicComponent","_withCtx","_createElementBlock","_Fragment","_renderList","_createVNode","_createSlots","_renderSlot","_mergeProps"],"mappings":";;;;;;AACE,EAAA,OAAAA,SAAA,EAAA,EAAAC,WAAA,CAoBYC,wBApBI,IAAS,CAAA,SAAA,CAAA,EAAA;AAAA,IAAE,KAAM,EAAA,sBAAA;AAAA,IAAuB,GAAI,EAAA,IAAA;AAAA,GAAA,EAAA;AAD9D,IAAA,OAAA,EAAAC,OAAA,CAGM,MAAsD;AAAA,OADxDH,SAAA,CAAA,IAAA,CAAA,EAAAI,kBAAA;AAAA,QAkBKC,QAAA;AAAA,QAAA,IAAA;AAAA,QApBTC,UAGsC,CAAA,IAAA,CAAA,qBAAA,EAHtC,CAGc,YAAA,EAAc,KAAK,KAAA;8BAD7BF,kBAkBK,CAAA,IAAA,EAAA;AAAA,YAhBF,GAAK,EAAA,KAAA;AAAA,YACN,WAAU,EAAA,oBAAA;AAAA,WAAA,EAAA;YAEVG,WAYe,CAAA,uBAAA,EAAA;AAAA,cAXZ,kBAAkB,EAAA,IAAA,CAAA,cAAA;AAAA,cAClB,qBAAqB,EAAA,IAAA,CAAA,gBAAA;AAAA,cACrB,kBAAkB,EAAA,IAAA,CAAA,cAAA;AAAA,cAClB,eAAe,EAAA,IAAA,CAAA,YAAA;AAAA,cACf,oBAAoB,EAAA,YAAA;AAAA,cACpB,MAAM,EAAA,IAAA,CAAA,YAAA;AAAA,cACN,OAAO,EAAA,IAAA,CAAA,YAAA;AAAA,aAdhB,EAAAC,WAAA,CAAA;AAAA,cAAA,CAAA,EAAA,CAAA;AAAA;AAAA,aAAA,EAAA;AAAA,cAgB0CF,UAAA,CAAA,IAAA,CAAA,MAAA,EAhB1C,CAgB0B,CAAA,EAAG,QAAQ,KAAA;;kBAhBrC,IAgBmD,EAAA,QAAA;AAAA,kBAhBnD,EAAA,EAAAH,OAAA,CAiBU,CAAwC,KADkB,KAAA;AAAA,oBAC1DM,WAAwC,IAA3B,CAAA,MAAA,EAAA,QAAA,EAAbC,UAAwC,CAAA,EAjBlD,iBAiByC,KAAK,CAAA,CAAA;AAAA,mBAAA,CAAA;;;;;;;;;;AAjB9C,IAAA,CAAA,EAAA,CAAA;AAAA;AAAA,GAAA,CAAA,CAAA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"query-preview-list.vue.js","sources":["../../../../../src/x-modules/queries-preview/components/query-preview-list.vue"],"sourcesContent":["<template>\n <component :is=\"animation\" class=\"x-query-preview-list\" tag=\"ul\">\n <li\n v-for=\"(queryPreview, index) in renderedQueryPreviews\"\n :key=\"index\"\n data-test=\"query-preview-item\"\n >\n <QueryPreview\n :debounce-time-ms=\"debounceTimeMs\"\n :max-items-to-render=\"maxItemsToRender\"\n :persist-in-cache=\"persistInCache\"\n :query-feature=\"queryFeature\"\n :query-preview-info=\"queryPreview\"\n @load=\"flagAsLoaded\"\n @error=\"flagAsFailed\"\n >\n <template v-for=\"(_, slotName) in $slots\" #[slotName]=\"scope\">\n <slot :name=\"slotName\" v-bind=\"scope\" />\n </template>\n </QueryPreview>\n </li>\n </component>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { RequestStatus } from '../../../store'\nimport type { QueryFeature } from '../../../types'\nimport type { QueryPreviewInfo } from '../store/types'\nimport { computed, defineComponent, ref, watch } from 'vue'\nimport { useState } from '../../../composables/index'\nimport { AnimationProp } from '../../../types'\nimport { getHashFromQueryPreviewInfo } from '../utils/get-hash-from-query-preview'\nimport { queriesPreviewXModule } from '../x-module'\nimport QueryPreview from './query-preview.vue'\n\ninterface QueryPreviewStatusRecord {\n [query: string]: RequestStatus\n}\n\n/**\n * Renders the results previews of a list of objects with the information about the query preview,\n * and exposes the {@link QueryPreview} slots to modify the content.\n * The requests are made in sequential order.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QueryPreviewList',\n xModule: queriesPreviewXModule.name,\n components: { QueryPreview },\n props: {\n /**\n * The list of queries preview to render.\n *\n * @public\n */\n queriesPreviewInfo: {\n type: Array as PropType<QueryPreviewInfo[]>,\n required: true,\n },\n /**\n * The origin property for the request on each query preview.\n *\n * @public\n */\n queryFeature: {\n type: String as PropType<QueryFeature>,\n },\n /**\n * Number of query preview results to be rendered on each query preview.\n *\n * @public\n */\n maxItemsToRender: {\n type: Number,\n },\n /**\n * Debounce time in milliseconds for triggering the search requests\n * on each query preview.\n * It will default to 0 to fit the most common use case (pre-search),\n * and it would work properly with a 250 value inside empathize.\n */\n debounceTimeMs: {\n type: Number,\n default: 0,\n },\n /**\n * Controls whether all the QueryPreview should be removed from the state\n * when the component is destroyed.\n *\n * @public\n */\n persistInCache: Boolean,\n /**\n * Animation component that will be used to animate the elements.\n *\n * @public\n */\n animation: {\n type: AnimationProp,\n default: 'ul',\n },\n },\n setup(props) {\n const { params } = useState('queriesPreview')\n\n /**\n * Contains the status of the preview requests, indexed by query.\n */\n const queriesStatus = ref<QueryPreviewStatusRecord>({})\n\n /**\n * The list of queries to preview.\n *\n * @returns The list of queries in the queriesPreviewInfo list.\n * @internal\n */\n const queries = computed((): string[] =>\n props.queriesPreviewInfo.map(item =>\n getHashFromQueryPreviewInfo(item, { ...params.value, ...item.extraParams }),\n ),\n )\n\n /**\n * Gets all the queries to render, that are those that don't have an `error` status.\n *\n * @returns A list of queries.\n * @internal\n */\n const renderedQueryPreviews = computed((): QueryPreviewInfo[] => {\n return props.queriesPreviewInfo.filter(item => {\n const queryPreviewHash = getHashFromQueryPreviewInfo(item, {\n ...params.value,\n ...item.extraParams,\n })\n return (\n queriesStatus.value[queryPreviewHash] === 'success' ||\n queriesStatus.value[queryPreviewHash] === 'loading'\n )\n })\n })\n\n /**\n * Tries to load the next query.\n *\n * @internal\n */\n const loadNext = (): void => {\n const queryToLoad = queries.value.find(query => !(query in queriesStatus.value))\n if (queryToLoad) {\n queriesStatus.value[queryToLoad] = 'loading'\n }\n }\n\n /**\n * Resets the status of all queries if they change.\n *\n * @param newQueries - The new queries.\n * @param oldQueries - The old queries.\n * @internal\n */\n watch(\n queries,\n (newQueries: string[], oldQueries: string[] | undefined) => {\n if (newQueries.toString() !== oldQueries?.toString()) {\n for (const key of Object.keys(queriesStatus.value)) {\n if (!newQueries.includes(key)) {\n delete queriesStatus.value[key]\n }\n }\n loadNext()\n }\n },\n { immediate: true, deep: true },\n )\n\n /**\n * Sets the status of a given query to `success`.\n *\n * @param loadedQuery - The query to flag as loaded.\n * @internal\n */\n const flagAsLoaded = (loadedQuery: string): void => {\n queriesStatus.value[loadedQuery] = 'success'\n loadNext()\n }\n\n /**\n * Sets the status of a given query to `error`.\n *\n * @param failedQuery - The query to flag as failed.\n * @internal\n */\n const flagAsFailed = (failedQuery: string): void => {\n queriesStatus.value[failedQuery] = 'error'\n loadNext()\n }\n\n return {\n renderedQueryPreviews,\n flagAsFailed,\n flagAsLoaded,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## See it in action\n\nHere you have a basic example of how the QueryPreviewList is rendered. Keep in mind that this\ncomponent is intended to be used overriding its default slot. By default it will only render the\nnames of the results.\n\n```vue live\n<template>\n <QueryPreviewList :queriesPreviewInfo=\"queriesPreviewInfo\" />\n</template>\n\n<script>\nimport { QueryPreviewList } from '@empathyco/x-components/queries-preview'\n\nexport default {\n name: 'QueryPreviewListDemo',\n components: {\n QueryPreviewList,\n },\n data() {\n return {\n queriesPreviewInfo: [{ query: 'sandals' }, { query: 'tshirt' }, { query: 'jacket' }],\n }\n },\n}\n</script>\n```\n\n### Play with the default slot\n\nIn this example, the results will be rendered inside a sliding panel.\n\n```vue live\n<template>\n <QueryPreviewList\n :queriesPreviewInfo=\"queriesPreviewInfo\"\n #default=\"{ queryPreviewInfo, totalResults, results }\"\n >\n <div class=\"x-flex x-flex-col x-gap-8 x-mb-16\">\n <h1 class=\"x-title2\">{{ queryPreviewInfo.query }} ({{ totalResults }})</h1>\n <SlidingPanel :resetOnContentChange=\"false\">\n <div class=\"x-flex x-gap-8\">\n <Result\n v-for=\"result in results\"\n :key=\"result.id\"\n :result=\"result\"\n style=\"max-width: 180px\"\n />\n </div>\n </SlidingPanel>\n </div>\n </QueryPreviewList>\n</template>\n\n<script>\nimport { QueryPreviewList } from '@empathyco/x-components/queries-preview'\nimport { BaseResultImage, BaseResultLink, SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'QueryPreviewListDemoOverridingSlot',\n components: {\n BaseResultImage,\n BaseResultLink,\n QueryPreviewList,\n SlidingPanel,\n },\n data() {\n return {\n queriesPreviewInfo: [{ query: 'sandals' }, { query: 'tshirt' }, { query: 'jacket' }],\n }\n },\n}\n</script>\n```\n\n### Play with the result slot\n\nThe component exposes a slot to override the result content, without modifying the list.\n\nIn this example, the ID of the results will be rendered along with the name.\n\n```vue\n<template>\n <QueryPreviewList\n class=\"x-flex x-gap-8\"\n :queriesPreviewInfo=\"queriesPreviewInfo\"\n #result=\"{ result }\"\n >\n <span class=\"x-font-bold\">{{ result.id }}:</span>\n <span>{{ result.name }}</span>\n </QueryPreviewList>\n</template>\n\n<script>\nimport { QueryPreviewList } from '@empathyco/x-components/queries-preview'\n\nexport default {\n name: 'QueryPreviewListDemoOverridingResultSlot',\n components: {\n QueryPreviewList,\n },\n data() {\n return {\n queriesPreviewInfo: [{ query: 'sandals' }, { query: 'tshirt' }, { query: 'jacket' }],\n }\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createBlock","_resolveDynamicComponent","_createElementBlock","_Fragment","_renderList","_createVNode","_createSlots","_withCtx","_renderSlot","_mergeProps"],"mappings":";;;;;;AACE,EAAA,OAAAA,SAAA,EAAA,EAAAC,WAAA,CAoBYC,wBApBI,IAAS,CAAA,SAAA,CAAA,EAAA;AAAA,IAAE,KAAM,EAAA,sBAAA;AAAA,IAAuB,GAAI,EAAA,IAAA;AAAA,GAAA,EAAA;qBAExD,MAAsD;AAAA,OADxDF,SAAA,CAAA,IAAA,CAAA,EAAAG,kBAAA;AAAA,QAkBKC,QAAA;AAAA,QAAA,IAAA;AAAA,QAjB6BC,UAAA,CAAA,IAAA,CAAA,qBAAA,EAAqB,CAA7C,YAAA,EAAc,KAAK,KAAA;8BAD7BF,kBAkBK,CAAA,IAAA,EAAA;AAAA,YAhBF,GAAK,EAAA,KAAA;AAAA,YACN,WAAU,EAAA,oBAAA;AAAA,WAAA,EAAA;YAEVG,WAYe,CAAA,uBAAA,EAAA;AAAA,cAXZ,kBAAkB,EAAA,IAAA,CAAA,cAAA;AAAA,cAClB,qBAAqB,EAAA,IAAA,CAAA,gBAAA;AAAA,cACrB,kBAAkB,EAAA,IAAA,CAAA,cAAA;AAAA,cAClB,eAAe,EAAA,IAAA,CAAA,YAAA;AAAA,cACf,oBAAoB,EAAA,YAAA;AAAA,cACpB,MAAM,EAAA,IAAA,CAAA,YAAA;AAAA,cACN,OAAO,EAAA,IAAA,CAAA,YAAA;AAAA,aAAA,EAAAC,WAAA,CAAA;;;;yBAE0B,IAAM,CAAA,MAAA,EAAA,CAAtB,GAAG,QAAQ,KAAA;;AAAc,kBAAA,IAAA,EAAA,QAAA;AAAA,kBAAA,EAAA,EAAAC,OAAA,CACzC,CAAwC,KADkB,KAAA;AAAA,oBAC1DC,UAAwC,CAAA,IAAA,CAAA,MAAA,EAA3B,QAAb,EAAAC,UAAA,CAAwC,mBAAT,KAAK,CAAA,CAAA;AAAA,mBAAA,CAAA;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-preview.vue.js","sources":["../../../../../src/x-modules/queries-preview/components/query-preview.vue"],"sourcesContent":["<template>\n <ul v-if=\"hasResults\" data-test=\"query-preview\" class=\"x-query-preview\">\n <li\n v-for=\"result in queryPreviewResults?.results\"\n :key=\"result.id\"\n class=\"x-query-preview__item\"\n data-test=\"query-preview-item\"\n >\n <!--\n @slot Query Preview result slot.\n @binding {Result} result - A Query Preview result\n -->\n <slot name=\"result\" :result=\"result\">\n <span data-test=\"result-name\">{{ result.name }}</span>\n </slot>\n </li>\n </ul>\n</template>\n\n<script lang=\"ts\">\nimport type { Filter, SearchRequest } from '@empathyco/x-types'\nimport type { PropType, Ref } from 'vue'\nimport type { FeatureLocation, QueryFeature } from '../../../types'\nimport type { DebouncedFunction } from '../../../utils'\nimport type { QueryPreviewInfo } from '../store/types'\nimport { deepEqual } from '@empathyco/x-utils'\nimport { computed, defineComponent, inject, onBeforeUnmount, provide, watch } from 'vue'\nimport { LIST_ITEMS_KEY } from '../../../components'\nimport { useState, useXBus } from '../../../composables'\nimport { createOrigin, createRawFilters, debounceFunction } from '../../../utils'\nimport { getHashFromQueryPreviewInfo } from '../utils/get-hash-from-query-preview'\nimport { queriesPreviewXModule } from '../x-module'\n\n/**\n * Retrieves a preview of the results of a query and exposes them in the default slot,\n * along with the query preview and the totalResults of the search request.\n * By default, it renders the names of the results.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QueryPreview',\n xModule: queriesPreviewXModule.name,\n props: {\n /** The information about the request of the query preview. */\n queryPreviewInfo: {\n type: Object as PropType<QueryPreviewInfo>,\n required: true,\n },\n /** The origin property for the request. */\n queryFeature: {\n type: String as PropType<QueryFeature>,\n },\n /** Number of query preview results to be rendered. */\n maxItemsToRender: {\n type: Number,\n },\n /**\n * Debounce time in milliseconds for triggering the search requests.\n * It will default to 0 to fit the most common use case (pre-search),\n * and it would work properly with a 250 value inside empathize.\n */\n debounceTimeMs: {\n type: Number,\n default: 0,\n },\n /**\n * Controls whether the QueryPreview should be removed from the state\n * when the component is destroyed.\n */\n persistInCache: {\n type: Boolean,\n default: false,\n },\n },\n emits: ['load', 'error'],\n setup(props, { emit, slots }) {\n const xBus = useXBus()\n\n /**\n * previewResults: The results preview of the queries preview cacheable mounted.\n * It is a dictionary, indexed by the query preview query.\n *\n * params: As the request is handled in this component, we need\n * the extra params that will be used in the request.\n *\n * config: As the request is handled in this component, we need\n * the config that will be used in the request.\n */\n const { queriesPreview: previewResults, params, config } = useState('queriesPreview')\n\n /**\n * Query Preview key converted into a unique id.\n *\n * @returns The query hash.\n */\n const queryPreviewHash = computed(() =>\n getHashFromQueryPreviewInfo(props.queryPreviewInfo, {\n ...params.value,\n ...props.queryPreviewInfo.extraParams,\n }),\n )\n\n provide('queryPreviewHash', queryPreviewHash)\n\n /**\n * Gets from the state the results preview of the query preview.\n *\n * @returns The results preview of the actual query preview.\n */\n const queryPreviewResults = computed(() => {\n const resultsPreview = previewResults.value[queryPreviewHash.value]\n return resultsPreview?.results\n ? {\n ...resultsPreview,\n results: resultsPreview.results.slice(0, props.maxItemsToRender),\n }\n : undefined\n })\n\n /**\n * The results to render from the state.\n *\n * @remarks The results list are provided with `items` key. It can be\n * concatenated with list items from components such as `BannersList`, `PromotedsList`,\n * `BaseGrid` or any component that injects the list.\n *\n * @returns A list of results.\n */\n const results = computed(() => queryPreviewResults.value?.results)\n provide(LIST_ITEMS_KEY as string, results)\n\n /**\n * It injects the provided {@link FeatureLocation} of the selected query in the search request.\n *\n * @internal\n */\n const injectedLocation = inject<Ref<FeatureLocation> | FeatureLocation>('location', 'none')\n const location =\n typeof injectedLocation === 'object' && 'value' in injectedLocation\n ? injectedLocation.value\n : injectedLocation\n\n /**\n * The computed request object to be used to retrieve the query preview results.\n *\n * @returns The search request object.\n */\n const queryPreviewRequest = computed<SearchRequest>(() => {\n const origin = createOrigin({\n feature: props.queryFeature,\n location,\n })\n const filters = props.queryPreviewInfo.filters?.reduce(\n (filtersList, filterId) => {\n const facetId = filterId.split(':')[0]\n const rawFilter = createRawFilters([filterId])[0]\n filtersList[facetId] = filtersList[facetId]\n ? filtersList[facetId].concat(rawFilter)\n : [rawFilter]\n\n return filtersList\n },\n {} as Record<string, Filter[]>,\n )\n\n return {\n query: props.queryPreviewInfo.query,\n rows: config.value.maxItemsToRequest,\n extraParams: {\n ...params.value,\n ...props.queryPreviewInfo.extraParams,\n },\n filters,\n ...(origin && { origin }),\n }\n })\n\n /**\n * The debounce method to trigger the request after the debounceTimeMs defined\n * for cacheable queries.\n *\n * @returns The search request object.\n */\n const emitQueryPreviewRequestUpdated = computed<DebouncedFunction<[SearchRequest]>>(() =>\n debounceFunction(request => {\n xBus.emit('QueryPreviewRequestUpdated', request, { priority: 0, replaceable: false })\n }, props.debounceTimeMs),\n )\n\n /**\n * Initialises watcher to emit debounced requests, and first value for the requests.\n *\n * @internal\n */\n watch(queryPreviewRequest, (newRequest, oldRequest) => {\n if (!deepEqual(newRequest, oldRequest)) {\n emitQueryPreviewRequestUpdated.value(newRequest)\n }\n })\n\n const cachedQueryPreview = previewResults.value[queryPreviewHash.value]\n\n // If the query has been saved it will emit load instead of the emitting the updated request.\n if (cachedQueryPreview?.status === 'success') {\n emit('load', queryPreviewHash.value)\n xBus.emit('QueryPreviewMounted', queryPreviewHash.value, {\n priority: 0,\n replaceable: false,\n })\n } else {\n emitQueryPreviewRequestUpdated.value(queryPreviewRequest.value)\n }\n\n /**\n * Cancels the (remaining) requests when the component is destroyed\n * via the `debounce.cancel()` method.\n * If the prop 'persistInCache' is set to false, it also removes the QueryPreview\n * from the state when the component is destroyed.\n */\n onBeforeUnmount(() => {\n emitQueryPreviewRequestUpdated.value.cancel()\n xBus.emit(\n 'QueryPreviewUnmounted',\n { queryPreviewHash: queryPreviewHash.value, cache: props.persistInCache },\n {\n priority: 0,\n replaceable: false,\n },\n )\n })\n\n /**\n * Cancels the previous request when the debounced function changes (e.g: the debounceTimeMs\n * prop changes or there is a request in progress that cancels it).\n *\n * @param _new - The new debounced function.\n * @param old - The previous debounced function.\n * @internal\n */\n watch(\n emitQueryPreviewRequestUpdated,\n (_new: DebouncedFunction<[SearchRequest]>, old: DebouncedFunction<[SearchRequest]>) => {\n old.cancel()\n },\n )\n\n const queryPreviewResultsStatus = computed(() => queryPreviewResults.value?.status)\n\n /**\n * Emits an event when the query results are loaded or fail to load.\n *\n * @param status - The status of the query preview request.\n */\n watch(queryPreviewResultsStatus, () => {\n if (queryPreviewResultsStatus.value === 'success') {\n emit(results.value?.length ? 'load' : 'error', queryPreviewHash.value)\n } else if (queryPreviewResultsStatus.value === 'error') {\n emit('error', queryPreviewHash.value)\n }\n })\n\n const hasResults = computed(() => (queryPreviewResults.value?.totalResults ?? 0) > 0)\n\n /**\n * Render function to execute the `default` slot, binding `slotsProps` and getting only the\n * first `vNode` to avoid Fragments and Text root nodes.\n * If there are no results, nothing is rendered.\n *\n * @remarks `slotProps` must be values without Vue reactivity and located inside the\n * render-function to update the binding data properly.\n *\n * @returns The root `vNode` of the `default` slot or empty string if there are no results.\n */\n function renderDefaultSlot() {\n const slotProps = {\n queryPreviewInfo: props.queryPreviewInfo,\n results: queryPreviewResults.value?.results,\n totalResults: queryPreviewResults.value?.totalResults,\n displayTagging: queryPreviewResults.value?.displayTagging,\n queryTagging: queryPreviewResults.value?.queryTagging,\n }\n\n return hasResults.value ? slots.default?.(slotProps)[0] : ''\n }\n\n /* Hack to render through a render-function, the `default` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const componentProps = { hasResults, queryPreviewResults }\n return (slots.default ? renderDefaultSlot : componentProps) as typeof componentProps\n },\n})\n</script>\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`QueryPreviewRequestUpdated`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted when the component is mounted and when the properties of the request object\n changes. The event payload is the `queryPreviewRequest` object.\n\n## Vue Events\n\nA list of vue events that the component will emit:\n\n- `load`: the event is emitted when the query results have been loaded.\n- `error`: the event is emitted if there is some error when retrieving the query results.\n\n## See it in action\n\nHere you have a basic example of how the QueryPreview is rendered. Keep in mind that this component\nis intended to be used overriding its default slot. By default it will only render the names of the\nresults.\n\n```vue live\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" />\n</template>\n\n<script>\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\n\nexport default {\n name: 'QueryPreviewDemo',\n components: {\n QueryPreview,\n },\n data() {\n return {\n queryPreviewInfo: { query: 'sandals' },\n }\n },\n}\n</script>\n```\n\n### Play with the default slot\n\nIn this example, the results will be rendered inside a sliding panel.\n\n```vue live\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" #default=\"{ totalResults, results }\">\n <section>\n <p>Total results: {{ totalResults }}</p>\n <SlidingPanel :resetOnContentChange=\"false\">\n <article\n v-for=\"result in results\"\n :key=\"result.id\"\n class=\"x-result\"\n style=\"max-width: 300px; overflow: hidden\"\n >\n <BaseResultLink :result=\"result\">\n <BaseResultImage :result=\"result\" class=\"x-result__picture\" />\n </BaseResultLink>\n <div class=\"x-result__description\">\n <BaseResultLink :result=\"result\">\n <h1 class=\"x-title3\">{{ result.name }}</h1>\n </BaseResultLink>\n </div>\n </article>\n </SlidingPanel>\n </section>\n </QueryPreview>\n</template>\n\n<script>\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\nimport { BaseResultImage, BaseResultLink, SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'QueryPreviewDemoOverridingSlot',\n components: {\n BaseResultImage,\n BaseResultLink,\n QueryPreview,\n SlidingPanel,\n },\n data() {\n return {\n queryPreviewInfo: { query: 'flip-flops' },\n }\n },\n}\n</script>\n```\n\n### Play with the result slot\n\nThe component exposes a slot to override the result content, without modifying the list.\n\nIn this example, the ID of the results will be rendered along with the name.\n\n```vue\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" #result=\"{ result }\">\n <span>{{ result.id }}</span>\n <span>{{ result.name }}</span>\n </QueryPreview>\n</template>\n\n<script>\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\n\nexport default {\n name: 'QueryPreviewDemoOverridingResultSlot',\n components: {\n QueryPreview,\n },\n data() {\n return {\n queryPreviewInfo: { query: 'flip-flops' },\n }\n },\n}\n</script>\n```\n\n### Play with props\n\nIn this example, the query preview has been limited to render a maximum of 4 results.\n\n```vue\n<template>\n <QueryPreview\n :maxItemsToRender=\"maxItemsToRender\"\n :queryPreviewInfo=\"queryPreviewInfo\"\n #default=\"{ results }\"\n >\n <BaseGrid #default=\"{ item }\" :items=\"results\">\n <BaseResultLink :result=\"item\">\n <BaseResultImage :result=\"item\" />\n </BaseResultLink>\n </BaseGrid>\n </QueryPreview>\n</template>\n\n<script>\nimport { BaseGrid, BaseResultImage, BaseResultLink } from '@empathyco/x-components'\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\n\nexport default {\n name: 'QueryPreviewDemo',\n components: {\n BaseGrid,\n BaseResultImage,\n BaseResultLink,\n QueryPreview,\n },\n data() {\n return {\n maxItemsToRender: 4,\n queryPreviewInfo: { query: 'flip-flops' },\n }\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_Fragment","_renderList","_renderSlot","_createElementVNode","_toDisplayString","_createCommentVNode"],"mappings":";;;;;AAAA,EAAA,GAAA,EAAA,CAAA;AAAA,EACwB,WAAU,EAAA,eAAA;AAAA,EAAgB,KAAM,EAAA,iBAAA;;AAY1C,MAAA,UAAA,GAAA,EAAA,WAAA,EAAU,aAAa,EAAA,CAAA;;SAZzB,IAAV,CAAA,UAAA,IAAAA,SAAA,EAAA,EAAAC,kBAAA,CAeK,MAfL,UAeK,EAAA;AAAA,KAdHD,SAAA,CAAA,IAAA,CAAA,EAAAC,kBAAA;AAAA,MAaKC,QAAA;AAAA,MAAA,IAAA;AAAA,MAfTC,UAGuB,CAAA,IAAA,CAAA,mBAAA,EAAqB,OAH5C,EAAA,CAGa,MAAM,KAAA;4BADfF,kBAaK,CAAA,IAAA,EAAA;AAAA,UAXF,KAAK,MAAO,CAAA,EAAA;AAAA,UACb,KAAM,EAAA,uBAAA;AAAA,UACN,WAAU,EAAA,oBAAA;AAAA,SAAA,EAAA;UAMVG,UAEO,CAAA,IAAA,CAAA,MAAA,EAAA,QAAA,EAAA,EAFc,MAAc,EAAA,EAAnC,MAEO;AAAA,YADLC,kBAAA;AAAA,cAAsD,MAAA;AAAA,cAAtD,UAAA;AAAA,cAAsDC,eAAA,CAArB,OAAO,IAAI,CAAA;AAAA,cAAA,CAAA;AAAA;AAAA,aAAA;AAAA,WAAA,CAAA;;;;;;AAbpD,GAAA,CAAA,IAAAC,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA,CAAA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"query-preview.vue.js","sources":["../../../../../src/x-modules/queries-preview/components/query-preview.vue"],"sourcesContent":["<template>\n <ul v-if=\"hasResults\" data-test=\"query-preview\" class=\"x-query-preview\">\n <li\n v-for=\"result in queryPreviewResults?.results\"\n :key=\"result.id\"\n class=\"x-query-preview__item\"\n data-test=\"query-preview-item\"\n >\n <!--\n @slot Query Preview result slot.\n @binding {Result} result - A Query Preview result\n -->\n <slot name=\"result\" :result=\"result\">\n <span data-test=\"result-name\">{{ result.name }}</span>\n </slot>\n </li>\n </ul>\n</template>\n\n<script lang=\"ts\">\nimport type { Filter, SearchRequest } from '@empathyco/x-types'\nimport type { PropType, Ref } from 'vue'\nimport type { FeatureLocation, QueryFeature } from '../../../types'\nimport type { DebouncedFunction } from '../../../utils'\nimport type { QueryPreviewInfo } from '../store/types'\nimport { deepEqual } from '@empathyco/x-utils'\nimport { computed, defineComponent, inject, onBeforeUnmount, provide, watch } from 'vue'\nimport { LIST_ITEMS_KEY } from '../../../components'\nimport { useState, useXBus } from '../../../composables'\nimport { createOrigin, createRawFilters, debounceFunction } from '../../../utils'\nimport { getHashFromQueryPreviewInfo } from '../utils/get-hash-from-query-preview'\nimport { queriesPreviewXModule } from '../x-module'\n\n/**\n * Retrieves a preview of the results of a query and exposes them in the default slot,\n * along with the query preview and the totalResults of the search request.\n * By default, it renders the names of the results.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QueryPreview',\n xModule: queriesPreviewXModule.name,\n props: {\n /** The information about the request of the query preview. */\n queryPreviewInfo: {\n type: Object as PropType<QueryPreviewInfo>,\n required: true,\n },\n /** The origin property for the request. */\n queryFeature: {\n type: String as PropType<QueryFeature>,\n },\n /** Number of query preview results to be rendered. */\n maxItemsToRender: {\n type: Number,\n },\n /**\n * Debounce time in milliseconds for triggering the search requests.\n * It will default to 0 to fit the most common use case (pre-search),\n * and it would work properly with a 250 value inside empathize.\n */\n debounceTimeMs: {\n type: Number,\n default: 0,\n },\n /**\n * Controls whether the QueryPreview should be removed from the state\n * when the component is destroyed.\n */\n persistInCache: {\n type: Boolean,\n default: false,\n },\n },\n emits: ['load', 'error'],\n setup(props, { emit, slots }) {\n const xBus = useXBus()\n\n /**\n * previewResults: The results preview of the queries preview cacheable mounted.\n * It is a dictionary, indexed by the query preview query.\n *\n * params: As the request is handled in this component, we need\n * the extra params that will be used in the request.\n *\n * config: As the request is handled in this component, we need\n * the config that will be used in the request.\n */\n const { queriesPreview: previewResults, params, config } = useState('queriesPreview')\n\n /**\n * Query Preview key converted into a unique id.\n *\n * @returns The query hash.\n */\n const queryPreviewHash = computed(() =>\n getHashFromQueryPreviewInfo(props.queryPreviewInfo, {\n ...params.value,\n ...props.queryPreviewInfo.extraParams,\n }),\n )\n\n provide('queryPreviewHash', queryPreviewHash)\n\n /**\n * Gets from the state the results preview of the query preview.\n *\n * @returns The results preview of the actual query preview.\n */\n const queryPreviewResults = computed(() => {\n const resultsPreview = previewResults.value[queryPreviewHash.value]\n return resultsPreview?.results\n ? {\n ...resultsPreview,\n results: resultsPreview.results.slice(0, props.maxItemsToRender),\n }\n : undefined\n })\n\n /**\n * The results to render from the state.\n *\n * @remarks The results list are provided with `items` key. It can be\n * concatenated with list items from components such as `BannersList`, `PromotedsList`,\n * `BaseGrid` or any component that injects the list.\n *\n * @returns A list of results.\n */\n const results = computed(() => queryPreviewResults.value?.results)\n provide(LIST_ITEMS_KEY as string, results)\n\n /**\n * It injects the provided {@link FeatureLocation} of the selected query in the search request.\n *\n * @internal\n */\n const injectedLocation = inject<Ref<FeatureLocation> | FeatureLocation>('location', 'none')\n const location =\n typeof injectedLocation === 'object' && 'value' in injectedLocation\n ? injectedLocation.value\n : injectedLocation\n\n /**\n * The computed request object to be used to retrieve the query preview results.\n *\n * @returns The search request object.\n */\n const queryPreviewRequest = computed<SearchRequest>(() => {\n const origin = createOrigin({\n feature: props.queryFeature,\n location,\n })\n const filters = props.queryPreviewInfo.filters?.reduce(\n (filtersList, filterId) => {\n const facetId = filterId.split(':')[0]\n const rawFilter = createRawFilters([filterId])[0]\n filtersList[facetId] = filtersList[facetId]\n ? filtersList[facetId].concat(rawFilter)\n : [rawFilter]\n\n return filtersList\n },\n {} as Record<string, Filter[]>,\n )\n\n return {\n query: props.queryPreviewInfo.query,\n rows: config.value.maxItemsToRequest,\n extraParams: {\n ...params.value,\n ...props.queryPreviewInfo.extraParams,\n },\n filters,\n ...(origin && { origin }),\n }\n })\n\n /**\n * The debounce method to trigger the request after the debounceTimeMs defined\n * for cacheable queries.\n *\n * @returns The search request object.\n */\n const emitQueryPreviewRequestUpdated = computed<DebouncedFunction<[SearchRequest]>>(() =>\n debounceFunction(request => {\n xBus.emit('QueryPreviewRequestUpdated', request, { priority: 0, replaceable: false })\n }, props.debounceTimeMs),\n )\n\n /**\n * Initialises watcher to emit debounced requests, and first value for the requests.\n *\n * @internal\n */\n watch(queryPreviewRequest, (newRequest, oldRequest) => {\n if (!deepEqual(newRequest, oldRequest)) {\n emitQueryPreviewRequestUpdated.value(newRequest)\n }\n })\n\n const cachedQueryPreview = previewResults.value[queryPreviewHash.value]\n\n // If the query has been saved it will emit load instead of the emitting the updated request.\n if (cachedQueryPreview?.status === 'success') {\n emit('load', queryPreviewHash.value)\n xBus.emit('QueryPreviewMounted', queryPreviewHash.value, {\n priority: 0,\n replaceable: false,\n })\n } else {\n emitQueryPreviewRequestUpdated.value(queryPreviewRequest.value)\n }\n\n /**\n * Cancels the (remaining) requests when the component is destroyed\n * via the `debounce.cancel()` method.\n * If the prop 'persistInCache' is set to false, it also removes the QueryPreview\n * from the state when the component is destroyed.\n */\n onBeforeUnmount(() => {\n emitQueryPreviewRequestUpdated.value.cancel()\n xBus.emit(\n 'QueryPreviewUnmounted',\n { queryPreviewHash: queryPreviewHash.value, cache: props.persistInCache },\n {\n priority: 0,\n replaceable: false,\n },\n )\n })\n\n /**\n * Cancels the previous request when the debounced function changes (e.g: the debounceTimeMs\n * prop changes or there is a request in progress that cancels it).\n *\n * @param _new - The new debounced function.\n * @param old - The previous debounced function.\n * @internal\n */\n watch(\n emitQueryPreviewRequestUpdated,\n (_new: DebouncedFunction<[SearchRequest]>, old: DebouncedFunction<[SearchRequest]>) => {\n old.cancel()\n },\n )\n\n const queryPreviewResultsStatus = computed(() => queryPreviewResults.value?.status)\n\n /**\n * Emits an event when the query results are loaded or fail to load.\n *\n * @param status - The status of the query preview request.\n */\n watch(queryPreviewResultsStatus, () => {\n if (queryPreviewResultsStatus.value === 'success') {\n emit(results.value?.length ? 'load' : 'error', queryPreviewHash.value)\n } else if (queryPreviewResultsStatus.value === 'error') {\n emit('error', queryPreviewHash.value)\n }\n })\n\n const hasResults = computed(() => (queryPreviewResults.value?.totalResults ?? 0) > 0)\n\n /**\n * Render function to execute the `default` slot, binding `slotsProps` and getting only the\n * first `vNode` to avoid Fragments and Text root nodes.\n * If there are no results, nothing is rendered.\n *\n * @remarks `slotProps` must be values without Vue reactivity and located inside the\n * render-function to update the binding data properly.\n *\n * @returns The root `vNode` of the `default` slot or empty string if there are no results.\n */\n function renderDefaultSlot() {\n const slotProps = {\n queryPreviewInfo: props.queryPreviewInfo,\n results: queryPreviewResults.value?.results,\n totalResults: queryPreviewResults.value?.totalResults,\n displayTagging: queryPreviewResults.value?.displayTagging,\n queryTagging: queryPreviewResults.value?.queryTagging,\n }\n\n return hasResults.value ? slots.default?.(slotProps)[0] : ''\n }\n\n /* Hack to render through a render-function, the `default` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const componentProps = { hasResults, queryPreviewResults }\n return (slots.default ? renderDefaultSlot : componentProps) as typeof componentProps\n },\n})\n</script>\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`QueryPreviewRequestUpdated`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted when the component is mounted and when the properties of the request object\n changes. The event payload is the `queryPreviewRequest` object.\n\n## Vue Events\n\nA list of vue events that the component will emit:\n\n- `load`: the event is emitted when the query results have been loaded.\n- `error`: the event is emitted if there is some error when retrieving the query results.\n\n## See it in action\n\nHere you have a basic example of how the QueryPreview is rendered. Keep in mind that this component\nis intended to be used overriding its default slot. By default it will only render the names of the\nresults.\n\n```vue live\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" />\n</template>\n\n<script>\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\n\nexport default {\n name: 'QueryPreviewDemo',\n components: {\n QueryPreview,\n },\n data() {\n return {\n queryPreviewInfo: { query: 'sandals' },\n }\n },\n}\n</script>\n```\n\n### Play with the default slot\n\nIn this example, the results will be rendered inside a sliding panel.\n\n```vue live\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" #default=\"{ totalResults, results }\">\n <section>\n <p>Total results: {{ totalResults }}</p>\n <SlidingPanel :resetOnContentChange=\"false\">\n <article\n v-for=\"result in results\"\n :key=\"result.id\"\n class=\"x-result\"\n style=\"max-width: 300px; overflow: hidden\"\n >\n <BaseResultLink :result=\"result\">\n <BaseResultImage :result=\"result\" class=\"x-result__picture\" />\n </BaseResultLink>\n <div class=\"x-result__description\">\n <BaseResultLink :result=\"result\">\n <h1 class=\"x-title3\">{{ result.name }}</h1>\n </BaseResultLink>\n </div>\n </article>\n </SlidingPanel>\n </section>\n </QueryPreview>\n</template>\n\n<script>\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\nimport { BaseResultImage, BaseResultLink, SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'QueryPreviewDemoOverridingSlot',\n components: {\n BaseResultImage,\n BaseResultLink,\n QueryPreview,\n SlidingPanel,\n },\n data() {\n return {\n queryPreviewInfo: { query: 'flip-flops' },\n }\n },\n}\n</script>\n```\n\n### Play with the result slot\n\nThe component exposes a slot to override the result content, without modifying the list.\n\nIn this example, the ID of the results will be rendered along with the name.\n\n```vue\n<template>\n <QueryPreview :queryPreviewInfo=\"queryPreviewInfo\" #result=\"{ result }\">\n <span>{{ result.id }}</span>\n <span>{{ result.name }}</span>\n </QueryPreview>\n</template>\n\n<script>\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\n\nexport default {\n name: 'QueryPreviewDemoOverridingResultSlot',\n components: {\n QueryPreview,\n },\n data() {\n return {\n queryPreviewInfo: { query: 'flip-flops' },\n }\n },\n}\n</script>\n```\n\n### Play with props\n\nIn this example, the query preview has been limited to render a maximum of 4 results.\n\n```vue\n<template>\n <QueryPreview\n :maxItemsToRender=\"maxItemsToRender\"\n :queryPreviewInfo=\"queryPreviewInfo\"\n #default=\"{ results }\"\n >\n <BaseGrid #default=\"{ item }\" :items=\"results\">\n <BaseResultLink :result=\"item\">\n <BaseResultImage :result=\"item\" />\n </BaseResultLink>\n </BaseGrid>\n </QueryPreview>\n</template>\n\n<script>\nimport { BaseGrid, BaseResultImage, BaseResultLink } from '@empathyco/x-components'\nimport { QueryPreview } from '@empathyco/x-components/queries-preview'\n\nexport default {\n name: 'QueryPreviewDemo',\n components: {\n BaseGrid,\n BaseResultImage,\n BaseResultLink,\n QueryPreview,\n },\n data() {\n return {\n maxItemsToRender: 4,\n queryPreviewInfo: { query: 'flip-flops' },\n }\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_Fragment","_renderList","_renderSlot","_createElementVNode","_toDisplayString"],"mappings":";;;;;;EACwB,WAAU,EAAA,eAAA;AAAA,EAAgB,KAAM,EAAA,iBAAA;;AAY1C,MAAA,UAAA,GAAA,EAAA,WAAA,EAAU,aAAa,EAAA,CAAA;;SAZzB,IAAV,CAAA,UAAA,IAAAA,SAAA,EAAA,EAAAC,kBAAA,CAeK,MAfL,UAeK,EAAA;AAAA,KAdHD,SAAA,CAAA,IAAA,CAAA,EAAAC,kBAAA;AAAA,MAaKC,QAAA;AAAA,MAAA,IAAA;AAAA,MAZcC,UAAA,CAAA,IAAA,CAAA,mBAAA,EAAqB,OAAO,EAAA,CAAtC,MAAM,KAAA;4BADfF,kBAaK,CAAA,IAAA,EAAA;AAAA,UAXF,KAAK,MAAO,CAAA,EAAA;AAAA,UACb,KAAM,EAAA,uBAAA;AAAA,UACN,WAAU,EAAA,oBAAA;AAAA,SAAA,EAAA;UAMVG,UAEO,CAAA,IAAA,CAAA,MAAA,EAAA,QAAA,EAAA,EAFc,MAAc,EAAA,EAAnC,MAEO;AAAA,YADLC,kBAAA;AAAA,cAAsD,MAAA;AAAA,cAAtD,UAAA;AAAA,cAAsDC,eAAA,CAArB,OAAO,IAAI,CAAA;AAAA,cAAA,CAAA;AAAA;AAAA,aAAA;AAAA,WAAA,CAAA;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-suggestion.vue.js","sources":["../../../../../src/x-modules/query-suggestions/components/query-suggestion.vue"],"sourcesContent":["<template>\n <BaseSuggestion\n v-slot=\"baseScope\"\n v-bind=\"{ query, suggestion, suggestionSelectedEvents }\"\n class=\"x-query-suggestion\"\n data-test=\"query-suggestion\"\n feature=\"query_suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Query Suggestion content\n @binding {Object} v-bind - `BaseSuggestion` default slot scope: **suggestion** <code>Suggestion</code> - Suggestion data<br /> **query** <code>string</code> - The query that the suggestion belongs to<br /> **filter** <code>Filter \\| undefined</code> - Suggestion's filter\n -->\n <!-- eslint-enable max-len -->\n <slot v-bind=\"{ ...baseScope }\" />\n </BaseSuggestion>\n</template>\n\n<script lang=\"ts\">\nimport type { Suggestion } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport BaseSuggestion from '../../../components/suggestions/base-suggestion.vue'\nimport { useGetter } from '../../../composables'\nimport { querySuggestionsXModule } from '../x-module'\n\n/**\n * This component renders a suggestion for a query. A query suggestion is a recommended query\n * based on previous search queries. It contains the query itself and a set of filters associated.\n * For example, if you're searching for _shirt_, a query suggestion could be _long sleeve shirt_.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QuerySuggestion',\n xModule: querySuggestionsXModule.name,\n components: { BaseSuggestion },\n props: {\n /** The suggestion to render. */\n suggestion: {\n type: Object as PropType<Suggestion>,\n required: true,\n },\n },\n setup(props) {\n /** The normalized query of the query-suggestions module. */\n const query = useGetter('querySuggestions').normalizedQuery\n\n /**\n * Emits {@link QuerySuggestionsXEvents.UserSelectedAQuerySuggestion} with the suggestion as\n * payload when selecting the query suggestion.\n */\n const suggestionSelectedEvents = {\n UserSelectedAQuerySuggestion: props.suggestion,\n }\n\n return {\n query,\n suggestionSelectedEvents,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`UserSelectedAQuerySuggestion`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button. The event payload is the query suggestion\n data.\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend microservice required\nTo use this component, the <b>Empathize</b> microservice must be\nimplemented.\n:::\n<!-- prettier-ignore-end -->\n\nHere you can see how a single query suggestion is rendered using the `suggestion` prop.\n\n```vue live\n<template>\n <QuerySuggestion :suggestion=\"suggestion\" />\n</template>\n\n<script>\nimport { QuerySuggestion } from '@empathyco/x-components/query-suggestions'\nexport default {\n name: 'QuerySuggestionDemo',\n components: {\n QuerySuggestion,\n },\n data() {\n return {\n suggestion: {\n modelName: 'QuerySuggestion',\n query: 'tshirt',\n facets: [],\n },\n }\n },\n}\n</script>\n```\n\n### Play with default slot\n\nIn this example, we are adding an emoji next to the suggestion.\n\n```vue live\n<template>\n <QuerySuggestion :suggestion=\"suggestion\" #default=\"{ suggestion }\">\n <span>🔍</span>\n <span>{{ suggestion.query }}</span>\n </QuerySuggestion>\n</template>\n\n<script>\nimport { QuerySuggestion } from '@empathyco/x-components/query-suggestions'\nexport default {\n name: 'QuerySuggestionDemo',\n components: {\n QuerySuggestion,\n },\n data() {\n return {\n suggestion: {\n modelName: 'QuerySuggestion',\n query: 'tshirt',\n facets: [],\n },\n }\n },\n}\n</script>\n```\n\n### Play with events\n\nIn this example, when you click on the query suggestion, a message is displayed to illustrate that\nthe `UserSelectedAQuerySuggestion` event has been triggered.\n\n```vue live\n<template>\n <QuerySuggestion :suggestion=\"suggestion\" @UserSelectedAQuerySuggestion=\"alertSuggestion\" />\n</template>\n\n<script>\nimport { QuerySuggestion } from '@empathyco/x-components/query-suggestions'\nexport default {\n name: 'QuerySuggestionDemo',\n components: {\n QuerySuggestion,\n },\n data() {\n return {\n suggestion: {\n modelName: 'QuerySuggestion',\n query: 'tshirt',\n facets: [],\n },\n }\n },\n methods: {\n alertSuggestion(querySuggestion) {\n alert(`You have clicked the query suggestion: ${querySuggestion.query}`)\n },\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createBlock","_mergeProps","_withCtx","_renderSlot"
|
|
1
|
+
{"version":3,"file":"query-suggestion.vue.js","sources":["../../../../../src/x-modules/query-suggestions/components/query-suggestion.vue"],"sourcesContent":["<template>\n <BaseSuggestion\n v-slot=\"baseScope\"\n v-bind=\"{ query, suggestion, suggestionSelectedEvents }\"\n class=\"x-query-suggestion\"\n data-test=\"query-suggestion\"\n feature=\"query_suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Query Suggestion content\n @binding {Object} v-bind - `BaseSuggestion` default slot scope: **suggestion** <code>Suggestion</code> - Suggestion data<br /> **query** <code>string</code> - The query that the suggestion belongs to<br /> **filter** <code>Filter \\| undefined</code> - Suggestion's filter\n -->\n <!-- eslint-enable max-len -->\n <slot v-bind=\"{ ...baseScope }\" />\n </BaseSuggestion>\n</template>\n\n<script lang=\"ts\">\nimport type { Suggestion } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport BaseSuggestion from '../../../components/suggestions/base-suggestion.vue'\nimport { useGetter } from '../../../composables'\nimport { querySuggestionsXModule } from '../x-module'\n\n/**\n * This component renders a suggestion for a query. A query suggestion is a recommended query\n * based on previous search queries. It contains the query itself and a set of filters associated.\n * For example, if you're searching for _shirt_, a query suggestion could be _long sleeve shirt_.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QuerySuggestion',\n xModule: querySuggestionsXModule.name,\n components: { BaseSuggestion },\n props: {\n /** The suggestion to render. */\n suggestion: {\n type: Object as PropType<Suggestion>,\n required: true,\n },\n },\n setup(props) {\n /** The normalized query of the query-suggestions module. */\n const query = useGetter('querySuggestions').normalizedQuery\n\n /**\n * Emits {@link QuerySuggestionsXEvents.UserSelectedAQuerySuggestion} with the suggestion as\n * payload when selecting the query suggestion.\n */\n const suggestionSelectedEvents = {\n UserSelectedAQuerySuggestion: props.suggestion,\n }\n\n return {\n query,\n suggestionSelectedEvents,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`UserSelectedAQuerySuggestion`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the button. The event payload is the query suggestion\n data.\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend microservice required\nTo use this component, the <b>Empathize</b> microservice must be\nimplemented.\n:::\n<!-- prettier-ignore-end -->\n\nHere you can see how a single query suggestion is rendered using the `suggestion` prop.\n\n```vue live\n<template>\n <QuerySuggestion :suggestion=\"suggestion\" />\n</template>\n\n<script>\nimport { QuerySuggestion } from '@empathyco/x-components/query-suggestions'\nexport default {\n name: 'QuerySuggestionDemo',\n components: {\n QuerySuggestion,\n },\n data() {\n return {\n suggestion: {\n modelName: 'QuerySuggestion',\n query: 'tshirt',\n facets: [],\n },\n }\n },\n}\n</script>\n```\n\n### Play with default slot\n\nIn this example, we are adding an emoji next to the suggestion.\n\n```vue live\n<template>\n <QuerySuggestion :suggestion=\"suggestion\" #default=\"{ suggestion }\">\n <span>🔍</span>\n <span>{{ suggestion.query }}</span>\n </QuerySuggestion>\n</template>\n\n<script>\nimport { QuerySuggestion } from '@empathyco/x-components/query-suggestions'\nexport default {\n name: 'QuerySuggestionDemo',\n components: {\n QuerySuggestion,\n },\n data() {\n return {\n suggestion: {\n modelName: 'QuerySuggestion',\n query: 'tshirt',\n facets: [],\n },\n }\n },\n}\n</script>\n```\n\n### Play with events\n\nIn this example, when you click on the query suggestion, a message is displayed to illustrate that\nthe `UserSelectedAQuerySuggestion` event has been triggered.\n\n```vue live\n<template>\n <QuerySuggestion :suggestion=\"suggestion\" @UserSelectedAQuerySuggestion=\"alertSuggestion\" />\n</template>\n\n<script>\nimport { QuerySuggestion } from '@empathyco/x-components/query-suggestions'\nexport default {\n name: 'QuerySuggestionDemo',\n components: {\n QuerySuggestion,\n },\n data() {\n return {\n suggestion: {\n modelName: 'QuerySuggestion',\n query: 'tshirt',\n facets: [],\n },\n }\n },\n methods: {\n alertSuggestion(querySuggestion) {\n alert(`You have clicked the query suggestion: ${querySuggestion.query}`)\n },\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createBlock","_mergeProps","_withCtx","_renderSlot"],"mappings":";;;;;;AACE,EAAA,OAAAA,SAAA,EAAA,EAAAC,WAAA;AAAA,IAciB,yBAAA;AAAA,IAdjBC,WAciB,EAZL,KAAA,EAAA,IAAA,CAAA,KAAA,EAAK,UAAE,EAAA,IAAA,CAAA,UAAA,EAAU,0BAAE,IAAwB,CAAA,wBAAA,EAAA,EAAA;AAAA,MACrD,KAAM,EAAA,oBAAA;AAAA,MACN,WAAU,EAAA,kBAAA;AAAA,MACV,OAAQ,EAAA,kBAAA;AAAA,KAAA,CAAA;;AAQR,MAAA,OAAA,EAAAC,OAAA,CAAA,CAAkC,SAZjB,KAAA;AAAA,QAYjBC,UAAA,CAAkC,+DAAf,SAAS,EAAA,CAAA,CAAA,CAAA;AAAA,OAAA,CAAA;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-suggestions.vue.js","sources":["../../../../../src/x-modules/query-suggestions/components/query-suggestions.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"suggestions\"\n class=\"x-query-suggestions\"\n data-test=\"query-suggestions\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom component that replaces the `QuerySuggestion` component\n @binding {Object} v-bind - Query Suggestion attributes:<br /> - **suggestion** `Suggestion` - Query Suggestion data<br /> - **index** `number` - Query Suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope }\">\n <QuerySuggestion\n v-slot=\"querySuggestionScope\"\n :suggestion=\"baseScope.suggestion\"\n class=\"x-query-suggestions__suggestion x-suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom content that replaces the `QuerySuggestion` default content\n @binding {Object} v-bind - Query Suggestion attributes:<br /> - **suggestion** `Suggestion` - Query Suggestion data<br /> - **index** `number` - Query Suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...querySuggestionScope }\" />\n </QuerySuggestion>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables'\nimport { querySuggestionsXModule } from '../x-module'\nimport QuerySuggestion from './query-suggestion.vue'\n\n/**\n * This component renders a list of possible search queries to select from as a query is entered\n * in the input field. By default, this is a list of\n * [`QuerySuggestion`](./x-components.query-suggestion.md) components.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QuerySuggestions',\n xModule: querySuggestionsXModule.name,\n components: { BaseSuggestions, QuerySuggestion },\n setup() {\n /** The module's list of suggestions. */\n const { querySuggestions } = useGetter('querySuggestions')\n\n return { suggestions: querySuggestions }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Inherited props\n\nThis component inherits the [`BaseSuggestions`](../base-components/x-components.base-suggestions.md)\nprops.\n\n| Name | Description | Type | Default |\n| ------------------ | ------------------------------------------- | -------- | ------- |\n| `animation` | Animation component for `QuerySuggestions`. | `Vue` | `\"ul\"` |\n| `maxItemsToRender` | Number of query suggestions to be rendered. | `number` | |\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend microservice required\nTo use this component, the <b>Empathize</b> microservice must be\nimplemented.\n:::\n<!-- prettier-ignore-end -->\n\nIn this example, a list of query suggestions is displayed. See how the suggestions change as you\ntype “sandal”. If you click on a suggestion, the search term in the search input is updated and the\nquery suggestions are changed to reflect the new search term.\n\n_Type “sandal” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions />\n </div>\n</template>\n\n<script>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n\nexport default {\n name: 'QuerySuggestionsDemo',\n components: {\n QuerySuggestions,\n SearchInput,\n },\n}\n</script>\n```\n\n### Play with props\n\nIn this example, an `StaggeredFadeAndSlide` animation component has been passed as prop, so that the\nmatching query suggestions are shuffled with a slight delay as more letters of the term are typed.\n\n_Type “lipstick” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions :animation=\"'StaggeredFadeAndSlide'\" />\n </div>\n</template>\n\n<script>\nimport Vue from 'vue'\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { StaggeredFadeAndSlide } from '@empathyco/x-components'\n\n// Registering the animation as a global component\nVue.component('StaggeredFadeAndSlide', StaggeredFadeAndSlide)\nexport default {\n name: 'QuerySuggestionsDemo',\n components: {\n QuerySuggestions,\n SearchInput,\n },\n}\n</script>\n```\n\n### Play with suggestion slot\n\nHere, the `suggestion` binding property passes the suggestion data.\n\n_Type “bag” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions #suggestion=\"{ suggestion }\">\n <QuerySuggestion :suggestion=\"suggestion\" #default=\"{ suggestion }\">\n <span>🔍</span>\n <span>{{ suggestion.query }}</span>\n </QuerySuggestion>\n </QuerySuggestions>\n </div>\n</template>\n\n<script>\nimport { QuerySuggestion, QuerySuggestions } from '@empathyco/x-components/query-suggestions'\n\nexport default {\n name: 'QuerySuggestionsDemo',\n components: {\n QuerySuggestion,\n QuerySuggestions,\n },\n}\n</script>\n```\n\n<!-- prettier-ignore-start -->\n::: danger\nIf you're not using the [`QuerySuggestion`](./query-suggestion.md) component, then\nyou must implement the `UserAcceptedAQuery` and `UserSelectedAQuerySuggestion` events in\n`QuerySuggestions`.\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions #suggestion=\"{ suggestion }\">\n <button @click=\"emitSuggestionClickedEvents($event, suggestion)\">\n {{ suggestion.query }}\n </button>\n </QuerySuggestions>\n </div>\n</template>\n\n<script>\n import { QuerySuggestions } from '@empathyco/x-components/query-suggestions';\n import { SearchInput } from '@empathyco/x-components/search-box';\n\n export default {\n name: 'QuerySuggestionsDemo',\n components: {\n SearchInput,\n QuerySuggestions\n },\n methods: {\n emitSuggestionClickedEvents(event, suggestion) {\n this.$x.emit('UserAcceptedAQuery', suggestion.query, {\n target: event.target\n });\n this.$x.emit('UserSelectedASuggestion', suggestion, {\n target: event.target\n });\n this.$x.emit('UserSelectedAQuerySuggestion', suggestion, {\n target: event.target\n });\n }\n }\n };\n</script>\n```\n\n:::\n<!-- prettier-ignore-end -->\n\n### Play with suggestion-content slot\n\nIn this example, the `suggestion` and `query` properties of the `suggestion-content` slot are used\nto paint a suggestion with an icon.\n\n_Type “trousers” or another toy in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions #suggestion-content=\"{ suggestion, query }\">\n <span>🔍</span>\n <Highlight :text=\"suggestion.query\" :highlight=\"query\" />\n </QuerySuggestions>\n </div>\n</template>\n\n<script>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { Highlight } from '@empathyco/x-components'\n\nexport default {\n name: 'QuerySuggestionsDemo',\n components: {\n SearchInput,\n QuerySuggestions,\n Highlight,\n },\n}\n</script>\n```\n\n## Extending the component\n\nComponents can be combined and communicate with each other. Commonly, the `QuerySuggestions`\ncomponent communicates with the [`SearchInput`](../search-box/x-components.search-input.md),\nupdating the term in the search input.\n\n_Type “pants” or another toy in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions />\n </div>\n</template>\n\n<script>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n\nexport default {\n name: 'QuerySuggestionsDemo',\n components: {\n SearchInput,\n QuerySuggestions,\n },\n}\n</script>\n```\n</docs>\n"],"names":["_createBlock","_withCtx","_renderSlot","_normalizeProps","_guardReactiveProps","_createVNode"],"mappings":";;;;;;;sBACEA,WA4BkB,CAAA,0BAAA,EAAA;AAAA,IA3Bf,WAAa,EAAA,IAAA,CAAA,WAAA;AAAA,IACd,KAAM,EAAA,qBAAA;AAAA,IACN,WAAU,EAAA,mBAAA;AAAA,GAAA,EAAA;IAEC,OAAO,EAAAC,OAAA,CAOhB,CAcO,SArBoB,KAAA;AAAA,MAO3BC,UAcO,CAAA,IAAA,CAAA,MAAA,EAAA,YAAA,
|
|
1
|
+
{"version":3,"file":"query-suggestions.vue.js","sources":["../../../../../src/x-modules/query-suggestions/components/query-suggestions.vue"],"sourcesContent":["<template>\n <BaseSuggestions\n :suggestions=\"suggestions\"\n class=\"x-query-suggestions\"\n data-test=\"query-suggestions\"\n >\n <template #default=\"baseScope\">\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom component that replaces the `QuerySuggestion` component\n @binding {Object} v-bind - Query Suggestion attributes:<br /> - **suggestion** `Suggestion` - Query Suggestion data<br /> - **index** `number` - Query Suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion\" v-bind=\"{ ...baseScope }\">\n <QuerySuggestion\n v-slot=\"querySuggestionScope\"\n :suggestion=\"baseScope.suggestion\"\n class=\"x-query-suggestions__suggestion x-suggestion\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom content that replaces the `QuerySuggestion` default content\n @binding {Object} v-bind - Query Suggestion attributes:<br /> - **suggestion** `Suggestion` - Query Suggestion data<br /> - **index** `number` - Query Suggestion index\n -->\n <!-- eslint-enable max-len -->\n <slot name=\"suggestion-content\" v-bind=\"{ ...baseScope, ...querySuggestionScope }\" />\n </QuerySuggestion>\n </slot>\n </template>\n </BaseSuggestions>\n</template>\n\n<script lang=\"ts\">\nimport { defineComponent } from 'vue'\nimport BaseSuggestions from '../../../components/suggestions/base-suggestions.vue'\nimport { useGetter } from '../../../composables'\nimport { querySuggestionsXModule } from '../x-module'\nimport QuerySuggestion from './query-suggestion.vue'\n\n/**\n * This component renders a list of possible search queries to select from as a query is entered\n * in the input field. By default, this is a list of\n * [`QuerySuggestion`](./x-components.query-suggestion.md) components.\n *\n * @public\n */\nexport default defineComponent({\n name: 'QuerySuggestions',\n xModule: querySuggestionsXModule.name,\n components: { BaseSuggestions, QuerySuggestion },\n setup() {\n /** The module's list of suggestions. */\n const { querySuggestions } = useGetter('querySuggestions')\n\n return { suggestions: querySuggestions }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Inherited props\n\nThis component inherits the [`BaseSuggestions`](../base-components/x-components.base-suggestions.md)\nprops.\n\n| Name | Description | Type | Default |\n| ------------------ | ------------------------------------------- | -------- | ------- |\n| `animation` | Animation component for `QuerySuggestions`. | `Vue` | `\"ul\"` |\n| `maxItemsToRender` | Number of query suggestions to be rendered. | `number` | |\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend microservice required\nTo use this component, the <b>Empathize</b> microservice must be\nimplemented.\n:::\n<!-- prettier-ignore-end -->\n\nIn this example, a list of query suggestions is displayed. See how the suggestions change as you\ntype “sandal”. If you click on a suggestion, the search term in the search input is updated and the\nquery suggestions are changed to reflect the new search term.\n\n_Type “sandal” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions />\n </div>\n</template>\n\n<script>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n\nexport default {\n name: 'QuerySuggestionsDemo',\n components: {\n QuerySuggestions,\n SearchInput,\n },\n}\n</script>\n```\n\n### Play with props\n\nIn this example, an `StaggeredFadeAndSlide` animation component has been passed as prop, so that the\nmatching query suggestions are shuffled with a slight delay as more letters of the term are typed.\n\n_Type “lipstick” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions :animation=\"'StaggeredFadeAndSlide'\" />\n </div>\n</template>\n\n<script>\nimport Vue from 'vue'\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { StaggeredFadeAndSlide } from '@empathyco/x-components'\n\n// Registering the animation as a global component\nVue.component('StaggeredFadeAndSlide', StaggeredFadeAndSlide)\nexport default {\n name: 'QuerySuggestionsDemo',\n components: {\n QuerySuggestions,\n SearchInput,\n },\n}\n</script>\n```\n\n### Play with suggestion slot\n\nHere, the `suggestion` binding property passes the suggestion data.\n\n_Type “bag” or another fashion term in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions #suggestion=\"{ suggestion }\">\n <QuerySuggestion :suggestion=\"suggestion\" #default=\"{ suggestion }\">\n <span>🔍</span>\n <span>{{ suggestion.query }}</span>\n </QuerySuggestion>\n </QuerySuggestions>\n </div>\n</template>\n\n<script>\nimport { QuerySuggestion, QuerySuggestions } from '@empathyco/x-components/query-suggestions'\n\nexport default {\n name: 'QuerySuggestionsDemo',\n components: {\n QuerySuggestion,\n QuerySuggestions,\n },\n}\n</script>\n```\n\n<!-- prettier-ignore-start -->\n::: danger\nIf you're not using the [`QuerySuggestion`](./query-suggestion.md) component, then\nyou must implement the `UserAcceptedAQuery` and `UserSelectedAQuerySuggestion` events in\n`QuerySuggestions`.\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions #suggestion=\"{ suggestion }\">\n <button @click=\"emitSuggestionClickedEvents($event, suggestion)\">\n {{ suggestion.query }}\n </button>\n </QuerySuggestions>\n </div>\n</template>\n\n<script>\n import { QuerySuggestions } from '@empathyco/x-components/query-suggestions';\n import { SearchInput } from '@empathyco/x-components/search-box';\n\n export default {\n name: 'QuerySuggestionsDemo',\n components: {\n SearchInput,\n QuerySuggestions\n },\n methods: {\n emitSuggestionClickedEvents(event, suggestion) {\n this.$x.emit('UserAcceptedAQuery', suggestion.query, {\n target: event.target\n });\n this.$x.emit('UserSelectedASuggestion', suggestion, {\n target: event.target\n });\n this.$x.emit('UserSelectedAQuerySuggestion', suggestion, {\n target: event.target\n });\n }\n }\n };\n</script>\n```\n\n:::\n<!-- prettier-ignore-end -->\n\n### Play with suggestion-content slot\n\nIn this example, the `suggestion` and `query` properties of the `suggestion-content` slot are used\nto paint a suggestion with an icon.\n\n_Type “trousers” or another toy in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions #suggestion-content=\"{ suggestion, query }\">\n <span>🔍</span>\n <Highlight :text=\"suggestion.query\" :highlight=\"query\" />\n </QuerySuggestions>\n </div>\n</template>\n\n<script>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { Highlight } from '@empathyco/x-components'\n\nexport default {\n name: 'QuerySuggestionsDemo',\n components: {\n SearchInput,\n QuerySuggestions,\n Highlight,\n },\n}\n</script>\n```\n\n## Extending the component\n\nComponents can be combined and communicate with each other. Commonly, the `QuerySuggestions`\ncomponent communicates with the [`SearchInput`](../search-box/x-components.search-input.md),\nupdating the term in the search input.\n\n_Type “pants” or another toy in the input field to try it out!_\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <QuerySuggestions />\n </div>\n</template>\n\n<script>\nimport { QuerySuggestions } from '@empathyco/x-components/query-suggestions'\nimport { SearchInput } from '@empathyco/x-components/search-box'\n\nexport default {\n name: 'QuerySuggestionsDemo',\n components: {\n SearchInput,\n QuerySuggestions,\n },\n}\n</script>\n```\n</docs>\n"],"names":["_createBlock","_withCtx","_renderSlot","_normalizeProps","_guardReactiveProps","_createVNode"],"mappings":";;;;;;;sBACEA,WA4BkB,CAAA,0BAAA,EAAA;AAAA,IA3Bf,WAAa,EAAA,IAAA,CAAA,WAAA;AAAA,IACd,KAAM,EAAA,qBAAA;AAAA,IACN,WAAU,EAAA,mBAAA;AAAA,GAAA,EAAA;IAEC,OAAO,EAAAC,OAAA,CAOhB,CAcO,SArBoB,KAAA;AAAA,MAO3BC,UAcO,CAAA,IAAA,CAAA,MAAA,EAAA,YAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAd8B,SAAS,EAAA,CAAA,CAAA,EAA9C,MAcO;AAAA,QAbLC,WAYkB,CAAA,0BAAA,EAAA;AAAA,UAVf,YAAY,SAAU,CAAA,UAAA;AAAA,UACvB,KAAM,EAAA,8CAAA;AAAA,SAAA,EAAA;AAQN,UAAA,OAAA,EAAAJ,OAAA,CAAA,CAAqF,oBAVzD,KAAA;AAAA,YAU5BC,UAAqF,CAAA,IAAA,CAAA,MAAA,EAAA,oBAAA,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAAxC,SAAS,EAAA,GAAK,oBAAoB,EAAA,CAAA,CAAA,CAAA;AAAA,WAAA,CAAA;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recommendations.vue.js","sources":["../../../../../src/x-modules/recommendations/components/recommendations.vue"],"sourcesContent":["<template>\n <component\n :is=\"animation\"\n v-if=\"recommendations.length\"\n tag=\"ul\"\n data-test=\"recommendations\"\n class=\"x-recommendations\"\n >\n <li\n v-for=\"recommendation in recommendations\"\n :key=\"recommendation.id\"\n class=\"x-recommendations__item\"\n data-test=\"recommendation-item\"\n >\n <!--\n @slot (Required) Recommendation content.\n @binding {recommendation} recommendation - Recommendation data.\n -->\n <slot :recommendation=\"recommendation\" />\n </li>\n </component>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropsWithType } from '../../../utils'\nimport type { XEventsTypes } from '../../../wiring'\nimport { computed, defineComponent, provide } from 'vue'\nimport { useState } from '../../../composables'\nimport { AnimationProp } from '../../../types'\nimport { recommendationsXModule } from '../x-module'\n\n/**\n * It renders a list of recommendations from the\n * {@link RecommendationsState.recommendations} state by default.\n * The component provides the slot layout which wraps the whole component with the\n * recommendations bounded. It also provides the default slot to customize the item, which is\n * within the layout slot, with the recommendation bounded. Each recommendation should be\n * represented by a {@link BaseResultLink} component besides any other component.\n *\n * @public\n */\nexport default defineComponent({\n name: 'Recommendations',\n xModule: recommendationsXModule.name,\n props: {\n /** Animation component that will be used to animate the recommendations. */\n animation: {\n type: AnimationProp,\n default: 'ul',\n },\n /** Number of recommendations to be rendered. */\n maxItemsToRender: Number,\n },\n setup(props, { slots }) {\n /** The module's list of recommendations. */\n const storedRecommendations = useState('recommendations').recommendations\n\n /** The additional events to be emitted by the mandatory {@link BaseResultLink} component. */\n provide<PropsWithType<XEventsTypes, Result>[]>('resultClickExtraEvents', [\n 'UserClickedARecommendation',\n ])\n\n /**\n * Slices the recommendations from the state.\n *\n * @returns - The list of recommendations slice by the number of items to render.\n */\n const recommendations = computed<Result[]>(() =>\n storedRecommendations.value.slice(0, props.maxItemsToRender),\n )\n\n /**\n * Render function to execute the `layout` slot, binding `slotsProps` and getting only the\n * first `vNode` to avoid Fragments and Text root nodes.\n * If there are no recommendations, nothing is rendered.\n *\n * @remarks `slotProps` must be values without Vue reactivity and located inside the\n * render-function to update the binding data properly.\n *\n * @returns The root `vNode` of the `layout` slot or empty string if there are\n * no recommendations.\n */\n function renderLayoutSlot() {\n const slotProps = {\n animation: props.animation,\n recommendations: recommendations.value,\n }\n return recommendations.value.length ? slots.layout?.(slotProps)[0] : ''\n }\n\n /* Hack to render through a render-function, the `layout` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const componentProps = { recommendations }\n return (slots.layout ? renderLayoutSlot : componentProps) as typeof componentProps\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-recommendations {\n display: flex;\n list-style-type: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events, but it makes components such as `BaseResultLink` emit additional\nevents:\n\n- [`UserClickedARecommendation`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the link of a recommendation.\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend service required\nTo use this component, the Topclicked service must be implemented.\n:::\n<!-- prettier-ignore-end -->\n\nHere you have a basic example on how the recommendations are rendered. You can customize how each\nresult is rendered by using the `default` slot. It is highly recommended to use base components such\nas the `BaseResultLink` or the `BaseResultAddToCart`, as they provides integration with other\nmodules such like the `tagging` one.\n\n```vue live\n<template>\n <Recommendations #default=\"{ recommendation }\">\n <BaseResultLink :result=\"recommendation\" class=\"x-recommendations__link\">\n <img :src=\"recommendation.images[0]\" class=\"x-recommendations__image\" />\n <span class=\"x-recommendations__title\">{{ recommendation.name }}</span>\n </BaseResultLink>\n <BaseResultAddToCart>Add to cart</BaseResultAddToCart>\n </Recommendations>\n</template>\n<script>\nimport { Recommendations } from '@empathyco/x-components/recommendations'\nimport { BaseResultLink, BaseResultAddToCart } from '@empathyco/x-components'\n\nexport default {\n name: 'RecommendationsDemo',\n components: {\n Recommendations,\n BaseResultLink,\n BaseResultAddToCart,\n },\n}\n</script>\n```\n\n### Play with props\n\nIn this example, the component will render a maximum of 4 result recommendations, and will use the\n`StaggeredFadeAndSlide` animation for the results, smoothing the entrance.\n\n```vue live\n<template>\n <Recommendations\n #default=\"{ recommendation }\"\n :maxItemsToRender=\"4\"\n animation=\"StaggeredFadeAndSlide\"\n >\n <BaseResultLink :result=\"recommendation\" class=\"x-recommendations__link\">\n <img :src=\"recommendation.images[0]\" class=\"x-recommendations__image\" />\n <span class=\"x-recommendations__title\">{{ recommendation.name }}</span>\n </BaseResultLink>\n <BaseResultAddToCart>Add to cart</BaseResultAddToCart>\n </Recommendations>\n</template>\n<script>\nimport Vue from 'vue'\nimport { Recommendations } from '@empathyco/x-components/recommendations'\nimport { BaseResultLink, BaseResultAddToCart } from '@empathyco/x-components'\n\nVue.component('StaggeredFadeAndSlide', StaggeredFadeAndSlide)\nexport default {\n name: 'RecommendationsDemo',\n components: {\n Recommendations,\n BaseResultLink,\n BaseResultAddToCart,\n },\n}\n</script>\n```\n\n### Play with the layout\n\nIn this example you can build your own layout, and the `Recommendations` component will just act as\na provider of the result recommendations data. Using the component this way, and due to Vue 2\nlimitations you will only be allowed to render a single element inside the `layout` slot.\n\n```vue live\n<template>\n <Recommendations #layout=\"{ recommendations }\">\n <div class=\"x-recommendations\">\n <article\n class=\"x-recommendations-list\"\n v-for=\"recommendation in recommendations\"\n :key=\"recommendation.id\"\n >\n <BaseResultLink :result=\"recommendation\" class=\"x-recommendations__link\">\n <img :src=\"recommendation.images[0]\" class=\"x-recommendations__image\" />\n <span class=\"x-recommendations__title\">{{ recommendation.name }}</span>\n </BaseResultLink>\n <BaseResultAddToCart>Add to cart</BaseResultAddToCart>\n </article>\n </div>\n </Recommendations>\n</template>\n<script>\nimport { Recommendations } from '@empathyco/x-components/recommendations'\nimport { BaseResultLink, BaseResultAddToCart } from '@empathyco/x-components'\n\nexport default {\n name: 'RecommendationsDemo',\n components: {\n Recommendations,\n BaseResultLink,\n BaseResultAddToCart,\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createBlock","_resolveDynamicComponent","
|
|
1
|
+
{"version":3,"file":"recommendations.vue.js","sources":["../../../../../src/x-modules/recommendations/components/recommendations.vue"],"sourcesContent":["<template>\n <component\n :is=\"animation\"\n v-if=\"recommendations.length\"\n tag=\"ul\"\n data-test=\"recommendations\"\n class=\"x-recommendations\"\n >\n <li\n v-for=\"recommendation in recommendations\"\n :key=\"recommendation.id\"\n class=\"x-recommendations__item\"\n data-test=\"recommendation-item\"\n >\n <!--\n @slot (Required) Recommendation content.\n @binding {recommendation} recommendation - Recommendation data.\n -->\n <slot :recommendation=\"recommendation\" />\n </li>\n </component>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropsWithType } from '../../../utils'\nimport type { XEventsTypes } from '../../../wiring'\nimport { computed, defineComponent, provide } from 'vue'\nimport { useState } from '../../../composables'\nimport { AnimationProp } from '../../../types'\nimport { recommendationsXModule } from '../x-module'\n\n/**\n * It renders a list of recommendations from the\n * {@link RecommendationsState.recommendations} state by default.\n * The component provides the slot layout which wraps the whole component with the\n * recommendations bounded. It also provides the default slot to customize the item, which is\n * within the layout slot, with the recommendation bounded. Each recommendation should be\n * represented by a {@link BaseResultLink} component besides any other component.\n *\n * @public\n */\nexport default defineComponent({\n name: 'Recommendations',\n xModule: recommendationsXModule.name,\n props: {\n /** Animation component that will be used to animate the recommendations. */\n animation: {\n type: AnimationProp,\n default: 'ul',\n },\n /** Number of recommendations to be rendered. */\n maxItemsToRender: Number,\n },\n setup(props, { slots }) {\n /** The module's list of recommendations. */\n const storedRecommendations = useState('recommendations').recommendations\n\n /** The additional events to be emitted by the mandatory {@link BaseResultLink} component. */\n provide<PropsWithType<XEventsTypes, Result>[]>('resultClickExtraEvents', [\n 'UserClickedARecommendation',\n ])\n\n /**\n * Slices the recommendations from the state.\n *\n * @returns - The list of recommendations slice by the number of items to render.\n */\n const recommendations = computed<Result[]>(() =>\n storedRecommendations.value.slice(0, props.maxItemsToRender),\n )\n\n /**\n * Render function to execute the `layout` slot, binding `slotsProps` and getting only the\n * first `vNode` to avoid Fragments and Text root nodes.\n * If there are no recommendations, nothing is rendered.\n *\n * @remarks `slotProps` must be values without Vue reactivity and located inside the\n * render-function to update the binding data properly.\n *\n * @returns The root `vNode` of the `layout` slot or empty string if there are\n * no recommendations.\n */\n function renderLayoutSlot() {\n const slotProps = {\n animation: props.animation,\n recommendations: recommendations.value,\n }\n return recommendations.value.length ? slots.layout?.(slotProps)[0] : ''\n }\n\n /* Hack to render through a render-function, the `layout` slot or, in its absence,\n the component itself. It is the alternative for the NoElement antipattern. */\n const componentProps = { recommendations }\n return (slots.layout ? renderLayoutSlot : componentProps) as typeof componentProps\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-recommendations {\n display: flex;\n list-style-type: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events, but it makes components such as `BaseResultLink` emit additional\nevents:\n\n- [`UserClickedARecommendation`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts):\n the event is emitted after the user clicks the link of a recommendation.\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend service required\nTo use this component, the Topclicked service must be implemented.\n:::\n<!-- prettier-ignore-end -->\n\nHere you have a basic example on how the recommendations are rendered. You can customize how each\nresult is rendered by using the `default` slot. It is highly recommended to use base components such\nas the `BaseResultLink` or the `BaseResultAddToCart`, as they provides integration with other\nmodules such like the `tagging` one.\n\n```vue live\n<template>\n <Recommendations #default=\"{ recommendation }\">\n <BaseResultLink :result=\"recommendation\" class=\"x-recommendations__link\">\n <img :src=\"recommendation.images[0]\" class=\"x-recommendations__image\" />\n <span class=\"x-recommendations__title\">{{ recommendation.name }}</span>\n </BaseResultLink>\n <BaseResultAddToCart>Add to cart</BaseResultAddToCart>\n </Recommendations>\n</template>\n<script>\nimport { Recommendations } from '@empathyco/x-components/recommendations'\nimport { BaseResultLink, BaseResultAddToCart } from '@empathyco/x-components'\n\nexport default {\n name: 'RecommendationsDemo',\n components: {\n Recommendations,\n BaseResultLink,\n BaseResultAddToCart,\n },\n}\n</script>\n```\n\n### Play with props\n\nIn this example, the component will render a maximum of 4 result recommendations, and will use the\n`StaggeredFadeAndSlide` animation for the results, smoothing the entrance.\n\n```vue live\n<template>\n <Recommendations\n #default=\"{ recommendation }\"\n :maxItemsToRender=\"4\"\n animation=\"StaggeredFadeAndSlide\"\n >\n <BaseResultLink :result=\"recommendation\" class=\"x-recommendations__link\">\n <img :src=\"recommendation.images[0]\" class=\"x-recommendations__image\" />\n <span class=\"x-recommendations__title\">{{ recommendation.name }}</span>\n </BaseResultLink>\n <BaseResultAddToCart>Add to cart</BaseResultAddToCart>\n </Recommendations>\n</template>\n<script>\nimport Vue from 'vue'\nimport { Recommendations } from '@empathyco/x-components/recommendations'\nimport { BaseResultLink, BaseResultAddToCart } from '@empathyco/x-components'\n\nVue.component('StaggeredFadeAndSlide', StaggeredFadeAndSlide)\nexport default {\n name: 'RecommendationsDemo',\n components: {\n Recommendations,\n BaseResultLink,\n BaseResultAddToCart,\n },\n}\n</script>\n```\n\n### Play with the layout\n\nIn this example you can build your own layout, and the `Recommendations` component will just act as\na provider of the result recommendations data. Using the component this way, and due to Vue 2\nlimitations you will only be allowed to render a single element inside the `layout` slot.\n\n```vue live\n<template>\n <Recommendations #layout=\"{ recommendations }\">\n <div class=\"x-recommendations\">\n <article\n class=\"x-recommendations-list\"\n v-for=\"recommendation in recommendations\"\n :key=\"recommendation.id\"\n >\n <BaseResultLink :result=\"recommendation\" class=\"x-recommendations__link\">\n <img :src=\"recommendation.images[0]\" class=\"x-recommendations__image\" />\n <span class=\"x-recommendations__title\">{{ recommendation.name }}</span>\n </BaseResultLink>\n <BaseResultAddToCart>Add to cart</BaseResultAddToCart>\n </article>\n </div>\n </Recommendations>\n</template>\n<script>\nimport { Recommendations } from '@empathyco/x-components/recommendations'\nimport { BaseResultLink, BaseResultAddToCart } from '@empathyco/x-components'\n\nexport default {\n name: 'RecommendationsDemo',\n components: {\n Recommendations,\n BaseResultLink,\n BaseResultAddToCart,\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createBlock","_resolveDynamicComponent","_createElementBlock","_Fragment","_renderList","_renderSlot"],"mappings":";;;;;;SAGU,IAAgB,CAAA,eAAA,CAAA,MAAA,IAAAA,SAAA,EAAA,EAFxBC,WAmBY,CAAAC,uBAAA,CAlBL,IAAS,CAAA,SAAA,CAAA,EAAA;AAAA,IAAA,GAAA,EAAA,CAAA;IAEd,GAAI,EAAA,IAAA;AAAA,IACJ,WAAU,EAAA,iBAAA;AAAA,IACV,KAAM,EAAA,mBAAA;AAAA,GAAA,EAAA;qBAGJ,MAAyC;AAAA,OAD3CF,SAAA,CAAA,IAAA,CAAA,EAAAG,kBAAA;AAAA,QAWKC,QAAA;AAAA,QAAA,IAAA;AAAA,QAVsBC,UAAA,CAAA,IAAA,CAAA,eAAA,EAAe,CAAjC,cAAc,KAAA;8BADvBF,kBAWK,CAAA,IAAA,EAAA;AAAA,YATF,KAAK,cAAe,CAAA,EAAA;AAAA,YACrB,KAAM,EAAA,yBAAA;AAAA,YACN,WAAU,EAAA,qBAAA;AAAA,WAAA,EAAA;AAMV,YAAAG,UAAA,CAAyC,0BAAlC,cAA8B,EAAA,EAAA,KAAA,CAAA,EAAA,IAAA,CAAA;AAAA,WAAA,CAAA,CAAA;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"related-prompt.vue.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompt.vue"],"sourcesContent":["<template>\n <button class=\"x-related-prompt\">\n <!--\n @slot related-prompt-extra-content - The slot to render related prompt extra information.\n @prop {Object} relatedPrompt - The related prompt object.\n -->\n <slot name=\"related-prompt-extra-content\" :related-prompt=\"relatedPrompt\">\n <img\n v-if=\"relatedPrompt.suggestionImageUrl\"\n :width=\"56\"\n :height=\"56\"\n :src=\"relatedPrompt.suggestionImageUrl\"\n :alt=\"relatedPrompt.nextQueries[0]\"\n class=\"x-related-prompts-item-image\"\n />\n </slot>\n <span\n v-typing=\"{ text: relatedPrompt.suggestionText, speed: 50 }\"\n class=\"x-related-prompt-text\"\n :class=\"{ 'x-related-prompt-text--selected': selected }\"\n />\n <component :is=\"selected ? 'CrossTinyIcon' : 'PlusIcon'\" class=\"x-related-prompt-icon\" />\n </button>\n</template>\n\n<script lang=\"ts\">\nimport type { RelatedPrompt } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport CrossTinyIcon from '../../../components/icons/cross-tiny.vue'\nimport PlusIcon from '../../../components/icons/plus.vue'\nimport { typing } from '../../../directives/typing'\n\n/**\n * This component shows a suggested related prompt.\n */\nexport default defineComponent({\n name: 'RelatedPrompt',\n directives: {\n typing,\n },\n components: {\n CrossTinyIcon,\n PlusIcon,\n },\n props: {\n /**\n * The related prompt to render.\n *\n * @public\n */\n relatedPrompt: {\n type: Object as PropType<RelatedPrompt>,\n required: true,\n },\n /**\n * Indicates if the related prompt is selected.\n *\n * @public\n */\n selected: {\n type: Boolean,\n default: false,\n },\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-related-prompt {\n display: flex;\n align-items: center;\n justify-content: space-between;\n text-align: start;\n padding: 8px;\n gap: 8px;\n height: 100%;\n width: 100%;\n}\n\n.x-related-prompt-text {\n text-align: left;\n flex-grow: 1;\n}\n\n.x-related-prompt-text.x-related-prompt-text--selected {\n text-align: center;\n}\n\n.x-related-prompt-icon {\n height: 24px;\n flex-shrink: 0;\n align-self: start;\n}\n\n.x-related-prompts-item-image {\n aspect-ratio: 1 / 1;\n flex-shrink: 0;\n overflow: hidden;\n border-radius: 50%;\n background-color: white;\n object-fit: cover;\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_renderSlot","_createCommentVNode","_withDirectives","_createElementVNode","_normalizeClass","_createBlock","_resolveDynamicComponent"],"mappings":";;;;;AACU,MAAA,UAAA,GAAA,EAAA,KAAA,EAAM,kBAAkB,EAAA,CAAA
|
|
1
|
+
{"version":3,"file":"related-prompt.vue.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompt.vue"],"sourcesContent":["<template>\n <button class=\"x-related-prompt\">\n <!--\n @slot related-prompt-extra-content - The slot to render related prompt extra information.\n @prop {Object} relatedPrompt - The related prompt object.\n -->\n <slot name=\"related-prompt-extra-content\" :related-prompt=\"relatedPrompt\">\n <img\n v-if=\"relatedPrompt.suggestionImageUrl\"\n :width=\"56\"\n :height=\"56\"\n :src=\"relatedPrompt.suggestionImageUrl\"\n :alt=\"relatedPrompt.nextQueries[0]\"\n class=\"x-related-prompts-item-image\"\n />\n </slot>\n <span\n v-typing=\"{ text: relatedPrompt.suggestionText, speed: 50 }\"\n class=\"x-related-prompt-text\"\n :class=\"{ 'x-related-prompt-text--selected': selected }\"\n />\n <component :is=\"selected ? 'CrossTinyIcon' : 'PlusIcon'\" class=\"x-related-prompt-icon\" />\n </button>\n</template>\n\n<script lang=\"ts\">\nimport type { RelatedPrompt } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport CrossTinyIcon from '../../../components/icons/cross-tiny.vue'\nimport PlusIcon from '../../../components/icons/plus.vue'\nimport { typing } from '../../../directives/typing'\n\n/**\n * This component shows a suggested related prompt.\n */\nexport default defineComponent({\n name: 'RelatedPrompt',\n directives: {\n typing,\n },\n components: {\n CrossTinyIcon,\n PlusIcon,\n },\n props: {\n /**\n * The related prompt to render.\n *\n * @public\n */\n relatedPrompt: {\n type: Object as PropType<RelatedPrompt>,\n required: true,\n },\n /**\n * Indicates if the related prompt is selected.\n *\n * @public\n */\n selected: {\n type: Boolean,\n default: false,\n },\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-related-prompt {\n display: flex;\n align-items: center;\n justify-content: space-between;\n text-align: start;\n padding: 8px;\n gap: 8px;\n height: 100%;\n width: 100%;\n}\n\n.x-related-prompt-text {\n text-align: left;\n flex-grow: 1;\n}\n\n.x-related-prompt-text.x-related-prompt-text--selected {\n text-align: center;\n}\n\n.x-related-prompt-icon {\n height: 24px;\n flex-shrink: 0;\n align-self: start;\n}\n\n.x-related-prompts-item-image {\n aspect-ratio: 1 / 1;\n flex-shrink: 0;\n overflow: hidden;\n border-radius: 50%;\n background-color: white;\n object-fit: cover;\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_renderSlot","_createCommentVNode","_withDirectives","_createElementVNode","_normalizeClass","_createBlock","_resolveDynamicComponent"],"mappings":";;;;;AACU,MAAA,UAAA,GAAA,EAAA,KAAA,EAAM,kBAAkB,EAAA,CAAA;;;;AAAhC,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA,CAqBS,UArBT,UAqBS,EAAA;AAAA,IAhBPC,UASO,CAAA,IAAA,CAAA,MAAA,EAAA,8BAAA,EAAA,EAToC,aAAgB,EAAA,IAAA,CAAA,aAAA,IAA3D,MASO;AAAA,MAPG,IAAA,CAAA,aAAA,CAAc,mCADtBD,kBAOE,CAAA,KAAA,EAAA;AAAA,QAAA,GAAA,EAAA,CAAA;QALC,KAAO,EAAA,EAAA;AAAA,QACP,MAAQ,EAAA,EAAA;AAAA,QACR,KAAK,IAAc,CAAA,aAAA,CAAA,kBAAA;AAAA,QACnB,GAAA,EAAK,mBAAc,WAAW,CAAA,CAAA,CAAA;AAAA,QAC/B,KAAM,EAAA,8BAAA;AAAA,OAAA,EAAA,IAAA,EAAA,CAAA,EAAA,UAAA,CAAA,IAAAE,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA;;AAGV,IAAAC,cAAA,CAAAC,kBAAA;AAAA,MAIE,MAAA;AAAA,MAAA;AAAA,QAFA,KAAK,EAAAC,cAAA,CAAA,CAAC,uBAAuB,EAAA,EAAA,iCAAA,EACgB,IAAQ,CAAA,QAAA,EAAA,CAAA,CAAA;AAAA,OAAA;;;;;AAFnC,MAAA,CAAA,iBAAA,EAAA,EAAA,IAAA,EAAA,IAAA,CAAA,aAAA,CAAc,cAAc,EAAA,KAAA,EAAA,EAAA,EAAA,CAAA;AAAA,KAAA,CAAA;AAIhD,KAAAN,SAAA,EAAA,EAAAO,WAAA,CAAyFC,uBAAzE,CAAA,IAAA,CAAA,QAAA,GAAQ,eAAiC,GAAA,UAAA,CAAA,EAAA,EAAA,KAAA,EAAM,uBAAuB,EAAA,CAAA;AAAA,GAAA,CAAA,CAAA;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"related-prompts-tag-list.vue.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompts-tag-list.vue"],"sourcesContent":["<template>\n <SlidingPanel\n :key=\"x.query.search\"\n :reset-on-content-change=\"false\"\n :button-class=\"buttonClass\"\n :show-buttons=\"showButtons && selectedPromptIndex === -1\"\n :scroll-container-class=\"[\n 'x-related-prompts-tag-list-scroll-container',\n scrollContainerClass || '',\n ]\"\n >\n <template #sliding-panel-left-button>\n <!--\n @slot sliding-panel-left-button - The button to be displayed on the left side of the sliding panel.\n -->\n <slot name=\"sliding-panel-left-button\" />\n </template>\n <transition-group\n class=\"x-related-prompts-tag-list\"\n :css=\"false\"\n tag=\"ul\"\n appear\n @before-enter=\"onBeforeEnter\"\n @enter=\"onEnter\"\n @leave=\"onLeave\"\n >\n <li\n v-for=\"{ index, ...relatedPrompt } in visibleRelatedPrompts\"\n ref=\"listItems\"\n :key=\"relatedPrompt.suggestionText\"\n class=\"x-related-prompts-tag-list-item\"\n :class=\"[tagClass, tagColors && tagColors[index % tagColors.length]]\"\n :data-index=\"index\"\n :style=\"{\n ...(selectedPromptIndex === index && { width: '100%' }),\n ...(isAnimating && { pointerEvents: 'none' }),\n }\"\n data-test=\"related-prompts-tag-list-item\"\n >\n <!--\n @slot - The slot to render related prompt information.\n @prop {Object} relatedPrompt - The related prompt object.\n @prop {Function} onSelect - The function to select the related prompt.\n @prop {Boolean} isSelected - Indicates if the related prompt is currently selected.\n -->\n <slot\n :related-prompt=\"relatedPrompt\"\n :on-select=\"() => onSelect(index)\"\n :is-selected=\"selectedPromptIndex === index\"\n >\n <DisplayEmitter\n :payload=\"relatedPrompt.tagging?.toolingDisplayTagging\"\n :event-metadata=\"{\n feature: 'related-prompts',\n displayOriginalQuery: x.query.searchBox,\n replaceable: false,\n }\"\n >\n <RelatedPrompt\n :related-prompt=\"relatedPrompt\"\n :selected=\"selectedPromptIndex === index\"\n @click=\"onSelect(index)\"\n >\n <template #related-prompt-extra-content>\n <!--\n @slot related-prompt-extra-content - The slot to render related prompt extra information.\n @prop {Object} relatedPrompt - The related prompt object.\n -->\n <slot name=\"related-prompt-extra-content\" :related-prompt=\"relatedPrompt\" />\n </template>\n </RelatedPrompt>\n </DisplayEmitter>\n </slot>\n </li>\n </transition-group>\n <template #sliding-panel-right-button>\n <!--\n @slot sliding-panel-right-button - The button to be displayed on the right side of the sliding panel.\n -->\n <slot name=\"sliding-panel-right-button\" />\n </template>\n </SlidingPanel>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, onBeforeUnmount, ref } from 'vue'\nimport DisplayEmitter from '../../../components/display-emitter.vue'\nimport SlidingPanel from '../../../components/sliding-panel.vue'\nimport { use$x, useState } from '../../../composables'\nimport { relatedPromptsXModule } from '../x-module'\nimport RelatedPrompt from './related-prompt.vue'\n\n/**\n * This component shows the list of `RelatedPrompts` components.\n *\n * If the default slot is reimplemented in the consumer, `onSelect` function will be\n * necessary to handle the selection of the related prompt and to trigger the stagger-fade-slide animation.\n *\n * @public\n */\nexport default defineComponent({\n name: 'RelatedPromptsTagList',\n xModule: relatedPromptsXModule.name,\n components: { DisplayEmitter, RelatedPrompt, SlidingPanel },\n props: {\n /**\n * The CSS class for the left and right button of the sliding panel.\n *\n * @public\n */\n buttonClass: String,\n /**\n * The boolean prop to handle the visiblity of sliding pannel buttons.\n *\n * @public\n */\n showButtons: { type: Boolean, default: true },\n /**\n * The CSS class for the wrapper of all the related prompt wrapper elements.\n *\n * @public\n */\n scrollContainerClass: String,\n /**\n * The CSS class for all the related prompt wrapper elements.\n *\n * @public\n */\n tagClass: String,\n /**\n * Array of colors to apply to the related prompts. It will be applied to tag\n * elements cyclically according to their index in the nex way: `tagColors[index % tagColors.length]`.\n *\n * @public\n */\n tagColors: Array as PropType<string[]>,\n /**\n * The duration of the total animation in milliseconds.\n *\n * @public\n */\n animationDurationInMs: {\n type: Number,\n default: 700,\n },\n },\n setup(props) {\n const x = use$x()\n const { relatedPrompts, selectedPrompt: selectedPromptIndex } = useState('relatedPrompts')\n\n const clickedListItemIndex = ref<number | null>(null)\n const initialOffsetLefts: Record<number, number> = {}\n const isAnimating = ref(false)\n const listItems = ref<HTMLElement[]>([])\n\n const sortedListItems = computed<HTMLElement[]>(() =>\n [...listItems.value].sort(\n (a: HTMLElement, b: HTMLElement) =>\n Number.parseInt(b.getAttribute('data-index')!) -\n Number.parseInt(a.getAttribute('data-index')!),\n ),\n )\n\n // The duration of a single animation (enter or leave) in milliseconds\n // if a related prompt is clicked (clickedListItemIndex.value !== null), the duration is divided by the number of related\n // prompts -1 (the clicked one is synchronized with the last one to leave or the first one to enter)\n const singleAnimationDurationInMs = computed(\n () =>\n props.animationDurationInMs /\n (clickedListItemIndex.value !== null\n ? relatedPrompts.value.length - 1\n : relatedPrompts.value.length),\n )\n\n const indexRelatedPrompts = computed(() =>\n relatedPrompts.value.map((relatedPrompt, index) => ({ ...relatedPrompt, index })),\n )\n\n const visibleRelatedPrompts = computed(() =>\n selectedPromptIndex.value !== -1\n ? [indexRelatedPrompts.value[selectedPromptIndex.value]]\n : indexRelatedPrompts.value,\n )\n\n let timeOutId: number\n const resetTransitionStyle = (excludedProperties: Array<string> = ['width']) => {\n if (timeOutId) {\n clearTimeout(timeOutId)\n }\n\n isAnimating.value = true\n timeOutId = +setTimeout(() => {\n isAnimating.value = false\n clickedListItemIndex.value = null\n\n sortedListItems.value.forEach(element => {\n element.style.cssText\n .split(';')\n .map(rule => rule.split(':')[0]?.trim())\n .forEach(property => {\n if (!excludedProperties.includes(property)) {\n element.style.removeProperty(property)\n }\n })\n })\n }, props.animationDurationInMs)\n }\n\n const onSelect = (selectedIndex: number): void => {\n resetTransitionStyle()\n\n clickedListItemIndex.value = selectedIndex\n const selected: HTMLElement = sortedListItems.value.find(\n element => Number.parseInt(element.getAttribute('data-index')!) === selectedIndex,\n )!\n\n // selectedPromptIndex.value === -1 ? 'SELECTING' : 'DESELECTING'\n if (selectedPromptIndex.value === -1) {\n // Prepare all the elements for the leave animation (~ 'beforeLeave' hook). Remember the elements are\n // sorted in descending order by index.\n sortedListItems.value.forEach(element => {\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n initialOffsetLefts[index] = element.offsetLeft\n element.style.left = `${element.offsetLeft}px`\n element.style.position = 'absolute'\n element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n\n if (index !== selectedIndex) {\n element.style.opacity = '1'\n element.style.transitionDelay = `${\n (index < selectedIndex ? index : index - 1) * singleAnimationDurationInMs.value\n }ms`\n }\n })\n\n // Synchronize the transition delay of the selected element with the last\n // element to leave\n selected.style.transitionDelay = `${\n (relatedPrompts.value.length > 1 ? relatedPrompts.value.length - 2 : 0) *\n singleAnimationDurationInMs.value\n }ms`\n\n // Trigger the animation (selecting) for the selected element\n requestAnimationFrame(() => {\n const maxWidth = getComputedStyle(selected).maxWidth\n\n selected.style.left = '0px'\n selected.style.setProperty(\n 'width',\n `${maxWidth !== 'none' ? maxWidth : '100%'}`,\n 'important',\n )\n })\n } else {\n // Prepare the selected element for the deselecting animation\n selected.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n selected.style.left = '0px'\n selected.style.position = 'absolute'\n\n // Trigger the animation (deselecting) for the selected element\n selected.style.removeProperty('width')\n requestAnimationFrame(() => {\n selected.style.left = `${initialOffsetLefts[selectedIndex]}px`\n })\n }\n\n x.emit('UserSelectedARelatedPrompt', selectedIndex, {\n relatedPrompt: relatedPrompts.value[selectedIndex],\n selectedPrompt: selectedPromptIndex.value,\n })\n }\n\n const onBeforeEnter = (el: Element) => {\n const element = el as HTMLElement\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n // Prepare the element for the enter animation\n element.style.opacity = '0'\n element.style.transform = 'translateY(5px)'\n element.style.transitionDelay = `${\n (clickedListItemIndex.value !== null && index > clickedListItemIndex.value\n ? index - 1\n : index) * singleAnimationDurationInMs.value\n }ms`\n element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n }\n\n const onEnter = (el: Element, done: () => void) => {\n const element = el as HTMLElement\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n // Also part of the preparation for the enter animation, but it needs to be done\n // once the element is inserted in DOM (if not the offsetLeft will be always 0)\n element.style.left = `${initialOffsetLefts[index] ?? element.offsetLeft}px`\n\n // trigger enter animation\n requestAnimationFrame(() => {\n element.style.opacity = '1'\n element.style.position = 'absolute'\n element.style.transform = 'translateY(0)'\n })\n\n done()\n }\n\n const onLeave = (el: Element, done: () => void) => {\n const element = el as HTMLElement\n\n // trigger leave animation\n requestAnimationFrame(() => {\n element.style.opacity = '0'\n element.style.transform = 'translateY(5px)'\n })\n\n // Wait for the animation to finish (done() exectution extracts the element from the DOM)\n setTimeout(done, props.animationDurationInMs)\n }\n\n // Changing the request will trigger the appear animation, so we need to reset the\n // style after it finishes\n x.on('SearchRequestChanged', false).subscribe(() => {\n resetTransitionStyle([])\n })\n\n onBeforeUnmount(() => {\n x.emit('RelatedPromptsUnmounted')\n })\n\n return {\n onSelect,\n onBeforeEnter,\n onEnter,\n onLeave,\n selectedPromptIndex,\n visibleRelatedPrompts,\n listItems,\n isAnimating,\n x,\n }\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-related-prompts-tag-list-scroll-container {\n height: 100%;\n position: relative;\n}\n.x-related-prompts-tag-list {\n display: flex;\n gap: 16px;\n min-width: 100%;\n width: 100%;\n}\n.x-related-prompts-tag-list-item {\n height: 100%;\n flex-shrink: 0;\n}\n</style>\n"],"names":["_createBlock","_withCtx","_renderSlot","_createVNode","_TransitionGroup","_openBlock","_createElementBlock","_Fragment","_renderList","_normalizeClass","_normalizeStyle"],"mappings":";;;;;AAAA,MAAA,UAAA,GAAA,CAAA,YAAA,CAAA,CAAA;;;;;sBACEA,WAgFe,CAAA,uBAAA,EAAA;AAAA,IA/EZ,GAAA,EAAK,OAAE,KAAM,CAAA,MAAA;AAAA,IACb,yBAAyB,EAAA,KAAA;AAAA,IACzB,cAAc,EAAA,IAAA,CAAA,WAAA;AAAA,IACd,cAAA,EAAc,oBAAe,IAAmB,CAAA,mBAAA,KAAA,CAAA,CAAA;AAAA,IAChD,wBAAsB,EAAA;AAAA,MAAA,6CAAA;MAA+D,IAAoB,CAAA,oBAAA,IAAA,EAAA;AAAA,KAAA;;AAK/F,IAAA,2BAAA,EAAyBC,QAIlC,MAAyC;AAAA,MAAzCC,UAAyC,CAAA,IAAA,CAAA,MAAA,EAAA,2BAAA,CAAA;AAAA,KAAA,CAAA;AA4DhC,IAAA,4BAAA,EAA0BD,QAInC,MAA0C;AAAA,MAA1CC,UAA0C,CAAA,IAAA,CAAA,MAAA,EAAA,4BAAA,CAAA;AAAA,KAAA,CAAA;AA/EhD,IAAA,OAAA,EAAAD,OAAA,CAiBI,MAyDmB;AAAA,MAzDnBE,WAyDmB,CAAAC,eAAA,EAAA;AAAA,QAxDjB,KAAM,EAAA,4BAAA;AAAA,QACL,GAAK,EAAA,KAAA;AAAA,QACN,GAAI,EAAA,IAAA;AAAA,QACJ,MAAA,EAAA,EAAA;AAAA,QACC,aAAc,EAAA,IAAA,CAAA,aAAA;AAAA,QACd,OAAO,EAAA,IAAA,CAAA,OAAA;AAAA,QACP,OAAO,EAAA,IAAA,CAAA,OAAA;AAAA,OAAA,EAAA;AAxBd,QAAA,OAAA,EAAAH,OAAA,CA2BQ,MAA4D;AAAA,WAD9DI,SAAA,CAAA,IAAA,CAAA,EAAAC,kBAAA;AAAA,YA+CKC,QAAA;AAAA,YAAA,IAAA;AAAA,YAzEXC,UA2B8C,CAAA,IAAA,CAAA,qBAAA,EA3B9C,CA2BiB,EAAA,KAAA,EAAK,GAAK,aAAa,EAAA,KAAA;kCADlCF,kBA+CK,CAAA,IAAA,EAAA;AAAA,gBAzEX,OAAA,EAAA,IAAA;AAAA,gBA4BQ,GAAI,EAAA,WAAA;AAAA,gBACH,KAAK,aAAc,CAAA,cAAA;AAAA,gBACpB,KAAA,EA9BRG,gBA8Bc,iCAAiC,EAAA,CAC9B,eAAU,IAAa,CAAA,SAAA,IAAA,IAAA,CAAA,SAAA,CAAU,KAAQ,GAAA,IAAA,CAAA,SAAA,CAAU,MAAM,CAAA,CAAA,CAAA,CAAA;AAAA,gBACjE,YAAY,EAAA,KAAA;AAAA,gBACZ,KAjCT,EAAAC,cAAA,CAAA;AAAA,kBAAA,GAiCgC,6BAAwB,KAAK,IAAA,EAAA,KAAA,EAAA,MAAA,EAAA;AAAA,kBAAA,GAAsC,IAAW,CAAA,WAAA,IAAA,EAAA,aAAA,EAAA,MAAA,EAAA;AAAA,iBAAA,CAAA;gBAItG,WAAU,EAAA,+BAAA;AAAA,eAAA,EAAA;gBAQVR,UA2BO,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA;AAAA,kBA1BJ,aAAA;AAAA,kBACA,QAAA,EAAS,MAAQ,IAAA,CAAA,QAAA,CAAS,KAAK,CAAA;AAAA,kBAC/B,YAAa,IAAwB,CAAA,mBAAA,KAAA,KAAA;AAAA,iBAAA,EAHxC,MA2BO;AAAA,kBAtBLC,WAqBiB,CAAA,yBAAA,EAAA;AAAA,oBApBd,OAAA,EAAS,cAAc,OAAS,EAAA,qBAAA;AAAA,oBAChC,gBAAc,EAAA;AAAA,sBAAA,OAAA,EAAA,iBAAA;AAAkF,sBAAA,oBAAA,EAAA,IAAA,CAAA,CAAA,CAAE,KAAM,CAAA,SAAA;AAAA,sBAAA,WAAA,EAAA,KAAA;;;AApDrH,oBAAA,OAAA,EAAAF,OAAA,CA0DY,MAYgB;AAAA,sBAZhBE,WAYgB,CAAA,wBAAA,EAAA;AAAA,wBAXb,gBAAgB,EAAA,aAAA;AAAA,wBAChB,UAAU,IAAwB,CAAA,mBAAA,KAAA,KAAA;AAAA,wBAClC,OAAA,EAAK,CAAE,MAAA,KAAA,IAAA,CAAA,QAAA,CAAS,KAAK,CAAA;AAAA,uBAAA,EAAA;AAEX,wBAAA,8BAAA,EAA4BF,QAKrC,MAA4E;AAAA,0BAA5EC,UAAA,CAA4E,+CAAjC,aAA6B,EAAA,CAAA;AAAA,yBAAA,CAAA;AApExF,wBAAA,CAAA,EAAA,CAAA;AAAA;AAAA,uBAAA,EAAA,IAAA,EAAA,CAAA,gBAAA,EAAA,UAAA,EAAA,SAAA,CAAA,CAAA;;AAAA,oBAAA,CAAA,EAAA,CAAA;AAAA;AAAA,mBAAA,EAAA,IAAA,EAAA,CAAA,SAAA,EAAA,gBAAA,CAAA,CAAA;;AAAA,eAAA,EAAA,EAAA,EAAA,UAAA,CAAA,CAAA;AAAA,aAAA,CAAA;;;;;AAAA,QAAA,CAAA,EAAA,CAAA;AAAA;AAAA,OAAA,EAAA,CAAA,EAAA,CAAA,eAAA,EAAA,SAAA,EAAA,SAAA,CAAA,CAAA;;AAAA,IAAA,CAAA,EAAA,CAAA;AAAA;AAAA,GAAA,EAAA,CAAA,EAAA,CAAA,cAAA,EAAA,cAAA,EAAA,wBAAA,CAAA,CAAA,CAAA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"related-prompts-tag-list.vue.js","sources":["../../../../../src/x-modules/related-prompts/components/related-prompts-tag-list.vue"],"sourcesContent":["<template>\n <SlidingPanel\n :key=\"x.query.search\"\n :reset-on-content-change=\"false\"\n :button-class=\"buttonClass\"\n :show-buttons=\"showButtons && selectedPromptIndex === -1\"\n :scroll-container-class=\"[\n 'x-related-prompts-tag-list-scroll-container',\n scrollContainerClass || '',\n ]\"\n >\n <template #sliding-panel-left-button>\n <!--\n @slot sliding-panel-left-button - The button to be displayed on the left side of the sliding panel.\n -->\n <slot name=\"sliding-panel-left-button\" />\n </template>\n <transition-group\n class=\"x-related-prompts-tag-list\"\n :css=\"false\"\n tag=\"ul\"\n appear\n @before-enter=\"onBeforeEnter\"\n @enter=\"onEnter\"\n @leave=\"onLeave\"\n >\n <li\n v-for=\"{ index, ...relatedPrompt } in visibleRelatedPrompts\"\n ref=\"listItems\"\n :key=\"relatedPrompt.suggestionText\"\n class=\"x-related-prompts-tag-list-item\"\n :class=\"[tagClass, tagColors && tagColors[index % tagColors.length]]\"\n :data-index=\"index\"\n :style=\"{\n ...(selectedPromptIndex === index && { width: '100%' }),\n ...(isAnimating && { pointerEvents: 'none' }),\n }\"\n data-test=\"related-prompts-tag-list-item\"\n >\n <!--\n @slot - The slot to render related prompt information.\n @prop {Object} relatedPrompt - The related prompt object.\n @prop {Function} onSelect - The function to select the related prompt.\n @prop {Boolean} isSelected - Indicates if the related prompt is currently selected.\n -->\n <slot\n :related-prompt=\"relatedPrompt\"\n :on-select=\"() => onSelect(index)\"\n :is-selected=\"selectedPromptIndex === index\"\n >\n <DisplayEmitter\n :payload=\"relatedPrompt.tagging?.toolingDisplayTagging\"\n :event-metadata=\"{\n feature: 'related-prompts',\n displayOriginalQuery: x.query.searchBox,\n replaceable: false,\n }\"\n >\n <RelatedPrompt\n :related-prompt=\"relatedPrompt\"\n :selected=\"selectedPromptIndex === index\"\n @click=\"onSelect(index)\"\n >\n <template #related-prompt-extra-content>\n <!--\n @slot related-prompt-extra-content - The slot to render related prompt extra information.\n @prop {Object} relatedPrompt - The related prompt object.\n -->\n <slot name=\"related-prompt-extra-content\" :related-prompt=\"relatedPrompt\" />\n </template>\n </RelatedPrompt>\n </DisplayEmitter>\n </slot>\n </li>\n </transition-group>\n <template #sliding-panel-right-button>\n <!--\n @slot sliding-panel-right-button - The button to be displayed on the right side of the sliding panel.\n -->\n <slot name=\"sliding-panel-right-button\" />\n </template>\n </SlidingPanel>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport { computed, defineComponent, onBeforeUnmount, ref } from 'vue'\nimport DisplayEmitter from '../../../components/display-emitter.vue'\nimport SlidingPanel from '../../../components/sliding-panel.vue'\nimport { use$x, useState } from '../../../composables'\nimport { relatedPromptsXModule } from '../x-module'\nimport RelatedPrompt from './related-prompt.vue'\n\n/**\n * This component shows the list of `RelatedPrompts` components.\n *\n * If the default slot is reimplemented in the consumer, `onSelect` function will be\n * necessary to handle the selection of the related prompt and to trigger the stagger-fade-slide animation.\n *\n * @public\n */\nexport default defineComponent({\n name: 'RelatedPromptsTagList',\n xModule: relatedPromptsXModule.name,\n components: { DisplayEmitter, RelatedPrompt, SlidingPanel },\n props: {\n /**\n * The CSS class for the left and right button of the sliding panel.\n *\n * @public\n */\n buttonClass: String,\n /**\n * The boolean prop to handle the visiblity of sliding pannel buttons.\n *\n * @public\n */\n showButtons: { type: Boolean, default: true },\n /**\n * The CSS class for the wrapper of all the related prompt wrapper elements.\n *\n * @public\n */\n scrollContainerClass: String,\n /**\n * The CSS class for all the related prompt wrapper elements.\n *\n * @public\n */\n tagClass: String,\n /**\n * Array of colors to apply to the related prompts. It will be applied to tag\n * elements cyclically according to their index in the nex way: `tagColors[index % tagColors.length]`.\n *\n * @public\n */\n tagColors: Array as PropType<string[]>,\n /**\n * The duration of the total animation in milliseconds.\n *\n * @public\n */\n animationDurationInMs: {\n type: Number,\n default: 700,\n },\n },\n setup(props) {\n const x = use$x()\n const { relatedPrompts, selectedPrompt: selectedPromptIndex } = useState('relatedPrompts')\n\n const clickedListItemIndex = ref<number | null>(null)\n const initialOffsetLefts: Record<number, number> = {}\n const isAnimating = ref(false)\n const listItems = ref<HTMLElement[]>([])\n\n const sortedListItems = computed<HTMLElement[]>(() =>\n [...listItems.value].sort(\n (a: HTMLElement, b: HTMLElement) =>\n Number.parseInt(b.getAttribute('data-index')!) -\n Number.parseInt(a.getAttribute('data-index')!),\n ),\n )\n\n // The duration of a single animation (enter or leave) in milliseconds\n // if a related prompt is clicked (clickedListItemIndex.value !== null), the duration is divided by the number of related\n // prompts -1 (the clicked one is synchronized with the last one to leave or the first one to enter)\n const singleAnimationDurationInMs = computed(\n () =>\n props.animationDurationInMs /\n (clickedListItemIndex.value !== null\n ? relatedPrompts.value.length - 1\n : relatedPrompts.value.length),\n )\n\n const indexRelatedPrompts = computed(() =>\n relatedPrompts.value.map((relatedPrompt, index) => ({ ...relatedPrompt, index })),\n )\n\n const visibleRelatedPrompts = computed(() =>\n selectedPromptIndex.value !== -1\n ? [indexRelatedPrompts.value[selectedPromptIndex.value]]\n : indexRelatedPrompts.value,\n )\n\n let timeOutId: number\n const resetTransitionStyle = (excludedProperties: Array<string> = ['width']) => {\n if (timeOutId) {\n clearTimeout(timeOutId)\n }\n\n isAnimating.value = true\n timeOutId = +setTimeout(() => {\n isAnimating.value = false\n clickedListItemIndex.value = null\n\n sortedListItems.value.forEach(element => {\n element.style.cssText\n .split(';')\n .map(rule => rule.split(':')[0]?.trim())\n .forEach(property => {\n if (!excludedProperties.includes(property)) {\n element.style.removeProperty(property)\n }\n })\n })\n }, props.animationDurationInMs)\n }\n\n const onSelect = (selectedIndex: number): void => {\n resetTransitionStyle()\n\n clickedListItemIndex.value = selectedIndex\n const selected: HTMLElement = sortedListItems.value.find(\n element => Number.parseInt(element.getAttribute('data-index')!) === selectedIndex,\n )!\n\n // selectedPromptIndex.value === -1 ? 'SELECTING' : 'DESELECTING'\n if (selectedPromptIndex.value === -1) {\n // Prepare all the elements for the leave animation (~ 'beforeLeave' hook). Remember the elements are\n // sorted in descending order by index.\n sortedListItems.value.forEach(element => {\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n initialOffsetLefts[index] = element.offsetLeft\n element.style.left = `${element.offsetLeft}px`\n element.style.position = 'absolute'\n element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n\n if (index !== selectedIndex) {\n element.style.opacity = '1'\n element.style.transitionDelay = `${\n (index < selectedIndex ? index : index - 1) * singleAnimationDurationInMs.value\n }ms`\n }\n })\n\n // Synchronize the transition delay of the selected element with the last\n // element to leave\n selected.style.transitionDelay = `${\n (relatedPrompts.value.length > 1 ? relatedPrompts.value.length - 2 : 0) *\n singleAnimationDurationInMs.value\n }ms`\n\n // Trigger the animation (selecting) for the selected element\n requestAnimationFrame(() => {\n const maxWidth = getComputedStyle(selected).maxWidth\n\n selected.style.left = '0px'\n selected.style.setProperty(\n 'width',\n `${maxWidth !== 'none' ? maxWidth : '100%'}`,\n 'important',\n )\n })\n } else {\n // Prepare the selected element for the deselecting animation\n selected.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n selected.style.left = '0px'\n selected.style.position = 'absolute'\n\n // Trigger the animation (deselecting) for the selected element\n selected.style.removeProperty('width')\n requestAnimationFrame(() => {\n selected.style.left = `${initialOffsetLefts[selectedIndex]}px`\n })\n }\n\n x.emit('UserSelectedARelatedPrompt', selectedIndex, {\n relatedPrompt: relatedPrompts.value[selectedIndex],\n selectedPrompt: selectedPromptIndex.value,\n })\n }\n\n const onBeforeEnter = (el: Element) => {\n const element = el as HTMLElement\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n // Prepare the element for the enter animation\n element.style.opacity = '0'\n element.style.transform = 'translateY(5px)'\n element.style.transitionDelay = `${\n (clickedListItemIndex.value !== null && index > clickedListItemIndex.value\n ? index - 1\n : index) * singleAnimationDurationInMs.value\n }ms`\n element.style.transitionDuration = `${singleAnimationDurationInMs.value}ms`\n }\n\n const onEnter = (el: Element, done: () => void) => {\n const element = el as HTMLElement\n const index = Number.parseInt(element.getAttribute('data-index')!)\n\n // Also part of the preparation for the enter animation, but it needs to be done\n // once the element is inserted in DOM (if not the offsetLeft will be always 0)\n element.style.left = `${initialOffsetLefts[index] ?? element.offsetLeft}px`\n\n // trigger enter animation\n requestAnimationFrame(() => {\n element.style.opacity = '1'\n element.style.position = 'absolute'\n element.style.transform = 'translateY(0)'\n })\n\n done()\n }\n\n const onLeave = (el: Element, done: () => void) => {\n const element = el as HTMLElement\n\n // trigger leave animation\n requestAnimationFrame(() => {\n element.style.opacity = '0'\n element.style.transform = 'translateY(5px)'\n })\n\n // Wait for the animation to finish (done() exectution extracts the element from the DOM)\n setTimeout(done, props.animationDurationInMs)\n }\n\n // Changing the request will trigger the appear animation, so we need to reset the\n // style after it finishes\n x.on('SearchRequestChanged', false).subscribe(() => {\n resetTransitionStyle([])\n })\n\n onBeforeUnmount(() => {\n x.emit('RelatedPromptsUnmounted')\n })\n\n return {\n onSelect,\n onBeforeEnter,\n onEnter,\n onLeave,\n selectedPromptIndex,\n visibleRelatedPrompts,\n listItems,\n isAnimating,\n x,\n }\n },\n})\n</script>\n\n<style lang=\"css\">\n.x-related-prompts-tag-list-scroll-container {\n height: 100%;\n position: relative;\n}\n.x-related-prompts-tag-list {\n display: flex;\n gap: 16px;\n min-width: 100%;\n width: 100%;\n}\n.x-related-prompts-tag-list-item {\n height: 100%;\n flex-shrink: 0;\n}\n</style>\n"],"names":["_createBlock","_withCtx","_renderSlot","_createVNode","_TransitionGroup","_openBlock","_createElementBlock","_Fragment","_renderList","_normalizeClass","_normalizeStyle"],"mappings":";;;;;;;;;;sBACEA,WAgFe,CAAA,uBAAA,EAAA;AAAA,IA/EZ,GAAA,EAAK,OAAE,KAAM,CAAA,MAAA;AAAA,IACb,yBAAyB,EAAA,KAAA;AAAA,IACzB,cAAc,EAAA,IAAA,CAAA,WAAA;AAAA,IACd,cAAA,EAAc,oBAAe,IAAmB,CAAA,mBAAA,KAAA,CAAA,CAAA;AAAA,IAChD,wBAAsB,EAAA;AAAA,MAAA,6CAAA;MAA+D,IAAoB,CAAA,oBAAA,IAAA,EAAA;AAAA,KAAA;;AAK/F,IAAA,2BAAA,EAAyBC,QAIlC,MAAyC;AAAA,MAAzCC,UAAyC,CAAA,IAAA,CAAA,MAAA,EAAA,2BAAA,CAAA;AAAA,KAAA,CAAA;AA4DhC,IAAA,4BAAA,EAA0BD,QAInC,MAA0C;AAAA,MAA1CC,UAA0C,CAAA,IAAA,CAAA,MAAA,EAAA,4BAAA,CAAA;AAAA,KAAA,CAAA;qBA9D5C,MAyDmB;AAAA,MAzDnBC,WAyDmB,CAAAC,eAAA,EAAA;AAAA,QAxDjB,KAAM,EAAA,4BAAA;AAAA,QACL,GAAK,EAAA,KAAA;AAAA,QACN,GAAI,EAAA,IAAA;AAAA,QACJ,MAAA,EAAA,EAAA;AAAA,QACC,aAAc,EAAA,IAAA,CAAA,aAAA;AAAA,QACd,OAAO,EAAA,IAAA,CAAA,OAAA;AAAA,QACP,OAAO,EAAA,IAAA,CAAA,OAAA;AAAA,OAAA,EAAA;yBAGN,MAA4D;AAAA,WAD9DC,SAAA,CAAA,IAAA,CAAA,EAAAC,kBAAA;AAAA,YA+CKC,QAAA;AAAA,YAAA,IAAA;AAAA,YAAAC,UAAA,CA9CmC,IAAqB,CAAA,qBAAA,EAAA,CAAA,EAAlD,KAAK,EAAA,GAAK,aAAa,EAAA,KAAA;kCADlCF,kBA+CK,CAAA,IAAA,EAAA;AAAA,gBAAA,OAAA,EAAA,IAAA;gBA7CH,GAAI,EAAA,WAAA;AAAA,gBACH,KAAK,aAAc,CAAA,cAAA;AAAA,gBACpB,KAAA,EAAKG,gBAAC,iCAAiC,EAAA,CAC9B,eAAU,IAAa,CAAA,SAAA,IAAA,IAAA,CAAA,SAAA,CAAU,KAAQ,GAAA,IAAA,CAAA,SAAA,CAAU,MAAM,CAAA,CAAA,CAAA,CAAA;AAAA,gBACjE,YAAY,EAAA,KAAA;AAAA,gBACZ,KAAK,EAAAC,cAAA,CAAA;AAAA,kBAAA,GAAkB,6BAAwB,KAAK,IAAA,EAAA,KAAA,EAAA,MAAA,EAAA;AAAA,kBAAA,GAAsC,IAAW,CAAA,WAAA,IAAA,EAAA,aAAA,EAAA,MAAA,EAAA;AAAA,iBAAA,CAAA;gBAItG,WAAU,EAAA,+BAAA;AAAA,eAAA,EAAA;gBAQVR,UA2BO,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA;AAAA,kBA1BJ,aAAA;AAAA,kBACA,QAAA,EAAS,MAAQ,IAAA,CAAA,QAAA,CAAS,KAAK,CAAA;AAAA,kBAC/B,YAAa,IAAwB,CAAA,mBAAA,KAAA,KAAA;AAAA,iBAAA,EAHxC,MA2BO;AAAA,kBAtBLC,WAqBiB,CAAA,yBAAA,EAAA;AAAA,oBApBd,OAAA,EAAS,cAAc,OAAS,EAAA,qBAAA;AAAA,oBAChC,gBAAc,EAAA;AAAA,sBAAA,OAAA,EAAA,iBAAA;AAAkF,sBAAA,oBAAA,EAAA,IAAA,CAAA,CAAA,CAAE,KAAM,CAAA,SAAA;AAAA,sBAAA,WAAA,EAAA,KAAA;;;qCAMzG,MAYgB;AAAA,sBAZhBA,WAYgB,CAAA,wBAAA,EAAA;AAAA,wBAXb,gBAAgB,EAAA,aAAA;AAAA,wBAChB,UAAU,IAAwB,CAAA,mBAAA,KAAA,KAAA;AAAA,wBAClC,OAAA,EAAK,CAAE,MAAA,KAAA,IAAA,CAAA,QAAA,CAAS,KAAK,CAAA;AAAA,uBAAA,EAAA;AAEX,wBAAA,8BAAA,EAA4BF,QAKrC,MAA4E;AAAA,0BAA5EC,UAAA,CAA4E,+CAAjC,aAA6B,EAAA,CAAA;AAAA,yBAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"related-tag.vue.js","sources":["../../../../../src/x-modules/related-tags/components/related-tag.vue"],"sourcesContent":["<template>\n <button\n ref=\"buttonEl\"\n class=\"x-tag x-related-tag\"\n data-test=\"related-tag\"\n :class=\"dynamicClasses\"\n @click=\"clickRelatedTag\"\n >\n <!--\n @slot Custom content that replaces the RelatedTag default content.\n @binding {RelatedTag} relatedTag - Related tag data.\n @binding {boolean} isSelected - Related tag status.\n @binding {boolean} shouldHighlightCurated - True if the curated RTs should be displayed.\n -->\n <slot v-bind=\"{ relatedTag, isSelected, shouldHighlightCurated }\">{{ relatedTag.tag }}</slot>\n </button>\n</template>\n\n<script lang=\"ts\">\nimport type { RelatedTag as RelatedTagModel } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../../../utils/types'\nimport type { WireMetadata } from '../../../wiring/wiring.types'\nimport { computed, defineComponent, ref } from 'vue'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { relatedTagsXModule } from '../x-module'\n\n/**\n * This component renders a related tag for a query. A related tag is a descriptive keyword\n * related to the current query to fine-tune the search. For example, if you are searching\n * for *lego*, a related tag could be *city*, refining the search with *lego city*.\n *\n * @public\n */\nexport default defineComponent({\n name: 'RelatedTag',\n xModule: relatedTagsXModule.name,\n props: {\n /**\n * Indicates if the curated related tag should be highlighted.\n *\n * @public\n */\n highlightCurated: {\n type: Boolean,\n default: false,\n },\n /**\n * The related tag model data.\n *\n * @public\n */\n relatedTag: {\n type: Object as PropType<RelatedTagModel>,\n required: true,\n },\n },\n setup(props) {\n const $x = use$x()\n\n const buttonEl = ref<HTMLElement | undefined>()\n\n /**\n * The selected related tags.\n *\n * @internal\n */\n const { selectedRelatedTags } = useState('relatedTags')\n\n /**\n * Check if the related tag is selected or not.\n *\n * @returns If the related tag is selected.\n *\n * @internal\n */\n const isSelected = computed(() => selectedRelatedTags.value.includes(props.relatedTag))\n\n /**\n * Blurs the related tag if it is selected.\n *\n * @public\n */\n const blurRelatedTag = () => {\n if (isSelected.value) {\n buttonEl.value?.blur()\n }\n }\n\n /**\n * Generates the {@link WireMetadata} object omitting the moduleName.\n *\n * @returns The {@link WireMetadata} object omitting the moduleName.\n * @internal\n */\n const createEventMetadata = (): Omit<WireMetadata, 'moduleName'> => ({\n target: buttonEl.value as HTMLElement,\n feature: 'related_tag',\n })\n\n /**\n * Emits events when the button is clicked.\n *\n * @public\n */\n const emitEvents = () => {\n // We have to emit this events first to avoid the UserPickedARelatedTag wires to change the\n // isSelected value before emitting this selection events.\n $x.emit(\n isSelected.value ? 'UserDeselectedARelatedTag' : 'UserSelectedARelatedTag',\n props.relatedTag,\n createEventMetadata(),\n )\n $x.emit('UserPickedARelatedTag', props.relatedTag, createEventMetadata())\n }\n\n /**\n * Handles the click on the button.\n *\n * @public\n */\n const clickRelatedTag = () => {\n emitEvents()\n blurRelatedTag()\n }\n\n /**\n * Check if the related tag is curated and should be highlighted.\n *\n * @returns True if the related tag is curated and should be highlighted.\n *\n * @internal\n */\n const shouldHighlightCurated = computed(\n () => props.highlightCurated && (props.relatedTag.isCurated ?? false),\n )\n\n /**\n * Adds the dynamic css classes to the component.\n *\n * @returns The class to be added to the component.\n *\n * @internal\n */\n const dynamicClasses = computed(\n (): VueCSSClasses => ({\n 'x-selected x-related-tag--is-selected': isSelected.value,\n 'x-related-tag--is-curated': shouldHighlightCurated.value,\n }),\n )\n\n return {\n buttonEl,\n dynamicClasses,\n isSelected,\n clickRelatedTag,\n shouldHighlightCurated,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Dynamic classes\n\n`RelatedTag` uses the following dynamic CSS classes so you can style it when is:\n\n- Selected: `x-related-tag--is-selected`.\n- Curated: `x-related-tag--is-curated`.\n\n## Events\n\nThis component emits the following events:\n\n- [`UserDeselectedARelatedTag`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserPickedARelatedTag`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserSelectedARelatedTag`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend service required\nThe QuerySignals microservice must be implemented.\n:::\n<!-- prettier-ignore-end -->\n\nIn this example related tag data is passed as a prop.\n\n_Here you can see how the RelatedTag component is rendered._\n\n```vue live\n<template>\n <RelatedTag :relatedTag=\"tag\" />\n</template>\n\n<script>\nimport { RelatedTag } from '@empathyco/x-components/related-tags'\n\nexport default {\n name: 'RelatedTagDemo',\n components: {\n RelatedTag,\n },\n data() {\n return {\n tag: {\n modelName: 'RelatedTag',\n query: 'high heel',\n isCurated: false,\n tag: 'heel',\n },\n }\n },\n}\n</script>\n```\n\n### Play with default slot\n\nIn this example, an HTML span element is passed in the `default` slot.\n\n_See how the related tag can be rendered._\n\n```vue live\n<template>\n <RelatedTag :relatedTag=\"tag\" #default=\"{ relatedTag }\">\n <span :aria-label=\"relatedTag.tag\">{{ relatedTag.tag }}</span>\n </RelatedTag>\n</template>\n\n<script>\nimport { RelatedTag } from '@empathyco/x-components/related-tags'\n\nexport default {\n name: 'RelatedTagDemo',\n components: {\n RelatedTag,\n },\n data() {\n return {\n tag: {\n modelName: 'RelatedTag',\n query: 'high heel',\n isCurated: false,\n tag: 'heel',\n },\n }\n },\n}\n</script>\n```\n\n### Play with events\n\nIn this example, the [`UserSelectedARelatedTag`](./../../api/x-components.relatedtagsxevents.md)\nevent is implemented, as illustrated by the “Tag” message returned.\n\n_See how the event is triggered when the related tag is clicked._\n\n```vue live\n<template>\n <RelatedTag :relatedTag=\"tag\" @UserSelectedARelatedTag=\"alertRelatedTag\" />\n</template>\n\n<script>\nimport { RelatedTag } from '@empathyco/x-components/related-tags'\n\nexport default {\n name: 'RelatedTagDemo',\n components: {\n RelatedTag,\n },\n data() {\n return {\n tag: {\n modelName: 'RelatedTag',\n query: 'high heel',\n isCurated: false,\n tag: 'heel',\n },\n }\n },\n methods: {\n alertRelatedTag(relatedTag) {\n alert(`You have clicked the related tag: ${relatedTag.query}`)\n },\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_renderSlot","
|
|
1
|
+
{"version":3,"file":"related-tag.vue.js","sources":["../../../../../src/x-modules/related-tags/components/related-tag.vue"],"sourcesContent":["<template>\n <button\n ref=\"buttonEl\"\n class=\"x-tag x-related-tag\"\n data-test=\"related-tag\"\n :class=\"dynamicClasses\"\n @click=\"clickRelatedTag\"\n >\n <!--\n @slot Custom content that replaces the RelatedTag default content.\n @binding {RelatedTag} relatedTag - Related tag data.\n @binding {boolean} isSelected - Related tag status.\n @binding {boolean} shouldHighlightCurated - True if the curated RTs should be displayed.\n -->\n <slot v-bind=\"{ relatedTag, isSelected, shouldHighlightCurated }\">{{ relatedTag.tag }}</slot>\n </button>\n</template>\n\n<script lang=\"ts\">\nimport type { RelatedTag as RelatedTagModel } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../../../utils/types'\nimport type { WireMetadata } from '../../../wiring/wiring.types'\nimport { computed, defineComponent, ref } from 'vue'\nimport { use$x } from '../../../composables/use-$x'\nimport { useState } from '../../../composables/use-state'\nimport { relatedTagsXModule } from '../x-module'\n\n/**\n * This component renders a related tag for a query. A related tag is a descriptive keyword\n * related to the current query to fine-tune the search. For example, if you are searching\n * for *lego*, a related tag could be *city*, refining the search with *lego city*.\n *\n * @public\n */\nexport default defineComponent({\n name: 'RelatedTag',\n xModule: relatedTagsXModule.name,\n props: {\n /**\n * Indicates if the curated related tag should be highlighted.\n *\n * @public\n */\n highlightCurated: {\n type: Boolean,\n default: false,\n },\n /**\n * The related tag model data.\n *\n * @public\n */\n relatedTag: {\n type: Object as PropType<RelatedTagModel>,\n required: true,\n },\n },\n setup(props) {\n const $x = use$x()\n\n const buttonEl = ref<HTMLElement | undefined>()\n\n /**\n * The selected related tags.\n *\n * @internal\n */\n const { selectedRelatedTags } = useState('relatedTags')\n\n /**\n * Check if the related tag is selected or not.\n *\n * @returns If the related tag is selected.\n *\n * @internal\n */\n const isSelected = computed(() => selectedRelatedTags.value.includes(props.relatedTag))\n\n /**\n * Blurs the related tag if it is selected.\n *\n * @public\n */\n const blurRelatedTag = () => {\n if (isSelected.value) {\n buttonEl.value?.blur()\n }\n }\n\n /**\n * Generates the {@link WireMetadata} object omitting the moduleName.\n *\n * @returns The {@link WireMetadata} object omitting the moduleName.\n * @internal\n */\n const createEventMetadata = (): Omit<WireMetadata, 'moduleName'> => ({\n target: buttonEl.value as HTMLElement,\n feature: 'related_tag',\n })\n\n /**\n * Emits events when the button is clicked.\n *\n * @public\n */\n const emitEvents = () => {\n // We have to emit this events first to avoid the UserPickedARelatedTag wires to change the\n // isSelected value before emitting this selection events.\n $x.emit(\n isSelected.value ? 'UserDeselectedARelatedTag' : 'UserSelectedARelatedTag',\n props.relatedTag,\n createEventMetadata(),\n )\n $x.emit('UserPickedARelatedTag', props.relatedTag, createEventMetadata())\n }\n\n /**\n * Handles the click on the button.\n *\n * @public\n */\n const clickRelatedTag = () => {\n emitEvents()\n blurRelatedTag()\n }\n\n /**\n * Check if the related tag is curated and should be highlighted.\n *\n * @returns True if the related tag is curated and should be highlighted.\n *\n * @internal\n */\n const shouldHighlightCurated = computed(\n () => props.highlightCurated && (props.relatedTag.isCurated ?? false),\n )\n\n /**\n * Adds the dynamic css classes to the component.\n *\n * @returns The class to be added to the component.\n *\n * @internal\n */\n const dynamicClasses = computed(\n (): VueCSSClasses => ({\n 'x-selected x-related-tag--is-selected': isSelected.value,\n 'x-related-tag--is-curated': shouldHighlightCurated.value,\n }),\n )\n\n return {\n buttonEl,\n dynamicClasses,\n isSelected,\n clickRelatedTag,\n shouldHighlightCurated,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Dynamic classes\n\n`RelatedTag` uses the following dynamic CSS classes so you can style it when is:\n\n- Selected: `x-related-tag--is-selected`.\n- Curated: `x-related-tag--is-curated`.\n\n## Events\n\nThis component emits the following events:\n\n- [`UserDeselectedARelatedTag`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserPickedARelatedTag`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n- [`UserSelectedARelatedTag`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend service required\nThe QuerySignals microservice must be implemented.\n:::\n<!-- prettier-ignore-end -->\n\nIn this example related tag data is passed as a prop.\n\n_Here you can see how the RelatedTag component is rendered._\n\n```vue live\n<template>\n <RelatedTag :relatedTag=\"tag\" />\n</template>\n\n<script>\nimport { RelatedTag } from '@empathyco/x-components/related-tags'\n\nexport default {\n name: 'RelatedTagDemo',\n components: {\n RelatedTag,\n },\n data() {\n return {\n tag: {\n modelName: 'RelatedTag',\n query: 'high heel',\n isCurated: false,\n tag: 'heel',\n },\n }\n },\n}\n</script>\n```\n\n### Play with default slot\n\nIn this example, an HTML span element is passed in the `default` slot.\n\n_See how the related tag can be rendered._\n\n```vue live\n<template>\n <RelatedTag :relatedTag=\"tag\" #default=\"{ relatedTag }\">\n <span :aria-label=\"relatedTag.tag\">{{ relatedTag.tag }}</span>\n </RelatedTag>\n</template>\n\n<script>\nimport { RelatedTag } from '@empathyco/x-components/related-tags'\n\nexport default {\n name: 'RelatedTagDemo',\n components: {\n RelatedTag,\n },\n data() {\n return {\n tag: {\n modelName: 'RelatedTag',\n query: 'high heel',\n isCurated: false,\n tag: 'heel',\n },\n }\n },\n}\n</script>\n```\n\n### Play with events\n\nIn this example, the [`UserSelectedARelatedTag`](./../../api/x-components.relatedtagsxevents.md)\nevent is implemented, as illustrated by the “Tag” message returned.\n\n_See how the event is triggered when the related tag is clicked._\n\n```vue live\n<template>\n <RelatedTag :relatedTag=\"tag\" @UserSelectedARelatedTag=\"alertRelatedTag\" />\n</template>\n\n<script>\nimport { RelatedTag } from '@empathyco/x-components/related-tags'\n\nexport default {\n name: 'RelatedTagDemo',\n components: {\n RelatedTag,\n },\n data() {\n return {\n tag: {\n modelName: 'RelatedTag',\n query: 'high heel',\n isCurated: false,\n tag: 'heel',\n },\n }\n },\n methods: {\n alertRelatedTag(relatedTag) {\n alert(`You have clicked the related tag: ${relatedTag.query}`)\n },\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_createTextVNode","_toDisplayString"],"mappings":";;;;;AACE,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,IAcS,QAAA;AAAA,IAAA;AAAA,MAbP,GAAI,EAAA,UAAA;AAAA,MACJ,KAAA,EAAKC,cAAC,CAAA,CAAA,qBAAA,EAEE,IAAc,CAAA,cAAA,CAAA,CAAA;AAAA,MADtB,WAAU,EAAA,aAAA;AAAA,MAET,SAAK,MAAE,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAA,IAAA,CAAA,eAAA,IAAA,IAAA,CAAA,eAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA,KAAA;;AAQR,MAAAC,UAAA,CAA6F,wEAA7E,IAAU,CAAA,UAAA,EAAA,UAAA,EAAE,iBAAU,sBAAE,EAAA,IAAA,CAAA,sBAAA,MAAxC,MAA6F;AAAA,QAAAC,eAAA;AAAxB,UAAAC,eAAA,CAAA,IAAA,CAAA,UAAA,CAAW,GAAG,CAAA;AAAA,UAAA,CAAA;AAAA;AAAA,SAAA;AAAA,OAAA,CAAA;;;;;;;;;;"}
|
|
@@ -30,9 +30,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
30
30
|
default: withCtx(({ relatedTag: relatedTagBinding, isSelected, shouldHighlightCurated }) => [
|
|
31
31
|
renderSlot(_ctx.$slots, "related-tag-content", mergeProps({ ref_for: true }, { relatedTag: relatedTagBinding, isSelected, shouldHighlightCurated }), void 0, true)
|
|
32
32
|
]),
|
|
33
|
-
_:
|
|
34
|
-
/*
|
|
35
|
-
},
|
|
33
|
+
_: 3
|
|
34
|
+
/* FORWARDED */
|
|
35
|
+
}, 8, ["highlight-curated", "related-tag", "class"])
|
|
36
36
|
], true)
|
|
37
37
|
]);
|
|
38
38
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"related-tags.vue.js","sources":["../../../../../src/x-modules/related-tags/components/related-tags.vue"],"sourcesContent":["<template>\n <component\n :is=\"animation\"\n v-if=\"relatedTags.length\"\n tag=\"ul\"\n class=\"x-related-tags\"\n data-test=\"related-tags\"\n >\n <li\n v-for=\"relatedTag in relatedTags\"\n :key=\"relatedTag.query\"\n class=\"x-related-tags__item\"\n data-test=\"related-tag-item\"\n >\n <!--\n @slot Custom content that replaces the RelatedTag component.\n @binding {RelatedTag} relatedTag - Related tag data.\n @binding {boolean} highlightCurated - True if the curated RTs should be displayed.\n -->\n <slot name=\"related-tag\" v-bind=\"{ relatedTag, highlightCurated }\">\n <RelatedTag\n :highlight-curated=\"highlightCurated\"\n :related-tag=\"relatedTag\"\n :class=\"itemClass\"\n >\n <template\n #default=\"{ relatedTag: relatedTagBinding, isSelected, shouldHighlightCurated }\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom content that replaces the RelatedTag default content.\n @binding {RelatedTag} relatedTag - Related tag data.\n @binding {boolean} isSelected - Related tag status.\n @binding {boolean} shouldHighlightCurated - True if the curated RTs should be displayed.\n -->\n <slot\n name=\"related-tag-content\"\n v-bind=\"{ relatedTag: relatedTagBinding, isSelected, shouldHighlightCurated }\"\n />\n </template>\n </RelatedTag>\n </slot>\n </li>\n </component>\n</template>\n\n<script lang=\"ts\">\nimport type { RelatedTag as RelatedTagModel } from '@empathyco/x-types'\nimport type { ComputedRef } from 'vue'\nimport { computed, defineComponent } from 'vue'\nimport { useGetter } from '../../../composables/use-getter'\nimport { AnimationProp } from '../../../types/index'\nimport { relatedTagsXModule } from '../x-module'\nimport RelatedTag from './related-tag.vue'\n\n/**\n * This component renders a set of [`RelatedTag`](./x-components.related-tag) components by\n * default to select from after a query is performed to fine-tune search.\n * For example, if you are searching for *lego*, different related tags could be *city*,\n * friends*, or *harry potter*, refining the search with *lego city*, *lego friends*,\n * or *lego harry potter*.\n *\n * @public\n */\nexport default defineComponent({\n name: 'RelatedTags',\n xModule: relatedTagsXModule.name,\n components: {\n RelatedTag,\n },\n props: {\n /**\n * Animation component that will be used to animate the suggestion.\n *\n * @public\n */\n animation: {\n type: AnimationProp,\n default: 'ul',\n },\n\n /**\n * Number of related tags to be rendered.\n *\n * @public\n */\n maxItemsToRender: Number,\n\n /**\n * Flag to indicate if the curated tags should be displayed different.\n *\n * @public\n */\n highlightCurated: {\n type: Boolean,\n default: false,\n },\n\n /** Class inherited by content element. */\n itemClass: String,\n },\n setup(props) {\n const storedRelatedTags: ComputedRef<RelatedTagModel[]> = useGetter('relatedTags').relatedTags\n\n const relatedTags = computed((): RelatedTagModel[] =>\n storedRelatedTags.value.slice(0, props.maxItemsToRender),\n )\n\n return {\n relatedTags,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-related-tags {\n display: flex;\n flex-flow: row nowrap;\n list-style: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend microservice required\nTo use this component, the QuerySignals microservice must be implemented.\n:::\n<!-- prettier-ignore-end -->\n\nThis example shows how related tags can be rendered without any additional effects.\n\n_Search for a fashion term like \"sandal\" or \"lipstick\"._\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <RelatedTags />\n </div>\n</template>\n\n<script>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { RelatedTags } from '@empathyco/x-components/related-tags'\n\nexport default {\n name: 'RelatedTagsDemo',\n components: {\n SearchInput,\n RelatedTags,\n },\n}\n</script>\n```\n\n### Play with props\n\nIn this example, the number of related tags rendered has been limited to 3. A fade and slide effect\nhas been added so that the related tags appear with a delay, then slide upwards and fade.\n\n_Search for a fashion term and see the related tags with the animation effect._\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <RelatedTags :animation=\"'StaggeredFadeAndSlide'\" :maxItemsToRender=\"3\" />\n </div>\n</template>\n\n<script>\nimport Vue from 'vue'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { RelatedTags } from '@empathyco/x-components/related-tags'\nimport { StaggeredFadeAndSlide } from '@empathyco/x-components'\n\n// Registering the animation as a global component\nVue.component('StaggeredFadeAndSlide', StaggeredFadeAndSlide)\nexport default {\n name: 'RelatedTagsDemo',\n components: {\n SearchInput,\n RelatedTags,\n },\n}\n</script>\n```\n\n### Play with related-tag slot\n\nIn this example, the [`RelatedTag`](./x-components.related-tag.md) component is passed in the\n`related-tag` slot (although any other component could potentially be passed).\n\n_Search for a fashion term and see how the related tags can be rendered._\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <RelatedTags #related-tag=\"{ relatedTag }\">\n <RelatedTag :relatedTag=\"relatedTag\" />\n </RelatedTags>\n </div>\n</template>\n\n<script>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { RelatedTags, RelatedTag } from '@empathyco/x-components/related-tags'\n\nexport default {\n name: 'RelatedTagsDemo',\n components: {\n SearchInput,\n RelatedTags,\n RelatedTag,\n },\n}\n</script>\n```\n\n### Play with related-tag-content slot\n\nTo continue the previous example, the [`RelatedTag`](./x-components.related-tag.md) component is\npassed in the `related-tag-content` slot, but in addition, an HTML span tag for the text are also\npassed.\n\n_Search for a fashion term and see how the related tags are rendered._\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <RelatedTags #related-tag-content=\"{ relatedTag }\">\n <span>{{ relatedTag.tag }}</span>\n </RelatedTags>\n </div>\n</template>\n\n<script>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { RelatedTags } from '@empathyco/x-components/related-tags'\n\nexport default {\n name: 'RelatedTagsDemo',\n components: {\n SearchInput,\n RelatedTags,\n },\n}\n</script>\n```\n\n## Extending the component\n\nComponents can be combined and communicate with each other. The `RelatedTags` component can\ncommunicate with the [`SearchInput`](../search-box/x-components.search-input.md) as follows:\n\n_Search for a fashion term and see how the related tags can be rendered._\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <RelatedTags />\n <ResultsList #result=\"{ item }\">\n <span class=\"result\">\n {{ item.name }}\n </span>\n </ResultsList>\n </div>\n</template>\n\n<script>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { RelatedTags } from '@empathyco/x-components/related-tags'\nimport { ResultsList } from '@empathyco/x-components/search'\n\nexport default {\n name: 'RelatedTagsDemo',\n components: {\n SearchInput,\n RelatedTags,\n ResultsList,\n },\n}\n</script>\n```\n\n## Customizing the related tags with classes\n\nThe `itemClass` prop can be used to add classes to the related tags.\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <RelatedTags #related-tag-content=\"{ relatedTag }\" itemClass=\"x-tag-outlined x-tag-auxiliary\">\n <span>{{ relatedTag.tag }}</span>\n </RelatedTags>\n </div>\n</template>\n\n<script>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { RelatedTags } from '@empathyco/x-components/related-tags'\n\nexport default {\n name: 'RelatedTagsDemo',\n components: {\n SearchInput,\n RelatedTags,\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createBlock","_resolveDynamicComponent","_withCtx","_createElementBlock","_Fragment","_renderList","_renderSlot","_mergeProps","_createVNode","_normalizeClass","_createCommentVNode"],"mappings":";;;;;;;SAGU,IAAY,CAAA,WAAA,CAAA,MAAA,IAAAA,SAAA,EAAA,EAFpBC,WA0CY,CAAAC,uBAAA,CAzCL,IAAS,CAAA,SAAA,CAAA,EAAA;AAAA,IAFlB,GAAA,EAAA,CAAA;AAAA,IAII,GAAI,EAAA,IAAA;AAAA,IACJ,KAAM,EAAA,gBAAA;AAAA,IACN,WAAU,EAAA,cAAA;AAAA,GAAA,EAAA;AANd,IAAA,OAAA,EAAAC,OAAA,CASM,MAAiC;AAAA,OADnCH,SAAA,CAAA,IAAA,CAAA,EAAAI,kBAAA;AAAA,QAkCKC,QAAA;AAAA,QAAA,IAAA;AAAA,QA1CTC,UAAA,CAS2B,IAT3B,CAAA,WAAA,EAAA,CASa,UAAU,KAAA;8BADnBF,kBAkCK,CAAA,IAAA,EAAA;AAAA,YAhCF,KAAK,UAAW,CAAA,KAAA;AAAA,YACjB,KAAM,EAAA,sBAAA;AAAA,YACN,WAAU,EAAA,kBAAA;AAAA,WAAA,EAAA;YAOVG,UAsBO,CAAA,IAAA,CAAA,MAAA,EAAA,aAAA,EAtBPC,WAsBO,EAzCb,OAAA,EAAA,IAAA,EAAA,EAAA,EAmByC,YAAU,gBAAE,EAAA,IAAA,CAAA,gBAAA,KAA/C,MAsBO;AAAA,cArBLC,WAoBa,CAAA,qBAAA,EAAA;AAAA,gBAnBV,mBAAmB,EAAA,IAAA,CAAA,gBAAA;AAAA,gBACnB,aAAa,EAAA,UAAA;AAAA,gBACb,KAAA,EAvBXC,eAuBkB,IAAS,CAAA,SAAA,CAAA;AAAA,eAAA,EAAA;AAGd,gBAAA,OAAA,EAAOP,OASR,CAAA,CAGE,EAZsB,UAAA,EAAA,iBAAA,EAAmB,YAAY,sBAAsB,EAAA,KAAA;AAAA,kBAS7EI,WAGE,IAHF,CAAA,MAAA,EAAA,qBAAA,EAAAC,UAAA,CAGE,EAtCd,OAqCoC,EAAA,IAAA,EAAA,EAAA,EAAA,UAAA,EAAA,iBAAA,EAAmB,YAAY,sBAAsB,EAAA,CAAA,EAAA,KAAA,CAAA,EAAA,IAAA,CAAA;AAAA,iBAAA,CAAA;AArCzF,gBAAA,CAAA,EAAA,CAAA;AAAA;AAAA,eAAA,EAAA,IAAA,EAAA,CAAA,mBAAA,EAAA,aAAA,EAAA,OAAA,CAAA,CAAA;;;;;;;;AAAA,IAAA,CAAA,EAAA,CAAA;AAAA;AAAA,GAAA,CAAA,IAAAG,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA,CAAA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"related-tags.vue.js","sources":["../../../../../src/x-modules/related-tags/components/related-tags.vue"],"sourcesContent":["<template>\n <component\n :is=\"animation\"\n v-if=\"relatedTags.length\"\n tag=\"ul\"\n class=\"x-related-tags\"\n data-test=\"related-tags\"\n >\n <li\n v-for=\"relatedTag in relatedTags\"\n :key=\"relatedTag.query\"\n class=\"x-related-tags__item\"\n data-test=\"related-tag-item\"\n >\n <!--\n @slot Custom content that replaces the RelatedTag component.\n @binding {RelatedTag} relatedTag - Related tag data.\n @binding {boolean} highlightCurated - True if the curated RTs should be displayed.\n -->\n <slot name=\"related-tag\" v-bind=\"{ relatedTag, highlightCurated }\">\n <RelatedTag\n :highlight-curated=\"highlightCurated\"\n :related-tag=\"relatedTag\"\n :class=\"itemClass\"\n >\n <template\n #default=\"{ relatedTag: relatedTagBinding, isSelected, shouldHighlightCurated }\"\n >\n <!-- eslint-disable max-len -->\n <!--\n @slot Custom content that replaces the RelatedTag default content.\n @binding {RelatedTag} relatedTag - Related tag data.\n @binding {boolean} isSelected - Related tag status.\n @binding {boolean} shouldHighlightCurated - True if the curated RTs should be displayed.\n -->\n <slot\n name=\"related-tag-content\"\n v-bind=\"{ relatedTag: relatedTagBinding, isSelected, shouldHighlightCurated }\"\n />\n </template>\n </RelatedTag>\n </slot>\n </li>\n </component>\n</template>\n\n<script lang=\"ts\">\nimport type { RelatedTag as RelatedTagModel } from '@empathyco/x-types'\nimport type { ComputedRef } from 'vue'\nimport { computed, defineComponent } from 'vue'\nimport { useGetter } from '../../../composables/use-getter'\nimport { AnimationProp } from '../../../types/index'\nimport { relatedTagsXModule } from '../x-module'\nimport RelatedTag from './related-tag.vue'\n\n/**\n * This component renders a set of [`RelatedTag`](./x-components.related-tag) components by\n * default to select from after a query is performed to fine-tune search.\n * For example, if you are searching for *lego*, different related tags could be *city*,\n * friends*, or *harry potter*, refining the search with *lego city*, *lego friends*,\n * or *lego harry potter*.\n *\n * @public\n */\nexport default defineComponent({\n name: 'RelatedTags',\n xModule: relatedTagsXModule.name,\n components: {\n RelatedTag,\n },\n props: {\n /**\n * Animation component that will be used to animate the suggestion.\n *\n * @public\n */\n animation: {\n type: AnimationProp,\n default: 'ul',\n },\n\n /**\n * Number of related tags to be rendered.\n *\n * @public\n */\n maxItemsToRender: Number,\n\n /**\n * Flag to indicate if the curated tags should be displayed different.\n *\n * @public\n */\n highlightCurated: {\n type: Boolean,\n default: false,\n },\n\n /** Class inherited by content element. */\n itemClass: String,\n },\n setup(props) {\n const storedRelatedTags: ComputedRef<RelatedTagModel[]> = useGetter('relatedTags').relatedTags\n\n const relatedTags = computed((): RelatedTagModel[] =>\n storedRelatedTags.value.slice(0, props.maxItemsToRender),\n )\n\n return {\n relatedTags,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-related-tags {\n display: flex;\n flex-flow: row nowrap;\n list-style: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## See it in action\n\n<!-- prettier-ignore-start -->\n:::warning Backend microservice required\nTo use this component, the QuerySignals microservice must be implemented.\n:::\n<!-- prettier-ignore-end -->\n\nThis example shows how related tags can be rendered without any additional effects.\n\n_Search for a fashion term like \"sandal\" or \"lipstick\"._\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <RelatedTags />\n </div>\n</template>\n\n<script>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { RelatedTags } from '@empathyco/x-components/related-tags'\n\nexport default {\n name: 'RelatedTagsDemo',\n components: {\n SearchInput,\n RelatedTags,\n },\n}\n</script>\n```\n\n### Play with props\n\nIn this example, the number of related tags rendered has been limited to 3. A fade and slide effect\nhas been added so that the related tags appear with a delay, then slide upwards and fade.\n\n_Search for a fashion term and see the related tags with the animation effect._\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <RelatedTags :animation=\"'StaggeredFadeAndSlide'\" :maxItemsToRender=\"3\" />\n </div>\n</template>\n\n<script>\nimport Vue from 'vue'\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { RelatedTags } from '@empathyco/x-components/related-tags'\nimport { StaggeredFadeAndSlide } from '@empathyco/x-components'\n\n// Registering the animation as a global component\nVue.component('StaggeredFadeAndSlide', StaggeredFadeAndSlide)\nexport default {\n name: 'RelatedTagsDemo',\n components: {\n SearchInput,\n RelatedTags,\n },\n}\n</script>\n```\n\n### Play with related-tag slot\n\nIn this example, the [`RelatedTag`](./x-components.related-tag.md) component is passed in the\n`related-tag` slot (although any other component could potentially be passed).\n\n_Search for a fashion term and see how the related tags can be rendered._\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <RelatedTags #related-tag=\"{ relatedTag }\">\n <RelatedTag :relatedTag=\"relatedTag\" />\n </RelatedTags>\n </div>\n</template>\n\n<script>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { RelatedTags, RelatedTag } from '@empathyco/x-components/related-tags'\n\nexport default {\n name: 'RelatedTagsDemo',\n components: {\n SearchInput,\n RelatedTags,\n RelatedTag,\n },\n}\n</script>\n```\n\n### Play with related-tag-content slot\n\nTo continue the previous example, the [`RelatedTag`](./x-components.related-tag.md) component is\npassed in the `related-tag-content` slot, but in addition, an HTML span tag for the text are also\npassed.\n\n_Search for a fashion term and see how the related tags are rendered._\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <RelatedTags #related-tag-content=\"{ relatedTag }\">\n <span>{{ relatedTag.tag }}</span>\n </RelatedTags>\n </div>\n</template>\n\n<script>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { RelatedTags } from '@empathyco/x-components/related-tags'\n\nexport default {\n name: 'RelatedTagsDemo',\n components: {\n SearchInput,\n RelatedTags,\n },\n}\n</script>\n```\n\n## Extending the component\n\nComponents can be combined and communicate with each other. The `RelatedTags` component can\ncommunicate with the [`SearchInput`](../search-box/x-components.search-input.md) as follows:\n\n_Search for a fashion term and see how the related tags can be rendered._\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <RelatedTags />\n <ResultsList #result=\"{ item }\">\n <span class=\"result\">\n {{ item.name }}\n </span>\n </ResultsList>\n </div>\n</template>\n\n<script>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { RelatedTags } from '@empathyco/x-components/related-tags'\nimport { ResultsList } from '@empathyco/x-components/search'\n\nexport default {\n name: 'RelatedTagsDemo',\n components: {\n SearchInput,\n RelatedTags,\n ResultsList,\n },\n}\n</script>\n```\n\n## Customizing the related tags with classes\n\nThe `itemClass` prop can be used to add classes to the related tags.\n\n```vue live\n<template>\n <div>\n <SearchInput />\n <RelatedTags #related-tag-content=\"{ relatedTag }\" itemClass=\"x-tag-outlined x-tag-auxiliary\">\n <span>{{ relatedTag.tag }}</span>\n </RelatedTags>\n </div>\n</template>\n\n<script>\nimport { SearchInput } from '@empathyco/x-components/search-box'\nimport { RelatedTags } from '@empathyco/x-components/related-tags'\n\nexport default {\n name: 'RelatedTagsDemo',\n components: {\n SearchInput,\n RelatedTags,\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createBlock","_resolveDynamicComponent","_createElementBlock","_Fragment","_renderList","_renderSlot","_mergeProps","_createVNode","_normalizeClass","_withCtx"],"mappings":";;;;;;;SAGU,IAAY,CAAA,WAAA,CAAA,MAAA,IAAAA,SAAA,EAAA,EAFpBC,WA0CY,CAAAC,uBAAA,CAzCL,IAAS,CAAA,SAAA,CAAA,EAAA;AAAA,IAAA,GAAA,EAAA,CAAA;IAEd,GAAI,EAAA,IAAA;AAAA,IACJ,KAAM,EAAA,gBAAA;AAAA,IACN,WAAU,EAAA,cAAA;AAAA,GAAA,EAAA;qBAGR,MAAiC;AAAA,OADnCF,SAAA,CAAA,IAAA,CAAA,EAAAG,kBAAA;AAAA,QAkCKC,QAAA;AAAA,QAAA,IAAA;AAAA,QAjCkBC,UAAA,CAAA,IAAA,CAAA,WAAA,EAAW,CAAzB,UAAU,KAAA;8BADnBF,kBAkCK,CAAA,IAAA,EAAA;AAAA,YAhCF,KAAK,UAAW,CAAA,KAAA;AAAA,YACjB,KAAM,EAAA,sBAAA;AAAA,YACN,WAAU,EAAA,kBAAA;AAAA,WAAA,EAAA;AAOV,YAAAG,UAAA,CAsBO,4BAtBPC,UAsBO,CAAA,EAAA,OAAA,EAAA,IAAA,EAAA,EAAA,EAtB4B,YAAU,gBAAE,EAAA,IAAA,CAAA,gBAAA,KAA/C,MAsBO;AAAA,cArBLC,WAoBa,CAAA,qBAAA,EAAA;AAAA,gBAnBV,mBAAmB,EAAA,IAAA,CAAA,gBAAA;AAAA,gBACnB,aAAa,EAAA,UAAA;AAAA,gBACb,KAAA,EAAKC,eAAE,IAAS,CAAA,SAAA,CAAA;AAAA,eAAA,EAAA;AAGd,gBAAA,OAAA,EAAOC,OASR,CAAA,CAGE,EAZsB,UAAA,EAAA,iBAAA,EAAmB,YAAY,sBAAsB,EAAA,KAAA;AAAA,kBAS7EJ,WAGE,IAHF,CAAA,MAAA,EAAA,qBAAA,EAAAC,UAAA,CAGE,EADsB,OAAA,EAAA,IAAA,EAAA,EAAA,EAAA,UAAA,EAAA,iBAAA,EAAmB,YAAY,sBAAsB,EAAA,CAAA,EAAA,KAAA,CAAA,EAAA,IAAA,CAAA;AAAA,iBAAA,CAAA;;;;;;;;;;;;;;;;;;;"}
|