'use client';

// src/components/Label/Label.tsx
import * as React2 from "react";
import { InfoOutlineIcon } from "@paalan/react-icons";
import { cn as cn2 } from "@paalan/react-shared/lib";
import * as LabelPrimitive from "@radix-ui/react-label";
import { cva } from "class-variance-authority";

// src/components/Tooltip/Tooltip.tsx
import * as React from "react";
import { useControllableState } from "@paalan/react-hooks";
import { cn } from "@paalan/react-shared/lib";
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
import { jsx, jsxs } from "react/jsx-runtime";
var TooltipProvider = TooltipPrimitive.Provider;
var TooltipRoot = TooltipPrimitive.Root;
var TooltipTrigger = TooltipPrimitive.Trigger;
var TooltipPortal = TooltipPrimitive.Portal;
var TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsx(
  TooltipPrimitive.Content,
  {
    ref,
    sideOffset,
    className: cn(
      "z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
      className
    ),
    ...props
  }
));
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
var Tooltip = React.forwardRef(
  ({
    className,
    trigger,
    asPortal,
    content,
    side = "top",
    align = "center",
    defaultOpen,
    open,
    onOpenChange,
    ...props
  }, ref) => {
    const TooltipPortalComponent = asPortal ? TooltipPortal : React.Fragment;
    const [localOpen, setLocalOpen] = useControllableState({
      defaultValue: defaultOpen,
      value: open,
      onChange: onOpenChange
    });
    return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 100, children: /* @__PURE__ */ jsxs(TooltipRoot, { open: localOpen, onOpenChange: setLocalOpen, children: [
      /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: trigger }),
      /* @__PURE__ */ jsx(TooltipPortalComponent, { children: /* @__PURE__ */ jsxs(
        TooltipContent,
        {
          ref,
          className: cn("bg-secondary fill-secondary text-secondary-foreground", className),
          side,
          align,
          ...props,
          children: [
            content,
            /* @__PURE__ */ jsx(TooltipPrimitive.Arrow, { width: 11, height: 5 })
          ]
        }
      ) })
    ] }) });
  }
);

// src/components/Label/Label.tsx
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
var labelVariants = cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70");
var Label = React2.forwardRef(
  ({ className, required = false, labelDescription, text, isInvalid, children, disabled, ...props }, ref) => /* @__PURE__ */ jsxs2(
    LabelPrimitive.Root,
    {
      ref,
      className: cn2(labelVariants(), { "text-danger": isInvalid, "opacity-70": disabled }, className),
      ...props,
      children: [
        text || children,
        required && /* @__PURE__ */ jsx2("span", { className: "text-danger/70", children: "*" }),
        labelDescription && /* @__PURE__ */ jsx2(
          Tooltip,
          {
            trigger: /* @__PURE__ */ jsx2(InfoOutlineIcon, { className: "ml-1 text-muted-foreground", "aria-hidden": "true" }),
            content: labelDescription
          }
        )
      ]
    }
  )
);
Label.displayName = LabelPrimitive.Root.displayName;
export {
  Label
};
