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

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.
@@ -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";
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";
11
17
  import { getRegionCountry, getRegionName } from "@panneau/fields/region";
12
- import { parsePhone } from "@panneau/fields/tel";
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() {
@@ -287,6 +293,86 @@ function DateTimeDisplay(t0) {
287
293
  } else t4 = $[8];
288
294
  return t4;
289
295
  }
296
+ /**
297
+ * A range of dates (decision 0053), in the format of the locale: `Nov 4 – 6, 2026`. Date-times show
298
+ * in the zone of the value or the field, with its short name when it isn't the user's. A range open
299
+ * at one end shows `From Nov 4, 2026` or `Until Dec 1, 2026`.
300
+ */
301
+ function DateRangeDisplay(t0) {
302
+ const $ = c(8);
303
+ const { value, field } = t0;
304
+ const intl = usePanneauIntl();
305
+ let t1;
306
+ let t2;
307
+ if ($[0] !== field?.settings || $[1] !== intl || $[2] !== value) {
308
+ t2 = Symbol.for("react.early_return_sentinel");
309
+ bb0: {
310
+ const range = formatDateRange(value, intl.locale, getDateRangeSettings(field?.settings).timeZone);
311
+ if (range === null) {
312
+ let t3;
313
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
314
+ t3 = /* @__PURE__ */ jsx(EmptyValue, {});
315
+ $[5] = t3;
316
+ } else t3 = $[5];
317
+ t2 = t3;
318
+ break bb0;
319
+ }
320
+ t1 = range.kind === "from" ? intl.formatMessage(messages.rangeFrom, { start: range.text }) : range.kind === "until" ? intl.formatMessage(messages.rangeUntil, { end: range.text }) : range.text;
321
+ }
322
+ $[0] = field?.settings;
323
+ $[1] = intl;
324
+ $[2] = value;
325
+ $[3] = t1;
326
+ $[4] = t2;
327
+ } else {
328
+ t1 = $[3];
329
+ t2 = $[4];
330
+ }
331
+ if (t2 !== Symbol.for("react.early_return_sentinel")) return t2;
332
+ const text = t1;
333
+ let t3;
334
+ if ($[6] !== text) {
335
+ t3 = /* @__PURE__ */ jsx("span", {
336
+ className: Displays_module_default.text,
337
+ children: text
338
+ });
339
+ $[6] = text;
340
+ $[7] = t3;
341
+ } else t3 = $[7];
342
+ return t3;
343
+ }
344
+ /** An amount of money (decision 0053), in the currency format of the locale: `1 250,00 $`. */
345
+ function MoneyDisplay(t0) {
346
+ const $ = c(6);
347
+ const { value } = t0;
348
+ const intl = usePanneauIntl();
349
+ let t1;
350
+ if ($[0] !== intl.locale || $[1] !== value) {
351
+ t1 = formatMoney(value, intl.locale);
352
+ $[0] = intl.locale;
353
+ $[1] = value;
354
+ $[2] = t1;
355
+ } else t1 = $[2];
356
+ const text = t1;
357
+ if (text === null) {
358
+ let t2;
359
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
360
+ t2 = /* @__PURE__ */ jsx(EmptyValue, {});
361
+ $[3] = t2;
362
+ } else t2 = $[3];
363
+ return t2;
364
+ }
365
+ let t2;
366
+ if ($[4] !== text) {
367
+ t2 = /* @__PURE__ */ jsx("span", {
368
+ className: Displays_module_default.number,
369
+ children: text
370
+ });
371
+ $[4] = text;
372
+ $[5] = t2;
373
+ } else t2 = $[5];
374
+ return t2;
375
+ }
290
376
  /** A time of day (`14:30`), in the format of the locale. */
291
377
  function TimeDisplay(t0) {
292
378
  const $ = c(13);
@@ -503,11 +589,13 @@ function EmailDisplay(t0) {
503
589
  }
504
590
  /**
505
591
  * 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.
592
+ * format (`+1 514 555 0199`), with its extension (`, ext. 123`) when its field allows one
593
+ * (`settings.extension`) or the column has no field. A value that isn't E.164 shows as it is.
507
594
  */
508
595
  function TelDisplay(t0) {
509
- const $ = c(16);
510
- const { value } = t0;
596
+ const $ = c(20);
597
+ const { value, field } = t0;
598
+ const intl = usePanneauIntl();
511
599
  if (typeof value !== "string" || value.trim() === "") {
512
600
  let t1;
513
601
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -516,146 +604,209 @@ function TelDisplay(t0) {
516
604
  } else t1 = $[0];
517
605
  return t1;
518
606
  }
519
- let number;
520
607
  let t1;
521
608
  let t2;
522
609
  let t3;
523
610
  let t4;
524
- if ($[1] !== value) {
525
- t4 = Symbol.for("react.early_return_sentinel");
611
+ let t5;
612
+ if ($[1] !== field || $[2] !== intl || $[3] !== value) {
613
+ t5 = Symbol.for("react.early_return_sentinel");
526
614
  bb0: {
527
- number = parsePhone(value);
615
+ const { number: text, extension } = field === null || field.settings?.extension === true ? splitExtension(value) : {
616
+ number: value,
617
+ extension: null
618
+ };
619
+ const number = parsePhone(text);
528
620
  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", {
621
+ let t6;
622
+ if ($[9] !== value) {
623
+ let t7;
624
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
625
+ t7 = /[^\d+]/g;
626
+ $[11] = t7;
627
+ } else t7 = $[11];
628
+ t6 = value.replace(t7, "");
629
+ $[9] = value;
630
+ $[10] = t6;
631
+ } else t6 = $[10];
632
+ const t7 = `tel:${t6}`;
633
+ let t8;
634
+ if ($[12] !== t7 || $[13] !== value) {
635
+ t8 = /* @__PURE__ */ jsx("a", {
538
636
  className: Displays_module_default.link,
539
- href: t6,
637
+ href: t7,
540
638
  children: value
541
639
  });
542
- $[8] = t6;
543
- $[9] = value;
544
- $[10] = t7;
545
- } else t7 = $[10];
546
- t4 = t7;
640
+ $[12] = t7;
641
+ $[13] = value;
642
+ $[14] = t8;
643
+ } else t8 = $[14];
644
+ t5 = t8;
547
645
  break bb0;
548
646
  }
549
647
  t1 = `${Displays_module_default.link} ${Displays_module_default.flagged}`;
550
- t2 = `tel:${number.number}`;
648
+ t2 = `tel:${number.number}${extension !== null ? `;ext=${extension}` : ""}`;
551
649
  t3 = number.country !== null ? /* @__PURE__ */ jsx("span", {
552
650
  className: Displays_module_default.flag,
553
651
  "aria-hidden": "true",
554
652
  children: getCountryFlag(number.country)
555
653
  }) : null;
654
+ t4 = extension !== null ? intl.formatMessage(messages.phoneExtension, {
655
+ number: number.international,
656
+ extension
657
+ }) : number.international;
556
658
  }
557
- $[1] = value;
558
- $[2] = number;
559
- $[3] = t1;
560
- $[4] = t2;
561
- $[5] = t3;
562
- $[6] = t4;
659
+ $[1] = field;
660
+ $[2] = intl;
661
+ $[3] = value;
662
+ $[4] = t1;
663
+ $[5] = t2;
664
+ $[6] = t3;
665
+ $[7] = t4;
666
+ $[8] = t5;
563
667
  } else {
564
- number = $[2];
565
- t1 = $[3];
566
- t2 = $[4];
567
- t3 = $[5];
568
- t4 = $[6];
668
+ t1 = $[4];
669
+ t2 = $[5];
670
+ t3 = $[6];
671
+ t4 = $[7];
672
+ t5 = $[8];
569
673
  }
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", {
674
+ if (t5 !== Symbol.for("react.early_return_sentinel")) return t5;
675
+ let t6;
676
+ if ($[15] !== t1 || $[16] !== t2 || $[17] !== t3 || $[18] !== t4) {
677
+ t6 = /* @__PURE__ */ jsxs("a", {
574
678
  className: t1,
575
679
  href: t2,
576
- children: [t3, number.international]
680
+ children: [t3, t4]
577
681
  });
578
- $[11] = number.international;
579
- $[12] = t1;
580
- $[13] = t2;
581
- $[14] = t3;
582
- $[15] = t5;
583
- } else t5 = $[15];
584
- return t5;
682
+ $[15] = t1;
683
+ $[16] = t2;
684
+ $[17] = t3;
685
+ $[18] = t4;
686
+ $[19] = t6;
687
+ } else t6 = $[19];
688
+ return t6;
585
689
  }
586
690
  /** A country: its flag and its name in the user's locale. */
587
- function CountryDisplay(t0) {
588
- const $ = c(15);
589
- const { value } = t0;
691
+ function Country(t0) {
692
+ const $ = c(14);
693
+ const { code } = t0;
590
694
  const intl = usePanneauIntl();
591
- if (typeof value !== "string" || value === "") {
695
+ if (!isCountryCode(code)) {
592
696
  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)) {
600
- let t1;
601
- if ($[1] !== value) {
697
+ if ($[0] !== code) {
602
698
  t1 = /* @__PURE__ */ jsx("span", {
603
699
  className: Displays_module_default.text,
604
- children: value
700
+ children: code
605
701
  });
606
- $[1] = value;
607
- $[2] = t1;
608
- } else t1 = $[2];
702
+ $[0] = code;
703
+ $[1] = t1;
704
+ } else t1 = $[1];
609
705
  return t1;
610
706
  }
611
707
  let t1;
612
- if ($[3] !== value) {
613
- t1 = getCountryFlag(value);
614
- $[3] = value;
615
- $[4] = t1;
616
- } else t1 = $[4];
708
+ if ($[2] !== code) {
709
+ t1 = getCountryFlag(code);
710
+ $[2] = code;
711
+ $[3] = t1;
712
+ } else t1 = $[3];
617
713
  let t2;
618
- if ($[5] !== t1) {
714
+ if ($[4] !== t1) {
619
715
  t2 = /* @__PURE__ */ jsx("span", {
620
716
  className: Displays_module_default.flag,
621
717
  "aria-hidden": "true",
622
718
  children: t1
623
719
  });
624
- $[5] = t1;
625
- $[6] = t2;
626
- } else t2 = $[6];
720
+ $[4] = t1;
721
+ $[5] = t2;
722
+ } else t2 = $[5];
627
723
  let t3;
628
- if ($[7] !== intl.locale || $[8] !== value) {
629
- t3 = getCountryName(value, intl.locale);
724
+ if ($[6] !== code || $[7] !== intl.locale) {
725
+ t3 = getCountryName(code, intl.locale);
726
+ $[6] = code;
630
727
  $[7] = intl.locale;
631
- $[8] = value;
632
- $[9] = t3;
633
- } else t3 = $[9];
728
+ $[8] = t3;
729
+ } else t3 = $[8];
634
730
  let t4;
635
- if ($[10] !== t3) {
731
+ if ($[9] !== t3) {
636
732
  t4 = /* @__PURE__ */ jsx("span", {
637
733
  className: Displays_module_default.text,
638
734
  children: t3
639
735
  });
640
- $[10] = t3;
641
- $[11] = t4;
642
- } else t4 = $[11];
736
+ $[9] = t3;
737
+ $[10] = t4;
738
+ } else t4 = $[10];
643
739
  let t5;
644
- if ($[12] !== t2 || $[13] !== t4) {
740
+ if ($[11] !== t2 || $[12] !== t4) {
645
741
  t5 = /* @__PURE__ */ jsxs("span", {
646
742
  className: Displays_module_default.flagged,
647
743
  children: [t2, t4]
648
744
  });
649
- $[12] = t2;
650
- $[13] = t4;
651
- $[14] = t5;
652
- } else t5 = $[14];
745
+ $[11] = t2;
746
+ $[12] = t4;
747
+ $[13] = t5;
748
+ } else t5 = $[13];
653
749
  return t5;
654
750
  }
751
+ /** A country, or several (`multiple`): their flags and their names in the user's locale. */
752
+ function CountryDisplay(t0) {
753
+ const $ = c(8);
754
+ const { value } = t0;
755
+ let t1;
756
+ let t2;
757
+ let t3;
758
+ if ($[0] !== value) {
759
+ t3 = Symbol.for("react.early_return_sentinel");
760
+ bb0: {
761
+ const codes = (Array.isArray(value) ? value : [value]).filter(_temp2);
762
+ if (codes.length === 0) {
763
+ let t4;
764
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
765
+ t4 = /* @__PURE__ */ jsx(EmptyValue, {});
766
+ $[4] = t4;
767
+ } else t4 = $[4];
768
+ t3 = t4;
769
+ break bb0;
770
+ }
771
+ if (codes.length === 1) {
772
+ t3 = /* @__PURE__ */ jsx(Country, { code: codes[0] });
773
+ break bb0;
774
+ }
775
+ t1 = Displays_module_default.countries;
776
+ t2 = codes.map(_temp3);
777
+ }
778
+ $[0] = value;
779
+ $[1] = t1;
780
+ $[2] = t2;
781
+ $[3] = t3;
782
+ } else {
783
+ t1 = $[1];
784
+ t2 = $[2];
785
+ t3 = $[3];
786
+ }
787
+ if (t3 !== Symbol.for("react.early_return_sentinel")) return t3;
788
+ let t4;
789
+ if ($[5] !== t1 || $[6] !== t2) {
790
+ t4 = /* @__PURE__ */ jsx("span", {
791
+ className: t1,
792
+ children: t2
793
+ });
794
+ $[5] = t1;
795
+ $[6] = t2;
796
+ $[7] = t4;
797
+ } else t4 = $[7];
798
+ return t4;
799
+ }
655
800
  /**
656
801
  * A region: its name in the user's locale, from its country in the item (the field's `from`) or
657
802
  * the field's settings. A region that Panneau doesn't know shows as it is.
658
803
  */
804
+ function _temp3(code_0) {
805
+ return /* @__PURE__ */ jsx(Country, { code: code_0 }, code_0);
806
+ }
807
+ function _temp2(code) {
808
+ return typeof code === "string" && code !== "";
809
+ }
659
810
  function RegionDisplay(t0) {
660
811
  const $ = c(10);
661
812
  const { value, field, item } = t0;
@@ -696,10 +847,14 @@ function RegionDisplay(t0) {
696
847
  } else t3 = $[9];
697
848
  return t3;
698
849
  }
699
- /** A duration in seconds, with its units: `1 h 5 min`, to the precision of its field. */
850
+ /**
851
+ * A duration with its units, `1 h 5 min` or `2 d 4 h`: in the unit of its field (seconds by
852
+ * default), from its largest unit to its precision.
853
+ */
700
854
  function DurationDisplay(t0) {
701
- const $ = c(6);
855
+ const $ = c(9);
702
856
  const { value, field } = t0;
857
+ const intl = usePanneauIntl();
703
858
  if (typeof value !== "number" || Number.isNaN(value)) {
704
859
  let t1;
705
860
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -708,24 +863,41 @@ function DurationDisplay(t0) {
708
863
  } else t1 = $[0];
709
864
  return t1;
710
865
  }
711
- const precision = field?.settings?.precision === "minutes" ? "minutes" : "seconds";
712
866
  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
867
  let t2;
720
- if ($[4] !== t1) {
721
- t2 = /* @__PURE__ */ jsx("span", {
722
- className: Displays_module_default.number,
723
- children: t1
868
+ if ($[1] !== field || $[2] !== intl || $[3] !== value) {
869
+ const labels = {
870
+ days: intl.formatMessage(fieldsMessages.daysUnit),
871
+ hours: intl.formatMessage(fieldsMessages.hoursUnit),
872
+ minutes: intl.formatMessage(fieldsMessages.minutesUnit),
873
+ seconds: intl.formatMessage(fieldsMessages.secondsUnit)
874
+ };
875
+ const units = field !== null ? getDurationUnits(field) : {};
876
+ t1 = Displays_module_default.number;
877
+ t2 = formatDuration(value, {
878
+ ...units,
879
+ labels
724
880
  });
881
+ $[1] = field;
882
+ $[2] = intl;
883
+ $[3] = value;
725
884
  $[4] = t1;
726
885
  $[5] = t2;
727
- } else t2 = $[5];
728
- return t2;
886
+ } else {
887
+ t1 = $[4];
888
+ t2 = $[5];
889
+ }
890
+ let t3;
891
+ if ($[6] !== t1 || $[7] !== t2) {
892
+ t3 = /* @__PURE__ */ jsx("span", {
893
+ className: t1,
894
+ children: t2
895
+ });
896
+ $[6] = t1;
897
+ $[7] = t2;
898
+ $[8] = t3;
899
+ } else t3 = $[8];
900
+ return t3;
729
901
  }
730
902
  /** JSON on one line, shortened. */
731
903
  function JsonDisplay(t0) {
@@ -780,7 +952,7 @@ function TagsDisplay(t0) {
780
952
  if ($[0] !== field?.options || $[1] !== value) {
781
953
  t3 = Symbol.for("react.early_return_sentinel");
782
954
  bb0: {
783
- const tags = Array.isArray(value) ? value.filter(_temp2) : [];
955
+ const tags = Array.isArray(value) ? value.filter(_temp4) : [];
784
956
  if (tags.length === 0) {
785
957
  let t4;
786
958
  if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
@@ -830,7 +1002,7 @@ function TagsDisplay(t0) {
830
1002
  return t4;
831
1003
  }
832
1004
  /** What a URL embeds: its thumbnail and title, linked to it. */
833
- function _temp2(tag) {
1005
+ function _temp4(tag) {
834
1006
  return typeof tag === "string";
835
1007
  }
836
1008
  function EmbedDisplay(t0) {
@@ -958,10 +1130,181 @@ function LocationDisplay(t0) {
958
1130
  } else t4 = $[14];
959
1131
  return t4;
960
1132
  }
961
- /** A swatch, with the color's code. */
962
- function ColorDisplay(t0) {
963
- const $ = c(6);
1133
+ /** An address on one line, in the order of its country, after the flag of its country. */
1134
+ function AddressDisplay(t0) {
1135
+ const $ = c(17);
964
1136
  const { value } = t0;
1137
+ const intl = usePanneauIntl();
1138
+ if (!isAddress(value)) {
1139
+ let t1;
1140
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1141
+ t1 = /* @__PURE__ */ jsx(EmptyValue, {});
1142
+ $[0] = t1;
1143
+ } else t1 = $[0];
1144
+ return t1;
1145
+ }
1146
+ let t1;
1147
+ if ($[1] !== intl.locale || $[2] !== value) {
1148
+ t1 = formatAddress(value, intl.locale);
1149
+ $[1] = intl.locale;
1150
+ $[2] = value;
1151
+ $[3] = t1;
1152
+ } else t1 = $[3];
1153
+ const text = t1;
1154
+ const country = typeof value.country === "string" ? value.country : "";
1155
+ if (text === "" && !isCountryCode(country)) {
1156
+ let t2;
1157
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
1158
+ t2 = /* @__PURE__ */ jsx(EmptyValue, {});
1159
+ $[4] = t2;
1160
+ } else t2 = $[4];
1161
+ return t2;
1162
+ }
1163
+ let t2;
1164
+ if ($[5] !== country || $[6] !== intl.locale) {
1165
+ t2 = isCountryCode(country) ? /* @__PURE__ */ jsx("span", {
1166
+ className: Displays_module_default.flag,
1167
+ title: getCountryName(country, intl.locale),
1168
+ children: getCountryFlag(country)
1169
+ }) : null;
1170
+ $[5] = country;
1171
+ $[6] = intl.locale;
1172
+ $[7] = t2;
1173
+ } else t2 = $[7];
1174
+ let t3;
1175
+ if ($[8] !== country || $[9] !== intl.locale || $[10] !== text) {
1176
+ t3 = text !== "" ? text : getCountryName(country, intl.locale);
1177
+ $[8] = country;
1178
+ $[9] = intl.locale;
1179
+ $[10] = text;
1180
+ $[11] = t3;
1181
+ } else t3 = $[11];
1182
+ let t4;
1183
+ if ($[12] !== t3) {
1184
+ t4 = /* @__PURE__ */ jsx("span", {
1185
+ className: Displays_module_default.text,
1186
+ children: t3
1187
+ });
1188
+ $[12] = t3;
1189
+ $[13] = t4;
1190
+ } else t4 = $[13];
1191
+ let t5;
1192
+ if ($[14] !== t2 || $[15] !== t4) {
1193
+ t5 = /* @__PURE__ */ jsxs("span", {
1194
+ className: Displays_module_default.flagged,
1195
+ children: [t2, t4]
1196
+ });
1197
+ $[14] = t2;
1198
+ $[15] = t4;
1199
+ $[16] = t5;
1200
+ } else t5 = $[16];
1201
+ return t5;
1202
+ }
1203
+ var LINK_ICONS = {
1204
+ url: Globe,
1205
+ page: FileText,
1206
+ email: Mail,
1207
+ tel: Phone,
1208
+ file: File
1209
+ };
1210
+ /**
1211
+ * A link: the icon of its type, and its label in the user's locale, or its page or its URL. It
1212
+ * opens its URL when it has one, in a new tab when the link does.
1213
+ */
1214
+ function LinkDisplay(t0) {
1215
+ const $ = c(19);
1216
+ const { value } = t0;
1217
+ const intl = usePanneauIntl();
1218
+ if (!isLink(value)) {
1219
+ let t1;
1220
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1221
+ t1 = /* @__PURE__ */ jsx(EmptyValue, {});
1222
+ $[0] = t1;
1223
+ } else t1 = $[0];
1224
+ return t1;
1225
+ }
1226
+ let t1;
1227
+ if ($[1] !== intl.locale || $[2] !== value) {
1228
+ t1 = getLinkText(value, intl.locale);
1229
+ $[1] = intl.locale;
1230
+ $[2] = value;
1231
+ $[3] = t1;
1232
+ } else t1 = $[3];
1233
+ const text = t1;
1234
+ if (text === null) {
1235
+ let t2;
1236
+ if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
1237
+ t2 = /* @__PURE__ */ jsx(EmptyValue, {});
1238
+ $[4] = t2;
1239
+ } else t2 = $[4];
1240
+ return t2;
1241
+ }
1242
+ const t2 = LINK_ICONS[value.type] ?? Hash;
1243
+ let t3;
1244
+ if ($[5] !== t2) {
1245
+ t3 = /* @__PURE__ */ jsx(Icon, {
1246
+ icon: t2,
1247
+ size: "sm"
1248
+ });
1249
+ $[5] = t2;
1250
+ $[6] = t3;
1251
+ } else t3 = $[6];
1252
+ const icon = t3;
1253
+ const url = typeof value.url === "string" && value.url !== "" ? value.url : null;
1254
+ if (url === null) {
1255
+ let t4;
1256
+ if ($[7] !== text) {
1257
+ t4 = /* @__PURE__ */ jsx("span", {
1258
+ className: Displays_module_default.text,
1259
+ children: text
1260
+ });
1261
+ $[7] = text;
1262
+ $[8] = t4;
1263
+ } else t4 = $[8];
1264
+ let t5;
1265
+ if ($[9] !== icon || $[10] !== t4) {
1266
+ t5 = /* @__PURE__ */ jsxs("span", {
1267
+ className: Displays_module_default.flagged,
1268
+ children: [icon, t4]
1269
+ });
1270
+ $[9] = icon;
1271
+ $[10] = t4;
1272
+ $[11] = t5;
1273
+ } else t5 = $[11];
1274
+ return t5;
1275
+ }
1276
+ let t4;
1277
+ if ($[12] !== value.newTab) {
1278
+ t4 = value.newTab === true ? {
1279
+ target: "_blank",
1280
+ rel: "noopener noreferrer"
1281
+ } : {};
1282
+ $[12] = value.newTab;
1283
+ $[13] = t4;
1284
+ } else t4 = $[13];
1285
+ let t5;
1286
+ if ($[14] !== icon || $[15] !== t4 || $[16] !== text || $[17] !== url) {
1287
+ t5 = /* @__PURE__ */ jsxs("a", {
1288
+ className: `${Displays_module_default.link} ${Displays_module_default.flagged}`,
1289
+ href: url,
1290
+ ...t4,
1291
+ children: [icon, text]
1292
+ });
1293
+ $[14] = icon;
1294
+ $[15] = t4;
1295
+ $[16] = text;
1296
+ $[17] = url;
1297
+ $[18] = t5;
1298
+ } else t5 = $[18];
1299
+ return t5;
1300
+ }
1301
+ /**
1302
+ * A swatch, with the color's code. A color of the field's palette (`settings.palette`) shows its
1303
+ * swatch and its label.
1304
+ */
1305
+ function ColorDisplay(t0) {
1306
+ const $ = c(18);
1307
+ const { value, field } = t0;
965
1308
  if (typeof value !== "string" || value === "") {
966
1309
  let t1;
967
1310
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
@@ -971,26 +1314,78 @@ function ColorDisplay(t0) {
971
1314
  return t1;
972
1315
  }
973
1316
  let t1;
974
- if ($[1] !== value) {
975
- t1 = /* @__PURE__ */ jsx("span", {
1317
+ if ($[1] !== field || $[2] !== value) {
1318
+ t1 = Symbol.for("react.early_return_sentinel");
1319
+ bb0: {
1320
+ const entry = getColorPalette(field)?.find((candidate) => candidate.value === value);
1321
+ if (entry !== void 0) {
1322
+ const swatch = getSwatchColor(entry);
1323
+ let t2;
1324
+ if ($[4] !== swatch) {
1325
+ t2 = swatch !== null ? { backgroundColor: swatch } : void 0;
1326
+ $[4] = swatch;
1327
+ $[5] = t2;
1328
+ } else t2 = $[5];
1329
+ let t3;
1330
+ if ($[6] !== t2) {
1331
+ t3 = /* @__PURE__ */ jsx("span", {
1332
+ className: Displays_module_default.swatch,
1333
+ style: t2,
1334
+ "aria-hidden": "true"
1335
+ });
1336
+ $[6] = t2;
1337
+ $[7] = t3;
1338
+ } else t3 = $[7];
1339
+ const t4 = entry.label ?? entry.value;
1340
+ let t5;
1341
+ if ($[8] !== t4) {
1342
+ t5 = /* @__PURE__ */ jsx("span", {
1343
+ className: Displays_module_default.text,
1344
+ children: t4
1345
+ });
1346
+ $[8] = t4;
1347
+ $[9] = t5;
1348
+ } else t5 = $[9];
1349
+ let t6;
1350
+ if ($[10] !== t3 || $[11] !== t5) {
1351
+ t6 = /* @__PURE__ */ jsxs("span", {
1352
+ className: Displays_module_default.paletteColor,
1353
+ children: [t3, t5]
1354
+ });
1355
+ $[10] = t3;
1356
+ $[11] = t5;
1357
+ $[12] = t6;
1358
+ } else t6 = $[12];
1359
+ t1 = t6;
1360
+ break bb0;
1361
+ }
1362
+ }
1363
+ $[1] = field;
1364
+ $[2] = value;
1365
+ $[3] = t1;
1366
+ } else t1 = $[3];
1367
+ if (t1 !== Symbol.for("react.early_return_sentinel")) return t1;
1368
+ let t2;
1369
+ if ($[13] !== value) {
1370
+ t2 = /* @__PURE__ */ jsx("span", {
976
1371
  className: Displays_module_default.swatch,
977
1372
  style: { backgroundColor: value },
978
1373
  "aria-hidden": "true"
979
1374
  });
980
- $[1] = value;
981
- $[2] = t1;
982
- } else t1 = $[2];
983
- let t2;
984
- if ($[3] !== t1 || $[4] !== value) {
985
- t2 = /* @__PURE__ */ jsxs("span", {
1375
+ $[13] = value;
1376
+ $[14] = t2;
1377
+ } else t2 = $[14];
1378
+ let t3;
1379
+ if ($[15] !== t2 || $[16] !== value) {
1380
+ t3 = /* @__PURE__ */ jsxs("span", {
986
1381
  className: Displays_module_default.color,
987
- children: [t1, value]
1382
+ children: [t2, value]
988
1383
  });
989
- $[3] = t1;
990
- $[4] = value;
991
- $[5] = t2;
992
- } else t2 = $[5];
993
- return t2;
1384
+ $[15] = t2;
1385
+ $[16] = value;
1386
+ $[17] = t3;
1387
+ } else t3 = $[17];
1388
+ return t3;
994
1389
  }
995
1390
  /** A thumbnail and the name of a media item (or of the first one). */
996
1391
  function MediaDisplay(t0) {
@@ -1068,9 +1463,13 @@ var builtInDisplays = {
1068
1463
  embed: EmbedDisplay,
1069
1464
  location: LocationDisplay,
1070
1465
  country: CountryDisplay,
1071
- region: RegionDisplay
1466
+ region: RegionDisplay,
1467
+ address: AddressDisplay,
1468
+ link: LinkDisplay,
1469
+ daterange: DateRangeDisplay,
1470
+ money: MoneyDisplay
1072
1471
  };
1073
1472
  //#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 };
1473
+ 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
1474
 
1076
1475
  //# sourceMappingURL=displays.js.map