@eliseubatista99/react-scaffold-core 0.1.86 → 0.1.87

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.
@@ -18,3 +18,4 @@ export declare const Default: Story;
18
18
  export declare const WithoutDecimals: Story;
19
19
  export declare const WithoutNegatives: Story;
20
20
  export declare const WithMinAndMax: Story;
21
+ export declare const WithMaxLength: Story;
package/dist/index.cjs.js CHANGED
@@ -156,7 +156,7 @@ Please change the parent <Route path="${O}"> to <Route path="${O==="/"?"*":`${O}
156
156
  input:-webkit-autofill {
157
157
  background-color: #00000000;
158
158
  }
159
- `,Sn=e=>{const{onValueChanged:t,handleOnBlur:r,handleOnFocus:i}=Zo(e),{name:a,label:s,leftIcon:c,rightIcon:l,bottomMessage:u,placeHolder:h,autoComplete:v="off",value:x,initialValue:R,type:M="text",maxLength:P,inputStyles:p,containerStyles:I,styles:O,step:F,pattern:U,onInput:q}=e;return G.jsxs(Qo,{style:{width:"100%",maxWidth:"357px",gap:"8px",...O},children:[s,G.jsxs("div",{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",...I},children:[c,G.jsx("input",{name:a,type:M,autoComplete:v,step:F,maxLength:P,placeholder:h,value:x,defaultValue:R,onChange:t,onFocus:i,onBlur:r,onInput:q,pattern:U,style:{flex:1,border:"none",color:"inherit",fontFamily:"inherit",fontStyle:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",outline:"inherit",background:"none",...p}}),l]}),u]})},es=({id:e,styles:t,children:r})=>{const{isItemVisible:i}=et();return G.jsx(G.Fragment,{children:i(e)&&G.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})})},ts=({id:e,children:t,backgroundStyles:r,contentStyles:i,onClickOutsideModal:a})=>{const{isItemVisible:s}=et();return G.jsx(G.Fragment,{children:s(e)&&G.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:G.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})})})},rs=e=>{const t=Y.useRef("");function r(c,l){const[u,...h]=c.split("."),[v,...x]=t.current.split(".");let R=h.join(""),M=x.join("");return l!==void 0&&(R.length>l?R=M:R=R.slice(0,l)),R||c.endsWith(".")?`${u}.${R}`:u}function i(c){const l=Number(c);var u=e.max;return u===void 0&&(u=e.maxLength?Number("9".repeat(e.maxLength)):void 0),!isNaN(l)&&(e.min!==void 0&&l<e.min||u!==void 0&&l>u)?t.current??c:c}const a=c=>{const l=c.target,u=l.selectionStart??0,h=l.selectionEnd??0;let v=l.value;const x=`0-9${e.allowDecimals?"\\.":""}${e.allowNegatives?"\\-":""}`;v=v.replace(new RegExp(`[^${x}]`,"g"),""),v=r(v,e.decimalScale),v=i(v);const R=v.length-l.value.length;l.value=v,l.setSelectionRange(u+R,h+R),t.current=v};return{props:Y.useCallback(()=>({...e,type:"text",pattern:"^-?d*.?d*$",onInput:a}),[])()}},ns=({allowNegatives:e=!0,allowDecimals:t=!0,decimalScale:r=2,...i})=>{const{props:a}=rs({allowNegatives:e,allowDecimals:t,decimalScale:r,...i});return G.jsx(Sn,{type:"text",...a})},is=e=>{const t=Y.useRef(null),r=Y.useRef(null),[i,a]=Y.useState(24),[s,c]=Y.useState(24),l=Y.useCallback(()=>{t.current&&a(t.current.clientHeight)},[t,t.current]),u=Y.useCallback(()=>{r.current&&c(r.current.clientHeight)},[r,r.current]),h=Y.useCallback(()=>{let v=0;return e.header?.visibility==="always"&&(v=v+(i||0)),e.footer?.visibility==="always"&&(v=v+(s||0)),v},[r,r.current]);return Y.useEffect(()=>{l()},[l,t,t.current]),Y.useEffect(()=>{u()},[u,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()}}},as=Pe.div`
159
+ `,Sn=e=>{const{onValueChanged:t,handleOnBlur:r,handleOnFocus:i}=Zo(e),{name:a,label:s,leftIcon:c,rightIcon:l,bottomMessage:u,placeHolder:h,autoComplete:v="off",value:x,initialValue:R,type:M="text",maxLength:P,inputStyles:p,containerStyles:I,styles:O,step:F,pattern:U,onInput:q}=e;return G.jsxs(Qo,{style:{width:"100%",maxWidth:"357px",gap:"8px",...O},children:[s,G.jsxs("div",{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",...I},children:[c,G.jsx("input",{name:a,type:M,autoComplete:v,step:F,maxLength:P,placeholder:h,value:x,defaultValue:R,onChange:t,onFocus:i,onBlur:r,onInput:q,pattern:U,style:{flex:1,border:"none",color:"inherit",fontFamily:"inherit",fontStyle:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",outline:"inherit",background:"none",...p}}),l]}),u]})},es=({id:e,styles:t,children:r})=>{const{isItemVisible:i}=et();return G.jsx(G.Fragment,{children:i(e)&&G.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})})},ts=({id:e,children:t,backgroundStyles:r,contentStyles:i,onClickOutsideModal:a})=>{const{isItemVisible:s}=et();return G.jsx(G.Fragment,{children:s(e)&&G.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:G.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})})})},rs=e=>{const t=Y.useRef("");function r(c,l){const[u,...h]=c.split("."),[v,...x]=t.current.split(".");let R=h.join(""),M=x.join("");return l!==void 0&&(R.length>l?R=M:R=R.slice(0,l)),R||c.endsWith(".")?`${u}.${R}`:u}function i(c){const l=Number(c);var u=e.max;return u===void 0&&(u=e.maxLength?Number("9".repeat(e.maxLength)):void 0),!isNaN(l)&&(e.min!==void 0&&l<e.min||u!==void 0&&l>u)?t.current??c:c}const a=c=>{const l=c.target,u=l.selectionStart??0,h=l.selectionEnd??0;let v=l.value;const x=`0-9${e.allowDecimals?"\\.":""}${e.allowNegatives?"\\-":""}`;v=v.replace(new RegExp(`[^${x}]`,"g"),""),v=r(v,e.decimalScale),v=i(v);const R=v.length-l.value.length;l.value=v,l.setSelectionRange(u+R,h+R),t.current=v};return{props:Y.useCallback(()=>({...e,type:"text",pattern:"^-?[0-9]*.?[0-9]*$",onInput:a}),[])()}},ns=({allowNegatives:e=!0,allowDecimals:t=!0,decimalScale:r=2,...i})=>{const{props:a}=rs({allowNegatives:e,allowDecimals:t,decimalScale:r,...i});return G.jsx(Sn,{type:"text",...a})},is=e=>{const t=Y.useRef(null),r=Y.useRef(null),[i,a]=Y.useState(24),[s,c]=Y.useState(24),l=Y.useCallback(()=>{t.current&&a(t.current.clientHeight)},[t,t.current]),u=Y.useCallback(()=>{r.current&&c(r.current.clientHeight)},[r,r.current]),h=Y.useCallback(()=>{let v=0;return e.header?.visibility==="always"&&(v=v+(i||0)),e.footer?.visibility==="always"&&(v=v+(s||0)),v},[r,r.current]);return Y.useEffect(()=>{l()},[l,t,t.current]),Y.useEffect(()=>{u()},[u,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()}}},as=Pe.div`
160
160
  min-height: 100%;
161
161
  max-height: 100%;
162
162
  width: 100%;
package/dist/index.es.js CHANGED
@@ -6403,7 +6403,7 @@ const Sn = q.createContext({
6403
6403
  props: _e(() => ({
6404
6404
  ...e,
6405
6405
  type: "text",
6406
- pattern: "^-?d*.?d*$",
6406
+ pattern: "^-?[0-9]*.?[0-9]*$",
6407
6407
  onInput: a
6408
6408
  }), [])()
6409
6409
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eliseubatista99/react-scaffold-core",
3
- "version": "0.1.86",
3
+ "version": "0.1.87",
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",