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
5
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.7 to 0.0.8

2

dist/index.js

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

var e,r,t=require("@radix-ui/react-primitive").Primitive,n=require("@radix-ui/react-presence").Presence,a=require("@radix-ui/react-label").useLabelContext,i=require("@radix-ui/react-use-controllable-state").useControllableState,o=require("@radix-ui/primitive").composeEventHandlers,c=require("@radix-ui/react-context").createContext,u=require("@radix-ui/react-compose-refs").useComposedRefs,l=(e={},r=require("react"),Object.keys(r).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})})),e);function d(){return(d=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function s(e,r){if(null==e)return{};var t,n,a=function(e,r){if(null==e)return{};var t,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function f(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],n=!0,a=!1,i=void 0;try{for(var o,c=e[Symbol.iterator]();!(n=(o=c.next()).done)&&(t.push(o.value),!r||t.length!==r);n=!0);}catch(e){a=!0,i=e}finally{try{n||null==c.return||c.return()}finally{if(a)throw i}}return t}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return b(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return b(e,r)}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var m=f(c("Checkbox"),2),p=m[0],y=m[1],v=l.forwardRef((function(e,r){var n=e.as,c=void 0===n?"button":n,b=e["aria-labelledby"],m=e.name,y=e.checked,v=e.defaultChecked,h=e.required,k=e.disabled,C=e.readOnly,O=e.value,g=void 0===O?"on":O,j=e.onCheckedChange,q=s(e,["as","aria-labelledby","name","checked","defaultChecked","required","disabled","readOnly","value","onCheckedChange"]),E=l.useRef(null),w=l.useRef(null),S=u(r,w),I=a(w),P=b||I,A=f(i({prop:y,defaultProp:v}),2),R=A[0],M=void 0!==R&&R,F=A[1];return l.useEffect((function(){var e="indeterminate"===M;E.current&&(E.current.indeterminate=e)})),l.createElement(l.Fragment,null,l.createElement("input",{ref:E,type:"checkbox",name:m,checked:"indeterminate"!==M&&M,required:h,disabled:k,readOnly:C,value:g,hidden:!0,onChange:o(j,(function(e){F(e.target.checked)}))}),l.createElement(p,{state:M,disabled:k},l.createElement(t,d({type:"button",role:"checkbox","aria-checked":"indeterminate"===M?"mixed":M,"aria-labelledby":P,"aria-required":h,"data-state":x(M),"data-disabled":k?"":void 0,"data-readonly":C,disabled:k,value:g},q,{as:c,ref:S,onClick:o(e.onClick,(function(){var e;return null===(e=E.current)||void 0===e?void 0:e.click()}),{checkForDefaultPrevented:!1})}))))}));exports.Checkbox=v,v.displayName="Checkbox";var h=l.forwardRef((function(e,r){var a=e.as,i=void 0===a?"span":a,o=e.forceMount,c=s(e,["as","forceMount"]),u=y("CheckboxIndicator");return l.createElement(n,{present:o||"indeterminate"===u.state||!0===u.state},l.createElement(t,d({"data-state":x(u.state),"data-disabled":u.disabled?"":void 0},c,{as:i,ref:r})))}));function x(e){return"indeterminate"===e?"indeterminate":e?"checked":"unchecked"}exports.CheckboxIndicator=h,h.displayName="CheckboxIndicator";var k=v;exports.Root=k;var C=h;exports.Indicator=C;
function e(e,t,r){Object.defineProperty(e,t,{get:r,enumerable:!0})}var t=require("@radix-ui/react-primitive").Primitive,r=require("@radix-ui/react-presence").Presence,a=require("@radix-ui/react-label").useLabelContext,n=require("@radix-ui/react-use-controllable-state").useControllableState,i=require("@radix-ui/primitive").composeEventHandlers,c=require("@radix-ui/react-context").createContext,o=require("@radix-ui/react-compose-refs").useComposedRefs,d=require("react"),u=d.forwardRef,s=d.useRef,l=d.useEffect,b=d.createElement,p=d.Fragment,f={};function h(){return(h=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(this,arguments)}const x="button",[k,m]=c("Checkbox"),C=u(((e,r)=>{const{as:c=x,"aria-labelledby":d,name:u,checked:f,defaultChecked:m,required:C,disabled:v,readOnly:y,value:g="on",onCheckedChange:I,...O}=e,P=s(null),R=s(null),j=o(r,R),E=a(R),w=d||E,[F=!1,N]=n({prop:f,defaultProp:m});return l((()=>{const e="indeterminate"===F;P.current&&(P.current.indeterminate=e)})),b(p,null,b("input",{ref:P,type:"checkbox",name:u,checked:"indeterminate"!==F&&F,required:C,disabled:v,readOnly:y,value:g,hidden:!0,onChange:i(I,(e=>{N(e.target.checked)}))}),b(k,{state:F,disabled:v},b(t,h({type:"button",role:"checkbox","aria-checked":"indeterminate"===F?"mixed":F,"aria-labelledby":w,"aria-required":C,"data-state":q(F),"data-disabled":v?"":void 0,"data-readonly":y,disabled:v,value:g},O,{as:c,ref:j,onClick:i(e.onClick,(()=>P.current?.click?.()),{checkForDefaultPrevented:!1})}))))}));exports.Checkbox=C,C.displayName="Checkbox";const v="span",y=u(((e,a)=>{const{as:n=v,forceMount:i,...c}=e,o=m("CheckboxIndicator");return b(r,{present:i||"indeterminate"===o.state||!0===o.state},b(t,h({"data-state":q(o.state),"data-disabled":o.disabled?"":void 0},c,{as:n,ref:a})))}));function q(e){return"indeterminate"===e?"indeterminate":e?"checked":"unchecked"}exports.CheckboxIndicator=y,y.displayName="CheckboxIndicator";const g=C;exports.Root=g;const I=y;exports.Indicator=I,e(f,"Indicator",(function(){return I})),e(f,"Root",(function(){return g})),e(f,"CheckboxIndicator",(function(){return y})),e(f,"Checkbox",(function(){return C}));
//# 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 n}from"@radix-ui/primitive";import{createContext as o}from"@radix-ui/react-context";import{useComposedRefs as i}from"@radix-ui/react-compose-refs";import*as c from"react";function d(){return(d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(this,arguments)}const l="button",[s,u]=o("Checkbox");export const Checkbox=c.forwardRef(((t,o)=>{const{as:u=l,"aria-labelledby":m,name:b,checked:f,defaultChecked:h,required:x,disabled:k,readOnly:C,value:v="on",onCheckedChange:y,...E}=t,g=c.useRef(null),I=c.useRef(null),O=i(o,I),R=r(I),q=m||R,[w=!1,P]=a({prop:f,defaultProp:h});return c.useEffect((()=>{const e="indeterminate"===w;g.current&&(g.current.indeterminate=e)})),c.createElement(c.Fragment,null,c.createElement("input",{ref:g,type:"checkbox",name:b,checked:"indeterminate"!==w&&w,required:x,disabled:k,readOnly:C,value:v,hidden:!0,onChange:n(y,(e=>{P(e.target.checked)}))}),c.createElement(s,{state:w,disabled:k},c.createElement(e,d({type:"button",role:"checkbox","aria-checked":"indeterminate"===w?"mixed":w,"aria-labelledby":q,"aria-required":x,"data-state":p(w),"data-disabled":k?"":void 0,"data-readonly":C,disabled:k,value:v},E,{as:u,ref:O,onClick:n(t.onClick,(()=>{var e;return null===(e=g.current)||void 0===e?void 0:e.click()}),{checkForDefaultPrevented:!1})}))))}));Checkbox.displayName="Checkbox";const m="span";export const CheckboxIndicator=c.forwardRef(((r,a)=>{const{as:n=m,forceMount:o,...i}=r,l=u("CheckboxIndicator");return c.createElement(t,{present:o||"indeterminate"===l.state||!0===l.state},c.createElement(e,d({"data-state":p(l.state),"data-disabled":l.disabled?"":void 0},i,{as:n,ref:a})))}));function p(e){return"indeterminate"===e?"indeterminate":e?"checked":"unchecked"}CheckboxIndicator.displayName="CheckboxIndicator";export const Root=Checkbox;export const Indicator=CheckboxIndicator;
function e(e,t,r){Object.defineProperty(e,t,{get:r,enumerable:!0})}import{Primitive as t}from"@radix-ui/react-primitive";import{Presence as r}from"@radix-ui/react-presence";import{useLabelContext as a}from"@radix-ui/react-label";import{useControllableState as o}from"@radix-ui/react-use-controllable-state";import{composeEventHandlers as n}from"@radix-ui/primitive";import{createContext as i}from"@radix-ui/react-context";import{useComposedRefs as c}from"@radix-ui/react-compose-refs";import{forwardRef as d,useRef as u,useEffect as l,createElement as s,Fragment as b}from"react";var m={};function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(this,arguments)}const h="button",[x,k]=i("Checkbox");export const Checkbox=d(((e,r)=>{const{as:i=h,"aria-labelledby":d,name:m,checked:k,defaultChecked:f,required:y,disabled:v,readOnly:I,value:g="on",onCheckedChange:O,...P}=e,j=u(null),q=u(null),R=c(r,q),N=a(q),w=d||N,[D=!1,F]=o({prop:k,defaultProp:f});return l((()=>{const e="indeterminate"===D;j.current&&(j.current.indeterminate=e)})),s(b,null,s("input",{ref:j,type:"checkbox",name:m,checked:"indeterminate"!==D&&D,required:y,disabled:v,readOnly:I,value:g,hidden:!0,onChange:n(O,(e=>{F(e.target.checked)}))}),s(x,{state:D,disabled:v},s(t,p({type:"button",role:"checkbox","aria-checked":"indeterminate"===D?"mixed":D,"aria-labelledby":w,"aria-required":y,"data-state":C(D),"data-disabled":v?"":void 0,"data-readonly":I,disabled:v,value:g},P,{as:i,ref:R,onClick:n(e.onClick,(()=>j.current?.click?.()),{checkForDefaultPrevented:!1})}))))}));Checkbox.displayName="Checkbox";const f="span";export const CheckboxIndicator=d(((e,a)=>{const{as:o=f,forceMount:n,...i}=e,c=k("CheckboxIndicator");return s(r,{present:n||"indeterminate"===c.state||!0===c.state},s(t,p({"data-state":C(c.state),"data-disabled":c.disabled?"":void 0},i,{as:o,ref:a})))}));function C(e){return"indeterminate"===e?"indeterminate":e?"checked":"unchecked"}CheckboxIndicator.displayName="CheckboxIndicator";export const Root=Checkbox;export const Indicator=CheckboxIndicator;e(m,"Indicator",(function(){return Indicator})),e(m,"Root",(function(){return Root})),e(m,"CheckboxIndicator",(function(){return CheckboxIndicator})),e(m,"Checkbox",(function(){return Checkbox}));
//# sourceMappingURL=index.module.js.map
{
"name": "@radix-ui/react-checkbox",
"version": "0.0.7",
"version": "0.0.8",
"license": "MIT",

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

"@radix-ui/react-polymorphic": "0.0.6",
"@radix-ui/react-presence": "0.0.7",
"@radix-ui/react-presence": "0.0.8",
"@radix-ui/react-primitive": "0.0.6",

@@ -27,0 +27,0 @@ "@radix-ui/react-use-controllable-state": "0.0.1"

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