import { PickerTableListItem, } from '../PickerTableListItem';
import React, { useState } from 'react';
import { TextWidthLoader } from '../TextWidthLoader';
import { Button } from '@wix/design-system';
import { observer } from 'mobx-react-lite';
function _PickerStandaloneTableListItem(props) {
    const { state, keyedItem, onClick, primaryActionWidth, defaultPrimaryButtonText, ...rest } = props;
    const [hovered, setHovered] = useState(false);
    const { submitted, picker, isMobileView } = state;
    const { collection: { bulkSelect, translate: t }, } = picker;
    const primaryButtonText = state.primaryButtonText ?? defaultPrimaryButtonText ?? t('cairo.continue');
    const { containerProps, listItemProps, primaryActionProps } = isMobileView
        ? {
            containerProps: undefined,
            listItemProps: {
                primaryActionWidth: 'min-content',
            },
            primaryActionProps: undefined,
        }
        : {
            containerProps: {
                onMouseEnter: () => setHovered(true),
                onMouseLeave: () => setHovered(false),
            },
            listItemProps: {
                primaryActionWidth,
            },
            primaryActionProps: {
                showButton: submitted ? bulkSelect.isChecked(keyedItem.key) : hovered,
            },
        };
    return (React.createElement("div", { ...containerProps },
        React.createElement(PickerTableListItem, { state: picker, keyedItem: keyedItem, onClick: submitted
                ? undefined
                : (e) => {
                    state.handlePrimaryButtonClick(keyedItem);
                    onClick?.(e);
                }, ...listItemProps, primaryAction: primaryActionProps && primaryActionProps.showButton ? (React.createElement(Button, { dataHook: "primary-action-button", size: "small" }, submitted ? (React.createElement(TextWidthLoader, { size: "tiny", text: primaryButtonText })) : (primaryButtonText))) : undefined, ...rest })));
}
export const PickerStandaloneTableListItem = observer(_PickerStandaloneTableListItem);
//# sourceMappingURL=PickerStandaloneTableListItem.js.map