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
4
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-10 to 0.0.1-11

2

dist/index.js

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

var e,t,r=require("@interop-ui/react-utils"),n=r.createContext,o=r.createStyleObj,i=r.forwardRef,l=r.useId,a=r.composeEventHandlers,u=r.useControlledState,c=require("@interop-ui/utils").cssReset,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 f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach((function(t){d(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(){return(b=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 y(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function O(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,i=void 0;try{for(var l,a=e[Symbol.iterator]();!(n=(l=a.next()).done)&&(r.push(l.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return v(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 v(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 v(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 g=O(n("CollapsibleContext","Collapsible"),2),m=g[0],h=g[1],j=i((function(e,t){var r=e.as,n=void 0===r?"button":r,o=e.onClick,i=y(e,["as","onClick"]),l=h("Collapsible.Button");return s.createElement(n,b({},E("button"),{ref:t,"aria-controls":l.contentId,"aria-expanded":l.isOpen||!1},i,{onClick:a(o,l.toggle),disabled:l.isDisabled}))})),C=i((function(e,t){var r=e.as,n=void 0===r?"div":r,o=e.id,i=e.children,a=y(e,["as","id","children"]),u=h("Collapsible.Content"),c=u.setContentId,f=u.isOpen,p="collapsible-".concat(l()),d=o||p;return s.useEffect((function(){c(d)}),[d,c]),s.createElement(n,b({},E("content"),{ref:t},a,{id:d,hidden:!f}),f&&i)})),w=i((function(e,t){var r=e.as,n=void 0===r?"div":r,o=(e.id,e.children),i=e.isOpen,l=e.defaultIsOpen,a=e.disabled,c=e.onToggle,f=y(e,["as","id","children","isOpen","defaultIsOpen","disabled","onToggle"]),p=O(u({prop:i,defaultProp:l,onChange:c}),2),d=p[0],v=p[1],g=O(s.useState(),2),h=g[0],j=g[1],C=s.useMemo((function(){return{contentId:h,isOpen:d,isDisabled:a,toggle:function(){return v((function(e){return!e}))},setContentId:j}}),[h,a,d,v]);return s.createElement(n,b({},E("root"),f,{ref:t}),s.createElement(m.Provider,{value:C},o))}));exports.Collapsible=w,w.Button=j,w.Content=C,w.displayName="Collapsible",w.Button.displayName="Collapsible.Button",w.Content.displayName="Collapsible.Content";var P=O(o("Collapsible",{root:p({},c("div")),button:p(p({},c("button")),{},{display:"block",width:"100%",textAlign:"inherit",userSelect:"none","&:disabled":{pointerEvents:"none"}}),content:p({},c("div"))}),2),S=P[0],E=P[1];exports.styles=S;
var e,t,r=require("@interop-ui/react-utils"),n=r.createContext,o=r.createStyleObj,i=r.forwardRef,l=r.useId,a=r.composeEventHandlers,u=r.useControlledState,c=require("@interop-ui/utils").cssReset,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 f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach((function(t){d(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function d(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b(){return(b=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 y(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function O(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,i=void 0;try{for(var l,a=e[Symbol.iterator]();!(n=(l=a.next()).done)&&(r.push(l.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==a.return||a.return()}finally{if(o)throw i}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return v(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 v(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 v(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 g=O(n("CollapsibleContext","Collapsible"),2),m=g[0],h=g[1],j=i((function(e,t){var r=e.as,n=void 0===r?"button":r,o=e.onClick,i=y(e,["as","onClick"]),l=h("Collapsible.Button");return s.createElement(n,b({},E("button"),{ref:t,"aria-controls":l.contentId,"aria-expanded":l.isOpen||!1,"data-state":I(l.isOpen)},i,{onClick:a(o,l.toggle),disabled:l.isDisabled}))})),C=i((function(e,t){var r=e.as,n=void 0===r?"div":r,o=e.id,i=e.children,a=y(e,["as","id","children"]),u=h("Collapsible.Content"),c=u.setContentId,f=u.isOpen,p="collapsible-".concat(l()),d=o||p;return s.useEffect((function(){c(d)}),[d,c]),s.createElement(n,b({},E("content"),{ref:t},a,{id:d,hidden:!f}),f&&i)})),w=i((function(e,t){var r=e.as,n=void 0===r?"div":r,o=(e.id,e.children),i=e.isOpen,l=e.defaultIsOpen,a=e.disabled,c=e.onToggle,f=y(e,["as","id","children","isOpen","defaultIsOpen","disabled","onToggle"]),p=O(u({prop:i,defaultProp:l,onChange:c}),2),d=p[0],v=p[1],g=O(s.useState(),2),h=g[0],j=g[1],C=s.useMemo((function(){return{contentId:h,isOpen:d,isDisabled:a,toggle:function(){return v((function(e){return!e}))},setContentId:j}}),[h,a,d,v]);return s.createElement(n,b({},E("root"),f,{"data-state":I(C.isOpen),ref:t}),s.createElement(m.Provider,{value:C},o))}));exports.Collapsible=w,w.Button=j,w.Content=C,w.displayName="Collapsible",w.Button.displayName="Collapsible.Button",w.Content.displayName="Collapsible.Content";var P=O(o("Collapsible",{root:p({},c("div")),button:p(p({},c("button")),{},{display:"block",width:"100%",textAlign:"inherit",userSelect:"none","&:disabled":{pointerEvents:"none"}}),content:p({},c("div"))}),2),S=P[0],E=P[1];function I(e){return e?"open":"closed"}exports.styles=S;
//# sourceMappingURL=index.js.map

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

import{createContext as e,createStyleObj as t,forwardRef as n,useId as r,composeEventHandlers as o,useControlledState as l}from"@interop-ui/react-utils";import{cssReset as i}from"@interop-ui/utils";import*as a from"react";function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){p(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function b(){return(b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function u(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}const[d,f]=e("CollapsibleContext","Collapsible"),O="button",y=n(((e,t)=>{const{as:n=O,onClick:r}=e,l=u(e,["as","onClick"]),i=f("Collapsible.Button");return a.createElement(n,b({},h("button"),{ref:t,"aria-controls":i.contentId,"aria-expanded":i.isOpen||!1},l,{onClick:o(r,i.toggle),disabled:i.isDisabled}))})),C="div",g=n(((e,t)=>{const{as:n=C,id:o,children:l}=e,i=u(e,["as","id","children"]),{setContentId:s,isOpen:c}=f("Collapsible.Content"),p="collapsible-".concat(r()),d=o||p;return a.useEffect((()=>{s(d)}),[d,s]),a.createElement(n,b({},h("content"),{ref:t},i,{id:d,hidden:!c}),c&&l)})),m="div";export const Collapsible=n(((e,t)=>{const{as:n=m,id:r,children:o,isOpen:i,defaultIsOpen:s,disabled:c,onToggle:p}=e,f=u(e,["as","id","children","isOpen","defaultIsOpen","disabled","onToggle"]),[O,y]=l({prop:i,defaultProp:s,onChange:p}),[C,g]=a.useState(),j=a.useMemo((()=>({contentId:C,isOpen:O,isDisabled:c,toggle:()=>y((e=>!e)),setContentId:g})),[C,c,O,y]);return a.createElement(n,b({},h("root"),f,{ref:t}),a.createElement(d.Provider,{value:j},o))}));Collapsible.Button=y,Collapsible.Content=g,Collapsible.displayName="Collapsible",Collapsible.Button.displayName="Collapsible.Button",Collapsible.Content.displayName="Collapsible.Content";const[j,h]=t("Collapsible",{root:c({},i(m)),button:c(c({},i(O)),{},{display:"block",width:"100%",textAlign:"inherit",userSelect:"none","&:disabled":{pointerEvents:"none"}}),content:c({},i(C))});export{j as styles};
import{createContext as e,createStyleObj as t,forwardRef as n,useId as r,composeEventHandlers as o,useControlledState as l}from"@interop-ui/react-utils";import{cssReset as i}from"@interop-ui/utils";import*as a from"react";function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach((function(t){p(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function b(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},l=Object.keys(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r<l.length;r++)n=l[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}const[d,f]=e("CollapsibleContext","Collapsible"),O="button",y=n(((e,t)=>{const{as:n=O,onClick:r}=e,l=b(e,["as","onClick"]),i=f("Collapsible.Button");return a.createElement(n,u({},h("button"),{ref:t,"aria-controls":i.contentId,"aria-expanded":i.isOpen||!1,"data-state":v(i.isOpen)},l,{onClick:o(r,i.toggle),disabled:i.isDisabled}))})),C="div",g=n(((e,t)=>{const{as:n=C,id:o,children:l}=e,i=b(e,["as","id","children"]),{setContentId:s,isOpen:c}=f("Collapsible.Content"),p="collapsible-".concat(r()),d=o||p;return a.useEffect((()=>{s(d)}),[d,s]),a.createElement(n,u({},h("content"),{ref:t},i,{id:d,hidden:!c}),c&&l)})),m="div";export const Collapsible=n(((e,t)=>{const{as:n=m,id:r,children:o,isOpen:i,defaultIsOpen:s,disabled:c,onToggle:p}=e,f=b(e,["as","id","children","isOpen","defaultIsOpen","disabled","onToggle"]),[O,y]=l({prop:i,defaultProp:s,onChange:p}),[C,g]=a.useState(),j=a.useMemo((()=>({contentId:C,isOpen:O,isDisabled:c,toggle:()=>y((e=>!e)),setContentId:g})),[C,c,O,y]);return a.createElement(n,u({},h("root"),f,{"data-state":v(j.isOpen),ref:t}),a.createElement(d.Provider,{value:j},o))}));Collapsible.Button=y,Collapsible.Content=g,Collapsible.displayName="Collapsible",Collapsible.Button.displayName="Collapsible.Button",Collapsible.Content.displayName="Collapsible.Content";const[j,h]=t("Collapsible",{root:c({},i(m)),button:c(c({},i(O)),{},{display:"block",width:"100%",textAlign:"inherit",userSelect:"none","&:disabled":{pointerEvents:"none"}}),content:c({},i(C))});export{j as styles};function v(e){return e?"open":"closed"}
//# sourceMappingURL=index.module.js.map
{
"name": "@interop-ui/react-collapsible",
"version": "0.0.1-10",
"version": "0.0.1-11",
"license": "MIT",

@@ -21,3 +21,3 @@ "source": "src/index.ts",

"dependencies": {
"@interop-ui/react-utils": "0.0.1-10",
"@interop-ui/react-utils": "0.0.1-11",
"@interop-ui/utils": "0.0.1-3"

@@ -29,4 +29,4 @@ },

"peerDependencies": {
"react": ">=16"
"react": "^16.8 || ^17.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