Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@interop-ui/react-collapsible

Package Overview
Dependencies
Maintainers
3
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@interop-ui/react-collapsible - npm Package Compare versions

Comparing version 0.0.1-16 to 0.2.0-rc.1

30

dist/index.d.ts

@@ -1,2 +0,6 @@

type CollapsibleOwnProps = {
import * as React from "react";
import * as Radix from "@interop-ui/react-primitive";
import { Primitive } from "@interop-ui/react-primitive";
type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
export interface CollapsibleProps extends PrimitiveDivProps {
defaultOpen?: boolean;

@@ -6,6 +10,9 @@ open?: boolean;

onOpenChange?(open?: boolean): void;
};
export const Collapsible: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"div", CollapsibleOwnProps>;
export const CollapsibleButton: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"button", {}>;
type CollapsibleContentOwnProps = {
}
export const Collapsible: React.ForwardRefExoticComponent<CollapsibleProps & React.RefAttributes<HTMLDivElement>>;
type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
export interface CollapsibleTriggerProps extends PrimitiveButtonProps {
}
export const CollapsibleTrigger: React.ForwardRefExoticComponent<CollapsibleTriggerProps & React.RefAttributes<HTMLButtonElement>>;
export interface CollapsibleContentProps extends Omit<CollapsibleContentImplProps, 'present'> {
/**

@@ -16,8 +23,11 @@ * Used to force mounting when more control is needed. Useful when

forceMount?: true;
};
export const CollapsibleContent: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"div", CollapsibleContentOwnProps>;
export const Root: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"div", CollapsibleOwnProps>;
export const Button: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"button", {}>;
export const Content: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"div", CollapsibleContentOwnProps>;
}
export const CollapsibleContent: React.ForwardRefExoticComponent<CollapsibleContentProps & React.RefAttributes<HTMLDivElement>>;
interface CollapsibleContentImplProps extends PrimitiveDivProps {
present: boolean;
}
export const Root: React.ForwardRefExoticComponent<CollapsibleProps & React.RefAttributes<HTMLDivElement>>;
export const Trigger: React.ForwardRefExoticComponent<CollapsibleTriggerProps & React.RefAttributes<HTMLButtonElement>>;
export const Content: React.ForwardRefExoticComponent<CollapsibleContentProps & React.RefAttributes<HTMLDivElement>>;
//# sourceMappingURL=index.d.ts.map

@@ -1,2 +0,2 @@

var e,t,r=require("@interop-ui/react-presence").Presence,n=require("@interop-ui/react-polymorphic").forwardRefWithAs,o=require("@interop-ui/utils").getPartDataAttrObj,a=require("@interop-ui/react-utils"),l=a.createContext,i=a.useId,u=a.composeEventHandlers,c=a.useControlledState,s=(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);function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function d(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,o=!1,a=void 0;try{for(var l,i=e[Symbol.iterator]();!(n=(l=i.next()).done)&&(r.push(l.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==i.return||i.return()}finally{if(o)throw a}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return b(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return b(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var v=f(l("CollapsibleContext","Collapsible"),2),y=v[0],C=v[1],m=n((function(e,t){var r=e.as,n=void 0===r?"div":r,a=(e.id,e.children),l=e.open,i=e.defaultOpen,u=e.disabled,b=e.onOpenChange,v=d(e,["as","id","children","open","defaultOpen","disabled","onOpenChange"]),C=f(c({prop:l,defaultProp:i,onChange:b}),2),m=C[0],h=void 0!==m&&m,g=C[1],j=f(s.useState(),2),x=j[0],E=j[1],S=s.useMemo((function(){return{contentId:x,open:h,disabled:u,toggle:function(){return g((function(e){return!e}))},setContentId:E}}),[x,u,h,g]);return s.createElement(n,p({},o("Collapsible"),v,{"data-state":O(S.open),ref:t}),s.createElement(y.Provider,{value:S},a))}));exports.Collapsible=m,m.displayName="Collapsible";var h=n((function(e,t){var r=e.as,n=void 0===r?"button":r,a=e.onClick,l=d(e,["as","onClick"]),i=C("CollapsibleButton");return s.createElement(n,p({},o("CollapsibleButton"),{ref:t,"aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":O(i.open)},l,{onClick:u(a,i.toggle),disabled:i.disabled}))}));exports.CollapsibleButton=h,h.displayName="CollapsibleButton";var g=n((function(e,t){var n=e.as,a=void 0===n?"div":n,l=e.id,u=e.forceMount,c=e.children,f=d(e,["as","id","forceMount","children"]),b=C("CollapsibleContent"),v=b.setContentId,y=b.open,m="collapsible-".concat(i()),h=l||m;return s.useEffect((function(){v(h)}),[h,v]),s.createElement(r,{present:u||y},(function(e){var r=e.present;return s.createElement(a,p({},f,o("CollapsibleContent"),{ref:t,id:h,hidden:!r,"data-state":O(y)}),r&&c)}))}));function O(e){return e?"open":"closed"}exports.CollapsibleContent=g,g.displayName="CollapsibleContent";var j=m;exports.Root=j;var x=h;exports.Button=x;var E=g;exports.Content=E;
var e,t,n,r=require("@interop-ui/react-id").useId,o=require("@interop-ui/react-presence").Presence,i=require("@interop-ui/react-primitive").Primitive,a=require("@interop-ui/react-compose-refs").useComposedRefs,s=require("@interop-ui/react-use-layout-effect").useLayoutEffect,l=require("@interop-ui/react-use-controllable-state").useControllableState,c=require("@interop-ui/react-context").createContext,d=require("@interop-ui/primitive").composeEventHandlers,u=(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),p=(n=require("@babel/runtime/helpers/extends"))&&n.__esModule?n.default:n;const[f,b]=c("Collapsible"),C=/*#__PURE__*/u.forwardRef(((e,t)=>{const{open:n,defaultOpen:o,disabled:a,onOpenChange:s,...c}=e,[d=!1,b]=l({prop:n,defaultProp:o,onChange:s});/*#__PURE__*/return u.createElement(f,{disabled:a,contentId:r(),open:d,onOpenToggle:u.useCallback((()=>b((e=>!e))),[b])},/*#__PURE__*/u.createElement(i.div,p({"data-state":y(d),"data-disabled":a?"":void 0},c,{ref:t})))}));exports.Collapsible=C;const g=/*#__PURE__*/u.forwardRef(((e,t)=>{const n=b("CollapsibleTrigger");/*#__PURE__*/return u.createElement(i.button,p({"aria-controls":n.contentId,"aria-expanded":n.open||!1,"data-state":y(n.open),"data-disabled":n.disabled?"":void 0,disabled:n.disabled},e,{ref:t,onClick:d(e.onClick,n.onOpenToggle)}))}));exports.CollapsibleTrigger=g;const m=/*#__PURE__*/u.forwardRef(((e,t)=>{const{forceMount:n,...r}=e,i=b("CollapsibleContent");/*#__PURE__*/return u.createElement(o,{present:n||i.open},(({present:e})=>/*#__PURE__*/u.createElement(x,p({},r,{ref:t,present:e}))))}));exports.CollapsibleContent=m;const x=/*#__PURE__*/u.forwardRef(((e,t)=>{const{present:n,children:r,...o}=e,l=b("CollapsibleContent"),[c,d]=u.useState(n),f=u.useRef(null),C=a(t,f),g=u.useRef(0),m=g.current,x=l.open||c;return s((()=>{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,e.style.transition=t,e.style.animation=r,d(n)}}),[l.open,n]),/*#__PURE__*/u.createElement(i.div,p({"data-state":y(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!x},o,{ref:C,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,...e.style}}),x&&r)}));function y(e){return e?"open":"closed"}const v=C;exports.Root=v;const h=g;exports.Trigger=h;const q=m;exports.Content=q;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import{Presence as e}from"@interop-ui/react-presence";import{forwardRefWithAs as t}from"@interop-ui/react-polymorphic";import{getPartDataAttrObj as o}from"@interop-ui/utils";import{createContext as n,useId as l,composeEventHandlers as r,useControlledState as a}from"@interop-ui/react-utils";import*as i from"react";function p(){return(p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])}return e}).apply(this,arguments)}function s(e,t){if(null==e)return{};var o,n,l=function(e,t){if(null==e)return{};var o,n,l={},r=Object.keys(e);for(n=0;n<r.length;n++)o=r[n],t.indexOf(o)>=0||(l[o]=e[o]);return l}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)o=r[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(l[o]=e[o])}return l}const c="div",[d,u]=n("CollapsibleContext","Collapsible");export const Collapsible=t(((e,t)=>{const{as:n=c,id:l,children:r,open:u,defaultOpen:b,disabled:C,onOpenChange:m}=e,O=s(e,["as","id","children","open","defaultOpen","disabled","onOpenChange"]),[h=!1,y]=a({prop:u,defaultProp:b,onChange:m}),[g,v]=i.useState(),x=i.useMemo((()=>({contentId:g,open:h,disabled:C,toggle:()=>y((e=>!e)),setContentId:v})),[g,C,h,y]);return i.createElement(n,p({},o("Collapsible"),O,{"data-state":f(x.open),ref:t}),i.createElement(d.Provider,{value:x},r))}));Collapsible.displayName="Collapsible";const b="button";export const CollapsibleButton=t(((e,t)=>{const{as:n=b,onClick:l}=e,a=s(e,["as","onClick"]),c=u("CollapsibleButton");return i.createElement(n,p({},o("CollapsibleButton"),{ref:t,"aria-controls":c.contentId,"aria-expanded":c.open||!1,"data-state":f(c.open)},a,{onClick:r(l,c.toggle),disabled:c.disabled}))}));CollapsibleButton.displayName="CollapsibleButton";const C="div";export const CollapsibleContent=t(((t,n)=>{const{as:r=C,id:a,forceMount:c,children:d}=t,b=s(t,["as","id","forceMount","children"]),{setContentId:m,open:O}=u("CollapsibleContent"),h="collapsible-".concat(l()),y=a||h;return i.useEffect((()=>{m(y)}),[y,m]),i.createElement(e,{present:c||O},(({present:e})=>i.createElement(r,p({},b,o("CollapsibleContent"),{ref:n,id:y,hidden:!e,"data-state":f(O)}),e&&d)))}));function f(e){return e?"open":"closed"}CollapsibleContent.displayName="CollapsibleContent";export const Root=Collapsible;export const Button=CollapsibleButton;export const Content=CollapsibleContent;
import{useId as e}from"@interop-ui/react-id";import{Presence as t}from"@interop-ui/react-presence";import{Primitive as o}from"@interop-ui/react-primitive";import{useComposedRefs as n}from"@interop-ui/react-compose-refs";import{useLayoutEffect as r}from"@interop-ui/react-use-layout-effect";import{useControllableState as i}from"@interop-ui/react-use-controllable-state";import{createContext as a}from"@interop-ui/react-context";import{composeEventHandlers as l}from"@interop-ui/primitive";import*as s from"react";import p from"@babel/runtime/helpers/esm/extends";const[c,d]=a("Collapsible");export const Collapsible=/*#__PURE__*/s.forwardRef(((t,n)=>{const{open:r,defaultOpen:a,disabled:l,onOpenChange:d,...m}=t,[u=!1,b]=i({prop:r,defaultProp:a,onChange:d});/*#__PURE__*/return s.createElement(c,{disabled:l,contentId:e(),open:u,onOpenToggle:s.useCallback((()=>b((e=>!e))),[b])},/*#__PURE__*/s.createElement(o.div,p({"data-state":f(u),"data-disabled":l?"":void 0},m,{ref:n})))}));/*#__PURE__*/export const CollapsibleTrigger=/*#__PURE__*/s.forwardRef(((e,t)=>{const n=d("CollapsibleTrigger");/*#__PURE__*/return s.createElement(o.button,p({"aria-controls":n.contentId,"aria-expanded":n.open||!1,"data-state":f(n.open),"data-disabled":n.disabled?"":void 0,disabled:n.disabled},e,{ref:t,onClick:l(e.onClick,n.onOpenToggle)}))}));/*#__PURE__*/export const CollapsibleContent=/*#__PURE__*/s.forwardRef(((e,o)=>{const{forceMount:n,...r}=e,i=d("CollapsibleContent");/*#__PURE__*/return s.createElement(t,{present:n||i.open},(({present:e})=>/*#__PURE__*/s.createElement(m,p({},r,{ref:o,present:e}))))}));/*#__PURE__*/const m=/*#__PURE__*/s.forwardRef(((e,t)=>{const{present:i,children:a,...l}=e,c=d("CollapsibleContent"),[m,u]=s.useState(i),b=s.useRef(null),C=n(t,b),g=s.useRef(0),x=g.current,h=c.open||m;return r((()=>{const e=b.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,e.style.transition=t,e.style.animation=o,u(i)}}),[c.open,i]),/*#__PURE__*/s.createElement(o.div,p({"data-state":f(c.open),"data-disabled":c.disabled?"":void 0,id:c.contentId,hidden:!h},l,{ref:C,style:{"--radix-collapsible-content-height":x?`${x}px`:void 0,...e.style}}),h&&a)}));function f(e){return e?"open":"closed"}export const Root=Collapsible;export const Trigger=CollapsibleTrigger;export const Content=CollapsibleContent;
//# sourceMappingURL=index.module.js.map
{
"name": "@interop-ui/react-collapsible",
"version": "0.0.1-16",
"version": "0.2.0-rc.1",
"license": "MIT",

@@ -15,19 +15,28 @@ "source": "src/index.ts",

"scripts": {
"build": "parcel build src/index.ts --no-cache",
"clean": "rm -rf dist",
"version": "yarn version",
"prepublish": "yarn clean && yarn build"
"version": "yarn version"
},
"dependencies": {
"@interop-ui/react-polymorphic": "0.0.1-3",
"@interop-ui/react-presence": "0.0.1-2",
"@interop-ui/react-utils": "0.0.1-16",
"@interop-ui/utils": "0.0.1-8"
"@babel/runtime": "^7.13.10",
"@interop-ui/primitive": "0.2.0-rc.1",
"@interop-ui/react-compose-refs": "0.2.0-rc.1",
"@interop-ui/react-context": "0.2.0-rc.1",
"@interop-ui/react-id": "0.2.0-rc.1",
"@interop-ui/react-presence": "0.2.0-rc.1",
"@interop-ui/react-primitive": "0.2.0-rc.1",
"@interop-ui/react-use-controllable-state": "0.2.0-rc.1",
"@interop-ui/react-use-layout-effect": "0.2.0-rc.1"
},
"devDependencies": {
"parcel": "^2.0.0-beta.1"
},
"peerDependencies": {
"react": "^16.8 || ^17.0"
}
},
"homepage": "https://radix-ui.com/primitives",
"repository": {
"type": "git",
"url": "git+https://github.com/radix-ui/primitives.git"
},
"bugs": {
"url": "https://github.com/radix-ui/primitives/issues"
},
"stableVersion": "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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc