UNPKG

reka-ui

Version:

Vue port for Radix UI Primitives.

1 lines 1.63 kB
{"version":3,"file":"PaginationListItem.cjs","sources":["../../src/Pagination/PaginationListItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\nimport { useForwardExpose } from '@/shared'\n\nexport interface PaginationListItemProps extends PrimitiveProps {\n /** Value for the page */\n value: number\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { Primitive } from '@/Primitive'\nimport { injectPaginationRootContext } from './PaginationRoot.vue'\n\nconst props = withDefaults(defineProps<PaginationListItemProps>(), { as: 'button' })\nuseForwardExpose()\n\nconst rootContext = injectPaginationRootContext()\nconst isSelected = computed(() => rootContext.page.value === props.value)\n\nconst disabled = computed((): boolean => rootContext.disabled.value)\n</script>\n\n<template>\n <Primitive\n v-bind=\"props\"\n data-type=\"page\"\n :aria-label=\"`Page ${value}`\"\n :aria-current=\"isSelected ? 'page' : undefined\"\n :data-selected=\"isSelected ? 'true' : undefined\"\n :disabled\n :type=\"as === 'button' ? 'button' : undefined\"\n @click=\"!disabled && rootContext.onPageChange(value)\"\n >\n <slot>{{ value }}</slot>\n </Primitive>\n</template>\n"],"names":["useForwardExpose","injectPaginationRootContext","computed"],"mappings":";;;;;;;;;;;;;;;AAeA,IAAA,MAAM,KAAQ,GAAA,OAAA;AACd,IAAiBA,wCAAA,EAAA;AAEjB,IAAA,MAAM,cAAcC,qDAA4B,EAAA;AAChD,IAAA,MAAM,aAAaC,YAAS,CAAA,MAAM,YAAY,IAAK,CAAA,KAAA,KAAU,MAAM,KAAK,CAAA;AAExE,IAAA,MAAM,QAAW,GAAAA,YAAA,CAAS,MAAe,WAAA,CAAY,SAAS,KAAK,CAAA;;;;;;;;;;;;;;;;;;;;;;;;"}