@adatechnology/content-ui 0.1.0 → 0.3.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/README.md CHANGED
@@ -48,10 +48,51 @@ const adminApi: ContentAdminApi = {
48
48
  | `StatusChip` | `status` |
49
49
  | `TagsInput` | `value`, `onChange`, `suggestions?`, `label` |
50
50
 
51
+ ### Abas, modelos, republicar e publicação automática
52
+
53
+ Tudo opt-in pela API injetada (sem o método, a peça não aparece): `countPosts` liga as abas
54
+ **Publicados / Agendados / Rascunhos / Modelos** com contagem; `saveAsTemplate` e `createFromTemplate`
55
+ ligam "Salvar como modelo" e "Novo a partir do modelo"; `republishPost` liga "Republicar" (nova data, mesmo
56
+ link); `listRecurrences`/`createRecurrence`/`updateRecurrence`/`removeRecurrence` ligam o painel de
57
+ publicação automática na aba Modelos. Estado é sempre ícone + palavra + cor, e a dica usa o `Tooltip` do
58
+ pacote (hover e foco, nunca `title`). Para o host manter os próprios controles, o `ContentWorkspace` aceita
59
+ `renderDateTimeInput` e `renderSelect`; sem eles os diálogos usam `datetime-local` e `<select>` nativos.
60
+
61
+ A lista segue a regra de listagens: **busca primeiro e à esquerda**, depois filtros (abas por situação e tags
62
+ multisseleção) e as ações à direita; cabeçalhos ordenáveis (`aria-sort`), caixas de marcar próprias com ações em
63
+ lote (publicar, despublicar, excluir), paginação do servidor com "x–y de total" e itens por página. Com
64
+ `syncUrl`, busca, aba, tags, página, tamanho e ordem vão para a query string (`?tab=&q=&tags=&page=&size=&sort=&order=`).
65
+
51
66
  O editor protege alterações não salvas (aviso do navegador ao fechar a aba e confirmação no botão
52
67
  Voltar), valida com o mesmo schema do servidor, gera o slug do título enquanto o autor não o edita
53
68
  e esconde o upload quando a API não tem `uploadCoverImage`.
54
69
 
70
+ ### Editor do corpo: barra, emoji, imagens e seletores
71
+
72
+ O corpo continua sendo **Markdown** (o formato guardado não muda); a barra escreve a sintaxe sobre a
73
+ seleção: negrito, itálico, título (H2/H3), lista, lista numerada, citação, link, imagem e emoji.
74
+ Atalhos: `Ctrl/Cmd+B`, `Ctrl/Cmd+I`, `Ctrl/Cmd+K`. A prévia fica ao lado no desktop e em aba no celular.
75
+
76
+ - **Imagem no corpo**: o botão abre um painel com URL, descrição (alt) e, se o host definiu
77
+ `uploadCoverImage`, "Enviar do aparelho" (no celular o sistema oferece câmera ou galeria). O arquivo
78
+ sobe pela mesma API da capa (mesmos limites: JPG/PNG/WebP até 1 MB) e entra como `![alt](url)`.
79
+ - **Emoji**: painel com busca (nome em pt-BR ou en) e categorias, sem dependência.
80
+ - **Esconder a barra**: `<ContentWorkspace showFormattingToolbar={false} />` (ou no `PostEditor`).
81
+ - **Seletor de data e hora próprio** para "Agendar para": `renderDateTimeInput`.
82
+ O valor é `YYYY-MM-DDTHH:mm` (hora local, 24h).
83
+
84
+ ```tsx
85
+ <ContentWorkspace
86
+ renderDateTimeInput={({ id, label, value, onChange }) => (
87
+ <MyDateTimePicker id={id} label={label} value={value} onChange={onChange} />
88
+ )}
89
+ />
90
+ ```
91
+
92
+ - **Seletor de arquivo** estilizado (botão + nome do arquivo): textos em `coverUpload`,
93
+ `imageUploadFromDevice` e `fileNoneChosen` (`messages`), não os do navegador.
94
+ - Headless: `toggleWrap`, `toggleLinePrefix`, `insertLink`, `insertImage`, `insertText` e `MarkdownEditor`.
95
+
55
96
  ## Site público
56
97
 
57
98
  ```tsx
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
- import { ReactNode } from 'react';
2
+ import { ReactNode, ReactElement } from 'react';
3
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';
4
+ import { PostStatus, PostSortField, Paginated, PostSummary, Post, CreatePostInput, UpdatePostInput, PublishPostInput, PostCounts, SaveAsTemplateInput, CreateFromTemplateInput, RepublishPostInput, RecurrenceRule, CreateRecurrenceInput, UpdateRecurrenceInput, TagCount, PublicPostSummary, PublicPost } from '@adatechnology/content-contracts';
5
5
 
6
6
  var statusDraft = "Rascunho";
7
7
  var statusScheduled = "Agendado";
@@ -65,7 +65,7 @@ var schedule = "Agendar";
65
65
  var unpublish = "Despublicar";
66
66
  var archive = "Arquivar";
67
67
  var archiveConfirm = "Arquivar este post? Ele sai do site.";
68
- var close = "Voltar";
68
+ var close = "Fechar";
69
69
  var unsavedConfirm = "Há alterações não salvas. Sair mesmo assim?";
70
70
  var unsavedBadge = "Alterações não salvas";
71
71
  var saveError = "Não foi possível salvar.";
@@ -92,6 +92,88 @@ var shareOn = "Compartilhar no {network}";
92
92
  var notFound = "Post não encontrado.";
93
93
  var postsEmpty = "Nenhum post publicado ainda.";
94
94
  var clearFilters = "Limpar filtros";
95
+ var statusTemplate = "Modelo";
96
+ var tabsLabel = "Situação dos posts";
97
+ var tabPublished = "Publicados";
98
+ var tabScheduled = "Agendados";
99
+ var tabDraft = "Rascunhos";
100
+ var tabTemplates = "Modelos";
101
+ var columnActions = "Ações";
102
+ var dialogCancel = "Cancelar";
103
+ var actionError = "Não foi possível concluir. Tente de novo.";
104
+ var emptyTemplates = "Nenhum modelo ainda. Em qualquer post, use “Salvar como modelo”.";
105
+ var saveAsTemplate = "Salvar como modelo";
106
+ var saveAsTemplateTip = "Cria uma cópia reutilizável. O post original não muda.";
107
+ var templateNameLabel = "Nome do modelo";
108
+ var newFromTemplate = "Novo a partir do modelo";
109
+ var newFromTemplateTip = "Cria um rascunho com o conteúdo do modelo.";
110
+ var newPostTitleLabel = "Título do novo post";
111
+ var createDraft = "Criar rascunho";
112
+ var republish = "Republicar";
113
+ var republishTip = "Muda a data e mantém o mesmo link: o jeito certo para buscadores.";
114
+ var republishDateLabel = "Nova data de publicação";
115
+ var republishHint = "O endereço do post não muda. Use agora ou uma data passada: data futura tiraria o post do ar.";
116
+ var recurrenceTitle = "Publicação automática";
117
+ var recurrenceNew = "Nova recorrência";
118
+ var recurrenceCreate = "Criar recorrência";
119
+ var recurrenceTemplate = "Modelo";
120
+ var recurrenceFrequency = "Repete";
121
+ var recurrenceStart = "Primeira publicação";
122
+ var frequencyWeekly = "Toda semana";
123
+ var frequencyMonthly = "Todo mês";
124
+ var recurrenceHint = "A cada data, um post novo é publicado sozinho a partir do modelo.";
125
+ var recurrenceNext = "próxima {date}";
126
+ var recurrenceActive = "Ativa";
127
+ var recurrencePaused = "Pausada";
128
+ var recurrencePause = "Pausar";
129
+ var recurrenceResume = "Retomar";
130
+ var recurrenceRemove = "Apagar regra";
131
+ var recurrenceRemoveTip = "Apaga só a regra. Os posts já publicados continuam no ar.";
132
+ var recurrenceEmpty = "Nenhuma recorrência. Crie uma para publicar sozinho toda semana ou mês.";
133
+ var recurrenceNeedsTemplate = "Crie um modelo primeiro para agendar publicações automáticas.";
134
+ var selectAll = "Selecionar todos";
135
+ var selectRow = "Selecionar {title}";
136
+ var selectedCount = "Selecionados: {count}";
137
+ var clearSelection = "Limpar seleção";
138
+ var batchLabel = "Ações em lote";
139
+ var batchPublish = "Publicar";
140
+ var batchUnpublish = "Despublicar";
141
+ var batchArchive = "Excluir";
142
+ var batchArchiveConfirm = "Excluir {count} posts? Eles saem do site; o conteúdo fica arquivado.";
143
+ var batchPartial = "Só {done} de {total} concluídos. Tente de novo nos demais.";
144
+ var itemsPerPage = "Por página";
145
+ var rangeLabel = "{from}–{to} de {total}";
146
+ var bodyHintToolbar = "Selecione o texto e use os botões acima. Atalhos: Ctrl+B negrito, Ctrl+I itálico, Ctrl+K link.";
147
+ var toolbarLabel = "Formatação do texto";
148
+ var formatBold = "Negrito";
149
+ var formatItalic = "Itálico";
150
+ var formatHeading2 = "Título";
151
+ var formatHeading3 = "Subtítulo";
152
+ var formatBulletList = "Lista com marcadores";
153
+ var formatNumberedList = "Lista numerada";
154
+ var formatQuote = "Citação";
155
+ var formatLink = "Link";
156
+ var formatImage = "Imagem";
157
+ var formatEmoji = "Emoji";
158
+ var formatSampleText = "texto";
159
+ var linkDialogTitle = "Inserir link";
160
+ var linkUrl = "Endereço do link (URL)";
161
+ var linkText = "Texto do link";
162
+ var imageDialogTitle = "Inserir imagem";
163
+ var imageUploadFromDevice = "Enviar do aparelho";
164
+ var dialogInsert = "Inserir";
165
+ var fileNoneChosen = "Nenhum arquivo escolhido";
166
+ var emojiTitle = "Escolher emoji";
167
+ var emojiSearch = "Buscar emoji";
168
+ var emojiCategories = "Categorias de emoji";
169
+ var emojiEmpty = "Nenhum emoji encontrado.";
170
+ var emojiSmileys = "Rostos";
171
+ var emojiGestures = "Gestos";
172
+ var emojiFood = "Comida";
173
+ var emojiNature = "Natureza";
174
+ var emojiTravel = "Lugares";
175
+ var emojiObjects = "Objetos";
176
+ var emojiSymbols = "Símbolos";
95
177
  var ptBR = {
96
178
  statusDraft: statusDraft,
97
179
  statusScheduled: statusScheduled,
@@ -181,7 +263,89 @@ var ptBR = {
181
263
  shareOn: shareOn,
182
264
  notFound: notFound,
183
265
  postsEmpty: postsEmpty,
184
- clearFilters: clearFilters
266
+ clearFilters: clearFilters,
267
+ statusTemplate: statusTemplate,
268
+ tabsLabel: tabsLabel,
269
+ tabPublished: tabPublished,
270
+ tabScheduled: tabScheduled,
271
+ tabDraft: tabDraft,
272
+ tabTemplates: tabTemplates,
273
+ columnActions: columnActions,
274
+ dialogCancel: dialogCancel,
275
+ actionError: actionError,
276
+ emptyTemplates: emptyTemplates,
277
+ saveAsTemplate: saveAsTemplate,
278
+ saveAsTemplateTip: saveAsTemplateTip,
279
+ templateNameLabel: templateNameLabel,
280
+ newFromTemplate: newFromTemplate,
281
+ newFromTemplateTip: newFromTemplateTip,
282
+ newPostTitleLabel: newPostTitleLabel,
283
+ createDraft: createDraft,
284
+ republish: republish,
285
+ republishTip: republishTip,
286
+ republishDateLabel: republishDateLabel,
287
+ republishHint: republishHint,
288
+ recurrenceTitle: recurrenceTitle,
289
+ recurrenceNew: recurrenceNew,
290
+ recurrenceCreate: recurrenceCreate,
291
+ recurrenceTemplate: recurrenceTemplate,
292
+ recurrenceFrequency: recurrenceFrequency,
293
+ recurrenceStart: recurrenceStart,
294
+ frequencyWeekly: frequencyWeekly,
295
+ frequencyMonthly: frequencyMonthly,
296
+ recurrenceHint: recurrenceHint,
297
+ recurrenceNext: recurrenceNext,
298
+ recurrenceActive: recurrenceActive,
299
+ recurrencePaused: recurrencePaused,
300
+ recurrencePause: recurrencePause,
301
+ recurrenceResume: recurrenceResume,
302
+ recurrenceRemove: recurrenceRemove,
303
+ recurrenceRemoveTip: recurrenceRemoveTip,
304
+ recurrenceEmpty: recurrenceEmpty,
305
+ recurrenceNeedsTemplate: recurrenceNeedsTemplate,
306
+ selectAll: selectAll,
307
+ selectRow: selectRow,
308
+ selectedCount: selectedCount,
309
+ clearSelection: clearSelection,
310
+ batchLabel: batchLabel,
311
+ batchPublish: batchPublish,
312
+ batchUnpublish: batchUnpublish,
313
+ batchArchive: batchArchive,
314
+ batchArchiveConfirm: batchArchiveConfirm,
315
+ batchPartial: batchPartial,
316
+ itemsPerPage: itemsPerPage,
317
+ rangeLabel: rangeLabel,
318
+ bodyHintToolbar: bodyHintToolbar,
319
+ toolbarLabel: toolbarLabel,
320
+ formatBold: formatBold,
321
+ formatItalic: formatItalic,
322
+ formatHeading2: formatHeading2,
323
+ formatHeading3: formatHeading3,
324
+ formatBulletList: formatBulletList,
325
+ formatNumberedList: formatNumberedList,
326
+ formatQuote: formatQuote,
327
+ formatLink: formatLink,
328
+ formatImage: formatImage,
329
+ formatEmoji: formatEmoji,
330
+ formatSampleText: formatSampleText,
331
+ linkDialogTitle: linkDialogTitle,
332
+ linkUrl: linkUrl,
333
+ linkText: linkText,
334
+ imageDialogTitle: imageDialogTitle,
335
+ imageUploadFromDevice: imageUploadFromDevice,
336
+ dialogInsert: dialogInsert,
337
+ fileNoneChosen: fileNoneChosen,
338
+ emojiTitle: emojiTitle,
339
+ emojiSearch: emojiSearch,
340
+ emojiCategories: emojiCategories,
341
+ emojiEmpty: emojiEmpty,
342
+ emojiSmileys: emojiSmileys,
343
+ emojiGestures: emojiGestures,
344
+ emojiFood: emojiFood,
345
+ emojiNature: emojiNature,
346
+ emojiTravel: emojiTravel,
347
+ emojiObjects: emojiObjects,
348
+ emojiSymbols: emojiSymbols
185
349
  };
186
350
 
187
351
  /**
@@ -209,8 +373,13 @@ type ListPostsParams = {
209
373
  readonly page?: number;
210
374
  readonly pageSize?: number;
211
375
  readonly status?: PostStatus;
376
+ /** Uma tag, ou várias separadas por vírgula (basta ter uma). */
212
377
  readonly tag?: string;
213
378
  readonly search?: string;
379
+ readonly sort?: PostSortField;
380
+ readonly order?: 'asc' | 'desc';
381
+ /** `true`: só modelos. */
382
+ readonly isTemplate?: boolean;
214
383
  };
215
384
  type ContentAdminApi = {
216
385
  listPosts(params: ListPostsParams): Promise<Paginated<PostSummary>>;
@@ -220,6 +389,18 @@ type ContentAdminApi = {
220
389
  publishPost(id: string, input?: PublishPostInput): Promise<Post>;
221
390
  unpublishPost(id: string): Promise<Post>;
222
391
  archivePost(id: string): Promise<void>;
392
+ /** Ausente: a lista não tem abas por situação nem contagens (filtro de status em lista suspensa). */
393
+ countPosts?(): Promise<PostCounts>;
394
+ /** Ausente: sem "Salvar como modelo" e sem a aba Modelos. */
395
+ saveAsTemplate?(id: string, input?: SaveAsTemplateInput): Promise<Post>;
396
+ createFromTemplate?(id: string, input?: CreateFromTemplateInput): Promise<Post>;
397
+ /** Ausente: sem "Republicar". */
398
+ republishPost?(id: string, input?: RepublishPostInput): Promise<Post>;
399
+ /** Ausentes: sem o painel de publicação automática (recorrência). */
400
+ listRecurrences?(): Promise<readonly RecurrenceRule[]>;
401
+ createRecurrence?(input: CreateRecurrenceInput): Promise<RecurrenceRule>;
402
+ updateRecurrence?(id: string, input: UpdateRecurrenceInput): Promise<RecurrenceRule>;
403
+ removeRecurrence?(id: string): Promise<void>;
223
404
  /** Ausente: o filtro de tag vira campo livre e o editor não sugere tags. */
224
405
  listTags?(): Promise<readonly TagCount[]>;
225
406
  /** Ausente: a capa é só por URL — sem alvo de upload que sempre falharia. */
@@ -250,6 +431,27 @@ type RenderLinkProps = {
250
431
  };
251
432
  /** Troca o `<a>` pelo `Link` do roteador do host (Next, React Router…) sem o pacote conhecê-lo. */
252
433
  type RenderLink = (props: RenderLinkProps) => ReactNode;
434
+ type DateTimeInputProps = {
435
+ readonly id: string;
436
+ readonly label: string;
437
+ /** Formato `YYYY-MM-DDTHH:mm` (hora local, 24h), ou vazio. */
438
+ readonly value: string;
439
+ readonly onChange: (value: string) => void;
440
+ };
441
+ /** Troca o `<input type="datetime-local">` nativo pelo seletor de data e hora do host. */
442
+ type RenderDateTimeInput = (props: DateTimeInputProps) => ReactNode;
443
+ type SelectInputProps = {
444
+ readonly id: string;
445
+ readonly label: string;
446
+ readonly value: string;
447
+ readonly options: readonly {
448
+ readonly id: string;
449
+ readonly label: string;
450
+ }[];
451
+ readonly onChange: (value: string) => void;
452
+ };
453
+ /** Troca o `<select>` nativo pelo menu de seleção do host. */
454
+ type RenderSelect = (props: SelectInputProps) => ReactNode;
253
455
 
254
456
  type ContentProviderProps = {
255
457
  /** Painel: lista e editor. Site público não precisa passar. */
@@ -321,8 +523,16 @@ type ContentWorkspaceProps = {
321
523
  /** Valores iniciais do post novo (ex.: autor logado). */
322
524
  readonly newPostDefaults?: Partial<PostDraft>;
323
525
  readonly onPostSaved?: (post: Post) => void;
526
+ /** Seletor de data e hora do host (padrão: `datetime-local` nativo). */
527
+ readonly renderDateTimeInput?: RenderDateTimeInput;
528
+ /** Menu de seleção do host (padrão: `<select>` nativo). */
529
+ readonly renderSelect?: RenderSelect;
530
+ /** Busca, aba, tags, página, tamanho e ordem da lista na URL (padrão: não). */
531
+ readonly syncUrl?: boolean;
532
+ /** Barra de formatação do corpo do post (padrão: ligada). */
533
+ readonly showFormattingToolbar?: boolean;
324
534
  };
325
- declare function ContentWorkspace({ pageSize, newPostDefaults, onPostSaved }: ContentWorkspaceProps): react.JSX.Element;
535
+ declare function ContentWorkspace({ pageSize, newPostDefaults, onPostSaved, renderDateTimeInput, renderSelect, syncUrl, showFormattingToolbar, }: ContentWorkspaceProps): react.JSX.Element;
326
536
 
327
537
  type PostListProps = {
328
538
  readonly onSelect: (post: PostSummary) => void;
@@ -331,8 +541,12 @@ type PostListProps = {
331
541
  readonly pageSize?: number;
332
542
  /** Mude o valor para forçar recarga (ex.: depois de salvar no editor). */
333
543
  readonly reloadKey?: number;
544
+ /** Guarda busca, aba, tags, página, tamanho e ordem na query string. */
545
+ readonly syncUrl?: boolean;
546
+ readonly renderDateTimeInput?: RenderDateTimeInput;
547
+ readonly renderSelect?: RenderSelect;
334
548
  };
335
- declare function PostList({ onSelect, onCreate, pageSize, reloadKey }: PostListProps): react.JSX.Element;
549
+ declare function PostList({ onSelect, onCreate, pageSize, reloadKey, syncUrl, renderDateTimeInput, renderSelect, }: PostListProps): react.JSX.Element;
336
550
 
337
551
  type PostEditorProps = {
338
552
  /** Ausente: post novo. */
@@ -343,13 +557,98 @@ type PostEditorProps = {
343
557
  readonly onArchived?: (post: Post) => void;
344
558
  /** Ausente: sem botão Voltar. Só é chamado depois de confirmar alterações não salvas. */
345
559
  readonly onClose?: () => void;
560
+ /** Barra de formatação do corpo (padrão: ligada). O formato guardado é Markdown nos dois casos. */
561
+ readonly showFormattingToolbar?: boolean;
562
+ /** Seletor de data e hora do host para "Agendar para". Padrão: `<input type="datetime-local">`. */
563
+ readonly renderDateTimeInput?: RenderDateTimeInput;
346
564
  };
347
- declare function PostEditor({ postId, defaults, onSaved, onArchived, onClose }: PostEditorProps): react.JSX.Element;
565
+ declare function PostEditor({ postId, defaults, onSaved, onArchived, onClose, showFormattingToolbar, renderDateTimeInput, }: PostEditorProps): react.JSX.Element;
566
+
567
+ type TooltipProps = {
568
+ readonly text: string;
569
+ readonly children: ReactElement;
570
+ };
571
+ declare function Tooltip({ text, children }: TooltipProps): react.JSX.Element;
572
+
573
+ declare const COVER_MAX_BYTES: number;
574
+ declare const COVER_MIME_TYPES: readonly string[];
575
+ type EditorFeedback = 'saved' | 'saveError' | 'coverTooLarge' | 'coverInvalidType' | 'coverUploadError' | 'errorSchedule';
576
+ type UploadImageResult = {
577
+ readonly url: string;
578
+ } | {
579
+ readonly error: 'coverTooLarge' | 'coverInvalidType' | 'coverUploadError';
580
+ };
581
+ declare function usePostEditor(params: {
582
+ readonly postId?: string;
583
+ readonly defaults?: Partial<PostDraft>;
584
+ readonly onSaved?: (post: Post) => void;
585
+ readonly onArchived?: (post: Post) => void;
586
+ }): {
587
+ post: Post | undefined;
588
+ draft: PostDraft;
589
+ update: <TKey extends keyof PostDraft>(field: TKey, value: PostDraft[TKey]) => void;
590
+ errors: Partial<Record<DraftErrorField, true>>;
591
+ isLoading: boolean;
592
+ isDirty: boolean;
593
+ isBusy: boolean;
594
+ isUploading: boolean;
595
+ feedback: EditorFeedback | undefined;
596
+ scheduleAt: string;
597
+ setScheduleAt: react.Dispatch<react.SetStateAction<string>>;
598
+ canUploadCover: boolean;
599
+ tagSuggestions: string[];
600
+ save: () => Promise<Post | undefined>;
601
+ publishNow: () => Promise<Post | undefined>;
602
+ schedule: () => Promise<Post | undefined>;
603
+ unpublish: () => Promise<Post | undefined>;
604
+ archive: () => Promise<void>;
605
+ uploadCover: (file: File) => Promise<void>;
606
+ uploadImage: (file: File) => Promise<UploadImageResult>;
607
+ };
608
+ type PostEditorState = ReturnType<typeof usePostEditor>;
609
+
610
+ type MarkdownEditorProps = {
611
+ readonly value: string;
612
+ readonly onChange: (value: string) => void;
613
+ readonly labelledBy: string;
614
+ readonly describedBy?: string;
615
+ readonly showToolbar?: boolean;
616
+ /** Ausente: o botão de imagem só aceita URL, sem envio de arquivo. */
617
+ readonly onUploadImage?: (file: File) => Promise<UploadImageResult>;
618
+ readonly isUploading?: boolean;
619
+ };
620
+ declare function MarkdownEditor({ value, onChange, labelledBy, describedBy, showToolbar, onUploadImage, isUploading, }: MarkdownEditorProps): react.JSX.Element;
621
+
622
+ /**
623
+ * Copyright (c) 2026 Ada Technology. MIT License.
624
+ */
625
+ type EmojiPickerProps = {
626
+ readonly onPick: (emoji: string) => void;
627
+ readonly onClose: () => void;
628
+ };
629
+ declare function EmojiPicker({ onPick, onClose }: EmojiPickerProps): react.JSX.Element;
630
+
631
+ /**
632
+ * Copyright (c) 2026 Ada Technology. MIT License.
633
+ *
634
+ * Seletor de arquivo estilizado: botão + nome do arquivo, com os textos vindos das mensagens (o
635
+ * `<input type="file">` nativo mostra o idioma do navegador e não aceita estilo).
636
+ */
637
+ type FilePickerProps = {
638
+ readonly buttonLabel: string;
639
+ readonly emptyLabel: string;
640
+ readonly accept: string;
641
+ readonly isBusy?: boolean;
642
+ readonly onPick: (file: File) => void;
643
+ };
644
+ declare function FilePicker({ buttonLabel, emptyLabel, accept, isBusy, onPick }: FilePickerProps): react.JSX.Element;
348
645
 
349
646
  type StatusChipProps = {
350
647
  readonly status: PostStatus;
648
+ /** Modelo mostra "Modelo" no lugar do status (ele nunca vai ao ar). */
649
+ readonly isTemplate?: boolean;
351
650
  };
352
- declare function StatusChip({ status }: StatusChipProps): react.JSX.Element;
651
+ declare function StatusChip({ status, isTemplate }: StatusChipProps): react.JSX.Element;
353
652
 
354
653
  /**
355
654
  * Copyright (c) 2026 Ada Technology. MIT License.
@@ -462,37 +761,6 @@ type PaginationProps = {
462
761
  };
463
762
  declare function Pagination({ page, totalPages, getPageHref, onPageChange }: PaginationProps): react.JSX.Element | null;
464
763
 
465
- declare const COVER_MAX_BYTES: number;
466
- declare const COVER_MIME_TYPES: readonly string[];
467
- type EditorFeedback = 'saved' | 'saveError' | 'coverTooLarge' | 'coverInvalidType' | 'coverUploadError' | 'errorSchedule';
468
- declare function usePostEditor(params: {
469
- readonly postId?: string;
470
- readonly defaults?: Partial<PostDraft>;
471
- readonly onSaved?: (post: Post) => void;
472
- readonly onArchived?: (post: Post) => void;
473
- }): {
474
- post: Post | undefined;
475
- draft: PostDraft;
476
- update: <TKey extends keyof PostDraft>(field: TKey, value: PostDraft[TKey]) => void;
477
- errors: Partial<Record<DraftErrorField, true>>;
478
- isLoading: boolean;
479
- isDirty: boolean;
480
- isBusy: boolean;
481
- isUploading: boolean;
482
- feedback: EditorFeedback | undefined;
483
- scheduleAt: string;
484
- setScheduleAt: react.Dispatch<react.SetStateAction<string>>;
485
- canUploadCover: boolean;
486
- tagSuggestions: string[];
487
- save: () => Promise<Post | undefined>;
488
- publishNow: () => Promise<Post | undefined>;
489
- schedule: () => Promise<Post | undefined>;
490
- unpublish: () => Promise<Post | undefined>;
491
- archive: () => Promise<void>;
492
- uploadCover: (file: File) => Promise<void>;
493
- };
494
- type PostEditorState = ReturnType<typeof usePostEditor>;
495
-
496
764
  /**
497
765
  * Copyright (c) 2026 Ada Technology. MIT License.
498
766
  */
@@ -509,21 +777,63 @@ type AsyncResource<TData> = {
509
777
  */
510
778
  declare function useAsyncResource<TData>(load: () => Promise<TData>, key: string): AsyncResource<TData>;
511
779
 
780
+ /**
781
+ * Copyright (c) 2026 Ada Technology. MIT License.
782
+ *
783
+ * Estado da lista na URL (`?q=&tab=&tags=&page=&size=&sort=&order=`): recarregar a página, voltar do
784
+ * editor e mandar o link a um colega reabrem a lista exatamente como estava.
785
+ */
786
+
787
+ declare const PAGE_SIZE_OPTIONS: readonly [10, 20, 50, 100];
788
+ type ListUrlState = {
789
+ readonly tab?: PostListTab;
790
+ readonly search: string;
791
+ readonly tags: readonly string[];
792
+ readonly page: number;
793
+ readonly pageSize?: number;
794
+ readonly sort: PostSortField;
795
+ readonly order: 'asc' | 'desc';
796
+ };
797
+ /** Lê a URL tolerando lixo: valor inválido cai no padrão, nunca quebra a tela. */
798
+ declare function parseListUrlState(search: string): ListUrlState;
799
+ /** Só grava o que difere do padrão: a URL de uma lista intocada fica limpa. */
800
+ declare function serializeListUrlState(state: ListUrlState): string;
801
+
802
+ /** Aba da lista: só existe quando a API injetada sabe contar (`countPosts`). */
803
+ declare const POST_LIST_TAB: {
804
+ readonly PUBLISHED: "published";
805
+ readonly SCHEDULED: "scheduled";
806
+ readonly DRAFT: "draft";
807
+ readonly TEMPLATES: "templates";
808
+ };
809
+ type PostListTab = (typeof POST_LIST_TAB)[keyof typeof POST_LIST_TAB];
512
810
  type PostListFilters = {
513
- readonly status?: PostStatus;
514
- readonly tag?: string;
515
- readonly search?: string;
811
+ readonly tags: readonly string[];
812
+ readonly search: string;
516
813
  };
517
814
  declare function usePostList(params: {
518
815
  readonly pageSize: number;
519
816
  readonly reloadKey?: number;
817
+ /** Espelha busca, aba, tags, página, tamanho e ordem na query string da URL. */
818
+ readonly syncUrl?: boolean;
520
819
  }): {
521
820
  posts: AsyncResource<_adatechnology_content_contracts.Paginated<_adatechnology_content_contracts.PostSummary>>;
821
+ counts: PostCounts | undefined;
522
822
  tags: readonly TagCount[] | undefined;
523
- filters: PostListFilters;
524
- updateFilters: (next: PostListFilters) => void;
525
- page: number;
526
- setPage: react.Dispatch<react.SetStateAction<number>>;
823
+ state: ListUrlState;
824
+ tab: PostListTab | undefined;
825
+ pageSize: number;
826
+ selectedIds: ReadonlySet<string>;
827
+ setSelectedIds: react.Dispatch<react.SetStateAction<ReadonlySet<string>>>;
828
+ toggleSelected: (id: string) => void;
829
+ toggleSort: (field: PostSortField) => void;
830
+ toggleTag: (tag: string) => void;
831
+ setTab: (next: PostListTab) => void;
832
+ setSearch: (search: string) => void;
833
+ setPageSize: (next: number) => void;
834
+ setPage: (page: number) => void;
835
+ clearFilters: () => void;
836
+ refresh: () => void;
527
837
  hasFilters: boolean;
528
838
  };
529
839
 
@@ -577,6 +887,47 @@ declare function toDateTimeLocalValue(iso: string | null | undefined): string;
577
887
  /** Valor do `datetime-local` (hora local, sem fuso) → ISO com fuso, pronto para a API. */
578
888
  declare function fromDateTimeLocalValue(value: string): string | undefined;
579
889
 
890
+ /**
891
+ * Copyright (c) 2026 Ada Technology. MIT License.
892
+ *
893
+ * Transformações puras do editor de corpo: texto + seleção entram, texto + seleção saem. O formato
894
+ * guardado continua Markdown; a barra só escreve a sintaxe por quem edita.
895
+ */
896
+ type TextSelection = {
897
+ readonly value: string;
898
+ readonly start: number;
899
+ readonly end: number;
900
+ };
901
+ type LinePrefixKind = 'heading2' | 'heading3' | 'bulletList' | 'numberedList' | 'quote';
902
+ declare function insertText(source: TextSelection, text: string): TextSelection;
903
+ /** Envolve a seleção (`**x**`); com a seleção já envolvida, desfaz. Sem seleção, usa o texto de exemplo. */
904
+ declare function toggleWrap(source: TextSelection, marker: string, placeholder: string): TextSelection;
905
+ /** Aplica o prefixo de bloco em cada linha da seleção; se todas já o têm, remove (liga e desliga). */
906
+ declare function toggleLinePrefix(source: TextSelection, kind: LinePrefixKind, placeholder: string): TextSelection;
907
+ declare function insertLink(source: TextSelection, params: {
908
+ readonly url: string;
909
+ readonly text?: string;
910
+ }): TextSelection;
911
+ declare function insertImage(source: TextSelection, params: {
912
+ readonly url: string;
913
+ readonly alt: string;
914
+ }): TextSelection;
915
+
916
+ /**
917
+ * Copyright (c) 2026 Ada Technology. MIT License.
918
+ *
919
+ * Conjunto enxuto de emojis (sem dependência): o suficiente para um post de novidades. A busca casa
920
+ * o nome em pt-BR ou en.
921
+ */
922
+ type EmojiEntry = {
923
+ readonly char: string;
924
+ readonly keywords: string;
925
+ };
926
+ type EmojiCategory = 'smileys' | 'gestures' | 'food' | 'nature' | 'travel' | 'objects' | 'symbols';
927
+ declare const EMOJI_CATEGORIES: readonly EmojiCategory[];
928
+ declare const EMOJI_BY_CATEGORY: Readonly<Record<EmojiCategory, readonly EmojiEntry[]>>;
929
+ declare function searchEmoji(query: string): readonly EmojiEntry[];
930
+
580
931
  /**
581
932
  * Copyright (c) 2026 Ada Technology. MIT License.
582
933
  */
@@ -597,4 +948,4 @@ declare function buildPageItems(params: {
597
948
  readonly siblings?: number;
598
949
  }): PageItem[];
599
950
 
600
- 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 DraftErrorField, EMPTY_POST_DRAFT, type EditorFeedback, type ListPostsParams, type ListPublishedPostsParams, MarkdownContent, type MarkdownContentProps, 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 RenderLink, type RenderLinkProps, SHARE_NETWORK, SHARE_NETWORKS, ShareButtons, type ShareButtonsProps, type ShareLink, type ShareNetwork, StatusChip, type StatusChipProps, TagsInput, type TagsInputProps, buildPageItems, buildPostMeta, buildShareLinks, deriveSlug, draftFromPost, draftToInput, formatPostDate, fromDateTimeLocalValue, interpolate, isDraftDirty, resolveContentMessages, splitTagInput, toDateTimeLocalValue, useAsyncResource, useContentAdminApi, useContentPublicApi, useContentText, usePostEditor, usePostList, useRenderLink, useUnsavedChangesGuard, validateDraft };
951
+ 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, type ListUrlState, MarkdownContent, type MarkdownContentProps, MarkdownEditor, type MarkdownEditorProps, PAGE_SIZE_OPTIONS, POST_LIST_TAB, type PageItem, Pagination, type PaginationProps, PostCard, type PostCardProps, type PostDraft, PostEditor, type PostEditorProps, type PostEditorState, PostList, type PostListFilters, PostListPage, type PostListPageProps, type PostListProps, type PostListTab, type PostMeta, PostPage, type PostPageProps, type RenderDateTimeInput, type RenderLink, type RenderLinkProps, type RenderSelect, SHARE_NETWORK, SHARE_NETWORKS, type SelectInputProps, ShareButtons, type ShareButtonsProps, type ShareLink, type ShareNetwork, StatusChip, type StatusChipProps, TagsInput, type TagsInputProps, type TextSelection, Tooltip, type TooltipProps, type UploadImageResult, buildPageItems, buildPostMeta, buildShareLinks, deriveSlug, draftFromPost, draftToInput, formatPostDate, fromDateTimeLocalValue, insertImage, insertLink, insertText, interpolate, isDraftDirty, parseListUrlState, resolveContentMessages, searchEmoji, serializeListUrlState, splitTagInput, toDateTimeLocalValue, toggleLinePrefix, toggleWrap, useAsyncResource, useContentAdminApi, useContentPublicApi, useContentText, usePostEditor, usePostList, useRenderLink, useUnsavedChangesGuard, validateDraft };