@bikdotai/bik-component-library 0.0.324 → 0.0.325

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