@bikdotai/bik-component-library 0.0.679-5 → 0.0.679-7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.d.ts +1 -0
- package/dist/cjs/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.js +1 -1
- package/dist/cjs/components/input/Input.d.ts +1 -0
- package/dist/cjs/components/input/Input.js +1 -1
- package/dist/cjs/components/zeroState/ZeroState.d.ts +1 -0
- package/dist/cjs/components/zeroState/ZeroState.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/OpennedDropdown.js +1 -1
- package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.d.ts +1 -0
- package/dist/esm/components/dropdown/OpenedDropdown/components/searchbox/SearchZeroState.js +1 -1
- package/dist/esm/components/input/Input.d.ts +1 -0
- package/dist/esm/components/input/Input.js +1 -1
- package/dist/esm/components/zeroState/ZeroState.d.ts +1 -0
- package/dist/esm/components/zeroState/ZeroState.js +5 -5
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../../../zeroState/ZeroState.js"),r=require("../../../../hooks/useOutside.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../../../zeroState/ZeroState.js"),r=require("../../../../hooks/useOutside.js"),o=require("../../hooks/useDropdown.js"),s=require("./description/Description.js"),i=require("./menu/FreeFormMenu.js"),l=require("./menu/MenuList.js"),u=require("./menu/SelectAllMenu.js"),a=require("./multiSelect/MultiSelectDropdownBottomBar.js"),c=require("./OpennedDropdown.styled.js"),d=require("./searchbox/SearchBox.js"),p=require("./searchbox/SearchZeroState.js");const h=304,S=290;exports.OpenedDropdown=f=>{let{options:j,isSearchable:x,isMultiSelect:g,width:b,allowFreeForm:v,height:w,onClose:O,onSelect:m,onSearch:y,version:C,skipSorting:D,headerRef:M,hideSelectAll:q,primaryButtonText:L,onInfiniteScroll:F,onMultiSelectClear:k,onDropdownItemClick:A,buttonOptions:B,isSearchLoading:I,disableSearchOptions:H,disableSearchedOptionExcept:R,useDefaultCursor:T,containerStyle:Z={},zeroState:z}=f;const{dropdownOptions:E,search:P,searchedString:W,searchedOptions:_,onApplyHandler:K,selectAllHandler:N,onMultiSelectClear:G,onFreeFormSelect:J,onMultiSelectApply:Q,latestDropdownOptionsRef:U,getSelectedOptions:V}=o.useDropdown(C,j,m,D,g,y,H,R),[X,Y]=t.useState(null!=b?b:S),[$,ee]=t.useState(null),te=t.useRef(null),ne=t.useRef([]);r.useOutside(te,(()=>{if(ee(null),g&&"2.0"===C){const e=V(U.current);null==O||O(e)}else null==O||O(E)}),[M,ne]);const re=null!=w?w:h,oe="number"==typeof re?x&&g?re-96:x&&!g||!x&&g?re-48:re:re;t.useEffect((()=>{const e=null!=b?b:S;if(null===$)Y(e);else if("number"==typeof e)Y(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));Y(t)}}),[$]);const se=[],ie=(W&&y?_:E).map((e=>{var t,n;if(W&&!y){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(W.toLowerCase()))&&(se.push(!W||e.label===W),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(W.toLowerCase()))||(null===(n=e.searchKey)||void 0===n?void 0:n.toLowerCase().includes(W.toLowerCase()))?(se.push(!W||e.label===W),e):null}return e})).filter((e=>null!==e)),le=!!x&&W&&0===ie.length;return e.jsxs(c.OpennedDropdownContainer,Object.assign({version:C,ref:te,style:Object.assign({width:X},Z)},{children:[e.jsxs("div",Object.assign({style:{width:$?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!x&&e.jsx(d.SearchBox,{onSearch:P,version:C}),ie.length||W?e.jsxs(c.MenuListContainer,Object.assign({minHeight:re,maxHeight:oe},{children:[!!g&&!le&&!q&&e.jsx(u.SelectAllMenu,{version:C,options:W&&y?_:E,onSelect:N}),!v&&le&&e.jsx(p.SearchZeroState,{isLoading:I,height:oe,searchedString:W,containerWidth:b}),v&&(le||!!se.length&&se.every((e=>!1===e)))&&e.jsx(i.FreeFormMenu,{version:C,isMultiSelect:g,onSelect:J,searchedString:W}),e.jsx(l.MenuList,{onInfiniteScroll:F,onDropdownItemClick:A,version:C,onSelect:K,showDescription:function(e,t){ee(e&&t?{title:e,description:t}:null)},isMultiSelect:g,options:ie,useDefaultCursor:T,ref:ne})]})):e.jsx("div",Object.assign({style:{height:re,display:"flex"}},{children:e.jsx(n.ZeroState,Object.assign({},z,{title:(null==z?void 0:z.title)||"No results found",subTitle:(null==z?void 0:z.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance."}))})),!!g&&!(!ie.length&&!W)&&"2.0"!==C&&e.jsx(a.default,{onClear:()=>{G(),null==k||k()},onApply:Q,list:W&&y?_:E,buttonText:L,buttonOptions:B})]})),!!$&&e.jsx(s.Description,{title:$.title,description:$.description,version:C})]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../../zeroState/ZeroState.js");exports.SearchZeroState=r=>{let{searchedString:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../../zeroState/ZeroState.js");exports.SearchZeroState=r=>{let{searchedString:i,height:s,isLoading:n,containerWidth:o}=r;return e.jsx("div",Object.assign({style:{height:s,display:"flex",alignItems:"center"}},{children:e.jsx(t.ZeroState,{isLoading:n,title:"No results found",subTitle:`Sorry we could not find any results for "${null!=i?i:""}"`,containerWidth:o})}))};
|
|
@@ -67,5 +67,6 @@ export interface InputProps {
|
|
|
67
67
|
hideInputHeader?: boolean;
|
|
68
68
|
hideBorder?: boolean;
|
|
69
69
|
inputWrapperStyles?: React.CSSProperties;
|
|
70
|
+
minCharLimit?: number;
|
|
70
71
|
}
|
|
71
72
|
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("../../assets/icons/info.svg.js"),n=require("react"),i=require("../button/Button.js"),
|
|
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"),l=require("./Input-helper.js"),s=require("../tooltips/Tooltip.js"),r=require("../TypographyStyle.js"),a=require("../../constants/Theme.js"),o=require("../../assets/icons/errorInfo.svg.js"),u=require("./context/InputStyleProvider.js"),c=require("./Input.styled.js");const d=n.forwardRef(((d,h)=>{var v,p,x,g,j,f,m,b;const{placeholder:y,leftIcon:C,rightIcon:O,labelText:I,maxCharLimit:T,isRequired:S,hintText:w,type:E,state:k,validate:H,variant:L,button:q,suffixText:B,prefixText:M,onChangeText:F,value:P,noErrorHint:R,reset:D,rangeValidation:z,noKeyDownChange:A,version:K,noMaxCharCheck:N,labelElement:_,autoGrow:W,minHeight:G,maxHeight:V,labelTextBold:$,truncateText:J,maxCharLimitPosition:Q,hightlightInputColor:U,onKeyDownEvent:X,hideInputHeader:Y,hideBorder:Z,inputWrapperStyles:ee,minCharLimit:te}=Object.assign({maxCharLimit:0,type:"text",variant:"default",maxCharLimitPosition:"TOP",minCharLimit:0},d),ne=null==C?void 0:C.icon,ie=null==O?void 0:O.icon,[le,se]=n.useState(!1),[re,ae]=n.useState(!1),[oe,ue]=n.useState(),ce="x-small"===L?"12px":"small"===L?"18px":"22px",de=n.useContext(u.InputStyleContext),[he,ve]=n.useState(),pe=n.useRef(null),xe=null!=h?h:pe;n.useEffect((()=>{ve(P),!P&&W&&(xe.current.style.height=G||"48px")}),[P]),n.useEffect((()=>{var e;xe.current&&(null===(e=d.onReferenceInit)||void 0===e||e.call(d,xe.current))}),[xe]),n.useEffect((()=>{const e=xe.current;if(e&&["phonenumber","zip","number"].includes(E))return e.addEventListener("wheel",me,{passive:!1}),()=>{e.removeEventListener("wheel",me)}}),[]),n.useEffect((()=>{D&&ve("")}),[D]),n.useEffect((()=>{var e;ae(!!d.isActive),d.isActive&&(null===(e=xe.current)||void 0===e||e.focus())}),[d.isActive]),n.useEffect((()=>{ue(d.errorMessage)}),[d.errorMessage]),n.useEffect((()=>{var e;se(!1),("invalid"===d.state||oe||"disabled-invalid"===d.state)&&se(!0),"active"===d.state&&(null===(e=xe.current)||void 0===e||e.focus())}),[d.state,oe]),n.useEffect((()=>{se(!!oe||"invalid"===d.state)}),[oe,d.state]);const ge=function(e){if(l.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)}},je=()=>"zip"===E?6:2e3,fe=e=>{const t=0!==T?T:je(),n=te,i=e.target.value;X&&(!i.length||i.length>=n)&&X(e),A||i.length&&!(i.length>=n)||F(P||"",e),N||![8].includes(e.which)&&t>0&&i.length>=t&&e.preventDefault()},me=e=>{e.preventDefault()},be=e=>{let t=e.target.value;const n=0!==T?T+1:je(),i=te;if(i&&t&&t.length<i)return;!N&&n>0&&t.length>=n&&(t=t.substring(0,n-1)),F(t,e),d.textControl||ve(t),W&&(xe.current.style.height=`${xe.current.scrollHeight}px`,t||(xe.current.style.height=G||"48px"));const s=H||l.validateInput;if(!s||!l.isFunction(s))return;const[r,a]=s(t,E,z);se(!r),ue(d.errorMessage?d.errorMessage:a)},ye=e=>{var t;d.skipFocus||ae(!0),ge(null===(t=d.onFocus)||void 0===t?void 0:t.call(d,e))},Ce=e=>{var t;d.skipFocus||ae(!1),ge(null===(t=d.onBlur)||void 0===t?void 0:t.call(d,e))},Oe=()=>{var t;return e.jsxs(e.Fragment,{children:["multiline"!==E&&e.jsx("input",{className:J?"truncate-class":"","data-test":d["data-test"],id:d.id,style:null!==(t=null==de?void 0:de.input)&&void 0!==t?t:{},ref:xe,type:["phonenumber","zip","number"].includes(E)?"number":E,value:he,onFocus:e=>ye(e),onBlur:e=>Ce(e),placeholder:y||"Enter here",onChange:be,onClick:e=>ge(d.onClick),onKeyDown:e=>fe(e)}),"multiline"===E&&e.jsx("textarea",{"data-test":d["data-test"],value:he,ref:xe,onFocus:e=>ye(e),onBlur:e=>Ce(e),onClick:e=>ge(d.onClick),placeholder:y||"Enter here",onChange:be,onKeyDown:e=>fe(e),maxLength:T>0?T:void 0})]})};return e.jsxs(c.RootContainer,Object.assign({width:d.width,height:d.height,state:k,type:E,style:null!==(v=null==de?void 0:de.RootContainer)&&void 0!==v?v:{}},{children:[e.jsxs("div",Object.assign({className:"flex-align-center"},{children:[!R&&(!!w||!!oe)&&e.jsxs(c.InputFooter,Object.assign({invalid:!!oe},{children:[!!oe&&e.jsx(o.default,{width:16,height:16}),oe||w]})),T>0&&"BOTTOM"===Q&&e.jsxs(c.MaxCharStyle,Object.assign({position:"BOTTOM"},{children:[null!==(x=null===(p=(null!=P?P:"").toString())||void 0===p?void 0:p.length)&&void 0!==x?x:0,"/",T]}))]})),e.jsxs(c.InputWrapper,Object.assign({variant:L,state:k,width:d.width,isActive:"active"===k||re,isInvalid:le,style:null!==(j=null!==(g=null==de?void 0:de.InputWrapper)&&void 0!==g?g:ee)&&void 0!==j?j:{},version:K,height:d.height,hightlightInputColor:U,hideBorder:Z},{children:[!!ne&&e.jsx(c.IconHolder,Object.assign({variant:L,iconSize:ce,onClick:()=>ge(null==C?void 0:C.callback),isLeft:!0,style:null!==(f=null==de?void 0:de.IconHolder)&&void 0!==f?f:{}},{children:e.jsx(ne,{})})),!!M&&e.jsx(c.PrefixHolder,Object.assign({variant:L},{children:M})),"default"===L&&e.jsx(c.InputContainer,Object.assign({height:d.height,type:d.type,minHeight:G,maxHeight:V,autoGrow:W},{children:Oe()})),["x-small","small"].includes(L)&&e.jsx(c.InputContainerSmall,Object.assign({height:d.height,type:d.type},{children:Oe()})),!!ie&&e.jsx(c.IconHolder,Object.assign({variant:L,iconSize:ce,onClick:()=>ge(null==O?void 0:O.callback),isLeft:!1},{children:e.jsx(ie,{})})),!!B&&e.jsx(c.SuffixHolder,Object.assign({variant:L},{children:B})),q&&q.text&&e.jsx(i.Button,{buttonText:q.text,onClick:()=>ge(null==q?void 0:q.onClick)}),q&&q.buttonProps&&e.jsx(i.Button,Object.assign({},q.buttonProps))]})),!Y&&(!!I||!!T)&&e.jsxs(c.InputHeader,Object.assign({invalid:le},{children:[_&&_,e.jsxs("div",Object.assign({className:"label__container"},{children:[$?e.jsxs(r.TitleSmall,{children:[I,S?e.jsx("span",{children:"*"}):""]}):e.jsxs(r.BodySecondary,{children:[I,S?e.jsx("span",{children:"*"}):""]}),d.tooltipText&&e.jsx(s.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:le?a.COLORS.content.negative:a.COLORS.content.primary})})}))]})),T>0&&"TOP"===Q&&e.jsxs(c.MaxCharStyle,{children:[null!==(b=null===(m=(null!=P?P:"").toString())||void 0===m?void 0:m.length)&&void 0!==b?b:0,"/",T]})]}))]}))}));d.displayName="Input",exports.Input=d;
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
align-items: center;
|
|
15
15
|
justify-content: center;
|
|
16
16
|
border-radius: 24px;
|
|
17
|
-
`;exports.ZeroState=n=>{var{subTitle:a,title:c,IconHolderStyle:j,style:g,isLoading:y}=n,x=e.__rest(n,["subTitle","title","IconHolderStyle","style","isLoading"]);return t.jsxs(d,Object.assign({style:null!=g?g:{}},{children:[y?t.jsx(i.Spinner,{size:"large",color:s.COLORS.stroke.brand}):t.jsx(u,Object.assign({style:null!=j?j:{}},{children:(null==x?void 0:x.Icon)||t.jsx(l.default,{color:s.COLORS.content.placeholder,height:24,width:24})})),t.jsx(
|
|
17
|
+
`;exports.ZeroState=n=>{var{subTitle:a,title:c,IconHolderStyle:j,style:g,isLoading:y,containerWidth:p}=n,x=e.__rest(n,["subTitle","title","IconHolderStyle","style","isLoading","containerWidth"]);let b=r.TitleRegular;const h=p?parseFloat(p):0;return h&&!isNaN(h)&&h<=150&&(b=r.TitleSmall),t.jsxs(d,Object.assign({style:null!=g?g:{}},{children:[y?t.jsx(i.Spinner,{size:"large",color:s.COLORS.stroke.brand}):t.jsx(u,Object.assign({style:null!=j?j:{}},{children:(null==x?void 0:x.Icon)||t.jsx(l.default,{color:s.COLORS.content.placeholder,height:24,width:24})})),t.jsx(b,Object.assign({style:{marginTop:8,color:s.COLORS.content.primary}},{children:y?"Loading...":c||"No results found"})),!!a&&!y&&t.jsx(r.BodyCaption,Object.assign({style:{marginTop:4,color:s.COLORS.content.secondary,textAlign:"center",maxWidth:184}},{children:a})),!!(null==x?void 0:x.actionButton)&&t.jsx("div",Object.assign({style:(null==x?void 0:x.buttonWidth)?{width:null==x?void 0:x.buttonWidth,display:"flex"}:{}},{children:t.jsx(o.Button,Object.assign({},null==x?void 0:x.actionButton))}))]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useRef as n,useEffect as i}from"react";import{ZeroState as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useRef as n,useEffect as i}from"react";import{ZeroState as r}from"../../../zeroState/ZeroState.js";import{useOutside as l}from"../../../../hooks/useOutside.js";import{useDropdown as s}from"../../hooks/useDropdown.js";import{Description as c}from"./description/Description.js";import{FreeFormMenu as a}from"./menu/FreeFormMenu.js";import{MenuList as u}from"./menu/MenuList.js";import{SelectAllMenu as p}from"./menu/SelectAllMenu.js";import d from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as h,MenuListContainer as m}from"./OpennedDropdown.styled.js";import{SearchBox as f}from"./searchbox/SearchBox.js";import{SearchZeroState as S}from"./searchbox/SearchZeroState.js";const g=304,b=290,v=v=>{let{options:j,isSearchable:w,isMultiSelect:y,width:O,allowFreeForm:x,height:C,onClose:D,onSelect:M,onSearch:L,version:k,skipSorting:A,headerRef:F,hideSelectAll:I,primaryButtonText:B,onInfiniteScroll:H,onMultiSelectClear:T,onDropdownItemClick:z,buttonOptions:R,isSearchLoading:W,disableSearchOptions:Z,disableSearchedOptionExcept:q,useDefaultCursor:E,containerStyle:K={},zeroState:N}=v;const{dropdownOptions:P,search:G,searchedString:J,searchedOptions:Q,onApplyHandler:U,selectAllHandler:V,onMultiSelectClear:X,onFreeFormSelect:Y,onMultiSelectApply:$,latestDropdownOptionsRef:_,getSelectedOptions:ee}=s(k,j,M,A,y,L,Z,q),[te,oe]=o(null!=O?O:b),[ne,ie]=o(null),re=n(null),le=n([]);l(re,(()=>{if(ie(null),y&&"2.0"===k){const e=ee(_.current);null==D||D(e)}else null==D||D(P)}),[F,le]);const se=null!=C?C:g,ce="number"==typeof se?w&&y?se-96:w&&!y||!w&&y?se-48:se:se;i((()=>{const e=null!=O?O:b;if(null===ne)oe(e);else if("number"==typeof e)oe(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));oe(t)}}),[ne]);const ae=[],ue=(J&&L?Q:P).map((e=>{var t,o;if(J&&!L){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(J.toLowerCase()))&&(ae.push(!J||e.label===J),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(J.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(J.toLowerCase()))?(ae.push(!J||e.label===J),e):null}return e})).filter((e=>null!==e)),pe=!!w&&J&&0===ue.length;return e(h,Object.assign({version:k,ref:re,style:Object.assign({width:te},K)},{children:[e("div",Object.assign({style:{width:ne?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!w&&t(f,{onSearch:G,version:k}),ue.length||J?e(m,Object.assign({minHeight:se,maxHeight:ce},{children:[!!y&&!pe&&!I&&t(p,{version:k,options:J&&L?Q:P,onSelect:V}),!x&&pe&&t(S,{isLoading:W,height:ce,searchedString:J,containerWidth:O}),x&&(pe||!!ae.length&&ae.every((e=>!1===e)))&&t(a,{version:k,isMultiSelect:y,onSelect:Y,searchedString:J}),t(u,{onInfiniteScroll:H,onDropdownItemClick:z,version:k,onSelect:U,showDescription:function(e,t){ie(e&&t?{title:e,description:t}:null)},isMultiSelect:y,options:ue,useDefaultCursor:E,ref:le})]})):t("div",Object.assign({style:{height:se,display:"flex"}},{children:t(r,Object.assign({},N,{title:(null==N?void 0:N.title)||"No results found",subTitle:(null==N?void 0:N.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance."}))})),!!y&&!(!ue.length&&!J)&&"2.0"!==k&&t(d,{onClear:()=>{X(),null==T||T()},onApply:$,list:J&&L?Q:P,buttonText:B,buttonOptions:R})]})),!!ne&&t(c,{title:ne.title,description:ne.description,version:k})]}))};export{v as OpenedDropdown};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{ZeroState as e}from"../../../../zeroState/ZeroState.js";const i=i=>{let{searchedString:r,height:n,isLoading:o,containerWidth:s}=i;return t("div",Object.assign({style:{height:n,display:"flex",alignItems:"center"}},{children:t(e,{isLoading:o,title:"No results found",subTitle:`Sorry we could not find any results for "${null!=r?r:""}"`,containerWidth:s})}))};export{i as SearchZeroState};
|
|
@@ -67,5 +67,6 @@ export interface InputProps {
|
|
|
67
67
|
hideInputHeader?: boolean;
|
|
68
68
|
hideBorder?: boolean;
|
|
69
69
|
inputWrapperStyles?: React.CSSProperties;
|
|
70
|
+
minCharLimit?: number;
|
|
70
71
|
}
|
|
71
72
|
export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement | HTMLTextAreaElement | null>>;
|
|
@@ -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 x}from"./context/InputStyleProvider.js";import{RootContainer as b,InputFooter as f,MaxCharStyle as y,InputWrapper as j,IconHolder as C,PrefixHolder as O,InputContainer as T,InputContainerSmall as w,SuffixHolder as I,InputHeader as k}from"./Input.styled.js";const
|
|
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 x}from"./context/InputStyleProvider.js";import{RootContainer as b,InputFooter as f,MaxCharStyle as y,InputWrapper as j,IconHolder as C,PrefixHolder as O,InputContainer as T,InputContainerSmall as w,SuffixHolder as I,InputHeader as k}from"./Input.styled.js";const L=l(((l,L)=>{var B,H,E,M,P,S,D,z;const{placeholder:A,leftIcon:F,rightIcon:K,labelText:N,maxCharLimit:R,isRequired:G,hintText:W,type:_,state:q,validate:V,variant:$,button:J,suffixText:Q,prefixText:U,onChangeText:X,value:Y,noErrorHint:Z,reset:ee,rangeValidation:te,noKeyDownChange:ie,version:ne,noMaxCharCheck:le,labelElement:re,autoGrow:oe,minHeight:ae,maxHeight:se,labelTextBold:ce,truncateText:he,maxCharLimitPosition:ue,hightlightInputColor:de,onKeyDownEvent:ve,hideInputHeader:pe,hideBorder:ge,inputWrapperStyles:me,minCharLimit:xe}=Object.assign({maxCharLimit:0,type:"text",variant:"default",maxCharLimitPosition:"TOP",minCharLimit:0},l),be=null==F?void 0:F.icon,fe=null==K?void 0:K.icon,[ye,je]=r(!1),[Ce,Oe]=r(!1),[Te,we]=r(),Ie="x-small"===$?"12px":"small"===$?"18px":"22px",ke=o(x),[Le,Be]=r(),He=a(null),Ee=null!=L?L:He;s((()=>{Be(Y),!Y&&oe&&(Ee.current.style.height=ae||"48px")}),[Y]),s((()=>{var e;Ee.current&&(null===(e=l.onReferenceInit)||void 0===e||e.call(l,Ee.current))}),[Ee]),s((()=>{const e=Ee.current;if(e&&["phonenumber","zip","number"].includes(_))return e.addEventListener("wheel",De,{passive:!1}),()=>{e.removeEventListener("wheel",De)}}),[]),s((()=>{ee&&Be("")}),[ee]),s((()=>{var e;Oe(!!l.isActive),l.isActive&&(null===(e=Ee.current)||void 0===e||e.focus())}),[l.isActive]),s((()=>{we(l.errorMessage)}),[l.errorMessage]),s((()=>{var e;je(!1),("invalid"===l.state||Te||"disabled-invalid"===l.state)&&je(!0),"active"===l.state&&(null===(e=Ee.current)||void 0===e||e.focus())}),[l.state,Te]),s((()=>{je(!!Te||"invalid"===l.state)}),[Te,l.state]);const Me=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)}},Pe=()=>"zip"===_?6:2e3,Se=e=>{const t=0!==R?R:Pe(),i=xe,n=e.target.value;ve&&(!n.length||n.length>=i)&&ve(e),ie||n.length&&!(n.length>=i)||X(Y||"",e),le||![8].includes(e.which)&&t>0&&n.length>=t&&e.preventDefault()},De=e=>{e.preventDefault()},ze=e=>{let t=e.target.value;const i=0!==R?R+1:Pe(),n=xe;if(n&&t&&t.length<n)return;!le&&i>0&&t.length>=i&&(t=t.substring(0,i-1)),X(t,e),l.textControl||Be(t),oe&&(Ee.current.style.height=`${Ee.current.scrollHeight}px`,t||(Ee.current.style.height=ae||"48px"));const r=V||u;if(!r||!h(r))return;const[o,a]=r(t,_,te);je(!o),we(l.errorMessage?l.errorMessage:a)},Ae=e=>{var t;l.skipFocus||Oe(!0),Me(null===(t=l.onFocus)||void 0===t?void 0:t.call(l,e))},Fe=e=>{var t;l.skipFocus||Oe(!1),Me(null===(t=l.onBlur)||void 0===t?void 0:t.call(l,e))},Ke=()=>{var n;return e(i,{children:["multiline"!==_&&t("input",{className:he?"truncate-class":"","data-test":l["data-test"],id:l.id,style:null!==(n=null==ke?void 0:ke.input)&&void 0!==n?n:{},ref:Ee,type:["phonenumber","zip","number"].includes(_)?"number":_,value:Le,onFocus:e=>Ae(e),onBlur:e=>Fe(e),placeholder:A||"Enter here",onChange:ze,onClick:e=>Me(l.onClick),onKeyDown:e=>Se(e)}),"multiline"===_&&t("textarea",{"data-test":l["data-test"],value:Le,ref:Ee,onFocus:e=>Ae(e),onBlur:e=>Fe(e),onClick:e=>Me(l.onClick),placeholder:A||"Enter here",onChange:ze,onKeyDown:e=>Se(e),maxLength:R>0?R:void 0})]})};return e(b,Object.assign({width:l.width,height:l.height,state:q,type:_,style:null!==(B=null==ke?void 0:ke.RootContainer)&&void 0!==B?B:{}},{children:[e("div",Object.assign({className:"flex-align-center"},{children:[!Z&&(!!W||!!Te)&&e(f,Object.assign({invalid:!!Te},{children:[!!Te&&t(m,{width:16,height:16}),Te||W]})),R>0&&"BOTTOM"===ue&&e(y,Object.assign({position:"BOTTOM"},{children:[null!==(E=null===(H=(null!=Y?Y:"").toString())||void 0===H?void 0:H.length)&&void 0!==E?E:0,"/",R]}))]})),e(j,Object.assign({variant:$,state:q,width:l.width,isActive:"active"===q||Ce,isInvalid:ye,style:null!==(P=null!==(M=null==ke?void 0:ke.InputWrapper)&&void 0!==M?M:me)&&void 0!==P?P:{},version:ne,height:l.height,hightlightInputColor:de,hideBorder:ge},{children:[!!be&&t(C,Object.assign({variant:$,iconSize:Ie,onClick:()=>Me(null==F?void 0:F.callback),isLeft:!0,style:null!==(S=null==ke?void 0:ke.IconHolder)&&void 0!==S?S:{}},{children:t(be,{})})),!!U&&t(O,Object.assign({variant:$},{children:U})),"default"===$&&t(T,Object.assign({height:l.height,type:l.type,minHeight:ae,maxHeight:se,autoGrow:oe},{children:Ke()})),["x-small","small"].includes($)&&t(w,Object.assign({height:l.height,type:l.type},{children:Ke()})),!!fe&&t(C,Object.assign({variant:$,iconSize:Ie,onClick:()=>Me(null==K?void 0:K.callback),isLeft:!1},{children:t(fe,{})})),!!Q&&t(I,Object.assign({variant:$},{children:Q})),J&&J.text&&t(c,{buttonText:J.text,onClick:()=>Me(null==J?void 0:J.onClick)}),J&&J.buttonProps&&t(c,Object.assign({},J.buttonProps))]})),!pe&&(!!N||!!R)&&e(k,Object.assign({invalid:ye},{children:[re&&re,e("div",Object.assign({className:"label__container"},{children:[e(ce?v:p,{children:[N,G?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:ye?g.content.negative:g.content.primary})})}))]})),R>0&&"TOP"===ue&&e(y,{children:[null!==(z=null===(D=(null!=Y?Y:"").toString())||void 0===D?void 0:D.length)&&void 0!==z?z:0,"/",R]})]}))]}))}));L.displayName="Input";export{L as Input};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{__rest as t}from"../../_virtual/_tslib.js";import{jsxs as e,jsx as n}from"react/jsx-runtime";import
|
|
2
|
-
background: ${
|
|
1
|
+
import{__rest as t}from"../../_virtual/_tslib.js";import{jsxs as e,jsx as n}from"react/jsx-runtime";import i from"styled-components";import{Spinner as o}from"../spinner/Spinner.js";import{BodyCaption as r,TitleRegular as l,TitleSmall as s}from"../TypographyStyle.js";import{COLORS as c}from"../../constants/Theme.js";import a from"../../assets/icons/alert.svg.js";import{Button as d}from"../button/Button.js";const u=i.div`
|
|
2
|
+
background: ${c.surface.standard};
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
align-items: center;
|
|
6
6
|
justify-content: center;
|
|
7
7
|
flex: 1;
|
|
8
|
-
`,
|
|
9
|
-
background: ${
|
|
8
|
+
`,m=i.div`
|
|
9
|
+
background: ${c.background.base};
|
|
10
10
|
width: 48px;
|
|
11
11
|
height: 48px;
|
|
12
12
|
display: flex;
|
|
@@ -14,4 +14,4 @@ import{__rest as t}from"../../_virtual/_tslib.js";import{jsxs as e,jsx as n}from
|
|
|
14
14
|
align-items: center;
|
|
15
15
|
justify-content: center;
|
|
16
16
|
border-radius: 24px;
|
|
17
|
-
`,
|
|
17
|
+
`,p=i=>{var{subTitle:p,title:g,IconHolderStyle:h,style:y,isLoading:b,containerWidth:f}=i,j=t(i,["subTitle","title","IconHolderStyle","style","isLoading","containerWidth"]);let x=l;const v=f?parseFloat(f):0;return v&&!isNaN(v)&&v<=150&&(x=s),e(u,Object.assign({style:null!=y?y:{}},{children:[b?n(o,{size:"large",color:c.stroke.brand}):n(m,Object.assign({style:null!=h?h:{}},{children:(null==j?void 0:j.Icon)||n(a,{color:c.content.placeholder,height:24,width:24})})),n(x,Object.assign({style:{marginTop:8,color:c.content.primary}},{children:b?"Loading...":g||"No results found"})),!!p&&!b&&n(r,Object.assign({style:{marginTop:4,color:c.content.secondary,textAlign:"center",maxWidth:184}},{children:p})),!!(null==j?void 0:j.actionButton)&&n("div",Object.assign({style:(null==j?void 0:j.buttonWidth)?{width:null==j?void 0:j.buttonWidth,display:"flex"}:{}},{children:n(d,Object.assign({},null==j?void 0:j.actionButton))}))]}))};export{p as ZeroState};
|