UNPKG

@empathyco/x-components

Version:
58 lines (55 loc) 1.6 kB
import { defineComponent, computed } from 'vue'; import { useState } from '../../../composables/use-state.js'; import { AnimationProp } from '../../../types/animation-prop.js'; import { searchXModule } from '../x-module.js'; /** * It renders a list of partial results from {@link SearchState.partialResults} by default. * It also provides the partial result slot to customize the item with the partial result bound. * * @public */ var _sfc_main = defineComponent({ name: 'PartialResultsList', xModule: searchXModule.name, props: { /** * Animation component that will be used to animate the partial results. * * @public */ animation: { type: AnimationProp, default: 'ul', }, /** * Maximum number of partial results to show. * * @public */ maxItemsToRender: { type: Number, default: 5, }, }, setup(props) { /** * The partials results from the search state. * * @public */ const items = useState('search').partialResults; /** * A limited number of partial results. * * @returns The partial results sliced by the maxItemsToRender. * * @internal */ const partialResults = computed(() => items.value.slice(0, props.maxItemsToRender)); return { partialResults, }; }, }); export { _sfc_main as default }; //# sourceMappingURL=partial-results-list.vue2.js.map