@bikdotai/bik-component-library 0.0.212-beta.4 → 0.0.212-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/accordion/Accordion.d.ts +1 -0
- package/dist/cjs/components/accordion/Accordion.js +1 -1
- package/dist/cjs/components/accordion/Accordion.style.d.ts +1 -0
- package/dist/cjs/components/accordion/Accordion.style.js +1 -0
- package/dist/esm/components/accordion/Accordion.d.ts +1 -0
- package/dist/esm/components/accordion/Accordion.js +1 -1
- package/dist/esm/components/accordion/Accordion.style.d.ts +1 -0
- package/dist/esm/components/accordion/Accordion.style.js +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../TypographyStyle.js"),n=require("./Accordion.style.js"),i=require("./AccordionArrow.js");exports.BikAccordion=s=>{const[o,a]=r.useState(!1),c=r.useRef(null),d=r.useRef(null),l=(e,r)=>{
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../TypographyStyle.js"),n=require("./Accordion.style.js"),i=require("./AccordionArrow.js");exports.BikAccordion=s=>{const[o,a]=r.useState(!1),c=r.useRef(null),d=r.useRef(null),l=(e,r)=>{d.current&&c.current&&("keydown"===r.type&&"Enter"!==r.key||(a(e),d.current.style.maxHeight?(d.current.style.maxHeight="",c.current.style.transform="rotate(0deg)",c.current.style.transition="transform 0.25s ease-in-out",d.current.style.transition="padding 0s"):(d.current.style.maxHeight=d.current.scrollHeight+"px",c.current.style.transform="rotate(180deg)",c.current.style.transition="transform 0.25s ease-in-out",d.current.style.transition="max-height 0.25s ease-in-out")))};return e.jsxs(n.default,Object.assign({className:"accordion",isActive:o,width:null==s?void 0:s.width,contentMargin:null==s?void 0:s.contentMargin,headerPadding:s.headerPadding,skipHoverState:s.skipHoverHeader,showBorders:s.showBorders,backgroundColor:s.backgroundColor},{children:[e.jsxs("div",Object.assign({className:"accordion__overview "+(o?"active":""),onClick:e=>l(!o,e),onKeyDown:e=>l(!o,e),role:"button",tabIndex:0},{children:[!s.rightActionComponent&&e.jsxs("div",Object.assign({className:"accordion__overview__header"},{children:["string"==typeof s.header?e.jsx(t.TitleRegular,{children:null==s?void 0:s.header}):s.header,e.jsx(i.default,{isNewIcon:!1,ref:c})]})),s.rightActionComponent&&e.jsxs("div",Object.assign({className:"accordion__overview__header"},{children:[e.jsxs("div",Object.assign({className:"accordion__overview__title-wrapper"},{children:[e.jsx(i.default,{isNewIcon:!0,ref:c}),"string"==typeof s.header?e.jsx(t.TitleRegular,{children:null==s?void 0:s.header}):s.header]})),e.jsx("div",Object.assign({onClick:e=>e.stopPropagation()},{children:s.rightActionComponent}))]})),(null==s?void 0:s.caption)&&e.jsx("div",Object.assign({className:"accordion__overview__caption"},{children:e.jsx(t.BodySecondary,{children:s.caption})}))]})),e.jsx("div",Object.assign({ref:d,className:"accordion__content"},{children:s.children}))]}))};
|
|
@@ -5,5 +5,6 @@ declare const AccordionStyle: import("styled-components").StyledComponent<"div",
|
|
|
5
5
|
skipHoverState?: boolean | undefined;
|
|
6
6
|
headerPadding?: string | undefined;
|
|
7
7
|
showBorders?: boolean | undefined;
|
|
8
|
+
backgroundColor?: string | undefined;
|
|
8
9
|
}, never>;
|
|
9
10
|
export default AccordionStyle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useState as n,useRef as t}from"react";import{TitleRegular as
|
|
1
|
+
import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useState as n,useRef as t}from"react";import{TitleRegular as o,BodySecondary as i}from"../TypographyStyle.js";import c from"./Accordion.style.js";import a from"./AccordionArrow.js";const s=s=>{const[d,l]=n(!1),h=t(null),g=t(null),m=(e,r)=>{g.current&&h.current&&("keydown"===r.type&&"Enter"!==r.key||(l(e),g.current.style.maxHeight?(g.current.style.maxHeight="",h.current.style.transform="rotate(0deg)",h.current.style.transition="transform 0.25s ease-in-out",g.current.style.transition="padding 0s"):(g.current.style.maxHeight=g.current.scrollHeight+"px",h.current.style.transform="rotate(180deg)",h.current.style.transition="transform 0.25s ease-in-out",g.current.style.transition="max-height 0.25s ease-in-out")))};return e(c,Object.assign({className:"accordion",isActive:d,width:null==s?void 0:s.width,contentMargin:null==s?void 0:s.contentMargin,headerPadding:s.headerPadding,skipHoverState:s.skipHoverHeader,showBorders:s.showBorders,backgroundColor:s.backgroundColor},{children:[e("div",Object.assign({className:"accordion__overview "+(d?"active":""),onClick:e=>m(!d,e),onKeyDown:e=>m(!d,e),role:"button",tabIndex:0},{children:[!s.rightActionComponent&&e("div",Object.assign({className:"accordion__overview__header"},{children:["string"==typeof s.header?r(o,{children:null==s?void 0:s.header}):s.header,r(a,{isNewIcon:!1,ref:h})]})),s.rightActionComponent&&e("div",Object.assign({className:"accordion__overview__header"},{children:[e("div",Object.assign({className:"accordion__overview__title-wrapper"},{children:[r(a,{isNewIcon:!0,ref:h}),"string"==typeof s.header?r(o,{children:null==s?void 0:s.header}):s.header]})),r("div",Object.assign({onClick:e=>e.stopPropagation()},{children:s.rightActionComponent}))]})),(null==s?void 0:s.caption)&&r("div",Object.assign({className:"accordion__overview__caption"},{children:r(i,{children:s.caption})}))]})),r("div",Object.assign({ref:g,className:"accordion__content"},{children:s.children}))]}))};export{s as BikAccordion};
|
|
@@ -5,5 +5,6 @@ declare const AccordionStyle: import("styled-components").StyledComponent<"div",
|
|
|
5
5
|
skipHoverState?: boolean | undefined;
|
|
6
6
|
headerPadding?: string | undefined;
|
|
7
7
|
showBorders?: boolean | undefined;
|
|
8
|
+
backgroundColor?: string | undefined;
|
|
8
9
|
}, never>;
|
|
9
10
|
export default AccordionStyle;
|
|
@@ -4,6 +4,7 @@ import e from"styled-components";import{COLORS as r}from"../../constants/Theme.j
|
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
border: ${e=>e.showBorders?"1px solid "+r.stroke.primary:""};
|
|
6
6
|
border-radius: ${e=>e.showBorders?"4px":""};
|
|
7
|
+
background: ${e=>e.backgroundColor||"transparent"};
|
|
7
8
|
.accordion {
|
|
8
9
|
&__overview {
|
|
9
10
|
display: flex;
|