Files
heroui-vue/packages/vue/src/components/button-group/context.ts
T

28 lines
1001 B
TypeScript

import type { ComputedRef, InjectionKey } from "vue";
import type { ButtonVariants, buttonGroupVariants } from "@heroui-vue/styles";
/** Marks direct children of ButtonGroup so nested Buttons do not inherit group props. */
export const BUTTON_GROUP_CHILD = "__button_group_child" as const;
export type ButtonGroupSlots = ReturnType<typeof buttonGroupVariants>;
export interface ButtonGroupContextValue {
slots: ButtonGroupSlots;
size?: ButtonVariants["size"];
variant?: ButtonVariants["variant"];
isDisabled?: boolean;
fullWidth?: boolean;
orientation: "horizontal" | "vertical";
}
export type ButtonGroupContext = ComputedRef<ButtonGroupContextValue>;
export const buttonGroupContextKey: InjectionKey<ButtonGroupContext> = Symbol(
"HeroUIVue.ButtonGroup",
);
/** Orientation inherited by ButtonGroup when nested in ToggleButtonGroup. */
export const buttonGroupOrientationKey: InjectionKey<
ComputedRef<"horizontal" | "vertical">
> = Symbol("HeroUIVue.ButtonGroupOrientation");