"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const React = require("react");
require("clsx");
const useProps = require("../../core/MantineProvider/use-props/use-props.cjs");
const factory = require("../../core/factory/factory.cjs");
const InputBase = require("../InputBase/InputBase.cjs");
const PillsInput_context = require("./PillsInput.context.cjs");
const PillsInputField = require("./PillsInputField/PillsInputField.cjs");
const defaultProps = {};
const PillsInput = factory.factory((_props, ref) => {
  const props = useProps.useProps("PillsInput", defaultProps, _props);
  const {
    children,
    onMouseDown,
    onClick,
    size,
    disabled,
    __staticSelector,
    error,
    variant,
    ...others
  } = props;
  const fieldRef = React.useRef(null);
  return /* @__PURE__ */ jsxRuntime.jsx(PillsInput_context.PillsInputProvider, { value: { fieldRef, size, disabled, hasError: !!error, variant }, children: /* @__PURE__ */ jsxRuntime.jsx(
    InputBase.InputBase,
    {
      size,
      error,
      variant,
      component: "div",
      ref,
      onMouseDown: (event) => {
        var _a;
        event.preventDefault();
        onMouseDown == null ? void 0 : onMouseDown(event);
        (_a = fieldRef.current) == null ? void 0 : _a.focus();
      },
      onClick: (event) => {
        var _a;
        event.preventDefault();
        onClick == null ? void 0 : onClick(event);
        (_a = fieldRef.current) == null ? void 0 : _a.focus();
      },
      ...others,
      multiline: true,
      disabled,
      __staticSelector: __staticSelector || "PillsInput",
      withAria: false,
      children
    }
  ) });
});
PillsInput.displayName = "@mantine/core/PillsInput";
PillsInput.Field = PillsInputField.PillsInputField;
exports.PillsInput = PillsInput;
