@radix-ui/react-switch
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -1,2 +0,2 @@ | ||
var e,r,t=require("@radix-ui/utils").getSelector,n=require("@radix-ui/react-label").useLabelContext,a=require("@radix-ui/react-primitive").Primitive,o=require("@radix-ui/react-utils"),i=o.createContext,l=o.composeEventHandlers,u=o.useControlledState,c=o.useComposedRefs,d=(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 s(){return(s=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 f(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 h(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,l=e[Symbol.iterator]();!(n=(i=l.next()).done)&&(t.push(i.value),!r||t.length!==r);n=!0);}catch(e){a=!0,o=e}finally{try{n||null==l.return||l.return()}finally{if(a)throw o}}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 y=h(i("SwitchContext","Switch"),2),v=y[0],p=y[1],m=d.forwardRef((function(e,r){var o=e.as,i=void 0===o?"button":o,b=e.selector,y=void 0===b?t("Switch"):b,p=e["aria-labelledby"],m=e.name,g=e.checked,O=e.defaultChecked,S=e.required,k=e.disabled,x=e.readOnly,C=e.value,j=void 0===C?"on":C,q=e.onCheckedChange,E=f(e,["as","selector","aria-labelledby","name","checked","defaultChecked","required","disabled","readOnly","value","onCheckedChange"]),P=d.useRef(null),A=d.useRef(null),R=c(r,A),T=n(A),I=p||T,F=h(u({prop:g,defaultProp:O}),2),M=F[0],N=void 0!==M&&M,_=F[1];return d.createElement(d.Fragment,null,d.createElement("input",{ref:P,type:"checkbox",name:m,checked:N,required:S,disabled:k,readOnly:x,value:j,hidden:!0,onChange:l(q,(function(e){_(e.target.checked)}))}),d.createElement(v.Provider,{value:N},d.createElement(a,s({type:"button"},E,{as:i,selector:y,ref:R,role:"switch","aria-checked":N,"aria-labelledby":I,"aria-required":S,"data-state":w(N),"data-readonly":x,disabled:k,value:j,onClick:l(e.onClick,(function(){var e;return null===(e=P.current)||void 0===e?void 0:e.click()}),{checkForDefaultPrevented:!1})}))))}));exports.Switch=m,m.displayName="Switch";var g=d.forwardRef((function(e,r){var n=e.as,o=void 0===n?"span":n,i=e.selector,l=void 0===i?t("SwitchThumb"):i,u=f(e,["as","selector"]),c=p("SwitchThumb");return d.createElement(a,s({},u,{as:o,selector:l,ref:r,"data-state":w(c)}))}));function w(e){return e?"checked":"unchecked"}exports.SwitchThumb=g,g.displayName="SwitchThumb";var O=m;exports.Root=O;var S=g;exports.Thumb=S; | ||
var e,r,t=require("@radix-ui/utils").getSelector,n=require("@radix-ui/react-label").useLabelContext,a=require("@radix-ui/react-primitive").Primitive,i=require("@radix-ui/react-utils"),o=i.createContext,l=i.composeEventHandlers,c=i.useControlledState,u=i.useComposedRefs,d=(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 s(){return(s=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 f(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 h(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,l=e[Symbol.iterator]();!(n=(o=l.next()).done)&&(t.push(o.value),!r||t.length!==r);n=!0);}catch(e){a=!0,i=e}finally{try{n||null==l.return||l.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 v=h(o("SwitchContext","Switch"),2),y=v[0],p=v[1],m=d.forwardRef((function(e,r){var i=e.as,o=void 0===i?"button":i,b=e.selector,v=void 0===b?t("Switch"):b,p=e["aria-labelledby"],m=e.name,k=e.checked,w=e.defaultChecked,O=e.required,S=e.disabled,x=e.readOnly,C=e.value,j=void 0===C?"on":C,q=e.onCheckedChange,E=f(e,["as","selector","aria-labelledby","name","checked","defaultChecked","required","disabled","readOnly","value","onCheckedChange"]),P=d.useRef(null),A=d.useRef(null),R=u(r,A),T=n(A),I=p||T,M=h(c({prop:k,defaultProp:w}),2),F=M[0],N=void 0!==F&&F,_=M[1],D=d.useMemo((function(){return{checked:N,disabled:S}}),[N,S]);return d.createElement(d.Fragment,null,d.createElement("input",{ref:P,type:"checkbox",name:m,checked:N,required:O,disabled:S,readOnly:x,value:j,hidden:!0,onChange:l(q,(function(e){_(e.target.checked)}))}),d.createElement(y.Provider,{value:D},d.createElement(a,s({type:"button",role:"switch","aria-checked":N,"aria-labelledby":I,"aria-required":O,"data-state":g(N),"data-disabled":S?"":void 0,"data-readonly":x},E,{as:o,selector:v,ref:R,disabled:S,value:j,onClick:l(e.onClick,(function(){var e;return null===(e=P.current)||void 0===e?void 0:e.click()}),{checkForDefaultPrevented:!1})}))))}));exports.Switch=m,m.displayName="Switch";var k=d.forwardRef((function(e,r){var n=e.as,i=void 0===n?"span":n,o=e.selector,l=void 0===o?t("SwitchThumb"):o,c=f(e,["as","selector"]),u=p("SwitchThumb");return d.createElement(a,s({"data-state":g(u.checked),"data-disabled":u.disabled?"":void 0},c,{as:i,selector:l,ref:r}))}));function g(e){return e?"checked":"unchecked"}exports.SwitchThumb=k,k.displayName="SwitchThumb";var w=m;exports.Root=w;var O=k;exports.Thumb=O; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import{getSelector as e}from"@radix-ui/utils";import{useLabelContext as r}from"@radix-ui/react-label";import{Primitive as t}from"@radix-ui/react-primitive";import{createContext as a,composeEventHandlers as n,useControlledState as c,useComposedRefs as l}from"@radix-ui/react-utils";import*as o from"react";function i(){return(i=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e}).apply(this,arguments)}function u(e,r){if(null==e)return{};var t,a,n=function(e,r){if(null==e)return{};var t,a,n={},c=Object.keys(e);for(a=0;a<c.length;a++)t=c[a],r.indexOf(t)>=0||(n[t]=e[t]);return n}(e,r);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(a=0;a<c.length;a++)t=c[a],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}const d="Switch",s="button",[h,f]=a(d+"Context",d);export const Switch=o.forwardRef(((a,f)=>{const{as:m=s,selector:p=e(d),"aria-labelledby":y,name:k,checked:v,defaultChecked:w,required:O,disabled:x,readOnly:g,value:C="on",onCheckedChange:S}=a,j=u(a,["as","selector","aria-labelledby","name","checked","defaultChecked","required","disabled","readOnly","value","onCheckedChange"]),E=o.useRef(null),P=o.useRef(null),R=l(f,P),T=r(P),q=y||T,[F=!1,N]=c({prop:v,defaultProp:w});return o.createElement(o.Fragment,null,o.createElement("input",{ref:E,type:"checkbox",name:k,checked:F,required:O,disabled:x,readOnly:g,value:C,hidden:!0,onChange:n(S,(e=>{N(e.target.checked)}))}),o.createElement(h.Provider,{value:F},o.createElement(t,i({type:"button"},j,{as:m,selector:p,ref:R,role:"switch","aria-checked":F,"aria-labelledby":q,"aria-required":O,"data-state":b(F),"data-readonly":g,disabled:x,value:C,onClick:n(a.onClick,(()=>{var e;return null===(e=E.current)||void 0===e?void 0:e.click()}),{checkForDefaultPrevented:!1})}))))}));Switch.displayName=d;const m="SwitchThumb",p="span";export const SwitchThumb=o.forwardRef(((r,a)=>{const{as:n=p,selector:c=e(m)}=r,l=u(r,["as","selector"]),d=f(m);return o.createElement(t,i({},l,{as:n,selector:c,ref:a,"data-state":b(d)}))}));function b(e){return e?"checked":"unchecked"}SwitchThumb.displayName=m;export const Root=Switch;export const Thumb=SwitchThumb; | ||
import{getSelector as e}from"@radix-ui/utils";import{useLabelContext as t}from"@radix-ui/react-label";import{Primitive as r}from"@radix-ui/react-primitive";import{createContext as a,composeEventHandlers as c,useControlledState as n,useComposedRefs as l}from"@radix-ui/react-utils";import*as o from"react";function i(){return(i=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 d(e,t){if(null==e)return{};var r,a,c=function(e,t){if(null==e)return{};var r,a,c={},n=Object.keys(e);for(a=0;a<n.length;a++)r=n[a],t.indexOf(r)>=0||(c[r]=e[r]);return c}(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(a=0;a<n.length;a++)r=n[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(c[r]=e[r])}return c}const u="Switch",s="button",[h,b]=a(u+"Context",u);export const Switch=o.forwardRef(((a,b)=>{const{as:f=s,selector:m=e(u),"aria-labelledby":y,name:k,checked:v,defaultChecked:w,required:O,disabled:x,readOnly:g,value:C="on",onCheckedChange:S}=a,j=d(a,["as","selector","aria-labelledby","name","checked","defaultChecked","required","disabled","readOnly","value","onCheckedChange"]),E=o.useRef(null),P=o.useRef(null),R=l(b,P),T=t(P),q=y||T,[F=!1,N]=n({prop:v,defaultProp:w}),D=o.useMemo((()=>({checked:F,disabled:x})),[F,x]);return o.createElement(o.Fragment,null,o.createElement("input",{ref:E,type:"checkbox",name:k,checked:F,required:O,disabled:x,readOnly:g,value:C,hidden:!0,onChange:c(S,(e=>{N(e.target.checked)}))}),o.createElement(h.Provider,{value:D},o.createElement(r,i({type:"button",role:"switch","aria-checked":F,"aria-labelledby":q,"aria-required":O,"data-state":p(F),"data-disabled":x?"":void 0,"data-readonly":g},j,{as:f,selector:m,ref:R,disabled:x,value:C,onClick:c(a.onClick,(()=>{var e;return null===(e=E.current)||void 0===e?void 0:e.click()}),{checkForDefaultPrevented:!1})}))))}));Switch.displayName=u;const f="SwitchThumb",m="span";export const SwitchThumb=o.forwardRef(((t,a)=>{const{as:c=m,selector:n=e(f)}=t,l=d(t,["as","selector"]),u=b(f);return o.createElement(r,i({"data-state":p(u.checked),"data-disabled":u.disabled?"":void 0},l,{as:c,selector:n,ref:a}))}));function p(e){return e?"checked":"unchecked"}SwitchThumb.displayName=f;export const Root=Switch;export const Thumb=SwitchThumb; | ||
//# sourceMappingURL=index.module.js.map |
{ | ||
"name": "@radix-ui/react-switch", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"license": "MIT", | ||
@@ -19,6 +19,6 @@ "source": "src/index.ts", | ||
"dependencies": { | ||
"@radix-ui/react-label": "0.0.4", | ||
"@radix-ui/react-polymorphic": "0.0.4", | ||
"@radix-ui/react-primitive": "0.0.3", | ||
"@radix-ui/react-utils": "0.0.4", | ||
"@radix-ui/react-label": "0.0.5", | ||
"@radix-ui/react-polymorphic": "0.0.5", | ||
"@radix-ui/react-primitive": "0.0.4", | ||
"@radix-ui/react-utils": "0.0.5", | ||
"@radix-ui/utils": "0.0.3" | ||
@@ -25,0 +25,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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26780
49
+ Added@radix-ui/react-label@0.0.5(transitive)
+ Added@radix-ui/react-polymorphic@0.0.5(transitive)
+ Added@radix-ui/react-primitive@0.0.4(transitive)
+ Added@radix-ui/react-utils@0.0.5(transitive)
- Removed@radix-ui/react-label@0.0.4(transitive)
- Removed@radix-ui/react-polymorphic@0.0.4(transitive)
- Removed@radix-ui/react-primitive@0.0.3(transitive)
- Removed@radix-ui/react-utils@0.0.4(transitive)
Updated@radix-ui/react-label@0.0.5
Updated@radix-ui/react-utils@0.0.5