/**
 * amis-ui v6.14.0-beta.1
 * Copyright 2018-2025 fex
 */

'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var tslib = require('tslib');
require('react');
var PopOverContainer = require('../PopOverContainer.js');
var icons = require('../icons.js');
var GroupedSelection = require('../GroupedSelection.js');
var amisCore = require('amis-core');

var __react_jsx__ = require('react');
var _J$X_ = (__react_jsx__["default"] || __react_jsx__).createElement;
(__react_jsx__["default"] || __react_jsx__).Fragment;
var option2value = function (item) { return item.value; };
function InputSwitch(_a) {
    var options = _a.options, value = _a.value, onChange = _a.onChange, cx = _a.classnames, disabled = _a.disabled, popOverContainer = _a.popOverContainer, testIdBuilder = _a.testIdBuilder;
    return (_J$X_(PopOverContainer.PopOverContainer, { popOverContainer: popOverContainer, popOverRender: function (_a) {
            var onClose = _a.onClose;
            return (_J$X_(GroupedSelection["default"], { onClick: onClose, option2value: option2value, onChange: onChange, options: options, value: value, multiple: false, disabled: disabled, testIdBuilder: testIdBuilder === null || testIdBuilder === void 0 ? void 0 : testIdBuilder.getChild('group') }));
        } }, function (_a) {
        var onClick = _a.onClick, isOpened = _a.isOpened, ref = _a.ref;
        return (_J$X_("div", tslib.__assign({ className: cx('CBInputSwitch', isOpened ? 'is-active' : '') }, testIdBuilder === null || testIdBuilder === void 0 ? void 0 : testIdBuilder.getTestId()),
            _J$X_("a", { onClick: onClick, ref: ref },
                _J$X_(icons.Icon, { icon: "ellipsis-v" }))));
    }));
}
var InputSwitch$1 = amisCore.themeable(InputSwitch);

exports.InputSwitch = InputSwitch;
exports["default"] = InputSwitch$1;
