UNPKG

@empathyco/x-components

Version:
65 lines (62 loc) 1.92 kB
import { defineComponent, provide, computed } from 'vue'; import { useState } from '../../../composables/use-state.js'; import { AnimationProp } from '../../../types/animation-prop.js'; import { identifierResultsXModule } from '../x-module.js'; /** * Paints the list of identifier results stored in the state. Each identifier result should be * represented by a {@link IdentifierResult} component besides any * other component. * * @public */ var _sfc_main = defineComponent({ name: 'IdentifierResults', xModule: identifierResultsXModule.name, props: { /** * Animation component that will be used to animate the identifier results. * * @public */ animation: { type: AnimationProp, default: 'ul', }, /** * Number of identifier results to render. * * @public */ maxItemsToRender: Number, }, setup(props) { /** * The module's list of identifier results. * * @public */ const { identifierResults } = useState('identifierResults'); /** * The additional events to be emitted by the mandatory {@link BaseResultLink} component. * * @public */ provide('resultClickExtraEvents', [ 'UserClickedAIdentifierResult', ]); /** * Slices the identifier results from the state. * * @returns - The list of identifier results sliced by the number of items to render. * * @internal */ const identifierResultsToRender = computed(() => identifierResults.value.slice(0, props.maxItemsToRender)); return { identifierResults, identifierResultsToRender, }; }, }); export { _sfc_main as default }; //# sourceMappingURL=identifier-results.vue2.js.map