import*as e from"react";import{useAccordion as r,AccordionDescendantsProvider as t,AccordionProvider as s,useAccordionItem as o,useAccordionContext as a}from"./use-accordion.js";import{useMultiStyleConfig as i}from"../../../system/dist/esm/use-style-config.js";import{omitThemingProps as n}from"../../../system/dist/esm/system.utils.js";import{StylesProvider as c,useStyles as m}from"../../../system/dist/esm/providers.js";import{Collapse as d}from"../../../transition/dist/esm/collapse.js";import{Icon as l}from"../../../icon/dist/esm/icon.js";import{forwardRef as p}from"../../../system/dist/esm/forward-ref.js";import{chakra as u}from"../../../system/dist/esm/system.js";import{cx as f}from"../../../utils/dist/esm/dom.js";import{__DEV__ as v}from"../../../utils/dist/esm/assertion.js";import{createContext as h}from"../../../react-utils/dist/esm/context.js";import{runIfFn as y}from"../../../utils/dist/esm/function.js";function _(){return(_=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e}).apply(this,arguments)}function j(e,r){if(null==e)return{};var t,s,o={},a=Object.keys(e);for(s=0;s<a.length;s++)t=a[s],r.indexOf(t)>=0||(o[t]=e[t]);return o}var N=p(((o,a)=>{var{children:m,reduceMotion:d}=o,l=j(o,["children","reduceMotion"]),p=i("Accordion",l),v=n(l),h=r(v),{htmlProps:y,descendants:N}=h,E=j(h,["htmlProps","descendants"]),g=e.useMemo((()=>_({},E,{reduceMotion:!!d})),[E,d]);return e.createElement(t,{value:N},e.createElement(s,{value:g},e.createElement(c,{value:p},e.createElement(u.div,_({ref:a},y,{className:f("chakra-accordion",l.className)}),m))))}));v&&(N.displayName="Accordion");var[E,g]=h({name:"AccordionItemContext",errorMessage:"useAccordionItemContext: `context` is undefined. Seems you forgot to wrap the accordion item parts in `<AccordionItem />` "}),A=p(((r,t)=>{var{children:s,className:a}=r,i=o(r),{htmlProps:n}=i,c=j(i,["htmlProps"]),d=_({},m().container,{overflowAnchor:"none"}),l=e.useMemo((()=>c),[c]);return e.createElement(E,{value:l},e.createElement(u.div,_({ref:t},n,{className:f("chakra-accordion__item",a),__css:d}),y(s,{isExpanded:!!c.isOpen,isDisabled:!!c.isDisabled})))}));v&&(A.displayName="AccordionItem");var b=p(((r,t)=>{var{getButtonProps:s}=g(),o=s(r,t),a=_({display:"flex",alignItems:"center",width:"100%",outline:0},m().button);return e.createElement(u.button,_({},o,{className:f("chakra-accordion__button",r.className),__css:a}))}));v&&(b.displayName="AccordionButton");var x=p(((r,t)=>{var{reduceMotion:s}=a(),{getPanelProps:o,isOpen:i}=g(),n=o(r,t),c=f("chakra-accordion__panel",r.className),l=m();s||delete n.hidden;var p=e.createElement(u.div,_({},n,{__css:l.panel,className:c}));return s?p:e.createElement(d,{in:i},p)}));v&&(x.displayName="AccordionPanel");var M=r=>{var{isOpen:t,isDisabled:s}=g(),{reduceMotion:o}=a(),i=f("chakra-accordion__icon",r.className),n=_({opacity:s?.4:1,transform:t?"rotate(-180deg)":void 0,transition:o?void 0:"transform 0.2s",transformOrigin:"center"},m().icon);return e.createElement(l,_({viewBox:"0 0 24 24","aria-hidden":!0,className:i,__css:n},r),e.createElement("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"}))};v&&(M.displayName="AccordionIcon");export{N as Accordion,b as AccordionButton,M as AccordionIcon,A as AccordionItem,x as AccordionPanel};
//# sourceMappingURL=accordion.js.map
