@dotss/ui 1.7.1 → 1.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @dotss/ui
2
2
 
3
+ ## 1.7.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 7a94bcd: fix(ui): useCollapse 애니메이션 발생 관련 부수효과함수 로직 수정
8
+
3
9
  ## 1.7.1
4
10
 
5
11
  ### Patch Changes
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react"),v=require("../../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.cjs"),y=require("../../usePrefersReducedMotion/usePrefersReducedMotion.cjs");function P({isCollapsed:t=!0,duration:s=200,delay:f=0,easing:o="ease-in-out",onTransitionStart:i,onTransitionEnd:l}={}){const{prefersReducedMotion:x}=y.default(),h=r.useRef(null),e=r.useRef(null),u=r.useRef(i),c=r.useRef(l),a=r.useRef(!0);u.current=i,c.current=l;const[g,H]=r.useState(t?"0px":"auto");return v.default(()=>{var d;if(a.current){a.current=!1;return}const n=h.current;if(!n)return;e.current&&(e.current.cancel(),e.current=null);const R=n.scrollHeight,M=t?[{height:`${R}px`},{height:"0px"}]:[{height:"0px"},{height:`${R}px`}],q=t?"0px":"auto";return(d=u.current)==null||d.call(u),e.current=n.animate(M,{duration:x?0:s,easing:o,delay:f,fill:"forwards"}),e.current.onfinish=()=>{var m,p;(m=e.current)==null||m.commitStyles(),H(q),(p=c.current)==null||p.call(c),e.current=null},()=>{e.current&&(e.current.cancel(),e.current=null)}},[t,s,f,o]),{targetRef:h,isCollapsed:t,height:g,style:{height:g,overflow:"hidden"},ariaProps:{"aria-hidden":t}}}exports.default=P;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react"),P=require("../../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.cjs"),q=require("../../usePrefersReducedMotion/usePrefersReducedMotion.cjs");function y({isCollapsed:t=!0,duration:f=200,delay:o=0,easing:s="ease-in-out",onTransitionStart:i,onTransitionEnd:h}={}){const{prefersReducedMotion:p}=q.default(),l=r.useRef(null),e=r.useRef(null),u=r.useRef(i),c=r.useRef(h),a=r.useRef(t);u.current=i,c.current=h;const[g,v]=r.useState(t?"0px":"auto");return P.default(()=>{var m;if(a.current===t)return;a.current=t;const n=l.current;if(!n)return;e.current&&(e.current.cancel(),e.current=null);const R=n.scrollHeight,H=t?[{height:`${R}px`},{height:"0px"}]:[{height:"0px"},{height:`${R}px`}],M=t?"0px":"auto";return(m=u.current)==null||m.call(u),e.current=n.animate(H,{duration:p?0:f,easing:s,delay:o,fill:"forwards"}),e.current.onfinish=()=>{var x,d;(x=e.current)==null||x.commitStyles(),v(M),(d=c.current)==null||d.call(c),e.current=null},()=>{e.current&&(e.current.cancel(),e.current=null)}},[t,f,o,s]),{targetRef:l,isCollapsed:t,height:g,style:{height:g,overflow:"hidden"},ariaProps:{"aria-hidden":t}}}exports.default=y;
@@ -1,51 +1,50 @@
1
- import { useRef as r, useState as M } from "react";
2
- import P from "../../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.es.js";
1
+ import { useRef as t, useState as y } from "react";
2
+ import M from "../../useIsomorphicLayoutEffect/useIsomorphicLayoutEffect.es.js";
3
3
  import $ from "../../usePrefersReducedMotion/usePrefersReducedMotion.es.js";
4
- function L({
5
- isCollapsed: t = !0,
4
+ function d({
5
+ isCollapsed: r = !0,
6
6
  duration: o = 200,
7
7
  delay: f = 0,
8
- easing: i = "ease-in-out",
9
- onTransitionStart: s,
10
- onTransitionEnd: h
8
+ easing: h = "ease-in-out",
9
+ onTransitionStart: i,
10
+ onTransitionEnd: m
11
11
  } = {}) {
12
- const { prefersReducedMotion: H } = $(), l = r(null), e = r(null), u = r(s), c = r(h), m = r(!0);
13
- u.current = s, c.current = h;
14
- const [p, d] = M(t ? "0px" : "auto");
15
- return P(() => {
16
- var g;
17
- if (m.current) {
18
- m.current = !1;
12
+ const { prefersReducedMotion: R } = $(), s = t(null), e = t(null), u = t(i), c = t(m), g = t(r);
13
+ u.current = i, c.current = m;
14
+ const [l, P] = y(r ? "0px" : "auto");
15
+ return M(() => {
16
+ var x;
17
+ if (g.current === r)
19
18
  return;
20
- }
21
- const n = l.current;
19
+ g.current = r;
20
+ const n = s.current;
22
21
  if (!n) return;
23
22
  e.current && (e.current.cancel(), e.current = null);
24
- const a = n.scrollHeight, w = t ? [{ height: `${a}px` }, { height: "0px" }] : [{ height: "0px" }, { height: `${a}px` }], y = t ? "0px" : "auto";
25
- return (g = u.current) == null || g.call(u), e.current = n.animate(w, {
26
- duration: H ? 0 : o,
27
- easing: i,
23
+ const p = n.scrollHeight, v = r ? [{ height: `${p}px` }, { height: "0px" }] : [{ height: "0px" }, { height: `${p}px` }], w = r ? "0px" : "auto";
24
+ return (x = u.current) == null || x.call(u), e.current = n.animate(v, {
25
+ duration: R ? 0 : o,
26
+ easing: h,
28
27
  delay: f,
29
28
  fill: "forwards"
30
29
  }), e.current.onfinish = () => {
31
- var x, R;
32
- (x = e.current) == null || x.commitStyles(), d(y), (R = c.current) == null || R.call(c), e.current = null;
30
+ var a, H;
31
+ (a = e.current) == null || a.commitStyles(), P(w), (H = c.current) == null || H.call(c), e.current = null;
33
32
  }, () => {
34
33
  e.current && (e.current.cancel(), e.current = null);
35
34
  };
36
- }, [t, o, f, i]), {
37
- targetRef: l,
38
- isCollapsed: t,
39
- height: p,
35
+ }, [r, o, f, h]), {
36
+ targetRef: s,
37
+ isCollapsed: r,
38
+ height: l,
40
39
  style: {
41
- height: p,
40
+ height: l,
42
41
  overflow: "hidden"
43
42
  },
44
43
  ariaProps: {
45
- "aria-hidden": t
44
+ "aria-hidden": r
46
45
  }
47
46
  };
48
47
  }
49
48
  export {
50
- L as default
49
+ d as default
51
50
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotss/ui",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "React UI components for Dotss",
5
5
  "type": "module",
6
6
  "main": "./index.cjs",