import { jsx, jsxs } from "react/jsx-runtime";
import * as React from "react";
import { cva } from "class-variance-authority";
import { cn } from "@open-mercato/shared/lib/utils";
const inputWrapperVariants = cva(
  "inline-flex w-full items-center gap-2 rounded-md border border-input bg-background shadow-xs transition-colors focus-within:outline-none focus-within:shadow-focus focus-within:border-foreground hover:bg-muted/40 has-[input:disabled]:bg-bg-disabled has-[input:disabled]:border-border-disabled has-[input:disabled]:shadow-none has-[input:disabled]:hover:bg-bg-disabled has-[input[aria-invalid=true]]:border-destructive has-[input[aria-invalid=true]]:focus-within:border-destructive",
  {
    variants: {
      size: {
        sm: "h-8 px-2.5",
        default: "h-9 px-3",
        lg: "h-10 px-3"
      }
    },
    defaultVariants: {
      size: "default"
    }
  }
);
const inputElementVariants = cva(
  "flex-1 min-w-0 bg-transparent border-0 outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:bg-transparent",
  {
    variants: {
      size: {
        sm: "text-xs",
        default: "text-sm",
        lg: "text-sm"
      }
    },
    defaultVariants: {
      size: "default"
    }
  }
);
const Input = React.forwardRef(
  ({ className, inputClassName, type = "text", size, leftIcon, rightIcon, ...props }, ref) => {
    return /* @__PURE__ */ jsxs(
      "div",
      {
        className: cn(inputWrapperVariants({ size }), className),
        "data-slot": "input-wrapper",
        children: [
          leftIcon ? /* @__PURE__ */ jsx(
            "span",
            {
              className: "flex shrink-0 items-center text-muted-foreground [&_svg]:size-4",
              "aria-hidden": "true",
              children: leftIcon
            }
          ) : null,
          /* @__PURE__ */ jsx(
            "input",
            {
              ref,
              type,
              className: cn(inputElementVariants({ size }), inputClassName),
              ...props
            }
          ),
          rightIcon ? /* @__PURE__ */ jsx(
            "span",
            {
              className: "flex shrink-0 items-center text-muted-foreground [&_svg]:size-4",
              "aria-hidden": "true",
              children: rightIcon
            }
          ) : null
        ]
      }
    );
  }
);
Input.displayName = "Input";
export {
  Input,
  inputElementVariants,
  inputWrapperVariants
};
//# sourceMappingURL=input.js.map
