@interop-ui/react-collapsible
Advanced tools
Comparing version 0.0.1-5 to 0.0.1-6
@@ -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 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}; | ||
//# sourceMappingURL=index.module.js.map |
{ | ||
"name": "@interop-ui/react-collapsible", | ||
"version": "0.0.1-5", | ||
"version": "0.0.1-6", | ||
"license": "MIT", | ||
@@ -21,3 +21,3 @@ "source": "src/index.ts", | ||
"dependencies": { | ||
"@interop-ui/react-utils": "0.0.1-5", | ||
"@interop-ui/react-utils": "0.0.1-6", | ||
"@interop-ui/utils": "0.0.1-3" | ||
@@ -24,0 +24,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39977
+ Added@interop-ui/react-utils@0.0.1-6(transitive)
- Removed@interop-ui/react-utils@0.0.1-5(transitive)