import AutoCompleteSetter from "../../../autoComplete-setter";
import { useState } from "react";
export default function StyleSizeSetter(props) {
  var _props$defaultUint = props.defaultUint,
    defaultUint = _props$defaultUint === void 0 ? "px" : _props$defaultUint,
    _props$units = props.units,
    units = _props$units === void 0 ? ["px", "%", "em", "mm", "cm"] : _props$units,
    _props$styleData = props.styleData,
    styleData = _props$styleData === void 0 ? {} : _props$styleData,
    _props$styleKey = props.styleKey,
    styleKey = _props$styleKey === void 0 ? "" : _props$styleKey,
    onStyleChange = props.onStyleChange;
  var _useState = useState(styleData[styleKey]),
    setValue = _useState[1];
  var value = styleData[styleKey];
  function onChange(value) {
    setValue(value);
    onStyleChange === null || onStyleChange === void 0 ? void 0 : onStyleChange([{
      styleKey: styleKey,
      value: value
    }]);
  }
  return /*#__PURE__*/React.createElement(AutoCompleteSetter, {
    key: styleKey,
    defaultUint: defaultUint,
    unit: units,
    value: value,
    onChange: onChange
  });
}