"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// packages/components/src/input-control/index.tsx
var input_control_exports = {};
__export(input_control_exports, {
  InputControl: () => InputControl,
  UnforwardedInputControl: () => UnforwardedInputControl,
  default: () => input_control_default
});
module.exports = __toCommonJS(input_control_exports);
var import_clsx = __toESM(require("clsx"), 1);
var import_compose = require("@wordpress/compose");
var import_element = require("@wordpress/element");
var import_input_base = __toESM(require("./input-base.cjs"), 1);
var import_input_field = __toESM(require("./input-field.cjs"), 1);
var import_space = require("../utils/space.cjs");
var import_utils = require("./utils.cjs");
var import_base_control = __toESM(require("../base-control/index.cjs"), 1);
var import_use_deprecated_props = require("../utils/use-deprecated-props.cjs");
var import_deprecated_36px_size = require("../utils/deprecated-36px-size.cjs");
var import_jsx_runtime = require("react/jsx-runtime");
var noop = () => {
};
function useUniqueId(idProp) {
  const instanceId = (0, import_compose.useInstanceId)(InputControl);
  const id = `inspector-input-control-${instanceId}`;
  return idProp || id;
}
function UnforwardedInputControl(props, ref) {
  const {
    __next40pxDefaultSize,
    __shouldNotWarnDeprecated36pxSize,
    __unstableStateReducer: stateReducer = (state) => state,
    __unstableInputWidth,
    className,
    disabled = false,
    help,
    hideLabelFromVision = false,
    id: idProp,
    isPressEnterToChange = false,
    label,
    labelPosition = "top",
    onChange = noop,
    onValidate = noop,
    onKeyDown = noop,
    prefix,
    size = "default",
    style,
    suffix,
    value,
    ...restProps
  } = (0, import_use_deprecated_props.useDeprecated36pxDefaultSizeProp)(props);
  const id = useUniqueId(idProp);
  const classes = (0, import_clsx.default)("components-input-control", className);
  const draftHookProps = (0, import_utils.useDraft)({
    value,
    onBlur: restProps.onBlur,
    onChange
  });
  const helpProp = !!help ? {
    "aria-describedby": `${id}__help`
  } : {};
  (0, import_deprecated_36px_size.maybeWarnDeprecated36pxSize)({
    componentName: "InputControl",
    __next40pxDefaultSize,
    size,
    __shouldNotWarnDeprecated36pxSize
  });
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_base_control.default, {
    className: classes,
    help,
    id,
    children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_base.default, {
      __next40pxDefaultSize,
      __unstableInputWidth,
      disabled,
      gap: 3,
      hideLabelFromVision,
      id,
      justify: "left",
      label,
      labelPosition,
      prefix,
      size,
      style,
      suffix,
      children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input_field.default, {
        ...restProps,
        ...helpProp,
        __next40pxDefaultSize,
        className: "components-input-control__input",
        disabled,
        id,
        isPressEnterToChange,
        onKeyDown,
        onValidate,
        paddingInlineStart: prefix ? (0, import_space.space)(1) : void 0,
        paddingInlineEnd: suffix ? (0, import_space.space)(1) : void 0,
        ref,
        size,
        stateReducer,
        ...draftHookProps
      })
    })
  });
}
var InputControl = (0, import_element.forwardRef)(UnforwardedInputControl);
var input_control_default = InputControl;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  InputControl,
  UnforwardedInputControl
});
//# sourceMappingURL=index.cjs.map
