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

@radix-ui/react-use-controllable-state

Package Overview
Dependencies
Maintainers
6
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@radix-ui/react-use-controllable-state - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1-rc.1

2

dist/index.js

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

var e,t,r=require("@radix-ui/react-use-callback-ref").useCallbackRef,n=(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);exports.useControllableState=function({prop:e,defaultProp:t,onChange:u=(()=>{})}){const[o,a]=function({defaultProp:e,onChange:t}){const u=n.useState(e),[o]=u,a=n.useRef(o),c=r(t);return n.useEffect((()=>{a.current!==o&&(c(o),a.current=o)}),[o,a,c]),u}({defaultProp:t,onChange:u}),c=void 0!==e,f=c?e:o,l=r(u);return[f,n.useCallback((t=>{if(c){const r=t,n="function"==typeof t?r(e):t;n!==e&&l(n)}else a(t)}),[c,e,a,l])]};
var e,t,r=require("@radix-ui/react-use-callback-ref").useCallbackRef,n=(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);exports.useControllableState=function({prop:e,defaultProp:t,onChange:u=(()=>{})}){const[o,a]=function({defaultProp:e,onChange:t}){const u=n.useState(e),[o]=u,a=n.useRef(o),c=r(t);return n.useEffect((()=>{a.current!==o&&(c(o),a.current=o)}),[o,a,c]),u}({defaultProp:t,onChange:u}),c=void 0!==e,f=c?e:o,l=r(u),s=n.useCallback((t=>{if(c){const r=t,n="function"==typeof t?r(e):t;n!==e&&l(n)}else a(t)}),[c,e,a,l]);return[f,s]};
//# sourceMappingURL=index.js.map

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

import{useCallbackRef as e}from"@radix-ui/react-use-callback-ref";import*as t from"react";export function useControllableState({prop:o,defaultProp:r,onChange:n=(()=>{})}){const[a,u]=function({defaultProp:o,onChange:r}){const n=t.useState(o),[a]=n,u=t.useRef(a),c=e(r);return t.useEffect((()=>{u.current!==a&&(c(a),u.current=a)}),[a,u,c]),n}({defaultProp:r,onChange:n}),c=void 0!==o,f=c?o:a,l=e(n);return[f,t.useCallback((e=>{if(c){const t=e,r="function"==typeof e?t(o):e;r!==o&&l(r)}else u(e)}),[c,o,u,l])]}
import{useCallbackRef as e}from"@radix-ui/react-use-callback-ref";import*as t from"react";export function useControllableState({prop:o,defaultProp:r,onChange:n=(()=>{})}){const[a,u]=function({defaultProp:o,onChange:r}){const n=t.useState(o),[a]=n,u=t.useRef(a),c=e(r);return t.useEffect((()=>{u.current!==a&&(c(a),u.current=a)}),[a,u,c]),n}({defaultProp:r,onChange:n}),c=void 0!==o,f=c?o:a,l=e(n),s=t.useCallback((e=>{if(c){const t=e,r="function"==typeof e?t(o):e;r!==o&&l(r)}else u(e)}),[c,o,u,l]);return[f,s]}
//# sourceMappingURL=index.module.js.map
{
"name": "@radix-ui/react-use-controllable-state",
"version": "0.1.0",
"version": "0.1.1-rc.1",
"license": "MIT",

@@ -20,6 +20,6 @@ "source": "src/index.ts",

"@babel/runtime": "^7.13.10",
"@radix-ui/react-use-callback-ref": "0.1.0"
"@radix-ui/react-use-callback-ref": "0.1.1-rc.1"
},
"peerDependencies": {
"react": "^16.8 || ^17.0"
"react": "^16.8 || ^17.0 || ^18.0"
},

@@ -33,3 +33,4 @@ "homepage": "https://radix-ui.com/primitives",

"url": "https://github.com/radix-ui/primitives/issues"
}
},
"stableVersion": "0.1.0"
}

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