UNPKG

reka-ui

Version:

Vue port for Radix UI Primitives.

1 lines 2.27 kB
{"version":3,"file":"ToolbarRoot.cjs","sources":["../../src/Toolbar/ToolbarRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Ref } from 'vue'\nimport type { PrimitiveProps } from '@/Primitive'\nimport type { DataOrientation, Direction } from '@/shared/types'\nimport { createContext, useDirection, useForwardExpose } from '@/shared'\n\nexport interface ToolbarRootProps extends PrimitiveProps {\n /** The orientation of the toolbar */\n orientation?: DataOrientation\n /** The reading direction of the combobox when applicable. <br> If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. */\n dir?: Direction\n /** When `true`, keyboard navigation will loop from last tab to first, and vice versa. */\n loop?: boolean\n}\n\nexport interface ToolbarRootContext {\n orientation: Ref<DataOrientation>\n dir: Ref<Direction>\n}\n\nexport const [injectToolbarRootContext, provideToolbarRootContext]\n = createContext<ToolbarRootContext>('ToolbarRoot')\n</script>\n\n<script setup lang=\"ts\">\nimport { toRefs } from 'vue'\nimport { Primitive } from '@/Primitive'\nimport { RovingFocusGroup } from '@/RovingFocus'\n\nconst props = withDefaults(defineProps<ToolbarRootProps>(), {\n orientation: 'horizontal',\n})\nconst { orientation, dir: propDir } = toRefs(props)\nconst dir = useDirection(propDir)\nconst { forwardRef } = useForwardExpose()\n\nprovideToolbarRootContext({ orientation, dir })\n</script>\n\n<template>\n <RovingFocusGroup\n as-child\n :orientation=\"orientation\"\n :dir=\"dir\"\n :loop=\"loop\"\n >\n <Primitive\n :ref=\"forwardRef\"\n role=\"toolbar\"\n :aria-orientation=\"orientation\"\n :as-child=\"asChild\"\n :as=\"as\"\n >\n <slot />\n </Primitive>\n </RovingFocusGroup>\n</template>\n"],"names":["createContext","toRefs","useDirection","useForwardExpose"],"mappings":";;;;;;;;;AAoBO,MAAM,CAAC,wBAAA,EAA0B,yBAAyB,CAAA,GAC7DA,mCAAkC,aAAa;;;;;;;;;;;AAQnD,IAAA,MAAM,KAAQ,GAAA,OAAA;AAGd,IAAA,MAAM,EAAE,WAAa,EAAA,GAAA,EAAK,OAAQ,EAAA,GAAIC,WAAO,KAAK,CAAA;AAClD,IAAM,MAAA,GAAA,GAAMC,iCAAa,OAAO,CAAA;AAChC,IAAM,MAAA,EAAE,UAAW,EAAA,GAAIC,wCAAiB,EAAA;AAExC,IAA0B,yBAAA,CAAA,EAAE,WAAa,EAAA,GAAA,EAAK,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}