@eliseubatista99/react-scaffold-core 0.1.93 → 0.1.95
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.
|
@@ -2,10 +2,11 @@ import { CSSProperties } from 'react';
|
|
|
2
2
|
export type CheckboxProps = {
|
|
3
3
|
name: string;
|
|
4
4
|
checked?: boolean;
|
|
5
|
+
label?: React.ReactNode;
|
|
5
6
|
customUncheckedRender?: React.ReactNode;
|
|
6
7
|
customCheckedRender?: React.ReactNode;
|
|
7
8
|
onToggle?: (checked: boolean) => void;
|
|
8
9
|
styles?: CSSProperties;
|
|
9
|
-
|
|
10
|
+
checkboxStyles?: CSSProperties;
|
|
10
11
|
};
|
|
11
|
-
export declare const Checkbox: ({ name, checked, onToggle, styles,
|
|
12
|
+
export declare const Checkbox: ({ name, checked, onToggle, styles, label, checkboxStyles, customCheckedRender, customUncheckedRender, }: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react-vite';
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: ({ name, checked, onToggle, styles,
|
|
4
|
+
component: ({ name, checked, onToggle, styles, label, checkboxStyles, customCheckedRender, customUncheckedRender, }: import('../checkbox').CheckboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
parameters: {
|
|
6
6
|
layout: string;
|
|
7
7
|
};
|
|
8
8
|
tags: string[];
|
|
9
9
|
args: {
|
|
10
|
+
label: import("react/jsx-runtime").JSX.Element;
|
|
10
11
|
name: string;
|
|
11
12
|
checked: false;
|
|
12
13
|
customCheckedRender: import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
customUncheckedRender: import("react/jsx-runtime").JSX.Element;
|
|
14
|
-
|
|
15
|
+
checkboxStyles: {
|
|
15
16
|
width: string;
|
|
16
17
|
height: string;
|
|
17
18
|
};
|
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,
|
|
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",{name:e,type:"checkbox",onChange:u=>{u.stopPropagation(),r?.(u.currentTarget.checked)},checked:t,style:{appearance:"none",width:"25px",height:"25px",borderRadius:"4px",border:"1px solid #969696ff",background:t?"#000000":"#ffffff",overflow:"hidden",objectFit:"contain",alignItems:"center",justifyContent:"center",display:"flex",...s}}),X.jsxs("div",{style:{display:"flex",position:"absolute",top:0,left:0,width:"100%",height:"100%",alignItems:"center",justifyContent:"center",pointerEvents:"none"},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
|
@@ -3882,70 +3882,86 @@ const aa = Pe.div`
|
|
|
3882
3882
|
checked: t,
|
|
3883
3883
|
onToggle: r,
|
|
3884
3884
|
styles: i,
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
{
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3885
|
+
label: a,
|
|
3886
|
+
checkboxStyles: s,
|
|
3887
|
+
customCheckedRender: c,
|
|
3888
|
+
customUncheckedRender: l
|
|
3889
|
+
}) => /* @__PURE__ */ X.jsxs(
|
|
3890
|
+
"div",
|
|
3891
|
+
{
|
|
3892
|
+
style: {
|
|
3893
|
+
width: "fit-content",
|
|
3894
|
+
height: "fit-content",
|
|
3895
|
+
position: "relative",
|
|
3896
|
+
display: "flex",
|
|
3897
|
+
flexDirection: "row",
|
|
3898
|
+
gap: "10px",
|
|
3899
|
+
alignItems: "center",
|
|
3900
|
+
...i
|
|
3901
|
+
},
|
|
3902
|
+
children: [
|
|
3903
|
+
/* @__PURE__ */ X.jsxs(
|
|
3904
|
+
"div",
|
|
3905
|
+
{
|
|
3906
|
+
style: {
|
|
3907
|
+
width: "fit-content",
|
|
3908
|
+
height: "fit-content",
|
|
3909
|
+
position: "relative",
|
|
3910
|
+
display: "flex"
|
|
3911
|
+
},
|
|
3912
|
+
children: [
|
|
3913
|
+
/* @__PURE__ */ X.jsx(
|
|
3914
|
+
"input",
|
|
3915
|
+
{
|
|
3916
|
+
name: e,
|
|
3917
|
+
type: "checkbox",
|
|
3918
|
+
onChange: (u) => {
|
|
3919
|
+
u.stopPropagation(), r?.(u.currentTarget.checked);
|
|
3920
|
+
},
|
|
3921
|
+
checked: t,
|
|
3922
|
+
style: {
|
|
3923
|
+
appearance: "none",
|
|
3924
|
+
width: "25px",
|
|
3925
|
+
height: "25px",
|
|
3926
|
+
borderRadius: "4px",
|
|
3927
|
+
border: "1px solid #969696ff",
|
|
3928
|
+
background: t ? "#000000" : "#ffffff",
|
|
3929
|
+
overflow: "hidden",
|
|
3930
|
+
objectFit: "contain",
|
|
3931
|
+
alignItems: "center",
|
|
3932
|
+
justifyContent: "center",
|
|
3933
|
+
display: "flex",
|
|
3934
|
+
...s
|
|
3935
|
+
}
|
|
3936
|
+
}
|
|
3937
|
+
),
|
|
3938
|
+
/* @__PURE__ */ X.jsxs(
|
|
3939
|
+
"div",
|
|
3940
|
+
{
|
|
3941
|
+
style: {
|
|
3942
|
+
display: "flex",
|
|
3943
|
+
position: "absolute",
|
|
3944
|
+
top: 0,
|
|
3945
|
+
left: 0,
|
|
3946
|
+
width: "100%",
|
|
3947
|
+
height: "100%",
|
|
3948
|
+
alignItems: "center",
|
|
3949
|
+
justifyContent: "center",
|
|
3950
|
+
pointerEvents: "none"
|
|
3951
|
+
},
|
|
3952
|
+
children: [
|
|
3953
|
+
t && c,
|
|
3954
|
+
!t && l
|
|
3955
|
+
]
|
|
3956
|
+
}
|
|
3957
|
+
)
|
|
3958
|
+
]
|
|
3959
|
+
}
|
|
3960
|
+
),
|
|
3961
|
+
a
|
|
3962
|
+
]
|
|
3963
|
+
}
|
|
3964
|
+
), ls = (e) => Ir(e, []), sa = () => {
|
|
3949
3965
|
const [e, t] = q.useState(
|
|
3950
3966
|
{}
|
|
3951
3967
|
), [r, i] = q.useState(!1);
|
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.95",
|
|
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",
|