@bikdotai/bik-component-library 0.0.659-beta.0 → 0.0.659-beta.10
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/alerts/Alert.d.ts +1 -0
- package/dist/cjs/components/alerts/Alert.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.d.ts +0 -2
- package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
- package/dist/esm/components/alerts/Alert.d.ts +1 -0
- package/dist/esm/components/alerts/Alert.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.d.ts +0 -2
- package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("./Alert.styled.js"),i=require("./AlertHelper.js"),r=require("../TypographyStyle.js"),o=require("../../constants/Theme.js");exports.Alert=l=>{var n,s;return e.jsxs(t.AlertStyle,Object.assign({type:l.type,contentPosition:l.contentPosition,style:l.containerStyle},{children:[l.icon&&e.jsx("div",Object.assign({style:Object.assign(Object.assign({},null==l?void 0:l.iconStyle),{display:(null===(n=null==l?void 0:l.iconStyle)||void 0===n?void 0:n.display)||"flex",alignSelf:(null===(s=null==l?void 0:l.iconStyle)||void 0===s?void 0:s.alignSelf)||"flex-start"})},{children:e.jsx(l.icon,{color:i.COLOR_CONFIG_MAP[l.type].textColor,height:16,width:16})})),e.jsx(r.BodyCaption,Object.assign({style:{color:l.textColor||i.COLOR_CONFIG_MAP[l.type].textColor,marginLeft:8,marginRight:4}},{children:l.text})),l.redirectToText&&l.redirectTo&&e.jsx(r.BodyCaption,Object.assign({style:{color:o.COLORS.text.brand,cursor:"pointer",textDecoration:"underline"},onClick:()=>{l.redirectTo&&window.open(l.redirectTo,"_blank")}},{children:l.redirectToText}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("./Alert.styled.js"),i=require("./AlertHelper.js"),r=require("../TypographyStyle.js"),o=require("../../constants/Theme.js");exports.Alert=l=>{var n,s;return e.jsxs(t.AlertStyle,Object.assign({type:l.type,contentPosition:l.contentPosition,style:l.containerStyle},{children:[l.icon&&e.jsx("div",Object.assign({style:Object.assign(Object.assign({},null==l?void 0:l.iconStyle),{display:(null===(n=null==l?void 0:l.iconStyle)||void 0===n?void 0:n.display)||"flex",alignSelf:(null===(s=null==l?void 0:l.iconStyle)||void 0===s?void 0:s.alignSelf)||"flex-start"})},{children:e.jsx(l.icon,{color:i.COLOR_CONFIG_MAP[l.type].textColor,height:16,width:16})})),e.jsx(r.BodyCaption,Object.assign({style:{color:l.textColor||i.COLOR_CONFIG_MAP[l.type].textColor,marginLeft:8,marginRight:4}},{children:l.text})),l.redirectToText&&l.redirectTo&&e.jsx(r.BodyCaption,Object.assign({style:{color:o.COLORS.text.brand,cursor:"pointer",textDecoration:"underline"},onClick:()=>{"INTERNAL"===l.redirectTo&&l.handleRedirectButtonClick?l.handleRedirectButtonClick():l.redirectTo&&window.open(l.redirectTo,"_blank")}},{children:l.redirectToText}))]}))};
|
|
@@ -37,7 +37,5 @@ export type LineChartProps = {
|
|
|
37
37
|
titleTooltipCallback?: (context: any) => void;
|
|
38
38
|
isInternationalStore?: boolean;
|
|
39
39
|
customYHeaders?: any;
|
|
40
|
-
legendsAndIconDirection?: 'row-reverse' | 'row';
|
|
41
|
-
headerIcons?: React.ReactNode[];
|
|
42
40
|
};
|
|
43
41
|
export declare const LineChart: React.FC<LineChartProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("chart.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("chart.js"),l=require("react"),r=require("react-chartjs-2"),n=require("../../../TypographyStyle.js"),i=require("../../../../constants/Theme.js"),o=require("../utils/calcPercentage.js"),a=require("./LineChart.styled.js");t.Chart.register(t.CategoryScale,t.LinearScale,t.PointElement,t.BarElement,t.LineElement,t.ArcElement,t.Filler,t.Title,t.Tooltip,t.Legend);exports.LineChart=t=>{let{scaleText:s,labels:d,canvasHeight:c,datas:u,maintainAspectRatio:g=!1,stepSize:p,min:y,max:b,isZeroState:v,tension:C,isNewStyles:O,prefixCurrencyInYAxis:h,pointRadius:x,useKFormat:S,lineThickness:j,ticksLabelCallback:m,labelCallback:L,afterBodyCallBack:k,titleTooltipCallback:f,isInternationalStore:R,customYHeaders:q}=t;var B,w,F;const[T,E]=l.useState(null),z=l.useRef();l.useEffect((()=>{var e,t,l,r;if(null===(r=null===(l=null===(t=null===(e=z.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.y)||void 0===l?void 0:l.ticks)||void 0===r?void 0:r.length){const e=38*z.current.scales.y.ticks.length;E(e)}}),[z]);const I=u.map((e=>({text:e.legend,color:e.lineColor?e.lineColor:e.dotted?i.COLORS.content.placeholder:i.COLORS.background.brand,square:e.squareLegends}))),$={labels:d,datasets:u.map(((e,t)=>{var l,r,n;return Object.assign(Object.assign({tension:null!=C?C:.4,fill:e.gradient?"start":0},((e,t)=>{const l={borderColor:e||(t?i.COLORS.content.placeholder:i.COLORS.background.brand)};return O?Object.assign({pointStyle:"circle",pointRadius:x||(d&&d.length>10?2.5:4),pointBorderColor:"transparent",pointBackgroundColor:e||(t?i.COLORS.content.placeholder:i.COLORS.background.brand)},l):Object.assign({pointRadius:null!=x?x:1},l)})(e.lineColor,e.dotted)),{borderDash:e.dotted?[8,3]:void 0,data:e.data,borderWidth:null!==(r=null!==(l=e.lineWidth)&&void 0!==l?l:j)&&void 0!==r?r:2,backgroundColor:e.gradient?e=>{const t=e.chart.ctx.createLinearGradient(0,0,0,T?T-75:150);return t.addColorStop(0,"#F1EEFB"),t.addColorStop(1,"rgba(127, 86, 217, 0)"),t}:null!==(n=e.backgroundColor)&&void 0!==n?n:"transparent",legend:e.legend})}))},A={maintainAspectRatio:g,responsive:!0,plugins:{legend:{display:!1},title:{display:!1},tooltip:{displayColors:null!=O&&O,titleFont:()=>({weight:"600",size:14,family:"inter"}),titleColor:()=>i.COLORS.content.primaryInverse,backgroundColor:i.COLORS.content.primary,callbacks:{labelTextColor:()=>i.COLORS.content.primaryInverse,title:f,label:L,afterBody:k},bodyFont:()=>({weight:"400",size:14,family:"inter"})}},scales:{y:{beginAtZero:!0,min:v?0:y,max:v?10:b,ticks:{color:i.COLORS.content.secondary,callback:e=>{var t,l;return S?`${null!==(t=null==s?void 0:s.yPrefix)&&void 0!==t?t:""}${R?o.truncateValueForInternationalStore(e):o.truncateValueForIndianStore(e)}${null!=h?h:""}`:q&&Object.keys(q).length>0?q[e]:`${null!==(l=null==s?void 0:s.yPrefix)&&void 0!==l?l:""}${e}${null!=h?h:""}`},font:{family:"inter",size:12,weight:"400"},stepSize:v?1:p,padding:O?24:0},title:{display:!!(null==s?void 0:s.y),text:null==s?void 0:s.y},grid:{color:i.COLORS.background.base,drawBorder:null===(B=null==s?void 0:s.yDrawBorder)||void 0===B||B}},x:{ticks:{callback:m,color:i.COLORS.content.secondary,font:{family:"inter",size:12,weight:"400"}},title:{display:!!(null==s?void 0:s.x),text:null==s?void 0:s.x},grid:{display:!1,drawBorder:null!==(w=null==s?void 0:s.xDrawBorder)&&void 0!==w&&w}}}};return e.jsxs("div",Object.assign({style:Object.assign(Object.assign({},g?{}:{height:null!==(F=null!=c?c:T)&&void 0!==F?F:204}),{display:"flex",flexDirection:"column",gap:2,width:"100%"})},{children:[e.jsx(a.LegendWrapper,{children:I.map(((t,l)=>{let{text:r,color:i,square:o}=t;return r?e.jsxs(a.LegendContainer,{children:[e.jsx(a.LegendColor,{color:i,square:o,newStyle:O}),e.jsx(n.BodyTiny,Object.assign({color:"#667085"},{children:r}))]},l):e.jsx(e.Fragment,{})}))}),e.jsx("div",Object.assign({style:{flex:1}},{children:e.jsx(r.Line,{ref:z,options:A,data:$})}))]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{AlertStyle as o}from"./Alert.styled.js";import{COLOR_CONFIG_MAP as i}from"./AlertHelper.js";import{BodyCaption as r}from"../TypographyStyle.js";import{COLORS as n}from"../../constants/Theme.js";const l=l=>{var c,s;return t(o,Object.assign({type:l.type,contentPosition:l.contentPosition,style:l.containerStyle},{children:[l.icon&&e("div",Object.assign({style:Object.assign(Object.assign({},null==l?void 0:l.iconStyle),{display:(null===(c=null==l?void 0:l.iconStyle)||void 0===c?void 0:c.display)||"flex",alignSelf:(null===(s=null==l?void 0:l.iconStyle)||void 0===s?void 0:s.alignSelf)||"flex-start"})},{children:e(l.icon,{color:i[l.type].textColor,height:16,width:16})})),e(r,Object.assign({style:{color:l.textColor||i[l.type].textColor,marginLeft:8,marginRight:4}},{children:l.text})),l.redirectToText&&l.redirectTo&&e(r,Object.assign({style:{color:n.text.brand,cursor:"pointer",textDecoration:"underline"},onClick:()=>{l.redirectTo&&window.open(l.redirectTo,"_blank")}},{children:l.redirectToText}))]}))};export{l as Alert};
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import{AlertStyle as o}from"./Alert.styled.js";import{COLOR_CONFIG_MAP as i}from"./AlertHelper.js";import{BodyCaption as r}from"../TypographyStyle.js";import{COLORS as n}from"../../constants/Theme.js";const l=l=>{var c,s;return t(o,Object.assign({type:l.type,contentPosition:l.contentPosition,style:l.containerStyle},{children:[l.icon&&e("div",Object.assign({style:Object.assign(Object.assign({},null==l?void 0:l.iconStyle),{display:(null===(c=null==l?void 0:l.iconStyle)||void 0===c?void 0:c.display)||"flex",alignSelf:(null===(s=null==l?void 0:l.iconStyle)||void 0===s?void 0:s.alignSelf)||"flex-start"})},{children:e(l.icon,{color:i[l.type].textColor,height:16,width:16})})),e(r,Object.assign({style:{color:l.textColor||i[l.type].textColor,marginLeft:8,marginRight:4}},{children:l.text})),l.redirectToText&&l.redirectTo&&e(r,Object.assign({style:{color:n.text.brand,cursor:"pointer",textDecoration:"underline"},onClick:()=>{"INTERNAL"===l.redirectTo&&l.handleRedirectButtonClick?l.handleRedirectButtonClick():l.redirectTo&&window.open(l.redirectTo,"_blank")}},{children:l.redirectToText}))]}))};export{l as Alert};
|
|
@@ -37,7 +37,5 @@ export type LineChartProps = {
|
|
|
37
37
|
titleTooltipCallback?: (context: any) => void;
|
|
38
38
|
isInternationalStore?: boolean;
|
|
39
39
|
customYHeaders?: any;
|
|
40
|
-
legendsAndIconDirection?: 'row-reverse' | 'row';
|
|
41
|
-
headerIcons?: React.ReactNode[];
|
|
42
40
|
};
|
|
43
41
|
export declare const LineChart: React.FC<LineChartProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{Chart as
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{Chart as o,CategoryScale as r,LinearScale as n,PointElement as i,BarElement as a,LineElement as s,ArcElement as d,Filler as c,Title as u,Tooltip as p,Legend as g}from"chart.js";import{useState as b,useRef as y,useEffect as m}from"react";import{Line as v}from"react-chartjs-2";import{BodyTiny as h}from"../../../TypographyStyle.js";import{COLORS as f}from"../../../../constants/Theme.js";import{truncateValueForInternationalStore as k,truncateValueForIndianStore as x}from"../utils/calcPercentage.js";import{LegendWrapper as C,LegendContainer as j,LegendColor as w}from"./LineChart.styled.js";o.register(r,n,i,a,s,d,c,u,p,g);const B=o=>{let{scaleText:r,labels:n,canvasHeight:i,datas:a,maintainAspectRatio:s=!1,stepSize:d,min:c,max:u,isZeroState:p,tension:g,isNewStyles:B,prefixCurrencyInYAxis:O,pointRadius:S,useKFormat:z,lineThickness:T,ticksLabelCallback:$,labelCallback:F,afterBodyCallBack:R,titleTooltipCallback:q,isInternationalStore:A,customYHeaders:D}=o;var I,L,P;const[E,H]=b(null),W=y();m((()=>{var e,t,l,o;if(null===(o=null===(l=null===(t=null===(e=W.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.y)||void 0===l?void 0:l.ticks)||void 0===o?void 0:o.length){const e=38*W.current.scales.y.ticks.length;H(e)}}),[W]);const Y=a.map((e=>({text:e.legend,color:e.lineColor?e.lineColor:e.dotted?f.content.placeholder:f.background.brand,square:e.squareLegends}))),Z={labels:n,datasets:a.map(((e,t)=>{var l,o,r;return Object.assign(Object.assign({tension:null!=g?g:.4,fill:e.gradient?"start":0},((e,t)=>{const l={borderColor:e||(t?f.content.placeholder:f.background.brand)};return B?Object.assign({pointStyle:"circle",pointRadius:S||(n&&n.length>10?2.5:4),pointBorderColor:"transparent",pointBackgroundColor:e||(t?f.content.placeholder:f.background.brand)},l):Object.assign({pointRadius:null!=S?S:1},l)})(e.lineColor,e.dotted)),{borderDash:e.dotted?[8,3]:void 0,data:e.data,borderWidth:null!==(o=null!==(l=e.lineWidth)&&void 0!==l?l:T)&&void 0!==o?o:2,backgroundColor:e.gradient?e=>{const t=e.chart.ctx.createLinearGradient(0,0,0,E?E-75:150);return t.addColorStop(0,"#F1EEFB"),t.addColorStop(1,"rgba(127, 86, 217, 0)"),t}:null!==(r=e.backgroundColor)&&void 0!==r?r:"transparent",legend:e.legend})}))},G={maintainAspectRatio:s,responsive:!0,plugins:{legend:{display:!1},title:{display:!1},tooltip:{displayColors:null!=B&&B,titleFont:()=>({weight:"600",size:14,family:"inter"}),titleColor:()=>f.content.primaryInverse,backgroundColor:f.content.primary,callbacks:{labelTextColor:()=>f.content.primaryInverse,title:q,label:F,afterBody:R},bodyFont:()=>({weight:"400",size:14,family:"inter"})}},scales:{y:{beginAtZero:!0,min:p?0:c,max:p?10:u,ticks:{color:f.content.secondary,callback:e=>{var t,l;return z?`${null!==(t=null==r?void 0:r.yPrefix)&&void 0!==t?t:""}${A?k(e):x(e)}${null!=O?O:""}`:D&&Object.keys(D).length>0?D[e]:`${null!==(l=null==r?void 0:r.yPrefix)&&void 0!==l?l:""}${e}${null!=O?O:""}`},font:{family:"inter",size:12,weight:"400"},stepSize:p?1:d,padding:B?24:0},title:{display:!!(null==r?void 0:r.y),text:null==r?void 0:r.y},grid:{color:f.background.base,drawBorder:null===(I=null==r?void 0:r.yDrawBorder)||void 0===I||I}},x:{ticks:{callback:$,color:f.content.secondary,font:{family:"inter",size:12,weight:"400"}},title:{display:!!(null==r?void 0:r.x),text:null==r?void 0:r.x},grid:{display:!1,drawBorder:null!==(L=null==r?void 0:r.xDrawBorder)&&void 0!==L&&L}}}};return e("div",Object.assign({style:Object.assign(Object.assign({},s?{}:{height:null!==(P=null!=i?i:E)&&void 0!==P?P:204}),{display:"flex",flexDirection:"column",gap:2,width:"100%"})},{children:[t(C,{children:Y.map(((o,r)=>{let{text:n,color:i,square:a}=o;return n?e(j,{children:[t(w,{color:i,square:a,newStyle:B}),t(h,Object.assign({color:"#667085"},{children:n}))]},r):t(l,{})}))}),t("div",Object.assign({style:{flex:1}},{children:t(v,{ref:W,options:G,data:Z})}))]}))};export{B as LineChart};
|