@s_mart/nps 7.0.11 → 8.0.0-next.1

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.d.mts CHANGED
@@ -1,4 +1,5 @@
1
- import { CSSProperties, FC } from 'react';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { CSSProperties } from 'react';
2
3
  import { z } from 'zod';
3
4
 
4
5
  declare const schema: z.ZodObject<{
@@ -16,6 +17,18 @@ declare const schema: z.ZodObject<{
16
17
  }>;
17
18
  type FormValues = z.infer<typeof schema>;
18
19
 
20
+ interface DropzoneOnNotificationProps {
21
+ /**
22
+ * @description Deve ser uma string, pois não sabemos qual lib de notificações são utilizadas e nem todas aceita `React.ReactNode`
23
+ */
24
+ title: string;
25
+ /**
26
+ * @description Deve ser uma string, pois não sabemos qual lib de notificações são utilizadas e nem todas aceita `React.ReactNode`
27
+ */
28
+ message?: string;
29
+ duration: number;
30
+ variant: 'warning' | 'error' | 'success' | 'info';
31
+ }
19
32
  interface NPSProps {
20
33
  sistemaNome: string;
21
34
  /**
@@ -46,8 +59,9 @@ interface NPSProps {
46
59
  * Callback chamada quando todo o formulário é finalizado.
47
60
  */
48
61
  onFinalizar: (values: FormValues) => void;
62
+ onNotification(params: DropzoneOnNotificationProps): void;
49
63
  }
50
64
 
51
- declare const NPS: FC<NPSProps>;
65
+ declare const NPS: ({ onFinalizar, mostrarBackdrop, sistemaNome, onClose, shouldCloseOnBackdropClick, onSelecionarNota, paperStyle, ...rest }: NPSProps) => react_jsx_runtime.JSX.Element;
52
66
 
53
67
  export { NPS, type NPSProps };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import{Button as I,LIcon as R}from"@s_mart/core";import{Checkbox as U,Form as H}from"@s_mart/form";import{lineTimes as L}from"@s_mart/regular-icons";import{Backdrop as O,Typography as g}from"@mui/material";import{Button as w}from"@s_mart/core";import{Typography as u,useMediaQuery as z}from"@mui/material";import{colorPalette as y}from"@s_mart/tokens";import{useFormContext as T}from"react-hook-form";import{Fragment as $,jsx as m,jsxs as b}from"react/jsx-runtime";var B=({onSelecionarNota:t})=>{let{watch:a,setValue:o}=T(),i=z("(max-width: 500px)"),l=a("nota"),n=s=>{l!==s&&(o("nota",s),t?.(s))},p=m(u,{variant:"bodyXS",color:y.neutral[100],children:"Pouco prov\xE1vel"});return b($,{children:[i&&m("div",{style:{marginBottom:"0.5rem"},children:p}),m("div",{style:{display:"flex",gap:"0.3rem",flexWrap:"wrap",justifyContent:"center"},children:Array(11).fill(void 0).map((s,r)=>m(w,{variant:l===r?"contained":"outlined",style:{minWidth:"3rem"},onClick:()=>n(r),children:r},r))}),b("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"0.5rem"},children:[m("span",{children:!i&&p}),m(u,{variant:"bodyXS",color:y.neutral[100],children:"Muito prov\xE1vel"})]})]})},v=B;import{TextField as E}from"@s_mart/form";import{jsx as D}from"react/jsx-runtime";var A=({tipo:t,sistemaNome:a})=>D(E,{name:"feedback",placeholder:t==="promotor"?`Para mim o ${a} \xE9...`:"Eu acho que...",multiline:!0,size:"large",minRows:2}),x=A;import V from"@emotion/styled";import{colorPalette as q}from"@s_mart/tokens";var P=V.div`
1
+ import{Button as j,LIcon as I}from"@s_mart/core";import{Checkbox as R,Form as U}from"@s_mart/form";import{lineTimes as L}from"@s_mart/regular-icons";import{Backdrop as O,Typography as g}from"@mui/material";import{Button as w}from"@s_mart/core";import{Typography as f,useMediaQuery as z}from"@mui/material";import{colorPalette as y}from"@s_mart/tokens";import{useFormContext as T}from"react-hook-form";import{Fragment as $,jsx as m,jsxs as b}from"react/jsx-runtime";var B=({onSelecionarNota:t})=>{let{watch:i,setValue:o}=T(),a=z("(max-width: 500px)"),l=i("nota"),p=s=>{l!==s&&(o("nota",s),t?.(s))},n=m(f,{variant:"bodyXS",color:y.neutral[100],children:"Pouco prov\xE1vel"});return b($,{children:[a&&m("div",{style:{marginBottom:"0.5rem"},children:n}),m("div",{style:{display:"flex",gap:"0.3rem",flexWrap:"wrap",justifyContent:"center"},children:Array(11).fill(void 0).map((s,r)=>m(w,{variant:l===r?"contained":"outlined",style:{minWidth:"3rem"},onClick:()=>p(r),children:r},r))}),b("div",{style:{display:"flex",justifyContent:"space-between",marginTop:"0.5rem"},children:[m("span",{children:!a&&n}),m(f,{variant:"bodyXS",color:y.neutral[100],children:"Muito prov\xE1vel"})]})]})},v=B;import{TextField as E}from"@s_mart/form";import{jsx as V}from"react/jsx-runtime";var A=({tipo:t,sistemaNome:i})=>V(E,{name:"feedback",placeholder:t==="promotor"?`Para mim o ${i} \xE9...`:"Eu acho que...",multiline:!0,size:"large",minRows:2}),x=A;import q from"@emotion/styled";import{colorPalette as D}from"@s_mart/tokens";var P=q.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 1rem;
@@ -7,7 +7,7 @@ import{Button as I,LIcon as R}from"@s_mart/core";import{Checkbox as U,Form as H}
7
7
  border-radius: 0.375rem;
8
8
  box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.25);
9
9
  border: 1px solid ${({theme:t})=>t.palette.primary?.main};
10
- background: ${q.neutral[0]};
10
+ background: ${D.neutral[0]};
11
11
 
12
12
  position: absolute;
13
13
  bottom: 1.5rem;
@@ -18,4 +18,4 @@ import{Button as I,LIcon as R}from"@s_mart/core";import{Checkbox as U,Form as H}
18
18
  right: 1.25rem;
19
19
  left: 1.25rem;
20
20
  }
21
- `;import{useState as M}from"react";import{useNotification as W}from"@s_mart/hooks";var X=({onEnviarNota:t})=>{let[a,o]=M("selecionarNota"),i=W();return{step:a,handleEnviar:(n,p)=>{a==="selecionarNota"?(t?.(n),n>=9?o("feedbackPromotor"):o("feedbackDetrator")):(p(),i.setNotification({variant:"success",title:"Avalia\xE7\xE3o enviada",message:"Agradecemos muito pela sua avalia\xE7\xE3o.",autoHideDuration:5e3}))}}},h=X;import{z as d}from"zod";var j=d.object({nota:d.number(),feedback:d.string().optional(),autorizoPublicacao:d.coerce.boolean()}),S=j;import{Fragment as G,jsx as e,jsxs as c}from"react/jsx-runtime";var Q=({onFinalizar:t,mostrarBackdrop:a,sistemaNome:o,onClose:i,shouldCloseOnBackdropClick:l,onSelecionarNota:n,paperStyle:p,...s})=>{let{step:r,handleEnviar:k}=h(s),N={selecionarNota:`De 0 a 10, o quanto voc\xEA recomendaria o ${o}?`,feedbackDetrator:`Como podemos melhorar a sua experi\xEAncia no ${o}?`,feedbackPromotor:`O que voc\xEA mais gosta no ${o}?`};return e(H,{onSubmit:t,schema:S,children:({watch:C,onSubmit:F})=>{let f=C("nota");return c(G,{children:[!!a&&e(O,{open:!0,onClick:l?i:void 0,style:{zIndex:99}}),c(P,{style:p,children:[c("div",{style:{display:"flex",justifyContent:"space-between"},children:[e(g,{variant:"titleSM",children:N[r]}),e(R,{icon:L,size:"25px",onClick:i,style:{cursor:"pointer"}})]}),e("div",{children:r==="selecionarNota"?e(v,{onSelecionarNota:n}):e(x,{tipo:r==="feedbackPromotor"?"promotor":"detrator",sistemaNome:o})}),c("div",{style:{display:"flex",justifyContent:"space-between"},children:[e("div",{children:r==="feedbackPromotor"&&e(U,{name:"autorizoPublicacao",label:c(g,{variant:"bodyXS",children:["Autorizo a publica\xE7\xE3o deste coment\xE1rio no site e em redes sociais do ",o]})})}),e(I,{disabled:f===void 0,onClick:()=>k(f,F),children:"Enviar"})]})]})]})}})},_=Q;export{_ as NPS};
21
+ `;import{useState as M}from"react";var W=({onEnviarNota:t,onNotification:i})=>{let[o,a]=M("selecionarNota");return{step:o,handleEnviar:(p,n)=>{o==="selecionarNota"?(t?.(p),p>=9?a("feedbackPromotor"):a("feedbackDetrator")):(n(),i({variant:"success",title:"Avalia\xE7\xE3o enviada",message:"Agradecemos muito pela sua avalia\xE7\xE3o.",duration:5e3}))}}},h=W;import{z as c}from"zod";var X=c.object({nota:c.number(),feedback:c.string().optional(),autorizoPublicacao:c.coerce.boolean()}),S=X;import{Fragment as G,jsx as e,jsxs as d}from"react/jsx-runtime";var Q=({onFinalizar:t,mostrarBackdrop:i,sistemaNome:o,onClose:a,shouldCloseOnBackdropClick:l,onSelecionarNota:p,paperStyle:n,...s})=>{let{step:r,handleEnviar:k}=h(s),N={selecionarNota:`De 0 a 10, o quanto voc\xEA recomendaria o ${o}?`,feedbackDetrator:`Como podemos melhorar a sua experi\xEAncia no ${o}?`,feedbackPromotor:`O que voc\xEA mais gosta no ${o}?`};return e(U,{onSubmit:t,schema:S,children:({watch:C,onSubmit:F})=>{let u=C("nota");return d(G,{children:[!!i&&e(O,{open:!0,onClick:l?a:void 0,style:{zIndex:99}}),d(P,{style:n,children:[d("div",{style:{display:"flex",justifyContent:"space-between"},children:[e(g,{variant:"titleSM",children:N[r]}),e(I,{icon:L,size:"25px",onClick:a,style:{cursor:"pointer"}})]}),e("div",{children:r==="selecionarNota"?e(v,{onSelecionarNota:p}):e(x,{tipo:r==="feedbackPromotor"?"promotor":"detrator",sistemaNome:o})}),d("div",{style:{display:"flex",justifyContent:"space-between"},children:[e("div",{children:r==="feedbackPromotor"&&e(R,{name:"autorizoPublicacao",label:d(g,{variant:"bodyXS",children:["Autorizo a publica\xE7\xE3o deste coment\xE1rio no site e em redes sociais do ",o]})})}),e(j,{disabled:u===void 0,onClick:()=>k(u,F),children:"Enviar"})]})]})]})}})},_=Q;export{_ as NPS};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@s_mart/nps",
3
- "version": "7.0.11",
3
+ "version": "8.0.0-next.1",
4
4
  "main": "./dist/index.mjs",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.mts",
@@ -10,25 +10,15 @@
10
10
  "dist/**"
11
11
  ],
12
12
  "dependencies": {
13
- "@emotion/react": "^11.11.4",
14
- "@emotion/styled": ">=11.11.5",
15
- "@mui/material": ">=5.15.14",
16
- "@types/react": ">=18.3.1",
17
- "@types/react-dom": ">=18.3.0",
18
13
  "tsup": "8.0.2",
19
14
  "typescript": ">=5.4.2",
20
- "@s_mart/core": "7.0.3",
21
- "@s_mart/form": "7.2.7",
22
- "@s_mart/hooks": "7.0.2",
23
- "@s_mart/regular-icons": "5.3.0",
24
- "@s_mart/tokens": "5.1.0",
25
- "@s_mart/typed": "6.0.0",
26
- "eslint-config-smarten": "4.1.0"
15
+ "@s_mart/typed": "7.0.0-next.0"
27
16
  },
28
17
  "peerDependencies": {
29
18
  "@emotion/react": "^11.11.4",
30
- "@emotion/styled": ">=11.11.5",
31
- "@mui/material": ">=5.15.14",
19
+ "@emotion/styled": "^11.13.0",
20
+ "@mui/material": "^6.1.3",
21
+ "@types/node": ">=20.0.0",
32
22
  "@types/react": ">=18.3.1",
33
23
  "@types/react-dom": ">=18.3.0",
34
24
  "notistack": ">=2.0.0",
@@ -36,21 +26,33 @@
36
26
  "react-dom": ">=18.3.1",
37
27
  "react-hook-form": "^7.51.0",
38
28
  "zod": ">=3.21.4",
39
- "@s_mart/core": "7.0.3",
40
- "@s_mart/form": "7.2.7",
41
- "@s_mart/hooks": "7.0.2",
42
- "@s_mart/regular-icons": "5.3.0",
29
+ "@s_mart/core": "8.0.0-next.1",
30
+ "@s_mart/form": "8.0.0-next.1",
31
+ "@s_mart/regular-icons": "5.3.2-next.0",
43
32
  "@s_mart/tokens": "5.1.0"
44
33
  },
45
- "devDependencies": {
46
- "eslint": "^8.47.0"
47
- },
48
34
  "publishConfig": {
49
35
  "access": "public"
50
36
  },
37
+ "devDependencies": {
38
+ "@emotion/react": "^11.11.4",
39
+ "@emotion/styled": "^11.13.0",
40
+ "@mui/material": "^6.1.3",
41
+ "@types/node": ">=20.0.0",
42
+ "@types/react": ">=18.3.1",
43
+ "@types/react-dom": ">=18.3.0",
44
+ "notistack": ">=2.0.0",
45
+ "react": ">=18.3.1",
46
+ "react-dom": ">=18.3.1",
47
+ "react-hook-form": "^7.51.0",
48
+ "zod": ">=3.21.4",
49
+ "@s_mart/core": "8.0.0-next.1",
50
+ "@s_mart/form": "8.0.0-next.1",
51
+ "@s_mart/regular-icons": "5.3.2-next.0",
52
+ "@s_mart/tokens": "5.1.0"
53
+ },
51
54
  "scripts": {
52
55
  "build": "tsup src/index.tsx --minify --format esm --dts --external react",
53
- "dev": "tsup src/index.tsx --format esm --watch --dts --external react",
54
- "lint": "eslint src/**/*.ts* --fix"
56
+ "dev": "tsup src/index.tsx --format esm --watch --dts --external react"
55
57
  }
56
58
  }