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

@jamsr-ui/hooks

Package Overview
Dependencies
Maintainers
0
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jamsr-ui/hooks - npm Package Compare versions

Comparing version 0.0.40 to 0.0.41

dist/chunk-3RXXB24P.mjs

2

dist/index.js
"use client"
"use strict";var N=Object.create;var P=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var z=(t,e)=>{for(var n in e)P(t,n,{get:e[n],enumerable:!0})},F=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of J(e))!q.call(t,o)&&o!==n&&P(t,o,{get:()=>e[o],enumerable:!(s=W(e,o))||s.enumerable});return t};var G=(t,e,n)=>(n=t!=null?N(j(t)):{},F(e||!t||!t.__esModule?P(n,"default",{value:t,enumerable:!0}):n,t)),Q=t=>F(P({},"__esModule",{value:!0}),t);var Y={};z(Y,{useCallbackRef:()=>L,useControlledState:()=>k,useControlledState2:()=>w,useDebounce:()=>C,useDisclosure:()=>M,useEventListener:()=>h,useFocus:()=>H,useFocusVisible:()=>K,useHover:()=>U,useKeyPress:()=>A,useMergeRefs:()=>V,usePress:()=>g,usePrevious:()=>B});module.exports=Q(Y);var v=require("react");function L(t){let e=(0,v.useRef)(t);return(0,v.useEffect)(()=>{e.current=t}),(0,v.useMemo)(()=>(...n)=>e.current?.(...n),[])}var m=require("react");var w=(t,e,n)=>{let[s,o]=(0,m.useState)(t??void 0),i=e!==void 0?e:s,a=(0,m.useCallback)(r=>{n&&n(r),e===void 0&&o(typeof r=="function"?u=>r(u):r)},[e,i]);return[i,a]};function X({defaultProp:t,onChange:e}){let n=(0,m.useState)(t),[s]=n,o=(0,m.useRef)(s),i=L(e);return(0,m.useEffect)(()=>{o.current!==s&&(i(s),o.current=s)},[s,o,i]),n}function k(t,e,n){let[s,o]=X({defaultProp:t,onChange:n}),i=e!==void 0,a=i?e:s,r=L(n),u=(0,m.useCallback)(c=>{if(i){let d=typeof c=="function"?c(e):c;d!==e&&r(d)}else o(c)},[i,e,o,r]);return[a,u]}var R=require("react"),C=(t,e=500)=>{let[n,s]=(0,R.useState)(t);return(0,R.useEffect)(()=>{let o=setTimeout(()=>{s(t)},e);return()=>{clearTimeout(o)}},[t,e]),n};var y=require("react"),M=t=>{let[e,n]=(0,y.useState)(t??!1),s=(0,y.useCallback)(()=>n(!0),[]),o=(0,y.useCallback)(()=>n(!1),[]);return{isOpen:e,setIsOpen:n,onOpen:s,onClose:o}};var x=require("react"),h=(t,e,n)=>{let s=(0,x.useRef)(null);(0,x.useEffect)(()=>{s.current=n},[n]),(0,x.useEffect)(()=>{if(!t)return()=>{};let o=i=>{s.current&&s.current(i)};return t.addEventListener(e,o),()=>{t.removeEventListener(e,o)}},[e,t])};var p=require("react"),H=(t={})=>{let{onFocusStart:e,onFocusEnd:n,isDisabled:s}=t,[o,i]=(0,p.useState)(!1),a=(0,p.useRef)(null);return(0,p.useEffect)(()=>{let r=a.current;if(!r||s)return()=>{};let u=()=>{i(!0),e?.()},c=()=>{i(!1),n?.()};return r.addEventListener("focus",u),r.addEventListener("blur",c),()=>{r.removeEventListener("focus",u),r.removeEventListener("blur",c)}},[e,n,s]),{ref:a,isFocused:o}};var T=require("react"),K=(t={})=>{let{onFocusVisible:e,onBlurVisible:n,isDisabled:s}=t,[o,i]=(0,T.useState)(!1),a=(0,T.useRef)(null);return(0,T.useEffect)(()=>{if(s)return()=>{};let r=!1,u=a.current,c=f=>{(f.key==="Tab"||f.key==="ArrowUp"||f.key==="ArrowDown"||f.key==="ArrowLeft"||f.key==="Home"||f.key==="End"||f.key==="ArrowRight")&&(r=!0)},l=()=>{r=!1},d=()=>{r&&(i(!0),e?.())},S=()=>{o&&(i(!1),n?.())};return document.addEventListener("keydown",c),document.addEventListener("mousedown",l),document.addEventListener("touchstart",l),u&&(u.addEventListener("focus",d),u.addEventListener("blur",S)),()=>{document.removeEventListener("keydown",c),document.removeEventListener("mousedown",l),document.removeEventListener("touchstart",l),u&&(u.removeEventListener("focus",d),u.removeEventListener("blur",S))}},[e,n,s,o]),{ref:a,isFocusVisible:o}};var E=require("react"),U=t=>{let{enterDelay:e=0,exitDelay:n=0,isDisabled:s}=t??{},[o,i]=(0,E.useState)(!1),a=(0,E.useRef)(null);return(0,E.useEffect)(()=>{let r=a.current;if(!r||s)return()=>{};let u=null,c=null,l=()=>{c&&clearTimeout(c),u=setTimeout(()=>{i(!0)},e)},d=()=>{u&&clearTimeout(u),c=setTimeout(()=>{i(!1)},n)};return r.addEventListener("mouseenter",l),r.addEventListener("mouseleave",d),()=>{u&&clearTimeout(u),c&&clearTimeout(c),r.removeEventListener("mouseenter",l),r.removeEventListener("mouseleave",d)}},[e,n,s]),{ref:a,isHovered:o}};var O=require("react"),A=(t,e)=>{(0,O.useEffect)(()=>{let n=s=>{let o=t===null&&"all"||Array.isArray(t)&&t||[t];(o==="all"||o.includes(s.key))&&e(s)};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n)}},[t,e])};var I=G(require("react")),V=t=>I.useMemo(()=>t.every(e=>e==null)?null:e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})},t);var b=require("react"),g=(t={})=>{let{onPressStart:e,onPressEnd:n,onPressCancel:s,isDisabled:o}=t,[i,a]=(0,b.useState)(!1),r=(0,b.useRef)(null);return(0,b.useEffect)(()=>{let u=r.current;if(!u||o)return()=>{};let c=()=>{a(!0),e?.();let l=f=>{if(u.contains(f.target)){a(!0);return}a(!1),s?.()},d=f=>{u&&u.contains(f.target)&&n?.(),a(!1),S()},S=()=>{document.removeEventListener("pointermove",l),document.removeEventListener("pointerup",d)};document.addEventListener("pointermove",l),document.addEventListener("pointerup",d)};return u.addEventListener("pointerdown",c),()=>{u.removeEventListener("pointerdown",c)}},[e,n,s,o]),{ref:r,isPressed:i}};var D=require("react"),B=t=>{let e=(0,D.useRef)(t);return(0,D.useEffect)(()=>{e.current=t},[t]),e.current};0&&(module.exports={useCallbackRef,useControlledState,useControlledState2,useDebounce,useDisclosure,useEventListener,useFocus,useFocusVisible,useHover,useKeyPress,useMergeRefs,usePress,usePrevious});
"use strict";var N=Object.create;var R=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var z=(e,t)=>{for(var n in t)R(e,n,{get:t[n],enumerable:!0})},w=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of J(t))!q.call(e,s)&&s!==n&&R(e,s,{get:()=>t[s],enumerable:!(o=W(t,s))||o.enumerable});return e};var G=(e,t,n)=>(n=e!=null?N(j(e)):{},w(t||!e||!e.__esModule?R(n,"default",{value:e,enumerable:!0}):n,e)),Q=e=>w(R({},"__esModule",{value:!0}),e);var Y={};z(Y,{useCallbackRef:()=>L,useControlledState:()=>h,useControlledState2:()=>F,useDebounce:()=>C,useDisclosure:()=>k,useEventListener:()=>M,useFocus:()=>H,useFocusVisible:()=>K,useHover:()=>U,useKeyPress:()=>V,useMergeRefs:()=>I,usePress:()=>g,usePrevious:()=>B});module.exports=Q(Y);var v=require("react");function L(e){let t=(0,v.useRef)(e);return(0,v.useEffect)(()=>{t.current=e}),(0,v.useMemo)(()=>(...n)=>t.current?.(...n),[])}var m=require("react");var F=(e,t,n)=>{let[o,s]=(0,m.useState)(t??e);return(0,m.useEffect)(()=>{n?.(o)},[n,o]),[o,s]};function X({defaultProp:e,onChange:t}){let n=(0,m.useState)(e),[o]=n,s=(0,m.useRef)(o),i=L(t);return(0,m.useEffect)(()=>{s.current!==o&&(i(o),s.current=o)},[o,s,i]),n}function h(e,t,n){let[o,s]=X({defaultProp:e,onChange:n}),i=t!==void 0,a=i?t:o,u=L(n),r=(0,m.useCallback)(c=>{if(i){let d=typeof c=="function"?c(t):c;d!==t&&u(d)}else s(c)},[i,t,s,u]);return[a,r]}var P=require("react"),C=(e,t=500)=>{let[n,o]=(0,P.useState)(e);return(0,P.useEffect)(()=>{let s=setTimeout(()=>{o(e)},t);return()=>{clearTimeout(s)}},[e,t]),n};var x=require("react"),k=e=>{let[t,n]=(0,x.useState)(e??!1),o=(0,x.useCallback)(()=>n(!0),[]),s=(0,x.useCallback)(()=>n(!1),[]);return{isOpen:t,setIsOpen:n,onOpen:o,onClose:s}};var y=require("react"),M=(e,t,n)=>{let o=(0,y.useRef)(null);(0,y.useEffect)(()=>{o.current=n},[n]),(0,y.useEffect)(()=>{if(!e)return()=>{};let s=i=>{o.current&&o.current(i)};return e.addEventListener(t,s),()=>{e.removeEventListener(t,s)}},[t,e])};var p=require("react"),H=(e={})=>{let{onFocusStart:t,onFocusEnd:n,isDisabled:o}=e,[s,i]=(0,p.useState)(!1),a=(0,p.useRef)(null);return(0,p.useEffect)(()=>{let u=a.current;if(!u||o)return()=>{};let r=()=>{i(!0),t?.()},c=()=>{i(!1),n?.()};return u.addEventListener("focus",r),u.addEventListener("blur",c),()=>{u.removeEventListener("focus",r),u.removeEventListener("blur",c)}},[t,n,o]),{ref:a,isFocused:s}};var E=require("react"),K=(e={})=>{let{onFocusVisible:t,onBlurVisible:n,isDisabled:o}=e,[s,i]=(0,E.useState)(!1),a=(0,E.useRef)(null);return(0,E.useEffect)(()=>{if(o)return()=>{};let u=!1,r=a.current,c=f=>{(f.key==="Tab"||f.key==="ArrowUp"||f.key==="ArrowDown"||f.key==="ArrowLeft"||f.key==="Home"||f.key==="End"||f.key==="ArrowRight")&&(u=!0)},l=()=>{u=!1},d=()=>{u&&(i(!0),t?.())},S=()=>{s&&(i(!1),n?.())};return document.addEventListener("keydown",c),document.addEventListener("mousedown",l),document.addEventListener("touchstart",l),r&&(r.addEventListener("focus",d),r.addEventListener("blur",S)),()=>{document.removeEventListener("keydown",c),document.removeEventListener("mousedown",l),document.removeEventListener("touchstart",l),r&&(r.removeEventListener("focus",d),r.removeEventListener("blur",S))}},[t,n,o,s]),{ref:a,isFocusVisible:s}};var T=require("react"),U=e=>{let{enterDelay:t=0,exitDelay:n=0,isDisabled:o}=e??{},[s,i]=(0,T.useState)(!1),a=(0,T.useRef)(null);return(0,T.useEffect)(()=>{let u=a.current;if(!u||o)return()=>{};let r=null,c=null,l=()=>{c&&clearTimeout(c),r=setTimeout(()=>{i(!0)},t)},d=()=>{r&&clearTimeout(r),c=setTimeout(()=>{i(!1)},n)};return u.addEventListener("mouseenter",l),u.addEventListener("mouseleave",d),()=>{r&&clearTimeout(r),c&&clearTimeout(c),u.removeEventListener("mouseenter",l),u.removeEventListener("mouseleave",d)}},[t,n,o]),{ref:a,isHovered:s}};var O=require("react"),V=(e,t)=>{(0,O.useEffect)(()=>{let n=o=>{let s=e===null&&"all"||Array.isArray(e)&&e||[e];(s==="all"||s.includes(o.key))&&t(o)};return window.addEventListener("keydown",n),()=>{window.removeEventListener("keydown",n)}},[e,t])};var A=G(require("react")),I=e=>A.useMemo(()=>e.every(t=>t==null)?null:t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})},e);var b=require("react"),g=(e={})=>{let{onPressStart:t,onPressEnd:n,onPressCancel:o,isDisabled:s}=e,[i,a]=(0,b.useState)(!1),u=(0,b.useRef)(null);return(0,b.useEffect)(()=>{let r=u.current;if(!r||s)return()=>{};let c=()=>{a(!0),t?.();let l=f=>{if(r.contains(f.target)){a(!0);return}a(!1),o?.()},d=f=>{r&&r.contains(f.target)&&n?.(),a(!1),S()},S=()=>{document.removeEventListener("pointermove",l),document.removeEventListener("pointerup",d)};document.addEventListener("pointermove",l),document.addEventListener("pointerup",d)};return r.addEventListener("pointerdown",c),()=>{r.removeEventListener("pointerdown",c)}},[t,n,o,s]),{ref:u,isPressed:i}};var D=require("react"),B=e=>{let t=(0,D.useRef)(e);return(0,D.useEffect)(()=>{t.current=e},[e]),t.current};0&&(module.exports={useCallbackRef,useControlledState,useControlledState2,useDebounce,useDisclosure,useEventListener,useFocus,useFocusVisible,useHover,useKeyPress,useMergeRefs,usePress,usePrevious});
import * as react from 'react';
declare const useControlledState2: <T>(defaultValue?: T, value?: T, onValueChange?: (value: T) => void) => [T, (newValue: T | ((prevState: T) => T)) => void];
declare const useControlledState2: <T>(defaultValue?: T, value?: T, onValueChange?: (value: T) => void) => [T, React.Dispatch<React.SetStateAction<T>>];
declare function useControlledState<T>(defaultProp?: T | undefined, prop?: T | undefined, onChange?: (state: T) => void): readonly [T, react.Dispatch<react.SetStateAction<T>>];
export { useControlledState, useControlledState2 };
"use client"
"use strict";var i=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var R=(t,e)=>{for(var n in e)i(t,n,{get:e[n],enumerable:!0})},y=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of m(e))!v.call(t,o)&&o!==n&&i(t,o,{get:()=>e[o],enumerable:!(s=p(e,o))||s.enumerable});return t};var C=t=>y(i({},"__esModule",{value:!0}),t);var h={};R(h,{useControlledState:()=>U,useControlledState2:()=>b});module.exports=C(h);var a=require("react");var f=require("react");function l(t){let e=(0,f.useRef)(t);return(0,f.useEffect)(()=>{e.current=t}),(0,f.useMemo)(()=>(...n)=>e.current?.(...n),[])}var b=(t,e,n)=>{let[s,o]=(0,a.useState)(t??void 0),r=e!==void 0?e:s,d=(0,a.useCallback)(c=>{n&&n(c),e===void 0&&o(typeof c=="function"?T=>c(T):c)},[e,r]);return[r,d]};function P({defaultProp:t,onChange:e}){let n=(0,a.useState)(t),[s]=n,o=(0,a.useRef)(s),r=l(e);return(0,a.useEffect)(()=>{o.current!==s&&(r(s),o.current=s)},[s,o,r]),n}function U(t,e,n){let[s,o]=P({defaultProp:t,onChange:n}),r=e!==void 0,d=r?e:s,c=l(n),T=(0,a.useCallback)(u=>{if(r){let S=typeof u=="function"?u(e):u;S!==e&&c(S)}else o(u)},[r,e,o,c]);return[d,T]}0&&(module.exports={useControlledState,useControlledState2});
"use strict";var l=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var m=Object.prototype.hasOwnProperty;var C=(t,e)=>{for(var n in e)l(t,n,{get:e[n],enumerable:!0})},v=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of R(e))!m.call(t,o)&&o!==n&&l(t,o,{get:()=>e[o],enumerable:!(a=p(e,o))||a.enumerable});return t};var h=t=>v(l({},"__esModule",{value:!0}),t);var A={};C(A,{useControlledState:()=>P,useControlledState2:()=>b});module.exports=h(A);var s=require("react");var r=require("react");function T(t){let e=(0,r.useRef)(t);return(0,r.useEffect)(()=>{e.current=t}),(0,r.useMemo)(()=>(...n)=>e.current?.(...n),[])}var b=(t,e,n)=>{let[a,o]=(0,s.useState)(e??t);return(0,s.useEffect)(()=>{n?.(a)},[n,a]),[a,o]};function y({defaultProp:t,onChange:e}){let n=(0,s.useState)(t),[a]=n,o=(0,s.useRef)(a),c=T(e);return(0,s.useEffect)(()=>{o.current!==a&&(c(a),o.current=a)},[a,o,c]),n}function P(t,e,n){let[a,o]=y({defaultProp:t,onChange:n}),c=e!==void 0,f=c?e:a,d=T(n),S=(0,s.useCallback)(u=>{if(c){let i=typeof u=="function"?u(e):u;i!==e&&d(i)}else o(u)},[c,e,o,d]);return[f,S]}0&&(module.exports={useControlledState,useControlledState2});
{
"name": "@jamsr-ui/hooks",
"version": "0.0.40",
"version": "0.0.41",
"description": "A react js ui library with tailwindcss",

@@ -5,0 +5,0 @@ "sideEffects": false,

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