Files
tools/vue/primitives/src/menu/MenuRadioGroup.vue
T
robonen 626fbc70d8 fix(primitives): eslint/tsconfig migration, asChild refactor, type fixes
- Migrate to eslint flat config + composite tsconfig.
- Complete the asChild→as="template" refactor (remove asChild prop + :as-child
  bindings across components, matching Primitive's slot model).
- Fix test type errors and source type-safety (useGraceArea hull/point math,
  FocusScope/util ref typing).

Note: ~53 vue-tsc errors remain (HTML attr/event passthrough typing on
transparent wrapper components + a couple of duplicate-export naming
collisions) — not gated by CI (build/lint/test green); pending a
component-attribute-typing design decision.
2026-06-07 16:29:56 +07:00

39 lines
932 B
Vue

<script lang="ts">
import type { PrimitiveProps } from '../primitive';
export interface MenuRadioGroupProps extends PrimitiveProps {
modelValue?: string;
defaultValue?: string;
}
export interface MenuRadioGroupEmits {
'update:modelValue': [value: string];
}
</script>
<script setup lang="ts">
import { computed, ref } from 'vue';
import { Primitive } from '../primitive';
import { provideMenuRadioGroupContext } from './context';
const { modelValue, defaultValue, as = 'div' } = defineProps<MenuRadioGroupProps>();
const emit = defineEmits<MenuRadioGroupEmits>();
const local = ref(defaultValue);
const value = computed(() => modelValue !== undefined ? modelValue : local.value);
provideMenuRadioGroupContext({
modelValue: value,
onValueChange: (v) => {
local.value = v;
emit('update:modelValue', v);
},
});
</script>
<template>
<Primitive :as="as" role="group">
<slot />
</Primitive>
</template>