@gravity-ui/uikit
Version:
Gravity UI base styling and components
24 lines (23 loc) • 1.45 kB
JavaScript
'use client';
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import * as React from 'react';
import { useCheckbox } from "../../hooks/private/index.js";
import { ControlLabel } from "../ControlLabel/index.js";
import { block } from "../utils/cn.js";
import { CheckboxDashIcon } from "./CheckboxDashIcon.js";
import { CheckboxTickIcon } from "./CheckboxTickIcon.js";
import "./Checkbox.css";
const b = block('checkbox');
export const Checkbox = React.forwardRef(function Checkbox(props, ref) {
const { size = 'm', indeterminate, disabled = false, content, children, title, style, className, qa, } = props;
const { checked, inputProps } = useCheckbox(props);
const text = content || children;
const control = (_jsxs("span", { className: b('indicator'), children: [_jsx("span", { className: b('icon'), "aria-hidden": true, children: indeterminate ? (_jsx(CheckboxDashIcon, { className: b('icon-svg', { type: 'dash' }) })) : (_jsx(CheckboxTickIcon, { className: b('icon-svg', { type: 'tick' }) })) }), _jsx("input", { ...inputProps, className: b('control') }), _jsx("span", { className: b('outline') })] }));
return (_jsx(ControlLabel, { ref: ref, title: title, style: style, size: size, disabled: disabled, className: b({
size,
disabled,
indeterminate,
checked,
}, className), qa: qa, control: control, children: text }));
});
//# sourceMappingURL=Checkbox.js.map