import { HTMLBuilder } from "@sankhyalabs/core";
export const buildDecimal = ({ readOnly, props }) => {
  var _a, _b;
  const precision = Number((_a = props === null || props === void 0 ? void 0 : props.precision) !== null && _a !== void 0 ? _a : 2);
  const prettyPrecision = Number((_b = props === null || props === void 0 ? void 0 : props.prettyPrecision) !== null && _b !== void 0 ? _b : precision);
  return buildNumeric(readOnly, precision, prettyPrecision);
};
export const buildInteger = ({ readOnly }) => {
  return buildNumeric(readOnly, 0, 0);
};
function buildNumeric(readOnly, precision, prettyPrecision) {
  const input = HTMLBuilder.parseElement(`<ez-number-input
        class="ez-grid grid_editor"
        enabled=${!readOnly}
        precision=${precision}
        pretty-precision=${prettyPrecision}
        mode="slim"
    />`);
  input.valueGetter = () => input.getValueAsync();
  input.autoFocus = true;
  return input;
}
