'use strict';
'use client';
import { jsx, jsxs } from 'react/jsx-runtime';
import { Switch } from '@base-ui/react/switch';
import { cn } from '../../../fd-toolbox/lib/utils.js';
import { cva } from 'class-variance-authority';
import { labelClassNames, labelDisplayNames } from '../label/label-constants.js';

var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", {
  value,
  configurable: true
});
const labelVariants = cva(labelClassNames.text);
function SlideToggleSwitch({
  className,
  ref
}) {
  return /* @__PURE__ */jsx(Switch.Root, {
    className: cn("focus-visible:ring-primary focus-visible:ring-offset-background data-[state=checked]:bg-primary data-[state=unchecked]:bg-input peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50", className),
    ref,
    children: /* @__PURE__ */jsx(Switch.Thumb, {
      className: cn("bg-background pointer-events-none block size-4 rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")
    })
  });
}
__name(SlideToggleSwitch, "SlideToggleSwitch");
SlideToggleSwitch.displayName = "Switch";
function SlideToggleLabel({
  className,
  ref
}) {
  return /* @__PURE__ */jsx("label", {
    className: cn(labelVariants(), className),
    ref
  });
}
__name(SlideToggleLabel, "SlideToggleLabel");
SlideToggleLabel.displayName = labelDisplayNames.label;
function SlideToggle({
  text,
  primary,
  color,
  onClick
}) {
  return /* @__PURE__ */jsxs("div", {
    className: "flex items-center space-x-2",
    children: [/* @__PURE__ */jsx(SlideToggleSwitch, {
      id: "switch",
      className: primary ? "bg-primary" : color,
      onClick
    }), /* @__PURE__ */jsx(SlideToggleLabel, {
      htmlFor: "switch",
      children: text
    })]
  });
}
__name(SlideToggle, "SlideToggle");

export { SlideToggle, SlideToggleLabel, SlideToggleSwitch };
