@zydon/common 2.9.83 → 2.9.85

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/README.md CHANGED
@@ -61,6 +61,7 @@ const { data, error, isLoading, isFetching, refetch } = useGetProductsListQuery(
61
61
  - **Label:** componente que renderiza uma tag *bonitinha*
62
62
  - **MaskedInput:** input com máscara. Util para campos como `CPF`, `CNPJ`, `Telefone`
63
63
  - **MenuPopover:** menu flutuante com setinha apontado para um ponto escolhido
64
+ - **MoreMenu:** botão de três pontos que abre um `MenuPopover` com as `actions`. Fecha ao clicar em qualquer item `role="menuitem"` (o `MenuItem`) e continua aberto em clique fora de um item. Depois da primeira abertura as ações ficam montadas, para que modais e downloads abertos por elas sobrevivam ao fechamento do menu
64
65
  - **Modal:** componente de modal
65
66
  - **RescheduleBilletDialog:** janela "Gerar novo boleto" (troca do vencimento do boleto do Zydon Pay, story #1014), usada pelo wallet-react e pelo sales-react. Props: `currentDueDate`, `minDate` e `maxDate` (`yyyy-MM-dd`, vindos de `due_date_reschedule.min_date`/`max_date` do zydon-payment), `onConfirm(dueDate)` (recebe só o dia `yyyy-MM-dd` e rejeita com o erro do `unwrap()` do RTK Query: `{ status, data: { code, message } }`), `onClose`, `onRefresh()` (relê a cobrança e devolve o `due_date_reschedule`) e `open` (padrão `true`). Fluxo: escolha do dia com o `DatePicker` (só data, intervalo inclusivo; "Continuar" indisponível fora dele), confirmação "de DD/MM/AAAA para DD/MM/AAAA" com o aviso "O boleto vale até o fim do dia DD/MM/AAAA", botão em carregamento sem segundo clique e sucesso com a data nova. Mensagens por código: `PROVIDER_REFUSED` (na 2ª recusa seguida orienta gerar nova cobrança; a contagem vive só no estado do componente e zera quando ele é montado de novo), `DUE_DATE_OUT_OF_RANGE` (volta à escolha do dia), `ALREADY_RESCHEDULED`, `RESCHEDULE_IN_PROGRESS`, `NOT_RESCHEDULABLE`, `RESCHEDULE_NOT_CONFIRMED` (mostra a mensagem do backend) e 404 pedem para atualizar a tela (botão "Atualizar" chama `onRefresh` e `onClose`); 403 mostra a falta de permissão. Outro 4xx sem código conhecido que traga `message` (recusa de regra do backend, ex.: 400 do zydon-sales) mostra essa mensagem com a janela aberta, sem recarregar e sem contar como recusa. Erro sem código conhecido (rede, timeout, 5xx, 503 `PAYMENT_UNAVAILABLE`) chama `onRefresh`: se `rescheduled` veio preenchido mostra o sucesso, senão a mensagem de conexão com a janela aberta, sem contar como recusa. `data-testid`: `reschedule-billet-dialog`, `reschedule-billet-current`, `reschedule-billet-range`, `reschedule-billet-summary`, `reschedule-billet-error`, `reschedule-billet-success`. Tipos exportados: `DueDateReschedule`, `DueDateRescheduleRecord`, `RescheduleBilletDialogProps`, `RescheduleBilletError`, `RescheduleBilletErrorCode`
66
67
  - **NumberInput:** input que aceita somente números
@@ -0,0 +1,13 @@
1
+ import { a as a$2 } from './chunk-CO2KQFUN.js';
2
+ import { a as a$1 } from './chunk-FMFS42U2.js';
3
+ import { a } from './chunk-LQRRMVFN.js';
4
+ import { useState } from 'react';
5
+ import P from '@mui/material/IconButton';
6
+ import h from '@mui/material/Stack';
7
+ import C from '@mui/material/Tooltip';
8
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
9
+
10
+ var O=({actions:m,disablePortal:s,actionLabel:t="A\xE7\xF5es",placement:u,arrow:c=!0,...a$3})=>{let{open:n,onClose:r,onOpen:M}=a(),[f,d]=useState(!1),E=e=>{d(!0),M(e);},k=e=>{e.target.closest('[role="menuitem"]')&&r();};return jsxs(Fragment,{children:[jsx(C,{title:t,placement:u,arrow:c,children:jsx(P,{...a$3,"aria-label":t,color:n?"inherit":"default",onClick:E,children:jsx(a$1,{icon:"MORE_BOLD"})})}),jsx(a$2,{open:n,onClose:r,arrow:"right-top",disablePortal:s,keepMounted:f,children:jsx(h,{component:"ul",gap:.5,minWidth:160,onClick:k,children:m})})]})},D=O;
11
+
12
+ export { D as a };
13
+ //# sourceMappingURL=chunk-YL4WEBNG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/MoreMenu/index.tsx"],"names":["useState","IconButton","Stack","Tooltip","Fragment","jsx","jsxs","MoreMenu","actions","disablePortal","actionLabel","placement","arrow","other","open","onClose","onOpen","usePopover_default","opened","setOpened","handleOpen","event","handleActionsClick","Icon_default","MenuPopover_default","MoreMenu_default"],"mappings":"wHAAA,OAAqB,YAAAA,MAAgB,QACrC,OAAOC,MAAgB,2BACvB,OAAOC,MAAW,sBAClB,OAAOC,MAAa,wBA6BhB,mBAAAC,EAQM,OAAAC,EARN,QAAAC,MAAA,oBArBJ,IAAMC,EAAW,CAAC,CAChB,QAAAC,EACA,cAAAC,EACA,YAAAC,EAAc,cACd,UAAAC,EACA,MAAAC,EAAQ,GACR,GAAGC,CACL,IAAqB,CACnB,GAAM,CAAE,KAAAC,EAAM,QAAAC,EAAS,OAAAC,CAAO,EAAIC,EAAW,EACvC,CAACC,EAAQC,CAAS,EAAInB,EAAS,EAAK,EAEpCoB,EAAcC,GAAmC,CACrDF,EAAU,EAAI,EACdH,EAAOK,CAAK,CACd,EAEMC,EAAsBD,GAAmC,CACxDA,EAAM,OAAuB,QAAQ,mBAAmB,GAAGN,EAAQ,CAC1E,EAEA,OACET,EAAAF,EAAA,CACE,UAAAC,EAACF,EAAA,CAAQ,MAAOO,EAAa,UAAWC,EAAW,MAAOC,EACxD,SAAAP,EAACJ,EAAA,CACE,GAAGY,EACJ,aAAYH,EACZ,MAAOI,EAAO,UAAY,UAC1B,QAASM,EAET,SAAAf,EAACkB,EAAA,CAAK,KAAK,YAAY,EACzB,EACF,EAEAlB,EAACmB,EAAA,CACC,KAAMV,EACN,QAASC,EACT,MAAM,YACN,cAAeN,EACf,YAAaS,EAEb,SAAAb,EAACH,EAAA,CACC,UAAU,KACV,IAAK,GACL,SAAU,IACV,QAASoB,EAER,SAAAd,EACH,EACF,GACF,CAEJ,EAEOiB,EAAQlB","sourcesContent":["import { MouseEvent, useState } from 'react';\nimport IconButton from '@mui/material/IconButton';\nimport Stack from '@mui/material/Stack';\nimport Tooltip from '@mui/material/Tooltip';\n\nimport Icon from 'components/Icon';\nimport MenuPopover from 'components/MenuPopover';\nimport usePopover from 'hooks/usePopover';\n\nimport { MoreMenuProps } from './props';\n\nconst MoreMenu = ({\n actions,\n disablePortal,\n actionLabel = 'Ações',\n placement,\n arrow = true,\n ...other\n}: MoreMenuProps) => {\n const { open, onClose, onOpen } = usePopover();\n const [opened, setOpened] = useState(false);\n\n const handleOpen = (event: MouseEvent<HTMLElement>) => {\n setOpened(true);\n onOpen(event);\n };\n\n const handleActionsClick = (event: MouseEvent<HTMLElement>) => {\n if ((event.target as HTMLElement).closest('[role=\"menuitem\"]')) onClose();\n };\n\n return (\n <>\n <Tooltip title={actionLabel} placement={placement} arrow={arrow}>\n <IconButton\n {...other}\n aria-label={actionLabel}\n color={open ? 'inherit' : 'default'}\n onClick={handleOpen}\n >\n <Icon icon=\"MORE_BOLD\" />\n </IconButton>\n </Tooltip>\n\n <MenuPopover\n open={open}\n onClose={onClose}\n arrow=\"right-top\"\n disablePortal={disablePortal}\n keepMounted={opened}\n >\n <Stack\n component=\"ul\"\n gap={0.5}\n minWidth={160}\n onClick={handleActionsClick}\n >\n {actions}\n </Stack>\n </MenuPopover>\n </>\n );\n};\n\nexport default MoreMenu;\n"]}
@@ -5,7 +5,7 @@ import { a as a$2 } from '../../../chunk-Q2R3X4EB.js';
5
5
  import { a as a$c, b as b$1, c as c$3 } from '../../../chunk-MWKWO5P2.js';
6
6
  import '../../../chunk-DRGARBKB.js';
7
7
  import '../../../chunk-55XSPNSX.js';
8
- import { a as a$5 } from '../../../chunk-33SY23DN.js';
8
+ import { a as a$5 } from '../../../chunk-YL4WEBNG.js';
9
9
  import { a as a$4 } from '../../../chunk-VYBJ5SNV.js';
10
10
  import { a as a$6 } from '../../../chunk-C2T2YAFC.js';
11
11
  import { a as a$a } from '../../../chunk-4XN57SLB.js';
@@ -1,4 +1,4 @@
1
- export { a as default } from '../../chunk-33SY23DN.js';
1
+ export { a as default } from '../../chunk-YL4WEBNG.js';
2
2
  import '../../chunk-CO2KQFUN.js';
3
3
  import '../../chunk-FMFS42U2.js';
4
4
  import '../../chunk-Z6YXPKWP.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zydon/common",
3
- "version": "2.9.83",
3
+ "version": "2.9.85",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -1,12 +0,0 @@
1
- import { a as a$2 } from './chunk-CO2KQFUN.js';
2
- import { a as a$1 } from './chunk-FMFS42U2.js';
3
- import { a } from './chunk-LQRRMVFN.js';
4
- import M from '@mui/material/IconButton';
5
- import s from '@mui/material/Stack';
6
- import P from '@mui/material/Tooltip';
7
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
8
-
9
- var d=({actions:i,disablePortal:m,actionLabel:r="A\xE7\xF5es",placement:l,arrow:u=!0,...a$3})=>{let{open:t,onClose:c,onOpen:f}=a();return jsxs(Fragment,{children:[jsx(P,{title:r,placement:l,arrow:u,children:jsx(M,{...a$3,"aria-label":r,color:t?"inherit":"default",onClick:f,children:jsx(a$1,{icon:"MORE_BOLD"})})}),jsx(a$2,{open:t,onClose:c,arrow:"right-top",disablePortal:m,children:jsx(s,{component:"ul",gap:.5,minWidth:160,children:i})})]})},w=d;
10
-
11
- export { w as a };
12
- //# sourceMappingURL=chunk-33SY23DN.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/MoreMenu/index.tsx"],"names":["IconButton","Stack","Tooltip","Fragment","jsx","jsxs","MoreMenu","actions","disablePortal","actionLabel","placement","arrow","other","open","onClose","onOpen","usePopover_default","Icon_default","MenuPopover_default","MoreMenu_default"],"mappings":"wHAAA,OAAOA,MAAgB,2BACvB,OAAOC,MAAW,sBAClB,OAAOC,MAAa,wBAkBhB,mBAAAC,EAQM,OAAAC,EARN,QAAAC,MAAA,oBAVJ,IAAMC,EAAW,CAAC,CAChB,QAAAC,EACA,cAAAC,EACA,YAAAC,EAAc,cACd,UAAAC,EACA,MAAAC,EAAQ,GACR,GAAGC,CACL,IAAqB,CACnB,GAAM,CAAE,KAAAC,EAAM,QAAAC,EAAS,OAAAC,CAAO,EAAIC,EAAW,EAC7C,OACEX,EAAAF,EAAA,CACE,UAAAC,EAACF,EAAA,CAAQ,MAAOO,EAAa,UAAWC,EAAW,MAAOC,EACxD,SAAAP,EAACJ,EAAA,CACE,GAAGY,EACJ,aAAYH,EACZ,MAAOI,EAAO,UAAY,UAC1B,QAASE,EAET,SAAAX,EAACa,EAAA,CAAK,KAAK,YAAY,EACzB,EACF,EAEAb,EAACc,EAAA,CACC,KAAML,EACN,QAASC,EACT,MAAM,YACN,cAAeN,EAEf,SAAAJ,EAACH,EAAA,CAAM,UAAU,KAAK,IAAK,GAAK,SAAU,IACvC,SAAAM,EACH,EACF,GACF,CAEJ,EAEOY,EAAQb","sourcesContent":["import IconButton from '@mui/material/IconButton';\nimport Stack from '@mui/material/Stack';\nimport Tooltip from '@mui/material/Tooltip';\n\nimport Icon from 'components/Icon';\nimport MenuPopover from 'components/MenuPopover';\nimport usePopover from 'hooks/usePopover';\n\nimport { MoreMenuProps } from './props';\n\nconst MoreMenu = ({\n actions,\n disablePortal,\n actionLabel = 'Ações',\n placement,\n arrow = true,\n ...other\n}: MoreMenuProps) => {\n const { open, onClose, onOpen } = usePopover();\n return (\n <>\n <Tooltip title={actionLabel} placement={placement} arrow={arrow}>\n <IconButton\n {...other}\n aria-label={actionLabel}\n color={open ? 'inherit' : 'default'}\n onClick={onOpen}\n >\n <Icon icon=\"MORE_BOLD\" />\n </IconButton>\n </Tooltip>\n\n <MenuPopover\n open={open}\n onClose={onClose}\n arrow=\"right-top\"\n disablePortal={disablePortal}\n >\n <Stack component=\"ul\" gap={0.5} minWidth={160}>\n {actions}\n </Stack>\n </MenuPopover>\n </>\n );\n};\n\nexport default MoreMenu;\n"]}