@eliseubatista99/react-scaffold-core 0.1.73 → 0.1.74
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/hooks/useFetch/useFetch.d.ts +5 -5
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +12 -12
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
type runFetchOptions = Record<string, any>;
|
|
2
2
|
export declare const useFetch: () => {
|
|
3
|
-
get: <OutputType>(endpointUrl: string, options?: runFetchOptions) => Promise<OutputType>;
|
|
4
|
-
post: <OutputType>(endpointUrl: string, options?: runFetchOptions) => Promise<OutputType>;
|
|
5
|
-
put: <OutputType>(endpointUrl: string, options?: runFetchOptions) => Promise<OutputType>;
|
|
6
|
-
patch: <OutputType>(endpointUrl: string, options?: runFetchOptions) => Promise<OutputType>;
|
|
7
|
-
delete: <OutputType>(endpointUrl: string, options?: runFetchOptions) => Promise<OutputType>;
|
|
3
|
+
get: <OutputType>(endpointUrl: string, options?: runFetchOptions, headers?: HeadersInit) => Promise<OutputType>;
|
|
4
|
+
post: <OutputType>(endpointUrl: string, options?: runFetchOptions, headers?: HeadersInit) => Promise<OutputType>;
|
|
5
|
+
put: <OutputType>(endpointUrl: string, options?: runFetchOptions, headers?: HeadersInit) => Promise<OutputType>;
|
|
6
|
+
patch: <OutputType>(endpointUrl: string, options?: runFetchOptions, headers?: HeadersInit) => Promise<OutputType>;
|
|
7
|
+
delete: <OutputType>(endpointUrl: string, options?: runFetchOptions, headers?: HeadersInit) => Promise<OutputType>;
|
|
8
8
|
};
|
|
9
9
|
export {};
|
package/dist/index.cjs.js
CHANGED
|
@@ -112,7 +112,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
112
112
|
box-sizing: border-box;
|
|
113
113
|
display: flex;
|
|
114
114
|
}
|
|
115
|
-
`,aa=({styles:e,content:t,settings:r,gap:i=15})=>{const[a,s]=Y.useState(1),c=Y.useRef(null),l=Y.useRef(null);var u={dots:!1,speed:500,slidesToScroll:1,infinite:!1,variableWidth:!0,arrows:!1,rows:1,...r};const h=t.map((x,j)=>K.jsx(ia,{ref:j===0?l:void 0,styles:{paddingRight:`${i}px`,overflow:"visible",...x.styles},"data-testid":"carousel-slide-item",children:x.content})),g=()=>{if(u.slidesToShow){s(u.slidesToShow);return}const x=(c.current?.offsetWidth||i+1)-i,j=l.current?.offsetWidth||1;let M=Math.floor(x/j);M<1?M=1:M>t.length&&(M=t.length),console.debug("Slides to show > ",{container:x,slide:j,res:M}),s(M)};return Y.useEffect(()=>{g()},[c,l]),K.jsx(na,{ref:c,styles:{...e},children:h.length>0&&K.jsx(oi,{...u,slidesToShow:a,children:h})})},oa=({checked:e,onToggle:t,styles:r,checkedStyles:i,customCheckedRender:a,customUncheckedRender:s})=>{const c=e?{...r,...i}:{...r};return K.jsxs("div",{onClick:l=>{l.preventDefault(),l.stopPropagation(),t?.(!e)},style:{width:"25px",height:"25px",borderRadius:"4px",border:"1px solid #969696ff",background:e?"#000000":"#ffffff",overflow:"hidden",objectFit:"contain",alignItems:"center",justifyContent:"center",display:"flex",...c},children:[e&&a,!e&&s]})},sa=e=>Y.useEffect(e,[]),Jr=()=>{const[e,t]=Y.useState({}),[r,i]=Y.useState(!1);return Y.useEffect(()=>{const a=l=>{t({x:l.clientX,y:l.clientY})},s=l=>{i(!0)},c=l=>{i(!1)};return window.addEventListener("pointermove",a),window.addEventListener("pointerdown",s),window.addEventListener("pointerup",c),()=>{window.removeEventListener("pointermove",a),window.removeEventListener("pointerdown",s),window.removeEventListener("pointerup",c)}},[]),{pointerPosition:e,isPointerDown:r}},Zr=({ref:e,onDrag:t,onDragStart:r,onDragEnd:i})=>{const a=Y.useRef(!1),s=Y.useRef(!1),{pointerPosition:c,isPointerDown:l}=Jr(),u=Y.useRef({isDragging:!1}),h=Y.useCallback(P=>{if(!e||!e.current||!u.current)return;const p={...u.current};return p.posY=P.y,p.posX=P.x,u.current.startPosX&&u.current.posX&&(p.distanceX=u.current.startPosX-u.current.posX),u.current.startPosY&&u.current.posY&&(p.distanceY=-(u.current.startPosY-u.current.posY)),p},[]),g=Y.useCallback(P=>{P.preventDefault(),P.stopPropagation(),u.current.isDragging=!0,u.current.startPosY=P.clientY,u.current.startPosX=P.clientX;const p=h({x:P.clientX,y:P.clientY});p&&(u.current=p,r?.(p))},[h]),x=Y.useCallback(P=>{u.current.isDragging=!1;const p=h(c);p&&(i?.(p),p.startPosX=void 0,p.startPosY=void 0,u.current=p)},[h,c]),j=Y.useCallback(P=>{if(console.debug("useDrag > onPointerMove > Is Dragging >",u.current.isDragging),!u.current.isDragging)return;const p=h(c);console.debug("useDrag > onPointerMove > Drag Result >",p),p&&(t?.(p),u.current=p)},[h,c]),M=Y.useCallback(async()=>{if(!a.current){for(;!e?.current;)await new Promise(P=>setTimeout(P,300));a.current=!0,e.current.onpointerdown=g,e.current.style.touchAction="none"}},[e?.current,g]);Y.useEffect(()=>{M()},[M]),Y.useEffect(()=>{j()},[c]),Y.useEffect(()=>{l!==s.current&&(s.current=l,l||x())},[l,s.current])},la=()=>{const e=(l,u)=>{if(!u)return l;const h=new URLSearchParams;for(const x in u){const j=u[x];Array.isArray(j)?j.forEach(M=>h.append(x,String(M))):j!=null&&h.append(x,String(j))}const g=h.toString();return g?`${l}?${g}`:l},t=async(l,u,h,g)=>await(await fetch(l,{method:u,headers:h,body:g})).json();return{get:async(l,u)=>{const
|
|
115
|
+
`,aa=({styles:e,content:t,settings:r,gap:i=15})=>{const[a,s]=Y.useState(1),c=Y.useRef(null),l=Y.useRef(null);var u={dots:!1,speed:500,slidesToScroll:1,infinite:!1,variableWidth:!0,arrows:!1,rows:1,...r};const h=t.map((x,j)=>K.jsx(ia,{ref:j===0?l:void 0,styles:{paddingRight:`${i}px`,overflow:"visible",...x.styles},"data-testid":"carousel-slide-item",children:x.content})),g=()=>{if(u.slidesToShow){s(u.slidesToShow);return}const x=(c.current?.offsetWidth||i+1)-i,j=l.current?.offsetWidth||1;let M=Math.floor(x/j);M<1?M=1:M>t.length&&(M=t.length),console.debug("Slides to show > ",{container:x,slide:j,res:M}),s(M)};return Y.useEffect(()=>{g()},[c,l]),K.jsx(na,{ref:c,styles:{...e},children:h.length>0&&K.jsx(oi,{...u,slidesToShow:a,children:h})})},oa=({checked:e,onToggle:t,styles:r,checkedStyles:i,customCheckedRender:a,customUncheckedRender:s})=>{const c=e?{...r,...i}:{...r};return K.jsxs("div",{onClick:l=>{l.preventDefault(),l.stopPropagation(),t?.(!e)},style:{width:"25px",height:"25px",borderRadius:"4px",border:"1px solid #969696ff",background:e?"#000000":"#ffffff",overflow:"hidden",objectFit:"contain",alignItems:"center",justifyContent:"center",display:"flex",...c},children:[e&&a,!e&&s]})},sa=e=>Y.useEffect(e,[]),Jr=()=>{const[e,t]=Y.useState({}),[r,i]=Y.useState(!1);return Y.useEffect(()=>{const a=l=>{t({x:l.clientX,y:l.clientY})},s=l=>{i(!0)},c=l=>{i(!1)};return window.addEventListener("pointermove",a),window.addEventListener("pointerdown",s),window.addEventListener("pointerup",c),()=>{window.removeEventListener("pointermove",a),window.removeEventListener("pointerdown",s),window.removeEventListener("pointerup",c)}},[]),{pointerPosition:e,isPointerDown:r}},Zr=({ref:e,onDrag:t,onDragStart:r,onDragEnd:i})=>{const a=Y.useRef(!1),s=Y.useRef(!1),{pointerPosition:c,isPointerDown:l}=Jr(),u=Y.useRef({isDragging:!1}),h=Y.useCallback(P=>{if(!e||!e.current||!u.current)return;const p={...u.current};return p.posY=P.y,p.posX=P.x,u.current.startPosX&&u.current.posX&&(p.distanceX=u.current.startPosX-u.current.posX),u.current.startPosY&&u.current.posY&&(p.distanceY=-(u.current.startPosY-u.current.posY)),p},[]),g=Y.useCallback(P=>{P.preventDefault(),P.stopPropagation(),u.current.isDragging=!0,u.current.startPosY=P.clientY,u.current.startPosX=P.clientX;const p=h({x:P.clientX,y:P.clientY});p&&(u.current=p,r?.(p))},[h]),x=Y.useCallback(P=>{u.current.isDragging=!1;const p=h(c);p&&(i?.(p),p.startPosX=void 0,p.startPosY=void 0,u.current=p)},[h,c]),j=Y.useCallback(P=>{if(console.debug("useDrag > onPointerMove > Is Dragging >",u.current.isDragging),!u.current.isDragging)return;const p=h(c);console.debug("useDrag > onPointerMove > Drag Result >",p),p&&(t?.(p),u.current=p)},[h,c]),M=Y.useCallback(async()=>{if(!a.current){for(;!e?.current;)await new Promise(P=>setTimeout(P,300));a.current=!0,e.current.onpointerdown=g,e.current.style.touchAction="none"}},[e?.current,g]);Y.useEffect(()=>{M()},[M]),Y.useEffect(()=>{j()},[c]),Y.useEffect(()=>{l!==s.current&&(s.current=l,l||x())},[l,s.current])},la=()=>{const e=(l,u)=>{if(!u)return l;const h=new URLSearchParams;for(const x in u){const j=u[x];Array.isArray(j)?j.forEach(M=>h.append(x,String(M))):j!=null&&h.append(x,String(j))}const g=h.toString();return g?`${l}?${g}`:l},t=async(l,u,h,g)=>await(await fetch(l,{method:u,headers:h,body:g})).json();return{get:async(l,u,h)=>{const g=e(l,u);return t(g,"GET",{...h})},post:async(l,u,h)=>t(l,"POST",{"Content-Type":"application/json",...h},JSON.stringify(u)),put:async(l,u,h)=>t(l,"PUT",{"Content-Type":"application/json",...h},JSON.stringify(u)),patch:async(l,u,h)=>t(l,"PATCH",{"Content-Type":"application/json",...h},JSON.stringify(u)),delete:async(l,u,h)=>{const g=e(l,u);return t(g,"DELETE",{...h})}}};function ua(e){const[t,r]=Y.useState(!1),i=Y.useMemo(()=>new IntersectionObserver(([a])=>r(a.isIntersecting)),[]);return Y.useEffect(()=>(e?.current&&i.observe(e?.current),()=>i.disconnect()),[e,i.disconnect,i.observe]),t}const Qr={xs:0,sm:420,md:768,lg:991,xl:1200,xxl:1440},ca=e=>{const t={...Qr,...e?.breakpointConfiguration},[r,i]=Y.useState(Cr(t)),a=()=>{i(Cr(t))};return Y.useEffect(()=>(window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}),[]),Y.useMemo(()=>r,[r])},fa=(e,t)=>e<t.sm?"xs":e<t.md?"sm":e<t.lg?"md":e<t.xl?"lg":e<t.xxl?"xl":"xxl",da=(e,t)=>e<=t.sm?"mobile":e<=t.md?"tablet":"desktop",Cr=e=>{const t=window.innerWidth,r=window.innerHeight,i=fa(t,e),a=da(t,e);return{currentWidth:t,currentHeight:r,currentBreakpoint:i,currentSize:a}},ha=e=>{const t=e.translations,r=e.language,i=(s,c)=>{if(!s)return;let l=s[r];if(l)return c&&Object.keys(c).forEach(u=>{const h=c[u];l=l.replaceAll(`{{${u}}}`,`${h}`)}),l};return{t:(s,c)=>{if(t[s]){const l=i(t[s],c);return l??s}return s},getTranslation:i}};var Ue={},Pr;function pa(){if(Pr)return Ue;Pr=1,Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.parse=c,Ue.serialize=h;const e=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,t=/^[\u0021-\u003A\u003C-\u007E]*$/,r=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,i=/^[\u0020-\u003A\u003D-\u007E]*$/,a=Object.prototype.toString,s=(()=>{const j=function(){};return j.prototype=Object.create(null),j})();function c(j,M){const P=new s,p=j.length;if(p<2)return P;const I=M?.decode||g;let k=0;do{const F=j.indexOf("=",k);if(F===-1)break;const U=j.indexOf(";",k),B=U===-1?p:U;if(F>B){k=j.lastIndexOf(";",F-1)+1;continue}const v=l(j,k,F),b=u(j,F,v),w=j.slice(v,b);if(P[w]===void 0){let E=l(j,F+1,B),y=u(j,B,E);const d=I(j.slice(E,y));P[w]=d}k=B+1}while(k<p);return P}function l(j,M,P){do{const p=j.charCodeAt(M);if(p!==32&&p!==9)return M}while(++M<P);return P}function u(j,M,P){for(;M>P;){const p=j.charCodeAt(--M);if(p!==32&&p!==9)return M+1}return P}function h(j,M,P){const p=P?.encode||encodeURIComponent;if(!e.test(j))throw new TypeError(`argument name is invalid: ${j}`);const I=p(M);if(!t.test(I))throw new TypeError(`argument val is invalid: ${M}`);let k=j+"="+I;if(!P)return k;if(P.maxAge!==void 0){if(!Number.isInteger(P.maxAge))throw new TypeError(`option maxAge is invalid: ${P.maxAge}`);k+="; Max-Age="+P.maxAge}if(P.domain){if(!r.test(P.domain))throw new TypeError(`option domain is invalid: ${P.domain}`);k+="; Domain="+P.domain}if(P.path){if(!i.test(P.path))throw new TypeError(`option path is invalid: ${P.path}`);k+="; Path="+P.path}if(P.expires){if(!x(P.expires)||!Number.isFinite(P.expires.valueOf()))throw new TypeError(`option expires is invalid: ${P.expires}`);k+="; Expires="+P.expires.toUTCString()}if(P.httpOnly&&(k+="; HttpOnly"),P.secure&&(k+="; Secure"),P.partitioned&&(k+="; Partitioned"),P.priority)switch(typeof P.priority=="string"?P.priority.toLowerCase():void 0){case"low":k+="; Priority=Low";break;case"medium":k+="; Priority=Medium";break;case"high":k+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${P.priority}`)}if(P.sameSite)switch(typeof P.sameSite=="string"?P.sameSite.toLowerCase():P.sameSite){case!0:case"strict":k+="; SameSite=Strict";break;case"lax":k+="; SameSite=Lax";break;case"none":k+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${P.sameSite}`)}return k}function g(j){if(j.indexOf("%")===-1)return j;try{return decodeURIComponent(j)}catch{return j}}function x(j){return a.call(j)==="[object Date]"}return Ue}pa();/**
|
|
116
116
|
* react-router v7.6.3
|
|
117
117
|
*
|
|
118
118
|
* Copyright (c) Remix Software Inc.
|
package/dist/index.es.js
CHANGED
|
@@ -4001,31 +4001,31 @@ const na = Pe.div`
|
|
|
4001
4001
|
body: g
|
|
4002
4002
|
})).json();
|
|
4003
4003
|
return {
|
|
4004
|
-
get: async (l, u) => {
|
|
4005
|
-
const
|
|
4006
|
-
return t(
|
|
4004
|
+
get: async (l, u, h) => {
|
|
4005
|
+
const g = e(l, u);
|
|
4006
|
+
return t(g, "GET", { ...h });
|
|
4007
4007
|
},
|
|
4008
|
-
post: async (l, u) => t(
|
|
4008
|
+
post: async (l, u, h) => t(
|
|
4009
4009
|
l,
|
|
4010
4010
|
"POST",
|
|
4011
|
-
{ "Content-Type": "application/json" },
|
|
4011
|
+
{ "Content-Type": "application/json", ...h },
|
|
4012
4012
|
JSON.stringify(u)
|
|
4013
4013
|
),
|
|
4014
|
-
put: async (l, u) => t(
|
|
4014
|
+
put: async (l, u, h) => t(
|
|
4015
4015
|
l,
|
|
4016
4016
|
"PUT",
|
|
4017
|
-
{ "Content-Type": "application/json" },
|
|
4017
|
+
{ "Content-Type": "application/json", ...h },
|
|
4018
4018
|
JSON.stringify(u)
|
|
4019
4019
|
),
|
|
4020
|
-
patch: async (l, u) => t(
|
|
4020
|
+
patch: async (l, u, h) => t(
|
|
4021
4021
|
l,
|
|
4022
4022
|
"PATCH",
|
|
4023
|
-
{ "Content-Type": "application/json" },
|
|
4023
|
+
{ "Content-Type": "application/json", ...h },
|
|
4024
4024
|
JSON.stringify(u)
|
|
4025
4025
|
),
|
|
4026
|
-
delete: async (l, u) => {
|
|
4027
|
-
const
|
|
4028
|
-
return t(
|
|
4026
|
+
delete: async (l, u, h) => {
|
|
4027
|
+
const g = e(l, u);
|
|
4028
|
+
return t(g, "DELETE", { ...h });
|
|
4029
4029
|
}
|
|
4030
4030
|
};
|
|
4031
4031
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eliseubatista99/react-scaffold-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.74",
|
|
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",
|