@eliseubatista99/react-scaffold-core 0.1.96 → 0.1.97

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,7 +1,7 @@
1
1
  import { StoryObj } from '@storybook/react-vite';
2
2
  declare const meta: {
3
3
  title: string;
4
- component: ({ name, checked, onToggle, styles, label, checkboxStyles, customCheckedRender, customUncheckedRender, }: import('../checkbox').CheckboxProps) => import("react/jsx-runtime").JSX.Element;
4
+ component: (props: import('../checkbox').CheckboxProps) => import("react/jsx-runtime").JSX.Element;
5
5
  parameters: {
6
6
  layout: string;
7
7
  };
@@ -21,4 +21,3 @@ declare const meta: {
21
21
  export default meta;
22
22
  type Story = StoryObj<typeof meta>;
23
23
  export declare const Default: Story;
24
- export declare const Checked: Story;
@@ -0,0 +1,2 @@
1
+ import { CheckboxProps } from '../checkbox';
2
+ export declare const CheckboxStoriesSetup: (props: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
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
- `,sa=({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,_)=>X.jsx(oa,{ref:_===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,_=l.current?.offsetWidth||1;let D=Math.floor(x/_);D<1?D=1:D>t.length&&(D=t.length),console.debug("Slides to show > ",{container:x,slide:_,res:D}),s(D)};return Y.useEffect(()=>{g()},[c,l]),X.jsx(aa,{ref:c,styles:{...e},children:h.length>0&&X.jsx(li,{...u,slidesToShow:a,children:h})})},la=({name:e,checked:t,onToggle:r,styles:i,label:a,checkboxStyles:s,customCheckedRender:c,customUncheckedRender:l})=>X.jsxs("div",{style:{width:"fit-content",height:"fit-content",position:"relative",display:"flex",flexDirection:"row",gap:"10px",alignItems:"center",...i},children:[X.jsxs("div",{style:{width:"fit-content",height:"fit-content",position:"relative",display:"flex"},children:[X.jsx("input",{type:"checkbox",name:e,checked:t,onChange:u=>{r?.(u.currentTarget.checked)},style:{position:"absolute",opacity:0,width:"100%",height:"100%",cursor:"pointer"}}),X.jsxs("div",{style:{width:"25px",height:"25px",borderRadius:"4px",border:"1px solid #969696ff",background:t?"#000":"#fff",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",...s},children:[t&&c,!t&&l]})]}),a]}),ua=e=>Y.useEffect(e,[]),Zr=()=>{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}},Qr=({ref:e,onDrag:t,onDragStart:r,onDragEnd:i})=>{const a=Y.useRef(!1),s=Y.useRef(!1),{pointerPosition:c,isPointerDown:l}=Zr(),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]),_=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]),D=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(()=>{D()},[D]),Y.useEffect(()=>{_()},[c]),Y.useEffect(()=>{l!==s.current&&(s.current=l,l||x())},[l,s.current])},ca=()=>{const e=(l,u)=>{if(!u)return l;const h=new URLSearchParams;for(const x in u){const _=u[x];Array.isArray(_)?_.forEach(D=>h.append(x,String(D))):_!=null&&h.append(x,String(_))}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 fa(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 en={xs:0,sm:420,md:768,lg:991,xl:1200,xxl:1440},da=e=>{const t={...en,...e?.breakpointConfiguration},[r,i]=Y.useState(Pr(t)),a=()=>{i(Pr(t))};return Y.useEffect(()=>(window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}),[]),Y.useMemo(()=>r,[r])},ha=(e,t)=>e<t.sm?"xs":e<t.md?"sm":e<t.lg?"md":e<t.xl?"lg":e<t.xxl?"xl":"xxl",pa=(e,t)=>e<=t.sm?"mobile":e<=t.md?"tablet":"desktop",Pr=e=>{const t=window.innerWidth,r=window.innerHeight,i=ha(t,e),a=pa(t,e);return{currentWidth:t,currentHeight:r,currentBreakpoint:i,currentSize:a}},ma=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={},Er;function va(){if(Er)return Ue;Er=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 _=function(){};return _.prototype=Object.create(null),_})();function c(_,D){const P=new s,p=_.length;if(p<2)return P;const I=D?.decode||g;let O=0;do{const F=_.indexOf("=",O);if(F===-1)break;const U=_.indexOf(";",O),q=U===-1?p:U;if(F>q){O=_.lastIndexOf(";",F-1)+1;continue}const v=l(_,O,F),b=u(_,F,v),w=_.slice(v,b);if(P[w]===void 0){let E=l(_,F+1,q),y=u(_,q,E);const d=I(_.slice(E,y));P[w]=d}O=q+1}while(O<p);return P}function l(_,D,P){do{const p=_.charCodeAt(D);if(p!==32&&p!==9)return D}while(++D<P);return P}function u(_,D,P){for(;D>P;){const p=_.charCodeAt(--D);if(p!==32&&p!==9)return D+1}return P}function h(_,D,P){const p=P?.encode||encodeURIComponent;if(!e.test(_))throw new TypeError(`argument name is invalid: ${_}`);const I=p(D);if(!t.test(I))throw new TypeError(`argument val is invalid: ${D}`);let O=_+"="+I;if(!P)return O;if(P.maxAge!==void 0){if(!Number.isInteger(P.maxAge))throw new TypeError(`option maxAge is invalid: ${P.maxAge}`);O+="; Max-Age="+P.maxAge}if(P.domain){if(!r.test(P.domain))throw new TypeError(`option domain is invalid: ${P.domain}`);O+="; Domain="+P.domain}if(P.path){if(!i.test(P.path))throw new TypeError(`option path is invalid: ${P.path}`);O+="; Path="+P.path}if(P.expires){if(!x(P.expires)||!Number.isFinite(P.expires.valueOf()))throw new TypeError(`option expires is invalid: ${P.expires}`);O+="; Expires="+P.expires.toUTCString()}if(P.httpOnly&&(O+="; HttpOnly"),P.secure&&(O+="; Secure"),P.partitioned&&(O+="; Partitioned"),P.priority)switch(typeof P.priority=="string"?P.priority.toLowerCase():void 0){case"low":O+="; Priority=Low";break;case"medium":O+="; Priority=Medium";break;case"high":O+="; 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":O+="; SameSite=Strict";break;case"lax":O+="; SameSite=Lax";break;case"none":O+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${P.sameSite}`)}return O}function g(_){if(_.indexOf("%")===-1)return _;try{return decodeURIComponent(_)}catch{return _}}function x(_){return a.call(_)==="[object Date]"}return Ue}va();/**
115
+ `,sa=({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,_)=>X.jsx(oa,{ref:_===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,_=l.current?.offsetWidth||1;let D=Math.floor(x/_);D<1?D=1:D>t.length&&(D=t.length),console.debug("Slides to show > ",{container:x,slide:_,res:D}),s(D)};return Y.useEffect(()=>{g()},[c,l]),X.jsx(aa,{ref:c,styles:{...e},children:h.length>0&&X.jsx(li,{...u,slidesToShow:a,children:h})})},la=({name:e,checked:t,onToggle:r,styles:i,label:a,checkboxStyles:s,customCheckedRender:c,customUncheckedRender:l})=>X.jsxs("div",{style:{width:"fit-content",height:"fit-content",position:"relative",display:"flex",flexDirection:"row",gap:"10px",alignItems:"center",...i},children:[X.jsxs("div",{style:{width:"fit-content",height:"fit-content",position:"relative",display:"flex"},children:[X.jsx("input",{type:"checkbox",name:e,checked:t,onChange:u=>{},onClick:u=>{u.stopPropagation(),r?.(!t)},style:{position:"absolute",opacity:0,width:"100%",height:"100%",cursor:"pointer"}}),X.jsxs("div",{style:{width:"25px",height:"25px",borderRadius:"4px",border:"1px solid #969696ff",background:t?"#000":"#fff",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",...s},children:[t&&c,!t&&l]})]}),a]}),ua=e=>Y.useEffect(e,[]),Zr=()=>{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}},Qr=({ref:e,onDrag:t,onDragStart:r,onDragEnd:i})=>{const a=Y.useRef(!1),s=Y.useRef(!1),{pointerPosition:c,isPointerDown:l}=Zr(),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]),_=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]),D=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(()=>{D()},[D]),Y.useEffect(()=>{_()},[c]),Y.useEffect(()=>{l!==s.current&&(s.current=l,l||x())},[l,s.current])},ca=()=>{const e=(l,u)=>{if(!u)return l;const h=new URLSearchParams;for(const x in u){const _=u[x];Array.isArray(_)?_.forEach(D=>h.append(x,String(D))):_!=null&&h.append(x,String(_))}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 fa(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 en={xs:0,sm:420,md:768,lg:991,xl:1200,xxl:1440},da=e=>{const t={...en,...e?.breakpointConfiguration},[r,i]=Y.useState(Pr(t)),a=()=>{i(Pr(t))};return Y.useEffect(()=>(window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}),[]),Y.useMemo(()=>r,[r])},ha=(e,t)=>e<t.sm?"xs":e<t.md?"sm":e<t.lg?"md":e<t.xl?"lg":e<t.xxl?"xl":"xxl",pa=(e,t)=>e<=t.sm?"mobile":e<=t.md?"tablet":"desktop",Pr=e=>{const t=window.innerWidth,r=window.innerHeight,i=ha(t,e),a=pa(t,e);return{currentWidth:t,currentHeight:r,currentBreakpoint:i,currentSize:a}},ma=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={},Er;function va(){if(Er)return Ue;Er=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 _=function(){};return _.prototype=Object.create(null),_})();function c(_,D){const P=new s,p=_.length;if(p<2)return P;const I=D?.decode||g;let O=0;do{const F=_.indexOf("=",O);if(F===-1)break;const U=_.indexOf(";",O),q=U===-1?p:U;if(F>q){O=_.lastIndexOf(";",F-1)+1;continue}const v=l(_,O,F),b=u(_,F,v),w=_.slice(v,b);if(P[w]===void 0){let E=l(_,F+1,q),y=u(_,q,E);const d=I(_.slice(E,y));P[w]=d}O=q+1}while(O<p);return P}function l(_,D,P){do{const p=_.charCodeAt(D);if(p!==32&&p!==9)return D}while(++D<P);return P}function u(_,D,P){for(;D>P;){const p=_.charCodeAt(--D);if(p!==32&&p!==9)return D+1}return P}function h(_,D,P){const p=P?.encode||encodeURIComponent;if(!e.test(_))throw new TypeError(`argument name is invalid: ${_}`);const I=p(D);if(!t.test(I))throw new TypeError(`argument val is invalid: ${D}`);let O=_+"="+I;if(!P)return O;if(P.maxAge!==void 0){if(!Number.isInteger(P.maxAge))throw new TypeError(`option maxAge is invalid: ${P.maxAge}`);O+="; Max-Age="+P.maxAge}if(P.domain){if(!r.test(P.domain))throw new TypeError(`option domain is invalid: ${P.domain}`);O+="; Domain="+P.domain}if(P.path){if(!i.test(P.path))throw new TypeError(`option path is invalid: ${P.path}`);O+="; Path="+P.path}if(P.expires){if(!x(P.expires)||!Number.isFinite(P.expires.valueOf()))throw new TypeError(`option expires is invalid: ${P.expires}`);O+="; Expires="+P.expires.toUTCString()}if(P.httpOnly&&(O+="; HttpOnly"),P.secure&&(O+="; Secure"),P.partitioned&&(O+="; Partitioned"),P.priority)switch(typeof P.priority=="string"?P.priority.toLowerCase():void 0){case"low":O+="; Priority=Low";break;case"medium":O+="; Priority=Medium";break;case"high":O+="; 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":O+="; SameSite=Strict";break;case"lax":O+="; SameSite=Lax";break;case"none":O+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${P.sameSite}`)}return O}function g(_){if(_.indexOf("%")===-1)return _;try{return decodeURIComponent(_)}catch{return _}}function x(_){return a.call(_)==="[object Date]"}return Ue}va();/**
116
116
  * react-router v7.6.3
117
117
  *
118
118
  * Copyright (c) Remix Software Inc.
package/dist/index.es.js CHANGED
@@ -3917,7 +3917,9 @@ const aa = Pe.div`
3917
3917
  name: e,
3918
3918
  checked: t,
3919
3919
  onChange: (u) => {
3920
- r?.(u.currentTarget.checked);
3920
+ },
3921
+ onClick: (u) => {
3922
+ u.stopPropagation(), r?.(!t);
3921
3923
  },
3922
3924
  style: {
3923
3925
  position: "absolute",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eliseubatista99/react-scaffold-core",
3
- "version": "0.1.96",
3
+ "version": "0.1.97",
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",