New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@react-input/core

Package Overview
Dependencies
Maintainers
0
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-input/core - npm Package Compare versions

Comparing version 1.0.12 to 1.0.13

2

dist/module/hooks/useInput.js

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

import{useRef as e,useMemo as t}from"react";import{unstable_batchedUpdates as n}from"react-dom";import r from"../errors/SyntheticChangeError.js";import l from"../utils/setInputAttributes.js";import"../_rollupPluginBabelHelpers-D3WySQMf.js";var u=["text","email","tel","search","url"];function i(i){var o=i.init,a=i.tracking,c=i.eventType,d=i.eventHandler,v=e({timeoutId:-1,fallbackTimeoutId:-1,cachedTimeoutId:-1,start:0,end:0}),s=e(!0),m=e(null),p=e({init:o,tracking:a,eventType:c,eventHandler:d});return p.current.init=o,p.current.tracking=a,p.current.eventType=c,p.current.eventHandler=d,t((function(){return function(e,t,n){var r=n.onFocus,i=n.onBlur,o=n.onInput;return new Proxy(e,{set:function(n,a,c){if("current"!==a)return!1;var d=null!==c&&u.includes(c.type);if("production"===process.env.NODE_ENV||null===c||d||console.warn("Warn: The input element type does not match one of the types: ".concat(u.join(", "),".")),c!==e.current&&(null!==e.current&&(e.current.removeEventListener("focus",r),e.current.removeEventListener("blur",i),e.current.removeEventListener("input",o)),null!==c&&d)){var v,s=null!==(v=c._wrapperState)&&void 0!==v?v:{},m=s.controlled,p=void 0!==m&&m,h=s.initialValue,f=void 0===h?"":h,E=t({controlled:p,initialValue:c.value||f});l(c,{value:E.value}),document.activeElement===c&&r(),c.addEventListener("focus",r),c.addEventListener("blur",i),c.addEventListener("input",o)}return n[a]=c,!0}})}(m,p.current.init,{onFocus:function(){v.current.timeoutId=window.setTimeout((function e(){var t,n,r,l;s.current?(v.current.start=null!==(t=null===(n=m.current)||void 0===n?void 0:n.selectionStart)&&void 0!==t?t:0,v.current.end=null!==(r=null===(l=m.current)||void 0===l?void 0:l.selectionEnd)&&void 0!==r?r:0,v.current.timeoutId=window.setTimeout(e)):v.current.fallbackTimeoutId=window.setTimeout(e)}))},onBlur:function(){window.clearTimeout(v.current.timeoutId),window.clearTimeout(v.current.fallbackTimeoutId),v.current.timeoutId=-1,v.current.fallbackTimeoutId=-1,v.current.cachedTimeoutId=-1},onInput:function(e){var t=m.current;if(null!==t)try{var u,i,o,a,c;if(v.current.cachedTimeoutId===v.current.timeoutId)throw new r("The input selection has not been updated.");v.current.cachedTimeoutId=v.current.timeoutId;var d=t.value,h=t.selectionStart,f=t.selectionEnd;if(null===h||null===f)throw new r("The selection attributes have not been initialized.");var E,w=null!==(u=null===(i=t._valueTracker)||void 0===i||null===(o=i.getValue)||void 0===o?void 0:o.call(i))&&void 0!==u?u:"";if(void 0===e.inputType&&(v.current.start=0,v.current.end=w.length),h>v.current.start?E="insert":h<=v.current.start&&h<v.current.end?E="deleteBackward":h===v.current.end&&d.length<w.length&&(E="deleteForward"),void 0===E||("deleteBackward"===E||"deleteForward"===E)&&d.length>w.length)throw new r("Input type detection error.");var T="",b="",g=v.current.start,_=v.current.end;if("insert"===E)T=d.slice(v.current.start,h);else{var I=w.length-d.length;g=h,_=h+I,b=w.slice(g,_)}var S=p.current.tracking({inputType:E,previousValue:w,value:d,addedValue:T,deletedValue:b,changeStart:g,changeEnd:_,selectionStart:h,selectionEnd:f});l(t,{value:S.value,selectionStart:S.selectionStart,selectionEnd:S.selectionEnd});var y=p.current.eventType,k=p.current.eventHandler;if("string"==typeof y&&k){var V=t.value,L=t.selectionStart,B=t.selectionEnd;s.current=!1,requestAnimationFrame((function(){l(t,{value:V,selectionStart:null!=L?L:V.length,selectionEnd:null!=B?B:V.length});var e=new CustomEvent(y,{bubbles:!0,cancelable:!1,composed:!0,detail:S.__detail});t.dispatchEvent(e),n?n(k,e):k(e),s.current=!0}))}null===(a=t._valueTracker)||void 0===a||null===(c=a.setValue)||void 0===c||c.call(a,w),v.current.start=S.selectionStart,v.current.end=S.selectionEnd}catch(n){var F,H,j,x,C,P,A,D,N,q,z,O=n,W=O.name,G=O.cause;if(l(t,{value:null!==(F=null!==(H=null==G||null===(j=G.__attributes)||void 0===j?void 0:j.value)&&void 0!==H?H:null===(x=t._valueTracker)||void 0===x||null===(C=x.getValue)||void 0===C?void 0:C.call(x))&&void 0!==F?F:"",selectionStart:null!==(P=null==G||null===(A=G.__attributes)||void 0===A?void 0:A.selectionStart)&&void 0!==P?P:v.current.start,selectionEnd:null!==(D=null==G||null===(N=G.__attributes)||void 0===N?void 0:N.selectionEnd)&&void 0!==D?D:v.current.end}),void 0!==(null==G||null===(q=G.__attributes)||void 0===q?void 0:q.selectionStart)&&(v.current.start=G.__attributes.selectionStart),void 0!==(null==G||null===(z=G.__attributes)||void 0===z?void 0:z.selectionEnd)&&(v.current.end=G.__attributes.selectionEnd),e.preventDefault(),e.stopPropagation(),"SyntheticChangeError"!==W)throw n}}})}),[])}export{i as default};
import{useRef as e,useMemo as t}from"react";import{unstable_batchedUpdates as n}from"react-dom";import r from"../errors/SyntheticChangeError.js";import l from"../utils/setInputAttributes.js";var u=["text","email","tel","search","url"];function i(i){var o=i.init,a=i.tracking,c=i.eventType,d=i.eventHandler,v=e({timeoutId:-1,fallbackTimeoutId:-1,cachedTimeoutId:-1,start:0,end:0}),s=e(!0),m=e(null),p=e({init:o,tracking:a,eventType:c,eventHandler:d});return p.current.init=o,p.current.tracking=a,p.current.eventType=c,p.current.eventHandler=d,t((function(){return function(e,t,n){var r=n.onFocus,i=n.onBlur,o=n.onInput;return new Proxy(e,{set:function(n,a,c){if("current"!==a)return!1;var d=null!==c&&u.includes(c.type);if("production"===process.env.NODE_ENV||null===c||d||console.warn("Warn: The input element type does not match one of the types: ".concat(u.join(", "),".")),c!==e.current&&(null!==e.current&&(e.current.removeEventListener("focus",r),e.current.removeEventListener("blur",i),e.current.removeEventListener("input",o)),null!==c&&d)){var v,s=null!==(v=c._wrapperState)&&void 0!==v?v:{},m=s.controlled,p=void 0!==m&&m,h=s.initialValue,f=void 0===h?"":h,E=t({controlled:p,initialValue:c.value||f});l(c,{value:E.value}),document.activeElement===c&&r(),c.addEventListener("focus",r),c.addEventListener("blur",i),c.addEventListener("input",o)}return n[a]=c,!0}})}(m,p.current.init,{onFocus:function(){v.current.timeoutId=window.setTimeout((function e(){var t,n,r,l;s.current?(v.current.start=null!==(t=null===(n=m.current)||void 0===n?void 0:n.selectionStart)&&void 0!==t?t:0,v.current.end=null!==(r=null===(l=m.current)||void 0===l?void 0:l.selectionEnd)&&void 0!==r?r:0,v.current.timeoutId=window.setTimeout(e)):v.current.fallbackTimeoutId=window.setTimeout(e)}))},onBlur:function(){window.clearTimeout(v.current.timeoutId),window.clearTimeout(v.current.fallbackTimeoutId),v.current.timeoutId=-1,v.current.fallbackTimeoutId=-1,v.current.cachedTimeoutId=-1},onInput:function(e){var t=m.current;if(null!==t)try{var u,i,o,a,c;if(v.current.cachedTimeoutId===v.current.timeoutId)throw new r("The input selection has not been updated.");v.current.cachedTimeoutId=v.current.timeoutId;var d=t.value,h=t.selectionStart,f=t.selectionEnd;if(null===h||null===f)throw new r("The selection attributes have not been initialized.");var E,w=null!==(u=null===(i=t._valueTracker)||void 0===i||null===(o=i.getValue)||void 0===o?void 0:o.call(i))&&void 0!==u?u:"";if(void 0===e.inputType&&(v.current.start=0,v.current.end=w.length),h>v.current.start?E="insert":h<=v.current.start&&h<v.current.end?E="deleteBackward":h===v.current.end&&d.length<w.length&&(E="deleteForward"),void 0===E||("deleteBackward"===E||"deleteForward"===E)&&d.length>w.length)throw new r("Input type detection error.");var T="",b="",g=v.current.start,_=v.current.end;if("insert"===E)T=d.slice(v.current.start,h);else{var I=w.length-d.length;g=h,_=h+I,b=w.slice(g,_)}var S=p.current.tracking({inputType:E,previousValue:w,value:d,addedValue:T,deletedValue:b,changeStart:g,changeEnd:_,selectionStart:h,selectionEnd:f});l(t,{value:S.value,selectionStart:S.selectionStart,selectionEnd:S.selectionEnd});var y=p.current.eventType,k=p.current.eventHandler;if("string"==typeof y&&k){var V=t.value,L=t.selectionStart,F=t.selectionEnd;s.current=!1,requestAnimationFrame((function(){l(t,{value:V,selectionStart:null!=L?L:V.length,selectionEnd:null!=F?F:V.length});var e=new CustomEvent(y,{bubbles:!0,cancelable:!1,composed:!0,detail:S.__detail});t.dispatchEvent(e),n?n(k,e):k(e),s.current=!0}))}null===(a=t._valueTracker)||void 0===a||null===(c=a.setValue)||void 0===c||c.call(a,w),v.current.start=S.selectionStart,v.current.end=S.selectionEnd}catch(n){var B,H,j,x,C,A,D,N,P,q,z,O=n,W=O.name,G=O.cause;if(l(t,{value:null!==(B=null!==(H=null==G||null===(j=G.__attributes)||void 0===j?void 0:j.value)&&void 0!==H?H:null===(x=t._valueTracker)||void 0===x||null===(C=x.getValue)||void 0===C?void 0:C.call(x))&&void 0!==B?B:"",selectionStart:null!==(A=null==G||null===(D=G.__attributes)||void 0===D?void 0:D.selectionStart)&&void 0!==A?A:v.current.start,selectionEnd:null!==(N=null==G||null===(P=G.__attributes)||void 0===P?void 0:P.selectionEnd)&&void 0!==N?N:v.current.end}),void 0!==(null==G||null===(q=G.__attributes)||void 0===q?void 0:q.selectionStart)&&(v.current.start=G.__attributes.selectionStart),void 0!==(null==G||null===(z=G.__attributes)||void 0===z?void 0:z.selectionEnd)&&(v.current.end=G.__attributes.selectionEnd),e.preventDefault(),e.stopPropagation(),"SyntheticChangeError"!==W)throw n}}})}),[])}export{i as default};

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

export{default as SyntheticChangeError}from"./errors/SyntheticChangeError.js";export{default as useConnectedInputRef}from"./hooks/useConnectedInputRef.js";export{default as useInput}from"./hooks/useInput.js";export{default as setInputAttributes}from"./utils/setInputAttributes.js";import"./_rollupPluginBabelHelpers-D3WySQMf.js";import"react";import"react-dom";
export{default as SyntheticChangeError}from"./errors/SyntheticChangeError.js";export{default as useConnectedInputRef}from"./hooks/useConnectedInputRef.js";export{default as useInput}from"./hooks/useInput.js";export{default as setInputAttributes}from"./utils/setInputAttributes.js";
{
"name": "@react-input/core",
"version": "1.0.12",
"version": "1.0.13",
"license": "MIT",
"author": "Nikolay Goncharuk <goncharuk.bro@gmail.com>",

@@ -23,10 +24,10 @@ "description": "The core of the packages included in the `@react-input` scope.",

"homepage": "https://github.com/GoncharukBro/react-input/tree/main/packages/core#readme",
"license": "MIT",
"module": "dist/module/index.js",
"main": "dist/node/index.cjs",
"types": "dist/@types/index.d.ts",
"files": [
"dist"
],
"sideEffects": false,
"type": "module",
"module": "dist/module/index.js",
"main": "dist/node/index.cjs",
"types": "dist/@types/index.d.ts",
"exports": {

@@ -39,28 +40,10 @@ ".": {

"./*": {
"import": [
"./dist/module/*.js",
"./dist/module/*/index.js"
],
"require": [
"./dist/node/*.cjs",
"./dist/node/*/index.cjs"
],
"types": [
"./dist/@types/*.d.ts",
"./dist/@types/*/index.d.ts"
]
"import": "./dist/module/*.js",
"require": "./dist/node/*.cjs",
"types": "./dist/@types/*.d.ts"
},
"./*.js": {
"import": [
"./dist/module/*.js",
"./dist/module/*/index.js"
],
"require": [
"./dist/node/*.cjs",
"./dist/node/*/index.cjs"
],
"types": [
"./dist/@types/*.d.ts",
"./dist/@types/*/index.d.ts"
]
"import": "./dist/module/*.js",
"require": "./dist/node/*.cjs",
"types": "./dist/@types/*.d.ts"
}

@@ -67,0 +50,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