@bikdotai/bik-component-library 0.0.542-beta.cm-1 → 0.0.543-default-val-beta

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.
Files changed (37) hide show
  1. package/dist/cjs/components/accordion/Accordion.d.ts +0 -4
  2. package/dist/cjs/components/accordion/Accordion.js +1 -1
  3. package/dist/cjs/components/accordion/Accordion.style.d.ts +0 -2
  4. package/dist/cjs/components/accordion/Accordion.style.js +2 -3
  5. package/dist/cjs/components/accordion/AccordionArrow.d.ts +0 -1
  6. package/dist/cjs/components/accordion/AccordionArrow.js +1 -1
  7. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js +1 -1
  8. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.model.d.ts +3 -0
  9. package/dist/cjs/components/country-code-picker/CountryCodePicker.d.ts +0 -1
  10. package/dist/cjs/components/country-code-picker/CountryCodePicker.js +1 -1
  11. package/dist/cjs/components/input/Input.js +1 -1
  12. package/dist/cjs/components/input-with-vars/InputWithVariables.js +2 -2
  13. package/dist/cjs/components/variable-picker-v3/Content.js +1 -1
  14. package/dist/cjs/components/variable-picker-v3/DefaultVariableContent.d.ts +8 -0
  15. package/dist/cjs/components/variable-picker-v3/DefaultVariableContent.js +1 -0
  16. package/dist/cjs/components/variable-picker-v3/model.d.ts +2 -0
  17. package/dist/cjs/components/variable-picker-v3/styles.d.ts +3 -1
  18. package/dist/cjs/components/variable-picker-v3/styles.js +4 -4
  19. package/dist/esm/components/accordion/Accordion.d.ts +0 -4
  20. package/dist/esm/components/accordion/Accordion.js +1 -1
  21. package/dist/esm/components/accordion/Accordion.style.d.ts +0 -2
  22. package/dist/esm/components/accordion/Accordion.style.js +0 -1
  23. package/dist/esm/components/accordion/AccordionArrow.d.ts +0 -1
  24. package/dist/esm/components/accordion/AccordionArrow.js +1 -1
  25. package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js +1 -1
  26. package/dist/esm/components/analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.model.d.ts +3 -0
  27. package/dist/esm/components/country-code-picker/CountryCodePicker.d.ts +0 -1
  28. package/dist/esm/components/country-code-picker/CountryCodePicker.js +1 -1
  29. package/dist/esm/components/input/Input.js +1 -1
  30. package/dist/esm/components/input-with-vars/InputWithVariables.js +1 -1
  31. package/dist/esm/components/variable-picker-v3/Content.js +1 -1
  32. package/dist/esm/components/variable-picker-v3/DefaultVariableContent.d.ts +8 -0
  33. package/dist/esm/components/variable-picker-v3/DefaultVariableContent.js +1 -0
  34. package/dist/esm/components/variable-picker-v3/model.d.ts +2 -0
  35. package/dist/esm/components/variable-picker-v3/styles.d.ts +3 -1
  36. package/dist/esm/components/variable-picker-v3/styles.js +1 -1
  37. package/package.json +1 -1
@@ -14,9 +14,5 @@ export interface AccordionProps {
14
14
  refresh?: number | boolean;
15
15
  autoOpen?: boolean;
16
16
  childrenMaxHeight?: number;
17
- openDirection?: 'DOWN' | 'UP';
18
- headerStyles?: React.CSSProperties;
19
- onToggleAccordion?: (state: boolean) => void;
20
- arrowColor?: string;
21
17
  }
22
18
  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"),o=require("../TypographyStyle.js"),t=require("./Accordion.style.js"),n=require("./AccordionArrow.js");exports.BikAccordion=i=>{var s,a;const[c,l]=r.useState(!1),d=r.useRef(null),u=r.useRef(null);r.useEffect((()=>{i.autoOpen&&h(i.autoOpen,{})}),[i.autoOpen]);const h=(e,r)=>{var o,t;u.current&&d.current&&("keydown"===r.type&&"Enter"!==r.key||(l(e),u.current.style.maxHeight?(u.current.style.maxHeight="",d.current.style.transform="rotate(0deg)",d.current.style.transition="transform 0.25s ease-in-out",u.current.style.transition="padding 0s"):(u.current.style.maxHeight=(null!==(o=i.childrenMaxHeight)&&void 0!==o?o:u.current.scrollHeight)+"px",d.current.style.transform="rotate(180deg)",d.current.style.transition="transform 0.25s ease-in-out",u.current.style.transition="max-height 0.25s ease-in-out"),null===(t=i.onToggleAccordion)||void 0===t||t.call(i,e)))};return r.useEffect((()=>{var e;c&&(null==i?void 0:i.refresh)&&(null===(e=null==u?void 0:u.current)||void 0===e?void 0:e.scrollHeight)&&!i.childrenMaxHeight&&setTimeout((()=>{u.current.style.maxHeight=u.current.scrollHeight+"px"}),100)}),[c,null==i?void 0:i.refresh,null===(s=null==u?void 0:u.current)||void 0===s?void 0:s.scrollHeight]),e.jsxs(t.default,Object.assign({className:"accordion",isActive:c,width:null==i?void 0:i.width,contentMargin:null==i?void 0:i.contentMargin,headerPadding:i.headerPadding,skipHoverState:i.skipHoverHeader,showBorders:i.showBorders,backgroundColor:i.backgroundColor,openDirection:i.openDirection},{children:[e.jsxs("div",Object.assign({className:"accordion__overview "+(c?"active":""),onClick:e=>h(!c,e),onKeyDown:e=>h(!c,e),role:"button",tabIndex:0},{children:[!i.rightActionComponent&&e.jsxs("div",Object.assign({className:"accordion__overview__header",style:null!==(a=i.headerStyles)&&void 0!==a?a:{}},{children:["string"==typeof i.header?e.jsx(o.TitleRegular,{children:null==i?void 0:i.header}):i.header,e.jsx(n.default,{arrowColor:i.arrowColor,isNewIcon:!0,ref:d})]})),i.rightActionComponent&&e.jsxs("div",Object.assign({className:"accordion__overview__header"},{children:[e.jsxs("div",Object.assign({className:"accordion__overview__title-wrapper"},{children:[e.jsx(n.default,{arrowColor:i.arrowColor,isNewIcon:!0,ref:d}),"string"==typeof i.header?e.jsx(o.TitleRegular,{children:null==i?void 0:i.header}):i.header]})),e.jsx("div",Object.assign({onClick:e=>e.stopPropagation(),onKeyDown:e=>{"Enter"===e.key&&e.stopPropagation()},role:"button",tabIndex:0},{children:i.rightActionComponent}))]})),(null==i?void 0:i.caption)&&e.jsx("div",Object.assign({className:"accordion__overview__caption"},{children:e.jsx(o.BodySecondary,{children:i.caption})}))]})),e.jsx("div",Object.assign({ref:u,className:"accordion__content"},{children:i.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("./Accordion.style.js"),i=require("./AccordionArrow.js");exports.BikAccordion=o=>{var s;const[a,c]=r.useState(!1),l=r.useRef(null),d=r.useRef(null);r.useEffect((()=>{o.autoOpen&&u(o.autoOpen,{})}),[o.autoOpen]);const u=(e,r)=>{var t;d.current&&l.current&&("keydown"===r.type&&"Enter"!==r.key||(c(e),d.current.style.maxHeight?(d.current.style.maxHeight="",l.current.style.transform="rotate(0deg)",l.current.style.transition="transform 0.25s ease-in-out",d.current.style.transition="padding 0s"):(d.current.style.maxHeight=(null!==(t=o.childrenMaxHeight)&&void 0!==t?t:d.current.scrollHeight)+"px",l.current.style.transform="rotate(180deg)",l.current.style.transition="transform 0.25s ease-in-out",d.current.style.transition="max-height 0.25s ease-in-out")))};return r.useEffect((()=>{var e;a&&(null==o?void 0:o.refresh)&&(null===(e=null==d?void 0:d.current)||void 0===e?void 0:e.scrollHeight)&&!o.childrenMaxHeight&&setTimeout((()=>{d.current.style.maxHeight=d.current.scrollHeight+"px"}),100)}),[a,null==o?void 0:o.refresh,null===(s=null==d?void 0:d.current)||void 0===s?void 0:s.scrollHeight]),e.jsxs(n.default,Object.assign({className:"accordion",isActive:a,width:null==o?void 0:o.width,contentMargin:null==o?void 0:o.contentMargin,headerPadding:o.headerPadding,skipHoverState:o.skipHoverHeader,showBorders:o.showBorders,backgroundColor:o.backgroundColor},{children:[e.jsxs("div",Object.assign({className:"accordion__overview "+(a?"active":""),onClick:e=>u(!a,e),onKeyDown:e=>u(!a,e),role:"button",tabIndex:0},{children:[!o.rightActionComponent&&e.jsxs("div",Object.assign({className:"accordion__overview__header"},{children:["string"==typeof o.header?e.jsx(t.TitleRegular,{children:null==o?void 0:o.header}):o.header,e.jsx(i.default,{isNewIcon:!0,ref:l})]})),o.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:l}),"string"==typeof o.header?e.jsx(t.TitleRegular,{children:null==o?void 0:o.header}):o.header]})),e.jsx("div",Object.assign({onClick:e=>e.stopPropagation(),onKeyDown:e=>{"Enter"===e.key&&e.stopPropagation()},role:"button",tabIndex:0},{children:o.rightActionComponent}))]})),(null==o?void 0:o.caption)&&e.jsx("div",Object.assign({className:"accordion__overview__caption"},{children:e.jsx(t.BodySecondary,{children:o.caption})}))]})),e.jsx("div",Object.assign({ref:d,className:"accordion__content"},{children:o.children}))]}))};
@@ -1,4 +1,3 @@
1
- import { AccordionProps } from './Accordion';
2
1
  declare const AccordionStyle: import("styled-components").StyledComponent<"div", any, {
3
2
  isActive: boolean;
4
3
  width?: string | undefined;
@@ -8,6 +7,5 @@ declare const AccordionStyle: import("styled-components").StyledComponent<"div",
8
7
  showBorders?: boolean | undefined;
9
8
  backgroundColor?: string | undefined;
10
9
  hasChildrenMaxHeight?: boolean | undefined;
11
- openDirection?: AccordionProps['openDirection'];
12
10
  }, never>;
13
11
  export default AccordionStyle;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),r=require("../../constants/Theme.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const i=o(e).default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),r=require("../../constants/Theme.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const t=o(e).default.div`
2
2
  width: ${e=>(null==e?void 0:e.width)||"100%"};
3
3
  display: flex;
4
4
  flex-direction: column;
@@ -31,7 +31,6 @@
31
31
  ${e=>e.isActive?{margin:(null==e?void 0:e.contentMargin)||"0px"}:{}};
32
32
  overflow: ${e=>e.hasChildrenMaxHeight?"scroll":"hidden"};
33
33
  max-height: 0;
34
- order: ${e=>"UP"===e.openDirection?-1:0};
35
34
  }
36
35
  }
37
- `;exports.default=i;
36
+ `;exports.default=t;
@@ -1,7 +1,6 @@
1
1
  import React, { HTMLAttributes } from 'react';
2
2
  interface BikAccordionArrowProps extends HTMLAttributes<HTMLDivElement> {
3
3
  isNewIcon: boolean;
4
- arrowColor?: string;
5
4
  }
6
5
  declare const BikAccordionArrow: React.ForwardRefExoticComponent<BikAccordionArrowProps & React.RefAttributes<HTMLDivElement>>;
7
6
  export default BikAccordionArrow;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const l=r(require("react")).default.forwardRef(((r,l)=>{var t,i;return e.jsxs("div",Object.assign({ref:l,className:"d-flex align-items-center"},{children:[!r.isNewIcon&&e.jsx("svg",Object.assign({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M7.7071 10.7071C7.07713 10.0771 7.5233 9 8.41421 9H15.5858C16.4767 9 16.9228 10.0771 16.2929 10.7071L12.7071 14.2929C12.3166 14.6834 11.6834 14.6834 11.2929 14.2929L7.7071 10.7071Z",fill:null!==(t=r.arrowColor)&&void 0!==t?t:"currentColor"})})),r.isNewIcon&&e.jsx("svg",Object.assign({width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.528758 0.52827C0.789108 0.26792 1.21122 0.26792 1.47157 0.52827L5.00016 4.05687L8.52876 0.52827C8.78911 0.26792 9.21122 0.26792 9.47157 0.52827C9.73192 0.788619 9.73192 1.21073 9.47157 1.47108L5.47157 5.47108C5.21122 5.73143 4.78911 5.73143 4.52876 5.47108L0.528758 1.47108C0.268409 1.21073 0.268409 0.788619 0.528758 0.52827Z",fill:null!==(i=r.arrowColor)&&void 0!==i?i:"currentColor"})}))]}))}));l.displayName="BikAccordionArrow",exports.default=l;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const i=t(require("react")).default.forwardRef(((t,i)=>e.jsxs("div",Object.assign({ref:i,className:"d-flex align-items-center"},{children:[!t.isNewIcon&&e.jsx("svg",Object.assign({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{d:"M7.7071 10.7071C7.07713 10.0771 7.5233 9 8.41421 9H15.5858C16.4767 9 16.9228 10.0771 16.2929 10.7071L12.7071 14.2929C12.3166 14.6834 11.6834 14.6834 11.2929 14.2929L7.7071 10.7071Z",fill:"currentColor"})})),t.isNewIcon&&e.jsx("svg",Object.assign({width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.528758 0.52827C0.789108 0.26792 1.21122 0.26792 1.47157 0.52827L5.00016 4.05687L8.52876 0.52827C8.78911 0.26792 9.21122 0.26792 9.47157 0.52827C9.73192 0.788619 9.73192 1.21073 9.47157 1.47108L5.47157 5.47108C5.21122 5.73143 4.78911 5.73143 4.52876 5.47108L0.528758 1.47108C0.268409 1.21073 0.268409 0.788619 0.528758 0.52827Z",fill:"currentColor"})}))]}))));i.displayName="BikAccordionArrow",exports.default=i;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("chart.js"),o=require("chartjs-plugin-datalabels"),i=require("react-chartjs-2"),a=require("../../../TypographyStyle.js"),l=require("../../../../constants/Theme.js"),n=require("../utils/calcPercentage.js"),s=require("./StackedBarChart.model.js"),r=require("./StackedBarChart.styles.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=d(o);t.Chart.register(t.CategoryScale,t.LinearScale,t.BarElement,t.Tooltip,t.Legend,c.default);exports.StackedBarChart=t=>{var o,d,c,O,u,A,v,x,g,p,T,R,y,N,I,b,C,h,S,E,H,f,k,F,L,j,m,_,P,G,Z,z,B,D,q;const w=0===t.yAxis.data.length,V=t.colorSchema===s.COLOR_SCHEMA.PASTEL?["#E6C7FF","#FEC6C6","#FEDEF3","#DEEFFF","#FFD8B1","#C7E5FF","#FFD3E6","#C9FFE5","#FFE3C7","#D9D9FF"]:["#5E07BB","#9E77ED","#D2AEFF","#F7D7FF","#CDE1FF","#92AFFA","#3935E1"],W={barPercentage:.4,categoryPercentage:1,pointStyle:"circle",barWidth:t.barWidth},K={};t.yAxis.data.map((e=>{e.map((e=>{K[e.name]?K[e.name].push(e.value):K[e.name]=[e.value]}))}));const M=Object.keys(K).map(((e,t)=>Object.assign({label:e,data:K[e],backgroundColor:V[t]},W))),Y={plugins:{legend:{display:!w&&!t.customLegend,labels:{usePointStyle:!0,fontSize:2}},tooltip:{enabled:!w,callbacks:{label:null===(o=t.tooltipConfig)||void 0===o?void 0:o.labelCallback,footer:null===(d=t.tooltipConfig)||void 0===d?void 0:d.footerCallback},footerFont:null===(O=null===(c=t.tooltipConfig)||void 0===c?void 0:c.footerStyles)||void 0===O?void 0:O.footerFont},datalabels:{display:null!==(u=t.showTotal)&&void 0!==u&&u,anchor:"end",align:"end",clamp:!0,formatter:(e,t)=>{var o;const i=t.datasetIndex,a=t.chart.data.datasets;if(i!==a.length-1)return"";const l=t.dataIndex;let n=0;for(let e=0;e<a.length;e++)n+=null!==(o=a[e].data[l])&&void 0!==o?o:0;return n?n<1e3?n:(n/1e3).toString().substring(0,4)+"k":""},color:l.COLORS.content.secondary}},layout:{padding:{right:t.showTotal&&t.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?50:0,top:t.showTotal&&t.orientation!=s.GRAPH_ORIENTATION.HORIZONTAL?50:0}},responsive:!0,maintainAspectRatio:!1,legend:{display:!t.customLegend,labels:{usePointStyle:!0}},indexAxis:t.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?"y":"x",scales:{x:{title:{display:!!(t.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?null===(A=t.yAxis)||void 0===A?void 0:A.title:null===(v=t.xAxis)||void 0===v?void 0:v.title),text:t.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?null===(x=t.yAxis)||void 0===x?void 0:x.title:null===(g=t.xAxis)||void 0===g?void 0:g.title,color:null!==(R=t.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?null===(p=t.yAxis)||void 0===p?void 0:p.titleColor:null===(T=t.xAxis)||void 0===T?void 0:T.titleColor)&&void 0!==R?R:l.COLORS.content.secondary,font:{size:l.FONTS.caption.fontSize}},grid:{display:t.orientation===s.GRAPH_ORIENTATION.HORIZONTAL,color:l.COLORS.background.base},ticks:{fontSize:l.FONTS.caption.fontSize,color:null!==(y=t.yAxis.labelColor)&&void 0!==y?y:l.COLORS.content.secondary,callback:t.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?n.truncateValueToK:void 0},stacked:t.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?"boolean"!=typeof(null===(N=t.yAxis)||void 0===N?void 0:N.stacked)||(null===(I=t.yAxis)||void 0===I?void 0:I.stacked):"boolean"!=typeof(null===(b=t.xAxis)||void 0===b?void 0:b.stacked)||(null===(C=t.xAxis)||void 0===C?void 0:C.stacked)},y:{title:{display:!!(t.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?null===(h=t.xAxis)||void 0===h?void 0:h.title:null===(S=t.yAxis)||void 0===S?void 0:S.title),text:t.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?null===(E=t.xAxis)||void 0===E?void 0:E.title:null===(H=t.yAxis)||void 0===H?void 0:H.title,color:null!==(F=t.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?null===(f=t.xAxis)||void 0===f?void 0:f.titleColor:null===(k=t.yAxis)||void 0===k?void 0:k.titleColor)&&void 0!==F?F:l.COLORS.content.secondary,font:{size:l.FONTS.caption.fontSize}},grid:{display:t.orientation!==s.GRAPH_ORIENTATION.HORIZONTAL,color:l.COLORS.background.base},ticks:Object.assign(Object.assign({stepSize:t.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?null===(L=t.xAxis)||void 0===L?void 0:L.stepSize:null===(j=t.yAxis)||void 0===j?void 0:j.stepSize,fontSize:l.FONTS.caption.fontSize,color:null!==(m=t.xAxis.labelColor)&&void 0!==m?m:l.COLORS.content.secondary},w?{min:0,max:2e3,stepSize:200}:{}),{callback:t.orientation!==s.GRAPH_ORIENTATION.VERTICAL?n.truncateValueToK:void 0}),stacked:t.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?"boolean"!=typeof(null===(_=t.xAxis)||void 0===_?void 0:_.stacked)||(null===(P=t.xAxis)||void 0===P?void 0:P.stacked):"boolean"!=typeof(null===(G=t.yAxis)||void 0===G?void 0:G.stacked)||(null===(Z=t.yAxis)||void 0===Z?void 0:Z.stacked)}},onClick:(e,o)=>{if(!t.onBarClick)return;const i=o[0].datasetIndex,a=o[0].index,l=e.chart.data.datasets[i].label,n=e.chart.data.labels[a];t.onBarClick(n,l)},onHover:(e,o)=>{t.onBarClick&&o.length&&(e.native.target.style.cursor="pointer")}};t.orientation&&t.orientation!==s.GRAPH_ORIENTATION.VERTICAL?delete Y.scales.y.ticks.callback:delete Y.scales.x.ticks.callback;const J={labels:t.xAxis.data.map((e=>"string"==typeof e?e:e.name)),datasets:w?[{data:[250,1e3,800,1500,300,600],backgroundColor:"rgba(0,0,0,0)"}]:M};return e.jsxs(r.GraphContainerWrapper,Object.assign({style:null!==(z=t.wrapperStyle)&&void 0!==z?z:{},padding:t.outerPadding,customLegend:t.customLegend},{children:[t.chartHeading&&e.jsx("div",Object.assign({style:{marginBottom:24}},{children:e.jsx(a.TitleRegular,Object.assign({color:null!==(B=t.chartHeading.color)&&void 0!==B?B:l.COLORS.content.secondary},{children:t.chartHeading.heading}))})),t.customLegend&&e.jsx("div",Object.assign({style:{overflowY:"scroll",display:"flex",flexDirection:"row",gap:"10px",padding:"0px 24px 12px 24px",justifyContent:"flex-end"}},{children:M.map((t=>e.jsxs("div",Object.assign({className:"legend__row"},{children:[e.jsx("div",{className:"legend__palette",style:{backgroundColor:t.backgroundColor}}),e.jsx(a.BodyTiny,Object.assign({color:l.COLORS.content.secondary},{children:t.label}))]}),t.label.replace(" ","_"))))})),e.jsx("div",Object.assign({className:"graph__wrapper"},{children:e.jsx("div",Object.assign({style:{height:null!==(D=t.graphCanvasHeight)&&void 0!==D?D:500,width:null!==(q=t.graphCanvasWidth)&&void 0!==q?q:"auto"}},{children:e.jsx(i.Bar,{options:Y,data:J})}))}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("chart.js"),t=require("chartjs-plugin-datalabels"),i=require("react-chartjs-2"),a=require("../../../TypographyStyle.js"),l=require("../../../../constants/Theme.js"),n=require("../utils/calcPercentage.js"),s=require("./StackedBarChart.model.js"),r=require("./StackedBarChart.styles.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=d(t);o.Chart.register(o.CategoryScale,o.LinearScale,o.BarElement,o.Tooltip,o.Legend,c.default);exports.StackedBarChart=o=>{var t,d,c,O,u,v,A,x,g,p,T,R,y,C,N,I,b,h,S,E,H,f,k,L,m,F,j,P,_,G,B,Z,z,D,q;const w=0===o.yAxis.data.length,V=void 0===o.customColourScaleBrand||void 0===o.customColourScalePastel?o.colorSchema===s.COLOR_SCHEMA.PASTEL?["#E6C7FF","#FEC6C6","#FEDEF3","#DEEFFF","#FFD8B1","#C7E5FF","#FFD3E6","#C9FFE5","#FFE3C7","#D9D9FF"]:["#5E07BB","#9E77ED","#D2AEFF","#F7D7FF","#CDE1FF","#92AFFA","#3935E1"]:o.colorSchema===s.COLOR_SCHEMA.PASTEL?o.customColourScalePastel:o.customColourScaleBrand,W=o.customHoverColour,M={barPercentage:.4,categoryPercentage:1,pointStyle:"circle",barWidth:o.barWidth},K={};o.yAxis.data.map((e=>{e.map((e=>{K[e.name]?K[e.name].push(e.value):K[e.name]=[e.value]}))}));const Y=Object.keys(K).map(((e,o)=>Object.assign({label:e,data:K[e],backgroundColor:V[o],hoverBackgroundColor:void 0===W?void 0:W[o]},M))),J={plugins:{legend:{display:!w&&!o.customLegend,labels:{usePointStyle:!0,fontSize:2}},tooltip:{enabled:!w,callbacks:{label:null===(t=o.tooltipConfig)||void 0===t?void 0:t.labelCallback,footer:null===(d=o.tooltipConfig)||void 0===d?void 0:d.footerCallback},footerFont:null===(O=null===(c=o.tooltipConfig)||void 0===c?void 0:c.footerStyles)||void 0===O?void 0:O.footerFont},datalabels:{display:null!==(u=o.showTotal)&&void 0!==u&&u,anchor:"end",align:"end",clamp:!0,formatter:(e,o)=>{var t;const i=o.datasetIndex,a=o.chart.data.datasets;if(i!==a.length-1)return"";const l=o.dataIndex;let n=0;for(let e=0;e<a.length;e++)n+=null!==(t=a[e].data[l])&&void 0!==t?t:0;return n?n<1e3?n:(n/1e3).toString().substring(0,4)+"k":""},color:l.COLORS.content.secondary}},layout:{padding:{right:o.showTotal&&o.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?50:0,top:o.showTotal&&o.orientation!=s.GRAPH_ORIENTATION.HORIZONTAL?50:0}},responsive:!0,maintainAspectRatio:!1,legend:{display:!o.customLegend,labels:{usePointStyle:!0}},indexAxis:o.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?"y":"x",scales:{x:{title:{display:!!(o.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?null===(v=o.yAxis)||void 0===v?void 0:v.title:null===(A=o.xAxis)||void 0===A?void 0:A.title),text:o.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?null===(x=o.yAxis)||void 0===x?void 0:x.title:null===(g=o.xAxis)||void 0===g?void 0:g.title,color:null!==(R=o.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?null===(p=o.yAxis)||void 0===p?void 0:p.titleColor:null===(T=o.xAxis)||void 0===T?void 0:T.titleColor)&&void 0!==R?R:l.COLORS.content.secondary,font:{size:l.FONTS.caption.fontSize}},grid:{display:o.orientation===s.GRAPH_ORIENTATION.HORIZONTAL,color:l.COLORS.background.base},ticks:{fontSize:l.FONTS.caption.fontSize,color:null!==(y=o.yAxis.labelColor)&&void 0!==y?y:l.COLORS.content.secondary,callback:o.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?n.truncateValueToK:void 0},stacked:o.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?"boolean"!=typeof(null===(C=o.yAxis)||void 0===C?void 0:C.stacked)||(null===(N=o.yAxis)||void 0===N?void 0:N.stacked):"boolean"!=typeof(null===(I=o.xAxis)||void 0===I?void 0:I.stacked)||(null===(b=o.xAxis)||void 0===b?void 0:b.stacked)},y:{title:{display:!!(o.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?null===(h=o.xAxis)||void 0===h?void 0:h.title:null===(S=o.yAxis)||void 0===S?void 0:S.title),text:o.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?null===(E=o.xAxis)||void 0===E?void 0:E.title:null===(H=o.yAxis)||void 0===H?void 0:H.title,color:null!==(L=o.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?null===(f=o.xAxis)||void 0===f?void 0:f.titleColor:null===(k=o.yAxis)||void 0===k?void 0:k.titleColor)&&void 0!==L?L:l.COLORS.content.secondary,font:{size:l.FONTS.caption.fontSize}},grid:{display:o.orientation!==s.GRAPH_ORIENTATION.HORIZONTAL,color:l.COLORS.background.base},ticks:Object.assign(Object.assign({stepSize:o.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?null===(m=o.xAxis)||void 0===m?void 0:m.stepSize:null===(F=o.yAxis)||void 0===F?void 0:F.stepSize,fontSize:l.FONTS.caption.fontSize,color:null!==(j=o.xAxis.labelColor)&&void 0!==j?j:l.COLORS.content.secondary},w?{min:0,max:2e3,stepSize:200}:{}),{callback:o.orientation!==s.GRAPH_ORIENTATION.VERTICAL?n.truncateValueToK:void 0}),stacked:o.orientation===s.GRAPH_ORIENTATION.HORIZONTAL?"boolean"!=typeof(null===(P=o.xAxis)||void 0===P?void 0:P.stacked)||(null===(_=o.xAxis)||void 0===_?void 0:_.stacked):"boolean"!=typeof(null===(G=o.yAxis)||void 0===G?void 0:G.stacked)||(null===(B=o.yAxis)||void 0===B?void 0:B.stacked)}},onClick:(e,t)=>{if(!o.onBarClick)return;const i=t[0].datasetIndex,a=t[0].index,l=e.chart.data.datasets[i].label,n=e.chart.data.labels[a];o.onBarClick(n,l)},onHover:(e,t)=>{o.onBarClick&&t.length&&(e.native.target.style.cursor="pointer")}};o.orientation&&o.orientation!==s.GRAPH_ORIENTATION.VERTICAL?delete J.scales.y.ticks.callback:delete J.scales.x.ticks.callback;const Q={labels:o.xAxis.data.map((e=>"string"==typeof e?e:e.name)),datasets:w?[{data:[250,1e3,800,1500,300,600],backgroundColor:"rgba(0,0,0,0)"}]:Y};return e.jsxs(r.GraphContainerWrapper,Object.assign({style:null!==(Z=o.wrapperStyle)&&void 0!==Z?Z:{},padding:o.outerPadding,customLegend:o.customLegend},{children:[o.chartHeading&&e.jsx("div",Object.assign({style:{marginBottom:24}},{children:e.jsx(a.TitleRegular,Object.assign({color:null!==(z=o.chartHeading.color)&&void 0!==z?z:l.COLORS.content.secondary},{children:o.chartHeading.heading}))})),o.customLegend&&e.jsx("div",Object.assign({style:{overflowY:"scroll",display:"flex",flexDirection:"row",gap:"10px",padding:"0px 24px 12px 24px",justifyContent:"flex-end"}},{children:Y.map((o=>e.jsxs("div",Object.assign({className:"legend__row"},{children:[e.jsx("div",{className:"legend__palette",style:{backgroundColor:o.backgroundColor}}),e.jsx(a.BodyTiny,Object.assign({color:l.COLORS.content.secondary},{children:o.label}))]}),o.label.replace(" ","_"))))})),e.jsx("div",Object.assign({className:"graph__wrapper"},{children:e.jsx("div",Object.assign({style:{height:null!==(D=o.graphCanvasHeight)&&void 0!==D?D:500,width:null!==(q=o.graphCanvasWidth)&&void 0!==q?q:"auto"}},{children:e.jsx(i.Bar,{options:J,data:Q})}))}))]}))};
@@ -55,4 +55,7 @@ export interface StackedBarGraphI {
55
55
  footerFont?: Partial<FontSpec>;
56
56
  };
57
57
  };
58
+ customColourScaleBrand?: string[];
59
+ customColourScalePastel?: string[];
60
+ customHoverColour?: string[];
58
61
  }
@@ -9,5 +9,4 @@ export declare const CountryCodePicker: React.FC<{
9
9
  height?: string;
10
10
  placement?: Placement;
11
11
  placementStrategy?: PositioningStrategy;
12
- disabled?: boolean;
13
12
  }>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("../../assets/icons/chevronDown.svg.js"),r=require("react"),t=require("./CountryCodePicker.modal.js"),n=require("./CountryCodePicker.styled.js"),s=require("../dropdown/DropdownPopover/index.js");require("../dropdown/Dropdown.js"),require("../dropdown/ChipDropdown.js"),require("../zeroState/ZeroState.js");var d=require("../TypographyStyle.js"),i=require("../../constants/Theme.js");require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../button/Button.js"),require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");exports.CountryCodePicker=c=>{var l,u,a,p,m,j;const[y,w]=r.useState(null!==(l=c.selectedCountry)&&void 0!==l?l:{name:"India",dial:"+91",code:"IN"}),v=`https://flagcdn.com/${null===(u=y.code)||void 0===u?void 0:u.toLowerCase()}.svg`;r.useEffect((()=>{c.selectedCountry&&w(c.selectedCountry)}),[null===(a=c.selectedCountry)||void 0===a?void 0:a.code]);return e.jsx(s.DropdownPopover,Object.assign({version:c.version,isSearchable:!0,width:null!==(p=c.popoverWidth)&&void 0!==p?p:"200px",placement:null!==(m=c.placement)&&void 0!==m?m:"bottom-start",strategy:null!==(j=c.placementStrategy)&&void 0!==j?j:"absolute",options:t.CountriesData.map((o=>{var r;const t=`https://flagcdn.com/${null===(r=o.code)||void 0===r?void 0:r.toLowerCase()}.svg`;return{value:o.code,label:o.dial,searchKey:o.name,customComponent:e.jsxs(n.StyledCountryPickerOption,{children:[e.jsx("img",{src:t,className:"country-flag__option",alt:o.name}),e.jsxs(d.BodySecondary,{children:[o.code," ",o.dial]})]}),selected:y.code===o.code}})),disabled:c.disabled,onSelect:e=>{const o=t.CountriesData.filter((o=>o.code===e.value));w(o[0]),c.onCountrySelect(o[0])}},{children:e.jsxs(n.StyledCountryPickerWrapper,Object.assign({height:c.height},{children:[e.jsxs("div",Object.assign({className:"content__wrapper"},{children:[e.jsx("img",{src:v,className:"country-flag__selected-option",alt:y.name}),e.jsx(d.BodySecondary,{children:y.dial})]})),e.jsx(o.default,{width:24,height:24,color:i.COLORS.content.primary})]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("../../assets/icons/chevronDown.svg.js"),r=require("react"),t=require("./CountryCodePicker.modal.js"),n=require("./CountryCodePicker.styled.js"),s=require("../dropdown/DropdownPopover/index.js");require("../dropdown/Dropdown.js"),require("../dropdown/ChipDropdown.js"),require("../zeroState/ZeroState.js");var d=require("../TypographyStyle.js"),i=require("../../constants/Theme.js");require("../dropdown/OpenedDropdown/components/description/Description.styled.js"),require("../checkBox/CheckBox.styled.js"),require("../list-item/ListItem.js"),require("../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js"),require("../dropdown/OpenedDropdown/components/menu/MenuItem.js"),require("../dropdown/OpenedDropdown/components/menu/MenuList.styled.js"),require("../button/Button.js"),require("../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js"),require("../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js"),require("../input/Input.js"),require("../dropdown/MenuItem/MenuItem.js");exports.CountryCodePicker=c=>{var l,u,p,a,m,j;const[y,w]=r.useState(null!==(l=c.selectedCountry)&&void 0!==l?l:{name:"India",dial:"+91",code:"IN"}),v=`https://flagcdn.com/${null===(u=y.code)||void 0===u?void 0:u.toLowerCase()}.svg`;r.useEffect((()=>{c.selectedCountry&&w(c.selectedCountry)}),[null===(p=c.selectedCountry)||void 0===p?void 0:p.code]);return e.jsx(s.DropdownPopover,Object.assign({version:c.version,isSearchable:!0,width:null!==(a=c.popoverWidth)&&void 0!==a?a:"200px",placement:null!==(m=c.placement)&&void 0!==m?m:"bottom-start",strategy:null!==(j=c.placementStrategy)&&void 0!==j?j:"absolute",options:t.CountriesData.map((o=>{var r;const t=`https://flagcdn.com/${null===(r=o.code)||void 0===r?void 0:r.toLowerCase()}.svg`;return{value:o.code,label:o.dial,searchKey:o.name,customComponent:e.jsxs(n.StyledCountryPickerOption,{children:[e.jsx("img",{src:t,className:"country-flag__option",alt:o.name}),e.jsxs(d.BodySecondary,{children:[o.code," ",o.dial]})]}),selected:y.code===o.code}})),onSelect:e=>{const o=t.CountriesData.filter((o=>o.code===e.value));w(o[0]),c.onCountrySelect(o[0])}},{children:e.jsxs(n.StyledCountryPickerWrapper,Object.assign({height:c.height},{children:[e.jsxs("div",Object.assign({className:"content__wrapper"},{children:[e.jsx("img",{src:v,className:"country-flag__selected-option",alt:y.name}),e.jsx(d.BodySecondary,{children:y.dial})]})),e.jsx(o.default,{width:24,height:24,color:i.COLORS.content.primary})]}))}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/info.svg.js"),n=require("react"),i=require("../button/Button.js"),s=require("./Input-helper.js"),r=require("../tooltips/Tooltip.js"),l=require("../TypographyStyle.js"),a=require("../../constants/Theme.js"),o=require("../../assets/icons/errorInfo.svg.js"),c=require("./context/InputStyleProvider.js"),u=require("./Input.styled.js");const d=n.forwardRef(((d,h)=>{var v,x,p,g,j,f,m;const{placeholder:y,leftIcon:b,rightIcon:C,labelText:O,maxCharLimit:T,isRequired:I,hintText:S,type:w,state:k,validate:E,variant:q,button:H,suffixText:L,prefixText:M,onChangeText:B,value:F,noErrorHint:R,reset:P,rangeValidation:z,noKeyDownChange:A,version:D,noMaxCharCheck:N,labelElement:_,autoGrow:K,minHeight:G,maxHeight:W,labelTextBold:V,truncateText:$,maxCharLimitPosition:J}=Object.assign({maxCharLimit:0,type:"text",variant:"default",maxCharLimitPosition:"TOP"},d),Q=null==b?void 0:b.icon,U=null==C?void 0:C.icon,[X,Y]=n.useState("invalid"===d.state||!!d.errorMessage),[Z,ee]=n.useState(!1),[te,ne]=n.useState(),ie="small"===q?"18px":"22px",se=n.useContext(c.InputStyleContext),[re,le]=n.useState(),ae=n.useRef(null),oe=null!=h?h:ae;n.useEffect((()=>{le(F),!F&&K&&(oe.current.style.height=G||"48px")}),[F]),n.useEffect((()=>{var e;oe.current&&(null===(e=d.onReferenceInit)||void 0===e||e.call(d,oe.current))}),[oe]),n.useEffect((()=>{const e=oe.current;if(e&&["phonenumber","zip","number"].includes(w))return e.addEventListener("wheel",he,{passive:!1}),()=>{e.removeEventListener("wheel",he)}}),[]),n.useEffect((()=>{P&&le("")}),[P]),n.useEffect((()=>{var e;ee(!!d.isActive),d.isActive&&(null===(e=oe.current)||void 0===e||e.focus())}),[d.isActive]),n.useEffect((()=>{ne(d.errorMessage)}),[d.errorMessage]),n.useEffect((()=>{var e;Y(!1),("invalid"===d.state||te||"disabled-invalid"===d.state)&&Y(!0),"active"===d.state&&(null===(e=oe.current)||void 0===e||e.focus())}),[d.state,te]);const ce=function(e){if(s.isFunction(e)){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];e(...n)}},ue=()=>"zip"===w?6:2e3,de=e=>{const t=0!==T?T:ue();if(A||B(F||"",e),N)return;const n=e.target.value;![8].includes(e.which)&&t>0&&n.length>=t&&e.preventDefault()},he=e=>{e.preventDefault()},ve=e=>{let t=e.target.value;const n=0!==T?T+1:ue();!N&&n>0&&t.length>=n&&(t=t.substring(0,n-1)),B(t,e),d.textControl||le(t),K&&(oe.current.style.height=`${oe.current.scrollHeight}px`,t||(oe.current.style.height=G||"48px"));const i=E||s.validateInput;if(!i||!s.isFunction(i))return;const[r,l]=i(t,w,z);Y(!r),ne(d.errorMessage?d.errorMessage:l)},xe=e=>{var t;d.skipFocus||ee(!0),ce(null===(t=d.onFocus)||void 0===t?void 0:t.call(d,e))},pe=e=>{var t;d.skipFocus||ee(!1),ce(null===(t=d.onBlur)||void 0===t?void 0:t.call(d,e))},ge=()=>{var t;return e.jsxs(e.Fragment,{children:["multiline"!==w&&e.jsx("input",{className:$?"truncate-class":"","data-test":d["data-test"],id:d.id,style:null!==(t=null==se?void 0:se.input)&&void 0!==t?t:{},ref:oe,type:["phonenumber","zip","number"].includes(w)?"number":w,value:re,onFocus:e=>xe(e),onBlur:e=>pe(e),placeholder:y||"Enter here",onChange:ve,onClick:e=>ce(d.onClick),onKeyDown:e=>de(e)}),"multiline"===w&&e.jsx("textarea",{"data-test":d["data-test"],value:re,ref:oe,onFocus:e=>xe(e),onBlur:e=>pe(e),onClick:e=>ce(d.onClick),placeholder:y||"Enter here",onChange:ve,onKeyDown:e=>de(e),maxLength:T>0?T:void 0})]})};return e.jsxs(u.RootContainer,Object.assign({width:d.width,height:d.height,state:k,type:w,style:null!==(v=null==se?void 0:se.RootContainer)&&void 0!==v?v:{}},{children:[e.jsxs("div",Object.assign({className:"flex-align-center"},{children:[!R&&(!!S||!!te)&&e.jsx(u.InputFooter,Object.assign({invalid:!!te},{children:e.jsxs("div",{children:[!!te&&e.jsx(o.default,{width:16,height:16}),te||S]})})),T>0&&"BOTTOM"===J&&e.jsxs(u.MaxCharStyle,Object.assign({position:"BOTTOM"},{children:[null!==(p=null===(x=d.value)||void 0===x?void 0:x.length)&&void 0!==p?p:0,"/",T]}))]})),e.jsxs(u.InputWrapper,Object.assign({variant:q,state:k,width:d.width,isActive:"active"===k||Z,isInvalid:X,style:null!==(g=null==se?void 0:se.InputWrapper)&&void 0!==g?g:{},version:D,height:d.height},{children:[!!Q&&e.jsx(u.IconHolder,Object.assign({variant:q,iconSize:ie,onClick:()=>ce(null==b?void 0:b.callback),isLeft:!0,style:null!==(j=null==se?void 0:se.IconHolder)&&void 0!==j?j:{}},{children:e.jsx(Q,{})})),!!M&&e.jsx(u.PrefixHolder,Object.assign({variant:q},{children:M})),"default"===q&&e.jsx(u.InputContainer,Object.assign({height:d.height,type:d.type,minHeight:G,maxHeight:W,autoGrow:K},{children:ge()})),"small"===q&&e.jsx(u.InputContainerSmall,Object.assign({height:d.height,type:d.type},{children:ge()})),!!U&&e.jsx(u.IconHolder,Object.assign({variant:q,iconSize:ie,onClick:()=>ce(null==C?void 0:C.callback),isLeft:!1},{children:e.jsx(U,{})})),!!L&&e.jsx(u.SuffixHolder,Object.assign({variant:q},{children:L})),H&&H.text&&e.jsx(i.Button,{buttonText:H.text,onClick:()=>ce(null==H?void 0:H.onClick)})]})),(!!O||!!T)&&e.jsxs(u.InputHeader,Object.assign({invalid:X},{children:[_&&_,e.jsxs("div",Object.assign({className:"label__container"},{children:[V?e.jsxs(l.TitleSmall,{children:[O,I?e.jsx("span",{children:"*"}):""]}):e.jsxs(l.BodySecondary,{children:[O,I?e.jsx("span",{children:"*"}):""]}),d.tooltipText&&e.jsx(r.Tooltip,Object.assign({body:d.tooltipText,placement:"top"},{children:e.jsx("span",{children:e.jsx(t.default,{style:{marginTop:-3},width:18,height:18,color:X?a.COLORS.content.negative:a.COLORS.content.primary})})}))]})),T>0&&"TOP"===J&&e.jsxs(u.MaxCharStyle,{children:[null!==(m=null===(f=d.value)||void 0===f?void 0:f.length)&&void 0!==m?m:0,"/",T]})]}))]}))}));d.displayName="Input",exports.Input=d;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/info.svg.js"),n=require("react"),i=require("../button/Button.js"),s=require("./Input-helper.js"),r=require("../tooltips/Tooltip.js"),l=require("../TypographyStyle.js"),a=require("../../constants/Theme.js"),o=require("../../assets/icons/errorInfo.svg.js"),c=require("./context/InputStyleProvider.js"),u=require("./Input.styled.js");const d=n.forwardRef(((d,h)=>{var v,x,p,g,j,f,m;const{placeholder:y,leftIcon:b,rightIcon:C,labelText:O,maxCharLimit:T,isRequired:I,hintText:S,type:w,state:E,validate:k,variant:q,button:H,suffixText:L,prefixText:M,onChangeText:B,value:F,noErrorHint:R,reset:P,rangeValidation:z,noKeyDownChange:A,version:D,noMaxCharCheck:N,labelElement:_,autoGrow:K,minHeight:G,maxHeight:W,labelTextBold:V,truncateText:$,maxCharLimitPosition:J}=Object.assign({maxCharLimit:0,type:"text",variant:"default",maxCharLimitPosition:"TOP"},d),Q=null==b?void 0:b.icon,U=null==C?void 0:C.icon,[X,Y]=n.useState(!1),[Z,ee]=n.useState(!1),[te,ne]=n.useState(),ie="small"===q?"18px":"22px",se=n.useContext(c.InputStyleContext),[re,le]=n.useState(),ae=n.useRef(null),oe=null!=h?h:ae;n.useEffect((()=>{le(F),!F&&K&&(oe.current.style.height=G||"48px")}),[F]),n.useEffect((()=>{var e;oe.current&&(null===(e=d.onReferenceInit)||void 0===e||e.call(d,oe.current))}),[oe]),n.useEffect((()=>{const e=oe.current;if(e&&["phonenumber","zip","number"].includes(w))return e.addEventListener("wheel",he,{passive:!1}),()=>{e.removeEventListener("wheel",he)}}),[]),n.useEffect((()=>{P&&le("")}),[P]),n.useEffect((()=>{var e;ee(!!d.isActive),d.isActive&&(null===(e=oe.current)||void 0===e||e.focus())}),[d.isActive]),n.useEffect((()=>{ne(d.errorMessage)}),[d.errorMessage]),n.useEffect((()=>{var e;Y(!1),("invalid"===d.state||te||"disabled-invalid"===d.state)&&Y(!0),"active"===d.state&&(null===(e=oe.current)||void 0===e||e.focus())}),[d.state,te]),n.useEffect((()=>{Y(!!te)}),[te]);const ce=function(e){if(s.isFunction(e)){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];e(...n)}},ue=()=>"zip"===w?6:2e3,de=e=>{const t=0!==T?T:ue();if(A||B(F||"",e),N)return;const n=e.target.value;![8].includes(e.which)&&t>0&&n.length>=t&&e.preventDefault()},he=e=>{e.preventDefault()},ve=e=>{let t=e.target.value;const n=0!==T?T+1:ue();!N&&n>0&&t.length>=n&&(t=t.substring(0,n-1)),B(t,e),d.textControl||le(t),K&&(oe.current.style.height=`${oe.current.scrollHeight}px`,t||(oe.current.style.height=G||"48px"));const i=k||s.validateInput;if(!i||!s.isFunction(i))return;const[r,l]=i(t,w,z);Y(!r),ne(d.errorMessage?d.errorMessage:l)},xe=e=>{var t;d.skipFocus||ee(!0),ce(null===(t=d.onFocus)||void 0===t?void 0:t.call(d,e))},pe=e=>{var t;d.skipFocus||ee(!1),ce(null===(t=d.onBlur)||void 0===t?void 0:t.call(d,e))},ge=()=>{var t;return e.jsxs(e.Fragment,{children:["multiline"!==w&&e.jsx("input",{className:$?"truncate-class":"","data-test":d["data-test"],id:d.id,style:null!==(t=null==se?void 0:se.input)&&void 0!==t?t:{},ref:oe,type:["phonenumber","zip","number"].includes(w)?"number":w,value:re,onFocus:e=>xe(e),onBlur:e=>pe(e),placeholder:y||"Enter here",onChange:ve,onClick:e=>ce(d.onClick),onKeyDown:e=>de(e)}),"multiline"===w&&e.jsx("textarea",{"data-test":d["data-test"],value:re,ref:oe,onFocus:e=>xe(e),onBlur:e=>pe(e),onClick:e=>ce(d.onClick),placeholder:y||"Enter here",onChange:ve,onKeyDown:e=>de(e),maxLength:T>0?T:void 0})]})};return e.jsxs(u.RootContainer,Object.assign({width:d.width,height:d.height,state:E,type:w,style:null!==(v=null==se?void 0:se.RootContainer)&&void 0!==v?v:{}},{children:[e.jsxs("div",Object.assign({className:"flex-align-center"},{children:[!R&&(!!S||!!te)&&e.jsx(u.InputFooter,Object.assign({invalid:!!te},{children:e.jsxs("div",{children:[!!te&&e.jsx(o.default,{width:16,height:16}),te||S]})})),T>0&&"BOTTOM"===J&&e.jsxs(u.MaxCharStyle,Object.assign({position:"BOTTOM"},{children:[null!==(p=null===(x=d.value)||void 0===x?void 0:x.length)&&void 0!==p?p:0,"/",T]}))]})),e.jsxs(u.InputWrapper,Object.assign({variant:q,state:E,width:d.width,isActive:"active"===E||Z,isInvalid:X,style:null!==(g=null==se?void 0:se.InputWrapper)&&void 0!==g?g:{},version:D,height:d.height},{children:[!!Q&&e.jsx(u.IconHolder,Object.assign({variant:q,iconSize:ie,onClick:()=>ce(null==b?void 0:b.callback),isLeft:!0,style:null!==(j=null==se?void 0:se.IconHolder)&&void 0!==j?j:{}},{children:e.jsx(Q,{})})),!!M&&e.jsx(u.PrefixHolder,Object.assign({variant:q},{children:M})),"default"===q&&e.jsx(u.InputContainer,Object.assign({height:d.height,type:d.type,minHeight:G,maxHeight:W,autoGrow:K},{children:ge()})),"small"===q&&e.jsx(u.InputContainerSmall,Object.assign({height:d.height,type:d.type},{children:ge()})),!!U&&e.jsx(u.IconHolder,Object.assign({variant:q,iconSize:ie,onClick:()=>ce(null==C?void 0:C.callback),isLeft:!1},{children:e.jsx(U,{})})),!!L&&e.jsx(u.SuffixHolder,Object.assign({variant:q},{children:L})),H&&H.text&&e.jsx(i.Button,{buttonText:H.text,onClick:()=>ce(null==H?void 0:H.onClick)})]})),(!!O||!!T)&&e.jsxs(u.InputHeader,Object.assign({invalid:X},{children:[_&&_,e.jsxs("div",Object.assign({className:"label__container"},{children:[V?e.jsxs(l.TitleSmall,{children:[O,I?e.jsx("span",{children:"*"}):""]}):e.jsxs(l.BodySecondary,{children:[O,I?e.jsx("span",{children:"*"}):""]}),d.tooltipText&&e.jsx(r.Tooltip,Object.assign({body:d.tooltipText,placement:"top"},{children:e.jsx("span",{children:e.jsx(t.default,{style:{marginTop:-3},width:18,height:18,color:X?a.COLORS.content.negative:a.COLORS.content.primary})})}))]})),T>0&&"TOP"===J&&e.jsxs(u.MaxCharStyle,{children:[null!==(m=null===(f=d.value)||void 0===f?void 0:f.length)&&void 0!==m?m:0,"/",T]})]}))]}))}));d.displayName="Input",exports.Input=d;
@@ -1,7 +1,7 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../assets/icons/PlusIcon.js"),r=require("react"),t=require("styled-components"),l=require("uuid"),i=require("../../constants/Theme.js"),s=require("../add-variableV2/AddVariableBox.styled.js"),n=require("../floater/floater.js"),u=require("../input/Input.js"),c=require("../TypographyStyle.js"),o=require("../variable-picker-v3/VariablePicker.js"),d=require("../variable-picker-v3/model.js"),v=require("./customPortal.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const b=p(t).default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../assets/icons/PlusIcon.js"),l=require("react"),r=require("styled-components"),t=require("uuid"),i=require("../../constants/Theme.js"),s=require("../add-variableV2/AddVariableBox.styled.js"),n=require("../floater/floater.js"),u=require("../input/Input.js"),c=require("../TypographyStyle.js"),o=require("../variable-picker-v3/VariablePicker.js"),d=require("../variable-picker-v3/model.js"),v=require("./customPortal.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const b=p(r).default.div`
2
2
  position: relative;
3
3
  margin-bottom: 16px;
4
4
  input {
5
5
  color: ${e=>e.isVar?i.COLORS.stroke.brand:"black"};
6
6
  }
7
- `;exports.InputWithVariables=t=>{let{type:i,allowMix:p,onChange:h,prevVariable:x,variablesList:j,onBlur:y,onlyVariables:g,placeHolder:T,showAddButton:f=!0,showHelp:V,errorMessage:m,maxCharLimit:k,noMaxCharCheck:C,labelText:E,labelElement:O,isRequired:S=!1,hintText:q,onEnterPress:P,pickerType:w=d.PickerType.FLOATER,portalElement:R,showVarHeader:F,varHeaderText:A,onPickerToggle:D}=t;const M=r.useRef(),B=r.useRef(!0),I=r.useRef(null),[L,H]=r.useState(!1),[N]=r.useState(l.v4()),[$,z]=r.useState(),[_,K]=r.useState(x),[W,G]=r.useState(!1),[J,Q]=r.useState(!1),[U,X]=r.useState(0);return r.useEffect((()=>{if($&&$.actualValue)if(p){if(K((e=>{return{actualValue:(a=e.actualValue,r=$.actualValue,t=U,a.slice(0,t)+r+a.slice(t)),variableType:"string"};var a,r,t})),I.current){X(I.current.selectionStart);const e=U+$.actualValue.length+2;I.current.setSelectionRange(e,e),X(e)}}else K((e=>({actualValue:$.actualValue,variableType:$.variableType,needsFetching:$.needsFetching})))}),[$]),r.useEffect((()=>{B.current?B.current=!1:h(_)}),[_]),e.jsxs(e.Fragment,{children:[e.jsxs(b,Object.assign({isVar:/^{{.*}}$/.test(_.actualValue),onKeyDown:e=>{"Enter"===e.key&&(null==P||P(_.actualValue))}},{children:[e.jsx(u.Input,{isRequired:S,hintText:q,type:null!=i?i:"text",id:N,ref:I,skipFocus:!0,isActive:L,value:_.actualValue,validate:e=>[!0,""],errorMessage:m,noMaxCharCheck:C,maxCharLimit:k,labelText:E,labelElement:O,placeholder:T||"Add a value",onClick:e=>{I.current&&X(I.current.selectionStart)},onChangeText:(e,a)=>{if(I.current&&X(I.current.selectionStart),g){const e=(null==a?void 0:a.keyCode)||(null==a?void 0:a.charCode);8!==e&&46!==e||K({actualValue:"",variableType:"string"})}else K(p?{actualValue:e,variableType:"string"}:{actualValue:e.replace(/{{.*}}/,""),variableType:"string"})},onReferenceInit:()=>{},onFocus:e=>{H(!0),Q(!0)},onBlur:e=>{var a,r,t,l,i,s;null==y||y(e,_),"addVar"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||"variable-picker-v3"===(null===(r=e.relatedTarget)||void 0===r?void 0:r.id)||(null===(l=null===(t=e.relatedTarget)||void 0===t?void 0:t.className)||void 0===l?void 0:l.includes("accordion"))||"back-btn-v3"===(null===(i=e.relatedTarget)||void 0===i?void 0:i.id)?(I.current&&I.current.focus(),H(!0)):"search-bar-v3-picker"===(null===(s=e.relatedTarget)||void 0===s?void 0:s.id)?H(!0):(H(!1),G(!1),null==D||D(!1),Q(!1))}}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"space-between"}},{children:[_.actualValue&&V&&e.jsx("div",Object.assign({style:{marginTop:4}},{children:e.jsx(c.BodyCaption,{children:`This value is of type ${_.variableType}`})})),f&&J&&e.jsx("div",Object.assign({style:{marginTop:m||q?"-24px":"0px"}},{children:e.jsx(s.AddVariableStyled,Object.assign({ref:M,id:"addVar",onClick:()=>{G(!W),null==D||D(!W)}},{children:e.jsxs("div",Object.assign({className:"add"},{children:[e.jsx(a.default,{color:"white"}),e.jsx("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))}))]}))]})),W&&e.jsx(e.Fragment,{children:w===d.PickerType.EMBEDDED?e.jsx(v.CustomPortal,Object.assign({zIndex:101,element:null!=R?R:document.body},{children:e.jsx(o.VariablePicker,{width:"344px",showHeader:F,headerText:A,onClose:()=>{G(!1),null==D||D(!1)},type:d.PickerType.EMBEDDED,data:j,onSelect:e=>{z(e),G(!1),null==D||D(!1)}})})):e.jsx("div",Object.assign({style:{zIndex:101,position:"relative"}},{children:e.jsx(n.Floater,Object.assign({refElement:M},{children:e.jsx("div",Object.assign({style:{height:500}},{children:e.jsx(o.VariablePicker,{onClose:()=>{G(!1),null==D||D(!1)},type:d.PickerType.FLOATER,data:j,onSelect:e=>{z(e),G(!1),null==D||D(!1)}})}))}))}))})]})};
7
+ `;exports.InputWithVariables=r=>{let{type:i,allowMix:p,onChange:h,prevVariable:x,variablesList:j,onBlur:g,onlyVariables:y,placeHolder:T,showAddButton:f=!0,showHelp:V,errorMessage:k,maxCharLimit:m,noMaxCharCheck:C,labelText:E,labelElement:O,isRequired:S=!1,hintText:q,onEnterPress:P,pickerType:w=d.PickerType.FLOATER,portalElement:R,showVarHeader:F,varHeaderText:A,onPickerToggle:D}=r;const M=l.useRef(),B=l.useRef(!0),I=l.useRef(null),[L,H]=l.useState(!1),[N]=l.useState(t.v4()),[$,z]=l.useState(),[_,K]=l.useState(x),[W,G]=l.useState(!1),[J,Q]=l.useState(!1),[U,X]=l.useState(0);return l.useEffect((()=>{if($&&$.actualValue)if(p){if(K((e=>{return{actualValue:(a=e.actualValue,l=$.actualValue,r=U,a.slice(0,r)+l+a.slice(r)),variableType:"string"};var a,l,r})),I.current){X(I.current.selectionStart);const e=U+$.actualValue.length+2;I.current.setSelectionRange(e,e),X(e)}}else K((e=>({actualValue:$.actualValue,variableType:$.variableType,needsFetching:$.needsFetching})))}),[$]),l.useEffect((()=>{B.current?B.current=!1:h(_)}),[_]),e.jsxs(e.Fragment,{children:[e.jsxs(b,Object.assign({isVar:/^{{.*}}$/.test(_.actualValue),onKeyDown:e=>{console.log("key",e.key),"Enter"===e.key&&(null==P||P(_.actualValue))}},{children:[e.jsx(u.Input,{isRequired:S,hintText:q,type:null!=i?i:"text",id:N,ref:I,skipFocus:!0,isActive:L,value:_.actualValue,validate:e=>[!0,""],errorMessage:k,noMaxCharCheck:C,maxCharLimit:m,labelText:E,labelElement:O,placeholder:T||"Add a value",onClick:e=>{I.current&&X(I.current.selectionStart)},onChangeText:(e,a)=>{if(I.current&&X(I.current.selectionStart),y){const e=(null==a?void 0:a.keyCode)||(null==a?void 0:a.charCode);8!==e&&46!==e||K({actualValue:"",variableType:"string"})}else K(p?{actualValue:e,variableType:"string"}:{actualValue:e.replace(/{{.*}}/,""),variableType:"string"})},onReferenceInit:()=>{},onFocus:e=>{H(!0),Q(!0)},onBlur:e=>{var a,l,r,t,i,s,n;console.log("ee",null===(a=e.relatedTarget)||void 0===a?void 0:a.id),null==g||g(e,_),"addVar"===(null===(l=e.relatedTarget)||void 0===l?void 0:l.id)||"variable-picker-v3"===(null===(r=e.relatedTarget)||void 0===r?void 0:r.id)||(null===(i=null===(t=e.relatedTarget)||void 0===t?void 0:t.className)||void 0===i?void 0:i.includes("accordion"))||"back-btn-v3"===(null===(s=e.relatedTarget)||void 0===s?void 0:s.id)?(I.current&&I.current.focus(),H(!0)):"search-bar-v3-picker"===(null===(n=e.relatedTarget)||void 0===n?void 0:n.id)?H(!0):(H(!1),G(!1),null==D||D(!1),Q(!1))}}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"space-between"}},{children:[_.actualValue&&V&&e.jsx("div",Object.assign({style:{marginTop:4}},{children:e.jsx(c.BodyCaption,{children:`This value is of type ${_.variableType}`})})),f&&J&&e.jsx("div",Object.assign({style:{marginTop:k||q?"-24px":"0px"}},{children:e.jsx(s.AddVariableStyled,Object.assign({ref:M,id:"addVar",onClick:()=>{G(!W),null==D||D(!W)}},{children:e.jsxs("div",Object.assign({className:"add"},{children:[e.jsx(a.default,{color:"white"}),e.jsx("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))}))]}))]})),W&&e.jsx(e.Fragment,{children:w===d.PickerType.EMBEDDED?e.jsx(v.CustomPortal,Object.assign({zIndex:101,element:null!=R?R:document.body},{children:e.jsx(o.VariablePicker,{width:"344px",showHeader:F,headerText:A,onClose:()=>{G(!1),null==D||D(!1)},type:d.PickerType.EMBEDDED,data:j,onSelect:e=>{z(e),G(!1),null==D||D(!1)}})})):e.jsx("div",Object.assign({style:{zIndex:101,position:"relative"}},{children:e.jsx(n.Floater,Object.assign({refElement:M},{children:e.jsx("div",Object.assign({style:{height:500}},{children:e.jsx(o.VariablePicker,{onClose:()=>{G(!1),null==D||D(!1)},type:d.PickerType.FLOATER,data:j,onSelect:e=>{z(e),G(!1),null==D||D(!1)}})}))}))}))})]})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_back.svg.js"),a=require("../../assets/icons/cross.svg.js"),i=require("../../assets/icons/plus.svg.js"),l=require("../../assets/icons/triangle_error.svg.js"),n=require("react"),r=require("../../constants/Theme.js"),o=require("../accordion/Accordion.js"),c=require("../icon-button/IconButton.js"),d=require("../input/Input.js"),u=require("../list-item/ListItem.js"),h=require("../switch/Switch.js"),b=require("../tooltips/Tooltip.js"),j=require("../TypographyStyle.js"),g=require("./context.js"),p=require("./NoResult.js"),x=require("./recommendVaribles.js"),y=require("./searchVariables.js"),m=require("./styles.js"),O=require("./SubHeaderItems.js");const v=(e,t)=>{if(0===t.length)return e;const a=e.toLowerCase().indexOf(t.toLowerCase());if(-1===a)return e;const i=e.slice(0,a),l=e.slice(a,a+t.length),n=e.slice(a+t.length);return s.jsxs("span",{children:[i,s.jsx("b",Object.assign({style:{color:r.COLORS.content.primary}},{children:l})),n]})},f=/.*\..*/,S=e=>{if(e.actualValue.match(f)){const s=e.actualValue.replace("{{","").replace("}}","").split(".");let t=s[0];return s.forEach(((e,s)=>{if(0===s)return;const a=(e=>/\w+\[\d+\]/g.test(e))(e);if(a){const s=e.match(/(\w+)\[(\d+)\]/);if(s){const e=s[1],a=s[2];t+=`['${e}'][${a}]`}}else t+=`['${e}']`})),t}return e.actualValueEval?e.actualValueEval:e.actualValue};exports.VariablePickerContent=f=>{const{data:C,onSelect:w,showHeader:R,showBackButton:V,hideHeaderCross:k,onBackButtonClick:q,isEvaluationList:T,autoOpenFirst:B,headerText:L}=f,[I,N]=n.useState(C),[_,H]=n.useState(""),[P,E]=n.useState([]),[$,A]=n.useState(""),[F,W]=n.useState(!1),[z,D]=n.useState([]);n.useEffect((()=>{K(!0)}),[]),n.useEffect((()=>{P.length>0?D([P[P.length-1]]):D(C)}),[P]);const K=s=>e.__awaiter(void 0,void 0,void 0,(function*(){if(W(s),s){const e=x.showOnlyRecommendedVariables(I,P);N(e)}else if(P.length>0){const e=$==P[P.length-1].displayName;if(_.length>0&&e){const e=y.searchVariables(_,z,P);N(e)}else N([P[P.length-1].variables])}else if(_.length>0){const e=y.searchVariables(_,z,P);N(e)}else N(C)})),M=()=>{let e=131;return P.length>0&&(e+=32),(f.showHeader||f.showBackButton)&&(e+=40),`calc(100% - ${e}px)`};return s.jsx(g.VariablePickerContext.Provider,Object.assign({value:{variables:I,searchText:_,subHeaderStack:P,showRecommended:F,setSubHeaderStack:E,setSearchText:H,setVariables:N,setShowRecommended:W}},{children:s.jsxs("div",Object.assign({tabIndex:-1,id:"variable-picker-v3",style:{backgroundColor:"white",borderRadius:4,height:"100%",outline:"none"},onClick:e=>e.stopPropagation()},{children:[(R||V)&&s.jsxs(m.HeaderWrapper,{children:[s.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:8}},{children:[V&&s.jsx(c.IconButton,{Icon:()=>s.jsx(t.default,{width:16,height:16,style:{display:"flex",color:r.COLORS.content.primary}}),onClick:q}),R&&s.jsx(j.TitleRegular,{children:null!=L?L:"Select Variable"})]})),!k&&s.jsx(c.IconButton,{style:{color:"#212121"},Icon:a.default,onClick:()=>f.onClose&&f.onClose()})]}),s.jsx("div",Object.assign({style:{padding:"0 16px",paddingTop:12,backgroundColor:r.COLORS.surface.subdued,borderTopLeftRadius:4,borderTopRightRadius:4}},{children:s.jsx(d.Input,{id:"search-bar-v3-picker",onBlur:e=>{f.onSearchBlur&&f.onSearchBlur(e)},value:_,noKeyDownChange:!0,placeholder:"Search",onChangeText:e=>{e||A("");const s=y.searchVariables(e,z,P);if(F){const e=x.showOnlyRecommendedVariables(s,P);N(e)}else N(s);H(e);const t=P.length>0?P[P.length-1].displayName:"home";A(t)}})})),s.jsxs(m.RecommendWrapper,{children:[s.jsx(j.BodySecondary,Object.assign({style:{color:r.COLORS.content.secondary}},{children:"Only Recommended"})),s.jsx(h.Switch,{value:F,onValueChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){yield K(s)}))})]}),P.length>0&&s.jsxs(m.BackHeader,{children:[s.jsx("div",Object.assign({style:{position:"absolute",left:16}},{children:s.jsx(c.IconButton,{id:"back-btn-v3",style:{display:"flex"},Icon:()=>s.jsx(t.default,{width:12,height:12,style:{color:r.COLORS.content.secondary}}),onClick:e=>{e.stopPropagation();let s=_;const t=[...P],a=t.pop();if(E(t),a.displayName===$&&(H(""),s=""),s.length>0){const e=t.length>0?[t[t.length-1]]:C,a=y.searchVariables(s,e,t);if(F){const e=x.showOnlyRecommendedVariables(a,t);N(e)}else N(a)}else if(t.length>0)if(F){const e=x.showOnlyRecommendedVariables([t[t.length-1].variables],t);N(e)}else N([t[t.length-1].variables]);else if(F){const e=x.showOnlyRecommendedVariables(C,P);N(e)}else N(C)}})})),s.jsx(j.BodyCaption,Object.assign({style:{color:r.COLORS.content.secondary}},{children:P[P.length-1].displayName}))]}),s.jsx(s.Fragment,{children:I.length>0?s.jsx(m.Container,Object.assign({height:M()},{children:I.map(((e,t)=>{var a,n;return e.displayName&&void 0!==e.variables?s.jsx("div",Object.assign({style:{borderBottom:`1px solid ${r.COLORS.stroke.primary}`}},{children:s.jsx(o.BikAccordion,Object.assign({autoOpen:B&&0===t,headerPadding:"12px 16px",header:s.jsx(j.TitleSmall,Object.assign({style:{color:r.COLORS.content.secondary}},{children:v(e.displayName,_)}))},{children:s.jsx(O.default,{parentVariable:e,disabled:null!==(a=f.disabled)&&void 0!==a&&a,searchText:_,variable:e.variables,onSelect:w})}))}),e.displayName+F):e.displayName?s.jsx(b.Tooltip,Object.assign({body:O.renderTooltipBody(e),placement:"bottom"},{children:s.jsx(u.ListItem,{variant:f.disabled?"readonly":(null==e?void 0:e.selected)?"selected":"default",version:"2.0",leadingIcon:(null==e?void 0:e.selected)||f.disabled?s.jsx(s.Fragment,{}):s.jsx(i.default,{width:14,height:14}),customListItemLabel:s.jsxs("div",Object.assign({style:{display:"flex",gap:4}},{children:[s.jsx(j.BodySecondary,Object.assign({style:{fontSize:"14px",color:r.COLORS.text.primary}},{children:v(e.displayName,_)})),!e.isAvailable&&s.jsx(b.Tooltip,Object.assign({body:"Not Recommended"},{children:s.jsx("div",Object.assign({style:{display:"flex",marginTop:2}},{children:s.jsx(l.default,{width:16,height:16,color:r.COLORS.content.secondary})}))}))]})),listItem:{label:e.displayName,value:e.displayName},subText:e.description||"",onClick:()=>{if(!f.disabled)if(T){const s=S(e);w(Object.assign(Object.assign({},e),{actualValue:s}))}else w(e)}},t)}),t):s.jsx(O.default,{disabled:null!==(n=f.disabled)&&void 0!==n&&n,searchText:_,variable:e,onSelect:e=>{if(!f.disabled)if(T){const s=S(e);w(Object.assign(Object.assign({},e),{actualValue:s}))}else w(e)}},t)}))})):s.jsx(p.default,{height:M(),searchText:_})})]}))}))},exports.highlightSearchText=v;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_back.svg.js"),a=require("../../assets/icons/cross.svg.js"),l=require("../../assets/icons/plus.svg.js"),i=require("../../assets/icons/triangle_error.svg.js"),n=require("react"),r=require("../../constants/Theme.js"),o=require("../accordion/Accordion.js"),c=require("../icon-button/IconButton.js"),d=require("../input/Input.js"),u=require("../list-item/ListItem.js"),h=require("../switch/Switch.js"),b=require("../tooltips/Tooltip.js"),j=require("../TypographyStyle.js"),p=require("./context.js"),g=require("./DefaultVariableContent.js"),x=require("./model.js"),y=require("./NoResult.js"),m=require("./recommendVaribles.js"),f=require("./searchVariables.js"),v=require("./styles.js"),O=require("./SubHeaderItems.js");const S=(e,t)=>{if(0===t.length)return e;const a=e.toLowerCase().indexOf(t.toLowerCase());if(-1===a)return e;const l=e.slice(0,a),i=e.slice(a,a+t.length),n=e.slice(a+t.length);return s.jsxs("span",{children:[l,s.jsx("b",Object.assign({style:{color:r.COLORS.content.primary}},{children:i})),n]})},C=/.*\..*/;exports.VariablePickerContent=V=>{const{data:w,onSelect:R,showHeader:k,showBackButton:q,hideHeaderCross:T,onBackButtonClick:B,isEvaluationList:I,autoOpenFirst:L,headerText:N}=V,[P,_]=n.useState(w),[D,E]=n.useState(""),[H,$]=n.useState([]),[F,A]=n.useState(""),[M,W]=n.useState(!1),[z,K]=n.useState([]),[G,J]=n.useState(!1),[Q,U]=n.useState(),X=G&&V.type===x.PickerType.EMBEDDED&&!T;n.useEffect((()=>{Z(!0)}),[]),n.useEffect((()=>{H.length>0?K([H[H.length-1]]):K(w)}),[H]);const Y=e=>{e.stopPropagation();let s=D;const t=[...H],a=t.pop();if($(t),a.displayName===F&&(E(""),s=""),s.length>0){const e=t.length>0?[t[t.length-1]]:w,a=f.searchVariables(s,e,t);if(M){const e=m.showOnlyRecommendedVariables(a,t);_(e)}else _(a)}else if(t.length>0)if(M){const e=m.showOnlyRecommendedVariables([t[t.length-1].variables],t);_(e)}else _([t[t.length-1].variables]);else if(M){const e=m.showOnlyRecommendedVariables(w,H);_(e)}else _(w)},Z=s=>e.__awaiter(void 0,void 0,void 0,(function*(){if(W(s),s){const e=m.showOnlyRecommendedVariables(P,H);_(e)}else if(H.length>0){const e=F==H[H.length-1].displayName;if(D.length>0&&e){const e=f.searchVariables(D,z,H);_(e)}else _([H[H.length-1].variables])}else if(D.length>0){const e=f.searchVariables(D,z,H);_(e)}else _(w)})),ee=()=>{let e=131;return H.length>0&&(e+=32),(V.showHeader||V.showBackButton)&&(e+=40),`calc(100% - ${e}px)`},se=e=>{if(!V.disabled)if(I){const s=(e=>{if(e.actualValue.match(C)){const s=e.actualValue.replace("{{","").replace("}}","").split(".");let t=s[0];return s.forEach(((e,s)=>{if(0===s)return;const a=(e=>/\w+\[\d+\]/g.test(e))(e);if(a){const s=e.match(/(\w+)\[(\d+)\]/);if(s){const e=s[1],a=s[2];t+=`['${e}'][${a}]`}}else t+=`['${e}']`})),t}return e.actualValueEval?e.actualValueEval:e.actualValue})(e);R(Object.assign(Object.assign({},e),{actualValue:s}))}else{if(e.enableDefaultValuePopulation)return U(e),void J(!0);R(e)}};return s.jsx(p.VariablePickerContext.Provider,Object.assign({value:{variables:P,searchText:D,subHeaderStack:H,showRecommended:M,setSubHeaderStack:$,setSearchText:E,setVariables:_,setShowRecommended:W}},{children:s.jsxs("div",Object.assign({tabIndex:-1,id:"variable-picker-v3",style:{backgroundColor:"white",borderRadius:4,height:"100%",outline:"none"},onClick:e=>e.stopPropagation()},{children:[(k||q||G)&&s.jsxs(v.HeaderWrapper,Object.assign({openDefault:G},{children:[s.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",gap:8}},{children:[(q||G)&&s.jsx(c.IconButton,{Icon:()=>s.jsx(t.default,{width:16,height:16,style:{display:"flex",color:r.COLORS.content.primary}}),onClick:()=>{G?(G&&J(!1),Y({})):B&&B()}}),(k||G)&&s.jsx(j.TitleRegular,{children:G?"Set up":null!=N?N:"Select Variable"})]})),X&&s.jsx(c.IconButton,{style:{color:"#212121"},Icon:a.default,onClick:()=>V.onClose&&V.onClose()})]})),G&&Q?s.jsx(g.DefaultVariableContent,{variable:Q,onInsertVariable:e=>{R(e),console.log("uploa",e)}}):s.jsxs(s.Fragment,{children:[s.jsx("div",Object.assign({style:{padding:"0 16px",paddingTop:12,backgroundColor:r.COLORS.surface.subdued,borderTopLeftRadius:4,borderTopRightRadius:4}},{children:s.jsx(d.Input,{id:"search-bar-v3-picker",onBlur:e=>{V.onSearchBlur&&V.onSearchBlur(e)},value:D,noKeyDownChange:!0,placeholder:"Search",onChangeText:e=>{e||A("");const s=f.searchVariables(e,z,H);if(M){const e=m.showOnlyRecommendedVariables(s,H);_(e)}else _(s);E(e);const t=H.length>0?H[H.length-1].displayName:"home";A(t)}})})),s.jsxs(v.RecommendWrapper,{children:[s.jsx(j.BodySecondary,Object.assign({style:{color:r.COLORS.content.secondary}},{children:"Only Recommended"})),s.jsx(h.Switch,{value:M,onValueChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){yield Z(s)}))})]}),H.length>0&&s.jsxs(v.BackHeader,{children:[s.jsx("div",Object.assign({style:{position:"absolute",left:16}},{children:s.jsx(c.IconButton,{id:"back-btn-v3",style:{display:"flex"},Icon:()=>s.jsx(t.default,{width:12,height:12,style:{color:r.COLORS.content.secondary}}),onClick:Y})})),s.jsx(j.BodyCaption,Object.assign({style:{color:r.COLORS.content.secondary}},{children:H[H.length-1].displayName}))]}),s.jsx(s.Fragment,{children:P.length>0?s.jsx(v.Container,Object.assign({height:ee()},{children:P.map(((e,t)=>{var a,n;return e.displayName&&void 0!==e.variables?s.jsx("div",Object.assign({style:{borderBottom:`1px solid ${r.COLORS.stroke.primary}`}},{children:s.jsx(o.BikAccordion,Object.assign({autoOpen:L&&0===t,headerPadding:"12px 16px",header:s.jsx(j.TitleSmall,Object.assign({style:{color:r.COLORS.content.secondary}},{children:S(e.displayName,D)}))},{children:s.jsx(O.default,{parentVariable:e,disabled:null!==(a=V.disabled)&&void 0!==a&&a,searchText:D,variable:e.variables,onSelect:e=>{if(e.enableDefaultValuePopulation)return U(e),void J(!0);R(e)}})}))}),e.displayName+M):e.displayName?s.jsx(b.Tooltip,Object.assign({body:O.renderTooltipBody(e),placement:"bottom"},{children:s.jsx(u.ListItem,{variant:V.disabled?"readonly":(null==e?void 0:e.selected)?"selected":"default",version:"2.0",leadingIcon:(null==e?void 0:e.selected)||V.disabled?s.jsx(s.Fragment,{}):s.jsx(l.default,{width:14,height:14}),customListItemLabel:s.jsxs("div",Object.assign({style:{display:"flex",gap:4}},{children:[s.jsx(j.BodySecondary,Object.assign({style:{fontSize:"14px",color:r.COLORS.text.primary}},{children:S(e.displayName,D)})),!e.isAvailable&&s.jsx(b.Tooltip,Object.assign({body:"Not Recommended"},{children:s.jsx("div",Object.assign({style:{display:"flex",marginTop:2}},{children:s.jsx(i.default,{width:16,height:16,color:r.COLORS.content.secondary})}))}))]})),listItem:{label:e.displayName,value:e.displayName},subText:e.description||"",onClick:()=>se(e)},t)}),t):s.jsx(O.default,{disabled:null!==(n=V.disabled)&&void 0!==n&&n,searchText:D,variable:e,onSelect:e=>se(e)},t)}))})):s.jsx(y.default,{height:ee(),searchText:D})})]})]}))}))},exports.highlightSearchText=S;
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { VariableV3 } from './model';
3
+ interface Props {
4
+ variable: VariableV3;
5
+ onInsertVariable: (variable: VariableV3) => void;
6
+ }
7
+ export declare const DefaultVariableContent: React.FC<Props>;
8
+ export {};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),a=require("../button/Button.js"),t=require("../checkBox/CheckBox.js"),s=require("../input/Input.js"),r=require("../TypographyStyle.js");exports.DefaultVariableContent=l=>{var n,d,o;const[u,c]=i.useState(l.variable.defaultValue||""),[p,x]=i.useState(""),[b,g]=i.useState(!!(null===(n=l.variable)||void 0===n?void 0:n.enableDefaultValueForGlobalUsage));return e.jsx(e.Fragment,{children:e.jsxs("div",Object.assign({style:{padding:"0 16px",paddingTop:12,borderTopLeftRadius:4,borderTopRightRadius:4}},{children:[e.jsx("div",Object.assign({style:{paddingBottom:16,borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(r.TitleRegular,{children:null===(d=l.variable)||void 0===d?void 0:d.displayName})})),e.jsxs("div",Object.assign({style:{paddingTop:24}},{children:[e.jsx(s.Input,{onChangeText:e=>{x(""),c(e)},value:u,isRequired:!0,labelText:"Default Value",hintText:"Used if this field is missing for a customer",errorMessage:null!=p?p:"",maxCharLimit:25}),e.jsxs("div",Object.assign({style:{paddingTop:24,gap:8,alignItems:"flex-start"},className:"d-flex"},{children:[e.jsx(t.CheckBox,{isChecked:b,onValueChange:e=>g(e),size:"SMALL",skipHoverState:!0}),e.jsx(r.BodySecondary,Object.assign({style:{marginTop:-2}},{children:`Make this the default value for ‘${null===(o=l.variable)||void 0===o?void 0:o.displayName}’`}))]})),e.jsx("div",Object.assign({style:{padding:"24px 0px",display:"flex",flexDirection:"row",justifyContent:"flex-end"}},{children:e.jsx(a.Button,{buttonText:"Insert Variable",buttonType:"primary",onClick:()=>{if(!u)return void x("This field is required");const e=Object.assign(Object.assign({},l.variable),{defaultValue:u,enableDefaultValueForGlobalUsage:b});l.onInsertVariable(e)}})}))]}))]}))})};
@@ -54,4 +54,6 @@ export interface VariableV3 {
54
54
  [key: string]: VariableV3;
55
55
  };
56
56
  needsFetching?: boolean;
57
+ enableDefaultValuePopulation?: boolean;
58
+ enableDefaultValueForGlobalUsage?: boolean;
57
59
  }
@@ -1,4 +1,6 @@
1
- export declare const HeaderWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
1
+ export declare const HeaderWrapper: import("styled-components").StyledComponent<"div", any, {
2
+ openDefault?: boolean | undefined;
3
+ }, never>;
2
4
  export declare const RecommendWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
3
5
  export declare const BackHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
4
6
  export declare const Container: import("styled-components").StyledComponent<"div", any, {
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=r(e);const i=o.default.div`
2
2
  display: flex;
3
3
  align-items: center;
4
- padding: 12px 16px 0px 16px;
4
+ padding: ${e=>e.openDefault?"12px 16px":"12px 16px 0px 16px"};
5
5
  background-color: ${t.COLORS.surface.subdued};
6
6
  justify-content: space-between;
7
7
  border-top-right-radius: 4px;
@@ -13,14 +13,14 @@
13
13
  padding: 12px 16px;
14
14
  background-color: ${t.COLORS.surface.subdued};
15
15
  border-bottom: 1px solid ${t.COLORS.stroke.primary};
16
- `,d=o.default.div`
16
+ `,p=o.default.div`
17
17
  position: relative;
18
18
  display: flex;
19
19
  align-items: center;
20
20
  justify-content: center;
21
21
  height: 32px;
22
22
  background-color: ${t.COLORS.background.base};
23
- `,p=o.default.div`
23
+ `,d=o.default.div`
24
24
  margin: 8px;
25
25
  display: flex;
26
26
  flex-direction: column;
@@ -39,4 +39,4 @@
39
39
  &::-webkit-scrollbar-thumb:horizontal {
40
40
  width: 8px;
41
41
  }
42
- `;exports.BackHeader=d,exports.Container=p,exports.HeaderWrapper=i,exports.RecommendWrapper=a;
42
+ `;exports.BackHeader=p,exports.Container=d,exports.HeaderWrapper=i,exports.RecommendWrapper=a;
@@ -14,9 +14,5 @@ export interface AccordionProps {
14
14
  refresh?: number | boolean;
15
15
  autoOpen?: boolean;
16
16
  childrenMaxHeight?: number;
17
- openDirection?: 'DOWN' | 'UP';
18
- headerStyles?: React.CSSProperties;
19
- onToggleAccordion?: (state: boolean) => void;
20
- arrowColor?: string;
21
17
  }
22
18
  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 a}from"../TypographyStyle.js";import c from"./Accordion.style.js";import l from"./AccordionArrow.js";const s=s=>{var d,h;const[u,v]=o(!1),g=n(null),p=n(null);t((()=>{s.autoOpen&&m(s.autoOpen,{})}),[s.autoOpen]);const m=(e,r)=>{var o,n;p.current&&g.current&&("keydown"===r.type&&"Enter"!==r.key||(v(e),p.current.style.maxHeight?(p.current.style.maxHeight="",g.current.style.transform="rotate(0deg)",g.current.style.transition="transform 0.25s ease-in-out",p.current.style.transition="padding 0s"):(p.current.style.maxHeight=(null!==(o=s.childrenMaxHeight)&&void 0!==o?o:p.current.scrollHeight)+"px",g.current.style.transform="rotate(180deg)",g.current.style.transition="transform 0.25s ease-in-out",p.current.style.transition="max-height 0.25s ease-in-out"),null===(n=s.onToggleAccordion)||void 0===n||n.call(s,e)))};return t((()=>{var e;u&&(null==s?void 0:s.refresh)&&(null===(e=null==p?void 0:p.current)||void 0===e?void 0:e.scrollHeight)&&!s.childrenMaxHeight&&setTimeout((()=>{p.current.style.maxHeight=p.current.scrollHeight+"px"}),100)}),[u,null==s?void 0:s.refresh,null===(d=null==p?void 0:p.current)||void 0===d?void 0:d.scrollHeight]),e(c,Object.assign({className:"accordion",isActive:u,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("div",Object.assign({className:"accordion__overview "+(u?"active":""),onClick:e=>m(!u,e),onKeyDown:e=>m(!u,e),role:"button",tabIndex:0},{children:[!s.rightActionComponent&&e("div",Object.assign({className:"accordion__overview__header",style:null!==(h=s.headerStyles)&&void 0!==h?h:{}},{children:["string"==typeof s.header?r(i,{children:null==s?void 0:s.header}):s.header,r(l,{arrowColor:s.arrowColor,isNewIcon:!0,ref:g})]})),s.rightActionComponent&&e("div",Object.assign({className:"accordion__overview__header"},{children:[e("div",Object.assign({className:"accordion__overview__title-wrapper"},{children:[r(l,{arrowColor:s.arrowColor,isNewIcon:!0,ref:g}),"string"==typeof s.header?r(i,{children:null==s?void 0:s.header}):s.header]})),r("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)&&r("div",Object.assign({className:"accordion__overview__caption"},{children:r(a,{children:s.caption})}))]})),r("div",Object.assign({ref:p,className:"accordion__content"},{children:s.children}))]}))};export{s as BikAccordion};
1
+ import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useState as n,useRef as t,useEffect as o}from"react";import{TitleRegular as i,BodySecondary as c}from"../TypographyStyle.js";import a from"./Accordion.style.js";import s from"./AccordionArrow.js";const l=l=>{var d;const[h,u]=n(!1),v=t(null),g=t(null);o((()=>{l.autoOpen&&m(l.autoOpen,{})}),[l.autoOpen]);const m=(e,r)=>{var n;g.current&&v.current&&("keydown"===r.type&&"Enter"!==r.key||(u(e),g.current.style.maxHeight?(g.current.style.maxHeight="",v.current.style.transform="rotate(0deg)",v.current.style.transition="transform 0.25s ease-in-out",g.current.style.transition="padding 0s"):(g.current.style.maxHeight=(null!==(n=l.childrenMaxHeight)&&void 0!==n?n:g.current.scrollHeight)+"px",v.current.style.transform="rotate(180deg)",v.current.style.transition="transform 0.25s ease-in-out",g.current.style.transition="max-height 0.25s ease-in-out")))};return o((()=>{var e;h&&(null==l?void 0:l.refresh)&&(null===(e=null==g?void 0:g.current)||void 0===e?void 0:e.scrollHeight)&&!l.childrenMaxHeight&&setTimeout((()=>{g.current.style.maxHeight=g.current.scrollHeight+"px"}),100)}),[h,null==l?void 0:l.refresh,null===(d=null==g?void 0:g.current)||void 0===d?void 0:d.scrollHeight]),e(a,Object.assign({className:"accordion",isActive:h,width:null==l?void 0:l.width,contentMargin:null==l?void 0:l.contentMargin,headerPadding:l.headerPadding,skipHoverState:l.skipHoverHeader,showBorders:l.showBorders,backgroundColor:l.backgroundColor},{children:[e("div",Object.assign({className:"accordion__overview "+(h?"active":""),onClick:e=>m(!h,e),onKeyDown:e=>m(!h,e),role:"button",tabIndex:0},{children:[!l.rightActionComponent&&e("div",Object.assign({className:"accordion__overview__header"},{children:["string"==typeof l.header?r(i,{children:null==l?void 0:l.header}):l.header,r(s,{isNewIcon:!0,ref:v})]})),l.rightActionComponent&&e("div",Object.assign({className:"accordion__overview__header"},{children:[e("div",Object.assign({className:"accordion__overview__title-wrapper"},{children:[r(s,{isNewIcon:!0,ref:v}),"string"==typeof l.header?r(i,{children:null==l?void 0:l.header}):l.header]})),r("div",Object.assign({onClick:e=>e.stopPropagation(),onKeyDown:e=>{"Enter"===e.key&&e.stopPropagation()},role:"button",tabIndex:0},{children:l.rightActionComponent}))]})),(null==l?void 0:l.caption)&&r("div",Object.assign({className:"accordion__overview__caption"},{children:r(c,{children:l.caption})}))]})),r("div",Object.assign({ref:g,className:"accordion__content"},{children:l.children}))]}))};export{l as BikAccordion};
@@ -1,4 +1,3 @@
1
- import { AccordionProps } from './Accordion';
2
1
  declare const AccordionStyle: import("styled-components").StyledComponent<"div", any, {
3
2
  isActive: boolean;
4
3
  width?: string | undefined;
@@ -8,6 +7,5 @@ declare const AccordionStyle: import("styled-components").StyledComponent<"div",
8
7
  showBorders?: boolean | undefined;
9
8
  backgroundColor?: string | undefined;
10
9
  hasChildrenMaxHeight?: boolean | undefined;
11
- openDirection?: AccordionProps['openDirection'];
12
10
  }, never>;
13
11
  export default AccordionStyle;
@@ -31,7 +31,6 @@ import e from"styled-components";import{COLORS as r}from"../../constants/Theme.j
31
31
  ${e=>e.isActive?{margin:(null==e?void 0:e.contentMargin)||"0px"}:{}};
32
32
  overflow: ${e=>e.hasChildrenMaxHeight?"scroll":"hidden"};
33
33
  max-height: 0;
34
- order: ${e=>"UP"===e.openDirection?-1:0};
35
34
  }
36
35
  }
37
36
  `;export{o as default};
@@ -1,7 +1,6 @@
1
1
  import React, { HTMLAttributes } from 'react';
2
2
  interface BikAccordionArrowProps extends HTMLAttributes<HTMLDivElement> {
3
3
  isNewIcon: boolean;
4
- arrowColor?: string;
5
4
  }
6
5
  declare const BikAccordionArrow: React.ForwardRefExoticComponent<BikAccordionArrowProps & React.RefAttributes<HTMLDivElement>>;
7
6
  export default BikAccordionArrow;
@@ -1 +1 @@
1
- import{jsxs as e,jsx as r}from"react/jsx-runtime";import o from"react";const i=o.forwardRef(((o,i)=>{var l,n;return e("div",Object.assign({ref:i,className:"d-flex align-items-center"},{children:[!o.isNewIcon&&r("svg",Object.assign({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:r("path",{d:"M7.7071 10.7071C7.07713 10.0771 7.5233 9 8.41421 9H15.5858C16.4767 9 16.9228 10.0771 16.2929 10.7071L12.7071 14.2929C12.3166 14.6834 11.6834 14.6834 11.2929 14.2929L7.7071 10.7071Z",fill:null!==(l=o.arrowColor)&&void 0!==l?l:"currentColor"})})),o.isNewIcon&&r("svg",Object.assign({width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:r("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.528758 0.52827C0.789108 0.26792 1.21122 0.26792 1.47157 0.52827L5.00016 4.05687L8.52876 0.52827C8.78911 0.26792 9.21122 0.26792 9.47157 0.52827C9.73192 0.788619 9.73192 1.21073 9.47157 1.47108L5.47157 5.47108C5.21122 5.73143 4.78911 5.73143 4.52876 5.47108L0.528758 1.47108C0.268409 1.21073 0.268409 0.788619 0.528758 0.52827Z",fill:null!==(n=o.arrowColor)&&void 0!==n?n:"currentColor"})}))]}))}));i.displayName="BikAccordionArrow";export{i as default};
1
+ import{jsxs as e,jsx as i}from"react/jsx-runtime";import r from"react";const l=r.forwardRef(((r,l)=>e("div",Object.assign({ref:l,className:"d-flex align-items-center"},{children:[!r.isNewIcon&&i("svg",Object.assign({width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i("path",{d:"M7.7071 10.7071C7.07713 10.0771 7.5233 9 8.41421 9H15.5858C16.4767 9 16.9228 10.0771 16.2929 10.7071L12.7071 14.2929C12.3166 14.6834 11.6834 14.6834 11.2929 14.2929L7.7071 10.7071Z",fill:"currentColor"})})),r.isNewIcon&&i("svg",Object.assign({width:"10",height:"6",viewBox:"0 0 10 6",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:i("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.528758 0.52827C0.789108 0.26792 1.21122 0.26792 1.47157 0.52827L5.00016 4.05687L8.52876 0.52827C8.78911 0.26792 9.21122 0.26792 9.47157 0.52827C9.73192 0.788619 9.73192 1.21073 9.47157 1.47108L5.47157 5.47108C5.21122 5.73143 4.78911 5.73143 4.52876 5.47108L0.528758 1.47108C0.268409 1.21073 0.268409 0.788619 0.528758 0.52827Z",fill:"currentColor"})}))]}))));l.displayName="BikAccordionArrow";export{l as default};
@@ -1 +1 @@
1
- import{jsxs as o,jsx as t}from"react/jsx-runtime";import{Chart as i,CategoryScale as e,LinearScale as l,BarElement as a,Tooltip as n,Legend as d}from"chart.js";import s from"chartjs-plugin-datalabels";import{Bar as r}from"react-chartjs-2";import{TitleRegular as c,BodyTiny as v}from"../../../TypographyStyle.js";import{COLORS as p,FONTS as u}from"../../../../constants/Theme.js";import{truncateValueToK as g}from"../utils/calcPercentage.js";import{COLOR_SCHEMA as x,GRAPH_ORIENTATION as y}from"./StackedBarChart.model.js";import{GraphContainerWrapper as b}from"./StackedBarChart.styles.js";i.register(e,l,a,n,d,s);const A=i=>{var e,l,a,n,d,s,A,m,h,O,f,k,C,F,L,T,j,S,H,I,E,N,R,Z,z,D,w,B,P,_,W,V,Y,q,G;const J=0===i.yAxis.data.length,K=i.colorSchema===x.PASTEL?["#E6C7FF","#FEC6C6","#FEDEF3","#DEEFFF","#FFD8B1","#C7E5FF","#FFD3E6","#C9FFE5","#FFE3C7","#D9D9FF"]:["#5E07BB","#9E77ED","#D2AEFF","#F7D7FF","#CDE1FF","#92AFFA","#3935E1"],M={barPercentage:.4,categoryPercentage:1,pointStyle:"circle",barWidth:i.barWidth},Q={};i.yAxis.data.map((o=>{o.map((o=>{Q[o.name]?Q[o.name].push(o.value):Q[o.name]=[o.value]}))}));const U=Object.keys(Q).map(((o,t)=>Object.assign({label:o,data:Q[o],backgroundColor:K[t]},M))),X={plugins:{legend:{display:!J&&!i.customLegend,labels:{usePointStyle:!0,fontSize:2}},tooltip:{enabled:!J,callbacks:{label:null===(e=i.tooltipConfig)||void 0===e?void 0:e.labelCallback,footer:null===(l=i.tooltipConfig)||void 0===l?void 0:l.footerCallback},footerFont:null===(n=null===(a=i.tooltipConfig)||void 0===a?void 0:a.footerStyles)||void 0===n?void 0:n.footerFont},datalabels:{display:null!==(d=i.showTotal)&&void 0!==d&&d,anchor:"end",align:"end",clamp:!0,formatter:(o,t)=>{var i;const e=t.datasetIndex,l=t.chart.data.datasets;if(e!==l.length-1)return"";const a=t.dataIndex;let n=0;for(let o=0;o<l.length;o++)n+=null!==(i=l[o].data[a])&&void 0!==i?i:0;return n?n<1e3?n:(n/1e3).toString().substring(0,4)+"k":""},color:p.content.secondary}},layout:{padding:{right:i.showTotal&&i.orientation===y.HORIZONTAL?50:0,top:i.showTotal&&i.orientation!=y.HORIZONTAL?50:0}},responsive:!0,maintainAspectRatio:!1,legend:{display:!i.customLegend,labels:{usePointStyle:!0}},indexAxis:i.orientation===y.HORIZONTAL?"y":"x",scales:{x:{title:{display:!!(i.orientation===y.HORIZONTAL?null===(s=i.yAxis)||void 0===s?void 0:s.title:null===(A=i.xAxis)||void 0===A?void 0:A.title),text:i.orientation===y.HORIZONTAL?null===(m=i.yAxis)||void 0===m?void 0:m.title:null===(h=i.xAxis)||void 0===h?void 0:h.title,color:null!==(k=i.orientation===y.HORIZONTAL?null===(O=i.yAxis)||void 0===O?void 0:O.titleColor:null===(f=i.xAxis)||void 0===f?void 0:f.titleColor)&&void 0!==k?k:p.content.secondary,font:{size:u.caption.fontSize}},grid:{display:i.orientation===y.HORIZONTAL,color:p.background.base},ticks:{fontSize:u.caption.fontSize,color:null!==(C=i.yAxis.labelColor)&&void 0!==C?C:p.content.secondary,callback:i.orientation===y.HORIZONTAL?g:void 0},stacked:i.orientation===y.HORIZONTAL?"boolean"!=typeof(null===(F=i.yAxis)||void 0===F?void 0:F.stacked)||(null===(L=i.yAxis)||void 0===L?void 0:L.stacked):"boolean"!=typeof(null===(T=i.xAxis)||void 0===T?void 0:T.stacked)||(null===(j=i.xAxis)||void 0===j?void 0:j.stacked)},y:{title:{display:!!(i.orientation===y.HORIZONTAL?null===(S=i.xAxis)||void 0===S?void 0:S.title:null===(H=i.yAxis)||void 0===H?void 0:H.title),text:i.orientation===y.HORIZONTAL?null===(I=i.xAxis)||void 0===I?void 0:I.title:null===(E=i.yAxis)||void 0===E?void 0:E.title,color:null!==(Z=i.orientation===y.HORIZONTAL?null===(N=i.xAxis)||void 0===N?void 0:N.titleColor:null===(R=i.yAxis)||void 0===R?void 0:R.titleColor)&&void 0!==Z?Z:p.content.secondary,font:{size:u.caption.fontSize}},grid:{display:i.orientation!==y.HORIZONTAL,color:p.background.base},ticks:Object.assign(Object.assign({stepSize:i.orientation===y.HORIZONTAL?null===(z=i.xAxis)||void 0===z?void 0:z.stepSize:null===(D=i.yAxis)||void 0===D?void 0:D.stepSize,fontSize:u.caption.fontSize,color:null!==(w=i.xAxis.labelColor)&&void 0!==w?w:p.content.secondary},J?{min:0,max:2e3,stepSize:200}:{}),{callback:i.orientation!==y.VERTICAL?g:void 0}),stacked:i.orientation===y.HORIZONTAL?"boolean"!=typeof(null===(B=i.xAxis)||void 0===B?void 0:B.stacked)||(null===(P=i.xAxis)||void 0===P?void 0:P.stacked):"boolean"!=typeof(null===(_=i.yAxis)||void 0===_?void 0:_.stacked)||(null===(W=i.yAxis)||void 0===W?void 0:W.stacked)}},onClick:(o,t)=>{if(!i.onBarClick)return;const e=t[0].datasetIndex,l=t[0].index,a=o.chart.data.datasets[e].label,n=o.chart.data.labels[l];i.onBarClick(n,a)},onHover:(o,t)=>{i.onBarClick&&t.length&&(o.native.target.style.cursor="pointer")}};i.orientation&&i.orientation!==y.VERTICAL?delete X.scales.y.ticks.callback:delete X.scales.x.ticks.callback;const $={labels:i.xAxis.data.map((o=>"string"==typeof o?o:o.name)),datasets:J?[{data:[250,1e3,800,1500,300,600],backgroundColor:"rgba(0,0,0,0)"}]:U};return o(b,Object.assign({style:null!==(V=i.wrapperStyle)&&void 0!==V?V:{},padding:i.outerPadding,customLegend:i.customLegend},{children:[i.chartHeading&&t("div",Object.assign({style:{marginBottom:24}},{children:t(c,Object.assign({color:null!==(Y=i.chartHeading.color)&&void 0!==Y?Y:p.content.secondary},{children:i.chartHeading.heading}))})),i.customLegend&&t("div",Object.assign({style:{overflowY:"scroll",display:"flex",flexDirection:"row",gap:"10px",padding:"0px 24px 12px 24px",justifyContent:"flex-end"}},{children:U.map((i=>o("div",Object.assign({className:"legend__row"},{children:[t("div",{className:"legend__palette",style:{backgroundColor:i.backgroundColor}}),t(v,Object.assign({color:p.content.secondary},{children:i.label}))]}),i.label.replace(" ","_"))))})),t("div",Object.assign({className:"graph__wrapper"},{children:t("div",Object.assign({style:{height:null!==(q=i.graphCanvasHeight)&&void 0!==q?q:500,width:null!==(G=i.graphCanvasWidth)&&void 0!==G?G:"auto"}},{children:t(r,{options:X,data:$})}))}))]}))};export{A as StackedBarChart};
1
+ import{jsxs as o,jsx as t}from"react/jsx-runtime";import{Chart as i,CategoryScale as e,LinearScale as l,BarElement as a,Tooltip as n,Legend as d}from"chart.js";import s from"chartjs-plugin-datalabels";import{Bar as r}from"react-chartjs-2";import{TitleRegular as c,BodyTiny as v}from"../../../TypographyStyle.js";import{COLORS as u,FONTS as p}from"../../../../constants/Theme.js";import{truncateValueToK as g}from"../utils/calcPercentage.js";import{COLOR_SCHEMA as x,GRAPH_ORIENTATION as y}from"./StackedBarChart.model.js";import{GraphContainerWrapper as m}from"./StackedBarChart.styles.js";i.register(e,l,a,n,d,s);const b=i=>{var e,l,a,n,d,s,b,A,h,O,f,C,k,F,S,L,T,j,H,E,I,N,R,Z,z,B,D,P,w,_,W,V,Y,q,G;const J=0===i.yAxis.data.length,K=void 0===i.customColourScaleBrand||void 0===i.customColourScalePastel?i.colorSchema===x.PASTEL?["#E6C7FF","#FEC6C6","#FEDEF3","#DEEFFF","#FFD8B1","#C7E5FF","#FFD3E6","#C9FFE5","#FFE3C7","#D9D9FF"]:["#5E07BB","#9E77ED","#D2AEFF","#F7D7FF","#CDE1FF","#92AFFA","#3935E1"]:i.colorSchema===x.PASTEL?i.customColourScalePastel:i.customColourScaleBrand,M=i.customHoverColour,Q={barPercentage:.4,categoryPercentage:1,pointStyle:"circle",barWidth:i.barWidth},U={};i.yAxis.data.map((o=>{o.map((o=>{U[o.name]?U[o.name].push(o.value):U[o.name]=[o.value]}))}));const X=Object.keys(U).map(((o,t)=>Object.assign({label:o,data:U[o],backgroundColor:K[t],hoverBackgroundColor:void 0===M?void 0:M[t]},Q))),$={plugins:{legend:{display:!J&&!i.customLegend,labels:{usePointStyle:!0,fontSize:2}},tooltip:{enabled:!J,callbacks:{label:null===(e=i.tooltipConfig)||void 0===e?void 0:e.labelCallback,footer:null===(l=i.tooltipConfig)||void 0===l?void 0:l.footerCallback},footerFont:null===(n=null===(a=i.tooltipConfig)||void 0===a?void 0:a.footerStyles)||void 0===n?void 0:n.footerFont},datalabels:{display:null!==(d=i.showTotal)&&void 0!==d&&d,anchor:"end",align:"end",clamp:!0,formatter:(o,t)=>{var i;const e=t.datasetIndex,l=t.chart.data.datasets;if(e!==l.length-1)return"";const a=t.dataIndex;let n=0;for(let o=0;o<l.length;o++)n+=null!==(i=l[o].data[a])&&void 0!==i?i:0;return n?n<1e3?n:(n/1e3).toString().substring(0,4)+"k":""},color:u.content.secondary}},layout:{padding:{right:i.showTotal&&i.orientation===y.HORIZONTAL?50:0,top:i.showTotal&&i.orientation!=y.HORIZONTAL?50:0}},responsive:!0,maintainAspectRatio:!1,legend:{display:!i.customLegend,labels:{usePointStyle:!0}},indexAxis:i.orientation===y.HORIZONTAL?"y":"x",scales:{x:{title:{display:!!(i.orientation===y.HORIZONTAL?null===(s=i.yAxis)||void 0===s?void 0:s.title:null===(b=i.xAxis)||void 0===b?void 0:b.title),text:i.orientation===y.HORIZONTAL?null===(A=i.yAxis)||void 0===A?void 0:A.title:null===(h=i.xAxis)||void 0===h?void 0:h.title,color:null!==(C=i.orientation===y.HORIZONTAL?null===(O=i.yAxis)||void 0===O?void 0:O.titleColor:null===(f=i.xAxis)||void 0===f?void 0:f.titleColor)&&void 0!==C?C:u.content.secondary,font:{size:p.caption.fontSize}},grid:{display:i.orientation===y.HORIZONTAL,color:u.background.base},ticks:{fontSize:p.caption.fontSize,color:null!==(k=i.yAxis.labelColor)&&void 0!==k?k:u.content.secondary,callback:i.orientation===y.HORIZONTAL?g:void 0},stacked:i.orientation===y.HORIZONTAL?"boolean"!=typeof(null===(F=i.yAxis)||void 0===F?void 0:F.stacked)||(null===(S=i.yAxis)||void 0===S?void 0:S.stacked):"boolean"!=typeof(null===(L=i.xAxis)||void 0===L?void 0:L.stacked)||(null===(T=i.xAxis)||void 0===T?void 0:T.stacked)},y:{title:{display:!!(i.orientation===y.HORIZONTAL?null===(j=i.xAxis)||void 0===j?void 0:j.title:null===(H=i.yAxis)||void 0===H?void 0:H.title),text:i.orientation===y.HORIZONTAL?null===(E=i.xAxis)||void 0===E?void 0:E.title:null===(I=i.yAxis)||void 0===I?void 0:I.title,color:null!==(Z=i.orientation===y.HORIZONTAL?null===(N=i.xAxis)||void 0===N?void 0:N.titleColor:null===(R=i.yAxis)||void 0===R?void 0:R.titleColor)&&void 0!==Z?Z:u.content.secondary,font:{size:p.caption.fontSize}},grid:{display:i.orientation!==y.HORIZONTAL,color:u.background.base},ticks:Object.assign(Object.assign({stepSize:i.orientation===y.HORIZONTAL?null===(z=i.xAxis)||void 0===z?void 0:z.stepSize:null===(B=i.yAxis)||void 0===B?void 0:B.stepSize,fontSize:p.caption.fontSize,color:null!==(D=i.xAxis.labelColor)&&void 0!==D?D:u.content.secondary},J?{min:0,max:2e3,stepSize:200}:{}),{callback:i.orientation!==y.VERTICAL?g:void 0}),stacked:i.orientation===y.HORIZONTAL?"boolean"!=typeof(null===(P=i.xAxis)||void 0===P?void 0:P.stacked)||(null===(w=i.xAxis)||void 0===w?void 0:w.stacked):"boolean"!=typeof(null===(_=i.yAxis)||void 0===_?void 0:_.stacked)||(null===(W=i.yAxis)||void 0===W?void 0:W.stacked)}},onClick:(o,t)=>{if(!i.onBarClick)return;const e=t[0].datasetIndex,l=t[0].index,a=o.chart.data.datasets[e].label,n=o.chart.data.labels[l];i.onBarClick(n,a)},onHover:(o,t)=>{i.onBarClick&&t.length&&(o.native.target.style.cursor="pointer")}};i.orientation&&i.orientation!==y.VERTICAL?delete $.scales.y.ticks.callback:delete $.scales.x.ticks.callback;const oo={labels:i.xAxis.data.map((o=>"string"==typeof o?o:o.name)),datasets:J?[{data:[250,1e3,800,1500,300,600],backgroundColor:"rgba(0,0,0,0)"}]:X};return o(m,Object.assign({style:null!==(V=i.wrapperStyle)&&void 0!==V?V:{},padding:i.outerPadding,customLegend:i.customLegend},{children:[i.chartHeading&&t("div",Object.assign({style:{marginBottom:24}},{children:t(c,Object.assign({color:null!==(Y=i.chartHeading.color)&&void 0!==Y?Y:u.content.secondary},{children:i.chartHeading.heading}))})),i.customLegend&&t("div",Object.assign({style:{overflowY:"scroll",display:"flex",flexDirection:"row",gap:"10px",padding:"0px 24px 12px 24px",justifyContent:"flex-end"}},{children:X.map((i=>o("div",Object.assign({className:"legend__row"},{children:[t("div",{className:"legend__palette",style:{backgroundColor:i.backgroundColor}}),t(v,Object.assign({color:u.content.secondary},{children:i.label}))]}),i.label.replace(" ","_"))))})),t("div",Object.assign({className:"graph__wrapper"},{children:t("div",Object.assign({style:{height:null!==(q=i.graphCanvasHeight)&&void 0!==q?q:500,width:null!==(G=i.graphCanvasWidth)&&void 0!==G?G:"auto"}},{children:t(r,{options:$,data:oo})}))}))]}))};export{b as StackedBarChart};
@@ -55,4 +55,7 @@ export interface StackedBarGraphI {
55
55
  footerFont?: Partial<FontSpec>;
56
56
  };
57
57
  };
58
+ customColourScaleBrand?: string[];
59
+ customColourScalePastel?: string[];
60
+ customHoverColour?: string[];
58
61
  }
@@ -9,5 +9,4 @@ export declare const CountryCodePicker: React.FC<{
9
9
  height?: string;
10
10
  placement?: Placement;
11
11
  placementStrategy?: PositioningStrategy;
12
- disabled?: boolean;
13
12
  }>;
@@ -1 +1 @@
1
- import{jsx as o,jsxs as e}from"react/jsx-runtime";import t from"../../assets/icons/chevronDown.svg.js";import{useState as n,useEffect as r}from"react";import{CountriesData as d}from"./CountryCodePicker.modal.js";import{StyledCountryPickerWrapper as s,StyledCountryPickerOption as i}from"./CountryCodePicker.styled.js";import{DropdownPopover as p}from"../dropdown/DropdownPopover/index.js";import"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"../zeroState/ZeroState.js";import{BodySecondary as c}from"../TypographyStyle.js";import{COLORS as m}from"../../constants/Theme.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../button/Button.js";import"../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";const l=l=>{var a,u,w,h,j,v;const[y,g]=n(null!==(a=l.selectedCountry)&&void 0!==a?a:{name:"India",dial:"+91",code:"IN"}),C=`https://flagcdn.com/${null===(u=y.code)||void 0===u?void 0:u.toLowerCase()}.svg`;r((()=>{l.selectedCountry&&g(l.selectedCountry)}),[null===(w=l.selectedCountry)||void 0===w?void 0:w.code]);return o(p,Object.assign({version:l.version,isSearchable:!0,width:null!==(h=l.popoverWidth)&&void 0!==h?h:"200px",placement:null!==(j=l.placement)&&void 0!==j?j:"bottom-start",strategy:null!==(v=l.placementStrategy)&&void 0!==v?v:"absolute",options:d.map((t=>{var n;const r=`https://flagcdn.com/${null===(n=t.code)||void 0===n?void 0:n.toLowerCase()}.svg`;return{value:t.code,label:t.dial,searchKey:t.name,customComponent:e(i,{children:[o("img",{src:r,className:"country-flag__option",alt:t.name}),e(c,{children:[t.code," ",t.dial]})]}),selected:y.code===t.code}})),disabled:l.disabled,onSelect:o=>{const e=d.filter((e=>e.code===o.value));g(e[0]),l.onCountrySelect(e[0])}},{children:e(s,Object.assign({height:l.height},{children:[e("div",Object.assign({className:"content__wrapper"},{children:[o("img",{src:C,className:"country-flag__selected-option",alt:y.name}),o(c,{children:y.dial})]})),o(t,{width:24,height:24,color:m.content.primary})]}))}))};export{l as CountryCodePicker};
1
+ import{jsx as o,jsxs as e}from"react/jsx-runtime";import t from"../../assets/icons/chevronDown.svg.js";import{useState as n,useEffect as r}from"react";import{CountriesData as d}from"./CountryCodePicker.modal.js";import{StyledCountryPickerWrapper as s,StyledCountryPickerOption as p}from"./CountryCodePicker.styled.js";import{DropdownPopover as i}from"../dropdown/DropdownPopover/index.js";import"../dropdown/Dropdown.js";import"../dropdown/ChipDropdown.js";import"../zeroState/ZeroState.js";import{BodySecondary as c}from"../TypographyStyle.js";import{COLORS as m}from"../../constants/Theme.js";import"../dropdown/OpenedDropdown/components/description/Description.styled.js";import"../checkBox/CheckBox.styled.js";import"../list-item/ListItem.js";import"../dropdown/OpenedDropdown/components/menu/FreeFormMenu.styled.js";import"../dropdown/OpenedDropdown/components/menu/MenuItem.js";import"../dropdown/OpenedDropdown/components/menu/MenuList.styled.js";import"../button/Button.js";import"../dropdown/OpenedDropdown/components/multiSelect/MultiSelectDropdownBottomBar.styled.js";import"../dropdown/OpenedDropdown/components/OpennedDropdown.styled.js";import"../input/Input.js";import"../dropdown/MenuItem/MenuItem.js";const l=l=>{var a,u,w,h,j,v;const[y,g]=n(null!==(a=l.selectedCountry)&&void 0!==a?a:{name:"India",dial:"+91",code:"IN"}),C=`https://flagcdn.com/${null===(u=y.code)||void 0===u?void 0:u.toLowerCase()}.svg`;r((()=>{l.selectedCountry&&g(l.selectedCountry)}),[null===(w=l.selectedCountry)||void 0===w?void 0:w.code]);return o(i,Object.assign({version:l.version,isSearchable:!0,width:null!==(h=l.popoverWidth)&&void 0!==h?h:"200px",placement:null!==(j=l.placement)&&void 0!==j?j:"bottom-start",strategy:null!==(v=l.placementStrategy)&&void 0!==v?v:"absolute",options:d.map((t=>{var n;const r=`https://flagcdn.com/${null===(n=t.code)||void 0===n?void 0:n.toLowerCase()}.svg`;return{value:t.code,label:t.dial,searchKey:t.name,customComponent:e(p,{children:[o("img",{src:r,className:"country-flag__option",alt:t.name}),e(c,{children:[t.code," ",t.dial]})]}),selected:y.code===t.code}})),onSelect:o=>{const e=d.filter((e=>e.code===o.value));g(e[0]),l.onCountrySelect(e[0])}},{children:e(s,Object.assign({height:l.height},{children:[e("div",Object.assign({className:"content__wrapper"},{children:[o("img",{src:C,className:"country-flag__selected-option",alt:y.name}),o(c,{children:y.dial})]})),o(t,{width:24,height:24,color:m.content.primary})]}))}))};export{l as CountryCodePicker};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n from"../../assets/icons/info.svg.js";import{forwardRef as l,useState as r,useContext as o,useRef as a,useEffect as s}from"react";import{Button as c}from"../button/Button.js";import{isFunction as d,validateInput as h}from"./Input-helper.js";import{Tooltip as u}from"../tooltips/Tooltip.js";import{TitleSmall as v,BodySecondary as p}from"../TypographyStyle.js";import{COLORS as g}from"../../constants/Theme.js";import m from"../../assets/icons/errorInfo.svg.js";import{InputStyleContext as f}from"./context/InputStyleProvider.js";import{RootContainer as x,InputFooter as b,MaxCharStyle as y,InputWrapper as j,IconHolder as O,PrefixHolder as C,InputContainer as T,InputContainerSmall as w,SuffixHolder as k,InputHeader as I}from"./Input.styled.js";const L=l(((l,L)=>{var M,B,H,E,z,A,D;const{placeholder:F,leftIcon:P,rightIcon:N,labelText:S,maxCharLimit:K,isRequired:R,hintText:G,type:_,state:q,validate:V,variant:W,button:$,suffixText:J,prefixText:Q,onChangeText:U,value:X,noErrorHint:Y,reset:Z,rangeValidation:ee,noKeyDownChange:te,version:ie,noMaxCharCheck:ne,labelElement:le,autoGrow:re,minHeight:oe,maxHeight:ae,labelTextBold:se,truncateText:ce,maxCharLimitPosition:de}=Object.assign({maxCharLimit:0,type:"text",variant:"default",maxCharLimitPosition:"TOP"},l),he=null==P?void 0:P.icon,ue=null==N?void 0:N.icon,[ve,pe]=r("invalid"===l.state||!!l.errorMessage),[ge,me]=r(!1),[fe,xe]=r(),be="small"===W?"18px":"22px",ye=o(f),[je,Oe]=r(),Ce=a(null),Te=null!=L?L:Ce;s((()=>{Oe(X),!X&&re&&(Te.current.style.height=oe||"48px")}),[X]),s((()=>{var e;Te.current&&(null===(e=l.onReferenceInit)||void 0===e||e.call(l,Te.current))}),[Te]),s((()=>{const e=Te.current;if(e&&["phonenumber","zip","number"].includes(_))return e.addEventListener("wheel",Le,{passive:!1}),()=>{e.removeEventListener("wheel",Le)}}),[]),s((()=>{Z&&Oe("")}),[Z]),s((()=>{var e;me(!!l.isActive),l.isActive&&(null===(e=Te.current)||void 0===e||e.focus())}),[l.isActive]),s((()=>{xe(l.errorMessage)}),[l.errorMessage]),s((()=>{var e;pe(!1),("invalid"===l.state||fe||"disabled-invalid"===l.state)&&pe(!0),"active"===l.state&&(null===(e=Te.current)||void 0===e||e.focus())}),[l.state,fe]);const we=function(e){if(d(e)){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];e(...i)}},ke=()=>"zip"===_?6:2e3,Ie=e=>{const t=0!==K?K:ke();if(te||U(X||"",e),ne)return;const i=e.target.value;![8].includes(e.which)&&t>0&&i.length>=t&&e.preventDefault()},Le=e=>{e.preventDefault()},Me=e=>{let t=e.target.value;const i=0!==K?K+1:ke();!ne&&i>0&&t.length>=i&&(t=t.substring(0,i-1)),U(t,e),l.textControl||Oe(t),re&&(Te.current.style.height=`${Te.current.scrollHeight}px`,t||(Te.current.style.height=oe||"48px"));const n=V||h;if(!n||!d(n))return;const[r,o]=n(t,_,ee);pe(!r),xe(l.errorMessage?l.errorMessage:o)},Be=e=>{var t;l.skipFocus||me(!0),we(null===(t=l.onFocus)||void 0===t?void 0:t.call(l,e))},He=e=>{var t;l.skipFocus||me(!1),we(null===(t=l.onBlur)||void 0===t?void 0:t.call(l,e))},Ee=()=>{var n;return e(i,{children:["multiline"!==_&&t("input",{className:ce?"truncate-class":"","data-test":l["data-test"],id:l.id,style:null!==(n=null==ye?void 0:ye.input)&&void 0!==n?n:{},ref:Te,type:["phonenumber","zip","number"].includes(_)?"number":_,value:je,onFocus:e=>Be(e),onBlur:e=>He(e),placeholder:F||"Enter here",onChange:Me,onClick:e=>we(l.onClick),onKeyDown:e=>Ie(e)}),"multiline"===_&&t("textarea",{"data-test":l["data-test"],value:je,ref:Te,onFocus:e=>Be(e),onBlur:e=>He(e),onClick:e=>we(l.onClick),placeholder:F||"Enter here",onChange:Me,onKeyDown:e=>Ie(e),maxLength:K>0?K:void 0})]})};return e(x,Object.assign({width:l.width,height:l.height,state:q,type:_,style:null!==(M=null==ye?void 0:ye.RootContainer)&&void 0!==M?M:{}},{children:[e("div",Object.assign({className:"flex-align-center"},{children:[!Y&&(!!G||!!fe)&&t(b,Object.assign({invalid:!!fe},{children:e("div",{children:[!!fe&&t(m,{width:16,height:16}),fe||G]})})),K>0&&"BOTTOM"===de&&e(y,Object.assign({position:"BOTTOM"},{children:[null!==(H=null===(B=l.value)||void 0===B?void 0:B.length)&&void 0!==H?H:0,"/",K]}))]})),e(j,Object.assign({variant:W,state:q,width:l.width,isActive:"active"===q||ge,isInvalid:ve,style:null!==(E=null==ye?void 0:ye.InputWrapper)&&void 0!==E?E:{},version:ie,height:l.height},{children:[!!he&&t(O,Object.assign({variant:W,iconSize:be,onClick:()=>we(null==P?void 0:P.callback),isLeft:!0,style:null!==(z=null==ye?void 0:ye.IconHolder)&&void 0!==z?z:{}},{children:t(he,{})})),!!Q&&t(C,Object.assign({variant:W},{children:Q})),"default"===W&&t(T,Object.assign({height:l.height,type:l.type,minHeight:oe,maxHeight:ae,autoGrow:re},{children:Ee()})),"small"===W&&t(w,Object.assign({height:l.height,type:l.type},{children:Ee()})),!!ue&&t(O,Object.assign({variant:W,iconSize:be,onClick:()=>we(null==N?void 0:N.callback),isLeft:!1},{children:t(ue,{})})),!!J&&t(k,Object.assign({variant:W},{children:J})),$&&$.text&&t(c,{buttonText:$.text,onClick:()=>we(null==$?void 0:$.onClick)})]})),(!!S||!!K)&&e(I,Object.assign({invalid:ve},{children:[le&&le,e("div",Object.assign({className:"label__container"},{children:[e(se?v:p,{children:[S,R?t("span",{children:"*"}):""]}),l.tooltipText&&t(u,Object.assign({body:l.tooltipText,placement:"top"},{children:t("span",{children:t(n,{style:{marginTop:-3},width:18,height:18,color:ve?g.content.negative:g.content.primary})})}))]})),K>0&&"TOP"===de&&e(y,{children:[null!==(D=null===(A=l.value)||void 0===A?void 0:A.length)&&void 0!==D?D:0,"/",K]})]}))]}))}));L.displayName="Input";export{L as Input};
1
+ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import n from"../../assets/icons/info.svg.js";import{forwardRef as l,useState as r,useContext as o,useRef as a,useEffect as s}from"react";import{Button as c}from"../button/Button.js";import{isFunction as h,validateInput as u}from"./Input-helper.js";import{Tooltip as d}from"../tooltips/Tooltip.js";import{TitleSmall as v,BodySecondary as p}from"../TypographyStyle.js";import{COLORS as g}from"../../constants/Theme.js";import m from"../../assets/icons/errorInfo.svg.js";import{InputStyleContext as f}from"./context/InputStyleProvider.js";import{RootContainer as x,InputFooter as b,MaxCharStyle as y,InputWrapper as j,IconHolder as O,PrefixHolder as C,InputContainer as T,InputContainerSmall as w,SuffixHolder as k,InputHeader as I}from"./Input.styled.js";const L=l(((l,L)=>{var B,H,M,E,z,A,D;const{placeholder:F,leftIcon:P,rightIcon:N,labelText:S,maxCharLimit:K,isRequired:R,hintText:G,type:_,state:q,validate:V,variant:W,button:$,suffixText:J,prefixText:Q,onChangeText:U,value:X,noErrorHint:Y,reset:Z,rangeValidation:ee,noKeyDownChange:te,version:ie,noMaxCharCheck:ne,labelElement:le,autoGrow:re,minHeight:oe,maxHeight:ae,labelTextBold:se,truncateText:ce,maxCharLimitPosition:he}=Object.assign({maxCharLimit:0,type:"text",variant:"default",maxCharLimitPosition:"TOP"},l),ue=null==P?void 0:P.icon,de=null==N?void 0:N.icon,[ve,pe]=r(!1),[ge,me]=r(!1),[fe,xe]=r(),be="small"===W?"18px":"22px",ye=o(f),[je,Oe]=r(),Ce=a(null),Te=null!=L?L:Ce;s((()=>{Oe(X),!X&&re&&(Te.current.style.height=oe||"48px")}),[X]),s((()=>{var e;Te.current&&(null===(e=l.onReferenceInit)||void 0===e||e.call(l,Te.current))}),[Te]),s((()=>{const e=Te.current;if(e&&["phonenumber","zip","number"].includes(_))return e.addEventListener("wheel",Le,{passive:!1}),()=>{e.removeEventListener("wheel",Le)}}),[]),s((()=>{Z&&Oe("")}),[Z]),s((()=>{var e;me(!!l.isActive),l.isActive&&(null===(e=Te.current)||void 0===e||e.focus())}),[l.isActive]),s((()=>{xe(l.errorMessage)}),[l.errorMessage]),s((()=>{var e;pe(!1),("invalid"===l.state||fe||"disabled-invalid"===l.state)&&pe(!0),"active"===l.state&&(null===(e=Te.current)||void 0===e||e.focus())}),[l.state,fe]),s((()=>{pe(!!fe)}),[fe]);const we=function(e){if(h(e)){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];e(...i)}},ke=()=>"zip"===_?6:2e3,Ie=e=>{const t=0!==K?K:ke();if(te||U(X||"",e),ne)return;const i=e.target.value;![8].includes(e.which)&&t>0&&i.length>=t&&e.preventDefault()},Le=e=>{e.preventDefault()},Be=e=>{let t=e.target.value;const i=0!==K?K+1:ke();!ne&&i>0&&t.length>=i&&(t=t.substring(0,i-1)),U(t,e),l.textControl||Oe(t),re&&(Te.current.style.height=`${Te.current.scrollHeight}px`,t||(Te.current.style.height=oe||"48px"));const n=V||u;if(!n||!h(n))return;const[r,o]=n(t,_,ee);pe(!r),xe(l.errorMessage?l.errorMessage:o)},He=e=>{var t;l.skipFocus||me(!0),we(null===(t=l.onFocus)||void 0===t?void 0:t.call(l,e))},Me=e=>{var t;l.skipFocus||me(!1),we(null===(t=l.onBlur)||void 0===t?void 0:t.call(l,e))},Ee=()=>{var n;return e(i,{children:["multiline"!==_&&t("input",{className:ce?"truncate-class":"","data-test":l["data-test"],id:l.id,style:null!==(n=null==ye?void 0:ye.input)&&void 0!==n?n:{},ref:Te,type:["phonenumber","zip","number"].includes(_)?"number":_,value:je,onFocus:e=>He(e),onBlur:e=>Me(e),placeholder:F||"Enter here",onChange:Be,onClick:e=>we(l.onClick),onKeyDown:e=>Ie(e)}),"multiline"===_&&t("textarea",{"data-test":l["data-test"],value:je,ref:Te,onFocus:e=>He(e),onBlur:e=>Me(e),onClick:e=>we(l.onClick),placeholder:F||"Enter here",onChange:Be,onKeyDown:e=>Ie(e),maxLength:K>0?K:void 0})]})};return e(x,Object.assign({width:l.width,height:l.height,state:q,type:_,style:null!==(B=null==ye?void 0:ye.RootContainer)&&void 0!==B?B:{}},{children:[e("div",Object.assign({className:"flex-align-center"},{children:[!Y&&(!!G||!!fe)&&t(b,Object.assign({invalid:!!fe},{children:e("div",{children:[!!fe&&t(m,{width:16,height:16}),fe||G]})})),K>0&&"BOTTOM"===he&&e(y,Object.assign({position:"BOTTOM"},{children:[null!==(M=null===(H=l.value)||void 0===H?void 0:H.length)&&void 0!==M?M:0,"/",K]}))]})),e(j,Object.assign({variant:W,state:q,width:l.width,isActive:"active"===q||ge,isInvalid:ve,style:null!==(E=null==ye?void 0:ye.InputWrapper)&&void 0!==E?E:{},version:ie,height:l.height},{children:[!!ue&&t(O,Object.assign({variant:W,iconSize:be,onClick:()=>we(null==P?void 0:P.callback),isLeft:!0,style:null!==(z=null==ye?void 0:ye.IconHolder)&&void 0!==z?z:{}},{children:t(ue,{})})),!!Q&&t(C,Object.assign({variant:W},{children:Q})),"default"===W&&t(T,Object.assign({height:l.height,type:l.type,minHeight:oe,maxHeight:ae,autoGrow:re},{children:Ee()})),"small"===W&&t(w,Object.assign({height:l.height,type:l.type},{children:Ee()})),!!de&&t(O,Object.assign({variant:W,iconSize:be,onClick:()=>we(null==N?void 0:N.callback),isLeft:!1},{children:t(de,{})})),!!J&&t(k,Object.assign({variant:W},{children:J})),$&&$.text&&t(c,{buttonText:$.text,onClick:()=>we(null==$?void 0:$.onClick)})]})),(!!S||!!K)&&e(I,Object.assign({invalid:ve},{children:[le&&le,e("div",Object.assign({className:"label__container"},{children:[e(se?v:p,{children:[S,R?t("span",{children:"*"}):""]}),l.tooltipText&&t(d,Object.assign({body:l.tooltipText,placement:"top"},{children:t("span",{children:t(n,{style:{marginTop:-3},width:18,height:18,color:ve?g.content.negative:g.content.primary})})}))]})),K>0&&"TOP"===he&&e(y,{children:[null!==(D=null===(A=l.value)||void 0===A?void 0:A.length)&&void 0!==D?D:0,"/",K]})]}))]}))}));L.displayName="Input";export{L as Input};
@@ -1,4 +1,4 @@
1
- import{jsxs as e,Fragment as a,jsx as l}from"react/jsx-runtime";import r from"../../assets/icons/PlusIcon.js";import{useRef as t,useState as i,useEffect as n}from"react";import o from"styled-components";import{v4 as s}from"uuid";import{COLORS as c}from"../../constants/Theme.js";import{AddVariableStyled as d}from"../add-variableV2/AddVariableBox.styled.js";import{Floater as u}from"../floater/floater.js";import{Input as p}from"../input/Input.js";import{BodyCaption as v}from"../TypographyStyle.js";import{VariablePicker as m}from"../variable-picker-v3/VariablePicker.js";import{PickerType as h}from"../variable-picker-v3/model.js";import{CustomPortal as b}from"./customPortal.js";const g=o=>{let{type:c,allowMix:g,onChange:f,prevVariable:T,variablesList:x,onBlur:V,onlyVariables:j,placeHolder:k,showAddButton:C=!0,showHelp:E,errorMessage:O,maxCharLimit:w,noMaxCharCheck:D,labelText:A,labelElement:M,isRequired:S=!1,hintText:B,onEnterPress:F,pickerType:R=h.FLOATER,portalElement:H,showVarHeader:I,varHeaderText:L,onPickerToggle:P}=o;const N=t(),$=t(!0),q=t(null),[z,K]=i(!1),[G]=i(s()),[J,Q]=i(),[U,W]=i(T),[X,Y]=i(!1),[Z,_]=i(!1),[ee,ae]=i(0);return n((()=>{if(J&&J.actualValue)if(g){if(W((e=>{return{actualValue:(a=e.actualValue,l=J.actualValue,r=ee,a.slice(0,r)+l+a.slice(r)),variableType:"string"};var a,l,r})),q.current){ae(q.current.selectionStart);const e=ee+J.actualValue.length+2;q.current.setSelectionRange(e,e),ae(e)}}else W((e=>({actualValue:J.actualValue,variableType:J.variableType,needsFetching:J.needsFetching})))}),[J]),n((()=>{$.current?$.current=!1:f(U)}),[U]),e(a,{children:[e(y,Object.assign({isVar:/^{{.*}}$/.test(U.actualValue),onKeyDown:e=>{"Enter"===e.key&&(null==F||F(U.actualValue))}},{children:[l(p,{isRequired:S,hintText:B,type:null!=c?c:"text",id:G,ref:q,skipFocus:!0,isActive:z,value:U.actualValue,validate:e=>[!0,""],errorMessage:O,noMaxCharCheck:D,maxCharLimit:w,labelText:A,labelElement:M,placeholder:k||"Add a value",onClick:e=>{q.current&&ae(q.current.selectionStart)},onChangeText:(e,a)=>{if(q.current&&ae(q.current.selectionStart),j){const e=(null==a?void 0:a.keyCode)||(null==a?void 0:a.charCode);8!==e&&46!==e||W({actualValue:"",variableType:"string"})}else W(g?{actualValue:e,variableType:"string"}:{actualValue:e.replace(/{{.*}}/,""),variableType:"string"})},onReferenceInit:()=>{},onFocus:e=>{K(!0),_(!0)},onBlur:e=>{var a,l,r,t,i,n;null==V||V(e,U),"addVar"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||"variable-picker-v3"===(null===(l=e.relatedTarget)||void 0===l?void 0:l.id)||(null===(t=null===(r=e.relatedTarget)||void 0===r?void 0:r.className)||void 0===t?void 0:t.includes("accordion"))||"back-btn-v3"===(null===(i=e.relatedTarget)||void 0===i?void 0:i.id)?(q.current&&q.current.focus(),K(!0)):"search-bar-v3-picker"===(null===(n=e.relatedTarget)||void 0===n?void 0:n.id)?K(!0):(K(!1),Y(!1),null==P||P(!1),_(!1))}}),e("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"space-between"}},{children:[U.actualValue&&E&&l("div",Object.assign({style:{marginTop:4}},{children:l(v,{children:`This value is of type ${U.variableType}`})})),C&&Z&&l("div",Object.assign({style:{marginTop:O||B?"-24px":"0px"}},{children:l(d,Object.assign({ref:N,id:"addVar",onClick:()=>{Y(!X),null==P||P(!X)}},{children:e("div",Object.assign({className:"add"},{children:[l(r,{color:"white"}),l("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))}))]}))]})),X&&l(a,{children:R===h.EMBEDDED?l(b,Object.assign({zIndex:101,element:null!=H?H:document.body},{children:l(m,{width:"344px",showHeader:I,headerText:L,onClose:()=>{Y(!1),null==P||P(!1)},type:h.EMBEDDED,data:x,onSelect:e=>{Q(e),Y(!1),null==P||P(!1)}})})):l("div",Object.assign({style:{zIndex:101,position:"relative"}},{children:l(u,Object.assign({refElement:N},{children:l("div",Object.assign({style:{height:500}},{children:l(m,{onClose:()=>{Y(!1),null==P||P(!1)},type:h.FLOATER,data:x,onSelect:e=>{Q(e),Y(!1),null==P||P(!1)}})}))}))}))})]})},y=o.div`
1
+ import{jsxs as e,Fragment as l,jsx as a}from"react/jsx-runtime";import r from"../../assets/icons/PlusIcon.js";import{useRef as t,useState as i,useEffect as n}from"react";import o from"styled-components";import{v4 as s}from"uuid";import{COLORS as c}from"../../constants/Theme.js";import{AddVariableStyled as d}from"../add-variableV2/AddVariableBox.styled.js";import{Floater as u}from"../floater/floater.js";import{Input as p}from"../input/Input.js";import{BodyCaption as v}from"../TypographyStyle.js";import{VariablePicker as m}from"../variable-picker-v3/VariablePicker.js";import{PickerType as h}from"../variable-picker-v3/model.js";import{CustomPortal as b}from"./customPortal.js";const g=o=>{let{type:c,allowMix:g,onChange:T,prevVariable:f,variablesList:x,onBlur:V,onlyVariables:j,placeHolder:k,showAddButton:C=!0,showHelp:E,errorMessage:O,maxCharLimit:w,noMaxCharCheck:D,labelText:A,labelElement:M,isRequired:S=!1,hintText:B,onEnterPress:F,pickerType:R=h.FLOATER,portalElement:H,showVarHeader:I,varHeaderText:L,onPickerToggle:P}=o;const N=t(),$=t(!0),q=t(null),[z,K]=i(!1),[G]=i(s()),[J,Q]=i(),[U,W]=i(f),[X,Y]=i(!1),[Z,_]=i(!1),[ee,le]=i(0);return n((()=>{if(J&&J.actualValue)if(g){if(W((e=>{return{actualValue:(l=e.actualValue,a=J.actualValue,r=ee,l.slice(0,r)+a+l.slice(r)),variableType:"string"};var l,a,r})),q.current){le(q.current.selectionStart);const e=ee+J.actualValue.length+2;q.current.setSelectionRange(e,e),le(e)}}else W((e=>({actualValue:J.actualValue,variableType:J.variableType,needsFetching:J.needsFetching})))}),[J]),n((()=>{$.current?$.current=!1:T(U)}),[U]),e(l,{children:[e(y,Object.assign({isVar:/^{{.*}}$/.test(U.actualValue),onKeyDown:e=>{console.log("key",e.key),"Enter"===e.key&&(null==F||F(U.actualValue))}},{children:[a(p,{isRequired:S,hintText:B,type:null!=c?c:"text",id:G,ref:q,skipFocus:!0,isActive:z,value:U.actualValue,validate:e=>[!0,""],errorMessage:O,noMaxCharCheck:D,maxCharLimit:w,labelText:A,labelElement:M,placeholder:k||"Add a value",onClick:e=>{q.current&&le(q.current.selectionStart)},onChangeText:(e,l)=>{if(q.current&&le(q.current.selectionStart),j){const e=(null==l?void 0:l.keyCode)||(null==l?void 0:l.charCode);8!==e&&46!==e||W({actualValue:"",variableType:"string"})}else W(g?{actualValue:e,variableType:"string"}:{actualValue:e.replace(/{{.*}}/,""),variableType:"string"})},onReferenceInit:()=>{},onFocus:e=>{K(!0),_(!0)},onBlur:e=>{var l,a,r,t,i,n,o;console.log("ee",null===(l=e.relatedTarget)||void 0===l?void 0:l.id),null==V||V(e,U),"addVar"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||"variable-picker-v3"===(null===(r=e.relatedTarget)||void 0===r?void 0:r.id)||(null===(i=null===(t=e.relatedTarget)||void 0===t?void 0:t.className)||void 0===i?void 0:i.includes("accordion"))||"back-btn-v3"===(null===(n=e.relatedTarget)||void 0===n?void 0:n.id)?(q.current&&q.current.focus(),K(!0)):"search-bar-v3-picker"===(null===(o=e.relatedTarget)||void 0===o?void 0:o.id)?K(!0):(K(!1),Y(!1),null==P||P(!1),_(!1))}}),e("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"space-between"}},{children:[U.actualValue&&E&&a("div",Object.assign({style:{marginTop:4}},{children:a(v,{children:`This value is of type ${U.variableType}`})})),C&&Z&&a("div",Object.assign({style:{marginTop:O||B?"-24px":"0px"}},{children:a(d,Object.assign({ref:N,id:"addVar",onClick:()=>{Y(!X),null==P||P(!X)}},{children:e("div",Object.assign({className:"add"},{children:[a(r,{color:"white"}),a("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))}))]}))]})),X&&a(l,{children:R===h.EMBEDDED?a(b,Object.assign({zIndex:101,element:null!=H?H:document.body},{children:a(m,{width:"344px",showHeader:I,headerText:L,onClose:()=>{Y(!1),null==P||P(!1)},type:h.EMBEDDED,data:x,onSelect:e=>{Q(e),Y(!1),null==P||P(!1)}})})):a("div",Object.assign({style:{zIndex:101,position:"relative"}},{children:a(u,Object.assign({refElement:N},{children:a("div",Object.assign({style:{height:500}},{children:a(m,{onClose:()=>{Y(!1),null==P||P(!1)},type:h.FLOATER,data:x,onSelect:e=>{Q(e),Y(!1),null==P||P(!1)}})}))}))}))})]})},y=o.div`
2
2
  position: relative;
3
3
  margin-bottom: 16px;
4
4
  input {
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../_virtual/_tslib.js";import{jsx as t,jsxs as s,Fragment as i}from"react/jsx-runtime";import o from"../../assets/icons/arrow_back.svg.js";import l from"../../assets/icons/cross.svg.js";import a from"../../assets/icons/plus.svg.js";import n from"../../assets/icons/triangle_error.svg.js";import{useState as r,useEffect as c}from"react";import{COLORS as d}from"../../constants/Theme.js";import{BikAccordion as h}from"../accordion/Accordion.js";import{IconButton as m}from"../icon-button/IconButton.js";import{Input as p}from"../input/Input.js";import{ListItem as g}from"../list-item/ListItem.js";import{Switch as b}from"../switch/Switch.js";import{Tooltip as u}from"../tooltips/Tooltip.js";import{TitleRegular as f,BodySecondary as y,BodyCaption as v,TitleSmall as j}from"../TypographyStyle.js";import{VariablePickerContext as x}from"./context.js";import O from"./NoResult.js";import{showOnlyRecommendedVariables as w}from"./recommendVaribles.js";import{searchVariables as k}from"./searchVariables.js";import{HeaderWrapper as C,RecommendWrapper as S,BackHeader as T,Container as N}from"./styles.js";import V,{renderTooltipBody as I}from"./SubHeaderItems.js";const B=(e,i)=>{if(0===i.length)return e;const o=e.toLowerCase().indexOf(i.toLowerCase());if(-1===o)return e;const l=e.slice(0,o),a=e.slice(o,o+i.length),n=e.slice(o+i.length);return s("span",{children:[l,t("b",Object.assign({style:{color:d.content.primary}},{children:a})),n]})},R=/.*\..*/,L=e=>{if(e.actualValue.match(R)){const t=e.actualValue.replace("{{","").replace("}}","").split(".");let s=t[0];return t.forEach(((e,t)=>{if(0===t)return;const i=(e=>/\w+\[\d+\]/g.test(e))(e);if(i){const t=e.match(/(\w+)\[(\d+)\]/);if(t){const e=t[1],i=t[2];s+=`['${e}'][${i}]`}}else s+=`['${e}']`})),s}return e.actualValueEval?e.actualValueEval:e.actualValue},H=R=>{const{data:H,onSelect:$,showHeader:E,showBackButton:P,hideHeaderCross:_,onBackButtonClick:A,isEvaluationList:z,autoOpenFirst:D,headerText:F}=R,[K,q]=r(H),[G,J]=r(""),[M,Q]=r([]),[U,W]=r(""),[X,Y]=r(!1),[Z,ee]=r([]);c((()=>{te(!0)}),[]),c((()=>{M.length>0?ee([M[M.length-1]]):ee(H)}),[M]);const te=t=>e(void 0,void 0,void 0,(function*(){if(Y(t),t){const e=w(K,M);q(e)}else if(M.length>0){const e=U==M[M.length-1].displayName;if(G.length>0&&e){const e=k(G,Z,M);q(e)}else q([M[M.length-1].variables])}else if(G.length>0){const e=k(G,Z,M);q(e)}else q(H)})),se=()=>{let e=131;return M.length>0&&(e+=32),(R.showHeader||R.showBackButton)&&(e+=40),`calc(100% - ${e}px)`};return t(x.Provider,Object.assign({value:{variables:K,searchText:G,subHeaderStack:M,showRecommended:X,setSubHeaderStack:Q,setSearchText:J,setVariables:q,setShowRecommended:Y}},{children:s("div",Object.assign({tabIndex:-1,id:"variable-picker-v3",style:{backgroundColor:"white",borderRadius:4,height:"100%",outline:"none"},onClick:e=>e.stopPropagation()},{children:[(E||P)&&s(C,{children:[s("div",Object.assign({style:{display:"flex",alignItems:"center",gap:8}},{children:[P&&t(m,{Icon:()=>t(o,{width:16,height:16,style:{display:"flex",color:d.content.primary}}),onClick:A}),E&&t(f,{children:null!=F?F:"Select Variable"})]})),!_&&t(m,{style:{color:"#212121"},Icon:l,onClick:()=>R.onClose&&R.onClose()})]}),t("div",Object.assign({style:{padding:"0 16px",paddingTop:12,backgroundColor:d.surface.subdued,borderTopLeftRadius:4,borderTopRightRadius:4}},{children:t(p,{id:"search-bar-v3-picker",onBlur:e=>{R.onSearchBlur&&R.onSearchBlur(e)},value:G,noKeyDownChange:!0,placeholder:"Search",onChangeText:e=>{e||W("");const t=k(e,Z,M);if(X){const e=w(t,M);q(e)}else q(t);J(e);const s=M.length>0?M[M.length-1].displayName:"home";W(s)}})})),s(S,{children:[t(y,Object.assign({style:{color:d.content.secondary}},{children:"Only Recommended"})),t(b,{value:X,onValueChange:t=>e(void 0,void 0,void 0,(function*(){yield te(t)}))})]}),M.length>0&&s(T,{children:[t("div",Object.assign({style:{position:"absolute",left:16}},{children:t(m,{id:"back-btn-v3",style:{display:"flex"},Icon:()=>t(o,{width:12,height:12,style:{color:d.content.secondary}}),onClick:e=>{e.stopPropagation();let t=G;const s=[...M],i=s.pop();if(Q(s),i.displayName===U&&(J(""),t=""),t.length>0){const e=s.length>0?[s[s.length-1]]:H,i=k(t,e,s);if(X){const e=w(i,s);q(e)}else q(i)}else if(s.length>0)if(X){const e=w([s[s.length-1].variables],s);q(e)}else q([s[s.length-1].variables]);else if(X){const e=w(H,M);q(e)}else q(H)}})})),t(v,Object.assign({style:{color:d.content.secondary}},{children:M[M.length-1].displayName}))]}),t(i,{children:K.length>0?t(N,Object.assign({height:se()},{children:K.map(((e,o)=>{var l,r;return e.displayName&&void 0!==e.variables?t("div",Object.assign({style:{borderBottom:`1px solid ${d.stroke.primary}`}},{children:t(h,Object.assign({autoOpen:D&&0===o,headerPadding:"12px 16px",header:t(j,Object.assign({style:{color:d.content.secondary}},{children:B(e.displayName,G)}))},{children:t(V,{parentVariable:e,disabled:null!==(l=R.disabled)&&void 0!==l&&l,searchText:G,variable:e.variables,onSelect:$})}))}),e.displayName+X):e.displayName?t(u,Object.assign({body:I(e),placement:"bottom"},{children:t(g,{variant:R.disabled?"readonly":(null==e?void 0:e.selected)?"selected":"default",version:"2.0",leadingIcon:(null==e?void 0:e.selected)||R.disabled?t(i,{}):t(a,{width:14,height:14}),customListItemLabel:s("div",Object.assign({style:{display:"flex",gap:4}},{children:[t(y,Object.assign({style:{fontSize:"14px",color:d.text.primary}},{children:B(e.displayName,G)})),!e.isAvailable&&t(u,Object.assign({body:"Not Recommended"},{children:t("div",Object.assign({style:{display:"flex",marginTop:2}},{children:t(n,{width:16,height:16,color:d.content.secondary})}))}))]})),listItem:{label:e.displayName,value:e.displayName},subText:e.description||"",onClick:()=>{if(!R.disabled)if(z){const t=L(e);$(Object.assign(Object.assign({},e),{actualValue:t}))}else $(e)}},o)}),o):t(V,{disabled:null!==(r=R.disabled)&&void 0!==r&&r,searchText:G,variable:e,onSelect:e=>{if(!R.disabled)if(z){const t=L(e);$(Object.assign(Object.assign({},e),{actualValue:t}))}else $(e)}},o)}))})):t(O,{height:se(),searchText:G})})]}))}))};export{H as VariablePickerContent,B as highlightSearchText};
1
+ import{__awaiter as e}from"../../_virtual/_tslib.js";import{jsx as t,jsxs as o,Fragment as s}from"react/jsx-runtime";import i from"../../assets/icons/arrow_back.svg.js";import l from"../../assets/icons/cross.svg.js";import a from"../../assets/icons/plus.svg.js";import n from"../../assets/icons/triangle_error.svg.js";import{useState as r,useEffect as c}from"react";import{COLORS as d}from"../../constants/Theme.js";import{BikAccordion as h}from"../accordion/Accordion.js";import{IconButton as p}from"../icon-button/IconButton.js";import{Input as m}from"../input/Input.js";import{ListItem as u}from"../list-item/ListItem.js";import{Switch as g}from"../switch/Switch.js";import{Tooltip as b}from"../tooltips/Tooltip.js";import{TitleRegular as f,BodySecondary as y,BodyCaption as v,TitleSmall as j}from"../TypographyStyle.js";import{VariablePickerContext as x}from"./context.js";import{DefaultVariableContent as O}from"./DefaultVariableContent.js";import{PickerType as w}from"./model.js";import k from"./NoResult.js";import{showOnlyRecommendedVariables as C}from"./recommendVaribles.js";import{searchVariables as S}from"./searchVariables.js";import{HeaderWrapper as V,RecommendWrapper as T,BackHeader as I,Container as N}from"./styles.js";import B,{renderTooltipBody as R}from"./SubHeaderItems.js";const D=(e,s)=>{if(0===s.length)return e;const i=e.toLowerCase().indexOf(s.toLowerCase());if(-1===i)return e;const l=e.slice(0,i),a=e.slice(i,i+s.length),n=e.slice(i+s.length);return o("span",{children:[l,t("b",Object.assign({style:{color:d.content.primary}},{children:a})),n]})},E=/.*\..*/,L=L=>{const{data:H,onSelect:P,showHeader:$,showBackButton:_,hideHeaderCross:A,onBackButtonClick:z,isEvaluationList:F,autoOpenFirst:K,headerText:M}=L,[q,G]=r(H),[J,Q]=r(""),[U,W]=r([]),[X,Y]=r(""),[Z,ee]=r(!1),[te,oe]=r([]),[se,ie]=r(!1),[le,ae]=r(),ne=se&&L.type===w.EMBEDDED&&!A;c((()=>{ce(!0)}),[]),c((()=>{U.length>0?oe([U[U.length-1]]):oe(H)}),[U]);const re=e=>{e.stopPropagation();let t=J;const o=[...U],s=o.pop();if(W(o),s.displayName===X&&(Q(""),t=""),t.length>0){const e=o.length>0?[o[o.length-1]]:H,s=S(t,e,o);if(Z){const e=C(s,o);G(e)}else G(s)}else if(o.length>0)if(Z){const e=C([o[o.length-1].variables],o);G(e)}else G([o[o.length-1].variables]);else if(Z){const e=C(H,U);G(e)}else G(H)},ce=t=>e(void 0,void 0,void 0,(function*(){if(ee(t),t){const e=C(q,U);G(e)}else if(U.length>0){const e=X==U[U.length-1].displayName;if(J.length>0&&e){const e=S(J,te,U);G(e)}else G([U[U.length-1].variables])}else if(J.length>0){const e=S(J,te,U);G(e)}else G(H)})),de=()=>{let e=131;return U.length>0&&(e+=32),(L.showHeader||L.showBackButton)&&(e+=40),`calc(100% - ${e}px)`},he=e=>{if(!L.disabled)if(F){const t=(e=>{if(e.actualValue.match(E)){const t=e.actualValue.replace("{{","").replace("}}","").split(".");let o=t[0];return t.forEach(((e,t)=>{if(0===t)return;const s=(e=>/\w+\[\d+\]/g.test(e))(e);if(s){const t=e.match(/(\w+)\[(\d+)\]/);if(t){const e=t[1],s=t[2];o+=`['${e}'][${s}]`}}else o+=`['${e}']`})),o}return e.actualValueEval?e.actualValueEval:e.actualValue})(e);P(Object.assign(Object.assign({},e),{actualValue:t}))}else{if(e.enableDefaultValuePopulation)return ae(e),void ie(!0);P(e)}};return t(x.Provider,Object.assign({value:{variables:q,searchText:J,subHeaderStack:U,showRecommended:Z,setSubHeaderStack:W,setSearchText:Q,setVariables:G,setShowRecommended:ee}},{children:o("div",Object.assign({tabIndex:-1,id:"variable-picker-v3",style:{backgroundColor:"white",borderRadius:4,height:"100%",outline:"none"},onClick:e=>e.stopPropagation()},{children:[($||_||se)&&o(V,Object.assign({openDefault:se},{children:[o("div",Object.assign({style:{display:"flex",alignItems:"center",gap:8}},{children:[(_||se)&&t(p,{Icon:()=>t(i,{width:16,height:16,style:{display:"flex",color:d.content.primary}}),onClick:()=>{se?(se&&ie(!1),re({})):z&&z()}}),($||se)&&t(f,{children:se?"Set up":null!=M?M:"Select Variable"})]})),ne&&t(p,{style:{color:"#212121"},Icon:l,onClick:()=>L.onClose&&L.onClose()})]})),se&&le?t(O,{variable:le,onInsertVariable:e=>{P(e),console.log("uploa",e)}}):o(s,{children:[t("div",Object.assign({style:{padding:"0 16px",paddingTop:12,backgroundColor:d.surface.subdued,borderTopLeftRadius:4,borderTopRightRadius:4}},{children:t(m,{id:"search-bar-v3-picker",onBlur:e=>{L.onSearchBlur&&L.onSearchBlur(e)},value:J,noKeyDownChange:!0,placeholder:"Search",onChangeText:e=>{e||Y("");const t=S(e,te,U);if(Z){const e=C(t,U);G(e)}else G(t);Q(e);const o=U.length>0?U[U.length-1].displayName:"home";Y(o)}})})),o(T,{children:[t(y,Object.assign({style:{color:d.content.secondary}},{children:"Only Recommended"})),t(g,{value:Z,onValueChange:t=>e(void 0,void 0,void 0,(function*(){yield ce(t)}))})]}),U.length>0&&o(I,{children:[t("div",Object.assign({style:{position:"absolute",left:16}},{children:t(p,{id:"back-btn-v3",style:{display:"flex"},Icon:()=>t(i,{width:12,height:12,style:{color:d.content.secondary}}),onClick:re})})),t(v,Object.assign({style:{color:d.content.secondary}},{children:U[U.length-1].displayName}))]}),t(s,{children:q.length>0?t(N,Object.assign({height:de()},{children:q.map(((e,i)=>{var l,r;return e.displayName&&void 0!==e.variables?t("div",Object.assign({style:{borderBottom:`1px solid ${d.stroke.primary}`}},{children:t(h,Object.assign({autoOpen:K&&0===i,headerPadding:"12px 16px",header:t(j,Object.assign({style:{color:d.content.secondary}},{children:D(e.displayName,J)}))},{children:t(B,{parentVariable:e,disabled:null!==(l=L.disabled)&&void 0!==l&&l,searchText:J,variable:e.variables,onSelect:e=>{if(e.enableDefaultValuePopulation)return ae(e),void ie(!0);P(e)}})}))}),e.displayName+Z):e.displayName?t(b,Object.assign({body:R(e),placement:"bottom"},{children:t(u,{variant:L.disabled?"readonly":(null==e?void 0:e.selected)?"selected":"default",version:"2.0",leadingIcon:(null==e?void 0:e.selected)||L.disabled?t(s,{}):t(a,{width:14,height:14}),customListItemLabel:o("div",Object.assign({style:{display:"flex",gap:4}},{children:[t(y,Object.assign({style:{fontSize:"14px",color:d.text.primary}},{children:D(e.displayName,J)})),!e.isAvailable&&t(b,Object.assign({body:"Not Recommended"},{children:t("div",Object.assign({style:{display:"flex",marginTop:2}},{children:t(n,{width:16,height:16,color:d.content.secondary})}))}))]})),listItem:{label:e.displayName,value:e.displayName},subText:e.description||"",onClick:()=>he(e)},i)}),i):t(B,{disabled:null!==(r=L.disabled)&&void 0!==r&&r,searchText:J,variable:e,onSelect:e=>he(e)},i)}))})):t(k,{height:de(),searchText:J})})]})]}))}))};export{L as VariablePickerContent,D as highlightSearchText};
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { VariableV3 } from './model';
3
+ interface Props {
4
+ variable: VariableV3;
5
+ onInsertVariable: (variable: VariableV3) => void;
6
+ }
7
+ export declare const DefaultVariableContent: React.FC<Props>;
8
+ export {};
@@ -0,0 +1 @@
1
+ import{jsx as e,Fragment as i,jsxs as a}from"react/jsx-runtime";import{useState as t}from"react";import{Button as l}from"../button/Button.js";import{CheckBox as r}from"../checkBox/CheckBox.js";import{Input as o}from"../input/Input.js";import{TitleRegular as s,BodySecondary as n}from"../TypographyStyle.js";const d=d=>{var p,u,c;const[b,f]=t(d.variable.defaultValue||""),[g,m]=t(""),[h,v]=t(!!(null===(p=d.variable)||void 0===p?void 0:p.enableDefaultValueForGlobalUsage));return e(i,{children:a("div",Object.assign({style:{padding:"0 16px",paddingTop:12,borderTopLeftRadius:4,borderTopRightRadius:4}},{children:[e("div",Object.assign({style:{paddingBottom:16,borderBottom:"1px solid #E0E0E0"}},{children:e(s,{children:null===(u=d.variable)||void 0===u?void 0:u.displayName})})),a("div",Object.assign({style:{paddingTop:24}},{children:[e(o,{onChangeText:e=>{m(""),f(e)},value:b,isRequired:!0,labelText:"Default Value",hintText:"Used if this field is missing for a customer",errorMessage:null!=g?g:"",maxCharLimit:25}),a("div",Object.assign({style:{paddingTop:24,gap:8,alignItems:"flex-start"},className:"d-flex"},{children:[e(r,{isChecked:h,onValueChange:e=>v(e),size:"SMALL",skipHoverState:!0}),e(n,Object.assign({style:{marginTop:-2}},{children:`Make this the default value for ‘${null===(c=d.variable)||void 0===c?void 0:c.displayName}’`}))]})),e("div",Object.assign({style:{padding:"24px 0px",display:"flex",flexDirection:"row",justifyContent:"flex-end"}},{children:e(l,{buttonText:"Insert Variable",buttonType:"primary",onClick:()=>{if(!b)return void m("This field is required");const e=Object.assign(Object.assign({},d.variable),{defaultValue:b,enableDefaultValueForGlobalUsage:h});d.onInsertVariable(e)}})}))]}))]}))})};export{d as DefaultVariableContent};
@@ -54,4 +54,6 @@ export interface VariableV3 {
54
54
  [key: string]: VariableV3;
55
55
  };
56
56
  needsFetching?: boolean;
57
+ enableDefaultValuePopulation?: boolean;
58
+ enableDefaultValueForGlobalUsage?: boolean;
57
59
  }
@@ -1,4 +1,6 @@
1
- export declare const HeaderWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
1
+ export declare const HeaderWrapper: import("styled-components").StyledComponent<"div", any, {
2
+ openDefault?: boolean | undefined;
3
+ }, never>;
2
4
  export declare const RecommendWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
3
5
  export declare const BackHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
4
6
  export declare const Container: import("styled-components").StyledComponent<"div", any, {
@@ -1,7 +1,7 @@
1
1
  import e from"styled-components";import{COLORS as t}from"../../constants/Theme.js";const o=e.div`
2
2
  display: flex;
3
3
  align-items: center;
4
- padding: 12px 16px 0px 16px;
4
+ padding: ${e=>e.openDefault?"12px 16px":"12px 16px 0px 16px"};
5
5
  background-color: ${t.surface.subdued};
6
6
  justify-content: space-between;
7
7
  border-top-right-radius: 4px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.542-beta.cm-1",
3
+ "version": "0.0.543-default-val-beta",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",