@empathyco/x-components 6.0.0-alpha.183 → 6.0.0-alpha.185
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 +16 -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-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-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/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/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 +7 -7
- 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/views/adapter.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":"base-result-add-to-cart.vue.js","sources":["../../../../src/components/result/base-result-add-to-cart.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n :metadata=\"metadata\"\n class=\"x-result-add-to-cart x-button\"\n data-test=\"result-add-to-cart\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot />\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { PropsWithType } from '../../utils/index'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport type { WireMetadata } from '../../wiring/index'\nimport { computed, defineComponent, inject } from 'vue'\nimport BaseEventButton from '../base-event-button.vue'\n\n/**\n * Renders a button with a default slot. It receives the result with the data and emits\n * {@link XEventsTypes.UserClickedResultAddToCart} to the bus on click mouse event.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseEventButton },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n },\n setup(props) {\n /**\n * The list of additional events to be emitted by the component when user clicks the add2cart button.\n *\n * @internal\n */\n const resultAddToCartExtraEvents = inject<PropsWithType<XEventsTypes, Result>[]>(\n 'resultAddToCartExtraEvents',\n [],\n )\n\n /**\n * The metadata to be injected in the events emitted by the component.\n */\n const metadata = inject<Omit<WireMetadata, 'moduleName' | 'origin' | 'location'>>(\n 'resultAddToCartExtraEventsMetadata',\n {},\n )\n\n /**\n * The events to be emitted by the button.\n *\n * @returns Events {@link XEventsTypes} to emit.\n *\n * @public\n */\n const events = computed(() => {\n return resultAddToCartExtraEvents.reduce(\n (acc, event) => {\n acc[event] = props.result\n return acc\n },\n { UserClickedResultAddToCart: props.result } as Partial<XEventsTypes>,\n )\n })\n\n return {\n events,\n metadata,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedResultAddToCart`](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 result data.\n\n## Examples\n\nRenders a button with a default slot. It receives the result with the data and emits an event\n`UserClickedResultAddToCart` to the bus on click mouse event.\n\n### Basic example\n\nThis component is a button to emit `UserClickedResultAddToCart` whe clicked by the user\n\n```vue\n<BaseResultAddToCart :result=\"result\">\n <img src=\"./add-to-cart.svg\" />\n <span>Add to cart</span>\n</BaseResultAddToCart>\n```\n</docs>\n"],"names":["_createBlock","
|
|
1
|
+
{"version":3,"file":"base-result-add-to-cart.vue.js","sources":["../../../../src/components/result/base-result-add-to-cart.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n :metadata=\"metadata\"\n class=\"x-result-add-to-cart x-button\"\n data-test=\"result-add-to-cart\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot />\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { PropsWithType } from '../../utils/index'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport type { WireMetadata } from '../../wiring/index'\nimport { computed, defineComponent, inject } from 'vue'\nimport BaseEventButton from '../base-event-button.vue'\n\n/**\n * Renders a button with a default slot. It receives the result with the data and emits\n * {@link XEventsTypes.UserClickedResultAddToCart} to the bus on click mouse event.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseEventButton },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n },\n setup(props) {\n /**\n * The list of additional events to be emitted by the component when user clicks the add2cart button.\n *\n * @internal\n */\n const resultAddToCartExtraEvents = inject<PropsWithType<XEventsTypes, Result>[]>(\n 'resultAddToCartExtraEvents',\n [],\n )\n\n /**\n * The metadata to be injected in the events emitted by the component.\n */\n const metadata = inject<Omit<WireMetadata, 'moduleName' | 'origin' | 'location'>>(\n 'resultAddToCartExtraEventsMetadata',\n {},\n )\n\n /**\n * The events to be emitted by the button.\n *\n * @returns Events {@link XEventsTypes} to emit.\n *\n * @public\n */\n const events = computed(() => {\n return resultAddToCartExtraEvents.reduce(\n (acc, event) => {\n acc[event] = props.result\n return acc\n },\n { UserClickedResultAddToCart: props.result } as Partial<XEventsTypes>,\n )\n })\n\n return {\n events,\n metadata,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedResultAddToCart`](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 result data.\n\n## Examples\n\nRenders a button with a default slot. It receives the result with the data and emits an event\n`UserClickedResultAddToCart` to the bus on click mouse event.\n\n### Basic example\n\nThis component is a button to emit `UserClickedResultAddToCart` whe clicked by the user\n\n```vue\n<BaseResultAddToCart :result=\"result\">\n <img src=\"./add-to-cart.svg\" />\n <span>Add to cart</span>\n</BaseResultAddToCart>\n```\n</docs>\n"],"names":["_createBlock","_renderSlot"],"mappings":";;;;;;sBACEA,WAQkB,CAAA,0BAAA,EAAA;AAAA,IAPf,MAAQ,EAAA,IAAA,CAAA,MAAA;AAAA,IACR,QAAU,EAAA,IAAA,CAAA,QAAA;AAAA,IACX,KAAM,EAAA,+BAAA;AAAA,IACN,WAAU,EAAA,oBAAA;AAAA,GAAA,EAAA;qBAGV,MAAQ;AAAA,MAARC,UAAQ,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,CAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-result-current-price.vue.js","sources":["../../../../src/components/result/base-result-current-price.vue"],"sourcesContent":["<template>\n <div :class=\"dynamicClasses\" class=\"x-result-current-price\" data-test=\"result-current-price\">\n <!--\n @slot Base currency item\n @binding {result} result - Result data\n -->\n <slot :result=\"result\">\n <BaseCurrency :value=\"result.price.value\" :format=\"format\" />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../../utils/types'\nimport { computed, defineComponent } from 'vue'\nimport BaseCurrency from '../currency/base-currency.vue'\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result} current price\n * that may or may not be on sale.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n /**\n * Format or mask to be defined as string.\n * - Use 'i' to define integer numbers.\n * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the\n * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.\n * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.\n * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more\n * than one character.\n * - Set whatever you need around the integers and decimals marks.\n * - Default mask: 'i.iii,dd' which returns '1.345,67'.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST match with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, delete significant digits.\n *\n * @public\n */\n format: {\n type: String,\n },\n },\n setup(props) {\n /**\n * Dynamic CSS classes to add to the root element of this component.\n *\n * @returns A booleans dictionary where each key is the class name to add,\n * and the boolean value tells if it should be added or not.\n * @internal\n */\n const dynamicClasses = computed<VueCSSClasses>(() => ({\n 'x-result-current-price--on-sale': props.result.price?.hasDiscount ?? false,\n }))\n\n return {\n dynamicClasses,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component shows the current price formatted. You can provide the `format` by property or let\nthe `BaseCurrency` component use an injected one.\n\n```vue\n<BaseResultCurrentPrice :value=\"result\" :format=\"'i.iii,ddd €'\" />\n```\n\n### Overriding default slot\n\n```vue\n<BaseResultCurrentPrice :result=\"result\">\n <span class=\"custom-base-result-current-price\">{{ result.price.value }}</span>\n</BaseResultCurrentPrice>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_createVNode"],"mappings":";;;;;;AACE,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,IAQM,KAAA;AAAA,IAAA;AAAA,MARA,KAAA,
|
|
1
|
+
{"version":3,"file":"base-result-current-price.vue.js","sources":["../../../../src/components/result/base-result-current-price.vue"],"sourcesContent":["<template>\n <div :class=\"dynamicClasses\" class=\"x-result-current-price\" data-test=\"result-current-price\">\n <!--\n @slot Base currency item\n @binding {result} result - Result data\n -->\n <slot :result=\"result\">\n <BaseCurrency :value=\"result.price.value\" :format=\"format\" />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../../utils/types'\nimport { computed, defineComponent } from 'vue'\nimport BaseCurrency from '../currency/base-currency.vue'\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result} current price\n * that may or may not be on sale.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n /**\n * Format or mask to be defined as string.\n * - Use 'i' to define integer numbers.\n * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the\n * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.\n * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.\n * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more\n * than one character.\n * - Set whatever you need around the integers and decimals marks.\n * - Default mask: 'i.iii,dd' which returns '1.345,67'.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST match with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, delete significant digits.\n *\n * @public\n */\n format: {\n type: String,\n },\n },\n setup(props) {\n /**\n * Dynamic CSS classes to add to the root element of this component.\n *\n * @returns A booleans dictionary where each key is the class name to add,\n * and the boolean value tells if it should be added or not.\n * @internal\n */\n const dynamicClasses = computed<VueCSSClasses>(() => ({\n 'x-result-current-price--on-sale': props.result.price?.hasDiscount ?? false,\n }))\n\n return {\n dynamicClasses,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component shows the current price formatted. You can provide the `format` by property or let\nthe `BaseCurrency` component use an injected one.\n\n```vue\n<BaseResultCurrentPrice :value=\"result\" :format=\"'i.iii,ddd €'\" />\n```\n\n### Overriding default slot\n\n```vue\n<BaseResultCurrentPrice :result=\"result\">\n <span class=\"custom-base-result-current-price\">{{ result.price.value }}</span>\n</BaseResultCurrentPrice>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_createVNode"],"mappings":";;;;;;AACE,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,IAQM,KAAA;AAAA,IAAA;AAAA,MARA,KAAA,EAAKC,cAAE,CAAA,CAAA,IAAA,CAAA,cAAA,EAAsB,wBAAwB,CAAA,CAAA;AAAA,MAAC,WAAU,EAAA,sBAAA;AAAA,KAAA;;AAKpE,MAAAC,UAAA,CAEO,IAFA,CAAA,MAAA,EAAA,SAAA,EAAA,EAAA,MAAA,EAAQ,IAAM,CAAA,MAAA,EAAA,EAArB,MAEO;AAAA,QADLC,WAA6D,CAAA,uBAAA,EAAA;AAAA,UAA9C,KAAA,EAAO,YAAO,KAAM,CAAA,KAAA;AAAA,UAAQ,MAAQ,EAAA,IAAA,CAAA,MAAA;AAAA,SAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,OAAA,EAAA,QAAA,CAAA,CAAA;;;;;;;;;;;"}
|
|
@@ -10,26 +10,23 @@ const _hoisted_1 = {
|
|
|
10
10
|
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
11
11
|
style: {"background-color":"#eef1f2"}
|
|
12
12
|
};
|
|
13
|
-
const _hoisted_2 = /*#__PURE__*/createElementVNode("rect", {
|
|
14
|
-
height: "371",
|
|
15
|
-
width: "256",
|
|
16
|
-
x: "0",
|
|
17
|
-
y: "0",
|
|
18
|
-
fill: "#EEF1F2"
|
|
19
|
-
}, null, -1 /* HOISTED */);
|
|
20
|
-
const _hoisted_3 = /*#__PURE__*/createElementVNode("path", {
|
|
21
|
-
d: "M142.40625,0 L142.40625,13.5625 L20.34375,13.5625 C16.5983809,13.5625 13.5625,16.5983809\n 13.5625,20.34375 L13.5625,20.34375 L13.5625,159.969687 L76.628125,96.971875\n C79.2732363,94.3424453 83.5445762,94.3424453 86.1896875,96.971875 L86.1896875,96.971875\n L128.84375,139.625937 L164.784375,103.753125 C167.429486,101.123695 171.700826,101.123695\n 174.345938,103.753125 L174.345938,103.753125 L203.4375,132.844687 L203.4375,81.375 L217,81.375\n L217,196.65625 C217,207.891934 207.891934,217 196.65625,217 L196.65625,217 L20.34375,217\n C9.10806641,217 0,207.891934 0,196.65625 L0,196.65625 L0,20.34375 C0,9.10806641 9.10806641,0\n 20.34375,0 L20.34375,0 L142.40625,0 Z M62,37 C73.045625,37 82,45.954375 82,57 C82,68.045625\n 73.045625,77 62,77 C50.954375,77 42,68.045625 42,57 C42,45.954375 50.954375,37 62,37 Z\n M211.783582,5.21641753 C213.066298,6.49913292 213.112109,8.55036201 211.921016,9.88797123\n L211.783582,10.0335825 L191.317,30.5 L211.783582,50.9664175 C213.113806,52.2966409\n 213.113806,54.4533591 211.783582,55.7835825 C210.500867,57.0662979 208.449638,57.1121091\n 207.112029,55.9210163 L206.966418,55.7835825 L186.5,35.317 L166.033582,55.7835825\n C164.703359,57.1138058 162.546641,57.1138058 161.216418,55.7835825 C159.933702,54.5008671\n 159.887891,52.449638 161.078984,51.1120288 L161.216418,50.9664175 L181.683,30.5\n L161.216418,10.0335825 C159.886194,8.7033591 159.886194,6.5466409 161.216418,5.21641753\n C162.499133,3.93370214 164.550362,3.88789087 165.887971,5.07898373 L166.033582,5.21641753\n L186.5,25.683 L206.966418,5.21641753 C208.296641,3.88619416 210.453359,3.88619416\n 211.783582,5.21641753 Z",
|
|
22
|
-
fill: "#DBE2E5",
|
|
23
|
-
"fill-rule": "nonzero",
|
|
24
|
-
transform: "translate(20.000000, 77.000000)"
|
|
25
|
-
}, null, -1 /* HOISTED */);
|
|
26
|
-
const _hoisted_4 = [
|
|
27
|
-
_hoisted_2,
|
|
28
|
-
_hoisted_3
|
|
29
|
-
];
|
|
30
13
|
|
|
31
14
|
function _sfc_render(_ctx, _cache) {
|
|
32
|
-
return (openBlock(), createElementBlock("svg", _hoisted_1, [...
|
|
15
|
+
return (openBlock(), createElementBlock("svg", _hoisted_1, [...(_cache[0] || (_cache[0] = [
|
|
16
|
+
createElementVNode("rect", {
|
|
17
|
+
height: "371",
|
|
18
|
+
width: "256",
|
|
19
|
+
x: "0",
|
|
20
|
+
y: "0",
|
|
21
|
+
fill: "#EEF1F2"
|
|
22
|
+
}, null, -1 /* CACHED */),
|
|
23
|
+
createElementVNode("path", {
|
|
24
|
+
d: "M142.40625,0 L142.40625,13.5625 L20.34375,13.5625 C16.5983809,13.5625 13.5625,16.5983809\n 13.5625,20.34375 L13.5625,20.34375 L13.5625,159.969687 L76.628125,96.971875\n C79.2732363,94.3424453 83.5445762,94.3424453 86.1896875,96.971875 L86.1896875,96.971875\n L128.84375,139.625937 L164.784375,103.753125 C167.429486,101.123695 171.700826,101.123695\n 174.345938,103.753125 L174.345938,103.753125 L203.4375,132.844687 L203.4375,81.375 L217,81.375\n L217,196.65625 C217,207.891934 207.891934,217 196.65625,217 L196.65625,217 L20.34375,217\n C9.10806641,217 0,207.891934 0,196.65625 L0,196.65625 L0,20.34375 C0,9.10806641 9.10806641,0\n 20.34375,0 L20.34375,0 L142.40625,0 Z M62,37 C73.045625,37 82,45.954375 82,57 C82,68.045625\n 73.045625,77 62,77 C50.954375,77 42,68.045625 42,57 C42,45.954375 50.954375,37 62,37 Z\n M211.783582,5.21641753 C213.066298,6.49913292 213.112109,8.55036201 211.921016,9.88797123\n L211.783582,10.0335825 L191.317,30.5 L211.783582,50.9664175 C213.113806,52.2966409\n 213.113806,54.4533591 211.783582,55.7835825 C210.500867,57.0662979 208.449638,57.1121091\n 207.112029,55.9210163 L206.966418,55.7835825 L186.5,35.317 L166.033582,55.7835825\n C164.703359,57.1138058 162.546641,57.1138058 161.216418,55.7835825 C159.933702,54.5008671\n 159.887891,52.449638 161.078984,51.1120288 L161.216418,50.9664175 L181.683,30.5\n L161.216418,10.0335825 C159.886194,8.7033591 159.886194,6.5466409 161.216418,5.21641753\n C162.499133,3.93370214 164.550362,3.88789087 165.887971,5.07898373 L166.033582,5.21641753\n L186.5,25.683 L206.966418,5.21641753 C208.296641,3.88619416 210.453359,3.88619416\n 211.783582,5.21641753 Z",
|
|
25
|
+
fill: "#DBE2E5",
|
|
26
|
+
"fill-rule": "nonzero",
|
|
27
|
+
transform: "translate(20.000000, 77.000000)"
|
|
28
|
+
}, null, -1 /* CACHED */)
|
|
29
|
+
]))]))
|
|
33
30
|
}
|
|
34
31
|
var baseResultFallbackImage = /*#__PURE__*/_export_sfc(_sfc_main, [['render',_sfc_render]]);
|
|
35
32
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-result-fallback-image.vue.js","sources":["../../../../src/components/result/base-result-fallback-image.vue"],"sourcesContent":["<template>\n <svg\n version=\"1.1\"\n viewBox=\"0 0 256 371\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n style=\"background-color: #eef1f2\"\n >\n <rect height=\"371\" width=\"256\" x=\"0\" y=\"0\" fill=\"#EEF1F2\"></rect>\n <path\n d=\"M142.40625,0 L142.40625,13.5625 L20.34375,13.5625 C16.5983809,13.5625 13.5625,16.5983809\n 13.5625,20.34375 L13.5625,20.34375 L13.5625,159.969687 L76.628125,96.971875\n C79.2732363,94.3424453 83.5445762,94.3424453 86.1896875,96.971875 L86.1896875,96.971875\n L128.84375,139.625937 L164.784375,103.753125 C167.429486,101.123695 171.700826,101.123695\n 174.345938,103.753125 L174.345938,103.753125 L203.4375,132.844687 L203.4375,81.375 L217,81.375\n L217,196.65625 C217,207.891934 207.891934,217 196.65625,217 L196.65625,217 L20.34375,217\n C9.10806641,217 0,207.891934 0,196.65625 L0,196.65625 L0,20.34375 C0,9.10806641 9.10806641,0\n 20.34375,0 L20.34375,0 L142.40625,0 Z M62,37 C73.045625,37 82,45.954375 82,57 C82,68.045625\n 73.045625,77 62,77 C50.954375,77 42,68.045625 42,57 C42,45.954375 50.954375,37 62,37 Z\n M211.783582,5.21641753 C213.066298,6.49913292 213.112109,8.55036201 211.921016,9.88797123\n L211.783582,10.0335825 L191.317,30.5 L211.783582,50.9664175 C213.113806,52.2966409\n 213.113806,54.4533591 211.783582,55.7835825 C210.500867,57.0662979 208.449638,57.1121091\n 207.112029,55.9210163 L206.966418,55.7835825 L186.5,35.317 L166.033582,55.7835825\n C164.703359,57.1138058 162.546641,57.1138058 161.216418,55.7835825 C159.933702,54.5008671\n 159.887891,52.449638 161.078984,51.1120288 L161.216418,50.9664175 L181.683,30.5\n L161.216418,10.0335825 C159.886194,8.7033591 159.886194,6.5466409 161.216418,5.21641753\n C162.499133,3.93370214 164.550362,3.88789087 165.887971,5.07898373 L166.033582,5.21641753\n L186.5,25.683 L206.966418,5.21641753 C208.296641,3.88619416 210.453359,3.88619416\n 211.783582,5.21641753 Z\"\n fill=\"#DBE2E5\"\n fill-rule=\"nonzero\"\n transform=\"translate(20.000000, 77.000000)\"\n ></path>\n </svg>\n</template>\n"],"names":["
|
|
1
|
+
{"version":3,"file":"base-result-fallback-image.vue.js","sources":["../../../../src/components/result/base-result-fallback-image.vue"],"sourcesContent":["<template>\n <svg\n version=\"1.1\"\n viewBox=\"0 0 256 371\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n style=\"background-color: #eef1f2\"\n >\n <rect height=\"371\" width=\"256\" x=\"0\" y=\"0\" fill=\"#EEF1F2\"></rect>\n <path\n d=\"M142.40625,0 L142.40625,13.5625 L20.34375,13.5625 C16.5983809,13.5625 13.5625,16.5983809\n 13.5625,20.34375 L13.5625,20.34375 L13.5625,159.969687 L76.628125,96.971875\n C79.2732363,94.3424453 83.5445762,94.3424453 86.1896875,96.971875 L86.1896875,96.971875\n L128.84375,139.625937 L164.784375,103.753125 C167.429486,101.123695 171.700826,101.123695\n 174.345938,103.753125 L174.345938,103.753125 L203.4375,132.844687 L203.4375,81.375 L217,81.375\n L217,196.65625 C217,207.891934 207.891934,217 196.65625,217 L196.65625,217 L20.34375,217\n C9.10806641,217 0,207.891934 0,196.65625 L0,196.65625 L0,20.34375 C0,9.10806641 9.10806641,0\n 20.34375,0 L20.34375,0 L142.40625,0 Z M62,37 C73.045625,37 82,45.954375 82,57 C82,68.045625\n 73.045625,77 62,77 C50.954375,77 42,68.045625 42,57 C42,45.954375 50.954375,37 62,37 Z\n M211.783582,5.21641753 C213.066298,6.49913292 213.112109,8.55036201 211.921016,9.88797123\n L211.783582,10.0335825 L191.317,30.5 L211.783582,50.9664175 C213.113806,52.2966409\n 213.113806,54.4533591 211.783582,55.7835825 C210.500867,57.0662979 208.449638,57.1121091\n 207.112029,55.9210163 L206.966418,55.7835825 L186.5,35.317 L166.033582,55.7835825\n C164.703359,57.1138058 162.546641,57.1138058 161.216418,55.7835825 C159.933702,54.5008671\n 159.887891,52.449638 161.078984,51.1120288 L161.216418,50.9664175 L181.683,30.5\n L161.216418,10.0335825 C159.886194,8.7033591 159.886194,6.5466409 161.216418,5.21641753\n C162.499133,3.93370214 164.550362,3.88789087 165.887971,5.07898373 L166.033582,5.21641753\n L186.5,25.683 L206.966418,5.21641753 C208.296641,3.88619416 210.453359,3.88619416\n 211.783582,5.21641753 Z\"\n fill=\"#DBE2E5\"\n fill-rule=\"nonzero\"\n transform=\"translate(20.000000, 77.000000)\"\n ></path>\n </svg>\n</template>\n"],"names":["_openBlock","_createElementBlock","_createElementVNode"],"mappings":";;;;;;AAEI,EAAA,OAAO,EAAC,KAAK;AACb,EAAA,OAAO,EAAC,aAAa;AACrB,EAAA,KAAK,EAAC,4BAA4B;AAClC,EAAA,aAAW,EAAC,8BAA8B;AAC1C,EAAA,KAAiC,EAAjC,CAAiC,kBAAA,CAAA,SAAA,CAAA;;;;AALnC,EAAA,QAAAA,SAAA,EAAA,EAAAC,kBAAA,CAgCM,OAhCN,UAgCM,EAAA,CAAA,IAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA;IAzBJC,kBAAiE,CAAA,MAAA,EAAA;AAA3D,MAAA,MAAM,EAAC,KAAK;AAAC,MAAA,KAAK,EAAC,KAAK;AAAC,MAAA,CAAC,EAAC,GAAG;AAAC,MAAA,CAAC,EAAC,GAAG;AAAC,MAAA,IAAI,EAAC,SAAS;;IACzDA,kBAuBQ,CAAA,MAAA,EAAA;AAtBN,MAAA,CAAC,EAAC,0sDAkBuB;AACzB,MAAA,IAAI,EAAC,SAAS;AACd,MAAA,WAAS,EAAC,SAAS;AACnB,MAAA,SAAS,EAAC,iCAAiC;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-result-image.vue.js","sources":["../../../../src/components/result/base-result-image.vue"],"sourcesContent":["<template>\n <!-- This is a div because using a picture causes the onload event of the image to fire twice. -->\n <!-- eslint-disable-next-line vuejs-accessibility/mouse-events-have-key-events -->\n <div\n class=\"x-result-picture x-picture\"\n data-test=\"result-picture\"\n @mouseenter.once=\"userHasHoveredImage = true\"\n @mouseenter=\"isHovering = true\"\n @mouseleave=\"isHovering = false\"\n >\n <img\n v-if=\"shouldLoadNextImage\"\n loading=\"lazy\"\n :src=\"pendingImages[0]\"\n :style=\"loaderStyles\"\n class=\"x-picture-image\"\n data-test=\"result-picture-loader\"\n alt=\"\"\n role=\"presentation\"\n @load=\"flagImageLoaded\"\n @error=\"flagImageAsFailed\"\n />\n <component :is=\"animation\" class=\"x-picture-image\" :appear=\"false\">\n <!-- @slot Fallback image content. It will be rendered when all the images failed -->\n <slot v-if=\"!loadedImages.length && !pendingImages.length\" name=\"fallback\" />\n\n <!-- @slot Loading image content. It will be rendered while the real image is not loaded -->\n <slot v-else-if=\"!loadedImages.length\" name=\"placeholder\" />\n\n <img\n v-else\n :key=\"imageSrc\"\n :alt=\"result.name\"\n :src=\"imageSrc\"\n class=\"x-result-picture-image\"\n data-test=\"result-picture-image\"\n />\n </component>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType, Ref } from 'vue'\nimport { computed, defineComponent, ref, watch } from 'vue'\nimport { AnimationProp } from '../../types'\nimport { NoAnimation } from '../animations'\n\n/**\n * Component to be reused that renders an `<img>`.\n *\n * @public\n */\nexport default defineComponent({\n name: 'BaseResultImage',\n props: {\n /** (Required) The {@link @empathyco/x-types#Result} information. */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n /**\n * Animation to use when switching between the placeholder, the loaded image, or the failed\n * image fallback.\n */\n loadAnimation: {\n type: AnimationProp,\n default: () => NoAnimation,\n },\n /** Animation to use when switching between the loaded image and the hover image. */\n hoverAnimation: {\n type: AnimationProp,\n },\n /**\n * Indicates if the next valid image should be displayed on hover.\n *\n * @public\n */\n showNextImageOnHover: {\n type: Boolean,\n default: false,\n },\n },\n setup(props) {\n /**\n * Copy of the images of the result.\n *\n * It is used as a queue of images to load, once an image loads/fails to load, it is removed\n * from this array.\n *\n * @internal\n */\n const pendingImages: Ref<string[]> = ref([])\n\n /**\n * Contains the images that have been loaded successfully.\n *\n * @internal\n */\n const loadedImages: Ref<string[]> = ref([])\n\n /**\n * Indicates if the user is hovering the image.\n *\n * @internal\n */\n const isHovering = ref(false)\n\n /**\n * Indicates if the user has hovered the image.\n *\n * @internal\n */\n const userHasHoveredImage = ref(false)\n\n /**.\n * Styles to use inline in the image loader, to prevent override from CSS\n *\n * @internal\n */\n const loaderStyles: Partial<CSSStyleDeclaration> = {\n position: 'absolute !important',\n top: '0 !important',\n left: '0 !important',\n width: '100% !important',\n height: '100% !important',\n pointerEvents: 'none !important',\n visibility: 'hidden !important',\n }\n\n /**\n * Initializes images state and resets when the result's images change.\n *\n * @internal\n */\n watch(\n () => props.result.images,\n () => {\n pendingImages.value = [...(props.result.images ?? [])]\n loadedImages.value = pendingImages.value.filter(image => loadedImages.value.includes(image))\n },\n { immediate: true },\n )\n\n /**\n * Animation to be used.\n *\n * @returns The animation to be used, taking into account if the user has hovered the image.\n *\n * @internal\n */\n const animation = computed(() => {\n return userHasHoveredImage.value\n ? (props.hoverAnimation ?? props.loadAnimation)\n : props.loadAnimation\n })\n\n /**\n * Gets the src from the result image.\n *\n * @returns The result image src.\n *\n * @internal\n */\n const imageSrc = computed(() => {\n return loadedImages.value[\n !props.showNextImageOnHover || !isHovering.value ? 0 : loadedImages.value.length - 1\n ]\n })\n\n /**\n * Indicates if the loader should try to load the next image.\n *\n * @returns True if it should try to load the next image.\n *\n * @internal\n */\n const shouldLoadNextImage = computed(() => {\n const numImagesToLoad = props.showNextImageOnHover && userHasHoveredImage.value ? 2 : 1\n return !!pendingImages.value.length && loadedImages.value.length < numImagesToLoad\n })\n\n /**\n * Sets an image as failed.\n *\n * @internal\n */\n const flagImageAsFailed = () => {\n pendingImages.value.shift()\n }\n\n /**\n * Sets an image as loaded.\n *\n * @internal\n */\n const flagImageLoaded = () => {\n const image = pendingImages.value.shift()\n if (image) {\n loadedImages.value.push(image)\n }\n }\n\n return {\n pendingImages,\n loadedImages,\n isHovering,\n userHasHoveredImage,\n loaderStyles,\n animation,\n imageSrc,\n shouldLoadNextImage,\n flagImageAsFailed,\n flagImageLoaded,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-result-picture {\n position: relative;\n min-width: 1px;\n min-height: 1px;\n}\n\n.x-result-picture-image {\n max-width: 100%;\n max-height: 100%;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component is for the result image. It may be part of the search result page, recommendations or\nother section which needs to include results.\n\nThe result prop is required. It will render a `<img/>` with the result image:\n\n```vue\n<BaseResultImage :result=\"result\" />\n```\n\n### Showing the next image on hover\n\nIf a result has multiple images, it can show the next one on hover.\n\n```vue\n<BaseResultImage :result=\"result\" showNextImageOnHover />\n```\n\n### Customizing slots content\n\nFallback and placeholder contents can be customized.\n\nThe fallback slot allows you to replace the content of the fallback image.\n\nThe other slot is called `placeholder`, and allows you to set the image that its going to be\ndisplayed while the real one is loaded.\n\n```vue\n<BaseResultImage :result=\"result\">\n <template #placeholder>\n <img alt=\"Placeholder image\" src=\"./placeholder-image.svg\"/>\n </template>\n <template #fallback>\n <img alt=\"Fallback image\" src=\"./fallback-image.svg\"/>\n </template>\n</BaseResultImage>\n```\n\n### Customizing the animations\n\nTwo animations can be used this component.\n\nThe `loadAnimation` is used to transition between the placeholder, the fallback and the image.\n\nThe `hoverAnimation` is used to transition between the image and the hover image, if the\n`showNextImageOnHover` prop is `true`.\n\n`hoverAnimation` will default to `loadAnimation` if it is not provided.\n\n```vue\n<template>\n <BaseResultImage\n :result=\"result\"\n :loadAnimation=\"loadAnimation\"\n :hoverAnimation=\"hoverAnimation\"\n showNextImageOnHover\n />\n</template>\n\n<script>\nimport { BaseResultImage } from '@empathyco/x-components'\nimport { CrossFade, CollapseHeight } from '@empathyco/x-components/animations'\n\nexport default {\n name: 'BaseResultImageAnimations',\n components: {\n BaseResultImage,\n },\n data() {\n return {\n loadAnimation: CrossFade,\n hoverAnimation: CollapseHeight,\n result: {\n name: 'jacket',\n images: ['https://some-image', 'https://some-image-2'],\n },\n }\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeStyle","_createCommentVNode","_createBlock","_resolveDynamicComponent","_withCtx","_renderSlot"],"mappings":";;;;;AAAA,MAAA,UAAA,GAAA,CAAA,KAAA,CAAA,CAAA;AAAA,MAAA,UAAA,GAAA,CAAA,KAAA,EAAA,KAAA,CAAA,CAAA;;AAGE,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,IAmCM,KAAA;AAAA,IAAA;AAAA,MAlCJ,KAAM,EAAA,4BAAA;AAAA,MACN,WAAU,EAAA,gBAAA;AAAA,MALd,wDAMsB,IAAmB,CAAA,mBAAA,GAAA,IAAA,CAAA;AAAA,MACpC,YAAA,EAAU,sCAAE,IAAU,CAAA,UAAA,GAAA,IAAA,CAAA;AAAA,MACtB,YAAA,EAAU,sCAAE,IAAU,CAAA,UAAA,GAAA,KAAA,CAAA;AAAA,KAAA;;AAGf,MAAA,IAAA,CAAA,mBAAA,IAAAD,SAAA,EAAA,EADRC,kBAWE,CAAA,KAAA,EAAA;AAAA,QArBN,GAAA,EAAA,CAAA;AAAA,QAYM,OAAQ,EAAA,MAAA;AAAA,QACP,KAAK,IAAa,CAAA,aAAA,CAAA,CAAA,CAAA;AAAA,QAClB,KAAA,EAdPC,eAcc,IAAY,CAAA,YAAA,CAAA;AAAA,QACpB,KAAM,EAAA,iBAAA;AAAA,QACN,WAAU,EAAA,uBAAA;AAAA,QACV,GAAI,EAAA,EAAA;AAAA,QACJ,IAAK,EAAA,cAAA;AAAA,QACJ,QAAI,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,QACN,SAAK,MAAE,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAA,IAAA,CAAA,iBAAA,IAAA,IAAA,CAAA,iBAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA,OApBd,EAAA,IAAA,EAAA,EAAA,EAAA,UAAA,CAAA,IAAAC,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA;AAAA,OAsBIH,SAAA,EAAA,EAAAI,WAAA,CAeYC,wBAfI,IAAS,CAAA,SAAA,CAAA,EAAA;AAAA,QAAE,KAAM,EAAA,iBAAA;AAAA,QAAmB,MAAQ,EAAA,KAAA;AAAA,OAAA,EAAA;AAtBhE,QAAA,OAAA,EAAAC,OAAA,CAwBM,MAA6E;AAAA,UAAA,CAAhE,IAAa,CAAA,YAAA,CAAA,MAAA,IAAM,CAAK,IAAA,CAAA,aAAA,CAAc,MAAnD,GAAAC,UAAA,CAA6E,IAxBnF,CAAA,MAAA,EAAA,UAAA,EAAA,EAAA,GAAA,EAAA,CAAA,EAAA,EAAA,KAAA,CAAA,EAAA,IAAA,CAAA,GAAA,CA2BwB,IAAa,CAAA,YAAA,CAAA,MAAA,GAA/BA,UAA4D,CAAA,IAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EA3BlE,wCA6BMN,kBAOE,CAAA,KAAA,EAAA;AAAA,YALC,GAAK,EAAA,IAAA,CAAA,QAAA;AAAA,YACL,KAAK,IAAO,CAAA,MAAA,CAAA,IAAA;AAAA,YACZ,GAAK,EAAA,IAAA,CAAA,QAAA;AAAA,YACN,KAAM,EAAA,wBAAA;AAAA,YACN,WAAU,EAAA,sBAAA;AAAA,WAnClB,EAAA,IAAA,EAAA,CAAA,EAAA,UAAA,CAAA,CAAA;AAAA,SAAA,CAAA;AAAA,QAAA,CAAA,EAAA,CAAA;AAAA;AAAA,OAAA,CAAA;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"base-result-image.vue.js","sources":["../../../../src/components/result/base-result-image.vue"],"sourcesContent":["<template>\n <!-- This is a div because using a picture causes the onload event of the image to fire twice. -->\n <!-- eslint-disable-next-line vuejs-accessibility/mouse-events-have-key-events -->\n <div\n class=\"x-result-picture x-picture\"\n data-test=\"result-picture\"\n @mouseenter.once=\"userHasHoveredImage = true\"\n @mouseenter=\"isHovering = true\"\n @mouseleave=\"isHovering = false\"\n >\n <img\n v-if=\"shouldLoadNextImage\"\n loading=\"lazy\"\n :src=\"pendingImages[0]\"\n :style=\"loaderStyles\"\n class=\"x-picture-image\"\n data-test=\"result-picture-loader\"\n alt=\"\"\n role=\"presentation\"\n @load=\"flagImageLoaded\"\n @error=\"flagImageAsFailed\"\n />\n <component :is=\"animation\" class=\"x-picture-image\" :appear=\"false\">\n <!-- @slot Fallback image content. It will be rendered when all the images failed -->\n <slot v-if=\"!loadedImages.length && !pendingImages.length\" name=\"fallback\" />\n\n <!-- @slot Loading image content. It will be rendered while the real image is not loaded -->\n <slot v-else-if=\"!loadedImages.length\" name=\"placeholder\" />\n\n <img\n v-else\n :key=\"imageSrc\"\n :alt=\"result.name\"\n :src=\"imageSrc\"\n class=\"x-result-picture-image\"\n data-test=\"result-picture-image\"\n />\n </component>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType, Ref } from 'vue'\nimport { computed, defineComponent, ref, watch } from 'vue'\nimport { AnimationProp } from '../../types'\nimport { NoAnimation } from '../animations'\n\n/**\n * Component to be reused that renders an `<img>`.\n *\n * @public\n */\nexport default defineComponent({\n name: 'BaseResultImage',\n props: {\n /** (Required) The {@link @empathyco/x-types#Result} information. */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n /**\n * Animation to use when switching between the placeholder, the loaded image, or the failed\n * image fallback.\n */\n loadAnimation: {\n type: AnimationProp,\n default: () => NoAnimation,\n },\n /** Animation to use when switching between the loaded image and the hover image. */\n hoverAnimation: {\n type: AnimationProp,\n },\n /**\n * Indicates if the next valid image should be displayed on hover.\n *\n * @public\n */\n showNextImageOnHover: {\n type: Boolean,\n default: false,\n },\n },\n setup(props) {\n /**\n * Copy of the images of the result.\n *\n * It is used as a queue of images to load, once an image loads/fails to load, it is removed\n * from this array.\n *\n * @internal\n */\n const pendingImages: Ref<string[]> = ref([])\n\n /**\n * Contains the images that have been loaded successfully.\n *\n * @internal\n */\n const loadedImages: Ref<string[]> = ref([])\n\n /**\n * Indicates if the user is hovering the image.\n *\n * @internal\n */\n const isHovering = ref(false)\n\n /**\n * Indicates if the user has hovered the image.\n *\n * @internal\n */\n const userHasHoveredImage = ref(false)\n\n /**.\n * Styles to use inline in the image loader, to prevent override from CSS\n *\n * @internal\n */\n const loaderStyles: Partial<CSSStyleDeclaration> = {\n position: 'absolute !important',\n top: '0 !important',\n left: '0 !important',\n width: '100% !important',\n height: '100% !important',\n pointerEvents: 'none !important',\n visibility: 'hidden !important',\n }\n\n /**\n * Initializes images state and resets when the result's images change.\n *\n * @internal\n */\n watch(\n () => props.result.images,\n () => {\n pendingImages.value = [...(props.result.images ?? [])]\n loadedImages.value = pendingImages.value.filter(image => loadedImages.value.includes(image))\n },\n { immediate: true },\n )\n\n /**\n * Animation to be used.\n *\n * @returns The animation to be used, taking into account if the user has hovered the image.\n *\n * @internal\n */\n const animation = computed(() => {\n return userHasHoveredImage.value\n ? (props.hoverAnimation ?? props.loadAnimation)\n : props.loadAnimation\n })\n\n /**\n * Gets the src from the result image.\n *\n * @returns The result image src.\n *\n * @internal\n */\n const imageSrc = computed(() => {\n return loadedImages.value[\n !props.showNextImageOnHover || !isHovering.value ? 0 : loadedImages.value.length - 1\n ]\n })\n\n /**\n * Indicates if the loader should try to load the next image.\n *\n * @returns True if it should try to load the next image.\n *\n * @internal\n */\n const shouldLoadNextImage = computed(() => {\n const numImagesToLoad = props.showNextImageOnHover && userHasHoveredImage.value ? 2 : 1\n return !!pendingImages.value.length && loadedImages.value.length < numImagesToLoad\n })\n\n /**\n * Sets an image as failed.\n *\n * @internal\n */\n const flagImageAsFailed = () => {\n pendingImages.value.shift()\n }\n\n /**\n * Sets an image as loaded.\n *\n * @internal\n */\n const flagImageLoaded = () => {\n const image = pendingImages.value.shift()\n if (image) {\n loadedImages.value.push(image)\n }\n }\n\n return {\n pendingImages,\n loadedImages,\n isHovering,\n userHasHoveredImage,\n loaderStyles,\n animation,\n imageSrc,\n shouldLoadNextImage,\n flagImageAsFailed,\n flagImageLoaded,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-result-picture {\n position: relative;\n min-width: 1px;\n min-height: 1px;\n}\n\n.x-result-picture-image {\n max-width: 100%;\n max-height: 100%;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component is for the result image. It may be part of the search result page, recommendations or\nother section which needs to include results.\n\nThe result prop is required. It will render a `<img/>` with the result image:\n\n```vue\n<BaseResultImage :result=\"result\" />\n```\n\n### Showing the next image on hover\n\nIf a result has multiple images, it can show the next one on hover.\n\n```vue\n<BaseResultImage :result=\"result\" showNextImageOnHover />\n```\n\n### Customizing slots content\n\nFallback and placeholder contents can be customized.\n\nThe fallback slot allows you to replace the content of the fallback image.\n\nThe other slot is called `placeholder`, and allows you to set the image that its going to be\ndisplayed while the real one is loaded.\n\n```vue\n<BaseResultImage :result=\"result\">\n <template #placeholder>\n <img alt=\"Placeholder image\" src=\"./placeholder-image.svg\"/>\n </template>\n <template #fallback>\n <img alt=\"Fallback image\" src=\"./fallback-image.svg\"/>\n </template>\n</BaseResultImage>\n```\n\n### Customizing the animations\n\nTwo animations can be used this component.\n\nThe `loadAnimation` is used to transition between the placeholder, the fallback and the image.\n\nThe `hoverAnimation` is used to transition between the image and the hover image, if the\n`showNextImageOnHover` prop is `true`.\n\n`hoverAnimation` will default to `loadAnimation` if it is not provided.\n\n```vue\n<template>\n <BaseResultImage\n :result=\"result\"\n :loadAnimation=\"loadAnimation\"\n :hoverAnimation=\"hoverAnimation\"\n showNextImageOnHover\n />\n</template>\n\n<script>\nimport { BaseResultImage } from '@empathyco/x-components'\nimport { CrossFade, CollapseHeight } from '@empathyco/x-components/animations'\n\nexport default {\n name: 'BaseResultImageAnimations',\n components: {\n BaseResultImage,\n },\n data() {\n return {\n loadAnimation: CrossFade,\n hoverAnimation: CollapseHeight,\n result: {\n name: 'jacket',\n images: ['https://some-image', 'https://some-image-2'],\n },\n }\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeStyle","_createCommentVNode","_createBlock","_resolveDynamicComponent","_renderSlot"],"mappings":";;;;;;;;AAGE,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,IAmCM,KAAA;AAAA,IAAA;AAAA,MAlCJ,KAAM,EAAA,4BAAA;AAAA,MACN,WAAU,EAAA,gBAAA;AAAA,MAAA,gBAAA,EAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,MAAA,KACQ,IAAmB,CAAA,mBAAA,GAAA,IAAA,CAAA;AAAA,MACpC,YAAA,EAAU,sCAAE,IAAU,CAAA,UAAA,GAAA,IAAA,CAAA;AAAA,MACtB,YAAA,EAAU,sCAAE,IAAU,CAAA,UAAA,GAAA,KAAA,CAAA;AAAA,KAAA;;AAGf,MAAA,IAAA,CAAA,mBAAA,IAAAD,SAAA,EAAA,EADRC,kBAWE,CAAA,KAAA,EAAA;AAAA,QAAA,GAAA,EAAA,CAAA;QATA,OAAQ,EAAA,MAAA;AAAA,QACP,KAAK,IAAa,CAAA,aAAA,CAAA,CAAA,CAAA;AAAA,QAClB,KAAA,EAAKC,eAAE,IAAY,CAAA,YAAA,CAAA;AAAA,QACpB,KAAM,EAAA,iBAAA;AAAA,QACN,WAAU,EAAA,uBAAA;AAAA,QACV,GAAI,EAAA,EAAA;AAAA,QACJ,IAAK,EAAA,cAAA;AAAA,QACJ,QAAI,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,QACN,SAAK,MAAE,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAA,IAAA,CAAA,iBAAA,IAAA,IAAA,CAAA,iBAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA,OAAA,EAAA,IAAA,EAAA,EAAA,EAAA,UAAA,CAAA,IAAAC,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA;AAEV,OAAAH,SAAA,EAAA,EAAAI,WAAA,CAeYC,wBAfI,IAAS,CAAA,SAAA,CAAA,EAAA;AAAA,QAAE,KAAM,EAAA,iBAAA;AAAA,QAAmB,MAAQ,EAAA,KAAA;AAAA,OAAA,EAAA;yBAE1D,MAA6E;AAAA,UAAhE,CAAA,IAAA,CAAA,YAAA,CAAa,MAAM,IAAA,CAAK,IAAc,CAAA,aAAA,CAAA,MAAA,GAAnDC,UAA6E,CAAA,IAAA,CAAA,MAAA,EAAA,UAAA,EAAA,EAAA,GAAA,EAAA,CAAA,EAAA,EAAA,KAAA,CAAA,EAAA,IAAA,CAAA,GAAA,CAG3D,IAAa,CAAA,YAAA,CAAA,MAAA,GAA/BA,UAA4D,CAAA,IAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,GAAA,EAAA,CAAA,EAAA,EAAA,KAAA,CAAA,EAAA,IAAA,CAAA,IAAAN,SAAA,EAAA,EAE5DC,kBAOE,CAAA,KAAA,EAAA;AAAA,YALC,GAAK,EAAA,IAAA,CAAA,QAAA;AAAA,YACL,KAAK,IAAO,CAAA,MAAA,CAAA,IAAA;AAAA,YACZ,GAAK,EAAA,IAAA,CAAA,QAAA;AAAA,YACN,KAAM,EAAA,wBAAA;AAAA,YACN,WAAU,EAAA,sBAAA;AAAA,WAAA,EAAA,IAAA,EAAA,CAAA,EAAA,UAAA,CAAA,CAAA;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-result-link.vue.js","sources":["../../../../src/components/result/base-result-link.vue"],"sourcesContent":["<template>\n <a\n :ref=\"el\"\n :href=\"result.url\"\n class=\"x-result-link\"\n data-test=\"result-link\"\n @click=\"emitUserClickedAResult\"\n @click.right=\"emitUserClickedAResult\"\n @click.middle=\"emitUserClickedAResult\"\n >\n <!--\n @slot (Required) Link content with a text, an image, another component or both\n @binding {Result} result - Result data\n -->\n <slot :result=\"result\" />\n </a>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { PropsWithType } from '../../utils/types'\nimport type { WireMetadata } from '../../wiring'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport { defineComponent, inject, ref } from 'vue'\nimport { use$x } from '../../composables/index'\n\n/**\n * Component to be reused that renders an `<a>` wrapping the result contents.\n *\n * @remarks\n * It has the logic to emit {@link XEventsTypes.UserClickedAResult} to the bus on click mouse\n * events. Additionally, this component may be injected other events to be emitted on click\n * event, so, depending on where it's used its father component may provide this events.\n *\n * @public\n */\nexport default defineComponent({\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n },\n setup(props) {\n const $x = use$x()\n\n /**\n * The rendered DOM element.\n *\n * @internal\n */\n const el = ref<HTMLElement | null>()\n\n /**\n * The list of additional events to be emitted by the component when user clicks the link.\n *\n * @internal\n */\n const resultClickExtraEvents = inject<PropsWithType<XEventsTypes, Result>[]>(\n 'resultClickExtraEvents',\n [],\n )\n\n /**\n * The metadata to be injected in the events emitted by the component. This component can emit\n * have extra events so this record pairs each event to its metadata.\n */\n const resultLinkMetadataPerEvent = inject<\n // TODO: Refactor this inject key to the constants when doing EMP-909\n Partial<\n Record<\n PropsWithType<XEventsTypes, Result>,\n Omit<WireMetadata, 'moduleName' | 'origin' | 'location'>\n >\n >\n >('resultLinkMetadataPerEvent', {})\n\n /**\n * Emits the {@link XEventsTypes.UserClickedAResult} when user clicks on the result, and also\n * additional events if have been injected in the component.\n *\n * @internal\n */\n const emitUserClickedAResult = (): void => {\n $x.emit('UserClickedAResult', props.result, {\n target: el.value!,\n ...resultLinkMetadataPerEvent.UserClickedAResult,\n })\n resultClickExtraEvents.forEach(event => {\n $x.emit(event, props.result, { target: el.value!, ...resultLinkMetadataPerEvent[event] })\n })\n }\n\n return {\n el,\n emitUserClickedAResult,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-result-link {\n text-decoration: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following event:\n\n- [`UserClickedAResult`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\nThe component can emit more events on click using the `resultClickExtraEvents` prop.\n\n## See it in action\n\nThis component is a wrapper for the result contents (images, name, price...) It may be part of the\nsearch result page, recommendations or other section which needs to include results.\n\nAdditionally, this component may be injected other events to be emitted on click event, so,\ndepending where it's used its father component may provide this events.\n\nThe result prop is required. It will render a `<a></a>` with the href to the result URL:\n\n```vue\n<BaseResultLink :result=\"result\">\n <template #default=\"{ result }\">\n <img :src=\"result.images[0]\"/>\n <span>{{ result.name }}</span>\n </template>\n</BaseResultLink>\n```\n</docs>\n"],"names":["_createElementBlock","_renderSlot"],"mappings":"
|
|
1
|
+
{"version":3,"file":"base-result-link.vue.js","sources":["../../../../src/components/result/base-result-link.vue"],"sourcesContent":["<template>\n <a\n :ref=\"el\"\n :href=\"result.url\"\n class=\"x-result-link\"\n data-test=\"result-link\"\n @click=\"emitUserClickedAResult\"\n @click.right=\"emitUserClickedAResult\"\n @click.middle=\"emitUserClickedAResult\"\n >\n <!--\n @slot (Required) Link content with a text, an image, another component or both\n @binding {Result} result - Result data\n -->\n <slot :result=\"result\" />\n </a>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { PropsWithType } from '../../utils/types'\nimport type { WireMetadata } from '../../wiring'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport { defineComponent, inject, ref } from 'vue'\nimport { use$x } from '../../composables/index'\n\n/**\n * Component to be reused that renders an `<a>` wrapping the result contents.\n *\n * @remarks\n * It has the logic to emit {@link XEventsTypes.UserClickedAResult} to the bus on click mouse\n * events. Additionally, this component may be injected other events to be emitted on click\n * event, so, depending on where it's used its father component may provide this events.\n *\n * @public\n */\nexport default defineComponent({\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n },\n setup(props) {\n const $x = use$x()\n\n /**\n * The rendered DOM element.\n *\n * @internal\n */\n const el = ref<HTMLElement | null>()\n\n /**\n * The list of additional events to be emitted by the component when user clicks the link.\n *\n * @internal\n */\n const resultClickExtraEvents = inject<PropsWithType<XEventsTypes, Result>[]>(\n 'resultClickExtraEvents',\n [],\n )\n\n /**\n * The metadata to be injected in the events emitted by the component. This component can emit\n * have extra events so this record pairs each event to its metadata.\n */\n const resultLinkMetadataPerEvent = inject<\n // TODO: Refactor this inject key to the constants when doing EMP-909\n Partial<\n Record<\n PropsWithType<XEventsTypes, Result>,\n Omit<WireMetadata, 'moduleName' | 'origin' | 'location'>\n >\n >\n >('resultLinkMetadataPerEvent', {})\n\n /**\n * Emits the {@link XEventsTypes.UserClickedAResult} when user clicks on the result, and also\n * additional events if have been injected in the component.\n *\n * @internal\n */\n const emitUserClickedAResult = (): void => {\n $x.emit('UserClickedAResult', props.result, {\n target: el.value!,\n ...resultLinkMetadataPerEvent.UserClickedAResult,\n })\n resultClickExtraEvents.forEach(event => {\n $x.emit(event, props.result, { target: el.value!, ...resultLinkMetadataPerEvent[event] })\n })\n }\n\n return {\n el,\n emitUserClickedAResult,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-result-link {\n text-decoration: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following event:\n\n- [`UserClickedAResult`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\nThe component can emit more events on click using the `resultClickExtraEvents` prop.\n\n## See it in action\n\nThis component is a wrapper for the result contents (images, name, price...) It may be part of the\nsearch result page, recommendations or other section which needs to include results.\n\nAdditionally, this component may be injected other events to be emitted on click event, so,\ndepending where it's used its father component may provide this events.\n\nThe result prop is required. It will render a `<a></a>` with the href to the result URL:\n\n```vue\n<BaseResultLink :result=\"result\">\n <template #default=\"{ result }\">\n <img :src=\"result.images[0]\"/>\n <span>{{ result.name }}</span>\n </template>\n</BaseResultLink>\n```\n</docs>\n"],"names":["_createElementBlock","_withModifiers","_renderSlot"],"mappings":";;;;;;;sBACEA,kBAcI,CAAA,GAAA,EAAA;AAAA,IAbD,GAAK,EAAA,IAAA,CAAA,EAAA;AAAA,IACL,MAAM,IAAO,CAAA,MAAA,CAAA,GAAA;AAAA,IACd,KAAM,EAAA,eAAA;AAAA,IACN,WAAU,EAAA,aAAA;AAAA,IACT,SAAK,MAAE,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAA,IAAA,CAAA,sBAAA,IAAA,IAAA,CAAA,sBAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA,IAAA,aAAA,EAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAAC,aAAA,CAAA,CAAA,GAAA,IAAA,KACM,IAAsB,CAAA,sBAAA,IAAA,IAAA,CAAA,sBAAA,CAAA,GAAA,IAAA,CAAA,EAAA,CAAA,OAAA,CAAA,CAAA,CAAA;AAAA,IAAA,SAAA,EAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAAA,aAAA,CAAA,CAAA,GAAA,IAAA,KACrB,IAAsB,CAAA,sBAAA,IAAA,IAAA,CAAA,sBAAA,CAAA,GAAA,IAAA,CAAA,EAAA,CAAA,QAAA,CAAA,CAAA,CAAA;AAAA,GAAA,EAAA;IAMrCC,UAAyB,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAAlB,QAAQ,IAAM,CAAA,MAAA,EAAA,EAAA,KAAA,CAAA,EAAA,IAAA,CAAA;AAAA,GAAA,EAAA,EAAA,EAAA,UAAA,CAAA,CAAA;;;;;;"}
|
|
@@ -10,25 +10,22 @@ const _hoisted_1 = {
|
|
|
10
10
|
"xmlns:xlink": "http://www.w3.org/1999/xlink",
|
|
11
11
|
style: {"background-color":"#eef1f2"}
|
|
12
12
|
};
|
|
13
|
-
const _hoisted_2 = /*#__PURE__*/createElementVNode("rect", {
|
|
14
|
-
height: "371",
|
|
15
|
-
width: "256",
|
|
16
|
-
x: "0",
|
|
17
|
-
y: "0",
|
|
18
|
-
fill: "#EEF1F2"
|
|
19
|
-
}, null, -1 /* HOISTED */);
|
|
20
|
-
const _hoisted_3 = /*#__PURE__*/createElementVNode("path", {
|
|
21
|
-
d: "M162.40625,77 L162.40625,90.5625 L40.34375,90.5625 C36.5983809,90.5625 33.5625,93.5983809\n 33.5625,97.34375 L33.5625,97.34375 L33.5625,236.969687 L96.628125,173.971875\n C99.2732363,171.342445 103.544576,171.342445 106.189687,173.971875 L106.189687,173.971875\n L148.84375,216.625937 L184.784375,180.753125 C187.429486,178.123695 191.700826,178.123695\n 194.345938,180.753125 L194.345938,180.753125 L223.4375,209.844687 L223.4375,158.375\n L237,158.375 L237,273.65625 C237,284.891934 227.891934,294 216.65625,294 L216.65625,294\n L40.34375,294 C29.1080664,294 20,284.891934 20,273.65625 L20,273.65625 L20,97.34375\n C20,86.1080664 29.1080664,77 40.34375,77 L40.34375,77 L162.40625,77 Z M82,114\n C93.045625,114 102,122.954375 102,134 C102,145.045625 93.045625,154 82,154 C70.954375,154\n 62,145.045625 62,134 C62,122.954375 70.954375,114 82,114 Z M175.444623,100.396089\n L183.687219,108.661381 C184.620423,109.602859 184.620423,111.123422 183.680918,112.077314\n C182.737148,113.018189 181.212972,113.018189 180.26465,112.073775 L180.26465,112.073775\n L177.727,109.527 L177.745354,109.644062 C179.677469,121.418749 189.812727,130.462066\n 202.047328,130.661575 L202.047328,130.661575 L202.460517,130.664942 C209.153157,130.664942\n 215.436777,128.056193 220.174617,123.31173 C221.12269,122.361456 222.670209,122.361776\n 223.58594,123.311542 C224.527282,124.25405 224.527282,125.78338 223.586285,126.726562\n C217.94114,132.382374 210.431948,135.5 202.451652,135.5 C187.460762,135.5 174.984785,124.35392\n 172.907406,109.825508 L172.907406,109.825508 L172.902,109.787 L170.627234,112.068625\n C170.216136,112.485215 169.674234,112.730073 169.104127,112.774878 L169.104127,112.774878\n L168.913187,112.782365 C168.276718,112.782365 167.658303,112.532522 167.207809,112.075026\n C166.263587,111.129629 166.263587,109.597657 167.206898,108.658263 L167.206898,108.658263\n L175.444623,100.396089 Z M202.54801,75.5 C217.536718,75.5 230.012345,86.6439604\n 232.093604,101.171817 L232.093604,101.171817 L232.098,101.21 L234.379146,98.9226859\n C235.281116,98.0234824 236.717815,97.9826095 237.660635,98.8020572 L237.660635,98.8020572\n L237.791853,98.9249739 C238.734405,99.8686992 238.736601,101.398026 237.795291,102.341522\n L237.795291,102.341522 L229.557794,110.600807 L221.31437,102.338232 C220.381166,101.396755\n 220.381166,99.876192 221.320671,98.9222996 C222.265013,97.9808537 223.794144,97.9808537\n 224.736486,98.9253846 L224.736486,98.9253846 L227.277,101.473 L227.259636,101.355612\n C225.324141,89.5799272 215.187742,80.5375269 202.954224,80.3380384 L202.954224,80.3380384\n L202.541072,80.3346719 C195.847619,80.3346719 189.562063,82.9439869 184.830962,87.683869\n C183.887384,88.6368031 182.34531,88.6368031 181.414841,87.6918832 C180.466611,86.7485972\n 180.466611,85.2139736 181.411064,84.2734376 C187.057027,78.6168059 194.564245,75.5\n 202.54801,75.5 Z",
|
|
22
|
-
fill: "#DBE2E5",
|
|
23
|
-
"fill-rule": "nonzero"
|
|
24
|
-
}, null, -1 /* HOISTED */);
|
|
25
|
-
const _hoisted_4 = [
|
|
26
|
-
_hoisted_2,
|
|
27
|
-
_hoisted_3
|
|
28
|
-
];
|
|
29
13
|
|
|
30
14
|
function _sfc_render(_ctx, _cache) {
|
|
31
|
-
return (openBlock(), createElementBlock("svg", _hoisted_1, [...
|
|
15
|
+
return (openBlock(), createElementBlock("svg", _hoisted_1, [...(_cache[0] || (_cache[0] = [
|
|
16
|
+
createElementVNode("rect", {
|
|
17
|
+
height: "371",
|
|
18
|
+
width: "256",
|
|
19
|
+
x: "0",
|
|
20
|
+
y: "0",
|
|
21
|
+
fill: "#EEF1F2"
|
|
22
|
+
}, null, -1 /* CACHED */),
|
|
23
|
+
createElementVNode("path", {
|
|
24
|
+
d: "M162.40625,77 L162.40625,90.5625 L40.34375,90.5625 C36.5983809,90.5625 33.5625,93.5983809\n 33.5625,97.34375 L33.5625,97.34375 L33.5625,236.969687 L96.628125,173.971875\n C99.2732363,171.342445 103.544576,171.342445 106.189687,173.971875 L106.189687,173.971875\n L148.84375,216.625937 L184.784375,180.753125 C187.429486,178.123695 191.700826,178.123695\n 194.345938,180.753125 L194.345938,180.753125 L223.4375,209.844687 L223.4375,158.375\n L237,158.375 L237,273.65625 C237,284.891934 227.891934,294 216.65625,294 L216.65625,294\n L40.34375,294 C29.1080664,294 20,284.891934 20,273.65625 L20,273.65625 L20,97.34375\n C20,86.1080664 29.1080664,77 40.34375,77 L40.34375,77 L162.40625,77 Z M82,114\n C93.045625,114 102,122.954375 102,134 C102,145.045625 93.045625,154 82,154 C70.954375,154\n 62,145.045625 62,134 C62,122.954375 70.954375,114 82,114 Z M175.444623,100.396089\n L183.687219,108.661381 C184.620423,109.602859 184.620423,111.123422 183.680918,112.077314\n C182.737148,113.018189 181.212972,113.018189 180.26465,112.073775 L180.26465,112.073775\n L177.727,109.527 L177.745354,109.644062 C179.677469,121.418749 189.812727,130.462066\n 202.047328,130.661575 L202.047328,130.661575 L202.460517,130.664942 C209.153157,130.664942\n 215.436777,128.056193 220.174617,123.31173 C221.12269,122.361456 222.670209,122.361776\n 223.58594,123.311542 C224.527282,124.25405 224.527282,125.78338 223.586285,126.726562\n C217.94114,132.382374 210.431948,135.5 202.451652,135.5 C187.460762,135.5 174.984785,124.35392\n 172.907406,109.825508 L172.907406,109.825508 L172.902,109.787 L170.627234,112.068625\n C170.216136,112.485215 169.674234,112.730073 169.104127,112.774878 L169.104127,112.774878\n L168.913187,112.782365 C168.276718,112.782365 167.658303,112.532522 167.207809,112.075026\n C166.263587,111.129629 166.263587,109.597657 167.206898,108.658263 L167.206898,108.658263\n L175.444623,100.396089 Z M202.54801,75.5 C217.536718,75.5 230.012345,86.6439604\n 232.093604,101.171817 L232.093604,101.171817 L232.098,101.21 L234.379146,98.9226859\n C235.281116,98.0234824 236.717815,97.9826095 237.660635,98.8020572 L237.660635,98.8020572\n L237.791853,98.9249739 C238.734405,99.8686992 238.736601,101.398026 237.795291,102.341522\n L237.795291,102.341522 L229.557794,110.600807 L221.31437,102.338232 C220.381166,101.396755\n 220.381166,99.876192 221.320671,98.9222996 C222.265013,97.9808537 223.794144,97.9808537\n 224.736486,98.9253846 L224.736486,98.9253846 L227.277,101.473 L227.259636,101.355612\n C225.324141,89.5799272 215.187742,80.5375269 202.954224,80.3380384 L202.954224,80.3380384\n L202.541072,80.3346719 C195.847619,80.3346719 189.562063,82.9439869 184.830962,87.683869\n C183.887384,88.6368031 182.34531,88.6368031 181.414841,87.6918832 C180.466611,86.7485972\n 180.466611,85.2139736 181.411064,84.2734376 C187.057027,78.6168059 194.564245,75.5\n 202.54801,75.5 Z",
|
|
25
|
+
fill: "#DBE2E5",
|
|
26
|
+
"fill-rule": "nonzero"
|
|
27
|
+
}, null, -1 /* CACHED */)
|
|
28
|
+
]))]))
|
|
32
29
|
}
|
|
33
30
|
var baseResultPlaceholderImage = /*#__PURE__*/_export_sfc(_sfc_main, [['render',_sfc_render]]);
|
|
34
31
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-result-placeholder-image.vue.js","sources":["../../../../src/components/result/base-result-placeholder-image.vue"],"sourcesContent":["<template>\n <svg\n version=\"1.1\"\n viewBox=\"0 0 256 371\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n style=\"background-color: #eef1f2\"\n >\n <rect height=\"371\" width=\"256\" x=\"0\" y=\"0\" fill=\"#EEF1F2\"></rect>\n <path\n d=\"M162.40625,77 L162.40625,90.5625 L40.34375,90.5625 C36.5983809,90.5625 33.5625,93.5983809\n 33.5625,97.34375 L33.5625,97.34375 L33.5625,236.969687 L96.628125,173.971875\n C99.2732363,171.342445 103.544576,171.342445 106.189687,173.971875 L106.189687,173.971875\n L148.84375,216.625937 L184.784375,180.753125 C187.429486,178.123695 191.700826,178.123695\n 194.345938,180.753125 L194.345938,180.753125 L223.4375,209.844687 L223.4375,158.375\n L237,158.375 L237,273.65625 C237,284.891934 227.891934,294 216.65625,294 L216.65625,294\n L40.34375,294 C29.1080664,294 20,284.891934 20,273.65625 L20,273.65625 L20,97.34375\n C20,86.1080664 29.1080664,77 40.34375,77 L40.34375,77 L162.40625,77 Z M82,114\n C93.045625,114 102,122.954375 102,134 C102,145.045625 93.045625,154 82,154 C70.954375,154\n 62,145.045625 62,134 C62,122.954375 70.954375,114 82,114 Z M175.444623,100.396089\n L183.687219,108.661381 C184.620423,109.602859 184.620423,111.123422 183.680918,112.077314\n C182.737148,113.018189 181.212972,113.018189 180.26465,112.073775 L180.26465,112.073775\n L177.727,109.527 L177.745354,109.644062 C179.677469,121.418749 189.812727,130.462066\n 202.047328,130.661575 L202.047328,130.661575 L202.460517,130.664942 C209.153157,130.664942\n 215.436777,128.056193 220.174617,123.31173 C221.12269,122.361456 222.670209,122.361776\n 223.58594,123.311542 C224.527282,124.25405 224.527282,125.78338 223.586285,126.726562\n C217.94114,132.382374 210.431948,135.5 202.451652,135.5 C187.460762,135.5 174.984785,124.35392\n 172.907406,109.825508 L172.907406,109.825508 L172.902,109.787 L170.627234,112.068625\n C170.216136,112.485215 169.674234,112.730073 169.104127,112.774878 L169.104127,112.774878\n L168.913187,112.782365 C168.276718,112.782365 167.658303,112.532522 167.207809,112.075026\n C166.263587,111.129629 166.263587,109.597657 167.206898,108.658263 L167.206898,108.658263\n L175.444623,100.396089 Z M202.54801,75.5 C217.536718,75.5 230.012345,86.6439604\n 232.093604,101.171817 L232.093604,101.171817 L232.098,101.21 L234.379146,98.9226859\n C235.281116,98.0234824 236.717815,97.9826095 237.660635,98.8020572 L237.660635,98.8020572\n L237.791853,98.9249739 C238.734405,99.8686992 238.736601,101.398026 237.795291,102.341522\n L237.795291,102.341522 L229.557794,110.600807 L221.31437,102.338232 C220.381166,101.396755\n 220.381166,99.876192 221.320671,98.9222996 C222.265013,97.9808537 223.794144,97.9808537\n 224.736486,98.9253846 L224.736486,98.9253846 L227.277,101.473 L227.259636,101.355612\n C225.324141,89.5799272 215.187742,80.5375269 202.954224,80.3380384 L202.954224,80.3380384\n L202.541072,80.3346719 C195.847619,80.3346719 189.562063,82.9439869 184.830962,87.683869\n C183.887384,88.6368031 182.34531,88.6368031 181.414841,87.6918832 C180.466611,86.7485972\n 180.466611,85.2139736 181.411064,84.2734376 C187.057027,78.6168059 194.564245,75.5\n 202.54801,75.5 Z\"\n fill=\"#DBE2E5\"\n fill-rule=\"nonzero\"\n ></path>\n </svg>\n</template>\n"],"names":["
|
|
1
|
+
{"version":3,"file":"base-result-placeholder-image.vue.js","sources":["../../../../src/components/result/base-result-placeholder-image.vue"],"sourcesContent":["<template>\n <svg\n version=\"1.1\"\n viewBox=\"0 0 256 371\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n style=\"background-color: #eef1f2\"\n >\n <rect height=\"371\" width=\"256\" x=\"0\" y=\"0\" fill=\"#EEF1F2\"></rect>\n <path\n d=\"M162.40625,77 L162.40625,90.5625 L40.34375,90.5625 C36.5983809,90.5625 33.5625,93.5983809\n 33.5625,97.34375 L33.5625,97.34375 L33.5625,236.969687 L96.628125,173.971875\n C99.2732363,171.342445 103.544576,171.342445 106.189687,173.971875 L106.189687,173.971875\n L148.84375,216.625937 L184.784375,180.753125 C187.429486,178.123695 191.700826,178.123695\n 194.345938,180.753125 L194.345938,180.753125 L223.4375,209.844687 L223.4375,158.375\n L237,158.375 L237,273.65625 C237,284.891934 227.891934,294 216.65625,294 L216.65625,294\n L40.34375,294 C29.1080664,294 20,284.891934 20,273.65625 L20,273.65625 L20,97.34375\n C20,86.1080664 29.1080664,77 40.34375,77 L40.34375,77 L162.40625,77 Z M82,114\n C93.045625,114 102,122.954375 102,134 C102,145.045625 93.045625,154 82,154 C70.954375,154\n 62,145.045625 62,134 C62,122.954375 70.954375,114 82,114 Z M175.444623,100.396089\n L183.687219,108.661381 C184.620423,109.602859 184.620423,111.123422 183.680918,112.077314\n C182.737148,113.018189 181.212972,113.018189 180.26465,112.073775 L180.26465,112.073775\n L177.727,109.527 L177.745354,109.644062 C179.677469,121.418749 189.812727,130.462066\n 202.047328,130.661575 L202.047328,130.661575 L202.460517,130.664942 C209.153157,130.664942\n 215.436777,128.056193 220.174617,123.31173 C221.12269,122.361456 222.670209,122.361776\n 223.58594,123.311542 C224.527282,124.25405 224.527282,125.78338 223.586285,126.726562\n C217.94114,132.382374 210.431948,135.5 202.451652,135.5 C187.460762,135.5 174.984785,124.35392\n 172.907406,109.825508 L172.907406,109.825508 L172.902,109.787 L170.627234,112.068625\n C170.216136,112.485215 169.674234,112.730073 169.104127,112.774878 L169.104127,112.774878\n L168.913187,112.782365 C168.276718,112.782365 167.658303,112.532522 167.207809,112.075026\n C166.263587,111.129629 166.263587,109.597657 167.206898,108.658263 L167.206898,108.658263\n L175.444623,100.396089 Z M202.54801,75.5 C217.536718,75.5 230.012345,86.6439604\n 232.093604,101.171817 L232.093604,101.171817 L232.098,101.21 L234.379146,98.9226859\n C235.281116,98.0234824 236.717815,97.9826095 237.660635,98.8020572 L237.660635,98.8020572\n L237.791853,98.9249739 C238.734405,99.8686992 238.736601,101.398026 237.795291,102.341522\n L237.795291,102.341522 L229.557794,110.600807 L221.31437,102.338232 C220.381166,101.396755\n 220.381166,99.876192 221.320671,98.9222996 C222.265013,97.9808537 223.794144,97.9808537\n 224.736486,98.9253846 L224.736486,98.9253846 L227.277,101.473 L227.259636,101.355612\n C225.324141,89.5799272 215.187742,80.5375269 202.954224,80.3380384 L202.954224,80.3380384\n L202.541072,80.3346719 C195.847619,80.3346719 189.562063,82.9439869 184.830962,87.683869\n C183.887384,88.6368031 182.34531,88.6368031 181.414841,87.6918832 C180.466611,86.7485972\n 180.466611,85.2139736 181.411064,84.2734376 C187.057027,78.6168059 194.564245,75.5\n 202.54801,75.5 Z\"\n fill=\"#DBE2E5\"\n fill-rule=\"nonzero\"\n ></path>\n </svg>\n</template>\n"],"names":["_openBlock","_createElementBlock","_createElementVNode"],"mappings":";;;;;;AAEI,EAAA,OAAO,EAAC,KAAK;AACb,EAAA,OAAO,EAAC,aAAa;AACrB,EAAA,KAAK,EAAC,4BAA4B;AAClC,EAAA,aAAW,EAAC,8BAA8B;AAC1C,EAAA,KAAiC,EAAjC,CAAiC,kBAAA,CAAA,SAAA,CAAA;;;;AALnC,EAAA,QAAAA,SAAA,EAAA,EAAAC,kBAAA,CA6CM,OA7CN,UA6CM,EAAA,CAAA,IAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA;IAtCJC,kBAAiE,CAAA,MAAA,EAAA;AAA3D,MAAA,MAAM,EAAC,KAAK;AAAC,MAAA,KAAK,EAAC,KAAK;AAAC,MAAA,CAAC,EAAC,GAAG;AAAC,MAAA,CAAC,EAAC,GAAG;AAAC,MAAA,IAAI,EAAC,SAAS;;IACzDA,kBAoCQ,CAAA,MAAA,EAAA;AAnCN,MAAA,CAAC,EAAC,u+FAgCgB;AAClB,MAAA,IAAI,EAAC,SAAS;AACd,MAAA,WAAS,EAAC,SAAS;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-result-previous-price.vue.js","sources":["../../../../src/components/result/base-result-previous-price.vue"],"sourcesContent":["<template>\n <div\n v-if=\"result.price.hasDiscount\"\n class=\"x-result-previous-price\"\n data-test=\"result-previous-price\"\n >\n <!--\n @slot Base currency item\n @binding {result} result - Result data\n -->\n <slot :result=\"result\">\n <BaseCurrency :value=\"result.price.originalValue\" :format=\"format\" />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport BaseCurrency from '../currency/base-currency.vue'\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result} previous price.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n /**\n * Format or mask to be defined as string.\n * - Use 'i' to define integer numbers.\n * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the\n * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.\n * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.\n * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more\n * than one character.\n * - Set whatever you need around the integers and decimals marks.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST match with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, delete significant digits.\n *\n * @public\n */\n format: {\n type: String,\n },\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component shows the previous price formatted if it has discount. The component has two optional\nprops. `format` to select the currency format to be applied.\n\n```vue\n<template>\n <BaseResultPreviousPrice :result=\"result\" :format=\"'i.iii,ddd €'\" />\n</template>\n\n<script>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nexport default {\n name: 'BaseResultPreviousPriceDemo',\n components: {\n BaseResultPreviousPrice,\n },\n}\n</script>\n```\n\n### Overriding default slot\n\n```vue\n<template>\n <BaseResultPreviousPrice :result=\"result\">\n <span class=\"custom-base-result-previous-price\">{{ result.price.originalValue }}</span>\n </BaseResultPreviousPrice>\n</template>\n\n<script>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nexport default {\n name: 'BaseResultPreviousPriceDemo',\n components: {\n BaseResultPreviousPrice,\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_renderSlot","_createVNode"
|
|
1
|
+
{"version":3,"file":"base-result-previous-price.vue.js","sources":["../../../../src/components/result/base-result-previous-price.vue"],"sourcesContent":["<template>\n <div\n v-if=\"result.price.hasDiscount\"\n class=\"x-result-previous-price\"\n data-test=\"result-previous-price\"\n >\n <!--\n @slot Base currency item\n @binding {result} result - Result data\n -->\n <slot :result=\"result\">\n <BaseCurrency :value=\"result.price.originalValue\" :format=\"format\" />\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent } from 'vue'\nimport BaseCurrency from '../currency/base-currency.vue'\n\n/**\n * Component that renders the {@link @empathyco/x-types#Result} previous price.\n *\n * @public\n */\nexport default defineComponent({\n components: { BaseCurrency },\n props: {\n /**\n * (Required) The {@link @empathyco/x-types#Result} information.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n /**\n * Format or mask to be defined as string.\n * - Use 'i' to define integer numbers.\n * - Use 'd' to define decimal numbers. You can define the length of the decimal part. If the\n * doesn't include decimals, it is filled with zeros until reach the length defined with 'd's.\n * - Integer separator must be defined between the 3rd and the 4th integer 'i' of a group.\n * - Decimal separator must be defined between the last 'i' and the first 'd'. It can be more\n * than one character.\n * - Set whatever you need around the integers and decimals marks.\n *\n * @remarks The number of 'd', which is the maximum decimal length, MUST match with the length\n * of decimals provided from the adapter. Otherwise, when the component truncate the decimal\n * part, delete significant digits.\n *\n * @public\n */\n format: {\n type: String,\n },\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\n### Basic example\n\nThis component shows the previous price formatted if it has discount. The component has two optional\nprops. `format` to select the currency format to be applied.\n\n```vue\n<template>\n <BaseResultPreviousPrice :result=\"result\" :format=\"'i.iii,ddd €'\" />\n</template>\n\n<script>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nexport default {\n name: 'BaseResultPreviousPriceDemo',\n components: {\n BaseResultPreviousPrice,\n },\n}\n</script>\n```\n\n### Overriding default slot\n\n```vue\n<template>\n <BaseResultPreviousPrice :result=\"result\">\n <span class=\"custom-base-result-previous-price\">{{ result.price.originalValue }}</span>\n </BaseResultPreviousPrice>\n</template>\n\n<script>\nimport { BaseResultPreviousPrice } from '@empathyco/x-components'\n\nexport default {\n name: 'BaseResultPreviousPriceDemo',\n components: {\n BaseResultPreviousPrice,\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_renderSlot","_createVNode"],"mappings":";;;;;;EAGI,KAAM,EAAA,yBAAA;AAAA,EACN,WAAU,EAAA,uBAAA;;;;AAFJ,EAAA,OAAA,IAAA,CAAA,MAAA,CAAO,KAAM,CAAA,WAAA,IAAAA,SAAA,EAAA,EADrBC,kBAYM,CAAA,KAAA,EAZN,UAYM,EAAA;AAAA,IAHJC,UAEO,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAFA,MAAQ,EAAA,IAAA,CAAA,MAAA,IAAf,MAEO;AAAA,MADLC,WAAqE,CAAA,uBAAA,EAAA;AAAA,QAAtD,KAAA,EAAO,YAAO,KAAM,CAAA,aAAA;AAAA,QAAgB,MAAQ,EAAA,IAAA,CAAA,MAAA;AAAA,OAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,OAAA,EAAA,QAAA,CAAA,CAAA;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-result-rating.vue.js","sources":["../../../../src/components/result/base-result-rating.vue"],"sourcesContent":["<template>\n <component\n :is=\"link ? 'a' : 'div'\"\n v-if=\"result.rating && result.rating.value\"\n :ref=\"el\"\n :href=\"link\"\n class=\"x-result-rating\"\n data-test=\"result-rating\"\n @click=\"emitClickedEvent\"\n >\n <!--\n @slot To override the whole content\n -->\n <slot :rating=\"result.rating.value\" :result=\"result\">\n <BaseRating :value=\"result.rating.value\" v-bind=\"$attrs\">\n <template #empty-icon>\n <!--\n @slot The content to render as empty icon\n -->\n <slot name=\"empty-icon\" />\n </template>\n\n <template #filled-icon>\n <!--\n @slot The content to render as filled icon\n -->\n <slot name=\"filled-icon\" />\n </template>\n </BaseRating>\n </slot>\n </component>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent, ref } from 'vue'\nimport { use$x } from '../../composables/index'\nimport BaseRating from '../base-rating.vue'\n\n/**\n * This component renders a {@link BaseRating} for a result passed as prop.\n *\n * @public\n */\nexport default defineComponent({\n components: {\n BaseRating,\n },\n inheritAttrs: false,\n props: {\n /**\n * The {@link @empathyco/x-types#Result} to render its rating.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n\n /**\n * A link to redirect when rating is clicked.\n *\n * @public\n */\n link: {\n type: String,\n },\n },\n setup(props) {\n const $x = use$x()\n\n const el = ref<HTMLElement | null>()\n\n /**\n * Emits the `UserClickedAResultRating` event when user clicks this component, with the\n * {@link @empathyco/x-types#Result} as payload.\n *\n * @internal\n */\n const emitClickedEvent = (): void => {\n $x.emit('UserClickedAResultRating', props.result, {\n target: el.value!,\n })\n }\n\n return {\n el,\n emitClickedEvent,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-result-rating {\n color: inherit;\n text-decoration: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`UserClickedAResultRating`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\n## See it in action\n\nHere you have a basic example of how the result rating is rendered.\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" />\n</template>\n\n<script>\nimport { BaseResultRating } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating,\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 },\n },\n }\n },\n}\n</script>\n```\n\n### Play with props\n\nIn this example, the result rating has been configured to 6 as maximum value using the prop `max`.\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" :max=\"6\" />\n</template>\n\n<script>\nimport { BaseResultRating } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating,\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 },\n },\n }\n },\n}\n</script>\n```\n\nIn this example, the result rating has been configured with a link to redirect when is clicked.\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" link=\"https://empathy.co/\" />\n</template>\n\n<script>\nimport { BaseResultRating } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating,\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 },\n },\n }\n },\n}\n</script>\n```\n\n### Play with events\n\nIn this example, a message has been added to be shown when the result rating is clicked.\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" @UserClickedAResultRating=\"logUserClickedRating\" />\n</template>\n\n<script>\nimport { BaseResultRating } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating,\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 },\n },\n }\n },\n methods: {\n logUserClickedRating(result) {\n console.log('User clickedRating of this result:', result)\n },\n },\n}\n</script>\n```\n\n## Extending the component\n\nThe rendered icons for rating can be configured through slots. Keep in mind that the icons for both\nstates (filled and empty), must have the same size make component work properly.\n\n```vue\n<template>\n <BaseResultRating :result=\"result\">\n <template #filled-icon>❤️</template>\n <template #empty-icon>🤍</template>\n </BaseResultRating>\n</template>\n\n<script>\nimport { BaseResultRating } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating,\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 },\n },\n }\n },\n}\n</script>\n```\n\nIt is possible to override all the content of the component to show your own rating but keeping the\nlink and event behaviour:\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" #default=\"{ rating, result }\">\n <span v-for=\"star in rating\">⭐️</span>\n <span>{{ result.name }}</span>\n </BaseResultRating>\n</template>\n\n<script>\nimport { BaseResultRating } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating,\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 },\n },\n }\n },\n}\n</script>\n```\n\nEven it is possible to reuse our rating component:\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" #default=\"{ rating, result }\">\n <BaseRating :value=\"rating\" />\n <span>{{ result.name }}</span>\n </BaseResultRating>\n</template>\n\n<script>\nimport { BaseResultRating, BaseRating } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating,\n BaseRating,\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 },\n },\n }\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createBlock","_resolveDynamicComponent","
|
|
1
|
+
{"version":3,"file":"base-result-rating.vue.js","sources":["../../../../src/components/result/base-result-rating.vue"],"sourcesContent":["<template>\n <component\n :is=\"link ? 'a' : 'div'\"\n v-if=\"result.rating && result.rating.value\"\n :ref=\"el\"\n :href=\"link\"\n class=\"x-result-rating\"\n data-test=\"result-rating\"\n @click=\"emitClickedEvent\"\n >\n <!--\n @slot To override the whole content\n -->\n <slot :rating=\"result.rating.value\" :result=\"result\">\n <BaseRating :value=\"result.rating.value\" v-bind=\"$attrs\">\n <template #empty-icon>\n <!--\n @slot The content to render as empty icon\n -->\n <slot name=\"empty-icon\" />\n </template>\n\n <template #filled-icon>\n <!--\n @slot The content to render as filled icon\n -->\n <slot name=\"filled-icon\" />\n </template>\n </BaseRating>\n </slot>\n </component>\n</template>\n\n<script lang=\"ts\">\nimport type { Result } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport { defineComponent, ref } from 'vue'\nimport { use$x } from '../../composables/index'\nimport BaseRating from '../base-rating.vue'\n\n/**\n * This component renders a {@link BaseRating} for a result passed as prop.\n *\n * @public\n */\nexport default defineComponent({\n components: {\n BaseRating,\n },\n inheritAttrs: false,\n props: {\n /**\n * The {@link @empathyco/x-types#Result} to render its rating.\n *\n * @public\n */\n result: {\n type: Object as PropType<Result>,\n required: true,\n },\n\n /**\n * A link to redirect when rating is clicked.\n *\n * @public\n */\n link: {\n type: String,\n },\n },\n setup(props) {\n const $x = use$x()\n\n const el = ref<HTMLElement | null>()\n\n /**\n * Emits the `UserClickedAResultRating` event when user clicks this component, with the\n * {@link @empathyco/x-types#Result} as payload.\n *\n * @internal\n */\n const emitClickedEvent = (): void => {\n $x.emit('UserClickedAResultRating', props.result, {\n target: el.value!,\n })\n }\n\n return {\n el,\n emitClickedEvent,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-result-rating {\n color: inherit;\n text-decoration: none;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`UserClickedAResultRating`](https://github.com/empathyco/x/blob/main/packages/x-components/src/wiring/events.types.ts)\n\n## See it in action\n\nHere you have a basic example of how the result rating is rendered.\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" />\n</template>\n\n<script>\nimport { BaseResultRating } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating,\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 },\n },\n }\n },\n}\n</script>\n```\n\n### Play with props\n\nIn this example, the result rating has been configured to 6 as maximum value using the prop `max`.\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" :max=\"6\" />\n</template>\n\n<script>\nimport { BaseResultRating } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating,\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 },\n },\n }\n },\n}\n</script>\n```\n\nIn this example, the result rating has been configured with a link to redirect when is clicked.\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" link=\"https://empathy.co/\" />\n</template>\n\n<script>\nimport { BaseResultRating } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating,\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 },\n },\n }\n },\n}\n</script>\n```\n\n### Play with events\n\nIn this example, a message has been added to be shown when the result rating is clicked.\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" @UserClickedAResultRating=\"logUserClickedRating\" />\n</template>\n\n<script>\nimport { BaseResultRating } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating,\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 },\n },\n }\n },\n methods: {\n logUserClickedRating(result) {\n console.log('User clickedRating of this result:', result)\n },\n },\n}\n</script>\n```\n\n## Extending the component\n\nThe rendered icons for rating can be configured through slots. Keep in mind that the icons for both\nstates (filled and empty), must have the same size make component work properly.\n\n```vue\n<template>\n <BaseResultRating :result=\"result\">\n <template #filled-icon>❤️</template>\n <template #empty-icon>🤍</template>\n </BaseResultRating>\n</template>\n\n<script>\nimport { BaseResultRating } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating,\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 },\n },\n }\n },\n}\n</script>\n```\n\nIt is possible to override all the content of the component to show your own rating but keeping the\nlink and event behaviour:\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" #default=\"{ rating, result }\">\n <span v-for=\"star in rating\">⭐️</span>\n <span>{{ result.name }}</span>\n </BaseResultRating>\n</template>\n\n<script>\nimport { BaseResultRating } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating,\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 },\n },\n }\n },\n}\n</script>\n```\n\nEven it is possible to reuse our rating component:\n\n```vue\n<template>\n <BaseResultRating :result=\"result\" #default=\"{ rating, result }\">\n <BaseRating :value=\"rating\" />\n <span>{{ result.name }}</span>\n </BaseResultRating>\n</template>\n\n<script>\nimport { BaseResultRating, BaseRating } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultRatingDemo',\n components: {\n BaseResultRating,\n BaseRating,\n },\n data() {\n return {\n result: {\n id: 1,\n name: 'Result with rating',\n rating: { value: 3 },\n },\n }\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createBlock","_resolveDynamicComponent","_renderSlot","_createVNode","_mergeProps","_withCtx"],"mappings":";;;;;;;AAGU,EAAA,OAAA,IAAA,CAAA,MAAA,CAAO,UAAU,IAAO,CAAA,MAAA,CAAA,MAAA,CAAO,KAFvC,IAAAA,SAAA,EAAA,EAAAC,WAAA,CA6BYC,wBA5BL,IAAI,CAAA,IAAA,GAAA,GAAA,GAAA,KAAA,CAAA,EAAA;AAAA,IAAA,GAAA,EAAA,CAAA;IAER,GAAK,EAAA,IAAA,CAAA,EAAA;AAAA,IACL,IAAM,EAAA,IAAA,CAAA,IAAA;AAAA,IACP,KAAM,EAAA,iBAAA;AAAA,IACN,WAAU,EAAA,eAAA;AAAA,IACT,OAAO,EAAA,IAAA,CAAA,gBAAA;AAAA,GAAA,EAAA;qBAKR,MAgBO;AAAA,MAhBPC,UAgBO,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA;AAAA,QAhBA,MAAA,EAAQ,YAAO,MAAO,CAAA,KAAA;AAAA,QAAQ,MAAQ,EAAA,IAAA,CAAA,MAAA;AAAA,OAAA,EAA7C,MAgBO;AAAA,QAfLC,WAAA,CAca,uBAdbC,UAca,CAAA;AAAA,UAdA,KAAA,EAAO,YAAO,MAAO,CAAA,KAAA;AAAA,SAAA,EAAe,IAAM,CAAA,MAAA,CAAA,EAAA;AAAA,UAC1C,YAAA,EAAUC,QAInB,MAA0B;AAAA,YAA1BH,UAA0B,CAAA,IAAA,CAAA,MAAA,EAAA,YAAA,EAAA,EAAA,EAAA,KAAA,CAAA,EAAA,IAAA,CAAA;AAAA,WAAA,CAAA;AAGjB,UAAA,aAAA,EAAWG,QAIpB,MAA2B;AAAA,YAA3BH,UAA2B,CAAA,IAAA,CAAA,MAAA,EAAA,aAAA,EAAA,EAAA,EAAA,KAAA,CAAA,EAAA,IAAA,CAAA;AAAA,WAAA,CAAA;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result-variant-selector.vue.js","sources":["../../../../src/components/result/result-variant-selector.vue"],"sourcesContent":["<template>\n <ul v-if=\"result && variants\" class=\"x-result-variant-selector__list\" data-test=\"variants-list\">\n <li\n v-for=\"(variant, index) in variants\"\n :key=\"index\"\n class=\"x-result-variant-selector__item\"\n :class=\"{ 'x-result-variant-selector__item--is-selected': variantIsSelected(variant) }\"\n data-test=\"variant-item\"\n >\n <!--\n @slot Variant item\n @binding {ResultVariant} variant - The variant item\n @binding {boolean} isSelected - Indicates if the variant is selected\n @binding {() => void} selectVariant - Callback to select the variant\n -->\n <slot\n name=\"variant\"\n :variant=\"variant\"\n :is-selected=\"variantIsSelected(variant)\"\n :select-variant=\"() => selectVariant(variant)\"\n >\n <button data-test=\"variant-button\" class=\"x-button\" @click=\"selectVariant(variant)\">\n <!--\n @slot Variant content\n @binding {ResultVariant} variant - The variant item\n @binding {boolean} isSelected - Indicates if the variant is selected\n -->\n <slot name=\"variant-content\" :variant=\"variant\" :is-selected=\"variantIsSelected(variant)\">\n {{ variant }}\n </slot>\n </button>\n </slot>\n </li>\n </ul>\n</template>\n\n<script lang=\"ts\">\nimport type { Result, ResultVariant } from '@empathyco/x-types'\nimport type { Ref } from 'vue'\nimport { computed, defineComponent, inject } from 'vue'\nimport {\n RESULT_WITH_VARIANTS_KEY,\n SELECT_RESULT_VARIANT_KEY,\n SELECTED_VARIANTS_KEY,\n} from '../decorators/injection.consts'\n\n/**\n * Component to show and select the available variants of a product for a given nest level.\n * TODO: Log warning on mount when result is not injected.\n *\n * @public\n */\nexport default defineComponent({\n name: 'ResultVariantSelector',\n props: {\n /** The nest level of the variants to be rendered. */\n level: {\n type: Number,\n default: 0,\n },\n },\n setup(props, { slots }) {\n /**\n * Callback to be called when a variant is selected.\n *\n * @public\n * @returns The 'selectResultVariant' injection key.\n */\n const selectResultVariant = inject<(variant: ResultVariant, level?: number) => void>(\n SELECT_RESULT_VARIANT_KEY as string,\n )\n\n /** The original result, used to retrieve the available variants for the level. */\n const result = inject<Ref<Result>>(RESULT_WITH_VARIANTS_KEY as string)\n\n /** Array containing the selected variants. */\n const selectedVariants = inject<Ref<ResultVariant[]>>(SELECTED_VARIANTS_KEY as string)\n\n /**\n * It retrieves the available variants from the result.\n *\n * @returns - The variants of the result for the current level.\n */\n const variants = computed<ResultVariant[] | undefined>(() => {\n if (props.level === 0) {\n return result!.value?.variants\n }\n return selectedVariants!.value[props.level - 1]?.variants\n })\n\n /**\n * Gets the selected variant of the current level.\n *\n * @returns - The selected variant.\n */\n const selectedVariant = computed<ResultVariant | undefined>(() =>\n variants.value?.find(variant => variant === selectedVariants!.value[props.level]),\n )\n\n /**\n * Calls the provided method to select a variant.\n *\n * @param variant - Variant to select.\n */\n const selectVariant = (variant: ResultVariant) => {\n selectResultVariant!(variant, props.level)\n }\n\n /**\n * Checks if a variant is selected.\n *\n * @param variant - Variant to check.\n * @returns True if the variant is selected, false if not.\n */\n const variantIsSelected = (variant: ResultVariant) => {\n return selectedVariant.value === variant\n }\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 result or variants, 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\n * no result or variants.\n */\n function renderDefaultSlot() {\n const slotProps = {\n variants: variants.value,\n selectedVariant: selectedVariant.value,\n selectVariant,\n }\n return result && variants.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 = { result, variants, variantIsSelected, selectVariant }\n return (slots.default ? renderDefaultSlot : componentProps) as typeof componentProps\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-result-variant-selector__list {\n display: flex;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component doesn't emit events.\n\n## See it in action\n\nHere you have a basic example of how the `ResultVariantSelector` component is rendered.\n\nTake into account that this component **must** be a child of a `ResultVariantsProvider` component.\n\nAlso, the component is intended to be used overwriting the content with the slots.\n\nBy default it will render a list of buttons containing the available variants.\n\nThis component only has a required `level` prop, that indicates the level of the variants to be\nrendered.\n\n```vue\n<template>\n <ResultVariantsProvider :result=\"result\" #default=\"{ result }\">\n <p>Result name: {{ result.name }}</p>\n\n <h1>Select color</h1>\n <ResultVariantSelector :level=\"0\" #variant=\"{ variant, selectVariant }\" />\n\n <h1>Select size</h1>\n <ResultVariantSelector :level=\"1\" #variant=\"{ variant, selectVariant }\" />\n </ResultVariantsProvider>\n</template>\n\n<script>\nimport { ResultVariantsProvider, ResultVariantSelector } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultVariantSelectorDemo',\n components: {\n ResultVariantsProvider,\n ResultVariantSelector,\n },\n data() {\n return {\n result: {\n id: 'jacket',\n modelName: 'Result',\n type: 'Product',\n isWishlisted: false,\n identifier: { value: 'jacket' },\n images: [],\n name: 'jacket',\n price: { hasDiscount: false, originalValue: 10, value: 10 },\n url: '/products/jacket',\n variants: [\n {\n name: 'red',\n variants: [\n {\n name: 'red XL',\n },\n {\n name: 'red L',\n },\n ],\n },\n {\n name: 'blue',\n variants: [\n {\n name: 'blue S',\n },\n {\n name: 'blue M',\n },\n {\n name: 'blue L',\n },\n ],\n },\n ],\n },\n }\n },\n}\n</script>\n```\n\n### Play with the default slot\n\nIn this example the default slot is used to customize the list.\n\n```vue\n<template>\n <ResultVariantsProvider :result=\"result\" #default=\"{ result }\">\n <p>Result name: {{ result.name }}</p>\n\n <ResultVariantSelector :level=\"0\" #default=\"{ variants, selectedVariant, selectVariant }\">\n <div>\n <p v-if=\"selectedVariant\">Selected variant: {{ selectedVariant.name }}</p>\n <ul class=\"x-flex\">\n <li v-for=\"(variant, index) in variants\" :key=\"index\">\n <button @click=\"selectVariant(variant)\">{{ variant.name }}</button>\n </li>\n </ul>\n </div>\n </ResultVariantSelector>\n </ResultVariantsProvider>\n</template>\n\n<script>\nimport { ResultVariantsProvider, ResultVariantSelector } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultVariantSelectorDemo',\n components: {\n ResultVariantsProvider,\n ResultVariantSelector,\n },\n data() {\n return {\n result: {\n id: 'jacket',\n modelName: 'Result',\n type: 'Product',\n isWishlisted: false,\n identifier: { value: 'jacket' },\n images: [],\n name: 'jacket',\n price: { hasDiscount: false, originalValue: 10, value: 10 },\n url: '/products/jacket',\n variants: [\n {\n name: 'red',\n },\n {\n name: 'blue',\n },\n ],\n },\n }\n },\n}\n</script>\n```\n\n### Play with variant-slot\n\nIn this example the variant-slot is used to customize the variant item.\n\nThe variant will be rendered inside a list.\n\n```vue\n<template>\n <ResultVariantsProvider :result=\"result\" #default=\"{ result }\">\n <p>Result name: {{ result.name }}</p>\n\n <ResultVariantSelector :level=\"0\" #variant=\"{ variant, isSelected, selectVariant }\">\n <div>\n <button @click=\"selectVariant\">\n {{ variant.name }}\n <span v-if=\"isSelected\">SELECTED!</span>\n </button>\n </div>\n </ResultVariantSelector>\n </ResultVariantsProvider>\n</template>\n\n<script>\nimport { ResultVariantsProvider, ResultVariantSelector } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultVariantSelectorDemo',\n components: {\n ResultVariantsProvider,\n ResultVariantSelector,\n },\n data() {\n return {\n result: {\n id: 'jacket',\n modelName: 'Result',\n type: 'Product',\n isWishlisted: false,\n identifier: { value: 'jacket' },\n images: [],\n name: 'jacket',\n price: { hasDiscount: false, originalValue: 10, value: 10 },\n url: '/products/jacket',\n variants: [\n {\n name: 'red',\n },\n {\n name: 'blue',\n },\n ],\n },\n }\n },\n}\n</script>\n```\n\n### Play with variant-content slot\n\nIn this example the variant-content slot is used to customize the content of the default variant\nbutton.\n\n```vue\n<template>\n <ResultVariantsProvider :result=\"result\" #default=\"{ result }\">\n <p>Result name: {{ result.name }}</p>\n\n <ResultVariantSelector #variant-content=\"{ variant, isSelected }\">\n <div>\n {{ variant.name }}\n <span v-if=\"isSelected\">SELECTED!</span>\n </div>\n </ResultVariantSelector>\n </ResultVariantsProvider>\n</template>\n\n<script>\nimport { ResultVariantsProvider, ResultVariantSelector } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultVariantSelectorDemo',\n components: {\n ResultVariantsProvider,\n ResultVariantSelector,\n },\n data() {\n return {\n result: {\n id: 'jacket',\n modelName: 'Result',\n type: 'Product',\n isWishlisted: false,\n identifier: { value: 'jacket' },\n images: [],\n name: 'jacket',\n price: { hasDiscount: false, originalValue: 10, value: 10 },\n url: '/products/jacket',\n variants: [\n {\n name: 'red',\n },\n {\n name: 'blue',\n },\n ],\n },\n }\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_Fragment","_renderList","_normalizeClass","_renderSlot","_createElementVNode","_createTextVNode","_toDisplayString","_createCommentVNode"],"mappings":";;;;;;AAAA,EAAA,GAAA,EAAA,CAAA;AAAA,EACgC,KAAM,EAAA,iCAAA;AAAA,EAAkC,WAAU,EAAA,eAAA;;AADlF,MAAA,UAAA,GAAA,CAAA,SAAA,CAAA,CAAA;;SACY,IAAU,CAAA,MAAA,IAAA,IAAA,CAAA,QAAA,IAAAA,SAAA,EAAA,EAApBC,kBAgCK,CAAA,IAAA,EAhCL,UAgCK,EAAA;AAAA,KA/BHD,SAAA,CAAA,IAAA,CAAA,EAAAC,kBAAA;AAAA,MA8BKC,QAAA;AAAA,MAAA,IAAA;AAAA,MAhCTC,UAGiC,CAAA,IAAA,CAAA,QAAA,EAHjC,CAGc,OAAA,EAAS,KAAK,KAAA;AADxB,QAAA,OAAAH,SAAA,EAAA,EAAAC,kBAAA;AAAA,UA8BK,IAAA;AAAA,UAAA;AAAA,YA5BF,GAAK,EAAA,KAAA;AAAA,YACN,KALN,EAAAG,cAAA,CAAA,CAKY,iCAAiC,EAAA,EAAA,8CAAA,EACmB,uBAAkB,OAAO,CAAA,EAAA,CAAA,CAAA;AAAA,YACnF,WAAU,EAAA,cAAA;AAAA,WAAA;;YAQVC,UAgBO,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA;AAAA,cAdJ,OAAA;AAAA,cACA,UAAA,EAAa,uBAAkB,OAAO,CAAA;AAAA,cACtC,aAAA,EAAc,MAAQ,IAAA,CAAA,aAAA,CAAc,OAAO,CAAA;AAAA,aAAA,EAJ9C,MAgBO;AAAA,cAVLC,kBASS,CAAA,QAAA,EAAA;AAAA,gBATD,WAAU,EAAA,gBAAA;AAAA,gBAAiB,KAAM,EAAA,UAAA;AAAA,gBAAY,OAAA,EAAK,CAAE,MAAA,KAAA,IAAA,CAAA,aAAA,CAAc,OAAO,CAAA;AAAA,eAAA,EAAA;gBAM/ED,UAEO,CAAA,IAAA,CAAA,MAAA,EAAA,iBAAA,EAAA;AAAA,kBAFuB,OAAA;AAAA,kBAAmB,UAAA,EAAa,uBAAkB,OAAO,CAAA;AAAA,iBAAA,EAAvF,MAEO;AAAA,kBA7BjBE,eAAA;AAAA,oBAAAC,eAAA,CA4Be,OAAO,CAAA;AAAA,oBAAA,CAAA;AAAA;AAAA,mBAAA;AAAA,iBAAA,EAAA,IAAA,CAAA;AA5BtB,eAAA,EAAA,CAAA,EAAA,UAAA,CAAA;AAAA,aAAA,EAAA,IAAA,CAAA;;;;;;;;;AAAA,GAAA,CAAA,IAAAC,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA,CAAA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"result-variant-selector.vue.js","sources":["../../../../src/components/result/result-variant-selector.vue"],"sourcesContent":["<template>\n <ul v-if=\"result && variants\" class=\"x-result-variant-selector__list\" data-test=\"variants-list\">\n <li\n v-for=\"(variant, index) in variants\"\n :key=\"index\"\n class=\"x-result-variant-selector__item\"\n :class=\"{ 'x-result-variant-selector__item--is-selected': variantIsSelected(variant) }\"\n data-test=\"variant-item\"\n >\n <!--\n @slot Variant item\n @binding {ResultVariant} variant - The variant item\n @binding {boolean} isSelected - Indicates if the variant is selected\n @binding {() => void} selectVariant - Callback to select the variant\n -->\n <slot\n name=\"variant\"\n :variant=\"variant\"\n :is-selected=\"variantIsSelected(variant)\"\n :select-variant=\"() => selectVariant(variant)\"\n >\n <button data-test=\"variant-button\" class=\"x-button\" @click=\"selectVariant(variant)\">\n <!--\n @slot Variant content\n @binding {ResultVariant} variant - The variant item\n @binding {boolean} isSelected - Indicates if the variant is selected\n -->\n <slot name=\"variant-content\" :variant=\"variant\" :is-selected=\"variantIsSelected(variant)\">\n {{ variant }}\n </slot>\n </button>\n </slot>\n </li>\n </ul>\n</template>\n\n<script lang=\"ts\">\nimport type { Result, ResultVariant } from '@empathyco/x-types'\nimport type { Ref } from 'vue'\nimport { computed, defineComponent, inject } from 'vue'\nimport {\n RESULT_WITH_VARIANTS_KEY,\n SELECT_RESULT_VARIANT_KEY,\n SELECTED_VARIANTS_KEY,\n} from '../decorators/injection.consts'\n\n/**\n * Component to show and select the available variants of a product for a given nest level.\n * TODO: Log warning on mount when result is not injected.\n *\n * @public\n */\nexport default defineComponent({\n name: 'ResultVariantSelector',\n props: {\n /** The nest level of the variants to be rendered. */\n level: {\n type: Number,\n default: 0,\n },\n },\n setup(props, { slots }) {\n /**\n * Callback to be called when a variant is selected.\n *\n * @public\n * @returns The 'selectResultVariant' injection key.\n */\n const selectResultVariant = inject<(variant: ResultVariant, level?: number) => void>(\n SELECT_RESULT_VARIANT_KEY as string,\n )\n\n /** The original result, used to retrieve the available variants for the level. */\n const result = inject<Ref<Result>>(RESULT_WITH_VARIANTS_KEY as string)\n\n /** Array containing the selected variants. */\n const selectedVariants = inject<Ref<ResultVariant[]>>(SELECTED_VARIANTS_KEY as string)\n\n /**\n * It retrieves the available variants from the result.\n *\n * @returns - The variants of the result for the current level.\n */\n const variants = computed<ResultVariant[] | undefined>(() => {\n if (props.level === 0) {\n return result!.value?.variants\n }\n return selectedVariants!.value[props.level - 1]?.variants\n })\n\n /**\n * Gets the selected variant of the current level.\n *\n * @returns - The selected variant.\n */\n const selectedVariant = computed<ResultVariant | undefined>(() =>\n variants.value?.find(variant => variant === selectedVariants!.value[props.level]),\n )\n\n /**\n * Calls the provided method to select a variant.\n *\n * @param variant - Variant to select.\n */\n const selectVariant = (variant: ResultVariant) => {\n selectResultVariant!(variant, props.level)\n }\n\n /**\n * Checks if a variant is selected.\n *\n * @param variant - Variant to check.\n * @returns True if the variant is selected, false if not.\n */\n const variantIsSelected = (variant: ResultVariant) => {\n return selectedVariant.value === variant\n }\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 result or variants, 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\n * no result or variants.\n */\n function renderDefaultSlot() {\n const slotProps = {\n variants: variants.value,\n selectedVariant: selectedVariant.value,\n selectVariant,\n }\n return result && variants.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 = { result, variants, variantIsSelected, selectVariant }\n return (slots.default ? renderDefaultSlot : componentProps) as typeof componentProps\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-result-variant-selector__list {\n display: flex;\n}\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component doesn't emit events.\n\n## See it in action\n\nHere you have a basic example of how the `ResultVariantSelector` component is rendered.\n\nTake into account that this component **must** be a child of a `ResultVariantsProvider` component.\n\nAlso, the component is intended to be used overwriting the content with the slots.\n\nBy default it will render a list of buttons containing the available variants.\n\nThis component only has a required `level` prop, that indicates the level of the variants to be\nrendered.\n\n```vue\n<template>\n <ResultVariantsProvider :result=\"result\" #default=\"{ result }\">\n <p>Result name: {{ result.name }}</p>\n\n <h1>Select color</h1>\n <ResultVariantSelector :level=\"0\" #variant=\"{ variant, selectVariant }\" />\n\n <h1>Select size</h1>\n <ResultVariantSelector :level=\"1\" #variant=\"{ variant, selectVariant }\" />\n </ResultVariantsProvider>\n</template>\n\n<script>\nimport { ResultVariantsProvider, ResultVariantSelector } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultVariantSelectorDemo',\n components: {\n ResultVariantsProvider,\n ResultVariantSelector,\n },\n data() {\n return {\n result: {\n id: 'jacket',\n modelName: 'Result',\n type: 'Product',\n isWishlisted: false,\n identifier: { value: 'jacket' },\n images: [],\n name: 'jacket',\n price: { hasDiscount: false, originalValue: 10, value: 10 },\n url: '/products/jacket',\n variants: [\n {\n name: 'red',\n variants: [\n {\n name: 'red XL',\n },\n {\n name: 'red L',\n },\n ],\n },\n {\n name: 'blue',\n variants: [\n {\n name: 'blue S',\n },\n {\n name: 'blue M',\n },\n {\n name: 'blue L',\n },\n ],\n },\n ],\n },\n }\n },\n}\n</script>\n```\n\n### Play with the default slot\n\nIn this example the default slot is used to customize the list.\n\n```vue\n<template>\n <ResultVariantsProvider :result=\"result\" #default=\"{ result }\">\n <p>Result name: {{ result.name }}</p>\n\n <ResultVariantSelector :level=\"0\" #default=\"{ variants, selectedVariant, selectVariant }\">\n <div>\n <p v-if=\"selectedVariant\">Selected variant: {{ selectedVariant.name }}</p>\n <ul class=\"x-flex\">\n <li v-for=\"(variant, index) in variants\" :key=\"index\">\n <button @click=\"selectVariant(variant)\">{{ variant.name }}</button>\n </li>\n </ul>\n </div>\n </ResultVariantSelector>\n </ResultVariantsProvider>\n</template>\n\n<script>\nimport { ResultVariantsProvider, ResultVariantSelector } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultVariantSelectorDemo',\n components: {\n ResultVariantsProvider,\n ResultVariantSelector,\n },\n data() {\n return {\n result: {\n id: 'jacket',\n modelName: 'Result',\n type: 'Product',\n isWishlisted: false,\n identifier: { value: 'jacket' },\n images: [],\n name: 'jacket',\n price: { hasDiscount: false, originalValue: 10, value: 10 },\n url: '/products/jacket',\n variants: [\n {\n name: 'red',\n },\n {\n name: 'blue',\n },\n ],\n },\n }\n },\n}\n</script>\n```\n\n### Play with variant-slot\n\nIn this example the variant-slot is used to customize the variant item.\n\nThe variant will be rendered inside a list.\n\n```vue\n<template>\n <ResultVariantsProvider :result=\"result\" #default=\"{ result }\">\n <p>Result name: {{ result.name }}</p>\n\n <ResultVariantSelector :level=\"0\" #variant=\"{ variant, isSelected, selectVariant }\">\n <div>\n <button @click=\"selectVariant\">\n {{ variant.name }}\n <span v-if=\"isSelected\">SELECTED!</span>\n </button>\n </div>\n </ResultVariantSelector>\n </ResultVariantsProvider>\n</template>\n\n<script>\nimport { ResultVariantsProvider, ResultVariantSelector } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultVariantSelectorDemo',\n components: {\n ResultVariantsProvider,\n ResultVariantSelector,\n },\n data() {\n return {\n result: {\n id: 'jacket',\n modelName: 'Result',\n type: 'Product',\n isWishlisted: false,\n identifier: { value: 'jacket' },\n images: [],\n name: 'jacket',\n price: { hasDiscount: false, originalValue: 10, value: 10 },\n url: '/products/jacket',\n variants: [\n {\n name: 'red',\n },\n {\n name: 'blue',\n },\n ],\n },\n }\n },\n}\n</script>\n```\n\n### Play with variant-content slot\n\nIn this example the variant-content slot is used to customize the content of the default variant\nbutton.\n\n```vue\n<template>\n <ResultVariantsProvider :result=\"result\" #default=\"{ result }\">\n <p>Result name: {{ result.name }}</p>\n\n <ResultVariantSelector #variant-content=\"{ variant, isSelected }\">\n <div>\n {{ variant.name }}\n <span v-if=\"isSelected\">SELECTED!</span>\n </div>\n </ResultVariantSelector>\n </ResultVariantsProvider>\n</template>\n\n<script>\nimport { ResultVariantsProvider, ResultVariantSelector } from '@empathyco/x-components'\n\nexport default {\n name: 'ResultVariantSelectorDemo',\n components: {\n ResultVariantsProvider,\n ResultVariantSelector,\n },\n data() {\n return {\n result: {\n id: 'jacket',\n modelName: 'Result',\n type: 'Product',\n isWishlisted: false,\n identifier: { value: 'jacket' },\n images: [],\n name: 'jacket',\n price: { hasDiscount: false, originalValue: 10, value: 10 },\n url: '/products/jacket',\n variants: [\n {\n name: 'red',\n },\n {\n name: 'blue',\n },\n ],\n },\n }\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_Fragment","_renderList","_normalizeClass","_renderSlot","_createElementVNode","_createTextVNode"],"mappings":";;;;;;;EACgC,KAAM,EAAA,iCAAA;AAAA,EAAkC,WAAU,EAAA,eAAA;;;;SAAtE,IAAU,CAAA,MAAA,IAAA,IAAA,CAAA,QAAA,IAAAA,SAAA,EAAA,EAApBC,kBAgCK,CAAA,IAAA,EAhCL,UAgCK,EAAA;AAAA,KA/BHD,SAAA,CAAA,IAAA,CAAA,EAAAC,kBAAA;AAAA,MA8BKC,QAAA;AAAA,MAAA,IAAA;AAAA,MA7BwBC,UAAA,CAAA,IAAA,CAAA,QAAA,EAAQ,CAA3B,OAAA,EAAS,KAAK,KAAA;AADxB,QAAA,OAAAH,SAAA,EAAA,EAAAC,kBAAA;AAAA,UA8BK,IAAA;AAAA,UAAA;AAAA,YA5BF,GAAK,EAAA,KAAA;AAAA,YACN,KAAK,EAAAG,cAAA,CAAA,CAAC,iCAAiC,EAAA,EAAA,8CAAA,EACmB,uBAAkB,OAAO,CAAA,EAAA,CAAA,CAAA;AAAA,YACnF,WAAU,EAAA,cAAA;AAAA,WAAA;;YAQVC,UAgBO,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA;AAAA,cAdJ,OAAA;AAAA,cACA,UAAA,EAAa,uBAAkB,OAAO,CAAA;AAAA,cACtC,aAAA,EAAc,MAAQ,IAAA,CAAA,aAAA,CAAc,OAAO,CAAA;AAAA,aAAA,EAJ9C,MAgBO;AAAA,cAVLC,kBASS,CAAA,QAAA,EAAA;AAAA,gBATD,WAAU,EAAA,gBAAA;AAAA,gBAAiB,KAAM,EAAA,UAAA;AAAA,gBAAY,OAAA,EAAK,CAAE,MAAA,KAAA,IAAA,CAAA,aAAA,CAAc,OAAO,CAAA;AAAA,eAAA,EAAA;gBAM/ED,UAEO,CAAA,IAAA,CAAA,MAAA,EAAA,iBAAA,EAAA;AAAA,kBAFuB,OAAA;AAAA,kBAAmB,UAAA,EAAa,uBAAkB,OAAO,CAAA;AAAA,iBAAA,EAAvF,MAEO;AAAA,kBAAAE,eAAA;oCADF,OAAO,CAAA;AAAA,oBAAA,CAAA;AAAA;AAAA,mBAAA;AAAA,iBAAA,EAAA,IAAA,CAAA;;;;;;;;;;;;;;;;;"}
|
|
@@ -42,7 +42,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
42
42
|
},
|
|
43
43
|
[
|
|
44
44
|
renderSlot(_ctx.$slots, "sliding-panel-left-button", {}, () => [
|
|
45
|
-
createTextVNode(
|
|
45
|
+
_cache[2] || (_cache[2] = createTextVNode(
|
|
46
|
+
"ᐸ",
|
|
47
|
+
-1
|
|
48
|
+
/* CACHED */
|
|
49
|
+
))
|
|
46
50
|
], true)
|
|
47
51
|
],
|
|
48
52
|
2
|
|
@@ -57,7 +61,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
57
61
|
},
|
|
58
62
|
[
|
|
59
63
|
renderSlot(_ctx.$slots, "sliding-panel-right-button", {}, () => [
|
|
60
|
-
createTextVNode(
|
|
64
|
+
_cache[3] || (_cache[3] = createTextVNode(
|
|
65
|
+
"ᐳ",
|
|
66
|
+
-1
|
|
67
|
+
/* CACHED */
|
|
68
|
+
))
|
|
61
69
|
], true)
|
|
62
70
|
],
|
|
63
71
|
2
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sliding-panel.vue.js","sources":["../../../src/components/sliding-panel.vue"],"sourcesContent":["<template>\n <div v-if=\"slots.default\" class=\"x-sliding-panel\" :class=\"cssClasses\" data-test=\"sliding-panel\">\n <div\n ref=\"scrollContainerRef\"\n :class=\"scrollContainerClass\"\n class=\"x-sliding-panel__scroll\"\n data-test=\"sliding-panel-scroll\"\n >\n <!-- @slot (Required) Sliding panel content -->\n <slot />\n </div>\n <slot name=\"sliding-panel-addons\" :arrived-state=\"arrivedState\" :scroll=\"xScroll\" />\n <template v-if=\"showButtons\">\n <button\n class=\"x-sliding-panel__button x-button x-sliding-panel-button-left\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-left-button\"\n @click=\"xScroll -= slotContainerWidth * scrollFactor\"\n >\n <!-- @slot Left button content -->\n <slot name=\"sliding-panel-left-button\">ᐸ</slot>\n </button>\n <button\n class=\"x-sliding-panel__button x-button x-sliding-panel-button-right\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-right-button\"\n @click=\"xScroll += slotContainerWidth * scrollFactor\"\n >\n <!-- @slot Right button content -->\n <slot name=\"sliding-panel-right-button\">ᐳ</slot>\n </button>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../utils/types'\nimport {\n useElementBounding,\n useElementVisibility,\n useMutationObserver,\n useScroll,\n whenever,\n} from '@vueuse/core'\nimport { computed, defineComponent, ref } from 'vue'\n\n/**\n * This component allows for any other component or element inside it to be horizontally\n * navigable. It also implements customizable buttons as well as other minor customizations to its\n * general behavior.\n *\n * Additionally, this component exposes the following props to modify the classes of the\n * elements: `buttonClass`.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SlidingPanel',\n props: {\n /**\n * Scroll factor that will dictate how much the scroll moves when pressing a navigation button.\n */\n scrollFactor: {\n type: Number,\n default: 0.7,\n },\n /** Would make the navigation buttons visible when they're needed or always hide them. */\n showButtons: {\n type: Boolean,\n default: true,\n },\n /**\n * When true, whenever the DOM content in the sliding panel slot changes, it will reset\n * the scroll position to 0.\n */\n resetOnContentChange: {\n type: Boolean,\n default: true,\n },\n buttonClass: { type: [String, Object, Array] as PropType<VueCSSClasses> },\n scrollContainerClass: { type: [String, Object, Array] as PropType<VueCSSClasses> },\n },\n setup(props, { slots }) {\n const scrollContainerRef = ref<HTMLDivElement>()\n\n const { width: slotContainerWidth } = useElementBounding(scrollContainerRef)\n const isVisible = useElementVisibility(scrollContainerRef)\n\n const {\n x: xScroll,\n arrivedState,\n measure,\n } = useScroll(scrollContainerRef, {\n behavior: 'smooth',\n })\n\n /** CSS classes to apply based on the scroll position. */\n const cssClasses = computed(() => ({\n 'x-sliding-panel-at-start': arrivedState.left,\n 'x-sliding-panel-at-end': arrivedState.right,\n }))\n\n if (props.resetOnContentChange) {\n useMutationObserver(\n scrollContainerRef,\n mutations => {\n if (mutations.length > 0) {\n xScroll.value = 0\n }\n },\n {\n subtree: true,\n childList: true,\n attributes: false,\n characterData: false,\n },\n )\n }\n //ensure positions are right calculated as soon as the sliding panel is shown\n whenever(isVisible, measure)\n\n return {\n arrivedState,\n cssClasses,\n scrollContainerRef,\n slotContainerWidth,\n xScroll,\n slots,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-sliding-panel {\n align-items: center;\n display: flex;\n flex-flow: row nowrap;\n position: relative;\n}\n\n.x-sliding-panel__button {\n opacity: 0;\n pointer-events: none;\n position: absolute;\n transition: all ease-out 0.2s;\n z-index: 2; /* To overlay the design system gradient with z-index:1 */\n}\n.x-sliding-panel-button-left {\n left: var(--x-sliding-panel-buttons-distance, 0);\n}\n.x-sliding-panel-button-right {\n right: var(--x-sliding-panel-buttons-distance, 0);\n}\n\n.x-sliding-panel__scroll {\n display: flex;\n flex: 100%;\n flex-flow: row nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none; /* Firefox */\n -ms-overflow-style: none; /* IE */\n}\n\n/* Chrome, Edge & Safari */\n.x-sliding-panel__scroll::-webkit-scrollbar {\n display: none;\n}\n\n.x-sliding-panel__scroll > * {\n flex: 0 0 auto;\n}\n\n/* prettier-ignore */\n.x-sliding-panel:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-start) .x-sliding-panel-button-left {\n opacity: 1;\n pointer-events: all;\n }\n\n/* prettier-ignore */\n.x-sliding-panel:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-end) .x-sliding-panel-button-right {\n opacity: 1;\n pointer-events: all;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events.\n\n## See it in action\n\nSimplest implementation of the component, just a list-based component inside its slot.\n\n```vue\n<template>\n <SlidingPanel>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n### Play with props\n\n#### Modifying scroll buttons travel distance\n\nEdit how much the scroll travels when navigating with the buttons by changing the `scrollFactor`\nprop.\n\n```vue\n<template>\n <SlidingPanel :scrollFactor=\"1.5\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Hiding scroll buttons\n\nHide the navigational buttons completely by setting the `showButtons` prop to `false`. This is\nintended to be used when other scrolling options are available, like in mobile, where you can scroll\njust by swiping.\n\n```vue\n<template>\n <SlidingPanel :showButtons=\"false\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Customizing the content with classes\n\nThe `buttonClass` prop can be used to add classes to the buttons.\n\nThe `scrollContainerClass` prop can be used to add classes to the scroll content.\n\n```vue\n<template>\n <SlidingPanel buttonClass=\"x-button--round\" scrollContainerClass=\"x-sliding-panel-fade\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Disabling reset the scroll when content changes\n\nBy default, whenever the content of the sliding panel changes, it auto resets its scroll position.\nYou can disable this behavior setting the `resetOnContentChange` prop to `false`.\n\n```vue\n<template>\n <div>\n <button @click=\"items++\">Add item</button>\n <label>\n <input type=\"checkbox\" v-model=\"resetOnContentChange\" />\n Reset content onchange\n </label>\n <SlidingPanel :resetOnContentChange=\"resetOnContentChange\">\n <div class=\"item\" v-for=\"item in items\" :key=\"item\">Item {{ item }}</div>\n </SlidingPanel>\n </div>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n data() {\n return {\n items: 4,\n resetOnContentChange: false,\n }\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n## Extending the component\n\n### Overriding Button content\n\nBy default the buttons show an arrow depicting the direction the scroll would go to when clicked,\nbut this content can be customized with anything, from characters to SVG and images.\n\n```vue\n<template>\n <SlidingPanel>\n <template #sliding-panel-left-button>Left</template>\n <template #default>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </template>\n <template #sliding-panel-right-button>Right</template>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_createElementVNode","_renderSlot","_Fragment","_createTextVNode","_createCommentVNode"],"mappings":";;;;;;AACa,EAAA,OAAA,IAAA,CAAA,KAAA,CAAM,OAAjB,IAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,IA+BM,KAAA;AAAA,IAAA;AAAA,MAhCR,GAAA,EAAA,CAAA;AAAA,MAC4B,KAAA,EAD5BC,cACkC,CAAA,CAAA,iBAAA,EAA0B,IAAU,CAAA,UAAA,CAAA,CAAA;AAAA,MAAE,WAAU,EAAA,eAAA;AAAA,KAAA;;AAC9E,MAAAC,kBAAA;AAAA,QAQM,KAAA;AAAA,QAAA;AAAA,UAPJ,GAAI,EAAA,oBAAA;AAAA,UACH,KAAA,EAJPD,cAIc,CAAA,CAAA,IAAA,CAAA,oBAAA,EACF,yBAAyB,CAAA,CAAA;AAAA,UAC/B,WAAU,EAAA,sBAAA;AAAA,SAAA;;UAGVE,UAAQ,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAAA,EAAA,KAAA,CAAA,EAAA,IAAA,CAAA;AAAA,SAAA;;;;MAEVA,UAAoF,CAAA,IAAA,CAAA,MAAA,EAAA,sBAAA,EAAA;AAAA,QAAjD,YAAe,EAAA,IAAA,CAAA,YAAA;AAAA,QAAe,MAAQ,EAAA,IAAA,CAAA,OAAA;AAAA,OAAA,EAAA,KAAA,CAAA,EAAA,IAAA,CAAA;MACzD,IAAhB,CAAA,WAAA,IAAAJ,SAAA,EAAA,EAAAC,kBAAA;AAAA,QAmBWI,QAAA;AAAA,QA/Bf,EAAA,GAAA,EAAA,CAAA,EAAA;AAAA,QAAA;AAAA,UAaMF,kBAAA;AAAA,YAQS,QAAA;AAAA,YAAA;AAAA,cAPP,KAAA,EAdRD,cAcc,CAAA,CAAA,8DAAA,EACE,IAAW,CAAA,WAAA,CAAA,CAAA;AAAA,cACnB,WAAU,EAAA,2BAAA;AAAA,cACT,OAAA,EAAK,MAAE,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,MAAA,KAAA,IAAA,CAAA,OAAA,IAAW,IAAqB,CAAA,kBAAA,GAAA,IAAA,CAAA,YAAA,CAAA;AAAA,aAAA;;AAGxC,cAAAE,UAAA,CAA+C,8CAA/C,MAA+C;AAAA,gBApBvDE,gBAoB+C,GAAC,CAAA;AAAA,eAAA,EAAA,IAAA,CAAA;;;;;AAE1C,UAAAH,kBAAA;AAAA,YAQS,QAAA;AAAA,YAAA;AAAA,cAPP,KAAA,EAvBRD,cAuBc,CAAA,CAAA,+DAAA,EACE,IAAW,CAAA,WAAA,CAAA,CAAA;AAAA,cACnB,WAAU,EAAA,4BAAA;AAAA,cACT,OAAA,EAAK,MAAE,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,MAAA,KAAA,IAAA,CAAA,OAAA,IAAW,IAAqB,CAAA,kBAAA,GAAA,IAAA,CAAA,YAAA,CAAA;AAAA,aAAA;;AAGxC,cAAAE,UAAA,CAAgD,+CAAhD,MAAgD;AAAA,gBA7BxDE,gBA6BgD,GAAC,CAAA;AAAA,eAAA,EAAA,IAAA,CAAA;;;;;;;;AA7BjD,OAAA,IAAAC,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA;AAAA,KAAA;;;AAAA,GAAA,IAAAA,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA,CAAA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"sliding-panel.vue.js","sources":["../../../src/components/sliding-panel.vue"],"sourcesContent":["<template>\n <div v-if=\"slots.default\" class=\"x-sliding-panel\" :class=\"cssClasses\" data-test=\"sliding-panel\">\n <div\n ref=\"scrollContainerRef\"\n :class=\"scrollContainerClass\"\n class=\"x-sliding-panel__scroll\"\n data-test=\"sliding-panel-scroll\"\n >\n <!-- @slot (Required) Sliding panel content -->\n <slot />\n </div>\n <slot name=\"sliding-panel-addons\" :arrived-state=\"arrivedState\" :scroll=\"xScroll\" />\n <template v-if=\"showButtons\">\n <button\n class=\"x-sliding-panel__button x-button x-sliding-panel-button-left\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-left-button\"\n @click=\"xScroll -= slotContainerWidth * scrollFactor\"\n >\n <!-- @slot Left button content -->\n <slot name=\"sliding-panel-left-button\">ᐸ</slot>\n </button>\n <button\n class=\"x-sliding-panel__button x-button x-sliding-panel-button-right\"\n :class=\"buttonClass\"\n data-test=\"sliding-panel-right-button\"\n @click=\"xScroll += slotContainerWidth * scrollFactor\"\n >\n <!-- @slot Right button content -->\n <slot name=\"sliding-panel-right-button\">ᐳ</slot>\n </button>\n </template>\n </div>\n</template>\n\n<script lang=\"ts\">\nimport type { PropType } from 'vue'\nimport type { VueCSSClasses } from '../utils/types'\nimport {\n useElementBounding,\n useElementVisibility,\n useMutationObserver,\n useScroll,\n whenever,\n} from '@vueuse/core'\nimport { computed, defineComponent, ref } from 'vue'\n\n/**\n * This component allows for any other component or element inside it to be horizontally\n * navigable. It also implements customizable buttons as well as other minor customizations to its\n * general behavior.\n *\n * Additionally, this component exposes the following props to modify the classes of the\n * elements: `buttonClass`.\n *\n * @public\n */\nexport default defineComponent({\n name: 'SlidingPanel',\n props: {\n /**\n * Scroll factor that will dictate how much the scroll moves when pressing a navigation button.\n */\n scrollFactor: {\n type: Number,\n default: 0.7,\n },\n /** Would make the navigation buttons visible when they're needed or always hide them. */\n showButtons: {\n type: Boolean,\n default: true,\n },\n /**\n * When true, whenever the DOM content in the sliding panel slot changes, it will reset\n * the scroll position to 0.\n */\n resetOnContentChange: {\n type: Boolean,\n default: true,\n },\n buttonClass: { type: [String, Object, Array] as PropType<VueCSSClasses> },\n scrollContainerClass: { type: [String, Object, Array] as PropType<VueCSSClasses> },\n },\n setup(props, { slots }) {\n const scrollContainerRef = ref<HTMLDivElement>()\n\n const { width: slotContainerWidth } = useElementBounding(scrollContainerRef)\n const isVisible = useElementVisibility(scrollContainerRef)\n\n const {\n x: xScroll,\n arrivedState,\n measure,\n } = useScroll(scrollContainerRef, {\n behavior: 'smooth',\n })\n\n /** CSS classes to apply based on the scroll position. */\n const cssClasses = computed(() => ({\n 'x-sliding-panel-at-start': arrivedState.left,\n 'x-sliding-panel-at-end': arrivedState.right,\n }))\n\n if (props.resetOnContentChange) {\n useMutationObserver(\n scrollContainerRef,\n mutations => {\n if (mutations.length > 0) {\n xScroll.value = 0\n }\n },\n {\n subtree: true,\n childList: true,\n attributes: false,\n characterData: false,\n },\n )\n }\n //ensure positions are right calculated as soon as the sliding panel is shown\n whenever(isVisible, measure)\n\n return {\n arrivedState,\n cssClasses,\n scrollContainerRef,\n slotContainerWidth,\n xScroll,\n slots,\n }\n },\n})\n</script>\n\n<style lang=\"css\" scoped>\n.x-sliding-panel {\n align-items: center;\n display: flex;\n flex-flow: row nowrap;\n position: relative;\n}\n\n.x-sliding-panel__button {\n opacity: 0;\n pointer-events: none;\n position: absolute;\n transition: all ease-out 0.2s;\n z-index: 2; /* To overlay the design system gradient with z-index:1 */\n}\n.x-sliding-panel-button-left {\n left: var(--x-sliding-panel-buttons-distance, 0);\n}\n.x-sliding-panel-button-right {\n right: var(--x-sliding-panel-buttons-distance, 0);\n}\n\n.x-sliding-panel__scroll {\n display: flex;\n flex: 100%;\n flex-flow: row nowrap;\n overflow-x: auto;\n overflow-y: hidden;\n scrollbar-width: none; /* Firefox */\n -ms-overflow-style: none; /* IE */\n}\n\n/* Chrome, Edge & Safari */\n.x-sliding-panel__scroll::-webkit-scrollbar {\n display: none;\n}\n\n.x-sliding-panel__scroll > * {\n flex: 0 0 auto;\n}\n\n/* prettier-ignore */\n.x-sliding-panel:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-start) .x-sliding-panel-button-left {\n opacity: 1;\n pointer-events: all;\n }\n\n/* prettier-ignore */\n.x-sliding-panel:not(.x-sliding-panel-show-buttons-on-hover):not(.x-sliding-panel-at-end) .x-sliding-panel-button-right {\n opacity: 1;\n pointer-events: all;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events.\n\n## See it in action\n\nSimplest implementation of the component, just a list-based component inside its slot.\n\n```vue\n<template>\n <SlidingPanel>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n### Play with props\n\n#### Modifying scroll buttons travel distance\n\nEdit how much the scroll travels when navigating with the buttons by changing the `scrollFactor`\nprop.\n\n```vue\n<template>\n <SlidingPanel :scrollFactor=\"1.5\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Hiding scroll buttons\n\nHide the navigational buttons completely by setting the `showButtons` prop to `false`. This is\nintended to be used when other scrolling options are available, like in mobile, where you can scroll\njust by swiping.\n\n```vue\n<template>\n <SlidingPanel :showButtons=\"false\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Customizing the content with classes\n\nThe `buttonClass` prop can be used to add classes to the buttons.\n\nThe `scrollContainerClass` prop can be used to add classes to the scroll content.\n\n```vue\n<template>\n <SlidingPanel buttonClass=\"x-button--round\" scrollContainerClass=\"x-sliding-panel-fade\">\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n#### Disabling reset the scroll when content changes\n\nBy default, whenever the content of the sliding panel changes, it auto resets its scroll position.\nYou can disable this behavior setting the `resetOnContentChange` prop to `false`.\n\n```vue\n<template>\n <div>\n <button @click=\"items++\">Add item</button>\n <label>\n <input type=\"checkbox\" v-model=\"resetOnContentChange\" />\n Reset content onchange\n </label>\n <SlidingPanel :resetOnContentChange=\"resetOnContentChange\">\n <div class=\"item\" v-for=\"item in items\" :key=\"item\">Item {{ item }}</div>\n </SlidingPanel>\n </div>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n data() {\n return {\n items: 4,\n resetOnContentChange: false,\n }\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n\n## Extending the component\n\n### Overriding Button content\n\nBy default the buttons show an arrow depicting the direction the scroll would go to when clicked,\nbut this content can be customized with anything, from characters to SVG and images.\n\n```vue\n<template>\n <SlidingPanel>\n <template #sliding-panel-left-button>Left</template>\n <template #default>\n <div class=\"item\">Item 1</div>\n <div class=\"item\">Item 2</div>\n <div class=\"item\">Item 3</div>\n <div class=\"item\">Item 4</div>\n </template>\n <template #sliding-panel-right-button>Right</template>\n </SlidingPanel>\n</template>\n\n<script>\nimport { SlidingPanel } from '@empathyco/x-components'\n\nexport default {\n name: 'SlidingPanelDemo',\n components: {\n SlidingPanel,\n },\n}\n</script>\n\n<style>\n.x-sliding-panel {\n width: 200px;\n}\n\n.item {\n display: inline-block;\n width: 100px;\n}\n</style>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_createElementVNode","_renderSlot","_Fragment","_createTextVNode"],"mappings":";;;;;;AACa,EAAA,OAAA,IAAA,CAAA,KAAA,CAAM,OAAjB,IAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,IA+BM,KAAA;AAAA,IAAA;AAAA,MAAA,GAAA,EAAA,CAAA;MA/BoB,KAAK,EAAAC,cAAA,CAAA,CAAC,mBAA0B,IAAU,CAAA,UAAA,CAAA,CAAA;AAAA,MAAE,WAAU,EAAA,eAAA;AAAA,KAAA;;AAC9E,MAAAC,kBAAA;AAAA,QAQM,KAAA;AAAA,QAAA;AAAA,UAPJ,GAAI,EAAA,oBAAA;AAAA,UACH,KAAA,EAAKD,cAAE,CAAA,CAAA,IAAA,CAAA,oBAAA,EACF,yBAAyB,CAAA,CAAA;AAAA,UAC/B,WAAU,EAAA,sBAAA;AAAA,SAAA;;UAGVE,UAAQ,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAAA,EAAA,KAAA,CAAA,EAAA,IAAA,CAAA;AAAA,SAAA;;;;MAEVA,UAAoF,CAAA,IAAA,CAAA,MAAA,EAAA,sBAAA,EAAA;AAAA,QAAjD,YAAe,EAAA,IAAA,CAAA,YAAA;AAAA,QAAe,MAAQ,EAAA,IAAA,CAAA,OAAA;AAAA,OAAA,EAAA,KAAA,CAAA,EAAA,IAAA,CAAA;MACzD,IAAhB,CAAA,WAAA,IAAAJ,SAAA,EAAA,EAAAC,kBAAA;AAAA,QAmBWI,QAAA;AAAA,QAAA,EAAA,GAAA,EAAA,CAAA,EAAA;AAAA,QAAA;AAAA,UAlBTF,kBAAA;AAAA,YAQS,QAAA;AAAA,YAAA;AAAA,cAPP,KAAA,EAAKD,cAAC,CAAA,CAAA,8DAAA,EACE,IAAW,CAAA,WAAA,CAAA,CAAA;AAAA,cACnB,WAAU,EAAA,2BAAA;AAAA,cACT,OAAA,EAAK,MAAE,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,MAAA,KAAA,IAAA,CAAA,OAAA,IAAW,IAAqB,CAAA,kBAAA,GAAA,IAAA,CAAA,YAAA,CAAA;AAAA,aAAA;;AAGxC,cAAAE,UAAA,CAA+C,8CAA/C,MAA+C;AAAA,gBAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAAE,eAAA;AAAR,kBAAA,GAAA;AAAA,kBAAC,CAAA,CAAA;AAAA;AAAA,iBAAA,CAAA;AAAA,eAAA,EAAA,IAAA,CAAA;;;;;AAE1C,UAAAH,kBAAA;AAAA,YAQS,QAAA;AAAA,YAAA;AAAA,cAPP,KAAA,EAAKD,cAAC,CAAA,CAAA,+DAAA,EACE,IAAW,CAAA,WAAA,CAAA,CAAA;AAAA,cACnB,WAAU,EAAA,4BAAA;AAAA,cACT,OAAA,EAAK,MAAE,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,MAAA,KAAA,IAAA,CAAA,OAAA,IAAW,IAAqB,CAAA,kBAAA,GAAA,IAAA,CAAA,YAAA,CAAA;AAAA,aAAA;;AAGxC,cAAAE,UAAA,CAAgD,+CAAhD,MAAgD;AAAA,gBAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAAE,eAAA;AAAR,kBAAA,GAAA;AAAA,kBAAC,CAAA,CAAA;AAAA;AAAA,iBAAA,CAAA;AAAA,eAAA,EAAA,IAAA,CAAA;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-suggestion.vue.js","sources":["../../../../src/components/suggestions/base-suggestion.vue"],"sourcesContent":["<template>\n <button ref=\"el\" :class=\"dynamicCSSClasses\" @click=\"emitEvents\">\n <!--\n @slot Button content\n @binding {Suggestion} suggestion - Suggestion data\n @binding {String} query - The query that the suggestion belongs to\n @binding {Filter} filter - Suggestion's filter\n -->\n <slot v-bind=\"{ query, suggestion, filter }\">\n <Highlight class=\"x-suggestion__query\" :text=\"suggestion.query\" :highlight=\"query\" />\n <span v-if=\"filter\" class=\"x-suggestion__filter\">{{ filter.label }}</span>\n </slot>\n </button>\n</template>\n\n<script lang=\"ts\">\nimport type { BooleanFilter, Suggestion } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { QueryFeature } from '../../types'\nimport type { VueCSSClasses } from '../../utils/types'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport { forEach } from '@empathyco/x-utils'\nimport { computed, defineComponent, ref } from 'vue'\nimport { use$x } from '../../composables/index'\nimport Highlight from '../highlight.vue'\n\n/**\n * Renders a button with a default slot. It receives a query, which should be the query of the\n * module using this component, a suggestion, the {@link XEvent} that will be emitted\n * on click with a given feature.\n *\n * The default slot receives the suggestion and the matched query has props.\n *\n * @public\n */\nexport default defineComponent({\n components: { Highlight },\n props: {\n /**\n * The normalized query of the module using this component.\n *\n * @public\n */\n query: {\n type: String,\n default: '',\n },\n\n /**\n * The suggestion to render and use in the default slot.\n *\n * @public\n */\n suggestion: {\n type: Object as PropType<Suggestion>,\n required: true,\n },\n\n /**\n * The feature from which the events will be emitted.\n *\n * @public\n */\n //TODO: set to true when the suggestions components pass it.\n feature: {\n type: String as PropType<QueryFeature>,\n },\n\n /**\n * The {@link XEvent} that will be emitted when selecting a suggestion.\n *\n * @public\n */\n suggestionSelectedEvents: {\n type: Object as PropType<Partial<XEventsTypes>>,\n required: true,\n },\n\n /**\n * Indicates if the curated suggestion should be highlighted.\n *\n * @public\n */\n highlightCurated: {\n type: Boolean,\n },\n },\n\n setup(props) {\n const el = ref<HTMLElement | null>(null)\n\n const $x = use$x()\n\n /**\n * Returns the suggestion filter object.\n * It is a BooleanFilter because the label is needed.\n * It returns only the first element because the facets and filters are being planned\n * in the BaseSuggestions component.\n *\n * @returns The filter.\n * @public\n */\n const filter = computed<BooleanFilter | undefined>(\n () => props.suggestion.facets?.[0]?.filters[0] as BooleanFilter,\n )\n\n /**\n * The event handler that will be triggered when clicking on a suggestion.\n *\n * @remarks\n * UserAcceptedAQuery: suggestion.query\n * UserSelectedASuggestion: suggestion\n * UserClickedAFilter: suggestion.facets[0].filters[0]\n * Merges the events defined in the suggestionSelectedEvents prop and also emits them\n *\n * @returns The {@link XEvent} to emit.\n * @public\n */\n const events = computed<Partial<XEventsTypes>>(() => {\n const filterEvent: Partial<XEventsTypes> = filter.value\n ? { UserClickedAFilter: filter.value }\n : {}\n return {\n UserAcceptedAQuery: props.suggestion.query,\n UserSelectedASuggestion: props.suggestion,\n ...props.suggestionSelectedEvents,\n ...filterEvent,\n }\n })\n\n /**\n * Emits the events when the button is clicked.\n *\n * @public\n */\n const emitEvents = (): void => {\n forEach(events.value, (event, payload): void => {\n $x.emit(event, payload, {\n target: el.value!,\n feature: props.feature,\n })\n })\n }\n\n /**\n * Checks if the suggestion is curated and if it should be highlighted.\n *\n * @returns True if the suggestion is curated and should be highlighted.\n *\n * @internal\n */\n const shouldHighlightCurated = computed<boolean>(\n () => props.highlightCurated && !!props.suggestion.isCurated,\n )\n\n /**\n * Generates css classes dynamically.\n *\n * @remarks\n * 'x-suggestion--matching added when the query should be matched.\n *\n * @returns The {@link VueCSSClasses} classes.\n * @public\n */\n const dynamicCSSClasses = computed<VueCSSClasses>(() => ({\n 'x-suggestion--is-curated': shouldHighlightCurated.value,\n }))\n\n return {\n el,\n filter,\n emitEvents,\n dynamicCSSClasses,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`UserAcceptedAQuery`](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 suggestion query\n data.\n- [`UserSelectedASuggestion`](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 suggestion data.\n- [`UserClickedAFilter`](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 if the suggestion includes a filter. The\n event payload is the suggestion filter.\n- The component can emit more events on click using the `suggestionSelectedEvents` prop.\n\n## See it in action\n\nThis suggestion component expects a suggestion to render and pass to its default slot, a normalized\nquery to compare with the suggestion's query and highlight its matching parts, and events to emit\nwhen the suggestion is selected.\n\nIf the suggestion contains a filter, it is displayed next to the suggestion.\n\n```vue live\n<template>\n <BaseSuggestion v-bind=\"{ query, suggestion }\" />\n</template>\n<script>\nimport { BaseSuggestion } from '@empathyco/x-components'\n\nexport default {\n name: 'BaseSuggestionDemo',\n components: {\n BaseSuggestion,\n },\n data() {\n return {\n query: 'st',\n suggestion: {\n modelName: 'QuerySuggestion',\n query: 'steak',\n facet: {\n namedModel: 'SimpleFacet',\n id: 'category',\n label: 'Category',\n filters: [\n {\n id: 'category:groceries',\n modelName: 'SimpleFilter',\n facetId: 'category-facet',\n label: 'Groceries',\n selected: false,\n totalResults: 10,\n },\n ],\n },\n },\n }\n },\n}\n</script>\n```\n\n### Customise the content\n\nYou can make this component render any content you want by using the `default` slot.\n\n```vue live\n<template>\n <BaseSuggestion v-bind=\"{ query, suggestion }\" #default=\"{ suggestion, query, filter }\">\n <span>🔍</span>\n <Highlight :text=\"suggestion.query\" :highlight=\"query\" />\n <span v-if=\"filter\">{{ filter.label }}</span>\n </BaseSuggestion>\n</template>\n<script>\nimport { BaseSuggestion } from '@empathyco/x-components'\n\nexport default {\n name: 'BaseSuggestionDemo',\n components: {\n BaseSuggestion,\n },\n data() {\n return {\n query: 'st',\n suggestion: {\n modelName: 'QuerySuggestion',\n query: 'steak',\n },\n }\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_renderSlot","
|
|
1
|
+
{"version":3,"file":"base-suggestion.vue.js","sources":["../../../../src/components/suggestions/base-suggestion.vue"],"sourcesContent":["<template>\n <button ref=\"el\" :class=\"dynamicCSSClasses\" @click=\"emitEvents\">\n <!--\n @slot Button content\n @binding {Suggestion} suggestion - Suggestion data\n @binding {String} query - The query that the suggestion belongs to\n @binding {Filter} filter - Suggestion's filter\n -->\n <slot v-bind=\"{ query, suggestion, filter }\">\n <Highlight class=\"x-suggestion__query\" :text=\"suggestion.query\" :highlight=\"query\" />\n <span v-if=\"filter\" class=\"x-suggestion__filter\">{{ filter.label }}</span>\n </slot>\n </button>\n</template>\n\n<script lang=\"ts\">\nimport type { BooleanFilter, Suggestion } from '@empathyco/x-types'\nimport type { PropType } from 'vue'\nimport type { QueryFeature } from '../../types'\nimport type { VueCSSClasses } from '../../utils/types'\nimport type { XEventsTypes } from '../../wiring/events.types'\nimport { forEach } from '@empathyco/x-utils'\nimport { computed, defineComponent, ref } from 'vue'\nimport { use$x } from '../../composables/index'\nimport Highlight from '../highlight.vue'\n\n/**\n * Renders a button with a default slot. It receives a query, which should be the query of the\n * module using this component, a suggestion, the {@link XEvent} that will be emitted\n * on click with a given feature.\n *\n * The default slot receives the suggestion and the matched query has props.\n *\n * @public\n */\nexport default defineComponent({\n components: { Highlight },\n props: {\n /**\n * The normalized query of the module using this component.\n *\n * @public\n */\n query: {\n type: String,\n default: '',\n },\n\n /**\n * The suggestion to render and use in the default slot.\n *\n * @public\n */\n suggestion: {\n type: Object as PropType<Suggestion>,\n required: true,\n },\n\n /**\n * The feature from which the events will be emitted.\n *\n * @public\n */\n //TODO: set to true when the suggestions components pass it.\n feature: {\n type: String as PropType<QueryFeature>,\n },\n\n /**\n * The {@link XEvent} that will be emitted when selecting a suggestion.\n *\n * @public\n */\n suggestionSelectedEvents: {\n type: Object as PropType<Partial<XEventsTypes>>,\n required: true,\n },\n\n /**\n * Indicates if the curated suggestion should be highlighted.\n *\n * @public\n */\n highlightCurated: {\n type: Boolean,\n },\n },\n\n setup(props) {\n const el = ref<HTMLElement | null>(null)\n\n const $x = use$x()\n\n /**\n * Returns the suggestion filter object.\n * It is a BooleanFilter because the label is needed.\n * It returns only the first element because the facets and filters are being planned\n * in the BaseSuggestions component.\n *\n * @returns The filter.\n * @public\n */\n const filter = computed<BooleanFilter | undefined>(\n () => props.suggestion.facets?.[0]?.filters[0] as BooleanFilter,\n )\n\n /**\n * The event handler that will be triggered when clicking on a suggestion.\n *\n * @remarks\n * UserAcceptedAQuery: suggestion.query\n * UserSelectedASuggestion: suggestion\n * UserClickedAFilter: suggestion.facets[0].filters[0]\n * Merges the events defined in the suggestionSelectedEvents prop and also emits them\n *\n * @returns The {@link XEvent} to emit.\n * @public\n */\n const events = computed<Partial<XEventsTypes>>(() => {\n const filterEvent: Partial<XEventsTypes> = filter.value\n ? { UserClickedAFilter: filter.value }\n : {}\n return {\n UserAcceptedAQuery: props.suggestion.query,\n UserSelectedASuggestion: props.suggestion,\n ...props.suggestionSelectedEvents,\n ...filterEvent,\n }\n })\n\n /**\n * Emits the events when the button is clicked.\n *\n * @public\n */\n const emitEvents = (): void => {\n forEach(events.value, (event, payload): void => {\n $x.emit(event, payload, {\n target: el.value!,\n feature: props.feature,\n })\n })\n }\n\n /**\n * Checks if the suggestion is curated and if it should be highlighted.\n *\n * @returns True if the suggestion is curated and should be highlighted.\n *\n * @internal\n */\n const shouldHighlightCurated = computed<boolean>(\n () => props.highlightCurated && !!props.suggestion.isCurated,\n )\n\n /**\n * Generates css classes dynamically.\n *\n * @remarks\n * 'x-suggestion--matching added when the query should be matched.\n *\n * @returns The {@link VueCSSClasses} classes.\n * @public\n */\n const dynamicCSSClasses = computed<VueCSSClasses>(() => ({\n 'x-suggestion--is-curated': shouldHighlightCurated.value,\n }))\n\n return {\n el,\n filter,\n emitEvents,\n dynamicCSSClasses,\n }\n },\n})\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the following events:\n\n- [`UserAcceptedAQuery`](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 suggestion query\n data.\n- [`UserSelectedASuggestion`](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 suggestion data.\n- [`UserClickedAFilter`](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 if the suggestion includes a filter. The\n event payload is the suggestion filter.\n- The component can emit more events on click using the `suggestionSelectedEvents` prop.\n\n## See it in action\n\nThis suggestion component expects a suggestion to render and pass to its default slot, a normalized\nquery to compare with the suggestion's query and highlight its matching parts, and events to emit\nwhen the suggestion is selected.\n\nIf the suggestion contains a filter, it is displayed next to the suggestion.\n\n```vue live\n<template>\n <BaseSuggestion v-bind=\"{ query, suggestion }\" />\n</template>\n<script>\nimport { BaseSuggestion } from '@empathyco/x-components'\n\nexport default {\n name: 'BaseSuggestionDemo',\n components: {\n BaseSuggestion,\n },\n data() {\n return {\n query: 'st',\n suggestion: {\n modelName: 'QuerySuggestion',\n query: 'steak',\n facet: {\n namedModel: 'SimpleFacet',\n id: 'category',\n label: 'Category',\n filters: [\n {\n id: 'category:groceries',\n modelName: 'SimpleFilter',\n facetId: 'category-facet',\n label: 'Groceries',\n selected: false,\n totalResults: 10,\n },\n ],\n },\n },\n }\n },\n}\n</script>\n```\n\n### Customise the content\n\nYou can make this component render any content you want by using the `default` slot.\n\n```vue live\n<template>\n <BaseSuggestion v-bind=\"{ query, suggestion }\" #default=\"{ suggestion, query, filter }\">\n <span>🔍</span>\n <Highlight :text=\"suggestion.query\" :highlight=\"query\" />\n <span v-if=\"filter\">{{ filter.label }}</span>\n </BaseSuggestion>\n</template>\n<script>\nimport { BaseSuggestion } from '@empathyco/x-components'\n\nexport default {\n name: 'BaseSuggestionDemo',\n components: {\n BaseSuggestion,\n },\n data() {\n return {\n query: 'st',\n suggestion: {\n modelName: 'QuerySuggestion',\n query: 'steak',\n },\n }\n },\n}\n</script>\n```\n</docs>\n"],"names":["_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_createVNode","_toDisplayString","_createCommentVNode"],"mappings":";;;;;;EAU0B,KAAM,EAAA,sBAAA;;;;AAT9B,EAAA,OAAAA,SAAA,EAAA,EAAAC,kBAAA;AAAA,IAWS,QAAA;AAAA,IAAA;AAAA,MAXD,GAAI,EAAA,IAAA;AAAA,MAAM,KAAA,EAAKC,eAAE,IAAiB,CAAA,iBAAA,CAAA;AAAA,MAAG,SAAK,MAAE,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAA,IAAA,CAAA,UAAA,IAAA,IAAA,CAAA,UAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA,KAAA;;AAOlD,MAAAC,UAAA,CAGO,mEAHS,IAAK,CAAA,KAAA,EAAA,UAAA,EAAE,iBAAU,MAAE,EAAA,IAAA,CAAA,MAAA,MAAnC,MAGO;AAAA,QAFLC,WAAqF,CAAA,oBAAA,EAAA;AAAA,UAA1E,KAAM,EAAA,qBAAA;AAAA,UAAuB,MAAM,IAAW,CAAA,UAAA,CAAA,KAAA;AAAA,UAAQ,SAAW,EAAA,IAAA,CAAA,KAAA;AAAA,SAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,MAAA,EAAA,WAAA,CAAA,CAAA;QAChE,IAAZ,CAAA,MAAA,IAAAJ,SAAA,EAAA,EAAAC,kBAAA;AAAA,UAA0E,MAAA;AAAA,UAA1E,UAAA;AAAA,UAA0EI,eAAA,CAAtB,YAAO,KAAK,CAAA;AAAA,UAAA,CAAA;AAAA;AAAA,SAAA,IAAAC,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA;;;;;;;;;;;"}
|