'use client';
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
import React, { useId } from 'react';
import { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js';
import { FieldLabel } from '../../fields/FieldLabel/index.js';
import { CheckIcon } from '../../icons/Check/index.js';
import { LineIcon } from '../../icons/Line/index.js';
export const inputBaseClass = 'checkbox-input';
export const CheckboxInput = ({ id: idFromProps, name, AfterInput, BeforeInput, checked, className, inputRef, Label, label, localized, onToggle, partialChecked, readOnly, required })=>{
    const fallbackID = useId();
    const id = idFromProps || fallbackID;
    return /*#__PURE__*/ _jsxDEV("div", {
        className: [
            className,
            inputBaseClass,
            checked && `${inputBaseClass}--checked`,
            readOnly && `${inputBaseClass}--read-only`
        ].filter(Boolean).join(' '),
        children: [
            /*#__PURE__*/ _jsxDEV("div", {
                className: `${inputBaseClass}__input`,
                children: [
                    BeforeInput,
                    /*#__PURE__*/ _jsxDEV("input", {
                        "aria-label": "",
                        "aria-labelledby": name,
                        defaultChecked: Boolean(checked),
                        disabled: readOnly,
                        id: id,
                        name: name,
                        onInput: onToggle,
                        ref: inputRef,
                        required: required,
                        title: name,
                        type: "checkbox"
                    }, void 0, false, {
                        fileName: "src/fields/Checkbox/Input.tsx",
                        lineNumber: 61,
                        columnNumber: 9
                    }, this),
                    /*#__PURE__*/ _jsxDEV("span", {
                        className: [
                            `${inputBaseClass}__icon`,
                            !checked && partialChecked ? 'partial' : 'check'
                        ].filter(Boolean).join(' '),
                        children: [
                            checked && /*#__PURE__*/ _jsxDEV(CheckIcon, {}, void 0, false, {
                                fileName: "src/fields/Checkbox/Input.tsx",
                                lineNumber: 79,
                                columnNumber: 23
                            }, this),
                            !checked && partialChecked && /*#__PURE__*/ _jsxDEV(LineIcon, {}, void 0, false, {
                                fileName: "src/fields/Checkbox/Input.tsx",
                                lineNumber: 80,
                                columnNumber: 42
                            }, this)
                        ]
                    }, void 0, true, {
                        fileName: "src/fields/Checkbox/Input.tsx",
                        lineNumber: 74,
                        columnNumber: 9
                    }, this),
                    AfterInput
                ]
            }, void 0, true, {
                fileName: "src/fields/Checkbox/Input.tsx",
                lineNumber: 59,
                columnNumber: 7
            }, this),
            /*#__PURE__*/ _jsxDEV(RenderCustomComponent, {
                CustomComponent: Label,
                Fallback: /*#__PURE__*/ _jsxDEV(FieldLabel, {
                    htmlFor: id,
                    label: label,
                    localized: localized,
                    required: required
                }, void 0, false, {
                    fileName: "src/fields/Checkbox/Input.tsx",
                    lineNumber: 87,
                    columnNumber: 11
                }, void 0)
            }, void 0, false, {
                fileName: "src/fields/Checkbox/Input.tsx",
                lineNumber: 84,
                columnNumber: 7
            }, this)
        ]
    }, void 0, true, {
        fileName: "src/fields/Checkbox/Input.tsx",
        lineNumber: 49,
        columnNumber: 5
    }, this);
};

//# sourceMappingURL=Input.js.map