@panneau/lists 5.0.0-alpha.15 → 5.0.0-alpha.17

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 (59) hide show
  1. package/dist/ListView.d.ts +7 -1
  2. package/dist/ListView.d.ts.map +1 -1
  3. package/dist/ListView.js +302 -297
  4. package/dist/ListView.js.map +1 -1
  5. package/dist/actions/ActionButton.d.ts +7 -1
  6. package/dist/actions/ActionButton.d.ts.map +1 -1
  7. package/dist/actions/ActionButton.js +74 -72
  8. package/dist/actions/ActionButton.js.map +1 -1
  9. package/dist/actions/Actions.css +12 -0
  10. package/dist/actions/Actions.module.js +6 -2
  11. package/dist/actions/Actions.module.js.map +1 -1
  12. package/dist/actions/RowActions.d.ts +21 -4
  13. package/dist/actions/RowActions.d.ts.map +1 -1
  14. package/dist/actions/RowActions.js +149 -84
  15. package/dist/actions/RowActions.js.map +1 -1
  16. package/dist/actions/fit.d.ts +25 -0
  17. package/dist/actions/fit.d.ts.map +1 -0
  18. package/dist/actions/fit.js +197 -0
  19. package/dist/actions/fit.js.map +1 -0
  20. package/dist/actions/icons.d.ts +5 -0
  21. package/dist/actions/icons.d.ts.map +1 -1
  22. package/dist/actions/icons.js +15 -1
  23. package/dist/actions/icons.js.map +1 -1
  24. package/dist/displays/Displays.css +19 -1
  25. package/dist/displays/Displays.module.js +8 -2
  26. package/dist/displays/Displays.module.js.map +1 -1
  27. package/dist/displays/displays.d.ts +31 -8
  28. package/dist/displays/displays.d.ts.map +1 -1
  29. package/dist/displays/displays.js +615 -164
  30. package/dist/displays/displays.js.map +1 -1
  31. package/dist/index.d.ts +1 -1
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +2 -2
  34. package/dist/layouts/CalendarLayout.d.ts +4 -4
  35. package/dist/layouts/CalendarLayout.d.ts.map +1 -1
  36. package/dist/layouts/CalendarLayout.js +25 -20
  37. package/dist/layouts/CalendarLayout.js.map +1 -1
  38. package/dist/layouts/CardsLayout.d.ts.map +1 -1
  39. package/dist/layouts/CardsLayout.js +90 -93
  40. package/dist/layouts/CardsLayout.js.map +1 -1
  41. package/dist/layouts/GalleryLayout.css +7 -0
  42. package/dist/layouts/GalleryLayout.d.ts.map +1 -1
  43. package/dist/layouts/GalleryLayout.js +76 -53
  44. package/dist/layouts/GalleryLayout.js.map +1 -1
  45. package/dist/layouts/GalleryLayout.module.js.map +1 -1
  46. package/dist/layouts/TableLayout.d.ts.map +1 -1
  47. package/dist/layouts/TableLayout.js +120 -93
  48. package/dist/layouts/TableLayout.js.map +1 -1
  49. package/dist/layouts/calendarDays.d.ts +14 -0
  50. package/dist/layouts/calendarDays.d.ts.map +1 -0
  51. package/dist/layouts/calendarDays.js +44 -0
  52. package/dist/layouts/calendarDays.js.map +1 -0
  53. package/dist/query.d.ts +3 -2
  54. package/dist/query.d.ts.map +1 -1
  55. package/dist/query.js +15 -4
  56. package/dist/query.js.map +1 -1
  57. package/dist/types.d.ts +9 -1
  58. package/dist/types.d.ts.map +1 -1
  59. package/package.json +7 -7
@@ -2,14 +2,20 @@ import { messages } from "../messages.js";
2
2
  import { findOption, getFieldOptions, toText } from "../values.js";
3
3
  import Displays_module_default from "./Displays.module.js";
4
4
  import { c } from "react/compiler-runtime";
5
+ import { fieldsMessages } from "@panneau/intl";
5
6
  import { Badge, Icon, usePanneauIntl } from "@panneau/ui";
6
7
  import { jsx, jsxs } from "react/jsx-runtime";
7
- import { Check, Minus } from "lucide-react";
8
+ import { Check, File, FileText, Globe, Hash, Mail, Minus, Phone } from "lucide-react";
8
9
  import { toReferences } from "@panneau/fields";
10
+ import { formatAddress, isAddress } from "@panneau/fields/address";
11
+ import { getColorPalette, getSwatchColor } from "@panneau/fields/color";
9
12
  import { getCountryFlag, getCountryName, isCountryCode } from "@panneau/fields/country";
10
- import { formatDuration } from "@panneau/fields/duration";
11
- import { getRegionCountry, getRegionName } from "@panneau/fields/region";
12
- import { parsePhone } from "@panneau/fields/tel";
13
+ import { formatDateRange, getDateRangeSettings } from "@panneau/fields/daterange";
14
+ import { formatDuration, getDurationUnits } from "@panneau/fields/duration";
15
+ import { getLinkText, isLink } from "@panneau/fields/link";
16
+ import { formatMoney } from "@panneau/fields/money";
17
+ import { RegionFlag, getRegionCountry, getRegionName } from "@panneau/fields/region";
18
+ import { parsePhone, splitExtension } from "@panneau/fields/tel";
13
19
  //#region src/displays/displays.tsx
14
20
  /** What a cell shows without a value. Hidden from assistive technologies, which skip the cell. */
15
21
  function EmptyValue() {
@@ -75,6 +81,7 @@ function TextDisplay(t0) {
75
81
  if ($[8] !== text) {
76
82
  t2 = /* @__PURE__ */ jsx("span", {
77
83
  className: Displays_module_default.text,
84
+ "data-clamp": "",
78
85
  children: text
79
86
  });
80
87
  $[8] = text;
@@ -97,6 +104,7 @@ function RichTextDisplay(t0) {
97
104
  if ($[2] !== text) {
98
105
  t2 = text === "" ? /* @__PURE__ */ jsx(EmptyValue, {}) : /* @__PURE__ */ jsx("span", {
99
106
  className: Displays_module_default.text,
107
+ "data-clamp": "",
100
108
  children: text
101
109
  });
102
110
  $[2] = text;
@@ -287,6 +295,87 @@ function DateTimeDisplay(t0) {
287
295
  } else t4 = $[8];
288
296
  return t4;
289
297
  }
298
+ /**
299
+ * A range of dates (decision 0053), in the format of the locale: `Nov 4 – 6, 2026`. Date-times show
300
+ * in the zone of the value or the field, with its short name when it isn't the user's. A range open
301
+ * at one end shows `From Nov 4, 2026` or `Until Dec 1, 2026`.
302
+ */
303
+ function DateRangeDisplay(t0) {
304
+ const $ = c(8);
305
+ const { value, field } = t0;
306
+ const intl = usePanneauIntl();
307
+ let t1;
308
+ let t2;
309
+ if ($[0] !== field?.settings || $[1] !== intl || $[2] !== value) {
310
+ t2 = Symbol.for("react.early_return_sentinel");
311
+ bb0: {
312
+ const range = formatDateRange(value, intl.locale, getDateRangeSettings(field?.settings).timeZone);
313
+ if (range === null) {
314
+ let t3;
315
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
316
+ t3 = /* @__PURE__ */ jsx(EmptyValue, {});
317
+ $[5] = t3;
318
+ } else t3 = $[5];
319
+ t2 = t3;
320
+ break bb0;
321
+ }
322
+ t1 = range.kind === "from" ? intl.formatMessage(messages.rangeFrom, { start: range.text }) : range.kind === "until" ? intl.formatMessage(messages.rangeUntil, { end: range.text }) : range.text;
323
+ }
324
+ $[0] = field?.settings;
325
+ $[1] = intl;
326
+ $[2] = value;
327
+ $[3] = t1;
328
+ $[4] = t2;
329
+ } else {
330
+ t1 = $[3];
331
+ t2 = $[4];
332
+ }
333
+ if (t2 !== Symbol.for("react.early_return_sentinel")) return t2;
334
+ const text = t1;
335
+ let t3;
336
+ if ($[6] !== text) {
337
+ t3 = /* @__PURE__ */ jsx("span", {
338
+ className: Displays_module_default.text,
339
+ "data-clamp": "",
340
+ children: text
341
+ });
342
+ $[6] = text;
343
+ $[7] = t3;
344
+ } else t3 = $[7];
345
+ return t3;
346
+ }
347
+ /** An amount of money (decision 0053), in the currency format of the locale: `1 250,00 $`. */
348
+ function MoneyDisplay(t0) {
349
+ const $ = c(6);
350
+ const { value } = t0;
351
+ const intl = usePanneauIntl();
352
+ let t1;
353
+ if ($[0] !== intl.locale || $[1] !== value) {
354
+ t1 = formatMoney(value, intl.locale);
355
+ $[0] = intl.locale;
356
+ $[1] = value;
357
+ $[2] = t1;
358
+ } else t1 = $[2];
359
+ const text = t1;
360
+ if (text === null) {
361
+ let t2;
362
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
363
+ t2 = /* @__PURE__ */ jsx(EmptyValue, {});
364
+ $[3] = t2;
365
+ } else t2 = $[3];
366
+ return t2;
367
+ }
368
+ let t2;
369
+ if ($[4] !== text) {
370
+ t2 = /* @__PURE__ */ jsx("span", {
371
+ className: Displays_module_default.number,
372
+ children: text
373
+ });
374
+ $[4] = text;
375
+ $[5] = t2;
376
+ } else t2 = $[5];
377
+ return t2;
378
+ }
290
379
  /** A time of day (`14:30`), in the format of the locale. */
291
380
  function TimeDisplay(t0) {
292
381
  const $ = c(13);
@@ -391,48 +480,54 @@ function SelectDisplay(t0) {
391
480
  }
392
481
  /** The labels of related items. */
393
482
  function RelationDisplay(t0) {
394
- const $ = c(8);
483
+ const $ = c(10);
395
484
  const { value } = t0;
396
485
  let t1;
397
486
  let t2;
398
487
  let t3;
488
+ let t4;
399
489
  if ($[0] !== value) {
400
- t3 = Symbol.for("react.early_return_sentinel");
490
+ t4 = Symbol.for("react.early_return_sentinel");
401
491
  bb0: {
402
492
  const references = toReferences(value);
403
493
  if (references.length === 0) {
404
- let t4;
405
- if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
406
- t4 = /* @__PURE__ */ jsx(EmptyValue, {});
407
- $[4] = t4;
408
- } else t4 = $[4];
409
- t3 = t4;
494
+ let t5;
495
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
496
+ t5 = /* @__PURE__ */ jsx(EmptyValue, {});
497
+ $[5] = t5;
498
+ } else t5 = $[5];
499
+ t4 = t5;
410
500
  break bb0;
411
501
  }
412
502
  t1 = Displays_module_default.text;
413
- t2 = references.map(_temp).join(", ");
503
+ t2 = "";
504
+ t3 = references.map(_temp).join(", ");
414
505
  }
415
506
  $[0] = value;
416
507
  $[1] = t1;
417
508
  $[2] = t2;
418
509
  $[3] = t3;
510
+ $[4] = t4;
419
511
  } else {
420
512
  t1 = $[1];
421
513
  t2 = $[2];
422
514
  t3 = $[3];
515
+ t4 = $[4];
423
516
  }
424
- if (t3 !== Symbol.for("react.early_return_sentinel")) return t3;
425
- let t4;
426
- if ($[5] !== t1 || $[6] !== t2) {
427
- t4 = /* @__PURE__ */ jsx("span", {
517
+ if (t4 !== Symbol.for("react.early_return_sentinel")) return t4;
518
+ let t5;
519
+ if ($[6] !== t1 || $[7] !== t2 || $[8] !== t3) {
520
+ t5 = /* @__PURE__ */ jsx("span", {
428
521
  className: t1,
429
- children: t2
522
+ "data-clamp": t2,
523
+ children: t3
430
524
  });
431
- $[5] = t1;
432
- $[6] = t2;
433
- $[7] = t4;
434
- } else t4 = $[7];
435
- return t4;
525
+ $[6] = t1;
526
+ $[7] = t2;
527
+ $[8] = t3;
528
+ $[9] = t5;
529
+ } else t5 = $[9];
530
+ return t5;
436
531
  }
437
532
  /** A link that opens the URL. */
438
533
  function _temp(reference) {
@@ -503,11 +598,13 @@ function EmailDisplay(t0) {
503
598
  }
504
599
  /**
505
600
  * A link that calls the phone number: the flag of its country and the number in its international
506
- * format (`+1 514 555 0199`). A value that isn't E.164 shows as it is.
601
+ * format (`+1 514 555 0199`), with its extension (`, ext. 123`) when its field allows one
602
+ * (`settings.extension`) or the column has no field. A value that isn't E.164 shows as it is.
507
603
  */
508
604
  function TelDisplay(t0) {
509
- const $ = c(16);
510
- const { value } = t0;
605
+ const $ = c(20);
606
+ const { value, field } = t0;
607
+ const intl = usePanneauIntl();
511
608
  if (typeof value !== "string" || value.trim() === "") {
512
609
  let t1;
513
610
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -516,148 +613,214 @@ function TelDisplay(t0) {
516
613
  } else t1 = $[0];
517
614
  return t1;
518
615
  }
519
- let number;
520
616
  let t1;
521
617
  let t2;
522
618
  let t3;
523
619
  let t4;
524
- if ($[1] !== value) {
525
- t4 = Symbol.for("react.early_return_sentinel");
620
+ let t5;
621
+ if ($[1] !== field || $[2] !== intl || $[3] !== value) {
622
+ t5 = Symbol.for("react.early_return_sentinel");
526
623
  bb0: {
527
- number = parsePhone(value);
624
+ const { number: text, extension } = field === null || field.settings?.extension === true ? splitExtension(value) : {
625
+ number: value,
626
+ extension: null
627
+ };
628
+ const number = parsePhone(text);
528
629
  if (number === null) {
529
- let t5;
530
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
531
- t5 = /[^\d+]/g;
532
- $[7] = t5;
533
- } else t5 = $[7];
534
- const t6 = `tel:${value.replace(t5, "")}`;
535
- let t7;
536
- if ($[8] !== t6 || $[9] !== value) {
537
- t7 = /* @__PURE__ */ jsx("a", {
630
+ let t6;
631
+ if ($[9] !== value) {
632
+ let t7;
633
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
634
+ t7 = /[^\d+]/g;
635
+ $[11] = t7;
636
+ } else t7 = $[11];
637
+ t6 = value.replace(t7, "");
638
+ $[9] = value;
639
+ $[10] = t6;
640
+ } else t6 = $[10];
641
+ const t7 = `tel:${t6}`;
642
+ let t8;
643
+ if ($[12] !== t7 || $[13] !== value) {
644
+ t8 = /* @__PURE__ */ jsx("a", {
538
645
  className: Displays_module_default.link,
539
- href: t6,
646
+ href: t7,
540
647
  children: value
541
648
  });
542
- $[8] = t6;
543
- $[9] = value;
544
- $[10] = t7;
545
- } else t7 = $[10];
546
- t4 = t7;
649
+ $[12] = t7;
650
+ $[13] = value;
651
+ $[14] = t8;
652
+ } else t8 = $[14];
653
+ t5 = t8;
547
654
  break bb0;
548
655
  }
549
656
  t1 = `${Displays_module_default.link} ${Displays_module_default.flagged}`;
550
- t2 = `tel:${number.number}`;
657
+ t2 = `tel:${number.number}${extension !== null ? `;ext=${extension}` : ""}`;
551
658
  t3 = number.country !== null ? /* @__PURE__ */ jsx("span", {
552
659
  className: Displays_module_default.flag,
553
660
  "aria-hidden": "true",
554
661
  children: getCountryFlag(number.country)
555
662
  }) : null;
663
+ t4 = extension !== null ? intl.formatMessage(messages.phoneExtension, {
664
+ number: number.international,
665
+ extension
666
+ }) : number.international;
556
667
  }
557
- $[1] = value;
558
- $[2] = number;
559
- $[3] = t1;
560
- $[4] = t2;
561
- $[5] = t3;
562
- $[6] = t4;
668
+ $[1] = field;
669
+ $[2] = intl;
670
+ $[3] = value;
671
+ $[4] = t1;
672
+ $[5] = t2;
673
+ $[6] = t3;
674
+ $[7] = t4;
675
+ $[8] = t5;
563
676
  } else {
564
- number = $[2];
565
- t1 = $[3];
566
- t2 = $[4];
567
- t3 = $[5];
568
- t4 = $[6];
677
+ t1 = $[4];
678
+ t2 = $[5];
679
+ t3 = $[6];
680
+ t4 = $[7];
681
+ t5 = $[8];
569
682
  }
570
- if (t4 !== Symbol.for("react.early_return_sentinel")) return t4;
571
- let t5;
572
- if ($[11] !== number.international || $[12] !== t1 || $[13] !== t2 || $[14] !== t3) {
573
- t5 = /* @__PURE__ */ jsxs("a", {
683
+ if (t5 !== Symbol.for("react.early_return_sentinel")) return t5;
684
+ let t6;
685
+ if ($[15] !== t1 || $[16] !== t2 || $[17] !== t3 || $[18] !== t4) {
686
+ t6 = /* @__PURE__ */ jsxs("a", {
574
687
  className: t1,
575
688
  href: t2,
576
- children: [t3, number.international]
689
+ children: [t3, t4]
577
690
  });
578
- $[11] = number.international;
579
- $[12] = t1;
580
- $[13] = t2;
581
- $[14] = t3;
582
- $[15] = t5;
583
- } else t5 = $[15];
584
- return t5;
691
+ $[15] = t1;
692
+ $[16] = t2;
693
+ $[17] = t3;
694
+ $[18] = t4;
695
+ $[19] = t6;
696
+ } else t6 = $[19];
697
+ return t6;
585
698
  }
586
699
  /** A country: its flag and its name in the user's locale. */
587
- function CountryDisplay(t0) {
588
- const $ = c(15);
589
- const { value } = t0;
700
+ function Country(t0) {
701
+ const $ = c(14);
702
+ const { code } = t0;
590
703
  const intl = usePanneauIntl();
591
- if (typeof value !== "string" || value === "") {
592
- let t1;
593
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
594
- t1 = /* @__PURE__ */ jsx(EmptyValue, {});
595
- $[0] = t1;
596
- } else t1 = $[0];
597
- return t1;
598
- }
599
- if (!isCountryCode(value)) {
704
+ if (!isCountryCode(code)) {
600
705
  let t1;
601
- if ($[1] !== value) {
706
+ if ($[0] !== code) {
602
707
  t1 = /* @__PURE__ */ jsx("span", {
603
708
  className: Displays_module_default.text,
604
- children: value
709
+ "data-clamp": "",
710
+ children: code
605
711
  });
606
- $[1] = value;
607
- $[2] = t1;
608
- } else t1 = $[2];
712
+ $[0] = code;
713
+ $[1] = t1;
714
+ } else t1 = $[1];
609
715
  return t1;
610
716
  }
611
717
  let t1;
612
- if ($[3] !== value) {
613
- t1 = getCountryFlag(value);
614
- $[3] = value;
615
- $[4] = t1;
616
- } else t1 = $[4];
718
+ if ($[2] !== code) {
719
+ t1 = getCountryFlag(code);
720
+ $[2] = code;
721
+ $[3] = t1;
722
+ } else t1 = $[3];
617
723
  let t2;
618
- if ($[5] !== t1) {
724
+ if ($[4] !== t1) {
619
725
  t2 = /* @__PURE__ */ jsx("span", {
620
726
  className: Displays_module_default.flag,
621
727
  "aria-hidden": "true",
622
728
  children: t1
623
729
  });
624
- $[5] = t1;
625
- $[6] = t2;
626
- } else t2 = $[6];
730
+ $[4] = t1;
731
+ $[5] = t2;
732
+ } else t2 = $[5];
627
733
  let t3;
628
- if ($[7] !== intl.locale || $[8] !== value) {
629
- t3 = getCountryName(value, intl.locale);
734
+ if ($[6] !== code || $[7] !== intl.locale) {
735
+ t3 = getCountryName(code, intl.locale);
736
+ $[6] = code;
630
737
  $[7] = intl.locale;
631
- $[8] = value;
632
- $[9] = t3;
633
- } else t3 = $[9];
738
+ $[8] = t3;
739
+ } else t3 = $[8];
634
740
  let t4;
635
- if ($[10] !== t3) {
741
+ if ($[9] !== t3) {
636
742
  t4 = /* @__PURE__ */ jsx("span", {
637
743
  className: Displays_module_default.text,
744
+ "data-clamp": "",
638
745
  children: t3
639
746
  });
640
- $[10] = t3;
641
- $[11] = t4;
642
- } else t4 = $[11];
747
+ $[9] = t3;
748
+ $[10] = t4;
749
+ } else t4 = $[10];
643
750
  let t5;
644
- if ($[12] !== t2 || $[13] !== t4) {
751
+ if ($[11] !== t2 || $[12] !== t4) {
645
752
  t5 = /* @__PURE__ */ jsxs("span", {
646
753
  className: Displays_module_default.flagged,
647
754
  children: [t2, t4]
648
755
  });
649
- $[12] = t2;
650
- $[13] = t4;
651
- $[14] = t5;
652
- } else t5 = $[14];
756
+ $[11] = t2;
757
+ $[12] = t4;
758
+ $[13] = t5;
759
+ } else t5 = $[13];
653
760
  return t5;
654
761
  }
762
+ /** A country, or several (`multiple`): their flags and their names in the user's locale. */
763
+ function CountryDisplay(t0) {
764
+ const $ = c(8);
765
+ const { value } = t0;
766
+ let t1;
767
+ let t2;
768
+ let t3;
769
+ if ($[0] !== value) {
770
+ t3 = Symbol.for("react.early_return_sentinel");
771
+ bb0: {
772
+ const codes = (Array.isArray(value) ? value : [value]).filter(_temp2);
773
+ if (codes.length === 0) {
774
+ let t4;
775
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
776
+ t4 = /* @__PURE__ */ jsx(EmptyValue, {});
777
+ $[4] = t4;
778
+ } else t4 = $[4];
779
+ t3 = t4;
780
+ break bb0;
781
+ }
782
+ if (codes.length === 1) {
783
+ t3 = /* @__PURE__ */ jsx(Country, { code: codes[0] });
784
+ break bb0;
785
+ }
786
+ t1 = Displays_module_default.countries;
787
+ t2 = codes.map(_temp3);
788
+ }
789
+ $[0] = value;
790
+ $[1] = t1;
791
+ $[2] = t2;
792
+ $[3] = t3;
793
+ } else {
794
+ t1 = $[1];
795
+ t2 = $[2];
796
+ t3 = $[3];
797
+ }
798
+ if (t3 !== Symbol.for("react.early_return_sentinel")) return t3;
799
+ let t4;
800
+ if ($[5] !== t1 || $[6] !== t2) {
801
+ t4 = /* @__PURE__ */ jsx("span", {
802
+ className: t1,
803
+ children: t2
804
+ });
805
+ $[5] = t1;
806
+ $[6] = t2;
807
+ $[7] = t4;
808
+ } else t4 = $[7];
809
+ return t4;
810
+ }
655
811
  /**
656
- * A region: its name in the user's locale, from its country in the item (the field's `from`) or
657
- * the field's settings. A region that Panneau doesn't know shows as it is.
812
+ * A region: its flag, when it has one, and its name in the user's locale, from its country in the
813
+ * item (the field's `from`) or the field's settings. A region that Panneau doesn't know shows as it
814
+ * is.
658
815
  */
816
+ function _temp3(code_0) {
817
+ return /* @__PURE__ */ jsx(Country, { code: code_0 }, code_0);
818
+ }
819
+ function _temp2(code) {
820
+ return typeof code === "string" && code !== "";
821
+ }
659
822
  function RegionDisplay(t0) {
660
- const $ = c(10);
823
+ const $ = c(17);
661
824
  const { value, field, item } = t0;
662
825
  const intl = usePanneauIntl();
663
826
  if (typeof value !== "string" || value === "") {
@@ -668,38 +831,76 @@ function RegionDisplay(t0) {
668
831
  } else t1 = $[0];
669
832
  return t1;
670
833
  }
834
+ let country;
671
835
  let t1;
672
- let t2;
673
836
  if ($[1] !== field || $[2] !== intl.locale || $[3] !== item || $[4] !== value) {
674
- const country = field !== null ? getRegionCountry(field, item) : null;
675
- t1 = Displays_module_default.text;
676
- t2 = getRegionName(country, value, intl.locale) ?? value;
837
+ country = field !== null ? getRegionCountry(field, item) : null;
838
+ t1 = getRegionName(country, value, intl.locale);
677
839
  $[1] = field;
678
840
  $[2] = intl.locale;
679
841
  $[3] = item;
680
842
  $[4] = value;
681
- $[5] = t1;
682
- $[6] = t2;
843
+ $[5] = country;
844
+ $[6] = t1;
683
845
  } else {
684
- t1 = $[5];
685
- t2 = $[6];
846
+ country = $[5];
847
+ t1 = $[6];
686
848
  }
849
+ const name = t1;
850
+ if (name === null) {
851
+ let t2;
852
+ if ($[7] !== value) {
853
+ t2 = /* @__PURE__ */ jsx("span", {
854
+ className: Displays_module_default.text,
855
+ "data-clamp": "",
856
+ children: value
857
+ });
858
+ $[7] = value;
859
+ $[8] = t2;
860
+ } else t2 = $[8];
861
+ return t2;
862
+ }
863
+ let t2;
864
+ if ($[9] !== country || $[10] !== value) {
865
+ t2 = /* @__PURE__ */ jsx(RegionFlag, {
866
+ country,
867
+ code: value,
868
+ className: Displays_module_default.regionFlag
869
+ });
870
+ $[9] = country;
871
+ $[10] = value;
872
+ $[11] = t2;
873
+ } else t2 = $[11];
687
874
  let t3;
688
- if ($[7] !== t1 || $[8] !== t2) {
875
+ if ($[12] !== name) {
689
876
  t3 = /* @__PURE__ */ jsx("span", {
690
- className: t1,
691
- children: t2
877
+ className: Displays_module_default.text,
878
+ "data-clamp": "",
879
+ children: name
692
880
  });
693
- $[7] = t1;
694
- $[8] = t2;
695
- $[9] = t3;
696
- } else t3 = $[9];
697
- return t3;
881
+ $[12] = name;
882
+ $[13] = t3;
883
+ } else t3 = $[13];
884
+ let t4;
885
+ if ($[14] !== t2 || $[15] !== t3) {
886
+ t4 = /* @__PURE__ */ jsxs("span", {
887
+ className: Displays_module_default.flagged,
888
+ children: [t2, t3]
889
+ });
890
+ $[14] = t2;
891
+ $[15] = t3;
892
+ $[16] = t4;
893
+ } else t4 = $[16];
894
+ return t4;
698
895
  }
699
- /** A duration in seconds, with its units: `1 h 5 min`, to the precision of its field. */
896
+ /**
897
+ * A duration with its units, `1 h 5 min` or `2 d 4 h`: in the unit of its field (seconds by
898
+ * default), from its largest unit to its precision.
899
+ */
700
900
  function DurationDisplay(t0) {
701
- const $ = c(6);
901
+ const $ = c(9);
702
902
  const { value, field } = t0;
903
+ const intl = usePanneauIntl();
703
904
  if (typeof value !== "number" || Number.isNaN(value)) {
704
905
  let t1;
705
906
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -708,24 +909,41 @@ function DurationDisplay(t0) {
708
909
  } else t1 = $[0];
709
910
  return t1;
710
911
  }
711
- const precision = field?.settings?.precision === "minutes" ? "minutes" : "seconds";
712
912
  let t1;
713
- if ($[1] !== precision || $[2] !== value) {
714
- t1 = formatDuration(value, { precision });
715
- $[1] = precision;
716
- $[2] = value;
717
- $[3] = t1;
718
- } else t1 = $[3];
719
913
  let t2;
720
- if ($[4] !== t1) {
721
- t2 = /* @__PURE__ */ jsx("span", {
722
- className: Displays_module_default.number,
723
- children: t1
914
+ if ($[1] !== field || $[2] !== intl || $[3] !== value) {
915
+ const labels = {
916
+ days: intl.formatMessage(fieldsMessages.daysUnit),
917
+ hours: intl.formatMessage(fieldsMessages.hoursUnit),
918
+ minutes: intl.formatMessage(fieldsMessages.minutesUnit),
919
+ seconds: intl.formatMessage(fieldsMessages.secondsUnit)
920
+ };
921
+ const units = field !== null ? getDurationUnits(field) : {};
922
+ t1 = Displays_module_default.number;
923
+ t2 = formatDuration(value, {
924
+ ...units,
925
+ labels
724
926
  });
927
+ $[1] = field;
928
+ $[2] = intl;
929
+ $[3] = value;
725
930
  $[4] = t1;
726
931
  $[5] = t2;
727
- } else t2 = $[5];
728
- return t2;
932
+ } else {
933
+ t1 = $[4];
934
+ t2 = $[5];
935
+ }
936
+ let t3;
937
+ if ($[6] !== t1 || $[7] !== t2) {
938
+ t3 = /* @__PURE__ */ jsx("span", {
939
+ className: t1,
940
+ children: t2
941
+ });
942
+ $[6] = t1;
943
+ $[7] = t2;
944
+ $[8] = t3;
945
+ } else t3 = $[8];
946
+ return t3;
729
947
  }
730
948
  /** JSON on one line, shortened. */
731
949
  function JsonDisplay(t0) {
@@ -780,7 +998,7 @@ function TagsDisplay(t0) {
780
998
  if ($[0] !== field?.options || $[1] !== value) {
781
999
  t3 = Symbol.for("react.early_return_sentinel");
782
1000
  bb0: {
783
- const tags = Array.isArray(value) ? value.filter(_temp2) : [];
1001
+ const tags = Array.isArray(value) ? value.filter(_temp4) : [];
784
1002
  if (tags.length === 0) {
785
1003
  let t4;
786
1004
  if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
@@ -830,7 +1048,7 @@ function TagsDisplay(t0) {
830
1048
  return t4;
831
1049
  }
832
1050
  /** What a URL embeds: its thumbnail and title, linked to it. */
833
- function _temp2(tag) {
1051
+ function _temp4(tag) {
834
1052
  return typeof tag === "string";
835
1053
  }
836
1054
  function EmbedDisplay(t0) {
@@ -866,6 +1084,7 @@ function EmbedDisplay(t0) {
866
1084
  if ($[6] !== t2) {
867
1085
  t3 = /* @__PURE__ */ jsx("span", {
868
1086
  className: Displays_module_default.text,
1087
+ "data-clamp": "",
869
1088
  children: t2
870
1089
  });
871
1090
  $[6] = t2;
@@ -906,6 +1125,7 @@ function LocationDisplay(t0) {
906
1125
  if ($[1] !== address) {
907
1126
  t1 = /* @__PURE__ */ jsx("span", {
908
1127
  className: Displays_module_default.text,
1128
+ "data-clamp": "",
909
1129
  children: address
910
1130
  });
911
1131
  $[1] = address;
@@ -958,10 +1178,183 @@ function LocationDisplay(t0) {
958
1178
  } else t4 = $[14];
959
1179
  return t4;
960
1180
  }
961
- /** A swatch, with the color's code. */
962
- function ColorDisplay(t0) {
963
- const $ = c(6);
1181
+ /** An address on one line, in the order of its country, after the flag of its country. */
1182
+ function AddressDisplay(t0) {
1183
+ const $ = c(17);
964
1184
  const { value } = t0;
1185
+ const intl = usePanneauIntl();
1186
+ if (!isAddress(value)) {
1187
+ let t1;
1188
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1189
+ t1 = /* @__PURE__ */ jsx(EmptyValue, {});
1190
+ $[0] = t1;
1191
+ } else t1 = $[0];
1192
+ return t1;
1193
+ }
1194
+ let t1;
1195
+ if ($[1] !== intl.locale || $[2] !== value) {
1196
+ t1 = formatAddress(value, intl.locale);
1197
+ $[1] = intl.locale;
1198
+ $[2] = value;
1199
+ $[3] = t1;
1200
+ } else t1 = $[3];
1201
+ const text = t1;
1202
+ const country = typeof value.country === "string" ? value.country : "";
1203
+ if (text === "" && !isCountryCode(country)) {
1204
+ let t2;
1205
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
1206
+ t2 = /* @__PURE__ */ jsx(EmptyValue, {});
1207
+ $[4] = t2;
1208
+ } else t2 = $[4];
1209
+ return t2;
1210
+ }
1211
+ let t2;
1212
+ if ($[5] !== country || $[6] !== intl.locale) {
1213
+ t2 = isCountryCode(country) ? /* @__PURE__ */ jsx("span", {
1214
+ className: Displays_module_default.flag,
1215
+ title: getCountryName(country, intl.locale),
1216
+ children: getCountryFlag(country)
1217
+ }) : null;
1218
+ $[5] = country;
1219
+ $[6] = intl.locale;
1220
+ $[7] = t2;
1221
+ } else t2 = $[7];
1222
+ let t3;
1223
+ if ($[8] !== country || $[9] !== intl.locale || $[10] !== text) {
1224
+ t3 = text !== "" ? text : getCountryName(country, intl.locale);
1225
+ $[8] = country;
1226
+ $[9] = intl.locale;
1227
+ $[10] = text;
1228
+ $[11] = t3;
1229
+ } else t3 = $[11];
1230
+ let t4;
1231
+ if ($[12] !== t3) {
1232
+ t4 = /* @__PURE__ */ jsx("span", {
1233
+ className: Displays_module_default.text,
1234
+ "data-clamp": "",
1235
+ children: t3
1236
+ });
1237
+ $[12] = t3;
1238
+ $[13] = t4;
1239
+ } else t4 = $[13];
1240
+ let t5;
1241
+ if ($[14] !== t2 || $[15] !== t4) {
1242
+ t5 = /* @__PURE__ */ jsxs("span", {
1243
+ className: Displays_module_default.flagged,
1244
+ children: [t2, t4]
1245
+ });
1246
+ $[14] = t2;
1247
+ $[15] = t4;
1248
+ $[16] = t5;
1249
+ } else t5 = $[16];
1250
+ return t5;
1251
+ }
1252
+ var LINK_ICONS = {
1253
+ url: Globe,
1254
+ page: FileText,
1255
+ email: Mail,
1256
+ tel: Phone,
1257
+ file: File
1258
+ };
1259
+ /**
1260
+ * A link: the icon of its type, and its label in the user's locale, or its page or its URL. It
1261
+ * opens its URL when it has one, in a new tab when the link does.
1262
+ */
1263
+ function LinkDisplay(t0) {
1264
+ const $ = c(19);
1265
+ const { value } = t0;
1266
+ const intl = usePanneauIntl();
1267
+ if (!isLink(value)) {
1268
+ let t1;
1269
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1270
+ t1 = /* @__PURE__ */ jsx(EmptyValue, {});
1271
+ $[0] = t1;
1272
+ } else t1 = $[0];
1273
+ return t1;
1274
+ }
1275
+ let t1;
1276
+ if ($[1] !== intl.locale || $[2] !== value) {
1277
+ t1 = getLinkText(value, intl.locale);
1278
+ $[1] = intl.locale;
1279
+ $[2] = value;
1280
+ $[3] = t1;
1281
+ } else t1 = $[3];
1282
+ const text = t1;
1283
+ if (text === null) {
1284
+ let t2;
1285
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
1286
+ t2 = /* @__PURE__ */ jsx(EmptyValue, {});
1287
+ $[4] = t2;
1288
+ } else t2 = $[4];
1289
+ return t2;
1290
+ }
1291
+ const t2 = LINK_ICONS[value.type] ?? Hash;
1292
+ let t3;
1293
+ if ($[5] !== t2) {
1294
+ t3 = /* @__PURE__ */ jsx(Icon, {
1295
+ icon: t2,
1296
+ size: "sm"
1297
+ });
1298
+ $[5] = t2;
1299
+ $[6] = t3;
1300
+ } else t3 = $[6];
1301
+ const icon = t3;
1302
+ const url = typeof value.url === "string" && value.url !== "" ? value.url : null;
1303
+ if (url === null) {
1304
+ let t4;
1305
+ if ($[7] !== text) {
1306
+ t4 = /* @__PURE__ */ jsx("span", {
1307
+ className: Displays_module_default.text,
1308
+ "data-clamp": "",
1309
+ children: text
1310
+ });
1311
+ $[7] = text;
1312
+ $[8] = t4;
1313
+ } else t4 = $[8];
1314
+ let t5;
1315
+ if ($[9] !== icon || $[10] !== t4) {
1316
+ t5 = /* @__PURE__ */ jsxs("span", {
1317
+ className: Displays_module_default.flagged,
1318
+ children: [icon, t4]
1319
+ });
1320
+ $[9] = icon;
1321
+ $[10] = t4;
1322
+ $[11] = t5;
1323
+ } else t5 = $[11];
1324
+ return t5;
1325
+ }
1326
+ let t4;
1327
+ if ($[12] !== value.newTab) {
1328
+ t4 = value.newTab === true ? {
1329
+ target: "_blank",
1330
+ rel: "noopener noreferrer"
1331
+ } : {};
1332
+ $[12] = value.newTab;
1333
+ $[13] = t4;
1334
+ } else t4 = $[13];
1335
+ let t5;
1336
+ if ($[14] !== icon || $[15] !== t4 || $[16] !== text || $[17] !== url) {
1337
+ t5 = /* @__PURE__ */ jsxs("a", {
1338
+ className: `${Displays_module_default.link} ${Displays_module_default.flagged}`,
1339
+ href: url,
1340
+ ...t4,
1341
+ children: [icon, text]
1342
+ });
1343
+ $[14] = icon;
1344
+ $[15] = t4;
1345
+ $[16] = text;
1346
+ $[17] = url;
1347
+ $[18] = t5;
1348
+ } else t5 = $[18];
1349
+ return t5;
1350
+ }
1351
+ /**
1352
+ * A swatch, with the color's code. A color of the field's palette (`settings.palette`) shows its
1353
+ * swatch and its label.
1354
+ */
1355
+ function ColorDisplay(t0) {
1356
+ const $ = c(18);
1357
+ const { value, field } = t0;
965
1358
  if (typeof value !== "string" || value === "") {
966
1359
  let t1;
967
1360
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -971,26 +1364,79 @@ function ColorDisplay(t0) {
971
1364
  return t1;
972
1365
  }
973
1366
  let t1;
974
- if ($[1] !== value) {
975
- t1 = /* @__PURE__ */ jsx("span", {
1367
+ if ($[1] !== field || $[2] !== value) {
1368
+ t1 = Symbol.for("react.early_return_sentinel");
1369
+ bb0: {
1370
+ const entry = getColorPalette(field)?.find((candidate) => candidate.value === value);
1371
+ if (entry !== void 0) {
1372
+ const swatch = getSwatchColor(entry);
1373
+ let t2;
1374
+ if ($[4] !== swatch) {
1375
+ t2 = swatch !== null ? { backgroundColor: swatch } : void 0;
1376
+ $[4] = swatch;
1377
+ $[5] = t2;
1378
+ } else t2 = $[5];
1379
+ let t3;
1380
+ if ($[6] !== t2) {
1381
+ t3 = /* @__PURE__ */ jsx("span", {
1382
+ className: Displays_module_default.swatch,
1383
+ style: t2,
1384
+ "aria-hidden": "true"
1385
+ });
1386
+ $[6] = t2;
1387
+ $[7] = t3;
1388
+ } else t3 = $[7];
1389
+ const t4 = entry.label ?? entry.value;
1390
+ let t5;
1391
+ if ($[8] !== t4) {
1392
+ t5 = /* @__PURE__ */ jsx("span", {
1393
+ className: Displays_module_default.text,
1394
+ "data-clamp": "",
1395
+ children: t4
1396
+ });
1397
+ $[8] = t4;
1398
+ $[9] = t5;
1399
+ } else t5 = $[9];
1400
+ let t6;
1401
+ if ($[10] !== t3 || $[11] !== t5) {
1402
+ t6 = /* @__PURE__ */ jsxs("span", {
1403
+ className: Displays_module_default.paletteColor,
1404
+ children: [t3, t5]
1405
+ });
1406
+ $[10] = t3;
1407
+ $[11] = t5;
1408
+ $[12] = t6;
1409
+ } else t6 = $[12];
1410
+ t1 = t6;
1411
+ break bb0;
1412
+ }
1413
+ }
1414
+ $[1] = field;
1415
+ $[2] = value;
1416
+ $[3] = t1;
1417
+ } else t1 = $[3];
1418
+ if (t1 !== Symbol.for("react.early_return_sentinel")) return t1;
1419
+ let t2;
1420
+ if ($[13] !== value) {
1421
+ t2 = /* @__PURE__ */ jsx("span", {
976
1422
  className: Displays_module_default.swatch,
977
1423
  style: { backgroundColor: value },
978
1424
  "aria-hidden": "true"
979
1425
  });
980
- $[1] = value;
981
- $[2] = t1;
982
- } else t1 = $[2];
983
- let t2;
984
- if ($[3] !== t1 || $[4] !== value) {
985
- t2 = /* @__PURE__ */ jsxs("span", {
1426
+ $[13] = value;
1427
+ $[14] = t2;
1428
+ } else t2 = $[14];
1429
+ let t3;
1430
+ if ($[15] !== t2 || $[16] !== value) {
1431
+ t3 = /* @__PURE__ */ jsxs("span", {
986
1432
  className: Displays_module_default.color,
987
- children: [t1, value]
1433
+ children: [t2, value]
988
1434
  });
989
- $[3] = t1;
990
- $[4] = value;
991
- $[5] = t2;
992
- } else t2 = $[5];
993
- return t2;
1435
+ $[15] = t2;
1436
+ $[16] = value;
1437
+ $[17] = t3;
1438
+ } else t3 = $[17];
1439
+ return t3;
994
1440
  }
995
1441
  /** A thumbnail and the name of a media item (or of the first one). */
996
1442
  function MediaDisplay(t0) {
@@ -1022,6 +1468,7 @@ function MediaDisplay(t0) {
1022
1468
  if ($[3] !== label) {
1023
1469
  t2 = label !== "" ? /* @__PURE__ */ jsx("span", {
1024
1470
  className: Displays_module_default.text,
1471
+ "data-clamp": "",
1025
1472
  children: label
1026
1473
  }) : null;
1027
1474
  $[3] = label;
@@ -1068,9 +1515,13 @@ var builtInDisplays = {
1068
1515
  embed: EmbedDisplay,
1069
1516
  location: LocationDisplay,
1070
1517
  country: CountryDisplay,
1071
- region: RegionDisplay
1518
+ region: RegionDisplay,
1519
+ address: AddressDisplay,
1520
+ link: LinkDisplay,
1521
+ daterange: DateRangeDisplay,
1522
+ money: MoneyDisplay
1072
1523
  };
1073
1524
  //#endregion
1074
- export { BooleanDisplay, ColorDisplay, CountryDisplay, DateDisplay, DateTimeDisplay, DurationDisplay, EmailDisplay, EmbedDisplay, EmptyValue, JsonDisplay, LocationDisplay, MediaDisplay, NumberDisplay, RegionDisplay, RelationDisplay, RichTextDisplay, SelectDisplay, TagsDisplay, TelDisplay, TextDisplay, TimeDisplay, UrlDisplay, builtInDisplays };
1525
+ export { AddressDisplay, BooleanDisplay, ColorDisplay, CountryDisplay, DateDisplay, DateRangeDisplay, DateTimeDisplay, DurationDisplay, EmailDisplay, EmbedDisplay, EmptyValue, JsonDisplay, LinkDisplay, LocationDisplay, MediaDisplay, MoneyDisplay, NumberDisplay, RegionDisplay, RelationDisplay, RichTextDisplay, SelectDisplay, TagsDisplay, TelDisplay, TextDisplay, TimeDisplay, UrlDisplay, builtInDisplays };
1075
1526
 
1076
1527
  //# sourceMappingURL=displays.js.map