import { Input as Input$1 } from '@base-ui/react/input';
import { cva } from 'class-variance-authority';
import { Minus, Plus } from 'lucide-react';
import { clsx } from 'clsx';
import { twMerge } from 'tailwind-merge';
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';

var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
  var target = {};
  for (var prop in source)
    if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source[prop];
  if (source != null && __getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(source)) {
      if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
        target[prop] = source[prop];
    }
  return target;
};
function cn(...inputs) {
  return twMerge(clsx(inputs));
}
function InputGroup(_a) {
  var _b = _a, {
    className,
    disabled
  } = _b, props = __objRest(_b, [
    "className",
    "disabled"
  ]);
  return /* @__PURE__ */ jsx(
    "div",
    __spreadValues({
      "data-slot": "input-group",
      "data-disabled": disabled || void 0,
      className: cn("flex w-full flex-col gap-2", className)
    }, props)
  );
}
function InputLabel(_a) {
  var _b = _a, {
    className,
    trailing,
    children
  } = _b, props = __objRest(_b, [
    "className",
    "trailing",
    "children"
  ]);
  return /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
    /* @__PURE__ */ jsx(
      "label",
      __spreadProps(__spreadValues({
        "data-slot": "input-label",
        className: cn(
          "text-sm font-medium leading-5 text-foreground select-none group-data-[disabled]:pointer-events-none group-data-[disabled]:opacity-50",
          className
        )
      }, props), {
        children
      })
    ),
    trailing && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: trailing })
  ] });
}
var inputHelperTextVariants = cva(
  "text-xs leading-4",
  {
    variants: {
      variant: {
        default: "text-muted-foreground",
        error: "text-destructive",
        success: "text-[var(--theme-text-success)]"
      }
    },
    defaultVariants: {
      variant: "default"
    }
  }
);
function InputHelperText(_a) {
  var _b = _a, {
    className,
    variant = "default"
  } = _b, props = __objRest(_b, [
    "className",
    "variant"
  ]);
  return /* @__PURE__ */ jsx(
    "p",
    __spreadValues({
      "data-slot": "input-helper-text",
      className: cn(inputHelperTextVariants({ variant }), className)
    }, props)
  );
}
var inputContainerVariants = cva(
  "flex w-full items-center overflow-clip rounded-[var(--radius-sm)] transition-[background-color,border-color] duration-150 has-[:focus-within]:transition-none has-[:focus-visible]:border-input-hover has-[:focus-visible]:ring-0 has-[:disabled]:pointer-events-none has-[:disabled]:opacity-50 has-[aria-invalid]:border-destructive has-[aria-invalid]:ring-3 has-[aria-invalid]:ring-destructive/20 dark:has-[aria-invalid]:border-destructive/50 dark:has-[aria-invalid]:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
  {
    variants: {
      inputStyle: {
        default: "border border-border bg-card shadow-none hover:bg-[var(--theme-background-input-hover)] dark:bg-sidebar dark:hover:bg-[var(--theme-background-input-hover)] dark:has-[:disabled]:hover:bg-sidebar dark:has-[:disabled]:bg-input/80",
        soft: "border border-transparent bg-card hover:bg-[var(--theme-background-input-hover)] has-[:disabled]:hover:bg-card dark:bg-sidebar dark:hover:bg-[var(--theme-background-input-hover)] dark:has-[:disabled]:hover:bg-sidebar"
      },
      size: {
        sm: "min-h-8",
        /** Fixed height (not min-height) so flex children cannot grow the row past 36px (e.g. toolbar alignment). */
        lg: "h-9"
      }
    },
    defaultVariants: {
      inputStyle: "default",
      size: "sm"
    }
  }
);
function InputContainer(_a) {
  var _b = _a, {
    className,
    inputStyle = "default",
    size = "sm"
  } = _b, props = __objRest(_b, [
    "className",
    "inputStyle",
    "size"
  ]);
  return /* @__PURE__ */ jsx(
    "div",
    __spreadValues({
      "data-slot": "input-container",
      className: cn(
        inputContainerVariants({ inputStyle, size, className })
      )
    }, props)
  );
}
var inputVariants = cva(
  "w-full min-w-0 bg-transparent text-sm text-foreground outline-none transition-colors placeholder:text-muted-foreground file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground disabled:pointer-events-none disabled:cursor-not-allowed",
  {
    variants: {
      size: {
        sm: "h-8 px-2.5 py-1",
        /** `py-0` avoids UA + padding stacking past 36px; `leading-5` matches `text-sm` line box. */
        lg: "h-9 px-2.5 py-0 leading-5"
      },
      standalone: {
        true: "rounded-[var(--radius-sm)] border border-border bg-card shadow-none transition-[background-color,border-color] duration-150 hover:bg-[var(--theme-background-input-hover)] focus-visible:transition-none focus-visible:border-input-hover focus-visible:ring-0 disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:bg-sidebar dark:hover:bg-[var(--theme-background-input-hover)] dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
        false: "border-none focus-visible:ring-0 focus-visible:ring-offset-0"
      }
    },
    defaultVariants: {
      size: "sm",
      standalone: true
    }
  }
);
function Input(_a) {
  var _b = _a, {
    className,
    type,
    size = "sm",
    standalone = true
  } = _b, props = __objRest(_b, [
    "className",
    "type",
    "size",
    "standalone"
  ]);
  return /* @__PURE__ */ jsx(
    Input$1,
    __spreadValues({
      type,
      "data-slot": "input",
      className: cn(inputVariants({ size, standalone, className }))
    }, props)
  );
}
function InputIcon(_a) {
  var _b = _a, {
    className,
    position = "lead",
    children
  } = _b, props = __objRest(_b, [
    "className",
    "position",
    "children"
  ]);
  return /* @__PURE__ */ jsx(
    "div",
    __spreadProps(__spreadValues({
      "data-slot": "input-icon",
      "data-position": position,
      className: cn(
        "flex shrink-0 items-center justify-center text-muted-foreground",
        position === "lead" ? "pl-2.5" : "pr-2.5",
        className
      )
    }, props), {
      children
    })
  );
}
function InputAddon(_a) {
  var _b = _a, {
    className,
    position = "lead",
    children
  } = _b, props = __objRest(_b, [
    "className",
    "position",
    "children"
  ]);
  return /* @__PURE__ */ jsx(
    "div",
    __spreadProps(__spreadValues({
      "data-slot": "input-addon",
      className: cn(
        "flex shrink-0 items-center justify-center px-3 text-sm font-medium text-muted-foreground select-none",
        position === "lead" ? "border-r border-input" : "border-l border-input",
        className
      )
    }, props), {
      children
    })
  );
}
function InputInlineAddon(_a) {
  var _b = _a, {
    className,
    position = "lead",
    children
  } = _b, props = __objRest(_b, [
    "className",
    "position",
    "children"
  ]);
  return /* @__PURE__ */ jsx(
    "span",
    __spreadProps(__spreadValues({
      "data-slot": "input-inline-addon",
      className: cn(
        "flex shrink-0 items-center text-sm font-medium text-muted-foreground whitespace-nowrap select-none",
        position === "lead" ? "pl-2.5" : "pr-2.5",
        className
      )
    }, props), {
      children
    })
  );
}
function InputShortcutBadge(_a) {
  var _b = _a, {
    className,
    children
  } = _b, props = __objRest(_b, [
    "className",
    "children"
  ]);
  return /* @__PURE__ */ jsx(
    "kbd",
    __spreadProps(__spreadValues({
      "data-slot": "input-shortcut-badge",
      className: cn(
        "mr-2 flex h-5 shrink-0 items-center justify-center rounded-xs border border-border px-1 text-xs font-medium text-muted-foreground select-none",
        className
      )
    }, props), {
      children
    })
  );
}
function InputActionButton(_a) {
  var _b = _a, {
    className,
    position = "tail",
    children
  } = _b, props = __objRest(_b, [
    "className",
    "position",
    "children"
  ]);
  return /* @__PURE__ */ jsxs(Fragment, { children: [
    /* @__PURE__ */ jsx(
      "div",
      {
        className: cn(
          "self-stretch w-px bg-input",
          position === "lead" && "order-none",
          position === "tail" && "order-none"
        ),
        "aria-hidden": true
      }
    ),
    /* @__PURE__ */ jsx(
      "button",
      __spreadProps(__spreadValues({
        type: "button",
        "data-slot": "input-action-button",
        className: cn(
          "flex shrink-0 cursor-pointer items-center justify-center gap-1 px-2.5 py-2 text-sm font-medium text-foreground whitespace-nowrap transition-colors hover:bg-muted select-none disabled:pointer-events-none disabled:opacity-50",
          className
        )
      }, props), {
        children
      })
    )
  ] });
}
function InputQuantityButton(_a) {
  var _b = _a, {
    className,
    action
  } = _b, props = __objRest(_b, [
    "className",
    "action"
  ]);
  return /* @__PURE__ */ jsx(
    "button",
    __spreadProps(__spreadValues({
      type: "button",
      "data-slot": "input-quantity-button",
      "aria-label": action === "increment" ? "Increase" : "Decrease",
      className: cn(
        "flex size-9 shrink-0 cursor-pointer items-center justify-center text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50",
        className
      )
    }, props), {
      children: action === "decrement" ? /* @__PURE__ */ jsx(Minus, { className: "size-4" }) : /* @__PURE__ */ jsx(Plus, { className: "size-4" })
    })
  );
}

export { Input, InputActionButton, InputAddon, InputContainer, InputGroup, InputHelperText, InputIcon, InputInlineAddon, InputLabel, InputQuantityButton, InputShortcutBadge, inputContainerVariants, inputHelperTextVariants, inputVariants };
//# sourceMappingURL=input.js.map
//# sourceMappingURL=input.js.map