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

import { __assign } from 'tslib';
import React__default from 'react';
import { PopOverContainer } from '../PopOverContainer.js';
import { Icon } from '../icons.js';
import GroupedSelection from '../GroupedSelection.js';
import { themeable } from 'amis-core';

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 (React__default.createElement(PopOverContainer, { popOverContainer: popOverContainer, popOverRender: function (_a) {
            var onClose = _a.onClose;
            return (React__default.createElement(GroupedSelection, { 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 (React__default.createElement("div", __assign({ className: cx('CBInputSwitch', isOpened ? 'is-active' : '') }, testIdBuilder === null || testIdBuilder === void 0 ? void 0 : testIdBuilder.getTestId()),
            React__default.createElement("a", { onClick: onClick, ref: ref },
                React__default.createElement(Icon, { icon: "ellipsis-v" }))));
    }));
}
var InputSwitch$1 = themeable(InputSwitch);

export { InputSwitch, InputSwitch$1 as default };
