UNPKG

@gluestack-ui/core

Version:

Universal UI components for React Native, Expo, and Next.js

42 lines 1.92 kB
var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; import React, { forwardRef } from 'react'; import { useCheckbox } from './CheckboxProvider'; const CheckboxIndicator = (StyledCheckboxIndicator) => forwardRef((_a, ref) => { var { children } = _a, props = __rest(_a, ["children"]); const { isChecked, isDisabled, isHovered, isInvalid, isReadOnly, isPressed, isFocused, isIndeterminate, isFocusVisible, } = useCheckbox('CheckboxContext'); return (<StyledCheckboxIndicator states={{ hover: isHovered, checked: isChecked, disabled: isDisabled, focusVisible: isFocusVisible, invalid: isInvalid, readOnly: isReadOnly, active: isPressed, focused: isFocused, indeterminate: isIndeterminate, }} dataSet={{ hover: isHovered ? 'true' : 'false', checked: isChecked ? 'true' : 'false', disabled: isDisabled ? 'true' : 'false', focusVisible: isFocusVisible ? 'true' : 'false', invalid: isInvalid ? 'true' : 'false', readOnly: isReadOnly ? 'true' : 'false', active: isPressed ? 'true' : 'false', focused: isFocused ? 'true' : 'false', indeterminate: isIndeterminate ? 'true' : 'false', }} {...props} ref={ref}> {children} </StyledCheckboxIndicator>); }); export default CheckboxIndicator; //# sourceMappingURL=CheckboxIndicator.jsx.map