reka-ui
Version:
Vue port for Radix UI Primitives.
1 lines • 2.32 kB
Source Map (JSON)
{"version":3,"file":"ConfigProvider.cjs","sources":["../../src/ConfigProvider/ConfigProvider.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Direction, ScrollBodyOption } from '@/shared/types'\nimport type { Ref } from 'vue'\nimport { createContext } from '@/shared'\n\ninterface ConfigProviderContextValue {\n dir?: Ref<Direction>\n locale?: Ref<string>\n scrollBody?: Ref<boolean | ScrollBodyOption>\n nonce?: Ref<string | undefined>\n useId?: () => string\n}\n\nexport const [injectConfigProviderContext, provideConfigProviderContext]\n = createContext<ConfigProviderContextValue>('ConfigProvider')\n\nexport interface ConfigProviderProps {\n /**\n * The global reading direction of your application. This will be inherited by all primitives.\n * @defaultValue 'ltr'\n */\n dir?: Direction\n /**\n * The global locale of your application. This will be inherited by all primitives.\n * @defaultValue 'en'\n */\n locale?: string\n /**\n * The global scroll body behavior of your application. This will be inherited by the related primitives.\n * @type boolean | ScrollBodyOption\n */\n scrollBody?: boolean | ScrollBodyOption\n /**\n * The global `nonce` value of your application. This will be inherited by the related primitives.\n * @type string\n */\n nonce?: string\n /**\n * The global `useId` injection as a workaround for preventing hydration issue.\n */\n useId?: () => string\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { toRefs } from 'vue'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst props = withDefaults(defineProps<ConfigProviderProps>(), {\n dir: 'ltr',\n locale: 'en',\n scrollBody: true,\n nonce: undefined,\n useId: undefined,\n})\n\nconst { dir, locale, scrollBody, nonce } = toRefs(props)\n\nprovideConfigProviderContext({\n dir,\n locale,\n scrollBody,\n nonce,\n useId: props.useId,\n})\n</script>\n\n<template>\n <slot />\n</template>\n"],"names":["createContext","toRefs"],"mappings":";;;;;AAaO,MAAM,CAAC,2BAAA,EAA6B,4BAA4B,CAAA,GACnEA,mCAA0C,gBAAgB;;;;;;;;;;;;;;AAqC9D,IAAA,MAAM,KAAQ,GAAA,OAAA;AAQd,IAAA,MAAM,EAAE,GAAK,EAAA,MAAA,EAAQ,YAAY,KAAM,EAAA,GAAIC,WAAO,KAAK,CAAA;AAEvD,IAA6B,4BAAA,CAAA;AAAA,MAC3B,GAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,MACA,KAAA;AAAA,MACA,OAAO,KAAM,CAAA;AAAA,KACd,CAAA;;;;;;;;;;"}