@bikdotai/bik-component-library 0.0.169 → 0.0.170

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("react"),n=require("../button/Button.js"),i=require("./Input-helper.js"),r=require("../TypographyStyle.js"),l=require("../../assets/icons/errorInfo.svg.js"),s=require("./context/InputStyleProvider.js"),a=require("./Input.styled.js");const o=o=>{var u,c,d,v;const{placeholder:h,leftIcon:x,rightIcon:p,labelText:f,maxCharLimit:j,isRequired:g,hintText:y,type:I,state:b,validate:C,variant:m,button:S,suffixText:E,prefixText:O,onChangeText:q,value:w,noErrorHint:F,reset:H,rangeValidation:T}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},o),k=null==x?void 0:x.icon,B=null==p?void 0:p.icon,[A,R]=t.useState(!1),[z,L]=t.useState(!1),[M,D]=t.useState(),P="small"===m?"18px":"22px",K=t.useContext(s.InputStyleContext),[W,_]=t.useState(),N=t.useRef();t.useEffect((()=>{_(w)}),[w]),t.useEffect((()=>{var e;N.current&&(null===(e=o.onReferenceInit)||void 0===e||e.call(o,N.current))}),[N]),t.useEffect((()=>{H&&_("")}),[H]),t.useEffect((()=>{var e;L(!!o.isActive),o.isActive&&(null===(e=N.current)||void 0===e||e.focus())}),[o.isActive]),t.useEffect((()=>{D(o.errorMessage)}),[o.errorMessage]),t.useEffect((()=>{var e;R(!1),("invalid"===o.state||M)&&R(!0),"active"===o.state&&(null===(e=N.current)||void 0===e||e.focus())}),[o.state,M]),t.useEffect((()=>{R(!!M)}),[M]);const V=function(e){if(i.isFunction(e)){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e(...n)}},G=e=>{const t=j||("zip"===I?6:60);q(w||"",e),![8].includes(e.which)&&t>0&&e.target.value.length===t&&e.preventDefault()},J=e=>{const t=e.target.value;q(t,e),_(t);const n=C||i.validateInput;if(!n||!i.isFunction(n))return;const[r,l]=n(t,I,T);R(!r),D(l)},Q=()=>{var t;return e.jsxs(e.Fragment,{children:["multiline"!==I&&e.jsx("input",{id:o.id,style:null!==(t=null==K?void 0:K.input)&&void 0!==t?t:{},ref:N,type:["phonenumber","zip","number"].includes(I)?"number":I,value:W,onFocus:()=>(L(!0),void V(o.onFocus)),onBlur:e=>(e=>{var t;L(!1),V(null===(t=o.onBlur)||void 0===t?void 0:t.call(o,e))})(e),placeholder:h||"Enter here",onChange:J,onKeyDown:e=>G(e)}),"multiline"===I&&e.jsx("textarea",{value:W,ref:N,onFocus:()=>L(!0),onBlur:()=>L(!1),placeholder:h||"Enter here",onChange:J,onKeyDown:e=>G(e)})]})};return e.jsxs(a.RootContainer,Object.assign({width:o.width,height:o.height,state:b,type:I,style:null!==(u=null==K?void 0:K.RootContainer)&&void 0!==u?u:{}},{children:[!F&&(!!y||!!M)&&e.jsxs(a.InputFooter,Object.assign({invalid:!!M},{children:[!!M&&e.jsx(l.default,{width:16,height:16}),M||y]})),e.jsxs(a.InputWrapper,Object.assign({variant:m,state:b,width:o.width,isActive:"active"===b||z,isInvalid:A,style:null!==(c=null==K?void 0:K.InputWrapper)&&void 0!==c?c:{}},{children:[!!k&&e.jsx(a.IconHolder,Object.assign({variant:m,iconSize:P,onClick:()=>V(null==x?void 0:x.callback),isLeft:!0,style:null!==(d=null==K?void 0:K.IconHolder)&&void 0!==d?d:{}},{children:e.jsx(k,{})})),!!O&&e.jsx(a.PrefixHolder,Object.assign({variant:m},{children:O})),"default"===m&&e.jsx(a.InputContainer,{children:Q()}),"small"===m&&e.jsx(a.InputContainerSmall,{children:Q()}),!!B&&e.jsx(a.IconHolder,Object.assign({variant:m,iconSize:P,onClick:()=>V(null==p?void 0:p.callback),isLeft:!1},{children:e.jsx(B,{})})),!!E&&e.jsx(a.SuffixHolder,Object.assign({variant:m},{children:E})),S&&S.text&&e.jsx(n.Button,{buttonText:S.text,onClick:()=>V(null==S?void 0:S.onClick)})]})),(!!f||!!j)&&e.jsxs(a.InputHeader,Object.assign({invalid:A},{children:[e.jsxs(r.BodySecondary,{children:[f,g?e.jsx("span",{children:"*"}):""]}),j>0&&e.jsxs(a.MaxCharStyle,{children:[null===(v=o.value)||void 0===v?void 0:v.length,"/",j]})]}))]}))};o.displayName="Input",exports.Input=o;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../button/Button.js"),i=require("./Input-helper.js"),r=require("../TypographyStyle.js"),l=require("../../assets/icons/errorInfo.svg.js"),s=require("./context/InputStyleProvider.js"),a=require("./Input.styled.js");const o=o=>{var u,c,d,v,h;const{placeholder:x,leftIcon:p,rightIcon:f,labelText:j,maxCharLimit:g,isRequired:y,hintText:I,type:b,state:C,validate:m,variant:S,button:E,suffixText:O,prefixText:q,onChangeText:w,value:F,noErrorHint:H,reset:T,rangeValidation:k}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},o),B=null==p?void 0:p.icon,A=null==f?void 0:f.icon,[R,z]=t.useState(!1),[L,M]=t.useState(!1),[D,P]=t.useState(),K="small"===S?"18px":"22px",W=t.useContext(s.InputStyleContext),[_,N]=t.useState(),V=t.useRef();t.useEffect((()=>{N(F)}),[F]),t.useEffect((()=>{var e;V.current&&(null===(e=o.onReferenceInit)||void 0===e||e.call(o,V.current))}),[V]),t.useEffect((()=>{T&&N("")}),[T]),t.useEffect((()=>{var e;M(!!o.isActive),o.isActive&&(null===(e=V.current)||void 0===e||e.focus())}),[o.isActive]),t.useEffect((()=>{P(o.errorMessage)}),[o.errorMessage]),t.useEffect((()=>{var e;z(!1),("invalid"===o.state||D)&&z(!0),"active"===o.state&&(null===(e=V.current)||void 0===e||e.focus())}),[o.state,D]),t.useEffect((()=>{z(!!D)}),[D]);const G=function(e){if(i.isFunction(e)){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];e(...n)}},J=e=>{const t=g||("zip"===b?6:60);w(F||"",e),![8].includes(e.which)&&t>0&&e.target.value.length===t&&e.preventDefault()},Q=e=>{const t=e.target.value;w(t,e),N(t);const n=m||i.validateInput;if(!n||!i.isFunction(n))return;const[r,l]=n(t,b,k);z(!r),P(l)},U=()=>{var t;return e.jsxs(e.Fragment,{children:["multiline"!==b&&e.jsx("input",{id:o.id,style:null!==(t=null==W?void 0:W.input)&&void 0!==t?t:{},ref:V,type:["phonenumber","zip","number"].includes(b)?"number":b,value:_,onFocus:()=>(M(!0),void G(o.onFocus)),onBlur:e=>(e=>{var t;M(!1),G(null===(t=o.onBlur)||void 0===t?void 0:t.call(o,e))})(e),placeholder:x||"Enter here",onChange:Q,onKeyDown:e=>J(e)}),"multiline"===b&&e.jsx("textarea",{value:_,ref:V,onFocus:()=>M(!0),onBlur:()=>M(!1),placeholder:x||"Enter here",onChange:Q,onKeyDown:e=>J(e)})]})};return e.jsxs(a.RootContainer,Object.assign({width:o.width,height:o.height,state:C,type:b,style:null!==(u=null==W?void 0:W.RootContainer)&&void 0!==u?u:{}},{children:[!H&&(!!I||!!D)&&e.jsxs(a.InputFooter,Object.assign({invalid:!!D},{children:[!!D&&e.jsx(l.default,{width:16,height:16}),D||I]})),e.jsxs(a.InputWrapper,Object.assign({variant:S,state:C,width:o.width,isActive:"active"===C||L,isInvalid:R,style:null!==(c=null==W?void 0:W.InputWrapper)&&void 0!==c?c:{}},{children:[!!B&&e.jsx(a.IconHolder,Object.assign({variant:S,iconSize:K,onClick:()=>G(null==p?void 0:p.callback),isLeft:!0,style:null!==(d=null==W?void 0:W.IconHolder)&&void 0!==d?d:{}},{children:e.jsx(B,{})})),!!q&&e.jsx(a.PrefixHolder,Object.assign({variant:S},{children:q})),"default"===S&&e.jsx(a.InputContainer,{children:U()}),"small"===S&&e.jsx(a.InputContainerSmall,{children:U()}),!!A&&e.jsx(a.IconHolder,Object.assign({variant:S,iconSize:K,onClick:()=>G(null==f?void 0:f.callback),isLeft:!1},{children:e.jsx(A,{})})),!!O&&e.jsx(a.SuffixHolder,Object.assign({variant:S},{children:O})),E&&E.text&&e.jsx(n.Button,{buttonText:E.text,onClick:()=>G(null==E?void 0:E.onClick)})]})),(!!j||!!g)&&e.jsxs(a.InputHeader,Object.assign({invalid:R},{children:[e.jsxs(r.BodySecondary,{children:[j,y?e.jsx("span",{children:"*"}):""]}),g>0&&e.jsxs(a.MaxCharStyle,{children:[null!==(h=null===(v=o.value)||void 0===v?void 0:v.length)&&void 0!==h?h:0,"/",g]})]}))]}))};o.displayName="Input",exports.Input=o;
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useState as i,useContext as l,useRef as r,useEffect as o}from"react";import{Button as a}from"../button/Button.js";import{isFunction as c,validateInput as s}from"./Input-helper.js";import{BodySecondary as u}from"../TypographyStyle.js";import d from"../../assets/icons/errorInfo.svg.js";import{InputStyleContext as v}from"./context/InputStyleProvider.js";import{RootContainer as h,InputFooter as p,InputWrapper as m,IconHolder as f,PrefixHolder as g,InputContainer as x,InputContainerSmall as b,SuffixHolder as y,InputHeader as j,MaxCharStyle as I}from"./Input.styled.js";const C=C=>{var w,O,T,k;const{placeholder:A,leftIcon:z,rightIcon:B,labelText:L,maxCharLimit:S,isRequired:D,hintText:E,type:F,state:R,validate:H,variant:K,button:M,suffixText:q,prefixText:N,onChangeText:P,value:V,noErrorHint:W,reset:G,rangeValidation:J}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},C),Q=null==z?void 0:z.icon,U=null==B?void 0:B.icon,[X,Y]=i(!1),[Z,$]=i(!1),[_,ee]=i(),te="small"===K?"18px":"22px",ne=l(v),[ie,le]=i(),re=r();o((()=>{le(V)}),[V]),o((()=>{var e;re.current&&(null===(e=C.onReferenceInit)||void 0===e||e.call(C,re.current))}),[re]),o((()=>{G&&le("")}),[G]),o((()=>{var e;$(!!C.isActive),C.isActive&&(null===(e=re.current)||void 0===e||e.focus())}),[C.isActive]),o((()=>{ee(C.errorMessage)}),[C.errorMessage]),o((()=>{var e;Y(!1),("invalid"===C.state||_)&&Y(!0),"active"===C.state&&(null===(e=re.current)||void 0===e||e.focus())}),[C.state,_]),o((()=>{Y(!!_)}),[_]);const oe=function(e){if(c(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)}},ae=e=>{const t=S||("zip"===F?6:60);P(V||"",e),![8].includes(e.which)&&t>0&&e.target.value.length===t&&e.preventDefault()},ce=e=>{const t=e.target.value;P(t,e),le(t);const n=H||s;if(!n||!c(n))return;const[i,l]=n(t,F,J);Y(!i),ee(l)},se=()=>{var i;return e(n,{children:["multiline"!==F&&t("input",{id:C.id,style:null!==(i=null==ne?void 0:ne.input)&&void 0!==i?i:{},ref:re,type:["phonenumber","zip","number"].includes(F)?"number":F,value:ie,onFocus:()=>($(!0),void oe(C.onFocus)),onBlur:e=>(e=>{var t;$(!1),oe(null===(t=C.onBlur)||void 0===t?void 0:t.call(C,e))})(e),placeholder:A||"Enter here",onChange:ce,onKeyDown:e=>ae(e)}),"multiline"===F&&t("textarea",{value:ie,ref:re,onFocus:()=>$(!0),onBlur:()=>$(!1),placeholder:A||"Enter here",onChange:ce,onKeyDown:e=>ae(e)})]})};return e(h,Object.assign({width:C.width,height:C.height,state:R,type:F,style:null!==(w=null==ne?void 0:ne.RootContainer)&&void 0!==w?w:{}},{children:[!W&&(!!E||!!_)&&e(p,Object.assign({invalid:!!_},{children:[!!_&&t(d,{width:16,height:16}),_||E]})),e(m,Object.assign({variant:K,state:R,width:C.width,isActive:"active"===R||Z,isInvalid:X,style:null!==(O=null==ne?void 0:ne.InputWrapper)&&void 0!==O?O:{}},{children:[!!Q&&t(f,Object.assign({variant:K,iconSize:te,onClick:()=>oe(null==z?void 0:z.callback),isLeft:!0,style:null!==(T=null==ne?void 0:ne.IconHolder)&&void 0!==T?T:{}},{children:t(Q,{})})),!!N&&t(g,Object.assign({variant:K},{children:N})),"default"===K&&t(x,{children:se()}),"small"===K&&t(b,{children:se()}),!!U&&t(f,Object.assign({variant:K,iconSize:te,onClick:()=>oe(null==B?void 0:B.callback),isLeft:!1},{children:t(U,{})})),!!q&&t(y,Object.assign({variant:K},{children:q})),M&&M.text&&t(a,{buttonText:M.text,onClick:()=>oe(null==M?void 0:M.onClick)})]})),(!!L||!!S)&&e(j,Object.assign({invalid:X},{children:[e(u,{children:[L,D?t("span",{children:"*"}):""]}),S>0&&e(I,{children:[null===(k=C.value)||void 0===k?void 0:k.length,"/",S]})]}))]}))};C.displayName="Input";export{C as Input};
1
+ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useState as i,useContext as l,useRef as r,useEffect as o}from"react";import{Button as a}from"../button/Button.js";import{isFunction as c,validateInput as s}from"./Input-helper.js";import{BodySecondary as u}from"../TypographyStyle.js";import d from"../../assets/icons/errorInfo.svg.js";import{InputStyleContext as v}from"./context/InputStyleProvider.js";import{RootContainer as h,InputFooter as p,InputWrapper as m,IconHolder as f,PrefixHolder as g,InputContainer as x,InputContainerSmall as b,SuffixHolder as y,InputHeader as j,MaxCharStyle as I}from"./Input.styled.js";const C=C=>{var w,O,T,k,A;const{placeholder:z,leftIcon:B,rightIcon:L,labelText:S,maxCharLimit:D,isRequired:E,hintText:F,type:R,state:H,validate:K,variant:M,button:q,suffixText:N,prefixText:P,onChangeText:V,value:W,noErrorHint:G,reset:J,rangeValidation:Q}=Object.assign({maxCharLimit:0,type:"text",variant:"default"},C),U=null==B?void 0:B.icon,X=null==L?void 0:L.icon,[Y,Z]=i(!1),[$,_]=i(!1),[ee,te]=i(),ne="small"===M?"18px":"22px",ie=l(v),[le,re]=i(),oe=r();o((()=>{re(W)}),[W]),o((()=>{var e;oe.current&&(null===(e=C.onReferenceInit)||void 0===e||e.call(C,oe.current))}),[oe]),o((()=>{J&&re("")}),[J]),o((()=>{var e;_(!!C.isActive),C.isActive&&(null===(e=oe.current)||void 0===e||e.focus())}),[C.isActive]),o((()=>{te(C.errorMessage)}),[C.errorMessage]),o((()=>{var e;Z(!1),("invalid"===C.state||ee)&&Z(!0),"active"===C.state&&(null===(e=oe.current)||void 0===e||e.focus())}),[C.state,ee]),o((()=>{Z(!!ee)}),[ee]);const ae=function(e){if(c(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=e=>{const t=D||("zip"===R?6:60);V(W||"",e),![8].includes(e.which)&&t>0&&e.target.value.length===t&&e.preventDefault()},se=e=>{const t=e.target.value;V(t,e),re(t);const n=K||s;if(!n||!c(n))return;const[i,l]=n(t,R,Q);Z(!i),te(l)},ue=()=>{var i;return e(n,{children:["multiline"!==R&&t("input",{id:C.id,style:null!==(i=null==ie?void 0:ie.input)&&void 0!==i?i:{},ref:oe,type:["phonenumber","zip","number"].includes(R)?"number":R,value:le,onFocus:()=>(_(!0),void ae(C.onFocus)),onBlur:e=>(e=>{var t;_(!1),ae(null===(t=C.onBlur)||void 0===t?void 0:t.call(C,e))})(e),placeholder:z||"Enter here",onChange:se,onKeyDown:e=>ce(e)}),"multiline"===R&&t("textarea",{value:le,ref:oe,onFocus:()=>_(!0),onBlur:()=>_(!1),placeholder:z||"Enter here",onChange:se,onKeyDown:e=>ce(e)})]})};return e(h,Object.assign({width:C.width,height:C.height,state:H,type:R,style:null!==(w=null==ie?void 0:ie.RootContainer)&&void 0!==w?w:{}},{children:[!G&&(!!F||!!ee)&&e(p,Object.assign({invalid:!!ee},{children:[!!ee&&t(d,{width:16,height:16}),ee||F]})),e(m,Object.assign({variant:M,state:H,width:C.width,isActive:"active"===H||$,isInvalid:Y,style:null!==(O=null==ie?void 0:ie.InputWrapper)&&void 0!==O?O:{}},{children:[!!U&&t(f,Object.assign({variant:M,iconSize:ne,onClick:()=>ae(null==B?void 0:B.callback),isLeft:!0,style:null!==(T=null==ie?void 0:ie.IconHolder)&&void 0!==T?T:{}},{children:t(U,{})})),!!P&&t(g,Object.assign({variant:M},{children:P})),"default"===M&&t(x,{children:ue()}),"small"===M&&t(b,{children:ue()}),!!X&&t(f,Object.assign({variant:M,iconSize:ne,onClick:()=>ae(null==L?void 0:L.callback),isLeft:!1},{children:t(X,{})})),!!N&&t(y,Object.assign({variant:M},{children:N})),q&&q.text&&t(a,{buttonText:q.text,onClick:()=>ae(null==q?void 0:q.onClick)})]})),(!!S||!!D)&&e(j,Object.assign({invalid:Y},{children:[e(u,{children:[S,E?t("span",{children:"*"}):""]}),D>0&&e(I,{children:[null!==(A=null===(k=C.value)||void 0===k?void 0:k.length)&&void 0!==A?A:0,"/",D]})]}))]}))};C.displayName="Input";export{C as Input};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.169",
3
+ "version": "0.0.170",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",