@eliseubatista99/react-scaffold-core 0.1.21 → 0.1.23

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,6 +18,6 @@ export declare const usePageLayoutHelper: (props: PageLayoutProps) => {
18
18
  styles?: React.CSSProperties;
19
19
  };
20
20
  page: {
21
- extraHeight: void;
21
+ extraHeight: number;
22
22
  };
23
23
  };
package/dist/index.cjs.js CHANGED
@@ -74,8 +74,8 @@ Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}
74
74
  input:-webkit-autofill {
75
75
  background-color: #00000000;
76
76
  }
77
- `,$a=({name:e,label:t,leftIcon:r,rightIcon:o,bottomMessage:i,placeHolder:a,autoComplete:l="off",value:f,initialValue:d,type:p="text",onChange:w,onFocus:E,inputStyles:R,containerProps:A,step:C})=>{const v=k=>{w?.(k.currentTarget.value)},M=k=>{E?.()};return G.jsxs(Fa,{style:{width:"100%",maxWidth:"357px",gap:"8px",...A},children:[t,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:"Poppins",fontStyle:"normal",fontWeight:400,fontSize:"16px",lineHeight:"24px",outline:"none",alignItems:"center",gap:"10px",...R},children:[r,G.jsx("input",{name:e,type:p,autoComplete:l,step:C,style:{flex:1,border:"none",color:"inherit",fontFamily:"inherit",fontStyle:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",outline:"inherit",background:"none"},placeholder:a,value:f,defaultValue:d,onChange:v,onFocus:M}),o]}),i]})},Wa=({id:e,styles:t,children:r})=>{const{isItemVisible:o}=et();return G.jsx(G.Fragment,{children:o(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})})},qa=({id:e,children:t,backgroundStyles:r,contentStyles:o,onClickOutsideModal:i})=>{const{isItemVisible:a}=et();return G.jsx(G.Fragment,{children:a(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:()=>{i?.()},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",...o},onClick:l=>{l.stopPropagation()},children:t})})})},Ba=e=>{const t=q.useRef(null),r=q.useRef(null),[o,i]=q.useState(24),[a,l]=q.useState(24),f=q.useCallback(()=>{t.current&&i(t.current.clientHeight)},[t,t.current]),d=q.useCallback(()=>{r.current&&l(r.current.clientHeight)},[r,r.current]),p=q.useCallback(()=>{e.header?.visibility,e.footer?.visibility},[r,r.current]);return q.useEffect(()=>{f()},[f,t,t.current]),q.useEffect(()=>{d()},[d,r,r.current]),{header:{...e.header,visible:e.header!==void 0,height:e.header?.visibility==="fixed"?0:o,ref:t},footer:{...e.footer,visible:e.footer!==void 0,height:e.footer?.visibility==="fixed"?0:a,ref:r},page:{extraHeight:p()}}},Ua=je.div`
78
- min-height: 100vh;
77
+ `,$a=({name:e,label:t,leftIcon:r,rightIcon:o,bottomMessage:i,placeHolder:a,autoComplete:l="off",value:f,initialValue:d,type:p="text",onChange:w,onFocus:E,inputStyles:R,containerProps:A,step:C})=>{const v=k=>{w?.(k.currentTarget.value)},M=k=>{E?.()};return G.jsxs(Fa,{style:{width:"100%",maxWidth:"357px",gap:"8px",...A},children:[t,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:"Poppins",fontStyle:"normal",fontWeight:400,fontSize:"16px",lineHeight:"24px",outline:"none",alignItems:"center",gap:"10px",...R},children:[r,G.jsx("input",{name:e,type:p,autoComplete:l,step:C,style:{flex:1,border:"none",color:"inherit",fontFamily:"inherit",fontStyle:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",outline:"inherit",background:"none"},placeholder:a,value:f,defaultValue:d,onChange:v,onFocus:M}),o]}),i]})},Wa=({id:e,styles:t,children:r})=>{const{isItemVisible:o}=et();return G.jsx(G.Fragment,{children:o(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})})},qa=({id:e,children:t,backgroundStyles:r,contentStyles:o,onClickOutsideModal:i})=>{const{isItemVisible:a}=et();return G.jsx(G.Fragment,{children:a(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:()=>{i?.()},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",...o},onClick:l=>{l.stopPropagation()},children:t})})})},Ba=e=>{const t=q.useRef(null),r=q.useRef(null),[o,i]=q.useState(24),[a,l]=q.useState(24),f=q.useCallback(()=>{t.current&&i(t.current.clientHeight)},[t,t.current]),d=q.useCallback(()=>{r.current&&l(r.current.clientHeight)},[r,r.current]),p=q.useCallback(()=>{let w=0;return e.header?.visibility==="always"&&(w=w+(o||0)),e.footer?.visibility==="always"&&(w=w+(a||0)),w},[r,r.current]);return q.useEffect(()=>{f()},[f,t,t.current]),q.useEffect(()=>{d()},[d,r,r.current]),{header:{...e.header,visible:e.header!==void 0,height:e.header?.visibility==="fixed"?0:o,ref:t},footer:{...e.footer,visible:e.footer!==void 0,height:e.footer?.visibility==="fixed"?0:a,ref:r},page:{extraHeight:p()}}},Ua=je.div`
78
+ min-height: 100%;
79
79
  width: 100%;
80
80
  min-width: 100%;
81
81
  position: relative;
@@ -93,4 +93,4 @@ Please change the parent <Route path="${k}"> to <Route path="${k==="/"?"*":`${k}
93
93
  box-sizing: border-box;
94
94
  position: relative;
95
95
  }
96
- `,Ya=e=>{const{containerStyles:t,pageStyles:r,children:o,allowScroll:i=!0,floatingContent:a}=e,{footer:l,header:f,page:d}=Ba(e);return G.jsxs(Ua,{"data-testid":"page-container",styles:t,children:[f.visible&&G.jsx("div",{ref:f.ref,"data-testid":"page-header",style:{width:"100%",zIndex:99,position:f.visibility==="fixed"?"relative":"sticky",top:0,left:0,right:0,display:"flex",flexDirection:"row",height:"fit-content",boxSizing:"border-box",...f.styles},children:f.content}),G.jsx("div",{"data-testid":"page-layout",style:{minHeight:`calc(100% + ${d.extraHeight}px)`,width:"100%",overflowY:i?"auto":"hidden",display:"flex",flexDirection:"column",boxSizing:"border-box",top:`-${f.height}px`,bottom:`-${l.height}px`},children:G.jsx("div",{style:{width:"100%",flex:1,minHeight:"fit-content",padding:`${f.height}px 24px ${l.height}px 24px`,paddingBottom:"",boxSizing:"border-box",overflowY:i?void 0:"hidden",...r},children:o})}),l.visible&&G.jsx("div",{ref:l.ref,"data-testid":"page-footer",style:{width:"100%",zIndex:99,position:l.visibility==="fixed"?"relative":"sticky",bottom:0,left:0,right:0,display:"flex",flexDirection:"row",height:"fit-content",boxSizing:"border-box",...l.styles},children:l.content})]})},Va=({src:e,width:t="22",height:r="28",stroke:o,viewBox:i="0 0 22 28",fill:a="#000000",alt:l="",onClick:f,styles:d})=>G.jsx("div",{style:{width:"fit-content",height:"fit-content",display:"flex",alignItems:"center",justifyContent:"center",...d},onClick:()=>f?.(),children:G.jsx("svg",{width:t,height:r,viewBox:i,fill:a,stroke:o,xmlns:"http://www.w3.org/2000/svg",style:{display:"flex"},children:e})}),Xa=({id:e,children:t,styles:r,durationInSeconds:o=3})=>{const i=q.useRef(!1),{isItemVisible:a,hideItem:l}=et();return q.useEffect(()=>{const f=a(e);i.current!==f&&(i.current=f,f&&setTimeout(()=>l(e),o*1e3))},[i,a,l]),G.jsx(G.Fragment,{children:a(e)&&G.jsx("div",{style:{width:"100px",height:"40px",background:"#534a4aff",color:"#ffffff",position:"fixed",top:"10px",left:"50%",transform:"translateX(-50%)",zIndex:1e3,borderRadius:"20px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",border:"solid 3px #000000ff",...r},onClick:f=>{f.stopPropagation()},children:t})})},Ga=({overflowEllipsis:e,children:t,styles:r})=>G.jsx("p",{style:{fontFamily:"inherit",maxWidth:"100%",overflow:"hidden",whiteSpace:e?"nowrap":"normal",textOverflow:"ellipsis",fontSize:"16px",fontStyle:"normal",lineHeight:"normal",color:"#000000",...r},children:t});class Ka{static isScrollEnabled=()=>document.body.style.overflow==="unset"||document.body.style.overflow==="auto";static disableScroll=()=>{document.body.style.overflow="hidden"};static enableScroll=()=>{document.body.style.overflow="unset"}}class Ja{static getPascalCase=t=>t.replace(/\w+/g,function(r){return r[0].toUpperCase()+r.slice(1).toLowerCase()});static isEqual=(t,r,o=!0)=>o?t===r:t.toUpperCase()===r.toUpperCase()}exports.Button=xn;exports.Carousel=Qi;exports.Drawer=Aa;exports.FeedbackProvider=Ma;exports.Form=Ha;exports.Image=Na;exports.InputField=$a;exports.Loader=Wa;exports.Modal=qa;exports.NavigationProvider=La;exports.PageLayout=Ya;exports.ScrollHelper=Ka;exports.SvgImage=Va;exports.TextHelper=Ja;exports.TimeHelper=Ur;exports.Toast=Xa;exports.Typography=Ga;exports.defaultBreakpoints=Yr;exports.useDidMount=eo;exports.useDrag=Br;exports.useFeedback=et;exports.useFetch=to;exports.useIsTouchingParentElement=ro;exports.useNavigation=Da;exports.usePointer=qr;exports.useResponsive=no;exports.useTranslations=ao;
96
+ `,Ya=e=>{const{containerStyles:t,pageStyles:r,children:o,allowScroll:i=!0,floatingContent:a}=e,{footer:l,header:f,page:d}=Ba(e);return G.jsxs(Ua,{"data-testid":"page-container",styles:{minHeight:`calc(100% + ${d.extraHeight}px)`,...t},children:[f.visible&&G.jsx("div",{ref:f.ref,"data-testid":"page-header",style:{width:"100%",zIndex:99,position:f.visibility==="fixed"?"relative":"sticky",top:0,left:0,right:0,display:"flex",flexDirection:"row",height:"fit-content",boxSizing:"border-box",...f.styles},children:f.content}),G.jsx("div",{"data-testid":"page-layout",style:{width:"100%",overflowY:i?"auto":"hidden",display:"flex",flexDirection:"column",boxSizing:"border-box",top:`-${f.height}px`,bottom:`-${l.height}px`},children:G.jsx("div",{style:{width:"100%",flex:1,minHeight:"fit-content",padding:`${f.height}px 24px ${l.height}px 24px`,paddingBottom:"",boxSizing:"border-box",overflowY:i?void 0:"hidden",...r},children:o})}),l.visible&&G.jsx("div",{ref:l.ref,"data-testid":"page-footer",style:{width:"100%",zIndex:99,position:l.visibility==="fixed"?"relative":"sticky",bottom:0,left:0,right:0,display:"flex",flexDirection:"row",height:"fit-content",boxSizing:"border-box",...l.styles},children:l.content})]})},Va=({src:e,width:t="22",height:r="28",stroke:o,viewBox:i="0 0 22 28",fill:a="#000000",alt:l="",onClick:f,styles:d})=>G.jsx("div",{style:{width:"fit-content",height:"fit-content",display:"flex",alignItems:"center",justifyContent:"center",...d},onClick:()=>f?.(),children:G.jsx("svg",{width:t,height:r,viewBox:i,fill:a,stroke:o,xmlns:"http://www.w3.org/2000/svg",style:{display:"flex"},children:e})}),Xa=({id:e,children:t,styles:r,durationInSeconds:o=3})=>{const i=q.useRef(!1),{isItemVisible:a,hideItem:l}=et();return q.useEffect(()=>{const f=a(e);i.current!==f&&(i.current=f,f&&setTimeout(()=>l(e),o*1e3))},[i,a,l]),G.jsx(G.Fragment,{children:a(e)&&G.jsx("div",{style:{width:"100px",height:"40px",background:"#534a4aff",color:"#ffffff",position:"fixed",top:"10px",left:"50%",transform:"translateX(-50%)",zIndex:1e3,borderRadius:"20px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",border:"solid 3px #000000ff",...r},onClick:f=>{f.stopPropagation()},children:t})})},Ga=({overflowEllipsis:e,children:t,styles:r})=>G.jsx("p",{style:{fontFamily:"inherit",maxWidth:"100%",overflow:"hidden",whiteSpace:e?"nowrap":"normal",textOverflow:"ellipsis",fontSize:"16px",fontStyle:"normal",lineHeight:"normal",color:"#000000",...r},children:t});class Ka{static isScrollEnabled=()=>document.body.style.overflow==="unset"||document.body.style.overflow==="auto";static disableScroll=()=>{document.body.style.overflow="hidden"};static enableScroll=()=>{document.body.style.overflow="unset"}}class Ja{static getPascalCase=t=>t.replace(/\w+/g,function(r){return r[0].toUpperCase()+r.slice(1).toLowerCase()});static isEqual=(t,r,o=!0)=>o?t===r:t.toUpperCase()===r.toUpperCase()}exports.Button=xn;exports.Carousel=Qi;exports.Drawer=Aa;exports.FeedbackProvider=Ma;exports.Form=Ha;exports.Image=Na;exports.InputField=$a;exports.Loader=Wa;exports.Modal=qa;exports.NavigationProvider=La;exports.PageLayout=Ya;exports.ScrollHelper=Ka;exports.SvgImage=Va;exports.TextHelper=Ja;exports.TimeHelper=Ur;exports.Toast=Xa;exports.Typography=Ga;exports.defaultBreakpoints=Yr;exports.useDidMount=eo;exports.useDrag=Br;exports.useFeedback=et;exports.useFetch=to;exports.useIsTouchingParentElement=ro;exports.useNavigation=Da;exports.usePointer=qr;exports.useResponsive=no;exports.useTranslations=ao;
package/dist/index.es.js CHANGED
@@ -6129,7 +6129,8 @@ const fn = U.createContext({
6129
6129
  }, [t, t.current]), d = U.useCallback(() => {
6130
6130
  r.current && l(r.current.clientHeight);
6131
6131
  }, [r, r.current]), h = U.useCallback(() => {
6132
- e.header?.visibility, e.footer?.visibility;
6132
+ let w = 0;
6133
+ return e.header?.visibility === "always" && (w = w + (o || 0)), e.footer?.visibility === "always" && (w = w + (a || 0)), w;
6133
6134
  }, [r, r.current]);
6134
6135
  return U.useEffect(() => {
6135
6136
  f();
@@ -6153,7 +6154,7 @@ const fn = U.createContext({
6153
6154
  }
6154
6155
  };
6155
6156
  }, Da = je.div`
6156
- min-height: 100vh;
6157
+ min-height: 100%;
6157
6158
  width: 100%;
6158
6159
  min-width: 100%;
6159
6160
  position: relative;
@@ -6179,82 +6180,91 @@ const fn = U.createContext({
6179
6180
  allowScroll: i = !0,
6180
6181
  floatingContent: a
6181
6182
  } = e, { footer: l, header: f, page: d } = La(e);
6182
- return /* @__PURE__ */ G.jsxs(Da, { "data-testid": "page-container", styles: t, children: [
6183
- f.visible && /* @__PURE__ */ G.jsx(
6184
- "div",
6185
- {
6186
- ref: f.ref,
6187
- "data-testid": "page-header",
6188
- style: {
6189
- width: "100%",
6190
- zIndex: 99,
6191
- position: f.visibility === "fixed" ? "relative" : "sticky",
6192
- top: 0,
6193
- left: 0,
6194
- right: 0,
6195
- display: "flex",
6196
- flexDirection: "row",
6197
- height: "fit-content",
6198
- boxSizing: "border-box",
6199
- ...f.styles
6200
- },
6201
- children: f.content
6202
- }
6203
- ),
6204
- /* @__PURE__ */ G.jsx(
6205
- "div",
6206
- {
6207
- "data-testid": "page-layout",
6208
- style: {
6209
- minHeight: `calc(100% + ${d.extraHeight}px)`,
6210
- width: "100%",
6211
- overflowY: i ? "auto" : "hidden",
6212
- display: "flex",
6213
- flexDirection: "column",
6214
- boxSizing: "border-box",
6215
- top: `-${f.height}px`,
6216
- bottom: `-${l.height}px`
6217
- },
6218
- children: /* @__PURE__ */ G.jsx(
6183
+ return /* @__PURE__ */ G.jsxs(
6184
+ Da,
6185
+ {
6186
+ "data-testid": "page-container",
6187
+ styles: {
6188
+ minHeight: `calc(100% + ${d.extraHeight}px)`,
6189
+ ...t
6190
+ },
6191
+ children: [
6192
+ f.visible && /* @__PURE__ */ G.jsx(
6193
+ "div",
6194
+ {
6195
+ ref: f.ref,
6196
+ "data-testid": "page-header",
6197
+ style: {
6198
+ width: "100%",
6199
+ zIndex: 99,
6200
+ position: f.visibility === "fixed" ? "relative" : "sticky",
6201
+ top: 0,
6202
+ left: 0,
6203
+ right: 0,
6204
+ display: "flex",
6205
+ flexDirection: "row",
6206
+ height: "fit-content",
6207
+ boxSizing: "border-box",
6208
+ ...f.styles
6209
+ },
6210
+ children: f.content
6211
+ }
6212
+ ),
6213
+ /* @__PURE__ */ G.jsx(
6214
+ "div",
6215
+ {
6216
+ "data-testid": "page-layout",
6217
+ style: {
6218
+ width: "100%",
6219
+ overflowY: i ? "auto" : "hidden",
6220
+ display: "flex",
6221
+ flexDirection: "column",
6222
+ boxSizing: "border-box",
6223
+ top: `-${f.height}px`,
6224
+ bottom: `-${l.height}px`
6225
+ },
6226
+ children: /* @__PURE__ */ G.jsx(
6227
+ "div",
6228
+ {
6229
+ style: {
6230
+ width: "100%",
6231
+ flex: 1,
6232
+ minHeight: "fit-content",
6233
+ padding: `${f.height}px 24px ${l.height}px 24px`,
6234
+ paddingBottom: "",
6235
+ boxSizing: "border-box",
6236
+ overflowY: i ? void 0 : "hidden",
6237
+ ...r
6238
+ },
6239
+ children: o
6240
+ }
6241
+ )
6242
+ }
6243
+ ),
6244
+ l.visible && /* @__PURE__ */ G.jsx(
6219
6245
  "div",
6220
6246
  {
6247
+ ref: l.ref,
6248
+ "data-testid": "page-footer",
6221
6249
  style: {
6222
6250
  width: "100%",
6223
- flex: 1,
6224
- minHeight: "fit-content",
6225
- padding: `${f.height}px 24px ${l.height}px 24px`,
6226
- paddingBottom: "",
6251
+ zIndex: 99,
6252
+ position: l.visibility === "fixed" ? "relative" : "sticky",
6253
+ bottom: 0,
6254
+ left: 0,
6255
+ right: 0,
6256
+ display: "flex",
6257
+ flexDirection: "row",
6258
+ height: "fit-content",
6227
6259
  boxSizing: "border-box",
6228
- overflowY: i ? void 0 : "hidden",
6229
- ...r
6260
+ ...l.styles
6230
6261
  },
6231
- children: o
6262
+ children: l.content
6232
6263
  }
6233
6264
  )
6234
- }
6235
- ),
6236
- l.visible && /* @__PURE__ */ G.jsx(
6237
- "div",
6238
- {
6239
- ref: l.ref,
6240
- "data-testid": "page-footer",
6241
- style: {
6242
- width: "100%",
6243
- zIndex: 99,
6244
- position: l.visibility === "fixed" ? "relative" : "sticky",
6245
- bottom: 0,
6246
- left: 0,
6247
- right: 0,
6248
- display: "flex",
6249
- flexDirection: "row",
6250
- height: "fit-content",
6251
- boxSizing: "border-box",
6252
- ...l.styles
6253
- },
6254
- children: l.content
6255
- }
6256
- )
6257
- ] });
6265
+ ]
6266
+ }
6267
+ );
6258
6268
  }, Za = ({
6259
6269
  src: e,
6260
6270
  width: t = "22",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eliseubatista99/react-scaffold-core",
3
- "version": "0.1.21",
3
+ "version": "0.1.23",
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",