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

@interop-ui/react-accordion

Package Overview
Dependencies
Maintainers
4
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 0.0.1-0 to 0.0.1-1

2

dist/index.js

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

var e,r=require("@interop-ui/react-collapsible"),t=r.Collapsible,n=r.styles,o=require("@interop-ui/react-utils"),i=o.composeEventHandlers,a=o.createContext,u=o.createStyleObj,c=o.forwardRef,l=o.useComposedRefs,d=o.useControlledState,s=o.useId,f=require("@interop-ui/utils").cssReset,b=(e=require("react"))&&e.__esModule?e.default:e;function p(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function y(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?p(Object(t),!0).forEach((function(r){v(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function v(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function m(e){return function(e){if(Array.isArray(e))return w(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||A(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(){return(O=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function g(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)t=i[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function h(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],n=!0,o=!1,i=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(t.push(a.value),!r||t.length!==r);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(o)throw i}}return t}(e,r)||A(e,r)||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 A(e,r){if(e){if("string"==typeof e)return w(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?w(e,r):void 0}}function w(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var j=h(a("AccordionContext","Accordion"),2),E=j[0],P=j[1],I=h(a("AccordionItemContext","Accordion.Item"),2),S=I[0],C=I[1],D=c((function(e,r){var n,o=e.value,i=(e.isOpen,e.defaultIsOpen,e.children),a=(e.onToggle,g(e,["value","isOpen","defaultIsOpen","children","onToggle"])),u=P("Accordion.Item"),c="accordion-button-".concat(s()),l=e.id||c,d=o&&o===u.value||!1,f=b.useMemo((function(){return{isOpen:d,buttonId:l}}),[d,l]);return b.createElement(t,O({},a,q("item"),{ref:r,disabled:null!==(n=u.isDisabled)&&void 0!==n?n:e.disabled,isOpen:d,onToggle:function(){return u.setValue(o)}}),b.createElement(S.Provider,{value:f},i))})),x=c((function(e,r){var t=e.as,n=void 0===t?"h3":t,o=g(e,["as"]);return b.createElement(n,O({ref:r},o,q("header")))})),T=c((function(e,r){var n=Object.assign({},e),o=P("Accordion.Button").buttonNodesRef,i=C("Accordion.Button"),a=b.useRef(null),u=l(a,r);return b.useEffect((function(){var e=o.current,r=a.current;if(r)return e.add(r),function(){e.delete(r)}}),[o]),b.createElement(t.Button,O({},n,q("button"),{ref:u,"aria-disabled":i.isOpen||void 0,id:i.buttonId}))})),N=c((function(e,r){var t=e.as,n=void 0===t?"h3":t,o=g(e,["as"]);return b.createElement(x,{as:n},b.createElement(T,O({},o,{ref:r})))})),R=c((function(e,r){var n=C("Accordion.Panel");return b.createElement(t.Content,O({},e,q("panel"),{ref:r,role:"region","aria-labelledby":n.buttonId}))})),k=["Home","End","ArrowDown","ArrowUp"],B=c((function(e,r){var t=e.as,n=void 0===t?"div":t,o=e.value,a=e.defaultValue,u=e.children,c=e.disabled,s=e.onChange,f=void 0===s?function(){}:s,p=g(e,["as","value","defaultValue","children","disabled","onChange"]),y=b.useRef(new Set),v=b.useRef(null),A=l(v,r),w=h(d({prop:o,defaultProp:a,onChange:function(e){function r(r){return e.apply(this,arguments)}return r.toString=function(){return e.toString()},r}((function(e){return e&&f(e)}))}),2),j=w[0],P=w[1],I=i(e.onKeyDown,(function(e){var r,t=k.includes(e.key),n=e.target,o=m(y.current).filter((function(e){return!(e&&e.disabled)})),i=o.length;if(t&&n instanceof HTMLButtonElement){var a=o.indexOf(n);if(-1!==a){var u=a;switch(e.key){case"Home":u=0;break;case"End":u=i-1;break;case"ArrowDown":u=a+1;break;case"ArrowUp":(u=a-1)<0&&(u=i-1)}null===(r=o[u%i])||void 0===r||r.focus()}}})),S=b.useMemo((function(){return{isDisabled:c,buttonNodesRef:y,value:j,setValue:P}}),[c,j,P]);return b.createElement(n,O({},p,q("root"),{ref:A,onKeyDown:c?void 0:I}),b.createElement(E.Provider,{value:S},u))}));exports.Accordion=B,B.Item=D,B.Header=x,B.Button=T,B.Trigger=N,B.Panel=R,B.displayName="Accordion",B.Item.displayName="Accordion.Item",B.Header.displayName="Accordion.Header",B.Button.displayName="Accordion.Button",B.Trigger.displayName="Accordion.Trigger",B.Panel.displayName="Accordion.Panel";var H=h(u("Accordion",{root:y({},f("div")),item:y(y({},f("div")),n.root),header:y({},f("h3")),button:y(y({},f("button")),n.button),panel:y(y({},f("div")),n.content)}),2),M=H[0],q=H[1];exports.styles=M;
var e,t=require("@interop-ui/react-collapsible"),r=t.Collapsible,n=t.styles,o=require("@interop-ui/react-utils"),i=o.composeEventHandlers,a=o.createContext,u=o.createStyleObj,c=o.forwardRef,l=o.useComposedRefs,d=o.useControlledState,s=o.useId,f=require("@interop-ui/utils").cssReset,b=(e=require("react"))&&e.__esModule?e.default:e;function p(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 y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p(Object(r),!0).forEach((function(t){v(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function v(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function m(e){return function(e){if(Array.isArray(e))return w(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||A(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function O(){return(O=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 g(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 h(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 a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,i=e}finally{try{n||null==u.return||u.return()}finally{if(o)throw i}}return r}(e,t)||A(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 A(e,t){if(e){if("string"==typeof e)return w(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?w(e,t):void 0}}function w(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 j=h(a("AccordionContext","Accordion"),2),P=j[0],I=j[1],S=h(a("AccordionItemContext","Accordion.Item"),2),E=S[0],C=S[1],D=c((function(e,t){var n,o=e.value,i=(e.isOpen,e.defaultIsOpen,e.children),a=(e.onToggle,g(e,["value","isOpen","defaultIsOpen","children","onToggle"])),u=I("Accordion.Item"),c="accordion-button-".concat(s()),l=e.id||c,d=o&&o===u.value||!1,f=b.useMemo((function(){return{isOpen:d,buttonId:l}}),[d,l]);return b.createElement(r,O({},a,M("item"),{ref:t,disabled:null!==(n=u.isDisabled)&&void 0!==n?n:e.disabled,isOpen:d,onToggle:function(){return u.setValue(o)}}),b.createElement(E.Provider,{value:f},i))})),x=c((function(e,t){var r=e.as,n=void 0===r?"h3":r,o=g(e,["as"]);return b.createElement(n,O({ref:t},o,M("header")))})),R=c((function(e,t){var n=Object.assign({},e),o=I("Accordion.Button").buttonNodesRef,i=C("Accordion.Button"),a=b.useRef(null),u=l(a,t);return b.useEffect((function(){var e=o.current,t=a.current;if(t)return e.add(t),function(){e.delete(t)}}),[o]),b.createElement(r.Button,O({},n,M("button"),{ref:u,"aria-disabled":i.isOpen||void 0,id:i.buttonId}))})),k=c((function(e,t){var n=C("Accordion.Panel");return b.createElement(r.Content,O({},e,M("panel"),{ref:t,role:"region","aria-labelledby":n.buttonId}))})),B=["Home","End","ArrowDown","ArrowUp"],H=c((function(e,t){var r=e.as,n=void 0===r?"div":r,o=e.value,a=e.defaultValue,u=e.children,c=e.disabled,s=e.onChange,f=void 0===s?function(){}:s,p=g(e,["as","value","defaultValue","children","disabled","onChange"]),y=b.useRef(new Set),v=b.useRef(null),A=l(v,t),w=h(d({prop:o,defaultProp:a,onChange:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){return e&&f(e)}))}),2),j=w[0],I=w[1],S=i(e.onKeyDown,(function(e){var t,r=B.includes(e.key),n=e.target,o=m(y.current).filter((function(e){return!(e&&e.disabled)})),i=o.length;if(r&&n instanceof HTMLButtonElement){var a=o.indexOf(n);if(-1!==a){var u=a;switch(e.key){case"Home":u=0;break;case"End":u=i-1;break;case"ArrowDown":u=a+1;break;case"ArrowUp":(u=a-1)<0&&(u=i-1)}null===(t=o[u%i])||void 0===t||t.focus()}}})),E=b.useMemo((function(){return{isDisabled:c,buttonNodesRef:y,value:j,setValue:I}}),[c,j,I]);return b.createElement(n,O({},p,M("root"),{ref:A,onKeyDown:c?void 0:S}),b.createElement(P.Provider,{value:E},u))}));exports.Accordion=H,H.Item=D,H.Header=x,H.Button=R,H.Panel=k,H.displayName="Accordion",H.Item.displayName="Accordion.Item",H.Header.displayName="Accordion.Header",H.Button.displayName="Accordion.Button",H.Panel.displayName="Accordion.Panel";var N=h(u("Accordion",{root:y({},f("div")),item:y(y({},f("div")),n.root),header:y({},f("h3")),button:y(y({},f("button")),n.button),panel:y(y({},f("div")),n.content)}),2),T=N[0],M=N[1];exports.styles=T;
//# sourceMappingURL=index.js.map

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

import{Collapsible as e,styles as t}from"@interop-ui/react-collapsible";import{composeEventHandlers as n,createContext as r,createStyleObj as o,forwardRef as c,useComposedRefs as i,useControlledState as a,useId as l}from"@interop-ui/react-utils";import{cssReset as u}from"@interop-ui/utils";import d 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 f(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 m(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},c=Object.keys(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}const[O,g]=r("AccordionContext","Accordion"),[y,v]=r("AccordionItemContext","Accordion.Item"),A=c((function(t,n){var r;const{value:o,isOpen:c,defaultIsOpen:i,children:a,onToggle:u}=t,s=m(t,["value","isOpen","defaultIsOpen","children","onToggle"]),f=g("Accordion.Item"),p="accordion-button-".concat(l()),O=t.id||p,v=o&&o===f.value||!1,A=d.useMemo(()=>({isOpen:v,buttonId:O}),[v,O]);return d.createElement(e,b({},s,x("item"),{ref:n,disabled:null!==(r=f.isDisabled)&&void 0!==r?r:t.disabled,isOpen:v,onToggle:()=>f.setValue(o)}),d.createElement(y.Provider,{value:A},a))})),h="h3",w=c((function(e,t){const{as:n=h}=e,r=m(e,["as"]);return d.createElement(n,b({ref:t},r,x("header")))})),j=c((function(t,n){const r=Object.assign({},t),{buttonNodesRef:o}=g("Accordion.Button"),c=v("Accordion.Button"),a=d.useRef(null),l=i(a,n);return d.useEffect(()=>{const e=o.current,t=a.current;if(t)return e.add(t),()=>{e.delete(t)}},[o]),d.createElement(e.Button,b({},r,x("button"),{ref:l,"aria-disabled":c.isOpen||void 0,id:c.buttonId}))})),P=h,E=c((function(e,t){const{as:n=P}=e,r=m(e,["as"]);return d.createElement(w,{as:n},d.createElement(j,b({},r,{ref:t})))})),I=c((function(t,n){const r=v("Accordion.Panel");return d.createElement(e.Content,b({},t,x("panel"),{ref:n,role:"region","aria-labelledby":r.buttonId}))})),D="div",N=["Home","End","ArrowDown","ArrowUp"];export const Accordion=c((function(e,t){const{as:r=D,value:o,defaultValue:c,children:l,disabled:u,onChange:s=(()=>{})}=e,f=m(e,["as","value","defaultValue","children","disabled","onChange"]),p=d.useRef(new Set),g=d.useRef(null),y=i(g,t),[v,A]=a({prop:o,defaultProp:c,onChange:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(e=>e&&s(e))}),h=n(e.onKeyDown,e=>{var t;const n=N.includes(e.key),r=e.target,o=[...p.current].filter(e=>!(e&&e.disabled)),c=o.length;if(!(n&&(i=r,i instanceof HTMLButtonElement)))return;var i;const a=o.indexOf(r);if(-1===a)return;let l=a;switch(e.key){case"Home":l=0;break;case"End":l=c-1;break;case"ArrowDown":l=a+1;break;case"ArrowUp":l=a-1,l<0&&(l=c-1)}null===(t=o[l%c])||void 0===t||t.focus()}),w=d.useMemo(()=>({isDisabled:u,buttonNodesRef:p,value:v,setValue:A}),[u,v,A]);return d.createElement(r,b({},f,x("root"),{ref:y,onKeyDown:u?void 0:h}),d.createElement(O.Provider,{value:w},l))}));Accordion.Item=A,Accordion.Header=w,Accordion.Button=j,Accordion.Trigger=E,Accordion.Panel=I,Accordion.displayName="Accordion",Accordion.Item.displayName="Accordion.Item",Accordion.Header.displayName="Accordion.Header",Accordion.Button.displayName="Accordion.Button",Accordion.Trigger.displayName="Accordion.Trigger",Accordion.Panel.displayName="Accordion.Panel";const[k,x]=o("Accordion",{root:f({},u(D)),item:f(f({},u("div")),t.root),header:f({},u(h)),button:f(f({},u("button")),t.button),panel:f(f({},u("div")),t.content)});export{k as styles};
import{Collapsible as e,styles as t}from"@interop-ui/react-collapsible";import{composeEventHandlers as n,createContext as r,createStyleObj as o,forwardRef as c,useComposedRefs as i,useControlledState as a,useId as l}from"@interop-ui/react-utils";import{cssReset as u}from"@interop-ui/utils";import d 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 f(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 m(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},c=Object.keys(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}const[O,y]=r("AccordionContext","Accordion"),[v,g]=r("AccordionItemContext","Accordion.Item"),A=c((function(t,n){var r;const{value:o,isOpen:c,defaultIsOpen:i,children:a,onToggle:u}=t,s=m(t,["value","isOpen","defaultIsOpen","children","onToggle"]),f=y("Accordion.Item"),p="accordion-button-".concat(l()),O=t.id||p,g=o&&o===f.value||!1,A=d.useMemo(()=>({isOpen:g,buttonId:O}),[g,O]);return d.createElement(e,b({},s,k("item"),{ref:n,disabled:null!==(r=f.isDisabled)&&void 0!==r?r:t.disabled,isOpen:g,onToggle:()=>f.setValue(o)}),d.createElement(v.Provider,{value:A},a))})),h="h3",w=c((function(e,t){const{as:n=h}=e,r=m(e,["as"]);return d.createElement(n,b({ref:t},r,k("header")))})),j=c((function(t,n){const r=Object.assign({},t),{buttonNodesRef:o}=y("Accordion.Button"),c=g("Accordion.Button"),a=d.useRef(null),l=i(a,n);return d.useEffect(()=>{const e=o.current,t=a.current;if(t)return e.add(t),()=>{e.delete(t)}},[o]),d.createElement(e.Button,b({},r,k("button"),{ref:l,"aria-disabled":c.isOpen||void 0,id:c.buttonId}))})),P=c((function(t,n){const r=g("Accordion.Panel");return d.createElement(e.Content,b({},t,k("panel"),{ref:n,role:"region","aria-labelledby":r.buttonId}))})),E="div",I=["Home","End","ArrowDown","ArrowUp"];export const Accordion=c((function(e,t){const{as:r=E,value:o,defaultValue:c,children:l,disabled:u,onChange:s=(()=>{})}=e,f=m(e,["as","value","defaultValue","children","disabled","onChange"]),p=d.useRef(new Set),y=d.useRef(null),v=i(y,t),[g,A]=a({prop:o,defaultProp:c,onChange:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(e=>e&&s(e))}),h=n(e.onKeyDown,e=>{var t;const n=I.includes(e.key),r=e.target,o=[...p.current].filter(e=>!(e&&e.disabled)),c=o.length;if(!(n&&(i=r,i instanceof HTMLButtonElement)))return;var i;const a=o.indexOf(r);if(-1===a)return;let l=a;switch(e.key){case"Home":l=0;break;case"End":l=c-1;break;case"ArrowDown":l=a+1;break;case"ArrowUp":l=a-1,l<0&&(l=c-1)}null===(t=o[l%c])||void 0===t||t.focus()}),w=d.useMemo(()=>({isDisabled:u,buttonNodesRef:p,value:g,setValue:A}),[u,g,A]);return d.createElement(r,b({},f,k("root"),{ref:v,onKeyDown:u?void 0:h}),d.createElement(O.Provider,{value:w},l))}));Accordion.Item=A,Accordion.Header=w,Accordion.Button=j,Accordion.Panel=P,Accordion.displayName="Accordion",Accordion.Item.displayName="Accordion.Item",Accordion.Header.displayName="Accordion.Header",Accordion.Button.displayName="Accordion.Button",Accordion.Panel.displayName="Accordion.Panel";const[D,k]=o("Accordion",{root:f({},u(E)),item:f(f({},u("div")),t.root),header:f({},u(h)),button:f(f({},u("button")),t.button),panel:f(f({},u("div")),t.content)});export{D as styles};
//# sourceMappingURL=index.module.js.map
{
"name": "@interop-ui/react-accordion",
"version": "0.0.1-0",
"version": "0.0.1-1",
"license": "MIT",

@@ -20,5 +20,5 @@ "source": "src/index.ts",

"dependencies": {
"@interop-ui/react-collapsible": "0.0.1-0",
"@interop-ui/react-utils": "0.0.1-0",
"@interop-ui/utils": "0.0.1-0"
"@interop-ui/react-collapsible": "0.0.1-1",
"@interop-ui/react-utils": "0.0.1-1",
"@interop-ui/utils": "0.0.1-1"
},

@@ -25,0 +25,0 @@ "devDependencies": {

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