@adatechnology/content-ui 0.2.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/dist/index.js CHANGED
@@ -65,7 +65,7 @@ var en_default = {
65
65
  unpublish: "Unpublish",
66
66
  archive: "Archive",
67
67
  archiveConfirm: "Archive this post? It will leave the site.",
68
- close: "Back",
68
+ close: "Close",
69
69
  unsavedConfirm: "You have unsaved changes. Leave anyway?",
70
70
  unsavedBadge: "Unsaved changes",
71
71
  saveError: "Could not save.",
@@ -92,6 +92,57 @@ var en_default = {
92
92
  notFound: "Post not found.",
93
93
  postsEmpty: "No posts published yet.",
94
94
  clearFilters: "Clear filters",
95
+ statusTemplate: "Template",
96
+ tabsLabel: "Post status",
97
+ tabPublished: "Published",
98
+ tabScheduled: "Scheduled",
99
+ tabDraft: "Drafts",
100
+ tabTemplates: "Templates",
101
+ columnActions: "Actions",
102
+ dialogCancel: "Cancel",
103
+ actionError: "Could not finish. Try again.",
104
+ emptyTemplates: "No templates yet. On any post, use \u201CSave as template\u201D.",
105
+ saveAsTemplate: "Save as template",
106
+ saveAsTemplateTip: "Makes a reusable copy. The original post does not change.",
107
+ templateNameLabel: "Template name",
108
+ newFromTemplate: "New from template",
109
+ newFromTemplateTip: "Creates a draft with the template content.",
110
+ newPostTitleLabel: "New post title",
111
+ createDraft: "Create draft",
112
+ republish: "Republish",
113
+ republishTip: "Changes the date and keeps the same link: the right way for search engines.",
114
+ republishDateLabel: "New publish date",
115
+ republishHint: "The post address does not change. Use now or a past date: a future date would take the post offline.",
116
+ recurrenceTitle: "Automatic publishing",
117
+ recurrenceNew: "New recurrence",
118
+ recurrenceCreate: "Create recurrence",
119
+ recurrenceTemplate: "Template",
120
+ recurrenceFrequency: "Repeats",
121
+ recurrenceStart: "First publication",
122
+ frequencyWeekly: "Every week",
123
+ frequencyMonthly: "Every month",
124
+ recurrenceHint: "On each date a new post is published automatically from the template.",
125
+ recurrenceNext: "next {date}",
126
+ recurrenceActive: "Active",
127
+ recurrencePaused: "Paused",
128
+ recurrencePause: "Pause",
129
+ recurrenceResume: "Resume",
130
+ recurrenceRemove: "Delete rule",
131
+ recurrenceRemoveTip: "Deletes only the rule. Posts already published stay online.",
132
+ recurrenceEmpty: "No recurrences. Create one to publish by itself every week or month.",
133
+ recurrenceNeedsTemplate: "Create a template first to schedule automatic publishing.",
134
+ selectAll: "Select all",
135
+ selectRow: "Select {title}",
136
+ selectedCount: "Selected: {count}",
137
+ clearSelection: "Clear selection",
138
+ batchLabel: "Batch actions",
139
+ batchPublish: "Publish",
140
+ batchUnpublish: "Unpublish",
141
+ batchArchive: "Delete",
142
+ batchArchiveConfirm: "Delete {count} posts? They leave the site; the content stays archived.",
143
+ batchPartial: "Only {done} of {total} done. Try again for the rest.",
144
+ itemsPerPage: "Per page",
145
+ rangeLabel: "{from}\u2013{to} of {total}",
95
146
  bodyHintToolbar: "Select text and use the buttons above. Shortcuts: Ctrl+B bold, Ctrl+I italic, Ctrl+K link.",
96
147
  toolbarLabel: "Text formatting",
97
148
  formatBold: "Bold",
@@ -111,7 +162,6 @@ var en_default = {
111
162
  imageDialogTitle: "Insert image",
112
163
  imageUploadFromDevice: "Upload from device",
113
164
  dialogInsert: "Insert",
114
- dialogCancel: "Cancel",
115
165
  fileNoneChosen: "No file chosen",
116
166
  emojiTitle: "Choose emoji",
117
167
  emojiSearch: "Search emoji",
@@ -190,7 +240,7 @@ var pt_BR_default = {
190
240
  unpublish: "Despublicar",
191
241
  archive: "Arquivar",
192
242
  archiveConfirm: "Arquivar este post? Ele sai do site.",
193
- close: "Voltar",
243
+ close: "Fechar",
194
244
  unsavedConfirm: "H\xE1 altera\xE7\xF5es n\xE3o salvas. Sair mesmo assim?",
195
245
  unsavedBadge: "Altera\xE7\xF5es n\xE3o salvas",
196
246
  saveError: "N\xE3o foi poss\xEDvel salvar.",
@@ -217,6 +267,57 @@ var pt_BR_default = {
217
267
  notFound: "Post n\xE3o encontrado.",
218
268
  postsEmpty: "Nenhum post publicado ainda.",
219
269
  clearFilters: "Limpar filtros",
270
+ statusTemplate: "Modelo",
271
+ tabsLabel: "Situa\xE7\xE3o dos posts",
272
+ tabPublished: "Publicados",
273
+ tabScheduled: "Agendados",
274
+ tabDraft: "Rascunhos",
275
+ tabTemplates: "Modelos",
276
+ columnActions: "A\xE7\xF5es",
277
+ dialogCancel: "Cancelar",
278
+ actionError: "N\xE3o foi poss\xEDvel concluir. Tente de novo.",
279
+ emptyTemplates: "Nenhum modelo ainda. Em qualquer post, use \u201CSalvar como modelo\u201D.",
280
+ saveAsTemplate: "Salvar como modelo",
281
+ saveAsTemplateTip: "Cria uma c\xF3pia reutiliz\xE1vel. O post original n\xE3o muda.",
282
+ templateNameLabel: "Nome do modelo",
283
+ newFromTemplate: "Novo a partir do modelo",
284
+ newFromTemplateTip: "Cria um rascunho com o conte\xFAdo do modelo.",
285
+ newPostTitleLabel: "T\xEDtulo do novo post",
286
+ createDraft: "Criar rascunho",
287
+ republish: "Republicar",
288
+ republishTip: "Muda a data e mant\xE9m o mesmo link: o jeito certo para buscadores.",
289
+ republishDateLabel: "Nova data de publica\xE7\xE3o",
290
+ republishHint: "O endere\xE7o do post n\xE3o muda. Use agora ou uma data passada: data futura tiraria o post do ar.",
291
+ recurrenceTitle: "Publica\xE7\xE3o autom\xE1tica",
292
+ recurrenceNew: "Nova recorr\xEAncia",
293
+ recurrenceCreate: "Criar recorr\xEAncia",
294
+ recurrenceTemplate: "Modelo",
295
+ recurrenceFrequency: "Repete",
296
+ recurrenceStart: "Primeira publica\xE7\xE3o",
297
+ frequencyWeekly: "Toda semana",
298
+ frequencyMonthly: "Todo m\xEAs",
299
+ recurrenceHint: "A cada data, um post novo \xE9 publicado sozinho a partir do modelo.",
300
+ recurrenceNext: "pr\xF3xima {date}",
301
+ recurrenceActive: "Ativa",
302
+ recurrencePaused: "Pausada",
303
+ recurrencePause: "Pausar",
304
+ recurrenceResume: "Retomar",
305
+ recurrenceRemove: "Apagar regra",
306
+ recurrenceRemoveTip: "Apaga s\xF3 a regra. Os posts j\xE1 publicados continuam no ar.",
307
+ recurrenceEmpty: "Nenhuma recorr\xEAncia. Crie uma para publicar sozinho toda semana ou m\xEAs.",
308
+ recurrenceNeedsTemplate: "Crie um modelo primeiro para agendar publica\xE7\xF5es autom\xE1ticas.",
309
+ selectAll: "Selecionar todos",
310
+ selectRow: "Selecionar {title}",
311
+ selectedCount: "Selecionados: {count}",
312
+ clearSelection: "Limpar sele\xE7\xE3o",
313
+ batchLabel: "A\xE7\xF5es em lote",
314
+ batchPublish: "Publicar",
315
+ batchUnpublish: "Despublicar",
316
+ batchArchive: "Excluir",
317
+ batchArchiveConfirm: "Excluir {count} posts? Eles saem do site; o conte\xFAdo fica arquivado.",
318
+ batchPartial: "S\xF3 {done} de {total} conclu\xEDdos. Tente de novo nos demais.",
319
+ itemsPerPage: "Por p\xE1gina",
320
+ rangeLabel: "{from}\u2013{to} de {total}",
220
321
  bodyHintToolbar: "Selecione o texto e use os bot\xF5es acima. Atalhos: Ctrl+B negrito, Ctrl+I it\xE1lico, Ctrl+K link.",
221
322
  toolbarLabel: "Formata\xE7\xE3o do texto",
222
323
  formatBold: "Negrito",
@@ -236,7 +337,6 @@ var pt_BR_default = {
236
337
  imageDialogTitle: "Inserir imagem",
237
338
  imageUploadFromDevice: "Enviar do aparelho",
238
339
  dialogInsert: "Inserir",
239
- dialogCancel: "Cancelar",
240
340
  fileNoneChosen: "Nenhum arquivo escolhido",
241
341
  emojiTitle: "Escolher emoji",
242
342
  emojiSearch: "Buscar emoji",
@@ -314,7 +414,7 @@ function useRenderLink() {
314
414
  }
315
415
 
316
416
  // src/components/ContentWorkspace.tsx
317
- import { useState as useState11 } from "react";
417
+ import { useState as useState15 } from "react";
318
418
 
319
419
  // src/components/PostEditor.tsx
320
420
  import { Archive as Archive2, ArrowLeft, CalendarClock as CalendarClock2, EyeOff, Save, Send, Trash2 } from "lucide-react";
@@ -703,9 +803,9 @@ function renderBlock(block, key, context, tight = false) {
703
803
  }
704
804
  }
705
805
  function MarkdownContent({ markdown, headingLevelOffset = 0, className }) {
706
- const document = useMemo3(() => parseMarkdown(markdown), [markdown]);
806
+ const document2 = useMemo3(() => parseMarkdown(markdown), [markdown]);
707
807
  const context = { offset: headingLevelOffset, nextHeadingId: createHeadingIdGenerator() };
708
- return /* @__PURE__ */ jsx3("div", { className: ["adc-prose", className].filter(Boolean).join(" "), children: document.children.map((block, index) => renderBlock(block, index, context)) });
808
+ return /* @__PURE__ */ jsx3("div", { className: ["adc-prose", className].filter(Boolean).join(" "), children: document2.children.map((block, index) => renderBlock(block, index, context)) });
709
809
  }
710
810
 
711
811
  // src/components/MarkdownEditor.tsx
@@ -1199,7 +1299,7 @@ function MarkdownEditor({
1199
1299
 
1200
1300
  // src/components/StatusChip.tsx
1201
1301
  import { POST_STATUS } from "@adatechnology/content-contracts";
1202
- import { Archive, CalendarClock, CircleCheck, PencilLine } from "lucide-react";
1302
+ import { Archive, CalendarClock, CircleCheck, Copy, PencilLine } from "lucide-react";
1203
1303
  import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
1204
1304
  var STATUS_VIEW = {
1205
1305
  [POST_STATUS.DRAFT]: { icon: PencilLine, label: "statusDraft" },
@@ -1207,10 +1307,10 @@ var STATUS_VIEW = {
1207
1307
  [POST_STATUS.PUBLISHED]: { icon: CircleCheck, label: "statusPublished" },
1208
1308
  [POST_STATUS.ARCHIVED]: { icon: Archive, label: "statusArchived" }
1209
1309
  };
1210
- function StatusChip({ status }) {
1310
+ function StatusChip({ status, isTemplate = false }) {
1211
1311
  const { messages } = useContentText();
1212
- const { icon: Icon, label } = STATUS_VIEW[status];
1213
- return /* @__PURE__ */ jsxs6("span", { className: `adc-chip adc-chip--${status}`, children: [
1312
+ const { icon: Icon, label } = isTemplate ? { icon: Copy, label: "statusTemplate" } : STATUS_VIEW[status];
1313
+ return /* @__PURE__ */ jsxs6("span", { className: `adc-badge adc-chip--${isTemplate ? "template" : status}`, children: [
1214
1314
  /* @__PURE__ */ jsx8(Icon, { "aria-hidden": "true", className: "adc-icon" }),
1215
1315
  messages[label]
1216
1316
  ] });
@@ -1603,37 +1703,431 @@ function PostEditor({
1603
1703
  }
1604
1704
 
1605
1705
  // src/components/PostList.tsx
1606
- import { POST_STATUSES } from "@adatechnology/content-contracts";
1607
- import { Plus, RotateCcw, Search } from "lucide-react";
1608
- import { useId as useId6 } from "react";
1706
+ import { CopyPlus as CopyPlus2, FilePlus2 as FilePlus22, RefreshCw as RefreshCw2 } from "lucide-react";
1707
+ import { useState as useState14 } from "react";
1609
1708
 
1610
1709
  // src/hooks/usePostList.ts
1611
- import { useState as useState10 } from "react";
1710
+ import { useEffect as useEffect4, useState as useState10 } from "react";
1711
+
1712
+ // src/lib/listUrlState.ts
1713
+ import { POST_SORT_FIELDS } from "@adatechnology/content-contracts";
1714
+ var PAGE_SIZE_OPTIONS = [10, 20, 50, 100];
1715
+ var DEFAULT_LIST_STATE = {
1716
+ search: "",
1717
+ tags: [],
1718
+ page: 1,
1719
+ sort: "updatedAt",
1720
+ order: "desc"
1721
+ };
1722
+ var TABS = ["published", "scheduled", "draft", "templates"];
1723
+ function positiveInteger(value) {
1724
+ const parsed = Number(value);
1725
+ return Number.isInteger(parsed) && parsed > 0 ? parsed : void 0;
1726
+ }
1727
+ function parseListUrlState(search) {
1728
+ const params = new URLSearchParams(search);
1729
+ const sort = params.get("sort");
1730
+ const size = positiveInteger(params.get("size"));
1731
+ const tab = params.get("tab");
1732
+ return {
1733
+ ...DEFAULT_LIST_STATE,
1734
+ ...tab && TABS.includes(tab) ? { tab } : {},
1735
+ search: params.get("q") ?? "",
1736
+ tags: (params.get("tags") ?? "").split(",").filter(Boolean),
1737
+ page: positiveInteger(params.get("page")) ?? 1,
1738
+ ...size && PAGE_SIZE_OPTIONS.includes(size) ? { pageSize: size } : {},
1739
+ sort: POST_SORT_FIELDS.includes(sort ?? "") ? sort : "updatedAt",
1740
+ order: params.get("order") === "asc" ? "asc" : "desc"
1741
+ };
1742
+ }
1743
+ function serializeListUrlState(state) {
1744
+ const params = new URLSearchParams();
1745
+ if (state.tab && state.tab !== "published") params.set("tab", state.tab);
1746
+ if (state.search) params.set("q", state.search);
1747
+ if (state.tags.length > 0) params.set("tags", state.tags.join(","));
1748
+ if (state.page > 1) params.set("page", String(state.page));
1749
+ if (state.pageSize) params.set("size", String(state.pageSize));
1750
+ if (state.sort !== DEFAULT_LIST_STATE.sort) params.set("sort", state.sort);
1751
+ if (state.order !== DEFAULT_LIST_STATE.order) params.set("order", state.order);
1752
+ return params.toString();
1753
+ }
1754
+
1755
+ // src/hooks/usePostList.ts
1756
+ var POST_LIST_TAB = {
1757
+ PUBLISHED: "published",
1758
+ SCHEDULED: "scheduled",
1759
+ DRAFT: "draft",
1760
+ TEMPLATES: "templates"
1761
+ };
1762
+ function initialState(syncUrl) {
1763
+ if (!syncUrl || typeof window === "undefined") return DEFAULT_LIST_STATE;
1764
+ return parseListUrlState(window.location.search);
1765
+ }
1612
1766
  function usePostList(params) {
1613
1767
  const api = useContentAdminApi();
1614
- const [filters, setFilters] = useState10({});
1615
- const [page, setPage] = useState10(1);
1616
- const key = JSON.stringify({ filters, page, pageSize: params.pageSize, reload: params.reloadKey ?? 0 });
1617
- const posts = useAsyncResource(() => api.listPosts({ ...filters, page, pageSize: params.pageSize }), key);
1768
+ const syncUrl = params.syncUrl ?? false;
1769
+ const hasTabs = Boolean(api.countPosts);
1770
+ const [state, setState] = useState10(() => initialState(syncUrl));
1771
+ const [localReload, setLocalReload] = useState10(0);
1772
+ const [selectedIds, setSelectedIds] = useState10(/* @__PURE__ */ new Set());
1773
+ const reload = (params.reloadKey ?? 0) + localReload;
1774
+ const tab = hasTabs ? state.tab ?? POST_LIST_TAB.PUBLISHED : void 0;
1775
+ const pageSize = state.pageSize ?? params.pageSize;
1776
+ useEffect4(() => {
1777
+ if (!syncUrl || typeof window === "undefined") return;
1778
+ const query = serializeListUrlState({ ...state, ...tab ? { tab } : {} });
1779
+ const url = `${window.location.pathname}${query ? `?${query}` : ""}${window.location.hash}`;
1780
+ window.history.replaceState(window.history.state, "", url);
1781
+ }, [state, tab, syncUrl]);
1782
+ const tabFilter = !tab ? {} : tab === POST_LIST_TAB.TEMPLATES ? { isTemplate: true } : { status: tab };
1783
+ const key = JSON.stringify({ state, tab, pageSize, reload });
1784
+ const posts = useAsyncResource(
1785
+ () => api.listPosts({
1786
+ ...tabFilter,
1787
+ ...state.search ? { search: state.search } : {},
1788
+ ...state.tags.length > 0 ? { tag: state.tags.join(",") } : {},
1789
+ sort: state.sort,
1790
+ order: state.order,
1791
+ page: state.page,
1792
+ pageSize
1793
+ }),
1794
+ key
1795
+ );
1796
+ const counts = useAsyncResource(
1797
+ () => api.countPosts ? api.countPosts() : Promise.resolve(void 0),
1798
+ `counts-${reload}`
1799
+ );
1618
1800
  const tags = useAsyncResource(
1619
1801
  () => api.listTags ? api.listTags() : Promise.resolve([]),
1620
- `tags-${params.reloadKey ?? 0}`
1802
+ `tags-${reload}`
1621
1803
  );
1622
- function updateFilters(next) {
1623
- setFilters(next);
1624
- setPage(1);
1804
+ useEffect4(() => setSelectedIds(/* @__PURE__ */ new Set()), [key]);
1805
+ const change = (patch) => setState((current) => ({ ...current, page: 1, ...patch }));
1806
+ function toggleSort(field) {
1807
+ change({ sort: field, order: state.sort === field && state.order === "asc" ? "desc" : "asc" });
1808
+ }
1809
+ function toggleTag(tag) {
1810
+ change({ tags: state.tags.includes(tag) ? state.tags.filter((entry) => entry !== tag) : [...state.tags, tag] });
1811
+ }
1812
+ function toggleSelected(id) {
1813
+ setSelectedIds((current) => {
1814
+ const next = new Set(current);
1815
+ if (!next.delete(id)) next.add(id);
1816
+ return next;
1817
+ });
1625
1818
  }
1626
1819
  return {
1627
1820
  posts,
1821
+ counts: counts.data,
1628
1822
  tags: api.listTags ? tags.data ?? [] : void 0,
1629
- filters,
1630
- updateFilters,
1631
- page,
1632
- setPage,
1633
- hasFilters: Boolean(filters.status || filters.tag || filters.search)
1823
+ state,
1824
+ tab,
1825
+ pageSize,
1826
+ selectedIds,
1827
+ setSelectedIds,
1828
+ toggleSelected,
1829
+ toggleSort,
1830
+ toggleTag,
1831
+ setTab: (next) => change({ tab: next }),
1832
+ setSearch: (search) => change({ search }),
1833
+ setPageSize: (next) => change({ pageSize: next }),
1834
+ setPage: (page) => setState((current) => ({ ...current, page })),
1835
+ clearFilters: () => change({ search: "", tags: [] }),
1836
+ refresh: () => setLocalReload((value) => value + 1),
1837
+ hasFilters: Boolean(state.search || state.tags.length > 0)
1634
1838
  };
1635
1839
  }
1636
1840
 
1841
+ // src/components/BatchBar.tsx
1842
+ import { Archive as Archive3, CircleCheck as CircleCheck2, EyeOff as EyeOff2, X as X3 } from "lucide-react";
1843
+ import { useState as useState11 } from "react";
1844
+
1845
+ // src/components/ActionDialog.tsx
1846
+ import { X as X2 } from "lucide-react";
1847
+ import { useEffect as useEffect5, useId as useId6, useRef as useRef4 } from "react";
1848
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
1849
+ function ActionDialog({
1850
+ title,
1851
+ confirmLabel,
1852
+ confirmIcon,
1853
+ isBusy = false,
1854
+ error,
1855
+ onConfirm,
1856
+ onClose,
1857
+ children
1858
+ }) {
1859
+ const { messages } = useContentText();
1860
+ const titleId = useId6();
1861
+ const formRef = useRef4(null);
1862
+ useEffect5(() => {
1863
+ formRef.current?.querySelector("input, button[aria-haspopup], select, textarea")?.focus();
1864
+ const handleKeyDown = (event) => {
1865
+ if (event.key === "Escape") onClose();
1866
+ };
1867
+ document.addEventListener("keydown", handleKeyDown);
1868
+ return () => document.removeEventListener("keydown", handleKeyDown);
1869
+ }, [onClose]);
1870
+ function handleSubmit(event) {
1871
+ event.preventDefault();
1872
+ if (!isBusy) onConfirm();
1873
+ }
1874
+ return /* @__PURE__ */ jsx11("div", { className: "adc-root adc-dialog-backdrop", children: /* @__PURE__ */ jsxs9(
1875
+ "form",
1876
+ {
1877
+ ref: formRef,
1878
+ className: "adc-dialog",
1879
+ role: "dialog",
1880
+ "aria-modal": "true",
1881
+ "aria-labelledby": titleId,
1882
+ onSubmit: handleSubmit,
1883
+ children: [
1884
+ /* @__PURE__ */ jsxs9("header", { className: "adc-dialog__header", children: [
1885
+ /* @__PURE__ */ jsx11("h3", { id: titleId, className: "adc-dialog__title", children: title }),
1886
+ /* @__PURE__ */ jsx11(
1887
+ "button",
1888
+ {
1889
+ type: "button",
1890
+ className: "adc-button adc-button--ghost adc-button--icon",
1891
+ "aria-label": messages.close,
1892
+ onClick: onClose,
1893
+ children: /* @__PURE__ */ jsx11(X2, { "aria-hidden": "true", className: "adc-icon" })
1894
+ }
1895
+ )
1896
+ ] }),
1897
+ /* @__PURE__ */ jsx11("div", { className: "adc-dialog__body", children }),
1898
+ error && /* @__PURE__ */ jsx11("p", { className: "adc-error", role: "alert", children: error }),
1899
+ /* @__PURE__ */ jsxs9("footer", { className: "adc-dialog__footer", children: [
1900
+ /* @__PURE__ */ jsx11("button", { type: "button", className: "adc-button", onClick: onClose, children: messages.dialogCancel }),
1901
+ /* @__PURE__ */ jsxs9("button", { type: "submit", className: "adc-button adc-button--primary", disabled: isBusy, children: [
1902
+ confirmIcon,
1903
+ confirmLabel
1904
+ ] })
1905
+ ] })
1906
+ ]
1907
+ }
1908
+ ) });
1909
+ }
1910
+
1911
+ // src/components/BatchBar.tsx
1912
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
1913
+ function BatchBar({ ids, tab, onClearSelection, onDone }) {
1914
+ const api = useContentAdminApi();
1915
+ const { messages, format } = useContentText();
1916
+ const [isConfirming, setIsConfirming] = useState11(false);
1917
+ const [isBusy, setIsBusy] = useState11(false);
1918
+ const [result, setResult] = useState11();
1919
+ async function run(action) {
1920
+ setIsBusy(true);
1921
+ const calls = ids.map(
1922
+ (id) => action === "publish" ? api.publishPost(id) : action === "unpublish" ? api.unpublishPost(id) : api.archivePost(id)
1923
+ );
1924
+ const settled = await Promise.allSettled(calls);
1925
+ const done = settled.filter((entry) => entry.status === "fulfilled").length;
1926
+ setResult(done === ids.length ? void 0 : format("batchPartial", { done, total: ids.length }));
1927
+ setIsBusy(false);
1928
+ setIsConfirming(false);
1929
+ onDone();
1930
+ }
1931
+ const canPublish = tab === "draft";
1932
+ const canUnpublish = tab === "published" || tab === "scheduled";
1933
+ return /* @__PURE__ */ jsxs10("div", { className: "adc-batch-bar", role: "region", "aria-label": messages.batchLabel, children: [
1934
+ /* @__PURE__ */ jsx12("strong", { children: format("selectedCount", { count: ids.length }) }),
1935
+ canPublish && /* @__PURE__ */ jsxs10(
1936
+ "button",
1937
+ {
1938
+ type: "button",
1939
+ className: "adc-button adc-button--compact",
1940
+ disabled: isBusy,
1941
+ onClick: () => void run("publish"),
1942
+ children: [
1943
+ /* @__PURE__ */ jsx12(CircleCheck2, { "aria-hidden": "true", className: "adc-icon" }),
1944
+ messages.batchPublish
1945
+ ]
1946
+ }
1947
+ ),
1948
+ canUnpublish && /* @__PURE__ */ jsxs10(
1949
+ "button",
1950
+ {
1951
+ type: "button",
1952
+ className: "adc-button adc-button--compact",
1953
+ disabled: isBusy,
1954
+ onClick: () => void run("unpublish"),
1955
+ children: [
1956
+ /* @__PURE__ */ jsx12(EyeOff2, { "aria-hidden": "true", className: "adc-icon" }),
1957
+ messages.batchUnpublish
1958
+ ]
1959
+ }
1960
+ ),
1961
+ /* @__PURE__ */ jsxs10(
1962
+ "button",
1963
+ {
1964
+ type: "button",
1965
+ className: "adc-button adc-button--compact adc-button--danger",
1966
+ disabled: isBusy,
1967
+ onClick: () => setIsConfirming(true),
1968
+ children: [
1969
+ /* @__PURE__ */ jsx12(Archive3, { "aria-hidden": "true", className: "adc-icon" }),
1970
+ messages.batchArchive
1971
+ ]
1972
+ }
1973
+ ),
1974
+ /* @__PURE__ */ jsxs10("button", { type: "button", className: "adc-button adc-button--compact adc-button--ghost", onClick: onClearSelection, children: [
1975
+ /* @__PURE__ */ jsx12(X3, { "aria-hidden": "true", className: "adc-icon" }),
1976
+ messages.clearSelection
1977
+ ] }),
1978
+ result && /* @__PURE__ */ jsx12("span", { className: "adc-error", role: "alert", children: result }),
1979
+ isConfirming && /* @__PURE__ */ jsx12(
1980
+ ActionDialog,
1981
+ {
1982
+ title: messages.batchArchive,
1983
+ confirmLabel: messages.batchArchive,
1984
+ confirmIcon: /* @__PURE__ */ jsx12(Archive3, { "aria-hidden": "true", className: "adc-icon" }),
1985
+ isBusy,
1986
+ onClose: () => setIsConfirming(false),
1987
+ onConfirm: () => void run("archive"),
1988
+ children: /* @__PURE__ */ jsx12("p", { children: format("batchArchiveConfirm", { count: ids.length }) })
1989
+ }
1990
+ )
1991
+ ] });
1992
+ }
1993
+
1994
+ // src/components/PostActionDialogs.tsx
1995
+ import { CopyPlus, FilePlus2, RefreshCw } from "lucide-react";
1996
+ import { useId as useId7, useState as useState12 } from "react";
1997
+
1998
+ // src/components/DateTimeField.tsx
1999
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
2000
+ function DateTimeField({ renderDateTimeInput, ...props }) {
2001
+ if (renderDateTimeInput) return renderDateTimeInput(props);
2002
+ return /* @__PURE__ */ jsxs11("div", { className: "adc-field", children: [
2003
+ /* @__PURE__ */ jsx13("label", { htmlFor: props.id, children: props.label }),
2004
+ /* @__PURE__ */ jsx13(
2005
+ "input",
2006
+ {
2007
+ id: props.id,
2008
+ type: "datetime-local",
2009
+ value: props.value,
2010
+ onChange: (event) => props.onChange(event.target.value)
2011
+ }
2012
+ )
2013
+ ] });
2014
+ }
2015
+
2016
+ // src/components/PostActionDialogs.tsx
2017
+ import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
2018
+ function useAction(run, onDone) {
2019
+ const { messages } = useContentText();
2020
+ const [isBusy, setIsBusy] = useState12(false);
2021
+ const [error, setError] = useState12();
2022
+ async function submit() {
2023
+ setIsBusy(true);
2024
+ setError(void 0);
2025
+ try {
2026
+ onDone(await run());
2027
+ } catch (caught) {
2028
+ setError(caught instanceof Error && caught.message ? caught.message : messages.actionError);
2029
+ setIsBusy(false);
2030
+ }
2031
+ }
2032
+ return { isBusy, error, submit: () => void submit() };
2033
+ }
2034
+ function TitleDialog({ post, heading, fieldLabel, confirmLabel, icon, run, onClose, onDone }) {
2035
+ const [title, setTitle] = useState12(post.title);
2036
+ const id = useId7();
2037
+ const action = useAction(() => run(title.trim() || void 0), onDone);
2038
+ return /* @__PURE__ */ jsx14(
2039
+ ActionDialog,
2040
+ {
2041
+ title: heading,
2042
+ confirmLabel,
2043
+ confirmIcon: icon,
2044
+ onClose,
2045
+ onConfirm: action.submit,
2046
+ isBusy: action.isBusy,
2047
+ error: action.error,
2048
+ children: /* @__PURE__ */ jsxs12("div", { className: "adc-field", children: [
2049
+ /* @__PURE__ */ jsx14("label", { htmlFor: id, children: fieldLabel }),
2050
+ /* @__PURE__ */ jsx14("input", { id, value: title, maxLength: 200, onChange: (event) => setTitle(event.target.value) })
2051
+ ] })
2052
+ }
2053
+ );
2054
+ }
2055
+ function SaveAsTemplateDialog(props) {
2056
+ const api = useContentAdminApi();
2057
+ const { messages } = useContentText();
2058
+ return /* @__PURE__ */ jsx14(
2059
+ TitleDialog,
2060
+ {
2061
+ ...props,
2062
+ heading: messages.saveAsTemplate,
2063
+ fieldLabel: messages.templateNameLabel,
2064
+ confirmLabel: messages.saveAsTemplate,
2065
+ icon: /* @__PURE__ */ jsx14(CopyPlus, { "aria-hidden": "true", className: "adc-icon" }),
2066
+ run: (title) => api.saveAsTemplate ? api.saveAsTemplate(props.post.id, title ? { title } : {}) : Promise.reject(new Error(messages.actionError))
2067
+ }
2068
+ );
2069
+ }
2070
+ function FromTemplateDialog(props) {
2071
+ const api = useContentAdminApi();
2072
+ const { messages } = useContentText();
2073
+ return /* @__PURE__ */ jsx14(
2074
+ TitleDialog,
2075
+ {
2076
+ ...props,
2077
+ heading: messages.newFromTemplate,
2078
+ fieldLabel: messages.newPostTitleLabel,
2079
+ confirmLabel: messages.createDraft,
2080
+ icon: /* @__PURE__ */ jsx14(FilePlus2, { "aria-hidden": "true", className: "adc-icon" }),
2081
+ run: (title) => api.createFromTemplate ? api.createFromTemplate(props.post.id, title ? { title } : {}) : Promise.reject(new Error(messages.actionError))
2082
+ }
2083
+ );
2084
+ }
2085
+ function RepublishDialog({
2086
+ post,
2087
+ renderDateTimeInput,
2088
+ onClose,
2089
+ onDone
2090
+ }) {
2091
+ const api = useContentAdminApi();
2092
+ const { messages } = useContentText();
2093
+ const [value, setValue] = useState12(() => toDateTimeLocalValue((/* @__PURE__ */ new Date()).toISOString()));
2094
+ const id = useId7();
2095
+ const action = useAction(() => {
2096
+ if (!api.republishPost) return Promise.reject(new Error(messages.actionError));
2097
+ const publishedAt = fromDateTimeLocalValue(value);
2098
+ return api.republishPost(post.id, publishedAt ? { publishedAt } : {});
2099
+ }, onDone);
2100
+ return /* @__PURE__ */ jsxs12(
2101
+ ActionDialog,
2102
+ {
2103
+ title: messages.republish,
2104
+ confirmLabel: messages.republish,
2105
+ confirmIcon: /* @__PURE__ */ jsx14(RefreshCw, { "aria-hidden": "true", className: "adc-icon" }),
2106
+ onClose,
2107
+ onConfirm: action.submit,
2108
+ isBusy: action.isBusy,
2109
+ error: action.error,
2110
+ children: [
2111
+ /* @__PURE__ */ jsx14("p", { className: "adc-muted", children: post.title }),
2112
+ /* @__PURE__ */ jsx14(
2113
+ DateTimeField,
2114
+ {
2115
+ id,
2116
+ label: messages.republishDateLabel,
2117
+ value,
2118
+ onChange: setValue,
2119
+ renderDateTimeInput
2120
+ }
2121
+ ),
2122
+ /* @__PURE__ */ jsx14("p", { className: "adc-hint", children: messages.republishHint })
2123
+ ]
2124
+ }
2125
+ );
2126
+ }
2127
+
2128
+ // src/components/PostListFooter.tsx
2129
+ import { useId as useId8 } from "react";
2130
+
1637
2131
  // src/components/Pagination.tsx
1638
2132
  import { ChevronLeft, ChevronRight } from "lucide-react";
1639
2133
 
@@ -1657,7 +2151,7 @@ function buildPageItems(params) {
1657
2151
  }
1658
2152
 
1659
2153
  // src/components/Pagination.tsx
1660
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
2154
+ import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
1661
2155
  function Pagination({ page, totalPages, getPageHref, onPageChange }) {
1662
2156
  const { messages, format } = useContentText();
1663
2157
  const renderLink = useRenderLink();
@@ -1666,7 +2160,7 @@ function Pagination({ page, totalPages, getPageHref, onPageChange }) {
1666
2160
  const className = `adc-page${isCurrent ? " adc-page--current" : ""}`;
1667
2161
  if (getPageHref && !isCurrent)
1668
2162
  return renderLink({ href: getPageHref(target), className, "aria-label": label, children: content });
1669
- return /* @__PURE__ */ jsx11(
2163
+ return /* @__PURE__ */ jsx15(
1670
2164
  "button",
1671
2165
  {
1672
2166
  type: "button",
@@ -1679,135 +2173,557 @@ function Pagination({ page, totalPages, getPageHref, onPageChange }) {
1679
2173
  }
1680
2174
  );
1681
2175
  }
1682
- return /* @__PURE__ */ jsxs9("nav", { className: "adc-pagination", "aria-label": messages.paginationLabel, children: [
1683
- page > 1 && renderTarget(page - 1, messages.paginationPrevious, /* @__PURE__ */ jsx11(ChevronLeft, { "aria-hidden": "true", className: "adc-icon" })),
2176
+ return /* @__PURE__ */ jsxs13("nav", { className: "adc-pagination", "aria-label": messages.paginationLabel, children: [
2177
+ page > 1 && renderTarget(page - 1, messages.paginationPrevious, /* @__PURE__ */ jsx15(ChevronLeft, { "aria-hidden": "true", className: "adc-icon" })),
1684
2178
  buildPageItems({ current: page, total: totalPages }).map(
1685
- (item) => item.kind === "gap" ? /* @__PURE__ */ jsx11("span", { className: "adc-page-gap", "aria-hidden": "true", children: "\u2026" }, item.key) : /* @__PURE__ */ jsx11("span", { children: renderTarget(item.page, format("pageLabel", { page: item.page }), item.page, item.page === page) }, item.page)
2179
+ (item) => item.kind === "gap" ? /* @__PURE__ */ jsx15("span", { className: "adc-page-gap", "aria-hidden": "true", children: "\u2026" }, item.key) : /* @__PURE__ */ jsx15("span", { children: renderTarget(item.page, format("pageLabel", { page: item.page }), item.page, item.page === page) }, item.page)
1686
2180
  ),
1687
- page < totalPages && renderTarget(page + 1, messages.paginationNext, /* @__PURE__ */ jsx11(ChevronRight, { "aria-hidden": "true", className: "adc-icon" }))
2181
+ page < totalPages && renderTarget(page + 1, messages.paginationNext, /* @__PURE__ */ jsx15(ChevronRight, { "aria-hidden": "true", className: "adc-icon" }))
1688
2182
  ] });
1689
2183
  }
1690
2184
 
1691
- // src/components/PostList.tsx
1692
- import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
1693
- var STATUS_LABEL = {
1694
- draft: "statusDraft",
1695
- scheduled: "statusScheduled",
1696
- published: "statusPublished",
1697
- archived: "statusArchived"
1698
- };
1699
- function PostList({ onSelect, onCreate, pageSize = 20, reloadKey }) {
1700
- const { messages, locale } = useContentText();
1701
- const { posts, tags, filters, updateFilters, page, setPage, hasFilters } = usePostList({
1702
- pageSize,
1703
- ...reloadKey !== void 0 ? { reloadKey } : {}
1704
- });
1705
- const searchId = useId6();
1706
- const statusId = useId6();
1707
- const tagId = useId6();
1708
- return /* @__PURE__ */ jsxs10("section", { className: "adc-root adc-post-list", children: [
1709
- /* @__PURE__ */ jsxs10("header", { className: "adc-toolbar", children: [
1710
- /* @__PURE__ */ jsx12("h2", { className: "adc-title", children: messages.listTitle }),
1711
- onCreate && /* @__PURE__ */ jsxs10("button", { type: "button", className: "adc-button adc-button--primary", onClick: onCreate, children: [
1712
- /* @__PURE__ */ jsx12(Plus, { "aria-hidden": "true", className: "adc-icon" }),
1713
- messages.newPost
1714
- ] })
1715
- ] }),
1716
- /* @__PURE__ */ jsxs10("div", { className: "adc-filters", children: [
1717
- /* @__PURE__ */ jsxs10("div", { className: "adc-field adc-field--search", children: [
1718
- /* @__PURE__ */ jsx12("label", { htmlFor: searchId, children: messages.searchLabel }),
1719
- /* @__PURE__ */ jsxs10("div", { className: "adc-input-icon", children: [
1720
- /* @__PURE__ */ jsx12(Search, { "aria-hidden": "true", className: "adc-icon" }),
1721
- /* @__PURE__ */ jsx12(
2185
+ // src/components/SelectField.tsx
2186
+ import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
2187
+ function SelectField({ renderSelect, ...props }) {
2188
+ if (renderSelect) return renderSelect(props);
2189
+ return /* @__PURE__ */ jsxs14("div", { className: "adc-field", children: [
2190
+ /* @__PURE__ */ jsx16("label", { htmlFor: props.id, children: props.label }),
2191
+ /* @__PURE__ */ jsx16("select", { id: props.id, value: props.value, onChange: (event) => props.onChange(event.target.value), children: props.options.map((option) => /* @__PURE__ */ jsx16("option", { value: option.id, children: option.label }, option.id)) })
2192
+ ] });
2193
+ }
2194
+
2195
+ // src/components/PostListFooter.tsx
2196
+ import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
2197
+ function PostListFooter({ data, pageSize, onPage, onPageSize, renderSelect }) {
2198
+ const { messages, format } = useContentText();
2199
+ const id = useId8();
2200
+ const { page, total } = data.pagination;
2201
+ const from = total === 0 ? 0 : (page - 1) * pageSize + 1;
2202
+ const to = Math.min(page * pageSize, total);
2203
+ return /* @__PURE__ */ jsxs15("div", { className: "adc-list-footer", children: [
2204
+ /* @__PURE__ */ jsx17("span", { className: "adc-muted", "aria-live": "polite", children: format("rangeLabel", { from, to, total }) }),
2205
+ /* @__PURE__ */ jsx17(Pagination, { page, totalPages: data.pagination.totalPages, onPageChange: onPage }),
2206
+ /* @__PURE__ */ jsx17(
2207
+ SelectField,
2208
+ {
2209
+ id,
2210
+ label: messages.itemsPerPage,
2211
+ value: String(pageSize),
2212
+ options: PAGE_SIZE_OPTIONS.map((size) => ({ id: String(size), label: String(size) })),
2213
+ onChange: (value) => onPageSize(Number(value)),
2214
+ renderSelect
2215
+ }
2216
+ )
2217
+ ] });
2218
+ }
2219
+
2220
+ // src/components/PostListTabs.tsx
2221
+ import { CalendarClock as CalendarClock3, CircleCheck as CircleCheck3, Copy as Copy2, PencilLine as PencilLine2 } from "lucide-react";
2222
+ import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
2223
+ var TABS2 = [
2224
+ { id: POST_LIST_TAB.PUBLISHED, icon: CircleCheck3, label: "tabPublished", count: "published" },
2225
+ { id: POST_LIST_TAB.SCHEDULED, icon: CalendarClock3, label: "tabScheduled", count: "scheduled" },
2226
+ { id: POST_LIST_TAB.DRAFT, icon: PencilLine2, label: "tabDraft", count: "draft" },
2227
+ { id: POST_LIST_TAB.TEMPLATES, icon: Copy2, label: "tabTemplates", count: "templates" }
2228
+ ];
2229
+ function PostListTabs({ active, counts, onChange }) {
2230
+ const { messages } = useContentText();
2231
+ return /* @__PURE__ */ jsx18("div", { className: "adc-status-tabs", role: "tablist", "aria-label": messages.tabsLabel, children: TABS2.map(({ id, icon: Icon, label, count }) => /* @__PURE__ */ jsxs16(
2232
+ "button",
2233
+ {
2234
+ type: "button",
2235
+ role: "tab",
2236
+ "aria-selected": id === active,
2237
+ className: `adc-status-tab adc-status-tab--${id}`,
2238
+ onClick: () => onChange(id),
2239
+ children: [
2240
+ /* @__PURE__ */ jsx18(Icon, { "aria-hidden": "true", className: "adc-icon" }),
2241
+ /* @__PURE__ */ jsx18("span", { children: messages[label] }),
2242
+ /* @__PURE__ */ jsx18("span", { className: "adc-status-tab__count", children: counts ? counts[count] : "\u2013" })
2243
+ ]
2244
+ },
2245
+ id
2246
+ )) });
2247
+ }
2248
+
2249
+ // src/components/PostListToolbar.tsx
2250
+ import { formatTagLabel } from "@adatechnology/content-contracts";
2251
+ import { Plus, RotateCcw, Search } from "lucide-react";
2252
+ import { useId as useId9 } from "react";
2253
+ import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
2254
+ function PostListToolbar(props) {
2255
+ const { messages } = useContentText();
2256
+ const searchId = useId9();
2257
+ return /* @__PURE__ */ jsxs17("div", { className: "adc-list-toolbar", children: [
2258
+ /* @__PURE__ */ jsxs17("div", { className: "adc-list-toolbar__filters", children: [
2259
+ /* @__PURE__ */ jsxs17("div", { className: "adc-field adc-field--search", children: [
2260
+ /* @__PURE__ */ jsx19("label", { htmlFor: searchId, className: "adc-visually-hidden", children: messages.searchLabel }),
2261
+ /* @__PURE__ */ jsxs17("div", { className: "adc-input-icon", children: [
2262
+ /* @__PURE__ */ jsx19(Search, { "aria-hidden": "true", className: "adc-icon" }),
2263
+ /* @__PURE__ */ jsx19(
1722
2264
  "input",
1723
2265
  {
1724
2266
  id: searchId,
1725
- type: "search",
2267
+ type: "text",
2268
+ inputMode: "search",
2269
+ autoComplete: "off",
1726
2270
  placeholder: messages.searchPlaceholder,
1727
- value: filters.search ?? "",
1728
- onChange: (event) => updateFilters({ ...filters, search: event.target.value || void 0 })
2271
+ value: props.search,
2272
+ onChange: (event) => props.onSearch(event.target.value)
1729
2273
  }
1730
2274
  )
1731
2275
  ] })
1732
2276
  ] }),
1733
- /* @__PURE__ */ jsxs10("div", { className: "adc-field", children: [
1734
- /* @__PURE__ */ jsx12("label", { htmlFor: statusId, children: messages.filterStatus }),
1735
- /* @__PURE__ */ jsxs10(
1736
- "select",
2277
+ props.tags && props.tags.length > 0 && /* @__PURE__ */ jsx19("div", { className: "adc-tag-toggles", role: "group", "aria-label": messages.filterTag, children: props.tags.slice(0, 12).map((entry) => /* @__PURE__ */ jsxs17(
2278
+ "button",
2279
+ {
2280
+ type: "button",
2281
+ className: "adc-tag-toggle",
2282
+ "aria-pressed": props.selectedTags.includes(entry.tag),
2283
+ onClick: () => props.onToggleTag(entry.tag),
2284
+ children: [
2285
+ formatTagLabel(entry.tag),
2286
+ /* @__PURE__ */ jsx19("span", { className: "adc-tag-toggle__count", children: entry.count })
2287
+ ]
2288
+ },
2289
+ entry.tag
2290
+ )) }),
2291
+ props.hasFilters && /* @__PURE__ */ jsxs17("button", { type: "button", className: "adc-button adc-button--ghost", onClick: props.onClear, children: [
2292
+ /* @__PURE__ */ jsx19(RotateCcw, { "aria-hidden": "true", className: "adc-icon" }),
2293
+ messages.clearFilters
2294
+ ] })
2295
+ ] }),
2296
+ props.onCreate && /* @__PURE__ */ jsxs17("button", { type: "button", className: "adc-button adc-button--primary", onClick: props.onCreate, children: [
2297
+ /* @__PURE__ */ jsx19(Plus, { "aria-hidden": "true", className: "adc-icon" }),
2298
+ messages.newPost
2299
+ ] })
2300
+ ] });
2301
+ }
2302
+
2303
+ // src/components/PostTable.tsx
2304
+ import { ArrowDown, ArrowUp, ChevronsUpDown } from "lucide-react";
2305
+
2306
+ // src/components/CheckBox.tsx
2307
+ import { Check, Minus } from "lucide-react";
2308
+ import { jsx as jsx20 } from "react/jsx-runtime";
2309
+ function CheckBox({ checked, isMixed = false, label, onChange }) {
2310
+ const Icon = isMixed ? Minus : Check;
2311
+ return /* @__PURE__ */ jsx20(
2312
+ "button",
2313
+ {
2314
+ type: "button",
2315
+ role: "checkbox",
2316
+ "aria-checked": isMixed ? "mixed" : checked,
2317
+ "aria-label": label,
2318
+ className: `adc-checkbox${checked || isMixed ? " is-on" : ""}`,
2319
+ onClick: onChange,
2320
+ children: (checked || isMixed) && /* @__PURE__ */ jsx20(Icon, { "aria-hidden": "true", className: "adc-icon" })
2321
+ }
2322
+ );
2323
+ }
2324
+
2325
+ // src/components/PostTable.tsx
2326
+ import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
2327
+ var SORTABLE_COLUMNS = [
2328
+ { field: "title", label: "columnTitle" },
2329
+ { field: "status", label: "columnStatus" },
2330
+ { field: "publishedAt", label: "columnPublished" },
2331
+ { field: "updatedAt", label: "columnUpdated" }
2332
+ ];
2333
+ function PostTable(props) {
2334
+ const { messages, locale } = useContentText();
2335
+ const selectedCount = props.rows.filter((row) => props.selectedIds.has(row.id)).length;
2336
+ const isAll = selectedCount > 0 && selectedCount === props.rows.length;
2337
+ return /* @__PURE__ */ jsx21("div", { className: "adc-table-wrap", "aria-busy": props.isBusy, children: /* @__PURE__ */ jsxs18("table", { className: "adc-table", children: [
2338
+ /* @__PURE__ */ jsx21("thead", { children: /* @__PURE__ */ jsxs18("tr", { children: [
2339
+ /* @__PURE__ */ jsx21("th", { scope: "col", className: "adc-table__check", children: /* @__PURE__ */ jsx21(
2340
+ CheckBox,
2341
+ {
2342
+ checked: isAll,
2343
+ isMixed: selectedCount > 0 && !isAll,
2344
+ label: messages.selectAll,
2345
+ onChange: props.onToggleAll
2346
+ }
2347
+ ) }),
2348
+ SORTABLE_COLUMNS.map(({ field, label }) => {
2349
+ const isActive = props.sort === field;
2350
+ const Icon = !isActive ? ChevronsUpDown : props.order === "asc" ? ArrowUp : ArrowDown;
2351
+ return /* @__PURE__ */ jsx21(
2352
+ "th",
2353
+ {
2354
+ scope: "col",
2355
+ "aria-sort": !isActive ? "none" : props.order === "asc" ? "ascending" : "descending",
2356
+ children: /* @__PURE__ */ jsxs18("button", { type: "button", className: "adc-sort", onClick: () => props.onSort(field), children: [
2357
+ messages[label],
2358
+ /* @__PURE__ */ jsx21(Icon, { "aria-hidden": "true", className: "adc-icon" })
2359
+ ] })
2360
+ },
2361
+ field
2362
+ );
2363
+ }),
2364
+ props.hasActions && /* @__PURE__ */ jsx21("th", { scope: "col", children: messages.columnActions })
2365
+ ] }) }),
2366
+ /* @__PURE__ */ jsx21("tbody", { children: props.rows.map((post) => /* @__PURE__ */ jsxs18("tr", { className: props.selectedIds.has(post.id) ? "is-selected" : void 0, children: [
2367
+ /* @__PURE__ */ jsx21("td", { className: "adc-table__check", children: /* @__PURE__ */ jsx21(
2368
+ CheckBox,
2369
+ {
2370
+ checked: props.selectedIds.has(post.id),
2371
+ label: messages.selectRow.replace("{title}", post.title),
2372
+ onChange: () => props.onToggleSelected(post.id)
2373
+ }
2374
+ ) }),
2375
+ /* @__PURE__ */ jsxs18("td", { children: [
2376
+ /* @__PURE__ */ jsx21("button", { type: "button", className: "adc-row-link", onClick: () => props.onSelect(post), children: post.title }),
2377
+ /* @__PURE__ */ jsxs18("span", { className: "adc-muted adc-slug", children: [
2378
+ "/",
2379
+ post.slug
2380
+ ] })
2381
+ ] }),
2382
+ /* @__PURE__ */ jsx21("td", { children: /* @__PURE__ */ jsx21(StatusChip, { status: post.status, isTemplate: post.isTemplate }) }),
2383
+ /* @__PURE__ */ jsx21("td", { children: formatPostDate(post.publishedAt, locale, true) }),
2384
+ /* @__PURE__ */ jsx21("td", { children: formatPostDate(post.updatedAt, locale, true) }),
2385
+ props.hasActions && /* @__PURE__ */ jsx21("td", { className: "adc-row-actions", children: props.renderActions(post) })
2386
+ ] }, post.id)) })
2387
+ ] }) });
2388
+ }
2389
+
2390
+ // src/components/RecurrencePanel.tsx
2391
+ import {
2392
+ RECURRENCE_FREQUENCY
2393
+ } from "@adatechnology/content-contracts";
2394
+ import { CirclePause, CirclePlay, Plus as Plus2, Repeat, Trash2 as Trash22 } from "lucide-react";
2395
+ import { useId as useId10, useState as useState13 } from "react";
2396
+ import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
2397
+ function defaultStart() {
2398
+ const next = new Date(Date.now() + 24 * 60 * 60 * 1e3);
2399
+ next.setMinutes(0, 0, 0);
2400
+ return toDateTimeLocalValue(next.toISOString());
2401
+ }
2402
+ function CreateRecurrenceDialog({
2403
+ templates,
2404
+ renderDateTimeInput,
2405
+ renderSelect,
2406
+ onClose,
2407
+ onCreated
2408
+ }) {
2409
+ const api = useContentAdminApi();
2410
+ const { messages } = useContentText();
2411
+ const [templateId, setTemplateId] = useState13(templates[0]?.id ?? "");
2412
+ const [frequency, setFrequency] = useState13(RECURRENCE_FREQUENCY.WEEKLY);
2413
+ const [startsAt, setStartsAt] = useState13(defaultStart);
2414
+ const [isBusy, setIsBusy] = useState13(false);
2415
+ const [error, setError] = useState13();
2416
+ const ids = { template: useId10(), frequency: useId10(), start: useId10() };
2417
+ async function submit() {
2418
+ const iso = fromDateTimeLocalValue(startsAt);
2419
+ if (!api.createRecurrence || !iso || !templateId) return;
2420
+ setIsBusy(true);
2421
+ try {
2422
+ await api.createRecurrence({ templateId, frequency, startsAt: iso });
2423
+ onCreated();
2424
+ } catch (caught) {
2425
+ setError(caught instanceof Error && caught.message ? caught.message : messages.actionError);
2426
+ setIsBusy(false);
2427
+ }
2428
+ }
2429
+ return /* @__PURE__ */ jsxs19(
2430
+ ActionDialog,
2431
+ {
2432
+ title: messages.recurrenceNew,
2433
+ confirmLabel: messages.recurrenceCreate,
2434
+ confirmIcon: /* @__PURE__ */ jsx22(Repeat, { "aria-hidden": "true", className: "adc-icon" }),
2435
+ isBusy,
2436
+ error,
2437
+ onClose,
2438
+ onConfirm: () => void submit(),
2439
+ children: [
2440
+ /* @__PURE__ */ jsx22(
2441
+ SelectField,
1737
2442
  {
1738
- id: statusId,
1739
- value: filters.status ?? "",
1740
- onChange: (event) => updateFilters({ ...filters, status: event.target.value || void 0 }),
1741
- children: [
1742
- /* @__PURE__ */ jsx12("option", { value: "", children: messages.filterAll }),
1743
- POST_STATUSES.map((status) => /* @__PURE__ */ jsx12("option", { value: status, children: messages[STATUS_LABEL[status]] }, status))
1744
- ]
2443
+ id: ids.template,
2444
+ label: messages.recurrenceTemplate,
2445
+ value: templateId,
2446
+ options: templates.map((template) => ({ id: template.id, label: template.title })),
2447
+ onChange: setTemplateId,
2448
+ renderSelect
1745
2449
  }
1746
- )
1747
- ] }),
1748
- /* @__PURE__ */ jsxs10("div", { className: "adc-field", children: [
1749
- /* @__PURE__ */ jsx12("label", { htmlFor: tagId, children: messages.filterTag }),
1750
- /* @__PURE__ */ jsx12(
1751
- "input",
2450
+ ),
2451
+ /* @__PURE__ */ jsx22(
2452
+ SelectField,
1752
2453
  {
1753
- id: tagId,
1754
- list: tags && tags.length > 0 ? `${tagId}-list` : void 0,
1755
- value: filters.tag ?? "",
1756
- onChange: (event) => updateFilters({ ...filters, tag: event.target.value || void 0 })
2454
+ id: ids.frequency,
2455
+ label: messages.recurrenceFrequency,
2456
+ value: frequency,
2457
+ options: [
2458
+ { id: RECURRENCE_FREQUENCY.WEEKLY, label: messages.frequencyWeekly },
2459
+ { id: RECURRENCE_FREQUENCY.MONTHLY, label: messages.frequencyMonthly }
2460
+ ],
2461
+ onChange: (value) => setFrequency(value),
2462
+ renderSelect
1757
2463
  }
1758
2464
  ),
1759
- tags && /* @__PURE__ */ jsx12("datalist", { id: `${tagId}-list`, children: tags.map((entry) => /* @__PURE__ */ jsx12("option", { value: entry.tag }, entry.tag)) })
1760
- ] }),
1761
- hasFilters && /* @__PURE__ */ jsxs10("button", { type: "button", className: "adc-button adc-button--ghost", onClick: () => updateFilters({}), children: [
1762
- /* @__PURE__ */ jsx12(RotateCcw, { "aria-hidden": "true", className: "adc-icon" }),
1763
- messages.clearFilters
2465
+ /* @__PURE__ */ jsx22(
2466
+ DateTimeField,
2467
+ {
2468
+ id: ids.start,
2469
+ label: messages.recurrenceStart,
2470
+ value: startsAt,
2471
+ onChange: setStartsAt,
2472
+ renderDateTimeInput
2473
+ }
2474
+ ),
2475
+ /* @__PURE__ */ jsx22("p", { className: "adc-hint", children: messages.recurrenceHint })
2476
+ ]
2477
+ }
2478
+ );
2479
+ }
2480
+ function RuleRow({ rule, onChanged }) {
2481
+ const api = useContentAdminApi();
2482
+ const { messages, locale, format } = useContentText();
2483
+ const toggleLabel = rule.isActive ? messages.recurrencePause : messages.recurrenceResume;
2484
+ const ToggleIcon = rule.isActive ? CirclePause : CirclePlay;
2485
+ const StateIcon = rule.isActive ? CirclePlay : CirclePause;
2486
+ async function toggle() {
2487
+ await api.updateRecurrence?.(rule.id, { isActive: !rule.isActive });
2488
+ onChanged();
2489
+ }
2490
+ async function remove() {
2491
+ await api.removeRecurrence?.(rule.id);
2492
+ onChanged();
2493
+ }
2494
+ return /* @__PURE__ */ jsxs19("li", { className: "adc-rule", children: [
2495
+ /* @__PURE__ */ jsxs19("div", { className: "adc-rule__main", children: [
2496
+ /* @__PURE__ */ jsx22("strong", { children: rule.templateTitle }),
2497
+ /* @__PURE__ */ jsxs19("span", { className: "adc-muted", children: [
2498
+ rule.frequency === RECURRENCE_FREQUENCY.WEEKLY ? messages.frequencyWeekly : messages.frequencyMonthly,
2499
+ rule.isActive && ` \xB7 ${format("recurrenceNext", { date: formatPostDate(rule.nextRunAt, locale, true) })}`
1764
2500
  ] })
1765
2501
  ] }),
1766
- posts.error !== void 0 && !posts.isLoading ? /* @__PURE__ */ jsxs10("div", { className: "adc-state adc-state--error", role: "alert", children: [
2502
+ /* @__PURE__ */ jsxs19("span", { className: `adc-chip adc-badge adc-chip--${rule.isActive ? "published" : "draft"}`, children: [
2503
+ /* @__PURE__ */ jsx22(StateIcon, { "aria-hidden": "true", className: "adc-icon" }),
2504
+ rule.isActive ? messages.recurrenceActive : messages.recurrencePaused
2505
+ ] }),
2506
+ /* @__PURE__ */ jsx22(Tooltip, { text: toggleLabel, children: /* @__PURE__ */ jsx22(
2507
+ "button",
2508
+ {
2509
+ type: "button",
2510
+ className: "adc-button adc-button--ghost adc-button--icon",
2511
+ "aria-label": toggleLabel,
2512
+ onClick: () => void toggle(),
2513
+ children: /* @__PURE__ */ jsx22(ToggleIcon, { "aria-hidden": "true", className: "adc-icon" })
2514
+ }
2515
+ ) }),
2516
+ /* @__PURE__ */ jsx22(Tooltip, { text: messages.recurrenceRemoveTip, children: /* @__PURE__ */ jsx22(
2517
+ "button",
2518
+ {
2519
+ type: "button",
2520
+ className: "adc-button adc-button--ghost adc-button--icon adc-button--danger",
2521
+ "aria-label": messages.recurrenceRemove,
2522
+ onClick: () => void remove(),
2523
+ children: /* @__PURE__ */ jsx22(Trash22, { "aria-hidden": "true", className: "adc-icon" })
2524
+ }
2525
+ ) })
2526
+ ] });
2527
+ }
2528
+ function RecurrencePanel(props) {
2529
+ const api = useContentAdminApi();
2530
+ const { messages } = useContentText();
2531
+ const [isCreating, setIsCreating] = useState13(false);
2532
+ const rules = useAsyncResource(
2533
+ () => api.listRecurrences ? api.listRecurrences() : Promise.resolve([]),
2534
+ "recurrences"
2535
+ );
2536
+ if (!api.listRecurrences) return null;
2537
+ return /* @__PURE__ */ jsxs19("section", { className: "adc-recurrence", "aria-labelledby": "adc-recurrence-title", children: [
2538
+ /* @__PURE__ */ jsxs19("header", { className: "adc-toolbar", children: [
2539
+ /* @__PURE__ */ jsxs19("h3", { id: "adc-recurrence-title", className: "adc-subtitle", children: [
2540
+ /* @__PURE__ */ jsx22(Repeat, { "aria-hidden": "true", className: "adc-icon" }),
2541
+ " ",
2542
+ messages.recurrenceTitle
2543
+ ] }),
2544
+ /* @__PURE__ */ jsxs19(
2545
+ "button",
2546
+ {
2547
+ type: "button",
2548
+ className: "adc-button",
2549
+ disabled: props.templates.length === 0,
2550
+ onClick: () => setIsCreating(true),
2551
+ children: [
2552
+ /* @__PURE__ */ jsx22(Plus2, { "aria-hidden": "true", className: "adc-icon" }),
2553
+ messages.recurrenceNew
2554
+ ]
2555
+ }
2556
+ )
2557
+ ] }),
2558
+ (rules.data?.length ?? 0) === 0 ? /* @__PURE__ */ jsx22("p", { className: "adc-state", children: props.templates.length === 0 ? messages.recurrenceNeedsTemplate : messages.recurrenceEmpty }) : /* @__PURE__ */ jsx22("ul", { className: "adc-rule-list", children: rules.data?.map((rule) => /* @__PURE__ */ jsx22(RuleRow, { rule, onChanged: rules.reload }, rule.id)) }),
2559
+ isCreating && /* @__PURE__ */ jsx22(
2560
+ CreateRecurrenceDialog,
2561
+ {
2562
+ ...props,
2563
+ onClose: () => setIsCreating(false),
2564
+ onCreated: () => {
2565
+ setIsCreating(false);
2566
+ rules.reload();
2567
+ }
2568
+ }
2569
+ )
2570
+ ] });
2571
+ }
2572
+
2573
+ // src/components/PostList.tsx
2574
+ import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
2575
+ function PostList({
2576
+ onSelect,
2577
+ onCreate,
2578
+ pageSize = 20,
2579
+ reloadKey,
2580
+ syncUrl,
2581
+ renderDateTimeInput,
2582
+ renderSelect
2583
+ }) {
2584
+ const { messages } = useContentText();
2585
+ const api = useContentAdminApi();
2586
+ const [dialog, setDialog] = useState14();
2587
+ const list = usePostList({
2588
+ pageSize,
2589
+ ...reloadKey !== void 0 ? { reloadKey } : {},
2590
+ ...syncUrl ? { syncUrl } : {}
2591
+ });
2592
+ const { posts, state, tab } = list;
2593
+ const rows = posts.data?.data ?? [];
2594
+ function actionsFor(post) {
2595
+ if (post.isTemplate) {
2596
+ return api.createFromTemplate ? [
2597
+ {
2598
+ action: "fromTemplate",
2599
+ icon: FilePlus22,
2600
+ label: messages.newFromTemplate,
2601
+ tip: messages.newFromTemplateTip
2602
+ }
2603
+ ] : [];
2604
+ }
2605
+ return [
2606
+ ...post.status === "published" && api.republishPost ? [{ action: "republish", icon: RefreshCw2, label: messages.republish, tip: messages.republishTip }] : [],
2607
+ ...api.saveAsTemplate ? [
2608
+ {
2609
+ action: "saveAsTemplate",
2610
+ icon: CopyPlus2,
2611
+ label: messages.saveAsTemplate,
2612
+ tip: messages.saveAsTemplateTip
2613
+ }
2614
+ ] : []
2615
+ ];
2616
+ }
2617
+ function handleActionDone(post) {
2618
+ const action = dialog?.action;
2619
+ setDialog(void 0);
2620
+ list.refresh();
2621
+ if (action === "fromTemplate") onSelect(post);
2622
+ if (action === "saveAsTemplate") list.setTab(POST_LIST_TAB.TEMPLATES);
2623
+ }
2624
+ function toggleAll() {
2625
+ list.setSelectedIds(list.selectedIds.size === rows.length ? /* @__PURE__ */ new Set() : new Set(rows.map((row) => row.id)));
2626
+ }
2627
+ return /* @__PURE__ */ jsxs20("section", { className: "adc-root adc-post-list", children: [
2628
+ /* @__PURE__ */ jsx23("header", { className: "adc-toolbar", children: /* @__PURE__ */ jsx23("h2", { className: "adc-title", children: messages.listTitle }) }),
2629
+ /* @__PURE__ */ jsx23(
2630
+ PostListToolbar,
2631
+ {
2632
+ search: state.search,
2633
+ onSearch: list.setSearch,
2634
+ tags: list.tags,
2635
+ selectedTags: state.tags,
2636
+ onToggleTag: list.toggleTag,
2637
+ hasFilters: list.hasFilters,
2638
+ onClear: list.clearFilters,
2639
+ onCreate
2640
+ }
2641
+ ),
2642
+ tab && /* @__PURE__ */ jsx23(PostListTabs, { active: tab, counts: list.counts, onChange: list.setTab }),
2643
+ list.selectedIds.size > 0 && /* @__PURE__ */ jsx23(
2644
+ BatchBar,
2645
+ {
2646
+ ids: [...list.selectedIds],
2647
+ tab,
2648
+ onClearSelection: () => list.setSelectedIds(/* @__PURE__ */ new Set()),
2649
+ onDone: list.refresh
2650
+ }
2651
+ ),
2652
+ posts.error !== void 0 && !posts.isLoading ? /* @__PURE__ */ jsxs20("div", { className: "adc-state adc-state--error", role: "alert", children: [
1767
2653
  messages.loadError,
1768
- /* @__PURE__ */ jsx12("button", { type: "button", className: "adc-button", onClick: posts.reload, children: messages.retry })
1769
- ] }) : posts.isLoading && !posts.data ? /* @__PURE__ */ jsx12("p", { className: "adc-state", role: "status", children: messages.loading }) : (posts.data?.data.length ?? 0) === 0 ? /* @__PURE__ */ jsx12("p", { className: "adc-state", children: messages.empty }) : /* @__PURE__ */ jsx12("div", { className: "adc-table-wrap", "aria-busy": posts.isLoading, children: /* @__PURE__ */ jsxs10("table", { className: "adc-table", children: [
1770
- /* @__PURE__ */ jsx12("thead", { children: /* @__PURE__ */ jsxs10("tr", { children: [
1771
- /* @__PURE__ */ jsx12("th", { scope: "col", children: messages.columnTitle }),
1772
- /* @__PURE__ */ jsx12("th", { scope: "col", children: messages.columnStatus }),
1773
- /* @__PURE__ */ jsx12("th", { scope: "col", children: messages.columnPublished }),
1774
- /* @__PURE__ */ jsx12("th", { scope: "col", children: messages.columnUpdated })
1775
- ] }) }),
1776
- /* @__PURE__ */ jsx12("tbody", { children: posts.data?.data.map((post) => /* @__PURE__ */ jsxs10("tr", { children: [
1777
- /* @__PURE__ */ jsxs10("td", { children: [
1778
- /* @__PURE__ */ jsx12("button", { type: "button", className: "adc-row-link", onClick: () => onSelect(post), children: post.title }),
1779
- /* @__PURE__ */ jsxs10("span", { className: "adc-muted adc-slug", children: [
1780
- "/",
1781
- post.slug
1782
- ] })
1783
- ] }),
1784
- /* @__PURE__ */ jsx12("td", { children: /* @__PURE__ */ jsx12(StatusChip, { status: post.status }) }),
1785
- /* @__PURE__ */ jsx12("td", { children: formatPostDate(post.publishedAt, locale, true) }),
1786
- /* @__PURE__ */ jsx12("td", { children: formatPostDate(post.updatedAt, locale, true) })
1787
- ] }, post.id)) })
1788
- ] }) }),
1789
- posts.data && /* @__PURE__ */ jsx12(Pagination, { page, totalPages: posts.data.pagination.totalPages, onPageChange: setPage })
2654
+ /* @__PURE__ */ jsx23("button", { type: "button", className: "adc-button", onClick: posts.reload, children: messages.retry })
2655
+ ] }) : posts.isLoading && !posts.data ? /* @__PURE__ */ jsx23("p", { className: "adc-state", role: "status", children: messages.loading }) : rows.length === 0 ? /* @__PURE__ */ jsx23("p", { className: "adc-state", children: tab === POST_LIST_TAB.TEMPLATES ? messages.emptyTemplates : messages.empty }) : /* @__PURE__ */ jsx23(
2656
+ PostTable,
2657
+ {
2658
+ rows,
2659
+ sort: state.sort,
2660
+ order: state.order,
2661
+ onSort: list.toggleSort,
2662
+ selectedIds: list.selectedIds,
2663
+ onToggleSelected: list.toggleSelected,
2664
+ onToggleAll: toggleAll,
2665
+ onSelect,
2666
+ hasActions: Boolean(tab),
2667
+ isBusy: posts.isLoading,
2668
+ renderActions: (post) => actionsFor(post).map(({ action, icon: Icon, label, tip }) => /* @__PURE__ */ jsx23(Tooltip, { text: tip, children: /* @__PURE__ */ jsxs20(
2669
+ "button",
2670
+ {
2671
+ type: "button",
2672
+ className: "adc-button adc-button--compact",
2673
+ onClick: () => setDialog({ action, post }),
2674
+ children: [
2675
+ /* @__PURE__ */ jsx23(Icon, { "aria-hidden": "true", className: "adc-icon" }),
2676
+ label
2677
+ ]
2678
+ }
2679
+ ) }, action))
2680
+ }
2681
+ ),
2682
+ posts.data && /* @__PURE__ */ jsx23(
2683
+ PostListFooter,
2684
+ {
2685
+ data: posts.data,
2686
+ pageSize: list.pageSize,
2687
+ onPage: list.setPage,
2688
+ onPageSize: list.setPageSize,
2689
+ renderSelect
2690
+ }
2691
+ ),
2692
+ tab === POST_LIST_TAB.TEMPLATES && /* @__PURE__ */ jsx23(RecurrencePanel, { templates: rows, renderDateTimeInput, renderSelect }),
2693
+ dialog?.action === "saveAsTemplate" && /* @__PURE__ */ jsx23(SaveAsTemplateDialog, { post: dialog.post, onClose: () => setDialog(void 0), onDone: handleActionDone }),
2694
+ dialog?.action === "fromTemplate" && /* @__PURE__ */ jsx23(FromTemplateDialog, { post: dialog.post, onClose: () => setDialog(void 0), onDone: handleActionDone }),
2695
+ dialog?.action === "republish" && /* @__PURE__ */ jsx23(
2696
+ RepublishDialog,
2697
+ {
2698
+ post: dialog.post,
2699
+ renderDateTimeInput,
2700
+ onClose: () => setDialog(void 0),
2701
+ onDone: handleActionDone
2702
+ }
2703
+ )
1790
2704
  ] });
1791
2705
  }
1792
2706
 
1793
2707
  // src/components/ContentWorkspace.tsx
1794
- import { jsx as jsx13 } from "react/jsx-runtime";
2708
+ import { jsx as jsx24 } from "react/jsx-runtime";
1795
2709
  function ContentWorkspace({
1796
2710
  pageSize,
1797
2711
  newPostDefaults,
1798
2712
  onPostSaved,
1799
- showFormattingToolbar,
1800
- renderDateTimeInput
2713
+ renderDateTimeInput,
2714
+ renderSelect,
2715
+ syncUrl,
2716
+ showFormattingToolbar
1801
2717
  }) {
1802
- const [view, setView] = useState11({ kind: "list" });
1803
- const [reloadKey, setReloadKey] = useState11(0);
2718
+ const [view, setView] = useState15({ kind: "list" });
2719
+ const [reloadKey, setReloadKey] = useState15(0);
1804
2720
  function handleSaved(post) {
1805
2721
  setReloadKey((value) => value + 1);
1806
2722
  setView({ kind: "editor", postId: post.id });
1807
2723
  onPostSaved?.(post);
1808
2724
  }
1809
2725
  if (view.kind === "editor") {
1810
- return /* @__PURE__ */ jsx13(
2726
+ return /* @__PURE__ */ jsx24(
1811
2727
  PostEditor,
1812
2728
  {
1813
2729
  ...view.postId ? { postId: view.postId } : {},
@@ -1824,10 +2740,13 @@ function ContentWorkspace({
1824
2740
  view.postId ?? "new"
1825
2741
  );
1826
2742
  }
1827
- return /* @__PURE__ */ jsx13(
2743
+ return /* @__PURE__ */ jsx24(
1828
2744
  PostList,
1829
2745
  {
1830
2746
  reloadKey,
2747
+ ...renderDateTimeInput ? { renderDateTimeInput } : {},
2748
+ ...renderSelect ? { renderSelect } : {},
2749
+ ...syncUrl ? { syncUrl } : {},
1831
2750
  ...pageSize ? { pageSize } : {},
1832
2751
  onSelect: (post) => setView({ kind: "editor", postId: post.id }),
1833
2752
  onCreate: () => setView({ kind: "editor" })
@@ -1836,13 +2755,14 @@ function ContentWorkspace({
1836
2755
  }
1837
2756
 
1838
2757
  // src/components/PostCard.tsx
1839
- import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
2758
+ import { formatTagLabel as formatTagLabel2 } from "@adatechnology/content-contracts";
2759
+ import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
1840
2760
  function PostCard({ post, href, headingLevel = 2 }) {
1841
2761
  const { messages, locale, format } = useContentText();
1842
2762
  const renderLink = useRenderLink();
1843
2763
  const Heading = `h${headingLevel}`;
1844
- return /* @__PURE__ */ jsxs11("article", { className: "adc-card", children: [
1845
- post.coverImageUrl && /* @__PURE__ */ jsx14(
2764
+ return /* @__PURE__ */ jsxs21("article", { className: "adc-card", children: [
2765
+ post.coverImageUrl && /* @__PURE__ */ jsx25(
1846
2766
  "img",
1847
2767
  {
1848
2768
  className: "adc-card-cover",
@@ -1852,22 +2772,23 @@ function PostCard({ post, href, headingLevel = 2 }) {
1852
2772
  decoding: "async"
1853
2773
  }
1854
2774
  ),
1855
- /* @__PURE__ */ jsxs11("div", { className: "adc-card-body", children: [
1856
- /* @__PURE__ */ jsx14(Heading, { className: "adc-card-title", children: renderLink({ href, className: "adc-card-link", children: post.title }) }),
1857
- /* @__PURE__ */ jsxs11("p", { className: "adc-meta", children: [
1858
- /* @__PURE__ */ jsx14("time", { dateTime: post.publishedAt, children: formatPostDate(post.publishedAt, locale) }),
1859
- /* @__PURE__ */ jsx14("span", { "aria-hidden": "true", children: " \xB7 " }),
2775
+ /* @__PURE__ */ jsxs21("div", { className: "adc-card-body", children: [
2776
+ /* @__PURE__ */ jsx25(Heading, { className: "adc-card-title", children: renderLink({ href, className: "adc-card-link", children: post.title }) }),
2777
+ /* @__PURE__ */ jsxs21("p", { className: "adc-meta", children: [
2778
+ /* @__PURE__ */ jsx25("time", { dateTime: post.publishedAt, children: formatPostDate(post.publishedAt, locale) }),
2779
+ /* @__PURE__ */ jsx25("span", { "aria-hidden": "true", children: " \xB7 " }),
1860
2780
  format("readingTime", { minutes: post.readingTimeMinutes })
1861
2781
  ] }),
1862
- post.excerpt && /* @__PURE__ */ jsx14("p", { className: "adc-card-excerpt", children: post.excerpt }),
1863
- post.tags.length > 0 && /* @__PURE__ */ jsx14("ul", { className: "adc-tag-list", children: post.tags.map((tag) => /* @__PURE__ */ jsx14("li", { className: "adc-tag", children: tag }, tag)) }),
1864
- /* @__PURE__ */ jsx14("span", { className: "adc-card-more", "aria-hidden": "true", children: messages.readMore })
2782
+ post.excerpt && /* @__PURE__ */ jsx25("p", { className: "adc-card-excerpt", children: post.excerpt }),
2783
+ post.tags.length > 0 && /* @__PURE__ */ jsx25("ul", { className: "adc-tag-list", children: post.tags.map((tag) => /* @__PURE__ */ jsx25("li", { className: "adc-tag", children: formatTagLabel2(tag, post.tagLabels) }, tag)) }),
2784
+ /* @__PURE__ */ jsx25("span", { className: "adc-card-more", "aria-hidden": "true", children: messages.readMore })
1865
2785
  ] })
1866
2786
  ] });
1867
2787
  }
1868
2788
 
1869
2789
  // src/components/PostListPage.tsx
1870
- import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
2790
+ import { formatTagLabel as formatTagLabel3 } from "@adatechnology/content-contracts";
2791
+ import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
1871
2792
  function PostListPage({ page = 1, tag, pageSize = 10, getPostHref, getListHref, title }) {
1872
2793
  const api = useContentPublicApi();
1873
2794
  const { messages } = useContentText();
@@ -1881,9 +2802,9 @@ function PostListPage({ page = 1, tag, pageSize = 10, getPostHref, getListHref,
1881
2802
  "public-tags"
1882
2803
  );
1883
2804
  const withTag = (target) => getListHref({ page: target, ...tag ? { tag } : {} });
1884
- return /* @__PURE__ */ jsxs12("section", { className: "adc-root adc-public-list", children: [
1885
- title && /* @__PURE__ */ jsx15("h1", { className: "adc-page-title", children: title }),
1886
- (tags.data?.length ?? 0) > 0 && /* @__PURE__ */ jsxs12("nav", { className: "adc-tag-filter", "aria-label": messages.tagsLabel, children: [
2805
+ return /* @__PURE__ */ jsxs22("section", { className: "adc-root adc-public-list", children: [
2806
+ title && /* @__PURE__ */ jsx26("h1", { className: "adc-page-title", children: title }),
2807
+ (tags.data?.length ?? 0) > 0 && /* @__PURE__ */ jsxs22("nav", { className: "adc-tag-filter", "aria-label": messages.tagsLabel, children: [
1887
2808
  renderLink({
1888
2809
  href: getListHref({ page: 1 }),
1889
2810
  className: `adc-tag-chip${tag ? "" : " adc-tag-chip--active"}`,
@@ -1895,24 +2816,25 @@ function PostListPage({ page = 1, tag, pageSize = 10, getPostHref, getListHref,
1895
2816
  href: getListHref({ page: 1, tag: entry.tag }),
1896
2817
  className: `adc-tag-chip${entry.tag === tag ? " adc-tag-chip--active" : ""}`,
1897
2818
  ...entry.tag === tag ? { "aria-current": "page" } : {},
1898
- children: `${entry.tag} (${entry.count})`
2819
+ children: `${formatTagLabel3(entry.tag)} (${entry.count})`
1899
2820
  })
1900
2821
  )
1901
2822
  ] }),
1902
- posts.isLoading && !posts.data ? /* @__PURE__ */ jsx15("p", { className: "adc-state", role: "status", children: messages.loading }) : posts.error !== void 0 ? /* @__PURE__ */ jsxs12("div", { className: "adc-state adc-state--error", role: "alert", children: [
2823
+ posts.isLoading && !posts.data ? /* @__PURE__ */ jsx26("p", { className: "adc-state", role: "status", children: messages.loading }) : posts.error !== void 0 ? /* @__PURE__ */ jsxs22("div", { className: "adc-state adc-state--error", role: "alert", children: [
1903
2824
  messages.loadError,
1904
- /* @__PURE__ */ jsx15("button", { type: "button", className: "adc-button", onClick: posts.reload, children: messages.retry })
1905
- ] }) : (posts.data?.data.length ?? 0) === 0 ? /* @__PURE__ */ jsx15("p", { className: "adc-state", children: messages.postsEmpty }) : /* @__PURE__ */ jsx15("div", { className: "adc-card-grid", children: posts.data?.data.map((post) => /* @__PURE__ */ jsx15(PostCard, { post, href: getPostHref(post.slug) }, post.id)) }),
1906
- posts.data && /* @__PURE__ */ jsx15(Pagination, { page, totalPages: posts.data.pagination.totalPages, getPageHref: withTag })
2825
+ /* @__PURE__ */ jsx26("button", { type: "button", className: "adc-button", onClick: posts.reload, children: messages.retry })
2826
+ ] }) : (posts.data?.data.length ?? 0) === 0 ? /* @__PURE__ */ jsx26("p", { className: "adc-state", children: messages.postsEmpty }) : /* @__PURE__ */ jsx26("div", { className: "adc-card-grid", children: posts.data?.data.map((post) => /* @__PURE__ */ jsx26(PostCard, { post, href: getPostHref(post.slug) }, post.id)) }),
2827
+ posts.data && /* @__PURE__ */ jsx26(Pagination, { page, totalPages: posts.data.pagination.totalPages, getPageHref: withTag })
1907
2828
  ] });
1908
2829
  }
1909
2830
 
1910
2831
  // src/components/PostPage.tsx
1911
- import { useEffect as useEffect5 } from "react";
2832
+ import { formatTagLabel as formatTagLabel4 } from "@adatechnology/content-contracts";
2833
+ import { useEffect as useEffect7 } from "react";
1912
2834
 
1913
2835
  // src/components/ShareButtons.tsx
1914
- import { Check, Link2, Share2 } from "lucide-react";
1915
- import { useEffect as useEffect4, useState as useState12 } from "react";
2836
+ import { Check as Check2, Link2, Share2 } from "lucide-react";
2837
+ import { useEffect as useEffect6, useState as useState16 } from "react";
1916
2838
 
1917
2839
  // src/lib/share.ts
1918
2840
  var SHARE_NETWORK = {
@@ -1937,7 +2859,7 @@ function buildShareLinks(params) {
1937
2859
  }
1938
2860
 
1939
2861
  // src/components/ShareButtons.tsx
1940
- import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
2862
+ import { jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
1941
2863
  var NETWORK_LABEL = {
1942
2864
  [SHARE_NETWORK.WHATSAPP]: "shareWhatsApp",
1943
2865
  [SHARE_NETWORK.FACEBOOK]: "shareFacebook",
@@ -1947,10 +2869,10 @@ var NETWORK_LABEL = {
1947
2869
  var COPIED_FEEDBACK_MS = 2e3;
1948
2870
  function ShareButtons({ url, title, networks }) {
1949
2871
  const { messages, format } = useContentText();
1950
- const [isCopied, setIsCopied] = useState12(false);
2872
+ const [isCopied, setIsCopied] = useState16(false);
1951
2873
  const links = buildShareLinks({ url, title }).filter((link) => !networks || networks.includes(link.network));
1952
- const [capabilities, setCapabilities] = useState12({ canShareNatively: false, canCopy: false });
1953
- useEffect4(() => {
2874
+ const [capabilities, setCapabilities] = useState16({ canShareNatively: false, canCopy: false });
2875
+ useEffect6(() => {
1954
2876
  setCapabilities({
1955
2877
  canShareNatively: typeof navigator.share === "function",
1956
2878
  canCopy: Boolean(navigator.clipboard)
@@ -1962,21 +2884,21 @@ function ShareButtons({ url, title, networks }) {
1962
2884
  setIsCopied(true);
1963
2885
  window.setTimeout(() => setIsCopied(false), COPIED_FEEDBACK_MS);
1964
2886
  }
1965
- return /* @__PURE__ */ jsxs13("div", { className: "adc-share", role: "group", "aria-label": messages.shareLabel, children: [
1966
- /* @__PURE__ */ jsx16("span", { className: "adc-label", children: messages.shareLabel }),
1967
- canShareNatively && /* @__PURE__ */ jsxs13(
2887
+ return /* @__PURE__ */ jsxs23("div", { className: "adc-share", role: "group", "aria-label": messages.shareLabel, children: [
2888
+ /* @__PURE__ */ jsx27("span", { className: "adc-label", children: messages.shareLabel }),
2889
+ canShareNatively && /* @__PURE__ */ jsxs23(
1968
2890
  "button",
1969
2891
  {
1970
2892
  type: "button",
1971
2893
  className: "adc-button",
1972
2894
  onClick: () => void navigator.share({ url, title }).catch(() => void 0),
1973
2895
  children: [
1974
- /* @__PURE__ */ jsx16(Share2, { "aria-hidden": "true", className: "adc-icon" }),
2896
+ /* @__PURE__ */ jsx27(Share2, { "aria-hidden": "true", className: "adc-icon" }),
1975
2897
  messages.shareNative
1976
2898
  ]
1977
2899
  }
1978
2900
  ),
1979
- links.map((link) => /* @__PURE__ */ jsx16(
2901
+ links.map((link) => /* @__PURE__ */ jsx27(
1980
2902
  "a",
1981
2903
  {
1982
2904
  className: `adc-button adc-share-link adc-share-link--${link.network}`,
@@ -1988,48 +2910,48 @@ function ShareButtons({ url, title, networks }) {
1988
2910
  },
1989
2911
  link.network
1990
2912
  )),
1991
- canCopy && /* @__PURE__ */ jsxs13("button", { type: "button", className: "adc-button", onClick: () => void handleCopy().catch(() => void 0), children: [
1992
- isCopied ? /* @__PURE__ */ jsx16(Check, { "aria-hidden": "true", className: "adc-icon" }) : /* @__PURE__ */ jsx16(Link2, { "aria-hidden": "true", className: "adc-icon" }),
1993
- /* @__PURE__ */ jsx16("span", { "aria-live": "polite", children: isCopied ? messages.linkCopied : messages.copyLink })
2913
+ canCopy && /* @__PURE__ */ jsxs23("button", { type: "button", className: "adc-button", onClick: () => void handleCopy().catch(() => void 0), children: [
2914
+ isCopied ? /* @__PURE__ */ jsx27(Check2, { "aria-hidden": "true", className: "adc-icon" }) : /* @__PURE__ */ jsx27(Link2, { "aria-hidden": "true", className: "adc-icon" }),
2915
+ /* @__PURE__ */ jsx27("span", { "aria-live": "polite", children: isCopied ? messages.linkCopied : messages.copyLink })
1994
2916
  ] })
1995
2917
  ] });
1996
2918
  }
1997
2919
 
1998
2920
  // src/components/PostPage.tsx
1999
- import { Fragment, jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
2921
+ import { Fragment, jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
2000
2922
  function PostPage({ slug, shareUrl, shareNetworks, getTagHref, onLoaded, renderNotFound }) {
2001
2923
  const api = useContentPublicApi();
2002
2924
  const { messages, locale, format } = useContentText();
2003
2925
  const renderLink = useRenderLink();
2004
2926
  const resource = useAsyncResource(() => api.getPublishedPost(slug), slug);
2005
2927
  const post = resource.data;
2006
- useEffect5(() => {
2928
+ useEffect7(() => {
2007
2929
  if (post) onLoaded?.(post);
2008
2930
  }, [post, onLoaded]);
2009
2931
  if (resource.isLoading && !post) {
2010
- return /* @__PURE__ */ jsx17("p", { className: "adc-root adc-state", role: "status", children: messages.loading });
2932
+ return /* @__PURE__ */ jsx28("p", { className: "adc-root adc-state", role: "status", children: messages.loading });
2011
2933
  }
2012
2934
  if (!post) {
2013
- return /* @__PURE__ */ jsx17(Fragment, { children: renderNotFound ? renderNotFound() : /* @__PURE__ */ jsx17("p", { className: "adc-root adc-state", children: messages.notFound }) });
2935
+ return /* @__PURE__ */ jsx28(Fragment, { children: renderNotFound ? renderNotFound() : /* @__PURE__ */ jsx28("p", { className: "adc-root adc-state", children: messages.notFound }) });
2014
2936
  }
2015
2937
  const url = shareUrl ?? (typeof window !== "undefined" ? window.location.href : "");
2016
- return /* @__PURE__ */ jsxs14("article", { className: "adc-root adc-post", children: [
2017
- /* @__PURE__ */ jsxs14("header", { className: "adc-post-header", children: [
2018
- /* @__PURE__ */ jsx17("h1", { className: "adc-page-title", children: post.title }),
2019
- /* @__PURE__ */ jsxs14("p", { className: "adc-meta", children: [
2020
- /* @__PURE__ */ jsx17("time", { dateTime: post.publishedAt, children: formatPostDate(post.publishedAt, locale) }),
2021
- /* @__PURE__ */ jsx17("span", { "aria-hidden": "true", children: " \xB7 " }),
2938
+ return /* @__PURE__ */ jsxs24("article", { className: "adc-root adc-post", children: [
2939
+ /* @__PURE__ */ jsxs24("header", { className: "adc-post-header", children: [
2940
+ /* @__PURE__ */ jsx28("h1", { className: "adc-page-title", children: post.title }),
2941
+ /* @__PURE__ */ jsxs24("p", { className: "adc-meta", children: [
2942
+ /* @__PURE__ */ jsx28("time", { dateTime: post.publishedAt, children: formatPostDate(post.publishedAt, locale) }),
2943
+ /* @__PURE__ */ jsx28("span", { "aria-hidden": "true", children: " \xB7 " }),
2022
2944
  format("readingTime", { minutes: post.readingTimeMinutes }),
2023
- post.authorName && /* @__PURE__ */ jsxs14(Fragment, { children: [
2024
- /* @__PURE__ */ jsx17("span", { "aria-hidden": "true", children: " \xB7 " }),
2945
+ post.authorName && /* @__PURE__ */ jsxs24(Fragment, { children: [
2946
+ /* @__PURE__ */ jsx28("span", { "aria-hidden": "true", children: " \xB7 " }),
2025
2947
  format("byAuthor", { author: post.authorName })
2026
2948
  ] })
2027
2949
  ] }),
2028
- post.tags.length > 0 && /* @__PURE__ */ jsx17("ul", { className: "adc-tag-list", children: post.tags.map((tag) => /* @__PURE__ */ jsx17("li", { className: "adc-tag", children: getTagHref ? renderLink({ href: getTagHref(tag), children: tag }) : tag }, tag)) })
2950
+ post.tags.length > 0 && /* @__PURE__ */ jsx28("ul", { className: "adc-tag-list", children: post.tags.map((tag) => /* @__PURE__ */ jsx28("li", { className: "adc-tag", children: getTagHref ? renderLink({ href: getTagHref(tag), children: formatTagLabel4(tag, post.tagLabels) }) : formatTagLabel4(tag, post.tagLabels) }, tag)) })
2029
2951
  ] }),
2030
- post.coverImageUrl && /* @__PURE__ */ jsx17("img", { className: "adc-post-cover", src: post.coverImageUrl, alt: post.coverImageAlt ?? "", decoding: "async" }),
2031
- /* @__PURE__ */ jsx17(MarkdownContent, { markdown: post.body, headingLevelOffset: 1 }),
2032
- url && shareNetworks?.length !== 0 && /* @__PURE__ */ jsx17(ShareButtons, { url, title: post.title, ...shareNetworks ? { networks: shareNetworks } : {} })
2952
+ post.coverImageUrl && /* @__PURE__ */ jsx28("img", { className: "adc-post-cover", src: post.coverImageUrl, alt: post.coverImageAlt ?? "", decoding: "async" }),
2953
+ /* @__PURE__ */ jsx28(MarkdownContent, { markdown: post.body, headingLevelOffset: 1 }),
2954
+ url && shareNetworks?.length !== 0 && /* @__PURE__ */ jsx28(ShareButtons, { url, title: post.title, ...shareNetworks ? { networks: shareNetworks } : {} })
2033
2955
  ] });
2034
2956
  }
2035
2957
 
@@ -2071,6 +2993,8 @@ export {
2071
2993
  FilePicker,
2072
2994
  MarkdownContent,
2073
2995
  MarkdownEditor,
2996
+ PAGE_SIZE_OPTIONS,
2997
+ POST_LIST_TAB,
2074
2998
  Pagination,
2075
2999
  PostCard,
2076
3000
  PostEditor,
@@ -2082,6 +3006,7 @@ export {
2082
3006
  ShareButtons,
2083
3007
  StatusChip,
2084
3008
  TagsInput,
3009
+ Tooltip,
2085
3010
  buildPageItems,
2086
3011
  buildPostMeta,
2087
3012
  buildShareLinks,
@@ -2095,8 +3020,10 @@ export {
2095
3020
  insertText,
2096
3021
  interpolate,
2097
3022
  isDraftDirty,
3023
+ parseListUrlState,
2098
3024
  resolveContentMessages,
2099
3025
  searchEmoji,
3026
+ serializeListUrlState,
2100
3027
  splitTagInput,
2101
3028
  toDateTimeLocalValue,
2102
3029
  toggleLinePrefix,