'use strict';
import { jsx } from 'react/jsx-runtime';
import { cn } from '../../../fd-toolbox/lib/utils.js';
import { FadeOutText } from '../fade-out-text/FadeOutText.js';
import { cva } from 'class-variance-authority';
import { componentVariantNames } from '../../../fd-toolbox/constants/html-constants.js';

var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", {
  value,
  configurable: true
});
const labelVariants = cva("bg-background pointer-events-none absolute top-2 left-1 z-10 origin-[0] rounded-md px-1 text-sm peer-disabled:cursor-not-allowed peer-disabled:opacity-70", {
  variants: {
    variant: {
      bordered: "transition-all duration-150 ease-in-out peer-focus:-translate-y-4 peer-focus:scale-75 file:text-sm",
      float: "duration-300"
    }
  },
  defaultVariants: {
    variant: componentVariantNames.float
  }
});
function LabelAnimation({
  label,
  forElementId,
  shouldAnimate,
  errorStyle,
  skipAnimationOnce,
  variant,
  className
}) {
  const isFloat = (variant ?? componentVariantNames.float) === componentVariantNames.float;
  return /* @__PURE__ */jsx("label", {
    htmlFor: forElementId,
    className: cn(labelVariants({
      variant
    }), isFloat && shouldAnimate && "animate-label-up", shouldAnimate && "pl-1.5", isFloat && !shouldAnimate && "animate-label-down", errorStyle ? "text-destructive" : "text-muted-foreground", className),
    children: /* @__PURE__ */jsx(FadeOutText, {
      children: label
    })
  }, Number(skipAnimationOnce));
}
__name(LabelAnimation, "LabelAnimation");

export { LabelAnimation, labelVariants };
