// // Copyright 2024 DXOS.org // import React, { forwardRef } from 'react'; import { useThemeContext } from '../../hooks'; import { type ThemedClassName } from '../../util'; import { Icon, type IconProps } from '../Icon'; import { Tooltip, type TooltipSide } from '../Tooltip'; import { Button, type ButtonProps } from './Button'; type IconButtonProps = Omit & Partial> & { label: string; noTooltip?: boolean; iconOnly?: boolean; square?: boolean; // TODO(burdon): Should be automatic in style? iconEnd?: boolean; iconClassNames?: ThemedClassName['classNames']; tooltipSide?: TooltipSide; }; const IconButton = forwardRef((props, forwardedRef) => props.iconOnly ? ( ) : ( ), ); const IconOnlyButton = forwardRef( ({ noTooltip, tooltipSide, ...props }, forwardedRef) => { if (noTooltip) { return ; } return ( ); }, ); const LabelledIconButton = forwardRef( ( { size, icon, iconOnly, square, iconEnd, iconClassNames, label, noTooltip: _, classNames, ...props }, forwardedRef, ) => { const { tx } = useThemeContext(); return ( ); }, ); export { IconButton }; export type { IconButtonProps };