@bikdotai/bik-component-library 0.0.718-beta.11 → 0.0.718-beta.13
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/analytics-chips-and-dropdowns/AnalyticsTrend.d.ts +1 -0
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsTrend.js +1 -1
- package/dist/cjs/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.d.ts +1 -0
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsTrend.js +1 -1
- package/dist/esm/components/bik-layout/MockMenus.d.ts +1 -0
- package/package.json +1 -1
|
@@ -30,5 +30,6 @@ export interface AnalyticsTrendInterface {
|
|
|
30
30
|
isInternationalStore?: boolean;
|
|
31
31
|
Icon?: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
|
|
32
32
|
tooltipTimelineText?: string;
|
|
33
|
+
customTimelineText?: string;
|
|
33
34
|
}
|
|
34
35
|
export declare const AnalyticsTrend: React.FC<AnalyticsTrendInterface>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("react"),n=require("../shimmer/ShimmerComponent/ShimmerStyled.js"),i=require("../../utils/DateUtils.js"),s=require("../../constants/Theme.js"),r=require("../../assets/icons/arrow_down.svg.js"),o=require("../../assets/icons/arrow_up.svg.js"),l=require("../../assets/icons/info.svg.js"),a=require("../tag/Tag.js"),c=require("../tooltips/Tooltip.js"),x=require("../TypographyStyle.js"),u=require("./chart/utils/calcPercentage.js"),d=require("./CommonStyles.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=m(t);const j=n=>{let{percent:l,direction:a,timeline:d,customRange:m,trendRaw:p,prefixSymbol:j,trendIconStyle:g,isInternationalStore:h,tooltipTimelineText:y}=n;const
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("react"),n=require("../shimmer/ShimmerComponent/ShimmerStyled.js"),i=require("../../utils/DateUtils.js"),s=require("../../constants/Theme.js"),r=require("../../assets/icons/arrow_down.svg.js"),o=require("../../assets/icons/arrow_up.svg.js"),l=require("../../assets/icons/info.svg.js"),a=require("../tag/Tag.js"),c=require("../tooltips/Tooltip.js"),x=require("../TypographyStyle.js"),u=require("./chart/utils/calcPercentage.js"),d=require("./CommonStyles.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var p=m(t);const j=n=>{let{percent:l,direction:a,timeline:d,customRange:m,trendRaw:p,prefixSymbol:j,trendIconStyle:g,isInternationalStore:h,tooltipTimelineText:y,customTimelineText:R}=n;const b=()=>{const e=((null!=p?p:0)>0?"+":"")+(null!=j?j:"");return void 0===p?"--":`${null!=e?e:""}${(()=>{let e="--";if(p)return e=String(h?u.truncateValueForInternationalStore(Math.abs(p)):u.truncateValueForIndianStore(Math.abs(p))),p<0?"-"+e:e})()}`},[f,O]=t.useState(b()),[S,T]=t.useState(R||"");t.useEffect((()=>{R||T("today"===d?"vs yesterday":"yesterday"===d?"vs 1 day before":"7 days"===d?"vs last 7 days":"30 days"===d?"vs last 30 days":"custom"===d&&m?i.default.getAnalyticsCustomDateTimelineText(m):"")}),[d,m]),t.useEffect((()=>{O(b())}),[p]);const v="negative"===a?r.default:o.default,E="negative"===a?s.COLORS.background.negative.vibrant:"positive"===a?s.COLORS.background.positive.vibrant:s.COLORS.content.placeholder;return e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",flexDirection:"row",flexWrap:"wrap"}},{children:["number"==typeof l&&e.jsxRuntimeExports.jsx(v,{color:E,height:16,width:16,style:Object.assign({marginRight:2},null!=g?g:{})}),"number"==typeof l&&a&&e.jsxRuntimeExports.jsxs(x.Caption,Object.assign({style:{color:E}},{children:["neutral"===a?0:l<1e3?l:">999","%"]})),!!p&&e.jsxRuntimeExports.jsx(x.Caption,Object.assign({style:{marginLeft:4,color:s.COLORS.content.placeholder}},{children:`(${f})`})),d&&(y?e.jsxRuntimeExports.jsx(c.Tooltip,Object.assign({body:y,placement:"bottom"},{children:e.jsxRuntimeExports.jsx(x.Caption,Object.assign({style:{marginLeft:4,color:s.COLORS.content.placeholder}},{children:R||S}))})):e.jsxRuntimeExports.jsx(x.Caption,Object.assign({style:{marginLeft:4,color:s.COLORS.content.placeholder}},{children:R||S})))]}))};exports.AnalyticsTrend=t=>{let{title:i,value:r,trendPercent:o,type:m="horizontal",timeline:g,customRange:h,tooltip:y,card:R=!0,rightSeparator:b=!1,size:f="big",share:O=!1,formatVal:S,prefixSymbol:T,trailingIcon:v,onTrailIconClick:E,iconTooltipBody:C,funnelPercent:w,isLoading:I,trendRaw:$,suffixText:L,trendStyle:q,trendContainerStyle:D,trendIconStyle:F,containerStyle:M,prevTrendDiff:k,relativePercentageDiff:P,isInternationalStore:V,Icon:_,iconContainerStyle:z,tooltipTimelineText:A,customTimelineText:N}=t;const B="big"===f?x.TitleLarge:x.TitleMedium,W=void 0!==o?o<0?"negative":0===o?"neutral":"positive":void 0,U=void 0!==o?O?Math.round(o):Math.abs(Math.round(o)):void 0;return e.jsxRuntimeExports.jsx(d.AnalyticsTrendContainer,Object.assign({card:R,style:Object.assign({},M)},{children:e.jsxRuntimeExports.jsxs("div",Object.assign({style:Object.assign({display:"flex",flexDirection:"row",gap:_?12:4,borderRightWidth:b?1:0,borderRightColor:s.COLORS.stroke.primary,borderRightStyle:"solid",paddingLeft:R?0:24,paddingRight:R?0:24,height:"100%",justifyContent:_?"flex-start":"space-between",alignItems:"center"},null!=D?D:{})},{children:[!!_&&e.jsxRuntimeExports.jsx(d.IconContainer,Object.assign({style:Object.assign({},z)},{children:e.jsxRuntimeExports.jsx(_,{})})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:Object.assign({display:"flex",flexDirection:"column",gap:4,height:"100%"},null!=q?q:{})},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:4,alignItems:"center"}},{children:[e.jsxRuntimeExports.jsx(x.BodyCaption,Object.assign({style:{color:s.COLORS.content.secondary}},{children:i})),y&&e.jsxRuntimeExports.jsx(c.Tooltip,Object.assign({body:y,placement:"right",width:300},{children:e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",cursor:"pointer",height:"100%"}},{children:e.jsxRuntimeExports.jsx(l.default,{color:s.COLORS.content.primary,height:16,width:16})}))}))]})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:Object.assign({display:"flex",flexDirection:"row",gap:12,alignItems:"center"},O?{justifyContent:"space-between"}:{})},{children:[I&&e.jsxRuntimeExports.jsx(n.ShimmerComponentStyled,{width:108,height:26}),!I&&e.jsxRuntimeExports.jsx(B,Object.assign({style:{color:s.COLORS.content.primary}},{children:void 0===r?"--":"number"==typeof r&&S?r>999?V?`${null!=T?T:""}${u.truncateValueForInternationalStore(r)} ${null!=L?L:""}`:`${null!=T?T:""}${u.truncateValueForIndianStore(r)} ${null!=L?L:""}`:`${null!=T?T:""}${new Intl.NumberFormat("en-IN",{maximumFractionDigits:2}).format(r)} ${null!=L?L:""}`:`${null!=T?T:""}${r} ${null!=L?L:""}`})),"number"==typeof P&&e.jsxRuntimeExports.jsx(a.Tag,{tagText:`${P}%`,theme:"light",type:"neutral"}),"horizontal"===m&&!I&&!O&&e.jsxRuntimeExports.jsx(j,{timeline:g,customRange:h,percent:U,direction:W,trendRaw:$,prefixSymbol:T,trendIconStyle:F,isInternationalStore:V,tooltipTimelineText:A,customTimelineText:N}),I&&!O&&"horizontal"===m&&e.jsxRuntimeExports.jsx(n.ShimmerComponentStyled,{height:20,width:141,marginTop:6}),"vertical"===m&&!I&&void 0!==w&&e.jsxRuntimeExports.jsx(a.Tag,{tagText:`${w} %`,theme:"light",type:"neutral"}),O&&!I&&void 0!==U&&e.jsxRuntimeExports.jsx(a.Tag,{tagText:`${U} %`,theme:"light",type:"neutral"}),O||I||!k||0==k?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):e.jsxRuntimeExports.jsx(a.Tag,{tagText:(e=>{const t=Math.abs(e);return t%1!=0?`${t.toFixed(1)} %`:`${t} %`})(k),theme:"light",type:"neutral"})]})),"vertical"===m&&!I&&!O&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{marginTop:10}},{children:e.jsxRuntimeExports.jsx(j,{timeline:g,customRange:h,percent:U,direction:W,trendRaw:$,prefixSymbol:T,trendIconStyle:F,isInternationalStore:V,tooltipTimelineText:A,customTimelineText:N})})),I&&"vertical"===m&&e.jsxRuntimeExports.jsx(n.ShimmerComponentStyled,{height:20,width:141,marginTop:6})]})),C&&!I&&e.jsxRuntimeExports.jsx(c.Tooltip,Object.assign({body:C,placement:"right"},{children:v&&e.jsxRuntimeExports.jsx("div",Object.assign({className:"icon--holder",onClick:E},{children:p.default.createElement(v,{height:20,width:20,color:s.COLORS.content.secondary})}))}))]}))}))};
|
|
@@ -30,5 +30,6 @@ export interface AnalyticsTrendInterface {
|
|
|
30
30
|
isInternationalStore?: boolean;
|
|
31
31
|
Icon?: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
|
|
32
32
|
tooltipTimelineText?: string;
|
|
33
|
+
customTimelineText?: string;
|
|
33
34
|
}
|
|
34
35
|
export declare const AnalyticsTrend: React.FC<AnalyticsTrendInterface>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"../../node_modules/react/jsx-runtime.js";import t,{useState as i,useEffect as n}from"react";import{ShimmerComponentStyled as
|
|
1
|
+
import{j as e}from"../../node_modules/react/jsx-runtime.js";import t,{useState as i,useEffect as n}from"react";import{ShimmerComponentStyled as s}from"../shimmer/ShimmerComponent/ShimmerStyled.js";import r from"../../utils/DateUtils.js";import{COLORS as o}from"../../constants/Theme.js";import l from"../../assets/icons/arrow_down.svg.js";import a from"../../assets/icons/arrow_up.svg.js";import c from"../../assets/icons/info.svg.js";import{Tag as d}from"../tag/Tag.js";import{Tooltip as m}from"../tooltips/Tooltip.js";import{BodyCaption as g,Caption as h,TitleLarge as p,TitleMedium as j}from"../TypographyStyle.js";import{truncateValueForInternationalStore as y,truncateValueForIndianStore as x}from"./chart/utils/calcPercentage.js";import{AnalyticsTrendContainer as u,IconContainer as b}from"./CommonStyles.js";const f=i=>{let{title:n,value:r,trendPercent:l,type:a="horizontal",timeline:h,customRange:f,tooltip:T,card:O=!0,rightSeparator:S=!1,size:w="big",share:$=!1,formatVal:I,prefixSymbol:R,trailingIcon:C,onTrailIconClick:D,iconTooltipBody:M,funnelPercent:k,isLoading:L,trendRaw:z,suffixText:F,trendStyle:P,trendContainerStyle:N,trendIconStyle:_,containerStyle:W,prevTrendDiff:A,relativePercentageDiff:B,isInternationalStore:E,Icon:U,iconContainerStyle:V,tooltipTimelineText:q,customTimelineText:G}=i;const H="big"===w?p:j,J=void 0!==l?l<0?"negative":0===l?"neutral":"positive":void 0,K=void 0!==l?$?Math.round(l):Math.abs(Math.round(l)):void 0;return e.jsx(u,Object.assign({card:O,style:Object.assign({},W)},{children:e.jsxs("div",Object.assign({style:Object.assign({display:"flex",flexDirection:"row",gap:U?12:4,borderRightWidth:S?1:0,borderRightColor:o.stroke.primary,borderRightStyle:"solid",paddingLeft:O?0:24,paddingRight:O?0:24,height:"100%",justifyContent:U?"flex-start":"space-between",alignItems:"center"},null!=N?N:{})},{children:[!!U&&e.jsx(b,Object.assign({style:Object.assign({},V)},{children:e.jsx(U,{})})),e.jsxs("div",Object.assign({style:Object.assign({display:"flex",flexDirection:"column",gap:4,height:"100%"},null!=P?P:{})},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:4,alignItems:"center"}},{children:[e.jsx(g,Object.assign({style:{color:o.content.secondary}},{children:n})),T&&e.jsx(m,Object.assign({body:T,placement:"right",width:300},{children:e.jsx("div",Object.assign({style:{display:"flex",cursor:"pointer",height:"100%"}},{children:e.jsx(c,{color:o.content.primary,height:16,width:16})}))}))]})),e.jsxs("div",Object.assign({style:Object.assign({display:"flex",flexDirection:"row",gap:12,alignItems:"center"},$?{justifyContent:"space-between"}:{})},{children:[L&&e.jsx(s,{width:108,height:26}),!L&&e.jsx(H,Object.assign({style:{color:o.content.primary}},{children:void 0===r?"--":"number"==typeof r&&I?r>999?E?`${null!=R?R:""}${y(r)} ${null!=F?F:""}`:`${null!=R?R:""}${x(r)} ${null!=F?F:""}`:`${null!=R?R:""}${new Intl.NumberFormat("en-IN",{maximumFractionDigits:2}).format(r)} ${null!=F?F:""}`:`${null!=R?R:""}${r} ${null!=F?F:""}`})),"number"==typeof B&&e.jsx(d,{tagText:`${B}%`,theme:"light",type:"neutral"}),"horizontal"===a&&!L&&!$&&e.jsx(v,{timeline:h,customRange:f,percent:K,direction:J,trendRaw:z,prefixSymbol:R,trendIconStyle:_,isInternationalStore:E,tooltipTimelineText:q,customTimelineText:G}),L&&!$&&"horizontal"===a&&e.jsx(s,{height:20,width:141,marginTop:6}),"vertical"===a&&!L&&void 0!==k&&e.jsx(d,{tagText:`${k} %`,theme:"light",type:"neutral"}),$&&!L&&void 0!==K&&e.jsx(d,{tagText:`${K} %`,theme:"light",type:"neutral"}),$||L||!A||0==A?e.jsx(e.Fragment,{}):e.jsx(d,{tagText:(e=>{const t=Math.abs(e);return t%1!=0?`${t.toFixed(1)} %`:`${t} %`})(A),theme:"light",type:"neutral"})]})),"vertical"===a&&!L&&!$&&e.jsx("div",Object.assign({style:{marginTop:10}},{children:e.jsx(v,{timeline:h,customRange:f,percent:K,direction:J,trendRaw:z,prefixSymbol:R,trendIconStyle:_,isInternationalStore:E,tooltipTimelineText:q,customTimelineText:G})})),L&&"vertical"===a&&e.jsx(s,{height:20,width:141,marginTop:6})]})),M&&!L&&e.jsx(m,Object.assign({body:M,placement:"right"},{children:C&&e.jsx("div",Object.assign({className:"icon--holder",onClick:D},{children:t.createElement(C,{height:20,width:20,color:o.content.secondary})}))}))]}))}))},v=t=>{let{percent:s,direction:c,timeline:d,customRange:g,trendRaw:p,prefixSymbol:j,trendIconStyle:u,isInternationalStore:b,tooltipTimelineText:f,customTimelineText:v}=t;const T=()=>{const e=((null!=p?p:0)>0?"+":"")+(null!=j?j:"");return void 0===p?"--":`${null!=e?e:""}${(()=>{let e="--";if(p)return e=String(b?y(Math.abs(p)):x(Math.abs(p))),p<0?"-"+e:e})()}`},[O,S]=i(T()),[w,$]=i(v||"");n((()=>{v||$("today"===d?"vs yesterday":"yesterday"===d?"vs 1 day before":"7 days"===d?"vs last 7 days":"30 days"===d?"vs last 30 days":"custom"===d&&g?r.getAnalyticsCustomDateTimelineText(g):"")}),[d,g]),n((()=>{S(T())}),[p]);const I="negative"===c?l:a,R="negative"===c?o.background.negative.vibrant:"positive"===c?o.background.positive.vibrant:o.content.placeholder;return e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",flexDirection:"row",flexWrap:"wrap"}},{children:["number"==typeof s&&e.jsx(I,{color:R,height:16,width:16,style:Object.assign({marginRight:2},null!=u?u:{})}),"number"==typeof s&&c&&e.jsxs(h,Object.assign({style:{color:R}},{children:["neutral"===c?0:s<1e3?s:">999","%"]})),!!p&&e.jsx(h,Object.assign({style:{marginLeft:4,color:o.content.placeholder}},{children:`(${O})`})),d&&(f?e.jsx(m,Object.assign({body:f,placement:"bottom"},{children:e.jsx(h,Object.assign({style:{marginLeft:4,color:o.content.placeholder}},{children:v||w}))})):e.jsx(h,Object.assign({style:{marginLeft:4,color:o.content.placeholder}},{children:v||w})))]}))};export{f as AnalyticsTrend};
|