@headlessui/react
Advanced tools
Comparing version 2.1.6 to 2.1.7
@@ -1,1 +0,2 @@ | ||
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}; | ||
var T;import{useRef as c,useState as S}from"react";import{disposables as m}from'../utils/disposables.js';import{useDisposables as g}from'./use-disposables.js';import{useFlags as E}from'./use-flags.js';import{useIsoMorphicEffect as y}from'./use-iso-morphic-effect.js';typeof process!="undefined"&&typeof globalThis!="undefined"&&((T=process==null?void 0:process.env)==null?void 0:T["NODE_ENV"])==="test"&&typeof Element.prototype.getAnimations=="undefined"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(` | ||
`)),[]});var A=(r=>(r[r.None=0]="None",r[r.Closed=1]="Closed",r[r.Enter=2]="Enter",r[r.Leave=4]="Leave",r))(A||{});function H(e){let n={};for(let t in e)e[t]===!0&&(n[`data-${t}`]="");return n}function R(e,n,t,i){let[r,o]=S(t),{hasFlag:s,addFlag:a,removeFlag:l}=E(e&&r?3:0),u=c(!1),f=c(!1),b=g();return y(()=>{var d;if(e){if(t&&o(!0),!n){t&&a(3);return}return(d=i==null?void 0:i.start)==null||d.call(i,t),L(n,{inFlight:u,prepare(){f.current?f.current=!1:f.current=u.current,u.current=!0,!f.current&&(t?(a(3),l(4)):(a(4),l(2)))},run(){f.current?t?(l(3),a(4)):(l(4),a(3)):t?l(1):a(1)},done(){var p;f.current&&typeof n.getAnimations=="function"&&n.getAnimations().length>0||(u.current=!1,l(7),t||o(!1),(p=i==null?void 0:i.end)==null||p.call(i,t))}})}},[e,t,n,b]),e?[r,{closed:s(1),enter:s(2),leave:s(4),transition:s(2)||s(4)}]:[t,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function L(e,{prepare:n,run:t,done:i,inFlight:r}){let o=m();return M(e,{prepare:n,inFlight:r}),o.nextFrame(()=>{t(),o.requestAnimationFrame(()=>{o.add(C(e,i))})}),o.dispose}function C(e,n){var o,s;let t=m();if(!e)return t.dispose;let i=!1;t.add(()=>{i=!0});let r=(s=(o=e.getAnimations)==null?void 0:o.call(e).filter(a=>a instanceof CSSTransition))!=null?s:[];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,R as useTransition}; |
{ | ||
"name": "@headlessui/react", | ||
"version": "2.1.6", | ||
"version": "2.1.7", | ||
"description": "A set of completely unstyled, fully accessible UI components for React, designed to integrate beautifully with Tailwind CSS.", | ||
@@ -52,2 +52,3 @@ "main": "dist/index.cjs", | ||
"@types/react-dom": "^18.3.0", | ||
"jsdom-testing-mocks": "^1.13.1", | ||
"react": "^18.3.1", | ||
@@ -54,0 +55,0 @@ "react-dom": "^18.3.1", |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
914912
16439
7
7