@nuxt/ui
Version:
A UI Library for Modern Web Apps, powered by Vue & Tailwind CSS.
20 lines (19 loc) • 635 B
JavaScript
import { computed, defineComponent, inject, provide } from "vue";
export const fieldGroupInjectionKey = Symbol("nuxt-ui.field-group");
export function useFieldGroup(props) {
const fieldGroup = inject(fieldGroupInjectionKey, void 0);
return {
orientation: computed(() => fieldGroup?.value.orientation),
size: computed(() => props?.size ?? fieldGroup?.value.size)
};
}
export const FieldGroupReset = defineComponent({
name: "FieldGroupReset",
setup(_, { slots }) {
provide(fieldGroupInjectionKey, computed(() => ({
size: void 0,
orientation: void 0
})));
return () => slots.default?.();
}
});