"use client";
import { jsx as p } from "react/jsx-runtime";
import { c as f } from "./cn-ct4n7r74mh8y0f48.js";
import { r as c } from "./resolve-variant-gw6eh7fa4st8ej7m.js";
import { forwardRef as k } from "react";
import { F as N } from "./field-hmucpi6d4sqci1zu.js";
import { I as y } from "./vendor-base-ui-ie71jahf0czyf58j.js";
const d = {
  size: {
    xs: {
      classes: "h-5 gap-1 rounded-sm px-1.5 text-xs",
      description: "Extra small input for compact UIs"
    },
    sm: {
      classes: "h-6.5 gap-1 rounded-md px-2 text-xs",
      description: "Small input for secondary fields"
    },
    base: {
      classes: "h-9 gap-1.5 rounded-lg px-3 text-base",
      description: "Default input size"
    },
    lg: {
      classes: "h-10 gap-2 rounded-lg px-4 text-base",
      description: "Large input for prominent fields"
    }
  },
  variant: {
    default: {
      classes: "focus:ring-kumo-focus/50 focus:ring-[1.5px]",
      description: "Default input appearance"
    },
    error: {
      classes: "!ring-kumo-danger focus:ring-kumo-danger/50 focus:ring-[1.5px]",
      description: "Error state for validation failures"
    }
  }
}, s = {
  size: "base",
  variant: "default"
};
function E({
  variant: r = s.variant,
  size: o = s.size,
  parentFocusIndicator: i = !1,
  focusIndicator: n = !1
} = {}) {
  return f(
    // Base styles
    "border-0 bg-kumo-control text-kumo-default ring ring-kumo-line outline-none focus:outline-none",
    // Disabled state and placeholder styles (using vanilla CSS class for Chrome compatibility)
    "kumo-input-placeholder disabled:text-kumo-disabled",
    // Apply size styles from KUMO_INPUT_VARIANTS
    c(d.size, o, s.size).classes,
    // Apply variant styles from KUMO_INPUT_VARIANTS
    c(d.variant, r, s.variant).classes,
    // Focus state handling
    i && (r === "error" ? "focus-within:ring-kumo-danger/50 focus-within:ring-[1.5px]" : "focus-within:ring-kumo-focus/50 focus-within:ring-[1.5px]"),
    n && (r === "error" ? "focus:ring-kumo-danger/50 focus:ring-[1.5px]" : "focus:ring-kumo-focus/50 focus:ring-[1.5px]")
  );
}
const w = k((r, o) => {
  const {
    className: i,
    size: n = "base",
    variant: l,
    label: t,
    labelTooltip: m,
    description: g,
    error: e,
    ...a
  } = r;
  process.env.NODE_ENV !== "production" && l === "error" && console.warn(
    '[Kumo Input]: variant="error" is deprecated. Error styling is now automatically applied when the `error` prop is truthy. Simply remove the variant prop and pass an error message instead.'
  );
  const b = l ?? (e ? "error" : "default"), { required: x } = a;
  if (process.env.NODE_ENV !== "production") {
    const h = !!t, v = !!a["aria-label"], I = !!a["aria-labelledby"];
    !h && !v && !I && console.warn(
      `[Kumo Input]: Input must have an accessible name. Provide either:
  - label prop: <Input label='Email' />
  - aria-label: <Input aria-label='Email address' />
  - aria-labelledby for custom label association`
    );
  }
  const u = /* @__PURE__ */ p(
    y,
    {
      ref: o,
      className: f(
        E({ size: n, variant: b, focusIndicator: !0 }),
        i
      ),
      ...a
    }
  );
  return t ? /* @__PURE__ */ p(
    N,
    {
      label: t,
      required: x,
      labelTooltip: m,
      description: g,
      error: e ? typeof e == "string" ? { message: e, match: !0 } : e : void 0,
      children: u
    }
  ) : u;
});
w.displayName = "Input";
export {
  w as I,
  d as K,
  E as i
};
//# sourceMappingURL=input-k2ychlh2zo6hsocz.js.map
