@cnc-ti/layout-basic 8.4.0 → 8.5.0

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.ts CHANGED
@@ -68,6 +68,24 @@ interface HeaderContainerProps extends HTMLAttributes<HTMLDivElement> {
68
68
  */
69
69
  logoLink?: string;
70
70
  container?: boolean;
71
+ /**
72
+ * Conteúdo opcional exibido à esquerda dos `children` do cabeçalho — a área
73
+ * reservada para o sino de notificações.
74
+ *
75
+ * Não é renderizado quando omitido, então nenhum consumidor atual é afetado.
76
+ * O uso previsto é o componente `HeaderNotifications`, mas qualquer nó React
77
+ * é aceito.
78
+ *
79
+ * @example
80
+ * <HeaderContainer
81
+ * onOpenMenu={toggleSidebar}
82
+ * isOpen={collapsed}
83
+ * notifications={<HeaderNotifications items={notificacoes} />}
84
+ * >
85
+ * <HeaderProfileHeader user={usuario}>...</HeaderProfileHeader>
86
+ * </HeaderContainer>
87
+ */
88
+ notifications?: ReactNode;
71
89
  }
72
90
  declare const HeaderContainer: React.FC<HeaderContainerProps>;
73
91
  interface ProfileProps extends HTMLAttributes<HTMLDivElement> {
@@ -619,4 +637,191 @@ interface CardListProps<T> {
619
637
  }
620
638
  declare function CardList<T>({ items, renderCard, emptyMessage, minItemWidth, className, gap, getKey, isLoading, skeletonCount, }: CardListProps<T>): react_jsx_runtime.JSX.Element;
621
639
 
622
- export { AplicationsHeader, type AppInput, type AppItem, AppsMenu, type AppsMenuProps, Badge, type BadgeSize, type BadgeVariant, Button, type ButtonProps, Card, CardContent, CardFooter, CardFooterItem, CardHeader, CardList, type CardListProps, Checkbox, type CheckboxProps, Collapsible, AnimatedCollapsibleContent as CollapsibleContent, CollapsibleTrigger, Combobox, type ComboboxProps, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Filter, type FilterField, type FilterFieldType, type FilterProps, type FilterValues, Header, HeaderContainer, HeaderProfileHeader, HeaderProfileItem, type HeaderProps, Input, type InputProps, type ItemOption, Modal, ModalEntidade, ModalMudancaEntidade, type ModalProps, PageHeader, PageHeaderActionsContainer, PageHeaderTitle, PageHeaderTitleContent, Popover, PopoverContent, PopoverTrigger, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectPortal, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SelectViewport, Sidebar, SidebarContainer, type SidebarContainerProps, SidebarImageBrand, type SidebarImageBrandProps, SidebarNavCollapse, type SidebarNavCollapseProps, SidebarNavLink, type SidebarNavLinkProps, type SidebarProps, Switch, type SwitchProps, Tabs, TabsContent, TabsList, TabsTrigger, Title, availableApps, buttonVariants };
640
+ type StatusNotificacao = "PENDENTE" | "AGENDADO" | "ENVIADO" | "PROCESSADO" | "FALHOU" | "CANCELADO" | "CONCLUIDO";
641
+ type StatusLeitura = "NAO_LIDO" | "ENTREGUE" | "LIDO";
642
+ /** Registro devolvido por `GET {baseUrl}/notificacoes`. */
643
+ interface Notificacao {
644
+ id: string | number;
645
+ sistema: string;
646
+ titulo: string;
647
+ mensagem?: string | null;
648
+ dataReferencia: string;
649
+ destinatarioEmail?: string | null;
650
+ status: StatusNotificacao;
651
+ statusLeitura: StatusLeitura;
652
+ metadados?: Record<string, unknown> | null;
653
+ lembrarNoDia?: boolean;
654
+ diasAntes?: number | null;
655
+ alertasDiasAntes?: number[] | null;
656
+ dataLembrete?: string | null;
657
+ disparado?: boolean;
658
+ criadoEm?: string | null;
659
+ criadoPor?: string | null;
660
+ disparadoEm?: string | null;
661
+ entregueEm?: string | null;
662
+ lidoEm?: string | null;
663
+ canceladoEm?: string | null;
664
+ concluidoEm?: string | null;
665
+ motivoCancelamento?: string | null;
666
+ }
667
+ interface HeaderNotificationItem {
668
+ /** Identificador único. Usado como `key` da lista. */
669
+ id: string | number;
670
+ /** Título da notificação. */
671
+ title: string;
672
+ /** Texto complementar, limitado a duas linhas. */
673
+ message?: string;
674
+ /** Data já formatada, ex.: "há 5 minutos". */
675
+ date?: string;
676
+ /** Quando `false` ou ausente, o item conta no badge e fica destacado. */
677
+ read?: boolean;
678
+ /** Destino sugerido, para a aplicação usar no `onSelect`. Não navega sozinho. */
679
+ href?: string;
680
+ }
681
+ interface HeaderNotificationsBaseProps {
682
+ /** Quantidade de skeletons durante o loading. @defaultValue 3 */
683
+ skeletonCount?: number;
684
+ /** Título do painel. @defaultValue "Notificações" */
685
+ title?: string;
686
+ /** Mensagem do estado vazio. @defaultValue "Nenhuma notificação" */
687
+ emptyMessage?: string;
688
+ /** A partir deste valor o badge exibe "N+". @defaultValue 9 */
689
+ maxCount?: number;
690
+ /**
691
+ * Ação extra no clique, além de marcar como lida. Só com ela o painel fecha
692
+ * e só com ela há navegação — o componente nunca navega por conta própria.
693
+ * Use `item.href`, preenchido por `getHref`, para decidir o destino.
694
+ */
695
+ onSelect?: (item: HeaderNotificationItem) => void;
696
+ /** Clique em uma notificação não lida, chamada antes de `onSelect`. */
697
+ onMarkAsRead?: (item: HeaderNotificationItem) => void;
698
+ /**
699
+ * Habilita o botão de marcar como não lida em cada item. No modo conectado o
700
+ * componente já faz a chamada; aqui a aplicação só é avisada.
701
+ */
702
+ onMarkAsUnread?: (item: HeaderNotificationItem) => void;
703
+ /**
704
+ * Habilita a lixeira em cada item. No modo conectado o componente já exclui
705
+ * na API; aqui a aplicação só é avisada. **A exclusão é definitiva.**
706
+ */
707
+ onDelete?: (item: HeaderNotificationItem) => void;
708
+ /** "Marcar todas como lidas", exibida só quando há não lidas. */
709
+ onMarkAllAsRead?: () => void;
710
+ /** Abertura e fechamento do painel. */
711
+ onOpenChange?: (open: boolean) => void;
712
+ /** Rodapé customizado. Substitui os botões padrão do rodapé. */
713
+ footer?: React$1.ReactNode;
714
+ /** Alinhamento do painel em relação ao sino. @defaultValue "end" */
715
+ align?: "start" | "center" | "end";
716
+ /** Classes adicionais do botão do sino. */
717
+ className?: string;
718
+ /** Classes adicionais do painel. */
719
+ contentClassName?: string;
720
+ }
721
+ /** Modo controlado: a aplicação busca e formata, o componente só exibe. */
722
+ interface HeaderNotificationsControladoProps extends HeaderNotificationsBaseProps {
723
+ /** Notificações exibidas no painel. */
724
+ items?: HeaderNotificationItem[];
725
+ /** Quando `true`, exibe skeletons no lugar da lista. */
726
+ isLoading?: boolean;
727
+ /** Contagem do badge. Quando omitida, é derivada de `items`. */
728
+ unreadCount?: number;
729
+ email?: never;
730
+ sistema?: never;
731
+ baseUrl?: never;
732
+ getHref?: never;
733
+ filtros?: never;
734
+ intervaloAtualizacao?: never;
735
+ limite?: never;
736
+ onErro?: never;
737
+ alertarLembretes?: never;
738
+ tituloLembretes?: never;
739
+ rotuloDispensarLembretes?: never;
740
+ }
741
+ /** Modo conectado: o componente busca no serviço de notificações sozinho. */
742
+ interface HeaderNotificationsConectadoProps extends HeaderNotificationsBaseProps {
743
+ /** E-mail do destinatário. Vira `?email=` no GET. */
744
+ email: string;
745
+ /** Identificador do sistema chamador, ex.: "gestao-demandas". */
746
+ sistema: string;
747
+ /**
748
+ * Raiz da API já versionada, ex.: `https://.../v1`. Quando omitida, usa
749
+ * `URL_PADRAO_NOTIFICACOES`, que aponta para o **ambiente de
750
+ * desenvolvimento** — em produção passe explicitamente.
751
+ */
752
+ baseUrl?: string;
753
+ /**
754
+ * Preenche `item.href` a partir de `metadados`. **Não navega sozinho** — só
755
+ * serve para o `onSelect` da aplicação saber para onde ir. Sem `onSelect`, o
756
+ * clique apenas marca como lida.
757
+ */
758
+ getHref?: (notificacao: Notificacao) => string | undefined;
759
+ /** Filtros de metadado enviados na query, ex.: `{ demandaId: "123" }`. */
760
+ filtros?: Record<string, string>;
761
+ /** Intervalo do polling em ms. `0` desliga. @defaultValue 60000 */
762
+ intervaloAtualizacao?: number;
763
+ /** Corte client-side — a API não pagina. @defaultValue 20 */
764
+ limite?: number;
765
+ /** Recebe falhas de rede em vez de deixá-las silenciosas. */
766
+ onErro?: (erro: Error) => void;
767
+ /**
768
+ * Abre um modal ao carregar quando existe lembrete vencido — notificação com
769
+ * `lembrarNoDia` ligado e `dataLembrete` já vencido. Fechar o modal marca
770
+ * esses lembretes como lidos. @defaultValue false
771
+ */
772
+ alertarLembretes?: boolean;
773
+ /** Título do modal de lembretes. Por padrão varia com a quantidade. */
774
+ tituloLembretes?: string;
775
+ /** Texto do botão que dispensa o modal. @defaultValue "Entendi" */
776
+ rotuloDispensarLembretes?: string;
777
+ items?: never;
778
+ isLoading?: never;
779
+ unreadCount?: never;
780
+ }
781
+ type HeaderNotificationsProps = HeaderNotificationsControladoProps | HeaderNotificationsConectadoProps;
782
+
783
+ /**
784
+ * Usada quando `baseUrl` não é informada. Aponta para o ambiente de
785
+ * desenvolvimento — em produção passe a prop explicitamente, senão a aplicação
786
+ * lê e grava no dev.
787
+ */
788
+ declare const URL_PADRAO_NOTIFICACOES = "https://dev-apinotificacoes-b5feekb4bdfyb7c2.eastus2-01.azurewebsites.net/v1";
789
+ declare class ErroNotificacoes extends Error {
790
+ readonly status?: number;
791
+ constructor(mensagem: string, status?: number);
792
+ }
793
+
794
+ /**
795
+ * Sino de notificações do cabeçalho: badge de não lidas, painel com a lista,
796
+ * estados de loading e vazio, marcar todas como lidas e atalho para a tela
797
+ * completa.
798
+ *
799
+ * Opera em dois modos, mutuamente exclusivos pelo tipo:
800
+ *
801
+ * **Conectado** — recebe `email` e `sistema` e cuida sozinho de buscar,
802
+ * formatar a data, filtrar o que já aconteceu e marcar como lida. `baseUrl` é
803
+ * opcional e cai em `URL_PADRAO_NOTIFICACOES`, que aponta para o ambiente de
804
+ * desenvolvimento — em produção passe a prop.
805
+ *
806
+ * **Controlado** — recebe `items` já prontos e devolve as interações por
807
+ * callback, sem fazer nenhuma requisição.
808
+ *
809
+ * @example
810
+ * <HeaderContainer
811
+ * onOpenMenu={toggleSidebar}
812
+ * isOpen={collapsed}
813
+ * notifications={
814
+ * <HeaderNotifications
815
+ * email={sessao.user.email}
816
+ * sistema="gestao-demandas"
817
+ * getHref={(n) => `/demandas/${n.metadados?.demandaId}`}
818
+ * onViewAll={() => router.push("/notificacoes")}
819
+ * />
820
+ * }
821
+ * >
822
+ * <HeaderProfileHeader user={usuario}>...</HeaderProfileHeader>
823
+ * </HeaderContainer>
824
+ */
825
+ declare function HeaderNotifications(props: HeaderNotificationsProps): react_jsx_runtime.JSX.Element;
826
+
827
+ export { AplicationsHeader, type AppInput, type AppItem, AppsMenu, type AppsMenuProps, Badge, type BadgeSize, type BadgeVariant, Button, type ButtonProps, Card, CardContent, CardFooter, CardFooterItem, CardHeader, CardList, type CardListProps, Checkbox, type CheckboxProps, Collapsible, AnimatedCollapsibleContent as CollapsibleContent, CollapsibleTrigger, Combobox, type ComboboxProps, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ErroNotificacoes, Filter, type FilterField, type FilterFieldType, type FilterProps, type FilterValues, Header, HeaderContainer, type HeaderNotificationItem, HeaderNotifications, type HeaderNotificationsBaseProps, type HeaderNotificationsConectadoProps, type HeaderNotificationsControladoProps, type HeaderNotificationsProps, HeaderProfileHeader, HeaderProfileItem, type HeaderProps, Input, type InputProps, type ItemOption, Modal, ModalEntidade, ModalMudancaEntidade, type ModalProps, type Notificacao, PageHeader, PageHeaderActionsContainer, PageHeaderTitle, PageHeaderTitleContent, Popover, PopoverContent, PopoverTrigger, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectPortal, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, SelectViewport, Sidebar, SidebarContainer, type SidebarContainerProps, SidebarImageBrand, type SidebarImageBrandProps, SidebarNavCollapse, type SidebarNavCollapseProps, SidebarNavLink, type SidebarNavLinkProps, type SidebarProps, type StatusLeitura, type StatusNotificacao, Switch, type SwitchProps, Tabs, TabsContent, TabsList, TabsTrigger, Title, URL_PADRAO_NOTIFICACOES, availableApps, buttonVariants };