import React from 'react'; import { useButton } from 'react-aria'; import type { ButtonProps, SlotProps } from 'react-aria-components'; import { ButtonContext, useContextProps } from 'react-aria-components'; import type { Exact, SafeOmit } from '@shoptet/utils'; import type { IconButtonProps } from '../../IconButton/IconButton'; import { IconButton } from '../../IconButton/IconButton'; interface InheritedIconButtonProps extends SafeOmit {} export interface TreeItemChevronProps extends InheritedIconButtonProps { isExpanded: boolean; } export function TreeItemChevron({ isExpanded, ...restProps }: TreeItemChevronProps) { restProps satisfies Exact; const chevronRef = React.useRef(null); const [chevronAriaProps, ref] = useContextProps( { slot: 'chevron' }, chevronRef, ButtonContext ); const { buttonProps: chevronProps } = useButton(chevronAriaProps, ref); return ( ); }