shekel-fe-shared-lib 1.0.18 → 1.0.19
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 +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +0 -2
- package/dist/index.mjs.map +1 -1
- package/dist/shekel-fe-shared-lib.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
border-color: #C21919 !important;
|
|
66
66
|
box-shadow: 0 0 0 2px rgba(194, 25, 25, 0.1) !important;
|
|
67
67
|
}
|
|
68
|
-
`}),t.jsx(B.Input,{className:`${r} ${c}`,status:e?"error":o,...i,style:{height:"44px",borderRadius:"12px"
|
|
68
|
+
`}),t.jsx(B.Input,{className:`${r} ${c}`,status:e?"error":o,...i,style:{height:"44px",borderRadius:"12px",...i.style}}),e&&t.jsxs("div",{className:"flex items-center mt-1 text-xs text-[#C21919]",children:[t.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),e]}),!e&&n&&t.jsx("div",{className:"mt-1 text-xs text-gray-500",children:n})]})},e0=({label:s,error:e,helperText:n,className:r="",status:o,...i})=>{const d=`password-input-custom ${r} ${e?"password-input-error-state":""}`;return t.jsxs("div",{className:"w-full",children:[s&&t.jsxs("label",{className:"block text-sm font-medium mb-2",style:{color:e?"#C21919":"#181918"},children:[s,i.required&&t.jsx("span",{style:{color:"#C21919"},children:"*"})]}),t.jsx("style",{children:e&&`
|
|
69
69
|
.password-input-error-state .ant-input-group-addon {
|
|
70
70
|
border-color: #C21919 !important;
|
|
71
71
|
}
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
border-color: #C21919 !important;
|
|
83
83
|
box-shadow: 0 0 0 2px rgba(194, 25, 25, 0.1) !important;
|
|
84
84
|
}
|
|
85
|
-
`}),t.jsx(B.Input.Password,{className:d,status:e?"error":o,...i,style:{height:"44px",borderRadius:"12px"
|
|
85
|
+
`}),t.jsx(B.Input.Password,{className:d,status:e?"error":o,...i,style:{height:"44px",borderRadius:"12px",...i.style}}),e&&t.jsxs("div",{className:"flex items-center mt-1 text-xs text-[#C21919]",children:[t.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),e]}),!e&&n&&t.jsx("div",{className:"mt-1 text-xs text-gray-500",children:n})]})},t0=({length:s=6,value:e="",onChange:n,onComplete:r,error:o=!1,errorMessage:i,disabled:c=!1,className:d=""})=>{const[a,C]=M.useState(Array(s).fill("")),l=M.useRef([]);M.useEffect(()=>{if(e){const h=e.split("").slice(0,s),b=[...h,...Array(s-h.length).fill("")];C(b)}},[e,s]);const p=(h,b)=>{var m;if(b&&!/^\d+$/.test(b))return;const x=[...a];x[h]=b.slice(-1),C(x);const v=x.join("");n==null||n(v),b&&h<s-1&&((m=l.current[h+1])==null||m.focus()),x.every(y=>y!=="")&&(r==null||r(v))},g=(h,b)=>{var x;b.key==="Backspace"&&!a[h]&&h>0&&((x=l.current[h-1])==null||x.focus())},w=h=>{var f;h.preventDefault();const b=h.clipboardData.getData("text/plain");if(!/^\d+$/.test(b))return;const x=b.split("").slice(0,s),v=[...x,...Array(s-x.length).fill("")];C(v);const m=v.join("");n==null||n(m);const y=Math.min(x.length,s-1);(f=l.current[y])==null||f.focus(),v.every(u=>u!=="")&&(r==null||r(m))};return t.jsxs("div",{className:"w-full",children:[t.jsx("div",{className:`flex gap-2 justify-center ${d}`,children:a.map((h,b)=>t.jsxs(M.Fragment,{children:[t.jsx(B.Input,{ref:x=>{l.current[b]=x},placeholder:"",value:h,onChange:x=>p(b,x.target.value),onKeyDown:x=>g(b,x),onPaste:w,disabled:c,maxLength:1,className:"text-center text-lg font-semibold otp-input-field",style:{width:"63px",height:"44px",borderRadius:"12px",borderColor:o?"#C21919":"#D1D1D1"}}),b===Math.floor(s/2)-1&&t.jsx("div",{className:"flex items-center justify-center px-1",children:t.jsx("span",{className:"text-gray-400 text-xl",children:"—"})})]},b))}),o&&i&&t.jsxs("div",{className:"flex items-center justify-center mt-2 text-xs text-[#C21919]",children:[t.jsx("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:t.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})}),i]})]})},s0=({label:s,error:e,helperText:n,className:r="",countryCode:o="+234",onCountryCodeChange:i,countryCodes:c=[{value:"+234",label:"+234"},{value:"+1",label:"+1"},{value:"+44",label:"+44"},{value:"+91",label:"+91"}],showCountryCodeDropdown:d=!0,format:a="spaced",customFormat:C,value:l,onChange:p,...g})=>{const w=e?"phone-input-error-state":"",[h,b]=M.useState("");M.useEffect(()=>{if(l!==void 0){const f=String(l).replace(/\D/g,""),u=x(f);b(u)}},[l,a,o]);const x=f=>{const u=f.replace(/\D/g,"");if(C)return C(u);if(a==="none")return u;let V="";return a==="spaced"?u.length<=3?V=u:u.length<=6?V=`${u.slice(0,3)} ${u.slice(3)}`:V=`${u.slice(0,3)} ${u.slice(3,6)} ${u.slice(6,10)}`:a==="dashed"?u.length<=3?V=u:u.length<=6?V=`${u.slice(0,3)}-${u.slice(3)}`:V=`${u.slice(0,3)}-${u.slice(3,6)}-${u.slice(6,10)}`:o==="+1"?u.length<=3?V=u:u.length<=6?V=`(${u.slice(0,3)}) ${u.slice(3)}`:V=`(${u.slice(0,3)}) ${u.slice(3,6)}-${u.slice(6,10)}`:u.length<=3?V=u:u.length<=6?V=`${u.slice(0,3)} ${u.slice(3)}`:V=`${u.slice(0,3)} ${u.slice(3,6)} ${u.slice(6,10)}`,V},v=f=>{var u;!/^\d$/.test(f.key)&&f.key!=="Backspace"&&f.key!=="Delete"&&f.key!=="Tab"&&f.key!=="ArrowLeft"&&f.key!=="ArrowRight"&&f.key!=="Home"&&f.key!=="End"&&f.preventDefault(),(u=g.onKeyDown)==null||u.call(g,f)},m=f=>{const u=f.target,V=u.selectionStart||0,H=u.value.replace(/\D/g,""),E=x(H);b(E);const Z=h.length,S=E.length-Z;if(requestAnimationFrame(()=>{const k=Math.max(0,Math.min(V+S,E.length));u.setSelectionRange(k,k)}),p){const k={...f,target:{...f.target,value:H}};p(k)}},y=f=>{var k;f.preventDefault();const V=f.clipboardData.getData("text/plain").replace(/\D/g,""),E=f.target.selectionStart||0,F=h.replace(/\D/g,"").slice(0,E)+V,S=x(F);if(b(S),p){const z={...f,target:{...f.target,value:F}};p(z)}(k=g.onPaste)==null||k.call(g,f)};return t.jsxs("div",{className:"w-full",children:[s&&t.jsxs("label",{className:"block text-sm font-medium mb-2",style:{color:e?"#C21919":"#181918"},children:[s,g.required&&t.jsx("span",{style:{color:"#C21919"},children:"*"})]}),t.jsx("style",{children:`
|
|
86
86
|
.phone-input-container {
|
|
87
87
|
display: flex;
|
|
88
88
|
gap: 8px;
|