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

@radix-ui/react-accordion

Package Overview
Dependencies
Maintainers
8
Versions
192
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 0.1.1-rc.10 to 0.1.1-rc.11

2

dist/index.js

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

var e,r,t=require("@radix-ui/react-id").useId,o=(e={},r=require("@radix-ui/react-collapsible"),Object.keys(r).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})})),e),n=require("@radix-ui/react-primitive").Primitive,a=require("@radix-ui/react-use-controllable-state").useControllableState,c=require("@radix-ui/primitive").composeEventHandlers,i=require("@radix-ui/react-compose-refs").useComposedRefs,l=require("@radix-ui/react-context").createContext,d=u(require("react")),s=u(require("@babel/runtime/helpers/extends"));function u(e){return e&&e.__esModule?e.default:e}const f=["Home","End","ArrowDown","ArrowUp"],p=/*#__PURE__*/d.forwardRef(((e,r)=>{const{type:t,...o}=e;if("single"===t){const e=o;/*#__PURE__*/return d.createElement(x,s({},e,{ref:r}))}if("multiple"===t){const e=o;/*#__PURE__*/return d.createElement(v,s({},e,{ref:r}))}throw new Error("Missing prop `type` expected on `Accordion`")}));exports.Accordion=p;const[m,g]=l("Accordion"),b=/*#__PURE__*/d.createContext(!1),x=/*#__PURE__*/d.forwardRef(((e,r)=>{const{value:t,defaultValue:o,onValueChange:n=(()=>{}),collapsible:c=!1,...i}=e,[l,u]=a({prop:t,defaultProp:o,onChange:n});/*#__PURE__*/return d.createElement(m,{value:l?[l]:[],onItemOpen:u,onItemClose:d.useCallback((()=>c&&u("")),[c,u])},/*#__PURE__*/d.createElement(b.Provider,{value:c},/*#__PURE__*/d.createElement(C,s({},i,{ref:r}))))})),v=/*#__PURE__*/d.forwardRef(((e,r)=>{const{value:t,defaultValue:o,onValueChange:n=(()=>{}),...c}=e,[i=[],l]=a({prop:t,defaultProp:o,onChange:n}),u=d.useCallback((e=>l(((r=[])=>[...r,e]))),[l]),f=d.useCallback((e=>l(((r=[])=>r.filter((r=>r!==e))))),[l]);/*#__PURE__*/return d.createElement(m,{value:i,onItemOpen:u,onItemClose:f},/*#__PURE__*/d.createElement(b.Provider,{value:!0},/*#__PURE__*/d.createElement(C,s({},c,{ref:r}))))})),[E,w]=l("Accordion"),C=/*#__PURE__*/d.forwardRef(((e,r)=>{const{disabled:t,...o}=e,a=d.useRef(new Set),l=d.useRef(null),u=i(l,r),p=c(e.onKeyDown,(e=>{var r;const t=e.target;if(!(f.includes(e.key)&&(o=t,o instanceof HTMLButtonElement)))return;var o;const n=[...a.current].filter((e=>!(null!=e&&e.disabled))),c=n.length,i=n.indexOf(t);if(-1===i)return;e.preventDefault();let l=i;switch(e.key){case"Home":l=0;break;case"End":l=c-1;break;case"ArrowDown":l=i+1;break;case"ArrowUp":l=i-1,l<0&&(l=c-1)}null===(r=n[l%c])||void 0===r||r.focus()}));/*#__PURE__*/return d.createElement(E,{triggerNodesRef:a,disabled:t},/*#__PURE__*/d.createElement(n.div,s({},o,{ref:u,onKeyDown:t?void 0:p})))})),[A,R]=l("AccordionItem"),h=/*#__PURE__*/d.forwardRef(((e,r)=>{const{value:n,...a}=e,c=w("AccordionItem"),i=g("AccordionItem"),l=t(),u=n&&i.value.includes(n)||!1,f=c.disabled||e.disabled;/*#__PURE__*/return d.createElement(A,{open:u,disabled:f,triggerId:l},/*#__PURE__*/d.createElement(o.Root,s({"data-state":u?"open":"closed"},a,{ref:r,disabled:f,open:u,onOpenChange:e=>{e?i.onItemOpen(n):i.onItemClose(n)}})))}));exports.AccordionItem=h;const I=/*#__PURE__*/d.forwardRef(((e,r)=>{const t=R("AccordionHeader");/*#__PURE__*/return d.createElement(n.h3,s({"data-state":(o=t.open,o?"open":"closed"),"data-disabled":t.disabled?"":void 0},e,{ref:r}));var o}));exports.AccordionHeader=I;const y=/*#__PURE__*/d.forwardRef(((e,r)=>{const{triggerNodesRef:t}=w("AccordionTrigger"),n=R("AccordionTrigger"),a=d.useContext(b),c=d.useRef(null),l=i(c,r);return d.useEffect((()=>{const e=t.current,r=c.current;if(r)return e.add(r),()=>{e.delete(r)}}),[t]),/*#__PURE__*/d.createElement(o.Trigger,s({"aria-disabled":n.open&&!a||void 0,id:n.triggerId},e,{ref:l}))}));exports.AccordionTrigger=y;const k=/*#__PURE__*/d.forwardRef(((e,r)=>{const t=R("AccordionContent");/*#__PURE__*/return d.createElement(o.Content,s({role:"region","aria-labelledby":t.triggerId},e,{style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)",...e.style},ref:r}))}));exports.AccordionContent=k;const q=p;exports.Root=q;const H=h;exports.Item=H;const O=I;exports.Header=O;const P=y;exports.Trigger=P;const T=k;exports.Content=T;
var e,r,t=require("@radix-ui/react-id").useId,o=(e={},r=require("@radix-ui/react-collapsible"),Object.keys(r).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})})),e),n=require("@radix-ui/react-primitive").Primitive,a=require("@radix-ui/react-use-controllable-state").useControllableState,c=require("@radix-ui/primitive").composeEventHandlers,i=require("@radix-ui/react-compose-refs").useComposedRefs,l=require("@radix-ui/react-context").createContext,d=u(require("react")),s=u(require("@babel/runtime/helpers/extends"));function u(e){return e&&e.__esModule?e.default:e}const f=["Home","End","ArrowDown","ArrowUp"],p=/*#__PURE__*/d.forwardRef(((e,r)=>{const{type:t,...o}=e;if("single"===t){const e=o;/*#__PURE__*/return d.createElement(x,s({},e,{ref:r}))}if("multiple"===t){const e=o;/*#__PURE__*/return d.createElement(v,s({},e,{ref:r}))}throw new Error("Missing prop `type` expected on `Accordion`")}));exports.Accordion=p;const[m,g]=l("Accordion"),b=/*#__PURE__*/d.createContext(!1),x=/*#__PURE__*/d.forwardRef(((e,r)=>{const{value:t,defaultValue:o,onValueChange:n=(()=>{}),collapsible:c=!1,...i}=e,[l,u]=a({prop:t,defaultProp:o,onChange:n});/*#__PURE__*/return d.createElement(m,{value:l?[l]:[],onItemOpen:u,onItemClose:d.useCallback((()=>c&&u("")),[c,u])},/*#__PURE__*/d.createElement(b.Provider,{value:c},/*#__PURE__*/d.createElement(C,s({},i,{ref:r}))))})),v=/*#__PURE__*/d.forwardRef(((e,r)=>{const{value:t,defaultValue:o,onValueChange:n=(()=>{}),...c}=e,[i=[],l]=a({prop:t,defaultProp:o,onChange:n}),u=d.useCallback((e=>l(((r=[])=>[...r,e]))),[l]),f=d.useCallback((e=>l(((r=[])=>r.filter((r=>r!==e))))),[l]);/*#__PURE__*/return d.createElement(m,{value:i,onItemOpen:u,onItemClose:f},/*#__PURE__*/d.createElement(b.Provider,{value:!0},/*#__PURE__*/d.createElement(C,s({},c,{ref:r}))))})),[w,E]=l("Accordion"),C=/*#__PURE__*/d.forwardRef(((e,r)=>{const{disabled:t,...o}=e,a=d.useRef(new Set),l=d.useRef(null),u=i(l,r),p=c(e.onKeyDown,(e=>{var r;const t=e.target;if(!(f.includes(e.key)&&(o=t,o instanceof HTMLButtonElement)))return;var o;const n=[...a.current].filter((e=>!(null!=e&&e.disabled))),c=n.length,i=n.indexOf(t);if(-1===i)return;e.preventDefault();let l=i;switch(e.key){case"Home":l=0;break;case"End":l=c-1;break;case"ArrowDown":l=i+1;break;case"ArrowUp":l=i-1,l<0&&(l=c-1)}null===(r=n[l%c])||void 0===r||r.focus()}));/*#__PURE__*/return d.createElement(w,{triggerNodesRef:a,disabled:t},/*#__PURE__*/d.createElement(n.div,s({},o,{ref:u,onKeyDown:t?void 0:p})))})),[A,h]=l("AccordionItem"),R=/*#__PURE__*/d.forwardRef(((e,r)=>{const{value:n,...a}=e,c=E("AccordionItem"),i=g("AccordionItem"),l=t(),u=n&&i.value.includes(n)||!1,f=c.disabled||e.disabled;/*#__PURE__*/return d.createElement(A,{open:u,disabled:f,triggerId:l},/*#__PURE__*/d.createElement(o.Root,s({"data-state":u?"open":"closed"},a,{ref:r,disabled:f,open:u,onOpenChange:e=>{e?i.onItemOpen(n):i.onItemClose(n)}})))}));exports.AccordionItem=R;const I=/*#__PURE__*/d.forwardRef(((e,r)=>{const t=h("AccordionHeader");/*#__PURE__*/return d.createElement(n.h3,s({"data-state":(o=t.open,o?"open":"closed"),"data-disabled":t.disabled?"":void 0},e,{ref:r}));var o}));exports.AccordionHeader=I;const y=/*#__PURE__*/d.forwardRef(((e,r)=>{const{triggerNodesRef:t}=E("AccordionTrigger"),n=h("AccordionTrigger"),a=d.useContext(b),c=d.useRef(null),l=i(c,r);return d.useEffect((()=>{const e=t.current,r=c.current;if(r)return e.add(r),()=>{e.delete(r)}}),[t]),/*#__PURE__*/d.createElement(o.Trigger,s({"aria-disabled":n.open&&!a||void 0,id:n.triggerId},e,{ref:l}))}));exports.AccordionTrigger=y;const k=/*#__PURE__*/d.forwardRef(((e,r)=>{const t=h("AccordionContent");/*#__PURE__*/return d.createElement(o.Content,s({role:"region","aria-labelledby":t.triggerId},e,{style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style},ref:r}))}));exports.AccordionContent=k;const q=p;exports.Root=q;const H=R;exports.Item=H;const O=I;exports.Header=O;const P=y;exports.Trigger=P;const T=k;exports.Content=T;
//# sourceMappingURL=index.js.map

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

import{useId as e}from"@radix-ui/react-id";import*as r from"@radix-ui/react-collapsible";import{Primitive as o}from"@radix-ui/react-primitive";import{useControllableState as t}from"@radix-ui/react-use-controllable-state";import{composeEventHandlers as n}from"@radix-ui/primitive";import{useComposedRefs as a}from"@radix-ui/react-compose-refs";import{createContext as c}from"@radix-ui/react-context";import i from"react";import d from"@babel/runtime/helpers/esm/extends";const l=["Home","End","ArrowDown","ArrowUp"];export const Accordion=/*#__PURE__*/i.forwardRef(((e,r)=>{const{type:o,...t}=e;if("single"===o){const e=t;/*#__PURE__*/return i.createElement(m,d({},e,{ref:r}))}if("multiple"===o){const e=t;/*#__PURE__*/return i.createElement(p,d({},e,{ref:r}))}throw new Error("Missing prop `type` expected on `Accordion`")}));/*#__PURE__*/const[s,u]=c("Accordion"),f=/*#__PURE__*/i.createContext(!1),m=/*#__PURE__*/i.forwardRef(((e,r)=>{const{value:o,defaultValue:n,onValueChange:a=(()=>{}),collapsible:c=!1,...l}=e,[u,m]=t({prop:o,defaultProp:n,onChange:a});/*#__PURE__*/return i.createElement(s,{value:u?[u]:[],onItemOpen:m,onItemClose:i.useCallback((()=>c&&m("")),[c,m])},/*#__PURE__*/i.createElement(f.Provider,{value:c},/*#__PURE__*/i.createElement(b,d({},l,{ref:r}))))})),p=/*#__PURE__*/i.forwardRef(((e,r)=>{const{value:o,defaultValue:n,onValueChange:a=(()=>{}),...c}=e,[l=[],u]=t({prop:o,defaultProp:n,onChange:a}),m=i.useCallback((e=>u(((r=[])=>[...r,e]))),[u]),p=i.useCallback((e=>u(((r=[])=>r.filter((r=>r!==e))))),[u]);/*#__PURE__*/return i.createElement(s,{value:l,onItemOpen:m,onItemClose:p},/*#__PURE__*/i.createElement(f.Provider,{value:!0},/*#__PURE__*/i.createElement(b,d({},c,{ref:r}))))})),[g,x]=c("Accordion"),b=/*#__PURE__*/i.forwardRef(((e,r)=>{const{disabled:t,...c}=e,s=i.useRef(new Set),u=i.useRef(null),f=a(u,r),m=n(e.onKeyDown,(e=>{var r;const o=e.target;if(!(l.includes(e.key)&&(t=o,t instanceof HTMLButtonElement)))return;var t;const n=[...s.current].filter((e=>!(null!=e&&e.disabled))),a=n.length,c=n.indexOf(o);if(-1===c)return;e.preventDefault();let i=c;switch(e.key){case"Home":i=0;break;case"End":i=a-1;break;case"ArrowDown":i=c+1;break;case"ArrowUp":i=c-1,i<0&&(i=a-1)}null===(r=n[i%a])||void 0===r||r.focus()}));/*#__PURE__*/return i.createElement(g,{triggerNodesRef:s,disabled:t},/*#__PURE__*/i.createElement(o.div,d({},c,{ref:f,onKeyDown:t?void 0:m})))})),[A,v]=c("AccordionItem");export const AccordionItem=/*#__PURE__*/i.forwardRef(((o,t)=>{const{value:n,...a}=o,c=x("AccordionItem"),l=u("AccordionItem"),s=e(),f=n&&l.value.includes(n)||!1,m=c.disabled||o.disabled;/*#__PURE__*/return i.createElement(A,{open:f,disabled:m,triggerId:s},/*#__PURE__*/i.createElement(r.Root,d({"data-state":f?"open":"closed"},a,{ref:t,disabled:m,open:f,onOpenChange:e=>{e?l.onItemOpen(n):l.onItemClose(n)}})))}));/*#__PURE__*/export const AccordionHeader=/*#__PURE__*/i.forwardRef(((e,r)=>{const t=v("AccordionHeader");/*#__PURE__*/return i.createElement(o.h3,d({"data-state":(n=t.open,n?"open":"closed"),"data-disabled":t.disabled?"":void 0},e,{ref:r}));var n}));/*#__PURE__*/export const AccordionTrigger=/*#__PURE__*/i.forwardRef(((e,o)=>{const{triggerNodesRef:t}=x("AccordionTrigger"),n=v("AccordionTrigger"),c=i.useContext(f),l=i.useRef(null),s=a(l,o);return i.useEffect((()=>{const e=t.current,r=l.current;if(r)return e.add(r),()=>{e.delete(r)}}),[t]),/*#__PURE__*/i.createElement(r.Trigger,d({"aria-disabled":n.open&&!c||void 0,id:n.triggerId},e,{ref:s}))}));/*#__PURE__*/export const AccordionContent=/*#__PURE__*/i.forwardRef(((e,o)=>{const t=v("AccordionContent");/*#__PURE__*/return i.createElement(r.Content,d({role:"region","aria-labelledby":t.triggerId},e,{style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)",...e.style},ref:o}))}));/*#__PURE__*/export const Root=Accordion;export const Item=AccordionItem;export const Header=AccordionHeader;export const Trigger=AccordionTrigger;export const Content=AccordionContent;
import{useId as e}from"@radix-ui/react-id";import*as r from"@radix-ui/react-collapsible";import{Primitive as t}from"@radix-ui/react-primitive";import{useControllableState as o}from"@radix-ui/react-use-controllable-state";import{composeEventHandlers as n}from"@radix-ui/primitive";import{useComposedRefs as a}from"@radix-ui/react-compose-refs";import{createContext as c}from"@radix-ui/react-context";import i from"react";import d from"@babel/runtime/helpers/esm/extends";const l=["Home","End","ArrowDown","ArrowUp"];export const Accordion=/*#__PURE__*/i.forwardRef(((e,r)=>{const{type:t,...o}=e;if("single"===t){const e=o;/*#__PURE__*/return i.createElement(m,d({},e,{ref:r}))}if("multiple"===t){const e=o;/*#__PURE__*/return i.createElement(p,d({},e,{ref:r}))}throw new Error("Missing prop `type` expected on `Accordion`")}));/*#__PURE__*/const[s,u]=c("Accordion"),f=/*#__PURE__*/i.createContext(!1),m=/*#__PURE__*/i.forwardRef(((e,r)=>{const{value:t,defaultValue:n,onValueChange:a=(()=>{}),collapsible:c=!1,...l}=e,[u,m]=o({prop:t,defaultProp:n,onChange:a});/*#__PURE__*/return i.createElement(s,{value:u?[u]:[],onItemOpen:m,onItemClose:i.useCallback((()=>c&&m("")),[c,m])},/*#__PURE__*/i.createElement(f.Provider,{value:c},/*#__PURE__*/i.createElement(b,d({},l,{ref:r}))))})),p=/*#__PURE__*/i.forwardRef(((e,r)=>{const{value:t,defaultValue:n,onValueChange:a=(()=>{}),...c}=e,[l=[],u]=o({prop:t,defaultProp:n,onChange:a}),m=i.useCallback((e=>u(((r=[])=>[...r,e]))),[u]),p=i.useCallback((e=>u(((r=[])=>r.filter((r=>r!==e))))),[u]);/*#__PURE__*/return i.createElement(s,{value:l,onItemOpen:m,onItemClose:p},/*#__PURE__*/i.createElement(f.Provider,{value:!0},/*#__PURE__*/i.createElement(b,d({},c,{ref:r}))))})),[g,x]=c("Accordion"),b=/*#__PURE__*/i.forwardRef(((e,r)=>{const{disabled:o,...c}=e,s=i.useRef(new Set),u=i.useRef(null),f=a(u,r),m=n(e.onKeyDown,(e=>{var r;const t=e.target;if(!(l.includes(e.key)&&(o=t,o instanceof HTMLButtonElement)))return;var o;const n=[...s.current].filter((e=>!(null!=e&&e.disabled))),a=n.length,c=n.indexOf(t);if(-1===c)return;e.preventDefault();let i=c;switch(e.key){case"Home":i=0;break;case"End":i=a-1;break;case"ArrowDown":i=c+1;break;case"ArrowUp":i=c-1,i<0&&(i=a-1)}null===(r=n[i%a])||void 0===r||r.focus()}));/*#__PURE__*/return i.createElement(g,{triggerNodesRef:s,disabled:o},/*#__PURE__*/i.createElement(t.div,d({},c,{ref:f,onKeyDown:o?void 0:m})))})),[A,v]=c("AccordionItem");export const AccordionItem=/*#__PURE__*/i.forwardRef(((t,o)=>{const{value:n,...a}=t,c=x("AccordionItem"),l=u("AccordionItem"),s=e(),f=n&&l.value.includes(n)||!1,m=c.disabled||t.disabled;/*#__PURE__*/return i.createElement(A,{open:f,disabled:m,triggerId:s},/*#__PURE__*/i.createElement(r.Root,d({"data-state":f?"open":"closed"},a,{ref:o,disabled:m,open:f,onOpenChange:e=>{e?l.onItemOpen(n):l.onItemClose(n)}})))}));/*#__PURE__*/export const AccordionHeader=/*#__PURE__*/i.forwardRef(((e,r)=>{const o=v("AccordionHeader");/*#__PURE__*/return i.createElement(t.h3,d({"data-state":(n=o.open,n?"open":"closed"),"data-disabled":o.disabled?"":void 0},e,{ref:r}));var n}));/*#__PURE__*/export const AccordionTrigger=/*#__PURE__*/i.forwardRef(((e,t)=>{const{triggerNodesRef:o}=x("AccordionTrigger"),n=v("AccordionTrigger"),c=i.useContext(f),l=i.useRef(null),s=a(l,t);return i.useEffect((()=>{const e=o.current,r=l.current;if(r)return e.add(r),()=>{e.delete(r)}}),[o]),/*#__PURE__*/i.createElement(r.Trigger,d({"aria-disabled":n.open&&!c||void 0,id:n.triggerId},e,{ref:s}))}));/*#__PURE__*/export const AccordionContent=/*#__PURE__*/i.forwardRef(((e,t)=>{const o=v("AccordionContent");/*#__PURE__*/return i.createElement(r.Content,d({role:"region","aria-labelledby":o.triggerId},e,{style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style},ref:t}))}));/*#__PURE__*/export const Root=Accordion;export const Item=AccordionItem;export const Header=AccordionHeader;export const Trigger=AccordionTrigger;export const Content=AccordionContent;
//# sourceMappingURL=index.module.js.map
{
"name": "@radix-ui/react-accordion",
"version": "0.1.1-rc.10",
"version": "0.1.1-rc.11",
"license": "MIT",

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

"@radix-ui/primitive": "0.1.0",
"@radix-ui/react-collapsible": "0.1.1-rc.10",
"@radix-ui/react-collapsible": "0.1.1-rc.11",
"@radix-ui/react-compose-refs": "0.1.0",
"@radix-ui/react-context": "0.1.0",
"@radix-ui/react-id": "0.1.0",
"@radix-ui/react-primitive": "0.1.1-rc.10",
"@radix-ui/react-primitive": "0.1.1-rc.11",
"@radix-ui/react-use-controllable-state": "0.1.0"

@@ -28,0 +28,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