Socket
Socket
Sign inDemoInstall

@headlessui/react

Package Overview
Dependencies
Maintainers
4
Versions
713
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@headlessui/react - npm Package Compare versions

Comparing version 2.1.4 to 2.1.5

2

dist/hooks/use-transition.js

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

import{useRef as T,useState as b}from"react";import{disposables as m}from'../utils/disposables.js';import{once as E}from'../utils/once.js';import{useDisposables as S}from'./use-disposables.js';import{useFlags as g}from'./use-flags.js';import{useIsoMorphicEffect as L}from'./use-iso-morphic-effect.js';var y=(a=>(a[a.None=0]="None",a[a.Closed=1]="Closed",a[a.Enter=2]="Enter",a[a.Leave=4]="Leave",a))(y||{});function j(e){let i={};for(let t in e)e[t]===!0&&(i[`data-${t}`]="");return i}function x(e,i,t,r){let[a,u]=b(t),{hasFlag:d,addFlag:f,removeFlag:o}=g(e&&a?3:0),s=T(!1),n=T(!1),l=S();return L(()=>{var c;if(e){if(t&&u(!0),!i){t&&f(3);return}return(c=r==null?void 0:r.start)==null||c.call(r,t),C(i,{inFlight:s,prepare(){n.current?n.current=!1:n.current=s.current,s.current=!0,!n.current&&(t?(f(3),o(4)):(f(4),o(2)))},run(){n.current?t?(o(3),f(4)):(o(4),f(3)):t?o(1):f(1)},done(){var p;n.current&&typeof i.getAnimations=="function"&&i.getAnimations().length>0||(s.current=!1,o(7),t||u(!1),(p=r==null?void 0:r.end)==null||p.call(r,t))}})}},[e,t,i,l]),e?[a,{closed:d(1),enter:d(2),leave:d(4),transition:d(2)||d(4)}]:[t,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function C(e,{prepare:i,run:t,done:r,inFlight:a}){let u=m();return M(e,{prepare:i,inFlight:a}),u.nextFrame(()=>{u.add(D(e,r)),t()}),u.dispose}function D(e,i){let t=E(i),r=m();if(!e)return r.dispose;let{transitionDuration:a,transitionDelay:u}=getComputedStyle(e),[d,f]=[a,u].map(s=>{let[n=0]=s.split(",").filter(Boolean).map(l=>l.includes("ms")?parseFloat(l):parseFloat(l)*1e3).sort((l,c)=>c-l);return n}),o=d+f;if(o!==0){let s=r.group(n=>{let l=n.setTimeout(()=>{t(),n.dispose()},o);n.addEventListener(e,"transitionrun",c=>{c.target===c.currentTarget&&(l(),n.addEventListener(e,"transitioncancel",p=>{p.target===p.currentTarget&&(t(),s())}))})});r.addEventListener(e,"transitionend",n=>{n.target===n.currentTarget&&(t(),r.dispose())})}else t();return r.dispose}function M(e,{inFlight:i,prepare:t}){if(i!=null&&i.current){t();return}let r=e.style.transition;e.style.transition="none",t(),e.offsetHeight,e.style.transition=r}export{j as transitionDataAttributes,x as useTransition};
import{useRef as T,useState as b}from"react";import{disposables as p}from'../utils/disposables.js';import{useDisposables as m}from'./use-disposables.js';import{useFlags as E}from'./use-flags.js';import{useIsoMorphicEffect as L}from'./use-iso-morphic-effect.js';var g=(r=>(r[r.None=0]="None",r[r.Closed=1]="Closed",r[r.Enter=2]="Enter",r[r.Leave=4]="Leave",r))(g||{});function H(e){let n={};for(let t in e)e[t]===!0&&(n[`data-${t}`]="");return n}function j(e,n,t,i){let[r,a]=b(t),{hasFlag:f,addFlag:o,removeFlag:s}=E(e&&r?3:0),u=T(!1),l=T(!1),S=m();return L(()=>{var d;if(e){if(t&&a(!0),!n){t&&o(3);return}return(d=i==null?void 0:i.start)==null||d.call(i,t),C(n,{inFlight:u,prepare(){l.current?l.current=!1:l.current=u.current,u.current=!0,!l.current&&(t?(o(3),s(4)):(o(4),s(2)))},run(){l.current?t?(s(3),o(4)):(s(4),o(3)):t?s(1):o(1)},done(){var c;l.current&&typeof n.getAnimations=="function"&&n.getAnimations().length>0||(u.current=!1,s(7),t||a(!1),(c=i==null?void 0:i.end)==null||c.call(i,t))}})}},[e,t,n,S]),e?[r,{closed:f(1),enter:f(2),leave:f(4),transition:f(2)||f(4)}]:[t,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function C(e,{prepare:n,run:t,done:i,inFlight:r}){let a=p();return M(e,{prepare:n,inFlight:r}),a.nextFrame(()=>{t(),a.requestAnimationFrame(()=>{a.add(y(e,i))})}),a.dispose}function y(e,n){let t=p();if(!e)return t.dispose;let i=!1;t.add(()=>{i=!0});let r=e.getAnimations().filter(a=>a instanceof CSSTransition);return r.length===0?(n(),t.dispose):(Promise.allSettled(r.map(a=>a.finished)).then(()=>{i||n()}),t.dispose)}function M(e,{inFlight:n,prepare:t}){if(n!=null&&n.current){t();return}let i=e.style.transition;e.style.transition="none",t(),e.offsetHeight,e.style.transition=i}export{H as transitionDataAttributes,j as useTransition};
{
"name": "@headlessui/react",
"version": "2.1.4",
"version": "2.1.5",
"description": "A set of completely unstyled, fully accessible UI components for React, designed to integrate beautifully with Tailwind CSS.",

@@ -5,0 +5,0 @@ "main": "dist/index.cjs",

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