import { Dialog as DialogPrimitive, useDialogContext } from "@seed-design/react-dialog"; import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive"; import { menuSheet, type MenuSheetVariantProps } from "@seed-design/css/recipes/menu-sheet"; import { menuSheetItem, type MenuSheetItemVariantProps, } from "@seed-design/css/recipes/menu-sheet-item"; import * as React from "react"; import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext"; import { createWithStateProps } from "../../utils/createWithStateProps"; import clsx from "clsx"; const { withRootProvider, withContext, useClassNames } = createSlotRecipeContext(menuSheet); const { PropsProvider: ItemPropsProvider, useProps: useItemProps, withContext: withItemContext, ClassNamesProvider: ItemClassNamesProvider, } = createSlotRecipeContext(menuSheetItem); const withStateProps = createWithStateProps([useDialogContext]); //////////////////////////////////////////////////////////////////////////////////// /** * @deprecated Use `SwipeableMenuSheet` instead. */ export interface MenuSheetRootProps extends MenuSheetVariantProps, DialogPrimitive.RootProps { /** * @default true */ lazyMount?: DialogPrimitive.RootProps["lazyMount"]; /** * @default true */ unmountOnExit?: DialogPrimitive.RootProps["unmountOnExit"]; } /** * @deprecated Use `SwipeableMenuSheet` instead. */ export const MenuSheetRoot = withRootProvider(DialogPrimitive.Root, { defaultProps: { lazyMount: true, unmountOnExit: true, }, }); //////////////////////////////////////////////////////////////////////////////////// /** * @deprecated Use `SwipeableMenuSheet` instead. */ export interface MenuSheetTriggerProps extends DialogPrimitive.TriggerProps {} /** * @deprecated Use `SwipeableMenuSheet` instead. */ export const MenuSheetTrigger = DialogPrimitive.Trigger; //////////////////////////////////////////////////////////////////////////////////// /** * @deprecated Use `SwipeableMenuSheet` instead. */ export interface MenuSheetPositionerProps extends DialogPrimitive.PositionerProps {} /** * @deprecated Use `SwipeableMenuSheet` instead. */ export const MenuSheetPositioner = withContext( DialogPrimitive.Positioner, "positioner", ); //////////////////////////////////////////////////////////////////////////////////// /** * @deprecated Use `SwipeableMenuSheet` instead. */ export interface MenuSheetBackdropProps extends DialogPrimitive.BackdropProps {} /** * @deprecated Use `SwipeableMenuSheet` instead. */ export const MenuSheetBackdrop = withContext( DialogPrimitive.Backdrop, "backdrop", ); //////////////////////////////////////////////////////////////////////////////////// /** * @deprecated Use `SwipeableMenuSheet` instead. */ export interface MenuSheetContentProps extends DialogPrimitive.ContentProps, Pick {} /** * @deprecated Use `SwipeableMenuSheet` instead. */ export const MenuSheetContent = React.forwardRef( ({ className, ...props }, ref) => { const [variantProps, otherProps] = menuSheetItem.splitVariantProps(props); const classNames = useClassNames(); return ( ); }, ); //////////////////////////////////////////////////////////////////////////////////// /** * @deprecated Use `SwipeableMenuSheet` instead. */ export interface MenuSheetHeaderProps extends PrimitiveProps, React.HTMLAttributes {} /** * @deprecated Use `SwipeableMenuSheet` instead. */ export const MenuSheetHeader = withContext( withStateProps(Primitive.div), "header", ); // NOTE: uses DialogPrimitive.TitleProps, // but actual rendered component is a Primitive.h2 rather than a DialogPrimitive.Title // find out why later; h2 is same but missing and some a11y features /** * @deprecated Use `SwipeableMenuSheet` instead. */ export interface MenuSheetTitleProps extends DialogPrimitive.TitleProps {} /** * @deprecated Use `SwipeableMenuSheet` instead. */ export const MenuSheetTitle = withContext( withStateProps(Primitive.h2), "title", ); // NOTE: uses DialogPrimitive.DescriptionProps, // but actual rendered component is a Primitive.p rather than a DialogPrimitive.Description // find out why later; p is same but missing and some a11y features /** * @deprecated Use `SwipeableMenuSheet` instead. */ export interface MenuSheetDescriptionProps extends DialogPrimitive.DescriptionProps {} /** * @deprecated Use `SwipeableMenuSheet` instead. */ export const MenuSheetDescription = withContext( withStateProps(Primitive.p), "description", ); //////////////////////////////////////////////////////////////////////////////////// /** * @deprecated Use `SwipeableMenuSheet` instead. */ export interface MenuSheetListProps extends PrimitiveProps, React.HTMLAttributes {} /** * @deprecated Use `SwipeableMenuSheet` instead. */ export const MenuSheetList = withContext( withStateProps(Primitive.div), "list", ); //////////////////////////////////////////////////////////////////////////////////// /** * @deprecated Use `SwipeableMenuSheet` instead. */ export interface MenuSheetGroupProps extends React.HTMLAttributes, Pick {} /** * @deprecated Use `SwipeableMenuSheet` instead. */ export const MenuSheetGroup = React.forwardRef( ({ className, ...props }, ref) => { const [variantProps, otherProps] = menuSheetItem.splitVariantProps(props); const parentProps = useItemProps(); const classNames = useClassNames(); const { stateProps } = useDialogContext(); return ( ); }, ); //////////////////////////////////////////////////////////////////////////////////// /** * @deprecated Use `SwipeableMenuSheet` instead. */ export interface MenuSheetItemProps extends PrimitiveProps, MenuSheetItemVariantProps, React.HTMLAttributes {} /** * @deprecated Use `SwipeableMenuSheet` instead. */ export const MenuSheetItem = React.forwardRef( ({ className: propClassName, ...props }, ref) => { const [variantProps, otherProps] = menuSheetItem.splitVariantProps(props); const parentProps = useItemProps(); const classNames = menuSheetItem({ ...parentProps, ...variantProps }); const { stateProps } = useDialogContext(); return ( ); }, ); /** * @deprecated Use `SwipeableMenuSheet` instead. */ export interface MenuSheetItemContentProps extends PrimitiveProps, React.HTMLAttributes {} /** * @deprecated Use `SwipeableMenuSheet` instead. */ export const MenuSheetItemContent = withItemContext( withStateProps(Primitive.div), "content", ); /** * @deprecated Use `SwipeableMenuSheet` instead. */ export interface MenuSheetItemLabelProps extends PrimitiveProps, React.HTMLAttributes {} /** * @deprecated Use `SwipeableMenuSheet` instead. */ export const MenuSheetItemLabel = withItemContext( withStateProps(Primitive.span), "label", ); /** * @deprecated Use `SwipeableMenuSheet` instead. */ export interface MenuSheetItemDescriptionProps extends PrimitiveProps, React.HTMLAttributes {} /** * @deprecated Use `SwipeableMenuSheet` instead. */ export const MenuSheetItemDescription = withItemContext< HTMLSpanElement, MenuSheetItemDescriptionProps >(withStateProps(Primitive.span), "description"); //////////////////////////////////////////////////////////////////////////////////// /** * @deprecated Use `SwipeableMenuSheet` instead. */ export interface MenuSheetFooterProps extends PrimitiveProps, React.HTMLAttributes {} /** * @deprecated Use `SwipeableMenuSheet` instead. */ export const MenuSheetFooter = withContext( withStateProps(Primitive.div), "footer", ); //////////////////////////////////////////////////////////////////////////////////// /** * @deprecated Use `SwipeableMenuSheet` instead. */ export interface MenuSheetCloseButtonProps extends DialogPrimitive.CloseButtonProps {} /** * @deprecated Use `SwipeableMenuSheet` instead. */ export const MenuSheetCloseButton = withContext( DialogPrimitive.CloseButton, "closeButton", );