"use client"; import { attachmentInput, type AttachmentInputVariantProps, } from "@seed-design/css/recipes/attachment-input"; import { field, type FieldVariantProps } from "@seed-design/css/recipes/field"; import { fieldLabel, type FieldLabelVariantProps } from "@seed-design/css/recipes/field-label"; import { AttachmentDisplay as AttachmentDisplayPrimitive, useAttachmentDisplayContext, } from "@seed-design/react-attachment-display"; import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive"; import clsx from "clsx"; import * as React from "react"; import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext"; import { createWithStateProps } from "../../utils/createWithStateProps"; import { InternalIcon } from "../private/Icon"; const { withProvider: withAttachmentInputProvider, withContext: withAttachmentInputContext } = createSlotRecipeContext(attachmentInput); const { withProvider: withFieldProvider, withContext: withFieldContext } = createSlotRecipeContext(field); const { withProvider: withLabelProvider, withContext: withLabelContext, useClassNames: useLabelClassNames, } = createSlotRecipeContext(fieldLabel); const withStateProps = createWithStateProps([useAttachmentDisplayContext]); //////////////////////////////////////////////////////////////////////////////////// export interface AttachmentDisplayRootProps extends FieldVariantProps, AttachmentDisplayPrimitive.RootProps {} export const AttachmentDisplayRoot = withFieldProvider( AttachmentDisplayPrimitive.Root, "root", ); //////////////////////////////////////////////////////////////////////////////////// export interface AttachmentDisplayHeaderProps extends PrimitiveProps, React.HTMLAttributes {} export const AttachmentDisplayHeader = withFieldContext< HTMLDivElement, AttachmentDisplayHeaderProps >(withStateProps(Primitive.div), "header"); export interface AttachmentDisplayLabelProps extends PrimitiveProps, FieldLabelVariantProps, React.HTMLAttributes {} export const AttachmentDisplayLabel = withLabelProvider< HTMLDivElement, AttachmentDisplayLabelProps >(withStateProps(Primitive.div), "root"); export interface AttachmentDisplayIndicatorTextProps extends PrimitiveProps, React.HTMLAttributes {} export const AttachmentDisplayIndicatorText = withLabelContext< HTMLSpanElement, AttachmentDisplayIndicatorTextProps >(withStateProps(Primitive.span), "indicatorText"); export interface AttachmentDisplayRequiredIndicatorProps extends React.SVGProps {} export const AttachmentDisplayRequiredIndicator = React.forwardRef< SVGSVGElement, AttachmentDisplayRequiredIndicatorProps >(({ className, ...props }, ref) => { const { indicatorIcon } = useLabelClassNames(); return ( } ref={ref} {...props} /> ); }); AttachmentDisplayRequiredIndicator.displayName = "AttachmentDisplayRequiredIndicator"; //////////////////////////////////////////////////////////////////////////////////// export interface AttachmentDisplayControlProps extends AttachmentInputVariantProps, PrimitiveProps, React.HTMLAttributes {} export const AttachmentDisplayControl = withAttachmentInputProvider< HTMLDivElement, AttachmentDisplayControlProps >(withStateProps(Primitive.div), "root"); export interface AttachmentDisplayContainerProps extends PrimitiveProps, React.HTMLAttributes {} export const AttachmentDisplayContainer = withAttachmentInputContext< HTMLDivElement, AttachmentDisplayContainerProps >(withStateProps(Primitive.div), "container"); export interface AttachmentDisplayItemGroupProps extends PrimitiveProps, React.HTMLAttributes {} export const AttachmentDisplayItemGroup = withAttachmentInputContext< HTMLUListElement, AttachmentDisplayItemGroupProps >(withStateProps(Primitive.ul), "itemGroup"); //////////////////////////////////////////////////////////////////////////////////// export interface AttachmentDisplayFooterProps extends PrimitiveProps, React.HTMLAttributes {} export const AttachmentDisplayFooter = withFieldContext< HTMLDivElement, AttachmentDisplayFooterProps >(withStateProps(Primitive.div), "footer"); export interface AttachmentDisplayDescriptionProps extends AttachmentDisplayPrimitive.DescriptionProps {} export const AttachmentDisplayDescription = withFieldContext< HTMLSpanElement, AttachmentDisplayDescriptionProps >(AttachmentDisplayPrimitive.Description, "description"); export interface AttachmentDisplayErrorMessageProps extends AttachmentDisplayPrimitive.ErrorMessageProps {} export const AttachmentDisplayErrorMessage = withFieldContext< HTMLSpanElement, AttachmentDisplayErrorMessageProps >(AttachmentDisplayPrimitive.ErrorMessage, "errorMessage"); //////////////////////////////////////////////////////////////////////////////////// export interface AttachmentDisplayContextProps extends AttachmentDisplayPrimitive.ContextProps {} export const AttachmentDisplayContext = AttachmentDisplayPrimitive.Context;