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

@radix-ui/react-switch

Package Overview
Dependencies
Maintainers
6
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 0.0.11 to 0.0.12

1

dist/index.d.ts

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

required?: InputDOMProps['required'];
readOnly?: InputDOMProps['readOnly'];
onCheckedChange?: InputDOMProps['onChange'];

@@ -13,0 +12,0 @@ }>;

2

dist/index.js

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

var e,r,t,a=require("@radix-ui/react-label").useLabelContext,d=require("@radix-ui/react-primitive").Primitive,i=require("@radix-ui/react-use-controllable-state").useControllableState,c=require("@radix-ui/react-context").createContext,n=require("@radix-ui/react-compose-refs").useComposedRefs,l=require("@radix-ui/primitive").composeEventHandlers,u=(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),o=(t=require("@babel/runtime/helpers/extends"))&&t.__esModule?t.default:t;const s="button",[b,h]=c("Switch"),f=/*#__PURE__*/u.forwardRef(((e,r)=>{const{as:t=s,"aria-labelledby":c,name:h,checked:f,defaultChecked:m,required:p,disabled:x,readOnly:v,value:q="on",onCheckedChange:C,...y}=e,w=u.useRef(null),E=u.useRef(null),R=n(r,E),g=a(E),S=c||g,[O=!1,P]=i({prop:f,defaultProp:m});/*#__PURE__*/return u.createElement(u.Fragment,null,/*#__PURE__*/u.createElement("input",{ref:w,type:"checkbox",name:h,checked:O,required:p,disabled:x,readOnly:v,value:q,hidden:!0,onChange:l(C,(e=>{P(e.target.checked)}))}),/*#__PURE__*/u.createElement(b,{checked:O,disabled:x},/*#__PURE__*/u.createElement(d,o({type:"button",role:"switch","aria-checked":O,"aria-labelledby":S,"aria-required":p,"data-state":k(O),"data-disabled":x?"":void 0,"data-readonly":v,disabled:x,value:q},y,{as:t,ref:R,onClick:l(e.onClick,(()=>{var e;return null===(e=w.current)||void 0===e?void 0:e.click()}),{checkForDefaultPrevented:!1})}))))}));exports.Switch=f;const m="span",p=/*#__PURE__*/u.forwardRef(((e,r)=>{const{as:t=m,...a}=e,i=h("SwitchThumb");/*#__PURE__*/return u.createElement(d,o({"data-state":k(i.checked),"data-disabled":i.disabled?"":void 0},a,{as:t,ref:r}))}));function k(e){return e?"checked":"unchecked"}exports.SwitchThumb=p;const x=f;exports.Root=x;const v=p;exports.Thumb=v;
var e,t,r,a=require("@radix-ui/react-label").useLabelContext,i=require("@radix-ui/react-primitive").Primitive,c=require("@radix-ui/react-use-controllable-state").useControllableState,d=require("@radix-ui/react-context").createContext,n=require("@radix-ui/react-compose-refs").useComposedRefs,l=require("@radix-ui/primitive").composeEventHandlers,u=(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),o=(r=require("@babel/runtime/helpers/extends"))&&r.__esModule?r.default:r;const s="button",[b,h]=d("Switch"),f=/*#__PURE__*/u.forwardRef(((e,t)=>{const{as:r=s,"aria-labelledby":d,name:h,checked:f,defaultChecked:m,required:p,disabled:x,value:v="on",onCheckedChange:q,...C}=e,y=u.useRef(null),[w,E]=u.useState(null),S=n(t,(e=>E(e))),g=a(w),R=d||g,[P=!1,_]=c({prop:f,defaultProp:m});/*#__PURE__*/return u.createElement(u.Fragment,null,/*#__PURE__*/u.createElement("input",{ref:y,type:"checkbox",name:h,checked:P,required:p,disabled:x,value:v,style:{display:"none"},onChange:l(q,(e=>{_(e.target.checked)}))}),/*#__PURE__*/u.createElement(b,{checked:P,disabled:x},/*#__PURE__*/u.createElement(i,o({type:"button",role:"switch","aria-checked":P,"aria-labelledby":R,"aria-required":p,"data-state":k(P),"data-disabled":x?"":void 0,disabled:x,value:v},C,{as:r,ref:S,onClick:l(e.onClick,(()=>{var e;return null===(e=y.current)||void 0===e?void 0:e.click()}),{checkForDefaultPrevented:!1})}))))}));exports.Switch=f;const m="span",p=/*#__PURE__*/u.forwardRef(((e,t)=>{const{as:r=m,...a}=e,c=h("SwitchThumb");/*#__PURE__*/return u.createElement(i,o({"data-state":k(c.checked),"data-disabled":c.disabled?"":void 0},a,{as:r,ref:t}))}));function k(e){return e?"checked":"unchecked"}exports.SwitchThumb=p;const x=f;exports.Root=x;const v=p;exports.Thumb=v;
//# sourceMappingURL=index.js.map

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

import{useLabelContext as e}from"@radix-ui/react-label";import{Primitive as t}from"@radix-ui/react-primitive";import{useControllableState as r}from"@radix-ui/react-use-controllable-state";import{createContext as a}from"@radix-ui/react-context";import{useComposedRefs as i}from"@radix-ui/react-compose-refs";import{composeEventHandlers as c}from"@radix-ui/primitive";import*as d from"react";import o from"@babel/runtime/helpers/esm/extends";const n="button",[l,u]=a("Switch");export const Switch=/*#__PURE__*/d.forwardRef(((a,u)=>{const{as:m=n,"aria-labelledby":h,name:p,checked:b,defaultChecked:f,required:k,disabled:x,readOnly:v,value:w="on",onCheckedChange:y,...C}=a,S=d.useRef(null),E=d.useRef(null),R=i(u,E),g=e(E),T=h||g,[q=!1,F]=r({prop:b,defaultProp:f});/*#__PURE__*/return d.createElement(d.Fragment,null,/*#__PURE__*/d.createElement("input",{ref:S,type:"checkbox",name:p,checked:q,required:k,disabled:x,readOnly:v,value:w,hidden:!0,onChange:c(y,(e=>{F(e.target.checked)}))}),/*#__PURE__*/d.createElement(l,{checked:q,disabled:x},/*#__PURE__*/d.createElement(t,o({type:"button",role:"switch","aria-checked":q,"aria-labelledby":T,"aria-required":k,"data-state":s(q),"data-disabled":x?"":void 0,"data-readonly":v,disabled:x,value:w},C,{as:m,ref:R,onClick:c(a.onClick,(()=>{var e;return null===(e=S.current)||void 0===e?void 0:e.click()}),{checkForDefaultPrevented:!1})}))))}));/*#__PURE__*/const m="span";export const SwitchThumb=/*#__PURE__*/d.forwardRef(((e,r)=>{const{as:a=m,...i}=e,c=u("SwitchThumb");/*#__PURE__*/return d.createElement(t,o({"data-state":s(c.checked),"data-disabled":c.disabled?"":void 0},i,{as:a,ref:r}))}));/*#__PURE__*/function s(e){return e?"checked":"unchecked"}export const Root=Switch;export const Thumb=SwitchThumb;
import{useLabelContext as e}from"@radix-ui/react-label";import{Primitive as t}from"@radix-ui/react-primitive";import{useControllableState as r}from"@radix-ui/react-use-controllable-state";import{createContext as a}from"@radix-ui/react-context";import{useComposedRefs as i}from"@radix-ui/react-compose-refs";import{composeEventHandlers as c}from"@radix-ui/primitive";import*as o from"react";import d from"@babel/runtime/helpers/esm/extends";const n="button",[l,u]=a("Switch");export const Switch=/*#__PURE__*/o.forwardRef(((a,u)=>{const{as:s=n,"aria-labelledby":h,name:p,checked:b,defaultChecked:f,required:k,disabled:x,value:v="on",onCheckedChange:w,...S}=a,y=o.useRef(null),[C,E]=o.useState(null),g=i(u,(e=>E(e))),R=e(C),T=h||R,[q=!1,F]=r({prop:b,defaultProp:f});/*#__PURE__*/return o.createElement(o.Fragment,null,/*#__PURE__*/o.createElement("input",{ref:y,type:"checkbox",name:p,checked:q,required:k,disabled:x,value:v,style:{display:"none"},onChange:c(w,(e=>{F(e.target.checked)}))}),/*#__PURE__*/o.createElement(l,{checked:q,disabled:x},/*#__PURE__*/o.createElement(t,d({type:"button",role:"switch","aria-checked":q,"aria-labelledby":T,"aria-required":k,"data-state":m(q),"data-disabled":x?"":void 0,disabled:x,value:v},S,{as:s,ref:g,onClick:c(a.onClick,(()=>{var e;return null===(e=y.current)||void 0===e?void 0:e.click()}),{checkForDefaultPrevented:!1})}))))}));/*#__PURE__*/const s="span";export const SwitchThumb=/*#__PURE__*/o.forwardRef(((e,r)=>{const{as:a=s,...i}=e,c=u("SwitchThumb");/*#__PURE__*/return o.createElement(t,d({"data-state":m(c.checked),"data-disabled":c.disabled?"":void 0},i,{as:a,ref:r}))}));/*#__PURE__*/function m(e){return e?"checked":"unchecked"}export const Root=Switch;export const Thumb=SwitchThumb;
//# sourceMappingURL=index.module.js.map
{
"name": "@radix-ui/react-switch",
"version": "0.0.11",
"version": "0.0.12",
"license": "MIT",

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

"@radix-ui/react-context": "0.0.5",
"@radix-ui/react-label": "0.0.11",
"@radix-ui/react-polymorphic": "0.0.10",
"@radix-ui/react-primitive": "0.0.11",
"@radix-ui/react-label": "0.0.12",
"@radix-ui/react-polymorphic": "0.0.11",
"@radix-ui/react-primitive": "0.0.12",
"@radix-ui/react-use-controllable-state": "0.0.6"

@@ -29,0 +29,0 @@ },

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