import { Space, Input } from 'antd';
import React__default, { useState, useCallback } from 'react';
import useParrotTranslation from '../../../hooks/useParrotTranslation.js';

const AffixColumnHeaderCell = ({ data, column, onChange, onBlur }) => {
  const [suffix, setSuffix] = useState("");
  const [prefix, setPrefix] = useState("");
  const { t } = useParrotTranslation();
  const onPrefixChange = useCallback(
    (e) => {
      const newPrefix = e.target.value;
      setPrefix(newPrefix);
      onChange(newPrefix + suffix);
    },
    [suffix, onChange]
  );
  const onSuffixChange = useCallback(
    (e) => {
      const newSuffix = e.target.value;
      setSuffix(newSuffix);
      onChange(prefix + newSuffix);
    },
    [prefix, onChange]
  );
  return /* @__PURE__ */ React__default.createElement(Space, { style: { marginTop: "4px" } }, !column.disablePrefix ? /* @__PURE__ */ React__default.createElement(
    Input,
    {
      value: prefix,
      placeholder: t("components.prefix"),
      size: "small",
      onChange: onPrefixChange,
      onBlur
    }
  ) : void 0, !column.disableSuffix ? /* @__PURE__ */ React__default.createElement(
    Input,
    {
      value: suffix,
      placeholder: t("components.suffix"),
      size: "small",
      onChange: onSuffixChange,
      onBlur
    }
  ) : void 0);
};

export { AffixColumnHeaderCell };
