@eliseubatista99/react-scaffold-core 1.1.17 → 1.1.18

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,5 +1,6 @@
1
1
  import { HTMLInputAutoCompleteAttribute, CSSProperties, HTMLInputTypeAttribute } from 'react';
2
2
  export interface InputFieldProps {
3
+ ref?: React.Ref<HTMLInputElement>;
3
4
  name: string;
4
5
  label?: React.ReactNode;
5
6
  leftIcon?: React.ReactNode;
package/dist/index.cjs.js CHANGED
@@ -156,7 +156,7 @@ Please change the parent <Route path="${S}"> to <Route path="${S==="/"?"*":`${S}
156
156
  input:-webkit-autofill {
157
157
  background-color: #00000000;
158
158
  }
159
- `,On=e=>{const{onValueChanged:t,handleOnBlur:r,handleOnFocus:i,handleOnClick:a}=Qo(e),{name:s,label:c,leftIcon:u,rightIcon:l,bottomMessage:h,placeHolder:g,autoComplete:y="off",value:E,initialValue:M,type:k="text",maxLength:p,inputStyles:R,containerStyles:S,styles:A,step:W,pattern:F,onInput:m}=e;return X.jsxs(es,{style:{width:"100%",maxWidth:"357px",gap:"8px",...A},children:[c,X.jsxs("div",{onClick:()=>a(),style:{display:"flex",flexDirection:"row",width:"100%",height:"47px",margin:"8px auto 0 auto",border:"2px solid #000000",borderRadius:"5px",padding:"5px 15px",color:"#000000",fontFamily:"inherit",fontStyle:"normal",fontWeight:400,fontSize:"16px",lineHeight:"24px",outline:"none",alignItems:"center",gap:"10px",...S},children:[u,X.jsx("input",{name:s,type:k,autoComplete:y,step:W,maxLength:p,placeholder:g,value:E,defaultValue:M,onChange:t,onFocus:i,onBlur:r,onInput:m,pattern:F,style:{flex:1,border:"none",color:"inherit",fontFamily:"inherit",fontStyle:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",outline:"inherit",background:"none",...R}}),l]}),h]})},ts=({id:e,styles:t,children:r})=>{const{isItemVisible:i}=et();return X.jsx(X.Fragment,{children:i(e)&&X.jsx("div",{style:{width:"100%",minHeight:"100%",left:0,top:0,position:"fixed",zIndex:1e3,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...t},children:r})})},rs=({id:e,children:t,backgroundStyles:r,contentStyles:i,onClickOutsideModal:a})=>{const{isItemVisible:s}=et();return X.jsx(X.Fragment,{children:s(e)&&X.jsx("div",{style:{width:"100%",height:"100%",minHeight:"100vh",background:"#00000068",position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e3,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...r},onClick:()=>{a?.()},children:X.jsx("div",{style:{width:"90%",maxWidth:"375px",height:"fit-content",minHeight:"80px",maxHeight:"50%",background:"#ffffff",borderRadius:"16px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",zIndex:1001,position:"relative",padding:"24px",...i},onClick:c=>{c.stopPropagation()},children:t})})})},ns=e=>{const t=U.useRef(""),r=U.useCallback(u=>(e.allowNegatives?(u=u.replace(/-/g,(l,h)=>h===0?"-":""),u.indexOf("-")>0&&(u=u.replace(/-/g,""),u="-"+u)):u=u.replace(/-/g,""),u),[e]),i=U.useCallback(u=>{if(e.allowDecimals){u.startsWith(".")&&(u="0"+u),u.length===2&&u[0]==="-"&&u[1]==="."&&(u="-");const l=u.indexOf(".");l!==-1&&(u=u.slice(0,l+1)+u.slice(l+1).replace(/\./g,""));const[h,...g]=u.split("."),[y,...E]=t.current.split(".");let M=g.join(""),k=E.join("");e.decimalScale!==void 0&&(M.length>e.decimalScale?M=k:M=M.slice(0,e.decimalScale)),u=M||u.endsWith(".")?`${h}.${M}`:h}else u=u.replace(/\./g,"");return u},[e]),a=U.useCallback(u=>{const l=Number(u);var h=e.max;return h===void 0&&(h=e.maxLength?Number("9".repeat(e.maxLength)):void 0),!isNaN(l)&&(e.min!==void 0&&l<e.min||h!==void 0&&l>h)?t.current??u:u},[e]),s=U.useCallback(u=>{const l=u.target,h=l.selectionStart??0,g=l.selectionEnd??0;let y=l.value;y=y.replace(/[^0-9\.\-]/g,""),y=r(y),y=i(y),y=a(y);const E=y.length-l.value.length;l.value=y,l.setSelectionRange(h+E,g+E),t.current=y},[r,i,a]);return{props:U.useCallback(()=>({...e,type:"text",pattern:"^-?[0-9]*.?[0-9]*$",onInput:s}),[e,s])()}},is=({allowNegatives:e=!0,allowDecimals:t=!0,decimalScale:r=2,...i})=>{const{props:a}=ns({allowNegatives:e,allowDecimals:t,decimalScale:r,...i});return X.jsx(On,{type:"text",...a})},as=e=>{const t=U.useRef(null),r=U.useRef(null),[i,a]=U.useState(24),[s,c]=U.useState(24),u=U.useCallback(()=>{t.current&&a(t.current.clientHeight)},[t,t.current]),l=U.useCallback(()=>{r.current&&c(r.current.clientHeight)},[r,r.current]),h=U.useCallback(()=>{let g=0;return e.header?.visibility==="always"&&(g=g+(i||0)),e.footer?.visibility==="always"&&(g=g+(s||0)),g},[r,r.current]);return U.useEffect(()=>{u()},[u,t,t.current]),U.useEffect(()=>{l()},[l,r,r.current]),{header:{...e.header,visible:e.header!==void 0,height:e.header?.visibility==="fixed"?0:i,ref:t},footer:{...e.footer,visible:e.footer!==void 0,height:e.footer?.visibility==="fixed"?0:s,ref:r},page:{extraHeight:h()}}},os=Pe.div`
159
+ `,On=e=>{const{onValueChanged:t,handleOnBlur:r,handleOnFocus:i,handleOnClick:a}=Qo(e),{ref:s,name:c,label:u,leftIcon:l,rightIcon:h,bottomMessage:g,placeHolder:y,autoComplete:E="off",value:M,initialValue:k,type:p="text",maxLength:R,inputStyles:S,containerStyles:A,styles:W,step:F,pattern:m,onInput:w}=e;return X.jsxs(es,{style:{width:"100%",maxWidth:"357px",gap:"8px",...W},children:[u,X.jsxs("div",{onClick:()=>a(),style:{display:"flex",flexDirection:"row",width:"100%",height:"47px",margin:"8px auto 0 auto",border:"2px solid #000000",borderRadius:"5px",padding:"5px 15px",color:"#000000",fontFamily:"inherit",fontStyle:"normal",fontWeight:400,fontSize:"16px",lineHeight:"24px",outline:"none",alignItems:"center",gap:"10px",...A},children:[l,X.jsx("input",{ref:s,name:c,type:p,autoComplete:E,step:F,maxLength:R,placeholder:y,value:M,defaultValue:k,onChange:t,onFocus:i,onBlur:r,onInput:w,pattern:m,style:{flex:1,border:"none",color:"inherit",fontFamily:"inherit",fontStyle:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",outline:"inherit",background:"none",...S}}),h]}),g]})},ts=({id:e,styles:t,children:r})=>{const{isItemVisible:i}=et();return X.jsx(X.Fragment,{children:i(e)&&X.jsx("div",{style:{width:"100%",minHeight:"100%",left:0,top:0,position:"fixed",zIndex:1e3,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...t},children:r})})},rs=({id:e,children:t,backgroundStyles:r,contentStyles:i,onClickOutsideModal:a})=>{const{isItemVisible:s}=et();return X.jsx(X.Fragment,{children:s(e)&&X.jsx("div",{style:{width:"100%",height:"100%",minHeight:"100vh",background:"#00000068",position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:1e3,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",...r},onClick:()=>{a?.()},children:X.jsx("div",{style:{width:"90%",maxWidth:"375px",height:"fit-content",minHeight:"80px",maxHeight:"50%",background:"#ffffff",borderRadius:"16px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",zIndex:1001,position:"relative",padding:"24px",...i},onClick:c=>{c.stopPropagation()},children:t})})})},ns=e=>{const t=U.useRef(""),r=U.useCallback(u=>(e.allowNegatives?(u=u.replace(/-/g,(l,h)=>h===0?"-":""),u.indexOf("-")>0&&(u=u.replace(/-/g,""),u="-"+u)):u=u.replace(/-/g,""),u),[e]),i=U.useCallback(u=>{if(e.allowDecimals){u.startsWith(".")&&(u="0"+u),u.length===2&&u[0]==="-"&&u[1]==="."&&(u="-");const l=u.indexOf(".");l!==-1&&(u=u.slice(0,l+1)+u.slice(l+1).replace(/\./g,""));const[h,...g]=u.split("."),[y,...E]=t.current.split(".");let M=g.join(""),k=E.join("");e.decimalScale!==void 0&&(M.length>e.decimalScale?M=k:M=M.slice(0,e.decimalScale)),u=M||u.endsWith(".")?`${h}.${M}`:h}else u=u.replace(/\./g,"");return u},[e]),a=U.useCallback(u=>{const l=Number(u);var h=e.max;return h===void 0&&(h=e.maxLength?Number("9".repeat(e.maxLength)):void 0),!isNaN(l)&&(e.min!==void 0&&l<e.min||h!==void 0&&l>h)?t.current??u:u},[e]),s=U.useCallback(u=>{const l=u.target,h=l.selectionStart??0,g=l.selectionEnd??0;let y=l.value;y=y.replace(/[^0-9\.\-]/g,""),y=r(y),y=i(y),y=a(y);const E=y.length-l.value.length;l.value=y,l.setSelectionRange(h+E,g+E),t.current=y},[r,i,a]);return{props:U.useCallback(()=>({...e,type:"text",pattern:"^-?[0-9]*.?[0-9]*$",onInput:s}),[e,s])()}},is=({allowNegatives:e=!0,allowDecimals:t=!0,decimalScale:r=2,...i})=>{const{props:a}=ns({allowNegatives:e,allowDecimals:t,decimalScale:r,...i});return X.jsx(On,{type:"text",...a})},as=e=>{const t=U.useRef(null),r=U.useRef(null),[i,a]=U.useState(24),[s,c]=U.useState(24),u=U.useCallback(()=>{t.current&&a(t.current.clientHeight)},[t,t.current]),l=U.useCallback(()=>{r.current&&c(r.current.clientHeight)},[r,r.current]),h=U.useCallback(()=>{let g=0;return e.header?.visibility==="always"&&(g=g+(i||0)),e.footer?.visibility==="always"&&(g=g+(s||0)),g},[r,r.current]);return U.useEffect(()=>{u()},[u,t,t.current]),U.useEffect(()=>{l()},[l,r,r.current]),{header:{...e.header,visible:e.header!==void 0,height:e.header?.visibility==="fixed"?0:i,ref:t},footer:{...e.footer,visible:e.footer!==void 0,height:e.footer?.visibility==="fixed"?0:s,ref:r},page:{extraHeight:h()}}},os=Pe.div`
160
160
  min-height: 100%;
161
161
  max-height: 100%;
162
162
  width: 100%;
package/dist/index.es.js CHANGED
@@ -6386,23 +6386,24 @@ const Sn = q.createContext({
6386
6386
  }
6387
6387
  `, qo = (e) => {
6388
6388
  const { onValueChanged: t, handleOnBlur: r, handleOnFocus: i, handleOnClick: a } = Uo(e), {
6389
- name: s,
6390
- label: c,
6391
- leftIcon: u,
6392
- rightIcon: l,
6393
- bottomMessage: h,
6394
- placeHolder: g,
6395
- autoComplete: y = "off",
6396
- value: E,
6397
- initialValue: M,
6398
- type: k = "text",
6399
- maxLength: p,
6400
- inputStyles: R,
6401
- containerStyles: S,
6402
- styles: A,
6403
- step: W,
6404
- pattern: F,
6405
- onInput: m
6389
+ ref: s,
6390
+ name: c,
6391
+ label: u,
6392
+ leftIcon: l,
6393
+ rightIcon: h,
6394
+ bottomMessage: g,
6395
+ placeHolder: y,
6396
+ autoComplete: E = "off",
6397
+ value: M,
6398
+ initialValue: k,
6399
+ type: p = "text",
6400
+ maxLength: R,
6401
+ inputStyles: S,
6402
+ containerStyles: A,
6403
+ styles: W,
6404
+ step: F,
6405
+ pattern: m,
6406
+ onInput: w
6406
6407
  } = e;
6407
6408
  return /* @__PURE__ */ X.jsxs(
6408
6409
  Yo,
@@ -6411,10 +6412,10 @@ const Sn = q.createContext({
6411
6412
  width: "100%",
6412
6413
  maxWidth: "357px",
6413
6414
  gap: "8px",
6414
- ...A
6415
+ ...W
6415
6416
  },
6416
6417
  children: [
6417
- c,
6418
+ u,
6418
6419
  /* @__PURE__ */ X.jsxs(
6419
6420
  "div",
6420
6421
  {
@@ -6437,26 +6438,27 @@ const Sn = q.createContext({
6437
6438
  outline: "none",
6438
6439
  alignItems: "center",
6439
6440
  gap: "10px",
6440
- ...S
6441
+ ...A
6441
6442
  },
6442
6443
  children: [
6443
- u,
6444
+ l,
6444
6445
  /* @__PURE__ */ X.jsx(
6445
6446
  "input",
6446
6447
  {
6447
- name: s,
6448
- type: k,
6449
- autoComplete: y,
6450
- step: W,
6451
- maxLength: p,
6452
- placeholder: g,
6453
- value: E,
6454
- defaultValue: M,
6448
+ ref: s,
6449
+ name: c,
6450
+ type: p,
6451
+ autoComplete: E,
6452
+ step: F,
6453
+ maxLength: R,
6454
+ placeholder: y,
6455
+ value: M,
6456
+ defaultValue: k,
6455
6457
  onChange: t,
6456
6458
  onFocus: i,
6457
6459
  onBlur: r,
6458
- onInput: m,
6459
- pattern: F,
6460
+ onInput: w,
6461
+ pattern: m,
6460
6462
  style: {
6461
6463
  flex: 1,
6462
6464
  border: "none",
@@ -6468,15 +6470,15 @@ const Sn = q.createContext({
6468
6470
  lineHeight: "inherit",
6469
6471
  outline: "inherit",
6470
6472
  background: "none",
6471
- ...R
6473
+ ...S
6472
6474
  }
6473
6475
  }
6474
6476
  ),
6475
- l
6477
+ h
6476
6478
  ]
6477
6479
  }
6478
6480
  ),
6479
- h
6481
+ g
6480
6482
  ]
6481
6483
  }
6482
6484
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eliseubatista99/react-scaffold-core",
3
- "version": "1.1.17",
3
+ "version": "1.1.18",
4
4
  "private": false,
5
5
  "description": "A library which provides basic components, hooks, helpers and providers to easily build a React application and avoid repeating the usual code.",
6
6
  "main": "dist/index.cjs.js",
@@ -58,4 +58,4 @@
58
58
  "slick-carousel": "^1.8.1",
59
59
  "dayjs": "^1.11.19"
60
60
  }
61
- }
61
+ }