@guruhotel/aura-ui
Version:
⚛️ React UI library by GuruHotel
1 lines • 2.94 kB
JavaScript
exports.__esModule=!0,exports.StyledTrigger=exports.StyledItem=exports.StyledHeader=exports.StyledContent=exports.StyledAccordion=void 0;var e=require("../theme"),t=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=i(t);if(n&&n.has(e))return n.get(e);var d={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var a=r?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(d,o,a):d[o]=e[o]}d.default=e,n&&n.set(e,d);return d}(require("@radix-ui/react-accordion")),n=require("../common-variants");function i(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(i=function(e){return e?n:t})(e)}const d=(0,e.keyframes)({from:{height:0},to:{height:"var(--radix-accordion-content-height)"}}),r=(0,e.keyframes)({from:{height:"var(--radix-accordion-content-height)"},to:{height:0}}),o=(0,e.styled)(t.Item,{overflow:"hidden",marginTop:1,"&:first-child":{marginTop:0,borderTopLeftRadius:4,borderTopRightRadius:4},"&:last-child":{borderBottomLeftRadius:4,borderBottomRightRadius:4}});exports.StyledItem=o;const a=(0,e.styled)(t.Header,{all:"unset",display:"flex"});exports.StyledHeader=a;const l=(0,e.styled)(t.Trigger,{all:"unset",flex:1,display:"flex",alignItems:"center",justifyContent:"space-between",fontWeight:"$medium",boxShadow:"0 1px 0 $colors$blackA5",width:"$full",'&[data-state="closed"]':{backgroundColor:"white"},'&[data-state="open"]':{backgroundColor:"white"},"&:hover":{backgroundColor:"$gray2"}});exports.StyledTrigger=l;const s=(0,e.styled)(t.Content,{width:"$full",overflow:"hidden",'&[data-state="open"]':{animation:`${d} 300ms cubic-bezier(0.87, 0, 0.13, 1)`},'&[data-state="closed"]':{animation:`${r} 300ms cubic-bezier(0.87, 0, 0.13, 1)`}});exports.StyledContent=s;const p=(0,e.styled)(t.Root,{backgroundColor:"$gray2",boxShadow:"$sm",variants:{rounded:n.rounded,withAccessibility:{true:{[`& ${o}`]:{_focusWithin:{position:"relative",zIndex:1,boxShadow:"0 0 0 2px $colors$guru12"}}}},size:{xs:{[`& ${s}`]:{paddingInlineStart:"$2",paddingInlineEnd:"$2"},[`& ${l}`]:{fontSize:"$xs",height:"$6",paddingInlineStart:"$2",paddingInlineEnd:"$2"}},sm:{[`& ${s}`]:{paddingInlineStart:"$3",paddingInlineEnd:"$3"},[`& ${l}`]:{fontSize:"$sm",height:"$8",paddingInlineStart:"$3",paddingInlineEnd:"$3"}},md:{[`& ${s}`]:{paddingInlineStart:"$4",paddingInlineEnd:"$4"},[`& ${l}`]:{fontSize:"$md",height:"$10",paddingInlineStart:"$4",paddingInlineEnd:"$4"}},lg:{[`& ${s}`]:{paddingInlineStart:"$6",paddingInlineEnd:"$6"},[`& ${l}`]:{fontSize:"$lg",height:"$12",paddingInlineStart:"$6",paddingInlineEnd:"$6"}},xl:{[`& ${s}`]:{paddingInlineStart:"$8",paddingInlineEnd:"$8"},[`& ${l}`]:{fontSize:"$xl",height:"$14",paddingInlineStart:"$8",paddingInlineEnd:"$8"}}}},defaultVariants:{rounded:"lg",size:"xs"}});exports.StyledAccordion=p;