Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@radix-ui/react-checkbox

Package Overview
Dependencies
Maintainers
8
Versions
202
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 0.0.15 to 0.0.16

2

dist/index.d.ts

@@ -11,3 +11,3 @@ import * as React from "react";

required?: InputDOMProps['required'];
onCheckedChange?: InputDOMProps['onChange'];
onCheckedChange?(checked: CheckedState): void;
}>;

@@ -14,0 +14,0 @@ export type CheckboxPrimitive = Polymorphic.ForwardRefComponent<typeof CHECKBOX_DEFAULT_TAG, CheckboxOwnProps>;

@@ -1,2 +0,2 @@

var e,t,r,a=require("@radix-ui/react-primitive").Primitive,n=require("@radix-ui/react-presence").Presence,i=require("@radix-ui/react-label").useLabelContext,c=require("@radix-ui/react-use-controllable-state").useControllableState,d=require("@radix-ui/primitive").composeEventHandlers,o=require("@radix-ui/react-context").createContext,u=require("@radix-ui/react-compose-refs").useComposedRefs,l=(e={},t=require("react"),Object.keys(t).forEach((function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),e),s=(r=require("@babel/runtime/helpers/extends"))&&r.__esModule?r.default:r;const b="button",[m,f]=o("Checkbox"),x=/*#__PURE__*/l.forwardRef(((e,t)=>{const{as:r=b,"aria-labelledby":n,name:o,checked:f,defaultChecked:x,required:p,disabled:h,value:v="on",onCheckedChange:C,...q}=e,E=l.useRef(null),[y,g]=l.useState(null),P=u(t,(e=>g(e))),R=i(y),_=n||R,[I=!1,M]=c({prop:f,defaultProp:x});return l.useEffect((()=>{const e="indeterminate"===I;E.current&&(E.current.indeterminate=e)})),/*#__PURE__*/l.createElement(l.Fragment,null,/*#__PURE__*/l.createElement("input",{ref:E,type:"checkbox",name:o,checked:"indeterminate"!==I&&I,required:p,disabled:h,value:v,style:{display:"none"},onChange:d(C,(e=>{M(e.target.checked)}))}),/*#__PURE__*/l.createElement(m,{state:I,disabled:h},/*#__PURE__*/l.createElement(a,s({type:"button",role:"checkbox","aria-checked":"indeterminate"===I?"mixed":I,"aria-labelledby":_,"aria-required":p,"data-state":k(I),"data-disabled":h?"":void 0,disabled:h,value:v},q,{as:r,ref:P,onClick:d(e.onClick,(()=>{var e;return null===(e=E.current)||void 0===e?void 0:e.click()}),{checkForDefaultPrevented:!1})}))))}));exports.Checkbox=x;const p="span",h=/*#__PURE__*/l.forwardRef(((e,t)=>{const{as:r=p,forceMount:i,...c}=e,d=f("CheckboxIndicator");/*#__PURE__*/return l.createElement(n,{present:i||"indeterminate"===d.state||!0===d.state},/*#__PURE__*/l.createElement(a,s({"data-state":k(d.state),"data-disabled":d.disabled?"":void 0},c,{as:r,ref:t})))}));function k(e){return"indeterminate"===e?"indeterminate":e?"checked":"unchecked"}exports.CheckboxIndicator=h;const v=x;exports.Root=v;const C=h;exports.Indicator=C;
var e,t,r,a=require("@radix-ui/react-primitive").Primitive,n=require("@radix-ui/react-presence").Presence,o=require("@radix-ui/react-label").useLabelContext,i=require("@radix-ui/react-use-size").useSize,c=require("@radix-ui/react-use-previous").usePrevious,s=require("@radix-ui/react-use-controllable-state").useControllableState,u=require("@radix-ui/primitive").composeEventHandlers,d=require("@radix-ui/react-context").createContext,l=require("@radix-ui/react-compose-refs").useComposedRefs,b=(e={},t=require("react"),Object.keys(t).forEach((function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),e),p=(r=require("@babel/runtime/helpers/extends"))&&r.__esModule?r.default:r;const f="button",[x,m]=d("Checkbox"),h=/*#__PURE__*/b.forwardRef(((e,t)=>{const{as:r=f,"aria-labelledby":n,name:i,checked:c,defaultChecked:d,required:m,disabled:h,value:k="on",onCheckedChange:v,...E}=e,[P,g]=b.useState(null),w=l(t,(e=>g(e))),R=o(P),I=n||R,M=b.useRef(!1),O=!P||Boolean(P.closest("form")),[S=!1,_]=s({prop:c,defaultProp:d,onChange:v});/*#__PURE__*/return b.createElement(x,{state:S,disabled:h},/*#__PURE__*/b.createElement(a,p({type:"button",role:"checkbox","aria-checked":q(S)?"mixed":S,"aria-labelledby":I,"aria-required":m,"data-state":y(S),"data-disabled":h?"":void 0,disabled:h,value:k},E,{as:r,ref:w,onClick:u(e.onClick,(e=>{_((e=>!!q(e)||!e)),O&&(M.current=e.isPropagationStopped(),M.current||e.stopPropagation())}))})),O&&/*#__PURE__*/b.createElement(C,{control:P,bubbles:!M.current,name:i,value:k,checked:S,required:m,disabled:h,style:{transform:"translateX(-100%)"}}))}));exports.Checkbox=h;const k="span",v=/*#__PURE__*/b.forwardRef(((e,t)=>{const{as:r=k,forceMount:o,...i}=e,c=m("CheckboxIndicator");/*#__PURE__*/return b.createElement(n,{present:o||q(c.state)||!0===c.state},/*#__PURE__*/b.createElement(a,p({"data-state":y(c.state),"data-disabled":c.disabled?"":void 0},i,{as:r,ref:t,style:{pointerEvents:"none",...e.style}})))}));exports.CheckboxIndicator=v;const C=e=>{const{control:t,checked:r,bubbles:a=!0,...n}=e,o=b.useRef(null),s=c(r),u=i(t);return b.useEffect((()=>{const e=o.current,t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,"checked").set;if(s!==r&&n){const t=new Event("click",{bubbles:a});e.indeterminate=q(r),n.call(e,!q(r)&&r),e.dispatchEvent(t)}}),[s,r,a]),/*#__PURE__*/b.createElement("input",p({type:"checkbox",defaultChecked:!q(r)&&r},n,{tabIndex:-1,ref:o,style:{...e.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function q(e){return"indeterminate"===e}function y(e){return q(e)?"indeterminate":e?"checked":"unchecked"}const E=h;exports.Root=E;const P=v;exports.Indicator=P;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import{Primitive as e}from"@radix-ui/react-primitive";import{Presence as t}from"@radix-ui/react-presence";import{useLabelContext as r}from"@radix-ui/react-label";import{useControllableState as a}from"@radix-ui/react-use-controllable-state";import{composeEventHandlers as i}from"@radix-ui/primitive";import{createContext as n}from"@radix-ui/react-context";import{useComposedRefs as o}from"@radix-ui/react-compose-refs";import*as c from"react";import d from"@babel/runtime/helpers/esm/extends";const l="button",[s,m]=n("Checkbox");export const Checkbox=/*#__PURE__*/c.forwardRef(((t,n)=>{const{as:m=l,"aria-labelledby":u,name:b,checked:f,defaultChecked:x,required:h,disabled:k,value:C="on",onCheckedChange:v,...E}=t,y=c.useRef(null),[g,I]=c.useState(null),R=o(n,(e=>I(e))),q=r(g),w=u||q,[F=!1,P]=a({prop:f,defaultProp:x});return c.useEffect((()=>{const e="indeterminate"===F;y.current&&(y.current.indeterminate=e)})),/*#__PURE__*/c.createElement(c.Fragment,null,/*#__PURE__*/c.createElement("input",{ref:y,type:"checkbox",name:b,checked:"indeterminate"!==F&&F,required:h,disabled:k,value:C,style:{display:"none"},onChange:i(v,(e=>{P(e.target.checked)}))}),/*#__PURE__*/c.createElement(s,{state:F,disabled:k},/*#__PURE__*/c.createElement(e,d({type:"button",role:"checkbox","aria-checked":"indeterminate"===F?"mixed":F,"aria-labelledby":w,"aria-required":h,"data-state":p(F),"data-disabled":k?"":void 0,disabled:k,value:C},E,{as:m,ref:R,onClick:i(t.onClick,(()=>{var e;return null===(e=y.current)||void 0===e?void 0:e.click()}),{checkForDefaultPrevented:!1})}))))}));/*#__PURE__*/const u="span";export const CheckboxIndicator=/*#__PURE__*/c.forwardRef(((r,a)=>{const{as:i=u,forceMount:n,...o}=r,l=m("CheckboxIndicator");/*#__PURE__*/return c.createElement(t,{present:n||"indeterminate"===l.state||!0===l.state},/*#__PURE__*/c.createElement(e,d({"data-state":p(l.state),"data-disabled":l.disabled?"":void 0},o,{as:i,ref:a})))}));/*#__PURE__*/function p(e){return"indeterminate"===e?"indeterminate":e?"checked":"unchecked"}export const Root=Checkbox;export const Indicator=CheckboxIndicator;
import{Primitive as e}from"@radix-ui/react-primitive";import{Presence as t}from"@radix-ui/react-presence";import{useLabelContext as r}from"@radix-ui/react-label";import{useSize as o}from"@radix-ui/react-use-size";import{usePrevious as a}from"@radix-ui/react-use-previous";import{useControllableState as n}from"@radix-ui/react-use-controllable-state";import{composeEventHandlers as i}from"@radix-ui/primitive";import{createContext as c}from"@radix-ui/react-context";import{useComposedRefs as s}from"@radix-ui/react-compose-refs";import*as d from"react";import l from"@babel/runtime/helpers/esm/extends";const u="button",[p,m]=c("Checkbox");export const Checkbox=/*#__PURE__*/d.forwardRef(((t,o)=>{const{as:a=u,"aria-labelledby":c,name:m,checked:b,defaultChecked:k,required:C,disabled:v,value:y="on",onCheckedChange:E,...g}=t,[w,I]=d.useState(null),R=s(o,(e=>I(e))),P=r(w),q=c||P,M=d.useRef(!1),O=!w||Boolean(w.closest("form")),[S=!1,j]=n({prop:b,defaultProp:k,onChange:E});/*#__PURE__*/return d.createElement(p,{state:S,disabled:v},/*#__PURE__*/d.createElement(e,l({type:"button",role:"checkbox","aria-checked":x(S)?"mixed":S,"aria-labelledby":q,"aria-required":C,"data-state":h(S),"data-disabled":v?"":void 0,disabled:v,value:y},g,{as:a,ref:R,onClick:i(t.onClick,(e=>{j((e=>!!x(e)||!e)),O&&(M.current=e.isPropagationStopped(),M.current||e.stopPropagation())}))})),O&&/*#__PURE__*/d.createElement(f,{control:w,bubbles:!M.current,name:m,value:y,checked:S,required:C,disabled:v,style:{transform:"translateX(-100%)"}}))}));/*#__PURE__*/const b="span";export const CheckboxIndicator=/*#__PURE__*/d.forwardRef(((r,o)=>{const{as:a=b,forceMount:n,...i}=r,c=m("CheckboxIndicator");/*#__PURE__*/return d.createElement(t,{present:n||x(c.state)||!0===c.state},/*#__PURE__*/d.createElement(e,l({"data-state":h(c.state),"data-disabled":c.disabled?"":void 0},i,{as:a,ref:o,style:{pointerEvents:"none",...r.style}})))}));/*#__PURE__*/const f=e=>{const{control:t,checked:r,bubbles:n=!0,...i}=e,c=d.useRef(null),s=a(r),u=o(t);return d.useEffect((()=>{const e=c.current,t=window.HTMLInputElement.prototype,o=Object.getOwnPropertyDescriptor(t,"checked").set;if(s!==r&&o){const t=new Event("click",{bubbles:n});e.indeterminate=x(r),o.call(e,!x(r)&&r),e.dispatchEvent(t)}}),[s,r,n]),/*#__PURE__*/d.createElement("input",l({type:"checkbox",defaultChecked:!x(r)&&r},i,{tabIndex:-1,ref:c,style:{...e.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function x(e){return"indeterminate"===e}function h(e){return x(e)?"indeterminate":e?"checked":"unchecked"}export const Root=Checkbox;export const Indicator=CheckboxIndicator;
//# sourceMappingURL=index.module.js.map
{
"name": "@radix-ui/react-checkbox",
"version": "0.0.15",
"version": "0.0.16",
"license": "MIT",

@@ -24,7 +24,9 @@ "source": "src/index.ts",

"@radix-ui/react-context": "0.0.5",
"@radix-ui/react-label": "0.0.13",
"@radix-ui/react-polymorphic": "0.0.11",
"@radix-ui/react-label": "0.0.14",
"@radix-ui/react-polymorphic": "0.0.12",
"@radix-ui/react-presence": "0.0.14",
"@radix-ui/react-primitive": "0.0.13",
"@radix-ui/react-use-controllable-state": "0.0.6"
"@radix-ui/react-primitive": "0.0.14",
"@radix-ui/react-use-controllable-state": "0.0.6",
"@radix-ui/react-use-previous": "0.0.5",
"@radix-ui/react-use-size": "0.0.6"
},

@@ -31,0 +33,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc