🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@radix-ui/react-checkbox

Package Overview
Dependencies
Maintainers
6
Versions
267
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@radix-ui/react-checkbox - npm Package Compare versions

Comparing version

to
1.2.0-rc.1744311029001

91

dist/index.js

@@ -116,3 +116,3 @@ "use strict";

isFormControl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
BubbleInput,
CheckboxBubbleInput,
{

@@ -153,40 +153,55 @@ control: button,

CheckboxIndicator.displayName = INDICATOR_NAME;
var BubbleInput = (props) => {
const { control, checked, bubbles = true, defaultChecked, ...inputProps } = props;
const ref = React.useRef(null);
const prevChecked = (0, import_react_use_previous.usePrevious)(checked);
const controlSize = (0, import_react_use_size.useSize)(control);
React.useEffect(() => {
const input = ref.current;
const inputProto = window.HTMLInputElement.prototype;
const descriptor = Object.getOwnPropertyDescriptor(inputProto, "checked");
const setChecked = descriptor.set;
if (prevChecked !== checked && setChecked) {
const event = new Event("click", { bubbles });
input.indeterminate = isIndeterminate(checked);
setChecked.call(input, isIndeterminate(checked) ? false : checked);
input.dispatchEvent(event);
}
}, [prevChecked, checked, bubbles]);
const defaultCheckedRef = React.useRef(isIndeterminate(checked) ? false : checked);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"input",
{
type: "checkbox",
"aria-hidden": true,
defaultChecked: defaultChecked ?? defaultCheckedRef.current,
...inputProps,
tabIndex: -1,
ref,
style: {
...props.style,
...controlSize,
position: "absolute",
pointerEvents: "none",
opacity: 0,
margin: 0
var BUBBLE_INPUT_NAME = "CheckboxBubbleInput";
var CheckboxBubbleInput = React.forwardRef(
({
__scopeCheckbox,
control,
checked,
bubbles = true,
defaultChecked,
...props
}, forwardedRef) => {
const ref = React.useRef(null);
const composedRefs = (0, import_react_compose_refs.useComposedRefs)(ref, forwardedRef);
const prevChecked = (0, import_react_use_previous.usePrevious)(checked);
const controlSize = (0, import_react_use_size.useSize)(control);
React.useEffect(() => {
const input = ref.current;
if (!input) return;
const inputProto = window.HTMLInputElement.prototype;
const descriptor = Object.getOwnPropertyDescriptor(
inputProto,
"checked"
);
const setChecked = descriptor.set;
if (prevChecked !== checked && setChecked) {
const event = new Event("click", { bubbles });
input.indeterminate = isIndeterminate(checked);
setChecked.call(input, isIndeterminate(checked) ? false : checked);
input.dispatchEvent(event);
}
}
);
};
}, [prevChecked, checked, bubbles]);
const defaultCheckedRef = React.useRef(isIndeterminate(checked) ? false : checked);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_react_primitive.Primitive.input,
{
type: "checkbox",
"aria-hidden": true,
defaultChecked: defaultChecked ?? defaultCheckedRef.current,
...props,
tabIndex: -1,
ref: composedRefs,
style: {
...props.style,
...controlSize,
position: "absolute",
pointerEvents: "none",
opacity: 0,
margin: 0
}
}
);
}
);
CheckboxBubbleInput.displayName = BUBBLE_INPUT_NAME;
function isIndeterminate(checked) {

@@ -193,0 +208,0 @@ return checked === "indeterminate";

{
"name": "@radix-ui/react-checkbox",
"version": "1.1.6-rc.1744259481941",
"version": "1.2.0-rc.1744311029001",
"license": "MIT",

@@ -15,8 +15,8 @@ "source": "./src/index.ts",

"@radix-ui/primitive": "1.1.2",
"@radix-ui/react-compose-refs": "1.1.2",
"@radix-ui/react-context": "1.1.2",
"@radix-ui/react-primitive": "2.0.3",
"@radix-ui/react-presence": "1.1.3",
"@radix-ui/react-primitive": "2.1.0-rc.1744311029001",
"@radix-ui/react-compose-refs": "1.1.2",
"@radix-ui/react-use-controllable-state": "1.2.0-rc.1744311029001",
"@radix-ui/react-use-previous": "1.1.1",
"@radix-ui/react-use-controllable-state": "1.2.0-rc.1744259481941",
"@radix-ui/react-use-size": "1.1.1"

@@ -32,4 +32,4 @@ },

"@repo/builder": "0.0.0",
"@repo/eslint-config": "0.0.0",
"@repo/typescript-config": "0.0.0"
"@repo/typescript-config": "0.0.0",
"@repo/eslint-config": "0.0.0"
},

@@ -36,0 +36,0 @@ "peerDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet