@panneau/lists 5.0.0-alpha.2 → 5.0.0-alpha.20

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.
Files changed (165) hide show
  1. package/README.md +17 -15
  2. package/dist/ItemDetails.css +50 -0
  3. package/dist/ItemDetails.d.ts +27 -0
  4. package/dist/ItemDetails.d.ts.map +1 -0
  5. package/dist/ItemDetails.js +134 -0
  6. package/dist/ItemDetails.js.map +1 -0
  7. package/dist/ItemDetails.module.js +20 -0
  8. package/dist/ItemDetails.module.js.map +1 -0
  9. package/dist/List.d.ts +3 -3
  10. package/dist/List.d.ts.map +1 -1
  11. package/dist/List.js +31 -10
  12. package/dist/List.js.map +1 -1
  13. package/dist/ListSkeleton.d.ts +19 -0
  14. package/dist/ListSkeleton.d.ts.map +1 -0
  15. package/dist/ListSkeleton.js +115 -0
  16. package/dist/ListSkeleton.js.map +1 -0
  17. package/dist/ListView.d.ts +73 -8
  18. package/dist/ListView.d.ts.map +1 -1
  19. package/dist/ListView.js +616 -218
  20. package/dist/ListView.js.map +1 -1
  21. package/dist/actions/ActionButton.d.ts +8 -2
  22. package/dist/actions/ActionButton.d.ts.map +1 -1
  23. package/dist/actions/ActionButton.js +98 -26
  24. package/dist/actions/ActionButton.js.map +1 -1
  25. package/dist/actions/Actions.css +16 -38
  26. package/dist/actions/Actions.module.js +6 -6
  27. package/dist/actions/Actions.module.js.map +1 -1
  28. package/dist/actions/ConfirmDialog.d.ts +20 -4
  29. package/dist/actions/ConfirmDialog.d.ts.map +1 -1
  30. package/dist/actions/ConfirmDialog.js +110 -92
  31. package/dist/actions/ConfirmDialog.js.map +1 -1
  32. package/dist/actions/RowActions.d.ts +25 -9
  33. package/dist/actions/RowActions.d.ts.map +1 -1
  34. package/dist/actions/RowActions.js +151 -80
  35. package/dist/actions/RowActions.js.map +1 -1
  36. package/dist/actions/actions.d.ts +5 -4
  37. package/dist/actions/actions.d.ts.map +1 -1
  38. package/dist/actions/actions.js +7 -14
  39. package/dist/actions/actions.js.map +1 -1
  40. package/dist/actions/fit.d.ts +25 -0
  41. package/dist/actions/fit.d.ts.map +1 -0
  42. package/dist/actions/fit.js +197 -0
  43. package/dist/actions/fit.js.map +1 -0
  44. package/dist/actions/icons.d.ts +5 -0
  45. package/dist/actions/icons.d.ts.map +1 -1
  46. package/dist/actions/icons.js +15 -1
  47. package/dist/actions/icons.js.map +1 -1
  48. package/dist/columns.d.ts +10 -0
  49. package/dist/columns.d.ts.map +1 -0
  50. package/dist/columns.js +25 -0
  51. package/dist/columns.js.map +1 -0
  52. package/dist/cx.js.map +1 -1
  53. package/dist/displays/Displays.css +48 -0
  54. package/dist/displays/Displays.module.js +18 -2
  55. package/dist/displays/Displays.module.js.map +1 -1
  56. package/dist/displays/displays.d.ts +62 -6
  57. package/dist/displays/displays.d.ts.map +1 -1
  58. package/dist/displays/displays.js +1151 -89
  59. package/dist/displays/displays.js.map +1 -1
  60. package/dist/filters/Filters.css +25 -11
  61. package/dist/filters/Filters.d.ts +1 -1
  62. package/dist/filters/Filters.js.map +1 -1
  63. package/dist/filters/Filters.module.js +5 -1
  64. package/dist/filters/Filters.module.js.map +1 -1
  65. package/dist/filters/controls.d.ts +1 -1
  66. package/dist/filters/controls.d.ts.map +1 -1
  67. package/dist/filters/controls.js +57 -35
  68. package/dist/filters/controls.js.map +1 -1
  69. package/dist/filters/format.d.ts +1 -1
  70. package/dist/filters/format.js.map +1 -1
  71. package/dist/images.d.ts +7 -0
  72. package/dist/images.d.ts.map +1 -0
  73. package/dist/images.js +39 -0
  74. package/dist/images.js.map +1 -0
  75. package/dist/index.d.ts +22 -18
  76. package/dist/index.d.ts.map +1 -1
  77. package/dist/index.js +7 -3
  78. package/dist/inline/Inline.css +58 -0
  79. package/dist/inline/Inline.module.js +20 -0
  80. package/dist/inline/Inline.module.js.map +1 -0
  81. package/dist/inline/InlineCell.d.ts +29 -0
  82. package/dist/inline/InlineCell.d.ts.map +1 -0
  83. package/dist/inline/InlineCell.js +490 -0
  84. package/dist/inline/InlineCell.js.map +1 -0
  85. package/dist/inline/editable.d.ts +12 -0
  86. package/dist/inline/editable.d.ts.map +1 -0
  87. package/dist/inline/editable.js +29 -0
  88. package/dist/inline/editable.js.map +1 -0
  89. package/dist/layouts/CalendarLayout.css +153 -0
  90. package/dist/layouts/CalendarLayout.d.ts +9 -0
  91. package/dist/layouts/CalendarLayout.d.ts.map +1 -0
  92. package/dist/layouts/CalendarLayout.js +303 -0
  93. package/dist/layouts/CalendarLayout.js.map +1 -0
  94. package/dist/layouts/CalendarLayout.module.js +28 -0
  95. package/dist/layouts/CalendarLayout.module.js.map +1 -0
  96. package/dist/layouts/CardsLayout.css +5 -0
  97. package/dist/layouts/CardsLayout.d.ts +2 -2
  98. package/dist/layouts/CardsLayout.d.ts.map +1 -1
  99. package/dist/layouts/CardsLayout.js +92 -91
  100. package/dist/layouts/CardsLayout.js.map +1 -1
  101. package/dist/layouts/CardsLayout.module.js.map +1 -1
  102. package/dist/layouts/GalleryLayout.css +87 -0
  103. package/dist/layouts/GalleryLayout.d.ts +8 -0
  104. package/dist/layouts/GalleryLayout.d.ts.map +1 -0
  105. package/dist/layouts/GalleryLayout.js +152 -0
  106. package/dist/layouts/GalleryLayout.js.map +1 -0
  107. package/dist/layouts/GalleryLayout.module.js +26 -0
  108. package/dist/layouts/GalleryLayout.module.js.map +1 -0
  109. package/dist/layouts/ItemTitle.d.ts +3 -1
  110. package/dist/layouts/ItemTitle.d.ts.map +1 -1
  111. package/dist/layouts/ItemTitle.js +12 -8
  112. package/dist/layouts/ItemTitle.js.map +1 -1
  113. package/dist/layouts/TableLayout.css +56 -0
  114. package/dist/layouts/TableLayout.d.ts +5 -4
  115. package/dist/layouts/TableLayout.d.ts.map +1 -1
  116. package/dist/layouts/TableLayout.js +171 -101
  117. package/dist/layouts/TableLayout.js.map +1 -1
  118. package/dist/layouts/TableLayout.module.js +8 -4
  119. package/dist/layouts/TableLayout.module.js.map +1 -1
  120. package/dist/layouts/builtIn.d.ts +2 -2
  121. package/dist/layouts/builtIn.d.ts.map +1 -1
  122. package/dist/layouts/builtIn.js +6 -2
  123. package/dist/layouts/builtIn.js.map +1 -1
  124. package/dist/layouts/calendarDays.d.ts +14 -0
  125. package/dist/layouts/calendarDays.d.ts.map +1 -0
  126. package/dist/layouts/calendarDays.js +44 -0
  127. package/dist/layouts/calendarDays.js.map +1 -0
  128. package/dist/plugin.d.ts +1 -1
  129. package/dist/plugin.js.map +1 -1
  130. package/dist/query.d.ts +4 -3
  131. package/dist/query.d.ts.map +1 -1
  132. package/dist/query.js +15 -4
  133. package/dist/query.js.map +1 -1
  134. package/dist/selection.d.ts +1 -1
  135. package/dist/selection.js.map +1 -1
  136. package/dist/toolbar/ColumnMenu.d.ts +17 -0
  137. package/dist/toolbar/ColumnMenu.d.ts.map +1 -0
  138. package/dist/toolbar/ColumnMenu.js +193 -0
  139. package/dist/toolbar/ColumnMenu.js.map +1 -0
  140. package/dist/toolbar/LayoutSwitch.d.ts.map +1 -1
  141. package/dist/toolbar/LayoutSwitch.js +73 -55
  142. package/dist/toolbar/LayoutSwitch.js.map +1 -1
  143. package/dist/toolbar/Pagination.d.ts +33 -0
  144. package/dist/toolbar/Pagination.d.ts.map +1 -1
  145. package/dist/toolbar/Pagination.js +282 -42
  146. package/dist/toolbar/Pagination.js.map +1 -1
  147. package/dist/toolbar/SearchField.js.map +1 -1
  148. package/dist/toolbar/SortSelect.d.ts +1 -1
  149. package/dist/toolbar/SortSelect.js.map +1 -1
  150. package/dist/toolbar/Toolbar.css +36 -0
  151. package/dist/toolbar/Toolbar.module.js +12 -2
  152. package/dist/toolbar/Toolbar.module.js.map +1 -1
  153. package/dist/types.d.ts +69 -1
  154. package/dist/types.d.ts.map +1 -1
  155. package/dist/useDraft.js.map +1 -1
  156. package/dist/useListState.js.map +1 -1
  157. package/dist/useRenderValue.d.ts +10 -0
  158. package/dist/useRenderValue.d.ts.map +1 -0
  159. package/dist/useRenderValue.js +84 -0
  160. package/dist/useRenderValue.js.map +1 -0
  161. package/dist/values.d.ts +4 -1
  162. package/dist/values.d.ts.map +1 -1
  163. package/dist/values.js +6 -2
  164. package/dist/values.js.map +1 -1
  165. package/package.json +9 -9
@@ -1,11 +1,22 @@
1
1
  import { messages } from "../messages.js";
2
- import { getFieldOptions, getOptionLabel, toText } from "../values.js";
2
+ import { findOption, getFieldOptions, isRecord, toText } from "../values.js";
3
+ import { getImageUrl } from "../images.js";
3
4
  import Displays_module_default from "./Displays.module.js";
4
5
  import { c } from "react/compiler-runtime";
6
+ import { fieldsMessages } from "@panneau/intl";
5
7
  import { Badge, Icon, usePanneauIntl } from "@panneau/ui";
6
- import { jsx, jsxs } from "react/jsx-runtime";
7
- import { Check, Minus } from "lucide-react";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
+ import { Check, File, FileText, Globe, Hash, Mail, Minus, Phone } from "lucide-react";
8
10
  import { toReferences } from "@panneau/fields";
11
+ import { formatAddress, isAddress } from "@panneau/fields/address";
12
+ import { getColorPalette, getSwatchColor } from "@panneau/fields/color";
13
+ import { getCountryFlag, getCountryName, isCountryCode } from "@panneau/fields/country";
14
+ import { formatDateRange, getDateRangeSettings } from "@panneau/fields/daterange";
15
+ import { formatDuration, getDurationUnits } from "@panneau/fields/duration";
16
+ import { getLinkText, isLink } from "@panneau/fields/link";
17
+ import { formatMoney } from "@panneau/fields/money";
18
+ import { RegionFlag, getRegionCountry, getRegionName } from "@panneau/fields/region";
19
+ import { parsePhone, splitExtension } from "@panneau/fields/tel";
9
20
  //#region src/displays/displays.tsx
10
21
  /** What a cell shows without a value. Hidden from assistive technologies, which skip the cell. */
11
22
  function EmptyValue() {
@@ -24,10 +35,13 @@ function EmptyValue() {
24
35
  function isEmpty(value) {
25
36
  return value === null || value === void 0 || value === "" || Array.isArray(value) && value.length === 0;
26
37
  }
27
- /** Text, on two lines at most. The default display. */
38
+ /**
39
+ * Text, on two lines at most. The default display. The value of a `secret` text field
40
+ * (`settings.secret`) shows as dots, never in clear.
41
+ */
28
42
  function TextDisplay(t0) {
29
- const $ = c(5);
30
- const { value } = t0;
43
+ const $ = c(10);
44
+ const { value, field } = t0;
31
45
  const intl = usePanneauIntl();
32
46
  let t1;
33
47
  if ($[0] !== intl.locale || $[1] !== value) {
@@ -37,15 +51,43 @@ function TextDisplay(t0) {
37
51
  $[2] = t1;
38
52
  } else t1 = $[2];
39
53
  const text = t1;
54
+ if (text === "") {
55
+ let t2;
56
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
57
+ t2 = /* @__PURE__ */ jsx(EmptyValue, {});
58
+ $[3] = t2;
59
+ } else t2 = $[3];
60
+ return t2;
61
+ }
62
+ if (field?.settings?.secret === true) {
63
+ let t2;
64
+ if ($[4] !== intl) {
65
+ t2 = intl.formatMessage(messages.secretValue);
66
+ $[4] = intl;
67
+ $[5] = t2;
68
+ } else t2 = $[5];
69
+ let t3;
70
+ if ($[6] !== t2) {
71
+ t3 = /* @__PURE__ */ jsx("span", {
72
+ role: "img",
73
+ "aria-label": t2,
74
+ children: "••••••••"
75
+ });
76
+ $[6] = t2;
77
+ $[7] = t3;
78
+ } else t3 = $[7];
79
+ return t3;
80
+ }
40
81
  let t2;
41
- if ($[3] !== text) {
42
- t2 = text === "" ? /* @__PURE__ */ jsx(EmptyValue, {}) : /* @__PURE__ */ jsx("span", {
82
+ if ($[8] !== text) {
83
+ t2 = /* @__PURE__ */ jsx("span", {
43
84
  className: Displays_module_default.text,
85
+ "data-clamp": "",
44
86
  children: text
45
87
  });
46
- $[3] = text;
47
- $[4] = t2;
48
- } else t2 = $[4];
88
+ $[8] = text;
89
+ $[9] = t2;
90
+ } else t2 = $[9];
49
91
  return t2;
50
92
  }
51
93
  /** HTML as plain text. */
@@ -63,6 +105,7 @@ function RichTextDisplay(t0) {
63
105
  if ($[2] !== text) {
64
106
  t2 = text === "" ? /* @__PURE__ */ jsx(EmptyValue, {}) : /* @__PURE__ */ jsx("span", {
65
107
  className: Displays_module_default.text,
108
+ "data-clamp": "",
66
109
  children: text
67
110
  });
68
111
  $[2] = text;
@@ -253,6 +296,87 @@ function DateTimeDisplay(t0) {
253
296
  } else t4 = $[8];
254
297
  return t4;
255
298
  }
299
+ /**
300
+ * A range of dates (decision 0053), in the format of the locale: `Nov 4 – 6, 2026`. Date-times show
301
+ * in the zone of the value or the field, with its short name when it isn't the user's. A range open
302
+ * at one end shows `From Nov 4, 2026` or `Until Dec 1, 2026`.
303
+ */
304
+ function DateRangeDisplay(t0) {
305
+ const $ = c(8);
306
+ const { value, field } = t0;
307
+ const intl = usePanneauIntl();
308
+ let t1;
309
+ let t2;
310
+ if ($[0] !== field?.settings || $[1] !== intl || $[2] !== value) {
311
+ t2 = Symbol.for("react.early_return_sentinel");
312
+ bb0: {
313
+ const range = formatDateRange(value, intl.locale, getDateRangeSettings(field?.settings).timeZone);
314
+ if (range === null) {
315
+ let t3;
316
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
317
+ t3 = /* @__PURE__ */ jsx(EmptyValue, {});
318
+ $[5] = t3;
319
+ } else t3 = $[5];
320
+ t2 = t3;
321
+ break bb0;
322
+ }
323
+ t1 = range.kind === "from" ? intl.formatMessage(messages.rangeFrom, { start: range.text }) : range.kind === "until" ? intl.formatMessage(messages.rangeUntil, { end: range.text }) : range.text;
324
+ }
325
+ $[0] = field?.settings;
326
+ $[1] = intl;
327
+ $[2] = value;
328
+ $[3] = t1;
329
+ $[4] = t2;
330
+ } else {
331
+ t1 = $[3];
332
+ t2 = $[4];
333
+ }
334
+ if (t2 !== Symbol.for("react.early_return_sentinel")) return t2;
335
+ const text = t1;
336
+ let t3;
337
+ if ($[6] !== text) {
338
+ t3 = /* @__PURE__ */ jsx("span", {
339
+ className: Displays_module_default.text,
340
+ "data-clamp": "",
341
+ children: text
342
+ });
343
+ $[6] = text;
344
+ $[7] = t3;
345
+ } else t3 = $[7];
346
+ return t3;
347
+ }
348
+ /** An amount of money (decision 0053), in the currency format of the locale: `1 250,00 $`. */
349
+ function MoneyDisplay(t0) {
350
+ const $ = c(6);
351
+ const { value } = t0;
352
+ const intl = usePanneauIntl();
353
+ let t1;
354
+ if ($[0] !== intl.locale || $[1] !== value) {
355
+ t1 = formatMoney(value, intl.locale);
356
+ $[0] = intl.locale;
357
+ $[1] = value;
358
+ $[2] = t1;
359
+ } else t1 = $[2];
360
+ const text = t1;
361
+ if (text === null) {
362
+ let t2;
363
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
364
+ t2 = /* @__PURE__ */ jsx(EmptyValue, {});
365
+ $[3] = t2;
366
+ } else t2 = $[3];
367
+ return t2;
368
+ }
369
+ let t2;
370
+ if ($[4] !== text) {
371
+ t2 = /* @__PURE__ */ jsx("span", {
372
+ className: Displays_module_default.number,
373
+ children: text
374
+ });
375
+ $[4] = text;
376
+ $[5] = t2;
377
+ } else t2 = $[5];
378
+ return t2;
379
+ }
256
380
  /** A time of day (`14:30`), in the format of the locale. */
257
381
  function TimeDisplay(t0) {
258
382
  const $ = c(13);
@@ -324,7 +448,13 @@ function SelectDisplay(t0) {
324
448
  break bb0;
325
449
  }
326
450
  t1 = Displays_module_default.badges;
327
- t2 = values.map((entry) => /* @__PURE__ */ jsx(Badge, { children: getOptionLabel(options, entry) ?? String(entry) }, String(entry)));
451
+ t2 = values.map((entry) => {
452
+ const option = findOption(options, entry);
453
+ return /* @__PURE__ */ jsx(Badge, {
454
+ tone: option?.tone ?? "neutral",
455
+ children: option?.label ?? String(entry)
456
+ }, String(entry));
457
+ });
328
458
  }
329
459
  $[0] = field;
330
460
  $[1] = value;
@@ -351,48 +481,54 @@ function SelectDisplay(t0) {
351
481
  }
352
482
  /** The labels of related items. */
353
483
  function RelationDisplay(t0) {
354
- const $ = c(8);
484
+ const $ = c(10);
355
485
  const { value } = t0;
356
486
  let t1;
357
487
  let t2;
358
488
  let t3;
489
+ let t4;
359
490
  if ($[0] !== value) {
360
- t3 = Symbol.for("react.early_return_sentinel");
491
+ t4 = Symbol.for("react.early_return_sentinel");
361
492
  bb0: {
362
493
  const references = toReferences(value);
363
494
  if (references.length === 0) {
364
- let t4;
365
- if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
366
- t4 = /* @__PURE__ */ jsx(EmptyValue, {});
367
- $[4] = t4;
368
- } else t4 = $[4];
369
- t3 = t4;
495
+ let t5;
496
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
497
+ t5 = /* @__PURE__ */ jsx(EmptyValue, {});
498
+ $[5] = t5;
499
+ } else t5 = $[5];
500
+ t4 = t5;
370
501
  break bb0;
371
502
  }
372
503
  t1 = Displays_module_default.text;
373
- t2 = references.map(_temp).join(", ");
504
+ t2 = "";
505
+ t3 = references.map(_temp).join(", ");
374
506
  }
375
507
  $[0] = value;
376
508
  $[1] = t1;
377
509
  $[2] = t2;
378
510
  $[3] = t3;
511
+ $[4] = t4;
379
512
  } else {
380
513
  t1 = $[1];
381
514
  t2 = $[2];
382
515
  t3 = $[3];
516
+ t4 = $[4];
383
517
  }
384
- if (t3 !== Symbol.for("react.early_return_sentinel")) return t3;
385
- let t4;
386
- if ($[5] !== t1 || $[6] !== t2) {
387
- t4 = /* @__PURE__ */ jsx("span", {
518
+ if (t4 !== Symbol.for("react.early_return_sentinel")) return t4;
519
+ let t5;
520
+ if ($[6] !== t1 || $[7] !== t2 || $[8] !== t3) {
521
+ t5 = /* @__PURE__ */ jsx("span", {
388
522
  className: t1,
389
- children: t2
523
+ "data-clamp": t2,
524
+ children: t3
390
525
  });
391
- $[5] = t1;
392
- $[6] = t2;
393
- $[7] = t4;
394
- } else t4 = $[7];
395
- return t4;
526
+ $[6] = t1;
527
+ $[7] = t2;
528
+ $[8] = t3;
529
+ $[9] = t5;
530
+ } else t5 = $[9];
531
+ return t5;
396
532
  }
397
533
  /** A link that opens the URL. */
398
534
  function _temp(reference) {
@@ -461,11 +597,16 @@ function EmailDisplay(t0) {
461
597
  } else t2 = $[3];
462
598
  return t2;
463
599
  }
464
- /** A swatch, with the color's code. */
465
- function ColorDisplay(t0) {
466
- const $ = c(6);
467
- const { value } = t0;
468
- if (typeof value !== "string" || value === "") {
600
+ /**
601
+ * A link that calls the phone number: the flag of its country and the number in its international
602
+ * format (`+1 514 555 0199`), with its extension (`, ext. 123`) when its field allows one
603
+ * (`settings.extension`) or the column has no field. A value that isn't E.164 shows as it is.
604
+ */
605
+ function TelDisplay(t0) {
606
+ const $ = c(20);
607
+ const { value, field } = t0;
608
+ const intl = usePanneauIntl();
609
+ if (typeof value !== "string" || value.trim() === "") {
469
610
  let t1;
470
611
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
471
612
  t1 = /* @__PURE__ */ jsx(EmptyValue, {});
@@ -474,33 +615,216 @@ function ColorDisplay(t0) {
474
615
  return t1;
475
616
  }
476
617
  let t1;
477
- if ($[1] !== value) {
478
- t1 = /* @__PURE__ */ jsx("span", {
479
- className: Displays_module_default.swatch,
480
- style: { backgroundColor: value },
481
- "aria-hidden": "true"
482
- });
483
- $[1] = value;
484
- $[2] = t1;
485
- } else t1 = $[2];
486
618
  let t2;
487
- if ($[3] !== t1 || $[4] !== value) {
488
- t2 = /* @__PURE__ */ jsxs("span", {
489
- className: Displays_module_default.color,
490
- children: [t1, value]
619
+ let t3;
620
+ let t4;
621
+ let t5;
622
+ if ($[1] !== field || $[2] !== intl || $[3] !== value) {
623
+ t5 = Symbol.for("react.early_return_sentinel");
624
+ bb0: {
625
+ const { number: text, extension } = field === null || field.settings?.extension === true ? splitExtension(value) : {
626
+ number: value,
627
+ extension: null
628
+ };
629
+ const number = parsePhone(text);
630
+ if (number === null) {
631
+ let t6;
632
+ if ($[9] !== value) {
633
+ let t7;
634
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
635
+ t7 = /[^\d+]/g;
636
+ $[11] = t7;
637
+ } else t7 = $[11];
638
+ t6 = value.replace(t7, "");
639
+ $[9] = value;
640
+ $[10] = t6;
641
+ } else t6 = $[10];
642
+ const t7 = `tel:${t6}`;
643
+ let t8;
644
+ if ($[12] !== t7 || $[13] !== value) {
645
+ t8 = /* @__PURE__ */ jsx("a", {
646
+ className: Displays_module_default.link,
647
+ href: t7,
648
+ children: value
649
+ });
650
+ $[12] = t7;
651
+ $[13] = value;
652
+ $[14] = t8;
653
+ } else t8 = $[14];
654
+ t5 = t8;
655
+ break bb0;
656
+ }
657
+ t1 = `${Displays_module_default.link} ${Displays_module_default.flagged}`;
658
+ t2 = `tel:${number.number}${extension !== null ? `;ext=${extension}` : ""}`;
659
+ t3 = number.country !== null ? /* @__PURE__ */ jsx("span", {
660
+ className: Displays_module_default.flag,
661
+ "aria-hidden": "true",
662
+ children: getCountryFlag(number.country)
663
+ }) : null;
664
+ t4 = extension !== null ? intl.formatMessage(messages.phoneExtension, {
665
+ number: number.international,
666
+ extension
667
+ }) : number.international;
668
+ }
669
+ $[1] = field;
670
+ $[2] = intl;
671
+ $[3] = value;
672
+ $[4] = t1;
673
+ $[5] = t2;
674
+ $[6] = t3;
675
+ $[7] = t4;
676
+ $[8] = t5;
677
+ } else {
678
+ t1 = $[4];
679
+ t2 = $[5];
680
+ t3 = $[6];
681
+ t4 = $[7];
682
+ t5 = $[8];
683
+ }
684
+ if (t5 !== Symbol.for("react.early_return_sentinel")) return t5;
685
+ let t6;
686
+ if ($[15] !== t1 || $[16] !== t2 || $[17] !== t3 || $[18] !== t4) {
687
+ t6 = /* @__PURE__ */ jsxs("a", {
688
+ className: t1,
689
+ href: t2,
690
+ children: [t3, t4]
491
691
  });
692
+ $[15] = t1;
693
+ $[16] = t2;
694
+ $[17] = t3;
695
+ $[18] = t4;
696
+ $[19] = t6;
697
+ } else t6 = $[19];
698
+ return t6;
699
+ }
700
+ /** A country: its flag and its name in the user's locale. */
701
+ function Country(t0) {
702
+ const $ = c(14);
703
+ const { code } = t0;
704
+ const intl = usePanneauIntl();
705
+ if (!isCountryCode(code)) {
706
+ let t1;
707
+ if ($[0] !== code) {
708
+ t1 = /* @__PURE__ */ jsx("span", {
709
+ className: Displays_module_default.text,
710
+ "data-clamp": "",
711
+ children: code
712
+ });
713
+ $[0] = code;
714
+ $[1] = t1;
715
+ } else t1 = $[1];
716
+ return t1;
717
+ }
718
+ let t1;
719
+ if ($[2] !== code) {
720
+ t1 = getCountryFlag(code);
721
+ $[2] = code;
492
722
  $[3] = t1;
493
- $[4] = value;
723
+ } else t1 = $[3];
724
+ let t2;
725
+ if ($[4] !== t1) {
726
+ t2 = /* @__PURE__ */ jsx("span", {
727
+ className: Displays_module_default.flag,
728
+ "aria-hidden": "true",
729
+ children: t1
730
+ });
731
+ $[4] = t1;
494
732
  $[5] = t2;
495
733
  } else t2 = $[5];
496
- return t2;
734
+ let t3;
735
+ if ($[6] !== code || $[7] !== intl.locale) {
736
+ t3 = getCountryName(code, intl.locale);
737
+ $[6] = code;
738
+ $[7] = intl.locale;
739
+ $[8] = t3;
740
+ } else t3 = $[8];
741
+ let t4;
742
+ if ($[9] !== t3) {
743
+ t4 = /* @__PURE__ */ jsx("span", {
744
+ className: Displays_module_default.text,
745
+ "data-clamp": "",
746
+ children: t3
747
+ });
748
+ $[9] = t3;
749
+ $[10] = t4;
750
+ } else t4 = $[10];
751
+ let t5;
752
+ if ($[11] !== t2 || $[12] !== t4) {
753
+ t5 = /* @__PURE__ */ jsxs("span", {
754
+ className: Displays_module_default.flagged,
755
+ children: [t2, t4]
756
+ });
757
+ $[11] = t2;
758
+ $[12] = t4;
759
+ $[13] = t5;
760
+ } else t5 = $[13];
761
+ return t5;
497
762
  }
498
- /** A thumbnail and the name of a media item (or of the first one). */
499
- function MediaDisplay(t0) {
763
+ /** A country, or several (`multiple`): their flags and their names in the user's locale. */
764
+ function CountryDisplay(t0) {
500
765
  const $ = c(8);
501
766
  const { value } = t0;
502
- const media = Array.isArray(value) ? value[0] : value;
503
- if (media === null || typeof media !== "object") {
767
+ let t1;
768
+ let t2;
769
+ let t3;
770
+ if ($[0] !== value) {
771
+ t3 = Symbol.for("react.early_return_sentinel");
772
+ bb0: {
773
+ const codes = (Array.isArray(value) ? value : [value]).filter(_temp2);
774
+ if (codes.length === 0) {
775
+ let t4;
776
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
777
+ t4 = /* @__PURE__ */ jsx(EmptyValue, {});
778
+ $[4] = t4;
779
+ } else t4 = $[4];
780
+ t3 = t4;
781
+ break bb0;
782
+ }
783
+ if (codes.length === 1) {
784
+ t3 = /* @__PURE__ */ jsx(Country, { code: codes[0] });
785
+ break bb0;
786
+ }
787
+ t1 = Displays_module_default.countries;
788
+ t2 = codes.map(_temp3);
789
+ }
790
+ $[0] = value;
791
+ $[1] = t1;
792
+ $[2] = t2;
793
+ $[3] = t3;
794
+ } else {
795
+ t1 = $[1];
796
+ t2 = $[2];
797
+ t3 = $[3];
798
+ }
799
+ if (t3 !== Symbol.for("react.early_return_sentinel")) return t3;
800
+ let t4;
801
+ if ($[5] !== t1 || $[6] !== t2) {
802
+ t4 = /* @__PURE__ */ jsx("span", {
803
+ className: t1,
804
+ children: t2
805
+ });
806
+ $[5] = t1;
807
+ $[6] = t2;
808
+ $[7] = t4;
809
+ } else t4 = $[7];
810
+ return t4;
811
+ }
812
+ /**
813
+ * A region: its flag, when it has one, and its name in the user's locale, from its country in the
814
+ * item (the field's `from`) or the field's settings. A region that Panneau doesn't know shows as it
815
+ * is.
816
+ */
817
+ function _temp3(code_0) {
818
+ return /* @__PURE__ */ jsx(Country, { code: code_0 }, code_0);
819
+ }
820
+ function _temp2(code) {
821
+ return typeof code === "string" && code !== "";
822
+ }
823
+ function RegionDisplay(t0) {
824
+ const $ = c(17);
825
+ const { value, field, item } = t0;
826
+ const intl = usePanneauIntl();
827
+ if (typeof value !== "string" || value === "") {
504
828
  let t1;
505
829
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
506
830
  t1 = /* @__PURE__ */ jsx(EmptyValue, {});
@@ -508,45 +832,768 @@ function MediaDisplay(t0) {
508
832
  } else t1 = $[0];
509
833
  return t1;
510
834
  }
511
- const { thumbnailUrl, url, name, filename } = media;
512
- const source = typeof thumbnailUrl === "string" ? thumbnailUrl : typeof url === "string" ? url : null;
513
- const label = typeof name === "string" ? name : typeof filename === "string" ? filename : "";
835
+ let country;
514
836
  let t1;
515
- if ($[1] !== source) {
516
- t1 = source !== null ? /* @__PURE__ */ jsx("img", {
517
- className: Displays_module_default.thumbnail,
518
- src: source,
519
- alt: ""
520
- }) : null;
521
- $[1] = source;
522
- $[2] = t1;
523
- } else t1 = $[2];
837
+ if ($[1] !== field || $[2] !== intl.locale || $[3] !== item || $[4] !== value) {
838
+ country = field !== null ? getRegionCountry(field, item) : null;
839
+ t1 = getRegionName(country, value, intl.locale);
840
+ $[1] = field;
841
+ $[2] = intl.locale;
842
+ $[3] = item;
843
+ $[4] = value;
844
+ $[5] = country;
845
+ $[6] = t1;
846
+ } else {
847
+ country = $[5];
848
+ t1 = $[6];
849
+ }
850
+ const name = t1;
851
+ if (name === null) {
852
+ let t2;
853
+ if ($[7] !== value) {
854
+ t2 = /* @__PURE__ */ jsx("span", {
855
+ className: Displays_module_default.text,
856
+ "data-clamp": "",
857
+ children: value
858
+ });
859
+ $[7] = value;
860
+ $[8] = t2;
861
+ } else t2 = $[8];
862
+ return t2;
863
+ }
524
864
  let t2;
525
- if ($[3] !== label) {
526
- t2 = label !== "" ? /* @__PURE__ */ jsx("span", {
527
- className: Displays_module_default.text,
528
- children: label
529
- }) : null;
530
- $[3] = label;
531
- $[4] = t2;
532
- } else t2 = $[4];
865
+ if ($[9] !== country || $[10] !== value) {
866
+ t2 = /* @__PURE__ */ jsx(RegionFlag, {
867
+ country,
868
+ code: value,
869
+ className: Displays_module_default.regionFlag
870
+ });
871
+ $[9] = country;
872
+ $[10] = value;
873
+ $[11] = t2;
874
+ } else t2 = $[11];
533
875
  let t3;
534
- if ($[5] !== t1 || $[6] !== t2) {
535
- t3 = /* @__PURE__ */ jsxs("span", {
536
- className: Displays_module_default.media,
537
- children: [t1, t2]
876
+ if ($[12] !== name) {
877
+ t3 = /* @__PURE__ */ jsx("span", {
878
+ className: Displays_module_default.text,
879
+ "data-clamp": "",
880
+ children: name
538
881
  });
539
- $[5] = t1;
540
- $[6] = t2;
541
- $[7] = t3;
542
- } else t3 = $[7];
543
- return t3;
882
+ $[12] = name;
883
+ $[13] = t3;
884
+ } else t3 = $[13];
885
+ let t4;
886
+ if ($[14] !== t2 || $[15] !== t3) {
887
+ t4 = /* @__PURE__ */ jsxs("span", {
888
+ className: Displays_module_default.flagged,
889
+ children: [t2, t3]
890
+ });
891
+ $[14] = t2;
892
+ $[15] = t3;
893
+ $[16] = t4;
894
+ } else t4 = $[16];
895
+ return t4;
544
896
  }
545
897
  /**
546
- * The built-in displays, by name. A column's display is its `display`, its field's `display`, or
547
- * its field's type: field types are display names. Values without a known display are shown as
548
- * text.
898
+ * A duration with its units, `1 h 5 min` or `2 d 4 h`: in the unit of its field (seconds by
899
+ * default), from its largest unit to its precision.
549
900
  */
901
+ function DurationDisplay(t0) {
902
+ const $ = c(9);
903
+ const { value, field } = t0;
904
+ const intl = usePanneauIntl();
905
+ if (typeof value !== "number" || Number.isNaN(value)) {
906
+ let t1;
907
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
908
+ t1 = /* @__PURE__ */ jsx(EmptyValue, {});
909
+ $[0] = t1;
910
+ } else t1 = $[0];
911
+ return t1;
912
+ }
913
+ let t1;
914
+ let t2;
915
+ if ($[1] !== field || $[2] !== intl || $[3] !== value) {
916
+ const labels = {
917
+ days: intl.formatMessage(fieldsMessages.daysUnit),
918
+ hours: intl.formatMessage(fieldsMessages.hoursUnit),
919
+ minutes: intl.formatMessage(fieldsMessages.minutesUnit),
920
+ seconds: intl.formatMessage(fieldsMessages.secondsUnit)
921
+ };
922
+ const units = field !== null ? getDurationUnits(field) : {};
923
+ t1 = Displays_module_default.number;
924
+ t2 = formatDuration(value, {
925
+ ...units,
926
+ labels
927
+ });
928
+ $[1] = field;
929
+ $[2] = intl;
930
+ $[3] = value;
931
+ $[4] = t1;
932
+ $[5] = t2;
933
+ } else {
934
+ t1 = $[4];
935
+ t2 = $[5];
936
+ }
937
+ let t3;
938
+ if ($[6] !== t1 || $[7] !== t2) {
939
+ t3 = /* @__PURE__ */ jsx("span", {
940
+ className: t1,
941
+ children: t2
942
+ });
943
+ $[6] = t1;
944
+ $[7] = t2;
945
+ $[8] = t3;
946
+ } else t3 = $[8];
947
+ return t3;
948
+ }
949
+ /** JSON on one line, shortened. */
950
+ function JsonDisplay(t0) {
951
+ const $ = c(9);
952
+ const { value } = t0;
953
+ if (value === null || value === void 0 || typeof value !== "object") {
954
+ let t1;
955
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
956
+ t1 = /* @__PURE__ */ jsx(EmptyValue, {});
957
+ $[0] = t1;
958
+ } else t1 = $[0];
959
+ return t1;
960
+ }
961
+ let t1;
962
+ let t2;
963
+ let t3;
964
+ if ($[1] !== value) {
965
+ const json = JSON.stringify(value);
966
+ t1 = Displays_module_default.code;
967
+ t2 = json.length > 80 ? json : void 0;
968
+ t3 = json.length > 80 ? `${json.slice(0, 79)}…` : json;
969
+ $[1] = value;
970
+ $[2] = t1;
971
+ $[3] = t2;
972
+ $[4] = t3;
973
+ } else {
974
+ t1 = $[2];
975
+ t2 = $[3];
976
+ t3 = $[4];
977
+ }
978
+ let t4;
979
+ if ($[5] !== t1 || $[6] !== t2 || $[7] !== t3) {
980
+ t4 = /* @__PURE__ */ jsx("code", {
981
+ className: t1,
982
+ title: t2,
983
+ children: t3
984
+ });
985
+ $[5] = t1;
986
+ $[6] = t2;
987
+ $[7] = t3;
988
+ $[8] = t4;
989
+ } else t4 = $[8];
990
+ return t4;
991
+ }
992
+ /** Tags, as badges, with the labels of their options. */
993
+ function TagsDisplay(t0) {
994
+ const $ = c(13);
995
+ const { value, field } = t0;
996
+ let t1;
997
+ let t2;
998
+ let t3;
999
+ if ($[0] !== field?.options || $[1] !== value) {
1000
+ t3 = Symbol.for("react.early_return_sentinel");
1001
+ bb0: {
1002
+ const tags = Array.isArray(value) ? value.filter(_temp4) : [];
1003
+ if (tags.length === 0) {
1004
+ let t4;
1005
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
1006
+ t4 = /* @__PURE__ */ jsx(EmptyValue, {});
1007
+ $[5] = t4;
1008
+ } else t4 = $[5];
1009
+ t3 = t4;
1010
+ break bb0;
1011
+ }
1012
+ let t4;
1013
+ if ($[6] !== field?.options) {
1014
+ t4 = field?.options ?? [];
1015
+ $[6] = field?.options;
1016
+ $[7] = t4;
1017
+ } else t4 = $[7];
1018
+ const options = t4;
1019
+ t1 = Displays_module_default.tags;
1020
+ let t5;
1021
+ if ($[8] !== options) {
1022
+ t5 = (tag_0) => /* @__PURE__ */ jsx(Badge, { children: options.find((option) => String(option.value) === tag_0)?.label ?? tag_0 }, tag_0);
1023
+ $[8] = options;
1024
+ $[9] = t5;
1025
+ } else t5 = $[9];
1026
+ t2 = tags.map(t5);
1027
+ }
1028
+ $[0] = field?.options;
1029
+ $[1] = value;
1030
+ $[2] = t1;
1031
+ $[3] = t2;
1032
+ $[4] = t3;
1033
+ } else {
1034
+ t1 = $[2];
1035
+ t2 = $[3];
1036
+ t3 = $[4];
1037
+ }
1038
+ if (t3 !== Symbol.for("react.early_return_sentinel")) return t3;
1039
+ let t4;
1040
+ if ($[10] !== t1 || $[11] !== t2) {
1041
+ t4 = /* @__PURE__ */ jsx("span", {
1042
+ className: t1,
1043
+ children: t2
1044
+ });
1045
+ $[10] = t1;
1046
+ $[11] = t2;
1047
+ $[12] = t4;
1048
+ } else t4 = $[12];
1049
+ return t4;
1050
+ }
1051
+ /** What a URL embeds: its thumbnail and title, linked to it. */
1052
+ function _temp4(tag) {
1053
+ return typeof tag === "string";
1054
+ }
1055
+ function EmbedDisplay(t0) {
1056
+ const $ = c(12);
1057
+ const { value } = t0;
1058
+ if (value === null || typeof value !== "object" || typeof value.url !== "string") {
1059
+ let t1;
1060
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1061
+ t1 = /* @__PURE__ */ jsx(EmptyValue, {});
1062
+ $[0] = t1;
1063
+ } else t1 = $[0];
1064
+ return t1;
1065
+ }
1066
+ const { url, title, thumbnailUrl } = value;
1067
+ let t1;
1068
+ if ($[1] !== thumbnailUrl) {
1069
+ t1 = typeof thumbnailUrl === "string" ? /* @__PURE__ */ jsx("img", {
1070
+ className: Displays_module_default.thumbnail,
1071
+ src: thumbnailUrl,
1072
+ alt: ""
1073
+ }) : null;
1074
+ $[1] = thumbnailUrl;
1075
+ $[2] = t1;
1076
+ } else t1 = $[2];
1077
+ let t2;
1078
+ if ($[3] !== title || $[4] !== url) {
1079
+ t2 = typeof title === "string" ? title : url.replace(/^https?:\/\//, "");
1080
+ $[3] = title;
1081
+ $[4] = url;
1082
+ $[5] = t2;
1083
+ } else t2 = $[5];
1084
+ let t3;
1085
+ if ($[6] !== t2) {
1086
+ t3 = /* @__PURE__ */ jsx("span", {
1087
+ className: Displays_module_default.text,
1088
+ "data-clamp": "",
1089
+ children: t2
1090
+ });
1091
+ $[6] = t2;
1092
+ $[7] = t3;
1093
+ } else t3 = $[7];
1094
+ let t4;
1095
+ if ($[8] !== t1 || $[9] !== t3 || $[10] !== url) {
1096
+ t4 = /* @__PURE__ */ jsxs("a", {
1097
+ className: `${Displays_module_default.link} ${Displays_module_default.media}`,
1098
+ href: url,
1099
+ target: "_blank",
1100
+ rel: "noreferrer",
1101
+ children: [t1, t3]
1102
+ });
1103
+ $[8] = t1;
1104
+ $[9] = t3;
1105
+ $[10] = url;
1106
+ $[11] = t4;
1107
+ } else t4 = $[11];
1108
+ return t4;
1109
+ }
1110
+ /** A place: its address, or its coordinates. */
1111
+ function LocationDisplay(t0) {
1112
+ const $ = c(15);
1113
+ const { value } = t0;
1114
+ const intl = usePanneauIntl();
1115
+ if (value === null || typeof value !== "object") {
1116
+ let t1;
1117
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1118
+ t1 = /* @__PURE__ */ jsx(EmptyValue, {});
1119
+ $[0] = t1;
1120
+ } else t1 = $[0];
1121
+ return t1;
1122
+ }
1123
+ const { lat, lng, address } = value;
1124
+ if (typeof address === "string" && address !== "") {
1125
+ let t1;
1126
+ if ($[1] !== address) {
1127
+ t1 = /* @__PURE__ */ jsx("span", {
1128
+ className: Displays_module_default.text,
1129
+ "data-clamp": "",
1130
+ children: address
1131
+ });
1132
+ $[1] = address;
1133
+ $[2] = t1;
1134
+ } else t1 = $[2];
1135
+ return t1;
1136
+ }
1137
+ if (typeof lat !== "number" || typeof lng !== "number") {
1138
+ let t1;
1139
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
1140
+ t1 = /* @__PURE__ */ jsx(EmptyValue, {});
1141
+ $[3] = t1;
1142
+ } else t1 = $[3];
1143
+ return t1;
1144
+ }
1145
+ let t1;
1146
+ if ($[4] !== intl) {
1147
+ t1 = (number) => intl.formatNumber(number, { maximumFractionDigits: 5 });
1148
+ $[4] = intl;
1149
+ $[5] = t1;
1150
+ } else t1 = $[5];
1151
+ const format = t1;
1152
+ let t2;
1153
+ if ($[6] !== format || $[7] !== lat) {
1154
+ t2 = format(lat);
1155
+ $[6] = format;
1156
+ $[7] = lat;
1157
+ $[8] = t2;
1158
+ } else t2 = $[8];
1159
+ let t3;
1160
+ if ($[9] !== format || $[10] !== lng) {
1161
+ t3 = format(lng);
1162
+ $[9] = format;
1163
+ $[10] = lng;
1164
+ $[11] = t3;
1165
+ } else t3 = $[11];
1166
+ let t4;
1167
+ if ($[12] !== t2 || $[13] !== t3) {
1168
+ t4 = /* @__PURE__ */ jsxs("span", {
1169
+ className: Displays_module_default.number,
1170
+ children: [
1171
+ t2,
1172
+ ", ",
1173
+ t3
1174
+ ]
1175
+ });
1176
+ $[12] = t2;
1177
+ $[13] = t3;
1178
+ $[14] = t4;
1179
+ } else t4 = $[14];
1180
+ return t4;
1181
+ }
1182
+ /** An address on one line, in the order of its country, after the flag of its country. */
1183
+ function AddressDisplay(t0) {
1184
+ const $ = c(17);
1185
+ const { value } = t0;
1186
+ const intl = usePanneauIntl();
1187
+ if (!isAddress(value)) {
1188
+ let t1;
1189
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1190
+ t1 = /* @__PURE__ */ jsx(EmptyValue, {});
1191
+ $[0] = t1;
1192
+ } else t1 = $[0];
1193
+ return t1;
1194
+ }
1195
+ let t1;
1196
+ if ($[1] !== intl.locale || $[2] !== value) {
1197
+ t1 = formatAddress(value, intl.locale);
1198
+ $[1] = intl.locale;
1199
+ $[2] = value;
1200
+ $[3] = t1;
1201
+ } else t1 = $[3];
1202
+ const text = t1;
1203
+ const country = typeof value.country === "string" ? value.country : "";
1204
+ if (text === "" && !isCountryCode(country)) {
1205
+ let t2;
1206
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
1207
+ t2 = /* @__PURE__ */ jsx(EmptyValue, {});
1208
+ $[4] = t2;
1209
+ } else t2 = $[4];
1210
+ return t2;
1211
+ }
1212
+ let t2;
1213
+ if ($[5] !== country || $[6] !== intl.locale) {
1214
+ t2 = isCountryCode(country) ? /* @__PURE__ */ jsx("span", {
1215
+ className: Displays_module_default.flag,
1216
+ title: getCountryName(country, intl.locale),
1217
+ children: getCountryFlag(country)
1218
+ }) : null;
1219
+ $[5] = country;
1220
+ $[6] = intl.locale;
1221
+ $[7] = t2;
1222
+ } else t2 = $[7];
1223
+ let t3;
1224
+ if ($[8] !== country || $[9] !== intl.locale || $[10] !== text) {
1225
+ t3 = text !== "" ? text : getCountryName(country, intl.locale);
1226
+ $[8] = country;
1227
+ $[9] = intl.locale;
1228
+ $[10] = text;
1229
+ $[11] = t3;
1230
+ } else t3 = $[11];
1231
+ let t4;
1232
+ if ($[12] !== t3) {
1233
+ t4 = /* @__PURE__ */ jsx("span", {
1234
+ className: Displays_module_default.text,
1235
+ "data-clamp": "",
1236
+ children: t3
1237
+ });
1238
+ $[12] = t3;
1239
+ $[13] = t4;
1240
+ } else t4 = $[13];
1241
+ let t5;
1242
+ if ($[14] !== t2 || $[15] !== t4) {
1243
+ t5 = /* @__PURE__ */ jsxs("span", {
1244
+ className: Displays_module_default.flagged,
1245
+ children: [t2, t4]
1246
+ });
1247
+ $[14] = t2;
1248
+ $[15] = t4;
1249
+ $[16] = t5;
1250
+ } else t5 = $[16];
1251
+ return t5;
1252
+ }
1253
+ var LINK_ICONS = {
1254
+ url: Globe,
1255
+ page: FileText,
1256
+ email: Mail,
1257
+ tel: Phone,
1258
+ file: File
1259
+ };
1260
+ /**
1261
+ * A link: the icon of its type, and its label in the user's locale, or its page or its URL. It
1262
+ * opens its URL when it has one, in a new tab when the link does.
1263
+ */
1264
+ function LinkDisplay(t0) {
1265
+ const $ = c(19);
1266
+ const { value } = t0;
1267
+ const intl = usePanneauIntl();
1268
+ if (!isLink(value)) {
1269
+ let t1;
1270
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1271
+ t1 = /* @__PURE__ */ jsx(EmptyValue, {});
1272
+ $[0] = t1;
1273
+ } else t1 = $[0];
1274
+ return t1;
1275
+ }
1276
+ let t1;
1277
+ if ($[1] !== intl.locale || $[2] !== value) {
1278
+ t1 = getLinkText(value, intl.locale);
1279
+ $[1] = intl.locale;
1280
+ $[2] = value;
1281
+ $[3] = t1;
1282
+ } else t1 = $[3];
1283
+ const text = t1;
1284
+ if (text === null) {
1285
+ let t2;
1286
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
1287
+ t2 = /* @__PURE__ */ jsx(EmptyValue, {});
1288
+ $[4] = t2;
1289
+ } else t2 = $[4];
1290
+ return t2;
1291
+ }
1292
+ const t2 = LINK_ICONS[value.type] ?? Hash;
1293
+ let t3;
1294
+ if ($[5] !== t2) {
1295
+ t3 = /* @__PURE__ */ jsx(Icon, {
1296
+ icon: t2,
1297
+ size: "sm"
1298
+ });
1299
+ $[5] = t2;
1300
+ $[6] = t3;
1301
+ } else t3 = $[6];
1302
+ const icon = t3;
1303
+ const url = typeof value.url === "string" && value.url !== "" ? value.url : null;
1304
+ if (url === null) {
1305
+ let t4;
1306
+ if ($[7] !== text) {
1307
+ t4 = /* @__PURE__ */ jsx("span", {
1308
+ className: Displays_module_default.text,
1309
+ "data-clamp": "",
1310
+ children: text
1311
+ });
1312
+ $[7] = text;
1313
+ $[8] = t4;
1314
+ } else t4 = $[8];
1315
+ let t5;
1316
+ if ($[9] !== icon || $[10] !== t4) {
1317
+ t5 = /* @__PURE__ */ jsxs("span", {
1318
+ className: Displays_module_default.flagged,
1319
+ children: [icon, t4]
1320
+ });
1321
+ $[9] = icon;
1322
+ $[10] = t4;
1323
+ $[11] = t5;
1324
+ } else t5 = $[11];
1325
+ return t5;
1326
+ }
1327
+ let t4;
1328
+ if ($[12] !== value.newTab) {
1329
+ t4 = value.newTab === true ? {
1330
+ target: "_blank",
1331
+ rel: "noopener noreferrer"
1332
+ } : {};
1333
+ $[12] = value.newTab;
1334
+ $[13] = t4;
1335
+ } else t4 = $[13];
1336
+ let t5;
1337
+ if ($[14] !== icon || $[15] !== t4 || $[16] !== text || $[17] !== url) {
1338
+ t5 = /* @__PURE__ */ jsxs("a", {
1339
+ className: `${Displays_module_default.link} ${Displays_module_default.flagged}`,
1340
+ href: url,
1341
+ ...t4,
1342
+ children: [icon, text]
1343
+ });
1344
+ $[14] = icon;
1345
+ $[15] = t4;
1346
+ $[16] = text;
1347
+ $[17] = url;
1348
+ $[18] = t5;
1349
+ } else t5 = $[18];
1350
+ return t5;
1351
+ }
1352
+ /**
1353
+ * A swatch, with the color's code. A color of the field's palette (`settings.palette`) shows its
1354
+ * swatch and its label.
1355
+ */
1356
+ function ColorDisplay(t0) {
1357
+ const $ = c(18);
1358
+ const { value, field } = t0;
1359
+ if (typeof value !== "string" || value === "") {
1360
+ let t1;
1361
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1362
+ t1 = /* @__PURE__ */ jsx(EmptyValue, {});
1363
+ $[0] = t1;
1364
+ } else t1 = $[0];
1365
+ return t1;
1366
+ }
1367
+ let t1;
1368
+ if ($[1] !== field || $[2] !== value) {
1369
+ t1 = Symbol.for("react.early_return_sentinel");
1370
+ bb0: {
1371
+ const entry = getColorPalette(field)?.find((candidate) => candidate.value === value);
1372
+ if (entry !== void 0) {
1373
+ const swatch = getSwatchColor(entry);
1374
+ let t2;
1375
+ if ($[4] !== swatch) {
1376
+ t2 = swatch !== null ? { backgroundColor: swatch } : void 0;
1377
+ $[4] = swatch;
1378
+ $[5] = t2;
1379
+ } else t2 = $[5];
1380
+ let t3;
1381
+ if ($[6] !== t2) {
1382
+ t3 = /* @__PURE__ */ jsx("span", {
1383
+ className: Displays_module_default.swatch,
1384
+ style: t2,
1385
+ "aria-hidden": "true"
1386
+ });
1387
+ $[6] = t2;
1388
+ $[7] = t3;
1389
+ } else t3 = $[7];
1390
+ const t4 = entry.label ?? entry.value;
1391
+ let t5;
1392
+ if ($[8] !== t4) {
1393
+ t5 = /* @__PURE__ */ jsx("span", {
1394
+ className: Displays_module_default.text,
1395
+ "data-clamp": "",
1396
+ children: t4
1397
+ });
1398
+ $[8] = t4;
1399
+ $[9] = t5;
1400
+ } else t5 = $[9];
1401
+ let t6;
1402
+ if ($[10] !== t3 || $[11] !== t5) {
1403
+ t6 = /* @__PURE__ */ jsxs("span", {
1404
+ className: Displays_module_default.paletteColor,
1405
+ children: [t3, t5]
1406
+ });
1407
+ $[10] = t3;
1408
+ $[11] = t5;
1409
+ $[12] = t6;
1410
+ } else t6 = $[12];
1411
+ t1 = t6;
1412
+ break bb0;
1413
+ }
1414
+ }
1415
+ $[1] = field;
1416
+ $[2] = value;
1417
+ $[3] = t1;
1418
+ } else t1 = $[3];
1419
+ if (t1 !== Symbol.for("react.early_return_sentinel")) return t1;
1420
+ let t2;
1421
+ if ($[13] !== value) {
1422
+ t2 = /* @__PURE__ */ jsx("span", {
1423
+ className: Displays_module_default.swatch,
1424
+ style: { backgroundColor: value },
1425
+ "aria-hidden": "true"
1426
+ });
1427
+ $[13] = value;
1428
+ $[14] = t2;
1429
+ } else t2 = $[14];
1430
+ let t3;
1431
+ if ($[15] !== t2 || $[16] !== value) {
1432
+ t3 = /* @__PURE__ */ jsxs("span", {
1433
+ className: Displays_module_default.color,
1434
+ children: [t2, value]
1435
+ });
1436
+ $[15] = t2;
1437
+ $[16] = value;
1438
+ $[17] = t3;
1439
+ } else t3 = $[17];
1440
+ return t3;
1441
+ }
1442
+ /** The text of a media, a reference or a file: its label, name or file name. */
1443
+ function mediaLabel(value) {
1444
+ for (const key of [
1445
+ "label",
1446
+ "name",
1447
+ "filename"
1448
+ ]) {
1449
+ const text = value[key];
1450
+ if (typeof text === "string" && text !== "") return text;
1451
+ }
1452
+ return "";
1453
+ }
1454
+ /**
1455
+ * A thumbnail and the name of a media (or of the first one), for `media` and `image` values:
1456
+ * a media reference (`{ id, label, media }`), or a media with its URLs.
1457
+ */
1458
+ function MediaDisplay(t0) {
1459
+ const $ = c(12);
1460
+ const { value } = t0;
1461
+ const media = Array.isArray(value) ? value[0] : value;
1462
+ if (!isRecord(media)) {
1463
+ let t1;
1464
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1465
+ t1 = /* @__PURE__ */ jsx(EmptyValue, {});
1466
+ $[0] = t1;
1467
+ } else t1 = $[0];
1468
+ return t1;
1469
+ }
1470
+ let t1;
1471
+ if ($[1] !== media) {
1472
+ t1 = getImageUrl(media);
1473
+ $[1] = media;
1474
+ $[2] = t1;
1475
+ } else t1 = $[2];
1476
+ const source = t1;
1477
+ let t2;
1478
+ if ($[3] !== media) {
1479
+ t2 = mediaLabel(media);
1480
+ $[3] = media;
1481
+ $[4] = t2;
1482
+ } else t2 = $[4];
1483
+ const label = t2;
1484
+ let t3;
1485
+ if ($[5] !== source) {
1486
+ t3 = source !== null ? /* @__PURE__ */ jsx("img", {
1487
+ className: Displays_module_default.thumbnail,
1488
+ src: source,
1489
+ alt: "",
1490
+ loading: "lazy"
1491
+ }) : null;
1492
+ $[5] = source;
1493
+ $[6] = t3;
1494
+ } else t3 = $[6];
1495
+ let t4;
1496
+ if ($[7] !== label) {
1497
+ t4 = label !== "" ? /* @__PURE__ */ jsx("span", {
1498
+ className: Displays_module_default.text,
1499
+ "data-clamp": "",
1500
+ children: label
1501
+ }) : null;
1502
+ $[7] = label;
1503
+ $[8] = t4;
1504
+ } else t4 = $[8];
1505
+ let t5;
1506
+ if ($[9] !== t3 || $[10] !== t4) {
1507
+ t5 = /* @__PURE__ */ jsxs("span", {
1508
+ className: Displays_module_default.media,
1509
+ children: [t3, t4]
1510
+ });
1511
+ $[9] = t3;
1512
+ $[10] = t4;
1513
+ $[11] = t5;
1514
+ } else t5 = $[11];
1515
+ return t5;
1516
+ }
1517
+ /**
1518
+ * Stored files (`file` values): the thumbnail of an image, or an icon, and the name of each file,
1519
+ * linked to its URL.
1520
+ */
1521
+ function FileDisplay(t0) {
1522
+ const $ = c(8);
1523
+ const { value } = t0;
1524
+ let t1;
1525
+ let t2;
1526
+ let t3;
1527
+ if ($[0] !== value) {
1528
+ t3 = Symbol.for("react.early_return_sentinel");
1529
+ bb0: {
1530
+ const files = (Array.isArray(value) ? value : [value]).filter(isRecord);
1531
+ if (files.length === 0) {
1532
+ let t4;
1533
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
1534
+ t4 = /* @__PURE__ */ jsx(EmptyValue, {});
1535
+ $[4] = t4;
1536
+ } else t4 = $[4];
1537
+ t3 = t4;
1538
+ break bb0;
1539
+ }
1540
+ t1 = Displays_module_default.files;
1541
+ t2 = files.map(_temp5);
1542
+ }
1543
+ $[0] = value;
1544
+ $[1] = t1;
1545
+ $[2] = t2;
1546
+ $[3] = t3;
1547
+ } else {
1548
+ t1 = $[1];
1549
+ t2 = $[2];
1550
+ t3 = $[3];
1551
+ }
1552
+ if (t3 !== Symbol.for("react.early_return_sentinel")) return t3;
1553
+ let t4;
1554
+ if ($[5] !== t1 || $[6] !== t2) {
1555
+ t4 = /* @__PURE__ */ jsx("span", {
1556
+ className: t1,
1557
+ children: t2
1558
+ });
1559
+ $[5] = t1;
1560
+ $[6] = t2;
1561
+ $[7] = t4;
1562
+ } else t4 = $[7];
1563
+ return t4;
1564
+ }
1565
+ /**
1566
+ * The built-in displays, by name. A column's display is its `display`, its field's `display`, or
1567
+ * its field's type: field types are display names. Values without a known display are shown as
1568
+ * text.
1569
+ */
1570
+ function _temp5(file, index) {
1571
+ const image = getImageUrl(file);
1572
+ const name = mediaLabel(file);
1573
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [image !== null ? /* @__PURE__ */ jsx("img", {
1574
+ className: Displays_module_default.thumbnail,
1575
+ src: image,
1576
+ alt: "",
1577
+ loading: "lazy"
1578
+ }) : /* @__PURE__ */ jsx(Icon, {
1579
+ icon: File,
1580
+ size: "sm"
1581
+ }), /* @__PURE__ */ jsx("span", {
1582
+ className: Displays_module_default.text,
1583
+ "data-clamp": "",
1584
+ children: name !== "" ? name : typeof file.url === "string" ? file.url : ""
1585
+ })] });
1586
+ return typeof file.url === "string" && file.url !== "" ? /* @__PURE__ */ jsx("a", {
1587
+ className: `${Displays_module_default.link} ${Displays_module_default.media}`,
1588
+ href: file.url,
1589
+ target: "_blank",
1590
+ rel: "noreferrer",
1591
+ children: content
1592
+ }, index) : /* @__PURE__ */ jsx("span", {
1593
+ className: Displays_module_default.media,
1594
+ children: content
1595
+ }, index);
1596
+ }
550
1597
  var builtInDisplays = {
551
1598
  text: TextDisplay,
552
1599
  textarea: TextDisplay,
@@ -562,9 +1609,24 @@ var builtInDisplays = {
562
1609
  url: UrlDisplay,
563
1610
  email: EmailDisplay,
564
1611
  color: ColorDisplay,
565
- media: MediaDisplay
1612
+ media: MediaDisplay,
1613
+ image: MediaDisplay,
1614
+ file: FileDisplay,
1615
+ tel: TelDisplay,
1616
+ range: NumberDisplay,
1617
+ duration: DurationDisplay,
1618
+ json: JsonDisplay,
1619
+ tags: TagsDisplay,
1620
+ embed: EmbedDisplay,
1621
+ location: LocationDisplay,
1622
+ country: CountryDisplay,
1623
+ region: RegionDisplay,
1624
+ address: AddressDisplay,
1625
+ link: LinkDisplay,
1626
+ daterange: DateRangeDisplay,
1627
+ money: MoneyDisplay
566
1628
  };
567
1629
  //#endregion
568
- export { BooleanDisplay, ColorDisplay, DateDisplay, DateTimeDisplay, EmailDisplay, EmptyValue, MediaDisplay, NumberDisplay, RelationDisplay, RichTextDisplay, SelectDisplay, TextDisplay, TimeDisplay, UrlDisplay, builtInDisplays };
1630
+ export { AddressDisplay, BooleanDisplay, ColorDisplay, CountryDisplay, DateDisplay, DateRangeDisplay, DateTimeDisplay, DurationDisplay, EmailDisplay, EmbedDisplay, EmptyValue, FileDisplay, JsonDisplay, LinkDisplay, LocationDisplay, MediaDisplay, MoneyDisplay, NumberDisplay, RegionDisplay, RelationDisplay, RichTextDisplay, SelectDisplay, TagsDisplay, TelDisplay, TextDisplay, TimeDisplay, UrlDisplay, builtInDisplays };
569
1631
 
570
1632
  //# sourceMappingURL=displays.js.map