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

5

dist/index.d.ts
import * as React from "react";
import { Primitive } from "@radix-ui/react-primitive";
import * as Polymorphic from "@radix-ui/react-polymorphic";
import { Merge } from "@radix-ui/utils";
declare const CHECKBOX_DEFAULT_TAG = "button";
type CheckedState = boolean | 'indeterminate';
type InputDOMProps = React.ComponentProps<'input'>;
type CheckboxOwnProps = Merge<Polymorphic.OwnProps<typeof Primitive>, {
type CheckboxOwnProps = Polymorphic.Merge<Polymorphic.OwnProps<typeof Primitive>, {
checked?: CheckedState;

@@ -18,3 +17,3 @@ defaultChecked?: CheckedState;

declare const INDICATOR_DEFAULT_TAG = "span";
type CheckboxIndicatorOwnProps = Merge<Polymorphic.OwnProps<typeof Primitive>, {
type CheckboxIndicatorOwnProps = Polymorphic.Merge<Polymorphic.OwnProps<typeof Primitive>, {
/**

@@ -21,0 +20,0 @@ * Used to force mounting when more control is needed. Useful when

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,o=require("@radix-ui/react-utils"),i=o.createContext,c=o.composeEventHandlers,l=o.useControlledState,u=o.useComposedRefs,d=require("@radix-ui/utils").getSelector,s=(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 f(){return(f=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 b(e,r){if(null==e)return{};var t,n,a=function(e,r){if(null==e)return{};var t,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||(a[t]=e[t]);return a}(e,r);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)t=o[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function v(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,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(n=(i=c.next()).done)&&(t.push(i.value),!r||t.length!==r);n=!0);}catch(e){a=!0,o=e}finally{try{n||null==c.return||c.return()}finally{if(a)throw o}}return t}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return h(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 h(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 h(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 y=v(i("CheckboxContext","Checkbox"),2),m=y[0],p=y[1],k=s.forwardRef((function(e,r){var n=e.as,o=void 0===n?"button":n,i=e.selector,h=void 0===i?d("Checkbox"):i,y=e["aria-labelledby"],p=e.name,k=e.checked,x=e.defaultChecked,g=e.required,O=e.disabled,j=e.readOnly,E=e.value,q=void 0===E?"on":E,S=e.onCheckedChange,w=b(e,["as","selector","aria-labelledby","name","checked","defaultChecked","required","disabled","readOnly","value","onCheckedChange"]),I=s.useRef(null),P=s.useRef(null),A=u(r,P),R=a(P),M=y||R,F=v(l({prop:k,defaultProp:x}),2),N=F[0],_=void 0!==N&&N,D=F[1];s.useEffect((function(){var e="indeterminate"===_;I.current&&(I.current.indeterminate=e)}));var H=s.useMemo((function(){return{state:_,disabled:O}}),[_,O]);return s.createElement(s.Fragment,null,s.createElement("input",{ref:I,type:"checkbox",name:p,checked:"indeterminate"!==_&&_,required:g,disabled:O,readOnly:j,value:q,hidden:!0,onChange:c(S,(function(e){D(e.target.checked)}))}),s.createElement(m.Provider,{value:H},s.createElement(t,f({type:"button","aria-checked":"indeterminate"===_?"mixed":_,"aria-labelledby":M,"aria-required":g,"data-state":C(_),"data-disabled":O?"":void 0,"data-readonly":j},w,{as:o,selector:h,ref:A,role:"checkbox",disabled:O,value:q,onClick:c(e.onClick,(function(){var e;return null===(e=I.current)||void 0===e?void 0:e.click()}),{checkForDefaultPrevented:!1})}))))}));exports.Checkbox=k,k.displayName="Checkbox";var x=s.forwardRef((function(e,r){var a=e.as,o=void 0===a?"span":a,i=e.selector,c=void 0===i?d("CheckboxIndicator"):i,l=e.forceMount,u=b(e,["as","selector","forceMount"]),v=p("CheckboxIndicator");return s.createElement(n,{present:l||"indeterminate"===v.state||!0===v.state},s.createElement(t,f({"data-state":C(v.state),"data-disabled":v.disabled?"":void 0},u,{as:o,selector:c,ref:r})))}));function C(e){return"indeterminate"===e?"indeterminate":e?"checked":"unchecked"}exports.CheckboxIndicator=x,x.displayName="CheckboxIndicator";var g=k;exports.Root=g;var O=x;exports.Indicator=O;
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;
//# 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{createContext as a,composeEventHandlers as n,useControlledState as o,useComposedRefs as c}from"@radix-ui/react-utils";import{getSelector as i}from"@radix-ui/utils";import*as d from"react";function l(){return(l=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)}function s(e,t){if(null==e)return{};var r,a,n=function(e,t){if(null==e)return{};var r,a,n={},o=Object.keys(e);for(a=0;a<o.length;a++)r=o[a],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a<o.length;a++)r=o[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}const u="Checkbox",f="button",[m,b]=a(u+"Context",u);export const Checkbox=d.forwardRef(((t,a)=>{const{as:b=f,selector:p=i(u),"aria-labelledby":h,name:x,checked:y,defaultChecked:v,required:C,disabled:O,readOnly:g,value:E="on",onCheckedChange:j}=t,I=s(t,["as","selector","aria-labelledby","name","checked","defaultChecked","required","disabled","readOnly","value","onCheckedChange"]),P=d.useRef(null),w=d.useRef(null),R=c(a,w),q=r(w),M=h||q,[F=!1,N]=o({prop:y,defaultProp:v});d.useEffect((()=>{const e="indeterminate"===F;P.current&&(P.current.indeterminate=e)}));const S=d.useMemo((()=>({state:F,disabled:O})),[F,O]);return d.createElement(d.Fragment,null,d.createElement("input",{ref:P,type:"checkbox",name:x,checked:"indeterminate"!==F&&F,required:C,disabled:O,readOnly:g,value:E,hidden:!0,onChange:n(j,(e=>{N(e.target.checked)}))}),d.createElement(m.Provider,{value:S},d.createElement(e,l({type:"button","aria-checked":"indeterminate"===F?"mixed":F,"aria-labelledby":M,"aria-required":C,"data-state":k(F),"data-disabled":O?"":void 0,"data-readonly":g},I,{as:b,selector:p,ref:R,role:"checkbox",disabled:O,value:E,onClick:n(t.onClick,(()=>{var e;return null===(e=P.current)||void 0===e?void 0:e.click()}),{checkForDefaultPrevented:!1})}))))}));Checkbox.displayName=u;const p="CheckboxIndicator",h="span";export const CheckboxIndicator=d.forwardRef(((r,a)=>{const{as:n=h,selector:o=i(p),forceMount:c}=r,u=s(r,["as","selector","forceMount"]),f=b(p);return d.createElement(t,{present:c||"indeterminate"===f.state||!0===f.state},d.createElement(e,l({"data-state":k(f.state),"data-disabled":f.disabled?"":void 0},u,{as:n,selector:o,ref:a})))}));function k(e){return"indeterminate"===e?"indeterminate":e?"checked":"unchecked"}CheckboxIndicator.displayName=p;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{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;
//# sourceMappingURL=index.module.js.map
{
"name": "@radix-ui/react-checkbox",
"version": "0.0.5",
"version": "0.0.6",
"license": "MIT",

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

"dependencies": {
"@radix-ui/react-label": "0.0.5",
"@radix-ui/react-polymorphic": "0.0.5",
"@radix-ui/react-presence": "0.0.5",
"@radix-ui/react-primitive": "0.0.4",
"@radix-ui/react-utils": "0.0.5",
"@radix-ui/utils": "0.0.3"
"@radix-ui/primitive": "0.0.1",
"@radix-ui/react-compose-refs": "0.0.1",
"@radix-ui/react-context": "0.0.1",
"@radix-ui/react-label": "0.0.6",
"@radix-ui/react-polymorphic": "0.0.6",
"@radix-ui/react-presence": "0.0.6",
"@radix-ui/react-primitive": "0.0.5",
"@radix-ui/react-use-controllable-state": "0.0.1"
},

@@ -27,0 +29,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