UNPKG

reka-ui

Version:

Vue port for Radix UI Primitives.

1 lines 1.84 kB
{"version":3,"file":"ListboxContent.cjs","sources":["../../src/Listbox/ListboxContent.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { Primitive, type PrimitiveProps } from '..'\nimport { injectListboxRootContext } from './ListboxRoot.vue'\nimport { refAutoReset } from '@vueuse/shared'\n\nexport interface ListboxContentProps extends PrimitiveProps { }\n</script>\n\n<script setup lang=\"ts\">\nimport { useCollection } from '@/Collection'\n\ndefineProps<ListboxContentProps>()\n\nconst { CollectionSlot } = useCollection()\nconst rootContext = injectListboxRootContext()\n\nconst isClickFocus = refAutoReset(false, 10)\n</script>\n\n<template>\n <CollectionSlot>\n <Primitive\n role=\"listbox\"\n :as=\"as\"\n :as-child=\"asChild\"\n :tabindex=\"rootContext.focusable.value ? rootContext.highlightedElement.value ? '-1' : '0' : undefined\"\n :aria-orientation=\"rootContext.orientation.value\"\n :aria-multiselectable=\"!!rootContext.multiple.value\"\n :data-orientation=\"rootContext.orientation.value\"\n @mousedown.left=\"isClickFocus = true\"\n @focus=\"(ev) => {\n if (isClickFocus)\n return\n rootContext.onEnter(ev)\n }\"\n @keydown.down.up.left.right.home.end.prevent=\"(event) => {\n rootContext.focusable.value ? rootContext.onKeydownNavigation(event) : undefined\n }\"\n @keydown.enter=\"rootContext.onKeydownEnter\"\n @keydown=\"rootContext.onKeydownTypeAhead\"\n >\n <slot />\n </Primitive>\n </CollectionSlot>\n</template>\n"],"names":["useCollection","injectListboxRootContext","refAutoReset"],"mappings":";;;;;;;;;;;;;;;;AAaA,IAAM,MAAA,EAAE,cAAe,EAAA,GAAIA,mCAAc,EAAA;AACzC,IAAA,MAAM,cAAcC,4CAAyB,EAAA;AAE7C,IAAM,MAAA,YAAA,GAAeC,mBAAa,CAAA,KAAA,EAAO,EAAE,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}