-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaccordion-stories.d8be9b96.iframe.bundle.js
1 lines (1 loc) · 34.5 KB
/
accordion-stories.d8be9b96.iframe.bundle.js
1
"use strict";(self.webpackChunkwww=self.webpackChunkwww||[]).push([[707],{"../../node_modules/@radix-ui/react-collapsible/dist/index.mjs":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Fw:()=>$409067139f391064$export$aadde00976f34151,VY:()=>$409067139f391064$export$7c6e2c02157bb7d2,fC:()=>$409067139f391064$export$be92b6f5f03c0fe9,p_:()=>$409067139f391064$export$952b32dcbe73087a,wy:()=>$409067139f391064$export$c135dce7b15bbbdc,xz:()=>$409067139f391064$export$41fb9f06171c75f4});var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_5__=__webpack_require__("../../node_modules/@babel/runtime/helpers/esm/extends.js"),react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../node_modules/react/index.js"),_radix_ui_primitive__WEBPACK_IMPORTED_MODULE_6__=__webpack_require__("../../node_modules/@radix-ui/primitive/dist/index.mjs"),_radix_ui_react_context__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("../../node_modules/@radix-ui/react-context/dist/index.mjs"),_radix_ui_react_use_controllable_state__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("../../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs"),_radix_ui_react_use_layout_effect__WEBPACK_IMPORTED_MODULE_9__=__webpack_require__("../../node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs"),_radix_ui_react_compose_refs__WEBPACK_IMPORTED_MODULE_8__=__webpack_require__("../../node_modules/@radix-ui/react-compose-refs/dist/index.mjs"),_radix_ui_react_primitive__WEBPACK_IMPORTED_MODULE_4__=__webpack_require__("../../node_modules/@radix-ui/react-primitive/dist/index.mjs"),_radix_ui_react_presence__WEBPACK_IMPORTED_MODULE_7__=__webpack_require__("../../node_modules/@radix-ui/react-presence/dist/index.mjs"),_radix_ui_react_id__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("../../node_modules/@radix-ui/react-id/dist/index.mjs");const[$409067139f391064$var$createCollapsibleContext,$409067139f391064$export$952b32dcbe73087a]=(0,_radix_ui_react_context__WEBPACK_IMPORTED_MODULE_1__.b)("Collapsible"),[$409067139f391064$var$CollapsibleProvider,$409067139f391064$var$useCollapsibleContext]=$409067139f391064$var$createCollapsibleContext("Collapsible"),$409067139f391064$export$6eb0f7ddcda6131f=(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(((props,forwardedRef)=>{const{__scopeCollapsible,open:openProp,defaultOpen,disabled,onOpenChange,...collapsibleProps}=props,[open=!1,setOpen]=(0,_radix_ui_react_use_controllable_state__WEBPACK_IMPORTED_MODULE_2__.T)({prop:openProp,defaultProp:defaultOpen,onChange:onOpenChange});return(0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)($409067139f391064$var$CollapsibleProvider,{scope:__scopeCollapsible,disabled,contentId:(0,_radix_ui_react_id__WEBPACK_IMPORTED_MODULE_3__.M)(),open,onOpenToggle:(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((()=>setOpen((prevOpen=>!prevOpen))),[setOpen])},(0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_radix_ui_react_primitive__WEBPACK_IMPORTED_MODULE_4__.WV.div,(0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_5__.Z)({"data-state":$409067139f391064$var$getState(open),"data-disabled":disabled?"":void 0},collapsibleProps,{ref:forwardedRef})))})),$409067139f391064$export$c135dce7b15bbbdc=(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(((props,forwardedRef)=>{const{__scopeCollapsible,...triggerProps}=props,context=$409067139f391064$var$useCollapsibleContext("CollapsibleTrigger",__scopeCollapsible);return(0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_radix_ui_react_primitive__WEBPACK_IMPORTED_MODULE_4__.WV.button,(0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_5__.Z)({type:"button","aria-controls":context.contentId,"aria-expanded":context.open||!1,"data-state":$409067139f391064$var$getState(context.open),"data-disabled":context.disabled?"":void 0,disabled:context.disabled},triggerProps,{ref:forwardedRef,onClick:(0,_radix_ui_primitive__WEBPACK_IMPORTED_MODULE_6__.M)(props.onClick,context.onOpenToggle)}))})),$409067139f391064$export$aadde00976f34151=(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(((props,forwardedRef)=>{const{forceMount,...contentProps}=props,context=$409067139f391064$var$useCollapsibleContext("CollapsibleContent",props.__scopeCollapsible);return(0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_radix_ui_react_presence__WEBPACK_IMPORTED_MODULE_7__.z,{present:forceMount||context.open},(({present})=>(0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)($409067139f391064$var$CollapsibleContentImpl,(0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_5__.Z)({},contentProps,{ref:forwardedRef,present}))))})),$409067139f391064$var$CollapsibleContentImpl=(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(((props,forwardedRef)=>{const{__scopeCollapsible,present,children,...contentProps}=props,context=$409067139f391064$var$useCollapsibleContext("CollapsibleContent",__scopeCollapsible),[isPresent,setIsPresent]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(present),ref=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null),composedRefs=(0,_radix_ui_react_compose_refs__WEBPACK_IMPORTED_MODULE_8__.e)(forwardedRef,ref),heightRef=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0),height=heightRef.current,widthRef=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(0),width=widthRef.current,isOpen=context.open||isPresent,isMountAnimationPreventedRef=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(isOpen),originalStylesRef=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)();return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{const rAF=requestAnimationFrame((()=>isMountAnimationPreventedRef.current=!1));return()=>cancelAnimationFrame(rAF)}),[]),(0,_radix_ui_react_use_layout_effect__WEBPACK_IMPORTED_MODULE_9__.b)((()=>{const node=ref.current;if(node){originalStylesRef.current=originalStylesRef.current||{transitionDuration:node.style.transitionDuration,animationName:node.style.animationName},node.style.transitionDuration="0s",node.style.animationName="none";const rect=node.getBoundingClientRect();heightRef.current=rect.height,widthRef.current=rect.width,isMountAnimationPreventedRef.current||(node.style.transitionDuration=originalStylesRef.current.transitionDuration,node.style.animationName=originalStylesRef.current.animationName),setIsPresent(present)}}),[context.open,present]),(0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_radix_ui_react_primitive__WEBPACK_IMPORTED_MODULE_4__.WV.div,(0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_5__.Z)({"data-state":$409067139f391064$var$getState(context.open),"data-disabled":context.disabled?"":void 0,id:context.contentId,hidden:!isOpen},contentProps,{ref:composedRefs,style:{"--radix-collapsible-content-height":height?`${height}px`:void 0,"--radix-collapsible-content-width":width?`${width}px`:void 0,...props.style}}),isOpen&&children)}));function $409067139f391064$var$getState(open){return open?"open":"closed"}const $409067139f391064$export$be92b6f5f03c0fe9=$409067139f391064$export$6eb0f7ddcda6131f,$409067139f391064$export$41fb9f06171c75f4=$409067139f391064$export$c135dce7b15bbbdc,$409067139f391064$export$7c6e2c02157bb7d2=$409067139f391064$export$aadde00976f34151},"../../node_modules/@radix-ui/react-collection/dist/index.mjs":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{B:()=>$e02a7d9cb1dc128c$export$c74125a8e3af6bb2});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../node_modules/react/index.js"),_radix_ui_react_context__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("../../node_modules/@radix-ui/react-context/dist/index.mjs"),_radix_ui_react_compose_refs__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("../../node_modules/@radix-ui/react-compose-refs/dist/index.mjs"),_radix_ui_react_slot__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("../../node_modules/@radix-ui/react-slot/dist/index.mjs");function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name){const PROVIDER_NAME=name+"CollectionProvider",[createCollectionContext,createCollectionScope]=(0,_radix_ui_react_context__WEBPACK_IMPORTED_MODULE_1__.b)(PROVIDER_NAME),[CollectionProviderImpl,useCollectionContext]=createCollectionContext(PROVIDER_NAME,{collectionRef:{current:null},itemMap:new Map}),CollectionProvider=props=>{const{scope,children}=props,ref=react__WEBPACK_IMPORTED_MODULE_0__.useRef(null),itemMap=react__WEBPACK_IMPORTED_MODULE_0__.useRef(new Map).current;return react__WEBPACK_IMPORTED_MODULE_0__.createElement(CollectionProviderImpl,{scope,itemMap,collectionRef:ref},children)},COLLECTION_SLOT_NAME=name+"CollectionSlot",CollectionSlot=react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(((props,forwardedRef)=>{const{scope,children}=props,context=useCollectionContext(COLLECTION_SLOT_NAME,scope),composedRefs=(0,_radix_ui_react_compose_refs__WEBPACK_IMPORTED_MODULE_2__.e)(forwardedRef,context.collectionRef);return react__WEBPACK_IMPORTED_MODULE_0__.createElement(_radix_ui_react_slot__WEBPACK_IMPORTED_MODULE_3__.g7,{ref:composedRefs},children)})),ITEM_SLOT_NAME=name+"CollectionItemSlot",CollectionItemSlot=react__WEBPACK_IMPORTED_MODULE_0__.forwardRef(((props,forwardedRef)=>{const{scope,children,...itemData}=props,ref=react__WEBPACK_IMPORTED_MODULE_0__.useRef(null),composedRefs=(0,_radix_ui_react_compose_refs__WEBPACK_IMPORTED_MODULE_2__.e)(forwardedRef,ref),context=useCollectionContext(ITEM_SLOT_NAME,scope);return react__WEBPACK_IMPORTED_MODULE_0__.useEffect((()=>(context.itemMap.set(ref,{ref,...itemData}),()=>{context.itemMap.delete(ref)}))),react__WEBPACK_IMPORTED_MODULE_0__.createElement(_radix_ui_react_slot__WEBPACK_IMPORTED_MODULE_3__.g7,{"data-radix-collection-item":"",ref:composedRefs},children)}));return[{Provider:CollectionProvider,Slot:CollectionSlot,ItemSlot:CollectionItemSlot},function useCollection(scope){const context=useCollectionContext(name+"CollectionConsumer",scope);return react__WEBPACK_IMPORTED_MODULE_0__.useCallback((()=>{const collectionNode=context.collectionRef.current;if(!collectionNode)return[];const orderedNodes=Array.from(collectionNode.querySelectorAll("[data-radix-collection-item]"));return Array.from(context.itemMap.values()).sort(((a,b)=>orderedNodes.indexOf(a.ref.current)-orderedNodes.indexOf(b.ref.current)))}),[context.collectionRef,context.itemMap])},createCollectionScope]}},"../../node_modules/@radix-ui/react-direction/dist/index.mjs":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{gm:()=>$f631663db3294ace$export$b39126d51d94e6f3});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../node_modules/react/index.js");const $f631663db3294ace$var$DirectionContext=(0,react__WEBPACK_IMPORTED_MODULE_0__.createContext)(void 0);function $f631663db3294ace$export$b39126d51d94e6f3(localDir){const globalDir=(0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)($f631663db3294ace$var$DirectionContext);return localDir||globalDir||"ltr"}},"../../node_modules/@radix-ui/react-id/dist/index.mjs":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{var react__WEBPACK_IMPORTED_MODULE_0___namespace_cache;__webpack_require__.d(__webpack_exports__,{M:()=>$1746a345f3d73bb7$export$f680877a34711e37});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../node_modules/react/index.js"),_radix_ui_react_use_layout_effect__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("../../node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs");const $1746a345f3d73bb7$var$useReactId=(react__WEBPACK_IMPORTED_MODULE_0___namespace_cache||(react__WEBPACK_IMPORTED_MODULE_0___namespace_cache=__webpack_require__.t(react__WEBPACK_IMPORTED_MODULE_0__,2)))["useId".toString()]||(()=>{});let $1746a345f3d73bb7$var$count=0;function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId){const[id,setId]=react__WEBPACK_IMPORTED_MODULE_0__.useState($1746a345f3d73bb7$var$useReactId());return(0,_radix_ui_react_use_layout_effect__WEBPACK_IMPORTED_MODULE_1__.b)((()=>{deterministicId||setId((reactId=>null!=reactId?reactId:String($1746a345f3d73bb7$var$count++)))}),[deterministicId]),deterministicId||(id?`radix-${id}`:"")}},"../../node_modules/@radix-ui/react-presence/dist/index.mjs":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{z:()=>$921a889cee6df7e8$export$99c2b779aa4e8b8b});var react__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../node_modules/react/index.js"),react_dom__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("../../node_modules/react-dom/index.js"),_radix_ui_react_compose_refs__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__("../../node_modules/@radix-ui/react-compose-refs/dist/index.mjs"),_radix_ui_react_use_layout_effect__WEBPACK_IMPORTED_MODULE_3__=__webpack_require__("../../node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs");const $921a889cee6df7e8$export$99c2b779aa4e8b8b=props=>{const{present,children}=props,presence=function $921a889cee6df7e8$var$usePresence(present){const[node1,setNode]=(0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(),stylesRef=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)({}),prevPresentRef=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(present),prevAnimationNameRef=(0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)("none"),initialState=present?"mounted":"unmounted",[state,send]=function $fe963b355347cc68$export$3e6543de14f8614f(initialState,machine){return(0,react__WEBPACK_IMPORTED_MODULE_0__.useReducer)(((state,event)=>{const nextState=machine[state][event];return null!=nextState?nextState:state}),initialState)}(initialState,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)((()=>{const currentAnimationName=$921a889cee6df7e8$var$getAnimationName(stylesRef.current);prevAnimationNameRef.current="mounted"===state?currentAnimationName:"none"}),[state]),(0,_radix_ui_react_use_layout_effect__WEBPACK_IMPORTED_MODULE_3__.b)((()=>{const styles=stylesRef.current,wasPresent=prevPresentRef.current;if(wasPresent!==present){const prevAnimationName=prevAnimationNameRef.current,currentAnimationName=$921a889cee6df7e8$var$getAnimationName(styles);if(present)send("MOUNT");else if("none"===currentAnimationName||"none"===(null==styles?void 0:styles.display))send("UNMOUNT");else{send(wasPresent&&prevAnimationName!==currentAnimationName?"ANIMATION_OUT":"UNMOUNT")}prevPresentRef.current=present}}),[present,send]),(0,_radix_ui_react_use_layout_effect__WEBPACK_IMPORTED_MODULE_3__.b)((()=>{if(node1){const handleAnimationEnd=event=>{const isCurrentAnimation=$921a889cee6df7e8$var$getAnimationName(stylesRef.current).includes(event.animationName);event.target===node1&&isCurrentAnimation&&(0,react_dom__WEBPACK_IMPORTED_MODULE_1__.flushSync)((()=>send("ANIMATION_END")))},handleAnimationStart=event=>{event.target===node1&&(prevAnimationNameRef.current=$921a889cee6df7e8$var$getAnimationName(stylesRef.current))};return node1.addEventListener("animationstart",handleAnimationStart),node1.addEventListener("animationcancel",handleAnimationEnd),node1.addEventListener("animationend",handleAnimationEnd),()=>{node1.removeEventListener("animationstart",handleAnimationStart),node1.removeEventListener("animationcancel",handleAnimationEnd),node1.removeEventListener("animationend",handleAnimationEnd)}}send("ANIMATION_END")}),[node1,send]),{isPresent:["mounted","unmountSuspended"].includes(state),ref:(0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)((node=>{node&&(stylesRef.current=getComputedStyle(node)),setNode(node)}),[])}}(present),child="function"==typeof children?children({present:presence.isPresent}):react__WEBPACK_IMPORTED_MODULE_0__.Children.only(children),ref=(0,_radix_ui_react_compose_refs__WEBPACK_IMPORTED_MODULE_2__.e)(presence.ref,child.ref);return"function"==typeof children||presence.isPresent?(0,react__WEBPACK_IMPORTED_MODULE_0__.cloneElement)(child,{ref}):null};function $921a889cee6df7e8$var$getAnimationName(styles){return(null==styles?void 0:styles.animationName)||"none"}$921a889cee6df7e8$export$99c2b779aa4e8b8b.displayName="Presence"},"./lib/utils.ts":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{cn:()=>cn});var clsx__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__("../../node_modules/clsx/dist/clsx.m.js"),tailwind_merge__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__("../../node_modules/tailwind-merge/dist/lib/tw-merge.mjs");__webpack_require__("../../node_modules/process/browser.js");function cn(){for(var _len=arguments.length,inputs=new Array(_len),_key=0;_key<_len;_key++)inputs[_key]=arguments[_key];return(0,tailwind_merge__WEBPACK_IMPORTED_MODULE_0__.m)((0,clsx__WEBPACK_IMPORTED_MODULE_1__.W)(inputs))}},"./registry/stories/accordion.stories.tsx":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{Base:()=>Base,default:()=>accordion_stories});var defineProperty=__webpack_require__("../../node_modules/@babel/runtime/helpers/esm/defineProperty.js"),react=__webpack_require__("../../node_modules/react/index.js"),esm_extends=__webpack_require__("../../node_modules/@babel/runtime/helpers/esm/extends.js"),objectWithoutProperties=__webpack_require__("../../node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),dist=__webpack_require__("../../node_modules/@radix-ui/react-context/dist/index.mjs"),react_collection_dist=__webpack_require__("../../node_modules/@radix-ui/react-collection/dist/index.mjs"),react_compose_refs_dist=__webpack_require__("../../node_modules/@radix-ui/react-compose-refs/dist/index.mjs"),primitive_dist=__webpack_require__("../../node_modules/@radix-ui/primitive/dist/index.mjs"),react_use_controllable_state_dist=__webpack_require__("../../node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs"),react_primitive_dist=__webpack_require__("../../node_modules/@radix-ui/react-primitive/dist/index.mjs"),react_collapsible_dist=__webpack_require__("../../node_modules/@radix-ui/react-collapsible/dist/index.mjs"),react_id_dist=__webpack_require__("../../node_modules/@radix-ui/react-id/dist/index.mjs"),react_direction_dist=__webpack_require__("../../node_modules/@radix-ui/react-direction/dist/index.mjs");const $1bf158f521e1b1b4$var$ACCORDION_KEYS=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[$1bf158f521e1b1b4$var$Collection,$1bf158f521e1b1b4$var$useCollection,$1bf158f521e1b1b4$var$createCollectionScope]=(0,react_collection_dist.B)("Accordion"),[$1bf158f521e1b1b4$var$createAccordionContext,$1bf158f521e1b1b4$export$9748edc328a73be1]=(0,dist.b)("Accordion",[$1bf158f521e1b1b4$var$createCollectionScope,react_collapsible_dist.p_]),$1bf158f521e1b1b4$var$useCollapsibleScope=(0,react_collapsible_dist.p_)(),$1bf158f521e1b1b4$export$a766cd26d0d69044=react.forwardRef(((props,forwardedRef)=>{const{type,...accordionProps}=props,singleProps=accordionProps,multipleProps=accordionProps;return react.createElement($1bf158f521e1b1b4$var$Collection.Provider,{scope:props.__scopeAccordion},"multiple"===type?react.createElement($1bf158f521e1b1b4$var$AccordionImplMultiple,(0,esm_extends.Z)({},multipleProps,{ref:forwardedRef})):react.createElement($1bf158f521e1b1b4$var$AccordionImplSingle,(0,esm_extends.Z)({},singleProps,{ref:forwardedRef})))}));$1bf158f521e1b1b4$export$a766cd26d0d69044.propTypes={type(props){const value=props.value||props.defaultValue;return props.type&&!["single","multiple"].includes(props.type)?new Error("Invalid prop `type` supplied to `Accordion`. Expected one of `single | multiple`."):"multiple"===props.type&&"string"==typeof value?new Error("Invalid prop `type` supplied to `Accordion`. Expected `single` when `defaultValue` or `value` is type `string`."):"single"===props.type&&Array.isArray(value)?new Error("Invalid prop `type` supplied to `Accordion`. Expected `multiple` when `defaultValue` or `value` is type `string[]`."):null}};const[$1bf158f521e1b1b4$var$AccordionValueProvider,$1bf158f521e1b1b4$var$useAccordionValueContext]=$1bf158f521e1b1b4$var$createAccordionContext("Accordion"),[$1bf158f521e1b1b4$var$AccordionCollapsibleProvider,$1bf158f521e1b1b4$var$useAccordionCollapsibleContext]=$1bf158f521e1b1b4$var$createAccordionContext("Accordion",{collapsible:!1}),$1bf158f521e1b1b4$var$AccordionImplSingle=react.forwardRef(((props,forwardedRef)=>{const{value:valueProp,defaultValue,onValueChange=()=>{},collapsible=!1,...accordionSingleProps}=props,[value,setValue]=(0,react_use_controllable_state_dist.T)({prop:valueProp,defaultProp:defaultValue,onChange:onValueChange});return react.createElement($1bf158f521e1b1b4$var$AccordionValueProvider,{scope:props.__scopeAccordion,value:value?[value]:[],onItemOpen:setValue,onItemClose:react.useCallback((()=>collapsible&&setValue("")),[collapsible,setValue])},react.createElement($1bf158f521e1b1b4$var$AccordionCollapsibleProvider,{scope:props.__scopeAccordion,collapsible},react.createElement($1bf158f521e1b1b4$var$AccordionImpl,(0,esm_extends.Z)({},accordionSingleProps,{ref:forwardedRef}))))})),$1bf158f521e1b1b4$var$AccordionImplMultiple=react.forwardRef(((props,forwardedRef)=>{const{value:valueProp,defaultValue,onValueChange=()=>{},...accordionMultipleProps}=props,[value1=[],setValue]=(0,react_use_controllable_state_dist.T)({prop:valueProp,defaultProp:defaultValue,onChange:onValueChange}),handleItemOpen=react.useCallback((itemValue=>setValue(((prevValue=[])=>[...prevValue,itemValue]))),[setValue]),handleItemClose=react.useCallback((itemValue=>setValue(((prevValue=[])=>prevValue.filter((value=>value!==itemValue))))),[setValue]);return react.createElement($1bf158f521e1b1b4$var$AccordionValueProvider,{scope:props.__scopeAccordion,value:value1,onItemOpen:handleItemOpen,onItemClose:handleItemClose},react.createElement($1bf158f521e1b1b4$var$AccordionCollapsibleProvider,{scope:props.__scopeAccordion,collapsible:!0},react.createElement($1bf158f521e1b1b4$var$AccordionImpl,(0,esm_extends.Z)({},accordionMultipleProps,{ref:forwardedRef}))))})),[$1bf158f521e1b1b4$var$AccordionImplProvider,$1bf158f521e1b1b4$var$useAccordionContext]=$1bf158f521e1b1b4$var$createAccordionContext("Accordion"),$1bf158f521e1b1b4$var$AccordionImpl=react.forwardRef(((props,forwardedRef)=>{const{__scopeAccordion,disabled,dir,orientation="vertical",...accordionProps}=props,accordionRef=react.useRef(null),composedRefs=(0,react_compose_refs_dist.e)(accordionRef,forwardedRef),getItems=$1bf158f521e1b1b4$var$useCollection(__scopeAccordion),isDirectionLTR="ltr"===(0,react_direction_dist.gm)(dir),handleKeyDown=(0,primitive_dist.M)(props.onKeyDown,(event=>{var _triggerCollection$cl;if(!$1bf158f521e1b1b4$var$ACCORDION_KEYS.includes(event.key))return;const target=event.target,triggerCollection=getItems().filter((item=>{var _item$ref$current;return!(null!==(_item$ref$current=item.ref.current)&&void 0!==_item$ref$current&&_item$ref$current.disabled)})),triggerIndex=triggerCollection.findIndex((item=>item.ref.current===target)),triggerCount=triggerCollection.length;if(-1===triggerIndex)return;event.preventDefault();let nextIndex=triggerIndex;const endIndex=triggerCount-1,moveNext=()=>{nextIndex=triggerIndex+1,nextIndex>endIndex&&(nextIndex=0)},movePrev=()=>{nextIndex=triggerIndex-1,nextIndex<0&&(nextIndex=endIndex)};switch(event.key){case"Home":nextIndex=0;break;case"End":nextIndex=endIndex;break;case"ArrowRight":"horizontal"===orientation&&(isDirectionLTR?moveNext():movePrev());break;case"ArrowDown":"vertical"===orientation&&moveNext();break;case"ArrowLeft":"horizontal"===orientation&&(isDirectionLTR?movePrev():moveNext());break;case"ArrowUp":"vertical"===orientation&&movePrev()}null===(_triggerCollection$cl=triggerCollection[nextIndex%triggerCount].ref.current)||void 0===_triggerCollection$cl||_triggerCollection$cl.focus()}));return react.createElement($1bf158f521e1b1b4$var$AccordionImplProvider,{scope:__scopeAccordion,disabled,direction:dir,orientation},react.createElement($1bf158f521e1b1b4$var$Collection.Slot,{scope:__scopeAccordion},react.createElement(react_primitive_dist.WV.div,(0,esm_extends.Z)({},accordionProps,{"data-orientation":orientation,ref:composedRefs,onKeyDown:disabled?void 0:handleKeyDown}))))})),[$1bf158f521e1b1b4$var$AccordionItemProvider,$1bf158f521e1b1b4$var$useAccordionItemContext]=$1bf158f521e1b1b4$var$createAccordionContext("AccordionItem"),$1bf158f521e1b1b4$export$d99097c13d4dac9f=react.forwardRef(((props,forwardedRef)=>{const{__scopeAccordion,value,...accordionItemProps}=props,accordionContext=$1bf158f521e1b1b4$var$useAccordionContext("AccordionItem",__scopeAccordion),valueContext=$1bf158f521e1b1b4$var$useAccordionValueContext("AccordionItem",__scopeAccordion),collapsibleScope=$1bf158f521e1b1b4$var$useCollapsibleScope(__scopeAccordion),triggerId=(0,react_id_dist.M)(),open1=value&&valueContext.value.includes(value)||!1,disabled=accordionContext.disabled||props.disabled;return react.createElement($1bf158f521e1b1b4$var$AccordionItemProvider,{scope:__scopeAccordion,open:open1,disabled,triggerId},react.createElement(react_collapsible_dist.fC,(0,esm_extends.Z)({"data-orientation":accordionContext.orientation,"data-state":$1bf158f521e1b1b4$var$getState(open1)},collapsibleScope,accordionItemProps,{ref:forwardedRef,disabled,open:open1,onOpenChange:open=>{open?valueContext.onItemOpen(value):valueContext.onItemClose(value)}})))})),$1bf158f521e1b1b4$export$5e3e5deaaf81ee41=react.forwardRef(((props,forwardedRef)=>{const{__scopeAccordion,...headerProps}=props,accordionContext=$1bf158f521e1b1b4$var$useAccordionContext("Accordion",__scopeAccordion),itemContext=$1bf158f521e1b1b4$var$useAccordionItemContext("AccordionHeader",__scopeAccordion);return react.createElement(react_primitive_dist.WV.h3,(0,esm_extends.Z)({"data-orientation":accordionContext.orientation,"data-state":$1bf158f521e1b1b4$var$getState(itemContext.open),"data-disabled":itemContext.disabled?"":void 0},headerProps,{ref:forwardedRef}))})),$1bf158f521e1b1b4$export$94e939b1f85bdd73=react.forwardRef(((props,forwardedRef)=>{const{__scopeAccordion,...triggerProps}=props,accordionContext=$1bf158f521e1b1b4$var$useAccordionContext("Accordion",__scopeAccordion),itemContext=$1bf158f521e1b1b4$var$useAccordionItemContext("AccordionTrigger",__scopeAccordion),collapsibleContext=$1bf158f521e1b1b4$var$useAccordionCollapsibleContext("AccordionTrigger",__scopeAccordion),collapsibleScope=$1bf158f521e1b1b4$var$useCollapsibleScope(__scopeAccordion);return react.createElement($1bf158f521e1b1b4$var$Collection.ItemSlot,{scope:__scopeAccordion},react.createElement(react_collapsible_dist.xz,(0,esm_extends.Z)({"aria-disabled":itemContext.open&&!collapsibleContext.collapsible||void 0,"data-orientation":accordionContext.orientation,id:itemContext.triggerId},collapsibleScope,triggerProps,{ref:forwardedRef})))})),$1bf158f521e1b1b4$export$985b9a77379b54a0=react.forwardRef(((props,forwardedRef)=>{const{__scopeAccordion,...contentProps}=props,accordionContext=$1bf158f521e1b1b4$var$useAccordionContext("Accordion",__scopeAccordion),itemContext=$1bf158f521e1b1b4$var$useAccordionItemContext("AccordionContent",__scopeAccordion),collapsibleScope=$1bf158f521e1b1b4$var$useCollapsibleScope(__scopeAccordion);return react.createElement(react_collapsible_dist.VY,(0,esm_extends.Z)({role:"region","aria-labelledby":itemContext.triggerId,"data-orientation":accordionContext.orientation},collapsibleScope,contentProps,{ref:forwardedRef,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...props.style}}))}));function $1bf158f521e1b1b4$var$getState(open){return open?"open":"closed"}const $1bf158f521e1b1b4$export$be92b6f5f03c0fe9=$1bf158f521e1b1b4$export$a766cd26d0d69044,$1bf158f521e1b1b4$export$6d08773d2e66f8f2=$1bf158f521e1b1b4$export$d99097c13d4dac9f,$1bf158f521e1b1b4$export$8b251419efc915eb=$1bf158f521e1b1b4$export$5e3e5deaaf81ee41,$1bf158f521e1b1b4$export$41fb9f06171c75f4=$1bf158f521e1b1b4$export$94e939b1f85bdd73,$1bf158f521e1b1b4$export$7c6e2c02157bb7d2=$1bf158f521e1b1b4$export$985b9a77379b54a0;var chevron_down=__webpack_require__("../../node_modules/lucide-react/dist/esm/icons/chevron-down.js"),utils=__webpack_require__("./lib/utils.ts"),_excluded=["className"],_excluded2=["className","children"],_excluded3=["className","children"],__jsx=react.createElement,Accordion=$1bf158f521e1b1b4$export$be92b6f5f03c0fe9,AccordionItem=react.forwardRef((function(_ref,ref){var className=_ref.className,props=(0,objectWithoutProperties.Z)(_ref,_excluded);return __jsx($1bf158f521e1b1b4$export$6d08773d2e66f8f2,(0,esm_extends.Z)({ref,className:(0,utils.cn)("border-b",className)},props))}));AccordionItem.displayName="AccordionItem";var AccordionTrigger=react.forwardRef((function(_ref2,ref){var className=_ref2.className,children=_ref2.children,props=(0,objectWithoutProperties.Z)(_ref2,_excluded2);return __jsx($1bf158f521e1b1b4$export$8b251419efc915eb,{className:"flex"},__jsx($1bf158f521e1b1b4$export$41fb9f06171c75f4,(0,esm_extends.Z)({ref,className:(0,utils.cn)("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",className)},props),children,__jsx(chevron_down.Z,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})))}));AccordionTrigger.displayName=$1bf158f521e1b1b4$export$41fb9f06171c75f4.displayName;var _Base$parameters,_Base$parameters2,AccordionContent=react.forwardRef((function(_ref3,ref){var className=_ref3.className,children=_ref3.children,props=(0,objectWithoutProperties.Z)(_ref3,_excluded3);return __jsx($1bf158f521e1b1b4$export$7c6e2c02157bb7d2,(0,esm_extends.Z)({ref,className:(0,utils.cn)("overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",className)},props),__jsx("div",{className:"pb-4 pt-0"},children))}));AccordionContent.displayName=$1bf158f521e1b1b4$export$7c6e2c02157bb7d2.displayName,AccordionItem.__docgenInfo={description:"",methods:[],displayName:"AccordionItem"},AccordionTrigger.__docgenInfo={description:"",methods:[]},AccordionContent.__docgenInfo={description:"",methods:[]};try{AccordionItem.displayName="AccordionItem",AccordionItem.__docgenInfo={description:"",displayName:"AccordionItem",props:{asChild:{defaultValue:null,description:"",name:"asChild",required:!1,type:{name:"boolean"}}}},"undefined"!=typeof STORYBOOK_REACT_CLASSES&&(STORYBOOK_REACT_CLASSES["registry/default/ui/accordion.tsx#AccordionItem"]={docgenInfo:AccordionItem.__docgenInfo,name:"AccordionItem",path:"registry/default/ui/accordion.tsx#AccordionItem"})}catch(__react_docgen_typescript_loader_error){}var accordion_stories_jsx=react.createElement;function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter((function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable}))),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach((function(key){(0,defineProperty.Z)(target,key,source[key])})):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach((function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))}))}return target}const accordion_stories={title:"ui/Accordion",component:Accordion,tags:["autodocs"],argTypes:{}};var Base={render:function render(args){return accordion_stories_jsx(Accordion,args,accordion_stories_jsx(AccordionItem,{value:"item-1"},accordion_stories_jsx(AccordionTrigger,null,"Is it accessible?"),accordion_stories_jsx(AccordionContent,null,"Yes. It adheres to the WAI-ARIA design pattern.")),accordion_stories_jsx(AccordionItem,{value:"item-2"},accordion_stories_jsx(AccordionTrigger,null,"Is it styled?"),accordion_stories_jsx(AccordionContent,null,"Yes. It comes with default styles that matches the other components' aesthetic.")),accordion_stories_jsx(AccordionItem,{value:"item-3"},accordion_stories_jsx(AccordionTrigger,null,"Is it animated?"),accordion_stories_jsx(AccordionContent,null,"Yes. It's animated by default, but you can disable it if you prefer.")))},args:{type:"single",collapsible:!0}};Base.parameters=_objectSpread(_objectSpread({},Base.parameters),{},{docs:_objectSpread(_objectSpread({},null===(_Base$parameters=Base.parameters)||void 0===_Base$parameters?void 0:_Base$parameters.docs),{},{source:_objectSpread({originalSource:'{\n render: args => <Accordion {...args}>\n <AccordionItem value="item-1">\n <AccordionTrigger>Is it accessible?</AccordionTrigger>\n <AccordionContent>\n Yes. It adheres to the WAI-ARIA design pattern.\n </AccordionContent>\n </AccordionItem>\n <AccordionItem value="item-2">\n <AccordionTrigger>Is it styled?</AccordionTrigger>\n <AccordionContent>\n Yes. It comes with default styles that matches the other components\'\n aesthetic.\n </AccordionContent>\n </AccordionItem>\n <AccordionItem value="item-3">\n <AccordionTrigger>Is it animated?</AccordionTrigger>\n <AccordionContent>\n Yes. It\'s animated by default, but you can disable it if you prefer.\n </AccordionContent>\n </AccordionItem>\n </Accordion>,\n args: {\n type: "single",\n collapsible: true\n }\n}'},null===(_Base$parameters2=Base.parameters)||void 0===_Base$parameters2||null===(_Base$parameters2=_Base$parameters2.docs)||void 0===_Base$parameters2?void 0:_Base$parameters2.source)})})},"../../node_modules/lucide-react/dist/esm/createLucideIcon.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>createLucideIcon});var react=__webpack_require__("../../node_modules/react/index.js"),defaultAttributes={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const createLucideIcon=(iconName,iconNode)=>{const Component=(0,react.forwardRef)((({color="currentColor",size=24,strokeWidth=2,absoluteStrokeWidth,children,...rest},ref)=>{return(0,react.createElement)("svg",{ref,...defaultAttributes,width:size,height:size,stroke:color,strokeWidth:absoluteStrokeWidth?24*Number(strokeWidth)/Number(size):strokeWidth,className:`lucide lucide-${string=iconName,string.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,...rest},[...iconNode.map((([tag,attrs])=>(0,react.createElement)(tag,attrs))),...(Array.isArray(children)?children:[children])||[]]);var string}));return Component.displayName=`${iconName}`,Component}},"../../node_modules/lucide-react/dist/esm/icons/chevron-down.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{__webpack_require__.d(__webpack_exports__,{Z:()=>ChevronDown});const ChevronDown=(0,__webpack_require__("../../node_modules/lucide-react/dist/esm/createLucideIcon.js").Z)("ChevronDown",[["polyline",{points:"6 9 12 15 18 9",key:"1do0m2"}]])}}]);