@inntechcorp/it-design 2.2.43 → 2.2.44
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/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -2386,7 +2386,7 @@ function(b,z){M.exports?M.exports=z(Eo()):z(b.moment)}(Fo,(function(M){void 0===
|
|
|
2386
2386
|
}
|
|
2387
2387
|
`}
|
|
2388
2388
|
|
|
2389
|
-
`,En=p.forwardRef((({id:M
|
|
2389
|
+
`,En=p.forwardRef((({id:M,position:o="bottom",direction:c="right",size:e="default",variant:O="default",placeholder:t="Please Select",className:n="",multi:A=!1,disabled:a=!1,showSearch:r=!1,locked:i=!1,floating:d=!1,options:q=[],value:s,defaultValue:l,label:W,prefix:u,suffix:f,icon:h,image:R,style:L,onChange:m,onUpdate:g},N)=>{const{t:B}=b.useTranslation("itd"),v=p.useRef(null),x=p.useMemo((()=>M||"itd-select-"+OM()),[M]),[X,y]=p.useState(!1),[w,S]=p.useState(""),[k,E]=p.useState(void 0),[C,D]=p.useState("");p.useEffect((()=>{X||setTimeout((()=>{S("")}),300)}),[X]),p.useEffect((()=>{void 0!==l&&E(l)}),[l]),p.useEffect((()=>{void 0!==s&&E(s)}),[s]),T(v,(()=>{X&&y(!1)})),_((()=>{X&&y(!1)}));const P=p.useCallback((M=>{y(M)}),[]),j=p.useCallback((()=>{y(!0)}),[]),F=p.useCallback((()=>{y(!1)}),[]),I=p.useCallback((M=>{y(M)}),[]),$=p.useCallback((M=>{X&&S(M)}),[X]),H=(M,b=!0,z=!0)=>{g&&g(M,b,z)};p.useImperativeHandle(N,(()=>({reset(M=!0,b=!0){const z=l||(A?[]:void 0);E(z),D(""),H(z,M,b)},setValue(M,b=!0,z=!0){E(M),H(M,b,z)},getValue:()=>k||(A?[]:""),setError(M){D(M||"")},clear(){}})));const U=p.useCallback((()=>{y(!1)}),[]),V=p.useCallback((M=>{D(""),H(M),E(M),A||y(!1),m&&m(M)}),[A,m,H]),G=p.useMemo((()=>{let M=[];return q.forEach((b=>{if(""!==w&&"string"==typeof b.value&&("searchText"in b&&"string"==typeof b.searchText?!b.searchText.toLocaleLowerCase().includes(w.toLocaleLowerCase()):!b.value.toLocaleLowerCase().includes(w.toLocaleLowerCase())&&!(M=>{if("string"==typeof M)return M.toLocaleLowerCase();if(Array.isArray(M)){let b="";return M.forEach((M=>{"string"==typeof M&&(b+=M.toLocaleLowerCase())})),b}return""})(b.label).includes(w.toLocaleLowerCase())))return;let z={value:b.value,label:b.label};b.icon&&(z={...z,icon:b.icon}),b.image&&(z={...z,image:b.image}),b.key&&(z={...z,customKey:b.key}),A&&k&&Array.isArray(k)&&(z={...z,multi:!0,checked:k.includes(b.value.toString())}),M.push(p.createElement(gc,{...z,key:b.key?b.key:b.value.toString()}))})),0===M.length&&M.push(z.jsx("div",{className:"itd-select-not-found",style:{padding:"20px",textAlign:"center"},children:"Not Found"},"not-found")),M}),[q,w,A,k]),Y=()=>"x-small"===e?"xs":"small"===e?"sm":"medium"===e?"md":"default"===e?"df":"large"===e?"lg":"x-large"===e?"xlg":"df",K=p.useMemo((()=>({style:L,disabled:a,$hasImage:null!=R,$hasIcon:null!=h,$size:Y(),$filled:void 0!==k})),[L,a,R,h,e,k]),Q=p.useMemo((()=>{let M="itd-select";return M+=" itd-select-"+O,M+=" itd-select-"+(A?"multi":"single"),M+=" itd-select-"+c,M+=" itd-select-"+Y(),X&&(M+=" itd-select-open"),C&&(M+=" itd-select-status-error"),a&&(M+=" itd-select-disabled"),r&&(M+=" itd-select-search"),h&&(M+=" itd-icon"),R&&(M+=" itd-image"),""!==n&&(M+=" "+n),M}),[O,A,c,e,X,C,a,r,h,R,n]);return p.useEffect((()=>{if(X&&A&&k&&Array.isArray(k)&&k.length>0){const M=q.find((M=>k.includes(M.value.toString())));if(M){const b=document.querySelector(`[data-value="${M.value}"]`);b&&setTimeout((()=>{b.scrollIntoView({behavior:"instant",block:"nearest",inline:"start"})}),50)}}}),[X]),z.jsxs(kn,{ref:v,className:Q,...K,children:[z.jsx(Vc,{id:x,labelType:d?"floating":"single",value:k,placeholder:q.length>0?t:"",onChange:P,onFocus:j,onBlur:F,onShow:I,onFilter:$,errorMessage:C,size:e,icon:h,prefix:u,suffix:f,image:R,label:(()=>{if(W)return W;if(void 0===k)return;let M="";if(A){const b=q.filter((M=>M.value===k[0]))[0];Array.isArray(k)&&(1===k.length?b&&(M=b.label):k.length>1&&(M=B("placeholders.multipleSelection",{count:k.length})))}else{const b=q.filter((M=>M.value===k))[0];b&&(M=b.label)}return M})(),disabled:a,isOpen:X,multi:A,locked:i,showSearch:r}),z.jsx(Xn,{onClose:U,onChange:V,defaultValue:k,position:o,direction:c,isOpen:X,multi:A,children:G})]})}));En.displayName="Select";const Cn=n.div`
|
|
2390
2390
|
|
|
2391
2391
|
display : flex;
|
|
2392
2392
|
flex-direction : ${M=>M.$horizontal?"row":"column"};
|
package/dist/index.esm.js
CHANGED
|
@@ -2386,7 +2386,7 @@ function(b,z){M.exports?M.exports=z(SO()):z(b.moment)}(FO,(function(M){void 0===
|
|
|
2386
2386
|
}
|
|
2387
2387
|
`}
|
|
2388
2388
|
|
|
2389
|
-
`,VA=W((({id:M
|
|
2389
|
+
`,VA=W((({id:M,position:z="bottom",direction:o="right",size:c="default",variant:e="default",placeholder:a="Please Select",className:r="",multi:d=!1,disabled:q=!1,showSearch:l=!1,locked:W=!1,floating:f=!1,options:h=[],value:R,defaultValue:L,label:g,prefix:N,suffix:B,icon:v,image:X,style:y,onChange:x,onUpdate:w},T)=>{const{t:_}=b("itd"),k=A(null),S=i((()=>M||"itd-select-"+IM()),[M]),[E,C]=t(!1),[D,P]=t(""),[F,I]=t(void 0),[$,H]=t("");n((()=>{E||setTimeout((()=>{P("")}),300)}),[E]),n((()=>{void 0!==L&&I(L)}),[L]),n((()=>{void 0!==R&&I(R)}),[R]),tM(k,(()=>{E&&C(!1)})),nM((()=>{E&&C(!1)}));const U=s((M=>{C(M)}),[]),j=s((()=>{C(!0)}),[]),V=s((()=>{C(!1)}),[]),Y=s((M=>{C(M)}),[]),G=s((M=>{E&&P(M)}),[E]),K=(M,b=!0,z=!0)=>{w&&w(M,b,z)};u(T,(()=>({reset(M=!0,b=!0){const z=L||(d?[]:void 0);I(z),H(""),K(z,M,b)},setValue(M,b=!0,z=!0){I(M),K(M,b,z)},getValue:()=>F||(d?[]:""),setError(M){H(M||"")},clear(){}})));const J=s((()=>{C(!1)}),[]),Q=s((M=>{H(""),K(M),I(M),d||C(!1),x&&x(M)}),[d,x,K]),Z=i((()=>{let M=[];return h.forEach((b=>{if(""!==D&&"string"==typeof b.value&&("searchText"in b&&"string"==typeof b.searchText?!b.searchText.toLocaleLowerCase().includes(D.toLocaleLowerCase()):!b.value.toLocaleLowerCase().includes(D.toLocaleLowerCase())&&!(M=>{if("string"==typeof M)return M.toLocaleLowerCase();if(Array.isArray(M)){let b="";return M.forEach((M=>{"string"==typeof M&&(b+=M.toLocaleLowerCase())})),b}return""})(b.label).includes(D.toLocaleLowerCase())))return;let z={value:b.value,label:b.label};b.icon&&(z={...z,icon:b.icon}),b.image&&(z={...z,image:b.image}),b.key&&(z={...z,customKey:b.key}),d&&F&&Array.isArray(F)&&(z={...z,multi:!0,checked:F.includes(b.value.toString())}),M.push(m(kc,{...z,key:b.key?b.key:b.value.toString()}))})),0===M.length&&M.push(p("div",{className:"itd-select-not-found",style:{padding:"20px",textAlign:"center"},children:"Not Found"},"not-found")),M}),[h,D,d,F]),MM=()=>"x-small"===c?"xs":"small"===c?"sm":"medium"===c?"md":"default"===c?"df":"large"===c?"lg":"x-large"===c?"xlg":"df",bM=i((()=>({style:y,disabled:q,$hasImage:null!=X,$hasIcon:null!=v,$size:MM(),$filled:void 0!==F})),[y,q,X,v,c,F]),zM=i((()=>{let M="itd-select";return M+=" itd-select-"+e,M+=" itd-select-"+(d?"multi":"single"),M+=" itd-select-"+o,M+=" itd-select-"+MM(),E&&(M+=" itd-select-open"),$&&(M+=" itd-select-status-error"),q&&(M+=" itd-select-disabled"),l&&(M+=" itd-select-search"),v&&(M+=" itd-icon"),X&&(M+=" itd-image"),""!==r&&(M+=" "+r),M}),[e,d,o,c,E,$,q,l,v,X,r]);return n((()=>{if(E&&d&&F&&Array.isArray(F)&&F.length>0){const M=h.find((M=>F.includes(M.value.toString())));if(M){const b=document.querySelector(`[data-value="${M.value}"]`);b&&setTimeout((()=>{b.scrollIntoView({behavior:"instant",block:"nearest",inline:"start"})}),50)}}}),[E]),O(jA,{ref:k,className:zM,...bM,children:[p(pe,{id:S,labelType:f?"floating":"single",value:F,placeholder:h.length>0?a:"",onChange:U,onFocus:j,onBlur:V,onShow:Y,onFilter:G,errorMessage:$,size:c,icon:v,prefix:N,suffix:B,image:X,label:(()=>{if(g)return g;if(void 0===F)return;let M="";if(d){const b=h.filter((M=>M.value===F[0]))[0];Array.isArray(F)&&(1===F.length?b&&(M=b.label):F.length>1&&(M=_("placeholders.multipleSelection",{count:F.length})))}else{const b=h.filter((M=>M.value===F))[0];b&&(M=b.label)}return M})(),disabled:q,isOpen:E,multi:d,locked:W,showSearch:l}),p(PA,{onClose:J,onChange:Q,defaultValue:F,position:z,direction:o,isOpen:E,multi:d,children:Z})]})}));VA.displayName="Select";const YA=k.div`
|
|
2390
2390
|
|
|
2391
2391
|
display : flex;
|
|
2392
2392
|
flex-direction : ${M=>M.$horizontal?"row":"column"};
|