@adatechnology/notification-ui 0.1.0-rc.1 → 0.1.0-rc.3
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/chunk-I6WQKOCP.js +428 -0
- package/dist/chunk-I6WQKOCP.js.map +1 -0
- package/dist/headless.d.ts +113 -11
- package/dist/headless.js +26 -291
- package/dist/headless.js.map +1 -1
- package/dist/index.d.ts +86 -5
- package/dist/index.js +400 -461
- package/dist/index.js.map +1 -1
- package/dist/styles.css +344 -5
- package/dist/styles.css.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export { DEFAULT_LOCALE, NOTIFICATION_QUERY_KEYS, NotificationContextValue, NotificationLocale, NotificationMessages, NotificationProvider, NotificationProviderProps, NotificationTheme, UseNotificationStreamOptions, UseNotificationsOptions, flattenNotificationPages, resolveMessages, useDeleteNotification, useMarkAllAsRead, useMarkAsRead, useNotificationContext, useNotificationStream, useNotifications, usePreferences, useTemplates, useUnreadCount, useUpdatePreferences } from './headless.js';
|
|
1
|
+
export { DEFAULT_LOCALE, NOTIFICATION_QUERY_KEYS, NotificationContextValue, NotificationLocale, NotificationMessages, NotificationProvider, NotificationProviderProps, NotificationTheme, TemplateDraft, UseNotificationStreamOptions, UseNotificationsOptions, UseTemplateEditorParams, UseTemplateEditorResult, flattenNotificationPages, formatNotificationTime, formatNotificationTimestamp, resolveMessages, useDeleteNotification, useMarkAllAsRead, useMarkAsRead, useNotificationContext, useNotificationStream, useNotifications, usePreferences, useTemplateEditor, useTemplates, useUnreadCount, useUpdatePreferences, useUpsertTemplate } from './headless.js';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { NotificationSummary, NotificationTemplate } from '@adatechnology/notification-contracts';
|
|
4
5
|
import '@adatechnology/notification-client';
|
|
5
6
|
import '@tanstack/react-query';
|
|
6
7
|
|
|
@@ -13,7 +14,7 @@ type NotificationBellProps = {
|
|
|
13
14
|
/** Acima disso o badge mostra `99+`; um número de 4 dígitos estoura o desenho do badge. */
|
|
14
15
|
readonly maxBadgeCount?: number;
|
|
15
16
|
};
|
|
16
|
-
declare function NotificationBell({ onClick, className, maxBadgeCount }: NotificationBellProps): react.JSX.Element;
|
|
17
|
+
declare function NotificationBell({ onClick, className, maxBadgeCount, }: NotificationBellProps): react.JSX.Element;
|
|
17
18
|
|
|
18
19
|
type NotificationItemProps = {
|
|
19
20
|
readonly notification: NotificationSummary;
|
|
@@ -26,12 +27,17 @@ type NotificationListProps = {
|
|
|
26
27
|
readonly category?: string;
|
|
27
28
|
readonly onSelect?: (notification: NotificationSummary) => void;
|
|
28
29
|
readonly className?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Substitui o vazio padrão. Quem decide se está vazio é a lista — o host que desenhava o próprio
|
|
32
|
+
* vazio ao lado dela mostrava "nada por aqui" embaixo das notificações que estavam ali.
|
|
33
|
+
*/
|
|
34
|
+
readonly renderEmpty?: () => ReactNode;
|
|
29
35
|
/** Slot: o host troca a linha sem reimplementar a lista (regra §4.3, slots e overrides). */
|
|
30
36
|
readonly components?: {
|
|
31
37
|
readonly Item?: typeof NotificationItem;
|
|
32
38
|
};
|
|
33
39
|
};
|
|
34
|
-
declare function NotificationList({ category, onSelect, className, components }: NotificationListProps): react.JSX.Element;
|
|
40
|
+
declare function NotificationList({ category, onSelect, className, renderEmpty, components }: NotificationListProps): react.JSX.Element;
|
|
35
41
|
|
|
36
42
|
/**
|
|
37
43
|
* Copyright (c) 2026 Ada Technology. MIT License.
|
|
@@ -41,4 +47,79 @@ type PreferencesPanelProps = {
|
|
|
41
47
|
};
|
|
42
48
|
declare function PreferencesPanel({ className }: PreferencesPanelProps): react.JSX.Element;
|
|
43
49
|
|
|
44
|
-
|
|
50
|
+
type NotificationsWorkspaceProps = {
|
|
51
|
+
/** Sobrescreve textos pontuais sem trocar o locale inteiro. */
|
|
52
|
+
readonly labels?: Partial<Record<string, string>>;
|
|
53
|
+
/** Filtra a inbox por assunto. Ausente, mostra tudo. */
|
|
54
|
+
readonly category?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Coluna de preferências ao lado da inbox.
|
|
57
|
+
*
|
|
58
|
+
* Ligada por padrão porque é o caso comum; um produto que gerencia preferência noutra tela passa
|
|
59
|
+
* `false` e fica só com a inbox, em largura cheia.
|
|
60
|
+
*/
|
|
61
|
+
readonly showPreferences?: boolean;
|
|
62
|
+
/** Ausente, o link de configuração não aparece — o produto pode não ter essa tela. */
|
|
63
|
+
readonly settingsHref?: string | undefined;
|
|
64
|
+
/** Clique numa notificação. Ausente, a linha não é clicável. */
|
|
65
|
+
readonly onSelectNotification?: (notification: NotificationSummary) => void;
|
|
66
|
+
/**
|
|
67
|
+
* Substitui o cabeçalho padrão inteiro.
|
|
68
|
+
*
|
|
69
|
+
* O workspace desenha um `<h1>` porque ele é a tela; a página que já tem o título dela passava a
|
|
70
|
+
* ter dois `<h1>` dizendo a mesma palavra, e para leitor de tela duas primeiras manchetes é o
|
|
71
|
+
* mesmo que nenhuma. Ausente, o padrão continua desenhando — slot é substituição, não interruptor.
|
|
72
|
+
*/
|
|
73
|
+
readonly renderHeader?: () => ReactNode;
|
|
74
|
+
/** Ações do produto no cabeçalho, ao lado do link de configuração. */
|
|
75
|
+
readonly renderHeaderActions?: () => ReactNode;
|
|
76
|
+
/** Aviso ou filtro do produto, entre o cabeçalho e a lista. */
|
|
77
|
+
readonly renderAboveList?: () => ReactNode;
|
|
78
|
+
/** Substitui o vazio padrão — útil quando o produto sabe explicar por que está vazio. */
|
|
79
|
+
readonly renderEmpty?: () => ReactNode;
|
|
80
|
+
readonly className?: string;
|
|
81
|
+
};
|
|
82
|
+
declare function NotificationsWorkspace({ labels: labelsOverride, category, showPreferences, settingsHref, onSelectNotification, renderHeader, renderHeaderActions, renderAboveList, renderEmpty, className, }: NotificationsWorkspaceProps): react.JSX.Element;
|
|
83
|
+
|
|
84
|
+
type NotificationChannelOption = {
|
|
85
|
+
readonly id: string;
|
|
86
|
+
readonly label: string;
|
|
87
|
+
/** O custo do canal, em uma linha. É o que faz alguém decidir em vez de chutar. */
|
|
88
|
+
readonly hint?: string;
|
|
89
|
+
};
|
|
90
|
+
type NotificationCategoryOption = {
|
|
91
|
+
readonly id: string;
|
|
92
|
+
readonly label: string;
|
|
93
|
+
readonly hint?: string;
|
|
94
|
+
};
|
|
95
|
+
type NotificationSettingsWorkspaceProps = {
|
|
96
|
+
readonly labels?: Partial<Record<string, string>>;
|
|
97
|
+
/** Os canais que ESTE produto oferece — o pacote despacha em cinco e não opina sobre quais usar. */
|
|
98
|
+
readonly channels: readonly NotificationChannelOption[];
|
|
99
|
+
/** Os assuntos que este produto dispara. */
|
|
100
|
+
readonly categories: readonly NotificationCategoryOption[];
|
|
101
|
+
/**
|
|
102
|
+
* Valores de exemplo do preview, por assunto do template. Ausente, o preview mostra campo vazio —
|
|
103
|
+
* que é honesto, mas menos útil para quem está escrevendo o texto.
|
|
104
|
+
*/
|
|
105
|
+
readonly previewPayload?: Readonly<Record<string, unknown>>;
|
|
106
|
+
/** Traduz `order.status.preparing` no rótulo que o produto usa. Ausente, mostra a chave crua. */
|
|
107
|
+
readonly templateLabelOf?: (template: NotificationTemplate) => string;
|
|
108
|
+
/**
|
|
109
|
+
* Campo extra por canal — é onde entra o nome do template aprovado na Meta, que só o WhatsApp tem.
|
|
110
|
+
* Ausente, nenhum campo extra aparece.
|
|
111
|
+
*/
|
|
112
|
+
readonly renderChannelFields?: (params: {
|
|
113
|
+
readonly channel: string;
|
|
114
|
+
readonly value: string;
|
|
115
|
+
readonly onChange: (value: string) => void;
|
|
116
|
+
}) => ReactNode;
|
|
117
|
+
/** Substitui o cabeçalho padrão — a página que já tem título próprio evita o segundo `<h1>`. */
|
|
118
|
+
readonly renderHeader?: () => ReactNode;
|
|
119
|
+
/** Ações do produto no cabeçalho. */
|
|
120
|
+
readonly renderHeaderActions?: () => ReactNode;
|
|
121
|
+
readonly className?: string;
|
|
122
|
+
};
|
|
123
|
+
declare function NotificationSettingsWorkspace({ labels: labelsOverride, channels, categories, previewPayload, templateLabelOf, renderChannelFields, renderHeader, renderHeaderActions, className, }: NotificationSettingsWorkspaceProps): react.JSX.Element;
|
|
124
|
+
|
|
125
|
+
export { NotificationBell, type NotificationBellProps, type NotificationCategoryOption, type NotificationChannelOption, NotificationItem, type NotificationItemProps, NotificationList, type NotificationListProps, NotificationSettingsWorkspace, type NotificationSettingsWorkspaceProps, NotificationsWorkspace, type NotificationsWorkspaceProps, PreferencesPanel, type PreferencesPanelProps };
|