@radix-ui/react-collapsible
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -1,2 +0,2 @@ | ||
var e,t,r=require("@radix-ui/react-presence").Presence,n=require("@radix-ui/react-primitive").Primitive,o=require("@radix-ui/utils").getSelector,l=require("@radix-ui/react-utils"),a=l.createContext,i=l.useId,u=l.composeEventHandlers,c=l.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 d(){return(d=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 p(e,t){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},l=Object.keys(e);for(n=0;n<l.length;n++)r=l[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)r=l[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,l=void 0;try{for(var a,i=e[Symbol.iterator]();!(n=(a=i.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,l=e}finally{try{n||null==i.return||i.return()}finally{if(o)throw l}}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(a("CollapsibleContext","Collapsible"),2),y=v[0],C=v[1],m=s.forwardRef((function(e,t){var r=e.selector,l=void 0===r?o("Collapsible"):r,a=(e.id,e.children),i=e.open,u=e.defaultOpen,b=e.disabled,v=e.onOpenChange,C=p(e,["selector","id","children","open","defaultOpen","disabled","onOpenChange"]),m=f(c({prop:i,defaultProp:u,onChange:v}),2),h=m[0],g=void 0!==h&&h,x=m[1],j=f(s.useState(),2),S=j[0],w=j[1],E=s.useMemo((function(){return{contentId:S,open:g,disabled:b,toggle:function(){return x((function(e){return!e}))},setContentId:w}}),[S,b,g,x]);return s.createElement(n,d({},C,{selector:l,"data-state":O(E.open),ref:t}),s.createElement(y.Provider,{value:E},a))}));exports.Collapsible=m,m.displayName="Collapsible";var h=s.forwardRef((function(e,t){var r=e.as,l=void 0===r?"button":r,a=e.selector,i=void 0===a?o("CollapsibleButton"):a,c=e.onClick,f=p(e,["as","selector","onClick"]),b=C("CollapsibleButton");return s.createElement(n,d({"aria-controls":b.contentId,"aria-expanded":b.open||!1,"data-state":O(b.open)},f,{as:l,selector:i,ref:t,onClick:u(c,b.toggle),disabled:b.disabled}))}));exports.CollapsibleButton=h,h.displayName="CollapsibleButton";var g=s.forwardRef((function(e,t){var l=e.selector,a=void 0===l?o("CollapsibleContent"):l,u=e.id,c=e.forceMount,f=e.children,b=p(e,["selector","id","forceMount","children"]),v=C("CollapsibleContent"),y=v.setContentId,m=v.open,h="collapsible-".concat(i()),g=u||h;return s.useEffect((function(){y(g)}),[g,y]),s.createElement(r,{present:c||m},(function(e){var r=e.present;return s.createElement(n,d({},b,{selector:a,ref:t,id:g,hidden:!r,"data-state":O(m)}),r&&f)}))}));function O(e){return e?"open":"closed"}exports.CollapsibleContent=g,g.displayName="CollapsibleContent";var x=m;exports.Root=x;var j=h;exports.Button=j;var S=g;exports.Content=S; | ||
var e,t,r=require("@radix-ui/react-presence").Presence,n=require("@radix-ui/react-primitive").Primitive,o=require("@radix-ui/utils").getSelector,a=require("@radix-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 d(){return(d=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 p(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=s.forwardRef((function(e,t){var r=e.selector,a=void 0===r?o("Collapsible"):r,l=(e.id,e.open),i=e.defaultOpen,u=e.disabled,b=e.onOpenChange,v=p(e,["selector","id","open","defaultOpen","disabled","onOpenChange"]),C=f(c({prop:l,defaultProp:i,onChange:b}),2),m=C[0],g=void 0!==m&&m,h=C[1],x=f(s.useState(),2),j=x[0],S=x[1],w=s.useMemo((function(){return{contentId:j,open:g,disabled:u,toggle:function(){return h((function(e){return!e}))},setContentId:S}}),[j,u,g,h]);return s.createElement(y.Provider,{value:w},s.createElement(n,d({},v,{selector:a,"data-state":O(w.open),ref:t})))}));exports.Collapsible=m,m.displayName="Collapsible";var g=s.forwardRef((function(e,t){var r=e.as,a=void 0===r?"button":r,l=e.selector,i=void 0===l?o("CollapsibleButton"):l,c=e.onClick,f=p(e,["as","selector","onClick"]),b=C("CollapsibleButton");return s.createElement(n,d({"aria-controls":b.contentId,"aria-expanded":b.open||!1,"data-state":O(b.open)},f,{as:a,selector:i,ref:t,onClick:u(c,b.toggle),disabled:b.disabled}))}));exports.CollapsibleButton=g,g.displayName="CollapsibleButton";var h=s.forwardRef((function(e,t){var a=e.selector,l=void 0===a?o("CollapsibleContent"):a,u=e.id,c=e.forceMount,f=e.children,b=p(e,["selector","id","forceMount","children"]),v=C("CollapsibleContent"),y=v.setContentId,m=v.open,g="collapsible-".concat(i()),h=u||g;return s.useEffect((function(){y(h)}),[h,y]),s.createElement(r,{present:c||m},(function(e){var r=e.present;return s.createElement(n,d({},b,{selector:l,ref:t,id:h,hidden:!r,"data-state":O(m)}),r&&f)}))}));function O(e){return e?"open":"closed"}exports.CollapsibleContent=h,h.displayName="CollapsibleContent";var x=m;exports.Root=x;var j=g;exports.Button=j;var S=h;exports.Content=S; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import{Presence as e}from"@radix-ui/react-presence";import{Primitive as t}from"@radix-ui/react-primitive";import{getSelector as o}from"@radix-ui/utils";import{createContext as n,useId as r,composeEventHandlers as l,useControlledState as a}from"@radix-ui/react-utils";import*as s from"react";function i(){return(i=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 c(e,t){if(null==e)return{};var o,n,r=function(e,t){if(null==e)return{};var o,n,r={},l=Object.keys(e);for(n=0;n<l.length;n++)o=l[n],t.indexOf(o)>=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)o=l[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}const p="Collapsible",[d,u]=n("CollapsibleContext",p);export const Collapsible=s.forwardRef(((e,n)=>{const{selector:r=o(p),id:l,children:u,open:f,defaultOpen:b,disabled:C,onOpenChange:O}=e,x=c(e,["selector","id","children","open","defaultOpen","disabled","onOpenChange"]),[g=!1,h]=a({prop:f,defaultProp:b,onChange:O}),[y,v]=s.useState(),E=s.useMemo((()=>({contentId:y,open:g,disabled:C,toggle:()=>h((e=>!e)),setContentId:v})),[y,C,g,h]);return s.createElement(t,i({},x,{selector:r,"data-state":m(E.open),ref:n}),s.createElement(d.Provider,{value:E},u))}));Collapsible.displayName=p;const f="CollapsibleButton",b="button";export const CollapsibleButton=s.forwardRef(((e,n)=>{const{as:r=b,selector:a=o(f),onClick:p}=e,d=c(e,["as","selector","onClick"]),C=u(f);return s.createElement(t,i({"aria-controls":C.contentId,"aria-expanded":C.open||!1,"data-state":m(C.open)},d,{as:r,selector:a,ref:n,onClick:l(p,C.toggle),disabled:C.disabled}))}));CollapsibleButton.displayName=f;const C="CollapsibleContent";export const CollapsibleContent=s.forwardRef(((n,l)=>{const{selector:a=o(C),id:p,forceMount:d,children:f}=n,b=c(n,["selector","id","forceMount","children"]),{setContentId:O,open:x}=u(C),g="collapsible-".concat(r()),h=p||g;return s.useEffect((()=>{O(h)}),[h,O]),s.createElement(e,{present:d||x},(({present:e})=>s.createElement(t,i({},b,{selector:a,ref:l,id:h,hidden:!e,"data-state":m(x)}),e&&f)))}));function m(e){return e?"open":"closed"}CollapsibleContent.displayName=C;export const Root=Collapsible;export const Button=CollapsibleButton;export const Content=CollapsibleContent; | ||
import{Presence as e}from"@radix-ui/react-presence";import{Primitive as t}from"@radix-ui/react-primitive";import{getSelector as o}from"@radix-ui/utils";import{createContext as n,useId as r,composeEventHandlers as l,useControlledState as a}from"@radix-ui/react-utils";import*as s from"react";function i(){return(i=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 c(e,t){if(null==e)return{};var o,n,r=function(e,t){if(null==e)return{};var o,n,r={},l=Object.keys(e);for(n=0;n<l.length;n++)o=l[n],t.indexOf(o)>=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n<l.length;n++)o=l[n],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}const p="Collapsible",[d,u]=n("CollapsibleContext",p);export const Collapsible=s.forwardRef(((e,n)=>{const{selector:r=o(p),id:l,open:u,defaultOpen:f,disabled:b,onOpenChange:C}=e,O=c(e,["selector","id","open","defaultOpen","disabled","onOpenChange"]),[x=!1,g]=a({prop:u,defaultProp:f,onChange:C}),[y,h]=s.useState(),v=s.useMemo((()=>({contentId:y,open:x,disabled:b,toggle:()=>g((e=>!e)),setContentId:h})),[y,b,x,g]);return s.createElement(d.Provider,{value:v},s.createElement(t,i({},O,{selector:r,"data-state":m(v.open),ref:n})))}));Collapsible.displayName=p;const f="CollapsibleButton",b="button";export const CollapsibleButton=s.forwardRef(((e,n)=>{const{as:r=b,selector:a=o(f),onClick:p}=e,d=c(e,["as","selector","onClick"]),C=u(f);return s.createElement(t,i({"aria-controls":C.contentId,"aria-expanded":C.open||!1,"data-state":m(C.open)},d,{as:r,selector:a,ref:n,onClick:l(p,C.toggle),disabled:C.disabled}))}));CollapsibleButton.displayName=f;const C="CollapsibleContent";export const CollapsibleContent=s.forwardRef(((n,l)=>{const{selector:a=o(C),id:p,forceMount:d,children:f}=n,b=c(n,["selector","id","forceMount","children"]),{setContentId:O,open:x}=u(C),g="collapsible-".concat(r()),y=p||g;return s.useEffect((()=>{O(y)}),[y,O]),s.createElement(e,{present:d||x},(({present:e})=>s.createElement(t,i({},b,{selector:a,ref:l,id:y,hidden:!e,"data-state":m(x)}),e&&f)))}));function m(e){return e?"open":"closed"}CollapsibleContent.displayName=C;export const Root=Collapsible;export const Button=CollapsibleButton;export const Content=CollapsibleContent; | ||
//# sourceMappingURL=index.module.js.map |
{ | ||
"name": "@radix-ui/react-collapsible", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"license": "MIT", | ||
@@ -19,6 +19,6 @@ "source": "src/index.ts", | ||
"dependencies": { | ||
"@radix-ui/react-polymorphic": "0.0.3", | ||
"@radix-ui/react-presence": "0.0.3", | ||
"@radix-ui/react-primitive": "0.0.2", | ||
"@radix-ui/react-utils": "0.0.3", | ||
"@radix-ui/react-polymorphic": "0.0.4", | ||
"@radix-ui/react-presence": "0.0.4", | ||
"@radix-ui/react-primitive": "0.0.3", | ||
"@radix-ui/react-utils": "0.0.4", | ||
"@radix-ui/utils": "0.0.3" | ||
@@ -25,0 +25,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
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
28620
+ Added@radix-ui/react-polymorphic@0.0.4(transitive)
+ Added@radix-ui/react-presence@0.0.4(transitive)
+ Added@radix-ui/react-primitive@0.0.3(transitive)
+ Added@radix-ui/react-utils@0.0.4(transitive)
- Removed@radix-ui/react-polymorphic@0.0.3(transitive)
- Removed@radix-ui/react-presence@0.0.3(transitive)
- Removed@radix-ui/react-primitive@0.0.2(transitive)
- Removed@radix-ui/react-utils@0.0.3(transitive)
Updated@radix-ui/react-utils@0.0.4