@empathyco/x-components 6.0.0-alpha.3 → 6.0.0-alpha.30
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 +283 -1
- package/core/index.js +5 -1
- package/core/index.js.map +1 -1
- package/design-system/deprecated-full-theme.css +1339 -1339
- package/docs/API-reference/api/x-adapter-platform.md +9 -0
- package/docs/API-reference/api/x-adapter-platform.platformadapter.relatedprompts.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.md +22 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.nextqueries.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.suggestiontext.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedprompt.type.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptsrequest.md +15 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptsresponse.data.md +13 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptsresponse.md +21 -0
- package/docs/API-reference/api/x-adapter-platform.platformrelatedpromptsresponse.status.md +11 -0
- package/docs/API-reference/api/x-adapter-platform.platformsearchresponse.catalog.md +6 -0
- package/docs/API-reference/api/x-adapter-platform.platformsearchresponse.md +1 -1
- package/docs/API-reference/api/x-adapter-platform.relatedpromptschema.md +13 -0
- package/docs/API-reference/api/x-adapter-platform.relatedpromptsendpointadapter.md +13 -0
- package/docs/API-reference/api/x-adapter-platform.relatedpromptsrequestmapper.md +13 -0
- package/docs/API-reference/api/x-adapter-platform.relatedpromptsrequestschema.md +13 -0
- package/docs/API-reference/api/x-adapter-platform.relatedpromptsresponsemapper.md +13 -0
- package/docs/API-reference/api/x-adapter-platform.relatedpromptsresponseschema.md +13 -0
- package/docs/API-reference/api/x-components.animationprop.md +6 -1
- package/docs/API-reference/api/x-components.bannerslist.md +3 -3
- package/docs/API-reference/api/x-components.basedropdown.md +5 -5
- package/docs/API-reference/api/x-components.baseeventsmodal.md +2 -2
- package/docs/API-reference/api/x-components.basegrid.md +3 -3
- package/docs/API-reference/api/x-components.baseheadertogglepanel.md +5 -5
- package/docs/API-reference/api/x-components.baseidmodal.md +2 -2
- package/docs/API-reference/api/x-components.baseidtogglepanel.md +5 -5
- package/docs/API-reference/api/x-components.basemodal.md +10 -10
- package/docs/API-reference/api/x-components.baseresultimage.md +9 -9
- package/docs/API-reference/api/x-components.baseslider.md +70 -0
- package/docs/API-reference/api/x-components.basesuggestions.md +3 -3
- package/docs/API-reference/api/x-components.basetabspanel.md +8 -8
- package/docs/API-reference/api/x-components.basetogglepanel.md +3 -3
- package/docs/API-reference/api/x-components.basevariablecolumngrid.md +3 -3
- package/docs/API-reference/api/x-components.cancelfetchandsaverelatedprompts.md +13 -0
- package/docs/API-reference/api/x-components.configmutations.config.md +11 -0
- package/docs/API-reference/api/x-components.configmutations.md +29 -0
- package/docs/API-reference/api/x-components.configmutations.mergeconfig.md +24 -0
- package/docs/API-reference/api/x-components.configmutations.setconfig.md +24 -0
- package/docs/API-reference/api/x-components.createrelatedtagsquerygetter.md +26 -0
- package/docs/API-reference/api/x-components.createrelatedtagsquerygetteroptions.getrelatedtags.md +13 -0
- package/docs/API-reference/api/x-components.createrelatedtagsquerygetteroptions.md +20 -0
- package/docs/API-reference/api/x-components.empathize.md +5 -5
- package/docs/API-reference/api/x-components.empathizemutations.md +1 -1
- package/docs/API-reference/api/x-components.facets.md +3 -3
- package/docs/API-reference/api/x-components.facetsmutations.md +1 -1
- package/docs/API-reference/api/x-components.fetchandsaverelatedprompts.md +13 -0
- package/docs/API-reference/api/x-components.fetchrelatedprompts.md +13 -0
- package/docs/API-reference/api/x-components.filterslist.md +3 -3
- package/docs/API-reference/api/x-components.globalxbus.md +6 -0
- package/docs/API-reference/api/x-components.hierarchicalfilter.md +5 -2
- package/docs/API-reference/api/x-components.historyqueriesmutations.md +1 -1
- package/docs/API-reference/api/x-components.historyqueriesstate.md +1 -1
- package/docs/API-reference/api/x-components.identifierresults.md +3 -3
- package/docs/API-reference/api/x-components.identifierresultsmutations.md +1 -1
- package/docs/API-reference/api/x-components.identifierresultsstate.md +1 -1
- package/docs/API-reference/api/x-components.installxoptions.domelement.md +1 -1
- package/docs/API-reference/api/x-components.installxoptions.installextraplugins.md +2 -2
- package/docs/API-reference/api/x-components.installxoptions.md +1 -1
- package/docs/API-reference/api/x-components.itemslist.md +3 -3
- package/docs/API-reference/api/x-components.mainmodal.md +2 -2
- package/docs/API-reference/api/x-components.md +26 -1
- package/docs/API-reference/api/x-components.mergeconfig.md +27 -0
- package/docs/API-reference/api/x-components.multicolumnmaxwidthlayout.md +5 -5
- package/docs/API-reference/api/x-components.myhistory.md +3 -3
- package/docs/API-reference/api/x-components.nextqueriesgroup.md +22 -0
- package/docs/API-reference/api/x-components.nextqueriesgroup.modelname.md +11 -0
- package/docs/API-reference/api/x-components.nextqueriesgroup.nextqueries.md +11 -0
- package/docs/API-reference/api/x-components.nextquerieslist.md +3 -3
- package/docs/API-reference/api/x-components.nextqueriesmutations.md +1 -1
- package/docs/API-reference/api/x-components.nextqueriesstate.md +1 -1
- package/docs/API-reference/api/x-components.partialresultslist.md +3 -3
- package/docs/API-reference/api/x-components.popularsearchesmutations.md +1 -1
- package/docs/API-reference/api/x-components.promotedslist.md +3 -3
- package/docs/API-reference/api/x-components.queriespreviewmutations.md +1 -1
- package/docs/API-reference/api/x-components.querymutations.md +20 -0
- package/docs/API-reference/api/x-components.querymutations.setquery.md +24 -0
- package/docs/API-reference/api/x-components.querypreviewlist.md +3 -3
- package/docs/API-reference/api/x-components.querystate.md +20 -0
- package/docs/API-reference/api/x-components.querystate.query.md +13 -0
- package/docs/API-reference/api/x-components.querysuggestionsmutations.md +1 -1
- package/docs/API-reference/api/x-components.querysuggestionsstate.md +1 -1
- package/docs/API-reference/api/x-components.recommendations.md +3 -3
- package/docs/API-reference/api/x-components.recommendationsmutations.md +1 -1
- package/docs/API-reference/api/x-components.relatedprompt.md +54 -0
- package/docs/API-reference/api/x-components.relatedpromptrequest.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsactioncontext.md +15 -0
- package/docs/API-reference/api/x-components.relatedpromptsactions.cancelfetchandsaverelatedprompts.md +17 -0
- package/docs/API-reference/api/x-components.relatedpromptsactions.fetchandsaverelatedprompts.md +24 -0
- package/docs/API-reference/api/x-components.relatedpromptsactions.fetchrelatedprompts.md +24 -0
- package/docs/API-reference/api/x-components.relatedpromptsactions.md +22 -0
- package/docs/API-reference/api/x-components.relatedpromptsgetters.md +20 -0
- package/docs/API-reference/api/x-components.relatedpromptsgetters.request.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptslist.md +72 -0
- package/docs/API-reference/api/x-components.relatedpromptsmutations.md +26 -0
- package/docs/API-reference/api/x-components.relatedpromptsmutations.resetrelatedpromptsstate.md +17 -0
- package/docs/API-reference/api/x-components.relatedpromptsmutations.resetselectedprompt.md +17 -0
- package/docs/API-reference/api/x-components.relatedpromptsmutations.setparams.md +24 -0
- package/docs/API-reference/api/x-components.relatedpromptsmutations.setrelatedpromptsproducts.md +24 -0
- package/docs/API-reference/api/x-components.relatedpromptsmutations.setselectedprompt.md +24 -0
- package/docs/API-reference/api/x-components.relatedpromptsmutations.setselectedquery.md +24 -0
- package/docs/API-reference/api/x-components.relatedpromptsstate.md +24 -0
- package/docs/API-reference/api/x-components.relatedpromptsstate.params.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsstate.relatedprompts.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsstate.selectedprompt.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsstate.selectedquery.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptstaglist.md +22 -0
- package/docs/API-reference/api/x-components.relatedpromptsxevents.md +22 -0
- package/docs/API-reference/api/x-components.relatedpromptsxevents.relatedpromptsrequestupdated.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsxevents.userselectedarelatedprompt.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsxevents.userselectedarelatedpromptquery.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsxmodule.md +13 -0
- package/docs/API-reference/api/x-components.relatedpromptsxstoremodule.md +15 -0
- package/docs/API-reference/api/x-components.relatedtags.md +3 -3
- package/docs/API-reference/api/x-components.relatedtagsmutations.md +1 -1
- package/docs/API-reference/api/x-components.relatedtagsstate.md +1 -1
- package/docs/API-reference/api/x-components.resultslist.md +3 -3
- package/docs/API-reference/api/x-components.scrolltotop.md +5 -5
- package/docs/API-reference/api/x-components.searchboxmutations.md +1 -1
- package/docs/API-reference/api/x-components.searchboxstate.md +1 -1
- package/docs/API-reference/api/x-components.searchinputplaceholder.md +3 -3
- package/docs/API-reference/api/x-components.searchmutations.md +2 -1
- package/docs/API-reference/api/x-components.searchmutations.setstats.md +24 -0
- package/docs/API-reference/api/x-components.searchstate.md +2 -1
- package/docs/API-reference/api/x-components.searchstate.stats.md +13 -0
- package/docs/API-reference/api/x-components.selectedfilterslist.md +3 -3
- package/docs/API-reference/api/x-components.semanticqueriesmutations.md +1 -1
- package/docs/API-reference/api/x-components.semanticqueriesstate.md +1 -1
- package/docs/API-reference/api/x-components.setconfig.md +27 -0
- package/docs/API-reference/api/x-components.setquery.md +25 -0
- package/docs/API-reference/api/x-components.simplefilter.md +3 -0
- package/docs/API-reference/api/x-components.singlecolumnlayout.md +3 -3
- package/docs/API-reference/api/x-components.snippetcallbacks.md +3 -0
- package/docs/API-reference/api/x-components.snippetconfigextraparams.md +1 -1
- package/docs/API-reference/api/x-components.sortdropdown.md +1 -1
- package/docs/API-reference/api/x-components.tagging.md +17 -4
- package/docs/API-reference/api/x-components.taggingmutations.md +1 -1
- package/docs/API-reference/api/x-components.urlmutations.md +1 -1
- package/docs/API-reference/api/x-components.urlstate.md +1 -1
- package/docs/API-reference/api/x-components.usealiasapi.md +1 -0
- package/docs/API-reference/api/x-components.usealiasapi.pricestats.md +16 -0
- package/docs/API-reference/api/x-components.xeventstypes.md +3 -3
- package/docs/API-reference/api/x-components.xmodulestree.md +1 -0
- package/docs/API-reference/api/x-components.xmodulestree.relatedprompts.md +11 -0
- package/docs/API-reference/api/x-types.md +4 -0
- package/docs/API-reference/api/x-types.relatedprompt.md +23 -0
- package/docs/API-reference/api/x-types.relatedprompt.nextqueries.md +13 -0
- package/docs/API-reference/api/x-types.relatedprompt.suggestiontext.md +13 -0
- package/docs/API-reference/api/x-types.relatedprompt.type.md +13 -0
- package/docs/API-reference/api/x-types.relatedpromptsrequest.md +15 -0
- package/docs/API-reference/api/x-types.relatedpromptsresponse.md +20 -0
- package/docs/API-reference/api/x-types.relatedpromptsresponse.relatedprompts.md +11 -0
- package/docs/API-reference/api/x-types.searchresponse.md +1 -0
- package/docs/API-reference/api/x-types.searchresponse.stats.md +11 -0
- package/docs/API-reference/api/x-types.stats.md +22 -0
- package/docs/API-reference/api/x-types.stats.price.md +14 -0
- package/docs/API-reference/api/x-types.xcomponentsadapter.md +1 -0
- package/docs/API-reference/api/x-types.xcomponentsadapter.relatedprompts.md +11 -0
- package/docs/API-reference/components/common/result/x-components.base-result-image.md +2 -2
- package/docs/API-reference/components/common/x-components.base-slider.md +189 -0
- package/docs/API-reference/components/common/x-components.items-list.md +1 -1
- package/docs/API-reference/components/facets/x-components.facets/facets.md +1 -1
- package/docs/API-reference/components/facets/x-components.lists/selected-filters-list.md +1 -1
- package/docs/API-reference/components/related-prompts/x-components.related-prompt.md +26 -0
- package/docs/API-reference/components/related-prompts/x-components.related-prompts-list.md +196 -0
- package/docs/API-reference/components/related-prompts/x-components.related-prompts-tag-list.md +23 -0
- package/docs/API-reference/components/search/x-components.results-list.md +1 -1
- package/docs/API-reference/components/tagging/x-components.tagging.md +2 -2
- package/js/components/animations/fade-and-slide.vue.js +1 -2
- package/js/components/animations/fade-and-slide.vue.js.map +1 -1
- package/js/components/base-dropdown.vue.js +1 -3
- package/js/components/base-dropdown.vue.js.map +1 -1
- package/js/components/base-dropdown.vue2.js +1 -7
- package/js/components/base-dropdown.vue2.js.map +1 -1
- package/js/components/base-event-button.vue.js +1 -2
- package/js/components/base-event-button.vue.js.map +1 -1
- package/js/components/base-grid.vue.js +11 -18
- package/js/components/base-grid.vue.js.map +1 -1
- package/js/components/base-grid.vue2.js.map +1 -1
- package/js/components/base-grid.vue3.js +1 -1
- package/js/components/base-keyboard-navigation.vue.js +1 -2
- package/js/components/base-keyboard-navigation.vue.js.map +1 -1
- package/js/components/base-rating.vue.js +1 -3
- package/js/components/base-rating.vue.js.map +1 -1
- package/js/components/base-slider.vue.js +65 -0
- package/js/components/base-slider.vue.js.map +1 -0
- package/js/components/base-slider.vue2.js +109 -0
- package/js/components/base-slider.vue2.js.map +1 -0
- package/js/components/base-slider.vue3.js +7 -0
- package/js/components/base-slider.vue3.js.map +1 -0
- package/js/components/base-variable-column-grid.vue.js +1 -2
- package/js/components/base-variable-column-grid.vue.js.map +1 -1
- package/js/components/column-picker/base-column-picker-dropdown.vue.js +1 -3
- 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 +1 -3
- package/js/components/column-picker/base-column-picker-list.vue.js.map +1 -1
- package/js/components/filters/labels/base-rating-filter-label.vue.js +1 -3
- package/js/components/filters/labels/base-rating-filter-label.vue.js.map +1 -1
- package/js/components/icons/cross-tiny.vue.js +2 -2
- package/js/components/icons/plus.vue.js +2 -2
- package/js/components/items-list.vue.js +1 -2
- package/js/components/items-list.vue.js.map +1 -1
- package/js/components/items-list.vue2.js +2 -2
- package/js/components/items-list.vue2.js.map +1 -1
- package/js/components/layouts/fixed-header-and-asides-layout.vue.js +1 -7
- 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 +1 -9
- package/js/components/layouts/multi-column-max-width-layout.vue.js.map +1 -1
- package/js/components/layouts/single-column-layout.vue.js +1 -9
- package/js/components/layouts/single-column-layout.vue.js.map +1 -1
- package/js/components/modals/base-events-modal-close.vue.js +1 -2
- package/js/components/modals/base-events-modal-close.vue.js.map +1 -1
- package/js/components/modals/base-events-modal-open.vue.js +1 -2
- package/js/components/modals/base-events-modal-open.vue.js.map +1 -1
- package/js/components/modals/base-id-modal-close.vue.js +1 -2
- package/js/components/modals/base-id-modal-close.vue.js.map +1 -1
- package/js/components/modals/base-id-modal-open.vue.js +1 -2
- package/js/components/modals/base-id-modal-open.vue.js.map +1 -1
- package/js/components/modals/base-modal.vue.js +1 -2
- package/js/components/modals/base-modal.vue.js.map +1 -1
- package/js/components/modals/base-modal.vue2.js +13 -6
- package/js/components/modals/base-modal.vue2.js.map +1 -1
- package/js/components/page-loader-button.vue.js +1 -4
- package/js/components/page-loader-button.vue.js.map +1 -1
- package/js/components/panels/base-header-toggle-panel.vue.js +1 -5
- package/js/components/panels/base-header-toggle-panel.vue.js.map +1 -1
- package/js/components/panels/base-id-toggle-panel-button.vue.js +1 -2
- package/js/components/panels/base-id-toggle-panel-button.vue.js.map +1 -1
- package/js/components/panels/base-id-toggle-panel.vue.js +1 -2
- package/js/components/panels/base-id-toggle-panel.vue.js.map +1 -1
- package/js/components/panels/base-tabs-panel.vue.js +1 -4
- package/js/components/panels/base-tabs-panel.vue.js.map +1 -1
- package/js/components/panels/base-toggle-panel.vue.js +1 -2
- package/js/components/panels/base-toggle-panel.vue.js.map +1 -1
- package/js/components/result/base-result-add-to-cart.vue.js +1 -2
- package/js/components/result/base-result-add-to-cart.vue.js.map +1 -1
- package/js/components/result/base-result-current-price.vue.js +1 -2
- package/js/components/result/base-result-current-price.vue.js.map +1 -1
- package/js/components/result/base-result-image.vue.js +39 -59
- package/js/components/result/base-result-image.vue.js.map +1 -1
- package/js/components/result/base-result-image.vue2.js +5 -5
- package/js/components/result/base-result-image.vue2.js.map +1 -1
- package/js/components/result/base-result-link.vue.js +1 -2
- package/js/components/result/base-result-link.vue.js.map +1 -1
- package/js/components/result/base-result-previous-price.vue.js +1 -2
- package/js/components/result/base-result-previous-price.vue.js.map +1 -1
- package/js/components/result/base-result-rating.vue.js +1 -4
- package/js/components/result/base-result-rating.vue.js.map +1 -1
- package/js/components/result/result-variant-selector.vue.js +1 -3
- package/js/components/result/result-variant-selector.vue.js.map +1 -1
- package/js/components/sliding-panel.vue.js +3 -6
- package/js/components/sliding-panel.vue.js.map +1 -1
- package/js/components/suggestions/base-suggestion.vue.js +1 -2
- package/js/components/suggestions/base-suggestion.vue.js.map +1 -1
- package/js/components/suggestions/base-suggestions.vue.js +1 -2
- package/js/components/suggestions/base-suggestions.vue.js.map +1 -1
- package/js/composables/use-alias-api.js +4 -1
- package/js/composables/use-alias-api.js.map +1 -1
- package/js/composables/use-getter.js +1 -1
- package/js/composables/use-state.js +1 -1
- package/js/index.js +15 -1
- package/js/index.js.map +1 -1
- package/js/types/animation-prop.js +5 -0
- package/js/types/animation-prop.js.map +1 -1
- package/js/x-installer/x-installer/x-installer.js +3 -3
- package/js/x-installer/x-installer/x-installer.js.map +1 -1
- package/js/x-modules/device/store/emitters.js +1 -0
- package/js/x-modules/device/store/emitters.js.map +1 -1
- package/js/x-modules/empathize/components/empathize.vue.js +1 -2
- package/js/x-modules/empathize/components/empathize.vue.js.map +1 -1
- package/js/x-modules/empathize/components/empathize.vue2.js +2 -0
- package/js/x-modules/empathize/components/empathize.vue2.js.map +1 -1
- package/js/x-modules/empathize/store/emitters.js +1 -0
- package/js/x-modules/empathize/store/emitters.js.map +1 -1
- package/js/x-modules/experience-controls/store/emitters.js +1 -0
- package/js/x-modules/experience-controls/store/emitters.js.map +1 -1
- package/js/x-modules/extra-params/components/snippet-config-extra-params.vue.js.map +1 -1
- package/js/x-modules/extra-params/components/snippet-config-extra-params.vue2.js +1 -1
- package/js/x-modules/extra-params/components/snippet-config-extra-params.vue2.js.map +1 -1
- package/js/x-modules/extra-params/store/emitters.js +1 -0
- package/js/x-modules/extra-params/store/emitters.js.map +1 -1
- package/js/x-modules/facets/components/facets/facets.vue.js +20 -33
- package/js/x-modules/facets/components/facets/facets.vue.js.map +1 -1
- package/js/x-modules/facets/components/facets/facets.vue2.js +2 -2
- package/js/x-modules/facets/components/facets/facets.vue2.js.map +1 -1
- package/js/x-modules/facets/components/filters/all-filter.vue.js +1 -2
- 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 +1 -6
- 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 +1 -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 +1 -3
- 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 +1 -3
- 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 +1 -2
- 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 +1 -3
- 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 +11 -18
- package/js/x-modules/facets/components/lists/selected-filters-list.vue.js.map +1 -1
- package/js/x-modules/facets/components/lists/selected-filters-list.vue2.js +2 -2
- package/js/x-modules/facets/components/lists/selected-filters-list.vue2.js.map +1 -1
- package/js/x-modules/facets/components/lists/sliced-filters.vue.js +1 -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 +1 -2
- 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 +1 -10
- 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 +1 -6
- 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 +1 -4
- 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 +1 -2
- package/js/x-modules/history-queries/components/remove-history-query.vue.js.map +1 -1
- package/js/x-modules/history-queries/store/emitters.js +1 -0
- package/js/x-modules/history-queries/store/emitters.js.map +1 -1
- package/js/x-modules/identifier-results/components/identifier-results.vue.js +1 -2
- package/js/x-modules/identifier-results/components/identifier-results.vue.js.map +1 -1
- package/js/x-modules/identifier-results/store/emitters.js +1 -0
- package/js/x-modules/identifier-results/store/emitters.js.map +1 -1
- package/js/x-modules/next-queries/components/next-queries.vue.js +1 -7
- 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 +1 -3
- 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 +1 -4
- package/js/x-modules/next-queries/components/next-query.vue.js.map +1 -1
- package/js/x-modules/next-queries/store/emitters.js +1 -0
- package/js/x-modules/next-queries/store/emitters.js.map +1 -1
- package/js/x-modules/popular-searches/components/popular-search.vue.js +1 -4
- 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 +1 -7
- 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 +1 -2
- package/js/x-modules/queries-preview/components/query-preview-button.vue.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview-button.vue2.js +2 -0
- package/js/x-modules/queries-preview/components/query-preview-button.vue2.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-list.vue2.js +15 -2
- package/js/x-modules/queries-preview/components/query-preview-list.vue2.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview.vue.js +1 -2
- package/js/x-modules/queries-preview/components/query-preview.vue.js.map +1 -1
- package/js/x-modules/queries-preview/components/query-preview.vue2.js +3 -1
- package/js/x-modules/queries-preview/components/query-preview.vue2.js.map +1 -1
- package/js/x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.js +2 -1
- package/js/x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.js.map +1 -1
- package/js/x-modules/queries-preview/store/emitters.js +1 -0
- package/js/x-modules/queries-preview/store/emitters.js.map +1 -1
- package/js/x-modules/queries-preview/store/module.js +1 -1
- package/js/x-modules/queries-preview/store/module.js.map +1 -1
- package/js/x-modules/queries-preview/utils/get-hash-from-query-preview.js +6 -4
- package/js/x-modules/queries-preview/utils/get-hash-from-query-preview.js.map +1 -1
- package/js/x-modules/query-suggestions/components/query-suggestion.vue.js +1 -4
- 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 +1 -7
- package/js/x-modules/query-suggestions/components/query-suggestions.vue.js.map +1 -1
- package/js/x-modules/query-suggestions/store/emitters.js +1 -0
- package/js/x-modules/query-suggestions/store/emitters.js.map +1 -1
- package/js/x-modules/recommendations/components/recommendations.vue.js +1 -2
- package/js/x-modules/recommendations/components/recommendations.vue.js.map +1 -1
- package/js/x-modules/recommendations/store/emitters.js +1 -0
- package/js/x-modules/recommendations/store/emitters.js.map +1 -1
- package/js/x-modules/related-prompts/components/related-prompt.vue.js +52 -0
- package/js/x-modules/related-prompts/components/related-prompt.vue.js.map +1 -0
- package/js/x-modules/related-prompts/components/related-prompt.vue2.js +62 -0
- package/js/x-modules/related-prompts/components/related-prompt.vue2.js.map +1 -0
- package/js/x-modules/related-prompts/components/related-prompts-list.vue.js +154 -0
- package/js/x-modules/related-prompts/components/related-prompts-list.vue.js.map +1 -0
- package/js/x-modules/related-prompts/components/related-prompts-list.vue2.js +6 -0
- package/js/x-modules/related-prompts/components/related-prompts-list.vue2.js.map +1 -0
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue.js +80 -0
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue.js.map +1 -0
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js +55 -0
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue2.js.map +1 -0
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue3.js +7 -0
- package/js/x-modules/related-prompts/components/related-prompts-tag-list.vue3.js.map +1 -0
- package/js/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.js +29 -0
- package/js/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.js.map +1 -0
- package/js/x-modules/related-prompts/store/actions/fetch-related-prompts.action.js +20 -0
- package/js/x-modules/related-prompts/store/actions/fetch-related-prompts.action.js.map +1 -0
- package/js/x-modules/related-prompts/store/emitters.js +15 -0
- package/js/x-modules/related-prompts/store/emitters.js.map +1 -0
- package/js/x-modules/related-prompts/store/getters/request.getter.js +16 -0
- package/js/x-modules/related-prompts/store/getters/request.getter.js.map +1 -0
- package/js/x-modules/related-prompts/store/module.js +61 -0
- package/js/x-modules/related-prompts/store/module.js.map +1 -0
- package/js/x-modules/related-prompts/wiring.js +98 -0
- package/js/x-modules/related-prompts/wiring.js.map +1 -0
- package/js/x-modules/related-prompts/x-module.js +21 -0
- package/js/x-modules/related-prompts/x-module.js.map +1 -0
- package/js/x-modules/related-tags/components/related-tag.vue.js +1 -2
- 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 +1 -4
- package/js/x-modules/related-tags/components/related-tags.vue.js.map +1 -1
- package/js/x-modules/related-tags/store/emitters.js +1 -0
- package/js/x-modules/related-tags/store/emitters.js.map +1 -1
- package/js/x-modules/scroll/components/scroll-to-top.vue.js +1 -2
- package/js/x-modules/scroll/components/scroll-to-top.vue.js.map +1 -1
- package/js/x-modules/scroll/components/scroll-to-top.vue2.js +2 -0
- package/js/x-modules/scroll/components/scroll-to-top.vue2.js.map +1 -1
- package/js/x-modules/scroll/store/emitters.js +1 -0
- package/js/x-modules/scroll/store/emitters.js.map +1 -1
- package/js/x-modules/search/components/partial-results-list.vue.js +1 -2
- package/js/x-modules/search/components/partial-results-list.vue.js.map +1 -1
- package/js/x-modules/search/components/results-list.vue.js +2 -2
- package/js/x-modules/search/components/results-list.vue.js.map +1 -1
- package/js/x-modules/search/components/sort-dropdown.vue.js +1 -3
- package/js/x-modules/search/components/sort-dropdown.vue.js.map +1 -1
- package/js/x-modules/search/store/actions/save-search-response.action.js +2 -1
- package/js/x-modules/search/store/actions/save-search-response.action.js.map +1 -1
- package/js/x-modules/search/store/emitters.js +1 -0
- package/js/x-modules/search/store/emitters.js.map +1 -1
- package/js/x-modules/search/store/module.js +7 -2
- package/js/x-modules/search/store/module.js.map +1 -1
- package/js/x-modules/search-box/components/clear-search-input.vue.js +1 -2
- 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 +1 -2
- package/js/x-modules/search-box/components/search-button.vue.js.map +1 -1
- package/js/x-modules/search-box/store/emitters.js +1 -0
- package/js/x-modules/search-box/store/emitters.js.map +1 -1
- package/js/x-modules/semantic-queries/components/semantic-queries.vue.js +1 -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 +1 -4
- package/js/x-modules/semantic-queries/components/semantic-query.vue.js.map +1 -1
- package/js/x-modules/tagging/components/tagging.vue.js +8 -2
- package/js/x-modules/tagging/components/tagging.vue.js.map +1 -1
- package/js/x-modules/url/store/emitters.js +1 -0
- package/js/x-modules/url/store/emitters.js.map +1 -1
- package/package.json +7 -6
- package/related-prompts/index.d.ts +1 -0
- package/related-prompts/index.js +10 -0
- package/report/x-adapter-platform.api.json +575 -1
- package/report/x-components.api.json +4962 -7798
- package/report/x-components.api.md +536 -167
- package/report/x-types.api.json +334 -0
- package/tools/inject-css.js +5 -3
- package/types/adapter/e2e-adapter.d.ts.map +1 -1
- package/types/adapter/mocked-responses.d.ts +3 -0
- package/types/adapter/mocked-responses.d.ts.map +1 -1
- package/types/components/base-dropdown.vue.d.ts +5 -5
- package/types/components/base-dropdown.vue.d.ts.map +1 -1
- package/types/components/base-grid.vue.d.ts +3 -3
- package/types/components/base-slider.vue.d.ts +74 -0
- package/types/components/base-slider.vue.d.ts.map +1 -0
- package/types/components/base-variable-column-grid.vue.d.ts +3 -3
- package/types/components/global-x-bus.vue.d.ts +6 -0
- package/types/components/global-x-bus.vue.d.ts.map +1 -1
- package/types/components/index.d.ts +1 -0
- package/types/components/index.d.ts.map +1 -1
- package/types/components/items-list.vue.d.ts +3 -3
- package/types/components/layouts/multi-column-max-width-layout.vue.d.ts +5 -5
- package/types/components/layouts/single-column-layout.vue.d.ts +3 -3
- package/types/components/modals/base-events-modal.vue.d.ts +2 -2
- package/types/components/modals/base-id-modal.vue.d.ts +2 -2
- package/types/components/modals/base-modal.vue.d.ts +10 -10
- package/types/components/modals/base-modal.vue.d.ts.map +1 -1
- package/types/components/modals/main-modal.vue.d.ts +2 -2
- package/types/components/panels/base-header-toggle-panel.vue.d.ts +5 -5
- package/types/components/panels/base-id-toggle-panel.vue.d.ts +5 -5
- package/types/components/panels/base-tabs-panel.vue.d.ts +8 -8
- package/types/components/panels/base-toggle-panel.vue.d.ts +3 -3
- package/types/components/result/base-result-image.vue.d.ts +10 -10
- package/types/components/result/base-result-image.vue.d.ts.map +1 -1
- package/types/components/snippet-callbacks.vue.d.ts +3 -0
- package/types/components/snippet-callbacks.vue.d.ts.map +1 -1
- package/types/components/suggestions/base-suggestions.vue.d.ts +3 -3
- package/types/composables/use-alias-api.d.ts +5 -0
- package/types/composables/use-alias-api.d.ts.map +1 -1
- package/types/composables/use-store.d.ts +2 -2
- package/types/composables/use-store.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/store/index.d.ts +4 -1
- package/types/store/index.d.ts.map +1 -1
- package/types/tailwind/plugin-options.d.ts +1 -2
- package/types/tailwind/plugin-options.d.ts.map +1 -1
- package/types/types/animation-prop.d.ts +6 -2
- package/types/types/animation-prop.d.ts.map +1 -1
- package/types/views/home/types.d.ts +3 -0
- package/types/views/home/types.d.ts.map +1 -1
- package/types/wiring/events.types.d.ts +3 -1
- package/types/wiring/events.types.d.ts.map +1 -1
- package/types/x-installer/x-installer/types.d.ts +2 -2
- package/types/x-installer/x-installer/types.d.ts.map +1 -1
- package/types/x-installer/x-installer/x-installer.d.ts +4 -4
- package/types/x-installer/x-installer/x-installer.d.ts.map +1 -1
- package/types/x-modules/empathize/components/empathize.vue.d.ts +5 -5
- package/types/x-modules/extra-params/components/snippet-config-extra-params.vue.d.ts +1 -1
- package/types/x-modules/facets/components/facets/facets.vue.d.ts +3 -3
- package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts +5 -2
- package/types/x-modules/facets/components/filters/hierarchical-filter.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts +3 -0
- package/types/x-modules/facets/components/filters/simple-filter.vue.d.ts.map +1 -1
- package/types/x-modules/facets/components/lists/filters-list.vue.d.ts +3 -3
- package/types/x-modules/facets/components/lists/selected-filters-list.vue.d.ts +3 -3
- package/types/x-modules/history-queries/components/my-history.vue.d.ts +3 -3
- package/types/x-modules/identifier-results/components/identifier-results.vue.d.ts +3 -3
- package/types/x-modules/next-queries/components/next-queries-list.vue.d.ts +3 -3
- package/types/x-modules/next-queries/index.d.ts +1 -0
- package/types/x-modules/next-queries/index.d.ts.map +1 -1
- package/types/x-modules/queries-preview/components/query-preview-list.vue.d.ts +3 -3
- 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.map +1 -1
- package/types/x-modules/queries-preview/store/actions/fetch-and-save-query-preview.action.d.ts.map +1 -1
- package/types/x-modules/queries-preview/store/module.d.ts.map +1 -1
- package/types/x-modules/queries-preview/utils/get-hash-from-query-preview.d.ts +4 -2
- package/types/x-modules/queries-preview/utils/get-hash-from-query-preview.d.ts.map +1 -1
- package/types/x-modules/recommendations/components/recommendations.vue.d.ts +3 -3
- package/types/x-modules/related-prompts/components/index.d.ts +4 -0
- package/types/x-modules/related-prompts/components/index.d.ts.map +1 -0
- package/types/x-modules/related-prompts/components/related-prompt.vue.d.ts +51 -0
- package/types/x-modules/related-prompts/components/related-prompt.vue.d.ts.map +1 -0
- package/types/x-modules/related-prompts/components/related-prompts-list.vue.d.ts +106 -0
- package/types/x-modules/related-prompts/components/related-prompts-list.vue.d.ts.map +1 -0
- package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts +14 -0
- package/types/x-modules/related-prompts/components/related-prompts-tag-list.vue.d.ts.map +1 -0
- package/types/x-modules/related-prompts/events.types.d.ts +26 -0
- package/types/x-modules/related-prompts/events.types.d.ts.map +1 -0
- package/types/x-modules/related-prompts/index.d.ts +6 -0
- package/types/x-modules/related-prompts/index.d.ts.map +1 -0
- package/types/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.d.ts +17 -0
- package/types/x-modules/related-prompts/store/actions/fetch-and-save-related-prompts.action.d.ts.map +1 -0
- package/types/x-modules/related-prompts/store/actions/fetch-related-prompts.action.d.ts +13 -0
- package/types/x-modules/related-prompts/store/actions/fetch-related-prompts.action.d.ts.map +1 -0
- package/types/x-modules/related-prompts/store/emitters.d.ts +9 -0
- package/types/x-modules/related-prompts/store/emitters.d.ts.map +1 -0
- package/types/x-modules/related-prompts/store/getters/request.getter.d.ts +13 -0
- package/types/x-modules/related-prompts/store/getters/request.getter.d.ts.map +1 -0
- package/types/x-modules/related-prompts/store/index.d.ts +7 -0
- package/types/x-modules/related-prompts/store/index.d.ts.map +1 -0
- package/types/x-modules/related-prompts/store/module.d.ts +8 -0
- package/types/x-modules/related-prompts/store/module.d.ts.map +1 -0
- package/types/x-modules/related-prompts/store/types.d.ts +108 -0
- package/types/x-modules/related-prompts/store/types.d.ts.map +1 -0
- package/types/x-modules/related-prompts/types.d.ts +10 -0
- package/types/x-modules/related-prompts/types.d.ts.map +1 -0
- package/types/x-modules/related-prompts/wiring.d.ts +37 -0
- package/types/x-modules/related-prompts/wiring.d.ts.map +1 -0
- package/types/x-modules/related-prompts/x-module.d.ts +16 -0
- package/types/x-modules/related-prompts/x-module.d.ts.map +1 -0
- package/types/x-modules/related-tags/components/related-tags.vue.d.ts +3 -3
- package/types/x-modules/scroll/components/scroll-to-top.vue.d.ts +5 -5
- package/types/x-modules/search/components/banners-list.vue.d.ts +3 -3
- package/types/x-modules/search/components/partial-results-list.vue.d.ts +3 -3
- package/types/x-modules/search/components/promoteds-list.vue.d.ts +3 -3
- package/types/x-modules/search/components/results-list.vue.d.ts +3 -3
- package/types/x-modules/search/components/sort-dropdown.vue.d.ts +1 -1
- package/types/x-modules/search/store/actions/save-search-response.action.d.ts.map +1 -1
- package/types/x-modules/search/store/module.d.ts +2 -0
- package/types/x-modules/search/store/module.d.ts.map +1 -1
- package/types/x-modules/search/store/types.d.ts +9 -1
- package/types/x-modules/search/store/types.d.ts.map +1 -1
- package/types/x-modules/search-box/components/search-input-placeholder.vue.d.ts +3 -3
- package/types/x-modules/tagging/components/tagging.vue.d.ts +17 -4
- package/types/x-modules/tagging/components/tagging.vue.d.ts.map +1 -1
- package/types/x-modules/x-modules.types.d.ts +2 -0
- package/types/x-modules/x-modules.types.d.ts.map +1 -1
- package/docs/API-reference/api/x-components.usestore.md +0 -19
- package/js/composables/use-store.js +0 -15
- package/js/composables/use-store.js.map +0 -1
- package/js/utils/options-api.js +0 -4
- package/js/utils/options-api.js.map +0 -1
- package/types/utils/options-api.d.ts +0 -3
- package/types/utils/options-api.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-modal.vue2.js","sources":["../../../../src/components/modals/base-modal.vue"],"sourcesContent":["<template>\n <div v-show=\"isWaitingForLeave || open\" ref=\"modalRef\" class=\"x-modal\" data-test=\"modal\">\n <component\n :is=\"animation\"\n @before-leave=\"isWaitingForLeave = true\"\n @after-leave=\"isWaitingForLeave = false\"\n >\n <div\n v-if=\"open\"\n ref=\"modalContentRef\"\n class=\"x-modal__content\"\n data-test=\"modal-content\"\n role=\"dialog\"\n :class=\"contentClass\"\n >\n <!-- @slot (Required) Modal container content -->\n <slot />\n </div>\n </component>\n <component :is=\"overlayAnimation\">\n <div\n v-if=\"open\"\n @click=\"emitOverlayClicked\"\n @keydown=\"emitOverlayClicked\"\n class=\"x-modal__overlay\"\n :class=\"overlayClass\"\n data-test=\"modal-overlay\"\n />\n </component>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';\n import { useDebounce } from '../../composables';\n import { AnimationProp } from '../../types';\n import { getTargetElement, FOCUSABLE_SELECTORS } from '../../utils';\n import { Fade, NoAnimation } from '../animations';\n\n /**\n * Base component with no XPlugin dependencies that serves as a utility for constructing more\n * complex modals.\n *\n * @public\n */\n export default defineComponent({\n name: 'BaseModal',\n props: {\n /** Determines if the modal is open or not. */\n open: {\n type: Boolean,\n required: true\n },\n /**\n * Determines if the focused element changes to one inside the modal when it opens. Either the\n * first element with a positive tabindex or just the first focusable element.\n */\n focusOnOpen: {\n type: Boolean,\n default: true\n },\n /**\n * The reference selector of a DOM element to use as reference to position the modal.\n * This selector can be an ID or a class, if it is a class, it will use the first\n * element that matches.\n */\n referenceSelector: String,\n /** Animation to use for opening/closing the modal.This animation only affects the content. */\n animation: {\n type: AnimationProp,\n default: () => NoAnimation\n },\n /**\n * Animation to use for the overlay (backdrop) part of the modal. By default, it uses\n * a fade transition.\n */\n overlayAnimation: {\n type: AnimationProp,\n default: () => Fade\n },\n /** Class inherited by content element. */\n contentClass: String,\n /** Class inherited by overlay element. */\n overlayClass: String\n },\n emits: ['click:overlay', 'focusin:body'],\n setup(props, { emit }) {\n /** Reference to the modal element in the DOM. */\n const modalRef = ref<HTMLDivElement>();\n /** Reference to the modal content element in the DOM. */\n const modalContentRef = ref<HTMLDivElement>();\n\n /** The previous value of the body overflow style. */\n const previousBodyOverflow = ref('');\n /** The previous value of the HTML element overflow style. */\n const previousHTMLOverflow = ref('');\n /** Boolean to delay the leave animation until it has completed. */\n const isWaitingForLeave = ref(false);\n /** The reference element to use to find the modal's position. */\n let referenceElement: HTMLElement;\n\n /** Disables the scroll of both the body and the window. */\n function disableScroll() {\n previousBodyOverflow.value = document.body.style.overflow;\n previousHTMLOverflow.value = document.documentElement.style.overflow;\n document.body.style.overflow = document.documentElement.style.overflow = 'hidden';\n }\n\n /** Restores the scroll of both the body and the window. */\n function enableScroll() {\n document.body.style.overflow = previousBodyOverflow.value;\n document.documentElement.style.overflow = previousHTMLOverflow.value;\n }\n\n /**\n * Emits the `click:overlay` event if the click has been triggered in the overlay layer.\n *\n * @param event - The click event.\n */\n function emitOverlayClicked(event: Event) {\n emit('click:overlay', event);\n }\n\n /**\n * Emits the `focusin:body` event if a focus event has been triggered outside the modal.\n *\n * @param event - The focusin event.\n */\n function emitFocusInBody(event: FocusEvent) {\n if (!modalContentRef.value?.contains(getTargetElement(event))) {\n emit('focusin:body', event);\n }\n }\n\n /**\n * Adds listeners to the body element ot detect if the modal should be closed.\n *\n * @remarks TODO find a better solution and remove the timeout\n * To avoid emit the focusin on opening X that provokes closing it immediately.\n * This is because this event was emitted after the open of main modal when the user clicks\n * on the customer website search box (focus event). This way we avoid add the listener before\n * the open and the avoid the event that provokes the close.\n */\n function addBodyListeners() {\n setTimeout(() => {\n document.body.addEventListener('focusin', emitFocusInBody);\n });\n }\n\n /** Removes the body listeners. */\n function removeBodyListeners() {\n document.body.removeEventListener('focusin', emitFocusInBody);\n }\n\n /**\n * Sets the focused element to the first element either the first element with a positive\n * tabindex or, if there isn't any, the first focusable element inside the modal.\n */\n function setFocus() {\n const candidates: HTMLElement[] = Array.from(\n modalContentRef.value?.querySelectorAll(FOCUSABLE_SELECTORS) ?? []\n );\n const element = candidates.find(element => element.tabIndex) ?? candidates[0];\n element?.focus();\n }\n\n /**\n * Syncs the body to the open state of the modal, adding or removing styles and listeners.\n *\n * @remarks nextTick() to wait for `modalContentRef` to be updated to look for focusable\n * candidates inside.\n *\n * @param isOpen - True when the modal is opened.\n */\n async function syncBody(isOpen: boolean) {\n if (isOpen) {\n disableScroll();\n addBodyListeners();\n if (props.focusOnOpen) {\n await nextTick();\n setFocus();\n }\n } else {\n enableScroll();\n removeBodyListeners();\n }\n }\n\n /**\n * Updates the position of the modal setting the top of the element depending\n * on the selector. The modal will be placed under this selector.\n */\n const debouncedUpdatePosition = useDebounce(\n () => {\n const { height, y } = referenceElement?.getBoundingClientRect() ?? { height: 0, y: 0 };\n modalRef.value!.style.top = `${height + y}px`;\n modalRef.value!.style.bottom = '0';\n modalRef.value!.style.height = 'auto';\n },\n 100,\n { leading: true }\n );\n\n let resizeObserver: ResizeObserver;\n\n onMounted(() => {\n watch(() => props.open, syncBody);\n if (props.open) {\n syncBody(true);\n }\n\n resizeObserver = new ResizeObserver(debouncedUpdatePosition);\n\n if (props.referenceSelector) {\n const element = document.querySelector(props.referenceSelector) as HTMLElement;\n if (element) {\n referenceElement = element;\n resizeObserver.observe(element);\n }\n }\n });\n\n onBeforeUnmount(() => {\n if (props.open) {\n removeBodyListeners();\n enableScroll();\n }\n resizeObserver.disconnect();\n });\n\n return {\n emitOverlayClicked,\n isWaitingForLeave,\n modalContentRef,\n modalRef\n };\n }\n });\n</script>\n\n<style lang=\"css\" scoped>\n .x-modal {\n position: fixed;\n top: 0;\n left: 0;\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n width: 100%;\n height: 100%;\n z-index: 1;\n }\n\n .x-modal__content {\n display: flex;\n flex-flow: column nowrap;\n z-index: 1;\n }\n\n .x-modal__overlay {\n width: 100%;\n height: 100%;\n position: absolute;\n background-color: rgb(0, 0, 0);\n opacity: 0.3;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Examples\n\nThe `BaseModal` is a simple component that serves to create complex modals. Its open state has to be\npassed via prop. There is a prop, `referenceSelector`, used to place the modal under some element\ninstead of set the top of the element directly. It also accepts an animation to use for opening &\nclosing.\n\nIt emits a `click:overlay` event when any part out of the content is clicked, but only if the modal\nis open.\n\n```vue\n<template>\n <div>\n <button @click=\"open = true\">Open modal</button>\n <BaseModal\n :animation=\"fadeAndSlide\"\n :open=\"open\"\n @click:overlay=\"open = false\"\n referenceSelector=\".header\"\n >\n <h1>Hello</h1>\n <p>The modal is working</p>\n <button @click=\"open = false\">Close modal</button>\n </BaseModal>\n </div>\n</template>\n\n<script>\n import { BaseModal, FadeAndSlide } from '@empathyco/x-components';\n import Vue from 'vue';\n\n Vue.component('fadeAndSlide', FadeAndSlide);\n\n export default {\n components: {\n BaseModal\n },\n data() {\n return {\n open: false\n };\n }\n };\n</script>\n```\n\n### Customized usage\n\n#### Customizing the content with classes\n\nThe `contentClass` prop can be used to add classes to the modal content.\n\n```vue\n<template>\n <div>\n <button @click=\"open = true\">Open modal</button>\n <BaseModal\n :animation=\"fadeAndSlide\"\n :open=\"open\"\n @click:overlay=\"open = false\"\n referenceSelector=\".header\"\n contentClass=\"x-bg-neutral-75\"\n >\n <h1>Hello</h1>\n <p>The modal is working</p>\n <button @click=\"open = false\">Close modal</button>\n </BaseModal>\n </div>\n</template>\n\n<script>\n import { BaseModal, FadeAndSlide } from '@empathyco/x-components';\n import Vue from 'vue';\n\n Vue.component('fadeAndSlide', FadeAndSlide);\n\n export default {\n components: {\n BaseModal\n },\n data() {\n return {\n open: false\n };\n }\n };\n</script>\n```\n\n#### Customizing the overlay with classes\n\nThe `overlayClass` prop can be used to add classes to the modal overlay.\n\n```vue\n<template>\n <div>\n <button @click=\"open = true\">Open modal</button>\n <BaseModal\n :animation=\"fadeAndSlide\"\n :open=\"open\"\n @click:overlay=\"open = false\"\n referenceSelector=\".header\"\n overlayClass=\"x-bg-neutral-75\"\n >\n <h1>Hello</h1>\n <p>The modal is working</p>\n <button @click=\"open = false\">Close modal</button>\n </BaseModal>\n </div>\n</template>\n\n<script>\n import { BaseModal, FadeAndSlide } from '@empathyco/x-components';\n import Vue from 'vue';\n\n Vue.component('fadeAndSlide', FadeAndSlide);\n\n export default {\n components: {\n BaseModal\n },\n data() {\n return {\n open: false\n };\n }\n };\n</script>\n```\n\n## Vue Events\n\nA list of events that the component will emit:\n\n- `click:overlay`: the event is emitted after the user clicks any part out of the content but only\n if the modal is open. The event payload is the mouse event that triggers it.\n- `focusin:body`: the event is emitted after the user focus in any part out of the content but only\n if the modal is open. The event payload is the focus event that triggers it.\n</docs>\n"],"names":["NoAnimation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCE;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,KAAK,EAAE;;AAEL,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,QAAQ,EAAE,IAAG;AACd,SAAA;AACD;;;AAGE;AACF,QAAA,WAAW,EAAE;AACX,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IAAG;AACb,SAAA;AACD;;;;AAIE;AACF,QAAA,iBAAiB,EAAE,MAAM;;AAEzB,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,aAAa;AACnB,YAAA,OAAO,EAAE,MAAMA,WAAU;AAC1B,SAAA;AACD;;;AAGE;AACF,QAAA,gBAAgB,EAAE;AAChB,YAAA,IAAI,EAAE,aAAa;AACnB,YAAA,OAAO,EAAE,MAAM,IAAG;AACnB,SAAA;;AAED,QAAA,YAAY,EAAE,MAAM;;AAEpB,QAAA,YAAY,EAAE,MAAK;AACpB,KAAA;AACD,IAAA,KAAK,EAAE,CAAC,eAAe,EAAE,cAAc,CAAC;AACxC,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,IAAG,EAAG,EAAA;;AAEnB,QAAA,MAAM,QAAS,GAAE,GAAG,EAAkB,CAAA;;AAEtC,QAAA,MAAM,eAAgB,GAAE,GAAG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K,CAAC,MAAK,GAAI,GAAG,CAAA;YAClC,QAAQ,CAAC,KAAM,CAAC,KAAK,CAAC,MAAK,GAAI,MAAM,CAAA;SACtC,EACD,GAAG,EACH,EAAE,OAAO,EAAE,IAAK,EAAA,CACjB,CAAA;AAED,QAAA,IAAI,cAA8B,CAAA;QAElC,SAAS,CAAC,MAAM;YACd,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;YACjC,IAAI,KAAK,CAAC,IAAI,EAAE;gBACd,QAAQ,CAAC,IAAI,CAAC,CAAA;AAChB,aAAA;AAEA,YAAA,iBAAiB,IAAI,cAAc,CAAC,uBAAuB,CAAC,CAAA;YAE5D,IAAI,KAAK,CAAC,iBAAiB,EAAE;gBAC3B,MAAM,OAAM,GAAI,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,iBAAiB,CAAgB,CAAA;AAC9E,gBAAA,IAAI,OAAO,EAAE;oBACX,mBAAmB,OAAO,CAAA;AAC1B,oBAAA,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;AACjC,iBAAA;AACF,aAAA;AACF,SAAC,CAAC,CAAA;QAEF,eAAe,CAAC,MAAM;YACpB,IAAI,KAAK,CAAC,IAAI,EAAE;AACd,gBAAA,mBAAmB,EAAE,CAAA;AACrB,gBAAA,YAAY,EAAE,CAAA;AAChB,aAAA;YACA,cAAc,CAAC,UAAU,EAAE,CAAA;AAC7B,SAAC,CAAC,CAAA;QAEF,OAAO;YACL,kBAAkB;YAClB,iBAAiB;YACjB,eAAe;YACf,QAAO;SACR,CAAA;KACH;AACD,CAAA,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"base-modal.vue2.js","sources":["../../../../src/components/modals/base-modal.vue"],"sourcesContent":["<template>\n <div v-show=\"isWaitingForLeave || open\" ref=\"modalRef\" class=\"x-modal\" data-test=\"modal\">\n <component\n :is=\"animation\"\n @before-leave=\"isWaitingForLeave = true\"\n @after-leave=\"isWaitingForLeave = false\"\n >\n <div\n v-if=\"open\"\n ref=\"modalContentRef\"\n class=\"x-modal__content\"\n data-test=\"modal-content\"\n role=\"dialog\"\n :class=\"contentClass\"\n >\n <!-- @slot (Required) Modal container content -->\n <slot />\n </div>\n </component>\n <component :is=\"overlayAnimation\">\n <div\n v-if=\"open\"\n @click=\"emitOverlayClicked\"\n @keydown=\"emitOverlayClicked\"\n class=\"x-modal__overlay\"\n :class=\"overlayClass\"\n data-test=\"modal-overlay\"\n />\n </component>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';\n import { useDebounce } from '../../composables';\n import { AnimationProp } from '../../types';\n import { getTargetElement, FOCUSABLE_SELECTORS } from '../../utils';\n import { Fade, NoAnimation } from '../animations';\n\n /**\n * Base component with no XPlugin dependencies that serves as a utility for constructing more\n * complex modals.\n *\n * @public\n */\n export default defineComponent({\n name: 'BaseModal',\n props: {\n /** Determines if the modal is open or not. */\n open: {\n type: Boolean,\n required: true\n },\n /**\n * Determines if the focused element changes to one inside the modal when it opens. Either the\n * first element with a positive tabindex or just the first focusable element.\n */\n focusOnOpen: {\n type: Boolean,\n default: true\n },\n /**\n * The reference selector of a DOM element to use as reference to position the modal.\n * This selector can be an ID or a class, if it is a class, it will use the first\n * element that matches.\n */\n referenceSelector: String,\n /** Animation to use for opening/closing the modal.This animation only affects the content. */\n animation: {\n type: AnimationProp,\n default: () => NoAnimation\n },\n /**\n * Animation to use for the overlay (backdrop) part of the modal. By default, it uses\n * a fade transition.\n */\n overlayAnimation: {\n type: AnimationProp,\n default: () => Fade\n },\n /** Class inherited by content element. */\n contentClass: String,\n /** Class inherited by overlay element. */\n overlayClass: String\n },\n emits: ['click:overlay', 'focusin:body'],\n setup(props, { emit }) {\n /** Reference to the modal element in the DOM. */\n const modalRef = ref<HTMLDivElement>();\n /** Reference to the modal content element in the DOM. */\n const modalContentRef = ref<HTMLDivElement>();\n\n /** The previous value of the body overflow style. */\n const previousBodyOverflow = ref('');\n /** The previous value of the HTML element overflow style. */\n const previousHTMLOverflow = ref('');\n /** Boolean to delay the leave animation until it has completed. */\n const isWaitingForLeave = ref(false);\n /** The reference element to use to find the modal's position. */\n let referenceElement: HTMLElement | undefined;\n\n /** Disables the scroll of both the body and the window. */\n function disableScroll() {\n previousBodyOverflow.value = document.body.style.overflow;\n previousHTMLOverflow.value = document.documentElement.style.overflow;\n document.body.style.overflow = document.documentElement.style.overflow = 'hidden';\n }\n\n /** Restores the scroll of both the body and the window. */\n function enableScroll() {\n document.body.style.overflow = previousBodyOverflow.value;\n document.documentElement.style.overflow = previousHTMLOverflow.value;\n }\n\n /**\n * Emits the `click:overlay` event if the click has been triggered in the overlay layer.\n *\n * @param event - The click event.\n */\n function emitOverlayClicked(event: Event) {\n emit('click:overlay', event);\n }\n\n /**\n * Emits the `focusin:body` event if a focus event has been triggered outside the modal.\n *\n * @param event - The focusin event.\n */\n function emitFocusInBody(event: FocusEvent) {\n if (!modalContentRef.value?.contains(getTargetElement(event))) {\n emit('focusin:body', event);\n }\n }\n\n /**\n * Adds listeners to the body element ot detect if the modal should be closed.\n *\n * @remarks TODO find a better solution and remove the timeout\n * To avoid emit the focusin on opening X that provokes closing it immediately.\n * This is because this event was emitted after the open of main modal when the user clicks\n * on the customer website search box (focus event). This way we avoid add the listener before\n * the open and the avoid the event that provokes the close.\n */\n function addBodyListeners() {\n setTimeout(() => {\n document.body.addEventListener('focusin', emitFocusInBody);\n });\n }\n\n /** Removes the body listeners. */\n function removeBodyListeners() {\n document.body.removeEventListener('focusin', emitFocusInBody);\n }\n\n /**\n * Sets the focused element to the first element either the first element with a positive\n * tabindex or, if there isn't any, the first focusable element inside the modal.\n */\n function setFocus() {\n const candidates: HTMLElement[] = Array.from(\n modalContentRef.value?.querySelectorAll(FOCUSABLE_SELECTORS) ?? []\n );\n const element = candidates.find(element => element.tabIndex) ?? candidates[0];\n element?.focus();\n }\n\n /**\n * Syncs the body to the open state of the modal, adding or removing styles and listeners.\n *\n * @remarks nextTick() to wait for `modalContentRef` to be updated to look for focusable\n * candidates inside.\n *\n * @param isOpen - True when the modal is opened.\n */\n async function syncBody(isOpen: boolean) {\n if (isOpen) {\n disableScroll();\n addBodyListeners();\n if (props.focusOnOpen) {\n await nextTick();\n setFocus();\n }\n } else {\n enableScroll();\n removeBodyListeners();\n }\n }\n\n /**\n * Updates the position of the modal setting the top of the element depending\n * on the selector. The modal will be placed under this selector.\n */\n const debouncedUpdatePosition = useDebounce(\n () => {\n const { height, y } = referenceElement?.getBoundingClientRect() ?? { height: 0, y: 0 };\n modalRef.value!.style.top = `${height + y}px`;\n modalRef.value!.style.bottom = '0';\n modalRef.value!.style.height = 'auto';\n },\n 100,\n { leading: true }\n );\n\n let resizeObserver: ResizeObserver;\n\n onMounted(() => {\n watch(() => props.open, syncBody);\n if (props.open) {\n syncBody(true);\n }\n\n resizeObserver = new ResizeObserver(debouncedUpdatePosition);\n\n watch(\n () => props.referenceSelector,\n () => {\n resizeObserver.disconnect();\n\n if (props.referenceSelector) {\n const element = document.querySelector(props.referenceSelector) as HTMLElement;\n if (element) {\n referenceElement = element;\n resizeObserver.observe(element);\n }\n } else {\n referenceElement = undefined;\n debouncedUpdatePosition();\n }\n },\n { immediate: true }\n );\n });\n\n onBeforeUnmount(() => {\n if (props.open) {\n removeBodyListeners();\n enableScroll();\n }\n resizeObserver.disconnect();\n });\n\n return {\n emitOverlayClicked,\n isWaitingForLeave,\n modalContentRef,\n modalRef\n };\n }\n });\n</script>\n\n<style lang=\"css\" scoped>\n .x-modal {\n position: fixed;\n top: 0;\n left: 0;\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n width: 100%;\n height: 100%;\n z-index: 1;\n }\n\n .x-modal__content {\n display: flex;\n flex-flow: column nowrap;\n z-index: 1;\n }\n\n .x-modal__overlay {\n width: 100%;\n height: 100%;\n position: absolute;\n background-color: rgb(0, 0, 0);\n opacity: 0.3;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Examples\n\nThe `BaseModal` is a simple component that serves to create complex modals. Its open state has to be\npassed via prop. There is a prop, `referenceSelector`, used to place the modal under some element\ninstead of set the top of the element directly. It also accepts an animation to use for opening &\nclosing.\n\nIt emits a `click:overlay` event when any part out of the content is clicked, but only if the modal\nis open.\n\n```vue\n<template>\n <div>\n <button @click=\"open = true\">Open modal</button>\n <BaseModal\n :animation=\"fadeAndSlide\"\n :open=\"open\"\n @click:overlay=\"open = false\"\n referenceSelector=\".header\"\n >\n <h1>Hello</h1>\n <p>The modal is working</p>\n <button @click=\"open = false\">Close modal</button>\n </BaseModal>\n </div>\n</template>\n\n<script>\n import { BaseModal, FadeAndSlide } from '@empathyco/x-components';\n import Vue from 'vue';\n\n Vue.component('fadeAndSlide', FadeAndSlide);\n\n export default {\n components: {\n BaseModal\n },\n data() {\n return {\n open: false\n };\n }\n };\n</script>\n```\n\n### Customized usage\n\n#### Customizing the content with classes\n\nThe `contentClass` prop can be used to add classes to the modal content.\n\n```vue\n<template>\n <div>\n <button @click=\"open = true\">Open modal</button>\n <BaseModal\n :animation=\"fadeAndSlide\"\n :open=\"open\"\n @click:overlay=\"open = false\"\n referenceSelector=\".header\"\n contentClass=\"x-bg-neutral-75\"\n >\n <h1>Hello</h1>\n <p>The modal is working</p>\n <button @click=\"open = false\">Close modal</button>\n </BaseModal>\n </div>\n</template>\n\n<script>\n import { BaseModal, FadeAndSlide } from '@empathyco/x-components';\n import Vue from 'vue';\n\n Vue.component('fadeAndSlide', FadeAndSlide);\n\n export default {\n components: {\n BaseModal\n },\n data() {\n return {\n open: false\n };\n }\n };\n</script>\n```\n\n#### Customizing the overlay with classes\n\nThe `overlayClass` prop can be used to add classes to the modal overlay.\n\n```vue\n<template>\n <div>\n <button @click=\"open = true\">Open modal</button>\n <BaseModal\n :animation=\"fadeAndSlide\"\n :open=\"open\"\n @click:overlay=\"open = false\"\n referenceSelector=\".header\"\n overlayClass=\"x-bg-neutral-75\"\n >\n <h1>Hello</h1>\n <p>The modal is working</p>\n <button @click=\"open = false\">Close modal</button>\n </BaseModal>\n </div>\n</template>\n\n<script>\n import { BaseModal, FadeAndSlide } from '@empathyco/x-components';\n import Vue from 'vue';\n\n Vue.component('fadeAndSlide', FadeAndSlide);\n\n export default {\n components: {\n BaseModal\n },\n data() {\n return {\n open: false\n };\n }\n };\n</script>\n```\n\n## Vue Events\n\nA list of events that the component will emit:\n\n- `click:overlay`: the event is emitted after the user clicks any part out of the content but only\n if the modal is open. The event payload is the mouse event that triggers it.\n- `focusin:body`: the event is emitted after the user focus in any part out of the content but only\n if the modal is open. The event payload is the focus event that triggers it.\n</docs>\n"],"names":["NoAnimation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCE;;;;;AAKE;AACF,gBAAe,eAAe,CAAC;AAC7B,IAAA,IAAI,EAAE,WAAW;AACjB,IAAA,KAAK,EAAE;;AAEL,QAAA,IAAI,EAAE;AACJ,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,QAAQ,EAAE,IAAG;AACd,SAAA;AACD;;;AAGE;AACF,QAAA,WAAW,EAAE;AACX,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,IAAG;AACb,SAAA;AACD;;;;AAIE;AACF,QAAA,iBAAiB,EAAE,MAAM;;AAEzB,QAAA,SAAS,EAAE;AACT,YAAA,IAAI,EAAE,aAAa;AACnB,YAAA,OAAO,EAAE,MAAMA,WAAU;AAC1B,SAAA;AACD;;;AAGE;AACF,QAAA,gBAAgB,EAAE;AAChB,YAAA,IAAI,EAAE,aAAa;AACnB,YAAA,OAAO,EAAE,MAAM,IAAG;AACnB,SAAA;;AAED,QAAA,YAAY,EAAE,MAAM;;AAEpB,QAAA,YAAY,EAAE,MAAK;AACpB,KAAA;AACD,IAAA,KAAK,EAAE,CAAC,eAAe,EAAE,cAAc,CAAC;AACxC,IAAA,KAAK,CAAC,KAAK,EAAE,EAAE,IAAG,EAAG,EAAA;;AAEnB,QAAA,MAAM,QAAS,G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AO;YACL,kBAAkB;YAClB,iBAAiB;YACjB,eAAe;YACf,QAAO;SACR,CAAA;KACH;AACD,CAAA,CAAC;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _sfc_main from './page-loader-button.vue2.js';
|
|
2
|
-
import { resolveComponent, openBlock, createElementBlock,
|
|
2
|
+
import { resolveComponent, openBlock, createElementBlock, renderSlot, normalizeProps, guardReactiveProps, createElementVNode, toDisplayString, createVNode, normalizeClass, withCtx, createTextVNode } from 'vue';
|
|
3
3
|
import _export_sfc from '../_virtual/_plugin-vue_export-helper.js';
|
|
4
4
|
|
|
5
5
|
const _hoisted_1 = {
|
|
@@ -13,9 +13,7 @@ const _hoisted_2 = {
|
|
|
13
13
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
14
14
|
const _component_BaseEventButton = resolveComponent("BaseEventButton");
|
|
15
15
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
16
|
-
createCommentVNode("\n @slot default\n @binding {number} resultsLength - The search result's length\n @binding {number} totalResults - The totalResults of a searched query\n "),
|
|
17
16
|
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ resultsLength: _ctx.resultsLength, totalResults: _ctx.totalResults })), () => [
|
|
18
|
-
createCommentVNode(" @slot Rendered count with a text and the number of results displayed & remaining. "),
|
|
19
17
|
renderSlot(_ctx.$slots, "textContent", {
|
|
20
18
|
resultsLength: _ctx.resultsLength,
|
|
21
19
|
totalResults: _ctx.totalResults
|
|
@@ -35,7 +33,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
35
33
|
"aria-label": "Load"
|
|
36
34
|
}, {
|
|
37
35
|
default: withCtx(() => [
|
|
38
|
-
createCommentVNode(" @slot Button content with a text, an icon or both "),
|
|
39
36
|
renderSlot(_ctx.$slots, "buttonContent", {}, () => [
|
|
40
37
|
createTextVNode("Load")
|
|
41
38
|
])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-loader-button.vue.js","sources":["../../../src/components/page-loader-button.vue"],"sourcesContent":["<template>\n <div class=\"x-flex x-flex-col x-items-center x-py-32\" data-test=\"page-loader\">\n <!--\n @slot default\n @binding {number} resultsLength - The search result's length\n @binding {number} totalResults - The totalResults of a searched query\n -->\n <slot v-bind=\"{ resultsLength, totalResults }\">\n <!-- @slot Rendered count with a text and the number of results displayed & remaining. -->\n <slot name=\"textContent\" :resultsLength=\"resultsLength\" :totalResults=\"totalResults\">\n <p class=\"x-text x-py-16\" data-test=\"text-content\">\n You are seeing {{ resultsLength }} of {{ totalResults }} results\n </p>\n </slot>\n <BaseEventButton\n class=\"x-button\"\n :class=\"buttonClasses\"\n :events=\"events\"\n data-test=\"load-content\"\n aria-label=\"Load\"\n >\n <!-- @slot Button content with a text, an icon or both -->\n <slot name=\"buttonContent\">Load</slot>\n </BaseEventButton>\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType } from 'vue';\n import { VueCSSClasses } from '../utils/types';\n import { use$x } from '../composables';\n import { XEventsTypes } from '../wiring';\n import BaseEventButton from './base-event-button.vue';\n\n /**\n * Component that renders a text with the number of rendered results and\n * the remaining ones and a `<BaseEventButton>` with the logic of emitting\n * the event \"UserReachedResultsListEnd\" to load more results on click.\n *\n * @public\n */\n export default defineComponent({\n name: 'PageLoaderButton',\n components: { BaseEventButton },\n props: {\n /**\n * CSS classes to customize the loader button.\n *\n * @internal\n */\n buttonClasses: {\n type: String as PropType<VueCSSClasses>,\n default: ''\n },\n /**\n * Events to customize what will be emitted by the loader button.\n *\n * @internal\n */\n buttonEvents: {\n type: Object as PropType<Partial<XEventsTypes>>\n }\n },\n setup(props) {\n const $x = use$x();\n const resultsLength = computed(() => $x.results.length);\n const totalResults = computed(() => $x.totalResults);\n\n /**\n * The events that will be emitted when clicking on the loader button.\n *\n * @returns The {@link XEvent} to emit.\n * @public\n */\n const events = computed<Partial<XEventsTypes>>(() => {\n return { UserReachedResultsListEnd: undefined, ...props.buttonEvents };\n });\n\n return {\n resultsLength,\n totalResults,\n events\n };\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the \"UserReachedResultsListEnd\" event by default. This can be changed using the\nbuttonEvents prop:\n\n```vue live\n<template>\n <PageLoaderButton :buttonEvents=\"{ UserClickedCloseX: undefined }\" />\n</template>\n\n<script>\n import { PageLoaderButton } from '@empathyco/x-components';\n\n export default {\n name: 'PageLoaderButtonDemo',\n components: {\n PageLoaderButton\n }\n };\n</script>\n```\n\n## See it in action\n\nHere you have a basic example of how the page loader component is rendered.\n\n```vue live\n<template>\n <PageLoaderButton />\n</template>\n\n<script>\n import { PageLoaderButton } from '@empathyco/x-components';\n\n export default {\n name: 'PageLoaderButtonDemo',\n components: {\n PageLoaderButton\n }\n };\n</script>\n```\n\n### Customise the default layout\n\nThis component has a default slot which allows to customise the entire layout.\n\n```vue live\n<template>\n <PageLoaderButton>\n <template #default=\"{ resultsLength, totalResults }\">\n <div class=\"x-flex x-flex-col\">\n <div class=\"x-flex x-gap-4 x-text\">\n <span class=\"x-text-accent-50 x-font-bold\">{{ resultsLength }}</span>\n <span>of</span>\n <span class=\"x-text-accent-50\">{{ totalResults }}</span>\n </div>\n <button\n @click=\"$x.emit('UserReachedResultsListEnd', undefined)\"\n class=\"x-button x-button-ghost\"\n >\n Load more\n </button>\n </div>\n </template>\n </PageLoaderButton>\n</template>\n\n<script>\n import { PageLoaderButton } from '@empathyco/x-components';\n\n export default {\n name: 'PageLoaderButtonDemo',\n components: {\n PageLoaderButton\n }\n };\n</script>\n```\n\n### Customise the slots\n\nThis component allows to customise both the textContent and the buttonContent slots. The\ntextContent's slot layout can be replaced entirely, while the buttonContent's slot enables wrapping\ncontent inside and customizing its style using the buttonClasses prop.\n\n```vue live\n<template>\n <PageLoaderButton :buttonClasses=\"buttonClasses\">\n <template #textContent=\"{ resultsLength, totalResults }\">\n <div class=\"x-flex x-gap-4 x-text\">\n <span class=\"x-text-accent-50 x-font-bold\">{{ resultsLength }}</span>\n <span>of</span>\n <span class=\"x-text-accent-50\">{{ totalResults }}</span>\n </div>\n </template>\n <template #buttonContent>Load more results</template>\n </PageLoaderButton>\n</template>\n\n<script>\n import { PageLoaderButton } from '@empathyco/x-components';\n\n export default {\n name: 'PageLoaderButtonDemo',\n components: {\n PageLoaderButton\n },\n data() {\n return {\n buttonClasses: 'x-rounded-full'\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createElementBlock","
|
|
1
|
+
{"version":3,"file":"page-loader-button.vue.js","sources":["../../../src/components/page-loader-button.vue"],"sourcesContent":["<template>\n <div class=\"x-flex x-flex-col x-items-center x-py-32\" data-test=\"page-loader\">\n <!--\n @slot default\n @binding {number} resultsLength - The search result's length\n @binding {number} totalResults - The totalResults of a searched query\n -->\n <slot v-bind=\"{ resultsLength, totalResults }\">\n <!-- @slot Rendered count with a text and the number of results displayed & remaining. -->\n <slot name=\"textContent\" :resultsLength=\"resultsLength\" :totalResults=\"totalResults\">\n <p class=\"x-text x-py-16\" data-test=\"text-content\">\n You are seeing {{ resultsLength }} of {{ totalResults }} results\n </p>\n </slot>\n <BaseEventButton\n class=\"x-button\"\n :class=\"buttonClasses\"\n :events=\"events\"\n data-test=\"load-content\"\n aria-label=\"Load\"\n >\n <!-- @slot Button content with a text, an icon or both -->\n <slot name=\"buttonContent\">Load</slot>\n </BaseEventButton>\n </slot>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent, PropType } from 'vue';\n import { VueCSSClasses } from '../utils/types';\n import { use$x } from '../composables';\n import { XEventsTypes } from '../wiring';\n import BaseEventButton from './base-event-button.vue';\n\n /**\n * Component that renders a text with the number of rendered results and\n * the remaining ones and a `<BaseEventButton>` with the logic of emitting\n * the event \"UserReachedResultsListEnd\" to load more results on click.\n *\n * @public\n */\n export default defineComponent({\n name: 'PageLoaderButton',\n components: { BaseEventButton },\n props: {\n /**\n * CSS classes to customize the loader button.\n *\n * @internal\n */\n buttonClasses: {\n type: String as PropType<VueCSSClasses>,\n default: ''\n },\n /**\n * Events to customize what will be emitted by the loader button.\n *\n * @internal\n */\n buttonEvents: {\n type: Object as PropType<Partial<XEventsTypes>>\n }\n },\n setup(props) {\n const $x = use$x();\n const resultsLength = computed(() => $x.results.length);\n const totalResults = computed(() => $x.totalResults);\n\n /**\n * The events that will be emitted when clicking on the loader button.\n *\n * @returns The {@link XEvent} to emit.\n * @public\n */\n const events = computed<Partial<XEventsTypes>>(() => {\n return { UserReachedResultsListEnd: undefined, ...props.buttonEvents };\n });\n\n return {\n resultsLength,\n totalResults,\n events\n };\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits the \"UserReachedResultsListEnd\" event by default. This can be changed using the\nbuttonEvents prop:\n\n```vue live\n<template>\n <PageLoaderButton :buttonEvents=\"{ UserClickedCloseX: undefined }\" />\n</template>\n\n<script>\n import { PageLoaderButton } from '@empathyco/x-components';\n\n export default {\n name: 'PageLoaderButtonDemo',\n components: {\n PageLoaderButton\n }\n };\n</script>\n```\n\n## See it in action\n\nHere you have a basic example of how the page loader component is rendered.\n\n```vue live\n<template>\n <PageLoaderButton />\n</template>\n\n<script>\n import { PageLoaderButton } from '@empathyco/x-components';\n\n export default {\n name: 'PageLoaderButtonDemo',\n components: {\n PageLoaderButton\n }\n };\n</script>\n```\n\n### Customise the default layout\n\nThis component has a default slot which allows to customise the entire layout.\n\n```vue live\n<template>\n <PageLoaderButton>\n <template #default=\"{ resultsLength, totalResults }\">\n <div class=\"x-flex x-flex-col\">\n <div class=\"x-flex x-gap-4 x-text\">\n <span class=\"x-text-accent-50 x-font-bold\">{{ resultsLength }}</span>\n <span>of</span>\n <span class=\"x-text-accent-50\">{{ totalResults }}</span>\n </div>\n <button\n @click=\"$x.emit('UserReachedResultsListEnd', undefined)\"\n class=\"x-button x-button-ghost\"\n >\n Load more\n </button>\n </div>\n </template>\n </PageLoaderButton>\n</template>\n\n<script>\n import { PageLoaderButton } from '@empathyco/x-components';\n\n export default {\n name: 'PageLoaderButtonDemo',\n components: {\n PageLoaderButton\n }\n };\n</script>\n```\n\n### Customise the slots\n\nThis component allows to customise both the textContent and the buttonContent slots. The\ntextContent's slot layout can be replaced entirely, while the buttonContent's slot enables wrapping\ncontent inside and customizing its style using the buttonClasses prop.\n\n```vue live\n<template>\n <PageLoaderButton :buttonClasses=\"buttonClasses\">\n <template #textContent=\"{ resultsLength, totalResults }\">\n <div class=\"x-flex x-gap-4 x-text\">\n <span class=\"x-text-accent-50 x-font-bold\">{{ resultsLength }}</span>\n <span>of</span>\n <span class=\"x-text-accent-50\">{{ totalResults }}</span>\n </div>\n </template>\n <template #buttonContent>Load more results</template>\n </PageLoaderButton>\n</template>\n\n<script>\n import { PageLoaderButton } from '@empathyco/x-components';\n\n export default {\n name: 'PageLoaderButtonDemo',\n components: {\n PageLoaderButton\n },\n data() {\n return {\n buttonClasses: 'x-rounded-full'\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createElementBlock","_renderSlot","resultsLength","_normalizeProps","_guardReactiveProps","totalResults","_createElementVNode","_toDisplayString","events","_withCtx"],"mappings":";;;;MACwD,UAAU,GAAA;AAAA,EAAA,KAAA,EAAA,0CAAA;;;MAShC,UAAU,GAAA;AAAA,EAAA,KAAA,EAAA,gBAAA;;;;qCAT1CA,gBAwBM,CAAA,iBAAA,CAAA,CAAA;SAhBFC,SAIO,EAAA,EAAAC,kBAAA,CAAA,KAAA,EAAA,UAAA,EAAA;AAAA,IAJmBC,UAAA,CAAA,IAAA,CAAa,QAAEC,SAAa,EAAAC,cAAA,CAAAC,kBAAA,CAAA,EAAA,aAAA,EAAA,IAAA,CAAA,aAAA,EAAA,YAAA,EAAA,IAAA,CAAA,YAAA,EAAA,CAAA,CAAA,EAAA,MAAA;AAAA,MAAAH,UAAA,CAAG,KAAcI,MAAY,EAAA,aAAA,EAAA;AAAA,QAI5E,aAAA,EAAA,IAAA,CAAA,aAAA;AAAA,QAHL,YAAA,EAAA,IAAA,CAAA,YAAA;AAAA,OAAA,EAAA,MAAA;AAIF,QAAAC,kBAAA;AAAA,UASkB,GAAA;AAAA,UAAA,UAAA;AAAA,UAAA,kBAAA,GAAAC,eAAA,CAAA,IAAA,CAAA,aAAA,CAAA,GAAA,MAAA,GAAAA,eAAA,CAAA,IAAA,CAAA,YAAA,CAAA,GAAA,WAAA;AAAA,UAAA,CAAA;AAAA;AAAA,SAAA;AAAA,OAAA,CAAA;kBANPC,0BAAM,EAAA;AAAA,QACf,sBAAU,CAAc,UAAA,EAAA,IAAA,CAAA,aAAA,CAAA,CAAA;AAAA,QACxB,MAAU,EAAA,IAAA,CAAA,MAAA;AAAA,QAAA,WAAA,EAAA,cAAA;AAnBlB,QAAA,YAAA,EAAA,MAAA;AAAA,OAAA,EAAA;iBAAAC,OAsBmC,CAAA,MAAA;AAAA,UAAAR,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,eAAA,EAAA,EAAA,EAAA,MAAA;;AAtBnC,WAAA,CAAA;AAAA,SAAA,CAAA;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _sfc_main from './base-header-toggle-panel.vue2.js';
|
|
2
|
-
import { resolveComponent, openBlock, createElementBlock,
|
|
2
|
+
import { resolveComponent, openBlock, createElementBlock, renderSlot, normalizeProps, guardReactiveProps, createElementVNode, normalizeClass, createVNode, withCtx } from 'vue';
|
|
3
3
|
import './base-header-toggle-panel.vue3.js';
|
|
4
4
|
import _export_sfc from '../../_virtual/_plugin-vue_export-helper.js';
|
|
5
5
|
|
|
@@ -7,9 +7,7 @@ const _hoisted_1 = { class: "x-header-toggle-panel" };
|
|
|
7
7
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
8
8
|
const _component_BaseTogglePanel = resolveComponent("BaseTogglePanel");
|
|
9
9
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
10
|
-
createCommentVNode(" @slot (Required) Slot that is be used for replacing the whole header. "),
|
|
11
10
|
renderSlot(_ctx.$slots, "header", normalizeProps(guardReactiveProps({ toggleOpen: _ctx.toggleOpen, open: _ctx.open })), () => [
|
|
12
|
-
createCommentVNode(" header-toggle-panel__header "),
|
|
13
11
|
createElementVNode(
|
|
14
12
|
"button",
|
|
15
13
|
{
|
|
@@ -18,7 +16,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
18
16
|
"data-test": "toggle-panel-header"
|
|
19
17
|
},
|
|
20
18
|
[
|
|
21
|
-
createCommentVNode(" @slot (Required) Slot used to just pass the content. "),
|
|
22
19
|
renderSlot(_ctx.$slots, "header-content", normalizeProps(guardReactiveProps({ open: _ctx.open })), void 0, true)
|
|
23
20
|
],
|
|
24
21
|
2
|
|
@@ -30,7 +27,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
30
27
|
animation: _ctx.animation
|
|
31
28
|
}, {
|
|
32
29
|
default: withCtx(() => [
|
|
33
|
-
createCommentVNode(" @slot (Required) Default content. "),
|
|
34
30
|
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
35
31
|
]),
|
|
36
32
|
_: 3
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-header-toggle-panel.vue.js","sources":["../../../../src/components/panels/base-header-toggle-panel.vue"],"sourcesContent":["<template>\n <div class=\"x-header-toggle-panel\">\n <!-- @slot (Required) Slot that is be used for replacing the whole header. -->\n <slot name=\"header\" v-bind=\"{ toggleOpen, open }\">\n <!-- header-toggle-panel__header -->\n <button\n @click=\"toggleOpen\"\n class=\"x-header-toggle-panel__header\"\n :class=\"headerClass\"\n data-test=\"toggle-panel-header\"\n >\n <!-- @slot (Required) Slot used to just pass the content. -->\n <slot name=\"header-content\" v-bind=\"{ open }\"></slot>\n </button>\n </slot>\n\n <BaseTogglePanel :open=\"open\" :animation=\"animation\">\n <!-- @slot (Required) Default content. -->\n <slot />\n </BaseTogglePanel>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, ref } from 'vue';\n import { AnimationProp } from '../../types';\n import { NoAnimation } from '../animations';\n import BaseTogglePanel from './base-toggle-panel.vue';\n\n /**\n * Toggle panel which uses the base toggle panel, adds a header and manage the\n * open / close state of the panel.\n *\n * @public\n */\n export default defineComponent({\n name: 'BaseHeaderTogglePanel',\n components: { BaseTogglePanel },\n props: {\n /** Animation component that will be used to animate the base-toggle-panel. */\n animation: {\n type: AnimationProp,\n default: () => NoAnimation\n },\n /** Handles if the panel is open by default. */\n startCollapsed: Boolean,\n /** Class inherited by content element. */\n headerClass: String\n },\n setup: function (props, { emit }) {\n /**\n * Handles if the base panel is open or closed.\n *\n * @internal\n */\n const open = ref(!props.startCollapsed);\n\n /**\n * Emits open status event.\n *\n * @internal\n */\n const emitOpenStatusEvent = () => {\n emit(open.value ? 'open' : 'close');\n };\n\n /**\n * Toggles the open property.\n *\n * @internal\n */\n const toggleOpen = () => {\n open.value = !open.value;\n emitOpenStatusEvent();\n };\n\n return {\n open,\n toggleOpen\n };\n }\n });\n</script>\n\n<style lang=\"css\" scoped>\n .x-header-toggle-panel__header {\n cursor: pointer;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- `open`: the event is emitted after the user clicks the element and opens it.\n- `close`: the event is emitted after the user clicks the element and closes it.\n\n## Examples\n\nToggle panel which uses the base toggle panel, adds a header and manage the open / close state of\nthe panel.\n\n### Basic usage\n\n```vue\n<BaseHeaderTogglePanel :animation=\"collapseHeight\" :start-collapsed=\"false\">\n <template #header-content=\"{ open }\">\n <p>Header, open: {{ open ? 'close' : 'open' }}</p>\n </template>\n <template>\n <p>Default content</p>\n </template>\n</BaseHeaderTogglePanel>\n```\n\n### Custom header\n\n```vue\n<BaseHeaderTogglePanel :animation=\"collapseHeight\" :start-collapsed=\"true\">\n <template #header=\"{ toggleOpen, open }\">\n <p>Header, open: {{ open ? 'close' : 'open' }}</p>\n <button @click=\"toggleOpen\">Toggle</button>\n </template>\n <template>\n <p>Default content</p>\n </template>\n</BaseHeaderTogglePanel>\n```\n\n### Customizing default header with classes\n\nThe `headerClass` prop can be used to add classes to the header of the toggle panel.\n\n```vue\n<BaseHeaderTogglePanel\n headerClass=\"custom-class\"\n :animation=\"collapseHeight\"\n :start-collapsed=\"false\"\n>\n <template #header-content=\"{ open }\">\n <p>Header, open: {{ open ? 'close' : 'open' }}</p>\n </template>\n <template>\n <p>Default content</p>\n </template>\n</BaseHeaderTogglePanel>\n```\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createElementBlock","
|
|
1
|
+
{"version":3,"file":"base-header-toggle-panel.vue.js","sources":["../../../../src/components/panels/base-header-toggle-panel.vue"],"sourcesContent":["<template>\n <div class=\"x-header-toggle-panel\">\n <!-- @slot (Required) Slot that is be used for replacing the whole header. -->\n <slot name=\"header\" v-bind=\"{ toggleOpen, open }\">\n <!-- header-toggle-panel__header -->\n <button\n @click=\"toggleOpen\"\n class=\"x-header-toggle-panel__header\"\n :class=\"headerClass\"\n data-test=\"toggle-panel-header\"\n >\n <!-- @slot (Required) Slot used to just pass the content. -->\n <slot name=\"header-content\" v-bind=\"{ open }\"></slot>\n </button>\n </slot>\n\n <BaseTogglePanel :open=\"open\" :animation=\"animation\">\n <!-- @slot (Required) Default content. -->\n <slot />\n </BaseTogglePanel>\n </div>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, ref } from 'vue';\n import { AnimationProp } from '../../types';\n import { NoAnimation } from '../animations';\n import BaseTogglePanel from './base-toggle-panel.vue';\n\n /**\n * Toggle panel which uses the base toggle panel, adds a header and manage the\n * open / close state of the panel.\n *\n * @public\n */\n export default defineComponent({\n name: 'BaseHeaderTogglePanel',\n components: { BaseTogglePanel },\n props: {\n /** Animation component that will be used to animate the base-toggle-panel. */\n animation: {\n type: AnimationProp,\n default: () => NoAnimation\n },\n /** Handles if the panel is open by default. */\n startCollapsed: Boolean,\n /** Class inherited by content element. */\n headerClass: String\n },\n setup: function (props, { emit }) {\n /**\n * Handles if the base panel is open or closed.\n *\n * @internal\n */\n const open = ref(!props.startCollapsed);\n\n /**\n * Emits open status event.\n *\n * @internal\n */\n const emitOpenStatusEvent = () => {\n emit(open.value ? 'open' : 'close');\n };\n\n /**\n * Toggles the open property.\n *\n * @internal\n */\n const toggleOpen = () => {\n open.value = !open.value;\n emitOpenStatusEvent();\n };\n\n return {\n open,\n toggleOpen\n };\n }\n });\n</script>\n\n<style lang=\"css\" scoped>\n .x-header-toggle-panel__header {\n cursor: pointer;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- `open`: the event is emitted after the user clicks the element and opens it.\n- `close`: the event is emitted after the user clicks the element and closes it.\n\n## Examples\n\nToggle panel which uses the base toggle panel, adds a header and manage the open / close state of\nthe panel.\n\n### Basic usage\n\n```vue\n<BaseHeaderTogglePanel :animation=\"collapseHeight\" :start-collapsed=\"false\">\n <template #header-content=\"{ open }\">\n <p>Header, open: {{ open ? 'close' : 'open' }}</p>\n </template>\n <template>\n <p>Default content</p>\n </template>\n</BaseHeaderTogglePanel>\n```\n\n### Custom header\n\n```vue\n<BaseHeaderTogglePanel :animation=\"collapseHeight\" :start-collapsed=\"true\">\n <template #header=\"{ toggleOpen, open }\">\n <p>Header, open: {{ open ? 'close' : 'open' }}</p>\n <button @click=\"toggleOpen\">Toggle</button>\n </template>\n <template>\n <p>Default content</p>\n </template>\n</BaseHeaderTogglePanel>\n```\n\n### Customizing default header with classes\n\nThe `headerClass` prop can be used to add classes to the header of the toggle panel.\n\n```vue\n<BaseHeaderTogglePanel\n headerClass=\"custom-class\"\n :animation=\"collapseHeight\"\n :start-collapsed=\"false\"\n>\n <template #header-content=\"{ open }\">\n <p>Header, open: {{ open ? 'close' : 'open' }}</p>\n </template>\n <template>\n <p>Default content</p>\n </template>\n</BaseHeaderTogglePanel>\n```\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createElementBlock","_renderSlot","_createElementVNode","_normalizeClass","_createVNode","animation"],"mappings":";;;;;;;qCACEA,gBAmBM,CAAA,iBAAA,CAAA,CAAA;SAfFC,SAQS,EAAA,EAAAC,kBAAA,CAAA,KAAA,EAAA,UAAA,EAAA;AAAA,IAAAC,UAAA,CAPD,yDAAE,EAAU,UAAA,EAAA,IAAA,CAAA,UAAA,EAAA,IAAA,EAAA,IAAA,CAAA,IAAA,EAAA,CAAA,CAAA,EAAA,MAAA;AAAA,MAAAC,kBAAA;AAN1B,QAAA,QAAA;AAAA,QAOc;AAAA,UAEN,gBAAU,CAAqB,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,CAAA,GAAA,IAAA,KAAA,IAAA,CAAA,UAAA,IAAA,IAAA,CAAA,UAAA,CAAA,GAAA,IAAA,CAAA,CAAA;AAAA,UAAA,KAAA,EAAAC,cAAA,CAAA,CAAA,+BAAA,EAAA,IAAA,CAAA,WAAA,CAAA,CAAA;UAG/B,WAAqD,EAAA,qBAAA;AAAA,SAAA;;;AAIzD,SAAA;AAAA,QAAA,CAAA;AAAA;AAAA,OAGkB;AAAA,KAAA,EAHA,IAAI,CAAA;AAAA,IAAAC,WAAA,CAAoBC,0BAAS,EAAA;AAAA,MAAA,IAAA,EAAA,IAAA,CAAA,IAAA;AAhBvD,MAAA,SAAA,EAAA,IAAA,CAAA,SAAA;AAAA,KAAA,EAAA;;AAAA,QAAAJ,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAAA,EAAA,KAAA,CAAA,EAAA,IAAA,CAAA;AAAA,OAAA,CAAA;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _sfc_main from './base-id-toggle-panel-button.vue2.js';
|
|
2
|
-
import { resolveComponent, openBlock, createBlock, withCtx,
|
|
2
|
+
import { resolveComponent, openBlock, createBlock, withCtx, renderSlot } from 'vue';
|
|
3
3
|
import _export_sfc from '../../_virtual/_plugin-vue_export-helper.js';
|
|
4
4
|
|
|
5
5
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
@@ -11,7 +11,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
11
11
|
"aria-pressed": _ctx.isPanelOpen.toString()
|
|
12
12
|
}, {
|
|
13
13
|
default: withCtx(() => [
|
|
14
|
-
createCommentVNode(" @slot (Required) Button content with a text, an icon or both "),
|
|
15
14
|
renderSlot(_ctx.$slots, "default", { isPanelOpen: _ctx.isPanelOpen })
|
|
16
15
|
]),
|
|
17
16
|
_: 3
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-id-toggle-panel-button.vue.js","sources":["../../../../src/components/panels/base-id-toggle-panel-button.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n class=\"x-base-id-toggle-panel-button x-button\"\n data-test=\"base-id-toggle-button\"\n :aria-pressed=\"isPanelOpen.toString()\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot :isPanelOpen=\"isPanelOpen\" />\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, ref, computed } from 'vue';\n import { XEventsTypes } from '../../wiring/events.types';\n import { WireMetadata } from '../../wiring/wiring.types';\n import BaseEventButton from '../base-event-button.vue';\n import { useXBus } from '../../composables';\n\n /**\n * Component containing an event button that emits\n * {@link XEventsTypes.UserClickedPanelToggleButton} when clicked with\n * the panelId as payload.\n *\n * It has a default slot to customize its contents.\n *\n * @public\n */\n export default defineComponent({\n name: 'BaseIdTogglePanelButton',\n components: { BaseEventButton },\n props: {\n /**\n * The panelId to use for the toggle event listeners.\n */\n panelId: {\n type: String,\n required: true\n }\n },\n setup: function (props) {\n const bus = useXBus();\n\n /**\n * The panel state to pass through the slot.\n */\n const isPanelOpen = ref(false);\n\n /**\n * List of events to emit by the BaseEventButton.\n *\n * @returns An object with the event and payload.\n *\n * @internal\n */\n const events = computed(\n (): Partial<XEventsTypes> => ({ UserClickedPanelToggleButton: props.panelId })\n );\n\n /**\n * The subscription to the {@link XEventsTypes.TogglePanelStateChanged} event\n * to update the `isPanelOpen` property.\n *\n * @param newState - The new isOpen state of the panel.\n * @param id - The `panelId`.\n */\n const updatePanelState = (newState: boolean, { id }: WireMetadata) => {\n if (props.panelId === id) {\n isPanelOpen.value = newState;\n }\n };\n\n bus\n .on('TogglePanelStateChanged', false)\n .subscribe(newState => updatePanelState(newState, { id: props.panelId, moduleName: null }));\n\n return {\n isPanelOpen,\n events\n };\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedPanelToggleButton`](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 id of the panelId\n that is going to be toggled.\n\n## Examples\n\n### Basic example\n\nThe component rendering content passed to the default slot and opening the panel toggle with panelId\n`my-toggle`.\n\n```vue\n<template>\n <div>\n <BaseIdTogglePanelButton v-slot=\"{ isPanelOpen }\" panelId=\"myToggle\">\n <template #default=\"{ isPanelOpen }\" v-if=\"isPanelOpen\">\n <img src=\"./close-button-icon.svg\" />\n <span>Close aside</span>\n </template>\n <template v-else>\n <img src=\"./open-button-icon.svg\" />\n <span>Open aside</span>\n </template>\n </BaseIdTogglePanelButton>\n <BaseIdTogglePanel :startOpen=\"true\" :animation=\"animation\" panelId=\"myToggle\">\n <div class=\"x-text1\">My toggle</div>\n </BaseIdTogglePanel>\n </div>\n</template>\n\n<script>\n import {\n BaseIdTogglePanel,\n BaseIdTogglePanelButton,\n CollapseFromTop\n } from '@empathyco/x-components';\n\n export default {\n components: {\n BaseIdTogglePanel,\n BaseIdTogglePanelButton,\n CollapseFromTop\n },\n data: function () {\n return {\n animation: CollapseFromTop\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createBlock","
|
|
1
|
+
{"version":3,"file":"base-id-toggle-panel-button.vue.js","sources":["../../../../src/components/panels/base-id-toggle-panel-button.vue"],"sourcesContent":["<template>\n <BaseEventButton\n :events=\"events\"\n class=\"x-base-id-toggle-panel-button x-button\"\n data-test=\"base-id-toggle-button\"\n :aria-pressed=\"isPanelOpen.toString()\"\n >\n <!-- @slot (Required) Button content with a text, an icon or both -->\n <slot :isPanelOpen=\"isPanelOpen\" />\n </BaseEventButton>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, ref, computed } from 'vue';\n import { XEventsTypes } from '../../wiring/events.types';\n import { WireMetadata } from '../../wiring/wiring.types';\n import BaseEventButton from '../base-event-button.vue';\n import { useXBus } from '../../composables';\n\n /**\n * Component containing an event button that emits\n * {@link XEventsTypes.UserClickedPanelToggleButton} when clicked with\n * the panelId as payload.\n *\n * It has a default slot to customize its contents.\n *\n * @public\n */\n export default defineComponent({\n name: 'BaseIdTogglePanelButton',\n components: { BaseEventButton },\n props: {\n /**\n * The panelId to use for the toggle event listeners.\n */\n panelId: {\n type: String,\n required: true\n }\n },\n setup: function (props) {\n const bus = useXBus();\n\n /**\n * The panel state to pass through the slot.\n */\n const isPanelOpen = ref(false);\n\n /**\n * List of events to emit by the BaseEventButton.\n *\n * @returns An object with the event and payload.\n *\n * @internal\n */\n const events = computed(\n (): Partial<XEventsTypes> => ({ UserClickedPanelToggleButton: props.panelId })\n );\n\n /**\n * The subscription to the {@link XEventsTypes.TogglePanelStateChanged} event\n * to update the `isPanelOpen` property.\n *\n * @param newState - The new isOpen state of the panel.\n * @param id - The `panelId`.\n */\n const updatePanelState = (newState: boolean, { id }: WireMetadata) => {\n if (props.panelId === id) {\n isPanelOpen.value = newState;\n }\n };\n\n bus\n .on('TogglePanelStateChanged', false)\n .subscribe(newState => updatePanelState(newState, { id: props.panelId, moduleName: null }));\n\n return {\n isPanelOpen,\n events\n };\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will emit:\n\n- [`UserClickedPanelToggleButton`](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 id of the panelId\n that is going to be toggled.\n\n## Examples\n\n### Basic example\n\nThe component rendering content passed to the default slot and opening the panel toggle with panelId\n`my-toggle`.\n\n```vue\n<template>\n <div>\n <BaseIdTogglePanelButton v-slot=\"{ isPanelOpen }\" panelId=\"myToggle\">\n <template #default=\"{ isPanelOpen }\" v-if=\"isPanelOpen\">\n <img src=\"./close-button-icon.svg\" />\n <span>Close aside</span>\n </template>\n <template v-else>\n <img src=\"./open-button-icon.svg\" />\n <span>Open aside</span>\n </template>\n </BaseIdTogglePanelButton>\n <BaseIdTogglePanel :startOpen=\"true\" :animation=\"animation\" panelId=\"myToggle\">\n <div class=\"x-text1\">My toggle</div>\n </BaseIdTogglePanel>\n </div>\n</template>\n\n<script>\n import {\n BaseIdTogglePanel,\n BaseIdTogglePanelButton,\n CollapseFromTop\n } from '@empathyco/x-components';\n\n export default {\n components: {\n BaseIdTogglePanel,\n BaseIdTogglePanelButton,\n CollapseFromTop\n },\n data: function () {\n return {\n animation: CollapseFromTop\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createBlock","_renderSlot"],"mappings":";;;;;AASoB,EAAA,MAAA,0BAAA,GAAAA,gBAAA,CAAA,iBAAA,CAAA,CAAA;AANX,EAAA,OAAAC,SAAA,EAAyC,EAAAC,WAAA,CAAA,0BAAA,EAAA;AAAA,IAC9C,MAAU,EAAA,IAAA,CAAA,MAAA;AAAA,IACT,KAAA,EAAA,wCAAA;AAAA,IAAA,WAAA,EAAA,uBAAA;IALL,cAQuC,EAAA,IAAA,CAAA,WAAA,CAAA,QAAA,EAAA;AAAA,GAAA,EAAA;;AARvC,MAAAC,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,EAAA,EAAA,WAAA,EAAA,IAAA,CAAA,WAAA,EAAA,CAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _sfc_main from './base-id-toggle-panel.vue2.js';
|
|
2
|
-
import { resolveComponent, openBlock, createBlock, withCtx,
|
|
2
|
+
import { resolveComponent, openBlock, createBlock, withCtx, renderSlot } from 'vue';
|
|
3
3
|
import _export_sfc from '../../_virtual/_plugin-vue_export-helper.js';
|
|
4
4
|
|
|
5
5
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
@@ -9,7 +9,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
9
9
|
animation: _ctx.animation
|
|
10
10
|
}, {
|
|
11
11
|
default: withCtx(() => [
|
|
12
|
-
createCommentVNode(" @slot (Required) Default content "),
|
|
13
12
|
renderSlot(_ctx.$slots, "default")
|
|
14
13
|
]),
|
|
15
14
|
_: 3
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-id-toggle-panel.vue.js","sources":["../../../../src/components/panels/base-id-toggle-panel.vue"],"sourcesContent":["<template>\n <BaseTogglePanel :open=\"isOpen\" :animation=\"animation\">\n <!-- @slot (Required) Default content -->\n <slot />\n </BaseTogglePanel>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, ref, watch } from 'vue';\n import { AnimationProp } from '../../types';\n import { use$x } from '../../composables';\n import { NoAnimation } from '../animations';\n import BaseTogglePanel from './base-toggle-panel.vue';\n\n /**\n * Simple panel that could receives its initial open state via prop, if not the default is opens\n * and a required prop, named `panelId`, which are responsible of rendering default slot\n * inside a configurable transition.\n *\n * It reacts to `UserClickedPanelToggleButton` event, when their payload matches the component's\n * 'panelId' prop, to handle its open/close state.\n *\n * The default slot offers the possibility to customise the modal content.\n *\n * @public\n */\n export default defineComponent({\n name: 'BaseIdTogglePanel',\n components: { BaseTogglePanel },\n props: {\n /** Shows the panel open at the beginning or not, depending on its state. */\n startOpen: {\n type: Boolean,\n default: true\n },\n /** Animation component that will be used to animate the panel content. */\n animation: {\n type: AnimationProp,\n default: () => NoAnimation\n },\n /**\n * The id to link with the BaseIdTogglePanelButton.\n * Both components must use the same Id to make them interact.\n */\n panelId: {\n type: String,\n required: true\n }\n },\n setup: function (props) {\n const $x = use$x();\n\n /** Whether the toggle panel is open or not. */\n const isOpen = ref(props.startOpen);\n\n /**\n * Method to subscribe to the {@link XEventsTypes.UserClickedPanelToggleButton} event.\n *\n * @param panelId - The payload of the {@link XEventsTypes.UserClickedPanelToggleButton} event.\n *\n * @public\n */\n const togglePanel = (panelId: string) => {\n if (props.panelId === panelId) {\n isOpen.value = !isOpen.value;\n }\n };\n\n $x.on('UserClickedPanelToggleButton', false).subscribe(togglePanel);\n\n /**\n * Emits the {@link XEventsTypes.TogglePanelStateChanged} event, when the internal state\n * changes.\n *\n * @remarks This event is necessary to link the state with the {@link BaseIdTogglePanelButton}\n * component.\n * @public\n */\n watch(\n () => isOpen.value,\n () => {\n $x.emit('TogglePanelStateChanged', isOpen.value, {\n id: props.panelId,\n target: document.getElementById(props.panelId) as HTMLElement\n });\n },\n { immediate: true }\n );\n\n return { isOpen };\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will watch:\n\n- [`UserClickedPanelToggleButton`](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 id of the panelId\n that is going to be toggled.\n\n## Examples\n\n### Basic usage\n\nUsing default slot:\n\n```vue\n<template>\n <div>\n <BaseIdTogglePanelButton panelId=\"myToggle\">\n <img src=\"./open-button-icon.svg\" />\n <span>Toggle Aside</span>\n </BaseIdTogglePanelButton>\n <BaseIdTogglePanel :startOpen=\"true\" :animation=\"animation\" panelId=\"myToggle\">\n <div class=\"x-text1\">My toggle</div>\n </BaseIdTogglePanel>\n </div>\n</template>\n\n<script>\n import {\n BaseIdTogglePanel,\n BaseIdTogglePanelButton,\n CollapseFromTop\n } from '@empathyco/x-components';\n\n export default {\n components: {\n BaseIdTogglePanel,\n BaseIdTogglePanelButton,\n CollapseFromTop\n },\n data: function () {\n return {\n animation: CollapseFromTop\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createBlock","
|
|
1
|
+
{"version":3,"file":"base-id-toggle-panel.vue.js","sources":["../../../../src/components/panels/base-id-toggle-panel.vue"],"sourcesContent":["<template>\n <BaseTogglePanel :open=\"isOpen\" :animation=\"animation\">\n <!-- @slot (Required) Default content -->\n <slot />\n </BaseTogglePanel>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, ref, watch } from 'vue';\n import { AnimationProp } from '../../types';\n import { use$x } from '../../composables';\n import { NoAnimation } from '../animations';\n import BaseTogglePanel from './base-toggle-panel.vue';\n\n /**\n * Simple panel that could receives its initial open state via prop, if not the default is opens\n * and a required prop, named `panelId`, which are responsible of rendering default slot\n * inside a configurable transition.\n *\n * It reacts to `UserClickedPanelToggleButton` event, when their payload matches the component's\n * 'panelId' prop, to handle its open/close state.\n *\n * The default slot offers the possibility to customise the modal content.\n *\n * @public\n */\n export default defineComponent({\n name: 'BaseIdTogglePanel',\n components: { BaseTogglePanel },\n props: {\n /** Shows the panel open at the beginning or not, depending on its state. */\n startOpen: {\n type: Boolean,\n default: true\n },\n /** Animation component that will be used to animate the panel content. */\n animation: {\n type: AnimationProp,\n default: () => NoAnimation\n },\n /**\n * The id to link with the BaseIdTogglePanelButton.\n * Both components must use the same Id to make them interact.\n */\n panelId: {\n type: String,\n required: true\n }\n },\n setup: function (props) {\n const $x = use$x();\n\n /** Whether the toggle panel is open or not. */\n const isOpen = ref(props.startOpen);\n\n /**\n * Method to subscribe to the {@link XEventsTypes.UserClickedPanelToggleButton} event.\n *\n * @param panelId - The payload of the {@link XEventsTypes.UserClickedPanelToggleButton} event.\n *\n * @public\n */\n const togglePanel = (panelId: string) => {\n if (props.panelId === panelId) {\n isOpen.value = !isOpen.value;\n }\n };\n\n $x.on('UserClickedPanelToggleButton', false).subscribe(togglePanel);\n\n /**\n * Emits the {@link XEventsTypes.TogglePanelStateChanged} event, when the internal state\n * changes.\n *\n * @remarks This event is necessary to link the state with the {@link BaseIdTogglePanelButton}\n * component.\n * @public\n */\n watch(\n () => isOpen.value,\n () => {\n $x.emit('TogglePanelStateChanged', isOpen.value, {\n id: props.panelId,\n target: document.getElementById(props.panelId) as HTMLElement\n });\n },\n { immediate: true }\n );\n\n return { isOpen };\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Events\n\nA list of events that the component will watch:\n\n- [`UserClickedPanelToggleButton`](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 id of the panelId\n that is going to be toggled.\n\n## Examples\n\n### Basic usage\n\nUsing default slot:\n\n```vue\n<template>\n <div>\n <BaseIdTogglePanelButton panelId=\"myToggle\">\n <img src=\"./open-button-icon.svg\" />\n <span>Toggle Aside</span>\n </BaseIdTogglePanelButton>\n <BaseIdTogglePanel :startOpen=\"true\" :animation=\"animation\" panelId=\"myToggle\">\n <div class=\"x-text1\">My toggle</div>\n </BaseIdTogglePanel>\n </div>\n</template>\n\n<script>\n import {\n BaseIdTogglePanel,\n BaseIdTogglePanelButton,\n CollapseFromTop\n } from '@empathyco/x-components';\n\n export default {\n components: {\n BaseIdTogglePanel,\n BaseIdTogglePanelButton,\n CollapseFromTop\n },\n data: function () {\n return {\n animation: CollapseFromTop\n };\n }\n };\n</script>\n```\n</docs>\n"],"names":["_resolveComponent","_openBlock","_createBlock","_renderSlot"],"mappings":";;;;;AAIoB,EAAA,MAAA,0BAAA,GAAAA,gBAAA,CAAA,iBAAA,CAAA,CAAA;AAHe,EAAA,OAAAC,SAAA,EAAoB,EAAAC,WAAA,CAAA,0BAAA,EAAA;AAAA,IAAA,IAAA,EAAA,IAAA,CAAA,MAAA;AADvD,IAAA,SAAA,EAAA,IAAA,CAAA,SAAA;AAAA,GAAA,EAAA;;AAAA,MAAAC,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,CAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _sfc_main from './base-tabs-panel.vue2.js';
|
|
2
|
-
import { openBlock, createElementBlock, createBlock, resolveDynamicComponent, normalizeClass, withCtx,
|
|
2
|
+
import { openBlock, createElementBlock, createBlock, resolveDynamicComponent, normalizeClass, withCtx, Fragment, renderList, renderSlot, mergeProps, createTextVNode, toDisplayString, normalizeProps, guardReactiveProps, createCommentVNode } from 'vue';
|
|
3
3
|
import './base-tabs-panel.vue3.js';
|
|
4
4
|
import _export_sfc from '../../_virtual/_plugin-vue_export-helper.js';
|
|
5
5
|
|
|
@@ -18,7 +18,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
18
18
|
role: "tablist"
|
|
19
19
|
}, {
|
|
20
20
|
default: withCtx(() => [
|
|
21
|
-
createCommentVNode("\n @slot Slot used to replace the whole tab.\n @binding {string} tab - The tab name.\n @binding {boolean} isSelected - Indicates if the tab is selected.\n @binding {function} select - Function to select the tab.\n "),
|
|
22
21
|
(openBlock(true), createElementBlock(
|
|
23
22
|
Fragment,
|
|
24
23
|
null,
|
|
@@ -33,7 +32,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
33
32
|
"data-test": "base-tabs-panel-button",
|
|
34
33
|
role: "tab"
|
|
35
34
|
}, [
|
|
36
|
-
createCommentVNode("\n @slot Slot used to just pass the content.\n @binding {string} tab - The tab name.\n @binding {boolean} isSelected - Indicates if the tab is selected.\n "),
|
|
37
35
|
renderSlot(_ctx.$slots, "tab-content", mergeProps({ ref_for: true }, { tab, isSelected: _ctx.tabIsSelected(tab) }), () => [
|
|
38
36
|
createTextVNode(
|
|
39
37
|
toDisplayString(tab),
|
|
@@ -60,7 +58,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
60
58
|
"data-test": "base-tabs-panel-content",
|
|
61
59
|
role: "tabpanel"
|
|
62
60
|
}, [
|
|
63
|
-
createCommentVNode("\n @slot Slot used to display the selected tab content.\n @binding {string} tab - This content's tab name.\n @binding {function} selectTab - Function to select a tab.\n @binding {function} deselectTab - Function to deselect the tab.\n "),
|
|
64
61
|
renderSlot(_ctx.$slots, _ctx.selectedTab, normalizeProps(guardReactiveProps({ tab: _ctx.selectedTab, selectTab: _ctx.selectTab, deselectTab: () => _ctx.selectTab(_ctx.selectedTab) })), void 0, true)
|
|
65
62
|
], 10, _hoisted_3)) : createCommentVNode("v-if", true)
|
|
66
63
|
]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-tabs-panel.vue.js","sources":["../../../../src/components/panels/base-tabs-panel.vue"],"sourcesContent":["<template>\n <section v-if=\"getTabs().length > 0\" class=\"x-tabs-panel\" data-test=\"base-tabs-panel\">\n <component\n :is=\"tabsAnimation\"\n class=\"x-tabs-panel__items-list\"\n :class=\"tabsListClass\"\n data-test=\"base-tabs-panel-list\"\n role=\"tablist\"\n >\n <!--\n @slot Slot used to replace the whole tab.\n @binding {string} tab - The tab name.\n @binding {boolean} isSelected - Indicates if the tab is selected.\n @binding {function} select - Function to select the tab.\n -->\n <slot\n v-for=\"tab in getTabs()\"\n name=\"tab\"\n v-bind=\"{ tab, isSelected: tabIsSelected(tab), select: () => selectTab(tab) }\"\n >\n <button\n :key=\"tab\"\n @click=\"selectTab(tab)\"\n :id=\"`base-tabs-panel-${tab}`\"\n class=\"x-tabs-panel__list-item x-tabs-panel__button x-button\"\n :class=\"tabIsSelected(tab) ? activeTabClass : tabClass\"\n :aria-selected=\"tabIsSelected(tab).toString()\"\n data-test=\"base-tabs-panel-button\"\n role=\"tab\"\n >\n <!--\n @slot Slot used to just pass the content.\n @binding {string} tab - The tab name.\n @binding {boolean} isSelected - Indicates if the tab is selected.\n -->\n <slot name=\"tab-content\" v-bind=\"{ tab, isSelected: tabIsSelected(tab) }\">\n {{ tab }}\n </slot>\n </button>\n </slot>\n </component>\n\n <component :is=\"contentAnimation\">\n <div\n v-if=\"selectedTab && slots[selectedTab]\"\n :key=\"selectedTab\"\n :class=\"contentClass\"\n :aria-labelledby=\"`base-tabs-panel-${selectedTab}`\"\n data-test=\"base-tabs-panel-content\"\n role=\"tabpanel\"\n >\n <!--\n @slot Slot used to display the selected tab content.\n @binding {string} tab - This content's tab name.\n @binding {function} selectTab - Function to select a tab.\n @binding {function} deselectTab - Function to deselect the tab.\n -->\n <slot\n :name=\"selectedTab\"\n v-bind=\"{ tab: selectedTab, selectTab, deselectTab: () => selectTab(selectedTab) }\"\n />\n </div>\n </component>\n </section>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, ref } from 'vue';\n import { AnimationProp } from '../../types';\n import { NoAnimation } from '../animations';\n\n /**\n * Base Tabs Panel.\n *\n * @public\n */\n export default defineComponent({\n name: 'BaseTabsPanel',\n props: {\n /**\n * Animation component that will be used to animate the tabs list.\n *\n * @public\n */\n tabsAnimation: {\n type: AnimationProp,\n default: 'header'\n },\n /**\n * Animation component that will be used to animate the selected tab content.\n *\n * @public\n */\n contentAnimation: {\n type: AnimationProp,\n default: () => NoAnimation\n },\n /**\n * The tab to be initially selected.\n *\n * @public\n */\n initialTab: {\n type: String,\n default: ''\n },\n /**\n * Allows the tabs to be unselected.\n *\n * @public\n */\n allowTabDeselect: {\n type: Boolean,\n default: false\n },\n /** Class inherited by content element. */\n activeTabClass: String,\n /** Class inherited by content element. */\n contentClass: String,\n /** Class inherited by content element. */\n tabClass: String,\n /** Class inherited by content element. */\n tabsListClass: String\n },\n setup: function (props, { slots }) {\n /**\n * The currently selected tab.\n *\n * @internal\n */\n const selectedTab = ref(props.initialTab);\n\n /**\n * Extracts the tab from the slots.\n *\n * @returns The list of tabs.\n *\n * @internal\n */\n const getTabs = () =>\n Object.keys(slots).filter(slotName => !['tab', 'tab-content'].includes(slotName));\n\n /**\n * Changes the current selected tab. If the tab is already selected\n * and `allowTabDeselect` is `true`, the tab will be unselected.\n *\n * @param tab - The tab to be selected.\n *\n * @internal\n */\n const selectTab = (tab: string) => {\n if (props.allowTabDeselect && selectedTab.value === tab) {\n selectedTab.value = '';\n } else {\n selectedTab.value = tab;\n }\n };\n\n /**\n * Checks if a tab is selected.\n *\n * @param tab - Tab to check.\n * @returns True if the tab is selected, false otherwise.\n *\n * @internal\n */\n const tabIsSelected = (tab: string) => selectedTab.value === tab;\n\n return {\n selectedTab,\n slots,\n getTabs,\n selectTab,\n tabIsSelected\n };\n }\n });\n</script>\n\n<style lang=\"css\" scoped>\n .x-tabs-panel__items-list {\n display: flex;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events.\n\n## Examples\n\nThis component renders a list of tabs based on the name of the slots passed on its template. By\ndefault, the name of each slot will be used as tab label. If an initial tab is passed by prop, the\ncontent of its correspondent slot will displayed in a panel. Otherwise, no content will be displayed\nuntil a tab is selected.\n\n### Basic example\n\nIt renders a list of tabs and, when a tab is clicked, a panel with its content will be displayed.\n\n```vue\n<template>\n <BaseTabsPanel>\n <template #summer>\n <div>Summer Top Sales</div>\n </template>\n\n <template #fall>\n <div>Fall Top Sales</div>\n </template>\n\n <template #outlet>\n <div>Outlet Top Sales</div>\n </template>\n </BaseTabsPanel>\n</template>\n\n<script>\n import { BaseTabsPanel } from '@empathyco/x-components';\n\n export default {\n name: 'BaseTabsPanelDemo',\n components: {\n BaseTabsPanel\n }\n };\n</script>\n```\n\n### Play with props\n\n#### Define the tab to be initially opened\n\nBy default, no tab is selected so any panel is displayed. The `initialTab` prop allows to indicate\nwhich tab should be opened at first.\n\n```vue\n<template>\n <BaseTabsPanel initialTab=\"summer\">\n <template #summer>\n <div>Summer Top Sales</div>\n </template>\n\n <template #fall>\n <div>Fall Top Sales</div>\n </template>\n\n <template #outlet>\n <div>Outlet Top Sales</div>\n </template>\n </BaseTabsPanel>\n</template>\n\n<script>\n import { BaseTabsPanel } from '@empathyco/x-components';\n\n export default {\n name: 'BaseTabsPanelDemo',\n components: {\n BaseTabsPanel\n }\n };\n</script>\n```\n\n#### Allowing tabs deselection\n\nThe prop `allowTabDeselect` allows the tabs to be deselected. When a tab that is already selected is\nclicked again, the tab will be deselected and no panel content will be displayed. By default, this\nbehavior is deactivated.\n\n```vue\n<template>\n <BaseTabsPanel initialTab=\"summer\" allowTabDeselect>\n <template #summer>\n <div>Summer Top Sales</div>\n </template>\n\n <template #fall>\n <div>Fall Top Sales</div>\n </template>\n\n <template #outlet>\n <div>Outlet Top Sales</div>\n </template>\n </BaseTabsPanel>\n</template>\n\n<script>\n import { BaseTabsPanel } from '@empathyco/x-components';\n\n export default {\n name: 'BaseTabsPanelDemo',\n components: {\n BaseTabsPanel\n }\n };\n</script>\n```\n\n#### Customizing the content with classes\n\n- The `activeTabClass` prop can be used to add classes to the active tab button.\n- The `contentClass` prop can be used to add classes to the content.\n- The `tabClass` prop can be used to add classes to the tab buttons.\n- The `tabsListClass` prop can be used to add classes to the tabs list.\n\n```vue\n<template>\n <BaseTabsPanel\n activeTabClass=\"x-button-auxiliary\"\n contentClass=\"x-p-12 x-bg-auxiliary-25\"\n tabClass=\"x-button-ghost\"\n tabListClass=\"x-flex-col\"\n >\n <template #summer>\n <div>Summer Top Sales</div>\n </template>\n\n <template #fall>\n <div>Fall Top Sales</div>\n </template>\n\n <template #outlet>\n <div>Outlet Top Sales</div>\n </template>\n </BaseTabsPanel>\n</template>\n\n<script>\n import { BaseTabsPanel } from '@empathyco/x-components';\n\n export default {\n name: 'BaseTabsPanelDemo',\n components: {\n BaseTabsPanel\n }\n };\n</script>\n```\n\n#### Play with the animations\n\n- The `tabsAnimation` prop can be used to animate the tabs list.\n- The `contentAnimation` prop can be used to animate the selected tab content.\n\n```vue\n<template>\n <BaseTabsPanel :tabsAnimation=\"staggeredFadeAndSlide\" :contentAnimation=\"staggeredFadeAndSlide\">\n <template #summer>\n <div>Summer Top Sales</div>\n </template>\n\n <template #fall>\n <div>Fall Top Sales</div>\n </template>\n </BaseTabsPanel>\n</template>\n\n<script>\n import { BaseTabsPanel, StaggeredFadeAndSlide } from '@empathyco/x-components';\n\n export default {\n name: 'BaseTabsPanelDemo',\n components: {\n BaseTabsPanel\n },\n data() {\n return {\n staggeredFadeAndSlide: StaggeredFadeAndSlide\n };\n }\n };\n</script>\n```\n\n### Overriding the slots\n\n#### Customizing the tab button\n\nBy default, the component is rendering a button for each tab to be displayed. This button can be\nreplaced entirely through the `tab` slot.\n\n```vue\n<template>\n <BaseTabsPanel>\n <template #tab=\"{ tab, isSelected, select }\">\n <CheckIcon v-if=\"isSelected\" />\n This is the {{ tab }} tab.\n <button @click=\"select\">Open tab</button>\n </template>\n\n <template #summer>\n <div>Summer Top Sales</div>\n </template>\n\n <template #fall>\n <div>Fall Top Sales</div>\n </template>\n\n <template #outlet>\n <div>Outlet Top Sales</div>\n </template>\n </BaseTabsPanel>\n</template>\n\n<script>\n import { BaseTabsPanel, CheckIcon } from '@empathyco/x-components';\n\n export default {\n name: 'BaseTabsPanelDemo',\n components: {\n BaseTabsPanel,\n CheckIcon\n }\n };\n</script>\n```\n\n#### Customizing the tab button content\n\nAlternatively to the previous example, instead of changing the whole tab button, the slot\n`tab-content` offers the possibility of changing just its contents.\n\n```vue\n<template>\n <BaseTabsPanel>\n <template #tab-content=\"{ tab, isSelected }\">\n <CheckIcon v-if=\"isSelected\" />\n {{ tab }}\n </template>\n\n <template #summer>\n <div>Summer Top Sales</div>\n </template>\n\n <template #fall>\n <div>Fall Top Sales</div>\n </template>\n\n <template #outlet>\n <div>Outlet Top Sales</div>\n </template>\n </BaseTabsPanel>\n</template>\n\n<script>\n import { BaseTabsPanel, CheckIcon } from '@empathyco/x-components';\n\n export default {\n name: 'BaseTabsPanelDemo',\n components: {\n BaseTabsPanel,\n CheckIcon\n }\n };\n</script>\n```\n\n#### Customizing the tab panel content\n\nThe displayed tab name and a method to select a tab are exposed to the tab panel content slot.\n\n```vue\n<template>\n <BaseTabsPanel>\n <template #summer=\"{ tab, selectTab, deselectTab }\">\n <h1>{{ tab }}</h1>\n <button @click=\"() => selectTab('fall')\">Open Fall</button>\n <button @click=\"deselectTab\">Close tab</button>\n </template>\n\n <template #fall>\n <div>Fall Top Sales</div>\n </template>\n </BaseTabsPanel>\n</template>\n\n<script>\n import { BaseTabsPanel } from '@empathyco/x-components';\n\n export default {\n name: 'BaseTabsPanelDemo',\n components: {\n BaseTabsPanel\n }\n };\n</script>\n```\n</docs>\n"],"names":["_openBlock","tabsListClass","_createBlock","_resolveDynamicComponent","_normalizeClass","_withCtx","_createCommentVNode","_createElementBlock","_Fragment","_renderList","_renderSlot","_mergeProps","selectTab","tabIsSelected","_toDisplayString","slots","selectedTab","contentClass","_normalizeProps","_guardReactiveProps"],"mappings":";;;;;MACuC,UAAM,GAAA;AAAA,EAAe,GAAA,EAAA,CAAA;AAAA,EAAA,KAAA,EAAA,cAAA;;;;;AAA1D,SAAA,WAAA,CAAA,IAAA,EAAA,MAAA,EAAA,MAAA,EA8DU,eA9DV,QA8DU,EAAA;AA7DR,EAAA,OAAA,IAAA,CAAA,OAAA,EAAA,CAAA,MAAA,GAAA,CAAA,IAAAA,SAAA,uBAEQ,SACEC,EAAAA,UAAAA,EAAAA;AAAAA,KAAAA,SAAAA,IACEC,WAAsB,CAAAC,uBAAA,CAAA,IAAA,CAAA,aAAA,CAAA,EAAA;AAAA,MAChC,OAAKC,cAAS,CAAA,CAAA,0BAAA,EAAA,IAAA,CAAA,aAAA,CAAA,CAAA;AAAA,MAAA,WAAA,EAAA,sBAAA;AAPpB,MAAA,IAAA,EAAA,SAAA;AAAA,KAAA,EAAA;AAeM,MAAA,OAAA,EAAAC,OAAA,CAAA,MAAA;AAAA,QAwBOC,kBAAA,CAAA,+PAAA,CAAA;AAAA,SAnBLN,SAAA,CAAA,IAAA,CAAA,EAAAO,kBAAA;AAAA,UAkBSC,QAAA;AAAA,UAAA,IAAA;AAAA,UAAAC,UAAA,CAAA,IAAA,CAAA,OAAA,EAAA,EAAA,CAAA,GAAA,KAAA;mBAjBHC,UAAK,CAAA,IAAA,CAAA,MAAA,EAAA,KAAA,EAAAC,UAAA,CAAA,EAAA,OAAA,EAAA,IAAA,EAAA,EAAA,EAAA,GAAA,EAAA,UAAA,EAAA,IAAA,CAAA,aAAA,CA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AAA,IAAA,CAEG,WAAKW,IAAAA,IAAAA,CAAAA,KAAAA,CAAW,IA7CzB,CAAA,WAAA,CAAA,IAAAhB,SAAA,EAAA,EAAAO,kBAAA,CA8CgBU,KAAY,EAAA;AAAA,UACnB,GAAA,EAAA,IAAA,CAAA,WAAA;AAAA,UACD,sBAAU,IAAyB,CAAA,YAAA,CAAA;AAAA,UACnC,iBAAe,EAAA,CAAA,gBAAA,EAAA,IAAA,CAAA,WAAA,CAAA,CAAA;AAAA,UAAA,WAAA,EAAA,yBAAA;AAEf,UAAA,IAAA,EAAA,UAAA;AAAA,SAMA,EAAA;AAAA,UAzDRX,kBAAA,CAAA,8RAAA,CAAA;AAAA,UAAAI,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,IAAA,CAAA,WAAA,EAAAQ,cAAA,CAAAC,kBAAA,CAAA,EAAA,GAAA,EAAA,IAAA,CAAA,WAAA,EAAA,SAAA,EAAA,IAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,IAAA,CAAA,SAAA,CAAA,IAAA,CAAA,WAAA,CAAA,EAAA,CAAA,CAAA,EAAA,KAAA,CAAA,EAAA,IAAA,CAAA;AAAA,SAAA,EAAA,EAAA,EAAA,UAAA,CAAA,IAAAb,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA;AAAA,OAAA,CAAA;;;AAAA,KAAA,CAAA;AAAA,GAAA,CAAA,IAAAA,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA,CAAA;;;;;;"}
|
|
1
|
+
{"version":3,"file":"base-tabs-panel.vue.js","sources":["../../../../src/components/panels/base-tabs-panel.vue"],"sourcesContent":["<template>\n <section v-if=\"getTabs().length > 0\" class=\"x-tabs-panel\" data-test=\"base-tabs-panel\">\n <component\n :is=\"tabsAnimation\"\n class=\"x-tabs-panel__items-list\"\n :class=\"tabsListClass\"\n data-test=\"base-tabs-panel-list\"\n role=\"tablist\"\n >\n <!--\n @slot Slot used to replace the whole tab.\n @binding {string} tab - The tab name.\n @binding {boolean} isSelected - Indicates if the tab is selected.\n @binding {function} select - Function to select the tab.\n -->\n <slot\n v-for=\"tab in getTabs()\"\n name=\"tab\"\n v-bind=\"{ tab, isSelected: tabIsSelected(tab), select: () => selectTab(tab) }\"\n >\n <button\n :key=\"tab\"\n @click=\"selectTab(tab)\"\n :id=\"`base-tabs-panel-${tab}`\"\n class=\"x-tabs-panel__list-item x-tabs-panel__button x-button\"\n :class=\"tabIsSelected(tab) ? activeTabClass : tabClass\"\n :aria-selected=\"tabIsSelected(tab).toString()\"\n data-test=\"base-tabs-panel-button\"\n role=\"tab\"\n >\n <!--\n @slot Slot used to just pass the content.\n @binding {string} tab - The tab name.\n @binding {boolean} isSelected - Indicates if the tab is selected.\n -->\n <slot name=\"tab-content\" v-bind=\"{ tab, isSelected: tabIsSelected(tab) }\">\n {{ tab }}\n </slot>\n </button>\n </slot>\n </component>\n\n <component :is=\"contentAnimation\">\n <div\n v-if=\"selectedTab && slots[selectedTab]\"\n :key=\"selectedTab\"\n :class=\"contentClass\"\n :aria-labelledby=\"`base-tabs-panel-${selectedTab}`\"\n data-test=\"base-tabs-panel-content\"\n role=\"tabpanel\"\n >\n <!--\n @slot Slot used to display the selected tab content.\n @binding {string} tab - This content's tab name.\n @binding {function} selectTab - Function to select a tab.\n @binding {function} deselectTab - Function to deselect the tab.\n -->\n <slot\n :name=\"selectedTab\"\n v-bind=\"{ tab: selectedTab, selectTab, deselectTab: () => selectTab(selectedTab) }\"\n />\n </div>\n </component>\n </section>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent, ref } from 'vue';\n import { AnimationProp } from '../../types';\n import { NoAnimation } from '../animations';\n\n /**\n * Base Tabs Panel.\n *\n * @public\n */\n export default defineComponent({\n name: 'BaseTabsPanel',\n props: {\n /**\n * Animation component that will be used to animate the tabs list.\n *\n * @public\n */\n tabsAnimation: {\n type: AnimationProp,\n default: 'header'\n },\n /**\n * Animation component that will be used to animate the selected tab content.\n *\n * @public\n */\n contentAnimation: {\n type: AnimationProp,\n default: () => NoAnimation\n },\n /**\n * The tab to be initially selected.\n *\n * @public\n */\n initialTab: {\n type: String,\n default: ''\n },\n /**\n * Allows the tabs to be unselected.\n *\n * @public\n */\n allowTabDeselect: {\n type: Boolean,\n default: false\n },\n /** Class inherited by content element. */\n activeTabClass: String,\n /** Class inherited by content element. */\n contentClass: String,\n /** Class inherited by content element. */\n tabClass: String,\n /** Class inherited by content element. */\n tabsListClass: String\n },\n setup: function (props, { slots }) {\n /**\n * The currently selected tab.\n *\n * @internal\n */\n const selectedTab = ref(props.initialTab);\n\n /**\n * Extracts the tab from the slots.\n *\n * @returns The list of tabs.\n *\n * @internal\n */\n const getTabs = () =>\n Object.keys(slots).filter(slotName => !['tab', 'tab-content'].includes(slotName));\n\n /**\n * Changes the current selected tab. If the tab is already selected\n * and `allowTabDeselect` is `true`, the tab will be unselected.\n *\n * @param tab - The tab to be selected.\n *\n * @internal\n */\n const selectTab = (tab: string) => {\n if (props.allowTabDeselect && selectedTab.value === tab) {\n selectedTab.value = '';\n } else {\n selectedTab.value = tab;\n }\n };\n\n /**\n * Checks if a tab is selected.\n *\n * @param tab - Tab to check.\n * @returns True if the tab is selected, false otherwise.\n *\n * @internal\n */\n const tabIsSelected = (tab: string) => selectedTab.value === tab;\n\n return {\n selectedTab,\n slots,\n getTabs,\n selectTab,\n tabIsSelected\n };\n }\n });\n</script>\n\n<style lang=\"css\" scoped>\n .x-tabs-panel__items-list {\n display: flex;\n }\n</style>\n\n<docs lang=\"mdx\">\n## Events\n\nThis component emits no events.\n\n## Examples\n\nThis component renders a list of tabs based on the name of the slots passed on its template. By\ndefault, the name of each slot will be used as tab label. If an initial tab is passed by prop, the\ncontent of its correspondent slot will displayed in a panel. Otherwise, no content will be displayed\nuntil a tab is selected.\n\n### Basic example\n\nIt renders a list of tabs and, when a tab is clicked, a panel with its content will be displayed.\n\n```vue\n<template>\n <BaseTabsPanel>\n <template #summer>\n <div>Summer Top Sales</div>\n </template>\n\n <template #fall>\n <div>Fall Top Sales</div>\n </template>\n\n <template #outlet>\n <div>Outlet Top Sales</div>\n </template>\n </BaseTabsPanel>\n</template>\n\n<script>\n import { BaseTabsPanel } from '@empathyco/x-components';\n\n export default {\n name: 'BaseTabsPanelDemo',\n components: {\n BaseTabsPanel\n }\n };\n</script>\n```\n\n### Play with props\n\n#### Define the tab to be initially opened\n\nBy default, no tab is selected so any panel is displayed. The `initialTab` prop allows to indicate\nwhich tab should be opened at first.\n\n```vue\n<template>\n <BaseTabsPanel initialTab=\"summer\">\n <template #summer>\n <div>Summer Top Sales</div>\n </template>\n\n <template #fall>\n <div>Fall Top Sales</div>\n </template>\n\n <template #outlet>\n <div>Outlet Top Sales</div>\n </template>\n </BaseTabsPanel>\n</template>\n\n<script>\n import { BaseTabsPanel } from '@empathyco/x-components';\n\n export default {\n name: 'BaseTabsPanelDemo',\n components: {\n BaseTabsPanel\n }\n };\n</script>\n```\n\n#### Allowing tabs deselection\n\nThe prop `allowTabDeselect` allows the tabs to be deselected. When a tab that is already selected is\nclicked again, the tab will be deselected and no panel content will be displayed. By default, this\nbehavior is deactivated.\n\n```vue\n<template>\n <BaseTabsPanel initialTab=\"summer\" allowTabDeselect>\n <template #summer>\n <div>Summer Top Sales</div>\n </template>\n\n <template #fall>\n <div>Fall Top Sales</div>\n </template>\n\n <template #outlet>\n <div>Outlet Top Sales</div>\n </template>\n </BaseTabsPanel>\n</template>\n\n<script>\n import { BaseTabsPanel } from '@empathyco/x-components';\n\n export default {\n name: 'BaseTabsPanelDemo',\n components: {\n BaseTabsPanel\n }\n };\n</script>\n```\n\n#### Customizing the content with classes\n\n- The `activeTabClass` prop can be used to add classes to the active tab button.\n- The `contentClass` prop can be used to add classes to the content.\n- The `tabClass` prop can be used to add classes to the tab buttons.\n- The `tabsListClass` prop can be used to add classes to the tabs list.\n\n```vue\n<template>\n <BaseTabsPanel\n activeTabClass=\"x-button-auxiliary\"\n contentClass=\"x-p-12 x-bg-auxiliary-25\"\n tabClass=\"x-button-ghost\"\n tabListClass=\"x-flex-col\"\n >\n <template #summer>\n <div>Summer Top Sales</div>\n </template>\n\n <template #fall>\n <div>Fall Top Sales</div>\n </template>\n\n <template #outlet>\n <div>Outlet Top Sales</div>\n </template>\n </BaseTabsPanel>\n</template>\n\n<script>\n import { BaseTabsPanel } from '@empathyco/x-components';\n\n export default {\n name: 'BaseTabsPanelDemo',\n components: {\n BaseTabsPanel\n }\n };\n</script>\n```\n\n#### Play with the animations\n\n- The `tabsAnimation` prop can be used to animate the tabs list.\n- The `contentAnimation` prop can be used to animate the selected tab content.\n\n```vue\n<template>\n <BaseTabsPanel :tabsAnimation=\"staggeredFadeAndSlide\" :contentAnimation=\"staggeredFadeAndSlide\">\n <template #summer>\n <div>Summer Top Sales</div>\n </template>\n\n <template #fall>\n <div>Fall Top Sales</div>\n </template>\n </BaseTabsPanel>\n</template>\n\n<script>\n import { BaseTabsPanel, StaggeredFadeAndSlide } from '@empathyco/x-components';\n\n export default {\n name: 'BaseTabsPanelDemo',\n components: {\n BaseTabsPanel\n },\n data() {\n return {\n staggeredFadeAndSlide: StaggeredFadeAndSlide\n };\n }\n };\n</script>\n```\n\n### Overriding the slots\n\n#### Customizing the tab button\n\nBy default, the component is rendering a button for each tab to be displayed. This button can be\nreplaced entirely through the `tab` slot.\n\n```vue\n<template>\n <BaseTabsPanel>\n <template #tab=\"{ tab, isSelected, select }\">\n <CheckIcon v-if=\"isSelected\" />\n This is the {{ tab }} tab.\n <button @click=\"select\">Open tab</button>\n </template>\n\n <template #summer>\n <div>Summer Top Sales</div>\n </template>\n\n <template #fall>\n <div>Fall Top Sales</div>\n </template>\n\n <template #outlet>\n <div>Outlet Top Sales</div>\n </template>\n </BaseTabsPanel>\n</template>\n\n<script>\n import { BaseTabsPanel, CheckIcon } from '@empathyco/x-components';\n\n export default {\n name: 'BaseTabsPanelDemo',\n components: {\n BaseTabsPanel,\n CheckIcon\n }\n };\n</script>\n```\n\n#### Customizing the tab button content\n\nAlternatively to the previous example, instead of changing the whole tab button, the slot\n`tab-content` offers the possibility of changing just its contents.\n\n```vue\n<template>\n <BaseTabsPanel>\n <template #tab-content=\"{ tab, isSelected }\">\n <CheckIcon v-if=\"isSelected\" />\n {{ tab }}\n </template>\n\n <template #summer>\n <div>Summer Top Sales</div>\n </template>\n\n <template #fall>\n <div>Fall Top Sales</div>\n </template>\n\n <template #outlet>\n <div>Outlet Top Sales</div>\n </template>\n </BaseTabsPanel>\n</template>\n\n<script>\n import { BaseTabsPanel, CheckIcon } from '@empathyco/x-components';\n\n export default {\n name: 'BaseTabsPanelDemo',\n components: {\n BaseTabsPanel,\n CheckIcon\n }\n };\n</script>\n```\n\n#### Customizing the tab panel content\n\nThe displayed tab name and a method to select a tab are exposed to the tab panel content slot.\n\n```vue\n<template>\n <BaseTabsPanel>\n <template #summer=\"{ tab, selectTab, deselectTab }\">\n <h1>{{ tab }}</h1>\n <button @click=\"() => selectTab('fall')\">Open Fall</button>\n <button @click=\"deselectTab\">Close tab</button>\n </template>\n\n <template #fall>\n <div>Fall Top Sales</div>\n </template>\n </BaseTabsPanel>\n</template>\n\n<script>\n import { BaseTabsPanel } from '@empathyco/x-components';\n\n export default {\n name: 'BaseTabsPanelDemo',\n components: {\n BaseTabsPanel\n }\n };\n</script>\n```\n</docs>\n"],"names":["_openBlock","tabsListClass","_createBlock","_resolveDynamicComponent","_normalizeClass","_createElementBlock","_Fragment","_renderList","_renderSlot","_mergeProps","selectTab","tabIsSelected","_toDisplayString","slots","_withCtx","selectedTab","contentClass","_normalizeProps","_guardReactiveProps","_createCommentVNode"],"mappings":";;;;;MACuC,UAAM,GAAA;AAAA,EAAe,GAAA,EAAA,CAAA;AAAA,EAAA,KAAA,EAAA,cAAA;;;;;AAA1D,SAAA,WAAA,CAAA,IAAA,EAAA,MAAA,EAAA,MAAA,EA8DU,eA9DV,QA8DU,EAAA;AA7DR,EAAA,OAAA,IAAA,CAAA,OAAA,EAAA,CAAA,MAAA,GAAA,CAAA,IAAAA,SA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EAAA,IAAA,CAAA,CAAA;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _sfc_main from './base-toggle-panel.vue2.js';
|
|
2
|
-
import { openBlock, createBlock, resolveDynamicComponent, withCtx, createElementBlock,
|
|
2
|
+
import { openBlock, createBlock, resolveDynamicComponent, withCtx, createElementBlock, renderSlot, createCommentVNode } from 'vue';
|
|
3
3
|
import _export_sfc from '../../_virtual/_plugin-vue_export-helper.js';
|
|
4
4
|
|
|
5
5
|
const _hoisted_1 = {
|
|
@@ -11,7 +11,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
11
11
|
return openBlock(), createBlock(resolveDynamicComponent(_ctx.animation), null, {
|
|
12
12
|
default: withCtx(() => [
|
|
13
13
|
_ctx.open ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
14
|
-
createCommentVNode(" @slot (Required) Default content "),
|
|
15
14
|
renderSlot(_ctx.$slots, "default")
|
|
16
15
|
])) : createCommentVNode("v-if", true)
|
|
17
16
|
]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-toggle-panel.vue.js","sources":["../../../../src/components/panels/base-toggle-panel.vue"],"sourcesContent":["<template>\n <component :is=\"animation\">\n <div v-if=\"open\" class=\"x-toggle-panel\" data-test=\"base-toggle-panel\">\n <!-- @slot (Required) Default content -->\n <slot />\n </div>\n </component>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent } from 'vue';\n import { AnimationProp } from '../../types/animation-prop';\n\n /**\n * Simple panel that receives its open state via prop, which is responsible of rendering\n * default slot inside a configurable transition.\n *\n * @public\n */\n export default defineComponent({\n props: {\n /**\n * Handles if the panel is rendered. It is used with v-if instead of v-show to get better\n * performance.\n *\n * @public\n */\n open: {\n type: Boolean,\n required: true\n },\n /**\n * Animation component that will be used to animate the panel content.\n *\n * @public\n */\n animation: {\n type: AnimationProp,\n default: 'div'\n }\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\nSimple panel that receives its open state via prop, which is responsible of rendering default slot\ninside a configurable transition.\n\n### Basic usage\n\nUsing default slot:\n\n```vue\n<BaseTogglePanel :open=\"true\" :animation=\"collapseFromTop\">\n <Filters :filters=\"filters\">\n <template #default=\"{ filter }\">\n <p>{{ filter.label }}</p>\n </template>\n </Filters>\n</BaseTogglePanel>\n```\n</docs>\n"],"names":["open","_createBlock","_resolveDynamicComponent","_withCtx","
|
|
1
|
+
{"version":3,"file":"base-toggle-panel.vue.js","sources":["../../../../src/components/panels/base-toggle-panel.vue"],"sourcesContent":["<template>\n <component :is=\"animation\">\n <div v-if=\"open\" class=\"x-toggle-panel\" data-test=\"base-toggle-panel\">\n <!-- @slot (Required) Default content -->\n <slot />\n </div>\n </component>\n</template>\n\n<script lang=\"ts\">\n import { defineComponent } from 'vue';\n import { AnimationProp } from '../../types/animation-prop';\n\n /**\n * Simple panel that receives its open state via prop, which is responsible of rendering\n * default slot inside a configurable transition.\n *\n * @public\n */\n export default defineComponent({\n props: {\n /**\n * Handles if the panel is rendered. It is used with v-if instead of v-show to get better\n * performance.\n *\n * @public\n */\n open: {\n type: Boolean,\n required: true\n },\n /**\n * Animation component that will be used to animate the panel content.\n *\n * @public\n */\n animation: {\n type: AnimationProp,\n default: 'div'\n }\n }\n });\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\nSimple panel that receives its open state via prop, which is responsible of rendering default slot\ninside a configurable transition.\n\n### Basic usage\n\nUsing default slot:\n\n```vue\n<BaseTogglePanel :open=\"true\" :animation=\"collapseFromTop\">\n <Filters :filters=\"filters\">\n <template #default=\"{ filter }\">\n <p>{{ filter.label }}</p>\n </template>\n </Filters>\n</BaseTogglePanel>\n```\n</docs>\n"],"names":["open","_createBlock","_resolveDynamicComponent","_withCtx","_openBlock","_createElementBlock","_renderSlot","_createCommentVNode"],"mappings":";;;;MAEqB,UAAM,GAAA;AAAA,EAAiB,GAAA,EAAA,CAAA;AAAA,EAAA,KAAA,EAAA,gBAAA;;;SAF5C,WAKU,CAAA,IAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,KAAA,EAAA,QAAA,EAAA;SAHKA,SAAI,EAAA,EAAAC,WAAA,CAAAC,uBAAA,CAAA,IAAA,CAAA,SAAA,CAAA,EAAA,IAAA,EAAA;AAAA,IAAf,OAAA,EAAAC,OAAA,CAAA,MAAA;AAAA,MAEE,IAAA,CAAA,IAAA,IAAAC,SAAA,EAAA,EAAAC,kBAAA,CAAA,KAAA,EAAA,UAAA,EAAA;AAJN,QAAAC,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,CAAA;AAAA,OAAA,CAAA,IAAAC,kBAAA,CAAA,MAAA,EAAA,IAAA,CAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _sfc_main from './base-result-add-to-cart.vue2.js';
|
|
2
|
-
import { resolveComponent, openBlock, createBlock, withCtx,
|
|
2
|
+
import { resolveComponent, openBlock, createBlock, withCtx, renderSlot } from 'vue';
|
|
3
3
|
import _export_sfc from '../../_virtual/_plugin-vue_export-helper.js';
|
|
4
4
|
|
|
5
5
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
@@ -10,7 +10,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
10
10
|
"data-test": "result-add-to-cart"
|
|
11
11
|
}, {
|
|
12
12
|
default: withCtx(() => [
|
|
13
|
-
createCommentVNode(" @slot (Required) Button content with a text, an icon or both "),
|
|
14
13
|
renderSlot(_ctx.$slots, "default")
|
|
15
14
|
]),
|
|
16
15
|
_: 3
|
|
@@ -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 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\">\n import { Result } from '@empathyco/x-types';\n import { computed, defineComponent, PropType } from 'vue';\n import { XEventsTypes } from '../../wiring/events.types';\n import 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 */\n export 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 events to be emitted by the button.\n *\n * @returns Events {@link XEventsTypes} to emit.\n *\n * @public\n */\n const events = computed<Partial<XEventsTypes>>(() => ({\n UserClickedResultAddToCart: props.result\n }));\n\n return {\n events\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":["_resolveComponent","_openBlock","_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 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\">\n import { Result } from '@empathyco/x-types';\n import { computed, defineComponent, PropType } from 'vue';\n import { XEventsTypes } from '../../wiring/events.types';\n import 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 */\n export 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 events to be emitted by the button.\n *\n * @returns Events {@link XEventsTypes} to emit.\n *\n * @public\n */\n const events = computed<Partial<XEventsTypes>>(() => ({\n UserClickedResultAddToCart: props.result\n }));\n\n return {\n events\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":["_resolveComponent","_openBlock","_createBlock","_renderSlot"],"mappings":";;;;;AAQoB,EAAA,MAAA,0BAAA,GAAAA,gBAAA,CAAA,iBAAA,CAAA,CAAA;AALX,EAAA,OAAAC,SAAA,EAAgC,EAAAC,WAAA,CAAA,0BAAA,EAAA;AAAA,IACrC,MAAU,EAAA,IAAA,CAAA,MAAA;AAAA,IAAA,KAAA,EAAA,+BAAA;AAJd,IAAA,WAAA,EAAA,oBAAA;AAAA,GAAA,EAAA;;AAAA,MAAAC,UAAA,CAAA,IAAA,CAAA,MAAA,EAAA,SAAA,CAAA;AAAA,KAAA,CAAA;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _sfc_main from './base-result-current-price.vue2.js';
|
|
2
|
-
import { resolveComponent, openBlock, createElementBlock, normalizeClass,
|
|
2
|
+
import { resolveComponent, openBlock, createElementBlock, normalizeClass, renderSlot, createVNode } from 'vue';
|
|
3
3
|
import _export_sfc from '../../_virtual/_plugin-vue_export-helper.js';
|
|
4
4
|
|
|
5
5
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
@@ -11,7 +11,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
11
11
|
"data-test": "result-current-price"
|
|
12
12
|
},
|
|
13
13
|
[
|
|
14
|
-
createCommentVNode("\n @slot Base currency item\n @binding {result} result - Result data\n "),
|
|
15
14
|
renderSlot(_ctx.$slots, "default", { result: _ctx.result }, () => [
|
|
16
15
|
createVNode(_component_BaseCurrency, {
|
|
17
16
|
value: _ctx.result.price.value,
|
|
@@ -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\">\n import { Result } from '@empathyco/x-types';\n import { computed, defineComponent, PropType } from 'vue';\n import { VueCSSClasses } from '../../utils/types';\n import 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 */\n export 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":["_resolveComponent","_openBlock","_createElementBlock","_normalizeClass","
|
|
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\">\n import { Result } from '@empathyco/x-types';\n import { computed, defineComponent, PropType } from 'vue';\n import { VueCSSClasses } from '../../utils/types';\n import 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 */\n export 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":["_resolveComponent","_openBlock","_createElementBlock","_normalizeClass","result","_createVNode","format"],"mappings":";;;;;kCACEA,gBAQM,CAAA,cAAA,CAAA,CAAA;SARsDC,SAAU,EAAA,EAAAC,kBAAA;AAAA,IAAsB,KAAA;AAAA,IAAA;AAAA,MAAA,KAAA,EAAAC,cAAA,CAAA,CAAA,IAAA,CAAA,cAAA,EAAA,wBAAA,CAAA,CAAA;MAK1F,WAEO,EAAA,sBAAA;AAAA,KAAA;;AADiBC,MAAAA,UAAAA,CAAAA,IAAAA,CAAAA,MAAAA,EAAO,SAAW,EAAA,EAAA,MAAA,EAAA,IAAA,CAAA,MAAA,EAAA,EAAA,MAAA;AAAA,QAAAC,WAAA,CAAWC,uBAAM,EAAA;AAAA,UAAA,KAAA,EAAA,IAAA,CAAA,MAAA,CAAA,KAAA,CAAA,KAAA;;;;;;;;;;;;;"}
|