Files
makelore/src/components/ui/disclosure.tsx
inman f4113a872f
Some checks failed
Electron E2E / Electron E2E (macos-latest) (push) Has been cancelled
Electron E2E / Electron E2E (ubuntu-latest) (push) Has been cancelled
Electron E2E / Electron E2E (windows-latest) (push) Has been cancelled
收口 Makelore 客户端变更
2026-08-12 22:43:09 +08:00

37 lines
1.1 KiB
TypeScript

import { forwardRef, type HTMLAttributes, type ReactNode } from 'react';
import { cn } from '@/lib/utils';
export const DISCLOSURE_ENTER_MS = 240;
export const DISCLOSURE_EXIT_MS = 180;
export interface DisclosureContentProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
open: boolean;
children: ReactNode;
innerClassName?: string;
}
/**
* A shared, interruptible-feeling disclosure surface. The content stays in
* the tree so reversing a toggle can retarget the same transition instead of
* snapping from a newly mounted node.
*/
export const DisclosureContent = forwardRef<HTMLDivElement, DisclosureContentProps>(
function DisclosureContent({ open, children, className, innerClassName, ...props }, ref) {
return (
<div
{...props}
ref={ref}
aria-hidden={!open || undefined}
data-state={open ? 'open' : 'closed'}
className={cn('codex-disclosure', className)}
>
<div className={cn('codex-disclosure-inner', innerClassName)}>
{children}
</div>
</div>
);
},
);
DisclosureContent.displayName = 'DisclosureContent';