import { jsx } from "react/jsx-runtime";
import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-DWVaNd2E.js";
import { Switch } from "./switch.js";
import { RichLabel } from "../rich-label/rich-label.js";
/**
 * A toggle switch with a label and optional icon and subtitle.
 *
 * @component
 * @param {Object} props - Component props.
 * @param {boolean} props.checked - Whether the switch is checked.
 * @param {Function} props.onChange - Function to call when the switch is toggled.
 * @param {boolean} [props.disabled] - Whether the switch is disabled.
 * @param {JSX.Element} [props.icon] - Icon to display.
 * @param {string} props.label - Label to display.
 * @param {string} [props.subtitle] - Subtitle to display.
 * @param {string} [props.className] - Classes to pass to the toggle switch.
 * @param {string} [props.labelClassName] - Classes to pass to the label.
 * @param {boolean} [props.isIndeterminate] - If `true`, the switch will render in an indeterminate state.
 * @param {boolean} [props.hidden] - If `true`, the component is not rendered.
 *
 * @returns {JSX.Element} The Toggle component.
 *
 * @example
 * const [checked, setChecked] = useState(false);
 *
 * <Toggle
 * 	icon={icons.myIcon}
 * 	label='My toggle'
 * 	checked={checked}
 * 	onChange={() => setChecked(!checked)}
 * />
 *
 * @preserve
 */
const Toggle = (props) => {
  const { checked, onChange, icon, label, subtitle, disabled, className, labelClassName, isIndeterminate, hidden } = props;
  if (hidden) {
    return null;
  }
  return /* @__PURE__ */ jsx(
    Switch,
    {
      checked,
      onChange,
      disabled,
      className,
      isIndeterminate,
      children: /* @__PURE__ */ jsx(
        RichLabel,
        {
          as: $01b77f81d0f07f68$export$b04be29aa201d4f5,
          icon,
          label,
          subtitle,
          className: labelClassName,
          fullWidth: true
        }
      )
    }
  );
};
export {
  Toggle
};
