@bikdotai/bik-component-library 0.0.573-1 → 0.0.573-2

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.
@@ -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;const{placeholder:f,leftIcon:m,rightIcon:y,labelText:b,maxCharLimit:C,isRequired:O,hintText:T,type:I,state:S,validate:w,variant:E,button:k,suffixText:q,prefixText:H,onChangeText:L,value:M,noErrorHint:B,reset:F,rangeValidation:R,noKeyDownChange:P,version:z,noMaxCharCheck:A,labelElement:D,autoGrow:N,minHeight:_,maxHeight:K,labelTextBold:G,truncateText:W,maxCharLimitPosition:V}=Object.assign({maxCharLimit:0,type:"text",variant:"default",maxCharLimitPosition:"TOP"},d),$=null==m?void 0:m.icon,J=null==y?void 0:y.icon,[Q,U]=n.useState(!1),[X,Y]=n.useState(!1),[Z,ee]=n.useState(),te="small"===E?"18px":"22px",ne=n.useContext(c.InputStyleContext),[ie,se]=n.useState(),re=n.useRef(null),le=null!=h?h:re;n.useEffect((()=>{se(M),!M&&N&&(le.current.style.height=_||"48px")}),[M]),n.useEffect((()=>{var e;le.current&&(null===(e=d.onReferenceInit)||void 0===e||e.call(d,le.current))}),[le]),n.useEffect((()=>{const e=le.current;if(e&&["phonenumber","zip","number"].includes(I))return e.addEventListener("wheel",ue,{passive:!1}),()=>{e.removeEventListener("wheel",ue)}}),[]),n.useEffect((()=>{F&&se("")}),[F]),n.useEffect((()=>{var e;Y(!!d.isActive),d.isActive&&(null===(e=le.current)||void 0===e||e.focus())}),[d.isActive]),n.useEffect((()=>{ee(d.errorMessage)}),[d.errorMessage]),n.useEffect((()=>{var e;U(!1),("invalid"===d.state||Z||"disabled-invalid"===d.state)&&U(!0),"active"===d.state&&(null===(e=le.current)||void 0===e||e.focus())}),[d.state,Z]),n.useEffect((()=>{U(!!Z||"invalid"===d.state)}),[Z,d.state]);const ae=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)}},oe=()=>"zip"===I?6:2e3,ce=e=>{const t=0!==C?C:oe();if(P||L(M||"",e),A)return;const n=e.target.value;![8].includes(e.which)&&t>0&&n.length>=t&&e.preventDefault()},ue=e=>{e.preventDefault()},de=e=>{let t=e.target.value;const n=0!==C?C+1:oe();!A&&n>0&&t.length>=n&&(t=t.substring(0,n-1)),L(t,e),d.textControl||se(t),N&&(le.current.style.height=`${le.current.scrollHeight}px`,t||(le.current.style.height=_||"48px"));const i=w||s.validateInput;if(!i||!s.isFunction(i))return;const[r,l]=i(t,I,R);U(!r),ee(d.errorMessage?d.errorMessage:l)},he=e=>{var t;d.skipFocus||Y(!0),ae(null===(t=d.onFocus)||void 0===t?void 0:t.call(d,e))},ve=e=>{var t;d.skipFocus||Y(!1),ae(null===(t=d.onBlur)||void 0===t?void 0:t.call(d,e))},xe=()=>{var t;return e.jsxs(e.Fragment,{children:["multiline"!==I&&e.jsx("input",{className:W?"truncate-class":"","data-test":d["data-test"],id:d.id,style:null!==(t=null==ne?void 0:ne.input)&&void 0!==t?t:{},ref:le,type:["phonenumber","zip","number"].includes(I)?"number":I,value:ie,onFocus:e=>he(e),onBlur:e=>ve(e),placeholder:f||"Enter here",onChange:de,onClick:e=>ae(d.onClick),onKeyDown:e=>ce(e)}),"multiline"===I&&e.jsx("textarea",{"data-test":d["data-test"],value:ie,ref:le,onFocus:e=>he(e),onBlur:e=>ve(e),onClick:e=>ae(d.onClick),placeholder:f||"Enter here",onChange:de,onKeyDown:e=>ce(e),maxLength:C>0?C:void 0})]})};return e.jsxs(u.RootContainer,Object.assign({width:d.width,height:d.height,state:S,type:I,style:null!==(v=null==ne?void 0:ne.RootContainer)&&void 0!==v?v:{}},{children:[e.jsxs("div",Object.assign({className:"flex-align-center"},{children:[!B&&(!!T||!!Z)&&e.jsxs(u.InputFooter,Object.assign({invalid:!!Z},{children:[!!Z&&e.jsx(o.default,{width:16,height:16}),Z||T]})),C>0&&"BOTTOM"===V&&e.jsxs(u.MaxCharStyle,Object.assign({position:"BOTTOM"},{children:[null!==(x=null==M?void 0:M.length)&&void 0!==x?x:0,"/",C]}))]})),e.jsxs(u.InputWrapper,Object.assign({variant:E,state:S,width:d.width,isActive:"active"===S||X,isInvalid:Q,style:null!==(p=null==ne?void 0:ne.InputWrapper)&&void 0!==p?p:{},version:z,height:d.height},{children:[!!$&&e.jsx(u.IconHolder,Object.assign({variant:E,iconSize:te,onClick:()=>ae(null==m?void 0:m.callback),isLeft:!0,style:null!==(g=null==ne?void 0:ne.IconHolder)&&void 0!==g?g:{}},{children:e.jsx($,{})})),!!H&&e.jsx(u.PrefixHolder,Object.assign({variant:E},{children:H})),"default"===E&&e.jsx(u.InputContainer,Object.assign({height:d.height,type:d.type,minHeight:_,maxHeight:K,autoGrow:N},{children:xe()})),"small"===E&&e.jsx(u.InputContainerSmall,Object.assign({height:d.height,type:d.type},{children:xe()})),!!J&&e.jsx(u.IconHolder,Object.assign({variant:E,iconSize:te,onClick:()=>ae(null==y?void 0:y.callback),isLeft:!1},{children:e.jsx(J,{})})),!!q&&e.jsx(u.SuffixHolder,Object.assign({variant:E},{children:q})),k&&k.text&&e.jsx(i.Button,{buttonText:k.text,onClick:()=>ae(null==k?void 0:k.onClick)})]})),(!!b||!!C)&&e.jsxs(u.InputHeader,Object.assign({invalid:Q},{children:[D&&D,e.jsxs("div",Object.assign({className:"label__container"},{children:[G?e.jsxs(l.TitleSmall,{children:[b,O?e.jsx("span",{children:"*"}):""]}):e.jsxs(l.BodySecondary,{children:[b,O?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:Q?a.COLORS.content.negative:a.COLORS.content.primary})})}))]})),C>0&&"TOP"===V&&e.jsxs(u.MaxCharStyle,{children:[console.log(M,{props:d}),null!==(j=null==M?void 0:M.length)&&void 0!==j?j:0,"/",C]})]}))]}))}));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"),l=require("../tooltips/Tooltip.js"),r=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;const{placeholder:m,leftIcon:y,rightIcon:b,labelText:C,maxCharLimit:O,isRequired:T,hintText:I,type:S,state:w,validate:E,variant:k,button:q,suffixText:H,prefixText:L,onChangeText:M,value:B,noErrorHint:F,reset:R,rangeValidation:P,noKeyDownChange:z,version:A,noMaxCharCheck:D,labelElement:N,autoGrow:_,minHeight:K,maxHeight:G,labelTextBold:W,truncateText:V,maxCharLimitPosition:$}=Object.assign({maxCharLimit:0,type:"text",variant:"default",maxCharLimitPosition:"TOP"},d),J=null==y?void 0:y.icon,Q=null==b?void 0:b.icon,[U,X]=n.useState(!1),[Y,Z]=n.useState(!1),[ee,te]=n.useState(),ne="small"===k?"18px":"22px",ie=n.useContext(c.InputStyleContext),[se,le]=n.useState(),re=n.useRef(null),ae=null!=h?h:re;n.useEffect((()=>{le(B),!B&&_&&(ae.current.style.height=K||"48px")}),[B]),n.useEffect((()=>{var e;ae.current&&(null===(e=d.onReferenceInit)||void 0===e||e.call(d,ae.current))}),[ae]),n.useEffect((()=>{const e=ae.current;if(e&&["phonenumber","zip","number"].includes(S))return e.addEventListener("wheel",de,{passive:!1}),()=>{e.removeEventListener("wheel",de)}}),[]),n.useEffect((()=>{R&&le("")}),[R]),n.useEffect((()=>{var e;Z(!!d.isActive),d.isActive&&(null===(e=ae.current)||void 0===e||e.focus())}),[d.isActive]),n.useEffect((()=>{te(d.errorMessage)}),[d.errorMessage]),n.useEffect((()=>{var e;X(!1),("invalid"===d.state||ee||"disabled-invalid"===d.state)&&X(!0),"active"===d.state&&(null===(e=ae.current)||void 0===e||e.focus())}),[d.state,ee]),n.useEffect((()=>{X(!!ee||"invalid"===d.state)}),[ee,d.state]);const oe=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)}},ce=()=>"zip"===S?6:2e3,ue=e=>{const t=0!==O?O:ce();if(z||M(B||"",e),D)return;const n=e.target.value;![8].includes(e.which)&&t>0&&n.length>=t&&e.preventDefault()},de=e=>{e.preventDefault()},he=e=>{let t=e.target.value;const n=0!==O?O+1:ce();!D&&n>0&&t.length>=n&&(t=t.substring(0,n-1)),M(t,e),d.textControl||le(t),_&&(ae.current.style.height=`${ae.current.scrollHeight}px`,t||(ae.current.style.height=K||"48px"));const i=E||s.validateInput;if(!i||!s.isFunction(i))return;const[l,r]=i(t,S,P);X(!l),te(d.errorMessage?d.errorMessage:r)},ve=e=>{var t;d.skipFocus||Z(!0),oe(null===(t=d.onFocus)||void 0===t?void 0:t.call(d,e))},xe=e=>{var t;d.skipFocus||Z(!1),oe(null===(t=d.onBlur)||void 0===t?void 0:t.call(d,e))},pe=()=>{var t;return e.jsxs(e.Fragment,{children:["multiline"!==S&&e.jsx("input",{className:V?"truncate-class":"","data-test":d["data-test"],id:d.id,style:null!==(t=null==ie?void 0:ie.input)&&void 0!==t?t:{},ref:ae,type:["phonenumber","zip","number"].includes(S)?"number":S,value:se,onFocus:e=>ve(e),onBlur:e=>xe(e),placeholder:m||"Enter here",onChange:he,onClick:e=>oe(d.onClick),onKeyDown:e=>ue(e)}),"multiline"===S&&e.jsx("textarea",{"data-test":d["data-test"],value:se,ref:ae,onFocus:e=>ve(e),onBlur:e=>xe(e),onClick:e=>oe(d.onClick),placeholder:m||"Enter here",onChange:he,onKeyDown:e=>ue(e),maxLength:O>0?O:void 0})]})};return e.jsxs(u.RootContainer,Object.assign({width:d.width,height:d.height,state:w,type:S,style:null!==(v=null==ie?void 0:ie.RootContainer)&&void 0!==v?v:{}},{children:[e.jsxs("div",Object.assign({className:"flex-align-center"},{children:[!F&&(!!I||!!ee)&&e.jsxs(u.InputFooter,Object.assign({invalid:!!ee},{children:[!!ee&&e.jsx(o.default,{width:16,height:16}),ee||I]})),O>0&&"BOTTOM"===$&&e.jsxs(u.MaxCharStyle,Object.assign({position:"BOTTOM"},{children:[null!==(x=null==B?void 0:B.length)&&void 0!==x?x:0,"/",O]}))]})),e.jsxs(u.InputWrapper,Object.assign({variant:k,state:w,width:d.width,isActive:"active"===w||Y,isInvalid:U,style:null!==(p=null==ie?void 0:ie.InputWrapper)&&void 0!==p?p:{},version:A,height:d.height},{children:[!!J&&e.jsx(u.IconHolder,Object.assign({variant:k,iconSize:ne,onClick:()=>oe(null==y?void 0:y.callback),isLeft:!0,style:null!==(g=null==ie?void 0:ie.IconHolder)&&void 0!==g?g:{}},{children:e.jsx(J,{})})),!!L&&e.jsx(u.PrefixHolder,Object.assign({variant:k},{children:L})),"default"===k&&e.jsx(u.InputContainer,Object.assign({height:d.height,type:d.type,minHeight:K,maxHeight:G,autoGrow:_},{children:pe()})),"small"===k&&e.jsx(u.InputContainerSmall,Object.assign({height:d.height,type:d.type},{children:pe()})),!!Q&&e.jsx(u.IconHolder,Object.assign({variant:k,iconSize:ne,onClick:()=>oe(null==b?void 0:b.callback),isLeft:!1},{children:e.jsx(Q,{})})),!!H&&e.jsx(u.SuffixHolder,Object.assign({variant:k},{children:H})),q&&q.text&&e.jsx(i.Button,{buttonText:q.text,onClick:()=>oe(null==q?void 0:q.onClick)})]})),(!!C||!!O)&&e.jsxs(u.InputHeader,Object.assign({invalid:U},{children:[N&&N,e.jsxs("div",Object.assign({className:"label__container"},{children:[W?e.jsxs(r.TitleSmall,{children:[C,T?e.jsx("span",{children:"*"}):""]}):e.jsxs(r.BodySecondary,{children:[C,T?e.jsx("span",{children:"*"}):""]}),d.tooltipText&&e.jsx(l.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:U?a.COLORS.content.negative:a.COLORS.content.primary})})}))]})),O>0&&"TOP"===$&&e.jsxs(u.MaxCharStyle,{children:[console.log(B,{props:d},null==B?void 0:B.length,null===(j=null==d?void 0:d.value)||void 0===j?void 0:j.length),null!==(f=null==B?void 0:B.length)&&void 0!==f?f:0,"/",O]})]}))]}))}));d.displayName="Input",exports.Input=d;
@@ -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 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;const{placeholder:A,leftIcon:D,rightIcon:F,labelText:P,maxCharLimit:N,isRequired:S,hintText:K,type:R,state:G,validate:_,variant:q,button:V,suffixText:W,prefixText:$,onChangeText:J,value:Q,noErrorHint:U,reset:X,rangeValidation:Y,noKeyDownChange:Z,version:ee,noMaxCharCheck:te,labelElement:ie,autoGrow:ne,minHeight:le,maxHeight:re,labelTextBold:oe,truncateText:ae,maxCharLimitPosition:se}=Object.assign({maxCharLimit:0,type:"text",variant:"default",maxCharLimitPosition:"TOP"},l),ce=null==D?void 0:D.icon,he=null==F?void 0:F.icon,[ue,de]=r(!1),[ve,pe]=r(!1),[ge,me]=r(),fe="small"===q?"18px":"22px",xe=o(f),[be,ye]=r(),je=a(null),Oe=null!=L?L:je;s((()=>{ye(Q),!Q&&ne&&(Oe.current.style.height=le||"48px")}),[Q]),s((()=>{var e;Oe.current&&(null===(e=l.onReferenceInit)||void 0===e||e.call(l,Oe.current))}),[Oe]),s((()=>{const e=Oe.current;if(e&&["phonenumber","zip","number"].includes(R))return e.addEventListener("wheel",ke,{passive:!1}),()=>{e.removeEventListener("wheel",ke)}}),[]),s((()=>{X&&ye("")}),[X]),s((()=>{var e;pe(!!l.isActive),l.isActive&&(null===(e=Oe.current)||void 0===e||e.focus())}),[l.isActive]),s((()=>{me(l.errorMessage)}),[l.errorMessage]),s((()=>{var e;de(!1),("invalid"===l.state||ge||"disabled-invalid"===l.state)&&de(!0),"active"===l.state&&(null===(e=Oe.current)||void 0===e||e.focus())}),[l.state,ge]),s((()=>{de(!!ge||"invalid"===l.state)}),[ge,l.state]);const Ce=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)}},Te=()=>"zip"===R?6:2e3,we=e=>{const t=0!==N?N:Te();if(Z||J(Q||"",e),te)return;const i=e.target.value;![8].includes(e.which)&&t>0&&i.length>=t&&e.preventDefault()},ke=e=>{e.preventDefault()},Ie=e=>{let t=e.target.value;const i=0!==N?N+1:Te();!te&&i>0&&t.length>=i&&(t=t.substring(0,i-1)),J(t,e),l.textControl||ye(t),ne&&(Oe.current.style.height=`${Oe.current.scrollHeight}px`,t||(Oe.current.style.height=le||"48px"));const n=_||u;if(!n||!h(n))return;const[r,o]=n(t,R,Y);de(!r),me(l.errorMessage?l.errorMessage:o)},Le=e=>{var t;l.skipFocus||pe(!0),Ce(null===(t=l.onFocus)||void 0===t?void 0:t.call(l,e))},Be=e=>{var t;l.skipFocus||pe(!1),Ce(null===(t=l.onBlur)||void 0===t?void 0:t.call(l,e))},He=()=>{var n;return e(i,{children:["multiline"!==R&&t("input",{className:ae?"truncate-class":"","data-test":l["data-test"],id:l.id,style:null!==(n=null==xe?void 0:xe.input)&&void 0!==n?n:{},ref:Oe,type:["phonenumber","zip","number"].includes(R)?"number":R,value:be,onFocus:e=>Le(e),onBlur:e=>Be(e),placeholder:A||"Enter here",onChange:Ie,onClick:e=>Ce(l.onClick),onKeyDown:e=>we(e)}),"multiline"===R&&t("textarea",{"data-test":l["data-test"],value:be,ref:Oe,onFocus:e=>Le(e),onBlur:e=>Be(e),onClick:e=>Ce(l.onClick),placeholder:A||"Enter here",onChange:Ie,onKeyDown:e=>we(e),maxLength:N>0?N:void 0})]})};return e(x,Object.assign({width:l.width,height:l.height,state:G,type:R,style:null!==(B=null==xe?void 0:xe.RootContainer)&&void 0!==B?B:{}},{children:[e("div",Object.assign({className:"flex-align-center"},{children:[!U&&(!!K||!!ge)&&e(b,Object.assign({invalid:!!ge},{children:[!!ge&&t(m,{width:16,height:16}),ge||K]})),N>0&&"BOTTOM"===se&&e(y,Object.assign({position:"BOTTOM"},{children:[null!==(H=null==Q?void 0:Q.length)&&void 0!==H?H:0,"/",N]}))]})),e(j,Object.assign({variant:q,state:G,width:l.width,isActive:"active"===G||ve,isInvalid:ue,style:null!==(M=null==xe?void 0:xe.InputWrapper)&&void 0!==M?M:{},version:ee,height:l.height},{children:[!!ce&&t(O,Object.assign({variant:q,iconSize:fe,onClick:()=>Ce(null==D?void 0:D.callback),isLeft:!0,style:null!==(E=null==xe?void 0:xe.IconHolder)&&void 0!==E?E:{}},{children:t(ce,{})})),!!$&&t(C,Object.assign({variant:q},{children:$})),"default"===q&&t(T,Object.assign({height:l.height,type:l.type,minHeight:le,maxHeight:re,autoGrow:ne},{children:He()})),"small"===q&&t(w,Object.assign({height:l.height,type:l.type},{children:He()})),!!he&&t(O,Object.assign({variant:q,iconSize:fe,onClick:()=>Ce(null==F?void 0:F.callback),isLeft:!1},{children:t(he,{})})),!!W&&t(k,Object.assign({variant:q},{children:W})),V&&V.text&&t(c,{buttonText:V.text,onClick:()=>Ce(null==V?void 0:V.onClick)})]})),(!!P||!!N)&&e(I,Object.assign({invalid:ue},{children:[ie&&ie,e("div",Object.assign({className:"label__container"},{children:[e(oe?v:p,{children:[P,S?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:ue?g.content.negative:g.content.primary})})}))]})),N>0&&"TOP"===se&&e(y,{children:[console.log(Q,{props:l}),null!==(z=null==Q?void 0:Q.length)&&void 0!==z?z:0,"/",N]})]}))]}))}));L.displayName="Input";export{L as Input};
1
+ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import i 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 u,validateInput as h}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;const{placeholder:D,leftIcon:F,rightIcon:P,labelText:N,maxCharLimit:S,isRequired:K,hintText:R,type:G,state:_,validate:q,variant:V,button:W,suffixText:$,prefixText:J,onChangeText:Q,value:U,noErrorHint:X,reset:Y,rangeValidation:Z,noKeyDownChange:ee,version:te,noMaxCharCheck:ne,labelElement:ie,autoGrow:le,minHeight:re,maxHeight:oe,labelTextBold:ae,truncateText:se,maxCharLimitPosition:ce}=Object.assign({maxCharLimit:0,type:"text",variant:"default",maxCharLimitPosition:"TOP"},l),ue=null==F?void 0:F.icon,he=null==P?void 0:P.icon,[de,ve]=r(!1),[pe,ge]=r(!1),[me,fe]=r(),xe="small"===V?"18px":"22px",be=o(f),[ye,je]=r(),Oe=a(null),Ce=null!=L?L:Oe;s((()=>{je(U),!U&&le&&(Ce.current.style.height=re||"48px")}),[U]),s((()=>{var e;Ce.current&&(null===(e=l.onReferenceInit)||void 0===e||e.call(l,Ce.current))}),[Ce]),s((()=>{const e=Ce.current;if(e&&["phonenumber","zip","number"].includes(G))return e.addEventListener("wheel",Ie,{passive:!1}),()=>{e.removeEventListener("wheel",Ie)}}),[]),s((()=>{Y&&je("")}),[Y]),s((()=>{var e;ge(!!l.isActive),l.isActive&&(null===(e=Ce.current)||void 0===e||e.focus())}),[l.isActive]),s((()=>{fe(l.errorMessage)}),[l.errorMessage]),s((()=>{var e;ve(!1),("invalid"===l.state||me||"disabled-invalid"===l.state)&&ve(!0),"active"===l.state&&(null===(e=Ce.current)||void 0===e||e.focus())}),[l.state,me]),s((()=>{ve(!!me||"invalid"===l.state)}),[me,l.state]);const Te=function(e){if(u(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)}},we=()=>"zip"===G?6:2e3,ke=e=>{const t=0!==S?S:we();if(ee||Q(U||"",e),ne)return;const n=e.target.value;![8].includes(e.which)&&t>0&&n.length>=t&&e.preventDefault()},Ie=e=>{e.preventDefault()},Le=e=>{let t=e.target.value;const n=0!==S?S+1:we();!ne&&n>0&&t.length>=n&&(t=t.substring(0,n-1)),Q(t,e),l.textControl||je(t),le&&(Ce.current.style.height=`${Ce.current.scrollHeight}px`,t||(Ce.current.style.height=re||"48px"));const i=q||h;if(!i||!u(i))return;const[r,o]=i(t,G,Z);ve(!r),fe(l.errorMessage?l.errorMessage:o)},Be=e=>{var t;l.skipFocus||ge(!0),Te(null===(t=l.onFocus)||void 0===t?void 0:t.call(l,e))},He=e=>{var t;l.skipFocus||ge(!1),Te(null===(t=l.onBlur)||void 0===t?void 0:t.call(l,e))},Me=()=>{var i;return e(n,{children:["multiline"!==G&&t("input",{className:se?"truncate-class":"","data-test":l["data-test"],id:l.id,style:null!==(i=null==be?void 0:be.input)&&void 0!==i?i:{},ref:Ce,type:["phonenumber","zip","number"].includes(G)?"number":G,value:ye,onFocus:e=>Be(e),onBlur:e=>He(e),placeholder:D||"Enter here",onChange:Le,onClick:e=>Te(l.onClick),onKeyDown:e=>ke(e)}),"multiline"===G&&t("textarea",{"data-test":l["data-test"],value:ye,ref:Ce,onFocus:e=>Be(e),onBlur:e=>He(e),onClick:e=>Te(l.onClick),placeholder:D||"Enter here",onChange:Le,onKeyDown:e=>ke(e),maxLength:S>0?S:void 0})]})};return e(x,Object.assign({width:l.width,height:l.height,state:_,type:G,style:null!==(B=null==be?void 0:be.RootContainer)&&void 0!==B?B:{}},{children:[e("div",Object.assign({className:"flex-align-center"},{children:[!X&&(!!R||!!me)&&e(b,Object.assign({invalid:!!me},{children:[!!me&&t(m,{width:16,height:16}),me||R]})),S>0&&"BOTTOM"===ce&&e(y,Object.assign({position:"BOTTOM"},{children:[null!==(H=null==U?void 0:U.length)&&void 0!==H?H:0,"/",S]}))]})),e(j,Object.assign({variant:V,state:_,width:l.width,isActive:"active"===_||pe,isInvalid:de,style:null!==(M=null==be?void 0:be.InputWrapper)&&void 0!==M?M:{},version:te,height:l.height},{children:[!!ue&&t(O,Object.assign({variant:V,iconSize:xe,onClick:()=>Te(null==F?void 0:F.callback),isLeft:!0,style:null!==(E=null==be?void 0:be.IconHolder)&&void 0!==E?E:{}},{children:t(ue,{})})),!!J&&t(C,Object.assign({variant:V},{children:J})),"default"===V&&t(T,Object.assign({height:l.height,type:l.type,minHeight:re,maxHeight:oe,autoGrow:le},{children:Me()})),"small"===V&&t(w,Object.assign({height:l.height,type:l.type},{children:Me()})),!!he&&t(O,Object.assign({variant:V,iconSize:xe,onClick:()=>Te(null==P?void 0:P.callback),isLeft:!1},{children:t(he,{})})),!!$&&t(k,Object.assign({variant:V},{children:$})),W&&W.text&&t(c,{buttonText:W.text,onClick:()=>Te(null==W?void 0:W.onClick)})]})),(!!N||!!S)&&e(I,Object.assign({invalid:de},{children:[ie&&ie,e("div",Object.assign({className:"label__container"},{children:[e(ae?v:p,{children:[N,K?t("span",{children:"*"}):""]}),l.tooltipText&&t(d,Object.assign({body:l.tooltipText,placement:"top"},{children:t("span",{children:t(i,{style:{marginTop:-3},width:18,height:18,color:de?g.content.negative:g.content.primary})})}))]})),S>0&&"TOP"===ce&&e(y,{children:[console.log(U,{props:l},null==U?void 0:U.length,null===(z=null==l?void 0:l.value)||void 0===z?void 0:z.length),null!==(A=null==U?void 0:U.length)&&void 0!==A?A:0,"/",S]})]}))]}))}));L.displayName="Input";export{L as Input};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.573-1",
3
+ "version": "0.0.573-2",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",