@panneau/forms 5.0.0-alpha.28 → 5.0.0-alpha.29

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.
@@ -3,7 +3,7 @@ import Form_module_default from "../Form.module.js";
3
3
  import { useFormState } from "../context.js";
4
4
  import { c } from "react/compiler-runtime";
5
5
  import { selectValue } from "@panneau/core";
6
- import { Badge, usePanneauIntl } from "@panneau/ui";
6
+ import { Badge, Button, usePanneauIntl } from "@panneau/ui";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { useId, useState } from "react";
9
9
  //#region src/publication/Publication.tsx
@@ -12,106 +12,89 @@ function toDate(value) {
12
12
  const date = new Date(value);
13
13
  return Number.isNaN(date.getTime()) ? null : date;
14
14
  }
15
- /**
16
- * The publication of an item (decision 0065): a `component` node of the form layout that frames
17
- * the fields of its children (whether it is published, its date, its status) under a summary of
18
- * the state, `Published`, `Scheduled` or `Not published`, with its date. A status with an option
19
- * gives the state its label and tone. The fields stay at the top of the resource, where lists can
20
- * filter and sort them.
21
- *
22
- * ```jsonc
23
- * { "type": "component", "component": "publication", "children": [
24
- * { "type": "field", "name": "published" },
25
- * { "type": "field", "name": "published_at" },
26
- * { "type": "field", "name": "status" }
27
- * ] }
28
- * ```
29
- */
30
- function Publication(t0) {
31
- const $ = c(51);
32
- const { node, form, fields, children, published: t1, publishedAt: t2, status: t3 } = t0;
33
- const published = t1 === void 0 ? "published" : t1;
34
- const publishedAt = t2 === void 0 ? "published_at" : t2;
35
- const status = t3 === void 0 ? "status" : t3;
15
+ /** The state of the publication of the form's item, from the values of its fields. */
16
+ function usePublicationSummary(form, fields, t0) {
17
+ const $ = c(37);
18
+ const { published, publishedAt, status } = t0;
36
19
  const intl = usePanneauIntl();
37
20
  const state = useFormState(form);
38
- const titleId = useId();
39
21
  const [now] = useState(_temp);
40
- let t4;
22
+ let t1;
41
23
  if ($[0] !== published || $[1] !== state) {
42
- t4 = selectValue(state, published);
24
+ t1 = selectValue(state, published);
43
25
  $[0] = published;
44
26
  $[1] = state;
45
- $[2] = t4;
46
- } else t4 = $[2];
47
- const isPublished = t4;
27
+ $[2] = t1;
28
+ } else t1 = $[2];
29
+ const isPublished = t1;
30
+ let live;
48
31
  let option;
49
32
  let summary;
50
33
  if ($[3] !== fields || $[4] !== intl || $[5] !== isPublished || $[6] !== now || $[7] !== publishedAt || $[8] !== state || $[9] !== status) {
51
34
  const date = toDate(selectValue(state, publishedAt));
52
- let t5;
53
- if ($[12] !== state || $[13] !== status) {
54
- t5 = selectValue(state, status);
55
- $[12] = state;
56
- $[13] = status;
57
- $[14] = t5;
58
- } else t5 = $[14];
59
- const statusValue = t5;
60
- let t6;
61
- if ($[15] !== fields || $[16] !== status || $[17] !== statusValue) {
62
- t6 = fields.get(status)?.options?.find((candidate) => String(candidate.value) === String(statusValue));
63
- $[15] = fields;
64
- $[16] = status;
65
- $[17] = statusValue;
66
- $[18] = t6;
67
- } else t6 = $[18];
68
- option = t6;
35
+ let t2;
36
+ if ($[13] !== state || $[14] !== status) {
37
+ t2 = selectValue(state, status);
38
+ $[13] = state;
39
+ $[14] = status;
40
+ $[15] = t2;
41
+ } else t2 = $[15];
42
+ const statusValue = t2;
43
+ let t3;
44
+ if ($[16] !== fields || $[17] !== status || $[18] !== statusValue) {
45
+ t3 = fields.get(status)?.options?.find((candidate) => String(candidate.value) === String(statusValue));
46
+ $[16] = fields;
47
+ $[17] = status;
48
+ $[18] = statusValue;
49
+ $[19] = t3;
50
+ } else t3 = $[19];
51
+ option = t3;
69
52
  const formatted = date !== null ? intl.formatDate(date, { dateStyle: "medium" }) : null;
70
53
  const scheduled = date !== null && date.getTime() > now;
71
- const live = isPublished === true || isPublished === void 0 && date !== null;
54
+ live = isPublished === true || isPublished === void 0 && date !== null;
72
55
  if (live && scheduled) summary = {
73
56
  label: intl.formatMessage(messages.publication.scheduled),
74
57
  tone: "info",
75
58
  detail: formatted !== null ? intl.formatMessage(messages.publication.scheduledFor, { date: formatted }) : null
76
59
  };
77
60
  else if (live) {
78
- let t7;
79
- if ($[19] !== intl) {
80
- t7 = intl.formatMessage(messages.publication.published);
81
- $[19] = intl;
82
- $[20] = t7;
83
- } else t7 = $[20];
84
- const t8 = formatted !== null ? intl.formatMessage(messages.publication.publishedOn, { date: formatted }) : null;
85
- let t9;
86
- if ($[21] !== t7 || $[22] !== t8) {
87
- t9 = {
88
- label: t7,
61
+ let t4;
62
+ if ($[20] !== intl) {
63
+ t4 = intl.formatMessage(messages.publication.published);
64
+ $[20] = intl;
65
+ $[21] = t4;
66
+ } else t4 = $[21];
67
+ const t5 = formatted !== null ? intl.formatMessage(messages.publication.publishedOn, { date: formatted }) : null;
68
+ let t6;
69
+ if ($[22] !== t4 || $[23] !== t5) {
70
+ t6 = {
71
+ label: t4,
89
72
  tone: "success",
90
- detail: t8
73
+ detail: t5
91
74
  };
92
- $[21] = t7;
93
- $[22] = t8;
94
- $[23] = t9;
95
- } else t9 = $[23];
96
- summary = t9;
75
+ $[22] = t4;
76
+ $[23] = t5;
77
+ $[24] = t6;
78
+ } else t6 = $[24];
79
+ summary = t6;
97
80
  } else {
98
- let t7;
99
- if ($[24] !== intl) {
100
- t7 = intl.formatMessage(messages.publication.unpublished);
101
- $[24] = intl;
102
- $[25] = t7;
103
- } else t7 = $[25];
104
- let t8;
105
- if ($[26] !== t7) {
106
- t8 = {
107
- label: t7,
81
+ let t4;
82
+ if ($[25] !== intl) {
83
+ t4 = intl.formatMessage(messages.publication.unpublished);
84
+ $[25] = intl;
85
+ $[26] = t4;
86
+ } else t4 = $[26];
87
+ let t5;
88
+ if ($[27] !== t4) {
89
+ t5 = {
90
+ label: t4,
108
91
  tone: "neutral",
109
92
  detail: null
110
93
  };
111
- $[26] = t7;
112
- $[27] = t8;
113
- } else t8 = $[27];
114
- summary = t8;
94
+ $[27] = t4;
95
+ $[28] = t5;
96
+ } else t5 = $[28];
97
+ summary = t5;
115
98
  }
116
99
  $[3] = fields;
117
100
  $[4] = intl;
@@ -120,99 +103,325 @@ function Publication(t0) {
120
103
  $[7] = publishedAt;
121
104
  $[8] = state;
122
105
  $[9] = status;
123
- $[10] = option;
124
- $[11] = summary;
106
+ $[10] = live;
107
+ $[11] = option;
108
+ $[12] = summary;
125
109
  } else {
126
- option = $[10];
127
- summary = $[11];
110
+ live = $[10];
111
+ option = $[11];
112
+ summary = $[12];
128
113
  }
129
114
  if (option !== void 0) {
130
- const t5 = option.tone ?? "neutral";
131
- let t6;
132
- if ($[28] !== option.label || $[29] !== summary || $[30] !== t5) {
133
- t6 = {
115
+ const t2 = option.tone ?? "neutral";
116
+ let t3;
117
+ if ($[29] !== option.label || $[30] !== summary || $[31] !== t2) {
118
+ t3 = {
134
119
  ...summary,
135
120
  label: option.label,
136
- tone: t5
121
+ tone: t2
137
122
  };
138
- $[28] = option.label;
139
- $[29] = summary;
140
- $[30] = t5;
141
- $[31] = t6;
142
- } else t6 = $[31];
143
- summary = t6;
123
+ $[29] = option.label;
124
+ $[30] = summary;
125
+ $[31] = t2;
126
+ $[32] = t3;
127
+ } else t3 = $[32];
128
+ summary = t3;
144
129
  }
130
+ let t2;
131
+ if ($[33] !== live || $[34] !== state || $[35] !== summary) {
132
+ t2 = {
133
+ summary,
134
+ state,
135
+ live
136
+ };
137
+ $[33] = live;
138
+ $[34] = state;
139
+ $[35] = summary;
140
+ $[36] = t2;
141
+ } else t2 = $[36];
142
+ return t2;
143
+ }
144
+ /**
145
+ * The publication of an item (decision 0065): a `component` node of the form layout that frames
146
+ * the fields of its children (whether it is published, its date, its status) under a summary of
147
+ * the state, `Published`, `Scheduled` or `Not published`, with its date. A status with an option
148
+ * gives the state its label and tone. The fields stay at the top of the resource, where lists can
149
+ * filter and sort them.
150
+ *
151
+ * ```jsonc
152
+ * { "type": "component", "component": "publication", "children": [
153
+ * { "type": "field", "name": "published" },
154
+ * { "type": "field", "name": "published_at" },
155
+ * { "type": "field", "name": "status" }
156
+ * ] }
157
+ * ```
158
+ */
159
+ function _temp() {
160
+ return Date.now();
161
+ }
162
+ function Publication(t0) {
163
+ const $ = c(23);
164
+ const { node, form, fields, children, published: t1, publishedAt: t2, status: t3 } = t0;
165
+ const published = t1 === void 0 ? "published" : t1;
166
+ const publishedAt = t2 === void 0 ? "published_at" : t2;
167
+ const status = t3 === void 0 ? "status" : t3;
168
+ const intl = usePanneauIntl();
169
+ const titleId = useId();
170
+ let t4;
171
+ if ($[0] !== published || $[1] !== publishedAt || $[2] !== status) {
172
+ t4 = {
173
+ published,
174
+ publishedAt,
175
+ status
176
+ };
177
+ $[0] = published;
178
+ $[1] = publishedAt;
179
+ $[2] = status;
180
+ $[3] = t4;
181
+ } else t4 = $[3];
182
+ const { summary } = usePublicationSummary(form, fields, t4);
145
183
  let t5;
146
- if ($[32] !== intl || $[33] !== node.label) {
184
+ if ($[4] !== intl || $[5] !== node.label) {
147
185
  t5 = node.label ?? intl.formatMessage(messages.publication.title);
148
- $[32] = intl;
149
- $[33] = node.label;
150
- $[34] = t5;
151
- } else t5 = $[34];
186
+ $[4] = intl;
187
+ $[5] = node.label;
188
+ $[6] = t5;
189
+ } else t5 = $[6];
152
190
  let t6;
153
- if ($[35] !== summary.label || $[36] !== summary.tone) {
191
+ if ($[7] !== summary.label || $[8] !== summary.tone) {
154
192
  t6 = /* @__PURE__ */ jsx(Badge, {
155
193
  tone: summary.tone,
156
194
  children: summary.label
157
195
  });
158
- $[35] = summary.label;
159
- $[36] = summary.tone;
160
- $[37] = t6;
161
- } else t6 = $[37];
196
+ $[7] = summary.label;
197
+ $[8] = summary.tone;
198
+ $[9] = t6;
199
+ } else t6 = $[9];
162
200
  let t7;
163
- if ($[38] !== t5 || $[39] !== t6 || $[40] !== titleId) {
201
+ if ($[10] !== t5 || $[11] !== t6 || $[12] !== titleId) {
164
202
  t7 = /* @__PURE__ */ jsxs("h3", {
165
203
  id: titleId,
166
204
  className: Form_module_default.sectionTitle,
167
205
  children: [t5, t6]
168
206
  });
169
- $[38] = t5;
170
- $[39] = t6;
171
- $[40] = titleId;
172
- $[41] = t7;
173
- } else t7 = $[41];
207
+ $[10] = t5;
208
+ $[11] = t6;
209
+ $[12] = titleId;
210
+ $[13] = t7;
211
+ } else t7 = $[13];
174
212
  let t8;
175
- if ($[42] !== summary.detail) {
213
+ if ($[14] !== summary.detail) {
176
214
  t8 = summary.detail !== null ? /* @__PURE__ */ jsx("p", {
177
215
  className: Form_module_default.sectionDescription,
178
216
  children: summary.detail
179
217
  }) : null;
180
- $[42] = summary.detail;
181
- $[43] = t8;
182
- } else t8 = $[43];
218
+ $[14] = summary.detail;
219
+ $[15] = t8;
220
+ } else t8 = $[15];
183
221
  let t9;
184
- if ($[44] !== t7 || $[45] !== t8) {
222
+ if ($[16] !== t7 || $[17] !== t8) {
185
223
  t9 = /* @__PURE__ */ jsxs("div", {
186
224
  className: Form_module_default.sectionHeader,
187
225
  children: [t7, t8]
188
226
  });
189
- $[44] = t7;
190
- $[45] = t8;
191
- $[46] = t9;
192
- } else t9 = $[46];
227
+ $[16] = t7;
228
+ $[17] = t8;
229
+ $[18] = t9;
230
+ } else t9 = $[18];
193
231
  let t10;
194
- if ($[47] !== children || $[48] !== t9 || $[49] !== titleId) {
232
+ if ($[19] !== children || $[20] !== t9 || $[21] !== titleId) {
195
233
  t10 = /* @__PURE__ */ jsxs("section", {
196
234
  className: Form_module_default.section,
197
235
  "aria-labelledby": titleId,
198
236
  children: [t9, children]
199
237
  });
200
- $[47] = children;
201
- $[48] = t9;
202
- $[49] = titleId;
203
- $[50] = t10;
204
- } else t10 = $[50];
238
+ $[19] = children;
239
+ $[20] = t9;
240
+ $[21] = titleId;
241
+ $[22] = t10;
242
+ } else t10 = $[22];
205
243
  return t10;
206
244
  }
207
- /** The `publication` layout component, as a `@panneau/core` plugin. */
208
- function _temp() {
209
- return Date.now();
245
+ /** Now, as the value of a `date` field (`2026-11-09`, local) or of a `datetime` one (ISO). */
246
+ function nowValue(field) {
247
+ const date = /* @__PURE__ */ new Date();
248
+ if (field.type === "date") {
249
+ const pad = (value) => String(value).padStart(2, "0");
250
+ return `${String(date.getFullYear())}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
251
+ }
252
+ return date.toISOString().replace(/\.\d{3}Z$/, "Z");
253
+ }
254
+ /**
255
+ * The `publication` panel of a form's sidebar (decision 0075): the state of the item, as the
256
+ * `publication` component shows it, its fields, and a Publish button, or Unpublish once it is
257
+ * published, which sets the publication and saves. Publishing sets `published` to `true`, or else
258
+ * the status to `publishedStatus`, and the date to now when it is empty. Without a `published`
259
+ * field nor a status with the option, the panel has no button.
260
+ */
261
+ function PublicationPanel(t0) {
262
+ const $ = c(56);
263
+ const { form, fields, children, published: t1, publishedAt: t2, status: t3, publishedStatus: t4, draftStatus: t5 } = t0;
264
+ const published = t1 === void 0 ? "published" : t1;
265
+ const publishedAt = t2 === void 0 ? "published_at" : t2;
266
+ const status = t3 === void 0 ? "status" : t3;
267
+ const publishedStatus = t4 === void 0 ? "published" : t4;
268
+ const draftStatus = t5 === void 0 ? "draft" : t5;
269
+ const intl = usePanneauIntl();
270
+ let t6;
271
+ if ($[0] !== published || $[1] !== publishedAt || $[2] !== status) {
272
+ t6 = {
273
+ published,
274
+ publishedAt,
275
+ status
276
+ };
277
+ $[0] = published;
278
+ $[1] = publishedAt;
279
+ $[2] = status;
280
+ $[3] = t6;
281
+ } else t6 = $[3];
282
+ const { summary, state, live } = usePublicationSummary(form, fields, t6);
283
+ let t7;
284
+ if ($[4] !== fields || $[5] !== published) {
285
+ t7 = fields.get(published);
286
+ $[4] = fields;
287
+ $[5] = published;
288
+ $[6] = t7;
289
+ } else t7 = $[6];
290
+ const publishedField = t7;
291
+ let byFlag;
292
+ let dateField;
293
+ let t8;
294
+ if ($[7] !== fields || $[8] !== publishedAt || $[9] !== publishedField || $[10] !== publishedStatus || $[11] !== status) {
295
+ const statusField = fields.get(status);
296
+ let t9;
297
+ if ($[15] !== fields || $[16] !== publishedAt) {
298
+ t9 = fields.get(publishedAt);
299
+ $[15] = fields;
300
+ $[16] = publishedAt;
301
+ $[17] = t9;
302
+ } else t9 = $[17];
303
+ dateField = t9;
304
+ const hasStatus = (value) => statusField?.options?.some((option) => String(option.value) === value) === true;
305
+ byFlag = publishedField !== void 0;
306
+ t8 = !byFlag && hasStatus(publishedStatus);
307
+ $[7] = fields;
308
+ $[8] = publishedAt;
309
+ $[9] = publishedField;
310
+ $[10] = publishedStatus;
311
+ $[11] = status;
312
+ $[12] = byFlag;
313
+ $[13] = dateField;
314
+ $[14] = t8;
315
+ } else {
316
+ byFlag = $[12];
317
+ dateField = $[13];
318
+ t8 = $[14];
319
+ }
320
+ const byStatus = t8;
321
+ let t9;
322
+ if ($[18] !== byFlag || $[19] !== byStatus || $[20] !== live || $[21] !== published || $[22] !== publishedStatus || $[23] !== state || $[24] !== status) {
323
+ t9 = byFlag ? selectValue(state, published) === true : byStatus ? String(selectValue(state, status)) === publishedStatus : live;
324
+ $[18] = byFlag;
325
+ $[19] = byStatus;
326
+ $[20] = live;
327
+ $[21] = published;
328
+ $[22] = publishedStatus;
329
+ $[23] = state;
330
+ $[24] = status;
331
+ $[25] = t9;
332
+ } else t9 = $[25];
333
+ const isLive = t9;
334
+ let t10;
335
+ if ($[26] !== byFlag || $[27] !== byStatus || $[28] !== dateField || $[29] !== draftStatus || $[30] !== form || $[31] !== isLive || $[32] !== published || $[33] !== publishedAt || $[34] !== publishedStatus || $[35] !== status) {
336
+ t10 = () => {
337
+ if (byFlag) form.setValue(published, !isLive);
338
+ else if (byStatus) form.setValue(status, isLive ? draftStatus : publishedStatus);
339
+ if (!isLive && dateField !== void 0 && toDate(form.getValue(publishedAt)) === null) form.setValue(publishedAt, nowValue(dateField));
340
+ };
341
+ $[26] = byFlag;
342
+ $[27] = byStatus;
343
+ $[28] = dateField;
344
+ $[29] = draftStatus;
345
+ $[30] = form;
346
+ $[31] = isLive;
347
+ $[32] = published;
348
+ $[33] = publishedAt;
349
+ $[34] = publishedStatus;
350
+ $[35] = status;
351
+ $[36] = t10;
352
+ } else t10 = $[36];
353
+ const toggle = t10;
354
+ let t11;
355
+ if ($[37] !== summary.label || $[38] !== summary.tone) {
356
+ t11 = /* @__PURE__ */ jsx(Badge, {
357
+ tone: summary.tone,
358
+ children: summary.label
359
+ });
360
+ $[37] = summary.label;
361
+ $[38] = summary.tone;
362
+ $[39] = t11;
363
+ } else t11 = $[39];
364
+ let t12;
365
+ if ($[40] !== summary.detail) {
366
+ t12 = summary.detail !== null ? /* @__PURE__ */ jsx("span", {
367
+ className: Form_module_default.sectionDescription,
368
+ children: summary.detail
369
+ }) : null;
370
+ $[40] = summary.detail;
371
+ $[41] = t12;
372
+ } else t12 = $[41];
373
+ let t13;
374
+ if ($[42] !== t11 || $[43] !== t12) {
375
+ t13 = /* @__PURE__ */ jsxs("div", {
376
+ className: Form_module_default.publicationState,
377
+ children: [t11, t12]
378
+ });
379
+ $[42] = t11;
380
+ $[43] = t12;
381
+ $[44] = t13;
382
+ } else t13 = $[44];
383
+ let t14;
384
+ if ($[45] !== byFlag || $[46] !== byStatus || $[47] !== intl || $[48] !== isLive || $[49] !== state || $[50] !== toggle) {
385
+ t14 = byFlag || byStatus ? /* @__PURE__ */ jsx(Button, {
386
+ type: "submit",
387
+ tone: isLive ? "neutral" : "accent",
388
+ appearance: isLive ? "outline" : "solid",
389
+ isPending: state.status === "submitting",
390
+ onPress: toggle,
391
+ children: intl.formatMessage(isLive ? messages.publication.unpublish : messages.publication.publish)
392
+ }) : null;
393
+ $[45] = byFlag;
394
+ $[46] = byStatus;
395
+ $[47] = intl;
396
+ $[48] = isLive;
397
+ $[49] = state;
398
+ $[50] = toggle;
399
+ $[51] = t14;
400
+ } else t14 = $[51];
401
+ let t15;
402
+ if ($[52] !== children || $[53] !== t13 || $[54] !== t14) {
403
+ t15 = /* @__PURE__ */ jsxs("div", {
404
+ className: Form_module_default.stack,
405
+ children: [
406
+ t13,
407
+ children,
408
+ t14
409
+ ]
410
+ });
411
+ $[52] = children;
412
+ $[53] = t13;
413
+ $[54] = t14;
414
+ $[55] = t15;
415
+ } else t15 = $[55];
416
+ return t15;
210
417
  }
418
+ /** The `publication` layout component and panel, as a `@panneau/core` plugin. */
211
419
  var publicationPlugin = {
212
420
  id: "panneau.publication",
213
- components: { publication: Publication }
421
+ components: { publication: Publication },
422
+ panels: { publication: PublicationPanel }
214
423
  };
215
424
  //#endregion
216
- export { Publication, publicationPlugin };
425
+ export { Publication, PublicationPanel, publicationPlugin };
217
426
 
218
427
  //# sourceMappingURL=Publication.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Publication.js","names":["useId","useState","selectValue","Option","Badge","Tone","usePanneauIntl","styles","useFormState","LayoutComponentProps","messages","PublicationProps","published","publishedAt","status","PublicationState","label","tone","detail","toDate","value","Date","date","Number","isNaN","getTime","Publication","t0","$","_c","node","form","fields","children","t1","t2","t3","undefined","intl","state","titleId","now","_temp","t4","isPublished","option","summary","t5","statusValue","t6","get","options","find","candidate","String","formatted","formatDate","dateStyle","scheduled","live","formatMessage","publication","scheduledFor","t7","t8","publishedOn","t9","unpublished","title","sectionTitle","sectionDescription","sectionHeader","t10","section","publicationPlugin","id","components","_c","styles"],"sources":["../../src/publication/Publication.tsx"],"sourcesContent":["import { useId, useState } from 'react';\n\nimport { selectValue } from '@panneau/core';\nimport type { Option } from '@panneau/protocol';\nimport { Badge, type Tone, usePanneauIntl } from '@panneau/ui';\n\nimport styles from '../Form.module.css';\nimport { useFormState } from '../context';\nimport type { LayoutComponentProps } from '../layout/Layout';\nimport { messages } from '../messages';\n\nexport interface PublicationProps extends LayoutComponentProps {\n /** The field that says whether the item is published, a `boolean`. Defaults to `published`. */\n published?: string;\n /** The field of the publication date, a `date` or a `datetime`. Defaults to `published_at`. */\n publishedAt?: string;\n /** The field of the status, a `select` whose options have tones. Defaults to `status`. */\n status?: string;\n}\n\ninterface PublicationState {\n label: string;\n tone: Tone;\n /** \"Published on Nov 3, 2026\", or `null` without a date. */\n detail: string | null;\n}\n\nfunction toDate(value: unknown): Date | null {\n if (typeof value !== 'string' || value === '') {\n return null;\n }\n const date = new Date(value);\n return Number.isNaN(date.getTime()) ? null : date;\n}\n\n/**\n * The publication of an item (decision 0065): a `component` node of the form layout that frames\n * the fields of its children (whether it is published, its date, its status) under a summary of\n * the state, `Published`, `Scheduled` or `Not published`, with its date. A status with an option\n * gives the state its label and tone. The fields stay at the top of the resource, where lists can\n * filter and sort them.\n *\n * ```jsonc\n * { \"type\": \"component\", \"component\": \"publication\", \"children\": [\n * { \"type\": \"field\", \"name\": \"published\" },\n * { \"type\": \"field\", \"name\": \"published_at\" },\n * { \"type\": \"field\", \"name\": \"status\" }\n * ] }\n * ```\n */\nexport function Publication({\n node,\n form,\n fields,\n children,\n published = 'published',\n publishedAt = 'published_at',\n status = 'status',\n}: PublicationProps) {\n const intl = usePanneauIntl();\n const state = useFormState(form);\n const titleId = useId();\n const [now] = useState(() => Date.now());\n const isPublished = selectValue(state, published);\n const date = toDate(selectValue(state, publishedAt));\n const statusValue = selectValue(state, status);\n const option: Option | undefined = fields\n .get(status)\n ?.options?.find((candidate) => String(candidate.value) === String(statusValue));\n const formatted = date !== null ? intl.formatDate(date, { dateStyle: 'medium' }) : null;\n const scheduled = date !== null && date.getTime() > now;\n const live = isPublished === true || (isPublished === undefined && date !== null);\n let summary: PublicationState;\n if (live && scheduled) {\n summary = {\n label: intl.formatMessage(messages.publication.scheduled),\n tone: 'info',\n detail:\n formatted !== null\n ? intl.formatMessage(messages.publication.scheduledFor, { date: formatted })\n : null,\n };\n } else if (live) {\n summary = {\n label: intl.formatMessage(messages.publication.published),\n tone: 'success',\n detail:\n formatted !== null\n ? intl.formatMessage(messages.publication.publishedOn, { date: formatted })\n : null,\n };\n } else {\n summary = {\n label: intl.formatMessage(messages.publication.unpublished),\n tone: 'neutral',\n detail: null,\n };\n }\n if (option !== undefined) {\n // The status of the site says more than the published flag: \"Draft\", \"In review\".\n summary = {\n ...summary,\n label: option.label,\n tone: (option.tone as Tone | undefined) ?? 'neutral',\n };\n }\n return (\n <section className={styles.section} aria-labelledby={titleId}>\n <div className={styles.sectionHeader}>\n <h3 id={titleId} className={styles.sectionTitle}>\n {node.label ?? intl.formatMessage(messages.publication.title)}\n <Badge tone={summary.tone}>{summary.label}</Badge>\n </h3>\n {summary.detail !== null ? (\n <p className={styles.sectionDescription}>{summary.detail}</p>\n ) : null}\n </div>\n {children}\n </section>\n );\n}\n\n/** The `publication` layout component, as a `@panneau/core` plugin. */\nexport const publicationPlugin = {\n id: 'panneau.publication',\n components: { publication: Publication },\n};\n"],"mappings":";;;;;;;;;AA2BA,SAASmB,OAAOC,OAA6B;CACzC,IAAI,OAAOA,UAAU,YAAYA,UAAU,IACvC,OAAO;CAEX,MAAME,OAAO,IAAID,KAAKD,KAAK;CAC3B,OAAOG,OAAOC,MAAMF,KAAKG,QAAQ,CAAC,IAAI,OAAOH;AACjD;;;;;;;;;;;;;;;;AAiBA,SAAOI,YAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAqB,MAAA,EAAAC,MAAAC,MAAAC,QAAAC,UAAArB,WAAAsB,IAAArB,aAAAsB,IAAArB,QAAAsB,OAAAT;CAKxB,MAAAf,YAAAsB,OAAAG,KAAAA,IAAA,cAAAH;CACA,MAAArB,cAAAsB,OAAAE,KAAAA,IAAA,iBAAAF;CACA,MAAArB,SAAAsB,OAAAC,KAAAA,IAAA,WAAAD;CAEA,MAAAE,OAAahC,eAAe;CAC5B,MAAAiC,QAAc/B,aAAauB,IAAI;CAC/B,MAAAS,UAAgBxC,MAAM;CACtB,MAAA,CAAAyC,OAAcxC,SAASyC,KAAgB;CAAE,IAAAC;CAAA,IAAAf,EAAA,OAAAhB,aAAAgB,EAAA,OAAAW,OAAA;EACrBI,KAAAzC,YAAYqC,OAAO3B,SAAS;EAACgB,EAAA,KAAAhB;EAAAgB,EAAA,KAAAW;EAAAX,EAAA,KAAAe;CAAA,OAAAA,KAAAf,EAAA;CAAjD,MAAAgB,cAAoBD;CAA8B,IA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lB,QAAO5B,WAAY,OAChB,oBAAA,KAAA;GAAc,WAAAX,oBAAM+D;GAAsBxB,UAAAA,QAAO5B;EAAY,CAAA,IADhE;EAEOU,EAAA,MAAAkB,QAAA5B;EAAAU,EAAA,MAAAoC;CAAA,OAAAA,KAAApC,EAAA;CAAA,IAAAsC;CAAA,IAAAtC,EAAA,QAAAmC,MAAAnC,EAAA,QAAAoC,IAAA;EAPZE,KAAA,qBAAA,OAAA;GAAgB,WAAA3D,oBAAMgE;GAAtB,UAAA,CACIR,IAICC,EAGC;;EAAApC,EAAA,MAAAmC;EAAAnC,EAAA,MAAAoC;EAAApC,EAAA,MAAAsC;CAAA,OAAAA,KAAAtC,EAAA;CAAA,IAAA4C;CAAA,IAAA5C,EAAA,QAAAK,YAAAL,EAAA,QAAAsC,MAAAtC,EAAA,QAAAY,SAAA;EATVgC,MAAA,qBAAA,WAAA;GAAoB,WAAAjE,oBAAMkE;GAA2BjC,mBAAAA;GAArD,UAAA,CACI0B,IASCjC,QACK;;EAAAL,EAAA,MAAAK;EAAAL,EAAA,MAAAsC;EAAAtC,EAAA,MAAAY;EAAAZ,EAAA,MAAA4C;CAAA,OAAAA,MAAA5C,EAAA;CAAA,OAXV4C;AAWU;;AApEX,SAAA9B,QAAA;CAAA,OAY0BrB,KAAIoB,IAAK;AAAC;AA6D3C,IAAaiC,oBAAoB;CAC7BC,IAAI;CACJC,YAAY,EAAEf,aAAanC,YAAY;AAC3C"}
1
+ {"version":3,"file":"Publication.js","names":["useId","useState","Form","FormState","selectValue","Field","Option","Badge","Button","Tone","usePanneauIntl","styles","useFormState","LayoutComponentProps","messages","FormPanelProps","PublicationProps","published","publishedAt","status","PublicationState","label","tone","detail","toDate","value","Date","date","Number","isNaN","getTime","PublicationNames","usePublicationSummary","form","fields","t0","$","_c","intl","state","now","_temp","t1","isPublished","live","option","summary","t2","statusValue","t3","get","options","find","candidate","String","formatted","formatDate","dateStyle","scheduled","undefined","formatMessage","publication","scheduledFor","t4","t5","publishedOn","t6","unpublished","Publication","node","children","titleId","title","t7","sectionTitle","t8","sectionDescription","t9","sectionHeader","t10","section","PublicationPanelProps","publishedStatus","draftStatus","nowValue","field","type","pad","padStart","getFullYear","getMonth","getDate","toISOString","replace","PublicationPanel","publishedField","byFlag","dateField","statusField","hasStatus","some","byStatus","isLive","setValue","getValue","toggle","t11","t12","t13","publicationState","t14","unpublish","publish","t15","stack","publicationPlugin","id","components","panels","_c","styles"],"sources":["../../src/publication/Publication.tsx"],"sourcesContent":["import { useId, useState } from 'react';\n\nimport { type Form, type FormState, selectValue } from '@panneau/core';\nimport type { Field, Option } from '@panneau/protocol';\nimport { Badge, Button, type Tone, usePanneauIntl } from '@panneau/ui';\n\nimport styles from '../Form.module.css';\nimport { useFormState } from '../context';\nimport type { LayoutComponentProps } from '../layout/Layout';\nimport { messages } from '../messages';\nimport type { FormPanelProps } from '../panels/panels';\n\nexport interface PublicationProps extends LayoutComponentProps {\n /** The field that says whether the item is published, a `boolean`. Defaults to `published`. */\n published?: string;\n /** The field of the publication date, a `date` or a `datetime`. Defaults to `published_at`. */\n publishedAt?: string;\n /** The field of the status, a `select` whose options have tones. Defaults to `status`. */\n status?: string;\n}\n\ninterface PublicationState {\n label: string;\n tone: Tone;\n /** \"Published on Nov 3, 2026\", or `null` without a date. */\n detail: string | null;\n}\n\nfunction toDate(value: unknown): Date | null {\n if (typeof value !== 'string' || value === '') {\n return null;\n }\n const date = new Date(value);\n return Number.isNaN(date.getTime()) ? null : date;\n}\n\ninterface PublicationNames {\n published: string;\n publishedAt: string;\n status: string;\n}\n\n/** The state of the publication of the form's item, from the values of its fields. */\nfunction usePublicationSummary(\n form: Form,\n fields: ReadonlyMap<string, Field>,\n { published, publishedAt, status }: PublicationNames,\n): { summary: PublicationState; state: FormState; live: boolean } {\n const intl = usePanneauIntl();\n const state = useFormState(form);\n const [now] = useState(() => Date.now());\n const isPublished = selectValue(state, published);\n const date = toDate(selectValue(state, publishedAt));\n const statusValue = selectValue(state, status);\n const option: Option | undefined = fields\n .get(status)\n ?.options?.find((candidate) => String(candidate.value) === String(statusValue));\n const formatted = date !== null ? intl.formatDate(date, { dateStyle: 'medium' }) : null;\n const scheduled = date !== null && date.getTime() > now;\n const live = isPublished === true || (isPublished === undefined && date !== null);\n let summary: PublicationState;\n if (live && scheduled) {\n summary = {\n label: intl.formatMessage(messages.publication.scheduled),\n tone: 'info',\n detail:\n formatted !== null\n ? intl.formatMessage(messages.publication.scheduledFor, { date: formatted })\n : null,\n };\n } else if (live) {\n summary = {\n label: intl.formatMessage(messages.publication.published),\n tone: 'success',\n detail:\n formatted !== null\n ? intl.formatMessage(messages.publication.publishedOn, { date: formatted })\n : null,\n };\n } else {\n summary = {\n label: intl.formatMessage(messages.publication.unpublished),\n tone: 'neutral',\n detail: null,\n };\n }\n if (option !== undefined) {\n // The status of the site says more than the published flag: \"Draft\", \"In review\".\n summary = {\n ...summary,\n label: option.label,\n tone: (option.tone as Tone | undefined) ?? 'neutral',\n };\n }\n return { summary, state, live };\n}\n\n/**\n * The publication of an item (decision 0065): a `component` node of the form layout that frames\n * the fields of its children (whether it is published, its date, its status) under a summary of\n * the state, `Published`, `Scheduled` or `Not published`, with its date. A status with an option\n * gives the state its label and tone. The fields stay at the top of the resource, where lists can\n * filter and sort them.\n *\n * ```jsonc\n * { \"type\": \"component\", \"component\": \"publication\", \"children\": [\n * { \"type\": \"field\", \"name\": \"published\" },\n * { \"type\": \"field\", \"name\": \"published_at\" },\n * { \"type\": \"field\", \"name\": \"status\" }\n * ] }\n * ```\n */\nexport function Publication({\n node,\n form,\n fields,\n children,\n published = 'published',\n publishedAt = 'published_at',\n status = 'status',\n}: PublicationProps) {\n const intl = usePanneauIntl();\n const titleId = useId();\n const { summary } = usePublicationSummary(form, fields, { published, publishedAt, status });\n return (\n <section className={styles.section} aria-labelledby={titleId}>\n <div className={styles.sectionHeader}>\n <h3 id={titleId} className={styles.sectionTitle}>\n {node.label ?? intl.formatMessage(messages.publication.title)}\n <Badge tone={summary.tone}>{summary.label}</Badge>\n </h3>\n {summary.detail !== null ? (\n <p className={styles.sectionDescription}>{summary.detail}</p>\n ) : null}\n </div>\n {children}\n </section>\n );\n}\n\nexport interface PublicationPanelProps extends FormPanelProps {\n /** The field that says whether the item is published, a `boolean`. Defaults to `published`. */\n published?: string;\n /** The field of the publication date, a `date` or a `datetime`. Defaults to `published_at`. */\n publishedAt?: string;\n /** The field of the status, a `select`. Defaults to `status`. */\n status?: string;\n /** The status that Publish sets, without a `published` field. Defaults to `published`. */\n publishedStatus?: string;\n /** The status that Unpublish sets, without a `published` field. Defaults to `draft`. */\n draftStatus?: string;\n}\n\n/** Now, as the value of a `date` field (`2026-11-09`, local) or of a `datetime` one (ISO). */\nfunction nowValue(field: Field): string {\n const date = new Date();\n if (field.type === 'date') {\n const pad = (value: number) => String(value).padStart(2, '0');\n return `${String(date.getFullYear())}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;\n }\n return date.toISOString().replace(/\\.\\d{3}Z$/, 'Z');\n}\n\n/**\n * The `publication` panel of a form's sidebar (decision 0075): the state of the item, as the\n * `publication` component shows it, its fields, and a Publish button, or Unpublish once it is\n * published, which sets the publication and saves. Publishing sets `published` to `true`, or else\n * the status to `publishedStatus`, and the date to now when it is empty. Without a `published`\n * field nor a status with the option, the panel has no button.\n */\nexport function PublicationPanel({\n form,\n fields,\n children,\n published = 'published',\n publishedAt = 'published_at',\n status = 'status',\n publishedStatus = 'published',\n draftStatus = 'draft',\n}: PublicationPanelProps) {\n const intl = usePanneauIntl();\n const { summary, state, live } = usePublicationSummary(form, fields, {\n published,\n publishedAt,\n status,\n });\n const publishedField = fields.get(published);\n const statusField = fields.get(status);\n const dateField = fields.get(publishedAt);\n const hasStatus = (value: string) =>\n statusField?.options?.some((option) => String(option.value) === value) === true;\n const byFlag = publishedField !== undefined;\n const byStatus = !byFlag && hasStatus(publishedStatus);\n const isLive = byFlag\n ? selectValue(state, published) === true\n : byStatus\n ? String(selectValue(state, status)) === publishedStatus\n : live;\n const toggle = () => {\n if (byFlag) {\n form.setValue(published, !isLive);\n } else if (byStatus) {\n form.setValue(status, isLive ? draftStatus : publishedStatus);\n }\n if (!isLive && dateField !== undefined && toDate(form.getValue(publishedAt)) === null) {\n form.setValue(publishedAt, nowValue(dateField));\n }\n };\n return (\n <div className={styles.stack}>\n <div className={styles.publicationState}>\n <Badge tone={summary.tone}>{summary.label}</Badge>\n {summary.detail !== null ? (\n <span className={styles.sectionDescription}>{summary.detail}</span>\n ) : null}\n </div>\n {children}\n {byFlag || byStatus ? (\n // A submit button: the form saves with the publication it just set\n <Button\n type=\"submit\"\n tone={isLive ? 'neutral' : 'accent'}\n appearance={isLive ? 'outline' : 'solid'}\n isPending={state.status === 'submitting'}\n onPress={toggle}\n >\n {intl.formatMessage(\n isLive ? messages.publication.unpublish : messages.publication.publish,\n )}\n </Button>\n ) : null}\n </div>\n );\n}\n\n/** The `publication` layout component and panel, as a `@panneau/core` plugin. */\nexport const publicationPlugin = {\n id: 'panneau.publication',\n components: { publication: Publication },\n panels: { publication: PublicationPanel },\n};\n"],"mappings":";;;;;;;;;AA4BA,SAASwB,OAAOC,OAA6B;CACzC,IAAI,OAAOA,UAAU,YAAYA,UAAU,IACvC,OAAO;CAEX,MAAME,OAAO,IAAID,KAAKD,KAAK;CAC3B,OAAOG,OAAOC,MAAMF,KAAKG,QAAQ,CAAC,IAAI,OAAOH;AACjD;;AASA,SAAAK,sBAAAC,MAAAC,QAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAGI,MAAA,EAAApB,WAAAC,aAAAC,WAAAgB;CAEA,MAAAG,OAAa5B,eAAe;CAC5B,MAAA6B,QAAc3B,aAAaqB,IAAI;CAC/B,MAAA,CAAAO,OAAcvC,SAASwC,KAAgB;CAAE,IAAAC;CAAA,IAAAN,EAAA,OAAAnB,aAAAmB,EAAA,OAAAG,OAAA;EACrBG,KAAAtC,YAAYmC,OAAOtB,SAAS;EAACmB,EAAA,KAAAnB;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B;CAC7BC,IAAI;CACJC,YAAY,EAAExD,aAAaO,YAAY;CACvCkD,QAAQ,EAAEzD,aAAaiC,iBAAiB;AAC5C"}
@@ -1,3 +1,4 @@
1
- export { Publication, type PublicationProps, publicationPlugin } from './Publication.js';
1
+ export { Publication, PublicationPanel, type PublicationPanelProps, type PublicationProps, publicationPlugin, } from './Publication.js';
2
2
  export type { LayoutComponentProps } from '../layout/Layout.js';
3
+ export type { FormPanelProps } from '../panels/panels.js';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/publication/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACtF,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/publication/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,WAAW,EACX,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,iBAAiB,GACpB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1 +1 @@
1
- export { Publication, publicationPlugin } from "./Publication.js";
1
+ export { Publication, PublicationPanel, publicationPlugin } from "./Publication.js";