@ariakit/react
Version:
Toolkit for building accessible web apps with React
59 lines (47 loc) • 1.66 kB
JavaScript
;Object.defineProperty(exports, "__esModule", {value: true});
var _X4U3XKYQcjs = require('./X4U3XKYQ.cjs');
var _LZ6L3ECGcjs = require('./LZ6L3ECG.cjs');
// ../ariakit-react-components/dist/checkbox/checkbox-check.js
var _react = require('react');
var _jsxruntime = require('react/jsx-runtime');
var TagName = "span";
var checkmark = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", {
display: "block",
fill: "none",
stroke: "currentColor",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: 1.5,
viewBox: "0 0 16 16",
height: "1em",
width: "1em",
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "polyline", { points: "4,8 7,12 12,4" })
});
function getChildren(props) {
if (props.checked) return props.children || checkmark;
return null;
}
var useCheckboxCheck = _LZ6L3ECGcjs.createHook.call(void 0, function useCheckboxCheck2({ store, checked, ...props }) {
const context = _react.useContext.call(void 0, _X4U3XKYQcjs.CheckboxCheckedContext);
checked = checked != null ? checked : context;
const children = getChildren({
checked,
children: props.children
});
props = {
"aria-hidden": true,
...props,
children,
style: {
width: "1em",
height: "1em",
pointerEvents: "none",
...props.style
}
};
return _LZ6L3ECGcjs.removeUndefinedValues.call(void 0, props);
});
var CheckboxCheck = _LZ6L3ECGcjs.forwardRef.call(void 0, function CheckboxCheck2(props) {
return _LZ6L3ECGcjs.createElement.call(void 0, TagName, useCheckboxCheck(props));
});
exports.useCheckboxCheck = useCheckboxCheck; exports.CheckboxCheck = CheckboxCheck;