// // Copyright 2024 DXOS.org // import React, { forwardRef } from 'react'; import { Button, type ButtonProps } from './Button'; import { useThemeContext } from '../../hooks'; import { type ThemedClassName } from '../../util'; import { Icon, type IconProps } from '../Icon'; import { Tooltip, type TooltipSide } from '../Tooltip'; type IconButtonProps = Omit & Pick & { label: string; iconOnly?: boolean; noTooltip?: boolean; caretDown?: boolean; iconClassNames?: ThemedClassName['classNames']; tooltipPortal?: boolean; tooltipSide?: TooltipSide; }; const IconOnlyButton = forwardRef( ({ noTooltip, tooltipPortal = true, tooltipSide, ...props }, forwardedRef) => { if (noTooltip) { return ; } return ( ); }, ); const LabelledIconButton = forwardRef( ({ icon, size, iconOnly, label, classNames, iconClassNames, caretDown, ...props }, forwardedRef) => { const { tx } = useThemeContext(); return ( ); }, ); const IconButton = forwardRef((props, forwardedRef) => props.iconOnly ? ( ) : ( ), ); export { IconButton }; export type { IconButtonProps };