@adatechnology/content-ui 0.0.0-stage → 0.2.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.
@@ -0,0 +1,762 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import * as _adatechnology_content_contracts from '@adatechnology/content-contracts';
4
+ import { PostStatus, Paginated, PostSummary, Post, CreatePostInput, UpdatePostInput, PublishPostInput, TagCount, PublicPostSummary, PublicPost } from '@adatechnology/content-contracts';
5
+
6
+ var statusDraft = "Rascunho";
7
+ var statusScheduled = "Agendado";
8
+ var statusPublished = "Publicado";
9
+ var statusArchived = "Arquivado";
10
+ var listTitle = "Posts";
11
+ var newPost = "Novo post";
12
+ var searchLabel = "Buscar";
13
+ var searchPlaceholder = "Título ou endereço";
14
+ var filterStatus = "Status";
15
+ var filterAll = "Todos";
16
+ var filterTag = "Tag";
17
+ var loading = "Carregando…";
18
+ var empty = "Nenhum post encontrado.";
19
+ var loadError = "Não foi possível carregar.";
20
+ var retry = "Tentar de novo";
21
+ var columnTitle = "Título";
22
+ var columnStatus = "Status";
23
+ var columnUpdated = "Atualizado";
24
+ var columnPublished = "Publicação";
25
+ var paginationLabel = "Paginação";
26
+ var paginationPrevious = "Anterior";
27
+ var paginationNext = "Próxima";
28
+ var pageLabel = "Página {page}";
29
+ var editorNewTitle = "Novo post";
30
+ var editorEditTitle = "Editar post";
31
+ var fieldTitle = "Título";
32
+ var fieldSlug = "Endereço (slug)";
33
+ var fieldSlugHint = "Aparece na URL. Mudar depois de publicado quebra links já compartilhados.";
34
+ var fieldExcerpt = "Resumo";
35
+ var fieldBody = "Conteúdo";
36
+ var bodyHint = "Markdown: # título, **negrito**, *itálico*, - lista, [link](https://…), ![imagem](https://…)";
37
+ var tabWrite = "Escrever";
38
+ var tabPreview = "Pré-visualizar";
39
+ var previewEmpty = "Nada para pré-visualizar.";
40
+ var fieldCover = "Imagem de capa";
41
+ var fieldCoverUrl = "URL da imagem";
42
+ var fieldCoverAlt = "Descrição da imagem (texto alternativo)";
43
+ var coverUpload = "Enviar imagem";
44
+ var coverRemove = "Remover capa";
45
+ var coverTooLarge = "A imagem passa de 1 MB.";
46
+ var coverInvalidType = "Use JPG, PNG ou WebP.";
47
+ var coverUploading = "Enviando…";
48
+ var coverUploadError = "Não foi possível enviar a imagem.";
49
+ var fieldTags = "Tags";
50
+ var tagsHint = "Enter ou vírgula para adicionar";
51
+ var tagRemove = "Remover tag {tag}";
52
+ var fieldAuthor = "Autor";
53
+ var seoSection = "SEO";
54
+ var fieldSeoTitle = "Título para buscadores";
55
+ var fieldSeoDescription = "Descrição para buscadores";
56
+ var fieldCanonical = "URL canônica";
57
+ var publishSection = "Publicação";
58
+ var scheduleAt = "Agendar para";
59
+ var save = "Salvar rascunho";
60
+ var saveChanges = "Salvar";
61
+ var saving = "Salvando…";
62
+ var saved = "Salvo.";
63
+ var publishNow = "Publicar agora";
64
+ var schedule = "Agendar";
65
+ var unpublish = "Despublicar";
66
+ var archive = "Arquivar";
67
+ var archiveConfirm = "Arquivar este post? Ele sai do site.";
68
+ var close = "Voltar";
69
+ var unsavedConfirm = "Há alterações não salvas. Sair mesmo assim?";
70
+ var unsavedBadge = "Alterações não salvas";
71
+ var saveError = "Não foi possível salvar.";
72
+ var errorTitle = "Informe o título.";
73
+ var errorSlug = "Use letras minúsculas, números e hífen.";
74
+ var errorUrl = "Use um endereço http(s) completo.";
75
+ var errorSchedule = "Escolha uma data e hora.";
76
+ var scheduledFor = "Agendado para {date}";
77
+ var publishedOn = "Publicado em {date}";
78
+ var readingTime = "{minutes} min de leitura";
79
+ var readMore = "Ler mais";
80
+ var byAuthor = "Por {author}";
81
+ var allTags = "Todos";
82
+ var tagsLabel = "Filtrar por tag";
83
+ var shareLabel = "Compartilhar";
84
+ var shareWhatsApp = "WhatsApp";
85
+ var shareFacebook = "Facebook";
86
+ var shareX = "X";
87
+ var shareLinkedIn = "LinkedIn";
88
+ var copyLink = "Copiar link";
89
+ var linkCopied = "Link copiado";
90
+ var shareNative = "Compartilhar…";
91
+ var shareOn = "Compartilhar no {network}";
92
+ var notFound = "Post não encontrado.";
93
+ var postsEmpty = "Nenhum post publicado ainda.";
94
+ var clearFilters = "Limpar filtros";
95
+ var bodyHintToolbar = "Selecione o texto e use os botões acima. Atalhos: Ctrl+B negrito, Ctrl+I itálico, Ctrl+K link.";
96
+ var toolbarLabel = "Formatação do texto";
97
+ var formatBold = "Negrito";
98
+ var formatItalic = "Itálico";
99
+ var formatHeading2 = "Título";
100
+ var formatHeading3 = "Subtítulo";
101
+ var formatBulletList = "Lista com marcadores";
102
+ var formatNumberedList = "Lista numerada";
103
+ var formatQuote = "Citação";
104
+ var formatLink = "Link";
105
+ var formatImage = "Imagem";
106
+ var formatEmoji = "Emoji";
107
+ var formatSampleText = "texto";
108
+ var linkDialogTitle = "Inserir link";
109
+ var linkUrl = "Endereço do link (URL)";
110
+ var linkText = "Texto do link";
111
+ var imageDialogTitle = "Inserir imagem";
112
+ var imageUploadFromDevice = "Enviar do aparelho";
113
+ var dialogInsert = "Inserir";
114
+ var dialogCancel = "Cancelar";
115
+ var fileNoneChosen = "Nenhum arquivo escolhido";
116
+ var emojiTitle = "Escolher emoji";
117
+ var emojiSearch = "Buscar emoji";
118
+ var emojiCategories = "Categorias de emoji";
119
+ var emojiEmpty = "Nenhum emoji encontrado.";
120
+ var emojiSmileys = "Rostos";
121
+ var emojiGestures = "Gestos";
122
+ var emojiFood = "Comida";
123
+ var emojiNature = "Natureza";
124
+ var emojiTravel = "Lugares";
125
+ var emojiObjects = "Objetos";
126
+ var emojiSymbols = "Símbolos";
127
+ var ptBR = {
128
+ statusDraft: statusDraft,
129
+ statusScheduled: statusScheduled,
130
+ statusPublished: statusPublished,
131
+ statusArchived: statusArchived,
132
+ listTitle: listTitle,
133
+ newPost: newPost,
134
+ searchLabel: searchLabel,
135
+ searchPlaceholder: searchPlaceholder,
136
+ filterStatus: filterStatus,
137
+ filterAll: filterAll,
138
+ filterTag: filterTag,
139
+ loading: loading,
140
+ empty: empty,
141
+ loadError: loadError,
142
+ retry: retry,
143
+ columnTitle: columnTitle,
144
+ columnStatus: columnStatus,
145
+ columnUpdated: columnUpdated,
146
+ columnPublished: columnPublished,
147
+ paginationLabel: paginationLabel,
148
+ paginationPrevious: paginationPrevious,
149
+ paginationNext: paginationNext,
150
+ pageLabel: pageLabel,
151
+ editorNewTitle: editorNewTitle,
152
+ editorEditTitle: editorEditTitle,
153
+ fieldTitle: fieldTitle,
154
+ fieldSlug: fieldSlug,
155
+ fieldSlugHint: fieldSlugHint,
156
+ fieldExcerpt: fieldExcerpt,
157
+ fieldBody: fieldBody,
158
+ bodyHint: bodyHint,
159
+ tabWrite: tabWrite,
160
+ tabPreview: tabPreview,
161
+ previewEmpty: previewEmpty,
162
+ fieldCover: fieldCover,
163
+ fieldCoverUrl: fieldCoverUrl,
164
+ fieldCoverAlt: fieldCoverAlt,
165
+ coverUpload: coverUpload,
166
+ coverRemove: coverRemove,
167
+ coverTooLarge: coverTooLarge,
168
+ coverInvalidType: coverInvalidType,
169
+ coverUploading: coverUploading,
170
+ coverUploadError: coverUploadError,
171
+ fieldTags: fieldTags,
172
+ tagsHint: tagsHint,
173
+ tagRemove: tagRemove,
174
+ fieldAuthor: fieldAuthor,
175
+ seoSection: seoSection,
176
+ fieldSeoTitle: fieldSeoTitle,
177
+ fieldSeoDescription: fieldSeoDescription,
178
+ fieldCanonical: fieldCanonical,
179
+ publishSection: publishSection,
180
+ scheduleAt: scheduleAt,
181
+ save: save,
182
+ saveChanges: saveChanges,
183
+ saving: saving,
184
+ saved: saved,
185
+ publishNow: publishNow,
186
+ schedule: schedule,
187
+ unpublish: unpublish,
188
+ archive: archive,
189
+ archiveConfirm: archiveConfirm,
190
+ close: close,
191
+ unsavedConfirm: unsavedConfirm,
192
+ unsavedBadge: unsavedBadge,
193
+ saveError: saveError,
194
+ errorTitle: errorTitle,
195
+ errorSlug: errorSlug,
196
+ errorUrl: errorUrl,
197
+ errorSchedule: errorSchedule,
198
+ scheduledFor: scheduledFor,
199
+ publishedOn: publishedOn,
200
+ readingTime: readingTime,
201
+ readMore: readMore,
202
+ byAuthor: byAuthor,
203
+ allTags: allTags,
204
+ tagsLabel: tagsLabel,
205
+ shareLabel: shareLabel,
206
+ shareWhatsApp: shareWhatsApp,
207
+ shareFacebook: shareFacebook,
208
+ shareX: shareX,
209
+ shareLinkedIn: shareLinkedIn,
210
+ copyLink: copyLink,
211
+ linkCopied: linkCopied,
212
+ shareNative: shareNative,
213
+ shareOn: shareOn,
214
+ notFound: notFound,
215
+ postsEmpty: postsEmpty,
216
+ clearFilters: clearFilters,
217
+ bodyHintToolbar: bodyHintToolbar,
218
+ toolbarLabel: toolbarLabel,
219
+ formatBold: formatBold,
220
+ formatItalic: formatItalic,
221
+ formatHeading2: formatHeading2,
222
+ formatHeading3: formatHeading3,
223
+ formatBulletList: formatBulletList,
224
+ formatNumberedList: formatNumberedList,
225
+ formatQuote: formatQuote,
226
+ formatLink: formatLink,
227
+ formatImage: formatImage,
228
+ formatEmoji: formatEmoji,
229
+ formatSampleText: formatSampleText,
230
+ linkDialogTitle: linkDialogTitle,
231
+ linkUrl: linkUrl,
232
+ linkText: linkText,
233
+ imageDialogTitle: imageDialogTitle,
234
+ imageUploadFromDevice: imageUploadFromDevice,
235
+ dialogInsert: dialogInsert,
236
+ dialogCancel: dialogCancel,
237
+ fileNoneChosen: fileNoneChosen,
238
+ emojiTitle: emojiTitle,
239
+ emojiSearch: emojiSearch,
240
+ emojiCategories: emojiCategories,
241
+ emojiEmpty: emojiEmpty,
242
+ emojiSmileys: emojiSmileys,
243
+ emojiGestures: emojiGestures,
244
+ emojiFood: emojiFood,
245
+ emojiNature: emojiNature,
246
+ emojiTravel: emojiTravel,
247
+ emojiObjects: emojiObjects,
248
+ emojiSymbols: emojiSymbols
249
+ };
250
+
251
+ /**
252
+ * Copyright (c) 2026 Ada Technology. MIT License.
253
+ *
254
+ * Nenhum texto visível vive em componente. O host sobrescreve chaves pontuais por `messages` no
255
+ * provider sem fornecer um locale inteiro — inclusive para trocar "post" pelo vocabulário dele.
256
+ */
257
+
258
+ type ContentMessages = typeof ptBR;
259
+ type ContentLocale = 'pt-BR' | 'en';
260
+ declare const DEFAULT_CONTENT_LOCALE: ContentLocale;
261
+ declare function resolveContentMessages(locale: ContentLocale): ContentMessages;
262
+ /** `{name}` → valor. Chave sem valor fica como está, para o defeito aparecer em vez de sumir. */
263
+ declare function interpolate(message: string, values: Readonly<Record<string, string | number>>): string;
264
+
265
+ /**
266
+ * Copyright (c) 2026 Ada Technology. MIT License.
267
+ *
268
+ * O pacote não faz `fetch`: o host implementa estas interfaces (sobre as rotas do
269
+ * `content-module`, um BFF, ou o que tiver) e injeta no `ContentProvider`.
270
+ */
271
+
272
+ type ListPostsParams = {
273
+ readonly page?: number;
274
+ readonly pageSize?: number;
275
+ readonly status?: PostStatus;
276
+ readonly tag?: string;
277
+ readonly search?: string;
278
+ };
279
+ type ContentAdminApi = {
280
+ listPosts(params: ListPostsParams): Promise<Paginated<PostSummary>>;
281
+ getPost(id: string): Promise<Post>;
282
+ createPost(input: CreatePostInput): Promise<Post>;
283
+ updatePost(id: string, input: UpdatePostInput): Promise<Post>;
284
+ publishPost(id: string, input?: PublishPostInput): Promise<Post>;
285
+ unpublishPost(id: string): Promise<Post>;
286
+ archivePost(id: string): Promise<void>;
287
+ /** Ausente: o filtro de tag vira campo livre e o editor não sugere tags. */
288
+ listTags?(): Promise<readonly TagCount[]>;
289
+ /** Ausente: a capa é só por URL — sem alvo de upload que sempre falharia. */
290
+ uploadCoverImage?(file: File): Promise<{
291
+ readonly url: string;
292
+ readonly key: string;
293
+ }>;
294
+ };
295
+ type ListPublishedPostsParams = {
296
+ readonly page?: number;
297
+ readonly pageSize?: number;
298
+ readonly tag?: string;
299
+ };
300
+ type ContentPublicApi = {
301
+ listPublishedPosts(params: ListPublishedPostsParams): Promise<Paginated<PublicPostSummary>>;
302
+ /** Rejeita (ou resolve `undefined`) quando o post não existe ou não está no ar. */
303
+ getPublishedPost(slug: string): Promise<PublicPost | undefined>;
304
+ /** Ausente: a página de lista não mostra o filtro de tags. */
305
+ listTags?(): Promise<readonly TagCount[]>;
306
+ };
307
+ type RenderLinkProps = {
308
+ readonly href: string;
309
+ readonly className?: string;
310
+ readonly children: ReactNode;
311
+ readonly 'aria-current'?: 'page';
312
+ readonly 'aria-label'?: string;
313
+ readonly rel?: string;
314
+ };
315
+ /** Troca o `<a>` pelo `Link` do roteador do host (Next, React Router…) sem o pacote conhecê-lo. */
316
+ type RenderLink = (props: RenderLinkProps) => ReactNode;
317
+ type DateTimeInputProps = {
318
+ readonly id: string;
319
+ readonly label: string;
320
+ /** Formato `YYYY-MM-DDTHH:mm` (hora local, 24h), ou vazio. */
321
+ readonly value: string;
322
+ readonly onChange: (value: string) => void;
323
+ };
324
+ /** Troca o `<input type="datetime-local">` nativo pelo seletor de data e hora do host. */
325
+ type RenderDateTimeInput = (props: DateTimeInputProps) => ReactNode;
326
+
327
+ type ContentProviderProps = {
328
+ /** Painel: lista e editor. Site público não precisa passar. */
329
+ readonly adminApi?: ContentAdminApi;
330
+ /** Site público: lista, página do post. Painel não precisa passar. */
331
+ readonly publicApi?: ContentPublicApi;
332
+ readonly locale?: ContentLocale;
333
+ /** Sobrescreve textos pontuais (ex.: "Posts" → "Novidades") sem trocar o locale inteiro. */
334
+ readonly messages?: Partial<ContentMessages>;
335
+ /** Link do roteador do host. Padrão: `<a>`. */
336
+ readonly renderLink?: RenderLink;
337
+ readonly children: ReactNode;
338
+ };
339
+ declare function ContentProvider({ adminApi, publicApi, locale, messages, renderLink, children, }: ContentProviderProps): react.JSX.Element;
340
+ declare function useContentAdminApi(): ContentAdminApi;
341
+ declare function useContentPublicApi(): ContentPublicApi;
342
+ type ContentText = {
343
+ readonly messages: ContentMessages;
344
+ readonly locale: ContentLocale;
345
+ readonly format: (key: keyof ContentMessages, values: Readonly<Record<string, string | number>>) => string;
346
+ };
347
+ declare function useContentText(): ContentText;
348
+ declare function useRenderLink(): RenderLink;
349
+
350
+ /**
351
+ * Copyright (c) 2026 Ada Technology. MIT License.
352
+ *
353
+ * Estado do editor como dado puro: rascunho ↔ post, detecção de alteração e validação com o
354
+ * mesmo schema que o servidor aplica.
355
+ */
356
+
357
+ type PostDraft = {
358
+ readonly title: string;
359
+ readonly slug: string;
360
+ readonly excerpt: string;
361
+ readonly body: string;
362
+ readonly coverImageUrl: string;
363
+ readonly coverImageAlt: string;
364
+ readonly tags: readonly string[];
365
+ readonly authorName: string;
366
+ readonly seoTitle: string;
367
+ readonly seoDescription: string;
368
+ readonly canonicalUrl: string;
369
+ };
370
+ declare const EMPTY_POST_DRAFT: PostDraft;
371
+ declare function draftFromPost(post: Post | undefined, defaults?: Partial<PostDraft>): PostDraft;
372
+ /** Campo vazio vira `null` (apaga no servidor); slug vazio é omitido (o servidor gera). */
373
+ declare function draftToInput(draft: PostDraft): CreatePostInput;
374
+ declare function isDraftDirty(draft: PostDraft, baseline: PostDraft): boolean;
375
+ /** Enquanto o autor não mexe no slug de um post novo, ele acompanha o título. */
376
+ declare function deriveSlug(params: {
377
+ readonly title: string;
378
+ readonly slug: string;
379
+ readonly slugTouched: boolean;
380
+ }): string;
381
+ declare const DRAFT_ERROR: {
382
+ readonly TITLE: "title";
383
+ readonly SLUG: "slug";
384
+ readonly COVER_IMAGE_URL: "coverImageUrl";
385
+ readonly CANONICAL_URL: "canonicalUrl";
386
+ };
387
+ type DraftErrorField = (typeof DRAFT_ERROR)[keyof typeof DRAFT_ERROR];
388
+ declare function validateDraft(draft: PostDraft): Partial<Record<DraftErrorField, true>>;
389
+ /** Entrada do campo de tags: separa por vírgula/quebra e normaliza como o servidor fará. */
390
+ declare function splitTagInput(value: string): string[];
391
+
392
+ type ContentWorkspaceProps = {
393
+ readonly pageSize?: number;
394
+ /** Valores iniciais do post novo (ex.: autor logado). */
395
+ readonly newPostDefaults?: Partial<PostDraft>;
396
+ readonly onPostSaved?: (post: Post) => void;
397
+ readonly showFormattingToolbar?: boolean;
398
+ readonly renderDateTimeInput?: RenderDateTimeInput;
399
+ };
400
+ declare function ContentWorkspace({ pageSize, newPostDefaults, onPostSaved, showFormattingToolbar, renderDateTimeInput, }: ContentWorkspaceProps): react.JSX.Element;
401
+
402
+ type PostListProps = {
403
+ readonly onSelect: (post: PostSummary) => void;
404
+ /** Ausente: sem botão "Novo post". */
405
+ readonly onCreate?: () => void;
406
+ readonly pageSize?: number;
407
+ /** Mude o valor para forçar recarga (ex.: depois de salvar no editor). */
408
+ readonly reloadKey?: number;
409
+ };
410
+ declare function PostList({ onSelect, onCreate, pageSize, reloadKey }: PostListProps): react.JSX.Element;
411
+
412
+ type PostEditorProps = {
413
+ /** Ausente: post novo. */
414
+ readonly postId?: string;
415
+ /** Valores iniciais de um post novo (ex.: `authorName` do usuário logado). */
416
+ readonly defaults?: Partial<PostDraft>;
417
+ readonly onSaved?: (post: Post) => void;
418
+ readonly onArchived?: (post: Post) => void;
419
+ /** Ausente: sem botão Voltar. Só é chamado depois de confirmar alterações não salvas. */
420
+ readonly onClose?: () => void;
421
+ /** Barra de formatação do corpo (padrão: ligada). O formato guardado é Markdown nos dois casos. */
422
+ readonly showFormattingToolbar?: boolean;
423
+ /** Seletor de data e hora do host para "Agendar para". Padrão: `<input type="datetime-local">`. */
424
+ readonly renderDateTimeInput?: RenderDateTimeInput;
425
+ };
426
+ declare function PostEditor({ postId, defaults, onSaved, onArchived, onClose, showFormattingToolbar, renderDateTimeInput, }: PostEditorProps): react.JSX.Element;
427
+
428
+ declare const COVER_MAX_BYTES: number;
429
+ declare const COVER_MIME_TYPES: readonly string[];
430
+ type EditorFeedback = 'saved' | 'saveError' | 'coverTooLarge' | 'coverInvalidType' | 'coverUploadError' | 'errorSchedule';
431
+ type UploadImageResult = {
432
+ readonly url: string;
433
+ } | {
434
+ readonly error: 'coverTooLarge' | 'coverInvalidType' | 'coverUploadError';
435
+ };
436
+ declare function usePostEditor(params: {
437
+ readonly postId?: string;
438
+ readonly defaults?: Partial<PostDraft>;
439
+ readonly onSaved?: (post: Post) => void;
440
+ readonly onArchived?: (post: Post) => void;
441
+ }): {
442
+ post: Post | undefined;
443
+ draft: PostDraft;
444
+ update: <TKey extends keyof PostDraft>(field: TKey, value: PostDraft[TKey]) => void;
445
+ errors: Partial<Record<DraftErrorField, true>>;
446
+ isLoading: boolean;
447
+ isDirty: boolean;
448
+ isBusy: boolean;
449
+ isUploading: boolean;
450
+ feedback: EditorFeedback | undefined;
451
+ scheduleAt: string;
452
+ setScheduleAt: react.Dispatch<react.SetStateAction<string>>;
453
+ canUploadCover: boolean;
454
+ tagSuggestions: string[];
455
+ save: () => Promise<Post | undefined>;
456
+ publishNow: () => Promise<Post | undefined>;
457
+ schedule: () => Promise<Post | undefined>;
458
+ unpublish: () => Promise<Post | undefined>;
459
+ archive: () => Promise<void>;
460
+ uploadCover: (file: File) => Promise<void>;
461
+ uploadImage: (file: File) => Promise<UploadImageResult>;
462
+ };
463
+ type PostEditorState = ReturnType<typeof usePostEditor>;
464
+
465
+ type MarkdownEditorProps = {
466
+ readonly value: string;
467
+ readonly onChange: (value: string) => void;
468
+ readonly labelledBy: string;
469
+ readonly describedBy?: string;
470
+ readonly showToolbar?: boolean;
471
+ /** Ausente: o botão de imagem só aceita URL, sem envio de arquivo. */
472
+ readonly onUploadImage?: (file: File) => Promise<UploadImageResult>;
473
+ readonly isUploading?: boolean;
474
+ };
475
+ declare function MarkdownEditor({ value, onChange, labelledBy, describedBy, showToolbar, onUploadImage, isUploading, }: MarkdownEditorProps): react.JSX.Element;
476
+
477
+ /**
478
+ * Copyright (c) 2026 Ada Technology. MIT License.
479
+ */
480
+ type EmojiPickerProps = {
481
+ readonly onPick: (emoji: string) => void;
482
+ readonly onClose: () => void;
483
+ };
484
+ declare function EmojiPicker({ onPick, onClose }: EmojiPickerProps): react.JSX.Element;
485
+
486
+ /**
487
+ * Copyright (c) 2026 Ada Technology. MIT License.
488
+ *
489
+ * Seletor de arquivo estilizado: botão + nome do arquivo, com os textos vindos das mensagens (o
490
+ * `<input type="file">` nativo mostra o idioma do navegador e não aceita estilo).
491
+ */
492
+ type FilePickerProps = {
493
+ readonly buttonLabel: string;
494
+ readonly emptyLabel: string;
495
+ readonly accept: string;
496
+ readonly isBusy?: boolean;
497
+ readonly onPick: (file: File) => void;
498
+ };
499
+ declare function FilePicker({ buttonLabel, emptyLabel, accept, isBusy, onPick }: FilePickerProps): react.JSX.Element;
500
+
501
+ type StatusChipProps = {
502
+ readonly status: PostStatus;
503
+ };
504
+ declare function StatusChip({ status }: StatusChipProps): react.JSX.Element;
505
+
506
+ /**
507
+ * Copyright (c) 2026 Ada Technology. MIT License.
508
+ */
509
+ type TagsInputProps = {
510
+ readonly value: readonly string[];
511
+ readonly onChange: (tags: string[]) => void;
512
+ readonly suggestions?: readonly string[];
513
+ readonly label: string;
514
+ };
515
+ declare function TagsInput({ value, onChange, suggestions, label }: TagsInputProps): react.JSX.Element;
516
+
517
+ type PostCardProps = {
518
+ readonly post: PublicPostSummary;
519
+ readonly href: string;
520
+ /** Nível do título do card na página do host. Padrão: 2. */
521
+ readonly headingLevel?: 2 | 3 | 4;
522
+ };
523
+ declare function PostCard({ post, href, headingLevel }: PostCardProps): react.JSX.Element;
524
+
525
+ /**
526
+ * Copyright (c) 2026 Ada Technology. MIT License.
527
+ *
528
+ * Página pública de lista. Página e tag vêm da URL do host (props) e saem como links, para cada
529
+ * página da lista ser endereçável e indexável.
530
+ */
531
+ type PostListPageProps = {
532
+ readonly page?: number;
533
+ readonly tag?: string;
534
+ readonly pageSize?: number;
535
+ readonly getPostHref: (slug: string) => string;
536
+ /** Link de uma página/tag da lista. `tag` ausente = todas. */
537
+ readonly getListHref: (params: {
538
+ readonly page: number;
539
+ readonly tag?: string;
540
+ }) => string;
541
+ /** Título visível da página. Ausente: sem `<h1>` (o host já tem o dele). */
542
+ readonly title?: string;
543
+ };
544
+ declare function PostListPage({ page, tag, pageSize, getPostHref, getListHref, title }: PostListPageProps): react.JSX.Element;
545
+
546
+ /**
547
+ * Copyright (c) 2026 Ada Technology. MIT License.
548
+ *
549
+ * Compartilhamento por URL simples das redes: nenhum script de terceiro entra na página, nada de
550
+ * rastreamento carregado só por abrir o post.
551
+ */
552
+ declare const SHARE_NETWORK: {
553
+ readonly WHATSAPP: "whatsapp";
554
+ readonly FACEBOOK: "facebook";
555
+ readonly X: "x";
556
+ readonly LINKEDIN: "linkedin";
557
+ };
558
+ type ShareNetwork = (typeof SHARE_NETWORK)[keyof typeof SHARE_NETWORK];
559
+ declare const SHARE_NETWORKS: readonly ShareNetwork[];
560
+ type ShareLink = {
561
+ readonly network: ShareNetwork;
562
+ readonly href: string;
563
+ };
564
+ declare function buildShareLinks(params: {
565
+ readonly url: string;
566
+ readonly title: string;
567
+ }): readonly ShareLink[];
568
+
569
+ type PostPageProps = {
570
+ readonly slug: string;
571
+ /** URL compartilhada. Padrão: o endereço atual do navegador. */
572
+ readonly shareUrl?: string;
573
+ /** Redes de compartilhamento; lista vazia esconde o bloco. */
574
+ readonly shareNetworks?: readonly ShareNetwork[];
575
+ /** Ausente: tags sem link. */
576
+ readonly getTagHref?: (tag: string) => string;
577
+ /** Para o host montar `<title>`/meta (ver `buildPostMeta`). */
578
+ readonly onLoaded?: (post: PublicPost) => void;
579
+ readonly renderNotFound?: () => ReactNode;
580
+ };
581
+ declare function PostPage({ slug, shareUrl, shareNetworks, getTagHref, onLoaded, renderNotFound }: PostPageProps): react.JSX.Element;
582
+
583
+ type ShareButtonsProps = {
584
+ readonly url: string;
585
+ readonly title: string;
586
+ /** Redes exibidas, na ordem. Padrão: todas. */
587
+ readonly networks?: readonly ShareNetwork[];
588
+ };
589
+ declare function ShareButtons({ url, title, networks }: ShareButtonsProps): react.JSX.Element;
590
+
591
+ /**
592
+ * Copyright (c) 2026 Ada Technology. MIT License.
593
+ *
594
+ * Renderiza o AST do `content-contracts` como elementos React — sem `dangerouslySetInnerHTML`.
595
+ * O texto entra como filho de elemento, que o React escapa; as URLs já vêm saneadas do parser.
596
+ */
597
+ type MarkdownContentProps = {
598
+ readonly markdown: string;
599
+ /** Com 1, `#` vira `<h2>` — a página do post já tem o `<h1>`. */
600
+ readonly headingLevelOffset?: number;
601
+ readonly className?: string;
602
+ };
603
+ declare function MarkdownContent({ markdown, headingLevelOffset, className }: MarkdownContentProps): react.JSX.Element;
604
+
605
+ /**
606
+ * Copyright (c) 2026 Ada Technology. MIT License.
607
+ */
608
+ type PaginationProps = {
609
+ readonly page: number;
610
+ readonly totalPages: number;
611
+ /** Com `getPageHref`, vira links (site público, SEO); sem, botões com `onPageChange` (painel). */
612
+ readonly getPageHref?: (page: number) => string;
613
+ readonly onPageChange?: (page: number) => void;
614
+ };
615
+ declare function Pagination({ page, totalPages, getPageHref, onPageChange }: PaginationProps): react.JSX.Element | null;
616
+
617
+ /**
618
+ * Copyright (c) 2026 Ada Technology. MIT License.
619
+ */
620
+ type AsyncResource<TData> = {
621
+ readonly data: TData | undefined;
622
+ readonly isLoading: boolean;
623
+ readonly error: unknown;
624
+ readonly reload: () => void;
625
+ };
626
+ /**
627
+ * Carrega um recurso e descarta resposta velha: trocar de página rápido não deixa a resposta da
628
+ * página anterior chegar por último e sobrescrever a atual. O pacote não traz cliente de cache
629
+ * próprio — quem quiser TanStack Query implementa a API injetada sobre ele.
630
+ */
631
+ declare function useAsyncResource<TData>(load: () => Promise<TData>, key: string): AsyncResource<TData>;
632
+
633
+ type PostListFilters = {
634
+ readonly status?: PostStatus;
635
+ readonly tag?: string;
636
+ readonly search?: string;
637
+ };
638
+ declare function usePostList(params: {
639
+ readonly pageSize: number;
640
+ readonly reloadKey?: number;
641
+ }): {
642
+ posts: AsyncResource<_adatechnology_content_contracts.Paginated<_adatechnology_content_contracts.PostSummary>>;
643
+ tags: readonly TagCount[] | undefined;
644
+ filters: PostListFilters;
645
+ updateFilters: (next: PostListFilters) => void;
646
+ page: number;
647
+ setPage: react.Dispatch<react.SetStateAction<number>>;
648
+ hasFilters: boolean;
649
+ };
650
+
651
+ /**
652
+ * Copyright (c) 2026 Ada Technology. MIT License.
653
+ */
654
+ /**
655
+ * Protege o rascunho: fechar a aba com alteração pede confirmação do navegador, e `confirmLeave`
656
+ * pergunta antes de uma navegação interna (botão Voltar do editor, troca de post).
657
+ */
658
+ declare function useUnsavedChangesGuard(isDirty: boolean, message: string): {
659
+ readonly confirmLeave: () => boolean;
660
+ };
661
+
662
+ /**
663
+ * Copyright (c) 2026 Ada Technology. MIT License.
664
+ */
665
+
666
+ type PostMeta = {
667
+ readonly title: string;
668
+ readonly description: string;
669
+ readonly canonicalUrl: string;
670
+ readonly openGraph: {
671
+ readonly type: 'article';
672
+ readonly title: string;
673
+ readonly description: string;
674
+ readonly url: string;
675
+ readonly image?: string;
676
+ readonly imageAlt?: string;
677
+ readonly publishedTime: string;
678
+ readonly modifiedTime: string;
679
+ readonly tags: readonly string[];
680
+ };
681
+ };
682
+ /**
683
+ * Metadados para o `<head>` do host (Next `generateMetadata`, react-helmet, SSR manual). O pacote
684
+ * não toca no `<head>`: quem é dono do documento é o host.
685
+ */
686
+ declare function buildPostMeta(post: PublicPost, params: {
687
+ readonly url: string;
688
+ readonly siteName?: string;
689
+ }): PostMeta;
690
+
691
+ /**
692
+ * Copyright (c) 2026 Ada Technology. MIT License.
693
+ */
694
+ /** Data por extenso no idioma da tela; data inválida volta vazia em vez de "Invalid Date". */
695
+ declare function formatPostDate(iso: string | null | undefined, locale: string, withTime?: boolean): string;
696
+ /** ISO → valor de `<input type="datetime-local">`, no fuso de quem está editando. */
697
+ declare function toDateTimeLocalValue(iso: string | null | undefined): string;
698
+ /** Valor do `datetime-local` (hora local, sem fuso) → ISO com fuso, pronto para a API. */
699
+ declare function fromDateTimeLocalValue(value: string): string | undefined;
700
+
701
+ /**
702
+ * Copyright (c) 2026 Ada Technology. MIT License.
703
+ *
704
+ * Transformações puras do editor de corpo: texto + seleção entram, texto + seleção saem. O formato
705
+ * guardado continua Markdown; a barra só escreve a sintaxe por quem edita.
706
+ */
707
+ type TextSelection = {
708
+ readonly value: string;
709
+ readonly start: number;
710
+ readonly end: number;
711
+ };
712
+ type LinePrefixKind = 'heading2' | 'heading3' | 'bulletList' | 'numberedList' | 'quote';
713
+ declare function insertText(source: TextSelection, text: string): TextSelection;
714
+ /** Envolve a seleção (`**x**`); com a seleção já envolvida, desfaz. Sem seleção, usa o texto de exemplo. */
715
+ declare function toggleWrap(source: TextSelection, marker: string, placeholder: string): TextSelection;
716
+ /** Aplica o prefixo de bloco em cada linha da seleção; se todas já o têm, remove (liga e desliga). */
717
+ declare function toggleLinePrefix(source: TextSelection, kind: LinePrefixKind, placeholder: string): TextSelection;
718
+ declare function insertLink(source: TextSelection, params: {
719
+ readonly url: string;
720
+ readonly text?: string;
721
+ }): TextSelection;
722
+ declare function insertImage(source: TextSelection, params: {
723
+ readonly url: string;
724
+ readonly alt: string;
725
+ }): TextSelection;
726
+
727
+ /**
728
+ * Copyright (c) 2026 Ada Technology. MIT License.
729
+ *
730
+ * Conjunto enxuto de emojis (sem dependência): o suficiente para um post de novidades. A busca casa
731
+ * o nome em pt-BR ou en.
732
+ */
733
+ type EmojiEntry = {
734
+ readonly char: string;
735
+ readonly keywords: string;
736
+ };
737
+ type EmojiCategory = 'smileys' | 'gestures' | 'food' | 'nature' | 'travel' | 'objects' | 'symbols';
738
+ declare const EMOJI_CATEGORIES: readonly EmojiCategory[];
739
+ declare const EMOJI_BY_CATEGORY: Readonly<Record<EmojiCategory, readonly EmojiEntry[]>>;
740
+ declare function searchEmoji(query: string): readonly EmojiEntry[];
741
+
742
+ /**
743
+ * Copyright (c) 2026 Ada Technology. MIT License.
744
+ */
745
+ type PageItem = {
746
+ readonly kind: 'page';
747
+ readonly page: number;
748
+ } | {
749
+ readonly kind: 'gap';
750
+ readonly key: string;
751
+ };
752
+ /**
753
+ * Páginas visíveis: primeira, última e vizinhas da atual, com reticências nos buracos. Em 375px
754
+ * cabe uma janela de 5 números; listar 40 páginas quebraria a linha.
755
+ */
756
+ declare function buildPageItems(params: {
757
+ readonly current: number;
758
+ readonly total: number;
759
+ readonly siblings?: number;
760
+ }): PageItem[];
761
+
762
+ export { type AsyncResource, COVER_MAX_BYTES, COVER_MIME_TYPES, type ContentAdminApi, type ContentLocale, type ContentMessages, ContentProvider, type ContentProviderProps, type ContentPublicApi, type ContentText, ContentWorkspace, type ContentWorkspaceProps, DEFAULT_CONTENT_LOCALE, DRAFT_ERROR, type DateTimeInputProps, type DraftErrorField, EMOJI_BY_CATEGORY, EMOJI_CATEGORIES, EMPTY_POST_DRAFT, type EditorFeedback, EmojiPicker, type EmojiPickerProps, FilePicker, type FilePickerProps, type LinePrefixKind, type ListPostsParams, type ListPublishedPostsParams, MarkdownContent, type MarkdownContentProps, MarkdownEditor, type MarkdownEditorProps, type PageItem, Pagination, type PaginationProps, PostCard, type PostCardProps, type PostDraft, PostEditor, type PostEditorProps, type PostEditorState, PostList, type PostListFilters, PostListPage, type PostListPageProps, type PostListProps, type PostMeta, PostPage, type PostPageProps, type RenderDateTimeInput, type RenderLink, type RenderLinkProps, SHARE_NETWORK, SHARE_NETWORKS, ShareButtons, type ShareButtonsProps, type ShareLink, type ShareNetwork, StatusChip, type StatusChipProps, TagsInput, type TagsInputProps, type TextSelection, type UploadImageResult, buildPageItems, buildPostMeta, buildShareLinks, deriveSlug, draftFromPost, draftToInput, formatPostDate, fromDateTimeLocalValue, insertImage, insertLink, insertText, interpolate, isDraftDirty, resolveContentMessages, searchEmoji, splitTagInput, toDateTimeLocalValue, toggleLinePrefix, toggleWrap, useAsyncResource, useContentAdminApi, useContentPublicApi, useContentText, usePostEditor, usePostList, useRenderLink, useUnsavedChangesGuard, validateDraft };