"use client";
'use strict';

require('react');
var checkboxGroup = require('@base-ui/react/checkbox-group');
var clsx = require('clsx');
var tailwindMerge = require('tailwind-merge');
var jsxRuntime = require('react/jsx-runtime');
var checkbox = require('@base-ui/react/checkbox');
var lucideReact = require('lucide-react');

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 tailwindMerge.twMerge(clsx.clsx(inputs));
}
function CheckboxGroup(_a) {
  var _b = _a, {
    className
  } = _b, props = __objRest(_b, [
    "className"
  ]);
  return /* @__PURE__ */ jsxRuntime.jsx(
    checkboxGroup.CheckboxGroup,
    __spreadValues({
      "data-slot": "checkbox-group",
      className: cn("grid w-full gap-2", className)
    }, props)
  );
}
function Checkbox(_a) {
  var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
  return /* @__PURE__ */ jsxRuntime.jsx(
    checkbox.Checkbox.Root,
    __spreadProps(__spreadValues({
      "data-slot": "checkbox",
      className: cn(
        "group/checkbox relative inline-flex size-6 shrink-0 cursor-pointer items-center justify-center outline-none touch-manipulation",
        "focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",
        className
      )
    }, props), {
      children: /* @__PURE__ */ jsxRuntime.jsx(
        "span",
        {
          "aria-hidden": true,
          className: cn(
            "relative flex size-4 shrink-0 items-center justify-center overflow-hidden rounded-[4px] border border-input bg-background transition-colors outline-none",
            "dark:bg-input/30",
            "group-focus-visible/checkbox:ring-4 group-focus-visible/checkbox:ring-ring/50 group-focus-visible/checkbox:ring-offset-1 group-focus-visible/checkbox:ring-offset-background",
            "group-focus-visible/checkbox:border-ring",
            "group-disabled/checkbox:cursor-not-allowed group-disabled/checkbox:opacity-50",
            "group-aria-invalid/checkbox:border-destructive group-aria-invalid/checkbox:ring-3 group-aria-invalid/checkbox:ring-destructive/20",
            "group-aria-invalid/checkbox:group-data-checked/checkbox:border-primary",
            "dark:group-aria-invalid/checkbox:border-destructive/50 dark:group-aria-invalid/checkbox:ring-destructive/40",
            "group-data-unchecked/checkbox:group-hover/checkbox:border-input-hover group-data-unchecked/checkbox:group-hover/checkbox:bg-accent/50",
            "dark:group-data-unchecked/checkbox:group-hover/checkbox:border-input-hover dark:group-data-unchecked/checkbox:group-hover/checkbox:bg-accent/30",
            "group-disabled/checkbox:group-hover/checkbox:border-input group-disabled/checkbox:group-hover/checkbox:bg-transparent",
            "group-data-checked/checkbox:border-primary group-data-checked/checkbox:bg-primary group-data-checked/checkbox:text-primary-foreground",
            "group-data-checked/checkbox:group-hover/checkbox:border-[var(--primary-hover)] group-data-checked/checkbox:group-hover/checkbox:bg-[var(--primary-hover)]",
            "dark:group-data-checked/checkbox:bg-primary",
            "group-data-indeterminate/checkbox:border-primary group-data-indeterminate/checkbox:bg-primary group-data-indeterminate/checkbox:text-primary-foreground",
            "group-data-indeterminate/checkbox:group-hover/checkbox:border-[var(--primary-hover)] group-data-indeterminate/checkbox:group-hover/checkbox:bg-[var(--primary-hover)]",
            "dark:group-data-indeterminate/checkbox:bg-primary"
          ),
          children: /* @__PURE__ */ jsxRuntime.jsx(
            checkbox.Checkbox.Indicator,
            {
              "data-slot": "checkbox-indicator",
              keepMounted: true,
              className: "absolute inset-0 flex items-center justify-center leading-none text-current transition-none",
              render: (indicatorProps, state) => /* @__PURE__ */ jsxRuntime.jsx(
                "span",
                __spreadProps(__spreadValues({}, indicatorProps), {
                  className: cn(
                    indicatorProps.className,
                    "flex size-full items-center justify-center"
                  ),
                  children: state.indeterminate ? /* @__PURE__ */ jsxRuntime.jsx(
                    lucideReact.MinusIcon,
                    {
                      className: "block size-2.5",
                      strokeWidth: 2.25,
                      "aria-hidden": true
                    }
                  ) : state.checked ? /* @__PURE__ */ jsxRuntime.jsx(
                    lucideReact.CheckIcon,
                    {
                      className: "block size-2.5",
                      strokeWidth: 2.25,
                      "aria-hidden": true
                    }
                  ) : null
                })
              )
            }
          )
        }
      )
    })
  );
}
function CheckboxSegmented({
  value,
  defaultValue,
  onValueChange,
  options,
  className,
  disabled
}) {
  return /* @__PURE__ */ jsxRuntime.jsx(
    CheckboxGroup,
    {
      "data-slot": "checkbox-segmented",
      value,
      defaultValue,
      onValueChange,
      disabled,
      className: cn(
        "inline-flex h-9 w-fit items-center gap-1 rounded-[var(--radius-md)] border border-border bg-muted/50 p-1",
        className
      ),
      children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(
        "label",
        {
          className: cn(
            "relative flex cursor-pointer items-center justify-center gap-1.5 rounded-[var(--radius-sm)] px-2.5 py-1.5 text-sm font-medium transition-colors",
            "text-muted-foreground hover:text-foreground",
            "has-[[data-checked]]:bg-primary has-[[data-checked]]:text-primary-foreground has-[[data-checked]]:hover:bg-primary has-[[data-checked]]:hover:text-primary-foreground",
            "has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50"
          ),
          children: [
            /* @__PURE__ */ jsxRuntime.jsx(
              Checkbox,
              {
                value: option.value,
                disabled,
                className: "peer sr-only"
              }
            ),
            option.icon != null ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "[&>svg]:size-4 [&>svg]:shrink-0", "aria-hidden": true, children: option.icon }) : null,
            /* @__PURE__ */ jsxRuntime.jsx("span", { children: option.label })
          ]
        },
        option.value
      ))
    }
  );
}

exports.CheckboxSegmented = CheckboxSegmented;
//# sourceMappingURL=checkbox-segmented.cjs.map
//# sourceMappingURL=checkbox-segmented.cjs.map