import { Button } from '@wix/design-system';
import React, { useCallback } from 'react';
import { DisabledTooltip } from '../DisabledTooltip';
export function ActionButton(props) {
    const { actionItem, suffixIcon, size, priority, fullWidth } = props;
    const { tooltip, prefixIcon, label, onClick, dataHook, disabled, ref } = actionItem;
    const setRef = useCallback((element) => {
        if (!element || !ref) {
            return;
        }
        const buttonEl = element.querySelector('button') ?? null;
        if (typeof ref === 'function') {
            ref(buttonEl);
        }
        else {
            ref.current =
                buttonEl;
        }
    }, [ref]);
    return (React.createElement("div", { ref: setRef, style: { display: 'contents' } },
        React.createElement(DisabledTooltip, { content: tooltip, dataHook: `${dataHook}-tooltip` },
            React.createElement(Button, { skin: "standard", priority: priority, size: size, prefixIcon: prefixIcon, ellipsis: true, onClick: onClick, dataHook: dataHook, disabled: disabled, suffixIcon: suffixIcon, fullWidth: fullWidth }, label))));
}
//# sourceMappingURL=ActionButton.js.map