// Copyright 1999-2025. WebPros International GmbH. All rights reserved.

import classNames from 'classnames';
import { CLS_PREFIX } from '../../constants';
import Switch from '../Switch';
import Action from '../Action';
import Popover from '../Popover';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
/**
 * `SwitchesPanelItem` component is used for combining [Switch](#!/Switch) component with text title and description.
 * Used in [SwitchesPanel](#!/SwitchesPanel).
 * @since 0.3.0
 */
const SwitchesPanelItem = _ref => {
  let {
    onChange,
    defaultChecked = false,
    intent,
    title,
    description,
    fullDescription,
    className,
    switchProps = {},
    children,
    baseClassName = `${CLS_PREFIX}switches-panel-item`,
    ...props
  } = _ref;
  return /*#__PURE__*/_jsxs("div", {
    className: classNames(baseClassName, {
      [`${baseClassName}--${intent}`]: intent
    }, className),
    ...props,
    children: [/*#__PURE__*/_jsx("h5", {
      className: `${baseClassName}__title`,
      children: title
    }), description && /*#__PURE__*/_jsx("p", {
      className: `${baseClassName}__description`,
      children: description
    }), /*#__PURE__*/_jsxs("div", {
      className: `${baseClassName}__actions`,
      children: [/*#__PURE__*/_jsx(Switch, {
        className: `${baseClassName}__switch`,
        intent: intent,
        onChange: onChange,
        defaultChecked: defaultChecked,
        ...switchProps
      }), (fullDescription || children) && /*#__PURE__*/_jsxs("div", {
        className: `${baseClassName}__controls`,
        children: [children, fullDescription && /*#__PURE__*/_jsx(Popover, {
          intent: "info",
          target: /*#__PURE__*/_jsx(Action, {
            icon: "question-mark-circle",
            outerProps: {
              className: `${baseClassName}__full-description-toggle`
            }
          }),
          placement: "bottom",
          children: fullDescription
        })]
      })]
    })]
  });
};
export default SwitchesPanelItem;