"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require('./styles/style.css');const jsxRuntime = require("react/jsx-runtime");
const react = require("react");
const designSystem = require("@choiceform/design-system");
;/* empty css                    */
const useCodeEditor = require("./hooks/use-code-editor.cjs");
const CodeEditor = react.forwardRef((props, ref) => {
  const {
    value,
    onChange,
    autoFocus,
    className,
    readonly,
    lineWrapping,
    onEditorUpdate,
    onFormat,
    onCursorChange,
    onSelectionChange
  } = props;
  const { containerRef, editorViewRef, getCursorPosition, getSelectedCharacterCount } = useCodeEditor.useCodeEditor({
    value,
    onChange,
    autoFocus,
    readonly,
    lineWrapping,
    onEditorUpdate,
    onFormat,
    onCursorChange,
    onSelectionChange
  });
  react.useImperativeHandle(ref, () => ({
    getCursorPosition,
    getEditor: () => editorViewRef.current,
    getSelectedCharacterCount
  }), [getCursorPosition, editorViewRef, getSelectedCharacterCount]);
  return /* @__PURE__ */ jsxRuntime.jsx(
    "div",
    {
      ref: containerRef,
      className: designSystem.tcx("relative h-full", className)
    }
  );
});
CodeEditor.displayName = "CodeEditor";
exports.CodeEditor = CodeEditor;
//# sourceMappingURL=code-editor.cjs.map
