import { chip, type ChipVariantProps } from "@seed-design/css/recipes/chip"; import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive"; import type * as React from "react"; import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext"; import { withIconRequired } from "../Icon/Icon"; import { createWithStateProps } from "../../utils/createWithStateProps"; import { useCheckboxContext } from "@seed-design/react-checkbox"; import { useRadioGroupItemContext } from "@seed-design/react-radio-group"; const { withProvider, withContext } = createSlotRecipeContext(chip); const withStateProps = createWithStateProps([ { useContext: useCheckboxContext, strict: false }, { useContext: useRadioGroupItemContext, strict: false }, ]); //////////////////////////////////////////////////////////////////////////////////// export interface ChipRootProps extends PrimitiveProps, ChipVariantProps, React.ButtonHTMLAttributes {} export const ChipRoot = withIconRequired( withProvider(Primitive.button, "root"), (props: ChipRootProps) => props.layout === "iconOnly", ); ChipRoot.displayName = "Chip.Root"; //////////////////////////////////////////////////////////////////////////////////// export interface ChipLabelProps extends PrimitiveProps, React.HTMLAttributes {} export const ChipLabel = withContext( withStateProps(Primitive.span), "label", ); ChipLabel.displayName = "Chip.Label"; //////////////////////////////////////////////////////////////////////////////////// export interface ChipPrefixIconProps extends PrimitiveProps, React.HTMLAttributes {} export const ChipPrefixIcon = withContext( withStateProps(Primitive.div), "prefixIcon", ); ChipPrefixIcon.displayName = "Chip.PrefixIcon"; //////////////////////////////////////////////////////////////////////////////////// export interface ChipPrefixAvatarProps extends PrimitiveProps, React.HTMLAttributes {} export const ChipPrefixAvatar = withContext( withStateProps(Primitive.div), "prefixAvatar", ); ChipPrefixAvatar.displayName = "Chip.PrefixAvatar"; //////////////////////////////////////////////////////////////////////////////////// export interface ChipSuffixIconProps extends PrimitiveProps, React.HTMLAttributes {} export const ChipSuffixIcon = withContext( withStateProps(Primitive.div), "suffixIcon", ); ChipSuffixIcon.displayName = "Chip.SuffixIcon";