@s_mart/nps 11.0.0-beta.3 → 11.0.0-beta.4
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/index.mjs +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{LIcon as ao}from"@s_mart/core";import{Checkbox as ro,Form as no}from"@s_mart/form";import{lineTimes as io}from"@s_mart/regular-icons";import{Button as lo,Backdrop as so,IconButton as po,Typography as V,useTheme as co}from"@mui/material";import{Button as X,Typography as B,useMediaQuery as L}from"@mui/material";import{colorPalette as E}from"@s_mart/tokens";import{useFormContext as Q,useWatch as U}from"react-hook-form";import{Fragment as G,jsx as f,jsxs as D}from"react/jsx-runtime";var _=({onSelecionarNota:o})=>{let{control:e,setValue:t}=Q(),a=L("(max-width: 500px)"),n=U({control:e,name:"nota"}),d=s=>{n!==s&&(t("nota",s),o?.(s))},l=f(B,{variant:"bodyXS",color:E.neutral[100],children:"Pouco prov\xE1vel"});return D(G,{children:[a&&f("div",{style:{marginBottom:"0.5rem"},children:l}),f("div",{style:{display:"flex",gap:"0.3rem",flexWrap:"wrap",justifyContent:"center"},children:Array.from({length:11}).map((s,i)=>f(X,{variant:n===i?"contained":"outlined",style:{minWidth:"3rem"},onClick:()=>d(i),children:i},i))}),D("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"0.5rem"},children:[f("span",{children:!a&&l}),f(B,{variant:"bodyXS",color:E.neutral[100],children:"Muito prov\xE1vel"})]})]})},w=_;import{TextField as J}from"@s_mart/form";import{jsx as Y}from"react/jsx-runtime";var K=({tipo:o,sistemaNome:e})=>Y(J,{name:"feedback",placeholder:o==="promotor"?`Para mim o ${e} \xE9...`:"Eu acho que...",multiline:!0,size:"large",minRows:2}),A=K;import{styled as Z}from"@mui/material";import{colorPalette as j}from"@s_mart/tokens";var H=Z("div")(({theme:o})=>({display:"flex",flexDirection:"column",gap:"1.5rem",padding:"1.5rem",borderRadius:Number.parseFloat(o.shape.borderRadius.toString())*1.5,boxShadow:o.shadows[6],border:`1px solid ${o.palette.primary?.main}`,background:j.neutral[0],position:"absolute",bottom:"1.5rem",right:"1.75rem",zIndex:102,"@media (max-width: 650px)":{right:"1.25rem",left:"1.25rem"}}));import{useState as oo}from"react";var eo=({onEnviarNota:o,onNotification:e})=>{let[t,a]=oo("selecionarNota");return{step:t,handleEnviar:(d,l)=>{t==="selecionarNota"?(o?.(d),d>=9?a("feedbackPromotor"):a("feedbackDetrator")):(l(),e({variant:"success",title:"Avalia\xE7\xE3o enviada",message:"Agradecemos muito pela sua avalia\xE7\xE3o.",duration:5e3}))}}},M=eo;import{z as v}from"zod";var to=v.object({nota:v.number(),feedback:v.string().optional(),autorizoPublicacao:v.coerce.boolean()}),z=to;import{Fragment as uo,jsx as p,jsxs as
|
|
1
|
+
import{LIcon as ao}from"@s_mart/core";import{Checkbox as ro,Form as no}from"@s_mart/form";import{lineTimes as io}from"@s_mart/regular-icons";import{Button as lo,Backdrop as so,IconButton as po,Typography as V,useTheme as co}from"@mui/material";import{Button as X,Typography as B,useMediaQuery as L}from"@mui/material";import{colorPalette as E}from"@s_mart/tokens";import{useFormContext as Q,useWatch as U}from"react-hook-form";import{Fragment as G,jsx as f,jsxs as D}from"react/jsx-runtime";var _=({onSelecionarNota:o})=>{let{control:e,setValue:t}=Q(),a=L("(max-width: 500px)"),n=U({control:e,name:"nota"}),d=s=>{n!==s&&(t("nota",s),o?.(s))},l=f(B,{variant:"bodyXS",color:E.neutral[100],children:"Pouco prov\xE1vel"});return D(G,{children:[a&&f("div",{style:{marginBottom:"0.5rem"},children:l}),f("div",{style:{display:"flex",gap:"0.3rem",flexWrap:"wrap",justifyContent:"center"},children:Array.from({length:11}).map((s,i)=>f(X,{variant:n===i?"contained":"outlined",style:{minWidth:"3rem"},onClick:()=>d(i),children:i},i))}),D("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"0.5rem"},children:[f("span",{children:!a&&l}),f(B,{variant:"bodyXS",color:E.neutral[100],children:"Muito prov\xE1vel"})]})]})},w=_;import{TextField as J}from"@s_mart/form";import{jsx as Y}from"react/jsx-runtime";var K=({tipo:o,sistemaNome:e})=>Y(J,{name:"feedback",placeholder:o==="promotor"?`Para mim o ${e} \xE9...`:"Eu acho que...",multiline:!0,size:"large",minRows:2}),A=K;import{styled as Z}from"@mui/material";import{colorPalette as j}from"@s_mart/tokens";var H=Z("div")(({theme:o})=>({display:"flex",flexDirection:"column",gap:"1.5rem",padding:"1.5rem",borderRadius:Number.parseFloat(o.shape.borderRadius.toString())*1.5,boxShadow:o.shadows[6],border:`1px solid ${o.palette.primary?.main}`,background:j.neutral[0],position:"absolute",bottom:"1.5rem",right:"1.75rem",zIndex:102,"@media (max-width: 650px)":{right:"1.25rem",left:"1.25rem"}}));import{useState as oo}from"react";var eo=({onEnviarNota:o,onNotification:e})=>{let[t,a]=oo("selecionarNota");return{step:t,handleEnviar:(d,l)=>{t==="selecionarNota"?(o?.(d),d>=9?a("feedbackPromotor"):a("feedbackDetrator")):(l(),e({variant:"success",title:"Avalia\xE7\xE3o enviada",message:"Agradecemos muito pela sua avalia\xE7\xE3o.",duration:5e3}))}}},M=eo;import{z as v}from"zod";var to=v.object({nota:v.number(),feedback:v.string().optional(),autorizoPublicacao:v.coerce.boolean()}),z=to;import{Fragment as uo,jsx as p,jsxs as b}from"react/jsx-runtime";var mo=({onFinalizar:o,mostrarBackdrop:e,sistemaNome:t,onClose:a,shouldCloseOnBackdropClick:n,onSelecionarNota:d,paperStyle:l,...s})=>{let{step:i,handleEnviar:u}=M(s),P=co(),g={selecionarNota:`De 0 a 10, o quanto voc\xEA recomendaria o ${t}?`,feedbackDetrator:`Como podemos melhorar a sua experi\xEAncia no ${t}?`,feedbackPromotor:`O que voc\xEA mais gosta no ${t}?`};return p(no,{onSubmit:o,schema:z,children:({watch:C,onSubmit:T})=>{let S=C("nota");return b(uo,{children:[!!e&&p(so,{open:!0,onClick:n?a:void 0,style:{zIndex:99}}),b(H,{style:l,children:[b("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[p(V,{variant:"titleSM",color:P.palette.grey[700],children:g[i]}),p(po,{size:"small",onClick:a,children:p(ao,{icon:io,removeMargin:!0,size:"25px"})})]}),p("div",{children:i==="selecionarNota"?p(w,{onSelecionarNota:d}):p(A,{tipo:i==="feedbackPromotor"?"promotor":"detrator",sistemaNome:t})}),b("div",{style:{display:"flex",justifyContent:"space-between"},children:[p("div",{children:i==="feedbackPromotor"&&p(ro,{name:"autorizoPublicacao",label:b(V,{variant:"bodyXS",children:["Autorizo a publica\xE7\xE3o deste coment\xE1rio no site e em redes sociais do ",t]})})}),p("div",{children:p(lo,{disabled:S===void 0,onClick:()=>u(S,T),children:"Enviar"})})]})]})]})}})};import{Dialog as Do}from"@s_mart/core";import{createContext as wo,useContext as Ao}from"react";import{useCallback as fo,useMemo as Po,useState as x}from"react";import{mergeSlotProps as So,useMediaQuery as bo,useTheme as yo}from"@mui/material";var k={avaliacao:{title:"O quanto voc\xEA recomendaria o sistema?"},feedback:{title:"Como podemos melhorar a sua experi\xEAncia?"},dialog:{closeIcon:!0}};function W(o){let[e,t]=x(""),[a,n]=x(null),[d,l]=x("avaliacao"),s=yo(),i=bo(s.breakpoints.down("sm")),u=Po(()=>So(o.slotProps,{...k,dialog:{fullScreen:i,...k.dialog}}),[o.slotProps,i]),P=S=>{o.onChangeAvaliacao?.(S),n(S)},g=()=>{o.onClose({nota:a}),setTimeout(()=>{n(null),t(""),l("avaliacao")},100)},C=fo(()=>{o.onSubmit({nota:a,feedback:e})},[o.onSubmit,a,e]);return{feedback:e,setFeedback:t,nota:a,handleChangeAvaliacao:P,handleProximaEtapa:()=>{l("feedback"),o.onChangeEtapa?.("feedback")},etapa:d,setEtapa:l,handleSubmit:C,handleClose:g,slotProps:u}}import{Button as go}from"@mui/material";import{Dialog as N}from"@s_mart/core";import{TextField as vo}from"@mui/material";import{jsx as ho}from"react/jsx-runtime";var I=o=>{let{feedback:e,setFeedback:t}=m();return ho(vo,{autoFocus:!0,fullWidth:!0,rows:3,multiline:!0,...o,value:e,onChange:n=>{t(n.target.value.trim()),o.onChange?.(n)}})};import{Fragment as Co,jsx as y,jsxs as ko}from"react/jsx-runtime";function R(o){let{handleSubmit:e,feedback:t}=m();return ko(Co,{children:[y(N.Header,{children:o.title}),y(N.Content,{children:y(I,{})}),y(N.Footer,{children:y(go,{fullWidth:!0,disabled:!t,onClick:e,children:"Enviar"})})]})}import{Button as Fo,styled as To}from"@mui/material";import{Dialog as F}from"@s_mart/core";import{Button as xo}from"@mui/material";import{jsx as No}from"react/jsx-runtime";var c=o=>{let{handleChangeAvaliacao:e}=m(),t=()=>e(o.notaSelecionada===o.nota?null:o.nota);return No(xo,{sx:{padding:0,minWidth:"3rem"},...o,variant:o.nota===o.notaSelecionada?"contained":"outlined",onClick:t,children:o.nota})};import{Fragment as Eo,jsx as r,jsxs as $}from"react/jsx-runtime";function q(o){let{nota:e,handleProximaEtapa:t}=m();return $(Eo,{children:[r(F.Header,{children:o.title}),r(F.Content,{children:$(Bo,{children:[r(c,{notaSelecionada:e,nota:0,color:"feedbackHard"}),r(c,{notaSelecionada:e,nota:1,color:"feedbackHard"}),r(c,{notaSelecionada:e,nota:2,color:"feedbackHard"}),r(c,{notaSelecionada:e,nota:3,color:"feedbackHard"}),r(c,{notaSelecionada:e,nota:4,color:"feedbackHard"}),r(c,{notaSelecionada:e,nota:5,color:"feedbackHard"}),r(c,{notaSelecionada:e,nota:6,color:"feedbackHard"}),r(c,{notaSelecionada:e,nota:7,color:"feedbackMedium"}),r(c,{notaSelecionada:e,nota:8,color:"feedbackMedium"}),r(c,{notaSelecionada:e,nota:9,color:"feedbackVeryEasy"}),r(c,{notaSelecionada:e,nota:10,color:"feedbackVeryEasy"})]})}),r(F.Footer,{children:r(Fo,{disabled:e===null,onClick:t,fullWidth:!0,children:"Enviar"})})]})}var Bo=To("div")({display:"flex",gap:"0.25rem",flexWrap:"wrap",justifyContent:"center",paddingBlock:"0.25rem"});import{styled as Ho}from"@mui/material";import{Fragment as Vo,jsx as h,jsxs as Wo}from"react/jsx-runtime";var O=wo(null);function Mo(o){let{feedback:e,nota:t,setFeedback:a,handleChangeAvaliacao:n,handleClose:d,handleProximaEtapa:l,etapa:s,setEtapa:i,slotProps:u,handleSubmit:P}=W(o);return h(zo,{open:o.isOpen,onClose:d,...u.dialog,children:h(O.Provider,{value:{handleSubmit:P,feedback:e,setFeedback:a,nota:t,handleChangeAvaliacao:n,handleProximaEtapa:l,etapa:s},children:Wo(Vo,{children:[s==="avaliacao"&&h(q,{...u.avaliacao}),s==="feedback"&&h(R,{...u.feedback})]})})})}var m=()=>{let o=Ao(O);if(!o)throw new Error("useNPSContext must be used within a NPSProvider");return o},zo=Ho(Do)(({theme:o})=>({[o.breakpoints.down("sm")]:{".MuiPaper-root":{position:"absolute",bottom:0,height:"auto"}}}));export{Mo as NPSDialog,mo as NPSPopover};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@s_mart/nps",
|
|
3
|
-
"version": "11.0.0-beta.
|
|
3
|
+
"version": "11.0.0-beta.4",
|
|
4
4
|
"main": "./dist/index.mjs",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.mts",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"react-hook-form": "^7.51.0",
|
|
30
30
|
"zod": "^3.22.4",
|
|
31
31
|
"@s_mart/core": "10.0.2-beta.1",
|
|
32
|
-
"@s_mart/form": "10.0.3-beta.1",
|
|
33
32
|
"@s_mart/regular-icons": "6.0.11",
|
|
33
|
+
"@s_mart/form": "10.0.3-beta.2",
|
|
34
34
|
"@s_mart/tokens": "6.0.0"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"react-hook-form": "^7.51.0",
|
|
51
51
|
"zod": "^3.22.4",
|
|
52
52
|
"@s_mart/core": "10.0.2-beta.1",
|
|
53
|
-
"@s_mart/form": "10.0.3-beta.
|
|
53
|
+
"@s_mart/form": "10.0.3-beta.2",
|
|
54
54
|
"@s_mart/regular-icons": "6.0.11",
|
|
55
55
|
"@s_mart/tokens": "6.0.0"
|
|
56
56
|
},
|