@bikdotai/bik-component-library 0.0.559-2 → 0.0.559-4

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.
@@ -21,5 +21,6 @@ export interface AccordionProps {
21
21
  isOpen?: boolean;
22
22
  buttonLinkText?: string;
23
23
  onButtonLinkClick?: () => void;
24
+ captionStyle?: React.CSSProperties;
24
25
  }
25
26
  export declare const BikAccordion: React.FC<AccordionProps>;
@@ -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("../button/Button.js"),o=require("./Accordion.style.js"),i=require("./AccordionArrow.js");exports.BikAccordion=s=>{var c,a;const[l,d]=r.useState(!1),u=r.useRef(null),h=r.useRef(null);r.useEffect((()=>{s.autoOpen&&v(s.autoOpen,{})}),[s.autoOpen]),r.useEffect((()=>{void 0!==s.isOpen&&v(s.isOpen,{})}),[s.isOpen]);const v=(e,r)=>{var t,n;h.current&&u.current&&("keydown"===r.type&&"Enter"!==r.key||(e!==l&&d(e),e?(h.current.style.maxHeight=(null!==(t=s.childrenMaxHeight)&&void 0!==t?t:h.current.scrollHeight)+"px",u.current.style.transform="rotate(180deg)",u.current.style.transition="transform 0.25s ease-in-out",h.current.style.transition="max-height 0.25s ease-in-out"):(h.current.style.maxHeight="",u.current.style.transform="rotate(0deg)",u.current.style.transition="transform 0.25s ease-in-out",h.current.style.transition="padding 0s"),null===(n=s.onToggleAccordion)||void 0===n||n.call(s,e)))};return r.useEffect((()=>{const e=new MutationObserver((()=>{l&&h.current&&(h.current.style.maxHeight=h.current.scrollHeight+"px")}));return h.current&&e.observe(h.current,{childList:!0,subtree:!0}),()=>{e.disconnect()}}),[l]),r.useEffect((()=>{var e;l&&(null==s?void 0:s.refresh)&&(null===(e=null==h?void 0:h.current)||void 0===e?void 0:e.scrollHeight)&&!s.childrenMaxHeight&&setTimeout((()=>{h.current.style.maxHeight=h.current.scrollHeight+"px"}),100)}),[l,null==s?void 0:s.refresh,null===(c=null==h?void 0:h.current)||void 0===c?void 0:c.scrollHeight]),e.jsxs(o.default,Object.assign({className:"accordion",isActive:l,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,openDirection:s.openDirection},{children:[e.jsxs("div",Object.assign({className:"accordion__overview "+(l?"active":""),onClick:e=>v(!l,e),onKeyDown:e=>v(!l,e),role:"button",tabIndex:0},{children:[!s.rightActionComponent&&e.jsxs("div",Object.assign({className:"accordion__overview__header",style:null!==(a=s.headerStyles)&&void 0!==a?a:{}},{children:[e.jsxs(o.AccordionHeaderGroup,{children:["string"==typeof s.header?e.jsx(t.TitleRegular,{children:null==s?void 0:s.header}):s.header,e.jsx(n.Button,{buttonText:s.buttonLinkText,buttonType:"text",darkMode:!0,onClick:s.onButtonLinkClick})]}),e.jsx(i.default,{arrowColor:s.arrowColor,isNewIcon:!0,ref:u})]})),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,{arrowColor:s.arrowColor,isNewIcon:!0,ref:u}),"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(),onKeyDown:e=>{"Enter"===e.key&&e.stopPropagation()},role:"button",tabIndex:0},{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:h,className:"accordion__content"},{children:s.children}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../TypographyStyle.js"),n=require("../button/Button.js"),o=require("./Accordion.style.js"),i=require("./AccordionArrow.js");exports.BikAccordion=s=>{var c,a;const[l,d]=r.useState(!1),u=r.useRef(null),h=r.useRef(null);r.useEffect((()=>{s.autoOpen&&v(s.autoOpen,{})}),[s.autoOpen]),r.useEffect((()=>{void 0!==s.isOpen&&v(s.isOpen,{})}),[s.isOpen]);const v=(e,r)=>{var t,n;h.current&&u.current&&("keydown"===r.type&&"Enter"!==r.key||(e!==l&&d(e),e?(h.current.style.maxHeight=(null!==(t=s.childrenMaxHeight)&&void 0!==t?t:h.current.scrollHeight)+"px",u.current.style.transform="rotate(180deg)",u.current.style.transition="transform 0.25s ease-in-out",h.current.style.transition="max-height 0.25s ease-in-out"):(h.current.style.maxHeight="",u.current.style.transform="rotate(0deg)",u.current.style.transition="transform 0.25s ease-in-out",h.current.style.transition="padding 0s"),null===(n=s.onToggleAccordion)||void 0===n||n.call(s,e)))};return r.useEffect((()=>{const e=new MutationObserver((()=>{l&&h.current&&(h.current.style.maxHeight=h.current.scrollHeight+"px")}));return h.current&&e.observe(h.current,{childList:!0,subtree:!0}),()=>{e.disconnect()}}),[l]),r.useEffect((()=>{var e;l&&(null==s?void 0:s.refresh)&&(null===(e=null==h?void 0:h.current)||void 0===e?void 0:e.scrollHeight)&&!s.childrenMaxHeight&&setTimeout((()=>{h.current.style.maxHeight=h.current.scrollHeight+"px"}),100)}),[l,null==s?void 0:s.refresh,null===(c=null==h?void 0:h.current)||void 0===c?void 0:c.scrollHeight]),e.jsxs(o.default,Object.assign({className:"accordion",isActive:l,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,openDirection:s.openDirection},{children:[e.jsxs("div",Object.assign({className:"accordion__overview "+(l?"active":""),onClick:e=>v(!l,e),onKeyDown:e=>v(!l,e),role:"button",tabIndex:0},{children:[!s.rightActionComponent&&e.jsxs("div",Object.assign({className:"accordion__overview__header",style:null!==(a=s.headerStyles)&&void 0!==a?a:{}},{children:[e.jsxs(o.AccordionHeaderGroup,{children:["string"==typeof s.header?e.jsx(t.TitleRegular,{children:null==s?void 0:s.header}):s.header,e.jsx(n.Button,{buttonText:s.buttonLinkText,buttonType:"text",darkMode:!0,onClick:s.onButtonLinkClick})]}),e.jsx(i.default,{arrowColor:s.arrowColor,isNewIcon:!0,ref:u})]})),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,{arrowColor:s.arrowColor,isNewIcon:!0,ref:u}),"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(),onKeyDown:e=>{"Enter"===e.key&&e.stopPropagation()},role:"button",tabIndex:0},{children:s.rightActionComponent}))]})),(null==s?void 0:s.caption)&&e.jsx("div",Object.assign({className:"accordion__overview__caption"},{children:e.jsx(t.BodySecondary,{children:e.jsx("div",Object.assign({style:s.captionStyle},{children:s.caption}))})}))]})),e.jsx("div",Object.assign({ref:h,className:"accordion__content"},{children:s.children}))]}))};
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Menus: ({
2
3
  displayName: string;
3
4
  key: number;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),s=require("../../constants/Theme.js"),r=require("../TypographyStyle.js"),a=require("./Tabs.styles.js");const n=r=>{var n,l;const{tabs:i,initialTab:c,onTabSelected:d,TabItemStyledProps:b,selectedTab:u,extendedBorder:p,rightComponent:x,size:T="default",isSquared:m=!1,containerStyles:g}=r,[y,C]=t.useState(c||i[0].key),{colorsV2:j}=s.DEFAULT_THEME;t.useEffect((()=>{u&&C(u)}),[u]);const S=r.backgroundColor,h=null!==(n=r.selectedTextColor)&&void 0!==n?n:j.background.brand,q=null!==(l=r.textColor)&&void 0!==l?l:j.content.secondary;return e.jsxs(a.TabHeader,Object.assign({style:null!=g?g:{},bgColor:S},{children:[i.map(((t,s)=>e.jsx(o,{hasEqualSpacing:r.hasEqualSpacing,selectedTextColor:h,textColor:q,tab:t,currentTab:y,TabItemStyledProps:b,IconComponent:t.icon,size:T,setCurrentTab:e=>{d(e),C(e)},isSquared:m,isFirstlement:0==s,isLastElement:s==i.length-1},t.key))),p&&e.jsx(a.EmptyTab,{}),e.jsx(a.RightComponent,{children:x})]}))},o=n=>{const{tab:o,currentTab:l,setCurrentTab:i,TabItemStyledProps:c,IconComponent:d,size:b="default",isSquared:u=!1,isFirstlement:p,isLastElement:x}=n,T=o.key===l,{colorsV2:m}=s.DEFAULT_THEME,g=t.useCallback((()=>Object.assign(Object.assign({},c),{borderRadius:n.isSquared?p?"4px 0px 0px 4px":x?"0px 4px 4px 0px":"":""})),[]);return e.jsxs(a.TabItem,Object.assign({style:g(),selected:T,hasEqualSpacing:n.hasEqualSpacing,onClick:()=>i(n.tab.key),selectedTextColor:n.selectedTextColor,isSquared:u},{children:[d&&e.jsx(d,{selected:T?m.background.brand:m.content.secondary}),e.jsx(a.TabItemText,Object.assign({style:"small"===b?{fontSize:14,fontStyle:"normal",fontWeight:600}:void 0,textColor:n.textColor,selectedTextColor:n.selectedTextColor,selected:T},{children:o.title})),void 0!==o.trailingNumber&&null!==o.trailingNumber&&e.jsx(a.TrailingNumberContainer,Object.assign({selected:T},{children:e.jsx(r.BodyCaption,Object.assign({color:m.content.primaryInverse},{children:o.trailingNumber}))}))]}))};n.displayName="Tabs",o.displayName="TabItemComponent",exports.TabItemComponent=o,exports.Tabs=n;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),s=require("../../constants/Theme.js"),r=require("../TypographyStyle.js"),n=require("./Tabs.styles.js");const o=r=>{var o,l;const{tabs:i,initialTab:c,onTabSelected:d,TabItemStyledProps:b,selectedTab:u,extendedBorder:p,rightComponent:x,size:T="default",isSquared:m=!1,containerStyles:g}=r,[y,C]=t.useState(c||i[0].key),{colorsV2:j}=s.DEFAULT_THEME;t.useEffect((()=>{u&&u!==y&&C(u)}),[u,y]);const S=r.backgroundColor,h=null!==(o=r.selectedTextColor)&&void 0!==o?o:j.background.brand,q=null!==(l=r.textColor)&&void 0!==l?l:j.content.secondary;return e.jsxs(n.TabHeader,Object.assign({style:null!=g?g:{},bgColor:S},{children:[i.map(((t,s)=>e.jsx(a,{hasEqualSpacing:r.hasEqualSpacing,selectedTextColor:h,textColor:q,tab:t,currentTab:y,TabItemStyledProps:b,IconComponent:t.icon,size:T,setCurrentTab:e=>{C(e),d&&d(e)},isSquared:m,isFirstlement:0==s,isLastElement:s==i.length-1},t.key))),p&&e.jsx(n.EmptyTab,{}),e.jsx(n.RightComponent,{children:x})]}))},a=o=>{const{tab:a,currentTab:l,setCurrentTab:i,TabItemStyledProps:c,IconComponent:d,size:b="default",isSquared:u=!1,isFirstlement:p,isLastElement:x}=o;console.log(a.key,l);const T=a.key===l,{colorsV2:m}=s.DEFAULT_THEME,g=t.useCallback((()=>Object.assign(Object.assign({},c),{borderRadius:o.isSquared?p?"4px 0px 0px 4px":x?"0px 4px 4px 0px":"":""})),[]);return e.jsxs(n.TabItem,Object.assign({style:g(),selected:T,hasEqualSpacing:o.hasEqualSpacing,onClick:()=>i(o.tab.key),selectedTextColor:o.selectedTextColor,isSquared:u},{children:[d&&e.jsx(d,{selected:T?m.background.brand:m.content.secondary}),e.jsx(n.TabItemText,Object.assign({style:"small"===b?{fontSize:14,fontStyle:"normal",fontWeight:600}:void 0,textColor:o.textColor,selectedTextColor:o.selectedTextColor,selected:T},{children:a.title})),void 0!==a.trailingNumber&&null!==a.trailingNumber&&e.jsx(n.TrailingNumberContainer,Object.assign({selected:T},{children:e.jsx(r.BodyCaption,Object.assign({color:m.content.primaryInverse},{children:a.trailingNumber}))}))]}))};o.displayName="Tabs",a.displayName="TabItemComponent",exports.TabItemComponent=a,exports.Tabs=o;
@@ -21,5 +21,6 @@ export interface AccordionProps {
21
21
  isOpen?: boolean;
22
22
  buttonLinkText?: string;
23
23
  onButtonLinkClick?: () => void;
24
+ captionStyle?: React.CSSProperties;
24
25
  }
25
26
  export declare const BikAccordion: React.FC<AccordionProps>;
@@ -1 +1 @@
1
- import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useState as o,useRef as n,useEffect as t}from"react";import{TitleRegular as i,BodySecondary as c}from"../TypographyStyle.js";import{Button as a}from"../button/Button.js";import s,{AccordionHeaderGroup as l}from"./Accordion.style.js";import d from"./AccordionArrow.js";const u=u=>{var h,v;const[g,p]=o(!1),m=n(null),y=n(null);t((()=>{u.autoOpen&&b(u.autoOpen,{})}),[u.autoOpen]),t((()=>{void 0!==u.isOpen&&b(u.isOpen,{})}),[u.isOpen]);const b=(e,r)=>{var o,n;y.current&&m.current&&("keydown"===r.type&&"Enter"!==r.key||(e!==g&&p(e),e?(y.current.style.maxHeight=(null!==(o=u.childrenMaxHeight)&&void 0!==o?o:y.current.scrollHeight)+"px",m.current.style.transform="rotate(180deg)",m.current.style.transition="transform 0.25s ease-in-out",y.current.style.transition="max-height 0.25s ease-in-out"):(y.current.style.maxHeight="",m.current.style.transform="rotate(0deg)",m.current.style.transition="transform 0.25s ease-in-out",y.current.style.transition="padding 0s"),null===(n=u.onToggleAccordion)||void 0===n||n.call(u,e)))};return t((()=>{const e=new MutationObserver((()=>{g&&y.current&&(y.current.style.maxHeight=y.current.scrollHeight+"px")}));return y.current&&e.observe(y.current,{childList:!0,subtree:!0}),()=>{e.disconnect()}}),[g]),t((()=>{var e;g&&(null==u?void 0:u.refresh)&&(null===(e=null==y?void 0:y.current)||void 0===e?void 0:e.scrollHeight)&&!u.childrenMaxHeight&&setTimeout((()=>{y.current.style.maxHeight=y.current.scrollHeight+"px"}),100)}),[g,null==u?void 0:u.refresh,null===(h=null==y?void 0:y.current)||void 0===h?void 0:h.scrollHeight]),e(s,Object.assign({className:"accordion",isActive:g,width:null==u?void 0:u.width,contentMargin:null==u?void 0:u.contentMargin,headerPadding:u.headerPadding,skipHoverState:u.skipHoverHeader,showBorders:u.showBorders,backgroundColor:u.backgroundColor,openDirection:u.openDirection},{children:[e("div",Object.assign({className:"accordion__overview "+(g?"active":""),onClick:e=>b(!g,e),onKeyDown:e=>b(!g,e),role:"button",tabIndex:0},{children:[!u.rightActionComponent&&e("div",Object.assign({className:"accordion__overview__header",style:null!==(v=u.headerStyles)&&void 0!==v?v:{}},{children:[e(l,{children:["string"==typeof u.header?r(i,{children:null==u?void 0:u.header}):u.header,r(a,{buttonText:u.buttonLinkText,buttonType:"text",darkMode:!0,onClick:u.onButtonLinkClick})]}),r(d,{arrowColor:u.arrowColor,isNewIcon:!0,ref:m})]})),u.rightActionComponent&&e("div",Object.assign({className:"accordion__overview__header"},{children:[e("div",Object.assign({className:"accordion__overview__title-wrapper"},{children:[r(d,{arrowColor:u.arrowColor,isNewIcon:!0,ref:m}),"string"==typeof u.header?r(i,{children:null==u?void 0:u.header}):u.header]})),r("div",Object.assign({onClick:e=>e.stopPropagation(),onKeyDown:e=>{"Enter"===e.key&&e.stopPropagation()},role:"button",tabIndex:0},{children:u.rightActionComponent}))]})),(null==u?void 0:u.caption)&&r("div",Object.assign({className:"accordion__overview__caption"},{children:r(c,{children:u.caption})}))]})),r("div",Object.assign({ref:y,className:"accordion__content"},{children:u.children}))]}))};export{u as BikAccordion};
1
+ import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useState as t,useRef as n,useEffect as o}from"react";import{TitleRegular as i,BodySecondary as c}from"../TypographyStyle.js";import{Button as s}from"../button/Button.js";import a,{AccordionHeaderGroup as l}from"./Accordion.style.js";import d from"./AccordionArrow.js";const u=u=>{var h,v;const[g,p]=t(!1),m=n(null),y=n(null);o((()=>{u.autoOpen&&b(u.autoOpen,{})}),[u.autoOpen]),o((()=>{void 0!==u.isOpen&&b(u.isOpen,{})}),[u.isOpen]);const b=(e,r)=>{var t,n;y.current&&m.current&&("keydown"===r.type&&"Enter"!==r.key||(e!==g&&p(e),e?(y.current.style.maxHeight=(null!==(t=u.childrenMaxHeight)&&void 0!==t?t:y.current.scrollHeight)+"px",m.current.style.transform="rotate(180deg)",m.current.style.transition="transform 0.25s ease-in-out",y.current.style.transition="max-height 0.25s ease-in-out"):(y.current.style.maxHeight="",m.current.style.transform="rotate(0deg)",m.current.style.transition="transform 0.25s ease-in-out",y.current.style.transition="padding 0s"),null===(n=u.onToggleAccordion)||void 0===n||n.call(u,e)))};return o((()=>{const e=new MutationObserver((()=>{g&&y.current&&(y.current.style.maxHeight=y.current.scrollHeight+"px")}));return y.current&&e.observe(y.current,{childList:!0,subtree:!0}),()=>{e.disconnect()}}),[g]),o((()=>{var e;g&&(null==u?void 0:u.refresh)&&(null===(e=null==y?void 0:y.current)||void 0===e?void 0:e.scrollHeight)&&!u.childrenMaxHeight&&setTimeout((()=>{y.current.style.maxHeight=y.current.scrollHeight+"px"}),100)}),[g,null==u?void 0:u.refresh,null===(h=null==y?void 0:y.current)||void 0===h?void 0:h.scrollHeight]),e(a,Object.assign({className:"accordion",isActive:g,width:null==u?void 0:u.width,contentMargin:null==u?void 0:u.contentMargin,headerPadding:u.headerPadding,skipHoverState:u.skipHoverHeader,showBorders:u.showBorders,backgroundColor:u.backgroundColor,openDirection:u.openDirection},{children:[e("div",Object.assign({className:"accordion__overview "+(g?"active":""),onClick:e=>b(!g,e),onKeyDown:e=>b(!g,e),role:"button",tabIndex:0},{children:[!u.rightActionComponent&&e("div",Object.assign({className:"accordion__overview__header",style:null!==(v=u.headerStyles)&&void 0!==v?v:{}},{children:[e(l,{children:["string"==typeof u.header?r(i,{children:null==u?void 0:u.header}):u.header,r(s,{buttonText:u.buttonLinkText,buttonType:"text",darkMode:!0,onClick:u.onButtonLinkClick})]}),r(d,{arrowColor:u.arrowColor,isNewIcon:!0,ref:m})]})),u.rightActionComponent&&e("div",Object.assign({className:"accordion__overview__header"},{children:[e("div",Object.assign({className:"accordion__overview__title-wrapper"},{children:[r(d,{arrowColor:u.arrowColor,isNewIcon:!0,ref:m}),"string"==typeof u.header?r(i,{children:null==u?void 0:u.header}):u.header]})),r("div",Object.assign({onClick:e=>e.stopPropagation(),onKeyDown:e=>{"Enter"===e.key&&e.stopPropagation()},role:"button",tabIndex:0},{children:u.rightActionComponent}))]})),(null==u?void 0:u.caption)&&r("div",Object.assign({className:"accordion__overview__caption"},{children:r(c,{children:r("div",Object.assign({style:u.captionStyle},{children:u.caption}))})}))]})),r("div",Object.assign({ref:y,className:"accordion__content"},{children:u.children}))]}))};export{u as BikAccordion};
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Menus: ({
2
3
  displayName: string;
3
4
  key: number;
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useEffect as r,useCallback as s}from"react";import{DEFAULT_THEME as n}from"../../constants/Theme.js";import{BodyCaption as l}from"../TypographyStyle.js";import{TabHeader as a,EmptyTab as i,RightComponent as c,TabItem as d,TabItemText as b,TrailingNumberContainer as m}from"./Tabs.styles.js";const p=s=>{var l,d;const{tabs:b,initialTab:m,onTabSelected:p,TabItemStyledProps:g,selectedTab:x,extendedBorder:y,rightComponent:T,size:C="default",isSquared:S=!1,containerStyles:h}=s,[j,f]=o(m||b[0].key),{colorsV2:q}=n;r((()=>{x&&f(x)}),[x]);const k=s.backgroundColor,I=null!==(l=s.selectedTextColor)&&void 0!==l?l:q.background.brand,O=null!==(d=s.textColor)&&void 0!==d?d:q.content.secondary;return e(a,Object.assign({style:null!=h?h:{},bgColor:k},{children:[b.map(((e,o)=>t(u,{hasEqualSpacing:s.hasEqualSpacing,selectedTextColor:I,textColor:O,tab:e,currentTab:j,TabItemStyledProps:g,IconComponent:e.icon,size:C,setCurrentTab:e=>{p(e),f(e)},isSquared:S,isFirstlement:0==o,isLastElement:o==b.length-1},e.key))),y&&t(i,{}),t(c,{children:T})]}))},u=o=>{const{tab:r,currentTab:a,setCurrentTab:i,TabItemStyledProps:c,IconComponent:p,size:u="default",isSquared:g=!1,isFirstlement:x,isLastElement:y}=o,T=r.key===a,{colorsV2:C}=n,S=s((()=>Object.assign(Object.assign({},c),{borderRadius:o.isSquared?x?"4px 0px 0px 4px":y?"0px 4px 4px 0px":"":""})),[]);return e(d,Object.assign({style:S(),selected:T,hasEqualSpacing:o.hasEqualSpacing,onClick:()=>i(o.tab.key),selectedTextColor:o.selectedTextColor,isSquared:g},{children:[p&&t(p,{selected:T?C.background.brand:C.content.secondary}),t(b,Object.assign({style:"small"===u?{fontSize:14,fontStyle:"normal",fontWeight:600}:void 0,textColor:o.textColor,selectedTextColor:o.selectedTextColor,selected:T},{children:r.title})),void 0!==r.trailingNumber&&null!==r.trailingNumber&&t(m,Object.assign({selected:T},{children:t(l,Object.assign({color:C.content.primaryInverse},{children:r.trailingNumber}))}))]}))};p.displayName="Tabs",u.displayName="TabItemComponent";export{u as TabItemComponent,p as Tabs};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useEffect as r,useCallback as s}from"react";import{DEFAULT_THEME as n}from"../../constants/Theme.js";import{BodyCaption as l}from"../TypographyStyle.js";import{TabHeader as a,EmptyTab as i,RightComponent as c,TabItem as d,TabItemText as b,TrailingNumberContainer as m}from"./Tabs.styles.js";const p=s=>{var l,d;const{tabs:b,initialTab:m,onTabSelected:p,TabItemStyledProps:g,selectedTab:y,extendedBorder:x,rightComponent:T,size:C="default",isSquared:S=!1,containerStyles:h}=s,[j,f]=o(m||b[0].key),{colorsV2:k}=n;r((()=>{y&&y!==j&&f(y)}),[y,j]);const q=s.backgroundColor,I=null!==(l=s.selectedTextColor)&&void 0!==l?l:k.background.brand,O=null!==(d=s.textColor)&&void 0!==d?d:k.content.secondary;return e(a,Object.assign({style:null!=h?h:{},bgColor:q},{children:[b.map(((e,o)=>t(u,{hasEqualSpacing:s.hasEqualSpacing,selectedTextColor:I,textColor:O,tab:e,currentTab:j,TabItemStyledProps:g,IconComponent:e.icon,size:C,setCurrentTab:e=>{f(e),p&&p(e)},isSquared:S,isFirstlement:0==o,isLastElement:o==b.length-1},e.key))),x&&t(i,{}),t(c,{children:T})]}))},u=o=>{const{tab:r,currentTab:a,setCurrentTab:i,TabItemStyledProps:c,IconComponent:p,size:u="default",isSquared:g=!1,isFirstlement:y,isLastElement:x}=o;console.log(r.key,a);const T=r.key===a,{colorsV2:C}=n,S=s((()=>Object.assign(Object.assign({},c),{borderRadius:o.isSquared?y?"4px 0px 0px 4px":x?"0px 4px 4px 0px":"":""})),[]);return e(d,Object.assign({style:S(),selected:T,hasEqualSpacing:o.hasEqualSpacing,onClick:()=>i(o.tab.key),selectedTextColor:o.selectedTextColor,isSquared:g},{children:[p&&t(p,{selected:T?C.background.brand:C.content.secondary}),t(b,Object.assign({style:"small"===u?{fontSize:14,fontStyle:"normal",fontWeight:600}:void 0,textColor:o.textColor,selectedTextColor:o.selectedTextColor,selected:T},{children:r.title})),void 0!==r.trailingNumber&&null!==r.trailingNumber&&t(m,Object.assign({selected:T},{children:t(l,Object.assign({color:C.content.primaryInverse},{children:r.trailingNumber}))}))]}))};p.displayName="Tabs",u.displayName="TabItemComponent";export{u as TabItemComponent,p as Tabs};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.559-2",
3
+ "version": "0.0.559-4",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",