@mirantes-micro/foundation-design-system 1.2.221 → 1.2.222

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3573,7 +3573,7 @@ query Communities($options: SearchCommunityInput) {
3573
3573
  postType
3574
3574
  }
3575
3575
  }
3576
- `;var YD=zustand.create(e=>({filter:"all",setFilter:t=>e({filter:t})}));function Bne(e,t,o,r,n,a){let s=e!=null?e:[];if(t&&t===o)return {reactions:s==null?void 0:s.filter(i=>i.userId!==r),currentUserReaction:""};if(t&&o!=="")return {reactions:s.map(i=>(i==null?void 0:i.userId)===r?F(y({},i),{reaction:o}):i),currentUserReaction:o};if(o!==""){let i={id:`optimistic-${Date.now()}`,postId:n,userId:r,reaction:o,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),user:{id:a==null?void 0:a.id,name:a==null?void 0:a.name,email:a==null?void 0:a.email,avatar:a==null?void 0:a.avatar,slug:a==null?void 0:a.slug,headline:a==null?void 0:a.headline}};return {reactions:[...s,i],currentUserReaction:o}}return {reactions:s==null?void 0:s.filter(i=>(i==null?void 0:i.userId)!==r),currentUserReaction:""}}function cf(e,t,o,r){let{reactions:n,currentUserReaction:a}=Bne(e==null?void 0:e.reactions,e==null?void 0:e.currentUserReaction,t,o,e.id,r);return F(y({},e),{reactions:n,currentUserReaction:a,totalReactions:n==null?void 0:n.length})}function JD({postType:e,post:t}){var c;let{user:o,feedApi:r,queryClient:n}=I(),a=(c=o==null?void 0:o.id)!=null?c:"",{filter:s}=YD(),i=!s||s==="all"?["posts",a]:["posts",a,s],{mutate:d,isPending:l}=pe({mutationFn:m=>K(this,null,function*(){var f;let u=yield L8__default.default(r,ZD,{createPostReactionInput:y({},m.createPostReactionInput)},{"x-access-token":(f=o==null?void 0:o.accessToken)!=null?f:""});return u==null?void 0:u.createPostReaction}),onMutate:u=>K(this,[u],function*({createPostReactionInput:m}){var C,N,S,M,P;let{postId:f,reaction:g}=m,p=["post",f],v=["postsByUser",a];yield n==null?void 0:n.cancelQueries({queryKey:p}),yield n==null?void 0:n.cancelQueries({queryKey:i}),yield n==null?void 0:n.cancelQueries({queryKey:v});let h=n==null?void 0:n.getQueryData(p),b=n==null?void 0:n.getQueryData(i),x=n==null?void 0:n.getQueryData(v),w={id:a,name:(C=o==null?void 0:o.name)!=null?C:"",email:(N=o==null?void 0:o.email)!=null?N:"",avatar:(S=o==null?void 0:o.avatar)!=null?S:"",slug:(M=o==null?void 0:o.slug)!=null?M:"",headline:(P=o==null?void 0:o.headline)!=null?P:""};return n==null||n.setQueryData(p,A=>A&&cf(A,g,a,w)),n==null||n.setQueryData(v,A=>A&&cf(A,g,a,w)),n==null||n.setQueryData(i,A=>A&&F(y({},A),{pages:A.pages.map(D=>{var k;return (k=D==null?void 0:D.recommendedPostsUser)!=null&&k.data?F(y({},D),{recommendedPostsUser:F(y({},D.recommendedPostsUser),{data:D.recommendedPostsUser.data.map(E=>{var G,T;return F(y({},E),{normalPosts:(G=E.normalPosts)==null?void 0:G.map(H=>H.id===f?cf(H,g,a,w):H),reels:(T=E.reels)==null?void 0:T.map(H=>H.id===f?cf(H,g,a,w):H)})})})}):D})})),{previousPost:h,previousPosts:b,previousPostsByUser:x,postQueryKey:p,postsQueryKey:i,postsByUserQueryKey:v}}),onError:(m,u,f)=>{f!=null&&f.previousPost&&(f!=null&&f.postQueryKey)&&(n==null||n.setQueryData(f.postQueryKey,f.previousPost)),f!=null&&f.previousPosts&&(f!=null&&f.postsQueryKey)&&(n==null||n.setQueryData(f.postsQueryKey,f.previousPosts)),f!=null&&f.previousPostsByUser&&(f!=null&&f.postsByUserQueryKey)&&(n==null||n.setQueryData(f.postsByUserQueryKey,f.previousPostsByUser));}});return {createPostReaction:d,isCreatingPostReaction:l}}function $D({post:e}){var i,d;let{createPostReaction:t,isCreatingPostReaction:o}=JD({postType:e==null?void 0:e.postType,post:e}),r=(i=e==null?void 0:e.currentUserReaction)!=null?i:"",n=(d=e==null?void 0:e.reactions)!=null?d:[],a=n.length,s=$.useCallback(l=>{var c;t({createPostReactionInput:{postId:(c=e==null?void 0:e.id)!=null?c:"",reaction:l}});},[e==null?void 0:e.id,t]);return {reaction:r,isCreatingPostReaction:o,handleCreateReaction:s,reactions:n,totalReactions:a}}var XD={reactionLike:"Agree",reactionAgree:"Support",reactionLove:"Love",reactionEureka:"Brilliant",reactionHaha:"Haha",reactionNoComment:"No comments",reactionDislike:"Disagree",reactionsSingular:"reaction",reactionsPlural:"reactions",allReactions:"All reactions",noReactionsYet:"No reactions yet."};var RD={reactionLike:"J'aime",reactionAgree:"Soutien",reactionLove:"J'adore",reactionEureka:"G\xE9nial",reactionHaha:"Haha",reactionNoComment:"Aucun commentaire",reactionDislike:"\xCAtre en d\xE9saccord",reactionsSingular:"r\xE9action",reactionsPlural:"r\xE9actions",allReactions:"Toutes",noReactionsYet:"Aucune r\xE9action pour le moment."};var eL={reactionLike:"Concordo",reactionAgree:"Apoio",reactionLove:"Adoro",reactionEureka:"Genial",reactionHaha:"Haha",reactionNoComment:"Sem coment\xE1rios",reactionDislike:"Discordo",reactionsSingular:"rea\xE7\xE3o",reactionsPlural:"rea\xE7\xF5es",allReactions:"Todos",noReactionsYet:"Nenhuma rea\xE7\xE3o ainda."};var Hne={pt:y({},eL),en:y({},XD),fr:y({},RD)};function Xn(e,t){return Hne[e][t]}function mf({currentReaction:e,onChange:t,size:o}){let{locale:r}=I(),n=r||"pt",a=$.useMemo(()=>[{emoji:$__namespace.default.createElement(Ec,null),label:Xn(n,"reactionLike"),id:"LIKE"},{emoji:$__namespace.default.createElement(ul,null),label:Xn(n,"reactionAgree"),id:"AGREE"},{emoji:$__namespace.default.createElement(Dc,null),label:Xn(n,"reactionLove"),id:"LOVE"},{emoji:$__namespace.default.createElement(Ac,null),label:Xn(n,"reactionEureka"),id:"EUREKA"},{emoji:$__namespace.default.createElement(Tc,null),label:Xn(n,"reactionHaha"),id:"HAHA"},{emoji:$__namespace.default.createElement(kc,null),label:Xn(n,"reactionNoComment"),id:"NO_COMMENT"},{emoji:$__namespace.default.createElement(fl,null),label:Xn(n,"reactionDislike"),id:"DISAGREE"}],[n]),[s,i]=$.useState(null);return $.useEffect(()=>{if(e){let c=a.find(m=>m.id===e);i(c!=null?c:null);}else i(null);},[e,a]),{handleReactionSelect:c=>{if(!c){let m=s;i(null),t(null,m);return}if((s==null?void 0:s.id)===c.id){let m=s;i(null),t(null,m);return}i(c),t(c,null),typeof window!="undefined"&&"vibrate"in navigator&&navigator.vibrate(25);},reactions:a,selectedReaction:s,isNormalSize:o==="normal"}}var Qne={AGREE:"#2B2E35",DISLIKE:"#2B2E35",EUREKA:"#2B2E35",LIKE:"#2B2E35",NO_COMMENT:"#2B2E35",LOVE:"#2B2E35",HAHA:"#2B2E35",SUPPORT:"#2B2E35"};function tL({reactions:e,className:t,handleReactionSelect:o,orientation:r,onClose:n}){let a=$.useRef(null);wa(a,n);let[s,i]=$.useState(null),d=l=>{typeof window!="undefined"&&"vibrate"in navigator&&navigator.vibrate(25),o(l),n();};return $__namespace.default.createElement("div",{ref:a,className:U("absolute bottom-full left-1/2 -translate-x-1/2 mb-2 z-50","flex items-center justify-center",t)},$__namespace.default.createElement("div",{className:U("flex items-center justify-center gap-1 bg-white/95 backdrop-blur-sm rounded-full shadow-lg px-2 py-1 border border-gray-100",r==="vertical"?"flex-col":"flex-row")},e.map(l=>{let c=Qne[l.id]||"#999";return $__namespace.default.createElement("div",{key:l.id,className:"relative flex flex-col items-center"},$__namespace.default.createElement("button",{type:"button",onClick:()=>d(l),onMouseEnter:()=>i(l),onMouseLeave:()=>i(null),className:U("button-empty p-2 rounded-full transition-transform duration-200 transform hover:scale-125 flex items-center justify-center")},l.emoji),(s==null?void 0:s.id)===l.id&&$__namespace.default.createElement("span",{className:"absolute bottom-full mb-1 px-2 py-1 rounded-full text-xs text-white font-semibold whitespace-nowrap shadow-lg",style:{backgroundColor:c,transform:"translateY(-4px)",transition:"all 0.15s ease-out"}},l.label))})))}var Kne=$__namespace.default.createContext(null);function rL(){let e=$__namespace.default.useContext(Kne);return e||{getIsFollowed:(t,o)=>o,dispatch:()=>{}}}L8.gql`
3576
+ `;var YD=zustand.create(e=>({filter:"all",setFilter:t=>e({filter:t})}));function Bne(e,t,o,r,n,a){let s=(e!=null?e:[]).filter(i=>i.userId!==r);if(t&&t===o)return {reactions:s,currentUserReaction:null};if(o!==""){let i={id:`optimistic-${Date.now()}`,postId:n,userId:r,reaction:o,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),user:{id:a==null?void 0:a.id,name:a==null?void 0:a.name,email:a==null?void 0:a.email,avatar:a==null?void 0:a.avatar,slug:a==null?void 0:a.slug,headline:a==null?void 0:a.headline}};return {reactions:[...s,i],currentUserReaction:o}}return {reactions:s,currentUserReaction:null}}function cf(e,t,o,r){let{reactions:n,currentUserReaction:a}=Bne(e==null?void 0:e.reactions,e==null?void 0:e.currentUserReaction,t,o,e.id,r);return F(y({},e),{reactions:n,currentUserReaction:a!=null?a:void 0,totalReactions:n==null?void 0:n.length})}function JD({postType:e,post:t}){var c;let{user:o,feedApi:r,queryClient:n}=I(),a=(c=o==null?void 0:o.id)!=null?c:"",{filter:s}=YD(),i=!s||s==="all"?["posts",a]:["posts",a,s],{mutate:d,isPending:l}=pe({mutationFn:m=>K(this,null,function*(){var f;let u=yield L8__default.default(r,ZD,{createPostReactionInput:y({},m.createPostReactionInput)},{"x-access-token":(f=o==null?void 0:o.accessToken)!=null?f:""});return u==null?void 0:u.createPostReaction}),onMutate:u=>K(this,[u],function*({createPostReactionInput:m}){var C,N,S,M,P;let{postId:f,reaction:g}=m,p=["post",f],v=["postsByUser",a];yield n==null?void 0:n.cancelQueries({queryKey:p}),yield n==null?void 0:n.cancelQueries({queryKey:i}),yield n==null?void 0:n.cancelQueries({queryKey:v});let h=n==null?void 0:n.getQueryData(p),b=n==null?void 0:n.getQueryData(i),x=n==null?void 0:n.getQueryData(v),w={id:a,name:(C=o==null?void 0:o.name)!=null?C:"",email:(N=o==null?void 0:o.email)!=null?N:"",avatar:(S=o==null?void 0:o.avatar)!=null?S:"",slug:(M=o==null?void 0:o.slug)!=null?M:"",headline:(P=o==null?void 0:o.headline)!=null?P:""};return n==null||n.setQueryData(p,A=>A&&cf(A,g,a,w)),n==null||n.setQueryData(v,A=>A&&cf(A,g,a,w)),n==null||n.setQueryData(i,A=>A&&F(y({},A),{pages:A.pages.map(D=>{var k;return (k=D==null?void 0:D.recommendedPostsUser)!=null&&k.data?F(y({},D),{recommendedPostsUser:F(y({},D.recommendedPostsUser),{data:D.recommendedPostsUser.data.map(E=>{var G,T;return F(y({},E),{normalPosts:(G=E.normalPosts)==null?void 0:G.map(H=>H.id===f?cf(H,g,a,w):H),reels:(T=E.reels)==null?void 0:T.map(H=>H.id===f?cf(H,g,a,w):H)})})})}):D})})),{previousPost:h,previousPosts:b,previousPostsByUser:x,postQueryKey:p,postsQueryKey:i,postsByUserQueryKey:v}}),onError:(m,u,f)=>{f!=null&&f.previousPost&&(f!=null&&f.postQueryKey)&&(n==null||n.setQueryData(f.postQueryKey,f.previousPost)),f!=null&&f.previousPosts&&(f!=null&&f.postsQueryKey)&&(n==null||n.setQueryData(f.postsQueryKey,f.previousPosts)),f!=null&&f.previousPostsByUser&&(f!=null&&f.postsByUserQueryKey)&&(n==null||n.setQueryData(f.postsByUserQueryKey,f.previousPostsByUser));}});return {createPostReaction:d,isCreatingPostReaction:l}}function $D({post:e}){var i,d;let{createPostReaction:t,isCreatingPostReaction:o}=JD({postType:e==null?void 0:e.postType,post:e}),r=(i=e==null?void 0:e.currentUserReaction)!=null?i:"",n=(d=e==null?void 0:e.reactions)!=null?d:[],a=n.length,s=$.useCallback(l=>{var c;t({createPostReactionInput:{postId:(c=e==null?void 0:e.id)!=null?c:"",reaction:l}});},[e==null?void 0:e.id,t]);return {reaction:r,isCreatingPostReaction:o,handleCreateReaction:s,reactions:n,totalReactions:a}}var XD={reactionLike:"Agree",reactionAgree:"Support",reactionLove:"Love",reactionEureka:"Brilliant",reactionHaha:"Haha",reactionNoComment:"No comments",reactionDislike:"Disagree",reactionsSingular:"reaction",reactionsPlural:"reactions",allReactions:"All reactions",noReactionsYet:"No reactions yet."};var RD={reactionLike:"J'aime",reactionAgree:"Soutien",reactionLove:"J'adore",reactionEureka:"G\xE9nial",reactionHaha:"Haha",reactionNoComment:"Aucun commentaire",reactionDislike:"\xCAtre en d\xE9saccord",reactionsSingular:"r\xE9action",reactionsPlural:"r\xE9actions",allReactions:"Toutes",noReactionsYet:"Aucune r\xE9action pour le moment."};var eL={reactionLike:"Concordo",reactionAgree:"Apoio",reactionLove:"Adoro",reactionEureka:"Genial",reactionHaha:"Haha",reactionNoComment:"Sem coment\xE1rios",reactionDislike:"Discordo",reactionsSingular:"rea\xE7\xE3o",reactionsPlural:"rea\xE7\xF5es",allReactions:"Todos",noReactionsYet:"Nenhuma rea\xE7\xE3o ainda."};var Hne={pt:y({},eL),en:y({},XD),fr:y({},RD)};function Xn(e,t){return Hne[e][t]}function mf({currentReaction:e,onChange:t,size:o}){let{locale:r}=I(),n=r||"pt",a=$.useMemo(()=>[{emoji:$__namespace.default.createElement(Ec,null),label:Xn(n,"reactionLike"),id:"LIKE"},{emoji:$__namespace.default.createElement(ul,null),label:Xn(n,"reactionAgree"),id:"AGREE"},{emoji:$__namespace.default.createElement(Dc,null),label:Xn(n,"reactionLove"),id:"LOVE"},{emoji:$__namespace.default.createElement(Ac,null),label:Xn(n,"reactionEureka"),id:"EUREKA"},{emoji:$__namespace.default.createElement(Tc,null),label:Xn(n,"reactionHaha"),id:"HAHA"},{emoji:$__namespace.default.createElement(kc,null),label:Xn(n,"reactionNoComment"),id:"NO_COMMENT"},{emoji:$__namespace.default.createElement(fl,null),label:Xn(n,"reactionDislike"),id:"DISAGREE"}],[n]),[s,i]=$.useState(null);return $.useEffect(()=>{if(e){let c=a.find(m=>m.id===e);i(c!=null?c:null);}else i(null);},[e,a]),{handleReactionSelect:c=>{if(!c){let m=s;i(null),t(null,m);return}if((s==null?void 0:s.id)===c.id){let m=s;i(null),t(null,m);return}i(c),t(c,null),typeof window!="undefined"&&"vibrate"in navigator&&navigator.vibrate(25);},reactions:a,selectedReaction:s,isNormalSize:o==="normal"}}var Qne={AGREE:"#2B2E35",DISLIKE:"#2B2E35",EUREKA:"#2B2E35",LIKE:"#2B2E35",NO_COMMENT:"#2B2E35",LOVE:"#2B2E35",HAHA:"#2B2E35",SUPPORT:"#2B2E35"};function tL({reactions:e,className:t,handleReactionSelect:o,orientation:r,onClose:n}){let a=$.useRef(null);wa(a,n);let[s,i]=$.useState(null),d=l=>{typeof window!="undefined"&&"vibrate"in navigator&&navigator.vibrate(25),o(l),n();};return $__namespace.default.createElement("div",{ref:a,className:U("absolute bottom-full left-1/2 -translate-x-1/2 mb-2 z-50","flex items-center justify-center",t)},$__namespace.default.createElement("div",{className:U("flex items-center justify-center gap-1 bg-white/95 backdrop-blur-sm rounded-full shadow-lg px-2 py-1 border border-gray-100",r==="vertical"?"flex-col":"flex-row")},e.map(l=>{let c=Qne[l.id]||"#999";return $__namespace.default.createElement("div",{key:l.id,className:"relative flex flex-col items-center"},$__namespace.default.createElement("button",{type:"button",onClick:()=>d(l),onMouseEnter:()=>i(l),onMouseLeave:()=>i(null),className:U("button-empty p-2 rounded-full transition-transform duration-200 transform hover:scale-125 flex items-center justify-center")},l.emoji),(s==null?void 0:s.id)===l.id&&$__namespace.default.createElement("span",{className:"absolute bottom-full mb-1 px-2 py-1 rounded-full text-xs text-white font-semibold whitespace-nowrap shadow-lg",style:{backgroundColor:c,transform:"translateY(-4px)",transition:"all 0.15s ease-out"}},l.label))})))}var Kne=$__namespace.default.createContext(null);function rL(){let e=$__namespace.default.useContext(Kne);return e||{getIsFollowed:(t,o)=>o,dispatch:()=>{}}}L8.gql`
3577
3577
  query VerifyFollow($followedId: String!) {
3578
3578
  verifyFollow(followedId: $followedId) {
3579
3579
  isFollowing
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mirantes-micro/foundation-design-system",
3
3
  "description": "A scalable and customizable design system package featuring a collection of reusable React components, utility functions, and context providers. Built to enforce visual and functional consistency across applications, this package offers accessible, themeable UI elements, shared logic through utility helpers, and context-based providers for managing global state such as themes, modals, and user sessions.",
4
- "version": "1.2.221",
4
+ "version": "1.2.222",
5
5
  "license": "MIT",
6
6
  "author": {
7
7
  "name": "Mirantes Frontend team"