@radix-ui/react-collapsible
Advanced tools
Comparing version 0.1.1 to 0.1.2-rc.1
@@ -1,2 +0,2 @@ | ||
var e,t,r,n=require("@radix-ui/react-id").useId,o=require("@radix-ui/react-presence").Presence,a=require("@radix-ui/react-primitive").Primitive,i=require("@radix-ui/react-compose-refs").useComposedRefs,l=require("@radix-ui/react-use-layout-effect").useLayoutEffect,s=require("@radix-ui/react-use-controllable-state").useControllableState,c=require("@radix-ui/react-context").createContextScope,d=require("@radix-ui/primitive").composeEventHandlers,p=(e={},t=require("react"),Object.keys(t).forEach((function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),e),u=(r=require("@babel/runtime/helpers/extends"))&&r.__esModule?r.default:r;const[b,f]=c("Collapsible");exports.createCollapsibleScope=f;const[C,x]=b("Collapsible"),g=/*#__PURE__*/p.forwardRef(((e,t)=>{const{__scopeCollapsible:r,open:o,defaultOpen:i,disabled:l,onOpenChange:c,...d}=e,[b=!1,f]=s({prop:o,defaultProp:i,onChange:c});/*#__PURE__*/return p.createElement(C,{scope:r,disabled:l,contentId:n(),open:b,onOpenToggle:p.useCallback((()=>f((e=>!e))),[f])},/*#__PURE__*/p.createElement(a.div,u({"data-state":y(b),"data-disabled":l?"":void 0},d,{ref:t})))}));exports.Collapsible=g;const m=/*#__PURE__*/p.forwardRef(((e,t)=>{const{__scopeCollapsible:r,...n}=e,o=x("CollapsibleTrigger",r);/*#__PURE__*/return p.createElement(a.button,u({"aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":y(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled},n,{ref:t,onClick:d(e.onClick,o.onOpenToggle)}))}));exports.CollapsibleTrigger=m;const h=/*#__PURE__*/p.forwardRef(((e,t)=>{const{forceMount:r,...n}=e,a=x("CollapsibleContent",e.__scopeCollapsible);/*#__PURE__*/return p.createElement(o,{present:r||a.open},(({present:e})=>/*#__PURE__*/p.createElement(v,u({},n,{ref:t,present:e}))))}));exports.CollapsibleContent=h;const v=/*#__PURE__*/p.forwardRef(((e,t)=>{const{__scopeCollapsible:r,present:n,children:o,...s}=e,c=x("CollapsibleContent",r),[d,b]=p.useState(n),f=p.useRef(null),C=i(t,f),g=p.useRef(0),m=g.current,h=p.useRef(0),v=h.current,_=c.open||d;return l((()=>{const e=f.current;if(e){const t=e.style.transition,r=e.style.animation;e.style.transition="none",e.style.animation="none";const o=e.getBoundingClientRect();g.current=o.height,h.current=o.width,e.style.transition=t,e.style.animation=r,b(n)}}),[c.open,n]),/*#__PURE__*/p.createElement(a.div,u({"data-state":y(c.open),"data-disabled":c.disabled?"":void 0,id:c.contentId,hidden:!_},s,{ref:C,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...e.style}}),_&&o)}));function y(e){return e?"open":"closed"}const _=g;exports.Root=_;const q=m;exports.Trigger=q;const R=h;exports.Content=R; | ||
var e,t,n,r=require("@radix-ui/react-id").useId,o=require("@radix-ui/react-presence").Presence,i=require("@radix-ui/react-primitive").Primitive,a=require("@radix-ui/react-compose-refs").useComposedRefs,s=require("@radix-ui/react-use-layout-effect").useLayoutEffect,l=require("@radix-ui/react-use-controllable-state").useControllableState,c=require("@radix-ui/react-context").createContextScope,d=require("@radix-ui/primitive").composeEventHandlers,p=(e={},t=require("react"),Object.keys(t).forEach((function(n){"default"!==n&&"__esModule"!==n&&Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})})),e),u=(n=require("@babel/runtime/helpers/extends"))&&n.__esModule?n.default:n;const[b,f]=c("Collapsible");exports.createCollapsibleScope=f;const[C,x]=b("Collapsible"),m=/*#__PURE__*/p.forwardRef(((e,t)=>{const{__scopeCollapsible:n,open:o,defaultOpen:a,disabled:s,onOpenChange:c,...d}=e,[b=!1,f]=l({prop:o,defaultProp:a,onChange:c}),x=p.useRef(b);/*#__PURE__*/return p.createElement(C,{scope:n,disabled:s,contentId:r(),isAnimationPrevented:x.current,open:b,onOpenToggle:p.useCallback((()=>{x.current=!1,f((e=>!e))}),[f])},/*#__PURE__*/p.createElement(i.div,u({"data-state":y(b),"data-disabled":s?"":void 0},d,{ref:t})))}));exports.Collapsible=m;const g=/*#__PURE__*/p.forwardRef(((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=x("CollapsibleTrigger",n);/*#__PURE__*/return p.createElement(i.button,u({"aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":y(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled},r,{ref:t,onClick:d(e.onClick,o.onOpenToggle)}))}));exports.CollapsibleTrigger=g;const v=/*#__PURE__*/p.forwardRef(((e,t)=>{const{forceMount:n,...r}=e,i=x("CollapsibleContent",e.__scopeCollapsible);/*#__PURE__*/return p.createElement(o,{present:n||i.open},(({present:e})=>/*#__PURE__*/p.createElement(h,u({},r,{ref:t,present:e}))))}));exports.CollapsibleContent=v;const h=/*#__PURE__*/p.forwardRef(((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...l}=e,c=x("CollapsibleContent",n),[d,b]=p.useState(r),f=p.useRef(null),C=a(t,f),m=p.useRef(0),g=m.current,v=p.useRef(0),h=v.current,_=c.open||d;return s((()=>{const e=f.current;if(e){const t=e.style.transition,n=e.style.animation;e.style.transition="none",e.style.animation="none";const o=e.getBoundingClientRect();m.current=o.height,v.current=o.width,e.style.transition=t,e.style.animation=n,b(r)}}),[c.open,r]),/*#__PURE__*/p.createElement(i.div,u({"data-state":y(c.open),"data-disabled":c.disabled?"":void 0,id:c.contentId,hidden:!_},l,{ref:C,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":h?`${h}px`:void 0,animation:c.isAnimationPrevented?"none":void 0,...e.style}}),_&&o)}));function y(e){return e?"open":"closed"}const _=m;exports.Root=_;const R=g;exports.Trigger=R;const q=v;exports.Content=q; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import{useId as e}from"@radix-ui/react-id";import{Presence as t}from"@radix-ui/react-presence";import{Primitive as o}from"@radix-ui/react-primitive";import{useComposedRefs as r}from"@radix-ui/react-compose-refs";import{useLayoutEffect as n}from"@radix-ui/react-use-layout-effect";import{useControllableState as i}from"@radix-ui/react-use-controllable-state";import{createContextScope as a}from"@radix-ui/react-context";import{composeEventHandlers as l}from"@radix-ui/primitive";import*as s from"react";import p from"@babel/runtime/helpers/esm/extends";const[d,c]=a("Collapsible");export{c as createCollapsibleScope};const[m,u]=d("Collapsible");export const Collapsible=/*#__PURE__*/s.forwardRef(((t,r)=>{const{__scopeCollapsible:n,open:a,defaultOpen:l,disabled:d,onOpenChange:c,...u}=t,[f=!1,C]=i({prop:a,defaultProp:l,onChange:c});/*#__PURE__*/return s.createElement(m,{scope:n,disabled:d,contentId:e(),open:f,onOpenToggle:s.useCallback((()=>C((e=>!e))),[C])},/*#__PURE__*/s.createElement(o.div,p({"data-state":b(f),"data-disabled":d?"":void 0},u,{ref:r})))}));/*#__PURE__*/export const CollapsibleTrigger=/*#__PURE__*/s.forwardRef(((e,t)=>{const{__scopeCollapsible:r,...n}=e,i=u("CollapsibleTrigger",r);/*#__PURE__*/return s.createElement(o.button,p({"aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":b(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled},n,{ref:t,onClick:l(e.onClick,i.onOpenToggle)}))}));/*#__PURE__*/export const CollapsibleContent=/*#__PURE__*/s.forwardRef(((e,o)=>{const{forceMount:r,...n}=e,i=u("CollapsibleContent",e.__scopeCollapsible);/*#__PURE__*/return s.createElement(t,{present:r||i.open},(({present:e})=>/*#__PURE__*/s.createElement(f,p({},n,{ref:o,present:e}))))}));/*#__PURE__*/const f=/*#__PURE__*/s.forwardRef(((e,t)=>{const{__scopeCollapsible:i,present:a,children:l,...d}=e,c=u("CollapsibleContent",i),[m,f]=s.useState(a),C=s.useRef(null),x=r(t,C),g=s.useRef(0),h=g.current,v=s.useRef(0),y=v.current,R=c.open||m;return n((()=>{const e=C.current;if(e){const t=e.style.transition,o=e.style.animation;e.style.transition="none",e.style.animation="none";const r=e.getBoundingClientRect();g.current=r.height,v.current=r.width,e.style.transition=t,e.style.animation=o,f(a)}}),[c.open,a]),/*#__PURE__*/s.createElement(o.div,p({"data-state":b(c.open),"data-disabled":c.disabled?"":void 0,id:c.contentId,hidden:!R},d,{ref:x,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...e.style}}),R&&l)}));function b(e){return e?"open":"closed"}export const Root=Collapsible;export const Trigger=CollapsibleTrigger;export const Content=CollapsibleContent; | ||
import{useId as e}from"@radix-ui/react-id";import{Presence as t}from"@radix-ui/react-presence";import{Primitive as o}from"@radix-ui/react-primitive";import{useComposedRefs as n}from"@radix-ui/react-compose-refs";import{useLayoutEffect as r}from"@radix-ui/react-use-layout-effect";import{useControllableState as i}from"@radix-ui/react-use-controllable-state";import{createContextScope as a}from"@radix-ui/react-context";import{composeEventHandlers as l}from"@radix-ui/primitive";import*as s from"react";import p from"@babel/runtime/helpers/esm/extends";const[d,c]=a("Collapsible");export{c as createCollapsibleScope};const[m,u]=d("Collapsible");export const Collapsible=/*#__PURE__*/s.forwardRef(((t,n)=>{const{__scopeCollapsible:r,open:a,defaultOpen:l,disabled:d,onOpenChange:c,...u}=t,[f=!1,C]=i({prop:a,defaultProp:l,onChange:c}),x=s.useRef(f);/*#__PURE__*/return s.createElement(m,{scope:r,disabled:d,contentId:e(),isAnimationPrevented:x.current,open:f,onOpenToggle:s.useCallback((()=>{x.current=!1,C((e=>!e))}),[C])},/*#__PURE__*/s.createElement(o.div,p({"data-state":b(f),"data-disabled":d?"":void 0},u,{ref:n})))}));/*#__PURE__*/export const CollapsibleTrigger=/*#__PURE__*/s.forwardRef(((e,t)=>{const{__scopeCollapsible:n,...r}=e,i=u("CollapsibleTrigger",n);/*#__PURE__*/return s.createElement(o.button,p({"aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":b(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled},r,{ref:t,onClick:l(e.onClick,i.onOpenToggle)}))}));/*#__PURE__*/export const CollapsibleContent=/*#__PURE__*/s.forwardRef(((e,o)=>{const{forceMount:n,...r}=e,i=u("CollapsibleContent",e.__scopeCollapsible);/*#__PURE__*/return s.createElement(t,{present:n||i.open},(({present:e})=>/*#__PURE__*/s.createElement(f,p({},r,{ref:o,present:e}))))}));/*#__PURE__*/const f=/*#__PURE__*/s.forwardRef(((e,t)=>{const{__scopeCollapsible:i,present:a,children:l,...d}=e,c=u("CollapsibleContent",i),[m,f]=s.useState(a),C=s.useRef(null),x=n(t,C),g=s.useRef(0),v=g.current,h=s.useRef(0),R=h.current,y=c.open||m;return r((()=>{const e=C.current;if(e){const t=e.style.transition,o=e.style.animation;e.style.transition="none",e.style.animation="none";const n=e.getBoundingClientRect();g.current=n.height,h.current=n.width,e.style.transition=t,e.style.animation=o,f(a)}}),[c.open,a]),/*#__PURE__*/s.createElement(o.div,p({"data-state":b(c.open),"data-disabled":c.disabled?"":void 0,id:c.contentId,hidden:!y},d,{ref:x,style:{"--radix-collapsible-content-height":v?`${v}px`:void 0,"--radix-collapsible-content-width":R?`${R}px`:void 0,animation:c.isAnimationPrevented?"none":void 0,...e.style}}),y&&l)}));function b(e){return e?"open":"closed"}export const Root=Collapsible;export const Trigger=CollapsibleTrigger;export const Content=CollapsibleContent; | ||
//# sourceMappingURL=index.module.js.map |
{ | ||
"name": "@radix-ui/react-collapsible", | ||
"version": "0.1.1", | ||
"version": "0.1.2-rc.1", | ||
"license": "MIT", | ||
@@ -39,3 +39,4 @@ "source": "src/index.ts", | ||
"url": "https://github.com/radix-ui/primitives/issues" | ||
} | ||
}, | ||
"stableVersion": "0.1.1" | ||
} |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
35921
56