import { jsx, jsxs } from "react/jsx-runtime";
import Search from "@mui/icons-material/Search";
import Box from "@mui/material/Box";
import InputBase from "@mui/material/InputBase";
import { Colors } from "@uipath/apollo-core";
import { useSafeLingui } from "../../../../i18n/index.js";
const PickerSearchInput = ({ value, onChange, onKeyDown, placeholder, 'aria-label': ariaLabel, activeDescendantId, inputRef, listboxId, dense, leading, trailing, className, 'data-testid': dataTestId })=>{
    const { _ } = useSafeLingui();
    const resolvedPlaceholder = placeholder ?? _({
        id: 'modelPicker.search.placeholder',
        message: 'Search models'
    });
    return /*#__PURE__*/ jsxs(Box, {
        className: className,
        sx: {
            display: 'flex',
            alignItems: 'center',
            gap: 1,
            p: dense ? 1.25 : 1.5,
            borderBottom: '1px solid',
            borderColor: `var(--color-border-de-emp, ${Colors.ColorGray300})`,
            backgroundColor: `var(--color-background-raised, ${Colors.ColorWhite})`
        },
        children: [
            leading && /*#__PURE__*/ jsx(Box, {
                sx: {
                    display: 'flex',
                    alignItems: 'center',
                    flexShrink: 0
                },
                children: leading
            }),
            /*#__PURE__*/ jsxs(Box, {
                sx: {
                    flex: 1,
                    minWidth: 0,
                    display: 'flex',
                    alignItems: 'center',
                    gap: 0.75,
                    border: '1px solid',
                    borderColor: `var(--color-border-de-emp, ${Colors.ColorGray300})`,
                    borderRadius: '8px',
                    px: 1.25,
                    py: dense ? 0.5 : 0.75,
                    backgroundColor: `var(--color-background-raised, ${Colors.ColorWhite})`,
                    transition: 'border-color 120ms',
                    '&:focus-within': {
                        borderColor: `var(--color-primary, ${Colors.ColorBlue500})`
                    }
                },
                children: [
                    /*#__PURE__*/ jsx(Search, {
                        sx: {
                            fontSize: dense ? 16 : 18,
                            color: `var(--color-foreground-disable, ${Colors.ColorGray500})`
                        },
                        "aria-hidden": true
                    }),
                    /*#__PURE__*/ jsx(InputBase, {
                        inputRef: inputRef,
                        value: value,
                        onChange: (e)=>onChange(e.target.value),
                        onKeyDown: onKeyDown,
                        placeholder: resolvedPlaceholder,
                        sx: {
                            flex: 1,
                            fontSize: dense ? 13 : 13.5,
                            color: `var(--color-foreground, ${Colors.ColorGray850})`,
                            '& .MuiInputBase-input::placeholder': {
                                color: `var(--color-foreground-disable, ${Colors.ColorGray500})`,
                                opacity: 1
                            }
                        },
                        inputProps: {
                            role: 'combobox',
                            'aria-label': ariaLabel ?? resolvedPlaceholder,
                            'aria-controls': listboxId,
                            'aria-autocomplete': 'list',
                            'aria-activedescendant': activeDescendantId,
                            'aria-expanded': true,
                            'data-testid': dataTestId
                        }
                    })
                ]
            }),
            trailing && /*#__PURE__*/ jsx(Box, {
                sx: {
                    display: 'flex',
                    alignItems: 'center',
                    flexShrink: 0
                },
                children: trailing
            })
        ]
    });
};
export { PickerSearchInput };
