amotify 0.2.138 → 0.2.139

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.
@@ -17,6 +17,7 @@ declare namespace Accordion {
17
17
  open(accordionID: string): void;
18
18
  close(accordionID: string): void;
19
19
  toggle(accordionID: string): void;
20
+ isOpen(accordionID: string): boolean | void;
20
21
  };
21
22
  };
22
23
  type Methods = FN & React.FC<Input>;
@@ -1 +1 @@
1
- import{b as u,d as D}from"../chunk-C5N2D3ZX.js";import{jsx as R}from"react/jsx-runtime";import s,{UUID as w,useStore as a}from"jmini";import{useState as l,useEffect as H,useRef as F}from"react";import{$$fromRoot as f}from"../@utils";import{Box as _}from"../atoms";import{AccordionClasses as C}from"../@styles/componentClasses";const $=e=>{e=u({},e);let A=e,{accordionID:o="",slideAnimation:v="fast",defaultOpen:d=!1,override:y=!1}=A,E=D(A,["accordionID","slideAnimation","defaultOpen","override"]),[p]=l(w()),[m]=l(w()),[r,c]=l(d),[g,x]=l(0);y&&r!=d&&c(d);const I=F(!1);return H(()=>{s.scope(()=>{let n=f('[data-accordion-content-id="'+m+'"]')[0];if(!n)return;let i=n.offsetHeight,t=0;v=="fast"?(t=i/1e3,t=Math.max(t,.2)):v=="slow"&&(t=i/300),x(i),f("#"+p).css({transition:t+"s"})}),s.scope(()=>{o&&a.set({["Accordion-"+o]:{open:()=>{c(!0)},close:()=>{c(!1)},toggle:()=>{c(n=>!n)}}})})},[]),H(()=>{let n=f("#"+p),i=f('[data-accordion-content-id="'+m+'"]')[0];I.current||(I.current=!0),s.scope(()=>{if(!i||s.is.nullish(g))return;let t=i.offsetHeight;g!=t&&x(t),g&&n.css({maxHeight:t+1+"px"}).await(100),r?n.css({maxHeight:"unset",overflow:(e==null?void 0:e.overflow)||"unset"}):n.css({maxHeight:"0px",overflow:"hidden"})})},[r]),R(_,{className:[C("Wrap"),C("Open_"+r)].join(" "),id:p,children:R(_,u({"data-accordion-content-id":m},E))})},h=$;h.fn={open:e=>{let o=a.get("Accordion-"+e);!o||o.open()},close:e=>{let o=a.get("Accordion-"+e);!o||o.close()},toggle:e=>{let o=a.get("Accordion-"+e);!o||o.toggle()}};export{h as Accordion,h as default};
1
+ import{b as u,d as D}from"../chunk-C5N2D3ZX.js";import{jsx as y}from"react/jsx-runtime";import a,{UUID as O,useStore as c}from"jmini";import{useState as l,useEffect as w,useRef as b}from"react";import{$$fromRoot as d}from"../@utils";import{Box as H}from"../atoms";import{AccordionClasses as _}from"../@styles/componentClasses";const E=e=>{e=u({},e);let A=e,{accordionID:o="",slideAnimation:v="fast",defaultOpen:f=!1,override:C=!1}=A,R=D(A,["accordionID","slideAnimation","defaultOpen","override"]),[p]=l(O()),[m]=l(O()),[s,r]=l(f),[g,I]=l(0);C&&s!=f&&r(f);const x=b(!1);return w(()=>{a.scope(()=>{let t=d('[data-accordion-content-id="'+m+'"]')[0];if(!t)return;let n=t.offsetHeight,i=0;v=="fast"?(i=n/1e3,i=Math.max(i,.2)):v=="slow"&&(i=n/300),I(n),d("#"+p).css({transition:i+"s"})}),a.scope(()=>{o&&c.set({["Accordion-"+o]:{open:()=>{r(!0)},close:()=>{r(!1)},toggle:()=>{r(t=>!t)},isOpen:()=>{let t;return r(n=>(t=n,n)),t}}})})},[]),w(()=>{let t=d("#"+p),n=d('[data-accordion-content-id="'+m+'"]')[0];x.current||(x.current=!0),a.scope(()=>{if(!n||a.is.nullish(g))return;let i=n.offsetHeight;g!=i&&I(i),g&&t.css({maxHeight:i+1+"px"}).await(100),s?t.css({maxHeight:"unset",overflow:(e==null?void 0:e.overflow)||"unset"}):t.css({maxHeight:"0px",overflow:"hidden"})})},[s]),y(H,{className:[_("Wrap"),_("Open_"+s)].join(" "),id:p,children:y(H,u({"data-accordion-content-id":m},R))})},h=E;h.fn={open:e=>{let o=c.get("Accordion-"+e);!o||o.open()},close:e=>{let o=c.get("Accordion-"+e);!o||o.close()},toggle:e=>{let o=c.get("Accordion-"+e);!o||o.toggle()},isOpen:e=>{let o=c.get("Accordion-"+e);if(o)return o.isOpen()}};export{h as Accordion,h as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amotify",
3
- "version": "0.2.138",
3
+ "version": "0.2.139",
4
4
  "description": "UI Component for React,NextJS,esbuild",
5
5
  "scripts": {
6
6
  "start": "run-p clean build:*",