@empathyco/x-components
Version:
Empathy X Components
61 lines (58 loc) • 1.83 kB
JavaScript
import { defineComponent, computed } from 'vue';
import BaseSuggestion from '../../../components/suggestions/base-suggestion.vue.js';
import { nextQueriesXModule } from '../x-module.js';
/**
* Renders a next query item which receives the suggestion that will be rendered as a prop. It
* exposes a default slot to change the next query content. If the slot is not overridden,
* it will render the suggestion query by default.
*
* @public
*/
var _sfc_main = defineComponent({
name: 'NextQuery',
xModule: nextQueriesXModule.name,
components: { BaseSuggestion },
props: {
/**
* The suggestion to render and use in the default slot.
*
* @public
*/
suggestion: {
type: Object,
required: true,
},
/**
* Indicates if the curated next query should be highlighted.
*
* @public
*/
highlightCurated: {
type: Boolean,
default: false,
},
},
setup(props) {
/**
* Events list which are going to be emitted when a next query is selected.
*
* @returns The {@link XEvent} to emit.
* @public
*/
const events = computed(() => ({ UserSelectedANextQuery: props.suggestion }));
/**
* Checks if the next query is curated and if it should be highlighted.
*
* @returns True if the next query is curated and should be highlighted.
*
* @internal
*/
const shouldHighlightCurated = computed(() => props.highlightCurated && (props.suggestion.isCurated ?? false));
return {
events,
shouldHighlightCurated,
};
},
});
export { _sfc_main as default };
//# sourceMappingURL=next-query.vue2.js.map