@empathyco/x-components
Version:
Empathy X Components
59 lines (56 loc) • 1.82 kB
JavaScript
import { defineComponent, computed } from 'vue';
import BaseSuggestions from '../../../components/suggestions/base-suggestions.vue.js';
import { useGetter } from '../../../composables/use-getter.js';
import { nextQueriesXModule } from '../x-module.js';
import NextQuery from './next-query.vue.js';
/**
* Simple next-queries component that renders a list of
* [`BaseSuggestions`](./x-components.base-suggestions.md),
* allowing the user to select one of them, and emitting the needed events. A next query is a
* suggestion for a new search, related to your previous query. I.e. If people normally search
* for `shirts`, and then `trousers`, `trousers` would be a next query of `shirts`.
*
* @public
*/
var _sfc_main = defineComponent({
name: 'NextQueries',
xModule: nextQueriesXModule.name,
components: {
NextQuery,
BaseSuggestions,
},
props: {
/**
* Flag to indicate if the curated next queries should be displayed different.
*
* @public
*/
highlightCurated: {
type: Boolean,
default: false,
},
/**
* NextQueries list to be used instead of state NextQueries.
*
* @public
*/
suggestions: Array,
},
setup(props) {
/**
* The list of next queries from the state.
*
* @internal
*/
const stateNextQueries = useGetter('nextQueries').nextQueries;
/**.
* The list of next queries finally rendered
*
* @internal
*/
const renderedNextQueries = computed(() => props.suggestions ?? stateNextQueries.value);
return { renderedNextQueries };
},
});
export { _sfc_main as default };
//# sourceMappingURL=next-queries.vue2.js.map