@radix-ui/react-collapsible
Advanced tools
Comparing version 0.1.1-rc.16 to 0.1.1-rc.17
import * as React from "react"; | ||
import * as Radix from "@radix-ui/react-primitive"; | ||
import { Primitive } from "@radix-ui/react-primitive"; | ||
export const createCollapsibleScope: import("@radix-ui/react-context").CreateScope; | ||
type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>; | ||
@@ -5,0 +6,0 @@ export interface CollapsibleProps extends PrimitiveDivProps { |
@@ -1,2 +0,2 @@ | ||
var e,t,r,n=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,d=require("@radix-ui/react-context").createContext,c=require("@radix-ui/primitive").composeEventHandlers,u=(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),p=(r=require("@babel/runtime/helpers/extends"))&&r.__esModule?r.default:r;const[f,b]=d("Collapsible"),x=/*#__PURE__*/u.forwardRef(((e,t)=>{const{open:r,defaultOpen:o,disabled:a,onOpenChange:s,...d}=e,[c=!1,b]=l({prop:r,defaultProp:o,onChange:s});/*#__PURE__*/return u.createElement(f,{disabled:a,contentId:n(),open:c,onOpenToggle:u.useCallback((()=>b((e=>!e))),[b])},/*#__PURE__*/u.createElement(i.div,p({"data-state":h(c),"data-disabled":a?"":void 0},d,{ref:t})))}));exports.Collapsible=x;const C=/*#__PURE__*/u.forwardRef(((e,t)=>{const r=b("CollapsibleTrigger");/*#__PURE__*/return u.createElement(i.button,p({"aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":h(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled},e,{ref:t,onClick:c(e.onClick,r.onOpenToggle)}))}));exports.CollapsibleTrigger=C;const g=/*#__PURE__*/u.forwardRef(((e,t)=>{const{forceMount:r,...n}=e,i=b("CollapsibleContent");/*#__PURE__*/return u.createElement(o,{present:r||i.open},(({present:e})=>/*#__PURE__*/u.createElement(m,p({},n,{ref:t,present:e}))))}));exports.CollapsibleContent=g;const m=/*#__PURE__*/u.forwardRef(((e,t)=>{const{present:r,children:n,...o}=e,l=b("CollapsibleContent"),[d,c]=u.useState(r),f=u.useRef(null),x=a(t,f),C=u.useRef(0),g=C.current,m=u.useRef(0),v=m.current,y=l.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();C.current=o.height,m.current=o.width,e.style.transition=t,e.style.animation=n,c(r)}}),[l.open,r]),/*#__PURE__*/u.createElement(i.div,p({"data-state":h(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!y},o,{ref:x,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...e.style}}),y&&n)}));function h(e){return e?"open":"closed"}const v=x;exports.Root=v;const y=C;exports.Trigger=y;const q=g;exports.Content=q; | ||
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; | ||
//# 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{createContext as a}from"@radix-ui/react-context";import{composeEventHandlers as l}from"@radix-ui/primitive";import*as s from"react";import d from"@babel/runtime/helpers/esm/extends";const[p,c]=a("Collapsible");export const Collapsible=/*#__PURE__*/s.forwardRef(((t,r)=>{const{open:n,defaultOpen:a,disabled:l,onOpenChange:c,...m}=t,[f=!1,b]=i({prop:n,defaultProp:a,onChange:c});/*#__PURE__*/return s.createElement(p,{disabled:l,contentId:e(),open:f,onOpenToggle:s.useCallback((()=>b((e=>!e))),[b])},/*#__PURE__*/s.createElement(o.div,d({"data-state":u(f),"data-disabled":l?"":void 0},m,{ref:r})))}));/*#__PURE__*/export const CollapsibleTrigger=/*#__PURE__*/s.forwardRef(((e,t)=>{const r=c("CollapsibleTrigger");/*#__PURE__*/return s.createElement(o.button,d({"aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":u(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled},e,{ref:t,onClick:l(e.onClick,r.onOpenToggle)}))}));/*#__PURE__*/export const CollapsibleContent=/*#__PURE__*/s.forwardRef(((e,o)=>{const{forceMount:r,...n}=e,i=c("CollapsibleContent");/*#__PURE__*/return s.createElement(t,{present:r||i.open},(({present:e})=>/*#__PURE__*/s.createElement(m,d({},n,{ref:o,present:e}))))}));/*#__PURE__*/const m=/*#__PURE__*/s.forwardRef(((e,t)=>{const{present:i,children:a,...l}=e,p=c("CollapsibleContent"),[m,f]=s.useState(i),b=s.useRef(null),x=r(t,b),C=s.useRef(0),g=C.current,h=s.useRef(0),v=h.current,y=p.open||m;return n((()=>{const e=b.current;if(e){const t=e.style.transition,o=e.style.animation;e.style.transition="none",e.style.animation="none";const r=e.getBoundingClientRect();C.current=r.height,h.current=r.width,e.style.transition=t,e.style.animation=o,f(i)}}),[p.open,i]),/*#__PURE__*/s.createElement(o.div,d({"data-state":u(p.open),"data-disabled":p.disabled?"":void 0,id:p.contentId,hidden:!y},l,{ref:x,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...e.style}}),y&&a)}));function u(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 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; | ||
//# sourceMappingURL=index.module.js.map |
{ | ||
"name": "@radix-ui/react-collapsible", | ||
"version": "0.1.1-rc.16", | ||
"version": "0.1.1-rc.17", | ||
"license": "MIT", | ||
@@ -22,6 +22,6 @@ "source": "src/index.ts", | ||
"@radix-ui/react-compose-refs": "0.1.0", | ||
"@radix-ui/react-context": "0.1.0", | ||
"@radix-ui/react-id": "0.1.0", | ||
"@radix-ui/react-presence": "0.1.1-rc.13", | ||
"@radix-ui/react-primitive": "0.1.1-rc.16", | ||
"@radix-ui/react-context": "0.1.1-rc.1", | ||
"@radix-ui/react-id": "0.1.1-rc.1", | ||
"@radix-ui/react-presence": "0.1.1-rc.14", | ||
"@radix-ui/react-primitive": "0.1.1-rc.17", | ||
"@radix-ui/react-use-controllable-state": "0.1.0", | ||
@@ -28,0 +28,0 @@ "@radix-ui/react-use-layout-effect": "0.1.0" |
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
34606
55
+ Added@radix-ui/react-context@0.1.1-rc.1(transitive)
+ Added@radix-ui/react-id@0.1.1-rc.1(transitive)
+ Added@radix-ui/react-presence@0.1.1-rc.14(transitive)
+ Added@radix-ui/react-primitive@0.1.1-rc.17(transitive)
+ Added@radix-ui/react-slot@0.1.1-rc.13(transitive)
- Removed@radix-ui/react-context@0.1.0(transitive)
- Removed@radix-ui/react-id@0.1.0(transitive)
- Removed@radix-ui/react-presence@0.1.1-rc.13(transitive)
- Removed@radix-ui/react-primitive@0.1.1-rc.16(transitive)
- Removed@radix-ui/react-slot@0.1.1-rc.12(transitive)